Given dy/dx = y-x,where y(0) = 2, find y(0.1) and y(0.2) by Euler’s method up to two decimal places.
Solution
Euler method is a numerical procedure for solving ordinary differential equations with a given initial value.
For
y’(x) = f(x,y(x)), y(x0)=y0
the size of every step h and xn = x0+n*h an approximation of the solution to the ODE is
yn+1 = yn + h*f(xn,yn)
In this case x0 = 0, y0 = 2, f(x,y) = y – x, h = 0.1
So
yn+1 = yn + h*(yn – xn ) = (1 + h)*yn – h*xn
y1 = y(0.1) = 2.2, y2 = y(0.2) = 2.41
Answer
y(0.1) = 2.2, y(0.2) = 2.41
Comments
Leave a comment