0% found this document useful (0 votes)
155 views44 pages

Integral Calculus: 12. Problem: Area Under A Curve

This document discusses integral calculus and the fundamental theorem of calculus. It introduces the problem of finding the area under a curve, which was solved by Newton and Leibniz using rectangles to approximate the area. It then discusses Riemann integrals and properties of integrals. Finally, it explains the fundamental theorem of calculus, which relates differentiation and integration by stating that differentiation is the inverse of integration.

Uploaded by

Kami Dentist
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)
155 views44 pages

Integral Calculus: 12. Problem: Area Under A Curve

This document discusses integral calculus and the fundamental theorem of calculus. It introduces the problem of finding the area under a curve, which was solved by Newton and Leibniz using rectangles to approximate the area. It then discusses Riemann integrals and properties of integrals. Finally, it explains the fundamental theorem of calculus, which relates differentiation and integration by stating that differentiation is the inverse of integration.

Uploaded by

Kami Dentist
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
You are on page 1/ 44

Ch 12 - Integral Calculus 5/29/2013

Chapter 12
Ch
Integral Calculus

1
Newton Leibniz

12. Problem: Area under a curve

• A very old problem


(Archimedes proposed a
solution! Fermat worked on
it, too). Newton and Leibniz
solved it.

g
• Idea: Introduce rectangles
under the curve, defined by
f(x), find the area of all of
those rectangles and add
them all up.
2

1
Ch 12 - Integral Calculus 5/29/2013

12. Estimating Area Under Points


• What if instead of a function, we were given points: how could
we use rectangles to estimate area under points?

12. Underestimating Area


• Here we underestimate the area by putting left corners at points:

2
Ch 12 - Integral Calculus 5/29/2013

12. Overestimating Area


• Here we overestimate the area by putting right corners at points:

12.1 Problem: Area under a curve


• Let ∆x=x1-x0. This is the base of the area.
• As. ∆x gets smaller, the approximation for the area under the
curve becomes more accurate.
• Bernhard Riemann thought of an idea using the concept of
adding small rectangles.
b n n

∫ f(x)dx = lim ∑ f (m k )Δ xk = lim ∑ f ( M k )Δxk


a n→∞ k =1 n→∞ k =1

• A function is Riemann integrable on [a,b] if:


- It is continuous on [a,b]
- It is monotone on [a,b]
- It is bounded and there a finite number of discontinuities on 6
[a,b]

3
Ch 12 - Integral Calculus 5/29/2013

12.1 Problem: Area under a curve


• An Example of a function that is not Riemann integrable:
The Dirichlet Function (Q is the set of rational numbers):
1 if x ∈ Q
f (x) =
0 if x ∉ Q

It is discontinuous on the Irrational Numbers: Uncountable set

• There are several generalizations of the Riemann integral:


Lebesgue, Perron, Denjoy, Henstock Integral (Generalized
Riemann Integral), etc.

12.1 Notation
• f(x): function (it must be continuous in [a,b]).
• x: variable of integration
• f( ) dx:
f(x) d integrand
i t d
• a, b: boundaries

b
∫ a
f ( x ) dx

4
Ch 12 - Integral Calculus 5/29/2013

12.1 Properties of Integrals


Assuming f(x) is a continuous function and a,b, and c are various x
limits and k is a constant, the following properties can be derived:
a
∫a
f ( x)dx = 0
b a
∫a
f ( x)dx = − ∫ f ( x)dx
b
c b c
∫a
f ( x)dx = ∫ f ( x)dx + ∫ f ( x)dx
a b
b b
∫a
kf ( x)dx =k ∫ f ( x)dx
a
c c b
∫a
f ( x)dx = ∫ f ( x)dx − ∫ f ( x)dx
b a
b b b
∫a
f ( x) + g ( x)dx = ∫ f ( x)dx + ∫ g ( x)dx
a a
9

12.2 Fundamental theorem of calculus

• The fundamental theorem of calculus states that differentiation


and integration are inverse operations.

• It relates the values of antiderivatives to definite integrals. Because


it is usually easier to compute an antiderivative than to apply the
definition of a definite integral, the Fundamental Theorem of
Calculus provides a practical way of computing definite integrals.

• It can also be interpreted as a precise statement of the fact that


differentiation is the inverse of integration.

10

5
Ch 12 - Integral Calculus 5/29/2013

12.2 Fundamental theorem of calculus


• The Fundamental Theorem of Calculus states: If a function f is
continuous on the interval [a, b] and if F is a function whose
d i ti is
derivative i f on the
th interval
i t l (a,
( b),
b) then
th

• Furthermore, for every x in the interval (a, b),


x
dF ( x )
F ( x) = ∫ f (t ) dt ,
a
satisfying
dx
= f ( x)

• In other words, if a function has a derivative over a range of


numbers, the integral over that same range can be calculated by
evaluating at the end points of the range and subtracting!

11

12.2 Fundamental theorem of calculus: Notes

• The first part is used to evaluate integrals.


• The second part defines the anti
anti-derivative.
derivative. Finding the the
anti-derivative is finding the integral.

• Example: Find the antiderivative of f(x) = 10 x4


F(x) = 2 x5

• In ggeneral, small letters will be used for functions, capital


p letters
for anti-derivatives.

12

6
Ch 12 - Integral Calculus 5/29/2013

12.2 Physics Example: Velocity & Acceleration

• Velocity, v(t), is defined as the derivative of position, x(t).


Acceleration, a(t),
( ) is the derivative of v(t),
( ) and the second
derivative of x(t).
• The integral of acceleration is velocity. The integral of velocity is
position.
• The graph of v(t) against time, t, shows that the area between
two times is the distance traveled.
• On the other hand, the area under a(t) against time shows the
velocity.
l i

13

12.3 Rules of Integration


Integration of the power function:

n ≠ −1 κ
∫ κx dx = n + 1 x
For n +1
n
+C

κ
∫ x dx = κ ln( x ) + C
1
Integration of
x

e λx
∫e
λx
The Integral of ex dx = +C
λ
The Constant Multiple Rule ∫ cf ( x)dx = c ∫ f ( x)dx
The Sum Rule for Integrals ∫[ f (x) + g(x)]dx = ∫ f (x)dx+ ∫ g(x)dx14

7
Ch 12 - Integral Calculus 5/29/2013

12.3 Rules of Integration: Applied Joke


There's a big calculus party, and all the functions are invited.
ln(x) is talking to some trig functions, when he sees his friend ex
sulking
lki in i a corner.
ln(x): "What's wrong ex?"
ex : "I'm so lonely!"
ln(x): "Well, you should go integrate yourself into the crowd!"
ex looks up and cries, "It won't make a difference!"

15

12.3 Rules of Integration


− cos αx
Integration of sin function:
∫ sin αxdx = α
+C

sin α x
Integration of cosine function: ∫ cos αxdx = α + C
dx
∫ 1+ x
1
Integration of = arctan x + C
1+ x2 2

16

8
Ch 12 - Integral Calculus 5/29/2013

12.3 Rules of Integration: Examples


2
• Evaluate the following:
∫ (x + 2e 3 x + 1)dx
3
0

• Graph
p

2 2 2
• Sum of 3 integrals ∫0
x 3 dx + 2 ∫
0 ∫
e 3 x dx + dx
0
2
⎡1 4 ⎤
2
⎡ e3x ⎤
⎥ + [x ]0
• Apply integration rules and + 2
FTC Part 1.
x
⎢4 ⎥ 2 ⎢
⎣ ⎦0 ⎣⎢ 3 ⎦⎥ 0

• Compute area under the ( ) (


2 + e − 1 + (2 ) = 274.29
1 4 2 6
4 3
)
curve. 17

12.4 Integration by Substitution


• Some integrals cannot be easily solved by just applying the
previous rules of integration.

• Consider
∫x cos( x 3 − 2 ) dx
2

• Graph:

• W
We can use a chain
h i rule
l lik
like argumentt tto simplify
i plif th
the iintegration.
t ti
For example, let u=x3-2, then du=3x2 dx => x2 dx = 1/3 du

• Substituting back into the original integral:


1 1 1
∫ 3 cos( u ) du =
3
sin( u ) + C = sin( x 3 − 2 ) + C
3
18

9
Ch 12 - Integral Calculus 5/29/2013

12.4 Integration by Substitution


• Suppose we want to find the integral from -1 to 2.5.

Th
Then,
2.5
2 .5 ⎡ 1 ⎤
∫ x cos( x − 2)dx = ⎢= sin( x 3 − 2) + C ⎥
2 3
−1 ⎣ 3 ⎦ -1
1
= [sin(2.5 3 - 2) - sin(-13 - 2)] = 0.3376015
3
• Graph:

19

12.4 Integration by Substitution

• The key is to find the appropriate u. The variable of integration


changes from x to u.
• Thus, it is important not to forget to substitute also dx.

• Another example:

∫ (4 x + 3 )
4
dx
u = 4x + 3
du
du = 4 dx ⇒ = dx
4
u4 1 u5
∫ 4
du =
4 5
+C
20

10
Ch 12 - Integral Calculus 5/29/2013

12.5 Integration by Parts

• Recall the product rule of differentiation:


d(u v) = u dv + v du

• Solve for u dv: udv = d (uv) − vdu


• Integrating both sides: ∫ udv = ∫ [ d ( uv ) − vdu ]
∫ udv = uv − ∫ vdu

• The last formula is used to integrate by parts.

• Key: selection of u & v functions. In general, u involves logs,


inverse, power, exponential, and trigonometric functions (in
21
this order, LIPET).

12.5 Integration by Parts: Example I

∫ xe
x
• Example: dx

• Select appropriate u & v functions –actually, select dv.

• Recall LIPET. We have a power function and an exponential


f
function.
i Since
Si power functions
f i come before
b f exponential
i l
functions, u equals x.

• From u, get du. => u=x, then du=dx


• From dv, get v. => v=ex, then dv=exdx
• Then, simply plug this into the integration by parts formula. 22

11
Ch 12 - Integral Calculus 5/29/2013

12.5 Integration by Parts: Example I (cont)

• Replace u, v, du, and dv.


∫ udv = uv − ∫ vdu
∫ xe dx = xe − ∫ e dx
x x x
• If the integral on the right looks
easy to compute, then simply
integrate it. Otherwise, you can = xe x − e x + C
integrate by parts again, or use = e x ( x − 1) + C
substitution method.

23

12.5 Integration by Parts: Example II

• Example:
∫ e 2 x cos( x ) dx
• Select appropriate u & v functions.
• Exponential functions come before trigonometric functions.
Then, u = e2x .
• From u, get du. =>u= e2x =>then du = 2 e2x dx
• From dv, get v. => dv=cos(x) dx => v = sin(x).
• Then, simply plug this into the integration by parts formula.

Κ = ∫ udv = uv − ∫ vdu

∫e cos( x ) dx = Κ
2x

Κ = e 2 x sin( x ) − 2 ∫ e 2 x sin( x ) dx 24

12
Ch 12 - Integral Calculus 5/29/2013

12.5 Integration by Parts: Example II (cont)

• The expression looks Κ = e2x sin(x) − 2∫ e2x sin(x)dx


more complicated than
the
h original.
i i l IIntegrate b
by u = e2x
parts again. du = 2e2xdx
• The integral of e2x cos(x) v = − cos(x)
is equal to Κ (the
original integral). dv = sin(x)dx
• Replace the integral of ( )
Κ = e2x sin(x) − 2 − e2x cos(x) + 2∫ e2x cos(x)dx
e2x cos(x) with Κ and
solve for Κ.
Κ Note Κ = ∫ e2x cos(x)dx
Κ = e2x sin(x) + 2e2x cos(x) − 4Κ
5Κ = e2x sin(x) + 2e2x cos(x)
e2x sin(x) + 2e2x cos(x)
Κ= +C
5
25

12.5 Integration by Parts: Tricks

• In an integral, do only integration by parts in the parts that are


not easyy to integrate.
g
• If the integration by parts is getting out of hand, you may have
selected the wrong u function.
• If you see your original integral in the integral part of the
integration by parts, just combine the two like integrals and solve
for the integral.

26

13
Ch 12 - Integral Calculus 5/29/2013

12.6 Improper Integrals


• An improper integral is an integral that has infinity as its limits or
has a discontinuity within its limits. Some converge, some diverge.
• Examples:

∫ 0
e − 2 x dx Infinity as a boundary

5 1
∫ 0 x−4
dx Discontinuity at x=4.

• With limits of infinity, use a letter to replace the infinity, say τ,


and treat it as a limit (lim τ → ∞).
• With points of discontinuity, split integral into parts. But, we
cannot integrate to the point of discontinuity, say x0. Then we 27
integrate to x0±δ and take limits as δ→0.

12.7 Applications: Value of a Bond

• Value of cash flows of a bond, paying continuous dividend.


• Maturity: T (say, T=3 years)
• Face value: FV (say, $1,000)
• Continuous discount rate: r (say, 5% annual)
• Continuous dividend rate: δ (say, 7% annual)
T T
e −rt T
∫ ∫
− rt
CF = δ FV e dt = δ FV e −rt dt = δ FV (− ) |0
r
0 0
δ δ
= FV (−e −rT + e −0 ) = FV (1 − e −rT )
r r
.07
CF(T = 3; FV = 1,000, r = .05, δ = .07) = $1,000(1 − e −.05x3 ) = $195.00
.05

28

14
Ch 12 - Integral Calculus 5/29/2013

12.7 Applications: Elements of Probability


• X is a random variable (an outcome of a random event). A
random variable (RV) is a function.
• X can be discrete (recession, boom) or continuous (price of IBM
stock tomorrow).
• Given a sample space S (S: set of all possible outcomes)
• To each discrete outcome A we associate a real number P(A)
• P is called a probability function and P(A) is called the
probabilityy of the event A if
p
– Axiom 1: For every event A, P(A) ≥ 0
– Axiom 2: For the Sure/Certain event S, P(S) = 1
– Axiom 3: For any number of mutually exclusive events A1, A2, A3
…, we have P(A1 U A2 U A3 U…) = P(A1) + P(A2) + P(A3) +...
29

12.7 Applications: Elements of Probability


• For continuous RV, the probability function is f(x), such that:
− f ( x) ≥ 0

− ∫ f ( x ) dx = 1
−∞
b
− P (a ≤ X ≤ b) = ∫ f ( x ) dx
a

• f(x) is called probability density function (pdf), or just “density.”

• The cumulative distribution function (CDF) of a discrete RV X,


denoted as F(x), is
F(x) = P(X ≤x) =∑xi≤x P(xi)
The cumulative distribution function (CDF) of a discrete RV X,
denoted as F(x), is
30
F(x) = P(X ≤x) =∫xi≤x f(xi)

15
Ch 12 - Integral Calculus 5/29/2013

12.7 Applications: Elements of Probability


• Example: Uniform Distribution: f(x)=constant –i.e., the
probability of any outcome is the same. Suppose x ∈[0,20]. What
i th
is the probability
b bilit th
thatt x is
i between
b t 10 andd 15?

15 15 15
1 1 1 1 1
P(10 ≤ X ≤ 15) = ∫ f ( x)dx = ∫ dx = ∫ dx = ( x) |15
10 = (15 −10) = .
10 10
20 20 10 20 20 4

• Example: Exponential Distribution: f(x)= λ e-λx for 0≤x ≤∞. Let


Suppose λ =3,
=3 what is the probability that x is between 0 and 1?
e−3x
1 1
P(0 ≤ X ≤ 1) = ∫ f (x)dx = 3∫ e−3xdx = −3 = −(e−3x ) |10
0 0
3
= −(e −1) = 1− e−3 = 0.9502.
−3

31

12.7 Applications: Elements of Probability


• Mean and Variance
Suppose X is a continuous RV with probability density function
f(x). Then, the mean or expected value of X, denoted μ, is

μ = E[ X ] = ∫ xf ( x)dx
−∞

• The variance of X, denoted as σ2 or V[X], is



σ 2 = V [ X ] = ∫ ( x − μ )2 f ( x)dx
−∞

• The standard deviation, σ, is the square root of V[X].

32

16
Ch 12 - Integral Calculus 5/29/2013

12.7 Applications: Elements of Probability


• Example: Uniform Distribution: f(x)= 1/20. Calculate the mean
and variance of f(x), where x ∈ [0,20]?
20 20 20
x 1 1 x 2 20 1
E[ X ] = ∫ xf ( x)dx = ∫
20 ∫0
dx = xdx = ( ) |0 = (400) = 10.
0 0
20 20 2 40
( x − 10) 2
20 20 20
1 1 u 3 20
V [ X ] = ∫ ( x − μ ) 2 f ( x)dx = ∫
20 ∫0
dx = (u ) 2
du = ( ) |0
0 0
20 20 3
1 1
= ( x − 10)3 |020 = (103 + 103 ) = 33.33
60 60
• Example: Exponential Distribution: f(x)= λ e-λx for 0≤x ≤∞.
Calculate the mean (integration by parts needed, u=x, v=-e-λx ).
∞ ∞
e − λx 1
∫ xλ e dx = e x |0 + ∫ e dx = 0 − (
− λx − λx ∞ − λx
E[ X ] = ) |∞0 = .
0 0
λ λ 33

12.8 Double Integrals


• Now, z=f(x,y), we have two variables of integration: x and y.
• Simple integrals represent areas, double integrals represent
volume.

We want to know the volume


defined by z=f(x,y) ≥ 0
on the rectangle R=[a,b]×[c,d]

34

17
Ch 12 - Integral Calculus 5/29/2013

12.8 Double Integrals


• Similar to the intuition behind simple integrals, we can think
of the double integral as a sum of small –easy to calculate-
volumes.
l

35

12.8 Double Integrals


ij’s column:
y z

(xi, yj) f (xij*, yij*)


Rij

Sample point (xij*, yij*) y


x x

Area of Rij is Δ A = Δ x Δ y
Volume of ij’s column: f ( xij* , yij* )ΔA
m n
Total volume of all columns: ∑∑ f ( x , y
i =1 j =1
*
ij
*
ij ) ΔA
36

18
Ch 12 - Integral Calculus 5/29/2013

12.8 Double Integrals

m n
V ≈ ∑∑ f ( xij* , yij* )Δ A
i =1 j =1

• Definition of a Double Integral:


m n
V = lim ∑ ∑
m, n → ∞ i =1 j =1
f ( x ij* , y ij* ) Δ A

37

12.8 Double Integrals


The double integral ∫∫
R
f ( x , y ) dA of f over the rectangle R is

m n

∫∫ f ( x , y ) dA = li ∑ ∑
lim
m, n → ∞ i = 1 j =1
f ( x ij* , y ij* ) Δ A , if the
h lilimit
i exists.
i
R
m n

• Double Riemann sum: ∑∑ i =1 j =1


f ( x ij* , y ij* ) Δ A

• Note 1: If f is continuous then the limit exists and the integral is


defined.
• Note 2: The definition of double integral does not depend on the
choice of sample points.
• If the sample points are upper right-hand corners then
m n

∫∫ f (x, y)dA = lim∑∑ f (xi , y j )ΔA


R m,n→∞ i =1 j =1 38

19
Ch 12 - Integral Calculus 5/29/2013

12.8 Double Integrals: Example


• Let z=16-x2-2y2, where 0≤x≤2
and 0≤y≤2.
• Estimate the volume of the
solid above the square and
below the graph
• Let’s partitioned the volume in
small (mxn) volumes.
• Exact volume: 48.

39
m=n=4;V≈41.5 m=n=8;V≈44.875 m=n=16;V≈ 46.46875

12.8 Double Integrals: Properties


• Linearity

∫∫[ f ( x, y) + g ( x, y)]dA = ∫∫ f ( x, y)dA + ∫∫ g ( x, y)dA


A A A

∫∫ cf ( x, y)dA = c ∫∫ f ( x, y)dA
A A

• Comparison: If f(x,y)≥g(x,y) for all (x,y) in R, then

∫∫ f ( x, y ) dA ≥ ∫∫ g ( x, y ) dA
A A

• Additivity: If A1 and A2 are non-overlapping regions then

∫∫ f ( x , y ) dA =
A1 ∪ A 2
∫∫ A1
f ( x , y ) dA + ∫∫
A2
f ( x , y ) dA 40

20
Ch 12 - Integral Calculus 5/29/2013

12.8 Double Integrals: Computation


• If f(x,y) is continuous on rectangle R=[a,b]×[c,d] then the double
integral is equal to the iterated integral

d b b d

∫∫ f ( x, y)dA = ∫ ∫ f ( x, y)dxdy =∫ ∫ f ( x, y)dydx


R c a a c
y
d
y
fixed fixed

c
x
a x b 41

12.8 Double Integrals: Computation


• Example:

11
⎛1
1

∫∫R f ( x, y)dA =∫∫
00
( x + y)dxdy=∫ ⎜∫

0⎝0
( x + y)dx⎟
⎟dy =

1
1
⎛ (x + y)2 ⎞ 1
⎛ (1+ y)2 − y2 ⎞ 1
(1+ y)2 − y2
= ∫ ⎜⎜ ⎟⎟ dy =∫ ⎜⎜ ⎟⎟dy =∫ dy
0⎝ ⎠0 0⎝ ⎠
2 2 0
2
1 1
(1+ y)2
1 1 2
y ⎛ (1+ y)3 ⎞ ⎛ y3 ⎞ 23 −1 1
=∫ dy − ∫ dy = ⎜⎜ ⎟⎟ − ⎜⎜ ⎟⎟ = − =1
0
2 0
2 ⎝ 6 ⎠0 ⎝ ⎠0
6 6 6
42

21
Ch 12 - Integral Calculus 5/29/2013

12.8 Double Integrals: Computation (General


Case)
• If f(x,y) is continuous on
A={(x,y) | x in [a,b] and h (x) ≤ y ≤ g (x)} then the double
integral
g is equal
q to the iterated integral
g

b g ( x)
y
g(x) ∫∫ f ( x, y)dA =∫ ∫ f ( x, y)dydx
A a h( x)

A
h(x)
x
a x b 43

12.8 Double Integrals: Computation


(General Case)
• Similarly, if f (x,y) is continuous on
A={(x,y) | y in [c,d] and h (y) ≤ x ≤ g (y)} then the double
g is equal
integral q to the iterated integral
g

d g ( y)

d
y ∫∫ f ( x, y)dA = ∫ ∫ f ( x, y)dxdy
R c h( y )
A
y
h(y) g(y)

c x
44

22
Ch 12 - Integral Calculus 5/29/2013

12.8 Double Integrals: Note


• If f (x, y) = φ (x) ψ(y) then

d b
⎡b ⎤ ⎡d ⎤
∫∫R f ( x , y ) dA = ∫c ∫a ϕ ( x )ψ ( y ) dxdy = ⎢∫
⎣a
ϕ ( x ) dx ⎥ ⎢∫

⎦ ⎣c
ψ ( y ) dy ⎥

• Examples:

∫∫ y sin((x)dA,
R
A = [1 / 2,1] × [π / 2, π ]

( x−μ x )2 ( y −μ y )2
1 − −
∫∫R 2π e 2
e 2
dxdy, R = [−∞, ∞] × [−∞, ∞]
45

12.9 Computational Science vs. Calculus

• Calculus tells you how to compute precise integrals &


d i i when
derivatives h you kknow the h equation
i ((analytical
l i l form)
f ) for
f
a problem; e.g., for indefinite integral:

-t3
∫(-t2 + 10t + 24) dt = + 5 t2 + 24t + C
3
• Computational science provides methods for estimating
integrals and derivatives from actual data.

46

23
Ch 12 - Integral Calculus 5/29/2013

Extra
Introduction to Numerical
Integration

47

Numerical Integration
Idea is to do integral in small parts, like the way we presented
integration: a summation.
N
Numerical
i l methods
h d jjust try to make
k it
i faster
f andd more accurate.

12

10

0 48
3 5 7 9 11 13 15

24
Ch 12 - Integral Calculus 5/29/2013

Basic Numerical Integration


• Idea: Weighted sum of function values to approximate integral
n
f ( x )dx ≈ ∑ c i f ( x i )
b
∫a
i =0

f(x) = c 0 f ( x 0 ) + c 1 f ( x 1 ) + LL + c n f ( x n )

x0 x1 xn-1 xn 49 x

Basic Numerical Integration


• We want to find integration of functions of various forms of the
equation known as the Newton-Cotes integration formulas.
• Newton-Cotes formula
Assume the value of f(x) defined on [a,b] is known at equally spaced
points xi (i=0,1,...,n), where x0 =a, and xn =b. Then,
b n

∫ f(x)dx ≈ ∑ ci f ( xi )
a i =1

where xi =h i + x0, with h (the step size) equal to (xn−x0)/n = (b−a)/n.


The ci's are called weights. The xi's are called nodes. The precision of
the approximation depends on n.
The nodes can be equally spaced or unequally spaced. 50

25
Ch 12 - Integral Calculus 5/29/2013

Numerical Integration
• The weights are derived from the Lagrange basis polynomials
L(x). They depend only on the xi's; not on the function ƒ.
Diff
Different
t methods
th d use different
diff t polynomials
l i l to
t gett the
th ci's.
'
• Newton-Cotes Closed Formulae -- Use both end points
– Trapezoidal Rule : Linear
– Simpson’s 1/3-Rule : Quadratic
– Simpson’s 3/8-Rule : Cubic
– Boole
Boole’ss Rule : Fourth
Fourth-order
order

• Newton-Cotes Open Formulae -- Use only interior points


– midpoint rule
51

Numerical Integration
• Error analysis
The error of the approximation is the difference between the
value of the integral and the numerical result:
error = ε = ∫ f(x) dx - Σi ci f(xi)

The errors are frequently approximated using Taylor series for


f(x). The error analysis gives a strict upper bound on the error,
if the derivatives of f are available.

52

26
Ch 12 - Integral Calculus 5/29/2013

Trapezoid Rule
• Straight-line approximation
The trapezoid rule approximates the region under the graph of
the function f(x) as a trapezoid and calculating its area.
b 1


a
f ( x ) dx ≈ ∑ i=0
ci f ( xi ) = c0 f ( x0 ) + c1 f ( x1 )

h
= [ f ( x 0 ) + f ( x 1 )]
2
f(x)

L(x)

x0 x1 53 x

Trapezoid Rule
• Lagrange interpolation
x − x1 x − x0
L( x) = f ( x0 ) + f ( x1 )
x 0 − x1 x1 − x 0
x−a d
dx
let a = x 0 , b = x1, ξ = , dξ = ; h=b−a
b−a h
⎧x = a ⇒ ξ = 0⎫
⎨ ⎬ ⇒ L (ξ ) = (1 − ξ ) f ( a ) + (ξ ) f ( b )
⎩x = b ⇒ ξ =1⎭

• Integrate to obtain the rule


b b 1
∫a
f ( x ) dx ≈ ∫ L ( x ) dx = h ∫ L (ξ ) dξ
a 0
1 1
= f ( a ) h ∫ (1 − ξ ) dξ + f (b) h ∫ ξ dξ
0 0
1 1
ξ2 ξ2 h
= f ( a ) h (ξ − ) + f (b ) h = [ f ( a ) + f (b ) ] 54
2 0
2 0
2

27
Ch 12 - Integral Calculus 5/29/2013

Trapezoid Rule

• Trapezoidal Rule: Approximation Error


ε = ∫ f(x) dx - Σi ci f(xi) = -(b – a)3/(12) f’’’(η)
(η is a number between a and b). b)

Thus, if the integrand is convex –i.e., positive second


derivative-, the error is negative. That is, the trapezoidal rule
overestimates the true value of the integral.

55

Example: Trapezoid Rule


4
Evaluate the integral ∫0
xe 2 x dx
• Exact solution
4
4 ⎡x 1 ⎤
∫ dx = ⎢ e 2 x − e 2 x ⎥
2x
xe
0
⎣2 4 ⎦0
1
1 2x
= e ( 2 x − 1 ) = 5216 . 926477
4 0

• Graph

56

28
Ch 12 - Integral Calculus 5/29/2013

Example: Trapezoid Rule


4
Evaluate the integral
∫0
xe 2 x dx

• Trapezoidal Rule: Approximation Error


ε = -(b – a)3/(12) f’’’(η) (η is a number between a and b).
Let’s take η =2. Then
ε = -43/12*[2*exp(2*2)+2*exp(2*2)+4*(2)*exp(2*2)] =-3494.282

• Trapezoidal Rule

4−0
[ f ( 0 ) + f ( 4 )] = 2( 0 + 4 e 8 ) = 23847 .66
4
I= ∫
0
xe 2 x dx ≈
2
5216 .926 − 23847 .66
ε = = − 357 .12 %
5216 .926
57

Simpson’s 1/3-Rule (Kepler’s Rule)


• Approximate the function by a parabola
2

∑c
b
∫a
f ( x )dx ≈
i =0
i f ( x i ) = c0 f ( x0 ) + c1 f ( x1 ) + c 2 f ( x 2 )

h
= [ f ( x 0 ) + 4 f ( x 1 ) + f ( x 2 )]
3

L(x)
f(x)

x0 h x1 h x2 58 x

29
Ch 12 - Integral Calculus 5/29/2013

Simpson’s 1/3-Rule
• Lagrange interpolation
( x − x 1 )( x − x 2 ) ( x − x 0 )( x − x 2 )
L( x ) = f ( x0 ) + f ( x1 )
( x 0 − x 1 )( x 0 − x 2 ) ( x 1 − x 0 )( x 1 − x 2 )
( x − x 0 )( x − x 1 )
+ f ( x2 )
( x 2 − x 0 )( x 2 − x 1 )
a+b
let x0 = a , x2 = b, x1 =
2
b−a x − x1 dx
h= ,ξ = , dξ =
2 h h
⎧ x = x 0 ⇒ ξ = −1

⎨ x = x1 ⇒ ξ = 0
⎪x = x ⇒ ξ = 1
⎩ 2

ξ (ξ − 1 ) ξ (ξ + 1 )
L( ξ ) = f ( x0 ) + ( 1 − ξ 2 ) f ( x1 ) + f ( x2 )
2 2 59

Simpson’s 1/3-Rule
• Integrate the Lagrange interpolation
b 1 h 1

a
f(x)dx ≈ h∫ L( ξ )dξ = f(x 0 )
−1 2 ∫− 1
ξ(ξ − 1 )dξ
1 h 1
+ f(x 1 )h∫ ( 1 − ξ 2 )dξ + f(x 2 ) ∫ ξ(ξ + 1 )dξ
0 2 −1
1 1
h ξ3 ξ2 ξ3
= f(x 0 ) ( − ) + f(x 1 )h(ξ − )
2 3 2 −1 3 −1
1
h ξ3 ξ2
+ f(x
f( 2 ) ( + )
2 3 2 −1

h
[ f(x0 ) + 4f(x 1 ) + f(x 2 )]
b

a
f(x)dx =
3 60

30
Ch 12 - Integral Calculus 5/29/2013

Simpson’s 3/8-Rule
• Approximate by a cubic polynomial
b 3

∫ f ( x )dx ≈ ∑ c i f ( x i ) = c 0 f(x 0 ) + c 1 f(x 1 ) + c 2 f(x 2 ) + c 3 f(x 3 )


a
i =0
3h
= [ f ( x 0 ) + 3 f ( x 1 ) + 3 f ( x 2 ) + f ( x 3 )]
8

L(x) f(x)

x0 h x1 h x2 h x3 61 x

Simpson’s 3/8-Rule
• Lagrange interpolation
( x − x 1 )( x − x 2 )( x − x 3 )
L( x ) = f ( x0 )
( x 0 − x 1 )( x 0 − x 2 )( x 0 − x 3 )
( x − x 0 )( x − x 2 )( x − x 3 )
+ f ( x1 )
( x 1 − x 0 )( x 1 − x 2 )( x 1 − x 3 )
( x − x 0 )( x − x 1 )( x − x 3 )
+ f ( x2 )
( x 2 − x 0 )( x 2 − x 1 )( x 2 − x 3 )
( x − x 0 )( x − x 1 )( x − x 2 )
+ f ( x3 )
( x 3 − x 0 )( x 3 − x 1 )( x 3 − x 2 )
• Integrate to obtain the rule

b b b-a
∫ a
f(x)dx ≈ ∫a
L(x)dx ; h=
3
3h
= [ f ( x 0 ) + 3 f ( x 1 ) + 3 f ( x 2 ) + f ( x 3 )] 62
8

31
Ch 12 - Integral Calculus 5/29/2013

Example: Simpson’s Rules


4
Evaluate the integral ∫0
xe 2 x dx
• Simpson’s 1/3-Rule: Approximation Error
ε = -(b – a)5/(2880) f (4)(η) (η is a number between a and b).
Since f (4)(η) >0, the error is negative (overshooting).
Let’s take η=2.5. Then,
ε = -45/(2880) [ exp(2*2.5)*[16*(2.5)+32] =-3799.3769

• Simpson’s 1/3-Rule
h
[ f (0 ) + 4 f (2) + f (4)]
4
I = ∫ 0
xe 2 xdx ≈
3
2
⎡ 0 + 4 ( 2 e 4 ) + 4 e 8 ⎤⎦ = 8 2 4 0 .4 1 1
=
3 ⎣
5 2 1 6 .9 2 6 − 8 2 4 0 .4 1 1
ε = = − 5 7 .9 6 %
5 2 1 6 .9 2 6 63

Example: Simpson’s Rules


4
Evaluate the integral ∫0
xe 2 x dx
• Simpson’s 3/8-Rule
4 3h ⎡ 4 8 ⎤
I= ∫
0
xe 2 x dx ≈
8 ⎢⎣
f (0) + 3 f ( ) + 3 f ( ) + f (4) ⎥
3 3 ⎦
3(4/3)
= [ 0 + 3(19.18922) + 3(552.33933) + 11923.832 ] = 6819.209
8
5216.926 − 6819.209
ε= = − 30.71%
5216.926

• Simpson’s 3/8-Rule: Approximation Error


ε = -(b – a)5/(6480) f (4)(η) (η is a number between a and b).

64

32
Ch 12 - Integral Calculus 5/29/2013

Midpoint Rule
• Newton-Cotes Open Formula
b

a
f ( x )dx ≈ ( b − a ) f ( x m )
a+b ( b − a )3
= (b − a )f ( )+ f ′′( η )
2 24
f(x)

a xm b 65 x

Two-point Newton-Cotes Open Formula


• Approximate by a straight line

b−a
[ f ( x 1 ) + f ( x 2 )] + ( b − a ) f ′′( η )
3
b
∫a
f ( x )dx ≈
2 108

f(x)

x0 h x1 h x2 h x3 66 x

33
Ch 12 - Integral Calculus 5/29/2013

Three-point Newton-Cotes Open Formula


• Approximate by a parabola
b−a
[2 f ( x 1 ) − f ( x 2 ) + 2 f ( x 3 )]
b
∫a
f ( x )dx ≈
3
7 ( b − a )5
+ f ′′′ ′( η )
23040
f(x)

x0 h x1 h x2 h x3 h x467 x

Better Numerical Integration


• Composite integration
– Composite Trapezoidal Rule
– Composite Simpson
Simpson’ss Rule
• Richardson Extrapolation
• Romberg integration

68

34
Ch 12 - Integral Calculus 5/29/2013

Composite Trapezoid Rule


To improve the Trapezoid Rule, first splits the interval of
integration [a,b] into N smaller, uniform subintervals, and then
applies the trapezoidal rule on each of them.
Two segments Three segments
7 7

6 6

5 5

4 4

3 3

2 2

1 1

0 0
3 5 7 9 11 13 15 3 5 7 9 11 13 15

7
Four segments 7
Many segments
6 6

5 5

4 4

3 3

2 2

1 1 69
0 0
3 5 7 9 11 13 15 3 5 7 9 11 13 15

Composite Trapezoid Rule


• Use the Trapezoid Rule in n intervals. Then, add them together.
b x1 x2 xn
∫a
f(x)dx = ∫ x0
f(x)dx + ∫ x1
f(x)dx + L L + ∫ xn−1
f(x)dx
h
= [ f(x 0 ) + f(x 1 )] + h [ f(x 1 ) + f(x 2 )] + L + h [ f(x n − 1 ) + f(x n )]
2 2 2
h
= [ f(x 0 ) + 2 f(x 1 ) + L + 2f(x i ) + L + 2 f ( x n − 1 ) + f ( x n )]
2
f(x)

b−a
h=
n
x0 h x1 h x2 h x3 h x470 x

35
Ch 12 - Integral Calculus 5/29/2013

Composite Trapezoid Rule


4
• Evaluate the integral I = ∫ xe 2 x dx
0

h
n = 1, h = 4 ⇒ I = [ f ( 0 ) + f ( 4 )] = 23847.66 ε = −357.12%
2
h
n = 2 , h = 2 ⇒ I = [ f ( 0 ) + 2 f ( 2 ) + f ( 4 )] = 12142.23 ε = −132.75%
2
h
n = 4 ,h = 1 ⇒ I = [ f ( 0 ) + 2 f ( 1 ) + 2 f ( 2 )
2
+ 2 f ( 3 ) + f ( 4 )] = 7288.79 ε = −39.71%
h
n = 8 , h = 0.5 ⇒ I = [ f ( 0 ) + 2 f ( 0.5 ) + 2 f ( 1 )
2
+ 2 f ( 1.5 ) + 2 f ( 2 ) + 2 f ( 2.5 ) + 2 f ( 3 )
+ 2 f ( 3.5 ) + f ( 4 )] = 5764.76 ε = −10.50%
h
n = 16 , h = 0.25 ⇒ I = [ f ( 0 ) + 2 f ( 0.25 ) + 2 f ( 0.5 ) + L
2
+ 2 f ( 3.5 ) + 2 f ( 3.75 ) + f ( 4 )]
= 5355.95 ε = −2.66% 71

Composite Trapezoid Rule with Unequal


Segments
4
• Evaluate the integral I = xe 2 x dx
0 ∫
Use the following hi‘s: {h1=2, h2=1, h3=0.5, h4=0.5}

2 3 3.5 4
I = ∫ f ( x)dx + ∫ f ( x)dx + ∫ f ( x)dx + ∫ f ( x)dx
0 2 3 3 .5

=
h1
[ f (0) + f (2)] + h2 [ f (2) + f (3)]
2 2
+ 3 [ f (3) + f (3.5)] + 4 [ f (3.5) + f (4)]
h h
2 2
2
2
[ ] [
1
= 0 + 2e 4 + 2e 4 + 3e 6 +
2
]0.5 6
2
[
3e + 3.5e 7 ]
+
0.5
2
[ ]
3.5e 7 + 4e8 = 5971.58 ⇒ ε = −14.45%
72

36
Ch 12 - Integral Calculus 5/29/2013

Composite Simpson’s Rule


• Piecewise Quadratic approximations

b−a
h=
n
f(x)

…...

x0 h x1 h x2 h x3 h x4 xn-2 xn-1 xn73 x

Composite Simpson’s Rule


4
• Evaluate the integral I = ∫ xe 2 x dx
0
• Using n = 2, h = 2
h
I = [ f ( 0 ) + 4 f ( 2 ) + f ( 4 )]
3
2
[ ]
= 0 + 4( 2e 4 ) + 4 e 8 = 8240.411 ⇒ ε = −57.96%
3
• Using n = 4, h = 1

h
I= [ f ( 0 ) + 4 f ( 1 ) + 2 f ( 2 ) + 4 f ( 3 ) + f ( 4 )]
3
1
[
= 0 + 4 ( e 2 ) + 2( 2 e 4 ) + 4 ( 3e 6 ) + 4 e 8
3
]
= 5670.975 ⇒ ε = −8.70%
74

37
Ch 12 - Integral Calculus 5/29/2013

Composite Simpson’s Rule with Unequal


Segments
4
• Evaluate the integral I = ∫ xe 2 x dx
0
Using h1 = 1.5, h2 = 0.5

3 4
I = ∫ f ( x)dx + ∫ f ( x)dx
0 3

=
h1
[ f (0) + 4 f (1.5) + 2 f (3)]
3
+ 2 [ f (3) + 4 f (3.5) + 2 f (4)]
h
3
=
1.5
3
[ ]
0 + 4(1.5e 3 ) + 3e 6 +
0. 5 6
3
[
3e + 4(3.5e 7 ) + 4e8 ]
= 5413.23 ⇒ ε = −3.76% 75

Gaussian Quadratures
• Newton-Cotes Formulae
– use evenly-spaced functional values

• Gaussian Quadratures
– Select functional values at non-uniformly distributed points
to achieve higher accuracy. The values are not
predetermined, but unknowns to be determined.
– Changeg of variables => the interval of integration
g is [-1,1].
[ , ]
– Gauss-Legendre formulae
– Rule is stated as
1 n

∫ f(x)dx ≈ ∑c
i =1
i f ( xi ) 76
−1

38
Ch 12 - Integral Calculus 5/29/2013

Gaussian Quadratures
• The Gauss-Legendre quadrature formula is stated as
1 n
f( )d ≈ ∑ c
∫ f(x)dx i f ( xi )
−1 i =1

the ci's are called the weights, the xi's are called the quadrature
nodes. The approximation error term, ε, is called the truncation
error for integration.

For Gauss
Gauss-Legendre
Legendre quadrature
quadrature, the nodes are chosen to be zeros
of certain Legendre polynomials.

77

Change of Interval for Gaussian Quadrature


• Coordinate transformation from [a,b] to [-1,1]
This can be done by an affine transformation on t and a change
of variables.
b−a b+a
t = x+
2 2
b−a
dt = dx
2
⎧ x = −1 ⇒ t = a

⎩x = 1 ⇒ t = b
a t1 t2 b
b−a b+a b−a b−a n
∑ ci f ( xi )
b 1

a
f (t )dt = ∫ f (
−1 2
x+
2
)(
2
)dx ≈
2 i =1
78

39
Ch 12 - Integral Calculus 5/29/2013

Gaussian Quadrature on [-1, 1]


• Gauss Quadrature General formulation:
n
f ( x )dx ≈ ∑ c i f ( x i ) = c 1 f ( x 1 ) + c 2 f ( x 2 ) + L + c n f ( x n )
1

−1
i =1

1
n = 2: ∫
−1
f(x)dx
= c1f(x1 ) + c 2 f(x 2 )

-1 x1 x2 1
• For n=2, we have four unknowns (c1, c2, x1, x2). These are found
by assuming that the formula gives exact results for integrating a
general 3rd order polynomial. It can also be done by choosing (c791,
c2, x1, x2) such that it yields “exact integral” for f(x) = x0, x1, x2, x3.

Gaussian Quadrature on [-1, 1]


1
Case n = 2 ⇒ ∫ −1
f(x)dx = c1f(x 1 ) + c 2 f(x 2 )

Exact integral for f = x0, x1, x2, x3


– Four
F equations
ti for
f four
f unknowns
k

⎧f 1
= 1 ⇒ ∫ 1dx = 2 = c 1 + c 2 ⎧c 1 = 1
⎪ −1
⎪c = 1
⎪ 1
⎪ 2
⎪f = x ⇒ ∫ xdx = 0 = c 1 x 1 + c 2 x 2 −1
−1 ⎪
⎨ 1 2 ⇒ ⎨ x1 =
⎪f = x 2 ⇒ ∫ x 2 dx = = c 1 x 12 + c 2 x 22 ⎪ 3
⎪ −1 3 ⎪ 1
⎪f 1
= x 3 ⇒ ∫ x 3 dx = 0 = c 1 x 13 + c 2 x 23 ⎪ x2 = 3
⎩ −1

1 1 1
I = ∫ f ( x )dx = f ( − )+ f ( )
−1
3 3 80

40
Ch 12 - Integral Calculus 5/29/2013

Gaussian Quadrature on [-1, 1]


1
Case n = 3 : ∫
−1
f ( x)dx = c1 f ( x1 ) + c2 f ( x2 ) + c3 f ( x3 )

-1 x1 x2 x3 1
• Now, choose (c1, c2, c3, x1, x2, x3) such that the method yields
“exact integral” for f(x) = x0, x1, x2, x3,x4, x5. (Again, (c1, c2, c3,
x1, x2, x3) are calculated by assuming the formula gives exact
expressions for integrating a fifth order polynomial). 81

Gaussian Quadrature on [-1, 1]


1
f = 1 ⇒ ∫ xdx = 2 = c1 + c2 + c3
−1
1
f = x ⇒ ∫ xdx = 0 = c1 x1 + c2 x2 + c3 x3
−1 ⎧c1 = 5 / 9
1 ⎪c = 8 / 9
f = x 2 ⇒ ∫ x 2 dx =
2
= c1 x12 + c2 x22 + c3 x32 ⎪ 2
−1
3 ⎪⎪c3 = 5 / 9
⇒⎨
⎪ x1 = − 3 / 5
1
f = x ⇒ ∫ x 3dx = 0 = c1 x13 + c2 x23 + c3 x33
3

−1
⎪ x2 = 0

⎪⎩ x3 = 3 / 5
1
2
f = x 4 ⇒ ∫ x 4 dx = = c1 x14 + c2 x24 + c3 x34
−1
5
1
f = x 5 ⇒ ∫ x 5 dx = 0 = c1 x15 + c2 x25 + c3 x35
82
−1

41
Ch 12 - Integral Calculus 5/29/2013

Gaussian Quadrature on [-1, 1]


• Approximation formula for n=3

1 5 3 8 5 3
I = ∫ f ( x )dx = f(− )+ f (0 )+ f ( )
−1 9 5 9 9 5

83

Example (1): Gaussian Quadrature


4
Evaluate I = ∫ te 2 t dt = 5216.926477
0

Coordinate transformation
b−a b+a
t= x+ = 2 x + 2 ; dt = 2dx
2 2
4 1 1
I = ∫ 0
te 2 t dt = ∫
−1
( 4 x + 4 )e 4 x + 4 dx = ∫
−1
f ( x )dx

Two-point formula (n=2)


−1
4 4
1 1 4 4− 3 4 4+ 3
I = ∫ f ( x)dx = f ( ) + f ( ) = (4 − )e + (4 + )e
−1
3 3 3 3
= 9.167657324 + 3468.376279 = 3477.543936 (ε = 33.34%)
84

42
Ch 12 - Integral Calculus 5/29/2013

Example (1): Gaussian Quadrature


Three-point formula (n=3)
1 5 8 5
I = ∫ f ( x )dx = f ( − 0.6 ) + f ( 0 ) + f ( 0.6 )
−1 9 9 9
5 8 5
= ( 4 − 4 0.6 )e 4 − 0.6 + ( 4 )e 4 + ( 4 + 4 0.6 )e 4 + 0.6
9 9 9
5 8 5
= ( 2.221191545 ) + ( 218.3926001 ) + ( 8589.142689 )
9 9 9
= 4967.106689 ( ε = 4.79%)

Four-point formula (n=4)

f ( x)dx = 0.34785[ f (−0.861136) + f (0.861136)]


1
I= ∫
−1
+ 0.652145[ f (−0.339981) + f (0.339981)]
= 5197.54375 (ε = 0.37%) 85

Example (2): Gaussian Quadrature


x2
1.64 −

Evaluate 1
I= e 2 dx = .44949742
2π 0

Coordinate transformation
b−a b+a
t= x+ = .82 x + .82 = .82(1 + x); dt = .82dx
2 2
t2 1
1.64 − 1 − [.82 (1+ x )]2 1
∫ ∫ ∫
1 .82 .82
I= e 2 dt = e 2 dx = f ( x)dx
2π 0 2π −1 2π −1 86

43
Ch 12 - Integral Calculus 5/29/2013

Example: Gaussian Quadrature


Two-point formula (n=2)
1 ⎞ .82 ⎜⎛ − 2 [.82(1− 3 )] ⎞
1 1 2 1 1
1 .82 ⎛ − 1 − [.82 (1+ )]2


.82
I= ⎜⎜ f ( ) + f ( ) ⎟⎟ =
f ( x)dx = e + e 2 3
2π −1 2π ⎝ 3 3 ⎠ ⎜
2π ⎜ ⎟⎟
⎝ ⎠
= 0.32713267 * (0.94171147 + 0.43323413) = .44978962 (ε = 0.065%)

Three-point formula (n=3)


1 .82 ⎛ 5 ⎞

.82 8 5
I = f ( x ) dx = ⎜ f ( − 0 .6 ) + f ( 0 ) + f ( 0 .6 ) ⎟
2π −1 2π ⎝ 9 9 9 ⎠
.82 ⎛⎜ 5 − 2 [.82 (1− 0.6 )] ⎞
1 1 1
8 − 2 [.82 (1− 0 )] 5 − 2 [.82 (1+ 0.6 )]
2 2 2

= e + e + e ⎟
2π ⎜⎝ 9 9 9 ⎟

= .32713267 * (0.5461465 9 + 0.63509351 + 0.19271450 )
= 0.44946544 (ε = 0 .007 %) 87

Q: What's the integral of (1/cabin)d(cabin)?


A: A natural log cabin!
88

44

You might also like