Harmonic oscillator modified by infinite well: are analytic solutions possible? I'm trying to find solutions to a harmonic oscillator that sits within an infinite square well. I haven't spent too much time yet, and I've had no success so far. I'm wondering how possible or complex an analytic solution would be? 
The potential of a simple harmonic oscillator is:
$$V_1(x)=1/2 m \omega_0^2 \, x^2$$
For simplicity, let us set $\omega_0=1$ and work in unitless time. 
The potential for the infinite well $V_2(x)$ is infinity outside of the box, $|x|>L/2$ and zero just about everywhere else. 
The potential for the modified problem is:
$$V(x)=V_1+V_2 \,=\, 1/2 m x^2 + V_2(x)$$
I would like to find the energy eigenstates of this modified problem, and the eigenvalues. What does your intuition say about how energy eigenvalues of the SHO would be affected by an added infinite well (assume a well width $L$ much larger than the "wavelength" of the ground state), and how does this compare to the actual analytical or a numerical solution?
 A: The wavefunction $\psi(x)$ will satisfy the Schrödinger equation for the harmonic oscillator on an interval $x\in (-\frac L2 , \frac L2)$. We could write it as
$$
\psi '' +\left(\frac{2E}{\hbar \omega} - \xi^2\right) \psi =0,\tag{1}
$$
where $\xi = \sqrt{\frac{m\omega}\hbar} x$ is the rescaled $x$-coordinate and dash denotes differentiation w.r.t $\xi$.
However, the equation now has new boundary conditions:
$$
\psi\left(\pm \sqrt{\frac{m\omega}\hbar} \frac L2\right)=0. \tag{2}
$$
So in order to solve it we need to write the general solution of the equation (1). It is done in terms of confluent hypergeometric functions  $M$ and $U$:
$$
\psi(\xi) = e^{-\frac{\xi^2}2 }\,\left(C_1 \xi\, M\left(\frac34 - \frac{E}{2\hbar \omega},\frac 32,\xi^2\right)+C_2 \xi\, U\left(\frac34 - \frac{E}{2\hbar \omega},\frac 32,\xi^2\right)\right).
$$
(For general value of parameter $E$ this wavefunction cannot be reduced to polynomial times exponential).
Since the potential is an even function, we can require that $\psi$ must have a specific parity. This allows us to eliminate one of the coefficients:


*

*$\psi$ odd ($\psi(0)=0$): $C_2=0.$

*$\psi$ even ($\psi'(0)=0$):
$$
C_2 = \frac{1}{2\sqrt\pi} \Gamma \left(\frac 14 -  \frac{E}{2\hbar \omega} \right) C_1$$
Coefficient $C_1$ is thus only determined by the norm of $\psi$ and should not enter the calculations of the energy spectrum. The only parameter left is the energy $E$, which must be determined by imposing the boundary condition (2) (only one of the equations is needed since we already imposed parity). This would gives us the energy spectrum of the system.

Note, that if the value $\xi=\sqrt{\frac{m\omega}\hbar}\frac L2$ happens to coincide with one of the roots of some Hermite polynomial $H_n(\xi)$, then the energy $\hbar\omega(n+\frac12)$ and wavefunction $\psi_n$ of harmonic oscillator would be the solution for this system. But of course, the number $n$ in this case would not mean that this is the $n$-th level.
A: I think in this case the square well is the dominant effect, because for any value of $m\omega_0^2$ the well potential is always stronger. Therefore you could start with the well solutions and calculate the first order energy shift due to the harmonic oscillator potential:
$$E_n^{(1)} = \left\langle n^{(0)} \right| V_1 \left|n^{(0)} \right\rangle$$
as well as higher order corrections. I suspect that you want $\frac{1}{2} m \omega_0^2 \frac{L^2}{4}$ to be much smaller than $\frac{\hbar^2 n^2 \pi^2}{2 m L^2}$.
As for an "exact" solution, recall the series method of solving the harmonic oscillator model (this is done in any QM textbook), where you write the wavefunction as a polynomial multiplying $e^{-\frac{m\omega}{2\hbar}x^2}$, and then obtain a recurrence relation for this polynomial. Well, I suspect that in this case you don't want to discard the other half, i.e., a polynomial multiplying $e^{+\frac{m\omega}{2\hbar}x^2}$. This leads to an equation that isn't quite Hermite's equation. Also, in the ordinary treatment, the recurrence relation terminates (giving discrete eigenvalues) in order to keep the solution from blowing up at $x\to \infty$. However, here we instead require that $\psi\left(\frac{L}{2}\right) = 0$, which is a different requirement.
