Octave Implementation of RK4
John Bryan
- RK4, Runge-Kutta 4, is implemented in Octave.
-
Tested with initial value problem: $y^\prime = $0.85$y, y(t_0)=19$.
-
Values of step size h tested were $0.50$, $0.25$, and $0.10$ from t$=0$ to t$=3$.
-
Exact solution is $ y = 19e^{0.85t}$.
-
Octave implementation.
-
Results.
\begin{array}{|c|c|c|c|}
\hline & t = 1 & t = 2 & t = 3 \\\hline
\text{exact} & 44.453 & 104.005 & 243.335 \\\hline
\text{RK4 } h = 0.50 & 44.446 & 103.871 & 243.216 \\\hline
\text{RK4 } h = 0.25 & 44.453 & 104.002 & 243.326 \\\hline
\text{RK4 } h = 0.10 & 44.453 & 104.005 & 243.335 \\\hline
\end{array}