0% found this document useful (0 votes)
5 views26 pages

Numerical Differentiation & Integration Methods

Uploaded by

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

Numerical Differentiation & Integration Methods

Uploaded by

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

Numerical and Computational

Methods
Chapter-5:
Numerical Differentiation and
Integration

Target Group: 2nd year HWRE and WRIE


Ac. Year: 2024/2025
Instructor: Alayu B.
Chapter-5: Numerical Differentiation and
Integration
Introduction
• Differentiation and integration are basic mathematical operations with a
wide range of applications in various fields of science and engineering.
• Simple continuous algebraic or transcendental functions can
be easily differentiated or integrated directly.
• However, at times there are complicated continuous functions which
are tedious to differentiate or integrate directly or in the case of
experimental data, where tabulated values of variables are
given in discrete form, direct methods of calculus are not applicable.
• In this chapter, we learn ways to:
• approximate the derivatives of function, when only data points are given, and
• integrate definite integrals by splitting the area under the curve in specified
ways.
Chapter-5: Numerical Differentiation
• The derivative of a function
represents the rate of change
of a variable with respect to
another variable.
• For example, the velocity of a
body is defined as the rate of
change of the location of the
body with respect to time.
• The location is the dependent
• variable
Similarly, if we measure
while time isthe the
rate of change of velocity with
respect to time,
independent we get the acceleration of the body.
variable.
• Let P and Q be two points on the curve of a function as
shown in Figure above.
• The line through P and Q is called secant line is the line
Chapter-5: Numerical Differentiation
• Consider the secant line drawn
through P and Q
• The slopef (of
m PQ ,secant 
a  hthe
)  f (line
a ) fb/n
(a  h)P fand
(a) Q

is ( a  h )  a h

• As Q moves closer and closer to


P, the limiting portion h 0 is called
the tangent line. f ( a  h)  f ( a )
m PQ , tangent lim
• The slope of h  0the tangent
h line is
the limiting value of the slope as
lim f x  Δx   f x 
f x   This equation is called Forward
Δx  0 Δx
difference approximation formula of
• This can also be written as
Chapter-5: Numerical Differentiation
Finite Difference Approximations for
Derivatives
Forward Central
Difference Backward
Difference
Method Difference Method
Method

h h h h h h
Chapter-5: Numerical Differentiation
Example-1
The velocity of a rocket is
given by
 14 10 4 
 t  2000 ln  4   9.8t ,0 t 30
 14 10  2100t 
is given in
where' ν ' is given in m/s and
(a)Use finite difference approximation methods for the first
seconds.
derivative of to calculate the acceleration at tν=
t  16
sec. Use a step size of h = 2 sec.
(b)Find the absolute relative true error for part (a) if the TV
is 29.674 m/s2
Chapter-5: Numerical Differentiation
Solution-1:  14 10 4 
 t  2000 ln  4   9.8t ,0 t 30
 14 10  2100t 
a) Forward Difference
Approximation 
 18 2000 ln 
14 10 4 
 9.818

 14 10  210018
4

453.02m/s
 14 10 4 
 16  2000 ln    9.816 
 14 10  210016 
4

392.07 m/s

The absolute relative true error is


True Value - Approximate Value
t  x100
True Value
29.674  30.474
 x100 2.6967%
29.674
Chapter-5: Numerical Differentiation
Solution-1:   
 t 2000 ln 
14 10 4 
14 10 4
 2100t   9.8t ,0 t 30
 

b) Backward Difference 
 16 2000 ln 
14 10 4 
  9.816 
14 10 4
 2100 16 
Approximation  
392.07m/s

 14 10 4 
 14  2000 ln    9.814 
 14 10  210014 
4

334.24m/s

The absolute relative true error is


True Value - Approximate Value
t  x100
True Value
29.674  28.915
t  x100 2.5584%
29.674
Chapter-5: Numerical Differentiation
Solution-1:   
 t 2000 ln 
14 10 4 
14 10 4
 2100t   9.8t ,0 t 30
 

c) Central Difference  14 10 4 


 
 18 2000 ln    9.818
 14 10  210018
4
Approximation
453.02m/s
 14 10 4 
 14  2000 ln    9.814 
 14 10  210014 
4

334.24m/s

The absolute relative true error is


True Value - Approximate Value
t  x100
True Value

29.674  29.694
t  100 0.069157%
29.674
Chapter-5: Numerical Differentiation
esults from the three difference approximations are given in Table 1.

Type of a16 m / s 2  t % Remark


Difference
Approximation
30.4752.6967 Backward and forward methods
Forward 28.9152.5584 have relatively the same level of
Backwar 29.6950.0691 accuracy and the central
d 57 difference gives the best of the
1: Summary of a
Central
(16) using different divided difference approximati
two.
Chapter-5: Numerical Differentiation
Example 2 (Home study) b) The slope of the tangent
If a function is given by , then line at (3,36)limis f x  Δx  f x 
f x  
find the slope of the secant line Δx  0 Δx
between points (3,36) and (5,100)
& the slope of the tangent line at
(3,36)
Solution 2:
a)The slope of the secant line b/n
𝑓 ( 𝑎 +h
(3,36) ) − 𝑓 (𝑎)
& (5,100)
𝑚=
( 𝑎+ h ) − 𝑎
Chapter-5: Numerical Differentiation
Reading Assignment =) Higher order derivatives
Chapter-5: Numerical Differentiation
Reading Assignment
-point forward and backward difference formulas for first derivatives

e-point central difference formulas for second derivatives


Chapter-5: Numerical Differentiation
Reading Assignment
Chapter-5: Numerical Integration
• The definition of integration is combining parts so
that they work together or form a whole.
• Mathematically, integration stands for finding the
area under a curve from one point to another.
• It is represented
b
by
f ( x)dx b
a Area f ( x)dx
a

• The integral of a function b/n the


lower limit a and the upper limit b
represents the area od the
function under the curve and b/n a
and b
Chapter-5: Numerical Integration

Integrat Trapezoidal Rule


ion
method
Simpson’s 3/8 Rule
s:
Simpson’s 3/8 Rule
Chapter-5: Numerical Integration

•Integrati
The process of measuring the area under a function
on:
plottedb on a graph.
I f ( x )dx
a

Where:
f(x) is the integrand
a= lower limit of
integration
b= upper limit of
integration
Chapter-5: Numerical Integration
• Trapezoidal Rule states that if one can approximate the
integrand as an nth order polynomial as
b
I f ( x )dx where f ( x )  f n ( x ) and f n ( x ) a0  a1 x  ...  an  1 x n  1  an x n
a

• Then the integral of that function is approximated by the


integral of thatb nth order
b polynomial.
f ( x ) f n ( x )
a a

• Trapezoidal Rule assumes n=1, that is, the area under


the linear polynomial,
b
 f ( a )  f ( b )
f ( x )dx ( b  a ) 2 
a
Chapter-5: Numerical Integration
Derivation of the trapezoidal rule
• The area under the curve is a trapezoid. The integral
b

f ( x)dx 1 Area of
a
trapezoid
 ( Sum of parallel sides )( height )
2
1
  f ( b )  f ( a )( b  a )
2
 f ( a )  f ( b )
( b  a ) 
 2
Chapter-5: Numerical Integration
Increasing the accuracy of integral
b a
estimation … h
n
• To improve the integration result (area),
we apply multiple segment application.
h
• We divide the portion b/n “a” and “b” in
to segments of equal intervals and
apply trapezoidal rule for each.
b a h a 2h a ( n  1 ) h b
f ( x )dx  f ( x )dx  f ( x )dx  ...  f ( x )dx  f ( x )dx
a a a h a ( n  2 ) h a ( n  1 ) h

pplying Trapezoidal rule on each segment gives:


h
𝐼= ( 𝑓 ( 𝑎 )+2∗ ∑ 𝑓 ( 𝑥𝑖 ) + 𝑓 ( 𝑏 ) )
2
Chapter-5: Numerical Integration
Example
• The vertical distance covered by a rocket from
t=8 to t=30 seconds is given by:
30
  140000  
x   2000 ln    9.8t  dt
8  140000  2100t  
a) Use single segment Trapezoidal rule to find the distance
covered.
b) Use two segment Trapezoidal rule to find the distance
covered.
c) Find the relative approximation error for part (a) and (b).
d) Find the true error for (a) and (b) (Home study)
Chapter-5: Numerical Integration
Solution (a)
 f ( a )  f ( b ) a 8 b 30
I ( b  a ) 
 2
 140000 
f ( t ) 2000 ln    9.8t
 140000  2100t 
 140000 
f ( 8 ) 2000 ln    9.8( 8 ) 177.27 m / s
 140000  2100( 8 )
 140000 
f ( 30 ) 2000 ln    9.8( 30 ) 901.67 m / s
 140000  2100( 30 )

 177.27  901.67 
I ( 30  8 ) 
 2
11868 m
Chapter-5: Numerical Integration
Solution (b)
b a n  1  
I f ( a )  2  f ( a  ih )  f ( b )
2n   i 1  

Then:
30  8  2  1  
I f ( 8 )  2  f ( a  ih )  f ( 30 )
2( 2 )   i 1  

22
  f ( 8 )  2 f ( 19 )  f ( 30 )
4 Solution (c)
22
Relative error b/n (a)
 177.27  2( 484.75 )  901.67 and (b)
4
5.34%
11266 m
Chapter-5: Numerical Integration
Chapter-5: Numerical Integration
Chapter-5: Numerical Integration

You might also like