Numerical Methods | |
|
Solving a first order differential equation by fourth order Runge-KuttaAny first order differential equation of the form, \[ \begin{equation} \frac{dx}{dt} = f(x,t) \end{equation} \]can be solved numerically using a fourth order Runge-Kutta routine. The code that solves this equation for $f(x,t) = -x + \sin (t)$ and the intial condition $x(t=0)=0$ is shown below. |