Back to 498CQM Home Back to 498CQM Calendar Previous Lecture Next Lecture |
Phys 498CQM Lecture 1Author: Erik Koch, Modified by R. Martin |
HW 1 (due 1/31) |
We will use shorthand notation in all of the following formulae:
fi | = fi | (1) |
fi+1 | = fi + h f'i + h2/2 f''i + h3/6 f'''i + . . . | (2) |
fi-1 | = fi - h f'i + h2/2 f''i - h3/6 f'''i + . . . | (3) |
fi+2 | = fi + 2h f'i + 2h2 f''i + 4h3/3 f'''i + . . . | (4) |
fi-2 | = fi - 2h f'i + 2h2 f''i - 4h3/3 f'''i + . . . | (5) |
. . . |
These numerical differentiation formulae are:
f' | = ( fi+1 - fi ) / h + O( h ) |
f' | = ( fi+1 - fi-1 ) / 2h + O( h2 ) |
f' | = ( -fi+2 + 6 fi+1 - 3 fi - 2 fi-1 ) / 6h + O( h3 ) |
f' | = ( -fi+2 + 8 fi+1 - 8 fi-1 + fi-2 ) / 12h + O( h4 ) |
Examples in class.
This method is very simple. First make an ansatz for the form of the formula you want, and leave the coefficients as variables. For example,
This example has four undetermined coefficents. Now choose four functions you want this formula to treat exactly. For our example we will choose f(x) = 1, f(x) = x - xi, f(x) = (x - xi)2, and f(x) = (x - xi)3.
Plugging these functions into our ansatz gives a linear system of equations,
0 = | a-1 | + a0 | + a1 | + a2 |
1 = | - a-1 | + a1 | + 2 a2 | |
0 = | + a-1 | + a1 | + 4 a2 | |
0 = | - a-1 | + a1 | + 8 a2 |
We can derive a formula for numerical quadrature by using the method of undetermined coefficients.
Suppose we want to numerically integrate f(x) over a finite interval, and use the function values at the end and the midpoint. If we let h be half the length of the interval, we can expect our integral to be approximated by :
To determine the coefficients, we require that our formula be exact for the functions f(x) = 1, f(x) = x - xi, and f(x) = (x - xi)2. These fuctions integrate to 2h, 0, and 2/3 h, respectively.
The linear system of equations that determine the coefficients is
2 = | ai-1 | + ai | + ai+1 |
0 = | - ai-1 | + ai+1 | |
2/3 = | + ai-1 | + ai+1 |
The usual way to apply this formula is to break the integral into a sum of small integrals, and evaluate each small integral using Simpson's rule. Thus, for grid spacing h = L / n, where L is the range of integration and n is an even integer, Simpon's rule applied to the n / 2 small integrals yields the formula:
Using the method of undetermined coefficients, we can derive elementary integration formulas.
Integration Range | Integration Formula | Elementary Error | Composite Error |
0 to h | h / 2 × ( f0 + f1 ) | O( h3 ) | O( h2 ) |
0 to 2 h | h / 3 × ( f0 + 4 f1 + f2 ) | O( h5 ) | O( h4 ) |
0 to 3 h | 3 h / 8 × ( f0 + 3 f1 + 3 f2 + f3 ) | O( h5 ) | O( h4 ) |
0 to 3 h | 2 h / 45 × ( 7 f0 + 32 f1 + 12 f2 + 12 f3 + 32 f4 ) | O( h7 ) | O( h6 ) |
Romberg Integration (see Chapter 4.3 of Numerical Recipies) applies Richardson extrapolation to numerical quadrature. Let Fexact be the exact value of the integral, and let F(h) be the numerical approximation with integration step h. For composite integration with Simpson's rule, which is O( h2 ), the relation between F(h) and Fexact for small h should be: