MATH 417 Lecture 10

From Notes
Jump to navigation Jump to search

« previous | Thursday, February 13, 2014 | next »


Section 4.3: Numerical Integration

If we have a function f(x) that is impossible (or really hard) to integrate exactly on an interval [a,b], we can estimate the integral based on the values of f at n+1 points x0,x1,…,xn.

  1. Choose a partition of the interval [a,b] → {Ij}j=1N
  2. Pick ξj∈Ij
  3. Form the riemann sum ∑j=1Nf(ξj)|Ij|.

We usually define partition intervals by a diameter h=maxj|Ij|. The Riemann integral, if it exists, is the limit of the sum as h→0.


In practice, we approximate f(x) with a polynomial pn(x), and then integrate the polynomial:

∫abf(x)dx=∫abpn(x)dx+∫abf(n+1)(ξ(x))(n+1)!(x−x0)…(x−xn)dx

Our error is going to be 0 if f is a polynomial of degree n.

We can get an upper bound on this error by approximating x−x0≤b−a. Hence

|∫abf(n+1)(ξ(x))(n+1)!(x−x0)…(x−xn)dx|≤C(n+1)!|b−a|n+1

For equidistant points, this bound can be better estimated by

|∫abf(n+1)(ξ(x))(n+1)!(x−x0)…(x−xn)dx|≤C(n+1)!hn


  1. Construct a numerical rule which is exact for degree at most n
  2. Find the degree of accuracy[1] of the rule


Quadrature Rule

Given x0,x1,…,xn,

∫abf(x)dx≈∫abpn(x)dx=∫ab∑j=0nf(xj)∏i=0;i≠jnx−xixj−xidx=∑j=0nf(xj)∫abpn,j(x)dx

Thus

∫abf(x)dx≈Qn(f)=∑j=0nAjf(xj), where Aj=∫abpn,j(x)dx=∫ab(x−x0)…(x−xn)(xj−x0)…(xj−xn)dx


In a simple case where x0=a and x1=b, we get the trapezoid rule.

The degree of accuracy is between n and 2n+1.


To find Ai's, we can set up a linear system instead of integrating the Lagrange polynomials

b0=∫ab1dx=A0⋅1+A1⋅1+…+An⋅1b1=∫abxdx=A0⋅x0+A1⋅x1+…+An⋅xnb2=∫abx2dx=A0⋅x02+A1⋅x12+…+An⋅xn2⋮=⋮bn=∫abxndx=A0⋅x0n+A1⋅x1n+…An⋅xnn


Change of Variables

Suppose we have a rule for f(x) when x∈[−1,1]. We can scale the rule to fit an arbitrary interval y∈[a,b] as follows:

−1≤x≤1

a≤y(x)≤b

y(x)=αx+β=b−a2x+a+b2

f(x)=g(y(x)), where g is a polynomial of the same degree:

Performing a substitution in the integral ∫−11g(x)dx gives ∫−11g(y(x))y′(x)dx

y′(x)=b−a2

This integral can now be approximated by B0g(y(−1))+B1g(y(0))+B2g(y(1)), where

Bj=b−a2Aj

f(x)=1+x+x2g(y)=1+y+12+(y+12)2




If ∫abf(x)dx=∑j=0nAjf(xj) for f(x)=1,x,x2,…,x4, then it is also exact for p(x) of degree ≤n.

Take ∫abf(x)dx=∫ab∑k=0nckxk=∑k=0nck∫abxkdx=∑k=0nck∑j=0nAjxjk=∑k=0n∑j=0nAjckxjk=∑j=0nAj∑k=0nckxjk=∑j=0nAjf(xj)


Footnotes

  1. ↑ the degree of accuracy is the largest polynomial degree for which ∫abf(x)dx=Q(f)