Responsive Navbar with Google Search
Ordinary Differential Equation-2: 2nd Order ODE (RK4 Method)

2nd Order ODE (RK4 Method): Program 1

Fourth-Order Runge-Kutta (RK4) Method

The RK4 method is used to solve the differential equation of a forced, damped harmonic oscillator represented by the following second-order ordinary differential equation:

$$ m \frac{d^2 x}{dt^2} + b \frac{dx}{dt} + kx = F_0 \sin(\omega t) $$

The equation can be rewritten in terms of the damping ratio \( \zeta \) and the natural frequency \( \omega_n \) as follows:

$$ \frac{d^2 x}{dt^2} = -2 \zeta \omega_n \frac{dx}{dt} - \omega_n^2 x + \frac{F_0}{m} \sin(\omega t) $$

where:

  • $$ \omega_n = \sqrt{\frac{k}{m}} $$ is the natural frequency,
  • $$ \zeta = \frac{b}{2\sqrt{km}} $$ is the damping ratio.

Given Parameters:

    $$ \omega_n = 1.0 \quad \zeta = 0.1 \quad F_0 = 1.0 \quad \omega = 0.5 $$

Initial Conditions:

    $$ x(0) = 1 \quad \frac{dx}{dt} \bigg|_{t=0} = 0$$

Output 1