{ "metadata": { "name": "", "signature": "sha256:25d377db4166fc7d1439fb19889672d7cd5de596e5478e8198d3671878cf5493" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "

Chapter 9: Maxwells Equations

" ] }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 9.1, Page number: 375" ] }, { "cell_type": "code", "collapsed": false, "input": [ " \n", "import scipy\n", "import scipy.integrate\n", "\n", "#Variable Declaration\n", "\n", "u2=20\n", "B2=4\n", "l=0.06\n", "#Calculations\n", "\n", "def ansa(x,y): \n", " return 4*10**3\n", "Va, erra = scipy.integrate.dblquad(lambda y , x: ansa(x,y), #in V \n", " 0, 0.06, lambda y: 0, lambda y: 0.08)\n", "\n", "Vb=-u2*B2*l #in mV\n", "\n", "def ansc(x,y): \n", " return 4\n", "psic, errc = scipy.integrate.dblquad(lambda y , x: ansc(x,y), #in mWb \n", " 0, 0.06, lambda y: 0, lambda y: 1)\n", "\n", "#Results\n", "\n", "print 'Va =',Va,'sin(10^6t) V'\n", "print 'Vb =',Vb,'mV'\n", "print 'Vc= ',psic*10**3,'cos(10^6t-y) -',psic*10**3,'cos(10^6t) V'\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Va = 19.2 sin(10^6t) V\n", "Vb = -4.8 mV\n", "Vc= 240.0 cos(10^6t-y) - 240.0 cos(10^6t) V\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Example 9.3, Page number: 379" ] }, { "cell_type": "code", "collapsed": false, "input": [ " \n", "import scipy\n", "\n", "#Variable Declaration\n", "\n", "n1=200\n", "n2=100 \n", "S=10**-3 #cross section in m^2\n", "muo=4*scipy.pi*10**-7 #permeabiility of free space\n", "mur=500 #relative permeability\n", "r=10*10**-3 #radius in m\n", "\n", "#Calculations\n", "\n", "psiI=n1*muo*mur*S/(2*scipy.pi*r)\n", "\n", "#Result\n", "\n", "print 'V2 =',psiI*n2*300*scipy.pi,'cos(100pi t) V'\n", "print '= 6Pi cos(100pi t) V'\n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "V2 = 188.495559215 cos(100pi t) V\n", "= 6Pi cos(100pi t) V\n" ] } ], "prompt_number": 6 }, { "cell_type": "markdown", "metadata": {}, "source": [ "

Example 9.5, Page number: 393

" ] }, { "cell_type": "code", "collapsed": false, "input": [ " \n", "import scipy\n", "import cmath\n", "from numpy import *\n", "\n", "\n", "#Variable Declaration\n", "\n", "z3=1j\n", "z4=3+4j \n", "z5=-1+6j \n", "z6=3+4j\n", "z7=1+1j\n", "z8=4-8j\n", "\n", "#Calculations\n", "\n", "z1=(z3*z4/(z5*z6))\n", "z2=scipy.sqrt(z7/z8)\n", "z1r=round(z1.real,4) #real part of z1 rounded to 4 decimal places\n", "z1i=round(z1.imag,4) #imaginary part of z1 rounded to 4 decimal places\n", "z2r=round(z2.real,4) #real part of z2 rounded to 4 decimal places\n", "z2i=round(z2.imag,4) #imaginary part of z2 rounded to 4 decimal places\n", "\n", "absz2=round(abs(z2),4) #absolute value of z2 rounded to 4 decimal places\n", "\n", "ang=scipy.arctan(z2i/z2r)*180/scipy.pi #in degrees\n", "\n", "#Results\n", "\n", "print 'z1 =',z1r,'+',z1i,'j'\n", "print 'z2 ='\n", "print 'mod =',absz2,'and angle=',round(ang,1),'degrees'" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "z1 = 0.1622 + -0.027 j\n", "z2 =\n", "mod = 0.3976 and angle= 54.2 degrees\n" ] } ], "prompt_number": 1 } ], "metadata": {} } ] }