These additional exercises and projects extend Chapter 9 without
repeating its assigned problems. The exercises focus on practical
questions that arise when using an ODE solver. The projects introduce
different physical models, from decay chains and circuits to rotating
bodies and quantum dynamics. All parameters are starting points for
reproducible calculations, not measured data.
Physics projects
The first six projects use familiar classical models; the last two
offer more advanced work in rigid-body rotation and quantum dynamics. For each
project, state assumptions and units, identify the state vector,
and write all first-order equations before programming. Present
the requested plots and a short physical interpretation. Verify
the calculation using the check supplied, then repeat with a
smaller step or tighter tolerances. Report the solver settings
and numerical uncertainty in the quantities you extract.
Adaptive RKF45 is a useful starting point for these nonstiff
default parameters. Use fixed-step velocity Verlet for the
coupled masses if desired. Variables with different physical
units need appropriate scaling. Limit the maximum step or use
dense output for smooth plots; locate turning points and switches
more carefully than simply choosing the nearest saved point.
1. A radioactive decay chain
Objective: follow the buildup and decay of an intermediate daughter species, rather than a single exponential decay.
NA′ = −λANA,
NB′ = λANA − λBNB,
NC′ = λBNB.
Assume each decay produces one daughter and the final species C is stable. Normalize the initial number of nuclei to one: (NA,NB,NC)(0) = (1,0,0). Use λA = 0.2 s−1, λB = 0.5 s−1, and integrate to 30 s. Start from Code 2 with three equations. Plot the three fractions and the two activities λANA and λBNB. Locate the time of maximum daughter abundance using its derivative or a refined search near the sampled maximum.
Validation: Check nonnegative fractions and NA + NB + NC = 1. For unequal decay constants, NA = e−λAt and NB = λA(e−λAt − e−λBt)/(λB − λA). The daughter maximum occurs at ln(λB/λA)/(λB − λA) ≈ 3.054302 s.
Possible extension: Set the two decay constants equal. Derive and test the limit NB = λt e−λt, rather than evaluating a formula with a zero denominator.
2. Thermal exchange between two finite bodies
Objective: model the evolution of both temperatures when neither body acts as a fixed-temperature reservoir.
C1T1′ = −G(T1 − T2),
C2T2′ = G(T1 − T2).
The bodies have constant heat capacities C1 = 500 J/K and C2 = 1000 J/K, with thermal conductance G = 5 W/K. Assume uniform temperature within each body and no heat exchange with the surroundings. Start at T1 = 400 K, T2 = 300 K, and integrate to 500 s. Use Code 2 with two equations. Plot both temperatures and the heat flow. Vary the heat-capacity ratio and explain which body changes temperature more.
Validation: The conserved quantity is C1T1 + C2T2, with an arbitrary common energy reference. Define Teq = (C1T1(0) + C2T2(0))/(C1 + C2) and τ = 1/[G(1/C1 + 1/C2)]. Then D = 100 K exp(−t/τ), T1 = Teq + C2D/(C1 + C2), and T2 = Teq − C1D/(C1 + C2). The defaults give Teq = 333.333333 K and τ = 66.666667 s.
Possible extension: Replace G by the positive conductance G0[1 + ((T1 − T2)/(100 K))2]. Does the final equilibrium change, or only the route to it?
3. An RLC circuit responding to a voltage pulse
Objective: follow energy supplied, stored, and dissipated during switching.
q′ = I,
L I′ = V(t) − RI − q/C.
Use a series circuit with inductance L = 0.10 H, capacitance C = 1.0 × 10−3 F, and resistance R = 5 Ω. Apply V(t) = V0 = 10 V from t = 0 to 0.10 s, then zero voltage through t = 1 s. Initially q = I = 0. Modify Code 3, treating charge and current as the two state variables. Integrate to the switching time and restart with the same state. Plot current, capacitor voltage, and stored energy. Repeat with R = 20 and 40 Ω; compare overshoot and settling behavior. Use output spacing or a maximum step small enough to resolve the oscillations.
Validation: With E = LI2/2 + q2/(2C), verify dE/dt = VI − RI2, preferably through its integrated energy balance. Before switching, the underdamped default has q = CV0[1 − e−αt(cos(ωdt) + (α/ωd)sin(ωdt))], where α = R/(2L) and ωd = sqrt(1/(LC) − α2). Critical damping occurs at R = 2 sqrt(L/C) = 20 Ω.
Possible extension: Vary pulse duration and compare the energy left in the circuit at switch-off. Keep charge and current continuous at each switch.
4. Energy transfer between two coupled masses
Objective: observe beating and energy exchange between coupled oscillators.
x1′ = v1, x2′ = v2,
m v1′ = −kx1 − kc(x1 − x2),
m v2′ = −kx2 − kc(x2 − x1).
Two equal masses are connected to fixed supports by equal springs and to each other by a coupling spring. Displacements are measured from equilibrium. Use m = 1 kg, k = 1 N/m, kc = 0.10 N/m, x1(0) = 0.10 m, and all other initial state variables zero. Integrate to 200 s using Code 2 with four equations, or adapt Code 5 to two position coordinates. Plot displacements and the individual quantities Ei = mvi2/2 + kxi2/2. These individual energies exclude the coupling spring; show its energy separately. Relate the slow transfer to the difference between the two normal-mode frequencies.
Validation: The exact displacements are x1 = (0.10 m/2)[cos(ω+t) + cos(ω−t)] and x2 = (0.10 m/2)[cos(ω+t) − cos(ω−t)], where ω+ = sqrt(k/m) is the in-phase mode frequency and ω− = sqrt((k + 2kc)/m) is the out-of-phase mode frequency. The labels + and − describe the relative signs of the two displacements, not the ordering of the frequencies. Verify conservation of E1 + E2 + kc(x1 − x2)2/2.
Possible extension: Make the masses unequal. How does detuning change the extent of energy transfer? Derive the modified acceleration equations before changing parameters.
5. A charged particle in crossed electric and magnetic fields
Objective: separate rapid cyclotron motion from the drift of the guiding center.
x′ = vx, y′ = vy,
vx′ = E + vy, vy′ = −vx.
Use reduced units with positive charge q = 1, mass m = 1, magnetic field Bz = 1, and electric field Ex = E = 0.2. All initial positions and velocities are zero. Neglect radiation and relativity. Integrate to 20π using Code 2 or Code 4. Plot the trajectory and velocity components, then average the velocity over complete cyclotron periods. Explain why a magnetic field changes direction but does no work. The force depends on velocity, so the standard position-force update in Code 5 does not apply directly.
Validation: For these initial data, vx = E sin t, vy = E(cos t − 1), x = E(1 − cos t), and y = E(sin t − t). The mean drift is (0,−E). Check conservation of (vx2 + vy2)/2 − Ex, which initially equals zero.
Possible extension: Restore arbitrary q, m, and B in the equations and reverse the charge. Compare cyclotron rotation with the drift E × B/|B|2, which is independent of charge sign.
6. A rocket that loses mass during a finite burn
Objective: model propulsion with changing mass and connect the powered and coasting stages.
h′ = v, m′ = −μ,
v′ = uμ/m − g (during the burn).
Assume a vertical flight with constant gravity, no air resistance, and effective exhaust speed u = 2000 m/s. Use initial mass m0 = 1000 kg, dry mass md = 600 kg, positive mass-loss rate μ = 5 kg/s, and g = 9.81 m/s2. Start with h = v = 0. The thrust uμ = 10000 N exceeds the initial weight. Integrate the three equations to burnout at tb = (m0 − md)/μ = 80 s. Then set thrust and mass loss to zero and follow the coast to the apex. Plot mass, velocity, altitude, and acceleration. Use Code 2 with three components and sensible component scales or tolerances.
Validation: During the burn, m = m0 − μt and v = u ln(m0/m) − gt. Check this velocity curve. After burnout, v = vb − g(t − tb), so the additional height is vb2/(2g). Mass, altitude, and velocity remain continuous at burnout; acceleration changes abruptly. Do not let the mass decrease below the dry mass. The default parameters give vb ≈ 236.851 m/s, hb ≈ 6009.850 m, and an apex at h ≈ 8869.102 m and t ≈ 104.144 s, measured from launch.
Possible extension: Keep the fuel mass and exhaust speed fixed, then vary the burn rate while retaining immediate lift-off. Explain the effect of burn duration on gravitational velocity loss. The thrust model is discussed in NASA’s rocket thrust notes.
7. Torque-free rotation and the intermediate-axis instability
Objective: test the stability of rotation about the three principal axes of an asymmetric rigid body.
I1ω1′ = (I2 − I3)ω2ω3,
I2ω2′ = (I3 − I1)ω3ω1,
I3ω3′ = (I1 − I2)ω1ω2.
These are Euler’s equations in the body’s principal-axis frame, with no external torque. Use reduced units with principal moments (I1,I2,I3) = (1,2,3). Run three initial angular velocities: (1,0.01,0.01), (0.01,1,0.01), and (0.01,0.01,1), each to t = 50. Use Code 2 with three equations. Plot all angular-velocity components and compare the growth of the small transverse components. Reduce the perturbations to 10−3 and repeat. The components are expressed in a rotating body frame, so they need not be constant even though angular momentum in space is conserved.
Validation: Check both E = (Σ Iiωi2)/2 and |L|2 = Σ Ii2ωi2. Exact rotation about any single principal axis stays constant. Linearization near the intermediate axis predicts an early growth rate |ω2| sqrt[(I2 − I1)(I3 − I2)/(I1I3)]. Fit growth only while the transverse components remain small.
Possible extension: Compare with an axisymmetric body, such as I1 = I2 = 1, I3 = 2. Further background is available in MIT’s notes on Euler’s equations.
8. Population transfer in a two-level quantum system
Objective: solve a time-dependent quantum state as four real first-order equations and test probability conservation. This project assumes introductory quantum mechanics.
i c1′ = −(Δ/2)c1 + (Ω/2)c2,
i c2′ = (Ω/2)c1 + (Δ/2)c2.
The amplitudes describe a closed, coherently coupled two-state model. The real constants Ω and Δ have units of angular frequency and represent coupling and detuning; Planck’s constant has been divided out. Set Ω = 1 s−1 and compare Δ = 0, 1, 3 s−1. Start with c1 = 1, c2 = 0, and integrate to 20 s. To use Code 2 without complex arithmetic, write c1 = a + ib and c2 = d + ie:
a′ = −Δb/2 + Ωe/2,
b′ = Δa/2 − Ωd/2,
d′ = Ωb/2 + Δe/2,
e′ = −Ωa/2 − Δd/2.
The initial real state is (a,b,d,e) = (1,0,0,0). Keep the imaginary unit i distinct from the real component e.
Validation: Check P1 = a2 + b2, P2 = d2 + e2, and P1 + P2 = 1. The exact transferred population is P2(t) = [Ω2/(Ω2 + Δ2)] sin2(sqrt(Ω2 + Δ2)t/2). At zero detuning the first complete transfer occurs at t = π/Ω. Plot both populations and explain how detuning changes the maximum transfer.
Possible extension: Apply a finite coupling pulse by turning Ω off at a chosen time, carrying the amplitudes continuously across the switch. Compare resonant pulse durations π/(2Ω) and π/Ω. See MIT’s two-level-system notes for background.