A supplied program models a pendulum in the small-angle approximation

PHYSICS · Subjective · Fermi University Physics · Computational Physics · Research software practice, verification and validation · Simulating classical dynamical systems

Computational Physics, Ch A workspace that can be rerun next year

Problem

A supplied program models a pendulum in the small-angle approximation, integrating θ¨=−(g/L)θ\ddot\theta = -(g/L)\theta with a step-by-step scheme of the kind Chapter 1 built. Line 6 of the listing computes the angular acceleration as a = -(g/L)*theta. Take L=0.90 mL = 0.90\,\mathrm{m}, θ0=0.15 rad\theta_0 = 0.15\,\mathrm{rad} (initial angular velocity zero) and g=9.8 m s−2g = 9.8\,\mathrm{m\,s^{-2}}. The equation is treated as exact (no real-pendulum nonlinearity), so its solution is θ(t)=θ0cos⁡(ωt)\theta(t) = \theta_0\cos(\omega t) with ω=g/L\omega = \sqrt{g/L}, and the period is T=2π/ωT = 2\pi/\omega. (a) State the exact value of θ\theta at one quarter of the period, t=T/4t = T/4, and use it to write a known-answer test as a single assert statement, testing θ(T/4)\theta(T/4) against a tolerance of 1×10−3 rad1\times10^{-3}\,\mathrm{rad}. (b) Run at a step of Δt=0.01 s\Delta t = 0.01\,\mathrm{s}, the correct program returns θ(T/4)=1.5×10−4 rad\theta(T/4) = 1.5\times10^{-4}\,\mathrm{rad}. Show that the test in part (a) passes, quoting the margin. (c) Line 6 is now changed to a = +(g/L)*theta (a sign slip). Find analytically the value the corrupted model gives for θ(T/4)\theta(T/4), with the same initial conditions, and determine whether the known-answer test of part (a) passes or fails, quoting the printed difference.

Browse the problem library