# Perform the modified Euler's Method given a point and a stepsize

Consider the following ODE

$$\dfrac{dy}{dx} = -\dfrac{2x}{y}~~~~\text{where}~~~~y(0)=1$$

Given that $y(0.7)=0.141421$ to $6$ digit precision, use the modified Euler's method to estimate $y(0.8)$ using $h=0.1$ and work to $5$ digit precision.

How do I do this? I can do it from scratch, but given $y(0.7)$ is throwing me off for some reason.

Thanks in advance for any help!

Given the ODE $y'=f(x,y)$ then Euler's method says $y(x_{n+1})=y(x_n)+h\cdot f(x_n,y(x_n))$ where in your case $f(x,y) = -\frac{2x}{y}$, $x_{n+1}=0.8$, $x_n=0.7$ and $h=x_{n+1}−x_n=0.1$. The modified Euler's method says $$y(x_{n+1}) = y(x_n) + \frac{h}{2}\cdot[f(x_n,y(x_n)) + f(x_{n+1},\tilde{y}(x_{n+1})) ]$$ where $ỹ (x_{n+1})=y(x_n)+h\cdot f(x_n,y(x_n))$ is the value you would get using Euler's method. It's just to plug in and compute all the terms here (and do the computations to the given precision).
The analytical solution to the ODE is $y(x) = \sqrt{1-2x^2}$ and $y(0.7)$ is in fact $0.141421$ to $6$ significant digits. It's just provided to allow you to perform the method from $x=0.7$. The reason $x=0.7$ is choosen is probably since the analytical solution does not exist (as a real function) for $x>0.707$ so the values you obtain using Euler's vs modified Euler's will likely be very different (and both wrong in this case).
• @RBadger I get something similar $-0.25928$ when working to 5 digit precision (but I did it very fast so might have made some mistakes) – Winther Mar 3 '18 at 16:48