For some integral, the trapezium rule with 2 strips gives T2=1.5 and the mid-ordinate rule with 2 strips gives M2=1.25. Use the relation S2n=31(2Mn+Tn) to find Simpson's estimate S4.
dx2d2y=−y, with y=1 and dxdy=0 at x=0. Using y1≈y0+hy0′+2h2y0′′ for the first step, and then h2yr+1−2yr+yr−1≈yr′′, estimate y(0.2) with h=0.1, to 5 decimal places.
dxdy=y, y(0)=1. Euler's method with h=0.5 gives y(1)≈2.25. Use Euler's method with h=0.25 to estimate y(1), to 4 decimal places, and compare the errors of the two estimates.
The region under y=e−x2 for 0≤x≤1 is rotated through 2π about the x-axis. Use Simpson's rule with 4 strips to estimate the volume, to 3 significant figures.
A car's speed v m s−1 is recorded every 2 seconds: at t=0,2,4,6,8, v=0,5,8,9,8. Use Simpson's rule to estimate the distance travelled in the 8 seconds, giving the exact value of the estimate.
Suppose f′′>0 on [a,b] (the graph is convex). Prove that for one strip, (b−a)f(2a+b)≤∫abfdx≤2b−a[f(a)+f(b)], and deduce that for any number of strips Mn≤I≤Tn. Illustrate with ∫01exdx and n=4.
Answer
Mn≤I≤Tn for convex f; e.g. 1.71382≤1.71828≤1.72722
dx2d2y=x+y, with y=1 and dxdy=0 at x=0. Use the approximation yr+1=2yr−yr−1+h2yr′′ with h=0.2 (finding y1 from a Taylor expansion) to estimate y(0.4), to 4 decimal places.
dxdy=y2, y(0)=1. Use the improved Euler method with h=0.1 to estimate y(0.2), to 4 decimal places, and compare with Euler's estimate (Q10) and the exact value 1.25.
The error in Simpson's rule for ∫abfdx with strip width h is at most 180(b−a)h4max∣f(4)∣. Find the smallest (even) number of strips that guarantees an error below 10−6 for ∫01exdx.
Show that one step of the improved Euler method applied to dxdy=y multiplies y by 1+h+2h2. Hence estimate y(1) for y(0)=1 using h=0.5, to 4 decimal places.
Prove that for any function and any n, Simpson's rule with 2n strips satisfies S2n=31(2Mn+Tn), where Mn and Tn are the mid-ordinate and trapezium estimates with n strips. Check it numerically for ∫01exdx with n=2.
Answer
S2n=31(2Mn+Tn); e.g. 31(2×1.70051+1.75393)=1.71832=S4
For dxdy=y, y(0)=1, Euler's method gives E(0.1)=1.110 and E(0.05)=1.0520 as estimates of y(1). Assuming the error is approximately proportional to h, form the improved estimate 2E(0.05)−E(0.1), to 4 decimal places.
A damped oscillator satisfies x¨+0.5x˙+4x=0, x(0)=1, x˙(0)=0. Using x¨r≈h2xr+1−2xr+xr−1 and x˙r≈2hxr+1−xr−1, with h=0.1 and x1≈x0+hx˙0+2h2x¨0, estimate x(0.3), to 4 decimal places.
The integral ∫01xcosxdx cannot be estimated directly by Simpson's rule, because the integrand is infinite at x=0. Use the substitution x=t2 to write it as 2∫01cos(t2)dt, and then estimate it with Simpson's rule using 4 strips, to 4 decimal places.
For dxdy=y, y(0)=1, the improved Euler method gives y(1)≈2.640625 with h=0.5 and 2.694856 with h=0.25. Find the ratio of the errors, to 2 significant figures, and use the fact that the method is second order to form the extrapolated estimate 31(4E(0.25)−E(0.5)), to 4 decimal places.
Simpson's rule on [−h,h] with two strips is 3h[f(−h)+4f(0)+f(h)]. Prove that it is exact for f(x)=1,x,x2,x3, and hence for every cubic. Show that it is not exact for x4, and find its error there.
Answer
Exact for all cubics; for x4 the rule overestimates by 154h5
The classical Runge–Kutta method (RK4) takes a step with k1=f(x,y), k2=f(x+2h,y+2hk1), k3=f(x+2h,y+2hk2), k4=f(x+h,y+hk3) and ynew=y+6h(k1+2k2+2k3+k4). Apply one step with h=0.2 to dxdy=x+y, y(0)=1, giving y(0.2) to 4 decimal places. Compare with the exact value.
Let f have a continuous fourth derivative, and let E(h)=3h[f(−h)+4f(0)+f(h)]−∫−hhf(x)dx. Using Taylor's theorem for f about 0 up to the x4 term, show that E(h)=90h5f(4)(0)+O(h6). Deduce that composite Simpson's rule on [a,b] has error approximately 180(b−a)h4f(4).
Euler's method with n steps of size h=n1 estimates e=y(1) for y′=y, y(0)=1, by En=(1+n1)n (Q38). Using ln(1+h)=h−2h2+O(h3), prove that e−En=2ne+O(n21). Check the formula for n=1000.
Answer
e−En=2ne+O(n−2); e.g. n=1000: 0.0013579 vs 0.0013591
When the improved Euler method is applied to dxdy=λy with λ<0, each step multiplies y by R(z)=1+z+2z2, where z=λh (Q39). Prove that ∣R(z)∣≤1 exactly when −2≤z≤0. Hence find the largest step h for which the method gives non-growing solutions of dxdy=−10y.
The backward (implicit) Euler method uses the slope at the end of the step: yr+1=yr+hf(xr+1,yr+1). Apply it to dxdy=−10y, y(0)=1, with h=0.25 (the step that made ordinary Euler blow up in Q36) to estimate y(1), to 4 significant figures. Show that the method never gives growing solutions of y′=λy with λ<0, whatever the step size.
Simpson's estimates of ∫01xdx=32 with 2, 4 and 8 strips are S2=0.638071, S4=0.656526, S8=0.663079. Find the ratio of successive errors, to 2 significant figures, and explain why it is not 16.
Answer
Ratio ≈2.8≈23/2: the error behaves like h1.5, not h4
A pendulum satisfies θ¨=−sinθ, θ(0)=1, θ˙(0)=0. Using θ1=θ0+2h2θ¨0 and then θr+1=2θr−θr−1−h2sinθr, with h=0.1, estimate θ(0.3), to 4 decimal places. Compare with the small-angle approximation θ=cost.
The boundary value problemy′′=2, y(0)=0, y(1)=0 is to be solved numerically with h=0.25. Replacing y′′ at each interior point xr by h2yr+1−2yr+yr−1 gives three simultaneous equations for y1,y2,y3. Solve them to estimate y(0.5), and explain why the answer is exact.
For I=∫01ex2dx, Simpson's rule gives S4=1.4637108 and S8=1.4627234. Using the fact that the error is approximately proportional to h4, form the improved estimate 151(16S8−S4), to 6 decimal places.
The formula yr+1=yr−1+2h(dxdy)r (Q19) is applied to dxdy=−y. Show that yr=μr satisfies the recurrence when μ2+2hμ−1=0. For h=0.1, find the root of larger size, to 4 decimal places, and explain why the method eventually fails for this equation however good the starting values.
Answer
μ2=−1.1050; the parasitic solution grows like 1.105r with alternating sign, so the method is unstable for decaying equations