import scipy
from pylab import *
#Variable Declaration
w=10**8
c=3.0*10**8
#Calculations
T=2*scipy.pi/w #timeperiod of the wave in sec
B=(w/c) #in rad/m
lam=2*scipy.pi/B #wavelength in m
t1=lam*10**9/(2*c) #time taken to travel half the wavelength in ns
x=arange(-6*scipy.pi,6*scipy.pi,0.1)
t=0
E=50*scipy.cos(10**8*t+x*w/c)
subplot(3,1,1)
xlabel("x")
ylabel("E for t=0")
plot(x,E,'r')
subplot(3,1,2)
t=T/4
E=50*scipy.cos(10**8*t+x*w/c)
xlabel("x")
ylabel("E for t=T/4")
plot(x,E)
subplot(3,1,3)
t=T/2
E=50*scipy.cos(10**8*t+x*w/c)
xlabel("x")
ylabel("E for t=T/2")
plot(x,E,'g')
show()
#Results
print 'Since the argument of cosine function is positive, '
print 'the wave is propagating in the negative x direction.'
print' B =',round(B,4),'rad/m'
print 'Time taken to travel a distance of lambda/2 =',round(t1,2),'n sec'
import cmath
import scipy
#Variable Declaration
Ho=10
n=200*scipy.exp(1)**(1j*scipy.pi/6)
b=0.5
#Calclations
Eo=n*Ho #amplitude of electric field in kV/m
P=scipy.arctan(scipy.sqrt(3))
a=b*((scipy.sqrt(((1+(scipy.tan(P))**2)**0.5)-1))/(scipy.sqrt(((1+(scipy.tan(P)
)**2)**0.5)+1)))
delta=1/a
#Results
print 'E has the same form as H except for amplitude and phase.'
print 'The amplitude and phase of E =',Eo,'kV/m'
print '= magnitude of 2000 and angle of pi/6'
print 'a =',round(a,4),'Np/m'
print 'Skin depth =',round(delta,3),'m'
print 'The polarization of wave is in z direction since it has an z component.'
import scipy
#Variable Declaration
B=1
n=60*scipy.pi
Ur=1 #relative permeability
Eo=10**-9/(36*scipy.pi) #permittivity of free space
Uo=4*scipy.pi*10**-7 #permeability of free space
#Calculations
Er=Uo*Ur/(n**2*Eo) #relative permittivity
w=B/scipy.sqrt(Eo*Er*Uo*Ur) #in rad/sec
eps=Eo*Er #permittivity of the medium in Farad/m
H1o=-0.1
H2o=0.5
Ex=H2o/(eps*w) #amplitude of x component of E in V/m
Ey=H1o/(eps*w) #amplitude of y component of E in V/m
#Results
print 'er =',Er
print 'w =',w,'rad/sec'
print 'E =',round(Ex,2),'sin(wt-z)ax +',round(-Ey,2),'cos(wt-z)ay V/m'
import scipy
#Variable Declaration
E=2 #amplitude of E in V/m
sigma=3 #in mhos/m
w=10**8 #in rad/sec
Ur=20 #relative permeability
Eo=10**-9/(36*scipy.pi) #permittivity of free space in Farad/m
Er=1 #relative permittivity
Uo=4*scipy.pi*10**-7 #permeability of free space
#Calculations
a=round(scipy.sqrt(Uo*Ur*w*sigma/2),1) #in Np/m
B=a #rad/m
theta=scipy.arctan(sigma/(w*Eo*Er))*0.5 #in radians
thetad=round(theta*180/scipy.pi,0) #in degrees
H=E/(scipy.sqrt(Uo*Ur*w/sigma))*10**3 #amplitude of H in mA/m
#Results
print 'alpha =',a,'Np/m'
print 'beta =',B,'rad/m'
print 'H =',round(H,1),'e^ (',a,'z ) sin(wt - Bz -',thetad,') mA/m'
import scipy
#Variable Declaration
a=2*10**-3 #in m
b=6*10**-3 #in m
t=10**-3 #in m
l=2 #in m
c=5.8*10**7 #conductivity in seimens
f=100*10**6 #frequency in Hz
mu=4*scipy.pi*10**-7 #permeability of free space
#Calculations
Ri=l/(c*scipy.pi*a*a) #dc resistance of inner cable in ohms
Ro=l/(c*scipy.pi*((b+t)**2-b**2)) #dc resistance of outer cable in ohms
Rdc=Ro+Ri #total dc resistance in ohms
Ria=round(l/(2*scipy.pi*a)*scipy.sqrt(scipy.pi*f*mu/c),1)
Roa=round(l/(2*scipy.pi*b)*scipy.sqrt(scipy.pi*f*mu/c),4)
Rac=Ria+Roa #ac resistance in ohms
#Results
print 'Rdc =',round(Rdc*10**3,3),'m ohms'
print 'Rac =',round(Rac,4),'ohms'
import scipy
from numpy import *
#Variable Declaration
ax=array([1,0,0]) #Unit vector along x direction
ay=array([0,1,0]) #Unit vector along y direction
az=array([0,0,1]) #Unit vector along z direction
a=0 #alpha in m^-1
b=0.8 #beta in m^-1
Eo=10**-9/(36*scipy.pi) #permittivity of free space in farad/m
Uo=4*scipy.pi*10**-7 #permeability of free space
Ur=1 #relative permeability of medium
w=2*scipy.pi*10**7 #omega in rad/s
Eamp=4 #amplitude of the field in V/m
#Calculations
Er=b**2/(Uo*Eo*w*w) #relative permittivity of the medium
n=scipy.sqrt(Uo/(Eo*Er)) #eta in ohms
Pav=Eamp**2/(2*n)*ax #average power in W/m^2
an=(2*ax+ay)/scipy.sqrt(5) #normal to the plane
S=100*10**-4*an #area in m^2
P=dot(Pav,S)*10**6 #power through the plane in micro W
#Results
print 'Er=',round(Er,2)
print 'eta= ',round(n,1),'ohms'
print 'The time-average power =',round(dot(Pav,ax)*10**3,0),'ax mW/m^2'
print 'The total power crossing 100 cm^2 of the plane =',round(P,2),'micro W'
import scipy
from numpy import *
#Variable Declaration
ax=array([1,0,0]) #Unit vector along x direction
ay=array([0,1,0]) #Unit vector along y direction
az=array([0,0,1]) #Unit vector along z direction
kx=0 #in m^-1
ky=0.866 #in m^-1
kz=0.5 #in m^-1
Eo=10**-9/(36*scipy.pi) #permittivity of free space in farad/m
Uo=4*scipy.pi*10**-7 #permeability of free space
c=1/(scipy.sqrt(Uo*Eo)) #speed of light in m/s
kvect=kx*ax+ky*ay+kz*az #propogation vector in m^-1
Eo=100 #amplitude of electric field
#Calculations
k=round(scipy.sqrt(kx*kx+ky*ky+kz*kz),0) #magnitude of k in m^-1
w=k*c #omega in rad/sec
lam=2*scipy.pi/k #wavelength in m
Ho=cross(kvect,Eo*ax*10)/(Uo*w) #amplitude of magnetic field in mA/m
Hoy=round(dot(Ho,ay),2) #y component of Ho
Hoz=round(dot(Ho,az),1) #z component of Ho
Hr=array([0,Hoy,Hoz]) #Ho with components rounded off
P=Eo**2/(2*120*scipy.pi)*kvect #average power in W/m^2
Py=round(dot(P,ay),2) #y component of P
Pz=round(dot(P,az),3) #z component of P
Pr=array([0,Py,Pz]) #P with components rounded off
#Results
print 'w =',w,'rad/sec'
print 'lambda =',round(lam,3),'m'
print 'The magnetic field component =',Hr,'e^j(0.866x-0.5z) mA/m'
print 'The time average power in the wave =',Pr,'W/m^2'
import scipy
#Variable Declaration
ax=array([1,0,0]) #Unit vector along x direction
ay=array([0,1,0]) #Unit vector along y direction
az=array([0,0,1]) #Unit vector along z direction
Ei=8 #incident wave amplitude
k=5 #propogation constant
Eo=10**-9/36*scipy.pi #permittivity of free space
Erel=2.5 #relative permittivity
muo=4*scipy.pi*10**-7 #permeability of free space
mur=1 #relative permeability
c=3*10**8 #speed of light
etao=377
#Calculations
w=k*c #frequency in rad
theta=scipy.arctan(4/3.0) #angle of incidence in rad
eta1=etao
eta2=377/scipy.sqrt(2.5)
thetai=scipy.arcsin(sin(theta)/scipy.sqrt(2.5))
gamm=(eta2*cos(theta)-eta1*cos(thetai))/(eta2*cos(theta)+eta1*cos(thetai))
Er=Ei*gamm #reflected E field amplitude in V/m
kt=w*scipy.sqrt(mur*Erel)/c
tao=2*eta2*cos(theta)/((eta2*cos(theta)+eta1*cos(thetai)))
Et=tao*Ei*ay
Ht=cross((4*ax+6.819*az)/(eta2*kt),Et)*10**3
Htx=round(dot(Ht,ax),2)
Hty=round(dot(Ht,ay),2)
Htz=round(dot(Ht,az),2)
Htc=array([Htx,Hty,Htz]) #transmitted H field amplitude
#Results
print 'Polarisation is perpendicular polarization'
print 'Angle of incidence is ',round(180*theta/scipy.pi,2),'degrees'
print 'Er =',round(Er,3),'cos(',w,'t - 4x + 3z) V/m'
print 'Ht =',Htc,'cos(',w,'t - 4x - 6.819z) mA/m'