Context
I am solving an equation of motion derived from a Lagrangian that has a discontinuous step in its potential at the origin. In other words $$V(x) = \left(V_2-V_1\right)H(x) + V_1.$$ Based on this context, my question regards how to solve an initial-value problem to obtain $\dot{x}$. Bare in mind that I can solve this problem using conservation of energy, but that won't teach me anything new with respect to how to utilize the Lagrangian formalism.
Question
I would like to solve the following initial value problem $$ m\, \ddot{x} = - \left[V_2 - V_1\right]\delta(x)$$ with the initial conditions $$x(t_o) = x_o,~\text{where}~x_0<0,~\text{and}~\dot{x}(t_o) = v_o,~\text{where} ~v_0>0.$$ [In truth, I am interested only in $\dot x(t)$].
My Answer
For all values $x$ excepting at $x=0$, the mass is moving with constant velocity. As a consequence, I may write that $x=v\left(t-t_o\right)+x_o$. Therefore, $$ m\, \ddot{x} = - \left[V_2 - V_1\right]\delta\left(v\left(t-t_o\right)+x_o \right).$$
Now, I integrate both sides with respect to time. I find $$ m\, \int \ddot{x} \,dt = - \left[V_2 - V_1\right] \int \delta\left(v\left(t-t_o\right)+x_0 \right)\,dt.$$ Upon integrating the left-hand side, and re-adjusting the right-hand side, I obtain $$ m\, \dot{x} + k_1 = - \left[V_2 - V_1\right] \int \delta\left(v\,t-\left(v\,t_o-x_o\right) \right)\,dt.$$ Now, I do a change of variables. Namely, that $s = v_o\,t$. I find that $$ m\, \dot{x} + k_1 = - \left[V_2 - V_1\right] \int \delta\left(s-\left(v_o\,t_o-x_o\right) \right)\,\frac{ds}{v_o}.$$ Erroneously taking the integral on the right-hand side, I incorrectly find that $$ m\, \dot{x} + k_1 = - \frac{\left[V_2 - V_1\right]}{v_o} H\left(s-\left(v_o\,t_o-x_o\right) \right) + k_2 .$$ Now, since $s = v_o\,t$, I have that $$ m\, \dot{x} + k_1 = - \frac{\left[V_2 - V_1\right]}{v_o} H\left(v_o\left(t-t_o\right) +x_o \right) + k_2 .$$
Ultimately, for an as yet unknown constant $k$, I arrive at $$ \dot{x}(t) = - \frac{\left[V_2 - V_1\right]}{m\,v_o} H\left(v_o\left(t-t_o\right) +x_o \right) + k .$$
Upon satisfying the satisfy the boundary condition, $$ \dot{x}(t_o) = - \frac{\left[V_2 - V_1\right]}{m\,v_o} H\left(v_o\left(t -t_o\right) +x_o \right) + k = k = v_o .$$
So, I erroneously find that $$ \boxed{ \dot{x}(t) = v_o - \frac{\left[V_2 - V_1\right]}{m\,v_o} H\left(v_o\left(t-t_o\right) +x_o \right) . } $$
Remarks
I am not satisfied with my approach. It seems unwieldy, and is erroneous. If you have a more direct approach to solve the problem, then please consider posting it.
I thought that it might be instructive to present an alternative approach that recasts the problem using a nascent Dirac Delta [1]. To that end we proceed.
Suppose $x_n(t)$ satisifies the differential equation
$$x_n''(t)=K\delta_n(x)\tag1$$
subject to the conditions $x_n(t_0)=x_0$ and $x'_n(t_0)=v_0$. In $(1)$. $K=-(V_2-V_1)/m$ and $\delta_n(x)$ is the nascent Dirac Delta
$$\delta_{n}(x)=\begin{cases}n&,0<x<1/n\\\\0&,\text{elsewhere}\end{cases}$$
The solution to $(1)$ is given by
$$x_n(t)=\begin{cases}x_0+v_0(t-t_0)&,x_n<0\\\\\frac{nK}2 (t-t_1)^2+A(t-t_1)&,0<x_n<\frac1n\\\\B(t-t_2)+\frac1n\end{cases}\tag2$$
where $x_n(t_1)=0$, $x_n(t_2)=1/n$, and $A$ and $B$ are integration constants.
We determine $A$ and $B$, and $t_1$ and $t_2$ in $(2)$ by enforcing continuity of position and velocity at $x_n=0$ and $x_n=1/n$. Proceeding, we find that for $v_0^2+2K\ge0$
$$\begin{align} t_1&=t_0-x_0/v_0\\\\ A&=v_0\\\\ t_2&=t_1-\frac{v_0}{nK}+\frac{\sqrt{v_0^2+2K}}{nK}\\\\ B&=\sqrt{v_0^2+2K} \end{align}$$
Finally, letting $n\to \infty$, we find that for $v_0^2+2K\ge0$, $x(t)=\lim_{n\to\infty}x_n(t)$ is given by
$$x(t)=\begin{cases} x_0+v_0(t-t_0)&, x<0\\\\ \sqrt{v_0^2-2(V_2-V_1)/m}\,(t-t_1)&,x>0 \end{cases}$$
And we are done!
References
[1] https://en.wikipedia.org/wiki/Dirac_delta_function#nascent_delta_function