Skip to main content

Numerical Methods — Diagnostic Tests

Unit Tests

Tests edge cases, boundary conditions, and common misconceptions for numerical methods.

UT-1: Newton-Raphson Divergence Near a Turning Point

Question:

The function f(x)=x32x+2f(x) = x^3 - 2x + 2 has a root near x=1.77x = -1.77.

(a) Show that f(x)=0f(x) = 0 has exactly one real root.

(b) Apply the Newton-Raphson formula with initial value x0=0x_0 = 0. Compute x1x_1, x2x_2, and x3x_3. Describe the behaviour of the iteration.

(c) Explain why the iteration fails to converge, referring to the value of f(x0)f'(x_0) and the geometry of the Newton-Raphson method.

(d) Find a value of x0x_0 for which the Newton-Raphson method does converge to the root.

[Difficulty: hard. Tests the classic failure case of Newton-Raphson where the initial value is near a point where the derivative is small, causing the tangent to project far from the root.]

Solution:

(a) f(x)=3x22=0f'(x) = 3x^2 - 2 = 0 gives x=±2/3±0.816x = \pm\sqrt{2/3} \approx \pm 0.816.

f ⁣(2/3)=LB26RB◆◆LB9RB+LB26RB◆◆LB3RB+2=LB46RB◆◆LB9RB+23.09f\!\left(-\sqrt{2/3}\right) = -\frac◆LB◆2\sqrt{6}◆RB◆◆LB◆9◆RB◆ + \frac◆LB◆2\sqrt{6}◆RB◆◆LB◆3◆RB◆ + 2 = \frac◆LB◆4\sqrt{6}◆RB◆◆LB◆9◆RB◆ + 2 \approx 3.09 (local maximum).

f ⁣(2/3)=LB26RB◆◆LB9RBLB26RB◆◆LB3RB+2=LB46RB◆◆LB9RB+20.91f\!\left(\sqrt{2/3}\right) = \frac◆LB◆2\sqrt{6}◆RB◆◆LB◆9◆RB◆ - \frac◆LB◆2\sqrt{6}◆RB◆◆LB◆3◆RB◆ + 2 = -\frac◆LB◆4\sqrt{6}◆RB◆◆LB◆9◆RB◆ + 2 \approx 0.91 (local minimum).

Since the local minimum is positive (0.91\approx 0.91), the graph crosses the xx-axis only once (to the left of the local maximum, where ff goes from -\infty to the maximum). So there is exactly one real root.

(b) f(x)=3x22f'(x) = 3x^2 - 2. Newton-Raphson: xn+1=xnf(xn)f(xn)x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}.

x0=0x_0 = 0: f(0)=2f(0) = 2, f(0)=2f'(0) = -2.

x1=022=1x_1 = 0 - \frac{2}{-2} = 1

x1=1x_1 = 1: f(1)=1f(1) = 1, f(1)=1f'(1) = 1.

x2=111=0x_2 = 1 - \frac{1}{1} = 0

x2=0x_2 = 0: f(0)=2f(0) = 2, f(0)=2f'(0) = -2.

x3=022=1x_3 = 0 - \frac{2}{-2} = 1

The iteration cycles: 0,1,0,1,0,1,0, 1, 0, 1, 0, 1, \ldots

(c) The iteration fails because at x0=0x_0 = 0, the tangent to the curve has gradient f(0)=2f'(0) = -2, which points towards x=1x = 1 rather than towards the root at x1.77x \approx -1.77. The Newton-Raphson method overshoots dramatically because the tangent at x=0x = 0 intersects the xx-axis at x=1x = 1, which is on the opposite side of the local minimum. The iteration then gets trapped in a 2-cycle between x=0x = 0 and x=1x = 1.

More precisely, the problem is that f(0)0f'(0) \neq 0 but the initial guess is far from the root relative to the curvature of the function. The function has a local minimum at x0.816x \approx 0.816 with f0.91>0f \approx 0.91 \gt 0, creating a barrier that the iteration cannot cross.

(d) Any x0<2/30.816x_0 \lt -\sqrt{2/3} \approx -0.816 will converge, since on this interval ff is strictly decreasing (and hence ff and ff' have useful properties for convergence).

For example, x0=2x_0 = -2: f(2)=2f(-2) = -2, f(2)=10f'(-2) = 10.

x1=2210=2+0.2=1.8x_1 = -2 - \frac{-2}{10} = -2 + 0.2 = -1.8

x2=1.81.83+3.6+23(3.24)2=1.85.832+5.67.72=1.8+0.2327.721.770x_2 = -1.8 - \frac{-1.8^3 + 3.6 + 2}{3(3.24)-2} = -1.8 - \frac{-5.832 + 5.6}{7.72} = -1.8 + \frac{0.232}{7.72} \approx -1.770

This converges rapidly to the root.


UT-2: Fixed-Point Iteration Convergence Criterion

Question:

The equation x=g(x)x = g(x) is to be solved by fixed-point iteration xn+1=g(xn)x_{n+1} = g(x_n), where g(x)=12(x+3x)g(x) = \frac{1}{2}(x + \frac{3}{x}).

(a) Show that the equation x=g(x)x = g(x) is equivalent to x2=3x^2 = 3, and hence state the positive root α\alpha.

(b) Compute x1x_1, x2x_2, x3x_3 starting from x0=2x_0 = 2.

(c) Verify the convergence criterion g(α)<1\lvert g'(\alpha) \rvert \lt 1 at the root.

(d) A student proposes the rearrangement x=x23+xx = x^2 - 3 + x (i.e. g(x)=x23+xg(x) = x^2 - 3 + x) to solve x2=3x^2 = 3. Show that this iteration diverges when x0=2x_0 = 2, and explain why by evaluating g(3)\lvert g'(\sqrt{3}) \rvert.

[Difficulty: hard. Tests the fixed-point iteration convergence theorem and the dependence of convergence on the choice of rearrangement.]

Solution:

(a) x=12(x+3x)    2x=x+3x    x=3x    x2=3x = \frac{1}{2}(x + \frac{3}{x}) \implies 2x = x + \frac{3}{x} \implies x = \frac{3}{x} \implies x^2 = 3.

Positive root: α=3\alpha = \sqrt{3}.

(b) x0=2x_0 = 2:

x1=12(2+32)=74=1.75x_1 = \frac{1}{2}\left(2 + \frac{3}{2}\right) = \frac{7}{4} = 1.75

x2=12(74+LB3×4RB◆◆LB7RB)=12(74+127)=1249+4828=97561.73214x_2 = \frac{1}{2}\left(\frac{7}{4} + \frac◆LB◆3 \times 4◆RB◆◆LB◆7◆RB◆\right) = \frac{1}{2}\left(\frac{7}{4} + \frac{12}{7}\right) = \frac{1}{2} \cdot \frac{49 + 48}{28} = \frac{97}{56} \approx 1.73214

x3=12(9756+LB3×56RB◆◆LB97RB)=12(9756+16897)=129409+94085432=18817108641.73205x_3 = \frac{1}{2}\left(\frac{97}{56} + \frac◆LB◆3 \times 56◆RB◆◆LB◆97◆RB◆\right) = \frac{1}{2}\left(\frac{97}{56} + \frac{168}{97}\right) = \frac{1}{2} \cdot \frac{9409 + 9408}{5432} = \frac{18817}{10864} \approx 1.73205

The iteration converges rapidly to 31.73205\sqrt{3} \approx 1.73205.

(c) g(x)=12(13x2)g'(x) = \frac{1}{2}\left(1 - \frac{3}{x^2}\right).

At x=α=3x = \alpha = \sqrt{3}: g(3)=12(11)=0g'(\sqrt{3}) = \frac{1}{2}(1 - 1) = 0.

Since g(3)=0<1\lvert g'(\sqrt{3}) \rvert = 0 \lt 1, the fixed-point iteration converges (with quadratic convergence, since g(α)=0g'(\alpha) = 0).

(d) g(x)=x23+xg(x) = x^2 - 3 + x. g(x)=2x+1g'(x) = 2x + 1.

At x=3x = \sqrt{3}: g(3)=23+14.464g'(\sqrt{3}) = 2\sqrt{3} + 1 \approx 4.464.

Since g(3)4.464>1\lvert g'(\sqrt{3}) \rvert \approx 4.464 \gt 1, the fixed-point theorem tells us this iteration diverges near the root.

Verification with x0=2x_0 = 2:

x1=43+2=3x_1 = 4 - 3 + 2 = 3

x2=93+3=9x_2 = 9 - 3 + 3 = 9

x3=813+9=87x_3 = 81 - 3 + 9 = 87

Clearly diverging.


UT-3: Trapezium Rule — Overestimate vs Underestimate

Question:

(a) Use the trapezium rule with 4 strips to estimate 02xdx\int_0^2 \sqrt{x}\, dx, giving your answer to 4 decimal places.

(b) Determine whether your estimate is an overestimate or underestimate, justifying your answer by examining the concavity of f(x)=xf(x) = \sqrt{x}.

(c) The exact value of the integral is LB42RB◆◆LB3RB\frac◆LB◆4\sqrt{2}◆RB◆◆LB◆3◆RB◆. Calculate the percentage error of the trapezium rule estimate.

(d) How many strips would be needed to guarantee that the trapezium rule estimate of 02xdx\int_0^2 \sqrt{x}\, dx is within 0.0010.001 of the exact value? (The error bound for the trapezium rule with nn strips on [a,b][a, b] is (ba)312n2max[a,b]f(x)\frac{(b-a)^3}{12n^2}\max_{[a,b]}\lvert f''(x) \rvert.)

[Difficulty: hard. Tests the trapezium rule with concavity analysis for error direction, and the error bound formula for determining required strip count.]

Solution:

(a) n=4n = 4 strips, width h=204=0.5h = \frac{2-0}{4} = 0.5.

xx00.511.52
y=xy = \sqrt{x}0LB1RB◆◆LB2RB0.7071\frac◆LB◆1◆RB◆◆LB◆\sqrt{2}◆RB◆ \approx 0.707111.51.2247\sqrt{1.5} \approx 1.224721.4142\sqrt{2} \approx 1.4142

T4=0.52[0+2(0.7071+1+1.2247)+1.4142]T_4 = \frac{0.5}{2}\left[0 + 2(0.7071 + 1 + 1.2247) + 1.4142\right]

=0.25[0+5.8636+1.4142]=0.25×7.2778=1.8194= 0.25[0 + 5.8636 + 1.4142] = 0.25 \times 7.2778 = 1.8194

(b) f(x)=x1/2f(x) = x^{1/2}. f(x)=12x1/2f'(x) = \frac{1}{2}x^{-1/2}. f(x)=14x3/2f''(x) = -\frac{1}{4}x^{-3/2}.

For x(0,2]x \in (0, 2]: f(x)=14x3/2<0f''(x) = -\frac{1}{4}x^{-3/2} \lt 0.

Since f(x)<0f''(x) \lt 0 on (0,2](0, 2], the curve is concave down. The trapezium rule overestimates when the curve is concave down (the trapezia lie above the curve).

(c) Exact value: LB42RB◆◆LB3RB1.8856\frac◆LB◆4\sqrt{2}◆RB◆◆LB◆3◆RB◆ \approx 1.8856.

Percentage error=LB1.81941.8856RB◆◆LB1.8856RB×100%3.51%\text{Percentage error} = \frac◆LB◆\lvert 1.8194 - 1.8856 \rvert◆RB◆◆LB◆1.8856◆RB◆ \times 100\% \approx 3.51\%

(d) The error bound: E(ba)312n2max[a,b]f(x)\lvert E \rvert \leq \frac{(b-a)^3}{12n^2}\max_{[a,b]}\lvert f''(x) \rvert.

f(x)=14x3/2f''(x) = -\frac{1}{4}x^{-3/2}. On (0,2](0, 2], f(x)f''(x) is unbounded as x0+x \to 0^+.

The maximum of f(x)\lvert f''(x) \rvert on [0,2][0, 2] does not exist (it diverges). The error bound formula is not directly applicable because ff'' is unbounded at x=0x = 0.

However, on the subinterval [ϵ,2][\epsilon, 2] for any ϵ>0\epsilon \gt 0: maxf(x)=14ϵ3/2\max \lvert f''(x) \rvert = \frac{1}{4}\epsilon^{-3/2}.

This illustrates a limitation of the trapezium rule error bound: it requires the second derivative to be bounded, which is not the case here. For functions with singularities at endpoints, alternative methods or a change of variable are needed.

Practically, using n=8n = 8 strips gives h=0.25h = 0.25:

T8=0.252[0+2(0.25+0.5+0.75+1+1.25+1.5+1.75)+2]T_8 = \frac{0.25}{2}[0 + 2(\sqrt{0.25} + \sqrt{0.5} + \sqrt{0.75} + 1 + \sqrt{1.25} + \sqrt{1.5} + \sqrt{1.75}) + \sqrt{2}]

0.125[0+2(0.5+0.7071+0.8660+1+1.1180+1.2247+1.3229)+1.4142]\approx 0.125[0 + 2(0.5 + 0.7071 + 0.8660 + 1 + 1.1180 + 1.2247 + 1.3229) + 1.4142]

=0.125[0+2×6.7387+1.4142]=0.125×14.8916=1.8615= 0.125[0 + 2 \times 6.7387 + 1.4142] = 0.125 \times 14.8916 = 1.8615

Error: 1.86151.8856=0.0241\lvert 1.8615 - 1.8856 \rvert = 0.0241. Still greater than 0.0010.001.

For practical purposes, approximately n=100n = 100 strips would be needed to achieve accuracy within 0.0010.001 for this integral.


Integration Tests

Tests synthesis of numerical methods with other topics. Requires combining concepts from multiple units.

IT-1: Newton-Raphson Applied to f(x)=0f'(x) = 0 (with Differentiation)

Question:

The function f(x)=x44x3+8x28x+3f(x) = x^4 - 4x^3 + 8x^2 - 8x + 3.

(a) Find f(x)f'(x) and f(x)f''(x).

(b) Use the Newton-Raphson method with x0=1x_0 = 1 to find a stationary point of ff to 4 decimal places. (Apply Newton-Raphson to f(x)=0f'(x) = 0.)

(c) Classify the stationary point you found in part (b).

(d) Show that f(x)=(x1)4f(x) = (x-1)^4 and hence explain why the Newton-Raphson method converges rapidly in this case.

[Difficulty: hard. Applies Newton-Raphson to the derivative function to locate stationary points, combining numerical methods with differentiation.]

Solution:

(a) f(x)=x44x3+8x28x+3f(x) = x^4 - 4x^3 + 8x^2 - 8x + 3.

f(x)=4x312x2+16x8f'(x) = 4x^3 - 12x^2 + 16x - 8

f(x)=12x224x+16f''(x) = 12x^2 - 24x + 16

(b) We apply Newton-Raphson to g(x)=f(x)=4x312x2+16x8g(x) = f'(x) = 4x^3 - 12x^2 + 16x - 8:

g(x)=f(x)=12x224x+16g'(x) = f''(x) = 12x^2 - 24x + 16.

x0=1x_0 = 1: g(1)=412+168=0g(1) = 4 - 12 + 16 - 8 = 0.

Since g(1)=0g(1) = 0, the Newton-Raphson formula gives x1=10g(1)=1x_1 = 1 - \frac{0}{g'(1)} = 1. The iteration has already converged.

The stationary point is at x=1x = 1.

Let me check with x0=1.5x_0 = 1.5 instead:

g(1.5)=4(3.375)12(2.25)+16(1.5)8=13.527+248=2.5g(1.5) = 4(3.375) - 12(2.25) + 16(1.5) - 8 = 13.5 - 27 + 24 - 8 = 2.5.

g(1.5)=12(2.25)24(1.5)+16=2736+16=7g'(1.5) = 12(2.25) - 24(1.5) + 16 = 27 - 36 + 16 = 7.

x1=1.52.571.50.357=1.143x_1 = 1.5 - \frac{2.5}{7} \approx 1.5 - 0.357 = 1.143.

g(1.143)4(1.493)12(1.306)+16(1.143)8=5.97215.672+18.2888=0.588g(1.143) \approx 4(1.493) - 12(1.306) + 16(1.143) - 8 = 5.972 - 15.672 + 18.288 - 8 = 0.588.

g(1.143)12(1.306)24(1.143)+16=15.67227.432+16=4.240g'(1.143) \approx 12(1.306) - 24(1.143) + 16 = 15.672 - 27.432 + 16 = 4.240.

x2=1.1430.5884.2401.004x_2 = 1.143 - \frac{0.588}{4.240} \approx 1.004.

x31.000x_3 \approx 1.000. Converges to x=1x = 1.

(c) f(1)=1224+16=4>0f''(1) = 12 - 24 + 16 = 4 \gt 0, so x=1x = 1 is a local minimum.

f(1)=14+88+3=0f(1) = 1 - 4 + 8 - 8 + 3 = 0.

The point (1,0)(1, 0) is a local minimum.

(d) f(x)=(x1)4=x44x3+6x24x+1f(x) = (x-1)^4 = x^4 - 4x^3 + 6x^2 - 4x + 1.

But f(x)=x44x3+8x28x+3(x1)4f(x) = x^4 - 4x^3 + 8x^2 - 8x + 3 \neq (x-1)^4.

Let me check: (x1)4=x44x3+6x24x+1(x-1)^4 = x^4 - 4x^3 + 6x^2 - 4x + 1, while f(x)=x44x3+8x28x+3f(x) = x^4 - 4x^3 + 8x^2 - 8x + 3.

These are different. The question's claim is incorrect.

The actual stationary point structure: f(x)=4x312x2+16x8=4(x33x2+4x2)=4(x1)(x22x+2)f'(x) = 4x^3 - 12x^2 + 16x - 8 = 4(x^3 - 3x^2 + 4x - 2) = 4(x-1)(x^2 - 2x + 2).

x22x+2=(x1)2+1>0x^2 - 2x + 2 = (x-1)^2 + 1 \gt 0 for all real xx, so x=1x = 1 is the only stationary point.

The Newton-Raphson method converges rapidly because f(x)=4(x1)((x1)2+1)f'(x) = 4(x-1)((x-1)^2+1) has a simple root at x=1x = 1 (multiplicity 1), so g(1)=f(1)=40g'(1) = f''(1) = 4 \neq 0, ensuring quadratic convergence near the root.


IT-2: Solving cosx=x\cos x = x Numerically (with Trigonometry)

Question:

(a) Show that the equation cosx=x\cos x = x has exactly one real root in the interval [0,LBπRB◆◆LB2RB][0, \frac◆LB◆\pi◆RB◆◆LB◆2◆RB◆].

(b) Use the fixed-point iteration xn+1=cosxnx_{n+1} = \cos x_n with x0=0.5x_0 = 0.5 to find the root to 5 decimal places.

(c) Explain why this iteration converges by examining g(x)\lvert g'(x) \rvert where g(x)=cosxg(x) = \cos x.

(d) Use the Newton-Raphson method with x0=0.5x_0 = 0.5 to find the root to 5 decimal places. Compare the number of iterations required with the fixed-point method.

[Difficulty: hard. Combines the intermediate value theorem with two numerical methods, comparing their convergence rates.]

Solution:

(a) Let h(x)=cosxxh(x) = \cos x - x. We need h(x)=0h(x) = 0.

h(0)=10=1>0h(0) = 1 - 0 = 1 \gt 0.

h ⁣(LBπRB◆◆LB2RB)=0LBπRB◆◆LB2RB<0h\!\left(\frac◆LB◆\pi◆RB◆◆LB◆2◆RB◆\right) = 0 - \frac◆LB◆\pi◆RB◆◆LB◆2◆RB◆ \lt 0.

By the intermediate value theorem, there is at least one root in [0,LBπRB◆◆LB2RB][0, \frac◆LB◆\pi◆RB◆◆LB◆2◆RB◆].

h(x)=sinx1<0h'(x) = -\sin x - 1 \lt 0 for all xx (since sinx0\sin x \geq 0 on [0,LBπRB◆◆LB2RB][0, \frac◆LB◆\pi◆RB◆◆LB◆2◆RB◆]).

Since hh is strictly decreasing, there is at most one root. Combined with existence, there is exactly one root.

(b) x0=0.5x_0 = 0.5:

x1=cos(0.5)0.87758x_1 = \cos(0.5) \approx 0.87758

x2=cos(0.87758)0.63901x_2 = \cos(0.87758) \approx 0.63901

x3=cos(0.63901)0.80269x_3 = \cos(0.63901) \approx 0.80269

x4=cos(0.80269)0.69478x_4 = \cos(0.80269) \approx 0.69478

x5=cos(0.69478)0.76820x_5 = \cos(0.69478) \approx 0.76820

x6=cos(0.76820)0.71917x_6 = \cos(0.76820) \approx 0.71917

x7=cos(0.71917)0.75236x_7 = \cos(0.71917) \approx 0.75236

x8=cos(0.75236)0.73012x_8 = \cos(0.75236) \approx 0.73012

x9=cos(0.73012)0.74512x_9 = \cos(0.73012) \approx 0.74512

x10=cos(0.74512)0.73501x_{10} = \cos(0.74512) \approx 0.73501

This converges slowly (oscillating above and below the root). After approximately 25-30 iterations, xn0.73909x_n \approx 0.73909.

To 5 decimal places: α0.73909\alpha \approx 0.73909.

(c) g(x)=cosxg(x) = \cos x, g(x)=sinxg'(x) = -\sin x.

At the root α0.739\alpha \approx 0.739: g(α)=sin(0.739)sin(0.739)0.674\lvert g'(\alpha) \rvert = \lvert -\sin(0.739) \rvert \approx \sin(0.739) \approx 0.674.

Since g(α)0.674<1\lvert g'(\alpha) \rvert \approx 0.674 \lt 1, the fixed-point iteration converges (linearly, since 0<g(α)<10 \lt \lvert g'(\alpha) \rvert \lt 1).

(d) Newton-Raphson: f(x)=cosxxf(x) = \cos x - x, f(x)=sinx1f'(x) = -\sin x - 1.

x0=0.5x_0 = 0.5: f(0.5)=cos0.50.50.37758f(0.5) = \cos 0.5 - 0.5 \approx 0.37758, f(0.5)=sin0.511.47943f'(0.5) = -\sin 0.5 - 1 \approx -1.47943.

x1=0.50.377581.479430.5+0.25521=0.75521x_1 = 0.5 - \frac{0.37758}{-1.47943} \approx 0.5 + 0.25521 = 0.75521

x2=0.75521LBcos0.755210.75521RB◆◆LBsin0.755211RB0.755210.027601.685600.755210.01637=0.73884x_2 = 0.75521 - \frac◆LB◆\cos 0.75521 - 0.75521◆RB◆◆LB◆-\sin 0.75521 - 1◆RB◆ \approx 0.75521 - \frac{-0.02760}{-1.68560} \approx 0.75521 - 0.01637 = 0.73884

x30.73884LBcos0.738840.73884RB◆◆LBsin0.738841RB0.738840.000041.673780.73909x_3 \approx 0.73884 - \frac◆LB◆\cos 0.73884 - 0.73884◆RB◆◆LB◆-\sin 0.73884 - 1◆RB◆ \approx 0.73884 - \frac{0.00004}{-1.67378} \approx 0.73909

Newton-Raphson converges in 3 iterations to 5 decimal places, compared to approximately 25-30 iterations for fixed-point iteration. Newton-Raphson has quadratic convergence while fixed-point has linear convergence in this case.


IT-3: Estimating 01ex2dx\int_0^1 e^{-x^2}\, dx Using the Trapezium Rule (with Integration)

Question:

The integral 01ex2dx\int_0^1 e^{-x^2}\, dx cannot be evaluated in terms of elementary functions.

(a) Use the trapezium rule with 4 strips to estimate 01ex2dx\int_0^1 e^{-x^2}\, dx, giving your answer to 5 decimal places.

(b) Use the trapezium rule with 8 strips and compare. Determine whether doubling the number of strips approximately quarters the error (as predicted by the error bound).

(c) Determine whether the trapezium rule overestimates or underestimates this integral, by examining the concavity of f(x)=ex2f(x) = e^{-x^2}.

(d) The Maclaurin series for ex2e^{-x^2} is 1x2+x42!x63!+1 - x^2 + \frac{x^4}{2!} - \frac{x^6}{3!} + \cdots. Use the first four terms to estimate the integral, and compare with your trapezium rule estimate.

[Difficulty: hard. Combines the trapezium rule with series expansion to estimate a non-elementary integral, and error analysis via concavity.]

Solution:

(a) n=4n = 4, h=0.25h = 0.25.

xx00.250.50.751
ex2e^{-x^2}1e0.06250.93941e^{-0.0625} \approx 0.93941e0.250.77880e^{-0.25} \approx 0.77880e0.56250.56978e^{-0.5625} \approx 0.56978e10.36788e^{-1} \approx 0.36788

T4=0.252[1+2(0.93941+0.77880+0.56978)+0.36788]T_4 = \frac{0.25}{2}[1 + 2(0.93941 + 0.77880 + 0.56978) + 0.36788]

=0.125[1+4.57598+0.36788]=0.125×5.94386=0.74298= 0.125[1 + 4.57598 + 0.36788] = 0.125 \times 5.94386 = 0.74298

(b) n=8n = 8, h=0.125h = 0.125.

xx00.1250.250.3750.50.6250.750.8751
ex2e^{-x^2}10.984500.939410.869360.778800.677060.569780.463530.36788

T8=0.1252[1+2(0.98450+0.93941+0.86936+0.77880+0.67706+0.56978+0.46353)+0.36788]T_8 = \frac{0.125}{2}[1 + 2(0.98450 + 0.93941 + 0.86936 + 0.77880 + 0.67706 + 0.56978 + 0.46353) + 0.36788]

=0.0625[1+2×5.28244+0.36788]=0.0625[1+10.56488+0.36788]=0.0625×11.93276=0.74580= 0.0625[1 + 2 \times 5.28244 + 0.36788] = 0.0625[1 + 10.56488 + 0.36788] = 0.0625 \times 11.93276 = 0.74580

The exact value (to 5 d.p.) is 01ex2dx0.74682\int_0^1 e^{-x^2}\, dx \approx 0.74682.

Error with T4T_4: 0.742980.74682=0.00384\lvert 0.74298 - 0.74682 \rvert = 0.00384.

Error with T8T_8: 0.745800.74682=0.00102\lvert 0.74580 - 0.74682 \rvert = 0.00102.

Ratio: 0.00384/0.001023.7640.00384 / 0.00102 \approx 3.76 \approx 4. This confirms that doubling the strips approximately quarters the error.

(c) f(x)=ex2f(x) = e^{-x^2}.

f(x)=2xex2f'(x) = -2xe^{-x^2}.

f(x)=2ex2+4x2ex2=ex2(4x22)f''(x) = -2e^{-x^2} + 4x^2 e^{-x^2} = e^{-x^2}(4x^2 - 2).

f(x)=0f''(x) = 0 when 4x2=24x^2 = 2, i.e. x=LB1RB◆◆LB2RB0.707x = \frac◆LB◆1◆RB◆◆LB◆\sqrt{2}◆RB◆ \approx 0.707.

For 0x<LB1RB◆◆LB2RB0 \leq x \lt \frac◆LB◆1◆RB◆◆LB◆\sqrt{2}◆RB◆: 4x22<04x^2 - 2 \lt 0, so f(x)<0f''(x) \lt 0 (concave down).

For LB1RB◆◆LB2RB<x1\frac◆LB◆1◆RB◆◆LB◆\sqrt{2}◆RB◆ \lt x \leq 1: 4x22>04x^2 - 2 \gt 0, so f(x)>0f''(x) \gt 0 (concave up).

Since the concavity changes within the interval, the trapezium rule will overestimate on the concave-down portion and underestimate on the concave-up portion. The net effect depends on the relative magnitudes. In this case, the trapezium rule underestimates overall (both T4T_4 and T8T_8 are below the exact value).

(d) Using the first four terms of the Maclaurin series:

01(1x2+x42x66)dx=[xx33+x510x742]01\int_0^1 \left(1 - x^2 + \frac{x^4}{2} - \frac{x^6}{6}\right) dx = \left[x - \frac{x^3}{3} + \frac{x^5}{10} - \frac{x^7}{42}\right]_0^1

=113+110142=21070+215210=156210=26350.74286= 1 - \frac{1}{3} + \frac{1}{10} - \frac{1}{42} = \frac{210 - 70 + 21 - 5}{210} = \frac{156}{210} = \frac{26}{35} \approx 0.74286

Comparison:

  • Series estimate (4 terms): 0.742860.74286
  • Trapezium rule (T4T_4): 0.742980.74298
  • Exact: 0.746820.74682

The series estimate and T4T_4 are very close, both underestimating by approximately 0.0040.004.