0
$\begingroup$

Knowing that a 1D wave with the physical form parametrized by x and t

$$u = \sin(x-t)$$

will yield us the first time derivative $$\frac{\partial u}{\partial t} =-\cos(x-t)$$

and the second time derivative $$\frac{\partial^2 u}{\partial t^2} = -\sin (x-t)$$

This implies that we can re-create the original wave shape u by producing (through any means) the acceleration in the exactly correct proportion over all x and for each moment t as prescribed by the second derivative, is it right?

I did a simple animation of this, but the result is puzzlingly not the u wave shape above. What am I doing wrong?

enter image description here

The resulting physical wave form is a standing wave that gets higher and higher (seemingly unbounded) amplitude. Why is this so?

The algorithm is:

  • For every frame t, for every t on the graph, calculate the new acceleration a = -sin (x-t).
  • Add this acceleration value (between -1 and 1) to the previous velocity v_new = v_old + a.
  • Finally, add this new v value to the physical wave form u_new = u_old + v.

Thank you.

$\endgroup$

1 Answer 1

0
$\begingroup$

You should change these

Add this acceleration value (between -1 and 1) to the previous velocity v_new = v_old + a.

Finally, add this new v value to the physical wave form u_new = u_old + v.

to

Add this acceleration value (between -1 and 1) to the previous velocity v_new = v_old + a x dt

and

Finally, add this new v value to the physical wave form u_new = u_old + v x dt

As the change in velocity is acceleration multiplied by time, and the change in distance is velocity multiplied by time...the dt is a small change in time. The smaller you make the dt, the more accurate the results will be. It's recommended that you check that each part of the velocity graph is going positive and negative (equally) before going onto the position graph. All the best.

$\endgroup$
7
  • $\begingroup$ @ John thank you! Yes, I have updated the graph per your correction, it looks better now, using dt = 0.00001 (the smallest my processor could manage in reasonable time) the velocity graph looks more proper now. There are still some cumulative errors on the position graph, but less drastic than before. On thing that still bugs me, the velocity graph max amplitude oscillates between 0 and 2. But according to the analytic first derivative it should have constant max amplitude = 1 like the acceleration graph, being just -cos(x-t), what gives? $\endgroup$ Commented Oct 20, 2021 at 20:23
  • 1
    $\begingroup$ @ James It's a similar problem, there is a point one half wavelength from the left on the velocity graph that never goes negative, but probably reaches 2 because its peak to peak distance is 2....not sure yet if it'll be solved with the 'dt' or is something else...5 mins $\endgroup$ Commented Oct 20, 2021 at 20:38
  • 1
    $\begingroup$ @James also it's more usual to make the t positive like this: u=sin(x+t).., v=cos(x+t), a = -sin(x+t), but that might not be it... $\endgroup$ Commented Oct 20, 2021 at 20:41
  • 1
    $\begingroup$ @James Do you have the right initial conditions, i.e. when a=0, v should be maximum or minimum (but not 0), (as in a pendulum), it's hard to tell on the animation as not sure how to stop it... $\endgroup$ Commented Oct 20, 2021 at 20:45
  • 1
    $\begingroup$ @James ...so would recommend if t=0 for initial conditions if $a_0 = -sinx, v_0 = cosx, u_0 = sinx$ or similar, perhaps if you try a few things like that it'll sort itself out $\endgroup$ Commented Oct 20, 2021 at 21:08