Wanna learn how to make this?
...or this?
...or even this?
This article specifically talks about wave simulations in the 2D eucledean space. Below is the equation for 2D waves:
d2z d2z d2z ___ = c2 ___ + ___ dt2 dx2 dy2
In conventional calculus, there is no number right next to another! Which is why there is this concept called the limit. The limit is a tool used in maths to determine what happens to a function when a variable approaches a value, when it gets closer and closer to that value but never equal.
In discrete calculus, however, the variables of a function get integer values. The value of t in f(t) can only get values like 0, 1, 2, etc. Why even bother with discrete maths?
The computer works in discrete maths!!!
There is no such thing as a "real number" when it comes to computer arithmetic! You cannot store a 0,5 value in a register of a CPU. The float and double datatypes are really just methods of representation of decimal numbers using natural numbers! Discrete values!
Because the smallest value a difference between two neighbouring values for a variable of a function can get is 1. So dt, dx, dy, and dwhatever is equal to 1 everywhere in the discrete version of the equation!!!
Why use the derivative? What does it mean?
When it comes to studying the behaviour of a phenomenon that changes over time, we need to know how the phenomenon changes in one unit of time. Ergo, find the difference between the present and the past value.
Let z(x, y, t) be the height of a point of a 2D plane at position (x, y), at the specific monent of time t. To see how fast the point moves up and down, we need the difference of the height of the point at time t and the height of it at time t+dt. Normalise over dt and you have (f(t+dt)-f(t))/dt or equivalently df/dt.
Now when it comes to waves and oscillations, we do not only care about the velocity, but also the derivative of the velocity, the acceleration. So the derivative of the derivative is d2f/dt2. In fact, the nth derivative of a function is dnf/dtn. For an oscillation to happen, the velocity has to change so the point of the surface at (x,y) has to return back to its original position, and repeatedly, well, oscillate around its original position.
To keep this tutorial short, the full equation emerges directly from Newton's law, where ΣF = m*d2f/dt2, the sum of forces upon an object equals the mass times the acceleration. For a point, the mass approaches zero, so it's a tiny dm. The density of the 2D surface is dm/dxdy. The sum of the forces on the surface is the tension T that keeps the surface "flat" on the edges essentially. You can find the full solution of the equation online, I just wanted to point out that yes, the acceleration of the point of a plane at (x,y) depends on the differences with the height of the neighbouring points in each direction, the second derivatives for x and y! The constant c2, is the speed of the wave, how fast the wave "moves" across the surface, and is equal to T/ρ, ρ being the density of the surface!
In the next page, I'm going to tell you how to translate this equation into a language that the computer can understand and simulate for you!