Below is a solver for the homogeneous 2nd order ordinary differential equation with constant coefficients,
ay''+by'+cy = 0
In order to solve this equation we must rewrite it as a system of first order equations:
y'= v,
v'= -(b/a)v - (c/a)y.
Try to vary the coefficients in order to see how many qualitatively different solutions you can find.
a: b:
c: tfinal:
Δt: v0:
y0:
Note: A fourth order Runge-Kutta method is used to solve the differential equation. Keep in mind that this is a fairly powerful method and that Δt does not need to be very small to get accurate results.