f(x)
a b x
Lower and Upper sums: approx. of area under the
curve
(A) Lower sums:
a=x0 x1 x2 x3 x4 x5 x6=b
Let P be a partition of the interval [a,b] given by
P= { a=x 0x 1x 2⋯⋯x n−1x n=b }
with partition points x0, x1, ......,xn that divide [a,b] into n
sub-intervals [xi,xi+1].
Greatest lower bound (infimum, inf) of f(x) on the sub-interval
[xi,xi+1] is: m i=inf { f x: x ixx i1 }
n−1
Lf ; P=∑ mi x i1−x i Underestimates
Lower sum of f(x): i=0
Lower and Upper sums: approx. of area under the
curve
(A) Upper sums:
a=x0 x1 x2 x3 x4 x5 x6=b
Let P be a partition of the interval [a,b] given by
P= { a=x 0x 1x 2⋯⋯x n−1x n=b }
with partition points x0, x1, ......,xn that divide [a,b] into n
sub-intervals [xi,xi+1].
Least upper bound (suppremum, sup) of f(x) on the
Sub-interval [xi,xi+1] is: M i=sup { f x: x i xx i1 }
n−1
n−1
L=∑ f x i x
i=0
Right Riemann Sum
n−1
R=∑ f x i1 x
i=0
An example:
1
−x 2
Evaluate the integral of : ∫e dx
0
n−1 n−1
x 2i
U f ; P n =∑ h f x i =h ∑ e
i=0 i=0
1 1 −3
[U f ; P−Lf ; P] ∗10
2 2
1 −1 −3
/ne −e 10
n7385
Trapezoidal Rule
a=x0 x1 x2 x3 x4 x5=b
where xi+1-xi=h=(b-a)/n
An efficient way of doing it is:
b
{ }
n−1
1
∫ f xdx≈h 2 [ f x 0 f xn ]∑ f xi
a i=1
program Trapezoid
integer i; real h, sum, x
integer n 60; real a 0, b 1
h (b-a)/n
sum 1/2[f(a)+f(b)]
for i=1 to n-1 do
x a+ih
sum sum+f(x)
end for
sum (sum)h
output sum
end program Trapezoid
{ }
n−1
1
∫ f xdx≈h 2 [ f x 0 f xn ]∑ f xi
a i=1
n−1
h
=h ∑ f aih [f af b]
i=1 2
22 R(2,0)
23 R(3,0)
The sub-intervals for R(n-1,0) are twice the size of those for
R(n,0), i.e., h should be replaced with 2h
2n−1 −1
R n−1,0=2h ∑ f a2 j h2C
j=1
2n −1 2n−1−1
1
R n ,0− R n−1,0=h ∑ f aih−h ∑ f a2 j h
2 i=1 j=1
n−1
2
=h ∑ f [a2 k−1h]
k=1
Recursive Trapezoid Formula:
n
h=b−a/2
1
R 0,0= b−a[ f af b]
2
Advantage: Allows us to compute a sequence of
approximations to a definite integral using the trapezoid rule
without re-evaluating the integrand at points where it has
already been evaluated.
Romberg Algorithm:
✔ Uses a combination of Richardson extrapolation and
Recursive Trapezoid formula.
R(0,0)
R(1,0) R(1,1)
R(2,0) R(2,1) R(2,2)
R(3,0) R(3,1) R(3,2) R(3,3)
. . . . .
. . . . .
R(n-1,0) R(n-1,1) . . R(n-1,n-1)
R(n,0) R(n,1) R(n,2) R(n,3) ................R(n,n)
The first column contains estimates using Recursive
Trapezoid Formula
1
R 0,0= b−a[f af b]
2
1 1 ab
R 1,0= R 0,0 b−a f
2 2 2
n−1
2
1
R n ,0= R n−1,0h ∑ f [a2k−1h]
2 k=1
1
R n , m=R n , m−1 m [ R n , m−1−R n−1, m−1]
4 −1
with n,m≥1
For step size2 hn-1:
h n−1 Error
b−a 4
I=R n−1,0− [f ' b−f ' a] hn−1 n−1 ⋯⋯⋯1
12 720
For step size 2hn:
hn b−a 4
I=R n ,0− [ f ' b−f ' a] hn n ⋯⋯⋯2
12 720
Now, hn=hn-1/2
Eqn (2) becomes:
2
hn−1 b−a 4
I=R n ,0− [ f ' b−f ' a] hn n ⋯⋯⋯3
48 720
4*(3)-(1) we get
4R n , 0−R n−1,0
I= O h 4 =R n , 1
3
In general for R(n,m):
1
R n , m=R n , m−1 m [ R n , m−1−R n−1, m−1]
4 −1
with n,m≥1
R(0,0)
R(1,0) R(1,1)
R(2,0) R(2,1) R(2,2)
R(3,0) R(3,1) R(3,2) R(3,3)
. . . . .
. . . . .
. . . . .
R(n,0) R(n,1) R(n,2) R(n,3) ............. R(n,n)
➢ Convergence along diagonal is faster than along the row.
General recipe:
Fit the data point to some polynomial (we will use Lagrangian
polynomial of order n: Pn(x))
b b
Then ∫ f xdx=∫ Pn x dx
a a
Case(A): Linear polynomial
x1
x 1−x 0
= [ f x 0 f x 1 ]
2
Let h=x1-x0
x1
b−a
Then ∫ f xdx≈ f 0f 1
x 0
2
Error in integral:
x1
E T =f ' '
2! x
∫ x−x 0 x−x 1 dx x 0x 1
0
x2
b−a
∫ f x dx≈ 6 [ f 04f 1f 2 ] Simpson's Rule
x0
−h5 4
Error: E S = f
90