from math import pi
#Variable declaration
u0=4*pi*1e-7;
H=1e7;#magnetic field strength
X=(-0.9)*1e-6;#magnetic suseptiblity
#Calculations&Results
M=X*H;#magnetization of material
print 'magnetization of material is %.f A/m'%M
B=u0*H;#magnetic flux density
print 'magnetic flux density is %.2f Wb/m^2'%B
from math import pi
#Variable declaration
X=2*1e-3;#magnetic suseptibility of material at room temp.
H=1e3;#magnetic field intrnsity of piece of ferricoxide
u0=4*pi*1e-7;
#Calculatons&Results
M=X*H;#magnetization
print 'magnetization is %.f A/m'%M
ur=X+1;#relative permiability
B=u0*ur*H;#magnetic flux density
print 'magnetic flux density is %.3f*10^-3 W/m^2'%(B/1e-3)
#Variable declaration
M=2.74*1e8;#magnetization per atom in A/m
a=2.66*1e-10;#elementry cube edge
n=2;#Iron in BCC
#Calculations&Results
B=(M*a**3)/2;#Am^2 per atom
print 'Average number of Bohr magnetons contributed are %.2f*10^-22'%(B/1e-22)
#interms of bohr megneton
b=B/(9.27*1e-24);#dipole moment
print 'dipole moment is %.f bohr megneton/atom'%b
#Incorrect answers in the textbook
from math import pi
#Variable declaration
u0=4*pi*1e-7;
b=9.27*1e-24;
H=1e3;#homogeneous field
k=1.38*1e-23;#boltzmann constant
T=303;#temp in kelvin
#Calculations
T1 = T - 273; # Temp In Degree
x=u0*b*H/(k*T);#avg magnetic moment
#Result
print 'avg magnetic moment is %.2f*10^-6 bohr magneton/spin'%(x/1e-6)
#Variable declaration
ur=16;#relative permiability
I=3300;#intensity of magnetization
#Calculation
H=I/(ur-1);#strength of the field
#Result
print 'strength of the field =%.f A/m'%H