A simple population model is run as a plain counted loop with no check on the size of…
PHYSICS · Multi-part · Fermi University Physics · Mathematical Methods for Physics · Numerical and computational mathematics · Numerical and computational mathematics
Computational Physics, Ch Numbers a machine can hold, and the two errors that follow
Problem
A simple population model is run as a plain counted loop with no check on the size of the numbers: Nk+1=Nk(1+rΔt),r=50s−1,Δt=0.5s,N0=1.0, so each step multiplies N by the fixed factor 1+rΔt=26. The printed output shows: step 217, N=1.12×10307; step 218, N=inf; step 219, N=inf. A later line then computes a growth-rate estimate R=ΔtN219−N218 and reports R=nan.
((a)) Verify, using log1026, that step 218 is indeed the first step at which N exceeds the largest finite binary64 magnitude, 1.80×10308.
((b)) Name the arithmetic operation that produces the first inf.
((c)) Name the arithmetic operation that produces the nan in the rate calculation.