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 501 samples at Δt=0.02s, held as arrays t, y and v, each of shape (501,). The heights run up to 1000m.
((a)) The neighbour difference (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−1. Write that as one expression in offset slices of y, and state its length. A loop over n 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−12ms−1. Chapter 2's rounding model puts an absolute error of order 1000ϵmach on a stored height of size 1000m, with ϵmach=2.22×10−16. Compute the floor this disagreement is to be judged against, and say whether the rewrite passes.