#Relative permiability and magnetic force
import math
#Variable Declaration
M=2300.0 # Magnetization
B=0.00314 # Flux density
#Calculation
mu=4*math.pi*10**-7
H=(B/mu)-M
mur=(M/H)+1
#Result
print('The magnetic force H is %.4f A/m and the relative permeability mu_r is %.5f'%(H,mur))
# magnetisation and flux density
import math
#Variable Declaration
H=10**4 # Magnetic field intensity
sus=3.7*10**-3 # Susceptibility
mu=4*math.pi*10**-7 # permeability of free space
#Calculation
M=sus*H
B=mu*(M+H)
#Result
print('The magnetisation in the material is %.0f A/m and flux density in the material is %.2f * 10^-2 Wb.m^-2'%(M,B*10**2))
#Flux density in a material
import math
#variable declaration
H=10**4 # Magnetic field intensity
sus=-0.8*10**-5 # susceptibility of copper
mu=4*math.pi*10**-7 # permeability of free space
#Calculations
M=sus*H
B=mu*(M+H)
#Result
print('The flux density in the material is %.2f * 10^-2 Wb.m^-2'%(B*10**2))
# Magnetic field intensity: value given in the book is 10^6 but calculations are done with 10^4
#Permeability
import math
# Variable declarations
H=1800.0 # Magnetic field intensity
fi=3*10**-5 # Magnetic flux
A=0.2*10**-4 # Area of cross-section
#Calculations
B=fi/A
mu=B/H
#Result
print('\nThe magnetic flux is %.1f Wb/m^2\nThe permeability is %.3f*10^-4 H/m'%(B,mu*10**4))
# Magnetic moment of Nickel
import math
#variable declaration
B=0.65 # Magnetic inductionof Nickel
r=8906 # Density of Nickel
M=58.7 # Atomic weight
avg=6.023*10**26 # Avogadro's Number
mu=4*math.pi*10**-7 # Permeability of free space
k=9.27*10**-24 # 1 Bohr Magnetron
#Calculations
N=r*avg/M
mu_m=B/(N*mu)
mu_m=mu_m/k
#Result
print("The magnetic moment of nickel atom is %.2f Bohr magneton"%mu_m)
# Average magnetization contributed per atom
import math
# Variable declaration
a=2.5*10**-10 # interatomic spacing
M=1.8*10**6 # MAgnetization
e=1.6*10**-19 # charge of an electron
#Calculations
n=2/a**3
m=9.1*10**-31
h=6.625*10**-34
ma=M/n
beta1=e*h/(4*math.pi*m)
#Result
print("The average magnetisation contributed per atom = %.3f Bohr Magneton"%(ma/beta1))
# Tempoerature using classical statistics
import math
#Variable declarations
mu=9.4*10**-24 # Permeability
H=2 # MAgnetic field intensity
k=1.38*10**-23 # Bolzmann's constant
#Calculations
T=2*mu*H/(k*math.log(2))
#Result
print("The temperature of the system T is %.1f K"%T)
# Saturation magnetic field of Gd atom
import math
#Variable declaration
ba=7.1 # Bohr magnetron per atom
aw=1.8*10**6 # Atomic weight of Gd
d=7.8*10**3 # Density of Gd
avg=6.023*10**26 # Avogadro's Number
M=157.26 # Atomic number of Gd
k=9.27*10**-24 # 1 Bohr magnetron
mu=4*math.pi*10**-7 # permeability of free space
#Calculations
N=d*avg/M
mm=N*ba*k
B=N*mu*k*7.1
#Result
print("\nThe saturation magnetic field of Gd atom is %.2f Wb/m^2"%B)
#saturation magnetisation
import math
# variable ddeclaration
bet=9.27*10**-24 # 1 Bohr magnetron
V=0.839*10**-9 # unit cell edge length
#Calculations
M=32*bet/V**3
#Result
print("The saturation magnetisation is %.3f *10^5 A/m"%(M*10**-5))
# Answer in the book is given as 5.023 x 10^-5
# Saturation flux density
import math
#variable declaration
d=8900 # Density of Ni
wt=58.71 # Atomic weight
avg=6.022*10**26 # Avogadro's Number
bet=9.27*10**-24 # 1 Bohr magnetron
mu=4*math.pi*10**-7 # permeability of free space
#Calculations
mm=0.6*bet
N=d*avg/wt
ms=mm*N
bs=mu*ms
#Result
print("\nThe saturation magnetisation is %.3f *10^5 A/m\nThe saturation flux density is %.3f Wb/m^2"%(ms*10**-5,bs))
# Saturation magnetisation of gadolinium
import math
#variable declaration
awt=157.25 # Atomic weight
an=64 # Atomic number
d=7860 # density
k=9.27*10**-24 # 1 Bohr magnetron
avg=6.023*10**26 # avogadro's Number
#Calculations
N=d*8*k*avg/awt
# Result
print("The saturation magnetisation of gadolinium is %.2f*10^6 A/m"%(N*10**-6))
# Magnetic flux density inside the material
import math
#variable declaration
H=1000 # Magnetic field strength
sus=-0.3*10**-5 # magnetic susceptibility
mu=4*math.pi*10**-7 # permeability of free space
#calculation
M=sus*H
B=mu*(M+H)
B=math.floor(B*10**6)/10**6
#Result
print("The magnetic flux density inside the material is %.3f T or Wb.m^-2"%(B*10**3))