#04 (08/28/2024)
Integration
Some of important integrals that you may have forgotten:
⌠
⌡
x
α
dx
x
α+ 1
α+ 1
⌠
⌡
1
x
dx
ln
x
⌠
⌡
dx
1 +
x
2
arctan
x
⌠
⌡
dx
√
a
2
−
x
2
arcsin (
x
/
a
)
⌠
⌡
f
(
x
)
g
′(
x
)
dx
f
(
x
)
g
(
x
) −
⌠
⌡
f
′(
x
)
g
(
x
)
dx
⌠
⌡
f
(
x
)
dx
x
f
(
x
) −
⌠
⌡
x
f
′(
x
)
dx
Exercises
Evaluate the following integrals:
(
a
)
⌠
⌡
dx
e
x
+
e
−
x
(
b
)
⌠
⌡
√
a
2
−
x
2
dx
(
c
)
⌠
⌡
e
ax
cos
b
x
dx
(
d
)
⌠
⌡
√
x
2
+ 1
dx
Solution for (d)
I
≡
⌠
⌡
√
x
2
+ 1
dx
.
Use integration by parts:
I
=
x
√
x
2
+ 1
−
⌠
⌡
x
⎛
⎝
√
x
2
+ 1
⎞
⎠
′
dx
=
x
√
x
2
+ 1
−
⌠
⌡
x
2
√
x
2
+ 1
dx
=
x
√
x
2
+ 1
−
⌠
⌡
x
2
+ 1 − 1
√
x
2
+ 1
dx
=
x
√
x
2
+ 1
−
⌠
⌡
√
x
2
+ 1
dx
+
⌠
⌡
dx
√
x
2
+ 1
=
x
√
x
2
+ 1
−
I
+
⌠
⌡
dx
√
x
2
+ 1
,
(1)
so
I
=
1
2
⎛
⎜
⎝
x
√
x
2
+ 1
+
⌠
⌡
dx
√
x
2
+ 1
⎞
⎟
⎠
.
(2)
Now, the integral,
J
, defined as
J
≡
⌠
⌡
dx
√
x
2
+ 1
,
(3)
is a challenging integral. The recipe is to change the variable from
x
to
t
as
1
√
x
2
+ 1
=
t
−
x
.
(4)
With this substitution,
1
=
t
2
−2
t
x
,
(5)
dx
=
t
−
x
t
dt
,
(6)
so
J
=
⌠
⌡
1
t
−
x
t
−
x
t
dt
=
⌠
⌡
dt
t
=
ln
t
=
ln
⎛
⎝
x
+
√
x
2
+ 1
⎞
⎠
,
(7)
and finally we obtain
I
=
1
2
⎛
⎝
x
√
x
2
+ 1
+ ln
⎛
⎝
x
+
√
x
2
+ 1
⎞
⎠
⎞
⎠
.
(8)
It is, however, more practical these days to carry out integrations like the one above via computer.
Enter the following line
Sqrt[x^2 + 1]
exactly (case sensitive, square bracket) in the first box and
x
(lower case) in the second box, then press the query button.
Integrate
with respect to
.
Numerical Integration
You can differentiate almost any function exactly but very few functions can be integrated analytically which is why numerical integrations are more important than numerical differentiation.
(Left) Rectangular rule:
I
∼
h
(
f
0
+
f
1
+
f
2
+ …+
f
n
−1
).
(9)
Trapezoidal rule:
I
∼
h
2
(
f
0
+ 2
f
1
+ 2
f
2
+ …+ 2
f
n
−1
+
f
n
).
(10)
Simpson rule:
I
∼
h
′
3
(
f
0
+4
f
1
+ 2
f
2
+ 4
f
3
+ 2
f
4
+ …+ 4
f
2
n
−1
+
f
2
n
).
(11)
where
h
=
b
−
a
n
,
h
′ =
b
−
a
2
n
.
(12)
It is possible to estimate possible numerical errors for each scheme.
Derivation
Rectangular rule
The rectangular rule is to approximate ∫
a
t
f
(
x
)
dx
by a rectangle with
f
(
t
) as the height and
t
−
a
( =
h
) as the base.
The error is then defined as
ϵ(
t
) = (
t
−
a
)
f
(
t
) −
⌠
⌡
t
a
f
(
x
)
dx
.
(13)
To see how this function behaves, take the derivative of ϵ(
t
) with respect to
t
as
ϵ′(
t
)
=
f
(
t
) + (
t
−
a
)
f
′(
t
) −
f
(
t
)
=
f
′(
t
) (
t
−
a
)
∼
f
′(ξ) (
t
−
a
),
(14)
where ξ is some constant value assuming that
f
′(
t
) does not fluctuate much between
a
and
t
. By integrating Eq. (
14
) with respect to
t
, we have
ϵ(
t
)
∼
f
′(ξ)
2
(
t
−
a
)
2
=
f
′(ξ)
2
h
2
,
(15)
where
h
= (
t
−
a
).
When adding up Eq. (
15
) over a finite interval of (
a
,
b
) for
n
times, the total error is
ϵ
total
∼
n
h
2
f
′(ξ)
2
=
(
b
−
a
)
f
′(ξ)
2
h
,
(16)
where
b
−
a
=
n
h
was used in Eq. (
16
). Equation (
16
) implies that when the rectangular rule is used to approximate
⌠
⌡
b
a
f
(
x
)
dx
,
(17)
the numerical error involved is in the order of
ϵ
total
∼
A
h
,
(18)
where
A
is a constant and
h
is the step size. In other words, to get 10
−5
accuracy for
b
−
a
= 1, one would need
n
= (
b
−
a
)/
h
∼ 10
5
partitions over the interval.
Trapezoidal Rule
The error involved in the trapezoidal rule is given
ϵ(
t
) =
⎛
⎝
f
(
t
) +
f
(
a
)
2
⎞
⎠
(
t
−
a
) −
⌠
⌡
t
a
f
(
x
)
dx
.
(19)
Take the derivative of Eq. (
19
) as
ϵ′(
t
) =
f
′(
t
)
2
(
t
−
a
) +
f
(
t
) +
f
(
a
)
2
−
f
(
t
),
(20)
which does not yield much insight. Try taking another derivative of Eq. (
20
) as
ϵ"(
t
)
=
f
"(
t
)
2
(
t
−
a
) +
f
′(
t
)
2
+
f
′(
t
)
2
−
f
′(
t
)
∼
f
"(ξ)
2
(
t
−
a
).
(21)
Integrating Eq. (
21
) yields
ϵ′(
t
) ∼
f
"(ξ)
4
(
t
−
a
)
2
.
(22)
Integrating Eq. (
22
) again yields
ϵ(
t
)
∼
f
"(ξ)
12
(
t
−
a
)
3
=
f
"(ξ)
12
h
3
.
(23)
By adding up Eq. (
23
) over the interval of (
a
,
b
), we obtain
ϵ
total
∼
n
h
3
f
"(ξ)
12
=
(
b
−
a
)
f
"(ξ)
12
h
2
∼
A
h
2
,
(24)
where
A
is a constant. This conclusion implies that we need √{10
5
} ∼ 316 partitions to obtain 10
−5
accuracy.
Simpson's Rule
From the result of error analysis of the trapezoidal rule, it was found that
I
∼
T
n
+
A
h
2
,
(25)
where
I
is the true value,
T
n
is the approximation by the trapezoidal rule,
h
is the step size and
n
is the number of partitions. If one makes the stepsize
h
one-half, Eq. (
25
) becomes
I
∼
T
2
n
+
A
⎛
⎝
h
2
⎞
⎠
2
,
(26)
or
I
∼
T
n
+
A
h
2
,
(27)
4
I
∼
4
T
2
n
+
A
h
2
,
(28)
from which it follows
I
∼
4
T
2
n
−
T
n
3
+
(
higher
order
terms
than
h
2
)
.
(29)
Actual computation of Eq. (
29
) is
I
∼
1
3
⎛
⎝
4
h
2
(
f
0
+ 2
f
1
+ 2
f
2
+ …+ 2
f
2
n
−1
+
f
2
n
)−
(2
h
)
2
(
f
0
+ 2
f
2
+ 2
f
4
+ …+
f
2
n
)
⎞
⎠
=
h
3
⎛
⎝
f
0
+ 4
f
1
+ 2
f
2
+ 4
f
3
+ 2
f
4
+ …+2
f
2
n
−2
+ 4
f
2
n
−1
+
f
2
n
⎞
⎠
.
(30)
Equation (
30
) is called the Simpson rule as you already figured it out.
An example of numerical integration with poor convergence:
Using the relationship
4
⌠
⌡
1
0
√
1 −
x
2
dx
= π,
(31)
to compute an approximation of π.
Numerical integration of this function results in poor convergence. Why ?
Footnotes:
1
For an integral of the type
⌠
⌡
F
(
x
,
√
a
x
2
+
b
x
+
c
)
dx
a
> 0
the following change of variable usually works:
√
a
x
2
+
b
x
+
c
= √
a
x
−
t
.
File translated from T
E
X by
T
T
H
, version 4.03.
On 27 Aug 2024, 20:59.