We start by defining the particle-in-a-box wavefunction:
> psi_pib := (n,x,L) -> sqrt(2/L)*sin(n*Pi*x/L);
Computing probabilities is then a straightforward matter:
> evalf(int(psi_pib(1,x,L)^2,x=0..L/4));
.09084505693
> evalf(int(psi_pib(2,x,L)^2,x=0..L/4));
.2500000000
> evalf(int(psi_pib(3,x,L)^2,x=0..L/4));
.3030516477
To understand why these values are as they are, we consider the shapes
of the wavefunctions. It is useful to focus on the leftmost quarter
for which we computed occupation probabilities:
> plot([psi_pib(1,x,1),psi_pib(2,x,1),psi_pib(3,x,1)],
x=0..1/4,color=[red,green,blue]);
The n=1 wavefunction peaks in the centre of the box so the
probability density is small at the edges of the box. The n=2
wavefunction has a simple two-fold antisymmetry, each lobe itself
having a simple reflection symmetry about its centre so that exactly
one quarter of the probability density can be found in each of the
quarters of the box. For n=3, the probability density is
divided into three similar lobes. The leftmost quarter of the box
contains one of the probability density maxima, so the probability of
finding the particle in this region is elevated.
Again, we start by defining the wavefunction. We can do it in pieces
to simplify our typing.
A := n -> sqrt(beta/(2^n*n!*sqrt(Pi)));
> with(orthopoly,H);
[H]
> psi := (n,x) -> A(n)*H(n,beta*x)*exp(-beta^2*x^2/2);
> assume(beta>0);
We now proceed to compute the expectation values:
> int(psi(0,x)*1/2*k*x^2*psi(0,x),x=-infinity..infinity);
> int(psi(1,x)*1/2*k*x^2*psi(1,x),x=-infinity..infinity);
> int(psi(2,x)*1/2*k*x^2*psi(2,x),x=-infinity..infinity);
The pattern is reasonably obvious:
Now we use the definition of :