Can momentum have a complex expectation value?

The wavefunction has a discontinuity at $x=-a$, which gives a term $-2aA i \hbar \delta(x+a)$ when you act with $p$. The contribution from this to the expectation value of momentum exactly cancels the imaginary value you have calculated.

Two more-general points:

  1. The momentum operator is hermitian, which means its expectation value must be real (provided the wavefunction obeys appropriate boundary conditions, which yours does).

  2. Your wavefunction is real, and therefore has time-reversal symmetry. This implies that the expectation value of the momentum must be zero.


I) One problem is that the momentum operator $\hat{p}$ is an unbounded operator, which means that it is only defined on a domain $D(\hat{p}) \subsetneq {\cal H}$ of the Hilbert space ${\cal H}=L^2(\mathbb{R})$.

When we apply the differentiation operator $\hat{p}=\frac{\hbar}{i}\frac{d}{dx}$ to OP's wave function

$$\tag{1} \psi(x)~=~A(a-x)\theta(a-|x|), \qquad A>0, $$

we get a term proportional to a distribution, cf. Stephen Powell's answer, so that the image $\hat{p}\psi\notin{\cal H}$ is outside the Hilbert space ${\cal H}=L^2(\mathbb{R})$ of square integrable functions. Stated a bit more precise, the issue is that OP's wave function $\psi \notin D(\hat{p}) $ is not in the domain $D(\hat{p})$ of the momentum operator $\hat{p}$, so that the calculation does not make mathematical sense, cf. answer & below comments by Valter Moretti.

II) Nevertheless, apart from standard arguments about expectation values of operators, we can perform various non-rigorous heuristic explicit calculations that indicate that the average momentum $\langle p \rangle$ should be interpreted as zero:

$$\tag{2} \langle p \rangle ~=~\frac{\hbar }{i}\int_{\mathbb{R}} \! dx ~\psi(x)\psi^{\prime}(x) ~=~\frac{\hbar }{2i}\int_{\mathbb{R}} \! dx \frac{d}{dx}\psi(x)^2~=~\frac{\hbar }{2i}\left[\psi(x)^2 \right]^{x=\infty}_{x=-\infty}~=~0,\qquad $$

or

$$\langle p \rangle~=~\frac{\hbar }{i}\int_{\mathbb{R}} \! dx ~\psi(x)\psi^{\prime}(x)~\stackrel{(1)}{=}~\frac{\hbar A^2}{i}\int_{\mathbb{R}} \! dx~ (a-x)\theta(a-|x|)\frac{d}{dx}\left\{ (a-x)\theta(a-|x|)\right\}$$ $$~\stackrel{\begin{matrix}\text{Leibniz'}\\ \text{rule}\end{matrix}}{=}~\frac{\hbar A^2}{i}\int_{\mathbb{R}} \! dx~ (a-x)\theta(a-|x|)\left\{-\theta(a-|x|) - (a-x){\rm sgn}(x) \delta(a-|x|) \right\} $$ $$~=~\frac{\hbar A^2}{i}\left\{\int_{-a}^a \! dx~ (x-a) - \sum_{x=\pm a} (a-x)^2\theta(a-|x|){\rm sgn}(x) \right\} $$ $$\tag{3}~=~\frac{\hbar A^2}{i}\left\{ -2a^2+4a^2 \theta(0)-0\right\}~=~0. $$

In the last equality we assigned the value $\theta(0)=\frac{1}{2}$ to the Heaviside step function $\theta$, cf. e.g. this Phys.SE post.

III) It becomes more ill-defined to try to calculate $$\tag{4}\langle p^2 \rangle~=~\left(\frac{\hbar }{i}\right)^2\int_{\mathbb{R}} \! dx ~\psi^{\prime}(x)^2~=~\infty,$$ partly because a square of the Dirac delta distribution is ill-defined, cf. e.g. this Phys.SE post. At least the value $\infty$ in eq. (4) doesn't conflict with the Heisenberg uncertainty relations!


Well, you can conclude that something is wrong by the following logic: momentum is an observable, which means its allowed values must be things that you could read off a measuring device (assuming you had one that measures momentum). These are necessarily real values, and since the expectation value is some linear combination of possible measurements, it also has to be real. There's no way you can get a complex number from a linear combination of reals.

But I think the core of your question is whether you should be looking for a math mistake, or if something about the form of the wavefunction you've chosen causes this result to be invalid. There is, in fact, something wrong with the wavefunction: it's not continuous.

plot of wavefunction with a=1

When you calculated the momentum, I assume you used the integral $$\langle p\rangle = -i\hbar\int_{\infty}^{\infty}\psi^*(x)\frac{\partial}{\partial x}\psi(x)\ \mathrm{d}x$$ and you probably broke it up into pieces corresponding to the regions in which you've defined the function: $$\begin{align} \langle p\rangle &= -i\hbar\int_{\infty}^{-a}\psi^*(x)\frac{\partial}{\partial x}\psi(x)\ \mathrm{d}x - i\hbar\int_{-a}^{a}\psi^*(x)\frac{\partial}{\partial x}\psi(x)\ \mathrm{d}x - i\hbar\int_{a}^{\infty}\psi^*(x)\frac{\partial}{\partial x}\psi(x)\ \mathrm{d}x \\ &= -i\hbar(0) - i\hbar\int_{-a}^{a} A(a - x)(-A)\ \mathrm{d}x - i\hbar(0) \\ &= -\frac{3i\hbar}{4a} \end{align}$$ But this ignores what happens to the derivative at the point where the wavefunction is discontinuous, namely $x = -a$. Strictly speaking, the derivative is undefined there, and that makes one point at which you cannot evaluate $\frac{\partial}{\partial x}\psi(x)$. By ignoring that point, you come up with a meaningless result.

In quantum mechanics, we say that wavefunctions have to be continuous, for this and other reasons. My recommendation is that you abandon this example and pick a continuous wavefunction.