0% found this document useful (0 votes)
3 views48 pages

Numerical Integration Techniques

The document discusses multiple integrals and improper integrals, focusing on numerical integration techniques such as the Composite Simpson's Rule (CSR) for multi-dimensional integration. It outlines the process of applying CSR in both x and y coordinates, including the error estimation for the approximation. Additionally, it mentions the potential for extending these techniques to higher dimensions and other numerical integration schemes.

Uploaded by

jacobzetterfeldt
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views48 pages

Numerical Integration Techniques

The document discusses multiple integrals and improper integrals, focusing on numerical integration techniques such as the Composite Simpson's Rule (CSR) for multi-dimensional integration. It outlines the process of applying CSR in both x and y coordinates, including the error estimation for the approximation. Additionally, it mentions the potential for extending these techniques to higher dimensions and other numerical integration schemes.

Uploaded by

jacobzetterfeldt
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Multiple Integrals

Improper Integrals

Numerical Analysis and Computing


Lecture Notes #09
— Numerical Integration and Differentiation —
Multiple Integrals; Improper Integrals

Joe Mahaffy,
hmahaffy@[Link]
Department of Mathematics
Dynamical Systems Group
Computational Sciences Research Center
San Diego State University
San Diego, CA 92182-7720
[Link]

Spring 2010

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (1/25)


Multiple Integrals
Improper Integrals

Outline

1 Multiple Integrals
CSR in n-D
Non-Rectangular Domains

2 Improper Integrals
Calculus Treasures
Taylor Expansions... Surprise!

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (2/25)


Multiple Integrals CSR in n-D
Improper Integrals Non-Rectangular Domains

The World is not One-Dimensional

Very few interesting problems are one-dimensional, so we need


integration schemes for multiple integrals, i.e.
11111111
00000000
d
00000000
11111111
00000000
11111111
ZZ
I= f (x, y ) dx dy , 00000000
11111111
R 00000000
11111111
00000000
11111111
00000000
11111111
where R = {(x, y ) : x ∈ [a, b], y ∈ [c, d]}. c
00000000
11111111
a b

Good News: The integration techniques we have developed


previously can be adopted for multi-dimensional
integration in a straight-forward way.

Composite Simpson’s Rule (CSR) is our favorite integration


scheme; we discuss multi-dimensional integration in that context.
Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (3/25)
Multiple Integrals CSR in n-D
Improper Integrals Non-Rectangular Domains

Multi-Dimensional Composite Simpson’s Rule

We divide the x-range [a, b] into an even


number nx of sub-intervals with nodes d

spaced hx = (b − a)/nx apart, and


the y -range [c, d] into an even number
ny of sub-intervals with nodes spaced c
hy = (d − c)/ny apart.
a b

We write
ZZ Z b ·Z d ¸
I= f (x, y ) dx dy = f (x, y ) dy dx,
R a c

and first apply CSR to approximate the integration in y — treating


x as a constant.

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (4/25)


Multiple Integrals CSR in n-D
Improper Integrals Non-Rectangular Domains

Composite Simpson’s Rule in the y -coordinate


1 Let yj = c + jhy , j = 0, 1, . . . , ny , then
Z d » ny /2 –
hy Xˆ ˜
f (x, y ) dy = f (x, y0 ) − f (x, yn ) + 2f (x, y2j ) + 4f (x, y2j−1 )
c 3 j=1
(d − c)hy4 ∂ 4 f (x, µy )
− · ,
180 ∂y 4
for some µy ∈ [c, d].

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (5/25)


Multiple Integrals CSR in n-D
Improper Integrals Non-Rectangular Domains

Composite Simpson’s Rule in the y -coordinate


1 Let yj = c + jhy , j = 0, 1, . . . , ny , then
Z d » ny /2 –
hy Xˆ ˜
f (x, y ) dy = f (x, y0 ) − f (x, yn ) + 2f (x, y2j ) + 4f (x, y2j−1 )
c 3 j=1
(d − c)hy4 ∂ 4 f (x, µy )
− · ,
180 ∂y 4
for some µy ∈ [c, d].
2 Then we apply the integral in the x−coordinate...
Z bZ d ·Z b Z b
hy
f (x, y ) dy dx = f (x, y0 ) dx − f (x, yn ) dx
a c 3 a a
ny /2 · Z b Z b ¸¸
X
+ 2 f (x, y2j ) dx + 4 f (x, y2j−1 ) dx
j=1 a a
(d − c)hy4 b
∂ 4 f (x, µy )
Z
− dx,
180 a ∂y 4

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (5/25)


Multiple Integrals CSR in n-D
Improper Integrals Non-Rectangular Domains

Apply Composite Simpson’s Rule in the x-coordinate

Now, we “simply” apply CSR in the x-coordinate, for each integral


in the expression...

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (6/25)


Multiple Integrals CSR in n-D
Improper Integrals Non-Rectangular Domains

Apply Composite Simpson’s Rule in the x-coordinate

Now, we “simply” apply CSR in the x-coordinate, for each integral


in the expression...
Z b Z d
f (x, y ) dy dx ≈
a c
» nx /2 „ «–
hx hy X
f (x0 , y0 ) − f (xn , y0 ) + 2f (x2i , y0 ) + 4f (x2i−1 , y0 )
9 i=1
» nx /2 „ «–
X
− f (x0 , yn ) − f (xn , yn ) + 2f (x2i , yn ) + 4f (x2i−1 , yn )
i=1
ny /2 » » nx /2 „ «–
X X
+ 2 f (x0 , y2j ) − f (xn , y2j ) + 2f (x2i , y2j ) + 4f (x2i−1 , y2j )
j=1 i=1
» nx /2 „ «––ff
X
+4 f (x0 , y2j−1 ) − f (xn , y2j−1 ) + 2f (x2i , y2j−1 ) + 4f (x2i−1 , y2j−1 )
i=1

This looks somewhat painful, but do not despair!!! [First, a peek at the error...]

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (6/25)


Multiple Integrals CSR in n-D
Improper Integrals Non-Rectangular Domains

2-Dimensional Composite Simpson’s Rule — The Error

The error for the approximation is

(b − a)(d − c) 4 ∂ 4 f 4
· ¸
4∂ f
E =− hx 4 (νx , µx ) + hy 4 (νy , µy )
180 ∂x ∂y

for some (νx , µx ), (νy , µy ) ∈ R = [a, b] × [c, d].

“Derivation of the error is left as an


exercise for the interested reader...”

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (7/25)


Multiple Integrals CSR in n-D
Improper Integrals Non-Rectangular Domains

Building 2-D CSR in a Comprehensible Way?

Consider the tensor product of the x- and y -stencils for CSR with
2 sub-intervals:
1

hx hy
1 4 2 4 1 ⊗ 2 =
3 3
4

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (8/25)


Multiple Integrals CSR in n-D
Improper Integrals Non-Rectangular Domains

Building 2-D CSR in a Comprehensible Way?

Consider the tensor product of the x- and y -stencils for CSR with
2 sub-intervals:
1 1 4 2 4 1

4 4 16 8 16 4

hx hy hx hy
1 4 2 4 1 ⊗ 2 = 2 8 4 8 2
3 3 9
4 4 16 8 16 4

1 1 4 2 4 1

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (8/25)


Multiple Integrals CSR in n-D
Improper Integrals Non-Rectangular Domains

Building 2-D CSR in a Comprehensible Way?

Consider the tensor product of the x- and y -stencils for CSR with
2 sub-intervals:
1 1 4 2 4 1

4 4 16 8 16 4

hx hy hx hy
1 4 2 4 1 ⊗ 2 = 2 8 4 8 2
3 3 9
4 4 16 8 16 4

1 1 4 2 4 1

Evaluate the function at the corresponding points, multiply by the


above weights, and sum ⇒ 2-D CSR.

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (8/25)


Multiple Integrals CSR in n-D
Improper Integrals Non-Rectangular Domains

Building 2-D CSR in a Comprehensible Way? — Example

x4 y4
9
Z Z
f (x, y ) dx dy ≈
hx h·y x0 y0 ¸
1 f (x0 , y0 ) + 4f (x1 , y0 ) + 2f (x2 , y0 ) + 4f (x3 , y0 ) + f (x4 , y0 ) +
· ¸
4 f (x0 , y1 ) + 4f (x1 , y1 ) + 2f (x2 , y1 ) + 4f (x3 , y1 ) + f (x4 , y1 ) +
· ¸
2 f (x0 , y2 ) + 4f (x1 , y2 ) + 2f (x2 , y2 ) + 4f (x3 , y2 ) + f (x4 , y2 ) +
· ¸
4 f (x0 , y3 ) + 4f (x1 , y3 ) + 2f (x2 , y3 ) + 4f (x3 , y3 ) + f (x4 , y3 ) +
· ¸
1 f (x0 , y4 ) + 4f (x1 , y4 ) + 2f (x2 , y4 ) + 4f (x3 , y4 ) + f (x4 , y4 )

x4 − x 0 y4 − y 0
hx = , hy = .
4 4
Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (9/25)
Multiple Integrals CSR in n-D
Improper Integrals Non-Rectangular Domains

Building Higher-Dimensional Schemes

Using the same strategy, we can build a 3-D CSR-scheme

CSRxyz = CSRx ⊗ CSRy ⊗ CSRz .

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (10/25)


Multiple Integrals CSR in n-D
Improper Integrals Non-Rectangular Domains

Building Higher-Dimensional Schemes

Using the same strategy, we can build a 3-D CSR-scheme

CSRxyz = CSRx ⊗ CSRy ⊗ CSRz .

There’s nothing unique about the usage of CSR. The same idea can be
used to build higher dimensional Gaussian Quadrature schemes. If we
have the stencils for the one-dimensional (Composite) Gaussian
Quadrature schemes in the x-, y - and z-directions (GQx , GQy , GQz ):

GQxyz = GQx ⊗ GQy ⊗ GQz .

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (10/25)


Multiple Integrals CSR in n-D
Improper Integrals Non-Rectangular Domains

Building Higher-Dimensional Schemes

Using the same strategy, we can build a 3-D CSR-scheme

CSRxyz = CSRx ⊗ CSRy ⊗ CSRz .

There’s nothing unique about the usage of CSR. The same idea can be
used to build higher dimensional Gaussian Quadrature schemes. If we
have the stencils for the one-dimensional (Composite) Gaussian
Quadrature schemes in the x-, y - and z-directions (GQx , GQy , GQz ):

GQxyz = GQx ⊗ GQy ⊗ GQz .

If you’re really twisted you could use different schemes in the different
coordinate directions, i.e.

NUMINTxyz = CSRx ⊗ GQy ⊗ Rombergz .

Needless to say, the error terms would get really “interesting.”

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (10/25)


Multiple Integrals CSR in n-D
Improper Integrals Non-Rectangular Domains

Integrating Outside the Box

The integration schemes we have discussed so far only works for


rectangular regions [a, b] × [c, d]...
In calculus we compute integrals of this form:
Z b Z d(x)
f (x, y ) dy dx
a c(x)

We can modify our integration schemes to deal with this type of


integrals.

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (11/25)


Multiple Integrals CSR in n-D
Improper Integrals Non-Rectangular Domains

Dealing with Variable Integration Limits

a b

In order to numerically compute an integral of this type


Z b Z d(x)
f (x, y ) dy dx
a c(x)

we are going to use CSR with a fixed step size hx = (b − a)/nx in


the x-direction, and variable step size hy = (d(x) − c(x))/ny in
the y -direction.
Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (12/25)
Multiple Integrals CSR in n-D
Improper Integrals Non-Rectangular Domains

Variable Integration Limits — Example

For simplicity we apply straight-up one-step SR to


Z b Z d(x)
f (x, y ) dy dx
a c(x)

and get
Z b Z d(x)
f (x, y ) dy dx ≈
a c(x)
½ · ¸
hx d(x0 )−c(x0 ) c(x0 )+d(x0 )
6 f (x 0 , c(x0 )) + 4f (x0 , 2 ) + f (x0 , d(x0 )) +
3
· ¸
4(d(x1 )−c(x1 )) c(x1 )+d(x1 )
6 f (x1 , c(x1 )) + 4f (x1 , 2 ) + f (x1 , d(x1 )) +
· ¸¾
d(x2 )−c(x2 ) c(x2 )+d(x2 )
6 f (x 2 , c(x2 )) + 4f (x2 , 2 ) + f (x2 , d(x2 )) ,

a+b
where x0 = a, x1 = , x2 = b.
2
Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (13/25)
Multiple Integrals CSR in n-D
Improper Integrals Non-Rectangular Domains

Variable Integration Limits

We can imagine how to extend to multiple dimensions, i.e.


Z b Z d(x) Z f (x,y )
g (x, y , z) dz dy dx.
a c(x) e(x,y )

Again, there nothing special about Simpson’s Rule — we can


attack variable integration limits with Gaussian Quadrature,
Trapezoidal Rule, or Boole’s Rule...

Note that there is nothing stopping us from using adaptive schemes


to find the integrals... but the complexity of the code grows!

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (14/25)


Multiple Integrals CSR in n-D
Improper Integrals Non-Rectangular Domains

Algorithm: Variable Limits Double Integral using CSR

Algorithm: Variable Limits Double Integral – CSR


[1] hx = (b-a)/n, ENDPTS=0, EVENPTS=0, ODDPTS=0
[2] FOR i = 0, 1, . . . , n % CSR in x
x = a + i*hx
k1 = f(x,c(x)) + f(x,d(x)) % End terms
k2 = 0 % Even terms
k3 = 0 % Odd terms
hy = (d(x)-c(x))/n
FOR j = 1, 2, . . . , (m − 1)
y = c(x)+j*hy
Q = f(x,y)
IF j EVEN: k2 += Q, ELSE: k3 += Q
END-FOR-j
L = hy*(k1 + 2*k2 + 4*k3)/3;
IF i is 0 OR n: ENDPTS += L
ELSEIF i EVEN: EVENPTS += L
ELSEIF i ODD: ODDPTS += L
END-FOR-i
INTAPPROX = hx*(ENDPTS+2*EVENPTS+4*ODDPTS)/3

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (15/25)


Multiple Integrals Calculus Treasures
Improper Integrals Taylor Expansions... Surprise!

Improper Integrals — Introduction

“Improper” integrals:

[1] Integrals over infinite intervals


Z ∞
f (x) dx.
a

[2] Integrals with unbounded functions


b
f (x)
Z
dx.
a (x − a)p

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (16/25)


Multiple Integrals Calculus Treasures
Improper Integrals Taylor Expansions... Surprise!

Improper Integrals — Introduction

“Improper” integrals:

[1] Integrals over infinite intervals


Z ∞
f (x) dx.
a

[2] Integrals with unbounded functions


b
f (x)
Z
dx.
a (x − a)p

Note: We can always transform [1]→[2]


Z ∞ ½ ¾ Z 0
t = x −1
f (x) dx = = −t −2 f (t −1 ) dt
a dt = −x −2 dx 1/a

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (16/25)


Multiple Integrals Calculus Treasures
Improper Integrals Taylor Expansions... Surprise!

More Forgotten Calculus

The integral
Z b
dx
a (x − a)p
converges if and only if p ∈ (−∞, 1), and
(b − a)1−p
Z b
dx
p
= .
a (x − a) 1−p

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (17/25)


Multiple Integrals Calculus Treasures
Improper Integrals Taylor Expansions... Surprise!

More Forgotten Calculus

The integral
Z b
dx
a (x − a)p
converges if and only if p ∈ (−∞, 1), and
(b − a)1−p
Z b
dx
p
= .
a (x − a) 1−p
If f (x) can be written on the form
g (x)
f (x) = , p ∈ (−∞, 1), g ∈ C [a, b]
(x − a)p
then the improper integral
Z b
f (x) dx, exists.
a

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (17/25)


Multiple Integrals Calculus Treasures
Improper Integrals Taylor Expansions... Surprise!

Splitting the Integrand using Taylor Expansions I/II

Assuming that g ∈ C d+1 [a, b], for some d ∈ Z+ , the Taylor


polynomial of degree d is
d
X g (k) (a)(x − a)k
Pd (x) = .
k!
k=0

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (18/25)


Multiple Integrals Calculus Treasures
Improper Integrals Taylor Expansions... Surprise!

Splitting the Integrand using Taylor Expansions I/II

Assuming that g ∈ C d+1 [a, b], for some d ∈ Z+ , the Taylor


polynomial of degree d is
d
X g (k) (a)(x − a)k
Pd (x) = .
k!
k=0

We can now write


Z b b b
g (x) − Pd (x) Pd (x)
Z Z
f (x) dx = dx + dx,
a a (x − a)p a (x − a)p

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (18/25)


Multiple Integrals Calculus Treasures
Improper Integrals Taylor Expansions... Surprise!

Splitting the Integrand using Taylor Expansions I/II

Assuming that g ∈ C d+1 [a, b], for some d ∈ Z+ , the Taylor


polynomial of degree d is
d
X g (k) (a)(x − a)k
Pd (x) = .
k!
k=0

We can now write


Z b b b
g (x) − Pd (x) Pd (x)
Z Z
f (x) dx = dx + dx,
a a (x − a)p a (x − a)p

where the last integral is easy to find, since Pd (x) is a polynomial:


d Z b (k) d
X g (a) X g (k) (a)
(x − a)k−p dx = (b − a)k+1−p
a k! k!(k + 1 − p)
k=0 k=0

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (18/25)


Multiple Integrals Calculus Treasures
Improper Integrals Taylor Expansions... Surprise!

Splitting the Integrand using Taylor Expansions II/II

If we let
b d
g (k) (a)
Z X
f (x) dx ≈ (b − a)k+1−p ,
a k!(k + 1 − p)
k=0

then the approximation error is bounded by:

b b b
g (x) − Pd (x) Rd (x) g (d+1) (ξ(x))(x − a)d+1
Z Z Z
dx = dx = dx
a (x − a)p a (x − a)p a (k + 1)!(x − a)p
b
1
Z
≤ max |g (d+1) (x)| (x − a)d+1−p dx
(k + 1)! x∈[a,b] a

g(d+1) (ξ)
= (b − a)d+2−p .
(k + 1)! (d + 2 − p)

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (19/25)


Multiple Integrals Calculus Treasures
Improper Integrals Taylor Expansions... Surprise!

Splitting the Integrand using Taylor Expansions II/II

If we let
b d
g (k) (a)
Z X
f (x) dx ≈ (b − a)k+1−p ,
a k!(k + 1 − p)
k=0

then the approximation error is bounded by:

b b b
g (x) − Pd (x) Rd (x) g (d+1) (ξ(x))(x − a)d+1
Z Z Z
dx = dx = dx
a (x − a)p a (x − a)p a (k + 1)!(x − a)p
b
1
Z
≤ max |g (d+1) (x)| (x − a)d+1−p dx
(k + 1)! x∈[a,b] a

g(d+1) (ξ)
= (b − a)d+2−p .
(k + 1)! (d + 2 − p)

What if we want to do better?

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (19/25)


Multiple Integrals Calculus Treasures
Improper Integrals Taylor Expansions... Surprise!

Numerical Approximation of the Remainder Term

To get a more accurate approximation to the integral, we compute the


numerical approximation of the remainder term:
Z b
g (x) − Pd (x)
dx.
a (x − a)p

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (20/25)


Multiple Integrals Calculus Treasures
Improper Integrals Taylor Expansions... Surprise!

Numerical Approximation of the Remainder Term

To get a more accurate approximation to the integral, we compute the


numerical approximation of the remainder term:
Z b
g (x) − Pd (x)
dx.
a (x − a)p
Define: (Remove the singularity)

 g (x) − Pd (x)

x ∈ (a, b]
G (x) = (x − a)p
0 x = a.

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (20/25)


Multiple Integrals Calculus Treasures
Improper Integrals Taylor Expansions... Surprise!

Numerical Approximation of the Remainder Term

To get a more accurate approximation to the integral, we compute the


numerical approximation of the remainder term:
Z b
g (x) − Pd (x)
dx.
a (x − a)p
Define: (Remove the singularity)

 g (x) − Pd (x)

x ∈ (a, b]
G (x) = (x − a)p
0 x = a.

Apply: Composite Simpson’s Rule


 
Z b n/2 · ¸
h X
G (x) dx ≈ G (x0 ) − G (xn ) + 4G (x2j−1 ) + 2G (x2j )  .
a 3
j=1

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (20/25)


Multiple Integrals Calculus Treasures
Improper Integrals Taylor Expansions... Surprise!

Numerical Approximation of the Remainder Term

To get a more accurate approximation to the integral, we compute the


numerical approximation of the remainder term:
Z b
g (x) − Pd (x)
dx.
a (x − a)p
Define: (Remove the singularity)

 g (x) − Pd (x)

x ∈ (a, b]
G (x) = (x − a)p
0 x = a.

Apply: Composite Simpson’s Rule


 
Z b n/2 · ¸
h X
G (x) dx ≈ G (x0 ) − G (xn ) + 4G (x2j−1 ) + 2G (x2j )  .
a 3
j=1

Pd g (k) (a)
Add the CSR-approximation to k=0 k!(k+1−p) (b − a)k+1−p .
Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (20/25)
Multiple Integrals Calculus Treasures
Improper Integrals Taylor Expansions... Surprise!

Example#1 I/III

We want to compute
1
ex
Z
dx.
0 x 1/2
The fourth order Taylor polynomial is

x2 x3 x4
P4 (x) = 1 + x + + + ,
2 6 24

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (21/25)


Multiple Integrals Calculus Treasures
Improper Integrals Taylor Expansions... Surprise!

Example#1 I/III

We want to compute
1
ex
Z
dx.
0 x 1/2
The fourth order Taylor polynomial is

x2 x3 x4
P4 (x) = 1 + x + + + ,
2 6 24
so
1 1
P4 (x) x 3/2 x 5/2 x 7/2
Z Z
dx = x −1/2 + x 1/2 + + + dx
0 x 1/2 0 2 6 24
2 2 2 2 2
= + + + + ≈ 2.923544974
1 3 2 · 5 6 · 7 24 · 9

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (21/25)


Multiple Integrals Calculus Treasures
Improper Integrals Taylor Expansions... Surprise!

Example#1 II/III
R1
Next, we apply CSR with h = 1/4 to 0
G (x) dx, where
 x
 e − P4 (x) x ∈ (0, 1]
G (x) = x 1/2
0 x = 0.

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (22/25)


Multiple Integrals Calculus Treasures
Improper Integrals Taylor Expansions... Surprise!

Example#1 II/III
R1
Next, we apply CSR with h = 1/4 to 0
G (x) dx, where
 x
 e − P4 (x) x ∈ (0, 1]
G (x) = x 1/2
0 x = 0.

1 ·
1
Z
G (x) dx ≈ 0 + 4 · 0.0000170 + 2 · 0.00413 + 4 · 0.0026026
0 4·3
¸
+0.0099485 = 0.0017691.

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (22/25)


Multiple Integrals Calculus Treasures
Improper Integrals Taylor Expansions... Surprise!

Example#1 II/III
R1
Next, we apply CSR with h = 1/4 to 0
G (x) dx, where
 x
 e − P4 (x) x ∈ (0, 1]
G (x) = x 1/2
0 x = 0.

1 ·
1
Z
G (x) dx ≈ 0 + 4 · 0.0000170 + 2 · 0.00413 + 4 · 0.0026026
0 4·3
¸
+0.0099485 = 0.0017691.

Hence,
Result
1
ex
Z
dx ≈ 2.923544974 + 0.0017691 = 2.9253141
0 x1/2

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (22/25)


Multiple Integrals Calculus Treasures
Improper Integrals Taylor Expansions... Surprise!

Example#1 III/III

Since |G (4) (x)| < 1 on (0, 1], the error from CSR is bounded by
1 1
· 4 = 0.0000217.
180 4

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (23/25)


Multiple Integrals Calculus Treasures
Improper Integrals Taylor Expansions... Surprise!

Example#1 III/III

Since |G (4) (x)| < 1 on (0, 1], the error from CSR is bounded by
1 1
· 4 = 0.0000217.
180 4
The error bound for the Taylor-only approximation is bounded by
1
= 0.00151515
5! · 5.5

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (23/25)


Multiple Integrals Calculus Treasures
Improper Integrals Taylor Expansions... Surprise!

Example#1 III/III

Since |G (4) (x)| < 1 on (0, 1], the error from CSR is bounded by
1 1
· 4 = 0.0000217.
180 4
The error bound for the Taylor-only approximation is bounded by
1
= 0.00151515
5! · 5.5
R
If, instead of adding the CSR-approximation of G (x) dx, we used
P5 (x), the error bound for that Taylor-only approximation would be
1
= 0.00021044.
6! · 6.5

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (23/25)


Multiple Integrals Calculus Treasures
Improper Integrals Taylor Expansions... Surprise!

Example#1 III/III

Since |G (4) (x)| < 1 on (0, 1], the error from CSR is bounded by
1 1
· 4 = 0.0000217.
180 4
The error bound for the Taylor-only approximation is bounded by
1
= 0.00151515
5! · 5.5
R
If, instead of adding the CSR-approximation of G (x) dx, we used
P5 (x), the error bound for that Taylor-only approximation would be
1
= 0.00021044.
6! · 6.5

The P6 (x)-only-error is comparable with the P4 (x)+CSR-error:


1
= 0.000026455.
7! · 7.5
Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (23/25)
Multiple Integrals Calculus Treasures
Improper Integrals Taylor Expansions... Surprise!

Example#2 I/II

We are going to approximate the integral


Z ∞ µ ¶
1 1
3/2
sin dx.
1 x x

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (24/25)


Multiple Integrals Calculus Treasures
Improper Integrals Taylor Expansions... Surprise!

Example#2 I/II

We are going to approximate the integral


Z ∞ µ ¶
1 1
3/2
sin dx.
1 x x
A quick change of variables t = x −1 gives us
Z 1
t −1/2 sin(t) dt.
0

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (24/25)


Multiple Integrals Calculus Treasures
Improper Integrals Taylor Expansions... Surprise!

Example#2 I/II

We are going to approximate the integral


Z ∞ µ ¶
1 1
3/2
sin dx.
1 x x
A quick change of variables t = x −1 gives us
Z 1
t −1/2 sin(t) dt.
0
The sixth Taylor polynomial P6 (t) for sin(t) about t = 0 is
1 1 5 1
P6 (t) = t − t 3 + t , |R6 (t)| ≤ = 0.00019841
6 120 7!

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (24/25)


Multiple Integrals Calculus Treasures
Improper Integrals Taylor Expansions... Surprise!

Example#2 I/II

We are going to approximate the integral


Z ∞ µ ¶
1 1
3/2
sin dx.
1 x x
A quick change of variables t = x −1 gives us
Z 1
t −1/2 sin(t) dt.
0
The sixth Taylor polynomial P6 (t) for sin(t) about t = 0 is
1 1 5 1
P6 (t) = t − t 3 + t , |R6 (t)| ≤ = 0.00019841
6 120 7!
Z 1 Z 1
1 1 9/2
t −1/2
P6 (t) dt = t 1/2 − t 5/2 + t dt
0 0 6 120
2 2 2
= − + = 0.62056277
3 7 · 6 11 · 120
Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (24/25)
Multiple Integrals Calculus Treasures
Improper Integrals Taylor Expansions... Surprise!

Example#2 II/II

We define
 sin(t) − P6 (t) t ∈ (0, 1]

G (t) = t 1/2
0 t = 0,

R1
and apply CSR with h = 1/32 to 0 G (t) dt to get

Result

∞ µ ¶
1 1
Z
sin dx
1 x3/2 x

≈ 0.62056277 − 0.0000261672790305 = 0.62053660 . . .

which is accurate to within ∼ 10−8 .

Joe Mahaffy, hmahaffy@[Link] Multiple Integrals; Improper Integrals — (25/25)

You might also like