Numerical methods for solving differential equations

Given the boudary-value problem

\displaystyle dy/dx = f(x, y)\ \ \ y(x_0) = y_0\ \ \ (1)

it may not be possible to obtain an exact solution. In such case various methods are available for obtaining an approximate or numerical solution. In the following we list several methods.

  1. Step by step or Euler method
  2. Taylor series method
  3. Picard’s method
  4. Runge-Kutta method

1. Step by step or Euler method

In this method we replace the differential equation of (1) by the approximation

\displaystyle \frac{y(x_0 + h)-y(x_0)}{h} = f(x_0, y_0)\ \ \ (2)

so that

\displaystyle y(x_0 + h) = y(x_0) + hf(x_0, y_0)\ \ \ (3)

By continuity in this manner we can then find y(x_0 + 2h),\ y(x_0 + 3h), etc. We choose h sufficiently small so as to obtain good approximations.

A modified procedure of this method can also be used.

2. Taylor series method

By successive differentiation of the differential equation in (1) we can find y'(x_0),\ y''(x_0),\ y'''(x_0),\cdots. Then the solution is given by the Taylor series

\displaystyle y(x) = y(x_0) + y'(x_0)(x - x_0) + \frac{y''(x_0)(x - x_0)^2}{2!} + \cdots\ \ \ (4)

assuming that the series converges. If it does we can obtain y(x_0 + h) to any desired accuracy.

3. Picard’s method

By integrating the differential equation in (1) and using the boundary condition, we find

\displaystyle y(x) = y_0 + \int^{x}_{x_0}\! f(u, y)du\ \ \ (5)

Assuming the approximation y_1(x) = y_0, we obtain from (5) a new approximation.

\displaystyle y_2(x) = y_0 + \int^{x}_{x_0}\! f(u, y_1)du\ \ \ (6)

Using this in (5) we obtain another approximation.

\displaystyle y_3(x) = y_0 + \int^{x}_{x_0}\! f(u, y_2)du\ \ \ (7)

Continuing in this manner we obtain a sequence of approximations y_1, y_2, y_3,\cdots. The limit of this sequence, if it exists, is the required solution. However, by carrying out the procedure a few times, good approximations can be obtained.

4. Runge-Kutta method

This method consists of computing

\displaystyle \left.\begin{array}{rcl}k_1 & = & hf(x_0, y_0) \\ k_2 & = & hf(x_0 + \frac{1}{2}h, y_0 + \frac{1}{2}k_1) \\ k_3 & = & hf(x_0 + \frac{1}{2}h, y_0 + \frac{1}{2}k_2 \\ k_4 & = & hf(x_0 + \frac{1}{2}h, y_0 + \frac{1}{2}k_3) \end{array} \right\}\ \ \ (8)

Then

\displaystyle y(x_0 + h) = y_0 + \frac{1}{6}(k_1 + 2k_2 + 2k_3 + k_4)\ \ \ (9)

These methods can also be adapted for higher order differential equations by writing them as several first order equations.

微分方程式を解くための数値解法

 次の境界値問題が与えられたとします.

\displaystyle dy/dx = f(x, y)\ \ \ y(x_0) = y_0\ \ \ (1)

恐らく正確な解を得ることはできないでしょう.このような場合,様々な方法で近似値や数値解法が得られます.いくつかの方法を列挙します.

  1. 逐次近似法またはオイラー法
  2. テイラー級数法
  3. ピカール法
  4. ルンゲクッタ法

1. 逐次近似法またはオイラー法

 この手法では微分方程式 (1) を次の近似式で置換します.

\displaystyle \frac{y(x_0 + h)-y(x_0)}{h} = f(x_0, y_0)\ \ \ (2)

そのため,

\displaystyle y(x_0 + h) = y(x_0) + hf(x_0, y_0)\ \ \ (3)

このような連続性により y(x_0 + 2h),\ y(x_0 + 3h) 等を見出すことができます.十分に小さな h を選ぶことで良い近似が得られます.

 この方法の変法もまた用いられています.

2. テイラー級数法

 (1) における微分方程式を連続して微分することで y'(x_0),\ y''(x_0),\ y'''(x_0),\cdots が得られます.そしてその解は,その級数が収束することを前提に,次のテイラー級数で得られます.

\displaystyle y(x) = y(x_0) + y'(x_0)(x - x_0) + \frac{y''(x_0)(x - x_0)^2}{2!} + \cdots\ \ \ (4)

級数が収束するならいかなる精度でも y(x_0 + h) が得られます.

3. ピカール法

 (1) の微分方程式を積分し,境界条件を用いることで次式が得られます.

\displaystyle y(x) = y_0 + \int^{x}_{x_0}\! f(u, y)du\ \ \ (5)

近似式 y_1(x) = y_0 を前提として (5) から次の新しい近似式が得られます.

\displaystyle y_2(x) = y_0 + \int^{x}_{x_0}\! f(u, y_1)du\ \ \ (6)

(5) においてこれを用いると別の近似式が得られます.

\displaystyle y_3(x) = y_0 + \int^{x}_{x_0}\! f(u, y_2)du\ \ \ (7)

 このように連続して一連の近似式 y_1, y_2, y_3,\cdots を得ます.この一連の近似式の極限は,もし存在するなら,求められる解です.しかしながら数回の手順を行うことで良い近似が得られます.

4. ルンゲクッタ法

 この手法は次の計算を含みます.

\displaystyle \left.\begin{array}{rcl}k_1 & = & hf(x_0, y_0) \\ k_2 & = & hf(x_0 + \frac{1}{2}h, y_0 + \frac{1}{2}k_1) \\ k_3 & = & hf(x_0 + \frac{1}{2}h, y_0 + \frac{1}{2}k_2 \\ k_4 & = & hf(x_0 + \frac{1}{2}h, y_0 + \frac{1}{2}k_3) \end{array} \right\}\ \ \ (8)

 ゆえに

\displaystyle y(x_0 + h) = y_0 + \frac{1}{6}(k_1 + 2k_2 + 2k_3 + k_4)\ \ \ (9)

 これらの手法もまた数個の1階の微分方程式として記述することで高階の微分方程式に適合しています.