smj5153.diff.eq.intro.odp

Download Report

Transcript smj5153.diff.eq.intro.odp

Differential Equation
●
Differential Equation – composed of an
unknown function & its derivatives
dv
c
= g− v
dt
m
v=unknown functiondependent variable
t=independent variable
●
●
1 independent variable – ODE (ordinary diff.
eq)
More than 1 independent variable – PDE
(partial differential equation)
Order of Diff. Eqn.
●
Order – highest order of derivative present
dv
c
=g− v 1st order ODE
dt
m
2
d x
dx
m 2 c kx=0 2nd order ODE
dt
dt
st
Reducing higher order to 1 order eqns.
–
–
Define new variable y= dx
dt
dy
getting
m cykx=0
dt
2
dy d x
so = 2
dt dt
Linearity
●
Linear ODE is of form
an  x  y  n⋯a1  x  y ' a0  x y= f  x
y n =nth derivative of y
a  x , f  x= functions of x
●
●
Linear because no products or nonlinear
functions (sin, cos etc.) of the dependent
variable y & its derivatives
Linear ODE can be solved analytically
–
●
Linearize nonlinear ODE to solve analytically
Many diff. Eqn. In engineering cannot be solved
analytically
Homogeneity
n
an  x  y ⋯a1  x y ' a0  x y= f  x 
f  x =0 homogeneous
f  x ≠0 non−homogeneous
Conditions
●
When integrating, an arbitrary constant c is
introduced
–
Infinite number of solutions that can satisfy integral
(solution not unique)
–
Need auxiliary conditions to find unique sol'n (initial
condition, boundary conditions)
Initial Condition
●
Also known as initial value
●
Condition of y specified at x=0
●
For nth order ODE; need n conditions
●
–
If all conditions specified at x=0; initial value
problem (IVP)
–
If conditions specified at various values of x;
boundary value problem (BVP)
IVP; many cases we know initial conditions &
want to know how the system progresses
–
Artillery (ballistics), tsunami, heat transfer, string
wave, etc.
Canonical Form
●
Simultaneous Diff. Eq.
dy 1
= f 1  y 1 , y 2 , y n , x
dx
dy 2
= f 2  y 1 , y 2 , y n , x
dx
⋮
dy n
= f n  y 1 , y 2 , y n , x
dx
●
Diff. Eqn cann be transformed
into canonical
n−1
form an  x d yn a n−1  x d n−1y ⋯a 1  x dy a0  x y= g  x
●
Written as
●
Using
dx
dx
dx
n

2
n−1
d y
dy d y
d y
=F y , , 2, ⋯, n−1
dx
dx dx
dx
y= y 1
transformation
dy dy 1
=
= y2
dx dx
2
d y dy 2
=
= y3
2
dx
dx
⋮
d n−1 y dy n−1
= yn
n−1 =
dx
dx
n
d y dy n
=
n
dx
dx

●
●
Get a set of canonical form
dy 1
= f 1  y 1 , y 2 , y n , x = y 2
dx
dy 2
= f 2  y 1 , y 2 , y n , x= y 3
dx
⋮
dy n−1
= f n−1  y 1 , y 2 , y n , x= y n
dx
dy n
= f n  y 1 , y 2 , , y n , x =F  y 1 , y 2 , , y n , x
dx
d y 
Using vector notation
= f  y , x
dx
y1
f1
y = y 2 , f = f 2
⋮
⋮
yn
fn
[] []
Solution concept
●
Consider single 1st order diff. eq
dy
= f  x , y
dx
●
I.C y  x 0 = y 0
2 solution approaches
–
Integrating function f(x,y) using numerical
integration
–
Finite difference approximation of the derivatives
(our focus)
●
●
●
Euler's methods
Runge-Kutta methods
Multistep methods
Euler's Method
●
Actually a subset of Runge-Kutta
●
Simplest & oldest
●
But error accumulates & solution deviates more
& more (so not commonly used)
●
We are trying to solve
●
Numerical scheme
–
●
dy
= f  x , y
dx
new value=old valueslope×stepsize
y i1= y i  h
=estimated slope of interval h
Done step by step to trace progression of solution
Different methods use different ways to
estimate slope
Euler-Cauchy/Point Slope Method
●
Slope at i used for whole interval h
●
If Diff. Eq is
dy
= f  x , y
dx
= f  x , y
[ y i1= y i f  x i , y i  h ]
Already the
expression of
slope
Euler's Method
●
Can also be derived from Taylor's series
f '  xi , yi  2
f n  x i , y i  n
n1
y i1 = y

f

x
,
y

h

h

h
O
h

i
i
i
2!
n!
●
Reduce error by
–
Reducing stepsize (until roundoff error dominates)
–
Taking more terms in Taylor series (reduce
truncation error)
●
●
Higher order derivatives from chain rule
Gets more complicated very quickly
–
Use other methods (other estimates of slope)
Heun's Method (predictor-corrector)
●
Use average of slopes at both ends of interval
–
Know slope at i
–
Extrapolate linearly to estimate yi+1 (predictor)
–
Use prediction to estimate slope at i+1
–
Get average of slopes
–
Use average of slopes in Euler's equation
(corrector)
Midpoint Method
●
Also known as Improved Polygon Method
●
Use slope at midpoint for whole interval
–
Use Euler's method to predict y at midpoint of
interval
–
Use this value to estimate slope at midpoint
–
Use this slope for whole interval in Euler's method
Runge-Kutta Methods (RK)
●
●
●
●
Taylor series method requires computing
derivatives of f(x,y)
RK methods do not require it, but gives
equivalent accuracy
RK needs only 1 initial point to start (self
starting)
But RK needs to evaluate several f(x,y) for
each step (slower)
RK
●
General form of RK
y i1= y i  x i , y i , hh
 x i , y i , h=increment function≈slope of interval
 x i , yi , h=c1 k 1c 2 k 2c n k n
n=order of RK method
ci =constants
k i =recurrence relations
k 1= f  x i , y i 
k 2 = f  x i  p 2 h , y i a21 hk 1 
k 3= f  x i  p 3 h , y i a31 hk 1a 32 hk 2 
⋮
k n = f  x i  p n h , y i a n1 hk 1a n2 hk 2an , n−1 hk n−1 
RK in Compact Form
n
y i1= y i h ∑ c j k j
j=1

j−1
k j = f xi  p j h , y i ∑ a jl k l
l =1

General Procedure for RK
●
6 steps
–
Select n for desired accuracy
●
Use Taylor expansion using (n+1) terms
–
Express each derivative by f, by chain rule
–
Rewrite Taylor series
–
Rewrite RK using n terms
–
Expand f using Taylor series for 2 variables
–
Equate yi+1 from both approaches & get coefficients
nd
2 Order RK
●
●
From previous steps, we get 3 equations but 4
unknowns
–
No unique solution
–
Assume a value for 1 constant, and get the rest
Different methods specifies different a2
–
Midpoint method; c2=1
–
Heun's method; c2=1/2
–
Ralston's method; c2=2/3
th
4 Order RK
●
Most popular