# Update velocity or position first in computation?

I am trying to make a simulation of a vibrating string. The string is divided into $n$ points, and each point along the string is acted upon by a force due to the positioning of its neighbors.

I eventually have to update both velocity due to acceleration, and position due to velocity at each point, but the two are dependent on each other.

Is there a physically correct order in which to update position and velocity?

The physically correct order would be at the same time. This can be done via $$x^{n+1} = x^n + v^n\Delta t+\frac12a^n\Delta t^2 \\ v^{n+1} = v^n + \frac12\left(a^n+a^{n+1}\right)\Delta t$$ where $a^n=F\left(x^n\right)$ with $n$ the time-step index.
However, what is done more often is called the Leapfrog scheme in which you update positions and velocities at offset intervals: $$x^{n+1} = x^n + v^{n+\frac12}\Delta t \\ a^{n+1} = F(x^{n+1}) \\ v^{n+\frac32}=v^{n+\frac12} + a^{n+1}\Delta t$$ Here, the fractional $n$ can be thought of the "cell wall" value (e.g., $x_{i+\frac12}=\frac12(x_i+x_{i+1})$) but in time instead of space.