Skip to content
Tutorials Center
My learning

Topics

Lesson 10 of 47 ยท Numerical Foundations

Chapter 2 Review: Numerical Foundations

Review chapter 2: floating point and round-off, derivatives and integrals on a grid, root finding and linear systems, with a recap table and a ten-question quiz.

This chapter built your numerical instincts. You learned that numbers carry about 16 digits, that calculus on a grid has measurable error, and that equations are solved by iteration. Use this page to consolidate before time stepping begins in chapter 3.

A cheat sheet with four cards: floating point, calculus on a grid, root finding, linear systems
Chapter 2 in one picture: what to remember about each tool.

What you will review

  • Floating point facts and the cancellation trap.
  • Orders of accuracy and the error floor.
  • Bisection, Newton and the condition number.

Recap table

Topic Key facts Typical mistake
Floating point 53 bits, ฮต โ‰ˆ 2.2e-16, gaps grow with size Comparing floats with ==
Derivatives and integrals Central difference and trapezoid are order 2, Simpson order 4 Making h smaller than the round-off sweet spot
Roots Bisection linear, Newton quadratic, brentq robust Starting Newton where fโ€ฒ โ‰ˆ 0
Linear systems solve, residual, cond(A) Using inv(A) @ b

A convergence study

The best habit from this chapter is the convergence study: run the same computation with several step sizes, tabulate the error, and fit the slope on a log-log plot. The slope is the order of the method. If it does not match theory, either the code has a bug or the function is not smooth enough.

Python Orders of accuracy on one plot

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Chapter review quiz

Quick check ยท 10 questions

of 10 answered You scored / 10 ยท perfect!

  1. 1. Which number is closest to machine epsilon for float64?

    Double precision relative spacing near 1 is 2^-52.
  2. 2. Which rewrite avoids cancellation in 1 - cos(x) for small x?

    The identity 1 - cos x = 2 sin^2(x/2) involves no subtraction of nearly equal numbers.
  3. 3. The forward difference error is proportional to

    It is a first order method; the leading Taylor error is -h f''(x)/2.
  4. 4. You halve h and an integral error drops from 1.6e-3 to 1.0e-4. The order is about

    The ratio is 16 = 2^4, so the order is 4.
  5. 5. The total error of a finite-difference derivative as a function of h typically

    Truncation falls with h, round-off rises; the sum has a minimum.
  6. 6. Which method needs a bracket with a sign change?

    Bisection relies on the intermediate value theorem.
  7. 7. Newton's method fails most likely when

    A nearly flat tangent sends the next guess far away.
  8. 8. Why is inv(A) @ b discouraged?

    Factorization-based solvers are both cheaper and more accurate.
  9. 9. A condition number of 1e8 means about how many double-precision digits remain in x?

    You lose roughly log10 of the condition number, 8 digits, leaving about 8.
  10. 10. What does a tiny residual guarantee for an ill-conditioned system?

    Ill-conditioned systems can have small residuals and large solution errors.

Summary

  • Floating point gives 16 digits; subtract carefully and compare with tolerances.
  • Measure the order of a method with a convergence study on a log-log plot.
  • Pick a root finder for safety (bisection, brentq) or speed (Newton).
  • Solve, do not invert, and read the condition number.

Next: Ordinary Differential Equations: Overview