> solve(27*a0^2-18*a0*r+2*r^2=0,r);
> psi2px := (r,theta,phi) -> > 1/sqrt(32*Pi*a0^5)*r*exp(-r/(2*a0))*sin(theta)*cos(phi);
> V := r -> -e^2/(4*Pi*epsilon0*r);
> assume(a0>0); > int(int(int(psi2px(r,theta,phi)*V(r)*psi2px(r,theta,phi) > *r^2*sin(theta),r=0..infinity),theta=0..Pi),phi=0..2*Pi);
> psi0 := x -> exp(-alpha*x^2/2);
> assume(alpha>0);If we multiply by a normalization factor, then integrate the square of the wavefunction and force the result to be equal to 1, we see that the normalization constant must be
> 1/sqrt(int(psi0(x)^2,x=-infinity..infinity));
> phi := x -> x*(L-x) + a*x^2*(L-x)^2;
The particle-in-a-box Hamiltonian is all kinetic:
> Evar := -hbar^2/(2*m)*int(phi(x)*diff(phi(x),x$2),x=0..L) > /int(phi(x)^2,x=0..L);
> avalues := solve(diff(Evar,a)=0,a);
The better solution is the one that gives the lowest energy:
> E1 := simplify(subs(a=avalues[1],Evar));
> E2 := simplify(subs(a=avalues[2],Evar));
> evalf(E1);
> evalf(E2);
E1 is by far the better solution.
The ground-state energy is given in terms of h, not , so we must make the conversion:
> hbar := h/(2*Pi);
> evalf(E1);
This is extremely close to the ground-state energy:
> percent_err := evalf((E1-h^2/(8*m*L^2))/(h^2/(8*m*L^2))*100);