import scipy
import scipy.integrate
#Variable Declaration
r1= 0.2 # radius of hemispherical shell in metres
r2= 0.1 # radius of spherical shell in metres
#Calculations
#Calculation of current through hemispherical shell
def J1(phi,theta):
s1=(1/r1)*(2* scipy.cos(theta)* scipy.sin(theta))
return s1
if __name__ == '__main__':
I1, error = scipy.integrate.dblquad(lambda theta , phi: J1(phi,theta),
0, 2*scipy.pi, lambda theta: 0, lambda theta: scipy.pi/2)
#Calculation of current through spherical shell
def J2(phi,theta):
s2=(1/r2)*(2* scipy.cos(theta)* scipy.sin(theta))
return s2
if __name__ == '__main__':
I2, error = scipy.integrate.dblquad(lambda theta , phi: J1(phi,theta),
0, 2*scipy.pi, lambda theta: 0, lambda theta: scipy.pi)
#Results
print 'Current through hemispherical shell=',round(I1,1),'A'
print 'Current through spherical shell=',round(I2,0),'A'
#Variable Declaration
ps=10**-7 #Surface charge density of the belt in Couloumb/metre^2
u=2 #Speed of the belt in metres/sec
w=0.1 #Width of the belt in metres
t=5 #Time taken in seconds
#Calculations
I=ps*u*w #Current in amperes
Q=I*t*10**9 #Charge collected in 5 seconds in nano Coloumbs
#Result
print "The charge collected in 5 seconds is ",Q,"nC"
#Variable Declaration
n=10**29 #Number density of electrons in m^-3
e=-1.6*10**-19 #Electronic charge in Coloumbs
sigma=5*10**7 #Current density in S/m
E=10**-2 #Electric Field in V/m
S=(3.14*10**-6)/4 #Cross sectional area of the wire in m^2
#Calculations
pv=n*e #Charge density of free electrons in C/m^3
J=sigma*E*10**-3 #Current density in kA/m^2
I=J*S*10**3 #Current in amperes
u=J*10**3/pv #Drift velocity in m/s
#Results
print "The charge density is ",pv,"C/m^3"
print "The current density is ",J,"kA/m^2"
print "The current is ",round(I,3), "A"
print "The drift velocity is ",-u,"m/s"
import scipy
#Variable Declaration
l=4 #Length of the lead bar in m
d=3 #Width of the lead bar in cm
r=0.5 #Radius of the hole drilled in cm
sigma=5*10**6 #Conductivity of the bar in S/m
#Calculation
S=(d**2-(scipy.pi*r**2)) #Cross sectional area in cm^2
R=l/(S*sigma*10**-4) #Resistance in ohms
#Result
print 'The resistance between the square ends is',round(R*10**6),'micro ohms'
import scipy
#Variable Declaration
e0=10**-9/(36*scipy.pi) #permittivity of free space in Farad/m
er=2.55 #relative permittivity (dimensionless)
E=10*10**3 #Electric field in V/m
chi=er-1.0 #Electric susceptibility (dimensionless)
d=1.5 #Distance between plates in mm
#Calculations
D=e0*er*E*10**9 #D in nC/m^2
P=chi*e0*E*10**9 #P in nC/m^2
ps=D #The surface charge density of
#free charge in nC/m^2
pps =P #The surface charge density of
#polarization charge in nC/m^2
V=E*d*10**-3 #The potential difference between
#the plates in volts
#Results
print 'D =',round(D,2),'nC/m^2'
print 'P =',round(P,0),'nC/m^2'
print 'Surface charge density of free charge =',round(ps,2),'nC/m^2'
print 'Surface charge density of polarization charge =',round(pps,0),'nC/m^2'
print 'The potential difference between the plates =',V,'V'
import scipy
#Variable Declaration
e0=10**-9/(36*scipy.pi) #permittivity of free space
#in Farad/m
er=5.7 #relative permittivity
#(dimensionless)
chi=er-1 #Electric susceptibility
#(dimensionless)
r=0.1 #radius of sphere in m
q1=2 #charge on sphere in pC
q2=-4 #value of point charge in pC
#Calculations
E=q1/(4*scipy.pi*e0*er*r**2) #Electric field on the
#sphere in pV/m
P=chi*e0*E #Polarisation in pC/m^2
pps=P #The surface density of polarization
#charge in pC/m^2
F=(q1*q2*10**-12)/(4*scipy.pi*e0*er*r**2) #Force exerted on point charge in pN
#Results
print 'The surface density of polarization'
print 'charge on the surface of the sphere =',round(pps,2),'pC/m^2'
print 'Force exerted on -4 pC charge =',round(F,3),'pN in the radial direction'
#Variable Declarartion
import scipy
from numpy import *
an=array([0,0,1]) #Unit vector normal to the interface
E1=array([5,-2,3]) #Electric field for z >=0 in kV/m
e_r1=4 #Relative permittivity for z >=0 (dimensionless)
e_r2=3 #Relative permittivity for z <=0 (dimensionless)
e0=(10**-9)/(36*scipy.pi) #Permittivity of free space in Farad/m
V=2*2*2 #Volume of cube placed in region 2 in m^3
#Calculations
E1n=array([0,0,dot(E1,an)]) #The normal component of E1 in kV/m
E1t=E1-E1n #Transverse component of E1 in kV/m
E2t=E1t #Transverse component of E2 in kV/m
E2n=e_r1*E1n/e_r2 #Normal Component of E2 in kV/m
E2=E2n+E2t #The total field E2 in kV/m
theta1= 90- 180*scipy.arccos(dot(E1,an)/ #Angle between E1 and
scipy.sqrt(dot(E1,E1)))/scipy.pi #interface in degrees
theta2= 90- 180*scipy.arccos(dot(E2,an)/ #Angle between E2 and
scipy.sqrt(dot(E2,E2)))/scipy.pi #interface in degrees
We1= 0.5*e0*e_r1*dot(E1,E1)*10**6 # The energy density of E1 in J/m^3
We2= 0.5*e0*e_r2*dot(E2,E2)*10**6 # The energy density of E2 in J/m^3
W= We2*V # The energy within the cube in J
#Results
print 'The electric field for the region z <=0 is',E2,'kV/m'
print 'The angle E1 makes with the boundary is',round(theta1,1),'degrees'
print 'The angle E2 makes with the boundary is',round(theta2,1),'degrees'
print 'The energy density in dielectric 1 is',round(We1*10**6,0),'J/m^3'
print 'The energy density in dielectric 2 is',round(We2*10**6,0),'J/m^3'
print 'The energy within the cube is',round(W*1000,3),'mJ'
import scipy
#Variable Declaration
e=(10**-9)/(36*scipy.pi) #Permittivity of free space in Farad/m
er=2 #Relative permittivity (dimensionless)
ps=2 #Surface charge in nC/m^2
#Calculations
#Point A is in the region y <=0. Hence E=D=0
#For point B which is in the region y >=0,
Dn=ps #Displacement current in nC/m^2
En=Dn*10**-9/(e*er) #Electric Field
#Result
print 'E at point A= 0'
print 'D at point A= 0'
print 'E at point B=',round(En,2),'V/m along positive y direction'
print 'D at point B=',Dn,'nC/m^2 along positive y direction'