diff options
author | debashisdeb | 2014-06-20 15:42:42 +0530 |
---|---|---|
committer | debashisdeb | 2014-06-20 15:42:42 +0530 |
commit | 83c1bfceb1b681b4bb7253b47491be2d8b2014a1 (patch) | |
tree | f54eab21dd3d725d64a495fcd47c00d37abed004 /Elements_of_Electromagnetics/chapter_5.ipynb | |
parent | a78126bbe4443e9526a64df9d8245c4af8843044 (diff) | |
download | Python-Textbook-Companions-83c1bfceb1b681b4bb7253b47491be2d8b2014a1.tar.gz Python-Textbook-Companions-83c1bfceb1b681b4bb7253b47491be2d8b2014a1.tar.bz2 Python-Textbook-Companions-83c1bfceb1b681b4bb7253b47491be2d8b2014a1.zip |
removing problem statements
Diffstat (limited to 'Elements_of_Electromagnetics/chapter_5.ipynb')
-rw-r--r-- | Elements_of_Electromagnetics/chapter_5.ipynb | 989 |
1 files changed, 467 insertions, 522 deletions
diff --git a/Elements_of_Electromagnetics/chapter_5.ipynb b/Elements_of_Electromagnetics/chapter_5.ipynb index 882e9145..db757859 100644 --- a/Elements_of_Electromagnetics/chapter_5.ipynb +++ b/Elements_of_Electromagnetics/chapter_5.ipynb @@ -1,523 +1,468 @@ -{
- "metadata": {
- "name": "chapter_5.ipynb"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h1>Chapter 5: Electric Fields in Material Space<h1>"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 5.1, Page number: 167<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "If the current density J=1/r^3(2cos(theta) a_r + sin(theta) a_t) Ampere/m^2,\n",
- "calculate the current passing through\n",
- "(a) A hemispherical shell of radius 20 cm.\n",
- "(b) A spherical shell of radius 10 cm. '''\n",
- "\n",
- "import scipy\n",
- "import scipy.integrate\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "r1= 0.2 # radius of hemispherical shell in metres\n",
- "r2= 0.1 # radius of spherical shell in metres\n",
- "\n",
- "#Calculations\n",
- "\n",
- "#Calculation of current through hemispherical shell \n",
- "\n",
- "def J1(phi,theta):\n",
- "\ts1=(1/r1)*(2* scipy.cos(theta)* scipy.sin(theta))\n",
- "\treturn s1\n",
- "\n",
- "if __name__ == '__main__':\n",
- "\n",
- " I1, error = scipy.integrate.dblquad(lambda theta , phi: J1(phi,theta), \n",
- " 0, 2*scipy.pi, lambda theta: 0, lambda theta: scipy.pi/2) \n",
- "\t \n",
- "#Calculation of current through spherical shell \n",
- "\n",
- "def J2(phi,theta):\n",
- "\ts2=(1/r2)*(2* scipy.cos(theta)* scipy.sin(theta))\n",
- "\treturn s2\n",
- "\n",
- "if __name__ == '__main__':\n",
- "\n",
- " I2, error = scipy.integrate.dblquad(lambda theta , phi: J1(phi,theta), \n",
- " 0, 2*scipy.pi, lambda theta: 0, lambda theta: scipy.pi) \n",
- "\t \n",
- "#Results\n",
- "\n",
- "print 'Current through hemispherical shell=',round(I1,1),'A' \n",
- "print 'Current through spherical shell=',round(I2,0),'A'\n",
- "\t"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Current through hemispherical shell= 31.4 A\n",
- "Current through spherical shell= 0.0 A\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 5.2, Page number: 168<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "A typical example of convective charge transport is found \n",
- "in the Van de Graaff generator where charge is transported \n",
- "on a moving belt from the base to the dome.\n",
- "If a surface charge density 10^7 C/m^2 is transported at a velocity of 2 m/s, \n",
- "calculate the charge collected in 5 s. Take the width of the belt as 10 cm. '''\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "ps=10**-7 #Surface charge density of the belt in Couloumb/metre^2\n",
- "u=2 #Speed of the belt in metres/sec\n",
- "w=0.1 #Width of the belt in metres\n",
- "t=5 #Time taken in seconds \n",
- "\n",
- "#Calculations\n",
- "\n",
- "I=ps*u*w #Current in amperes\n",
- "Q=I*t*10**9 #Charge collected in 5 seconds in nano Coloumbs\n",
- "\n",
- "#Result\n",
- "\n",
- "print \"The charge collected in 5 seconds is \",Q,\"nC\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The charge collected in 5 seconds is 100.0 nC\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 5.3, Page number: 169<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "A wire of diameter 1mm and conductivity 5X10^7 S/m has 10^29 \n",
- "free electrons/m^3 when an electric field of 10mV /m is applied. Determine \n",
- "(a) The charge density of free electrons \n",
- "(b) The current density \n",
- "(c) The current in the wire \n",
- "(d) The drift velocity of the electrons. \n",
- "Take the electronic charge as e = -1.6X10^-19 C. '''\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "n=10**29 #Number density of electrons in m^-3\n",
- "e=-1.6*10**-19 #Electronic charge in Coloumbs\n",
- "sigma=5*10**7 #Current density in S/m\n",
- "E=10**-2 #Electric Field in V/m\n",
- "S=(3.14*10**-6)/4 #Cross sectional area of the wire in m^2\n",
- "\n",
- "#Calculations\n",
- "\n",
- "pv=n*e #Charge density of free electrons in C/m^3\n",
- "J=sigma*E*10**-3 #Current density in kA/m^2\n",
- "I=J*S*10**3 #Current in amperes\n",
- "u=J*10**3/pv #Drift velocity in m/s\n",
- "\n",
- "#Results\n",
- "\n",
- "print \"The charge density is \",pv,\"C/m^3\" \n",
- "print \"The current density is \",J,\"kA/m^2\" \n",
- "print \"The current is \",round(I,3), \"A\"\n",
- "print \"The drift velocity is \",-u,\"m/s\" "
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The charge density is -16000000000.0 C/m^3\n",
- "The current density is 500.0 kA/m^2\n",
- "The current is 0.393 A\n",
- "The drift velocity is 3.125e-05 m/s\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 5.4, Page number: 170<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "A lead (sigma=5X10^6 S/m) bar of square cross section has a\n",
- "hole bored along its length of 4 cm so that its cross section \n",
- "becomes a square of side 3 cm with a hole of diameter 1 cm \n",
- "drilled through the centre,\n",
- "Find the resistance between the square ends. '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "l=4 #Length of the lead bar in m\n",
- "d=3 #Width of the lead bar in cm\n",
- "r=0.5 #Radius of the hole drilled in cm\n",
- "sigma=5*10**6 #Conductivity of the bar in S/m\n",
- "\n",
- "#Calculation\n",
- "\n",
- "S=(d**2-(scipy.pi*r**2)) #Cross sectional area in cm^2\n",
- "R=l/(S*sigma*10**-4) #Resistance in ohms\n",
- "\n",
- "#Result\n",
- "\n",
- "print 'The resistance between the square ends is',round(R*10**6),'micro ohms'\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The resistance between the square ends is 974.0 micro ohms\n"
- ]
- }
- ],
- "prompt_number": 4
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 5.6, Page number: 177<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "The electric field intensity in polystyrene (epsilon_r= 2.55) filling\n",
- "the space between the plates of a parallel-plate capacitor is 10 kV/m. \n",
- "The distance between the plates is 1.5 mm. Calculate: \n",
- "(a) D \n",
- "(b) P \n",
- "(c) The surface charge density of free charge on the plates \n",
- "(d) The surface density of polarization charge \n",
- "(e) The potential difference between the plates '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "e0=10**-9/(36*scipy.pi) #permittivity of free space in Farad/m\n",
- "er=2.55 #relative permittivity (dimensionless)\n",
- "E=10*10**3 #Electric field in V/m\n",
- "chi=er-1.0 #Electric susceptibility (dimensionless)\n",
- "d=1.5 #Distance between plates in mm\n",
- "\n",
- "#Calculations\n",
- "\n",
- "D=e0*er*E*10**9 #D in nC/m^2\n",
- "\n",
- "P=chi*e0*E*10**9 #P in nC/m^2\n",
- "\n",
- "ps=D #The surface charge density of \n",
- " #free charge in nC/m^2\n",
- " \n",
- "pps =P #The surface charge density of\n",
- " #polarization charge in nC/m^2\n",
- " \n",
- "V=E*d*10**-3 #The potential difference between \n",
- " #the plates in volts\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'D =',round(D,2),'nC/m^2'\n",
- "print 'P =',round(P,0),'nC/m^2'\n",
- "print 'Surface charge density of free charge =',round(ps,2),'nC/m^2'\n",
- "print 'Surface charge density of polarization charge =',round(pps,0),'nC/m^2'\n",
- "print 'The potential difference between the plates =',V,'V'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "D = 225.47 nC/m^2\n",
- "P = 137.0 nC/m^2\n",
- "Surface charge density of free charge = 225.47 nC/m^2\n",
- "Surface charge density of polarization charge = 137.0 nC/m^2\n",
- "The potential difference between the plates = 15.0 V\n"
- ]
- }
- ],
- "prompt_number": 5
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 5.7, Page number: 178<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "A dielectric sphere (epsilon_r = 5.7) of radius 10 cm \n",
- "has a point charge 2 pC placed at its center. \n",
- "Calculate: \n",
- "(a)The surface density of polarization charge on\n",
- " the surface of the sphere \n",
- "(b)The force exerted by the charge on a -4 pC \n",
- " point charge placed on the sphere '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "e0=10**-9/(36*scipy.pi) #permittivity of free space\n",
- " #in Farad/m\n",
- " \n",
- "er=5.7 #relative permittivity\n",
- " #(dimensionless)\n",
- " \n",
- "chi=er-1 #Electric susceptibility\n",
- " #(dimensionless)\n",
- " \n",
- "r=0.1 #radius of sphere in m\n",
- "\n",
- "q1=2 #charge on sphere in pC\n",
- "\n",
- "q2=-4 #value of point charge in pC\n",
- "\n",
- "#Calculations\n",
- "\n",
- "E=q1/(4*scipy.pi*e0*er*r**2) #Electric field on the\n",
- " #sphere in pV/m\n",
- " \n",
- "P=chi*e0*E #Polarisation in pC/m^2\n",
- "\n",
- "pps=P #The surface density of polarization \n",
- " #charge in pC/m^2\n",
- " \n",
- "F=(q1*q2*10**-12)/(4*scipy.pi*e0*er*r**2) #Force exerted on point charge in pN\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'The surface density of polarization'\n",
- "print 'charge on the surface of the sphere =',round(pps,2),'pC/m^2'\n",
- "print 'Force exerted on -4 pC charge =',round(F,3),'pN in the radial direction'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The surface density of polarization\n",
- "charge on the surface of the sphere = 13.12 pC/m^2\n",
- "Force exerted on -4 pC charge = -1.263 pN in the radial direction\n"
- ]
- }
- ],
- "prompt_number": 6
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 5.9, Page number: 188<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Two extensive homogeneous isotropic dielectrics meet on \n",
- "plane z = O. For z >=0, epsilon_r1 = 4 and for z <= 0, \n",
- "epsilon_r2 = 3. A uniform electric field E1= 5 a_x - 2 a_y + 3 a_z kV/m \n",
- "exists for z >= O. Find \n",
- "(a) E2 for z <= 0 \n",
- "(b) The angles El and E2 make with the interface \n",
- "(c) The energy densities in J/m^3 in both dielectrics \n",
- "(d) The energy within a cube of side 2 m centered at (3,4,-5) '''\n",
- "\n",
- "#Variable Declarartion\n",
- "\n",
- "import scipy\n",
- "from numpy import *\n",
- "\n",
- "an=array([0,0,1]) #Unit vector normal to the interface\n",
- "E1=array([5,-2,3]) #Electric field for z >=0 in kV/m\n",
- "e_r1=4 #Relative permittivity for z >=0 (dimensionless)\n",
- "e_r2=3 #Relative permittivity for z <=0 (dimensionless)\n",
- "e0=(10**-9)/(36*scipy.pi) #Permittivity of free space in Farad/m\n",
- "V=2*2*2 #Volume of cube placed in region 2 in m^3\n",
- "\n",
- "#Calculations\n",
- "\n",
- "E1n=array([0,0,dot(E1,an)]) #The normal component of E1 in kV/m\n",
- "E1t=E1-E1n #Transverse component of E1 in kV/m\n",
- "E2t=E1t #Transverse component of E2 in kV/m\n",
- "E2n=e_r1*E1n/e_r2 #Normal Component of E2 in kV/m\n",
- "E2=E2n+E2t #The total field E2 in kV/m\n",
- "\n",
- "theta1= 90- 180*scipy.arccos(dot(E1,an)/ #Angle between E1 and \n",
- " scipy.sqrt(dot(E1,E1)))/scipy.pi #interface in degrees\n",
- " \n",
- "theta2= 90- 180*scipy.arccos(dot(E2,an)/ #Angle between E2 and \n",
- " scipy.sqrt(dot(E2,E2)))/scipy.pi #interface in degrees\n",
- "\n",
- "\n",
- "We1= 0.5*e0*e_r1*dot(E1,E1)*10**6 # The energy density of E1 in J/m^3\n",
- "We2= 0.5*e0*e_r2*dot(E2,E2)*10**6 # The energy density of E2 in J/m^3\n",
- "W= We2*V # The energy within the cube in J\n",
- "\n",
- "#Results\n",
- "\n",
- "print 'The electric field for the region z <=0 is',E2,'kV/m'\n",
- "print 'The angle E1 makes with the boundary is',round(theta1,1),'degrees'\n",
- "print 'The angle E2 makes with the boundary is',round(theta2,1),'degrees'\n",
- "print 'The energy density in dielectric 1 is',round(We1*10**6,0),'J/m^3'\n",
- "print 'The energy density in dielectric 2 is',round(We2*10**6,0),'J/m^3'\n",
- "print 'The energy within the cube is',round(W*1000,3),'mJ'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "The electric field for the region z <=0 is [ 5 -2 4] kV/m\n",
- "The angle E1 makes with the boundary is 29.1 degrees\n",
- "The angle E2 makes with the boundary is 36.6 degrees\n",
- "The energy density in dielectric 1 is 672.0 J/m^3\n",
- "The energy density in dielectric 2 is 597.0 J/m^3\n",
- "The energy within the cube is 4.775 mJ\n"
- ]
- }
- ],
- "prompt_number": 7
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "<h3>Example 5.10, Page number: 190<h3>"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "'''\n",
- "Region y <= 0 consists of a perfect conductor while region y >= 0 \n",
- "is a dielectric medium (epsilon_1r = 2). If there is a surface charge\n",
- "of 2 nC/m^2 on the conductor, determine E and D at \n",
- "(a) A(3, -2,2) \n",
- "(b) B(-4, 1,5) '''\n",
- "\n",
- "import scipy\n",
- "\n",
- "#Variable Declaration\n",
- "\n",
- "e=(10**-9)/(36*scipy.pi) #Permittivity of free space in Farad/m\n",
- "er=2 #Relative permittivity (dimensionless)\n",
- "ps=2 #Surface charge in nC/m^2\n",
- "\n",
- "#Calculations\n",
- "\n",
- "#Point A is in the region y <=0. Hence E=D=0\n",
- "#For point B which is in the region y >=0,\n",
- "\n",
- "Dn=ps #Displacement current in nC/m^2\n",
- "En=Dn*10**-9/(e*er) #Electric Field\n",
- "\n",
- "#Result\n",
- "\n",
- "print 'E at point A= 0'\n",
- "print 'D at point A= 0'\n",
- "print 'E at point B=',round(En,2),'V/m along positive y direction'\n",
- "print 'D at point B=',Dn,'nC/m^2 along positive y direction'"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "E at point A= 0\n",
- "D at point A= 0\n",
- "E at point B= 113.1 V/m along positive y direction\n",
- "D at point B= 2 nC/m^2 along positive y direction\n"
- ]
- }
- ],
- "prompt_number": 8
- }
- ],
- "metadata": {}
- }
- ]
+{ + "metadata": { + "name": "", + "signature": "sha256:08d693988f55ded7946a3910c4b750b4a1419d79f72e5b56719c0d924a66fd5a" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "<h1>Chapter 5: Electric Fields in Material Space<h1>" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "<h3>Example 5.1, Page number: 167<h3>" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "import scipy.integrate\n", + "\n", + "#Variable Declaration\n", + "\n", + "r1= 0.2 # radius of hemispherical shell in metres\n", + "r2= 0.1 # radius of spherical shell in metres\n", + "\n", + "#Calculations\n", + "\n", + "#Calculation of current through hemispherical shell \n", + "\n", + "def J1(phi,theta):\n", + "\ts1=(1/r1)*(2* scipy.cos(theta)* scipy.sin(theta))\n", + "\treturn s1\n", + "\n", + "if __name__ == '__main__':\n", + "\n", + " I1, error = scipy.integrate.dblquad(lambda theta , phi: J1(phi,theta), \n", + " 0, 2*scipy.pi, lambda theta: 0, lambda theta: scipy.pi/2) \n", + "\t \n", + "#Calculation of current through spherical shell \n", + "\n", + "def J2(phi,theta):\n", + "\ts2=(1/r2)*(2* scipy.cos(theta)* scipy.sin(theta))\n", + "\treturn s2\n", + "\n", + "if __name__ == '__main__':\n", + "\n", + " I2, error = scipy.integrate.dblquad(lambda theta , phi: J1(phi,theta), \n", + " 0, 2*scipy.pi, lambda theta: 0, lambda theta: scipy.pi) \n", + "\t \n", + "#Results\n", + "\n", + "print 'Current through hemispherical shell=',round(I1,1),'A' \n", + "print 'Current through spherical shell=',round(I2,0),'A'\n", + "\t" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Current through hemispherical shell= 31.4 A\n", + "Current through spherical shell= 0.0 A\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "<h3>Example 5.2, Page number: 168<h3>" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#Variable Declaration\n", + "\n", + "ps=10**-7 #Surface charge density of the belt in Couloumb/metre^2\n", + "u=2 #Speed of the belt in metres/sec\n", + "w=0.1 #Width of the belt in metres\n", + "t=5 #Time taken in seconds \n", + "\n", + "#Calculations\n", + "\n", + "I=ps*u*w #Current in amperes\n", + "Q=I*t*10**9 #Charge collected in 5 seconds in nano Coloumbs\n", + "\n", + "#Result\n", + "\n", + "print \"The charge collected in 5 seconds is \",Q,\"nC\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The charge collected in 5 seconds is 100.0 nC\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "<h3>Example 5.3, Page number: 169<h3>" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#Variable Declaration\n", + "\n", + "n=10**29 #Number density of electrons in m^-3\n", + "e=-1.6*10**-19 #Electronic charge in Coloumbs\n", + "sigma=5*10**7 #Current density in S/m\n", + "E=10**-2 #Electric Field in V/m\n", + "S=(3.14*10**-6)/4 #Cross sectional area of the wire in m^2\n", + "\n", + "#Calculations\n", + "\n", + "pv=n*e #Charge density of free electrons in C/m^3\n", + "J=sigma*E*10**-3 #Current density in kA/m^2\n", + "I=J*S*10**3 #Current in amperes\n", + "u=J*10**3/pv #Drift velocity in m/s\n", + "\n", + "#Results\n", + "\n", + "print \"The charge density is \",pv,\"C/m^3\" \n", + "print \"The current density is \",J,\"kA/m^2\" \n", + "print \"The current is \",round(I,3), \"A\"\n", + "print \"The drift velocity is \",-u,\"m/s\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The charge density is -16000000000.0 C/m^3\n", + "The current density is 500.0 kA/m^2\n", + "The current is 0.393 A\n", + "The drift velocity is 3.125e-05 m/s\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "<h3>Example 5.4, Page number: 170<h3>" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "l=4 #Length of the lead bar in m\n", + "d=3 #Width of the lead bar in cm\n", + "r=0.5 #Radius of the hole drilled in cm\n", + "sigma=5*10**6 #Conductivity of the bar in S/m\n", + "\n", + "#Calculation\n", + "\n", + "S=(d**2-(scipy.pi*r**2)) #Cross sectional area in cm^2\n", + "R=l/(S*sigma*10**-4) #Resistance in ohms\n", + "\n", + "#Result\n", + "\n", + "print 'The resistance between the square ends is',round(R*10**6),'micro ohms'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The resistance between the square ends is 974.0 micro ohms\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "<h3>Example 5.6, Page number: 177<h3>" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "e0=10**-9/(36*scipy.pi) #permittivity of free space in Farad/m\n", + "er=2.55 #relative permittivity (dimensionless)\n", + "E=10*10**3 #Electric field in V/m\n", + "chi=er-1.0 #Electric susceptibility (dimensionless)\n", + "d=1.5 #Distance between plates in mm\n", + "\n", + "#Calculations\n", + "\n", + "D=e0*er*E*10**9 #D in nC/m^2\n", + "\n", + "P=chi*e0*E*10**9 #P in nC/m^2\n", + "\n", + "ps=D #The surface charge density of \n", + " #free charge in nC/m^2\n", + " \n", + "pps =P #The surface charge density of\n", + " #polarization charge in nC/m^2\n", + " \n", + "V=E*d*10**-3 #The potential difference between \n", + " #the plates in volts\n", + "\n", + "#Results\n", + "\n", + "print 'D =',round(D,2),'nC/m^2'\n", + "print 'P =',round(P,0),'nC/m^2'\n", + "print 'Surface charge density of free charge =',round(ps,2),'nC/m^2'\n", + "print 'Surface charge density of polarization charge =',round(pps,0),'nC/m^2'\n", + "print 'The potential difference between the plates =',V,'V'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "D = 225.47 nC/m^2\n", + "P = 137.0 nC/m^2\n", + "Surface charge density of free charge = 225.47 nC/m^2\n", + "Surface charge density of polarization charge = 137.0 nC/m^2\n", + "The potential difference between the plates = 15.0 V\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "<h3>Example 5.7, Page number: 178<h3>" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "e0=10**-9/(36*scipy.pi) #permittivity of free space\n", + " #in Farad/m\n", + " \n", + "er=5.7 #relative permittivity\n", + " #(dimensionless)\n", + " \n", + "chi=er-1 #Electric susceptibility\n", + " #(dimensionless)\n", + " \n", + "r=0.1 #radius of sphere in m\n", + "\n", + "q1=2 #charge on sphere in pC\n", + "\n", + "q2=-4 #value of point charge in pC\n", + "\n", + "#Calculations\n", + "\n", + "E=q1/(4*scipy.pi*e0*er*r**2) #Electric field on the\n", + " #sphere in pV/m\n", + " \n", + "P=chi*e0*E #Polarisation in pC/m^2\n", + "\n", + "pps=P #The surface density of polarization \n", + " #charge in pC/m^2\n", + " \n", + "F=(q1*q2*10**-12)/(4*scipy.pi*e0*er*r**2) #Force exerted on point charge in pN\n", + "\n", + "#Results\n", + "\n", + "print 'The surface density of polarization'\n", + "print 'charge on the surface of the sphere =',round(pps,2),'pC/m^2'\n", + "print 'Force exerted on -4 pC charge =',round(F,3),'pN in the radial direction'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The surface density of polarization\n", + "charge on the surface of the sphere = 13.12 pC/m^2\n", + "Force exerted on -4 pC charge = -1.263 pN in the radial direction\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "<h3>Example 5.9, Page number: 188<h3>" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#Variable Declarartion\n", + "\n", + "import scipy\n", + "from numpy import *\n", + "\n", + "an=array([0,0,1]) #Unit vector normal to the interface\n", + "E1=array([5,-2,3]) #Electric field for z >=0 in kV/m\n", + "e_r1=4 #Relative permittivity for z >=0 (dimensionless)\n", + "e_r2=3 #Relative permittivity for z <=0 (dimensionless)\n", + "e0=(10**-9)/(36*scipy.pi) #Permittivity of free space in Farad/m\n", + "V=2*2*2 #Volume of cube placed in region 2 in m^3\n", + "\n", + "#Calculations\n", + "\n", + "E1n=array([0,0,dot(E1,an)]) #The normal component of E1 in kV/m\n", + "E1t=E1-E1n #Transverse component of E1 in kV/m\n", + "E2t=E1t #Transverse component of E2 in kV/m\n", + "E2n=e_r1*E1n/e_r2 #Normal Component of E2 in kV/m\n", + "E2=E2n+E2t #The total field E2 in kV/m\n", + "\n", + "theta1= 90- 180*scipy.arccos(dot(E1,an)/ #Angle between E1 and \n", + " scipy.sqrt(dot(E1,E1)))/scipy.pi #interface in degrees\n", + " \n", + "theta2= 90- 180*scipy.arccos(dot(E2,an)/ #Angle between E2 and \n", + " scipy.sqrt(dot(E2,E2)))/scipy.pi #interface in degrees\n", + "\n", + "\n", + "We1= 0.5*e0*e_r1*dot(E1,E1)*10**6 # The energy density of E1 in J/m^3\n", + "We2= 0.5*e0*e_r2*dot(E2,E2)*10**6 # The energy density of E2 in J/m^3\n", + "W= We2*V # The energy within the cube in J\n", + "\n", + "#Results\n", + "\n", + "print 'The electric field for the region z <=0 is',E2,'kV/m'\n", + "print 'The angle E1 makes with the boundary is',round(theta1,1),'degrees'\n", + "print 'The angle E2 makes with the boundary is',round(theta2,1),'degrees'\n", + "print 'The energy density in dielectric 1 is',round(We1*10**6,0),'J/m^3'\n", + "print 'The energy density in dielectric 2 is',round(We2*10**6,0),'J/m^3'\n", + "print 'The energy within the cube is',round(W*1000,3),'mJ'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The electric field for the region z <=0 is [ 5 -2 4] kV/m\n", + "The angle E1 makes with the boundary is 29.1 degrees\n", + "The angle E2 makes with the boundary is 36.6 degrees\n", + "The energy density in dielectric 1 is 672.0 J/m^3\n", + "The energy density in dielectric 2 is 597.0 J/m^3\n", + "The energy within the cube is 4.775 mJ\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "<h3>Example 5.10, Page number: 190<h3>" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "e=(10**-9)/(36*scipy.pi) #Permittivity of free space in Farad/m\n", + "er=2 #Relative permittivity (dimensionless)\n", + "ps=2 #Surface charge in nC/m^2\n", + "\n", + "#Calculations\n", + "\n", + "#Point A is in the region y <=0. Hence E=D=0\n", + "#For point B which is in the region y >=0,\n", + "\n", + "Dn=ps #Displacement current in nC/m^2\n", + "En=Dn*10**-9/(e*er) #Electric Field\n", + "\n", + "#Result\n", + "\n", + "print 'E at point A= 0'\n", + "print 'D at point A= 0'\n", + "print 'E at point B=',round(En,2),'V/m along positive y direction'\n", + "print 'D at point B=',Dn,'nC/m^2 along positive y direction'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "E at point A= 0\n", + "D at point A= 0\n", + "E at point B= 113.1 V/m along positive y direction\n", + "D at point B= 2 nC/m^2 along positive y direction\n" + ] + } + ], + "prompt_number": 8 + } + ], + "metadata": {} + } + ] }
\ No newline at end of file |