from __future__ import division
import math
i1=100 #in amp
i2=20 #in amp
W=0.073 #weight of second wire W=F/l in nt/m
u0=4*math.pi*10**-7 #in weber/amp-m
d=u0*i1*i2/(2*math.pi*W)
print("Separation between two wires in metres %.7f"%d)
from __future__ import division
import math
l=1.0 #length of solenoid in meter
d=3*10**-2 #diameter of solenoid in meter
n=5*850 #number of layers and turns of wire
u0=4*math.pi*10**-7 #in weber/amp-m
i0=5.0 #current in amp
#(A)
B=u0*i0*n
print("Magnetic field at center in wb/m2 is %.7f"%B)
#(B)
A=math.pi*(d/2)**2
Q=B*A
print("Magnetic flux at the center of the solenoid in weber is %.7f"%Q)
from __future__ import division
import math
e=1.6*10**-19 #in coul
R=5.1*10**-11 #radius of th enucleus in meter
f=6.8*10**15 #frequency with which elecron circulates in rev/sec
u0=4*math.pi*10**-7 #in weber/amp-m
x=0 #x is any point on the orbit, since at center x=0
#(A)
i=e*f
B=u0*i*R**2*0.5/((R**2+x**2)**(3/2))
print("(A) Magnetic field at the center of the orbit in wb/m2 %.3f"%B)
N=1 #no.of turns
A=math.pi*R**2
U=N*i*A
print("(B) Equivalent magnetic dipole moment in amp-m2 is %.3e"%U)