Skip to content
Infinitesimal Dynamics home
Notebook: 0 XP

Numerical Methods / Linear systems, integrals and equations of motion

Numerical Integration and ODE Solvers

From Simpson’s rule to Gaussian quadrature and Runge–Kutta: squeezing more accuracy out of fewer function evaluations.

3 min read · 1 sections · 2 checks

Contents 2 sections
  1. §1Choosing the points too
  2. ?Check yourself

By the end you can

  • Compare the error orders of trapezoid, Simpson and Gauss rules
  • Explain the idea behind Gaussian quadrature
  • Describe the classical Runge–Kutta method

Helps to know: Numerical Integration & Error, Numerical Methods for ODEs

§1Choosing the points too

The trapezoid rule has error O(h2)O(h^2) and Simpson’s rule O(h4)O(h^4). Gaussian quadrature chooses both the weights and the sample points, and with nn points integrates every polynomial of degree up to 2n−12n - 1 exactly.

∫−11f(x) dx≈f ⁣(−13)+f ⁣(13)\int_{-1}^{1} f(x)\,dx \approx f\!\left(-\tfrac{1}{\sqrt3}\right) + f\!\left(\tfrac{1}{\sqrt3}\right)

For y′=f(t,y)y' = f(t, y), Euler’s method has global error O(h)O(h). The classical fourth-order Runge–Kutta method samples the slope four times per step for error O(h4)O(h^4): halving the step cuts the error sixteen-fold.

Preparing the instrument…
Fig. 1 Turn on Euler’s method and shrink the step to watch it close in on the accurate solution.

Check yourself

  1. Q1
    Two-point Gaussian quadrature is exact for polynomials up to degree…
  2. Q2
    Halving the step of a fourth-order method divides the error by about…