Docsity

Understanding Integration and Differentiation: Numerical Methods and MATLAB, Slides of Computational Methods

Partial preview of the text

Download Understanding Integration and Differentiation: Numerical Methods and MATLAB and more Slides Computational Methods in PDF only on Docsity!

Chp9: Integration

& Differentiation

Learning Goals

  • Demonstrate Geometrically the Concepts

of Numerical Integ. & Diff.

  • Integrals → Trapezoidal, Simpson’s, and Higher-
order rules
  • Derivative → Finite Difference Methods
  • Use MATLAB to Numerically Evaluate

Math/Data Integrals

  • Use MATLAB to Numerically Evaluate

Math/Data Derivatives

Why Differentiate, Integrate?

  • Integration: Integration is commonplace in Science
and Engineering

Calculation of Geographic Areas

River Channel Cross Section

Wind-Force Loading

Review: Integration

  • Integration: the area
under the curve
described by the
function f ( x ) with
respect to the
independent variable
x , evaluated between
the limits
x = a to x = b.

A

b

a

A f x dx

Integral Properties

  • Indefinite Intregral w/
Variable End-Pts

y^ ( ) x^ = (^) ∫ g ( ) x dx^ = f ( ) x + Const

 Initial/Final Value
Formulations

y ( ) t 0 g ( ) x dx f ( ) t y ( ) 0

t = (^) ∫ = −

y ( ) t g ( ) x dx y ( ) f ( ) t

y t g x dx f t y

t

t

= = ∞ −

= = − −∞

∫

∫ ∞

−∞

 Piecewise Property

a

x

y

c b ∫ ( )^ =^ ∫ ( )^ +∫ ( )

c a

b c

b a f x dx f x dx f x dx

 Linearity → for
Constants p & q

[ ( ) ( )]

∫ ( )^ ∫ ( )

∫

b a

b a

b a

p f x dx q g x dx
p f x q g x dx

Derivative Properties

  • PRODUCT Rule
    • Given

y^ ( ) x^ = f ( ) x^ ⋅ g ( ) x

  • Then • Then
 QUOTIENT Rule
  • Given

( ) ( ) dx

df g x dx

dg f x dx

dy = +

g ( ) x

f x y x =

g^ ( ) x

dx

dg f x dx

df g x

dx

dy 2

−

Why Numerical Methods?

  • Numerical Integration
    • Very often, the function f ( x ) to differentiate, or the integrand to integrate, is TOO COMPLEX to yield exact analytical solutions.
    • In most cases in engineering testing, the function f ( x ) is only available in a TABULATED form with values known only at DISCRETE POINTS

Numerical Integration

  • Game Plan: Divide
Unknown Area into
Strips (or boxes), and
Add Up
 To Improve
Accuracy the TOP of
the Strip can Be
  • Slanted Lines
    • Trapezoidal Rule
  • Parabolas
    • Simpson’s Rule
  • Higher Order PolyNomials

Strip-Count Effect

 Adaptive Integration → INCREASE the strip-
Count in Regions with Large SLOPES
  • More Strips of Constant Width Tends to work just as well

10 Strips 20 Strips

dy/dx by Finite Difference Approx.

y(x)

y(x)

y(x- Δ x)

y(x)

y(x+ Δ x)

 Derivative at Point-x :
x
y
dx
dy
m
  • Forward Difference ( ) ( ) ( )

( ) ( ) x

y x x y x x x x

y x x y x x

y m (^) fwd ∆

+∆ −

+∆ −

+∆ −

∆

∆

  • Backward Difference

x

y x y x x

x x x

y x y x x x

y mbkwd

∆

− −∆

− −∆

− −∆

∆

∆

dy/dx by Discrete-Point Difference

  • From Previous LET

1 1

1 1

− +

− +

n n n

n n n

y y y y y y y y

x x x x x x x x

 The FORWARD Difference Calc

n n

n n

fwd

fwd

x x x x

y y

x

y

dx

dy

n

−

−

∆

∆

= (^1)

1

dy/dx by Discrete-Point Difference

  • The BACKWARD Difference Calc

 The CENTRAL Difference Calc

1 1

1 1

  • −

  • −

= −

−

∆

∆

n n

n n

cent

cent

x x x x

y y

x

y

dx

dy

n

1

1

−

−

= −

−

∆

∆

n n

n n

bkwd

bkwd

x x x x

y y

x

y

dx

dy

n

Discrete Point dy/dx Pt x y Fwd dy/dx Bk dy/dx Cent dy/dx 1 1.216 0.382 0. 2 2.263 1.350 0.2445 0.9248 0. 3 3.032 1.538 0.5390 0.2445 0. 4 4.062 2.093 -1.0275 0.5390 -0. 5 5.122 1.003 0.1208 -1.0275 -0. 6 6.124 1.124 6.8226 0.1208 3. 7 7.100 7.781 6.6722 6.8226 6. 8 8.071 14.260 -0.2581 6.6722 2. 9 9.215 13.964 -11.5670 -0.2581 -5. 10 10.046 4.353 41.9968 -11.5670 19. 11 11.168 51.459 -26.9751 41.9968 8. 12 12.228 22.859 97.8991 -26.9751 26. 13 13.025 100.873 5.0713 97.8991 43. 14 14.135 106.504 -67.7185 5.0713 -30. 15 15.204 34.153 123.3603 -67.7185 14. 16 16.015 134.249 123.

(^00 2 4 6 8 10 12 14 )

20

40

60

80

100

120

140

x

y

Compare Fwd, Bkwd, Cent Diffs

(^00 2 4 6 8 10 12 14 )

20

40

60

80

100

120

140

x

y

Finite Difference Calc

0

1

2

3

4

5

6

2 3 4 5 6 7 8 9 10 11 12 13 14 15

Point

[dy/dy]/average

F/avg B/avg C/avg