# Preface

This tutorial was made solely for the purpose of education and it was designed for students taking Applied Math 0340. It is primarily for students who have some experience using Mathematica. If you have never used Mathematica before and would like to learn more of the basics for this computer algebra system, it is strongly recommended looking at the APMA 0330 tutorial. As a friendly reminder, don't forget to clear variables in use and/or the kernel. The Mathematica commands in this tutorial are all written in bold black font, while Mathematica output is in regular fonts.

Finally, you can copy and paste all commands into your Mathematica notebook, change the parameters, and run them because the tutorial is under the terms of the GNU General Public License (GPL). You, as the user, are free to use the scripts for your needs to learn the Mathematica program, and have the right to distribute this tutorial and refer to this tutorial as long as this tutorial is accredited appropriately. The tutorial accompanies the textbook Applied Differential Equations. The Primary Course by Vladimir Dobrushkin, CRC Press, 2015; http://www.crcpress.com/product/isbn/9781439851043

Introduction to Linear Algebra

# Runge--Kutta algorithms

Application of the standard Runge--Kutta method of order 4 to the system of differential equations

$\begin{cases} \dot{x} &= f(t, x, y) , \\ \dot{y} &= g(t,x,y) , \end{cases} \qquad\mbox{subject to }\qquad \begin{cases} x(t_0 ) = x_0 , \\ y(t_0 ) = y_0 ; \end{cases}$
gives
$\begin{cases} x_{k+1} &= x_k + \frac{h}{6} \left( f_1 + 2\, f_2 + 2\,f_3 + f_4 \right) , \\ y_{k+1} &= y_k + \frac{h}{6} \left( g_1 + 2\, g_2 + 2\,g_3 + g_4 \right) , \end{cases}$
where
\begin{align*} & f_1 = f\left( t_k , x_k , y_k \right) , \qquad & g_1 = g \left( t_k , x_k , y_k \right) , \\ & f_2 = f \left( t_k + \frac{h}{2}, x_k + \frac{h}{2}\,f_1 , y_k + \frac{h}{2}\,g_1 \right) , \qquad & g_2 = g \left( t_k + \frac{h}{2}, x_k + \frac{h}{2}\,f_1 , y_k + \frac{h}{2}\,g_1 \right) , \\ & f_3 = f \left( t_k + \frac{h}{2}, x_k + \frac{h}{2}\,f_2 , y_k + \frac{h}{2}\,g_2 \right) , \qquad & g_3 = g \left( t_k + \frac{h}{2}, x_k + \frac{h}{2}\,f_2 , y_k + \frac{h}{2}\,g_2 \right) , \\ & f_4 = f \left( t_k +h , x_k + h\,f_3 , y_k + h\,g_3 \right) , \qquad & g_4 = g \left( t_k +h , x_k + h\,f_3 , y_k + h\,g_3 \right) . \end{align*}

Example: Consider the initial ■

Example: Consider the initial ■