# Euler's improved method with subroutines

• July 12th 2009, 10:40 AM
diddledabble
Euler's improved method with subroutines
How do you use the improved Euler's method subroutine with step size h=0.2 to approximate the solution to the initial value problem:
y'= (1/x)(y^2+y)
at points x= 1.2, 1.4, 1.6, 1.8 and N=4

My book shows the "improved" method just like the original and I want to see an example and know how it is improved or different from the original.
• July 12th 2009, 10:58 PM
CaptainBlack
Quote:

Originally Posted by diddledabble
How do you use the improved Euler's method subroutine with step size h=0.2 to approximate the solution to the initial value problem:
y'= (1/x)(y^2+y)
at points x= 1.2, 1.4, 1.6, 1.8 and N=4

My book shows the "improved" method just like the original and I want to see an example and know how it is improved or different from the original.

We don't know what you are refering to by subroutines, there is an implication that you are coding this in Fortran but you do not say so.

Also you cannot do this without stating the initial conditions.

By the "improved Euler" method you are refering to the first order predictor corrector method also known as Heun's method.

This tentativly steps forward using the Euler step:

$y_1(t+h)=y(t)+h\; y'(t,y)$

Then refines the derivative estimate to:

$y'_1=[y'(t,y)+y'(t,y_1(t+h)]/2$

and then the final estimate uses an Euler step using the refined derivative estimate:

$
y(t+h)=y(t)+h\; y'_1
$

CB
• July 13th 2009, 07:11 AM
HallsofIvy
So if the subroutine you are talking about the one that evaluates f(x,y), it may be that the only noticeable difference is that the routine is calling that subroutine twice.
• July 13th 2009, 12:00 PM
diddledabble
Clarification
It is not for Fortran it is just a simple pencil/paper exercise. I think the wording of subroutine is a little misleading but that is what my book says. Maybe just an example of how to use the improved Euler's method for the problem would be more appropriate.