# Example 7.2 Page 213¶

In :
#initiation of variable
from math import exp
import math
from scipy import integrate
# calculating radial probability  P= (4/ao^3)*integral(r^2 * e^(-2r/ao)) between the limits 0 and ao for r

#calculation
def integrand(x):
return ((x**2)*exp(-x))/2.0
Pr=integrate.quad(integrand,0,2,args=());#simplifying where as x=2*r/a0; hence the limits change between 0 to 2

#result
print "Hence the probability of finding the electron nearer to nucleus is",round(Pr,3);

Hence the probability of finding the electron nearer to nucleus is 0.323


## Example 7.3 Page 213¶

In :
#initiation of variable
from math import exp
import math
from scipy import integrate
# employing the formula for probability distribution similarly as done in Exa-7.2
#calculation
def integrand(x):
return (1.0/8)*((4.0*x**2)-(4.0*x**3)+(x**4))*exp(-x)
Pr1= integrate.quad(integrand,0,1,args=())             #x=r/ao; similrly limits between 0 and 1.

#result
print"The probability for l=0 electron is",round(Pr1,5)

#part2
def integrand(x):
return (1.0/24)*(x**4)*(exp(-x))
Pr2=integrate.quad(integrand,0,1);                            #x=r/ao; similarly limits between 0 and 1.

#result
print"The probability for l=1 electron is",round(Pr2,5)

The probability for l=0 electron is 0.03432
The probability for l=1 electron is 0.00366


## Example 7.4 Page 215¶

In :
#initiation of variable
from math import exp, sqrt
import math
from scipy import integrate
l=1.0;         #given value of l

#calculation
am1=sqrt(l*(l+1));      #angular momentum==sqrt(l(l+1)) h
l=2.0                     #given l
am2=sqrt(l*(l+1));

#result
print"The angular momenta are found out to be", round(am1,3)," h and",round(am2,3)," h respectively for l=1 and l=2.";

The angular momenta are found out to be 1.414  h and 2.449  h respectively for l=1 and l=2.


## Example 7.5 Page 216¶

In :
#initiation of variable
from math import sqrt
print "The possible values for m are [+2,-2] and hence any of the 5 components [-2h,2h] are possible for the L vector.";
print "Length of the vector as found out previously is %.2f*h.",round(sqrt(6),4);#angular momentum==sqrt(l(l+1)) h

The possible values for m are [+2,-2] and hence any of the 5 components [-2h,2h] are possible for the L vector.
Length of the vector as found out previously is %.2f*h. 2.4495


## Example 7.6 Page 223¶

In :
#initiation of variable
uz=9.27*10**-24; t=1.4*10**3; x=3.5*10**-2;    #various constants and given values
m=1.8*10**-25;v=750;                        # mass and velocity of the particle

#calculation
d=(uz*t*(x**2))/(m*(v**2));                  #net separtion

#result
print"The distance of separation in mm is",round(d*10**3,3);

The distance of separation in mm is 0.157


## Example 7.7 Page 227¶

In :
#initiation of variable
n1=1.0;n2=2.0;hc=1240.0;    #hc=1240 eV.nm
E=(-13.6)*((1/n2**2)-(1/n1**2));   #Energy calculation

#calculation
w=hc/E;                   #wavelength
u=9.27*10**-24; B=2;          #constants
delE= u*B/(1.6*10**-19);     #change in energy
delw=((w**2/hc))*delE;             #change in wavelength

#result
print"The change in wavelength in nm. is",round(delw,4);

The change in wavelength in nm. is 0.0014