Download as pdf or txt
Download as pdf or txt
You are on page 1of 25

Numerical Integration

Marialuce Graziadei
!Improper Integrals
"Change of variable
"Elimination of the singularity

"Ignoring the singularity

"Truncation of the interval

"Formulas of Interpolatory and Gauss type

"Numerical evaluation of the Cauchy Principal Value

!Indefinite Integration
"Indefinite integration via Differential Equations
"Application of Approximation Theory

Ref. ‘Methods of Numerical Integration’, Philip J. Davis and Philip Rabinowitz.


Definitions
Improper integrals Integrals whose integrand is unbounded.

1) • f (x) is defined on (a,b];


• f (x ) is unbounded in the neighbourhood of x = a.
b b

∫ f ( x ) dx = lim ∫ f ( x ) dx
a r→a+ r

2)
• f (x) is defined on [ a, b ] \ {c} ;
• f (x) is unbounded in the vicinity of x = c, with a < c < b .
The Cauchy Principal Value of the integral is defined by the limit

[ ]
c−r b

∫a f ( x) dx + c∫+r f ( x) dx
b

P ∫ f ( x) dx = lim
r →0 +
a

6/11/2002 Seminar: Numerical Integration 2


Change of variable
Sometimes it is possible to find a change of variable that eliminates the
singularity.
Example 1
[ ]
g ( x ) ∈ C 0 ,1
1 1

I = ∫ x g ( x ) dx n
n≥2
0
n
The change of variable t = x transforms the integral into
1

I = n∫t n−2 n
g ( t ) dt which is proper.
0

But (example 2)
1
I = ∫ log( x) ⋅ g ( x)dx with t = − lo g x
0
becomes ∞
I = − ∫ te − t g ( e − t ) d t Infinite range of
integration
0
6/11/2002 Seminar: Numerical Integration 3
Elimination of the singularity
General ideas: subtract from the singular integrand f (x) a function g ( x ).
! g ( x ) integral is known in closed form;
! f ( x) − g ( x) is no longer singular.
This means that g ( x ) has to mimic the behaviour of f (x) closely to its
singular point.
Example
1
cos x 1 1
cos x − 1 1
cos x − 1 1

∫ dx = ∫ dx + ∫ dx = 2 + ∫ dx .
0 x x 0 x 0 x 0

But 2
x
cos x − 1 ≈ −
2
near x = 0 , so the last integrand in now in C [0 ,1 ]

6/11/2002 Seminar: Numerical Integration 4


Ignoring the singularity
It is also possible to avoid the integrand singularities and apply
the standard quadrature rules.
We want to compute
1

∫ f ( x ) dx ,
0

where f ( x ) is unbounded in the neighbourhood of x = 0 .

!Then we set f ( 0 ) = 0 (or any other value) and use any


sequence of rules.

!Another option: use a sequence of rules that do not involve


the value of f ( x ) at x = 0 .

6/11/2002 Seminar: Numerical Integration 5


Ignoring the singularity
Example 1
32 × S 1.8427 G2 1.65068
64 × S 1.8887 G3 1.75086

1 128 × S 1.9213 G4 1.80634


dx

256 × S
= 2 512 × S
1.9444
1.9606
G10
G16
1.91706
1.94722
0 x 1024 × S 1.9721 G32 1.97321
S = Simpson G = Gauss

But the method of ‘ignoring the singularity’ may not work if the integrand is
oscillatory
Example 2
1 1
1 1 1 s in x
∫0
x
s in d x =
x 2
(π − 2 ∫
0
x
d x ) = .6 2 4 7 1 3
32 × S 2.3123
64 × S 1.6946
128 × S -0.6083 No patterns of
256 × S 1.2181 convergence is discernible
512 × S 0.7215 from this computations
1024 × S 0.3178
S = Simpson
6/11/2002 Seminar: Numerical Integration 6
Ignoring the singularity
However let R designate a fixed m-point rule of approximate integration in [ 0 ,1 ]
m
R( f ) = ∑ w f ( x ) k k
k =1
m
with 0 ≤ x < x < ... < x ≤ 1,
1 2 m
w > 0,
k ∑ w = 1,
k
k =1

and let R n designate the compound rule that arises by applying R to each of
the subintervals
[0 ,1 / n ], [1 / n , 2 / n ],..., [( n − 1 ) / n ,1 ] , then

0 1/ n 2 / n ( n − 1) / n 1
Theorem
If f ( x ) is a monotonic increasing integrable singular function with a singularity
at x = 0 , then
1

lim R ( f ) = ∫ f ( x ) dx .
n→ ∞ n
0
6/11/2002 Seminar: Numerical Integration 7
Proceeding to the limit
Integral to be evaluated:
1

∫ f ( x ) dx
0

! f (x) is continuous in 0 < x ≤ 1 (may be unbounded in x = 0 ).


! 1 > r > r > ... is a sequence of points that converges to 0 (e.g r = 2 ).
1 2 n
−n

1 1 r1 r2

∫ f ( x) dx = ∫ f ( x) dx + ∫ f ( x) dx + ∫ f ( x) dx +...
0 r1 r2 r3

The evaluation is terminated when

rn+1 proper integrals

∫ f ( x ) dx ≤ ε
rn

6/11/2002 Seminar: Numerical Integration 8


Truncation of the interval
1 r 1


0
f ( x)dx = ∫
0
f ( x)dx + ∫
r
f ( x)dx
Then, if r

∫ f ( x ) dx ≤ ε
0

we can simply evaluate the proper integral


1

∫ f ( x ) dx
Example r

1
g (x)
I = ∫ 1 1 dx with g bounded in  0 ,1  , e.g. g ( x ) ≤ 1
0
x + x
2 3

But in [0,1]
g (x) 1 r
g (x) r
dx 1

1 1 ≤ 1 ∫ 1 1 dx ≤ ∫ 1 = r 2

x 2
+ x 3
2x 2 0
x 2
+ x 3 0
2x 2

And, if we take r ≤ 10 , we get an accuracy of 10


−6 −3

6/11/2002 Seminar: Numerical Integration 9


Integration Formulas of Interpolatory Type
Consider the integral
1

∫ w ( x ) f ( x ) dx
0

where w(x) is a function with a singularity in the neighbourhood of x = 0 , but


such that
1

∫ w ( x ) x dx
k
exist for k = 0 , 1 ,..., n .
0

The, for a given sequence of abscissas 0 < x 0 < x 1 < ... x n ≤ 1 , we can
determine weights w i such that
1 n

∫ w ( x) p ( x)dx = ∑
i=0
wi p ( xi )
0
whenever p ∈ Pn .
This leads to the approximate integration formula
1 n

∫ w ( x ) f ( x ) dx ≈ ∑ w f ( x )
0 i=0
i i

6/11/2002 Seminar: Numerical Integration 10


Integration Formulas of Interpolatory Type
Example
1
− 1 2
w( x) = x 2 x0 = , x1 = , x 2 = 1.
3 3
1 1

w1 + w 2 + w 3 = ∫x
0
2
dx = 2,

1 1
w1 2 w 2 − 2
3
+
3
+ w3 = ∫
0
x 2
xdx =
3
,

w 4w 2 1 −
1

+
1
+ w = ∫ x x dx = .
2
3
2 2

9 9 5 0

This leads to the rule

14  1  8  2  4
1 1

∫x 2
f ( x) dx ≈ f   − f   + f (1) .
0
5 3 5  3 5
6/11/2002 Seminar: Numerical Integration 11
Integration Formulas of Gauss Type
Singularities may be accommodated by means of Gauss-type formulas. The
integral is written in the form
b

I = ∫ w ( x ) f ( x ) dx ,
a
where w ( x ) is a fixed positive weight function. The moments
b

∫ w ( x ) x dx
n
exist for n = 0 , 1 ,...
[ ]
a

but w ( x ) may have one or more singularities in the interval a , b


The corresponding orthonormal polynomials are p ( x ) and their zeros are n

a < x < x < ... < x < b 1 2 n

Then w , w ,..., w (positive constants) can be found such that


1 2 n
b n

∫ w ( x ) p ( x ) dx = ∑ w p ( x )
a k =1
k k

b n

∫ w ( x ) f ( x ) dx ≈ ∑ w f ( x )
a k =1
k k

6/11/2002 Seminar: Numerical Integration 12


Integration Formulas of Gauss Type
We want to compute the integral
1
I = ∫
0
L og ( x) f ( x)dx,
• f ( x) is regular in [0,1]
We need
Gn ( x) polynomials orthonormal to Log ( x) in [0,1].
To get them, we must solve
1
In = ∫
0
− L o g ( x )( x n ) d x .
−y
•x=e
• integration by parts

1 1

− ( m +1) y
Im = e dy =
m +1 0
( m + 1) 2
By Mme Henri Berthod Zabrowski
6/11/2002 Seminar: Numerical Integration 13
Integration Formulas of Gauss Type
1

∫0
− L o g ( x ) G i G j d x = δ ij
• Polynomials • Points • Weights
G0 = 1,

12  1
G1 =  x − ; 0.25 1
7 4

5 ( 252 x 2 − 180 x + 17 ) 0.602277 0.281461


G2 = ; 0.112009 0.718539
12 7

0.063891 0.513405
7 ( 258800 x − 310500 x − 92016 x − 4679 )
3 2

G3 = ; 0.368997 0.391980
9 10849 647 0.766880 0.094615
… 6/11/2002 Seminar: Numerical Integration 14
Integration Formulas of Gauss Type

• Example
1
Log (x) π
I = ∫
0

1+ x
dx =
12
= 0 .8 2 2 4 6 7 0 .

n=3

I co m p u ted = 0 .8 2 2 4 4 8 5
I exa ct − I co m p u ted = 1 8 5 ⋅ 1 0 − 7

6/11/2002 Seminar: Numerical Integration 15


Numerical Evaluation of the Cauchy Principal
Value
Reduction of the CPV to one-sided improper integral is possible.
f (x) unbounded in x=c with a < c < b.
b

Suppose that P ∫ f ( x ) dx exists.


a

b
c−r b

P ∫ f ( x ) = lim  ∫ f ( x ) dx + ∫ f ( x ) dx 
r →0
a a c+r 
Consider c = 0 and b = a.
Decompose f ( x ) in its odd and even parts
Odd Even

g ( x) =
1
[ f ( x) − f (− x)] h( x) =
1
[ f ( x ) + f (− x )]
2 2

6/11/2002 Seminar: Numerical Integration 16


Numerical Evaluation of the Cauchy Principal
Value
−r a

∫ f ( x ) dx + ∫ f ( x ) dx =
−a r

−r a −r a

∫ g ( x ) dx + ∫ g ( x ) dx + ∫ h( x ) dx + ∫ h( x ) dx =
−a r −a r

2 ∫ h ( x ) dx.
r

Therefore

a a
P ∫ f ( x)dx =
r →0 ∫
2lim h( x)dx.
+
−a r

6/11/2002 Seminar: Numerical Integration 17


Numerical Evaluation of the Cauchy Principal
Value
Example1
dx 1

P ∫
x −1

1  1 1 
1
dx
h (x ) =  −  = 0 P ∫ = 0
2  x x  −1 x

Example2 x
e1

P ∫ dx
x
−1

1e x
e  1
−x

h (x ) =  +  = sinh ( x )
2 x − x x

x
e1
sinh( x)1

P ∫ dx = 2 ∫ dx
x−1 x 0

6/11/2002 Seminar: Numerical Integration 18


Numerical Evaluation of the Cauchy Principal
Value
The method of subtracting the singularity may also be used.
b
f (t )
I (x) = P ∫ dt, a < x < b
a
t− x
Hilbert
I ( x ) = ∫ f ( t ) − f ( x ) dt + f ( x ) P ∫ dt =
b b
transform of
a
t−x a
t−x f (x)
b
f ( t ) − f ( x ) dt + f ( x ) log b − x .
∫a t−x x−a
Consider the function
f (t ) − f ( x )
φ (t , x ) = t ≠ x,
t−x
φ ( x , x ) = f '( x ) t = x.
and solve b

∫ φ ( t , x ) dt
a
∗ Interpolatory-type and Gauss-type formulas have been developed for Cauchy Principal Value
integrals.
6/11/2002 Seminar: Numerical Integration 19
Numerical Evaluation of the Cauchy Principal
Value
It may be useful to consider
x+h
f (t + x ) − f ( x )
h

∫ φ (t , x ) dt = ∫
x−h −h
t
dt .

If f ( x ) can be expanded in a Taylor series at t = x , then we have

x+h h
 t f ''( x ) t 2 f '''( x ) 
∫x − h φ (t , x ) dt = −∫h  f '( x ) + 2! + 3! + ...  dt
h 3 f '''( x )
= 2 hf '( x ) + + ...
9

6/11/2002 Seminar: Numerical Integration 20


Indefinite Integration
We want to compute x

F(x) = ∫ f (t) dt a ≤ x ≤b
a
or the more complicated
x

F(x) = ∫ f (x, t) dt a ≤ x ≤b
a
Two choices
•Regard the F ( x ) as a definite integral over a variable range;
•Regard F ( x ) as the solution of the differential equation
dF = f ( x ), F ( a ) = 0.
dx
The simplest approach:
•divide the interval of integration a ≤ x ≤b into a set of subintervals;
•apply a rule of approximate integration to each subinterval.
Simpson’s rule is widely used
6/11/2002 Seminar: Numerical Integration 21
Indefinite Integration via Differential Equations
We can use familiar rules. Consider, for example, the classical Runge-Kutta
method for the solution of
dy
= g ( x, y ) y( x ) = y .
0 0
dx
The relevant formulas are

h
y m +1 = y m + ( k 1 + 2 k 2 + 2 k 3 + k 4 ),
6
h h k1
k 1 = g ( x m , y m ), k 2 = g ( x m + , y m + ),
2 2
h hk2
k3 = g ( xm + , ym + ), k 2 = g ( x m + h , y m + h k 3 ).
2 2

A general multistep method for indefinite integration would consist in


computing the value of the integral at the next step, yn+1 in terms of the values
of the integral previously computed, yn , yn−1 ,..., and in terms of the values of
the integrand, f ( xn+1 ), f ( xn ), f ( xn−1 ),...
6/11/2002 Seminar: Numerical Integration 22
Indefinite Integration-Approximation Theory
x

F(x) = ∫ f (t) dt a ≤ x ≤b −∞< a < b < ∞


a

Suppose we can approximate f ( x ) with

f ( x) = φ ( x) + φ ( x) + ... + φ ( x) + ε ( x)
0 1 n
a ≤ x ≤ b,
ε(x) ≤ ε a ≤ x ≤ b,
x
and that ψ i ( x ) = ∫ φ i (t ) dt
is simple to calculate. a

Then
x

F ( x) = ∫ f (t )dt =ψ ( x) + ψ ( x) + ... + ψ ( x) + η ( x),


0 1 n
a

x
with
η ( x) = ∫ ε (t )dt ≤ (b − a)ε .
a

6/11/2002 Seminar: Numerical Integration 23


Indefinite Integration-Approximation Theory
Chebyshev Polynomials
 n  n−2 2
Tn ( x) = cos(n ⋅ ar cos x) = x +   x ( x − 1) + ...
n

 2
n = 0,1, ..., −1 ≤ x ≤ 1
or
T0 ( x) = 1, T1 ( x) = x,
Tn +1 ( x) = 2 xTn ( x) − Tn −1 ( x), n = 2,3,...,

If the function f ( x ) satisfies a Lipschitz condition in [ −1,1] , it can be


expanded in an uniformely convergent series of Chebishev polynomials.

1
f ( x) = a0 + a1T1 ( x) + a2T2 ( x) + ...
2
6/11/2002 Seminar: Numerical Integration 24
Indefinite Integration-Approximation Theory
Orthogonality
π , m = n = 0,
π

1
Tm ( x)Tn ( x)
∫−1 1 − x 2 dx =  2 , m = n ≠ 0,

0, m ≠ n.
The coefficients of the series are given by
1 π
2 f ( x)Tr ( x) 2
π ∫ ∫
ar = dx = f (cos ϑ ) cos rϑdϑ
−1 1− x 2 π 0

For many functions the sequence a 0, a 1,... decreases to zero rapidly. So

a0 a a  T ( x) Tr −1 ( x) 
∫ f (t )dt = T1 ( x) + 1T2 ( x) + ∑ r  r +1 −  + cons
2 4 r =2 2  r + 1 r −1 

6/11/2002 Seminar: Numerical Integration 25

You might also like