You are on page 1of 7

So far....

the Quadrature Rules


MATH 174
Numerical Analysis I
Newton Cotes Quadratures
The abscissas are fixed and the weights are from the auxiliary
polynomials used in interpolation of the integrand

Section S
Second Semester A.Y. 2013-2014

Gaussian Quadratures
A fixed number of abscissas and weights are chosen to ensure the
achievement of the maximum degree of precision possible

Mathematics Division
Institute of Mathematical Sciences and Physics
University of the Philippines Los Ba
nos

March 18, 2014

NJA Egarguin (IMSP, UPLB)

MATH 174

March 18, 2014

1 / 26

NJA Egarguin (IMSP, UPLB)

MATH 174

March 18, 2014

2 / 26

Romberg Integration

Problems with the Quadrature Rules:


Finding the number of sub-intervals to achieve better accuracy may
be cumbersome.
The error terms are quite pessimistic, thus they tend to require more
work than needed.

Romberg Integration is simply repetitive extrapolation of the Trapezoidal


Rule.
We start with applying the Trapezoidal Rule using halved step sizes.
Denote by Rk,j the Romberg approximations where k controls the
step size while j indicates the level of extrapolation.
Usually, the approximations are organized in a tableau where Rk,j is
in the k th row and j th column.

NJA Egarguin (IMSP, UPLB)

MATH 174

March 18, 2014

3 / 26

NJA Egarguin (IMSP, UPLB)

MATH 174

March 18, 2014

4 / 26

Try to recreate this!!

Thus, Rk,1 = Traph (f ), where h =

Lets approximate ln 2 by using a 5 row Romberg Integration tableau.


Z 2
1
dx then we apply Rombergs method on this
Solution: Since ln 2 =
x
1
integral. Doing so will yield the tableau:

ba
.
2k 1

For the succeeding column entries, we use the extrapolation formula:


Rk,j =

4j1 Rk,j1 Rk1,j1


.
4j1 1

0.7500000000
0.7083333333
0.6970238095
0.6941218504
0.6933912022

0.6944444444
0.6932539683
0.6931545307
0.6931476528

0.6931746032
0.6931479015
0.6931471943

0.6931474776
0.6931471831

The last column gives the approximate value 0.6931471819 of ln 2.

NJA Egarguin (IMSP, UPLB)

MATH 174

March 18, 2014

5 / 26

Shortcomings of the Quadrature rules Addressed

NJA Egarguin (IMSP, UPLB)

MATH 174

March 18, 2014

6 / 26

March 18, 2014

8 / 26

Row by Row Computation

Suppose we set the convergence tolerance to  = 2 108

Estimation of the errors will result for the following termination rule.
Romberg Integration Algorithm Termination Rule
Let  be the specified convergence tolerance. If


Rn,n Rn1,n1

<


2n1
then halt the algorithm. Else, proceed with iteration.

NJA Egarguin (IMSP, UPLB)

MATH 174



R2,2 R1,1

0.0277777778.


21

March 18, 2014

7 / 26

NJA Egarguin (IMSP, UPLB)

MATH 174

Row by Row Computation

Row by Row Computation

Suppose we set the convergence tolerance to  = 2 108

Suppose we set the convergence tolerance to  = 2 108



R3,3 R2,2

0.0003174603.


22



R4,4 R3,3

0.0000033907.


23

NJA Egarguin (IMSP, UPLB)

MATH 174

March 18, 2014

9 / 26

Row by Row Computation

NJA Egarguin (IMSP, UPLB)

MATH 174

March 18, 2014

10 / 26

Another Integration Anomaly!!!!!


Z

Suppose we set the convergence tolerance to  = 2

108

Even in practical situations we encounter integrals like


1

ex 1
dx,
x

that can make the formulas we derived fail.


In general, improper integrals can still be successfully approximated by our
developed techniques, but more caution and care is required.
Recall from elementary calculus, a definite integral is improper if any one
of the following occurs:
the integrand is discontinuous at a number in the integration interval;
or



R5,5 R4,4

0.00000001848125.


24

NJA Egarguin (IMSP, UPLB)

MATH 174

the integration interval is unbounded.

March 18, 2014

11 / 26

NJA Egarguin (IMSP, UPLB)

MATH 174

March 18, 2014

12 / 26

Z
Consider the (NOT-so improper) integral

Solution: Remove the Fractional Exponent

x2/3 dx. If some basic

quadrature rules, we can get the following tally of errors per varying
number of nodes.
n
2
4
8
16
32
64
EOC
TOC

Trapezoidal
3.502 102
1.193 102
3.982 103
1.311 103
4.269 104
1.380 104
1.5986
2

Simpsons
1.336 102
4.229 103
1.334 103
4.202 104
1.324 104
4.169 105
1.6651
4

Midpoint
1.117 102
3.963 103
1.361 103
4.568 104
1.509 104
4.930 105
1.5667
2

2-pt Gaussian
1.338 102
4.225 104
1.331 104
4.194 105
1.321 105
4.161 106
1.6659
4

Z
Consider A =

x2/3 d. Notice that the integrand is not sufficiently

differentiable, that is, it lacks sufficient smoothness to guarantee


achievement of convergence.
Z 1
3
To remedy this, let x = u = A =
3u4 du. Re-performing the
0

quadrature rules earlier with this new form for A yields the following error
data:

Cause of under performance: discontinuity of the derivatives of the


integrand at x = 0.
NJA Egarguin (IMSP, UPLB)

MATH 174

March 18, 2014

13 / 26

NJA Egarguin (IMSP, UPLB)

MATH 174

March 18, 2014

14 / 26

Improper Integrals: Removable Discontinuities


n
2
4
8
16
32
64
EOC
TOC

Trapezoidal
2.438 101
6.211 102
1.560 102
3.905 103
9.765 104
2.441 104
1.9939
2

Simpsons
2.500 102
1.563 103
9.766 105
6.104 106
3.815 107
2.384 108
4.0000
4

Midpoint
1.195 101
3.091 102
7.791 103
1.952 103
4.882 104
1.221 104
1.9894
2

2-pt Gaussian
1.042 103
6.510 105
4.069 106
2.543 107
1.589 108
9.934 1010
4.000
4

Removable Discontinuity
Recall that f (x) has a removable discontinuity at x = a if lim f (x) exists
xa

but is not equal to f (a).


Z 1 x
ex 1
e 1
is
1.
dx. Note that the integrand f (x) =
x
x
1
discontinuous at x = 0 since f (0) is undefined. Further, lim f (x) = 1, so
x0

the discontinuity is removable. Also, note that


x2 x3
+
+ ...
x x2
2
6
=1+ +
+ ....
x
2
6

1 + 1 + x +
f (x) =

Lesson: Make your integrand as smooth as possible.

NJA Egarguin (IMSP, UPLB)

MATH 174

March 18, 2014

15 / 26

NJA Egarguin (IMSP, UPLB)

MATH 174

March 18, 2014

16 / 26

sin x
sin x
dx. Notice that even if f (x) = is undefined at
x
x
0
x = 0, lim f (x) = 0. So f has a removable discontinuity at x = 0.
2. B =

x0

Thus, f is infinitely differentiable, which will make any quadrature rule


work optimally in the integrands current form, except when 0 is used as
an abscissa. Thus, we may replace the integrand with
x
e 1 , x 6= 0

f (x) =
.
x
1,
x=0

Checking the McLaurin expansion of f yields:


x
f (x) =

x3
x5
+ + ...
x5/2 x9/2
1/2
3!
5!
=
x

+
+ ....
3!
5!
x1/22

This shows that quadrature rules may not perform optimally with the
current integrand. Hence,
Z a change in variable is in place.
1

2 sin(u2 )du.

Let x = u2 = B =

Using the (adaptive) three-point Gaussian quadrature rule will require 87


function evaluations to get an approximate using tolerance 5 1011 . Had
the change in variable not been done, 677 function evaluations are
required instead.
NJA Egarguin (IMSP, UPLB)

MATH 174

March 18, 2014

17 / 26

NJA Egarguin (IMSP, UPLB)

MATH 174

March 18, 2014

18 / 26

Improper Integrals: Essential Discontinuities


Further, notice that
Case 1: Algebraic Discontinuity

f (x) = x2/3

f (x) tends to behave like (x a) for some > 0, as x a


=
Z
3. C =
0

(cos( x 1))e

3
x2 (1 + 3 x)

dx.

+
X
x2k/5
(1)k
(2k)!

k=1
4/15
x

x1/15
2

+ k/2
X
x

k!

x2/15

24

k=1
x7/30

+
X

!
(1)k xk/3

k=1

+ ....

Thus, to assure convergence of quadrature rules, we let x = u30 and use


the quadrature rules on

Let f be the integrand. Then


Z
C=

lim f (x) = .

NJA Egarguin (IMSP, UPLB)

MATH 174

March 18, 2014

19 / 26

NJA Egarguin (IMSP, UPLB)

6
9 (cos u

30u
0

x0+

15

1)eu
du.
1 + u10

MATH 174

March 18, 2014

20 / 26

Case 2: Logarithmic Discontinuity

However, for > 0,


lim x ln x = 0.

f (x) tends to behave like ln(x a) as x a

x0

thus f has an essential discontinuity. Further,

Hence, it would be more stable to write the integral as



Z 1
Z 1
ln x
D=
lnx dx +
ln x
1 + x2
0
0
Z 1
Z 1 2
x ln x
dx +
ln x
=
2
0
0 1+x

f (x) = (1 x2 + x4 x6 + ...) ln x = ln x x2 ln x + x4 ln x x6 ln x + ...

The first summand has a removable discontinuity, while the second can
easily be computed manually.

Z
4. D =
0

ln x
dx. Let f be the integrand.
1 + x2

Notice that
lim f (x) =

x0

NJA Egarguin (IMSP, UPLB)

MATH 174

March 18, 2014

21 / 26

NJA Egarguin (IMSP, UPLB)

MATH 174

March 18, 2014

22 / 26

March 18, 2014

24 / 26

Improper Integrals: Unbounded Integration Intervals


Z
5. E =
1

Here, we consider two substitution rules that will project an infinite


integration interval to a finite one.
Case 1: The integration interval does not contain zero.

ex
dx.
x

1
= E =
If we let x =
u
Hence,

Substitution Rule
x=

NJA Egarguin (IMSP, UPLB)

1
u

MATH 174

March 18, 2014

23 / 26

NJA Egarguin (IMSP, UPLB)



e1/u
du
2
1/u
u
1
Z 1 1/u
e
E=
du.
u
0

MATH 174

Z
Z
6. F =

7. G =

t2 et dt.

To apply the previous substitution, we need to separate the infinities and


zero and come up with three integrals with bounds such as
, 1, 1, .

First split the integration interval to separate 0 and as:


Z 1
Z
2
2 t2
F =
t e dt +
t2 et dt.
0

Z
F =

Another way to solve this improper integral is via the substitution rule

In the second integral, let x =

ex
dx.
1 + x + x2

1
. Then
u
2

t2 et dt +

x = tan .
Z

e1/u
du.
u4

Doing so will give


Z
G=

NJA Egarguin (IMSP, UPLB)

MATH 174

March 18, 2014

25 / 26

NJA Egarguin (IMSP, UPLB)

e tan
d.
1 + sin cos

MATH 174

March 18, 2014

26 / 26

You might also like