Escolar Documentos
Profissional Documentos
Cultura Documentos
d~ x ( t) ~ v ( t) = dt
d2 ~ x ( t) ~ ( t) m = F dt2
CLASSIFICATIONS of ODEs
First order Single equation Linear Homogenous Initial Value Problem (IVP)
High Order Systems of equations Non-linear Inhomogenous Boundary Value Problem (BVP)
~ d2 ~ x F = dt m
d~ x =~ u dt ~ d~ u F = dt m
Almost all equations of higher order can be reduced to first order equations
j = 2, . . . , n 1
= yj +1 ,
= f (x, y, y1 , . . . , yn )
j = 1, 2, . . . , n 1
Numerical Differentiation
How to estimate derivatives in the computer? Estimate derivatives of a function using a finite set of points. Assume that the data are the exact values of a smooth function at the data points and
further, that the derivatives are needed only at the data points.
There are 3 ways to do this: 1. INTERPOLATE: Then differentiate the interpolant 2.TAYLOR SERIES: more effort but have error estimates 3.INTEGRATE the ODEs using numerical quadrature
1. INTERPOLATION
INTERPOLATION
Use Lagrange interpolation: (1st order) (linear interpolation)
f ( x) xi x x x i 1 f ( x i 1 ) + f (xi ) on xi1 x xi x i x i 1 x i x i 1
INTERPOLATION (Cont.)
Higher order formulas can be obtained by using the quadratic Lagrange polynomial
(x xi )(x xi+1 ) x xi1 )(x xi+1 ) (x xi1 )(x xi ) f ( x) = f i 1 + fi + fi+1 (xi1 xi )(xi1 xi+1 ) (xi xi1 )(xi xi+1 ) (xi+1 xi1 )(xi+1 xi )
Differentiating this expression and evaluating at the central point of this interval x_i, we get for h_i = h_{i-1} = h
fi+1 fi1 1 f ( xi ) = (D+ D )f (central dierences) 2h 2 3fi1 + 4fi fi+1 0 f ( x i 1 ) 2h fi1 3fi 3fi+1 0 f (xi+1 ) 2h
0
We can also differentiate {LagrangePolynomial} to get a second order derivative
2. TAYLOR SERIES
2 h 0 00 f ( x h ) = f ( x ) hf ( x ) + f ( x) . . . Start from 2
and form linear combinations of the function at various mesh points
x, x h, x 2h
EXAMPLE: construct an approximation for the rst derivative of the function at x using values at f(x-h), f(x), f(x+h).
af (x h) + bf (x) + cf (x + h)=(a + b + c)f (x) + (c a)hf 0 (x)+ 1 2 00 1 3 000 (c + a) h f (x) + (c a) h f (x) + h.o.t. 2 6
Solve to get:
Since we wish to approximate $f'(x)$ we wish that coefcients of f' are 1 and as many of the others are equal to 0
c = a =
1 and b = 0 2h
SUBSTITUTE
Higher Accuracy can be obtained with More points. That can be more expensive and may be problematic with boundary conditions
Friday, March 15, 13
f (x0 , y ) dx0
y (xn+1 ) = y (xn ) +
xn+1 xn
f (x0 , y ) dx0
Z Z Z Z
f (x, y ) dx hf (xn , yn ) yn+1 = yn + hf (xn , yn ) (Explicit Euler) f (x, y ) dx hf (xn+1 , yn+1 ) yn+1 = yn + hf (xn+1 , yn+1 ) (Implicit Euler) f (x, y ) dx hf (xn+ 1 , yn+ 1 ) yn+1 = yn1 + 2hf (xn , yn ) (Leap-frog) 2 2 f (x, y ) dx h h [f (xn , yn ) + f (xn+1 , yn+1 )] yn+1 = yn + [f (xn , yn ) + f (xn+1 , yn+1 )] 2 2
STABILITY OF ODEs
Use of a model equation to study the stability behavior of various numerical schemes
dx = x dt
Note that this model can be related to any generic right hand side as:
dx = f (x, t) x + (0 + 1 t) dt
Stability is determined by the term Return to Model Equation the solution is:
x ( t) = x 0 e
Note that :
1 2 = 1 + h + ( h) + . . . 2
Euler's method reproduces the rst two terms so it is rst order accurate
What if
= k + i
then e
=e
kh
(cos h + i sin h)
BREAK
N-body Problems
Particles moving according to Newtons Laws of Motion:
One Particle:
d~ x dt d~ u m dt
= ~ u = ~ F
d~ xi dt d~ ui m dt
= ~ ui , = ~i , F
i = 1, . . . , N i = 1, . . . , N
~i = F ~i (m1 , . . . , mN , ~ F x1 , . . . , ~ xN )
Friday, March 15, 13
QUESTIONS
What properties of the continuous system must be preserved in the discrete ? How accurate ? How to design schemes that respect physical principles regardless of classical accuracy requirements ?
In general
CONSISTENCY
The approximate scheme is consistent with the systems it approximates EXAMPLE
Euler scheme is consistent with
Why ?
Taylor series expansion:
ACCURACY
Time symmetry
A desired property for particle integrators is that they reflect
time symmetry.
Example:
The leapfrog scheme is time centered, since is centered around is centered around
Consider:
Conservative Systems
~i = ~ If F x1 , . . . , ~ xN ) xi V (~ ~i is a conservative force F
Conservative System: A system with an energy function that is constant along a trajectory (in the phase space (~ x, ~ u)) Examples: (1) Gravitation (2) Molecular Dynamics (3) Wave Equation
Friday, March 15, 13
d~ x ~ u= and dt
d~ u M = V dt
- Use different approximations (time integrators) for different components of the solution - Useful when there is a dichotomy between velocities and positions
Examples: (1) Partitioned Runge Kutta Methods (2) Asymmetric Euler A (3) Asymmetric Euler B (4) Strmer-Verlet Methods and Alternatives
Friday, March 15, 13
This is equivalent to central differences of the 2nd derivative We need the velocities to compute the kinetic energy:
u(t) = (r(t+dt) - r(t-dt))/2dt + O (dt^2)
It is guaranteed to conserve linear momentum and energy. Also note that in r(t+dt) and r(t-dt) a small term dt2a(t) is
added to a difference of large terms O(dt) in order to introduce the trajectory.
Modification I:
u(t+dt/2) = u(t-dt/2) + dt*a(t) r(t+dt) = r(t) + dt u(t+dt/2) Store r(t), a(t), u(t-dt/2) u(t) = ! [u(t+dt/2) + u(t-dt/2)]
The Energy at time t can be calculated This scheme is algebraically equivalent to Verlet, the
velocities appear explicitly but not at time (t)
This is again algebraically equivalent to Verlet. In practice, compute new positions and velocity
r(t+dt) = r(t) + dt*u(t) + dt2a(t)/2 u(t+dt/2) = u(t) + dt*a(t)/2
~ xk+1 = ~ xk + t ~ x =~ xk + t
i
s X i=1
j ~ ij f (~ x ) i = 1, . . . s
Strmer-Verlet Method
t = M~ un V (~ xn ) 2 t V (~ xn+1 ) 2
u n+ 1 Step 1: M ~ 2
Alternative 1: solve the velocity at half steps only Alternative 2: eliminate the velocity
Particle Models
Physical System Model Simulation
(Difference Equations)
(Differential Equations)
Particle Methods (N body problem) Solve using time integrators ODEs = DEs (accuracy and stability)