DEPARTMENT OF PHYSICS
Name:
NIT Calicut Role No:
Computational Physics (Code: PH-3005D)
Date: 30/01/25 Quiz 4 Maximum Marks: 5
1. Physics Problem: Coupled First and Second Order ODEs - Numerical Solution
Consider a damped mass-spring system where the displacement of the mass x(t) is governed
by the following second-order ordinary differential equation:
d2 x dx
m 2
= −kx − b + F (t)
dt dt
with the following physical parameters:
* Mass (m) = 1.0 kg * Spring constant (k) = 4.0 N/m * Damping coefficient (b) = 0.5 Ns/m
The time-dependent driving force F (t) is itself governed by the following coupled first-order
ordinary differential equation:
dF
= −γF + α sin(wt)
dt
with the parameters for the driving force:
* γ = 0.2 s−1 * α = 3.0 N/s * w = 2.0 rad/s
The initial conditions at time t = 0 are given as:
dx
* Displacement x(0) = 0.1 m * Velocity dt (0) = v(0) = 0.0 m/s * Driving force F (0) = 0.5 N
Question:
Convert this system of coupled differential equations into a system of first-order ordinary
differential equations. Then, using the fourth-order Runge-Kutta method with a time step
of h = 0.1 s, numerically approximate the displacement x(t), velocity v(t) = dxdt (t), and the
driving force F (t) at time t = 0.2 s. Show the steps for the first time step (from t = 0 to
t = 0.1 s).
Retain all numerical values to exactly 6 decimal places in every step.
Hint: RK4
dy
For an ODE of the form dx = f (x, y) with initial condition y(x0 ) = y0 ;
k1 = hf (tn , yn )
h 1
k2 = hf (tn + , yn + k1 )
2 2
h 1
k3 = hf (tn + , yn + k2 )
2 2
k4 = hf (tn + h, yn + k3 )
1
yn+1 = yn + (k1 + 2k2 + 2k3 + k4 ) .
6
Student’s name: End of exam