Numerical Integration Formulas - PowerPoint PPT Presentation

About This Presentation
Title:

Numerical Integration Formulas

Description:

Chapter 17 Numerical Integration Formulas Graphical Representation of Integral Use of strips to approximate an integral Numerical Integration Pressure Force on a Dam ... – PowerPoint PPT presentation

Number of Views:373
Avg rating:3.0/5.0
Slides: 61
Provided by: tamu190
Category:

less

Transcript and Presenter's Notes

Title: Numerical Integration Formulas


1
Chapter 17
  • Numerical Integration Formulas

2
(No Transcript)
3
Graphical Representation of Integral
Use of a grid to approximate an integral
Integral area under the curve
4
Use of strips to approximate an integral
5
Numerical Integration
Net force against a skyscraper
Cross-sectional area and volume flowrate in a
river
Survey of land area of an irregular lot
6
Pressure Force on a Dam
Water exerting pressure on the upstream face of a
dam (a) side view showing force increasing
linearly with depth (b) front view showing
width of dam in meters.
p ?gh ?h
7
Integration
  • Weighted sum of functional values at discrete
    points
  • Newton-Cotes closed or open formulae
  • -- evenly spaced points
  • Approximate the function by Lagrange
    interpolation polynomial
  • Integration of a simple interpolation polynomial
  • Guassian Quadratures
  • Richardson extrapolation and Romberg integration

8
Basic Numerical Integration
  • Weighted sum of function values

f(x)
x
x0
x1
xn
xn-1
9
Numerical Integration
  • Idea is to do integral in small parts, like the
    way you first learned integration - a summation
  • Numerical methods just try to make it faster and
    more accurate

10
Numerical integration
Newton-Cotes formulas - based on idea
  • Approximate f(x) by a polynomial

11
  • fn (x) can be linear
  • fn (x) can be quadratic

12
  • fn (x) can also be cubic or other higher-order
    polynomials

13
  • Polynomial can be piecewise over the data

14
Numerical Integration
  • Newton-Cotes Closed Formulae -- Use both end
    points
  • Trapezoidal Rule Linear
  • Simpsons 1/3-Rule Quadratic
  • Simpsons 3/8-Rule Cubic
  • Booles Rule Fourth-order
  • Higher-order methods
  • Newton-Cotes Open Formulae -- Use only interior
    points
  • midpoint rule
  • Higher-order methods

15
Closed and Open Formulae
(a) End points are known (b)
Extrapolation
16
Trapezoidal Rule
  • Straight-line approximation

f(x)
L(x)
x
x0
x1
17
Trapezoidal Rule
  • Lagrange interpolation

18
ExampleTrapezoidal Rule
  • Evaluate the integral
  • Exact solution
  • Trapezoidal Rule

19
Better Numerical Integration
  • Composite integration
  • Multiple applications of Newton-Cotes formulae
  • Composite Trapezoidal Rule
  • Composite Simpsons Rule
  • Richardson Extrapolation
  • Romberg integration

20
Apply trapezoidal rule to multiple segments over
integration limits
Two segments
Three segments
Four segments
Many segments
21
Multiple Applications of Trapezoidal Rule
22
Composite Trapezoidal Rule
f(x)
x
x0
x1
x2
h
h
x3
h
h
x4
23
Trapezoidal Rule
  • Truncation error (single application)
  • Exact if the function is linear ( f ? 0)
  • Use multiple applications to reduce the
    truncation error

Approximate error
24
Composite Trapezoidal Rule
function f example1(x) a 0, b
pi fx.2.sin(2x)
25
Composite Trapezoidal Rule
a0 bpi dx(b-a)/100 xadxb
yexample1(x) Itrap('example1',a,b,1) I
-3.7970e-015 Itrap('example1',a,b,2) I
-1.4239e-015 Itrap('example1',a,b,4) I
-3.8758 Itrap('example1',a,b,8) I
-4.6785 Itrap('example1',a,b,16) I
-4.8712 Itrap('example1',a,b,32) I -4.9189
Itrap('example1',a,b,64) I -4.9308
Itrap('example1',a,b,128) I -4.9338
Itrap('example1',a,b,256) I -4.9346
Itrap('example1',a,b,512) I -4.9347
Itrap('example1',a,b,1024) I -4.9348
Qquad8('example1',a,b) Q -4.9348
MATLAB function
26
n 2 I -1.4239 e-15 Exact -4. 9348
27
n 4 I -3.8758 Exact -4. 9348
28
n 8 I -4.6785 Exact -4. 9348
29
n 16 I -4.8712 Exact -4. 9348
30
Composite Trapezoidal Rule
  • Evaluate the integral

31
Composite Trapezoidal Rule
x00.044 yexample2(x) x1044
y1example2(x1) x2024 y2example2(x2)
x3014 y3example2(x3) x400.54
y4example2(x4) Hplot(x,y,x1,y1,'g-',x2,y2,'r
-s',x3,y3,'c-o',x4,y4,'m-d')
set(H,'LineWidth',3,'MarkerSize',12)
xlabel('x') ylabel('y') title('f(x) x
exp(2x)') Itrap('example2',0,4,1) I
2.3848e004 Itrap('example2',0,4,2) I
1.2142e004 Itrap('example2',0,4,4) I
7.2888e003 Itrap('example2',0,4,8) I
5.7648e003 Itrap('example2',0,4,16) I
5.3559e003
32
Composite Trapezoidal Rule
33
Simpsons 1/3-Rule
  • Approximate the function by a parabola

L(x)
f(x)
x
x0
x1
x2
h
h
34
Simpsons 1/3-Rule
35
Simpsons 1/3-Rule
36
Composite Simpsons Rule
Piecewise Quadratic approximations
f(x)
...
x
x0
x2
x4
h
h
xn-2
h
xn
h
x3
x1
xn-1
37
Composite Simpsons 1/3 Rule
  • Applicable only if the number of segments is even

38
Composite Simpsons 1/3 Rule
  • Applicable only if the number of segments is even
  • Substitute Simpsons 1/3 rule for each integral
  • For uniform spacing (equal segments)

39
Simpsons 1/3 Rule
  • Truncation error (single application)
  • Exact up to cubic polynomial ( f (4) 0)
  • Approximate error for (n/2) multiple applications

40
Composite Simpsons 1/3 Rule
  • Evaluate the integral
  • n 2, h 2
  • n 4, h 1

41
Simpsons 3/8-Rule
  • Approximate by a cubic polynomial

f(x)
L(x)
x
x0
x1
x2
h
h
x3
h
42
Simpsons 3/8-Rule
  • Truncation error

43
Example Simpsons Rules
  • Evaluate the integral
  • Simpsons 1/3-Rule
  • Simpsons 3/8-Rule

44
Composite Simpsons 1/3 Rule
function I Simp(f, a, b, n) integral of f
using composite Simpson rule n must be even h
(b - a)/n S feval(f,a) for i 1 2 n-1
x(i) a hi S S 4feval(f,
x(i)) end for i 2 2 n-2 x(i) a
hi S S 2feval(f, x(i)) end S S
feval(f, b) I hS/3
45
Simpsons 1/3 Rule
46
Composite Simpsons 1/3 Rule
47
x00.044 yexample(x) x1024
y1example(x1) cLagrange_coef(x1,y1)
p1Lagrange_eval(x,x1,c) Hplot(x,y,x1,y1,'r',
x,p1,'r') xlabel('x') ylabel('y')
title('f(x) xexp(2x)') set(H,'LineWidth',3,'
MarkerSize',12) x2014 y2example(x2)
cLagrange_coef(x2,y2) p2Lagrange_eval(x,x2,c)
Hplot(x,y,x2,y2,'r',x,p2,'r') xlabel('x')
ylabel('y') title('f(x) xexp(2x)')
set(H,'LineWidth',3,'MarkerSize',12)
ISimp('example',0,4,2) I 8.2404e003
ISimp('example',0,4,4) I 5.6710e003
ISimp('example',0,4,8) I 5.2568e003
ISimp('example',0,4,16) I 5.2197e003
QQuad8('example',0,4) Q 5.2169e003
n 2 n 4 n 8 n 16
MATLAB fun
48
Multiple applications of Simpsons rule with odd
number of intervals
Hybrid Simpsons 1/3 3/8 rules
49
Newton-Cotes Closed Integration Formulae
50
Composite Trapezoidal Rule with Unequal Segments
  • Evaluate the integral
  • h1 2, h2 1, h3 0.5, h4 0.5

51
Trapezoidal Rule for Unequally Spaced Data
52
MATLAB Function trapz
  • Z trapz(x,y)

x0 1 1.5 2.0 2.5 3.0 3.3 3.6 3.8 3.9 4.0 x
Columns 1 through 7 0 1.0000
1.5000 2.0000 2.5000 3.0000 3.3000
Columns 8 through 11 3.6000 3.8000
3.9000 4.0000 yx.exp(2.x) y 1.0e004
Columns 1 through 7 0 0.0007
0.0030 0.0109 0.0371 0.1210 0.2426
Columns 8 through 11 0.4822 0.7593
0.9518 1.1924 integr trapz(x,y) integr
5.3651e003
53
Integral of Unevenly-Spaced Data
  • Trapezoidal rule
  • Could also be evaluated with Simpsons rule for
    higher accuracy

54
Composite Simpsons Rule with Unequal Segments
  • Evaluate the integral
  • h1 1.5, h2 0.5

55
Newton-Cotes Open FormulaMidpoint Rule
(One-point)
f(x)
x
a
b
xm
56
Two-point Newton-Cotes Open Formula
  • Approximate by a straight line

f(x)
x
x0
x1
x2
h
h
x3
h
57
Three-point Newton-Cotes Open Formula
  • Approximate by a parabola

f(x)
x
x0
x1
x2
h
h
x3
h
h
x4
58
Newton-Cotes Open Integration Formulae
59
Double Integral
  • Area under the function surface

60
Double Integral
  • T(x, y) 2xy 2x x2 2y2 40
  • Two-segment trapezoidal rule
  • Exact if using single-segment Simpsons 1/3 rule
    (because the function is quadratic in x and y)
Write a Comment
User Comments (0)
About PowerShow.com