import math
##Example 21.1
##calculation of magnetizing force and relative permeability
##given values
M=2300.;##magnetization in A/m
B=.00314;##flux density in Wb/m**2
u=12.57*10**-7.;##permeability in H/m
##calculation
H=(B/u)-M;
print'%s %.2f %s'%('magnetizing force(in A/m)is ',H,'');
Ur=B/(u*H);
print'%s %.2f %s'%('relative permeability is',Ur,'')
import math
##Example 21.2
##calculation of magnetization and magnetic flux density
##given values
H=10**5;##external field in A/m
X=5*10**-5;##susceptibility
u=12.57*10**-7;##permeability in H/m
##calculation
M=X*H;
print'%s %.2f %s'%('magnetization (in A/m)is ',M,'');
B=u*(M+H);
print'%s %.2f %s'%('magnetic flux density (in wb/m^2) is',B,'')
import math
##Example 21.3
##calculation of relative permeability
##given values
X=3.7*10**-3;##susceptibility at 300k
T=300;##temp in K
T1=200;##temp in K
T2=500;##temp in K
##calculation
C=X*T;##curie constant
XT1=C/T1;
print'%s %.4f %s'%('relative permeability at T1 is ',XT1,'');
XT2=C/T2;
print'%s %.3f %s'%('relative permeability at T2 is',XT2,'')