Kinetic Energy of wavefunction Suppose we have been provided the form of some wavefunction on a graph, but not the exact mathematical expression of the wavefunction $\langle x|\psi\rangle $. Now I'm asked to find the average kinetic energy or the expectation value of the momentum by analyzing nothing except the figure that is given to me. How do I approach problems like this in general.
For example, suppose we have a symmetric wavefunction like this : 
We have to find the expectation value of Kinetic energy, or rather the average kinetic energy.
Now my guess is that, since the wavefunction is a constant between $-a$ to $a$ , the first derivative there will be zero and between $[-(a+b),-a]$ and $[(a+b),a]$, it's $\psi(x)=mx$. Hence the second derivative must vanish as well, the kinetic energy which has the double derivative of the wavefunction inside the integral must therefore be zero. But I feel like I am missing something.
The given answer is $$T=\frac{3\hbar^2}{2mb(3a+b)}.$$
Any help on how to approach this problem would be highly appreciated.
 A: You can start by finding a suitable expression for the function.
$$
 \psi(x)=\begin{cases} 
      k & |x|\lt a \\
      \frac{k}{b}(x+a+b) & -a\lt x\lt -(a+b) \\
      \frac{k}{b}(a+b-x) & a\lt x\lt (a+b) 
   \end{cases}
$$
Then you need to normalize the wavefunction and find the value of $k$. Do it by integrating region by region, in a piecewise manner. You should get $k^2=\frac{3}{2(3a+b)}$
Now you need to find $\langle\psi|\frac{p_{x}^2}{2m}|\psi\rangle$
This is equivalent to :
$$\frac{-\hbar^2}{2m}\int_{-\infty}^{\infty}\psi^*(x)\frac{\partial^2\psi(x)}{\partial x^2}dx$$
From here, you have two options. You note that, using integration by parts :
$$\int_{-\infty}^{\infty}\psi^*(x)\frac{\partial^2\psi(x)}{\partial x^2}dx=\psi(x)\int\frac{\partial^2\psi(x)}{\partial x^2}dx|_{-\infty}^{\infty}\space -\int_{-\infty}^{\infty}\frac{\partial\psi(x)}{\partial x} (\int_{-\infty}^{\infty}\frac{\partial^2\psi(x)}{\partial x^2}dx)dx$$
The first term on the RHS goes to $0$, as $\psi(x)\rightarrow 0$ at both the infinities. Hence, you have :
$$\frac{-\hbar^2}{2m}\int_{-\infty}^{\infty}\psi^*(x)\frac{\partial^2\psi(x)}{\partial x^2}dx=\frac{-\hbar^2}{2m}\int_{-\infty}^{\infty}(\frac{\partial\psi(x)}{\partial x})^2dx$$
You can easily calculate $(\frac{\partial \psi(x)}{\partial x})^2$ in these intervals. After integrating, you should get $\frac{\hbar^2 k^2}{mb}$.
Plugging the value of $k$ that you got from normalization, you should get the desired expression.
Another alternative is to note that, the double derivative of a 'kink' is a Dirac delta function. Hence, you should have :
$$\frac{\partial^2\psi(x)}{\partial x^2}=-\frac{k}{b}(\delta(x+a)+\delta(x-a))$$
You can plug this into the integral, and get the same thing out, by noting $\psi(a)=\psi(-a)=k$
You can solve the integral in this way too, and reach the final expression.
A: This is one of the classic subleties of QM where one needs to know whether the wavefunction is in the domain   of the unbounded Hamiltonian operator.
A  readable discussion is Francois Gieres Mathematical surprises and Dirac’s formalism
in quantum mechanics See in particular Example 7 on page 8 of his account. There he displays  a function whose  fourth  derivative is identically zero , but the  expectaion of $H^2\propto \partial^4_x$  is not zero. The explanation is that the wave function is not in the domain of $H^2$. In your case, your wavefunction is not in the domain of $\partial^2$.
