import math
r=1 #radius in meter
H=2 #magnitude of field vector in amp/meter
pi=1 #let
I=H*2*pi*r
print"Current in the wire is %d*pi amp"%I
import math
sigma=1e-4 #conductivity in siemen/m
Er=2.25 #relative permittivity
E0=1/(4*math.pi*9e9) #permittivity of free space
#E=5e-6*sin(9e9*t) is the electric field in the material volt/m (given)
#J= sigma*E = 1e-4*5e-6*sin(9e9*t)= 5e-10sin(9e9*t)is Conduction current density in A/m**2
#d(E)/dt= 5e-6*9e9*cos(9e9*t)
#Jd=E0*Er*(d(E)/dt) is Displacement current density in A/m**2
print"Conduction current density is %s*sin(9e9*t) A/m**2"%(sigma*5e-6)
print"Displacement current density is %s*cos(9e9*t) A/m**2"%round((E0*Er*5e-6*9e9),9)
import math
H0=1 #magnitude of field vector in amp/meter
mu_0=4*round(math.pi,2)*1e-7 #permeability of free space in H/m
e0=8.85e-12 #permittivity of free space in F/m
E0=H0*math.sqrt(mu_0/e0)
print"Magnitude of electric field for plane wave in free space is ",round(E0,2),"V/m"
import math
E0=1e2 #maximum electric field in plane electromagnetic wave in Newton/coul.
c=3e8 #speed of light in m/sec
B0=E0/c
print"Maximum magnetic field is ",round(B0,9),"Tesla"
print"Maximum magnetic field will be in Z-direction."#this part is not printed in answer in book
import math
S=2*4.2e4/60 #energy flux per unit area per second at the earth surface
mu_0=4*round(math.pi,2)*1e-7 #permeability of free space in H/m
e0=8.85e-12 #permittivity of free space in F/m
EH=S
E_div_H=math.sqrt(mu_0/e0)
E=math.sqrt(E_div_H*EH)
H=EH/E
E0=round(E,1)*round(math.sqrt(2.),3)
H0=H*math.sqrt(2.)
print"Amplitude of electric field is ",round(E0,1),"V/m"
print"Amplitude of magnetic field is ",round(H0,3),"A-turn m-1"
import math
P0=1000 #power in watt
r=2 #distance in meter
Sav=P0/(4*round(math.pi,2)*r**2)
mu_0=4*round(math.pi,2)*1e-7 #permeability of free space in H/m
e0=8.85e-12 #permittivity of free space in F/m
EH=Sav
E_div_H=math.sqrt(mu_0/e0)
E=math.sqrt(E_div_H*EH)
H=EH/E
print"Average value of electric field intensity is ",round(E,2),"V/m"
print"Average value of magnetic field intensity is ",round(H,2),"A-turn m-1"
import math
S=1.38 #energy flux in KW/m**2
c=3e8 #speed of light in m/sec
mu_0=4*math.pi*1e-7 #permeability of free space in H/m
E0=math.sqrt(2*mu_0*c*S*1e3)
B0=E0/c
print"Peak value of electric field is ",round(E0*1e-3,2),"KV/m"
print"Peak value of magnetic field is ",round(B0,7),"Wb/m**2"
import math
E0=100 #in Newton/coul.
A=1e-3 #area in m**2
l=100 #length in cm
e0=8.85e-12 #permittivity of free space in F/m
V=A*l*1e-2
U=e0*E0**2*V/2
print"Energy contained in cylinder is ",U,"Joule"
import math
E0=0.05 #amplitude of electric field strength in V/m
v=6 #frequency in MHz
c=3e8 #speed of light in m/sec
mu_0=4*math.pi*1e-7 #permeability of free space in H/m
e0=8.85e-12 #permittivity of free space in F/m
T=round(1/(v*1e6),9)
lamda=c/(v*1e6)
H0=E0/math.sqrt(mu_0/e0)
Sx_av=E0*round(H0,6)/2
print"E=",E0,"*sin(","{:.2e}".format(2*math.pi/T),"t -",(2*round(math.pi,2)/lamda),"x) V/m"
print"H=","{:.2e}".format(H0),"*sin(","{:.2e}".format(2*math.pi/T),"t -",(2*round(math.pi,2)/lamda),"x) A/m"
print"B=",round(E0/c,12),"*sin(","{:.2e}".format(2*math.pi/T),"t -",(2*round(math.pi,2)/lamda),"x) Wb/m**2"
print"Average poynting vector S=",Sx_av,"Wb/m**2"
import math
lamda=7 #wavelength in mm
E0=42 #maximum magnitude of electric field in V/m
c=3e8 #speed of light in m/sec
print"E=",E0,"*sin(2*pi*(ct-x)/",lamda,") V/m"
print"B=",E0/c,"*sin(2*pi*(ct-x)/",lamda,") Wb/m**2 \nThe magnetic field is along Z-axis."
#unit is not mentioned in answer in book
import math
er=81 #relative permittivity of distilled water
e0=1 #let, permittivity of free space
mu_0=1 #let, permeability of free space
e=e0*er
c=3e8 #speed of light in m/sec
mu=mu_0#for distilled water
MU=math.sqrt((mu*e)/(mu_0*e0))
v=c/MU
print"Refractive index is ",MU
print"Velocity of light in distilled water is ","{:.2e}".format(v),"m/s"
import math
E0=7.5 #electric field intensity in KV/m
w=2e9 #angular frequency in rad/sec
c=3e8 #speed of light in m/sec
mu_0=4*round(math.pi,2)*1e-7 #permeability of free space in H/m
e0=8.85e-12 #permittivity of free space in F/m
f=w/(2*round(math.pi,2))
lamda=c/f
T=1/f
H0=E0*1e3/math.sqrt(mu_0/e0)
print"Wavelength is ",lamda,"m"
print"Frequency is ",round(f*1e-6,1),"MHz"
print"Time period is ",T,"sec"
print"Amplitude of magnetic field intensity is ",round(H0,2),"A/m"
print"Therefore, Hz=",round(H0,2),"*cos( (%.e*t)-(beta*x)) A/m"%w#unit is not printed in book
import math
mu_0=4*math.pi*1e-7 #permeability of free space in H/m
e0=8.854e-12 #permittivity of free space in F/m
#E=45*sin(6e8*pi*t-(2*pi*x))j+15*cos(6e8*pi*t-(2*pi*x))k volt/m (given equation)
#E=Ey*sin((w*t)-(beta*x))j + Ez*cos((w*t)-(beta*x))k (standard form)
#compairing given equation with above equation
pi=1 #let
beta=2*pi
w=6e8*pi
f=w/(2*pi)
n0=math.sqrt(mu_0/e0)
print"Phase constant is %d*pi rad/s"%beta
print"Angular frequency is %.e*pi rad/s"%w
print"Frequency is %.e Hz"%f
print"Intrinsic impedance is %d Ohm"%round(n0)
print"Magnetic field is [0 %s*cos(6*pi*10**8*t-(2*pi*x)) %s*sin(6*pi*10**8*t-(2*pi*x))] A/m"%(round(15/n0,4),round(45/n0,3)) #unit is not printed in book
from sympy import symbols,diff,cos,sin
import math
x,y,B,Y=symbols('x y B Y')
Hz=(6*x*cos(B))+(12*y*sin(Y))
a=diff(Hz,y)
b=diff(-Hz,x)
c=0
d=array([a,b,c])
print"J =", d
import math
A=1.3 #area in m**2
t=3 #time in hours
S=1.1 #intensity of sun rays in KW/m**2
c=3e8 #speed of light in m/sec
p=A*(t*3600)*(S*1000)/c
print"Momentum is %se-4 Kg-m/s"%(p*10000)
import math
S=10 #energy flux in watt/m**2
A=1 #area in m**2
t=1 #time in hour
c=3e8 #speed of light in m/sec
p=2*S*A*(t*3600)/c
F=2*S*A/c
print"Momentum is %.1e Kg-m/s"%p
print"Force is %.2e N"%F
import math
mu=4*math.pi*1e-7 #permeability in H/m
f=71.6 #frequency in MHz
sigma=3.54e7 #conductivity in siemens/m
d=1/sqrt(math.pi*f*1e6*mu*sigma)
print"Depth of penetration is ",int(round(d*1e6)),"micro meter"
import math
f=3e6 #frequency in Hz
mu_r=1
mu_0=4*round(math.pi,2)*1e-7 # in H/m
sigma=38e6 # in S/m
mu=mu_r*mu_0
d=1/math.sqrt(round(math.pi,2)*f*mu*sigma)
alpha=1/(d)
beta=alpha
magnitude=math.sqrt(alpha**2+beta**2)
angle=math.degrees(math.atan(beta/alpha))
v=2*round(math.pi,2)*f/round(beta)
print"Skin depth is ",round(d*1e3,5),"mm"
print"Propagation constant =[ %.4e , %s degree] m**-1"%(magnitude,int(angle)) #in polar form
print"Wave velocity is ",round(v,2),"m/s"
import math
mu=4*math.pi*1e-7 # in H/m
e0=8.854e-12 # in F/m
e=70*e0
sigma=5
d=(2./sigma)*math.sqrt(e/mu)
alpha=1/round(d,4)
print"skin depth is ",round(d,4),"m"
print"Attenuation constant is ",round(alpha,2),"Np/m"
import math
import cmath
sigma=2e-3 #in S/m
e0=8.854e-12 #in F/m
e=80*e0
f=10 #in KHz
mu=4*math.pi*1e-7 #in H/m
ratio=sigma/(2*round(math.pi,2)*f*1e3*e)
#since ratio= sigma/(w*e) = 44.96 >>1,therefore, medium is a good conductor.
#So calculations will be done considering medium as a good conductor.
alpha=math.sqrt(2*math.pi*f*1e3*mu*sigma/2)
beta=int(alpha*1e5)*1e-5
magnitude=math.sqrt(alpha**2+beta**2)
angle=math.degrees(math.atan(beta/alpha))
ni=round(round(math.sqrt(2*math.pi*f*1e3*mu/sigma),2)/round(math.sqrt(2),2),3)*(1+1j)
lamda=2*round(math.pi,2)/beta
v=2*math.pi*f*1e3/beta
print"Attenuation constant is %.2e neper/m"%(int(alpha*1e5)*1e-5)
print"Phase constant is %.2e rad/m"%beta
print"Propagation constant = [ %.3e , %.f degree] m**-1"%(magnitude,angle)#in polar form(unit is not printed in book)
print"Intrinsic impedance is ",ni,"ohm"
print"Wavelength is %.2f m"%lamda
print"Velocity of wave is %.2e m/s"%v
import math
f=100 #in MHz
mu_r=1
mu_0=4*round(math.pi,2)*1e-7 #in H/m
mu=mu_0*mu_r
sigma=58e6 #in S/m
alpha=math.sqrt(round(math.pi,2)*f*1e6*mu*sigma)
alpha=int(alpha/10)*10
beta=alpha
magnitude=math.sqrt(alpha**2+beta**2)
angle=math.degrees(math.atan(beta/alpha))
sqrt_j=45
ni=sqrt(2*round(math.pi,2)*f*1e6*mu/sigma)
v=2*round(math.pi,2)*f*1e6/beta
print"Attenuation constant is %.4e neper/m"%(int(alpha*1e5)*1e-5)
print"Phase constant is %.4e rad/m"%beta
print"Propagation constant = [ %.4e , %.f degree] m**-1"%(magnitude,angle)#in polar form(unit is not printed in book)
print"Intrinsic impedance = [ %.3e , %s degree ] ohm"%(ni,sqrt_j)#in polar form(unit is not printed in book)
print"Velocity of wave is %.3f Km/s"%(v/1e3)
import math
mu=4*math.pi*1e-7 #in H/m
sigma=3.54e7 #in S/m
d=0.0664 #penetration depth in mm
f=1/(math.pi*mu*sigma*(d*1e-3)**2)
print"Frequency is %.2f MHz"%(f/1e6)
#answer is wrong in book because d=0.0644 is taken in calculation which is wrong(given d=0.0664 mm)