Table of Contents

Formulas for Numerical Methods

In what follows, \( f_m = f(x_m) \) and \( y_m = y(x_m) \).
Examples:
\( f_0 = f(x_0) \) , \( f_1 = f(x_1) \) , \( f_2 = f(x_2) \) ...
\( y_0 = y(x_0) \) , \( y_1 = y(x_1) \) , \( y_2 = y(x_2) \) ...

numerical integration of functions

Trapezoidal Rule for Integration

\( \displaystyle \int_{x_0}^{x_m} f(x) dx = h \left( \dfrac{f_0}{2} + f_1 + f_2 + f_3 + ... + f_{m-1}+\dfrac{f_m}{2}\right) \)
\( h = \dfrac{x_m - x_0}{m} \)

Simpson's Rule for Integration

The number of intervals must be even and is taken as \( 2 m \)
\( \displaystyle \int_{x_0}^{x_{2m}} f(x) dx = \dfrac{h}{3} \left[ f_0 + 4( f_1 + f_3 + f_5 + ...) + 2 ( f_2 + f_4 +f_6 + .... )+ f_{2m} \right] \)
\( h = \dfrac{x_{2m} - x_0}{2 m} \)

Euler's Method for Differential Equations

\( y' = f(x,y) \)
\( y_{n+1} = y_n + h f(x_n , y_n) + O(h^3) \)

Second-Order Runge-Kutta Method for Differential Equations

\( y' = f(x,y) \)
\( y_{n+1} = y_n + \dfrac{1}{2} (k_1 + k_2) + O(h^3) \)
where
\( k_1 = h f(x_n , y_n) \)
\( k_2 = h f(x_n+h , y_n+k_1) \)

Fourth-Order Runge-Kutta Method for Differential Equations

\( y' = f(x,y) \)
\( y_{n+1} = y_n + \dfrac{1}{6} (k_1 + 2 k_2 + 2 k_3 + k_4) + O(h^5) \)
where
\( k_1 = h f(x_n , y_n) \)
\( k_2 = h f(x_n+\dfrac{h}{2} , y_n + \dfrac{k_1}{2} ) \)
\( k_3 = h f(x_n+\dfrac{h}{2} , y_n + \dfrac{k_2}{2} ) \)
\( k_4 = h f(x_n+ h , y_n + k_3) \)

Second-Order Runge-Kutta Method for Systems of Differential Equations

\( y' = f(x,y,z) \)     ,     \( z' = g(x,y,z) \)
\( y_{n+1} = y_n + \dfrac{1}{2} (l_1 + l_2) \)    *(Note: symmetric formulations apply)*
\( y_{n+1} = y_n + \dfrac{1}{2} (k_1 + k_2) + O(h^3) \)
\( z_{n+1} = z_n + \dfrac{1}{2} (l_1 + l_2) + O(h^3) \)
where
\( k_1 = h f(x_n , y_n , z_n) \)     ,     \( l_1 = h g(x_n , y_n , z_n) \)
\( k_2 = h f(x_n+h , y_n + k_1 , z_n + l_1) \)     ,     \( l_2 = h g(x_n+h , y_n + k_1 , z_n + l_1) \)

Fourth-Order Runge-Kutta Method for Systems of Differential Equations

\( y' = f(x,y,z) \)     ,     \( z' = g(x,y,z) \)
\( y_{n+1} = y_n + \dfrac{1}{6} (k_1 + 2 k_2 + 2 k_3 + k_4) + O(h^5) \)
\( z_{n+1} = z_n + \dfrac{1}{6} (l_1 + 2 l_2 + 2 l_3 + l_4) + O(h^5) \)
where
\( k_1 = h f(x_n , y_n , z_n) \)     ,     \( l_1 = h g(x_n , y_n , z_n) \)
\( k_2 = h f(x_n+\dfrac{h}{2} , y_n + \dfrac{k_1}{2} , z_n + \dfrac{l_1}{2}) \)     ,     \( l_2 = h g(x_n+\dfrac{h}{2} , y_n + \dfrac{k_1}{2} , z_n + \dfrac{l_1}{2} ) \)
\( k_3 = h f(x_n+\dfrac{h}{2} , y_n + \dfrac{k_2}{2} , z_n + \dfrac{l_2}{2} ) \)     ,     \( l_3 = h g(x_n+\dfrac{h}{2} , y_n + \dfrac{k_2}{2} , z_n + \dfrac{l_2}{2}) \)
\( k_4 = h f(x_n + h , y_n + k_3 , z_n + l_3) \)     ,     \( l_4 = h g(x_n + h , y_n + k_3 , z_n + l_3) \)

Note: The fourth-order Runge-Kutta method for systems of differential equations is more stable. I used it in my doctoral thesis on "Evanescent Field Effects on Pulse Propagation in Transversely Inhomogeneous Waveguides", page 43, and it yielded excellent results.

More References and Links

Handbook of Mathematical Functions
George F. Simmons, P.; Steven G. Krantz; (2007). Differential Equations: Theory, Technique, and Practice.
Evanescent Field Effects on Pulse Propagation in Transversely Inhomogeneous Waveguides. Ph.D. Thesis - University of Nottingham - United Kingdom - 1984 - by Abdelkader Dendane
Fox, L.; Numerical Solutions of Ordinary and Partial Differential Equations, Oxford, Pergamon (1962)
Daniel, J. W.; Moore, R. E.; Computation and Theory in Ordinary Differential Equations, H. W. Freeman and Co. (1970)
Williams, P. W.; Numerical Computation, Thomas Nelson and Sons (1972)
Mathematics for Engineers with Examples and Solutions