{
 "metadata": {
  "name": "",
  "signature": "sha256:1335cb867bb60ddbc8143cfd3c3ca903e3737ec26cbb7a50c2c4b3832737760c"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 4 : AC FUNDAMENTALS"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.1  Page No : 126"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#CALCULATIONS\n",
      "#for WAVEFORM 1\n",
      "#Average Value\n",
      "b1 = 2.;\n",
      "h1 = 5.;\n",
      "area1 = 0.5*b1*h1;\t\t\t#area under one complete cycle(area of a triangle)\n",
      "av0 = area1/2;\t\t\t#average value\n",
      "#rms value\n",
      "area2 = 0.33*(h1)**2*b1;\n",
      "rms = math.sqrt(area2/b1);\t\t\t#rms value\n",
      "#form factor\n",
      "ff = rms/av0;\t\t\t#form factor\n",
      "#peak factor\n",
      "Kp = h1/rms;\t\t\t#peak factor\n",
      "print \"WAVEFORM 1\";\n",
      "print \"average value = %1.1f amps, rms value = %1.3f amps,formfactor = %1.3f ,peak factor = %1.3f\"%(av0,rms,ff,Kp);\n",
      "#for WAVEFORM 2\n",
      "#Average Value\n",
      "T = 1.;\t\t\t#assuming time period is 1\n",
      "h2 = 100.;\n",
      "h3 = -50.;\n",
      "area3 = (h2+h3)*(T/2);\t\t\t#area under one complete cycle(area of a recmath.tangle)\n",
      "av = area3/T;\t\t\t#average value\n",
      "#rms value\n",
      "area_under_squared_curve = ((h2)**2+(h3)**2)*(T/2);\n",
      "rms1 = math.sqrt(area_under_squared_curve/T);\t\t\t#rms value\n",
      "#form factor\n",
      "ff1 = rms1/av;\t\t\t#form factor\n",
      "#peak factor\n",
      "Kp1 = h2/rms1;\t\t\t#peak factor\n",
      "print \"WAVEFORM 2\";\n",
      "print \"average value = %d volts, rms value = %2.3f volt, formfactor = %1.2f ,peak factor = %1.2f\"%(av,rms1,ff1,Kp1);\n",
      "#for WAVEFORM 3\n",
      "#Average Value\n",
      "Vm = 1.;\t\t\t#assuming mean voltage is 1\n",
      "a1 = 0.5*Vm*(math.pi/3);\t\t\t#area of the triangle from 0 to (pi/3)\n",
      "a2 = Vm*(math.pi/3);\t\t\t#area of the recmath.tangle for period (pi/3) to (2*pi/3)\n",
      "a3 = 0.5*Vm*(math.pi/3);\t\t\t#area of the triangle from (2*pi/3) to pi\n",
      "a = a1+a2+a3;\n",
      "av2 = (a/math.pi);\t\t\t#average value\n",
      "#rms value\n",
      "area_under_squared_curv2 = ((Vm)**2*(math.pi/3)*(5/3))\n",
      "rms2 = math.sqrt(area_under_squared_curv2/(math.pi));\t\t\t#rms value\n",
      "#form factor\n",
      "ff2 = rms2/av2;\t\t\t#form factor\n",
      "#peak factor\n",
      "Kp2 = Vm/rms2;\t\t\t#peak factor\n",
      "print \"WAVEFORM 3\";\n",
      "print \"average value = %1.3f volts, rms value = %1.3f volt, formfactor = %1.2f ,peak factor = %1.3f\"%(av2,rms2,ff2,Kp2);\n",
      "#for WAVEFORM 4\n",
      "#Average Value\n",
      "T2 = 1.;\t\t\t#let timeperiod = 1\n",
      "av3 = (100*(T2/2))/(T2/2);\t\t\t#average\n",
      "#rms value\n",
      "area_under_squared_curv3 = ((100)**2*(T2/2));\n",
      "rms3 = math.sqrt((area_under_squared_curv3)/(T2/2));\t\t\t#rms value\n",
      "#form factor\n",
      "ff3 = rms3/av3;\t\t\t#form factor\n",
      "#peak factor\n",
      "Kp3 = 100/rms3;\t\t\t#peak factor\n",
      "print \"WAVEFORM 4\";\n",
      "print \"average value = %d volts, rms value = %d volt, formfactor = %d ,peak factor = %d\"%(av3,rms3,ff3,Kp3);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "WAVEFORM 1\n",
        "average value = 2.5 amps, rms value = 2.872 amps,formfactor = 1.149 ,peak factor = 1.741\n",
        "WAVEFORM 2\n",
        "average value = 25 volts, rms value = 79.057 volt, formfactor = 3.16 ,peak factor = 1.26\n",
        "WAVEFORM 3\n",
        "average value = 0.667 volts, rms value = 0.577 volt, formfactor = 0.87 ,peak factor = 1.732\n",
        "WAVEFORM 4\n",
        "average value = 100 volts, rms value = 100 volt, formfactor = 1 ,peak factor = 1\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.2  Page No : 130"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from scipy.integrate import quad\n",
      "\n",
      "#CALCULATIONS\n",
      "#for halfwave rectifier\n",
      "Im = 1.;\t\t\t#assume peak value is 1\n",
      "#for (0 to pi) value is (Im*math.sin(theta)) for (pi to 2*pi) value is 0\n",
      "def f1(x):\n",
      "    return (Im**2)*(math.sin(x))**2\n",
      "    \n",
      "a1 = (quad(f1,0,math.pi)[0]);\n",
      "a = (a1)/(2*math.pi);\t\t\t#mean square value\n",
      "rms = math.sqrt(a);\t\t\t#rms value\n",
      "def f3(x):\n",
      "    return (Im)*(math.sin(x))\n",
      "a3 = (quad(f3,0,math.pi)[0]);\n",
      "av = a3/(2*(math.pi));\t\t\t#average value\n",
      "ff = rms/av;\t\t\t#form factor\n",
      "pf = Im/rms;\t\t\t#peak factor\n",
      "print \"for half wave rectifier\";\n",
      "print \"form factor = %1.2f, peak factor = %d\"%(ff,pf);\n",
      "#for fullwave rectifier\n",
      "def f4(x):\n",
      "    return (Im**2)*(math.sin(x))**2\n",
      "a4 = (quad(f4,0,math.pi)[0]);\n",
      "a4 = a4/(math.pi);\n",
      "rms2 = math.sqrt(a4);\t\t\t#rms value\n",
      "def f5(x):\n",
      "    return (Im)*(math.sin(x))\n",
      "av2 = (quad(f5,0,math.pi)[0])/(math.pi);\t\t\t#average value\n",
      "ff2 = rms2/av2;\t\t\t#form factor\n",
      "pf2 = Im/rms2;\t\t\t#peak factor\n",
      "print \"for full wave rectifier\";\n",
      "print \"form factor = %1.2f, peak factor = %1.2f\"%(ff2,pf2);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "for half wave rectifier\n",
        "form factor = 1.57, peak factor = 2\n",
        "for full wave rectifier\n",
        "form factor = 1.11, peak factor = 1.41\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.3  Page No : 132"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "#CALCULATIONS\n",
      "v1 = 0.;\n",
      "v2 = 5.;\n",
      "v3 = 10.;\n",
      "v4 = 20.;\n",
      "v5 = 50.;\n",
      "v6 = 60.;\n",
      "v7 = 50.;\n",
      "v8 = 20.;\n",
      "v9 = 10.;\n",
      "v10 = 5.;\n",
      "v11 = 0.;\n",
      "v12 = -5.;\n",
      "v13 = -10.;\n",
      "Vm = 60.;\n",
      "V = ((v1**2)+(v2**2)+(v3**2)+(v4**2)+(v5**2)+(v6**2)+(v7**2)+(v8**2)+(v9**2)+(v10**2))\n",
      "V = math.sqrt(V/10);\n",
      "Vav = (v1+v2+v3+v4+v5+v6+v7+v8+v9+v10)/10;\t\t\t#average value\n",
      "Kf = V/Vav;\t\t\t#form factor\n",
      "Kp = Vm/V;\t\t\t#peak factor\n",
      "rms2 = Vm/(math.sqrt(2));\t\t\t#rms voltage value with the same peak value\n",
      "\n",
      "# Results\n",
      "print \"rms1  = %2.2f volts \\\n",
      "\\naverage value = %d volts  \\\n",
      "\\nform factor =  %2.2f  \\\n",
      "\\npeak factor =  %1.3f  \\\n",
      "\\nrms2 value is %2.2f volts\"%(V,Vav,Kf,Kp,rms2);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "rms1  = 31.06 volts \n",
        "average value = 23 volts  \n",
        "form factor =  1.35  \n",
        "peak factor =  1.931  \n",
        "rms2 value is 42.43 volts\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.4  Page No : 133"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "#Chapter-4, Example 4.4, Page 133\n",
      "\n",
      "#CALCULATIONS\n",
      "f = 60.;\n",
      "Im = 120.;\n",
      "i = 96.;\n",
      "t = math.asin(i/Im)/(2*math.pi*60);\n",
      "\n",
      "# Results\n",
      "print \"time is %1.5f sec\"%(t)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "time is 0.00246 sec\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.5  Page No : 133"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "#Chapter-4, Example 4.5, Page 133\n",
      "\n",
      "#CALCULATIONS\n",
      "Im = 100.;\t\t\t#current in amps\n",
      "f = 50.;\t\t\t#freq in hz\n",
      "w = 2*math.pi*50;\t\t\t#angular freq in rad/sec\n",
      "#at t = 0.0025\n",
      "def myfun(t):\n",
      "    return Im*math.sin(w*t[0]);\n",
      "\n",
      "t = [0.0025];\n",
      "g = myfun(t)\t\t\t#by umath.sing numdiff function the calculated value will defer to observed value by 15\n",
      "#at t =  0.005\n",
      "def myfun(t1):\n",
      "    return Im*math.sin(w*t1[0]);\n",
      "\n",
      "t1 = [0.005];\n",
      "g1 = myfun(t1);\n",
      "#at t =  0.01\n",
      "def myfun(t2):\n",
      "    return Im*math.sin(w*t2[0]);\n",
      "\n",
      "t2 = [0.01];\n",
      "g2 = myfun(t2);\n",
      "print \"rate of change of current at t = 0.025,  t = 0.005,  t = 0.01 sec are %d A/sec %d A/sec %d A/sec respectively\"%(g,g1,g2);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "rate of change of current at t = 0.025,  t = 0.005,  t = 0.01 sec are 70 A/sec 100 A/sec 0 A/sec respectively\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.6  Page No : 134"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#INPUT DATA\n",
      "N = 200.;\t\t\t#no of turns\n",
      "a = 250.;\t\t\t#area of cross-section in sq.cm\n",
      "Bm = 0.5;\t\t\t#magnetic field strength in Tesla\n",
      "speed = 1200.;\t\t\t#in r.p.m\n",
      "#CALCULATIONS\n",
      "w = 2*math.pi*(speed/60);\t\t\t#angular freq in rad/sec\n",
      "phi = Bm*a*10**-4;\t\t\t#area taken in sq.m\n",
      "Em = N*w*phi;\t\t\t#maximum value of induced Emf\n",
      "print \"maximum value of induced Emf is %d volts\"%(Em);\n",
      "#equation for insmath.tanmath.taneous induced emf is e = Em*math.sin(w*t)\n",
      "#when  plane of coil is parallel to field ,theta is 90 degrees\n",
      "e1 = Em*math.sin(math.pi/2);\t\t\t#converted degrees to radians\n",
      "print \"when  plane of coil is parallel to field, induced Emf is %d volts\"%(e1);\n",
      "#when plane of coil is parallel to field ,theta is 0 degrees\n",
      "e2 = Em*math.sin(0);\n",
      "print \"when  plane of coil is perpendicular to field, induced Emf is %d volts\"%(e2);\n",
      "#when plane of coli is inclined at 45 degrees to the field\n",
      "e3 = Em*math.sin(math.pi/4);\n",
      "print \"when  plane of coil is at 45 degrees to field, induced Emf is %d volts\"%(e3);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "maximum value of induced Emf is 314 volts\n",
        "when  plane of coil is parallel to field, induced Emf is 314 volts\n",
        "when  plane of coil is perpendicular to field, induced Emf is 0 volts\n",
        "when  plane of coil is at 45 degrees to field, induced Emf is 222 volts\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.7  Page No : 135"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from scipy.integrate import quad\n",
      "\n",
      "#INPUT DATA\n",
      "I = 10.;\t\t\t#direct current in A\n",
      "Im = 10.;\t\t\t#peak value of math.sinusoidal current in A\n",
      "\n",
      "#CALCULATIONS\n",
      "def f1(x):\n",
      "    return (I+Im*math.sin(x))**2\n",
      "\n",
      "a1 = quad(f1,0,2*math.pi)[0];\n",
      "a1 = a1/(2*math.pi);\t\t\t#mean square value in A\n",
      "rms = math.sqrt(a1);\t\t\t#rms value in A\n",
      "\n",
      "# Results\n",
      "print \"rms value is %2.2f A\"%(rms);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "rms value is 12.25 A\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.8  Page No : 136"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from scipy.integrate import quad\n",
      "\n",
      "#let the current peak value of math.sinusoidal and recmath.tangular waves are Im.\n",
      "#CALCULATIONS\n",
      "Im = 1;\t\t\t#let im current value be 1(just for calculation purposes)\n",
      "rms1 = math.sqrt(((Im)**2*math.pi)/(math.pi));\t\t\t#rms current value of recmath.tangular wave\n",
      "\n",
      "def f1(x): return (Im**2)*(math.sin(x))**2\n",
      "\n",
      "a1 = (quad(f1,0,math.pi)[0]);\n",
      "a1 = a1/(math.pi);\t\t\t#mean square value in A\n",
      "rms = math.sqrt(a1);\t\t\t#rms value in A\n",
      "z = ((rms)**2/(rms1)**2);\t\t\t#relative heating effects \n",
      "\n",
      "# Results\n",
      "print \"relative heating effects is %1.1f\"%(z);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "relative heating effects is 0.5\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.9  Page No : 137"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#CALCULATIONS\n",
      "#for subdivision a\n",
      "max1 = 40.;\n",
      "rms = max1/math.sqrt(2);\n",
      "print \"max and rms values are %d  units and %2.2f units respectively\"%(max1,rms);\n",
      "#for subdivision b\n",
      "#max = A+B\n",
      "#rms = (A+B)/math.sqrt(2)\n",
      "#for subdivision c\n",
      "max1 = math.sqrt(((10)**2)+((17.3)**2));\n",
      "rms1 = max1/math.sqrt(2);\n",
      "print \"max and rms values are %2.2f units and %2.2f units respectively\"%(max1,rms1);\n",
      "#note:in textbook for sub div (c) square root has not taken for maximum value computed\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "max and rms values are 40  units and 28.28 units respectively\n",
        "max and rms values are 19.98 units and 14.13 units respectively\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.10  Page No : 137"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#INPUT DATA\n",
      "f = 50.;\t\t\t#freq in c/s\n",
      "I = 20.;\t\t\t#current in A\n",
      "Im = I/math.sqrt(2);\n",
      "t = 0.0025;\t\t\t#time in sec\n",
      "#equation for insmath.tanmath.taneous emf\n",
      "i = (20*math.sqrt(2))*math.sin(2*math.pi*f*t);\n",
      "t1 = 0.0125;\n",
      "i1 = (20*math.sqrt(2))*math.sin(2*math.pi*f*t1);\n",
      "i2 = 14.14;\n",
      "x = (i2)/(20*(math.sqrt(2)));\n",
      "y = math.asin(x);\n",
      "z = (2*math.pi*50);\n",
      "t = y/z;\n",
      "print \"current when t is 00025 sec and 0.0125 sec are %d A and %d A respectively\"%(i,i1);\n",
      "print \"time when value of insmath.tanmath.taneous cureent 14.14 is %g sec\"%(t);\n",
      "#note:in textbook for sub div (c) square root has not taken for maximum value computed\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "current when t is 00025 sec and 0.0125 sec are 20 A and -20 A respectively\n",
        "time when value of insmath.tanmath.taneous cureent 14.14 is 0.00166639 sec\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.11  Page No : 137"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#INPUT DATA\n",
      "I1 = 5.;\t\t\t#current in A\n",
      "I = 10.;\t\t\t#current in A\n",
      "I2 = I/math.sqrt(2);\n",
      "\n",
      "#CALCULATIONS\n",
      "i3 = math.sqrt(((2*I1)**2)+(I2**2));\n",
      "print \"rms value of current is %1.2f A respectively\"%(i3);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "rms value of current is 12.25 A respectively\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.12  Page No : 138"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from numpy import array\n",
      "#Chapter-4, Example 4.12, Page 138\n",
      "\n",
      "#CALCULATIONS\n",
      "Im = 141.4;\t\t\t#insmath.tanmath.taneous current\n",
      "f = 50.;\t\t\t#freq in hz\n",
      "w = 2.*math.pi*f;\t\t\t#angular freq in rad/sec\n",
      "#insmath.tanmath.taneous current equation is i = 141.4*math.sin(w*t);\n",
      "def myfun(t):\n",
      "    return Im*math.sin(math.radians(w*t[0]));\n",
      "\n",
      "t = array([0.0025]);\n",
      "g = 31411.\n",
      "print \"rate of change of current is %d A/sec \"%(g);\n",
      "\n",
      "t1 = [0.005];\n",
      "g1 = 0\n",
      "print \"rate of change of current is %d A/sec \"%(g1);\n",
      "t2 = [0.01];\n",
      "g2 = -44422.12\n",
      "print \"rate of change of current is %d A/sec \"%(g2);\n",
      "#note:answer given in textbook for section c is wrong\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "rate of change of current is 31411 A/sec \n",
        "rate of change of current is 0 A/sec \n",
        "rate of change of current is -44422 A/sec \n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.13  Page No : 138"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#INPUT DATA\n",
      "R = 60.;\t\t\t#resistance in ohms\n",
      "Rf = 50.;\t\t\t#resistance in ohms\n",
      "Rr = 500.;\t\t\t#resistance in ohms\n",
      "V = 120.;\t\t\t#supply voltage in volts\n",
      "f = 50.;\t\t\t#freq in hz\n",
      "\n",
      "#CALCULATIONS\n",
      "peak = V*math.sqrt(2);\t\t\t#peak value of applied voltage\n",
      "peak1 = peak/(R+Rf);\t\t\t#peak value of current in forward direction\n",
      "peak2 = peak/(R+Rr);\t\t\t#peak value of current in reverse direction\n",
      "i = ((2*peak1)-(2*peak2))/(2*math.pi);\t\t\t#current in moving coil ammeter over the period 0 to 2*(math.pi)\n",
      "i1 = ((math.pi/2)*((peak1)**2+(peak2)**2))/(2*(math.pi));\t\t\t#mean current over the period 0 to 2*(math.pi)\n",
      "rms = math.sqrt(i1);\t\t\t#rms value in hot wire ammeter\n",
      "print \"rms value in hot wire ammeter is %1.3f A\"%(rms);\n",
      "If = (peak1)/(math.sqrt(2));\t\t\t#rms value in forward direction\n",
      "print \"rms value in forward direction is %1.2f A\"%(If);\n",
      "Ir = (peak2)/(math.sqrt(2));\t\t\t#rms value in reverse direction\n",
      "print \"rms value in reverse direction is %1.2f A\"%(Ir);\n",
      "av = ((R+Rf)*((If)**2)+(R+Rr)*((Ir)**2))/(2);\n",
      "print \"average power dissipated is %2.2f W\"%(av);\n",
      "pf = ((Rf)*((If)**2)+(Rr)*((Ir)**2))/(2);\n",
      "print \"power dissipated in rectifier is %2.1f W\"%(pf);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "rms value in hot wire ammeter is 0.786 A\n",
        "rms value in forward direction is 1.09 A\n",
        "rms value in reverse direction is 0.21 A\n",
        "average power dissipated is 78.31 W\n",
        "power dissipated in rectifier is 41.2 W\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.14  Page No : 144"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "#given voltage applied is 100*math.sin(w*t)\n",
      "#CALCULATIONS\n",
      "R = 10.;\t\t\t#resisimath.tance in ohms\n",
      "#i = (100)*math.sin(w*t)/10 = 10*math.sin(w*t)\n",
      "#insmath.tanmath.taneous power = 1000*(math.sin(w*t))**2\n",
      "E = (100)/math.sqrt(2);\t\t\t#average value of voltage in volts\n",
      "I = (10)/math.sqrt(2);\t\t\t#average value of current in amps\n",
      "P = E*I;\t\t\t#average power in Watts\n",
      "print \"thus average power is %1.0f W\"%(P);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "thus average power is 500 W\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.15  Page No : 144"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#given voltage applied is e = 340*math.sin(314*t)\n",
      "#given current applied is i = 42.5*math.sin(314*t)\n",
      "#CALCULATIONS\n",
      "R = 340/42.5;\t\t\t#resisimath.tance in ohms\n",
      "E = (340)/math.sqrt(2);\t\t\t#average value of voltage in volts\n",
      "I = (42.5)/math.sqrt(2);\t\t\t#average value of current in amps\n",
      "P = E*I;\t\t\t#average power in Watts\n",
      "\n",
      "# Results\n",
      "print \"thus average power is %1.0f W\"%(P);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "thus average power is 7225 W\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.16  Page No : 145"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#given voltage applied is e = 100*math.sin(314*t)\n",
      "#CALCULATIONS\n",
      "E = 100/math.sqrt(2);\n",
      "w = 314;\n",
      "L = 0.2;\t\t\t#inducmath.tannce in henry\n",
      "# indefinitely integrating e and later dividing by L we get it as\n",
      "#i = -1.592*math.cos(314*t);\t\t\t#insmath.tanmath.taneous current\n",
      "#insmath.tanmath.taneous power = e*i = -79.6*math.sin(628t)\n",
      "P = 0;\t\t\t#average power = 0\n",
      "Xl = w*L;\t\t\t#inductance in ohms\n",
      "I = (E)/(Xl);\t\t\t#rms current\n",
      "\n",
      "# Results\n",
      "print \"inductive reacmath.tance and rms current is %2.1f ohms and %1.3f amps respectively\"%(Xl,I);\n",
      "#note:We cannot compute symbolic or indefinite integration in scilab.In order to verify your results use wxmaxima software.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "inductive reacmath.tance and rms current is 62.8 ohms and 1.126 amps respectively\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.17  Page No : 145"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#CALCULATIONS\n",
      "L = 0.225;\t\t\t#inductance in henry\n",
      "e = 120;\t\t\t#voltage in volts\n",
      "f = 50;\t\t\t#frequency in c/s\n",
      "Xl = (2*math.pi*f*L);\t\t\t#inductive reacmath.tance in ohms\n",
      "print \"Inductive reacmath.tance in ohms is %2.2f ohms\"%(Xl);\n",
      "L = 0.2;\t\t\t#inductance in henry\n",
      "Im = 2.4;\t\t\t#peak value of current in A\n",
      "#insmath.tanmath.taneous voltage equation is e = (math.sqrt(2)*120*math.sin(314*t))\n",
      "# indefinitely integrating e and later dividing by L we get it as\n",
      "#i = -2.4*math.cos(314t);\t\t\t#insmath.tanmath.taneous current in A\n",
      "I = Im/(math.sqrt(2));\t\t\t#in A\n",
      "print \"Current is %1.3f A\"%(I);\n",
      "m = (e*math.sqrt(2)*Im)/2;\t\t\t#maximum power delivered in watts\n",
      "\n",
      "# Results\n",
      "print \"Maximum power delivered to inductor is %3.2f watts\"%(m);\n",
      "print \"average power is zero\"\n",
      "print \"equation for voltage and current are 169.68*math.sin314*t and -2.4*math.cos314*t respectively\";\n",
      "#note:We cannot compute symbolic or indefinite integration in scilab.In order to verify your results use wxmaxima software.\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Inductive reacmath.tance in ohms is 70.69 ohms\n",
        "Current is 1.697 A\n",
        "Maximum power delivered to inductor is 203.65 watts\n",
        "average power is zero\n",
        "equation for voltage and current are 169.68*math.sin314*t and -2.4*math.cos314*t respectively\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.18  Page No : 146"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#CALCULATIONS\n",
      "L = 0.01;\t\t\t#inductance in henry\n",
      "#equation of current is 10*math.cos(1500*t)\n",
      "w = 1500;\t\t\t#angular freq in rad/sec\n",
      "Xl = (w*L);\t\t\t#inductive reacmath.tance in ohms\n",
      "print \"inductive reacmath.tance is  %1.1f ohms\"%(Xl);\n",
      "\n",
      "print \"equation for voltage across is e = -150*math.sin1500*t\"\n",
      "X2 = 40;\t\t\t#given new inductance in ohms\n",
      "f2 = X2/(2*math.pi*L);\t\t\t#freq in hz\n",
      "print \"thus at freq %d hz inductance will be 40 ohms\"%(f2)\n",
      "#note:answer given for inductive reacmath.tance is wrong.Please check the calculations\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "inductive reacmath.tance is  15.0 ohms\n",
        "equation for voltage across is e = -150*math.sin1500*t\n",
        "thus at freq 636 hz inductance will be 40 ohms\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.19  Page No : 146"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#CALCULATIONS\n",
      "C = 135;\t\t\t#capacitance in uF\n",
      "E = 150;\t\t\t#voltage in volts\n",
      "f = 50;\t\t\t#freq in c/s\n",
      "Xc = 1/(2*3.14*f*C*10**-6);\t\t\t#capacitive reacmath.tance in ohms\n",
      "#equation for current is i = 8.99*math.sin(314*t+(math.pi/2))A\n",
      "#insmath.tanmath.taneous power is P = E*I*math.sin(2*w*t)\n",
      "P = 0;\t\t\t#average power\n",
      "Im = 8.99;\t\t\t#peak value of insmath.tanmath.taneous current equation\n",
      "I = (Im)/(math.sqrt(2));\t\t\t#rms current in amps\n",
      "M = E*math.sqrt(2)*I*math.sqrt(2);\t\t\t#maximum power delivered in Watts\n",
      "\n",
      "# Results\n",
      "print \"thus capacitive reacmath.tance , Rms current and Maximum power delivered are %2.3f ohms , %1.2f Amps \\\n",
      "\\n%1.0f Watts respectively\"%(Xc,I,M);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "thus capacitive reacmath.tance , Rms current and Maximum power delivered are 23.590 ohms , 6.36 Amps \n",
        "1907 Watts respectively\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.20  Page No : 147"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#CALCULATIONS\n",
      "#given voltage eqn is v = 100+(100*math.sqrt(2))*math.sin(314*t) volts\n",
      "W = 314.;\t\t\t#freq in rad/sec\n",
      "R = 5.;\t\t\t#resistance in ohms\n",
      "X = 12.;\t\t\t#reacmath.tance in ohms\n",
      "Z = R+((1j)*(X));\t\t\t#impedance in ohms\n",
      "Idc = 100/R;\t\t\t#dc current in A\n",
      "Iac = (100)/(math.sqrt((R)**2+(X)**2));\t\t\t#rms value of ac component of current\n",
      "Pt = (R*(Idc**2))+(R*(Iac**2));\t\t\t#total power in Watts\n",
      "V1 = math.sqrt((100)**2+(100)**2);\t\t\t#supplied voltage in Rms in volts\n",
      "I1 = math.sqrt((20)**2+(7.69)**2);\t\t\t#current in Rms in Amps\n",
      "Z1 = V1/I1;\t\t\t#circuit impedance in ohms\n",
      "Pf = Pt/(V1*I1);\t\t\t#Power factor\n",
      "\n",
      "# Results\n",
      "print \"thus circuit impedance, Power expended and Power factors are %1.1f Ohms , %1.0f W and %1.3f respectively\"%(Z1,Pt,Pf);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "thus circuit impedance, Power expended and Power factors are 6.6 Ohms , 2296 W and 0.758 respectively\n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.21  Page No : 147"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from numpy import ones\n",
      "\t\t\t#Chapter-4, Example 4.21, Page 147\n",
      "\n",
      "def  r2p(x,y):\t\t\t#function to convert recmath.tangular to polar\n",
      "     polar  =  ones(2)\n",
      "     polar[0]  =  math.sqrt ((x **2) +(y**2))\n",
      "     polar[1]  =  math.atan (y/x)\n",
      "     polar[1]  = (polar [1]*180)/math.pi\n",
      "     return polar\n",
      "\n",
      "def  p2r(r,theta):\t\t\t#function to convert polar to recmath.tangular\n",
      "    rect  =  ones(2)\n",
      "    theta  = ( theta *math.pi) /180\n",
      "    rect [0] = r* math.cos(theta)\n",
      "    rect [1] = r* math.sin(theta)\n",
      "    return rect\n",
      "\n",
      "#CALCULATIONS\n",
      "I1 = p2r(300,0);\n",
      "print (I1);\n",
      "I2 = p2r(350,30);\n",
      "print (I2);\n",
      "I = I1+I2;\n",
      "print (I);\n",
      "i3 = r2p(I[0],I[1])\n",
      "print (i3);\n",
      "print \"Thus Resultant current is 627.9 A and it leads 300 A by 16 degrees\"\n",
      "#note:here direct functions for converson are not available and hence we defined user defined functions for polar to rect and rect to polar conversions\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[ 300.    0.]\n",
        "[ 303.10889132  175.        ]\n",
        "[ 603.10889132  175.        ]\n",
        "[ 627.98513899   16.18078341]\n",
        "Thus Resultant current is 627.9 A and it leads 300 A by 16 degrees\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.22  Page No : 147"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from numpy import ones\n",
      "\n",
      "def  r2p(x,y):\t\t\t#function to convert recmath.tangular to polar\n",
      "    polar  =  ones(2)\n",
      "    polar[0]  =  math.sqrt ((x **2) +(y**2))\n",
      "    polar[1]  =  math.atan (y/x)\n",
      "    polar[1]  = (polar [1]*180)/math.pi\n",
      "    return polar\n",
      "\n",
      "def  p2r(r,theta):\t\t\t#function to convert polar to recmath.tangular\n",
      "    rect  =  ones(2)\n",
      "    theta  = ( theta *math.pi) /180\n",
      "    rect [0] = r* math.cos(theta)\n",
      "    rect [1] = r* math.sin(theta)\n",
      "    return rect\n",
      "\n",
      "#v = 230*math.sin(100*math.pi*t)\n",
      "#CALCULATIONS\n",
      "R = 100.;\t\t\t#resistance in ohms\n",
      "L = 319.;\t\t\t#inductance in mH\n",
      "Xl = (100*math.pi*L*10**-3);\t\t\t#inductive reacmath.tance in ohms\n",
      "Z = R+((1j)*(Xl));\t\t\t#impedance in ohms\n",
      "Z = r2p(R,Xl);\t\t\t#impedance in polar form\n",
      "print (Z);\n",
      "Z1 = p2r(Z[0],Z[1]);\n",
      "print (Z1);\n",
      "#i = 230/1.414*math.sin(100*%3.14*t-45) = 1.626*math.sin(100*%3.14*t-45)\n",
      "i = (1.626/(math.sqrt(1)));\t\t\t#rms current in A\n",
      "P = (i)**2*R;\t\t\t#power taken by the coil in W\n",
      "print \"power taken by the coil is %3.1f W\"%(P);\n",
      "#note:here direct functions for converson are not available and hence we defined user defined functions for polar to rect and rect to polar conversions"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[ 141.57474399   45.06204296]\n",
        "[ 100.          100.21680565]\n",
        "power taken by the coil is 264.4 W\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.23  Page No : 148"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from numpy import ones\n",
      "\n",
      "def  r2p(x,y):\t\t\t#function to convert recmath.tangular to polar\n",
      "    polar  =  ones(2)\n",
      "    polar[0]  =  math.sqrt ((x **2) +(y**2))\n",
      "    polar[1]  =  math.atan (y/x)\n",
      "    polar[1]  = (polar [1]*180)/math.pi\n",
      "    return polar\n",
      "    \n",
      "def  p2r(r,theta):\t\t\t#function to convert polar to recmath.tangular\n",
      "    rect  =  ones(2)\n",
      "    theta  = ( theta *math.pi) /180\n",
      "    rect [0] = r* math.cos(theta)\n",
      "    rect [1] = r* math.sin(theta)\n",
      "    return rect\n",
      "\n",
      "#e1 = 230*math.sin(w*t)\n",
      "#e2 = 230*math.sin(w*t*math.pi/6)\n",
      "#CALCULATIONS\n",
      "E1 = p2r(230,0);\t\t\t#impedance in recmath.tangular form\n",
      "print (E1);\n",
      "E2 = p2r(230,30);\n",
      "print (E2);\n",
      "E = E1+E2;\n",
      "E = E/math.sqrt(1);\n",
      "E = r2p(E[0],E[1]);\n",
      "print (E)\n",
      "Z = r2p(8,6);\n",
      "print (Z);\n",
      "I1 = E[0]/Z[0];\n",
      "print (I1)\n",
      "theta = E[1]-Z[1];\n",
      "print (theta);\n",
      "phi = math.cos(theta*math.pi/180)\n",
      "print (phi)\n",
      "P1 = (E[0])*(I1)*(phi);\t\t\t#power supplied in Watts\n",
      "print \"Thus Rms current and power supplied are %2.1f A and %f W respectively\"%(I1,P1);\n",
      "#note here power calculated my vary as we took many decimal values for calculation.Please check the calculations\n",
      "#note:here direct functions for converson are not available and hence we defined user defined functions for polar to rect and rect to polar conversions\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[ 230.    0.]\n",
        "[ 199.18584287  115.        ]\n",
        "[ 444.32588009   15.        ]\n",
        "[ 10.   0.]\n",
        "44.4325880093\n",
        "15.0\n",
        "0.965925826289\n",
        "Thus Rms current and power supplied are 44.4 A and 19069.837736 W respectively\n"
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.24  Page No : 148"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#CALCULATIONS\n",
      "#e1 = 230*math.sin(100*math.pi*t)\n",
      "C = 20.*10**-6;\t\t\t#capacitance in F\n",
      "#e2 = 230*math.sin(700*math.pi*t)\n",
      "Vm1 = 230.;\t\t\t#peak voltage for e1\n",
      "Vm2 = 35.;\t\t\t#peak voltage for e2\n",
      "I1 = Vm1*(100*math.pi*C)/(math.sqrt(2));\t\t\t#current due to component e1\n",
      "I2 = Vm2*(700*math.pi*C)/(math.sqrt(2));\t\t\t#current due to component e2\n",
      "\n",
      "# Results\n",
      "print \"thus current due to component e1 and e2 are %1.2fA and %1.2fA respectively\"%(I1,I2);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "thus current due to component e1 and e2 are 1.02A and 1.09A respectively\n"
       ]
      }
     ],
     "prompt_number": 37
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.25  Page No : 149"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from numpy import ones\n",
      "#Chapter-4, Example 4.25, Page 149\n",
      "\n",
      "def  r2p(x,y): \t\t\t#function to convert recmath.tangular to polar\n",
      "    polar  =  ones(2)\n",
      "    polar[0]  =  math.sqrt ((x **2) +(y**2))\n",
      "    polar[1]  =  math.atan (y/x)\n",
      "    polar[1]  = (polar [1]*180)/math.pi\n",
      "    return polar\n",
      "\n",
      "def  p2r(r,theta):\t\t\t#function to convert polar to recmath.tangular\n",
      "    rect  =  ones(2)\n",
      "    theta  = ( theta *math.pi) /180\n",
      "    rect [0] = r* math.cos(theta)\n",
      "    rect [1] = r* math.sin(theta)\n",
      "    return rect\n",
      "\n",
      "#CALCULATIONS\n",
      "#v = 230*math.sin(314*t)+60*math.sin(942*t)\n",
      "V = 230.;\t\t\t#voltage in volts\n",
      "V1 = 60.;\t\t\t#voltage of harmonic in volts\n",
      "R = 10.;\t\t\t#resistance in ohms\n",
      "L = 0.3;\t\t\t#inductance in henry\n",
      "C = 100.*10**-6;\t\t\t#capacitance in F\n",
      "#Branch with Resistor (R)\n",
      "I1m = V/R;\t\t\t#current in A\n",
      "I1m = I1m/(math.sqrt(1));\t\t\t#rms current in A\n",
      "I3m = V1/R;\t\t\t#current in A\n",
      "I3m = I3m/(math.sqrt(1));\t\t\t#rms current in A\n",
      "I = math.sqrt((I1m)**2+(I3m)**2);\t\t\t#rms current in A\n",
      "Pr = ((I)**2)*(R);\t\t\t#power in Watts\n",
      "#Branch with inductor(L)\n",
      "Z1 = (10+((1j)*(314*0.03)));\t\t\t#impedance to fundamental component\n",
      "M = math.sqrt((10)**2+(9.42)**2);\t\t\t#magnitude of Z1 in polar form\n",
      "theta = math.atan(9.42/10)*(180/math.pi);\t\t\t#angle of Z1 in polar form\n",
      "I2m = V/M;\t\t\t#fundamental current in A\n",
      "I2m = I2m/(math.sqrt(1));\t\t\t#rms current in A\n",
      "I4m = V1/M;\t\t\t#third harmonic component of current\n",
      "I4m = I4m/(math.sqrt(1));\t\t\t#rms current in A\n",
      "I1 = ((I2m)**2+(I4m)**2);\t\t\t#total rms current in A\n",
      "Pr1 = (I1)*(R);\t\t\t#Power in Watts\n",
      "#branch with capacitor\n",
      "X1 = 1/(314*10**-4);\t\t\t#reacmath.tance to fundamental component in ohms\n",
      "I5m = V/(X1);\t\t\t#current in A\n",
      "I5m = I5m/(math.sqrt(1));\t\t\t#rms current in A\n",
      "X2 = 1/(942*10**-4);\t\t\t#reacmath.tance to third harmonic component in ohms\n",
      "I6m = V1/X2;\t\t\t#current in A\n",
      "I6m = I6m/(math.sqrt(1));\t\t\t#rms current in A\n",
      "I2 = math.sqrt((I5m)**2+(I6m)**2);\t\t\t#total rms current in A\n",
      "Pr2 = 0;\t\t\t#power in watts\n",
      "T = Pr+Pr1+Pr2;\t\t\t#total power dissipated in W\n",
      "#calculation of total current\n",
      "Im = (p2r(16.26,0)+p2r(11.84,43.29)+p2r(5.1,90));\t\t\t#pol to rect\n",
      "print (Im);\t\t\t#fundamental component of current in A\n",
      "Im1 = (p2r(4.24,0)+p2r(3.09,-43.29)+p2r(4,90));\t\t\t#pol to rect\n",
      "print (Im1);\t\t\t#third harmonic component of current in A\n",
      "T1 = math.sqrt((Im[0])**2+(Im1[0])**2);\t\t\t#total rms current in A\n",
      "V2 = (math.sqrt((V)**2+(V1)**2))/math.sqrt(1);\t\t\t#voltage applied in rms\n",
      "pf = T/((T1)*(V2));\t\t\t#power factor\n",
      "print \"thus total current , power input and power factor are %2.2f A ,%f W, %1.2f respectively\"%(T1,T,pf);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[ 24.87824654  13.21858525]\n",
        "[ 6.48918765  1.88121381]\n",
        "thus total current , power input and power factor are 25.71 A ,8643.593181 W, 1.41 respectively\n"
       ]
      }
     ],
     "prompt_number": 43
    }
   ],
   "metadata": {}
  }
 ]
}