Solving Euler-Lagrange Equation with delta function I am trying to understand a physical system and have arrived at the following equation:
$$\mathcal{S} = \int_{z = -\infty}^{z = \infty} dz \left\lbrace f_\rho[\rho] + \dfrac{m}{2} \bigg| \dfrac{\partial \rho}{\partial z} \bigg| ^2 + \dfrac{\rho ^2 (z) \delta(z-z_0)}{2}\right\rbrace$$
where I seek the $ \rho (z) $ that minimizes the value of $\mathcal{S}$.
$ \rho (z) $ is a function of $ z $, with $ \rho ' = d\rho / dz$.
$ f [\rho] = a \rho ^2 + b \rho ^3 + c \rho ^4$ is a functional of $ \rho (z) $, and $ f_\rho[\rho] = \frac{df}{d\rho} $.
I thus write an Euler-Lagrange equation:
$$ \dfrac{\partial \mathcal{S}}{\partial \rho} = \dfrac{\partial}{\partial z} \left( \dfrac{\partial \mathcal{S}}{\partial \rho '}\right)$$
I have been unable to solve this equation for $ {\rho(z)} $, and was wondering how to do so.
I have managed to simplify the EL equation to:
$$ \dfrac{\partial f_\rho [\rho]}{\partial \rho} + \rho \delta(z-z_0) = m \dfrac{\partial ^2 \rho}{\partial z^2} $$
but I don't know where to go from here. Any help would be much appreciated.
 A: Since $\rho$ is a function of $z$ alone, and $f$ is a function of $\rho$ alone, a more proper way to write the last equation is
\begin{equation}
 m \frac{\text{d}^2 \rho}{\text{d} z^2} - \frac{\text{d}^2 f}{\text{d} \rho^2} = \rho\,\delta(z-z_0).
\end{equation}
The best thing to do now is to multiply both sides by $\frac{\text{d} \rho}{\text{d} z}$, and integrate to $z$, which gives
\begin{equation}
\int_{z_*}^z m \frac{\text{d} \rho}{\text{d} z}\frac{\text{d}^2 \rho}{\text{d} z^2} - \frac{\text{d} \rho}{\text{d} z}\frac{\text{d}^2 f}{\text{d} \rho^2}\,\text{d}z = \int_{z_*}^z\rho\frac{\text{d} \rho}{\text{d} z}\,\delta(z-z_0) \,\text{d}z.
\end{equation}
We can recognise the left hand side as the $z$-derivative of $\frac{1}{2} m (\frac{\text{d} \rho}{\text{d} z})^2 - \frac{\text{d} f}{\text{d} \rho}$; integration of the delta distribution yields a constant. Therefore, we get
\begin{align}
 \frac{1}{2} m \left(\frac{\text{d} \rho}{\text{d} z}\right)^2 - \frac{\text{d} f}{\text{d} \rho} &\,= \text{constant} \tag{1}\\ &\left( = \frac{1}{2} m \left(\frac{\text{d} \rho}{\text{d} z}(z_*)\right)^2 - \frac{\text{d} f}{\text{d} \rho}(\rho(z_*)) + \left\{\begin{array} a\rho(z_0) \frac{\text{d} \rho}{\text{d} z}(z_0) & \text{if} & z_* \leq z_0 \leq z \\ 0 & \text{if} & z_0 < z_* \text{ or } z < z_0\end{array}\right.\right)
\end{align}
So, as usual, we obtain an equation of the form '$\text{energy} = T + V = \text{constant}$', only this time, the value of that constant will jump as $z$ increases through the point $z=z_0$. That means that the solution will 'jump' from one energy level to another; the magnitude of the jump is determined by the function value at that point $\rho(z_0)$, and by the value of its derivative $\frac{\text{d}\rho}{\text{d} z}(z_0)$. However, if $z_0$ is your initial value, i.e when $z \geq z_0$, this jump does not occur (then, we're always have the 'upper' value in $(1)$). 
A: General comments to the question (v1): 


*

*OP has a Lagrangian of the form $$L~=~ \frac{1}{2}m \dot{q}^2 -V(q)+ \frac{k}{2}\delta(t-t_0)q(t_0)^2,$$ where $V$ is a smooth function.

*The Euler-Lagrange equation is a 2nd-order non-linear ODE of the form
$$m\ddot{q}+\frac{d V(q)}{dq}~=~k\delta(t-t_0)q(t_0). $$ 

*Let us for simplicity only seek $C^1$-solutions $q:\mathbb{R}\to \mathbb{R}$ that are piecewise $C^2$.

*A first integral is then
$$ \frac{1}{2}m \dot{q}^2 +V(q)~=~E~=~{\rm const.} $$

*Such solution should satisfy the following boundary condition
$$ \lim_{t\to t_0^+}\ddot{q}(t) - \lim_{t\to t_0^-}\ddot{q}(t) ~=~ \frac{k}{m}q(t_0).$$

*Besides the above boundary condition at $t=t_0$, the function $q$ should also satisfy appropriate boundary conditions at $t=\pm\infty$ to ensure that the variational problem is well-posed in the first place. 

*By the way, a similar technique is used to solve the TISE in a Dirac delta function potential.
