> psi := (n,L,x) -> sqrt(2/L)*sin(n*Pi*x/L);
Use the hint:
> assume(n,integer); > assume(m,integer);Now compute the inner product:
> int(psi(n,L,x)*psi(m,L,x),x=0..L);
Note that Maple simply assumes that n and m represent different integers. We haven't told it that this is true so it probably shouldn't do that. Computer algebra systems can be very good at what they do, but they are not foolproof. You should double-check your results whenever possible and pay special attention to special cases.
> avg_x:=int(psi(2,L,x)^2*x,x=0..L);
> avg_x2:=int(psi(2,L,x)^2*x^2,x=0..L);
> avg_p:=-I*hbar*int(psi(2,L,x)*diff(psi(2,L,x),x),x=0..L);
> avg_p2:=-hbar^2*int(psi(2,L,x)*diff(psi(2,L,x),x$2),x=0..L);
> assume(L,positive); > assume(hbar,positive); > delta_x:=sqrt(avg_x2-avg_x^2);
> delta_p:=sqrt(avg_p2-avg_p^2);
> simplify(delta_x*delta_p);
> evalf(%);
This is bigger than so the uncertainty principle is verified for this state.
> avg_xp := -I*hbar*int(psi(1,L,x)*x*diff(psi(1,L,x),x),x=0..L);
> avg_px := -I*hbar*int(psi(1,L,x)*diff(x*psi(1,L,x),x),x=0..L);
Note that these values are complex. This is OK because neither px nor xp represents a proper observable. Some quantum mechanical operators commute ( ) and some, like and , don't. It turns out that this is deeply connected to the uncertainty principle: Commuting observables can be simultaneously measured without interference while noncommuting observables can't.