#Horizontal component of magnetic Intensity
import math
#variable declaration
Bo=1.7*10**-5 #in weber/m^2
meu_o=4*math.pi*10**-7 #permeability of free space in weber/amp-meter
#Calculations
H=Bo/meu_o #in A/m
#result
print("Horizontal component of magnetic filed intensity in A/m : %.1f"%H);
#Current through solenoid
import math
#variable Declaration
H=5*10**3 #in Ampere-turns/m
l=10 #in cm
l=l*10**-2 #in meter
N=50 #no. of turns
n=N/l #no. of turns per unit length
#Calculation
#Formula : H=n*i
i=H/n #in Ampere
#Result
print("Current should be sent through solenoid in Ampere : %.0f"%i)
#Magnetic moment of rod
import math
#variable declaration
meu_r=1000 #relative permeability
n=5 #turns/cm
n=n*10**2 #turns/meter
i=0.5 #in Ampere
Volume=10**-4 #in m^3
#calculation
I=(meu_r-1)*n*i #in Ampere
MagneticMoment=I*Volume #in Ameter^2
#Result
print("Magnetic moment of the rod in Ampere-meter^2 : %.0f"%(math.ceil(MagneticMoment)))
#Flux density magnetic intensity and permeability
import math
#variable Declaration
l=30 #in cm
l=l*10**-2 #in meter
A=1 #in cm^2
A=A*10**-4 #in meter^2
N=300 #turns of wire
i=0.032 #in Ampere
FI_B=2*10**-6 #in weber
meu_o=4*math.pi*10**-7 #permeability of free space in weber/amp-meter
#Calculations
B=FI_B/A #in weber/meter^2
H=N*i/l #in amp-turn/meter
meu=B/H #in weber/Amp-meter
meu_r=meu/meu_o #Relative Permeability
#Result
print("Flux Density in weber/meter^2 :%.2f "%B)
print("\nmagnetic Intensity in amp-turn/meter : %.0f"%H)
print("\nPermeability in weber/amp-meter :%.2f *10^-4"%(meu*10**4))
print("\nRelative Permeability :%.3f "%meu_r)
#Answer of relative permeability is wrong in the book.
#Relative Permeability
import math
#variable declaration
Xci_m=9.48*10**-9 #usceptibility of medium(unitless)
#calculation
meu_r=1+Xci_m #relative permeability(unitless)
#result
print("Relative Permeability : %.2f * 10^-9\n"%(meu_r*10**9));
print("i.e, Relative Permeability is sligtly greater than 1.");
#Magnetising Force and material magnetisation
import math
#variable declarationm
n=10 #turns/cm
n=n*10**2 #turns/meter
i=2 #in Ampere
B=1 #in weber/meter^2
meu_o=4*math.pi*10**-7 #permeability of free space in weber/amp-meter
#Calculations
H=n*i #in amp-turn/meter
#Formula : B=meu_o*(H+I)
I=B/meu_o-H #in amp-turn/meter
meu_r=B/(meu_o*H) #relative permeability(unitless)
#result
print("Magnetising Force in amp-turn/meter :%.0f "%H)
print("\nMagn etisation of material in amp-turn/meter %.2f * 10^5:"%(math.ceil(I/10**3)/100))
print("\nRelative Permeability : %.0f"%(math.floor(meu_r)))