Someone writes this conserved-quantity test for the drag-free Chapter 1 integrator:…

PHYSICS · Multi-part · Fermi University Physics · Computational Physics · Research software practice, verification and validation · Research software practice, verification and validation

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

Problem

Someone writes this conserved-quantity test for the drag-free Chapter 1 integrator: def test_energy_conserved(): y, v, t = simulate_fall(y0=1000.0, v0=0.0, g=9.8, b=0.0, dt=0.1, t_max=5.0); assert len(y) == len(t); assert len(v) == len(t); print('conserved-quantity test passed'). They report that it prints "conserved-quantity test passed" every time, including after they deliberately add a spurious extra force inside simulate_fall that makes the body gain a large amount of energy. ((a)) Find the error: say exactly why this test can never fail, no matter how badly energy is not conserved. ((b)) Rewrite it as a correct conserved-quantity test, using E=12v2+gyE=\tfrac12v^2+gy per unit mass and a stated numerical tolerance, and say whether it should be expected to pass or fail on the unmodified Chapter 1 integrator.

Browse the problem library