import math
# part a
#to calculate electric flux
#electric flux through a surface is phi=vector(E)*vector(s)
#where vector E=2i+4j+7k,vector s=10j
E=4 #E=4j
s=10 #s=10j
phi=E*s
print "electric flux is phi=",phi,"units"
# part b
#to calculate flux coming out of any face of the cube
q=1 #charge in coulomb
epsilon0=8.85*10**-12 #permittivity in free space in coul**2/N-m**2
phi1=q/(6*epsilon0)
print "flux coming out of any face of the cube is phi1=","{:.3e}".format(phi1),"N-m**2/coul**2"
import math
# part a
#to calculate electric field at a point from centre of the shell
q=0.2*10**-6 #charge
r=3 #radius
epsilon0=8.85*10**-12
E=q/(4*math.pi*epsilon0*r**2)
print "electric field at a point from centre of the shell is E=",round(E),"N/coulomb"
# part b
#to calculate electric field at a point just outside the shell
R=0.25 #radius
E=q/(4*math.pi*epsilon0*R**2)
print "electric field at a point just outside the shell is E=","{:.3e}".format(E),"N/coulomb"
#to calculate the electric field at a point inside the shell
#when the point is situated inside the spherical shell,the electric field is zero
import math
#to calculate electric field at a point on earth vertically below the wire
lamda=10**-4 #wavelength in coulomb/m
r=4 #radius in m
epsilon0=8.854*10**-12
E=2*lamda/(4*math.pi*epsilon0*r)
print "electric field at a point on earth vertically below the wire is E=","{:.3e}".format(E),"N/coulomb"
import math
#to calculate separation between those equipotential surfaces
V=5 #potential difference
epsilon0=8.85*10**-12 #permittivity of free space
sigma=1*10**-7 #in c/m**2
#electric field due to an infinite sheet of surface charge density is given by E=sigma/(2*epsilon0) eq(1)
#E=V/d eq(2)
#from eq(1) and eq(2),we get
d=(2*epsilon0*V)/sigma
print "separation between those equipotential surfaces is d=","{:.3e}".format(d),"m"
import math
#to calculate force per unit area
#force of attraction per unit area is given by F=(epsilon0*E**2)/2 eq(1)
#E=V/d eq(2)
epsilon0=8.85*10**-12 #permittivity of free space
d=1*10**-3 #distance
V=100 #potential difference in volts
#from eq(1) and eq(2),we get
F=(epsilon0*V**2)/(2*d**2)
print "force per unit area is F=","{:.3e}".format(F),"N/m**2"
#answer is given incorrect in the book ,F=4.425*10**-12
import math
#to calculate charge
#let charge be q coulomb ,then the surface density of charge i.e. sigma=q/(4*math.pi*r**2)..............eq(1)
#outward pull per unit area =sigma**2/(2*epsilon0)............eq(2)
#put eq(1) in eq(2),we get q**2/(4*math.pi*r**2)**2*(2*epsilon0)..............eq(3)
#pressure due to surface tension =4*T/r............eq(4)
T=27
r=1.5*10**-2
epsilon0=8.85*10**-12
#equate eq(3) and eq(4),we get
q=math.sqrt(4*T*((4*math.pi*r**2)**2)*2*epsilon0/r)
print "charge is q=","{:.3e}".format(q),"coulomb"
#answer is given wrong in the book,square of 4*math.pi*r**2 is not taken in the solution.
import math
#to calculate increase in radius
q=4.8*10**-8 #charge in coulomb
r=10*10**-2 #radius in m
epsilon0=8.85*10**-12 #C**2/N-m**2
P=10**5 #N/m**2
dr=(q**2)/(96*((math.pi)**2)*(r**3)*epsilon0*P)
print "increase in radius is dr=","{:.3e}".format(dr),"m"
#in page no.340,numbering is done wrongly,it should be like ex-8,ex-9,ex-10,ex-11,ex-12,ex-13,ex-14
import math
#to calculate average values of intensities of electric and magnetic fields of radiation
#energy of lamp=1000 J/s
#area illuminated =4*math.pi*r**2=16*math.pi m**2
#energy radiated per unit area per second =1000/16*math.pi
#from poynting theorem |s|=|E*H|=E*H eq(1)
s=1000/(16*math.pi)
muo=4*math.pi*10**-7 #permeability of free space
epsilon0=8.85*10**-12 #permittivity in free space
#E/H=math.sqrt(muo/epsilon0) eq(2)
#from eq(1) and eq(2),we get
E=math.sqrt(s*math.sqrt(muo/epsilon0))
H=s/E
print "average value of intensity of electric fields of radiation is E=",round(E,3),"V/m"
print "average value of intensity of magnetic fields of radiation is H=",round(H,3),"ampere-turn/m"
#answer is given wrong in the book E=48.87 V/m,solution of magnetic fields is not given in the book .
import math
#to calculate amplitudes of electric and magnetic fields of radiation
#energy received by an electromagnetic wave per sec per unit area is given by poynting vector |s|=|E*H|=E*H*sin 90 (becoz E is perpendicular to H)
#it is given that energy received by earth's surface is
s=1400.0 #|s|=2 cal min**-1 cm**-2
muo=4.0*math.pi*10**-7 #permittivity of free space
epsilon0=8.85*10**-12 #permeability of free space
#E*H=1400 eq(1)
#E/H=math.sqrt(muo/epsilon0) eq(2)
#from eq(1) and eq(2) ,we get
E=math.sqrt(s*math.sqrt(muo/epsilon0))
#from eq(1) ,we get
H=1400.0/E
Eo=E*math.sqrt(2) # at distance 2 m
Ho=H*math.sqrt(2) # at distance 2 m
print "amplitude of electric field is Eo=",round(Eo,3),"V/m"
print "amplitude of magnetic field is Ho=",round(Ho,3),"amp-turn/m"
# The answers in the textbook are slightly different due to approximation
# no value to be found out , only equation to be written hence skipped following the TBC guidelines
import math
#to calculate skin depth
f=10**8 #frequency
sigma=3*10.0**7 #conductivity of the medium
muo=4*math.pi*10**-7 #permeability of free space
Del=math.sqrt(2/(2*math.pi*f*sigma*muo))
print "skin depth is Del=","{:.3e}".format(Del),"cm"
# answer in book is wrong
import math
# part a
#to calculate frequency
muo=4*math.pi*10**-7 #permeability of free space
sigma=4.3 # in mhos/m
Del=0.1 #skin depth in m
f=2/(2*math.pi*muo*Del**2)
print "frequency is f=","{:.3e}".format(f),"Hz"
#value of frequency is given incorrect in the book
# part b
#show that for frequencies less than 10**8 ,it can be considered as good conductor
epsilon=80*8.854*10**-12
f=10**8 #frequency in Hz
sigma=4.3
#formula is sigma/(omega*epsilon)>4.3/(2*math.pi*10**8*80*epsilon)
sigma1=sigma/(2*math.pi*f*epsilon) #where sigma1=sigma/(omega*epsilon)
print "sigma1=",round(sigma1,3),"unitless"
#the ocean water to be good conductor ,the value of sigma/(omega*epsilon) should be greater than 1
import math
#to show that for frequency <10**9 Hz ,a sample of silicon will act like a good conductor
sigma=200 #in mhos/m
omega=2*math.pi*10**9
epsilon0=8.85*10**-12 #permittivity in free space
epsilon=12*epsilon0
sigma1=sigma/(omega*epsilon) #sigma1=sigma/(omega*epsilon)
print "sigma1=",round(sigma1),"unitless"
#if sigma/(omega*epsilon) is greater than 1 , silicon is a good conductor at frequency <10**9 Hz
#to calculate penetration depth
f=10**6 #frequency in Hz
muo=4*math.pi*10**-7 #permeability of free space
sigma=200
Del=math.sqrt(2/(2*math.pi*f*muo*sigma))
print "penetration depth is del=",round(Del*100,1),"cm"
import math
#to calculate conduction current and displacement current densities
sigma=10**-3 #conductivity in mhos/m
E=4*10**-6 #where E=4*10**-6*math.sin(9*10**9t) v/m
J=sigma*E
print "conduction current density is J=","{:.3e}".format(J),"math.sin(9*10**9t) A/m"
epsilon0=8.85*10**-12 #permittivity in free space
epsilonr=2.45 #relative permittivity
#formula is epsilon0*epsilonr*(delE/delt)
#delE/delt=4*10**-6*9*10**9*math.cos(9*10**9*t)
Jd=epsilon0*epsilonr*4*10**-6*9*10**9
print "displacement current density is Jd=",round(Jd,10),"math.cos(9*10**9*t) A/m**2"