Numerical Integration of Systems of Differential Equations

Systems of (maximum 4) first-order differential equations are solved numerically.
To do this, the task must be formulated in the sense of an initial value problem in the following form:

y(t,y(t)) = f( t,y(t)) with y(0)=y0

The vector y(t) contains the solutions y1(t), y2(t), ... .
The vector y(0) contains the initial values of the solutions sought.

The solution is determined as a function of the independent variable t for 0 ≤ t ≤ tEnd.
The solution is displayed graphically as a function curve and optionally also as a table of values.
The methods used here are explicit one-step methods, one of them with step size control, which achieves the best results.

A differential equation of the nth order (here n ≤ 4) can also be solved by first converting it into a differential equation system of n differential equations of the first order.
To do this, n-1 auxiliary variables are introduced for y to y(n-1) and the differential equation as the nth equation solved for their highest derivative y(n).

So you can get the 2nd order differential equation a(t)y + b(t)y + c(t)y = f(t) solve by creating the following system:
y1 = y2
y2 = (f(t) - b(t) y2 - c(t) y1)/a(t)
y1(t) is then the desired solution y(t) and y2(t) is the corresponding 1st derivative.

   



To the examples

Example 1: free undamped oscillation
Example 2: free damped oscillation
Example 3: excited damped oscillation with excitation above the resonance frequency
Example 4: excited undamped oscillation with excitation in the resonance
Example 5: Transient process at excitation frequency above the resonance frequency
Example 6: Transient process at excitation frequency below the resonance frequency
Example 7: harmonically excited damped oscillation with disturbance of the excitation at 15s (ignites the homogeneous solution again)
Example 8: excited damped oscillation with 2 different excitation frequencies
Example 9: Transient process in the aperiodic limit case
Example 10: Nonlinear free oscillation (pendulum at large amplitudes)
Example 11: Nonlinear free oscillation (frictional damping)
Example 12: Nonlinear free oscillation, wobble oscillation (restoring force is nonlinear)
Example 13: Nonlinear free oscillation (restoring force is proportional to the square of the deflection
Example 14: 3rd order differential equation with pulse excitation (via short square wave pulse)
Example 15: 4th order differential equation with impulse excitation (via initial condition)
Example 16: elastically cushioned impact of a moving mass on a stationary mass
Example 17: Impulse response of an untethered, damped 2-mass oscillator
Example 18: Predator-prey model (Lotka-Volterra equations)


more JavaScript applications