Chronology Current Month Current Thread Current Date
[Year List] [Month List (current year)] [Date Index] [Thread Index] [Thread Prev] [Thread Next] [Date Prev] [Date Next]

Re: [Phys-L] Mathematica question; stiff differential equation



Hi --

Another couple of thoughts on the recalcitrant differential equation.

Last time I said "make a graph of what you know" at the start of the
exercise. That's always good advice. I also said beware of the
proximity of other solutions. We are about to see that concept return
in a big way.

This time let's plot something that we /didn't/ know at the outset.
That is, we use 20-20 hindsight to work backwards from the solution.
That's sometimes (not often, but sometimes) a good way to solve the
problem, and it is very often a way to /understand/ the problem after
it has been solved. In particular, we can work backwards all the way
to the starting point, and then identify the fewmets that should have
told us the situation was problematic.

Here's what we know:

1) Using 20-20 hindsight, we know the solution is h = ½ g t².

2) At the beginning of the exercise we wrote h' = √(2 g h). The RHS
is clearly a function of h. Everything we told the computer was
expressed as a function of h.

3) We are only interested in solutions for positive t and positive h,
but the computer doesn't know this. It can't read minds. Also, we
must consider the possibility that the calculation of h is not quite
exact. In particular, suppose at the point where h is supposed to be
zero, our best estimate of h comes out slightly negative. Then the
square root becomes imaginary. This is a huge fewmet!

Whenever you see a variable that might go imaginary behind your back,
you should say hmmm, the last ten times this happened I got badly
burned; maybe I should be careful here, or start over and reformulate
the whole problem so this doesn't happen. At the very least, it's
time to haul out some additional machinery, starting with a
root-locus plot, like this:
https://www.av8n.com/physics/img48/dt-dh-root-locus.png

4) You can see that as the points get closer to the origin, points
that are equally spaced in terms of h become disproportionately far
apart in terms of t. In fact dt/dh becomes infinite. This is
already something to worry about.

5) The equation of motion was derived from an energy principle.
That's always asking for trouble. The momentum will tell you the
kinetic energy, but the kinetic energy will not (in general) tell you
the momentum. (Given the *Lagrangian* you can figure out the
momentum, but that's the answer to a different question.)

Given a certain h such as h=1, there are two possible times when that
could occur, namely t=-1 (inbound, shown in red in the diagram) and
t=+1 (outbound, shown in blue in the diagram. This double-valuedness
is a huge worry. This is a /proximity/ issue. The outbound
trajectory is awfully close to the inbound trajectory.

6) The trajectory exists only for h≥0, but the universe as a whole
still exists even for h<0. For example, negative h could arise due
to a miscalculation. There are always uncertainties. We can revisit
item 4, because a tiny amount of negative h creates a huge amount of
imaginary t.

We can also revisit item 5, because the solution for positive t is in
proximity to negative t *and also* to imaginary t, as we now see. So
the "proximity" issue is even worse than you might have imagined when
reading my previous note.

You know and I know that we're not interested in imaginary-time
solutions, but as far as the computer knows, the system could have
arrived at h=0 from below, via imaginary time.

===================

We needed to know the solution to construct the root-locus plot, but
we have now learned from it a bunch of ideas that we can apply to the
original unsolved problem, and in particular to a wide range of other
problems that we may encounter.

a) Phase space is a thing. Phase space is your friend. It does not
get nearly enough emphasis in most classes nowadays. If you know
what's going on in phase space you can figure out the energy, but not
vice versa. Trying to derive the equation of motion from the energy
is asking for trouble. It's better to try to formulate things in
terms of phase space starting from Day One. It's worth taking some
time to reformulate them if necessary. Symplectic integrators are
your friend.

b) Square roots may seem familiar and innocuous, but near the origin
they are asking for trouble, and they are representative of a wider
class of troublesome things. For starters, √h is not differentiable
at h=0. Trying to solve differential equations at places where
things are not differentiable is no fun.

c) If h = t² that does *not* mean that t=√h. The correct solution is
t=±√h. That ± sometimes matters a lot. That may sound like "duh"
... but I have seen physics professors at Big Name universities fool
themselves this way.

d) Near h=0, not only do you need to worry about negative-t solutions
(which may or may not be physically significant), you also need to
worry about imaginary-t solutions (which may or may not be physically
significant). The /equation/ doesn't know what's significant and
what's not. It can't read minds. "Beware the proximity of other
solutions."

When in doubt, draw the root-locus plot. You might discover some
new physics. Sometimes the analytic continuation of your equation
has some hitherto-unappreciated meaning.

Here's a famous example: Suppose d/dt d/dt y = y. Suppose you know
you are looking for a decaying exponential solution. The differential
equation is notoriously impossible to solve numerically, because
there is also an exponentially *increasing* solution, and no amount
of fiddling with the initial conditions will keep that solution from
sneaking in and wiping out your answer.

e) The fact that dh/dt goes to zero may seem innocuous, but the fact
that dt/dh goes to infinity should make your hair catch on fire.
Using good old physics intuition you may think of the situation in
terms of functions of t, but the computer can't read minds. The
equation that the computer sees is a function of h. Yesterday's graph
https://www.av8n.com/physics/img48/dt-dh-integrator.png
as well as the dot-spacing in today's graph
https://www.av8n.com/physics/img48/dt-dh-root-locus.png
should raise the alarm.