Numerical Analysis: Prof. Dr. Süheyla ÇEHRELİ

You might also like

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

NUMERICAL ANALYSIS

Prof. Dr. Süheyla ÇEHRELİ

12
NUMERİCAL INTEGRATİON
Indefinite Integrals Definite Integrals
2
x 2 1
 x dx  2  c
1
x 1
0 xdx  2 
2
0

Indefinite Integrals of Definite Integrals


a function are are numbers.
functions that differ
from each other by a
constant.
One interpretation of the definite integral is:
Integral = area under the curve

f(x)

b
Area   f(x)dx
a

a b
TRAPEZOID METHOD

f(b)
 f b   f a  
   
b
f(a) I   f a  x  a  dx
a ba 
Trapezoid Rule

𝑓 𝑎 + 𝑓(𝑏)
𝐼 = (𝑏 − 𝑎)
2

a b
I  width  average height
THE MULTIPLE-APPLICATION TRAPEZOIDAL RULE
The accuracy can be improved by
dividing the interval from a to b
into a number of segments and
applying the method to each
segment.
The areas of individual segments
are added to yield the integral for
the entire interval.
ba
h n  # of seg. a  x0 b  xn
n
x1 x2 xn

I  f ( x)dx   f ( x)dx     f ( x)dx


x0 x1 xn1

f ( x0 )  f ( x1 ) f ( x1 )  f ( x 2 ) f ( xn1 )  f ( x n )
I h h  h
2 2 2
ba  n 1

I
2n 
f ( x 0 )  f ( x n )  2 
i 1
f ( x )
i 

SIMPSON’S RULES
More accurate estimate of an integral is obtained if a high-order
polynomial is used to connect the points. These formulas are
called Simpson’s rules.
Simpson’s 1/3 Rule: results when a 2nd order Lagrange
interpolating polynomial is used for f(x)
SIMPSON’S RULES
b b
I   f ( x)dx   f 2 ( x)dx where f 2 ( x ) is a second - order polynomial.
a a

Using a  x0 b  x2

 ( x  x1 )( x  x2 ) ( x  x0 )( x  x2 ) ( x  x0 )( x  x1 ) 
x2

I   f ( x0 )  f ( x1 )  f ( x2 )dx
x0 
( x0  x1 )( x0  x2 ) ( x1  x0 )( x1  x2 ) ( x2  x0 )( x2  x1 ) 

after integration and algebraic manipulation, the following formula results :

ba
I   f ( x0 )  4 f ( x1 )  f ( x2 )
h
h
3 2
𝑥1 = (𝑏 + 𝑎)/2

𝒇 𝒙𝟎 + 𝟒𝒇 𝒙𝟏 + 𝒇(𝒙𝟐 )
𝑰 = (𝒃 − 𝒂) Simpson’s 1/3 Rule
𝟔
THE MULTIPLE-APPLICATION SİMPSON’S 1/3 RULE

 As with Trapezoidal rule, can use multiple


applications of Simpson’s 1/3 rule.
 Need even number of intervals

 An odd number of points are required.


(aralık sayısı çift nokta sayısı tek olacak!!!)
𝑛−1 𝑛 −2
𝑓(𝑥0 ) + 4 𝑖=1,3,5 𝑓 (𝑥𝑖 ) + 2 𝑗 =2,4,6 𝑓 𝑥𝑗 + 𝑓(𝑥𝑛 )
𝐼 = (𝑏 − 𝑎)
3𝑛
SİMPSON’S 3/8 RULE
 Simpson’s 3/8 rule uses a third order polynomial
 need 3 intervals (4 data points)

f ( x)  p3 ( x)  a0  a1 x  a2 x 2  a3 x3

I   f x dx   p3  x dx
x3 x3

x0 x0

ba
I  h f  x0   3 x1   3 f  x2   f  x3 
3
h
3 8

𝒇 𝒙𝟎 +𝟑𝒇 𝒙𝟏 +𝟑𝒇 𝒙𝟐 +𝒇(𝒙𝟑)


I= 𝒃−𝒂
𝟖
 EXP 12-1: The function f(x)=e-x can be used to
generate the following table unequally spread data.
Evaluate the integral from a=0 to b=1,2 using a
combination of the trapezoidal and Simpson’s rules.

x 0 0.1 0.3 0.5 0.7 0.95 1.2


f(x) 1 0.9048 0.7408 0.6065 0.4966 0.3867 0.3012

 EXP 12-2: Determine the distance traveled for the


following data using a combination the trapezoidal and
Simpson’s rules.

t, s 1 2 3.25 4.5 6 7 8 9 9.5 10


v, m/s 5 6 5.5 7 8.5 8 6 7 7 5
 EXP 12-3: The work produced by a constant
temperature, pressure-volume thermodynamic process
can be computed as
W=∫PdV
where W is work, P is pressure, and V is volume. Using a
combination of the trapezoidal rule, and Simpson’s rule,
use the following data to compute the work in kJ.

pressure, kPa 420 368 333 326 326 312 242 207
volume, m3 0.5 2 3 4 6 8 10 11

You might also like