Consider the equation dz/dx = -z^2 given z(0)=1 and delta x = .25, computer z(0.25) and z(.5). Using Euler's method compare to the exact solution z= 1/(1-x)

solve the above question using Euler's improved method, compare to the exact solution

Here is what I get. I am not in a diffiq class, this is a computer methods course. Nor have I ever taken diffiq.

My answer for the first part.

x z actual error

0 1 1 0

0.25 0.75 1.333333333 43.75%

0.5 0.609375 2 69.53%

So as you can see, my error is way off.

How I found z was z1 + .25 * -z1^2

so z3 would be z2 + .25 * -z2^2

Is that correct?

Here is what I get from the improved method, and this seems to be rather screwed up.

x f est 1 y est 1 f est 2 yest 2 actual error

0 1 1 0 1 1

0.25 -0.0625 1.000976563 -0.062530518 1.000978 1.333333 0.249267

0.5 0.015625 1.001038552 -0.117317319 1.004418 2 0.497791

f est 1 = -x^2 * y est 2

y est 1 = y est 2 + (.25* f est 1^2)

f est 2 = f est 1 - (x^2 * y est 1)/2

y est 2 = y est 2 +(.25 *(f est 2^2))

Those are the equations I am getting the numbers from.

thanks