CCS
140: Computational Physics and Visualization
ODE (Ordinary
Differential Equation) Solution Techniques
- Trade-off: accuracy and stability vs. computation time and
space (memory)
- Simplest technique: "Euler Method"
- Plug current values (xn
and tn) into DE to
get slope of graph at current time
- Create new point (xn+1 and tn+1) and
repeat process
- Problems with Euler Method:
- Accuracy and stability not good, i.e. need very small time
steps to ensure good results (example)
- Derivative calculations are not "centered" on interval:
Runge-Kutta Method
- "2nd-order Runge-Kutta" or "midpoint" method:
- Evaluates the values of x and t at the midpoint between
two data points (xn+1/2
and tn+1/2).
Then uses this to find xn+1.
- More accurate and stable than Euler method
- This procedure can be embellished to give higher-order
accuracy (think of keeping more and more terms in a Taylor Series)
- The most common technique is "Fourth-order Runge-Kutta" or
"RK4":
Second Derivatives
- When dealing with second derivatives (e.g. F = ma), it is
common practice to re-write the DE as a system of first-order DE's