Go to Post Geekier than me? That's a goal you can shoot for. You might make it, too -- in twenty years or so. :cool: - Richard Wallace [more]
Home
Go Back   Chief Delphi > Other > Math and Science
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Spotlight this post!  
Unread 15-05-2013, 12:56
Michael Hill's Avatar
Michael Hill Michael Hill is offline
Registered User
FRC #3138 (Innovators Robotics)
Team Role: Mentor
 
Join Date: Jul 2004
Rookie Year: 2003
Location: Dayton, OH
Posts: 1,567
Michael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond reputeMichael Hill has a reputation beyond repute
Re: numerical computation challenge

I think I solved it....

I got 0.536594(7|8)
My strategy was to use the fact that it was symmetric about x=y.

I took the initial y=... function and rotated it by pi/4 (45 degrees) using the transformation matrix:
Code:
[y']   [cos(pi/4)  sin(pi/4)] [y]
[  ] = [                    ] [ ]
[x']   [cos(pi/4) -sin(pi/4)] [x]
That allows me to essentially take the integral above the new y' and simply multiply it by 2. I used MATLAB to get it.

Code:
clear

xmin = eval(evalin(symengine, 'numeric::solve(0==y-10*log(y+1)/exp(y+1), y=-0.5..0.5)'));
xmax = eval(evalin(symengine, 'numeric::solve(0==y-10*log(y+1)/exp(y+1), y=0.5..2)'));

error = 1;
stepsize = 3000000;
prevsum = 0;
while (abs(error > 0.000000001))
    stepsize = stepsize + 10000;
    th = pi/4
    x0min = xmin;
    x0max = xmax;
    y0min = xmin;
    y0max = xmax;

    x0 = linspace(x0min,x0max,stepsize);
    y0 = linspace(y0min,y0max,stepsize);
    y = 10*log(x0+1)./exp(x0+1);
    x = 10*log(y0+1)./exp(y0+1);
    xp = x*cos(th) + y0*sin(th);
    yp = y*cos(th) - x0*sin(th);
    xp0 = x/cos(th);
    plot(x0,y,x,y0,xp,yp);
    axis equal
    axis square
    grid on
    sum = 0;
    for i=1:stepsize-1
        sum = sum + (xp0(i+1)-xp0(i))*yp(i);
    end
    sum = sum*2;
    error = sum - prevsum;
    disp('step size');
    disp(stepsize);
    disp('sum');
    disp(sum);
    disp('error');
    disp(error);
end

Last edited by Michael Hill : 15-05-2013 at 12:59.
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 12:23.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi