A particle confined by a potential wall exerts some pressure on it. More specifically, suppose that the particle moves in this potential:
$$V(x) ~=~\left\{ \begin{array}{lcc}\text{finite function}&\text{if}& x > b, \\ V_0 &\text{if} &x < b,\end{array}\right. $$ where $V_0 \to \infty$.
In the limit of infinitely high wall, $\psi(b) = 0$, and the force $F$ depends on $\psi'(b)$. The exact expression can be found in the following way:
Derive the expression for $F$ without making any ad hoc assumptions. Let $V_0$ be very large but finite. In this case, you can find the form of the wavefunction $\psi(x)$ in a small neighborhood of $b$ knowing only $\psi'(b)$. Now suppose that the wall shifts by an infinitely small distance $\delta b$. Consider the corresponding change of the potential, $\delta V(x)$, and calculate the variation of energy.
I have tried solving this several other ways, such as $F = -\frac{d E_n}{dL}$ in an infinite square well of length $L$, but I can't get the above to work out.