|
ODE by 4.th order Runge-Kutta
(template) Solves numerically and plots
the solution to a given ODE (or system),
via RK4. |
|
|
tf, h |
|
Final time, and step
for integration ([time]). • |
n |
(only 2 ! ) |
Order of ODE (or system). • |
Parameters |
|
Parameters: x" + k1 x' +
k2 x = 0. • |
X0 |
|
Initial (n) values. • |
Show values ? |
|
Shows the graph coordinates. |
Solves an n.th order ODE or a system by RK4,
the numerical 4.th order Runge-Kutta method.
The basis problem is given above, with analytical solution
x(t) = [α cos(t) +
β sin(t)] exp (-k t).
Plots x and x' (function and derivative) vs. time.
A result reported is x(0.5) = 1.145 .
Other suggested data:
(tf, params.) = (16, 0.4, 5). |
| References: |
Plate: GeneralRungeKutta4 |
• Polyanin, Andrei D., Ordinary Differential Equations
• 1934-04-06: Ostrovskii, Iossif Vladimirovich
(–). |