In units 1 and 2, we worked towards simulating Apollo 13's flight from the earth, around the moon, and back to earth.
$h$ - step size
$x$ - position
$v$ - velocity
$F$ - net force
$m$ - mass
Euler's method:
Euler's method is the most basic and easy to understand method for simulating a differential equation. At each step in time, we simply increment the state variables linearly along the line tangent to their current values.
$x[i + 1] = x[i] + h \cdot v[i]$
$v[i + 1] = v[i] + h \cdot \frac{F(x[i],v[i])}{m}$
In the limiting case where $h\to0$, Euler's method will capture the dynamics exactly, but this makes the method very computationally intensive. Values of $h>0$ will all lead to a certain amount of error at each step, known as the Local Truncation Error.
Heun's method
Heun's method is an improvement on Euler's method. Rather than increment along the line tangent to the state variables, we use the average of the lines tangent to the state variable at the current point and the tangent to the state variable at the next point had we used Euler's method.
$x_E = x[i] + h \cdot v[i]$
$v_E = v[i] + h \cdot \frac{F(x[i],v[i])}{m}$
$x[i + 1] = x[i] + h \cdot \frac{v[i] + v_E}{2}$
$v[i + 1] = v[i] + h \cdot \frac{F(x[i], v[i]) + F(x_E, v_E)}{2m}$
where $x_E$ and $v_E$ are simply the Euler estimates of the next $x$ and $v$
Adaptive step size
[Needs work]
$h_{new} = h_{old}\sqrt{\frac{tolerance}{LTE}}$
Note that you'll need to track the current time with this method since our time steps will not be evenly spaced.
Simplectic method
[Needs work]
A plot of the state variables is called a phase space plot. The area of the phase space plot is the energy? of the system. The simplectic method preserves the energy of the system. In the simplectic method, we alternate between incrementing state variables.
$x[i + 1] = x[i] + h \cdot v[i]$
$v[i + 1] = v[i] + h \cdot \frac{F(x[i+1], v[i])}{m}$
There are a few alternatives to this:
- $x$ then $v$ then $v$ then $x$ ... etc. This is known as leapfrogging
No comments:
Post a Comment