Runge Kutta Method

Numerical Solutions to ODEs

  • To solve a differential equation numerically, the goal is to find a vector representation whose graph is close approximation to the graph of the actual solution.

\[ \frac{dy}{dt} = f(t,y), \,\, y(t_0) = y_0 \]

  • Note that the right side function, \( f(t,y) \), gives the slope of the solution \( y(t) \) at the ordered pair \( (t,y) \).
  • Note that we also have a starting point \( (t_0, y_0 \)) on the graph of the solution.
  • Having point and slope \( y' \) is all we need for equation of line to approximate \( y \).

Equations of Lines!

title title

  • Point-slope formula:

\[ \begin{align} y - y_0 & = m(x - x_0) \\ y &= y_0 + m(x - x_0) \\ &= y_0 + mh \end{align} \]

  • Generate points on line:

\[ \begin{align} a &= hm \,\,\, \mathrm{(rise)}\\ y_{k+1} & = y_k + a \,\,\, \mathrm{(vertical)}\\ t_{k+1} &= t_k + h \,\,\, \mathrm{(horizontal)} \end{align} \]

  • plot(t,y)

Euler Method

title

\[ \begin{align} \frac{dy}{dt} & = f(t,y), \,\, y(t_0) = y_0 \\ a &= hf(t_k,y_k) \\ y_{k+1} & = y_k + a \\ t_{k+1} &= t_k + h \end{align} \]

Runge-Kutta Method (4th Order)

  • The Runge-Kutta is a predictor-correct method. title
  • Runge-Kutta has an error that is \( O(h^4) \). title

Runge-Kutta Method

title

\[ \begin{align} \frac{dy}{dt} & = f(t,y), \,\, y(t_0) = y_0 \\ a &= hf(t_k,y_k) \\ b &= hf\left(t_k + 0.5h, y_k + 0.5a \right) \\ c &= hf\left(t_k + 0.5h, y_k + 0.5b \right) \\ d &= hf\left(t_k + h, y_k + c \right) \\ y_{k+1} & = y_k + \frac{1}{6} (a + 2b + 2c + d) \\ t_{k+1} &= t_k + h \end{align} \]

Runge-Kutta Method

title

\[ \begin{align} \frac{dy}{dt} & = f(y), \,\, y(t_0) = y_0 \\ a &= hf(y_k) \\ b &= hf\left(y_k + 0.5a \right) \\ c &= hf\left(y_k + 0.5b \right) \\ d &= hf\left(y_k + c \right) \\ y_{k+1} & = y_k + \frac{1}{6} (a + 2b + 2c + d) \\ t_{k+1} &= t_k + h \end{align} \]

Runge-Kutta: 4th Order Method

title