Work in the float32 arithmetic of the harmonic-series example

PHYSICS · Multi-part · Fermi University Physics · Mathematical Methods for Physics · Numerical and computational mathematics · Numerical and computational mathematics

Scientific Computing for Physicists, Ch The numerical toolkit closed: backward error and the audit of a library routine

Problem

Work in the float32 arithmetic of the harmonic-series example, with ϵmach=2−23\epsilon_{\rm mach}=2^{-23} and every operation rounded to nearest. ((a)) For three terms, write the recursively computed sum fl(fl(x1+x2)+x3)\mathrm{fl}(\mathrm{fl}(x_1+x_2)+x_3) with one rounding factor (1+δk)(1+\delta_k) per addition, and show that to first order in ϵmach\epsilon_{\rm mach} the effective perturbations on x1x_1, x2x_2 and x3x_3 are δ2+δ3\delta_2+\delta_3, δ2+δ3\delta_2+\delta_3 and δ3\delta_3. Explain how this pattern gives the bound (N−1)ϵmach/2(N-1)\epsilon_{\rm mach}/2 for NN terms, and evaluate it for N=220N=2^{20}. ((b)) The float32 value stored for 0.10.1 is x=0.100 000 001 490 116 12x=0.100\,000\,001\,490\,116\,12. Add xx to itself N=220N=2^{20} times in float32, once with a plain running total and once with Kahan's update, and give the relative error of each against the exact sum NxNx. Explain why Nx=104 857.601 562 5Nx=104\,857.601\,562\,5 is exact. ((c)) State whether each error respects its bound, and what the comparison shows about growth with NN.

Browse the problem library