# Chapter 1 ELECTROMAGNETIC THEORY¶

## example 1.1,page no.17¶

In [1]:
# program to calculate wavelength , phase velocity and wave impedence .
from math import pi,sqrt

f=3*10**9;
mur =3;
muo =4*pi*10**-7;
eipsilao =8.854*10**-12;
eipsilar =7;
mue=muo*mur;
eipsila=eipsilao*eipsilar;
Vp=sqrt(1/(mue*eipsila));
lamda=Vp/f;
eta=sqrt(mue/eipsila);
#Result
print"phase velocity in meter per second= %.2e "%Vp;
# phase velocity .
print"wavelength in meter= %.2e "%lamda # wavelength.
print"wave impedence in ohm= %.2e "%eta # wave impedence .

phase velocity in meter per second= 6.54e+07
wavelength in meter= 2.18e-02
wave impedence in ohm= 2.47e+02


## example:−1.2 page no.−20¶

In [2]:
# progarm to find out skin depth of aluminium, copper , gold and silver at frequency 10GHZ.
from math import sqrt

f=10*10**9;
muo=4*pi*10**-7; # permeability in free space.
omega=2*pi*f;
sigma_aluminium =3.816*10**7;
sigma_copper =5.813*10**7;
sigma_gold =4.098*10**7;
sigma_silver =6.173*10**7;
delta1=sqrt(2/(omega*muo*sigma_aluminium));
delta2=sqrt(2/(omega*muo*sigma_copper));
delta3=sqrt(2/(omega*muo*sigma_gold));
delta4=sqrt(2/(omega*muo*sigma_silver));
#result
print"skin depth of aluminium in meter=%.2e "%delta1; # skin depth of aluminium
print"skin depth of copper in meter= %.2e"%delta2; # skin depth of copper .
print"skin depth of gold in meter= %.2e"%delta3; #skin depth of gold .
print"skin depth of silver in meter= %.2e"%delta4; # skin depth of silver .

skin depth of aluminium in meter=8.15e-07
skin depth of copper in meter= 6.60e-07
skin depth of gold in meter= 7.86e-07
skin depth of silver in meter= 6.41e-07


## example:−1.3 page no.−24¶

In [3]:
#program to find the resulting fields by assuming plane waves on either side of the current sheet and enforcing the boundary conditions.
from sympy import symbols,Matrix,exp,I

E,x,E1,E2,H1,H2,z,Jo,A,B,N,n,ko,y,l,m = symbols('E,x,E1,E2,H1,H2,z,Jo,A,B,N,n,ko,y,l,m');
E1=A*N*exp(I*ko*z)*x; # x component of elec tricfield (region z<0).
H1=A*N*exp(I*ko*z)*(-y); # y component of magnetic field (region z<0).
E2=B*N*exp(-I*ko*z)*x;# x component of electric field (region z>0).
H2=B*N*exp(-I*ko*z)*y;  # y component of electric field (region z>0).
print "for z<0, E1=",E1
print "for z<0, H1=",H1
print "for z>0, E2=",E2
print "for z>0, H2=",H2
#from boundary conditions
c=Matrix([[-1,-1],[1,-1]]);
d=Matrix([[A],[B]]);
d=c.inv()*Matrix([[Jo],[0]]);
print d;
#result
# A=−Jo/2; B=−Jo/2.

for z<0, E1= A*N*x*exp(I*ko*z)
for z<0, H1= -A*N*y*exp(I*ko*z)
for z>0, E2= B*N*x*exp(-I*ko*z)
for z>0, H2= B*N*y*exp(-I*ko*z)
Matrix([[-Jo/2], [-Jo/2]])


## example:−1.4 page no.−38.¶

In [4]:
# program to compute propagation constan , impedence , skin depth , reflection and transmission coefficient
from sympy import I
from numpy import pi,sqrt

f=1*10**9;
omega=2*pi*f;
sigma=5.813*10**7; # for copper .
mue=4*pi*10**-7; # permeability in free space.
delta=sqrt(2/(mue*sigma*omega)); # skin depth .
gama=((1+I)/delta); # propagation constant .
eta=gama/sigma; # impedence
etao=377; # intrinsic impedence in free space .
tao=((eta-etao)/(eta+etao)); # reflection coefficient .
t=(2*eta)/(eta+etao); # transmission coefficient
# result
print "skin depth in meter= %.3e"%delta
print "propagation comstant =",gama
print "intrinsic impedence in ohm=",eta
print "reflection coefficient=",tao
print "transmission coefficient= ",t

skin depth in meter= 2.087e-06
propagation comstant = 479049.101381194 + 479049.101381194*I
intrinsic impedence in ohm= 0.00824099606711155 + 0.00824099606711155*I
reflection coefficient= (-376.991759003933 + 0.00824099606711155*I)/(377.008240996067 + 0.00824099606711155*I)
transmission coefficient=  (0.0164819921342231 + 0.0164819921342231*I)/(377.008240996067 + 0.00824099606711155*I)


## example:−1.5 page no.−42.¶

In [6]:
# example:−2.7.page no.−50.
# program to plot the reflection coefficients for parallel and perpendicular polarized plane waves incident from free space on to a dielectric region with Er=2.55,versus incidence angle.

%matplotlib inline
from pylab import plot,subplot,title,xlabel,ylabel
from sympy import acos,asin
import numpy as n
import math as m

Er=2.55; # relaitve permittivity of dielectric medium .
N1=377.; # intrinsic impedence
N2=N1/m.sqrt(Er); # intrinsic impedence of dielectric medium.
xb=asin(m.sqrt(1./(1.+1/2.55)));# brewster angle valid only in case of parallel polarization.
xt=acos(m.sqrt(1.-(1./Er)**2.*m.sin(xb))); # angle of transmission .
xi=n.arange(0,m.pi/2,0.05); # incidence
print "The wave impendaces are %d ohm , %d ohm"%(N1,N2)
# for parallel polarization angle .
N2=N2*m.cos(xt);
N1=N1*n.cos(xi);
Tpar=(N2-N1)/(N2+N1);
w=abs(Tpar);

# result
subplot(121)
title ('parallel polarization');
xlabel('xi(incidence angle)');
ylabel('Tpar(reflection coefficient)');
plot(xi,w)
# for perpendicular polarization .
#NOTE:− in case of this polarization . there is no brewster angle .
xt=acos(n.sqrt(1-(1/Er)**2.*m.sin(xb)));
n1=377.*m.cos(xt);
n2=(377/m.sqrt(Er))*n.cos(xi);
Tper=(n2-n1)/(n1+n2);
z=abs(Tper);
#result
subplot(122)

title ('perpendicular polarization');
xlabel('xi(incidence angle)');
#ylabel('Tper(reflection coefficient)');
plot(xi,z);

The wave impendaces are 377 ohm , 236 ohm