Difference between revisions of "Integrators for time stepping"

From Medusa: Coordinate Free Mehless Method implementation
Jump to: navigation, search
(Explicit (single step) methods)
Line 23: Line 23:
  
 
It is given by
 
It is given by
:<math> y_{n+1} = y_n + h \sum_{i=1}^s b_i k_i, </math>
+
$y_{n+1} = y_n + h \sum_{i=1}^s b_i k_i$
where<ref>{{harvnb|Press|Teukolsky|Vetterling|Flannery|2007|p=907}}</ref>
+
where  
:<math>
+
 
\begin{align}
+
$
 +
\begin{align*}
 
  k_1 & = f(t_n, y_n), \\
 
  k_1 & = f(t_n, y_n), \\
 
  k_2 & = f(t_n+c_2h, y_n+h(a_{21}k_1)), \\
 
  k_2 & = f(t_n+c_2h, y_n+h(a_{21}k_1)), \\
Line 32: Line 33:
 
     & \ \ \vdots \\
 
     & \ \ \vdots \\
 
  k_s & = f(t_n+c_sh, y_n+h(a_{s1}k_1+a_{s2}k_2+\cdots+a_{s,s-1}k_{s-1})).
 
  k_s & = f(t_n+c_sh, y_n+h(a_{s1}k_1+a_{s2}k_2+\cdots+a_{s,s-1}k_{s-1})).
\end{align}
+
\end{align*}
</math>
+
$
:''(Note: the above equations have different but equivalent definitions in different texts).''<ref name=notation />
 
  
 
To specify a particular method, one needs to provide the integer ''s'' (the number of stages), and the coefficients ''a<sub>ij</sub>'' (for 1 ≤ ''j'' < ''i'' ≤ ''s''), ''b<sub>i</sub>'' (for ''i'' = 1, 2, ..., ''s'') and ''c<sub>i</sub>'' (for ''i'' = 2, 3, ..., ''s''). The matrix [''a<sub>ij</sub>''] is called the ''Runge–Kutta matrix'', while the ''b<sub>i</sub>'' and ''c<sub>i</sub>'' are known as the ''weights'' and the ''nodes''.<ref>{{harvnb|Iserles|1996|p=38}}</ref> These data are usually arranged in a mnemonic device, known as a ''Butcher tableau'' (after [[John C. Butcher]]):
 
To specify a particular method, one needs to provide the integer ''s'' (the number of stages), and the coefficients ''a<sub>ij</sub>'' (for 1 ≤ ''j'' < ''i'' ≤ ''s''), ''b<sub>i</sub>'' (for ''i'' = 1, 2, ..., ''s'') and ''c<sub>i</sub>'' (for ''i'' = 2, 3, ..., ''s''). The matrix [''a<sub>ij</sub>''] is called the ''Runge–Kutta matrix'', while the ''b<sub>i</sub>'' and ''c<sub>i</sub>'' are known as the ''weights'' and the ''nodes''.<ref>{{harvnb|Iserles|1996|p=38}}</ref> These data are usually arranged in a mnemonic device, known as a ''Butcher tableau'' (after [[John C. Butcher]]):

Revision as of 11:55, 10 November 2017

This page describes how to solve ordinary differential equations numerically with examples from our library.

Introduction and notation

We are solving an initial value problem, given as

$ \begin{align*} \dot{y}(t) &= f(t, y) \\ y(t_0) &= y_0 \end{align*} $

where $y$ is the unknown (possibly vector) function, $t_0$ is the start time, $f$ is the derivative (the functions we wish to integrate) and $y_0$ is the initial value of $y$. Numerically, we usually choose a time step $\Delta t$ and integrate the function up to a certain time $t_{\max}$. Times os subsequent time steps are denoted with $t_i$ and function values with $y_i$.

The simplest method is explicit Euler's method: $y_{n+1} = y_{n} + \Delta t f(t, y_n)$

Explicit (single step) methods

A family of single step methods are exaplicit Runge-Kutta methods

It is given by $y_{n+1} = y_n + h \sum_{i=1}^s b_i k_i$ where

$ \begin{align*} k_1 & = f(t_n, y_n), \\ k_2 & = f(t_n+c_2h, y_n+h(a_{21}k_1)), \\ k_3 & = f(t_n+c_3h, y_n+h(a_{31}k_1+a_{32}k_2)), \\ & \ \ \vdots \\ k_s & = f(t_n+c_sh, y_n+h(a_{s1}k_1+a_{s2}k_2+\cdots+a_{s,s-1}k_{s-1})). \end{align*} $

To specify a particular method, one needs to provide the integer s (the number of stages), and the coefficients aij (for 1 ≤ j < is), bi (for i = 1, 2, ..., s) and ci (for i = 2, 3, ..., s). The matrix [aij] is called the Runge–Kutta matrix, while the bi and ci are known as the weights and the nodes.[1] These data are usually arranged in a mnemonic device, known as a Butcher tableau (after John C. Butcher):
  1. Template:Harvnb