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=50 s−1, Δt=0.5 s, N0=1.0,N_{k+1} = N_k\,(1+r\Delta t), \qquad r = 50\,\mathrm{s^{-1}},\ \Delta t = 0.5\,\mathrm{s},\ N_0 = 1.0, so each step multiplies NN by the fixed factor 1+rΔt=261+r\Delta t = 26. The printed output shows: step 217217, N=1.12×10307N = 1.12\times10^{307}; step 218218, N=infN = \texttt{inf}; step 219219, N=infN = \texttt{inf}. A later line then computes a growth-rate estimate R=N219−N218ΔtR = \frac{N_{219}-N_{218}}{\Delta t} and reports R=nanR = \texttt{nan}. ((a)) Verify, using log⁡1026\log_{10}26, that step 218218 is indeed the first step at which NN exceeds the largest finite binary64 magnitude, 1.80×103081.80\times10^{308}. ((b)) Name the arithmetic operation that produces the first inf\texttt{inf}. ((c)) Name the arithmetic operation that produces the nan\texttt{nan} in the rate calculation.

Browse the problem library