26.1 Ordinary Differential Equations
A gradient step, a residual block and one step of a diffusion sampler have something in common, as the chapter introduction claimed: each is a short move along an arrow that says how fast a state changes. The next section asks how good such steps are. This one asks what they are steps of. Suppose a velocity is prescribed at every point, as the wind is on a weather map, and a balloon is released into it. Is its path determined? Could two balloons released at the same spot part company? Can we tell where the balloon was an hour ago? And where does it end up?
Newton's laws of 1687 are rules of this kind: they say how the state of a body changes, not where it will be. That such a rule has exactly one solution is not automatic. The theorem that secures it, proved by Picard and Lindelöf in the 1890s, asks that the velocity not change too abruptly from one point to the next, and we shall meet a harmless-looking rule that fails the test.
Models need this theorem. When a network supplies the velocity and the model's output is the place to which the motion carries its input, uniqueness makes the output a function of the input, and running the motion backward inverts that function, which a generative flow needs. For a linear rule we can do more and write the solution down. The eigenvalues of its matrix say whether the motion decays, grows or turns; the memory of a state space model (Section 12.4) and the convergence of a training run are read from them.
We begin with two motions that can be solved by hand, prove the theorem, and then solve linear equations completely. Everything later rests on two results: a velocity rule that changes gently has one trajectory through each point, and the real parts of the eigenvalues of a linear rule decide whether its motion decays. The last two subsections, on a decaying system that grows before it decays and on the pendulum, can be skipped on a first reading.
26.1.1 Vector Fields and Flows#
26.1.1.1 Decay, Rotation, and the Spiral#
The simplest motion is decay. The rule "move toward zero at a speed proportional to the distance" is the equation , where the dot is the derivative in time. Its solution from is
as differentiating shows: . Each unit of time multiplies the distance to the origin by .
Next comes rotation. In the plane, let the velocity be the position turned by a right angle,
that is and . The velocity is perpendicular to the position, because , so the length of never changes:
A point moves on a circle, and since its speed equals its radius it turns at one radian per unit of time: one revolution takes .
Adding half of the decay to the rotation gives the equation that serves as the running example of this section and the next two,
The rotation part does not change the length and the decay part shrinks it: . This is the decay equation again, now for the squared length, so and . A point loses length at rate while it turns at unit speed: it spirals into the origin (Figure 26.1.1). The eigenvalues of are . Their real part, , gives the decay and their imaginary part, , the angular speed. This is no accident: Section 26.1.2 shows that every linear equation of this kind is a sum of decays, growths and rotations, one for each eigenvalue.
An ODE as a velocity field. The faint grid arrows are the field with and eigenvalues . The two coloured curves are trajectories: each follows the local arrow at every instant and spirals into the origin, the one point where the field vanishes (a fixed point).
26.1.1.2 The Initial-Value Problem#
Most rules of motion are not linear, so we need a form that covers them all. The general problem gives a velocity rule and a starting point:
Here is the state. The function is a vector field: it attaches an arrow to every point at every time. A trajectory is a differentiable path whose tangent at each instant is the arrow at its current position.
The vector is the initial value, and (26.1.1) is called an initial-value problem. When does not depend on , the system is autonomous: the arrows stay fixed and only the state moves. Decay, rotation and the spiral are the autonomous fields , and . A weather map is not autonomous, since the wind changes while the balloon flies.
Integrating both sides from to (Section 22.6) gives the equivalent integral form
The solution is the start plus the accumulated velocity. The unknown path appears on both sides, so this is still an equation and not a formula, but the existence proof below works with it.
26.1.1.3 Existence and Uniqueness#
Does an initial-value problem have a solution, and only one? Not always. Consider from . The constant path solves it. So does, for every waiting time ,
since for . A particle at rest may leave at any time. The solutions fan out from the axis, one for each departure time (panel (a) of Figure 26.1.2), and we shall call this picture the fan. A model defined by this field would not assign one output to its input. The cause is the slope of , which is unbounded at : a small displacement produces the much larger velocity .
Two fields that the theorem below does not cover. (a) Solutions of through : the constant solution and a parabolic solution for every departure time . The slope of is unbounded at the origin, so no constant bounds how fast the velocity changes there (the Lipschitz condition of the theorem fails), and the solution is not unique. (b) Solutions of from , and (dots). Here the slope of the field is bounded near every point but not by one constant for all , and each solution, , exists only up to the time (dashed), where it reaches infinity.
For a well-behaved field a solution can be built by iterating the integral form (26.1.2): guess a path, read off the velocities that the field prescribes along it, add them up from the start to obtain a new path, and repeat. This is Picard iteration. For with , start from the constant path and set :
The iterates converge to the solution . Here each iteration adds one Taylor term of ; for other fields the iterates look different, but they still converge, provided the field does not change too abruptly from point to point. The theorem makes "too abruptly" precise.
Theorem (Picard--Lindelöf). Let be continuous in and globally Lipschitz in : there is an with
Then the initial-value problem (26.1.1) has exactly one solution on , for every and every (Coddington and Levinson, 1955).
This is the theorem that allows a model to be defined by a field. The constant bounds how fast the arrows may change from point to point. Decay has , and a linear field has , where the norm of a matrix is, here and in the rest of the section, its spectral norm: the largest factor by which the matrix stretches a vector (Section 21.4.2.2). The fan is what happens when no such exists near . The proof shows that the Picard iterates converge, and that they converge to the only solution.
Proof. A continuous path on solves the problem if and only if it is a fixed point of the Picard operator
In words, is one round of Picard iteration: it reads the velocities along a guessed path and adds them up from the start. (A solution satisfies the integral form; conversely, a continuous fixed point is differentiable by the fundamental theorem of calculus, with the right derivative and the right start.)
The step that is not routine pulls the Lipschitz bound through the integral. For two paths on , write . Then for ,
With , every application of halves the distance between two candidate paths.
Start from the constant path and set . Consecutive iterates then differ by at most , and these differences add up like a geometric series. So the iterates converge in the distance , that is, uniformly on , to a path . We take one fact from analysis on trust here: a uniform limit of continuous paths is continuous. Since , the paths converge to as well as to . Hence : the limit is a solution. Two solutions would satisfy , so they coincide.
Finally restart at from . The step length does not depend on where the solution is, because is the same everywhere, so pieces of this length cover , with one solution on each.
The theorem asks for a Lipschitz bound and for that bound to hold globally, and each requirement rules out a different failure. The fan shows what happens without a Lipschitz bound. Without the global bound, the solution can blow up. The field is smooth, and we can solve it. Since , the quantity grows at unit rate: , and so
which from a start reaches infinity at the finite time (panel (b) of Figure 26.1.2). The last step of the proof shows why the theorem does not cover it. On the interval the field is Lipschitz with , since . The restart length therefore shrinks as the solution grows, and the restarts can add up to a finite time. A field that is Lipschitz only on bounded sets guarantees a solution only for a while.
26.1.1.4 The Flow Map#
A generative model moves a whole cloud of starting points at once, so we now fix the field and vary the start. Let us take the simple case first, a field that does not change in time; the wind returns at the end of the subsection. For an autonomous, globally Lipschitz field, write
for the state at time of the one trajectory started at . This flow map moves all of space forward by along the arrows.
For decay the flow map is . Flowing for and then for gives , and undoes . The same law holds for every autonomous field:
The reason is that the arrows do not change with time: the path starts at and follows the same arrows, so by uniqueness it is the trajectory from that point. The decay example suggests that the law also holds for negative times. It does, because running a field backward is the same theorem applied to a second field.
Corollary (the flow map is a bijection). Let be autonomous and globally Lipschitz. Then exists for every , and each is a bijection of with inverse . If instead depends on time and satisfies the hypotheses of the theorem, then for every the map that carries the state at time to the state at time is a bijection of .
Proof. The field is Lipschitz with the same . A path solves on if and only if solves on , since . The theorem applied to gives a unique solution backward in time for every start, so is defined for all real . The composition law (26.1.3), whose argument did not use the sign of or , then gives .
The reversal did not need the arrows to stand still. For a field that depends on time, play the film backward from time : a path solves on if and only if solves with . This is again continuous in time and Lipschitz with the same , so by the theorem exactly one reversed path leaves each point . Read forward, it is the one trajectory that ends at at time : every end state comes from exactly one start.
A field that changes in time loses the law (26.1.3) in this form only. An hour of wind from noon and an hour from midnight are different maps, so the map depends on the starting time as well as on the duration. Write for the state at time of the trajectory that is at at time . Travelling from to and on from to is travelling from to , by the same uniqueness argument as before:
The three times may come in any order, so inverts . For an autonomous field , and (26.1.4) is the old law. We keep the symbol for a field that depends on time, as short for . The two-time law is not a formality: the few-step samplers of Section 17.8 train a network to imitate itself, and some of them take the law as their training signal: two short jumps of the network must make its long one.
One consequence is that two different trajectories are never at the same point at the same time: run backward from such a meeting, the theorem allows only one path. For a Lipschitz wind this answers the first three questions of the opening. The balloon's path is determined, two balloons released together stay together, and playing the weather map backward shows where they were an hour ago.
An invertible map from noise to data whose inverse can be computed is what a generative flow needs, and the fields of many neural networks qualify. A field built from linear maps and Lipschitz activations, such as , is globally Lipschitz, with at most the product of the weight norms and the activations' constants ( here). The model of Section 26.3, whose field may also depend on time, is therefore well-posed, and by the corollary its map from input to output is a bijection.
26.1.2 Linear ODEs and Stability#
The last question of the opening, where the motion ends up, has a complete answer for one family. Linear fields can be solved in closed form, and they describe most other fields near a point where the field vanishes.
26.1.2.1 The Matrix Exponential#
The scalar equation is solved by . For a linear system
we look for the same form with a matrix in the exponent. For any square matrix , define the matrix exponential by the power series that defines :
The series converges for every matrix. Stretching by one matrix and then by another stretches by at most the product of the two factors, , so , and term by term the series is dominated by the scalar series for , which converges.
Proposition (the matrix exponential solves linear ODEs). is the unique solution of , .
Proof. Differentiate the series (26.1.5) with term by term (legitimate: on any bounded -interval the differentiated series still converges uniformly, by the same domination):
So satisfies the ODE, and at the series collapses to , so . Uniqueness is Picard--Lindelöf: the field is Lipschitz with .
An infinite series of matrix powers is not yet a formula we can read. The eigendecomposition turns it into scalar exponentials. Recall from Section 21.3 that if has independent eigenvectors , , then with and we have .
Powers then telescope, , because each adjacent cancels, and summing the series (26.1.5) gives
The eigenvalue section quoted this formula and left its development to us. It says that the system decouples. Expand the start in the eigenbasis, ; then
Along each eigendirection the system is the scalar equation , evolving independently of the others. Each term is called a mode of the system.
For the spiral we can do better than the general formula. Its matrix is a sum, , and we would like to split the exponential as splits for numbers. For matrices the rule holds when , since then expands by the binomial theorem as it does for numbers. The identity commutes with every matrix, so . Because , the powers of cycle through , and the series for splits into even and odd terms, the series of and :
The flow shrinks by and turns by radians, as we found from the field itself. From at the state is , with length . For this the eigenvectors and eigenvalues are complex, but the product is real.
A word of caution: when the two matrices do not commute, the split fails. For and , which both square to zero, , whereas has in both diagonal entries.
There is a third route to , which needs neither a series nor eigenvectors: the compound-interest limit as . Each factor moves the state along the field for the short time . How fast does the limit arrive? In the eigenbasis the product is , so it is enough to ask one eigenvalue. Since ,
so each tends to and misses it by the fraction of its size. For the spiral at this fraction is for both eigenvalues, and , which predicts an error of about . The cell computes from the eigendecomposition and compares the compounding with it at three values of .
A = np.array([[-0.5, -1.0], [1.0, -0.5]]) # spiral: eigenvalues -0.5 +- i
t, x0 = 2.0, np.array([2.0, 0.0])
lam, V = np.linalg.eig(A) # A = V diag(lam) V^{-1}
expAt = (V @ np.diag(np.exp(lam * t)) @ np.linalg.inv(V)).real
x = expAt @ x0
print('eigenvalues of A:', lam.round(4))
print('x(2) =', x.round(4), f' length {np.linalg.norm(x):.6f}')
for n in [2 ** 10, 2 ** 16, 2 ** 24]: # compounding (I + tA/n)^n
err = np.abs(np.linalg.matrix_power(np.eye(2) + (t / n) * A, n) - expAt).max()
print(f'n = 2^{int(np.log2(n))}: error {err:.1e}, n * error = {n * err:.2f}')
eigenvalues of A: [-0.5+1.j -0.5-1.j]
x(2) = [-0.3062 0.669 ] length 0.735759
n = 2^10: error 8.8e-04, n * error = 0.90
n = 2^16: error 1.4e-05, n * error = 0.90
n = 2^24: error 5.4e-08, n * error = 0.90
The state and its length agree with the values computed by hand. The compounding converges at the predicted rate and no faster: the largest entry of its error, multiplied by , stays at from to . This is compound interest with a matrix interest rate. It defines the exponential well and computes it badly. After nearly seventeen million compounding periods the error is still .
26.1.2.2 Stability from Eigenvalues#
The decoupled form tells us at a glance whether a linear system settles down. Write each eigenvalue as . Its mode has magnitude , since has modulus one. The real part sets growth or decay; the imaginary part sets rotation. For a diagonalizable this gives the following classification.
- If for all , every mode decays, and from every start: the origin is asymptotically stable. The slowest mode sets the decay rate .
- If for some , that mode grows exponentially, and every start with a component along escapes: the origin is unstable.
- In between, a mode with neither grows nor decays. It stands still or circles forever, as the rotation did.
A complex pair is the spiral with general rates: a rotation at angular speed that decays or grows with the sign of . To see this, write the eigenvector of as with real (independent, since ). The real and imaginary parts of are
So maps the plane of and to itself, and in the basis it is the matrix . The computation for the spiral then gives
scaling by composed with rotation by the angle . The same block, iterated in discrete time instead of flowed, appears in Section 21.3.1.6.
In two dimensions this leaves six pictures, and Figure 26.1.3 draws one field of each kind. With real eigenvalues the origin is a stable node (both negative), an unstable node (both positive) or a saddle (one of each sign). With a complex pair it is a stable spiral, an unstable spiral or, when the real part is zero, a center. (A zero eigenvalue is left out: it gives a whole line of points at rest.) The stable spiral is our running example.
Six planar linear systems. Top row, real eigenvalues: a stable node (both negative), an unstable node (both positive) and a saddle (opposite signs), with the eigendirections dashed; trajectories enter or leave along them. Bottom row, a complex pair : a stable spiral (), an unstable spiral () and a center (, closed orbits).
In training we meet the top row most often. Gradient descent in continuous time on a quadratic loss is the linear field , and a symmetric has real eigenvalues, so such a loss produces only nodes and saddles. Rotation needs a field that is not a gradient, such as the two players of the smallest GAN, who circle their equilibrium in a center (Section 16.4).
When has too few eigenvectors to be diagonalized, the modes acquire polynomial factors . They change the verdict only for eigenvalues on the imaginary axis, and Exercise 3 works out the smallest case.
26.1.2.3 Linear Systems with an Input#
So far nothing pushed the system from outside. The state of a state space model that reads a sequence (Section 12.4) obeys a linear equation with an input , which enters the state through a matrix :
The matrix exponential solves this equation as well, and one observation finds the solution. Without the input, the quantity stands still at : it is the state carried back to time along the free motion. With the input it can move only as fast as the input pushes it. Indeed, since , the product rule gives , and the right-hand side no longer contains . Integrating from to and multiplying by yields
This is the variation of constants formula, so called because the constant of the free solution has been allowed to vary in time. The state is the decayed start plus every past input, each decayed for the time since it arrived.
A sequence model receives its input one sample per step, not at every instant. So cut time into steps of length , with grid times and grid states , and suppose that the input is constant during each step, for . This is called a zero-order hold. Apply (26.1.7) to one step, which starts from at time . The constant comes out of the integral, and with what remains is , the same matrix for every step. The grid states therefore obey a linear recurrence, without any approximation:
where the last form needs to be invertible. In one dimension these are and , the coefficients on which the state space models of Section 12.4.1.2 are built (there the step is and the state is ).
The point to remember is that for every step whenever : the exact recurrence is stable whenever the equation is. Compare the factor of one compounding period, which follows the field for a time without looking again. On with the exact factor is , while flips the sign of the state and enlarges it. Stepping along the field in this way is Euler's method, and Section 26.2 shows what the factor does to a training run.
The recurrence is exact only while the input is constant over each step, and a sequence model reads samples of a signal that moves between them. What does the hold cost then? The cell runs the scalar recurrence on from to , with the input held at its value at the start of each step, and compares the result with the closed-form solution. It does so for a slow rate and a fast one , and prints beside the exact factor .
def zoh(lam, h, u, x0=1.0, T=2.0):
"""Exact steps of dx/dt = lam x + u(t), u held at u(t_n) over each step."""
a, b = np.exp(h * lam), np.expm1(h * lam) / lam
x = x0
for n in range(round(T / h)):
x = a * x + b * u(n * h)
return x
def exact_sin(lam, T=2.0):
"""Solution of dx/dt = lam x + sin t with x(0) = 1, at time T."""
c = 1 + lam ** 2
return np.exp(lam * T) * (1 + 1 / c) - (lam * np.sin(T) + np.cos(T)) / c
print(f'{"lam":>5} {"h":>5} {"e^(h lam)":>10} {"1 + h lam":>10}'
f' {"error at T":>11}')
for lam in [-1.0, -50.0]:
for h in [0.5, 0.1, 0.02]:
err = abs(zoh(lam, h, np.sin) - exact_sin(lam))
print(f'{lam:5.0f} {h:5.2f} {np.exp(h * lam):10.3g}'
f' {1 + h * lam:10.2f} {err:11.1e}')
lam h e^(h lam) 1 + h lam error at T
-1 0.50 0.607 0.50 6.8e-02
-1 0.10 0.905 0.90 9.7e-03
-1 0.02 0.98 0.98 1.8e-03
-50 0.50 1.39e-11 -24.00 1.6e-03
-50 0.10 0.00674 -4.00 5.8e-04
-50 0.02 0.368 0.00 9.2e-05
The recurrence itself approximates nothing, so the only error is that of the hold, which pretends that the sine stands still during each step. It shrinks about in proportion to the step: for it is , and at , and . The row to study is with , a step twenty-five times longer than the time in which the state forgets. There the exact factor is and the error is , where the factor would have blown the state up. The models of Section 12.4.1.2 rest on this fact. As long as the rates stay negative, no step size that training might choose makes the recurrence grow.
26.1.2.4 Transient Growth#
One caveat to the verdict by eigenvalues is still owed. When every mode decays, the state goes to zero, but its length need not decrease on the way. A triangular matrix shows it:
with eigenvalues and , both negative. The second row involves only , so . The first row is then , a decay equation with an input, and (26.1.7) gives
The first coordinate starts at and rises until its derivative vanishes, at . There, at , it equals , and , so a state that started with length now has length . From then on decays, in the long run like , the rate of the slower mode (Figure 26.1.4).
The length of the state of the triangular system, started at , on a logarithmic axis. It rises to at before it decays like . Dashed: for , the greatest length that a unit start can have at time under the diagonal matrix with the same eigenvalues. The two curves end with the same slope, which is all that the eigenvalues determine.
The reason is the one of Section 21.4.2.3, which treats the discrete-time case in full: the eigenvectors and span lines only apart, so the short vector is the difference of two long ones. They decay at different rates, and the cancellation stops before both have died away. Eigenvalues give the asymptotic rate of decay, not the size of the transient. This is worth remembering in front of a training curve: a momentum run that converges can grow for its first few steps (Exercise 5).
26.1.2.5 Linearization at Fixed Points#
Few nonlinear fields have a closed-form solution, but near a point where the field vanishes they behave like a linear one. A fixed point of an autonomous field is a state with : a particle placed there never moves. For a continuously differentiable and a small displacement , Taylor's theorem (Section 22.2) gives
Near the fixed point the field is the linear field of its Jacobian , up to a remainder that vanishes faster than the displacement. May we ignore the remainder? In most cases, yes. A fixed point is hyperbolic if no eigenvalue of has zero real part. For a hyperbolic fixed point, the Hartman--Grobman theorem (Hartman, 1960; Grobman, 1959), which we cite without proof, says that near the trajectories of the nonlinear field are those of , up to a continuous change of coordinates. The eigenvalues of the Jacobian then decide local stability by the classification above.
For gradient descent in continuous time, , this is a familiar statement in new words. The fixed points are the critical points of the loss, and the Jacobian is , minus the Hessian. A minimum with positive curvature in every direction is therefore a stable node, and a saddle point of the loss is a saddle of the flow.
The damped pendulum is the one nonlinear field we work out. In units of time that make the ratio of gravity to length equal to one, its angle from the bottom obeys , with damping coefficient . With the angular velocity it becomes a first-order system, written here with its Jacobian:
The fixed points have and : the pendulum hanging at and balanced upright at .
- At the bottom, has characteristic polynomial , with roots for . At they are , a stable spiral. This is the ring-down of a released pendulum: it swings with period about while its amplitude decays like .
- At the top, the polynomial is , whose roots have product , so one is positive and one negative for every . At they are and : a saddle. Only the starts on one curve approach the top. They are the pendulum swung up with just the right speed, which comes to rest balanced like a pencil on its tip.
The same computation, a Jacobian and its eigenvalues, classifies the fixed points of any smooth field, with one exception. When no eigenvalue has positive real part but one lies on the imaginary axis, the linearization does not decide stability. The fields and both have Jacobian at the origin. The first is stable, with ; the second escapes to infinity at .
We could tell the two apart only because we could solve them. Lyapunov's idea, from 1892, decides such cases without a solution: find a quantity that the motion can only decrease. A Lyapunov function for a fixed point is a continuously differentiable function of the state with and at every other point nearby, whose value does not rise along any trajectory:
The middle expression is the chain rule, and it needs the field but no trajectory. A state that starts where is small can never reach a place where is larger, so it stays near : the fixed point is stable. If the inequality is strict away from , the nearby states converge to it. For the two cubic fields take , with derivative . Under this is , and the origin is stable. Under it is : now grows along every trajectory, and the origin is unstable.
We have in fact used the idea already. For the spiral the squared length obeyed . For gradient descent in continuous time the loss, measured from its value at an isolated minimum, is a Lyapunov function near that minimum, since (Exercise 6). And the pendulum has its energy , kinetic plus potential, which is zero at the bottom and changes at the rate
Damping can only remove energy. This holds for swings of any size, far from the bottom, where the Jacobian has nothing to say. The inequality is not strict, since the energy stands still for an instant at each turning point, where . That the damped pendulum nevertheless comes to rest takes one more argument, which we skip. The Jacobian comes with a recipe and a Lyapunov function does not. It has to be guessed, and an energy or a loss is the usual first guess.
So far a formula has done all the work. For a field given by a network there is no formula at all, and a computer can only take steps: read the arrow, move a little, read it again. How far do such steps stray from the trajectory they imitate, and can they fail where the equation does not?
26.1.3 Summary#
An ordinary differential equation prescribes a velocity at every point, and the first question is whether that determines a motion. When the field is globally Lipschitz it does: one trajectory passes through each point, forward and backward, so the flow map is a bijection and a model can be defined by a field. Linear systems are solved by : the real parts of the eigenvalues decide decay, the imaginary parts rotation. An input held constant over each step turns the equation into a recurrence that is exact, and stable at every step size when the equation is stable. Eigenvalues give the rate of decay in the long run, not the size of the transient, and at a hyperbolic fixed point they classify a nonlinear field through its Jacobian. Where the Jacobian does not decide, or the displacement is large, a Lyapunov function does: a quantity such as an energy or a loss that no trajectory can increase. None of this computes a trajectory when no formula exists.
26.1.4 Exercises#
-
One exponent, two failures. Consider for .
- For , find every solution with , and check that gives the fan of Figure 26.1.2. Which hypothesis of the Picard--Lindelöf theorem fails, and at which point?
- For the theorem applies. What is , and what is the solution from ?
- For and , solve the equation as the text solved (differentiate ) and find the time at which the solution reaches infinity. Which hypothesis fails now? Show that the solution from is unique all the same. (Two solutions both stay in for a short time, where the field is Lipschitz with constant ; apply the uniqueness step of the proof on a short interval, then restart.)
- Reverse time in the case . The equation for describes, in suitable units, the level of water in a bucket that drains through a hole in its bottom (Torricelli's law). Show that every solution reaches in finite time and stays there. An empty bucket does not say when it ran dry: which statement of the corollary on the flow map fails?
-
Separation of trajectories. Consider a field of the form , the kind of field that a Neural ODE integrates (Section 26.3).
- Show that is Lipschitz with constant in the spectral norm. Which property of does the proof use? Does the bound change when is replaced by ReLU?
- Let and be two trajectories of an autonomous field with Lipschitz constant . Differentiate and show that
What does the lower bound imply for two trajectories that start at distinct points? What do the two bounds imply for the Lipschitz constants of and of its inverse?
-
A repeated eigenvalue. The matrix with real has a single eigenvalue and only one eigendirection, so (26.1.6) does not apply to it.
- Write and use to show that . Why may the exponential be split here?
- From the first coordinate is . For , find its peak and the time at which it occurs. For which does the factor change the verdict that the sign of alone would give?
- Let the two eigenvalues of the matrix of Section 26.1.2.4 approach each other. For and , compute and its limit as . What happens to the angle between the two eigendirections in this limit, and what does that say about a matrix that cannot be diagonalized?
-
[code] The zero-order hold. Consider the scalar equation with . (The exercise on discretization rules in Section 12.4 compares the hold with three other ways to turn this equation into a recurrence.)
- Specialize (26.1.8) to one dimension to obtain and , and find the limit of as . Show that for a constant input the recurrence and the equation settle at the same value.
- On the samples of a moving input, the recurrence solves the equation driven by a staircase. Argue that the staircase is, on average, the input delayed by , and conclude that to first order in the error at time has size . Evaluate this for , , and . How close is it to the three errors that the cell of Section 26.1.2.3 prints for ?
- Change the cell of that subsection so that it samples the input at the middle of each step, . How does the error for fall with now, and why?
-
[code] Transient growth and nonnormality. ● The text shows one matrix with transient growth. This exercise finds how the growth depends on the angle between the eigenvectors, and meets it again in momentum.
- For and , show that and find the peak of and the time at which it occurs. Find numerically the smallest for which ever exceeds .
- Compute the angle between the two eigenvectors of as a function of , express in the eigenbasis, and explain the growth as the cancellation of two large components.
- Compute for numerically and compare it with the peak of the trajectory from . Why can the first never be smaller than the second?
- Heavy-ball momentum on is the recurrence , which Exercise 6 of Section 26.2 derives from a damped oscillator. It is the linear map with . Show that is not normal, that is, (normal matrices have orthogonal eigenvectors and no transient growth, Section 21.4.2.3). For , compute its eigenvalues at and at , and check that their modulus is in both cases. Run both from rest, . In which run does grow before it decays, for how many steps and to what peak, and what happens to the loss in its first step? What does this say about reading the first iterations of a momentum run as divergence?
-
A gradient flow cannot circle. Let be twice continuously differentiable and bounded below, and consider the gradient flow .
- Show that . Conclude that no trajectory returns to a point it has left, so that a gradient flow has no closed orbit and no center.
- Integrate the identity from to and show that . Which assumptions on the loss did this bound not need?
- The game , in which descends and ascends the value , has the field , : the rotation . Show that this field is not the negative gradient of any function. (Compare with .) What does part (a) then say about the difference between training one loss and training two players against each other?
-
Limits of linearization.
- The field has Jacobian at the origin, like the two cubic fields of the text. Its solution in Section 26.1.1.3 holds for every start . Find the starts from which the state approaches the origin. Is the origin stable, unstable, or stable from one side only? What does the Hartman--Grobman theorem say about the three fields?
- For the damped pendulum, find the damping at which the bottom rest point changes from a spiral to a node. Sketch the portrait near the bottom for , and , and describe how a released pendulum moves in each case.
- The loss is that of the smallest deep linear network, a product of two weights fitted to the target . Write down its gradient flow , find all fixed points, and classify the origin. Show that at every point of the curve the Jacobian has the eigenvalues and . Why can no point of a curve of fixed points be hyperbolic, and what does the negative eigenvalue still tell you?