A run of the falling-hailstone program of chapter 1 records samples at

PHYSICS · Multi-part · Fermi University Physics · Mathematical Methods for Physics · Computational Physics · Scientific programming for physicists

Computational Physics, Ch Arrays: a field is a rectangle of numbers

Problem

A run of the falling-hailstone program of chapter 1 records 501501 samples at Δt=0.02 s\Delta t = 0.02\,\mathrm{s}, held as arrays t\texttt{t}, y\texttt{y} and v\texttt{v}, each of shape (501,)(501,). The heights run up to 1000 m1000\,\mathrm{m}. ((a)) The neighbour difference (y[1:] - y[:-1])/dt\texttt{(y[1:] - y[:-1])/dt} estimates the velocity over each gap. State the length of the result. ((b)) Differencing a second time gives yn+1−2yn+yn−1y_{n+1} - 2y_n + y_{n-1}. Write that as one expression in offset slices of y\texttt{y}, and state its length. A loop over nn computing the same quantity agrees with it to the last bit; say why. ((c)) The velocity estimate of the first part is compared entry by entry with the recorded velocities, and the largest disagreement is 4.0×10−12 m s−14.0\times10^{-12}\,\mathrm{m\,s^{-1}}. Chapter 2's rounding model puts an absolute error of order 1000 ϵmach1000\,\epsilon_{\rm mach} on a stored height of size 1000 m1000\,\mathrm{m}, with ϵmach=2.22×10−16\epsilon_{\rm mach} = 2.22\times10^{-16}. Compute the floor this disagreement is to be judged against, and say whether the rewrite passes.

Browse the problem library