The Lumenary · Early undergraduate
Numerical methods
Name: ______________________
Date: ______________________
You will learn to
- Explain binary floating-point representation, machine epsilon and the unit roundoff, and prove that subtracting nearly equal numbers amplifies relative error (catastrophic cancellation)
- Implement bisection and Newton's method, prove that bisection always converges for a continuous function with a sign change and that Newton's method converges quadratically near a simple root, and give examples where Newton fails
- Define the order of convergence of an iterative method and estimate it from computed errors
- Derive the error of polynomial interpolation and of difference quotients, and balance truncation error against rounding error
- Implement the composite trapezoidal and Simpson rules and prove their error bounds and for smooth integrands
- 1.
Bisection is started on to find as a root of . After halvings we report the midpoint of the current interval. What is the smallest for which Theorem 3 guarantees an error of at most ?
- 2.
Newton's method for is . Starting from , compute exactly , and in lowest terms. Enter the numerator .
- 3.
For large (say ), which formula computes most accurately in floating point?
- A.
- B., as written
- C.
- D.
- 4.
Newton's method for (the real cube root) gives and diverges from every , although . Which hypothesis of Theorem 4 fails?
- A. is not differentiable at the root (its derivative blows up there), so it is not near the root.
- B.The root is not simple: .
- C.The starting point is too far from the root.
- D. is not continuous at .
- 5.
Apply Simpson's rule with strips () to . What value does it give?
- 6.
Which statements are true? (Choose all that apply.)
- A.The trapezoidal rule integrates every polynomial of degree exactly.
- B.Simpson's rule integrates exactly.
- C.For a smooth integrand, halving divides the trapezoidal error by about .
- D.Simpson's rule has error for .
- E.Simpson's rule with step equals .
- 7.
In binary64 arithmetic, approximately which step minimises the total error of the forward difference for a typical smooth function with , of moderate size?
- A.
- B., the unit roundoff
- C.As small as possible: the error tends to as .
- D.
- 8.
With
IsBinary64 xmeaning " is a positive binary64 number", which Lean statement says that is the gap between and the next larger binary64 number?- A.
IsBinary64 (1 + 2 ^ (-52 : ℤ)) ∧ ∀ x, IsBinary64 x → ¬ (1 < x ∧ x < 1 + 2 ^ (-52 : ℤ)) - B.
∀ x, IsBinary64 x → 1 + 2 ^ (-52 : ℤ) ≤ x - C.
∃ x, IsBinary64 x ∧ 1 < x ∧ x < 1 + 2 ^ (-52 : ℤ) - D.
∀ x, ¬ (1 < x ∧ x < 1 + 2 ^ (-52 : ℤ))
- A.
- 9.
Write
newton(f, df, x0, tol=1e-12, max_iter=50)that runs Newton's method and returns(x, n): the first iterate withabs(f(x)) <= toland the number of steps taken. If a derivative is exactly0, ormax_itersteps pass without success, return(None, n).Computational — Practice