Commit f8eb49e4 authored by Erik Strand's avatar Erik Strand

Update notes

parent 00355e04
......@@ -34,9 +34,18 @@ $$
By differentiating both sides of this relation and applying the chain rule, we find that
$$
\frac{\partial}{\partial y_0} y_{n+1} = \frac{\partial}{\partial y_n} g(n \Delta t, y_n) \frac{\partial}{\partial y_0} y_n
\frac{\partial y_{n+1}}{\partial y_0} = \frac{\partial g}{\partial y_n} (n \Delta t, y_n) \frac{\partial y_n}{\partial y_0}
$$
Note that we can take the partial derivative of any component of $$y_n$$ with respect to any
component of $$y_0$$. So the equation above relates Jacobian matrices. The left hand side is the
Jacobian of of $$y_{n + 1}$$ as a function of $$y_0$$. The right hand side is the product of the
Jacobian of $$g$$ as a function of $$y_n$$ with the Jacobian of $$y_n$$ as a function of $$y_0$$.
Note that $$g$$ necessarily involves the gradient of $$y$$ as a function of time (i.e. $$f$$, the
object that normal non-differential simulation integrates forward), so the Jacobian of $$g$$ will
involve second order derivatives of $$y$$ (first evaluated with respect to time, then with respect
to the prior state).
Assuming that we can compute $$\partial g / \partial y$$ on demand, this gives a convenient
recurrence relation for $$\partial y_{n+1} / \partial y_0$$ in terms of $$\partial y_{n} / \partial
y_0$$. So to differentiate through such a simulation, all we need to do is figure out $$\partial g /
......@@ -48,15 +57,26 @@ the values $$y_n$$.
As mentioned above, for Euler integration $$g(x, y) = y + (\Delta x) f(x, y)$$. Thus
$$
\frac{\partial}{\partial y} g(x, y) = 1 + (\Delta x) \frac{\partial}{\partial y} f(x, y)
\frac{\partial g}{\partial y} (x, y) = 1 + (\Delta x) \frac{\partial f}{\partial y} (x, y)
$$
And
$$
\begin{aligned}
\frac{\partial}{\partial y_0} y_{n+1}
&= \frac{\partial}{\partial y_n} g(n \Delta t, y_n) \frac{\partial}{\partial y_0} y_n \\
&= \left( 1 + (\Delta x) \frac{\partial}{\partial y} f(x, y) \right) \frac{\partial}{\partial y_0} y_n \\
\frac{\partial y_{n+1}}{\partial y_0}
&= \frac{\partial g}{\partial y_n} (n \Delta t, y_n) \frac{\partial y_n}{\partial y_0} \\
&= \left( 1 + (\Delta x) \frac{\partial f}{\partial y} (x, y) \right) \frac{\partial y_n}{\partial y_0} \\
\end{aligned}
$$
### N-Body Problem
A simple test case is the n-body problem. Let's take our phase space coordinates to be position and
velocity. Given positions $$x_i$$ and masses $$m_i$$, Newton's law of universal gravitation (along
with Newton's second law of motion) tells us how to compute the acceleration experienced by a
particular particle.
$$
a_i = \sum_{j \neq i} G m_j \frac{x_j - x_i}{|x_j - x_i|^3}
$$
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment