Week 12 - Numerical Integration (Open Formula and Improper Integrals)

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

Numerical Analysis I

Numerical Integration

First Semester, AY 2023-2024

Numerical Analysis I First Semester, AY 2023-2024 1 / 15


Outline

1 Open Newton-Cotes Formulas

Numerical Analysis I First Semester, AY 2023-2024 2 / 15


Outline

1 Open Newton-Cotes Formulas

2 Improper Integrals with Left Endpoint Singularity

Numerical Analysis I First Semester, AY 2023-2024 2 / 15


Outline

1 Open Newton-Cotes Formulas

2 Improper Integrals with Left Endpoint Singularity

3 Improper Integrals with Right Endpoint Singularity

Numerical Analysis I First Semester, AY 2023-2024 2 / 15


Open Newton-Cotes Formulas

The Open Newton-Cotes formulas do not include the endpoints of [a, b] as


nodes. We use
b−a
1 x = x + ih for each i = 0, 1, . . . , n where h = ,
i 0
n+2
2 x = a + h and x = b − h, and
0 n
3 x−1 = a and xn+1 = b
So that the integral is given by
Z b Z xn+1 n
X
f (x)dx = f (x)dx ≈ wi f (xi ),
a x−1 i=0

where Z b
wi = Li (x)dx.
a

Numerical Analysis I First Semester, AY 2023-2024 3 / 15


Open Newton-Cotes Formulas
n=0 (Midpoint rule):
x1
h3 ′′
Z
f (x)dx = 2hf (x0 ) + f (ξ) wherex−1 < ξ < x1 .
x−1 3

n=1

x2
3h3 ′′
Z
3h
f (x)dx = [f (x0 ) + f (x1 )] + f (ξ) where x−1 < ξ < x2 .
x−1 2 4

n=2

x3
14h5 (4)
Z
4h
f (x)dx = [2f (x0 ) − f (x1 ) + 2f (x2 )] + f (ξ)
x−1 3 45
where x−1 < ξ < x3 .

Numerical Analysis I First Semester, AY 2023-2024 4 / 15


Open Newton-Cotes Formulas

n=3
Z x4
5h
f (x)dx = [11f (x0 ) + f (x1 ) + f (x2 ) + 11f (x3 )]
x−1 24
95 5 (4)
+ h f (ξ) where x−1 < ξ < x4 .
144

Numerical Analysis I First Semester, AY 2023-2024 5 / 15


Improper Integrals with Left Endpoint Singularity
There are instances where we need to evaluate the integral of afunction
whose value is unbounded at the endpoint(s) of the interval [a, b]. For
example,
Plot of x12
12

10

8
y-axis

0
−1 0 1 2 3
Numerical Analysis I First Semester, AY 2023-2024 6 / 15
Improper Integrals with Left Endpoint Singularity

In this case we say that f has a singularity at the endpoint a.


Theorem:
Z b
dx
The integral converges if and only if 0 < p < 1. In this case,
a (x − a)p
we have Z b
dx (b − a)1−p
p
= .
a (x − a) 1−p

Numerical Analysis I First Semester, AY 2023-2024 7 / 15


How to Approximate the Integral
If f is a function that can be written in the form
g (x)
f (x) = ,
(x − a)p

where 0 < p < 1 and g is continuous on [a, b], then the improper integral
Z b
f (x)dx
a

also exists. We will approximate the integral using the Composite Simpson’s
rule, provided that g ∈ C 5 [a, b]. In this case, we can use the fourth Taylor
polynomial, P4 (x), for g about a,
4
X g (n) (a)(x − a)n
P4 (x) =
n!
n=0

Numerical Analysis I First Semester, AY 2023-2024 8 / 15


How to Approximate the Integral
and write
b b b
g (x) − P4 (x)
Z Z Z
P4 (x)
f (x)dx = dx + dx.
a a (x − a)p a (x − a)p

Integrating the second term of the right side of the equation is relatively
easy since it only involves a polynomial. To approximate the integral of f ,
we must add to this value the approximation of
b
g (x) − P4 (x)
Z
dx.
a (x − a)p

This can be done by applying the Composite Simpson’s rule to the function
( g (x)−P (x)
4
(x−a)p , if a < x ≤ b,
G (x) =
0, if x = a.

Numerical Analysis I First Semester, AY 2023-2024 9 / 15


Improper Integrals with Right Endpoint Singularity

We can also use the techniques for improper integrals with left endpoint
singularity to deal with improper integrals with right endpoint singularity.
To do this, suppose that we want to find
Z b
f (x)dx
a

where f (x) is discontinuous at x = b. We make the substitution

z = −x, dz = −dx

so that Z b Z −a
f (x) = f (−z)dz,
a −b
which has a singularity at the left endpoint.

Numerical Analysis I First Semester, AY 2023-2024 10 / 15


Improper Integrals with Right Endpoint Singularity

−4 −3 −2 −1

Numerical Analysis I First Semester, AY 2023-2024 11 / 15


Improper Integrals with Right Endpoint Singularity

1 2 3 4

Numerical Analysis I First Semester, AY 2023-2024 12 / 15


Improper Integrals with Singularity inside [a, b]

An improper integral with a singularity at c, where a < c < b, can be


rewritten as a sum of improper integrals with endpoint singularities since
Z b Z c Z b
f (x)dx = f (x)dx + f (x)dx.
a a c

Numerical Analysis I First Semester, AY 2023-2024 13 / 15


Improper Integrals with Infinite Singularity

Another type of improper integral is one whose bounds involve infinity.


The basic integral of this type has form
Z ∞
1
dx
a xp

for p > 1. Let


t = x −1 , dt = −x −2 dx
so that 1
∞ 0
tp
Z Z Z
1 a 1
dx = − 2 dt = dt.
a xp 1 t 0 t 2−p
a

Numerical Analysis I First Semester, AY 2023-2024 14 / 15


Improper Integral with Infinite Singularity

R∞
Similarly, if we let t = x −1 , the improper integral a f (x)dx into
Z 1
a 1
t −2 f ( )dt
0 t

which has a left endpoint singularity at zero.

Numerical Analysis I First Semester, AY 2023-2024 15 / 15

You might also like