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

• From: John Denker <jsd@av8n.com>
• Date: Tue, 8 Dec 2020 17:20:10 -0700

On 12/8/20 10:22 AM, Francois Primeau via Phys-l wrote:

The problem is that Mathematica knows mathematics but not physics.

Yes.

As stated, your problem is ill posed because you start it off at a
point at which the derivative does not exist.

Yes.

Perhaps there is a way in Mathematica to start off your problem at
y=100-epsilon for epsilon>0 and then take the limit as epsilon
approaches zero.
Yes, that's one possibility.

Earlier:

an easy way to avoid the fact that the derivative of the square root
function does not exist at zero is to convert your equation into the
system y’=v and v’=g.
That's even better.

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

FP's answer is correct and concise. Perhaps I can fill in a couple of
details. For starters, let's be clear: Do not confuse the statement:
y'' = -g for all time (which is true)

with the statement:
y'' = -g for all y (which is not true).

Beware: y simply does not exist for y>100.
Similarly: y is not twice differentiable for y>=100.

In more detail:
h = 100 - y # by fiat; new convenient variable
h' = -y' # by differentiating
h' = √(2 g h) for all h>=0 # from conservation
h'' = ½ √(2 g h)¯¹ ⋅ 2 g h' for all h>0 (not including h=0)
= g for all h>0

Mathematica knows mathematics but not physics

Mathematica has no reason to compute h'', and would be unable to compute
it even if it wanted to. So (h,h') = (0,0) is a fixed point.

This is a huge problem, because h'' is important to the physics, and is
presumably deeply built into your intuition. Alas it is not built into
this equation.

This corresponds to Zeno's paradox in reverse. It takes an infinite number
of steps to get away from the fixed point.

Here's another bit of jargon that may help: This is a /stiff/ differential
equation. Pretty much worst-case stiff.
https://en.wikipedia.org/wiki/Stiff_equation

Useful practical rule of thumb: Avoid(*) using differential equations that
bump up against the boundaries of the domain where the variables are defined.

(*) I was going to say "avoid like sin" or "avoid like the plague"
but we need to find better similes. It turns out people aren't very
good at avoiding those things.

convert your equation into the system y’=v and v’=g.

That would be my recommendation.
That is better math-wise as well as physics-wise.

Among other things, that sets you up to use a symplectic integrator, which
will probably outperform anything else rather spectacularly.

https://www.av8n.com/physics/symplectic-integrator.htm