Numerical Solutions for Linear 2nd Order Non-Homogeneous ODEs, Slides of Calculus for Engineers

An overview of ordinary differential equations (odes), focusing on linear, second order, non-homogeneous, constant coefficient equations. It covers analytical solutions for such equations and the use of matlab to determine numerical solutions. The document also discusses the differences between odes and partial differential equations (pdes) and mentions that pdes are covered in more detail in engr45.

Typology: Slides

2012/2013

Uploaded on 03/26/2013

abduu
abduu 🇮🇳

4.4

(49)

195 documents

1 / 29

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Engr/Math/Physics 25
Chp9: ODE’s
Numerical Solns
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d

Partial preview of the text

Download Numerical Solutions for Linear 2nd Order Non-Homogeneous ODEs and more Slides Calculus for Engineers in PDF only on Docsity!

Engr/Math/Physics 25

Chp9: ODE’s

Numerical Solns

Learning Goals

  • List Characteristics of Linear, MultiOrder,

NonHomgeneous Ordinary Differential

Equations (ODEs)

  • Solve ANALYTICALLLY, Linear, 2nd^ Order,

NonHomogeneous, Constant Coefficient

ODEs

  • Use MATLAB to determine Numerical

Solutions to Ordinary Differential Equations

(ODEs)

Numerical ODE Solution

  • Today we’ll do some

MTH

  • We’ll “look under the

hood” of NUMERICAL Solutions to ODE’s

  • The BASIC Game-Plan for even Sophisticated Solvers: - Given a STARTING POINT, y(0) - Use ODE to find dy/dt at t= - ESTIMATE y 1 as

0

1 0

≈ +∆ ⋅ dt t

dy y y t

Numerical Solution - 1

  • Notation (^)  Exact Numerical

Method (impossible to achieve) by Forward Steps t (^) n = n ×∆ t

y (^) n = y ( tn )

f (^) n = f ( tn , yn )

n ≡Step Number

t ≡ TimeStep Length

f ( t , y ) dt

dy

 Now Consider

yn+

t (^) n

yn

t (^) n+

tt

Numerical Solution -

  • However, we can calculate the TANGENT slope at any point FROM the differential equation itself

 The Basic Concept for all numerical methods for solving ODE’s is to use the TANGENT slope, available from the R.H.S. of the ODE, to approximate the chord slope

 Recognize dy/dt as the Tangent Slope

( (^) n , n ) t t

n f t y dt

dy m

n

=

tangent slope= f ( t , y ) (^ n n ) t

n n f t y dt

dy

t

y y

n

(^1) ≈ = , ∆

Euler Method – 1

st

Order

  • Solve 1 st^ Order ODE

with I.C.

 ReArranging

 Use: [Chord Slope]

≈ [Tangent Slope at start of time step]

f ( t , y ) dt

dy

y ( 0 ) = b yn^ + 1 ≈ yn + ∆ tfn

 Then Start the “Forward March” with Initial Conditions

t (^) 0 = 0 y 0 = b

( (^) n n ) t

n n f t y dt

dy

t

y y

n

(^1) ≈ = , ∆

1 n^ or t

n y dt

dy y t n

  • ≈ ∆^ +

Euler Exmpl Calc

n tn yn fn= – yn+1 yn+1= yn+t f (^) n

0 0 0.000 1.000 0.

1 0.1 0.100 0.900 0. 2 0.2 0.190 0.810 0. 3 0.3 0.271 0.729 0. 4 0.4 0.344 0.656 0. 5 0.5 0.410 0.590 0. 6 0.6 0.469 0.531 0. 7 0.7 0.522 0.478 0. 8 0.8 0.570 0.430 0. 9 0.9 0.613 0.387 0.

= − y + 1 ∆ t = 0. 1 dt

dy

Plot

Slope

Euler vs Analytical

0

0 0.25 0.5 0.

1

t

Exact

Numerical

y

t y e

− = 1 −

 The Analytical Solution

Analytical Soln

  • And

= − y + 1 y^ ( t^ = 0 )^ = 0 dt

dy

 Thus Soln u(t) t u Ke

 Sub u = 1−y

 Now use IC

 The Analytical Soln

t C C t t

u

e e e Ke

e u

− + − − = =

=

ln

t y Ke

− 1 − =

1

1 0

0

⇒ =

− =

K

Ke

t y e

− 1 − = 1 ⋅

t y e

− = 1 −

Predictor-Corrector - 1

  • Again Solve 1st^ Order

ODE with I.C.

 Mathematically

 This Time Let:

Chord slopeaverage of tangent slopes at start and END of time step

f ( t , y ) dt

dy

y ( 0 ) = b

BUT , we do NOT know y (^) n+1 and it appears on the RHS ...

+ 1 ≈ 0. 5 [ ( , )+ ( + 1 , + 1 )]

n n n n

n n f t y f t y t

y y

Avg of the Tangent Slopes at (t (^) n,y (^) n) & (t (^) n+1,y (^) n+1)

Predictor-Corrector Example

  • Solve ODE with IC

 The Corrector step

= − y + 1 dt

dy (^) y ( 0 ) = 0

[ ]

yn + 1 = yn + 0. 5 ∆ t fn + fn + 1

 The next Step Eqn for dy/dt = f(t,y)= –y+

  1. 5 [ ( 1 ) ( 1 )]

yn + 1 = yn + ∆ tyn + + − yn + 1 +

 Numerical Results on Next Slide

Predictor-Corrector Example

n

0 0 0.000 1.000 0.100 0.900 0.

1 0.1 0.095 0.905 0.186 0.815 0.

2 0.2 0.181 0.819 0.263 0.737 0.

3 0.3 0.259 0.741 0.333 0.667 0.

4 0.4 0.329 0.671 0.396 0.604 0.

t (^) n y (^) n f (^) n

y (^) n + 1

f (^) n + 1 yn + 1

f = dy dt = − y + 1 [ ]

yn + 1 = yn + 0. 5 ∆ t fn + fn + 1

Slope Slope

ODE Example:

  • Euler Solution with ∆t =
      • The Solution Table

= 3. 9 cos ( 4. 2 y ) − 3. 9 ln( 5. 1 t + 6 ) dt

dy

(^220 1 2 3 4 5 6 7 8 9 )

24

26

28

30

32

34

36

38

t

y(t) by Euler

Euler Solution to dy/dt = 3.9cos(4.2y)-ln(5.1t+6)

n 0 (^) t (^) 0 37.0000 -1.7457 -0.4364 36.5636 y dy/dt dely y (^) n+ 12 0.25 36.56360.5 36.9143 -1.3492 -0.3373 36.5769 1.4027 0.3507 36. 34 0.75 36.57691 36.8872 -1.2264 -0.3066 36.5806 1.2410 0.3103 36. 56 1.25 36.58061.5 36.8418 -0.7108 -0.1777 36.6641 1.0448 0.2612 36. 78 1.75 36.66412 36.9608 -2.5004 -0.6251 36.3357 1.1868 0.2967 36. 109 2.25 36.3357 -2.6357 -0.6589 35.67682.5 35.6768 -1.6265 -0.4066 35. 1112 2.75 35.27013 35.2882 -0.2436 -0.0609 35.2273 0.0722 0.0181 35. 1314 3.25 35.22733.5 35.3380 -1.1420 -0.2855 35.0526 0.4430 0.1107 35. 1516 3.75 35.0526 -0.0139 -0.0035 35.04914 35.0491 -0.1072 -0.0268 35. 1718 4.25 35.0223 -0.5255 -0.1314 34.89094.5 34.8909 -2.6041 -0.6510 34. 1920 4.75 34.2399 -1.1497 -0.2874 33.95245 33.9524 -3.0108 -0.7527 33. 2122 5.25 33.1997 -3.0006 -0.7502 32.44965.5 32.4496 -3.0151 -0.7538 31. 2324 5.75 31.6958 -2.9862 -0.7466 30.94926 30.9492 -3.0384 -0.7596 30. 2526 6.25 30.1897 -2.9328 -0.7332 29.45646.5 29.4564 -3.1419 -0.7855 28. 2728 6.75 28.6710 -2.6916 -0.6729 27.99817 27.9981 -3.5484 -0.8871 27. 2930 7.25 27.1110 -1.7458 -0.4365 26.67457.5 26.6745 -2.8722 -0.7180 25. 3132 7.75 25.9565 -2.4562 -0.6141 25.34248 25.3424 -0.4717 -0.1179 25. 3334 8.25 25.2245 -2.2562 -0.5641 24.66048.5 24.6604 -0.0369 -0.0092 24. 3536 8.75 24.6512 -0.0977 -0.0244 24.62689 24.6268 -0.2699 -0.0675 24. 3738 9.25 24.5593 -1.0481 -0.2620 24.29739.5 24.2973 -3.9863 -0.9966 23. 3940 9.75 23.3007 -0.9318 -0.2329 23.067810 23.0678 -1.0551 -0.2638 22.

Compare Euler vs. ODE

Euler Solution

  • Euler is Much LESS accurate

ODE45 Solution

(^220 1 2 3 4 5 6 7 8 9 )

24

26

28

30

32

34

36

38

t

y(t) by Euler

Euler Solution to dy/dt = 3.9cos(4.2y)-ln(5.1t+6)

34.5 0 1 2 3 4 5 6 7 8 9 10

35

36

37

T by ODE

Y by ODE