Euler's method advances

PHYSICS · Subjective · Fermi University Physics · Mathematical Methods for Physics · Computational Physics · Research software practice, verification and validation

Computational Physics, Ch A workspace that can be rerun next year

Problem

Euler's method advances yn+1=yn+Δt f(tn,yn)y_{n+1}=y_n+\Delta t\,f(t_n,y_n). Apply it to radioactive decay, dy/dt=−λy\mathrm{d}y/\mathrm{d}t=-\lambda y with λ=1 s−1\lambda=1\,\mathrm{s^{-1}} and y(0)=1y(0)=1, using four step sizes Δt=0.5, 0.25, 0.125, 0.0625 s\Delta t=0.5,\,0.25,\,0.125,\,0.0625\,\mathrm{s}, each chosen so that an integer number of steps N=1/ΔtN=1/\Delta t lands exactly on t=1 st=1\,\mathrm{s}. For this equation the Euler estimate after NN steps is yN=(1−λΔt)Ny_N=(1-\lambda\Delta t)^N. The exact solution is y(1)=e−1=0.367879y(1)=e^{-1}=0.367879 (6 d.p.). (a) Compute the four errors ∣yN−e−1∣|y_N-e^{-1}|, to 6 decimal places. (b) Form the three ratios of successive errors (largest step first) and use the smallest-step ratio to estimate the measured order p=log⁡2(ratio)p=\log_2(\text{ratio}). (c) A convergence-order test asserts that the measured order is 11 to within 1515 per cent. Does it pass?

Browse the problem library