0% found this document useful (0 votes)
274 views25 pages

Topic 3c Interpolation

done

Uploaded by

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

Topic 3c Interpolation

done

Uploaded by

Farhana Hussin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

Ordinary Differential Equations

• Equations which are composed of an unknown


function and its derivatives are called
differential equations.
• Differential equations play a fundamental role in
engineering because many physical
phenomena are best formulated mathematically
in terms of their rate of change.

dv c v- dependent variable
g v
dt m t- independent variable
1
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
• function that involves:
~ one dependent variable: called an ordinary
differential equation (or ODE).
~ two or more independent variables: called
partial differential equation (or PDE).

• Differential equations are also classified as to their


order.
– A first order equation includes a first derivative as its
highest derivative.
– A second order equation includes a second derivative.

• Higher order equations can be reduced to a


system of first order equations, by redefining a
variable.
2
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Figure PT7.2

3
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Figure PT7.5

Pronounced as :
Roo-nga koot ah
German; C.D.
Runge (1856 -
1927) &
M.W. Kutta
(1867 – 1944)

Chapter 25 4
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Euler’s Method
• The simplest form of RK methods
• To solve ordinary differential equations of the form:
dy
f ( x, y)
dx

5
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
• The first derivative provides a direct estimate of the
slope at xi
f ( xi , yi )
where f(xi,yi) is the differential equation evaluated at
xi and yi. This estimate can be substituted into the
equation:
New value = old value + (slope x step size)

yi 1 yi f ( xi , yi )h Eqn 25.2

• A new value of y is predicted using the slope to


extrapolate linearly over the step size h. 6
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Figure 25.3
7
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
EXAMPLE 25.1: Euler’s Method
Use Euler’s method to numerically integrate
Function must be dy
in the form of a 2 x3 12 x 2 20 x 8.5
derivative dx
From x = 0 to x = 4 with a step size of 0.5. The initial condition at x=0 is y=1.

Solution: yi 1 yi f ( xi , yi )h
x 0, y 1 i.e., y(0) 1 step size, h 0 .5
y(0.5) y(0) f (0,1) 0.5
f (0,1) 2(0)3 12(0) 2 20(0) 8.5 8.5
y(0.5) 1 8.5(0.5) 5.25

3.21875 5.25
t 100% 63.1% 8
3.21875
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
PROBLEM 25.1
Solve the following initial value problem over the interval from t=0 to 2
where y(0)=1. Display all your results on the same graph.
dy
yt 3 1.5 y
Solution: dt
(a) Analytically

dy The result can be plotted as


3
t 1.5dt
y
t4
ln y 1.5t C
4
Substituting the initial conditions yields C = 0.
Taking the exponential gives the final result

t4
1. 5
y e 4
9
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
(b) Euler’s method with h = 0.5 f (0,1) yt 3 1.5 y
t y dy/dt y i+1 f (0,1) (1)(0)3 1.5(1)
0 1 -1.5 0.25 1.5
h = 0.5
0.5 0.25
1.0
1.5 yi 1 yi f (ti , yi )h
2 y (0.5) y (0) f (0,1)0.5
Euler’s method with h = 0.25 y (0.5) 1 ( 1.5)0.5
t y dy/dt y (0.5) 0.25
0 1 -1.5
0.25 0.625
0.5 Can remove the
yi+1 column

10
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Figure 25.4 11
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Improvements of Euler’s method
• A fundamental source of error in Euler’s
method is that the derivative at the
beginning of the interval is assumed to
apply across the entire interval.

• Two simple modifications to circumvent


this shortcoming:
– Heun’s Method
– The Midpoint (or Improved Polygon) Method
Chapter 25 12
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Figure 25.9

h
yi 1/ 2
yi f ( xi , yi )
2
(25.25)

yi 1 yi f ( xi 1/ 2 , yi 1/ 2 )h

(25.27)
Chapter 25 13
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Figure 25.10

Chapter 25 14
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
The Midpoint (or Improved Polygon) Method/
• Uses Euler’s method to predict a value of y at the
midpoint of the interval:

yi 1 yi f ( xi 1/ 2 , yi 1/ 2 )h
Where:
h
yi 1/ 2 yi f ( xi , yi )
2
xi 1/ 2 ( xi xi 1 ) / 2

Chapter 25 15
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Figure 25.12 16
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Figure 25.14

Chapter 25 17
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Fig. 25.16

Chapter 25 18
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
PROBLEM 25.1: Using Midpoint Method
Solve the following initial value problem over the interval
from t=0 to 2 where y(0)=1. Display all your results on the
same graph.
dy
yt 3 1.5 y
Solution: dt
(c) Midpoint method with h = 0.5

t y dy/dt tm ym dy/dt- yi+1


mid
0 1 -1.5 0.25 0.625
0.5
1

19
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Solution: dy
yt 3 1.5 y
(c) Midpoint method with h = 0.5 dt
t y dy/d tm ym dy/dt-mid yi+1
t
0 1 -1.5 0.25 0.625 -0.92773 0.5361
0.5 0.5361
1
1.5
dy / dt f (0,1) yt 3 1.5 y
h
yi 1/ 2 yi f (ti , yi ) dy / dt mid f (ti 1/ 2 , yi 1/ 2 )
2
1 f (0,1) (0.5 / 2) yi 1 yi f (ti 1/ 2 , yi 1/ 2 )h
0.625 y (0.5) y (0) f (0.25,0.625) 0.5
0 0.5 y (0.5) 1 ( 0.92773)(0.5)
ti 1/ 2 0.25
2 y (0.5) 0.5361 20
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
PROBLEM 25.1 dy
yt 3 1.5 y
(c) Midpoint method with h = 0.25 dt
t y dy/dt tm ym dy/dt-mid
0 1 -1.5 0.125
0.25
0.5
0.75

dy / dt f (0,1) yt 3 1.5 y yi 1 yi f (ti 1/ 2 , yi 1/ 2 )h


h y (0.5) y (0) f (0.125,0.625)0.5
yi yi f (ti , yi )
1/ 2
2 y (0.5) 1 ( 0.859375)(0.5)
0 0.25 y (0.5) 0.5703125
ti 1/ 2 0.125
2
dy / dt mid f (ti 1/ 2 , yi 1/ 2 ) 21
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
PROBLEM 25.1
Display all your results on the same graph

Analytically

h=0.25

h=0.5

22
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Exercises:
• Do problems :
25.2 (b), 25.3 (a), 28.28 (use Midpoint
method)

23
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
June 2014 : Qn 3 (a)
• Use modified Euler method to find y at
x=2.25
dy 2 8y
xy
dx 3x
Given : At x = 1.5, y = 0.5

Step size, h= 0.25

24
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Midpoint method with h = 0.25 dy 2 8y
xy
dx 3x
x y dy/dx xm ym dy/dx-mid yi+1
1.5 0.5 -0.514 1.625 0.436 -0.407 0.398
1.75 0.398 1.875
2.0 2.125
2.25

dy / dx f (1.5, 0.5) ..........


h
yi 1/ 2 yi f ( xi , yi )
2 yi yi f ( xi , yi )h
1 1/ 2 1/ 2
1.5 1.75 y (1.75) y (1.5) f (1.625, 0.436) 0.25
xi 1/ 2 1.625
2
dy / dx mid f ( xi 1/ 2 , yi 1/ 2 )
25
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

You might also like