I want to compute this integral, $I = \int_{-\infty}^{+\infty} \psi(x)\frac{d^2}{dx^2} \psi(x) dx$. Now, consider a function which has a discontinuity in its first derivative. For an example I'll consider a triangular wave centered at $\frac \Delta 2$. So,
$$ \begin{equation} \psi(x) = \begin{cases} A x, & 0 \le x \le \frac \Delta 2 \\ A (\Delta - x), & \frac \Delta 2 \le x \le \Delta \end{cases} \end{equation} \tag 1 $$
where $A = \sqrt{\frac{12}{\Delta^3}}$ and,
$$ \begin{equation} \frac{d}{dx}\psi(x) = \begin{cases} A , & 0 \le x \le \frac \Delta 2 \\ -A , & \frac \Delta 2 \le x \le \Delta \end{cases} \end{equation} \tag 2 $$
Now Eq. $(2)$ can we written in a more illuminating form using the step function, $\theta(x)$. So,
$$ \frac{d}{dx} \psi(x) = A(\theta(x) - 2\theta(x - \frac \Delta 2) + \theta(x - \Delta)), \forall x \tag 3 $$
Now if I had simply considered the two regions in Eq. $(2)$ then I would have got,
$$ \begin{equation} \frac{d}{dx}\psi(x) = \begin{cases} A(\theta(x) - \theta(x - \frac \Delta 2)) , & 0 \le x \le \frac \Delta 2 \\ -A(\theta(x - \frac \Delta 2) - \theta(x - \Delta)) , & \frac \Delta 2 \le x \le \Delta \end{cases} \end{equation} \tag 4 $$
Since my objective is to compute the second derivative in $\psi(x)$ and then computing the above mentioned integral $I$ then I would have got using Eq. $(3)$, $\frac{12}{\Delta^2}$; and using Eq. $(4)$, $\frac {6} {\Delta^2}$.
Now I know for a fact that using $(4)$ wrong. Could someone explain why? Is $(4)$ counting just half the contribution of the discontinuities than $(3)$? Where am I missing the justification?