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
1)

Integrals whose integrand is unbounded.

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


f (x ) is unbounded in the neighbourhood of
b

x = a.

f ( x ) dx = lim f ( x ) dx
ra+

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

cr

a f ( x) dx + c+r f ( x) dx
P f ( x) dx = lim
r 0
b

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

[ ]
I = x g ( x ) dx

g ( x ) C 0 ,1

1
n

n2

The change of variable t

= x transforms the integral into


1

I = nt

n2

g ( t ) dt

which is proper.

But (example 2)
1

I = log( x) g ( x)dx
0

becomes

with

t = lo g x

I = te t g ( e t ) d t

Infinite range of
integration

6/11/2002

Seminar: Numerical Integration

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

cos x
1
cos x 1
cos x 1
dx =
dx +
dx = 2 +
dx .

x
x
x
x
1

But

x
cos x 1
2

near x = 0 , so the last integrand in now in C [0 ,1 ]


6/11/2002

Seminar: Numerical Integration

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

Ignoring the singularity


Example 1
1

32 S
64 S
128 S
256 S
512 S
1024 S

dx
= 2
x

1.8427

G2

1.65068

1.8887

G3

1.75086

1.9213

G4

1.80634

1.9444

G10

1.91706

1.9606

G16

1.94722

1.9721
S = Simpson

G32
1.97321
G = Gauss

But the method of ignoring the singularity may not work if the integrand is
oscillatory
Example 2
1

1
1
1
s in x
s in d x =
( 2
d x ) = .6 2 4 7 1 3
x
x
2
x
0

32 S
64 S
128 S
256 S
512 S
1024 S

2.3123
1.6946
-0.6083
1.2181
0.7215

No patterns of
convergence is discernible
from this computations

0.3178

S = Simpson

6/11/2002

Seminar: Numerical Integration

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 =1

with

0 x < x < ... < x 1,


1

w > 0,
k

w = 1,
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
0

1/ n

1 ) / n ,1 ] ,

( n 1) / n

2 / n

then

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

6/11/2002

Seminar: Numerical Integration

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 ).
n

r1

r2

r1

r2

r3

f ( x) dx = f ( x) dx + f ( x) dx + f ( x) dx +...
The evaluation is terminated when
rn+1

f ( x ) dx

proper integrals

rn

6/11/2002

Seminar: Numerical Integration

Truncation of the interval


1

f ( x)dx =

f ( x)dx +

Then, if

f ( x)dx

f ( x ) dx
0

we can simply evaluate the proper integral


1

f ( x ) dx

Example

g (x)

I =

1
2

But in [0,1]

g (x)
x

1
2

+ x

1
3

x + x

1
3

1
2x

dx

with g bounded in 0 ,1 , e.g. g ( x ) 1

g (x)

1
2

1
2

+ x

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


6

6/11/2002

1
3

dx
0

dx
2x

1
2

= r

1
2

Seminar: Numerical Integration

Integration Formulas of Interpolatory Type


Consider the integral

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 .

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

w ( x) p ( x)dx =

i=0

whenever p Pn

wi p ( xi )

This leads to the approximate integration formula


1

i=0

w ( x ) f ( x ) dx w f ( x )
6/11/2002

Seminar: Numerical Integration

10

Integration Formulas of Interpolatory Type


Example
w( x) = x

1
2

1
x0 = ,
3
1

w1 + w 2 + w 3 =

1
2

2
x1 = ,
3

x 2 = 1.

dx = 2,

w1 2 w 2
+
+ w3 =
3
3

1
2

xdx =

2
,
3

w
4w
2
+
+ w = x x dx = .
9
9
5
1

1
2

This leads to the rule


1

x
0

6/11/2002

1
2

f ( x) dx

14 1 8 2 4
f f + f (1) .
5 3 5 3 5
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 ,...

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


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

k =1

w ( x ) p ( x ) dx = w p ( x )
k

k =1

w ( x ) f ( x ) dx w f ( x )
6/11/2002

Seminar: Numerical Integration

12

Integration Formulas of Gauss Type


We want to compute the integral
1

I =

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 =
x=e

L o g ( x )( x n ) d x .

integration by parts

Im

1
=
m +1

By Mme Henri Berthod Zabrowski


6/11/2002

( m +1) y

1
dy =
( m + 1) 2

Seminar: Numerical Integration

13

Integration Formulas of Gauss Type


1

L o g ( x ) G i G j d x = ij

Polynomials

Points

Weights

G0 = 1,
G1 =

G2 =

12
1
x

;
4
7
5 ( 252 x 2 180 x + 17 )
12 7

7 ( 258800 x 310500 x 92016 x 4679 )


3

G3 =

0.25

9 10849 647
6/11/2002

Seminar: Numerical Integration

0.602277
0.112009

0.281461

0.063891

0.513405

0.368997

0.391980

0.766880

0.094615

0.718539

14

Integration Formulas of Gauss Type


Example
1

I =

Log (x)

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

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

a < c < b.

with

Suppose that

P f ( x ) dx

exists.

b
cr

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

Consider c = 0

and

b = a.

Decompose f ( x ) in its odd and even parts


Even

Odd

g ( x) =
6/11/2002

1
[ f ( x) f ( x)]
2

h( x) =

Seminar: Numerical Integration

1
[ f ( x ) + f ( x )]
2
16

Numerical Evaluation of the Cauchy Principal


Value
r

f ( x ) dx + f ( x ) dx =

g ( x ) dx + g ( x ) dx + h( x ) dx + h( x ) dx =
a

2 h ( x ) dx.
r

Therefore
a

P f ( x)dx
a

6/11/2002

2lim
h( x)dx.
r 0
+

Seminar: Numerical Integration

17

Numerical Evaluation of the Cauchy Principal


Value
Example1

dx
P
x
1

dx
P
= 0
x
1

1 1
1
h (x ) =

= 0
2 x
x

Example2

e
dx
P
x
1

1e
e 1
h (x ) =
+
= sinh ( x )
2 x
x x
x

e
sinh( x)
P dx = 2
dx
x
x
1

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

I (x) = P
a

f (t )
t x

dt, a < x < b

I ( x ) = f ( t ) f ( x ) dt + f ( x ) P dt =
tx
tx
a
a
b
f ( t ) f ( x ) dt + f ( x ) log b x .
a
tx
xa
b

Hilbert
transform of

f (x)

Consider the function

f (t ) f ( x )
tx
( x , x ) = f '( x )

(t , x ) =
and solve

t x,
t = x.

( 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

xh

(t , x ) dt =

f (t + x ) f ( x )
dt .
t

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


x+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

F(x) = f (t) dt

or the more complicated

a x b

F(x) = f (x, t) dt

a x b

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 ),
dx

F ( a ) = 0.

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.


Simpsons 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 )
dx

y( x ) = y .
0

The relevant formulas are


h
( k 1 + 2 k 2 + 2 k 3 + k 4 ),
6
h k1
h
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
y m +1 = y m +

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 , yn1 ,..., and in terms of the values of
the integrand, f ( xn+1 ), f ( xn ), f ( xn1 ),...
6/11/2002

Seminar: Numerical Integration

22

Indefinite Integration-Approximation Theory


x

F(x) = f (t) dt

a x b

< a < b <

Suppose we can approximate f ( x ) with

f ( x) = ( x) + ( x) + ... + ( x) + ( x)
0

a x b,

(x)

a x b,
x

and that
is simple to calculate.
Then

i ( x ) = i (t ) dt
a

F ( x) = f (t )dt = ( x) + ( x) + ... + ( x) + ( x),


0

with

( x) = (t )dt (b a) .
a

6/11/2002

Seminar: Numerical Integration

23

Indefinite Integration-Approximation Theory


Chebyshev Polynomials

n n2 2
Tn ( x) = cos(n ar cos x) = x + x ( x 1) + ...
2
n = 0,1, ...,
1 x 1
n

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

ar =

f ( x)Tr ( x)
1 x

dx =

f (cos ) cos rd

For many functions the sequence a 0, a 1,...

f (t )dt =

6/11/2002

decreases to zero rapidly. So

a0
a
a T ( x) Tr 1 ( x)
T1 ( x) + 1T2 ( x) + r r +1

+ cons
r 1
2
4
r =2 2 r + 1
Seminar: Numerical Integration

25

You might also like