Suppose that we use Euler's method to approximate the solution to the differential equation dy/dx = x^2y; y(0.3) = 5. Let f(x,y) = x^2/y. We let x0 = 0.3 and y0 = 5, and pick a step size h = 0.2. Euler's method is the following algorithm. From xn and yn, our approximations to the solution of the differential equation at the nth stage, we find the next stage by computing xn+1 = xn + h, yn+1 = yn + h*f(xn,yn).
Complete the following table:
n | xn | yn
0 | 0.3 | 5
1 | 0.5 | 5.2
2 | 0.7 | 5.48
3 | 0.9 | 5.832
4 | 1.1 | 6.28
5 | 1.3 | 6.832
The exact solution can also be found using separation of variables. It is y(x) = x^3/10 + 5/3. Thus the actual value of the function at the point x = 1.3 is y(1.3) = 1.3^3/10 + 5/3.