New algorithms for numerical integration and ODE solutions
03-14-2014, 10:40 PM
Post: #2
 Dan W Junior Member Posts: 4 Joined: Dec 2013
RE: New algorithms for numerical integration and ODE solutions
Hi Namir

h = 2 * |YMaxDelta / f’(X1)|

When I used the function EXP(-X)*(SIN(X))^2, this function evaluates to zero at x=0, and also the derivative is zero at x=0. This should cause the equation for h to blow up.

It doesn't in your example because your MyDx function is an approximation. However if an improved MyDx function is used that generates a number much closer to zero, h ends up being very large.

In this case the next DO loop evaluates the function at a large X2, which coincidentally is also close to zero causing it to exit the DO.

I think some protection on h near zero slope and when the slope is rapidly changing would be a valuable improvement.
 « Next Oldest | Next Newest »

 Messages In This Thread New algorithms for numerical integration and ODE solutions - Namir - 03-13-2014, 10:44 AM RE: New algorithms for numerical integration and ODE solutions - Dan W - 03-14-2014 10:40 PM RE: New algorithms for numerical integration and ODE solutions - Namir - 03-15-2014, 12:40 AM RE: New algorithms for numerical integration and ODE solutions - Namir - 03-15-2014, 03:37 PM RE: New algorithms for numerical integration and ODE solutions - Dan W - 03-15-2014, 06:31 PM RE: New algorithms for numerical integration and ODE solutions - Namir - 03-21-2014, 10:39 PM RE: New algorithms for numerical integration and ODE solutions - Namir - 03-26-2014, 02:44 PM RE: New algorithms for numerical integration and ODE solutions - Wes Loewer - 03-26-2014, 07:29 PM RE: New algorithms for numerical integration and ODE solutions - Namir - 03-26-2014, 09:26 PM RE: New algorithms for numerical integration and ODE solutions - Wes Loewer - 03-27-2014, 04:15 AM RE: New algorithms for numerical integration and ODE solutions - Namir - 03-27-2014, 01:06 PM RE: New algorithms for numerical integration and ODE solutions - Namir - 03-27-2014, 03:29 PM

User(s) browsing this thread: 1 Guest(s)