
The unreasonable effectiveness of mathematics - lisper
http://blog.rongarret.info/2015/02/the-unreasonable-effectiveness-of.html
======
fenomas
Over the years I've found that whenever I want to make something look sort-of-
physical, it winds up being quicker and easier to use real physics than to
hack up something that isn't physics-based but looks close enough.

For example, I once made a wave animation just like the one in this post (in
2D but otherwise the same), thusly:

1\. Make an array of height values initialized to zero

2\. Run a tick() function that applies a spring force between neighboring
values, then updates their position/velocity

3\. Perturb the middle value by a large amount

Not exactly real fluid mechanics but convincing enough. Perhaps best of all,
fine-tuning is easy because the model matches your intuition - if you want the
fluid to look more viscous you don't need to guess what to tweak, you just
dampen the velocities, etc.

~~~
stegosaurus
This post gave me a great nostalgia moment and I imagine others have similar
experiences.

I remember trying to code a basic platformer at a young age in BASIC or
something similar. Moving around the character and jumping are the most basic,
essential functions.

I tried to reason it out. Ok, so start off slow, after the character has been
moving for a bit speed him up. For jumping, add some positive velocity and
reverse it after a bit.

It took forever to fine tune and still didn't really work that well. I gave up
in the end. We didn't have the Internet then and I didn't really think about
asking the librarian or similar 'how can i make a character jump about'.

Fast forward a few years and my schoolteacher introduced the concept of
Newtonian mechanics. Acceleration as a rate of change of velocity; the idea of
a ballistic trajectory as a quadratic.

Suddenly the problem becomes trivial! That eureka moment I can probably point
to as the defining thing that made me choose to study higher level physics.

(Part of it was probably being young and not having the reasoning skills I do
now - but I also often think about how access to information is so different
now. What would the ten year old me have done with access to Wikipedia? Mind
boggling.)

~~~
fenomas
You may already know this, but actually even a lot of modern game engines use
nonphysical methods for moving characters - it's hard to make the character
feel responsive using only impulses and friction, etc. I'm working on such an
engine at the moment, and it wound up taking some hacking (e.g. I turn off the
player's friction when a movement key is pressed - which makes sense when you
think about it but seemed nonphysical at first!).

With that said, you've reminded me of an example of this. Years ago I was
making a "UFO catcher" crane game in Flash, where the user moves a thingy left
and right, and an attached crane arm swings freely like a pendulum. At first I
thought: this isn't a damned physics simulation, I'll just hack something up.
Then I spent probably a whole day trying to get it to not feel so wrong. Then
finally I break down and get the formula for pendulum motion off wikipedia,
and 15 minutes later it works perfectly - with maybe three lines of physics
code. :D

------
swatow
I liked the explanation of the physics of why there should be a spike. But I
don't see the relationship to the original equation. It seems to me that it's
just a coincidence that the original equation had a spike.

~~~
tjradcliffe
The explanation is no explanation at all. It is true that water has inertia,
and it is true that water has to go somewhere. It is not true that this is
sufficient to explain why the water goes up.

In particular, the statement "because of inertia and the fact that water is
not compresible, it has to keep moving" is false.

The fact that water is not compressible means that the water moving in one
direction is capable of exerting an extremely large force on the water moving
in the other direction when they run into each other, which would bring the
water to a halt as the hole closes. The interesting question is: why doesn't
this happen?

One possibility is that the free surface at the bottom of the hole travels
upward due to what amounts to a buoyancy force (think of the hole as a bubble
with no top). The water pressure at the bottom of the hole is the same as it
is everywhere at that depth, and so the bottom move upwards, and this pressure
force creates upward momentum that is not met by any opposing force when the
bottom of the hole reaches the water's surface, and therefore creates an
upward-moving column of water.

One way of testing this would be by inserting an empty pipe into the water
against a flat disk of the same diameter, and then rapidly pulling the pipe
out. The flat disk would impede water from moving upward into the hole, which
would--on my account--dramatically reduce the size of the spike.

As to the "unreasonable effectiveness of mathematics", the argument is bogus:
[http://www.tjradcliffe.com/?p=381](http://www.tjradcliffe.com/?p=381) Our
mathematical descriptions of reality almost all admit of extraneous solutions
that have to be discarded based on physical--not mathematical--considerations.
This is what you would expect if mathematics was a human-made tool for
describing reality. It is not at all what you would expect if mathematics was
somehow the pre-existing armature upon which physical reality was constructed.

~~~
marrs

        The fact that water is not compressible means that the water moving in one direction is capable of exerting an extremely large force on the water moving in the other direction when they run into each other, which would bring the water to a halt as the hole closes. The interesting question is: why doesn't this happen?
    

Why would you expect that to happen? The hole in the water is an area of low
pressure that the water is going to rush in to fill. Now that water has a lot
of kinetic energy and momentum. Why would it suddenly lose that momentum? And
how does water's incompressible nature help that? Surely, if anything, this
contributes to the difference in resistance between the water and the air and
help explain the spike that you initially see.

------
Chinjut
It threw me for a bit that x here refers to the distance from the origin,
whether or not that distance is leftwards or rightwards.

Anyway, the function's being described isn't really the way water waves
actually work, is it? Surely, dropping a stone in water does not start out
disturbing every portion of the water immediately like "sin(x)/x", but rather,
the disturbance only emanates out over time from the origin, with at any
moment only so much water disturbed. (Then again, I'm not a physicist, so what
do I know?)

~~~
lisper
> Anyway, the function's being described isn't really the way water waves
> actually work, is it?

That's exactly right. In fact, that is one of the interesting features of
math: you can often get the right answer even when the math is completely
unjustified! This actually happens more than you might think. Quantum
mechanics was essentially discovered this way. Even the classical mechanics
literature is chock-full of wrong math that happens to give the right answer.
See:

[http://mitpress.mit.edu/sites/default/files/titles/content/s...](http://mitpress.mit.edu/sites/default/files/titles/content/sicm/book-
Z-H-5.html#%_chap_Temp_2)

~~~
JadeNB
> In fact, that is one of the interesting features of math: you can often get
> the right answer even when the math is completely unjustified!

As a mild nitpick, I would say that this is a feature of _mathematical
physics_. A mathematician on his or her own would not be satisfied with
getting the 'right' answer by wrong methods—in fact, would have no way to
judge what is 'right' _except_ by appealing to right methods (there being no
outside arbiter who can decide the matter independently, as is the universe
itself in mathematical physics).

------
allthatglitters
Very nicely done! Love the graphics and the video. BTW, what is your pay
grade?

~~~
lisper
Thanks! :-)

