PHYSICS · Subjective · Fermi University Physics · Computational Physics · Scientific programming for physicists · Scientific programming for physicists
Computational Physics, Ch Letting the computer do the algebra
Problem
The three-term pendulum period-ratio series, counting the leading 1 as the first term, is T0T≈1+16θ02+307211θ04, where θ0 is the swing amplitude in radians.
(a) Convert this symbolic expression in the symbol θ0 into a numerical function of a NumPy array, using SymPy's lambdify.
(b) Evaluate the compiled function at the five amplitudes θ0=0.10,0.20,0.30,0.40,0.50rad and state each value of T/T0 to five significant figures.
(c) Confirm that substituting θ0=0.30rad directly into the original symbolic expression and evaluating it numerically agrees with the value from the compiled function at that point, to at least twelve significant figures.