So far we have learnt how to solve by means of direction field and we learnt how to solve analytically some kinds of DE.
Not all differential equations can be solved analytically and we might obtain satisfying results by numerical solution. The most simple method is Euler's method.
This method is not accurate, but its principle is obvious. For its inaccuracy is not practically used. There exist software, which use Runge-Kutta methods.
In numerical solutions, it is usually desirable to construct a table in which all relevant computations are systematically recorded.
Solve DE $y'=x^2 + y$ for initial condition y(0) = 1: find solution by Euler's method at
with steps
and compare with algebraic solution $y = 3e^x -x^2 -2x-2$.
A. Solved with step $h = \Delta x_n = 0.1$:
Numerical method | Algebraic m. | ||||||
---|---|---|---|---|---|---|---|
$x_n$ | $y_n$ | $y'(x_n,y_n)$ | $\times$ | $\Delta x_n$ | $=$ | $\Delta y_n$ | $y_n$ |
0 | 1 | 1 | 0.1 | 0.1 | |||
0.1 | 1.1 | 1.11 | 0.1 | 0.111 | 1.1055 | ||
0.2 | 1.211 | 1.251 | 0.1 | 0.1251 | 1.2242 | ||
0.3 | 1.336 | 1.3596 |
B. Solved with step $h = \Delta x_n = 0.05$:
Numerical method | Algebraic m. | ||||||
---|---|---|---|---|---|---|---|
$x_n$ | $y_n$ | $y'(x_n,y_n)$ | $\times$ | $\Delta x_n$ | $=$ | $\Delta y_n$ | $y_n$ |
0 | 1 | 1 | 0.05 | 0.05 | |||
0.05 | 1.05 | 1.0525 | 0.05 | 0.05263 | |||
0.1 | 1.1026 | 1.1126 | 0.05 | 0.0556 | 1.1055 | ||
0.15 | 1.1582 | 1.1807 | 0.05 | 0.0590 | |||
0.2 | 1.2172 | 1.2572 | 0.05 | 0.0629 | 1.2242 | ||
0.25 | 1.2801 | 1.3426 | 0.05 | 0.0671 | |||
0.3 | 1.3472 | 1.3596 |
In general the accuracy of the method increases as the step $h$ decreases. But not indefinitely: if the step is too small, rounding errors come into play.