> psi2p0 := (r,theta,phi) -> A*r*exp(-r/(2*a0))*cos(theta);
> assume(a0>0);
> N := int(int(int( psi2p0(r,theta,phi)^2*r^2*sin(theta),r=0..infinity), theta=0..Pi),phi=0..2*Pi);
Using Taylor's theorem, we have
> V := x -> hbar^2/(m*L^3)*abs(x-L/2);
> phi := x -> x*(L-x) + c*x^2*(L-x)^2;
> assume(L>0);
The variational energy is
We will compute it in pieces. First :
> Kip := int(phi(x)*(-hbar^2/(2*m))*diff(phi(x),x$2),x=0..L);
> Vip := int(phi(x)*V(x)*phi(x),x=0..L);
> ip:=int(phi(x)^2,x=0..L);
> Evar:=(Kip+Vip)/ip;
To find the best value of the variational parameter c, we minimize
with respect to this parameter:
> s1:=solve(diff(Evar,c)=0,c);
> evalf(subs(c=s1[1],Evar));
> evalf(subs(c=s1[2],Evar));