The solutions must satisfy
> psi := (n,x) -> sqrt(2/L)*sin(n*Pi*x/L);
For n=1:
> int(psi(1,x)^2,x=3*L/8..5*L/8);
> evalf(%);
For n=2:
> int(psi(2,x)^2,x=3*L/8..5*L/8);
> evalf(%);
The probability is much greater for n=1 than for n=2 because in the latter case the range of integration includes a wavefunction node.
To calculate :
> int(psi(1,x)*(x-L/2)*psi(1,x),x=0..L);
:
> int(psi(1,x)*(x-L/2)^2*psi(1,x),x=0..L);
:
> int(psi(1,x)*(x-L/2)^3*psi(1,x),x=0..L);
Note that the odd moments ( with q odd) are all zero. This is a general property of distributions which are symmetric about their mean.
The transition energy from level n to n+1 is
This is enormously smaller than the kinetic energy so quantum effects (like the discreteness of the energy levels) should not be detectable.
> phi:=x->A*x*(L-x);
The wavefunction is normalized if the integral of the probability density is 1:
> N := int(phi(x)^2,x=0..L);
> solve(N=1,A);
Either one of these is an acceptable normalization factor. The sign is not physically significant.