Numerical Methods
Level: 2 (Recall — definitions, standard problems, short derivations) Time: 30 minutes Total Marks: 40
Answer all questions. Show working. Use for mathematics.
Q1. (4 marks) Define truncation error and round-off error, giving one clear example of each in numerical computation.
Q2. (4 marks) (a) State what machine epsilon represents in practice. (2) (b) For IEEE 754 double precision with a 52-bit mantissa, compute to 3 significant figures. (2)
Q3. (5 marks) The bisection method is applied to on . (a) Verify a root is bracketed. (1) (b) Perform two iterations, stating the interval after each. (3) (c) State the bracket width after two iterations. (1)
Q4. (5 marks) Derive the Newton–Raphson iteration formula from a first-order Taylor expansion of about . State the update formula and name the order of convergence.
Q5. (5 marks) Perform one iteration of Newton–Raphson to approximate using with initial guess . Give as an exact fraction and as a decimal to 4 d.p.
Q6. (5 marks) Using Lagrange interpolation, find the polynomial through the points , , . Simplify to standard form .
Q7. (4 marks) Approximate using the trapezoidal rule with a single interval (). Give the numerical value to 4 d.p. and state the exact value for comparison.
Q8. (4 marks) Use the central difference formula to approximate for with step . Compare with the exact value.
Q9. (4 marks) Explain the term catastrophic cancellation. Compute directly (4 sig figs each root) and by a rearranged, stable formula; comment on the difference.
Answer keyMark scheme & solutions
Q1. (4 marks)
- Truncation error (1): error from approximating an infinite/exact process by a finite one (e.g. truncating a Taylor series or using finite in a difference formula). Example (1): approximating drops terms.
- Round-off error (1): error from representing real numbers with finite precision on a computer. Example (1): has no exact binary representation in IEEE 754.
Q2. (4 marks) (a) is the gap between and the next representable floating-point number; equivalently the smallest with in machine arithmetic. It bounds relative round-off. (2) (b) . (2)
Q3. (5 marks) (a) , , opposite signs ⇒ root in . (1) (b) Iter 1: , ⇒ root in . (1.5) Iter 2: , ⇒ root in . (1.5) (c) Width . (1)
Q4. (5 marks) Taylor: . (2) Set ⇒ . (1) (1) Convergence is quadratic (order 2) near a simple root. (1)
Q5. (5 marks) , . (1) . (2) . (2) (True .)
Q6. (5 marks) Basis: , , . (2) . (1) . Expand: . (2)
Q7. (4 marks) Trapezoidal, : . (3) Exact . (1) (Overestimate since convex.)
Q8. (4 marks) Central diff: . (3) Exact ; error . (1)
Q9. (4 marks) Catastrophic cancellation (2): loss of significant digits when subtracting two nearly equal numbers, amplifying relative round-off. Direct: , ⇒ difference (digits lost). (1) Stable: . Retains precision. (1)
[
{"claim":"Newton iteration for sqrt5 from x0=2 gives 9/4",
"code":"x0=Rational(2); x1=x0-(x0**2-5)/(2*x0); result=(x1==Rational(9,4))"},
{"claim":"Lagrange interpolant through (0,1),(1,3),(2,7) is x**2+x+1",
"code":"x=symbols('x'); P=1*(x-1)*(x-2)/2 -3*x*(x-2) +7*x*(x-1)/2; result=(expand(P)==x**2+x+1)"},
{"claim":"Trapezoid n=1 for exp on [0,1] equals (1+e)/2",
"code":"val=Rational(1,2)*(exp(0)+exp(1)); result=(simplify(val-(1+E)/2)==0)"},
{"claim":"Central difference of x**3 at 1 with h=0.1 equals 3.01",
"code":"f=lambda t:t**3; d=(f(Rational(11,10))-f(Rational(9,10)))/(2*Rational(1,10)); result=(nsimplify(d)==Rational(301,100))"}
]