Topic 3c Interpolation
Topic 3c Interpolation
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).
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
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
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.
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
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
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
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