Use Euler’s method with h = 0.25 to obtain a numerical solution of
dy/
dx= −xy2
subject to y(0) = 2, giving approximate values of y for 0 "\\leq" x "\\geq" 1. Work throughout
to three decimal places and determine the exact solution for comparison.
Solution
Exact solution of DE: dy/y2 = -xdx => -1/y = -x2/2-C => y = 2/(x2+2C)
y(0) = 2 => 2 = 2/(0+2C) => C = ½ => y(x) = 2/( x2+1)
For the first-order differential equation with the initial value
y’(x) = F(x,y y(x)), y(x0) = y0
according to the Euler method
yn+1 = yn + h*F(xn, yn)
where h – step, xn = h*n, yn = y(xn), n = 0,1,2…N
In this case F(x,y) = -xy2 , h = 0.25 , x0 = 0 , y0 = 2.
Calculations gives such results (last column is the exact solution):
n xn yn y(xn)
0 0 2 2
1 0.25 2 1.882
2 0.5 1.75 1.6
3 0.75 1.367 1.28
4 1 1.017 1
Comments
Ok
Leave a comment