For a generic well (see Figure 1), the potential is given by
\[ V(x) = \begin{cases}\infty, \text { if } x < x_{0}\\0, \text{ if } x_{0} \leq x \leq x_{0}+L\\\infty, \text { if } x > x_{0}+L\end{cases} \tag{1} \label {Eq:V_x0} \]
The solutions to Time-Independent Schrodinger Equation are
\[ \psi_{1_{n}}(x) = Ae^{\imath k x} \qquad \Big |A \Big | = \sqrt{\frac{1}{L}} \]
or
\[ \psi_{2_{n}}(x)=B^{-\imath kx} \qquad \Big |B \Big | = \sqrt{\frac{1}{L}} \]
with
\[ k_{n} = \frac{n \pi}{L} \qquad n=\pm 1, \pm 2, \pm 3, \dots \]
A. The Expectation Values $\langle x \rangle$ and $\langle p \rangle$.
The expectation value of position $\langle x \rangle$ with the well placed at an arbitrary location is given by
\[ \langle x \rangle = \int_{x{0}}^{x_{0}+L} \psi^{*}(x) \cdot x \cdot \psi(x)dx \notag \]
\[ = A^{*}A \int_{x_{0}}^{x_{0}+L} e^{-\imath kx} \cdot x \cdot e^{\imath kx} dx \notag \]
\[ = \frac{1}{L} \cdot \frac{1}{2} \Big [ (x_{0}+L)^{2} – x_{0}^2 \Big ] \notag \]
\[ = x_{0} + \frac{1}{2} L \tag{1} \label{Eq:Expectationx} \]
The above value matches that for the traditional approach and the value that is intuitively expected.
The expectation value of the momentum, with the momentum operator $\hat{p}$ being given as $-\imath \hbar d /dx$ results in
\[ \langle p \rangle = \int_{x_{0}}^{x_{0}+L} A^{*}e^{-\imath kx} \cdot \hat{p} Ae^{\imath kx} dx = \hbar k \tag{2} \label{Eq:Expectationp}\]
which fits in nicely as indeed momentum $p$ is given by $\hbar k$.
B. Invariance.
Note should be made that the solutions were derived for a well at an arbitrary position $x_{0}$ (see Quantization of Energy and The Solutions). Therefore, the equations themselves are invariant.
Therefore, the expectation value of the position is always given by an equation of the form in Eq.\eqref{Eq:Expectationx}.
For example, in one reference frame a well of length $L$ is placed with its left-hand edge at $x=0$. The expectation value is given by
\[ \langle x \rangle = x_{0} + \frac{1}{2} L \]
The well is now shifted a distance of $\Delta x$ to the right with its left-hand edge now being given by the coordinate $\underline x_{0}$. The relationship between the two positions is
\[ \underline x_{0} = x_{0} + \Delta x \tag{3} \label{Eq:Shift} \]
From the perspective of the new frame of reference, the expectation value of the position is given by
\[ \langle \underline x \rangle = \underline x_{0} + \frac{1}{2}L \tag{4} \label{Eq:Shiftedx} \]
Substituting the relationship in Eq.\eqref{Eq:Shift} into the result given in Eq.\eqref{Eq:Shiftedx} gives
\[ \langle \underline x \rangle = x_{0} + \Delta x + \frac{1}{2}L = \langle x \rangle + \Delta x \]
The above result is as expected with the value of $\langle x \rangle$ simply being shifted by the amount $\Delta x$.
The expectation value of $p$ is given by Eq.\eqref{Eq:Expectationp} and is not dependent on $x_{0}$. As in classical mechanics, the momentum is independent of the frame of reference and independent of any shifts in the well’s position.