I am having problems understanding the derivation of acceleration in terms of displacement. The first step is fine:
$$a(x) = \frac{\mathrm dv(x)}{\mathrm dt} = \frac{\mathrm dv(x)}{\mathrm dx} \frac{\mathrm dx(t)}{\mathrm dt} = \frac{\mathrm dv(x)}{\mathrm dx} v(t) \tag{1}$$
However, the second step causes me problems, because the use of $v$ is ambiguous:
$$\frac{\mathrm d}{\mathrm dx}\left(\frac{v^2}{2}\right) = v \frac{\mathrm dv}{\mathrm dx} \implies a(x) = \frac{\mathrm d}{\mathrm dx}\left(\frac{v^2}{2}\right) \tag{2}$$
It is not stated whether they mean $v(t)$ or $v(x)$ and neither of the alternatives makes sense to me:
Alternative 1: $v = v(x)$
$$\frac{\mathrm d}{\mathrm dx}\left(\frac{v(x)^2}{2}\right) = v(x) \frac{\mathrm dv(x)}{\mathrm dx},$$ which is not equal to what we derived in (1).
Alternative 2: $v = v(t)$
$$\frac{\mathrm d}{\mathrm dx}\left(\frac{v(t)^2}{2}\right) = v(t) \frac{\mathrm dv(t)}{\mathrm dx},$$ which is not equal to what we derived in (1) either.
I have a few theories; firstly that my interpretation of what $v$ is in terms of in (1) might be incorrect. Secondly it might be that I apply the chain rule incorrectly somewhere. I would love for someone to clarify what is wrong – or explain what $v$ is in terms of when writing $a(x) = \frac{\mathrm d}{\mathrm dx}\left(\frac{v^2}{2}\right)$.