{
 "metadata": {
  "name": "",
  "signature": "sha256:46dd88e506b63134e24582a78d5a791547c8824340e8bb4b0b9ee7239c438783"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h1>Chapter 43: Magnetically coupled circuits</h1>"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 1, page no. 842</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "Na  =  1200;  \n",
      "Nb  =  1000;\n",
      "Ia  =  0.8;#  in  amperes\n",
      "Phia  =  100E-6;#  in  Wb\n",
      "xb  =  0.75;\n",
      "\n",
      " #calculation:\n",
      " #self  inductance  of  coil  A\n",
      "La  =  Na*Phia/Ia\n",
      " #mutual  inductance,  M\n",
      "Phib  =  xb*Phia\n",
      "M  =  Nb*Phib/Ia\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  self  inductance  of  coil  A  is  \",La,\"  H\"\n",
      "print  \"\\n  mutual  inductance,  M  is  \",M,\"H\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  self  inductance  of  coil  A  is   0.15   H\n",
        "\n",
        "  mutual  inductance,  M  is   0.09375 H"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 2, page no. 843</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "M  =  600E-3;#  in  Henry\n",
      "Ia  =  5;#  in  amperes\n",
      "dt  =  0.2;#  in  secs\n",
      "\n",
      " #calculation:\n",
      " #change  of  current\n",
      "dIa  =  2*Ia  \n",
      "dIadt  =  dIa/dt\n",
      " #secondary  induced  e.m.f.,  E2\n",
      "E2  =  -1*M*dIadt\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  secondary  induced  e.m.f.,  E2  is  \",E2,\"  V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  secondary  induced  e.m.f.,  E2  is   -30.0   V"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 3, page no. 844</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "La  =  250E-3;#  in  Henry\n",
      "Lb  =  400E-3;#  in  Henry\n",
      "M  =  80E-3;#  in  Henry\n",
      "\n",
      " #calculation:\n",
      " #coupling  coefficient,\n",
      "k  =  M/(La*Lb)**0.5\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  coupling  coefficient,  is  \",round(k,3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  coupling  coefficient,  is   0.253"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 4, page no. 845</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "Lx  =  80E-3;#  in  Henry\n",
      "Ly  =  60E-3;#  in  Henry\n",
      "Nx  =  200;#  turns\n",
      "Ny  =  100;#  turns\n",
      "Ix  =  4;#  in  Amperes\n",
      "Phiy  =  0.005;#  in  Wb\n",
      "\n",
      "#calculation:\n",
      " #mutual  inductance,  M\n",
      "M  =  Ny*Phiy/(2*Ix)\n",
      " #coupling  coefficient,\n",
      "k  =  M/(Lx*Ly)**0.5\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  mutual  inductance,  M  is  \",M*1E3,\"mH\"\n",
      "print  \"\\n  coupling  coefficient,  is  \",round(k,3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  mutual  inductance,  M  is   62.5 mH\n",
        "\n",
        "  coupling  coefficient,  is   0.902"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 5, page no. 846</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "La  =  40E-3;#  in  Henry\n",
      "Lb  =  10E-3;#  in  Henry\n",
      "L  =  60E-3;#  in  Henry\n",
      "\n",
      " #calculation:\n",
      " #mutual  inductance,  M\n",
      "M  =  (L  -  La  -  Lb)/2\n",
      " #coupling  coefficient,\n",
      "k  =  M/(La*Lb)**0.5\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  mutual  inductance,  M  is  \",M*1E3,\"mH\"\n",
      "print  \"\\n  coupling  coefficient,  is  \",k"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  mutual  inductance,  M  is   5.0 mH\n",
        "\n",
        "  coupling  coefficient,  is   0.25"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 6, page no. 847</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "V  =  240;#  in  Volts\n",
      "Ra  =  5;#  in  Ohm\n",
      "La  =  1;#  in  Henry\n",
      "Rb  =  10;#  in  Ohm\n",
      "Lb  =  5;#  in  Henry\n",
      "I  =  8;#  in  amperes\n",
      "dIdt  =  15;#  in  A/sec\n",
      "\n",
      " #calculation:\n",
      " #Kirchhoff\u2019s  voltage  law\n",
      "L  =  (V  -  I*(Ra  +  Rb))/dIdt\n",
      " #mutual  inductance,  M\n",
      "M  =  (L  -  La  -  Lb)/2\n",
      " #coupling  coefficient,\n",
      "k  =  M/(La*Lb)**0.5\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  mutual  inductance,  M  is  \",M,\"H\"\n",
      "print  \"\\n  coupling  coefficient,  is  \",round(k,3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  mutual  inductance,  M  is   1.0 H\n",
        "\n",
        "  coupling  coefficient,  is   0.447"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 7, page no. 848</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "k  =  0.7;#  coefficient  of  coupling\n",
      "L1  =  15E-3;#  in  Henry\n",
      "L2  =  10E-3;#  in  Henry\n",
      "\n",
      "#calculation:\n",
      " #L1  =  La  +  Lb  +  2*k*(La*Lb)**0.5\n",
      " #L2  =  La  +  Lb  -  2*k*(La*Lb)**0.5\n",
      " #self  inductance  of  coils\n",
      "a  =  ((L1  -  (L1    +  L2)/2)/(2*k))**2\n",
      "La1  =((L1    +  L2)/2  +  (((L1    +  L2)/2)**2  -  4*a)**0.5)/2\n",
      "La2  =((L1    +  L2)/2  -  (((L1    +  L2)/2)**2  -  4*a)**0.5)/2\n",
      "Lb1  =  (L1  +  L2)/2  -  La1\n",
      "Lb2  =  (L1  +  L2)/2  -  La2\n",
      " #mutual  inductance,  M\n",
      "M  =  (L1  -  L2)/4\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\nself  inductance  of  coils  are  \",round(La1*1E3,2),\"mH  and  \",round(  Lb1*1E3,2),\"mH\"\n",
      "print  \"\\n  mutual  inductance,  M  is  \",round(M*1E3,2),\"mH\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "self  inductance  of  coils  are   12.24 mH  and   0.26 mH\n",
        "\n",
        "  mutual  inductance,  M  is   1.25 mH\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 8, page no. 850</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "E1  =  8;#  in  Volts\n",
      "thetae1  =  0;#  in  degrees\n",
      "w  =  2500;#  in  rad/sec\n",
      "R  =  15;#  in  ohm\n",
      "L  =  5E-3;#  in  Henry\n",
      "M  =  0.1E-3;#  in  Henry\n",
      "\n",
      " #calculation:\n",
      " #voltage\n",
      "E1  =  E1*math.cos(thetae1*math.pi/180)  +  1j*E1*math.sin(thetae1*math.pi/180)\n",
      " #Impedance  of  primary\n",
      "Z1  =  R  + 1j*w*L\n",
      " #Primary  current  I1\n",
      "I1  =  E1/Z1\n",
      " #E2\n",
      "E2  =  1j*w*M*I1\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\nE2  is  \",round(abs(E2),3),\"/_\",round(cmath.phase(complex(E2.real,E2.imag))*180/math.pi,2),\"deg  V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "E2  is   0.102 /_ 50.19 deg  V"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 9, page no. 850</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "Lx  =  20E-3;#  in  Henry\n",
      "Ly  =  80E-3;#  in  Henry\n",
      "k  =  0.75;#  coupling  coeff.\n",
      "Ex  =  5;#  in  Volts\n",
      "\n",
      " #calculation:\n",
      " #mutual  inductance\n",
      "M  =  k*(Lx*Ly)**0.5\n",
      " #magnitude  of  the  open  circuit  e.m.f.  induced\n",
      "Ey  =  M*Ex/Lx\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  mutual  inductance  is  \",M,\"  H\"\n",
      "print  \"\\n  magnitude  of  the  open  circuit  e.m.f.  induced  is  \",Ey,\"  V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  mutual  inductance  is   0.03   H\n",
        "\n",
        "  magnitude  of  the  open  circuit  e.m.f.  induced  is   7.5   V"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 10, page no. 852</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "E1  =  2;#  in  Volts\n",
      "thetae1  =  0;#  in  degrees\n",
      "f  =  1000/math.pi;#  in  Hz\n",
      "R1  =  4;#  in  ohm\n",
      "R2  =  16;#  in  ohm\n",
      "R3  =  16;#  in  ohm\n",
      "R4  =  50;#  in  ohm\n",
      "L  =  10E-3;#  in  Henry\n",
      "M  =  2E-3;#  in  Henry\n",
      "\n",
      "#calculation:\n",
      "w  =  2*math.pi*f\n",
      " #R1e  is  the  real  part  of  Z1e\n",
      "R1e  =  R1  +  R2  +  ((R3  +  R4)*(M**2)*(w**2))/((R3  +  R4)**2  +  (w*L)**2)\n",
      " #X1e  is  the  imaginary  part  of  Z1e\n",
      "X1e  =  w*L  -  (L*(M**2)*(w**3))/((R3  +  R4)**2  +  (w*L)**2)\n",
      "Z1e  =  R1e  +  1j*X1e\n",
      "Z2e  =  R3  +  R4  +  1j*w*L\n",
      " #primary  current,  I1\n",
      "I1  =  E1/Z1e\n",
      " #E2\n",
      "E2  =  1j*w*M*I1\n",
      " #secondary  current  I2\n",
      "I2  =  E2/Z2e\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"secondary  current  I2  is  \",round(abs(I2)*1E3,3),\"/_\", round(cmath.phase(complex(I2.real,I2.imag))*180/math.pi,2),\"deg  mA\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "secondary  current  I2  is   4.085 /_ 28.55 deg  mA\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 11, page no. 853</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "E1  =  50;#  in  Volts\n",
      "thetae1  =  0;#  in  degrees\n",
      "w  =  500;#  in  rad/sec\n",
      "R1  =  300;#  in  ohm\n",
      "L1  =  0.2;#  in  Henry\n",
      "L2  =  0.5;#  in  Henry\n",
      "L3  =  0.3;#  in  Henry\n",
      "R2  =  500;#  in  ohm\n",
      "C  =  5E-6;#  in  farad\n",
      "M  =  0.2;#  in  Henry\n",
      "\n",
      "#calculation:\n",
      " #  Self  impedance  of  primary  circuit\n",
      "Z1  =  R1  +  1j*w*(L1  +  L2)\n",
      " #Self  impedance  of  secondary  circuit,\n",
      "Z2  =  R2  +  1j*(w*L3  -  1/(w*C))\n",
      " #reflected  impedance,  Zr\n",
      "Zr  =  (w*M)**2/Z2\n",
      " #Effective  primary  impedance,\n",
      "Z1e  =  Z1  +  Zr\n",
      " #Primary  current  I1  \n",
      "I1  =  E1/Z1e\n",
      " #Secondary  current  I2\n",
      "E2  =  1j*w*M*I1\n",
      "I2  =  E2/Z2\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  Self  impedance  of  primary  circuit,  Z1  is  \",Z1.real,\"  +  (\",  Z1.imag,\")i  ohm\"\n",
      "print  \"\\n  Self  impedance  of  secondary  circuit,  Z2  is  \",Z2.real,\"  +  (\",  Z2.imag,\")i  ohm\"\n",
      "print  \"\\n  reflected  impedance,  Zr  is  \",Zr.real,\"  +(\",  Zr.imag,\")i  ohm\"\n",
      "print  \"\\n  Effective  primary  impedance  Z1(eff)  is  \",Z1e.real,\"  +(\",Z1e.imag,\")i  ohm\"\n",
      "print  \"\\n  primary  current  I1  is  \",round(abs(I1),2),\"/_\",round(cmath.phase(complex(I1.real,I1.imag))*180/math.pi,2),\"deg  A\"\n",
      "print  \"\\n  secondary  current  I2  is  \",round(abs(I2),2),\"/_\",round(cmath.phase(complex(I2.real,I2.imag))*180/math.pi,2),\"deg  A\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  Self  impedance  of  primary  circuit,  Z1  is   300.0   +  ( 350.0 )i  ohm\n",
        "\n",
        "  Self  impedance  of  secondary  circuit,  Z2  is   500.0   +  ( -250.0 )i  ohm\n",
        "\n",
        "  reflected  impedance,  Zr  is   16.0   +( 8.0 )i  ohm\n",
        "\n",
        "  Effective  primary  impedance  Z1(eff)  is   316.0   +( 358.0 )i  ohm\n",
        "\n",
        "  primary  current  I1  is   0.1 /_ -48.57 deg  A\n",
        "\n",
        "  secondary  current  I2  is   0.02 /_ 68.0 deg  A"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 12, page no. 855</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "E1  =  20;#  in  Volts\n",
      "thetae1  =  0;#  in  degrees\n",
      "R1  =  15;#  in  ohm\n",
      "C1  =  400E-12;#  in  farad\n",
      "R2  =  30;#  in  ohm\n",
      "L1  =  0.001;#  in  Henry\n",
      "L2  =  0.0002;#  in  Henry\n",
      "R3  =  50;#  in  ohm\n",
      "M  =  10E-6;#  in  Henry\n",
      "\n",
      "#calculation:\n",
      " #voltage\n",
      "E1  =  E1*math.cos(thetae1*math.pi/180)  +  1j*E1*math.sin(thetae1*math.pi/180)\n",
      " #the  resonant  frequency,  fr  \n",
      "fr  =  1/(2*math.pi*(L1*C1)**0.5)\n",
      " #The  secondary  is  also  tuned  to  a  resonant  frequency\n",
      " #capacitance,C2\n",
      "C2  =  1/(L2*(2*math.pi*fr)**2)\n",
      " #the  effective  primary  impedance  Z1eff\n",
      "w = 2*math.pi*fr\n",
      "Z1e  =  R1 + R2 +  ((w*M)**2)/R3\n",
      " #Primary  current  I1  \n",
      "I1  =  E1/Z1e\n",
      " #Secondary  current  I2\n",
      "E2  =  1j*w*M*I1\n",
      "I2  =  E2/Z1e\n",
      " #voltage  across  capacitor  C2\n",
      "Vc2  =  I2*(-1*1j/(w*C2))\n",
      " #coefficient  of  coupling,  k  \n",
      "k  =  M/(L1*L2)**0.5\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  the  resonant  frequency,fr  is  \",round(fr/1000,2),\"KHz\"\n",
      "print  \"\\n  capacitance,C2  is  \",round(C2*1E9,2),\"nF\"\n",
      "print  \"\\n  Effective  primary  impedance  Z1(eff)  is  \",round(abs(Z1e),2),\" ohm\"\n",
      "print  \"\\n  primary  current  I1  is  \",round(abs(I1),2),\"/_\",round(cmath.phase(complex(I1.real,I1.imag)),0),\"deg  A\"\n",
      "print  \"\\n  voltage  across  capacitor  C2  is \",round(abs(Vc2),2),\"/_\",round(abs(cmath.phase(complex(Vc2.real,Vc2.imag))),0),\"deg  V\"\n",
      "print  \"\\n  coefficient  of  coupling,  k    is  \",round(k,4),\"\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  the  resonant  frequency,fr  is   251.65 KHz\n",
        "\n",
        "  capacitance,C2  is   2.0 nF\n",
        "\n",
        "  Effective  primary  impedance  Z1(eff)  is   50.0  ohm\n",
        "\n",
        "  primary  current  I1  is   0.4 /_ 0.0 deg  A\n",
        "\n",
        "  voltage  across  capacitor  C2  is  40.0 /_ 0.0 deg  V\n",
        "\n",
        "  coefficient  of  coupling,  k    is   0.0224 \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 13, page no. 858</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "E1  =  250;#  in  Volts\n",
      "thetae1  =  0;#  in  degrees\n",
      "R1  =  50j;#  in  ohm\n",
      "R2  =  10;#  in  ohm\n",
      "R3  =  10;#  in  ohm\n",
      "R4  =  50j;#  in  ohm\n",
      "R5  =  50;#  in  ohm\n",
      "M  =  10j;#  in  ohm\n",
      "\n",
      " #calculation:\n",
      " #voltage\n",
      "E1  =  E1*math.cos(thetae1*math.pi/180)  +  1j*E1*math.sin(thetae1*math.pi/180)\n",
      " #Applying  Kirchhoff\u2019s  voltage  law  to  the  primary  circuit  gives\n",
      " #(R1  +  R2)*I1  -  M*I2  =  E1\n",
      " #Applying  Kirchhoff\u2019s  voltage  law  to  the  secondary  circuit  gives\n",
      " #-1*M*I1  +  (  R3  +  R4  +  R5)*I2  =  0\n",
      " #solving  these  two\n",
      "I2  =  E1/((R1  +  R2)*(R3  +  R4  +  R5)/(-1*M)  +  (-1*M))\n",
      "I1  =  I2*(R3  +  R4  +  R5)/(-1*M)\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  primary  current  I1  is  \",round(I1.real,2),\"  +(\",round(  I1.imag,2),\")i  A\"\n",
      "print  \"\\n  secondary  current  I2  is  \",round(I2.real,2),\"  +(\",round(  I2.imag,2),\")i  A\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  primary  current  I1  is   0.85   +( -4.77 )i  A\n",
        "\n",
        "  secondary  current  I2  is   -0.54   +( 0.31 )i  A"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 14, page no. 859</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "E1  =  40;#  in  Volts\n",
      "thetae1  =  0;#  in  degrees\n",
      "R1  =  5;#  in  ohm\n",
      "L1  =  0.001;#  in  Henry\n",
      "L2  =  0.006;#  in  Henry\n",
      "R2  =  40;#  in  ohm\n",
      "rzl  =  200;#  in  ohm\n",
      "thetazl  =  -60;#  in  degrees\n",
      "k  =  0.70\n",
      "f  =  20000;#  in  Hz\n",
      "\n",
      " #calculation:\n",
      "w  =  2*math.pi*f\n",
      " #voltage\n",
      "#E1  =  E1*math.cos(thetae1*math.pi/180)  +  1j*E1*math.sin(thetae1*math.pi/180)\n",
      " #impedance\n",
      "ZL  =  rzl*math.cos(thetazl*math.pi/180)  +  1j*rzl*math.sin(thetazl*math.pi/180)\n",
      " #mutual  inductance,  M\n",
      "M  =  k*(L1*L2)**0.5\n",
      " #Applying  Kirchhoff\u00e2\u20ac\u2122s  voltage  law  to  the  primary  circuit  gives\n",
      " #(R1  +  1j*w*L1)*I1  -  1j*w*M*I2  =  E1\n",
      " #Applying  Kirchhoff\u00e2\u20ac\u2122s  voltage  law  to  the  secondary  circuit  gives\n",
      " #-1j*w*M*I1  +  (  R2  +  ZL  +  1j*w*L2)*I2  =  0\n",
      " #solving  these  two\n",
      "\n",
      "a = R1  +  1j*w*L1\n",
      "b = 1j*w*M\n",
      "c = R2  +  ZL  +  1j*w*L2\n",
      "I1  =  E1/(1*a - (b**2)/c)\n",
      "d = -1*cmath.phase(complex(I1.real,I1.imag))\n",
      "e = abs(I1)\n",
      "I2  =  (b/c)*(e*math.cos(d)  +  1j*e*math.sin(d))\n",
      "pd2 = I2*ZL\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  mutual  induction  M  is  \",round(M*1E3,3),\"mH\"\n",
      "print  \"\\n  primary  current  I1  is  \",round(abs(I1),3),\"/_\",round(-1*cmath.phase(complex(I1.real,I1.imag))*180/math.pi,2),\"deg  A\"\n",
      "print  \"\\n  secondary  current  I2  is  \",round(abs(pd2),1),\"/_\",round(cmath.phase(complex(pd2.real,pd2.imag))*180/math.pi,2),\"deg  V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  mutual  induction  M  is   1.715 mH\n",
        "\n",
        "  primary  current  I1  is   0.724 /_ 65.15 deg  A\n",
        "\n",
        "  secondary  current  I2  is   52.2 /_ 18.7 deg  V"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 15, page no. 860</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "E1  =  50;#  in  Volts\n",
      "thetae1  =  0;#  in  degrees\n",
      "r  =  5;#  in  ohm\n",
      "R1  =  20;#  in  ohm\n",
      "L1  =  0.2;#  in  Henry\n",
      "L2  =  0.4;#  in  Henry\n",
      "R2  =  25;#  in  ohm\n",
      "RL  =  20;#  in  ohm\n",
      "M  =  0.1;#  in  Henry\n",
      "f  =  75/math.pi;#  in  Hz\n",
      "\n",
      "#calculation:\n",
      "w  =  2*math.pi*f\n",
      " #Applying  Kirchhoff\u2019s  voltage  law  to  the  primary  circuit  gives\n",
      " #(r  +  R1  +  1j*w*L1)*I1  -  1j*w*M*I2  =  E1\n",
      " #Applying  Kirchhoff\u2019s  voltage  law  to  the  secondary  circuit  gives\n",
      " #-1*1j*w*M*I1  +  (  R2  +  RL  +  1j*w*L2)*I2  =  0\n",
      " #solving  these  two\n",
      "I2  =  E1/((r  +  R1  +  1j*w*L1)*(R2  +  RL  +  1j*w*L2)/(1j*w*M)  +  (-1*1j*w*M))\n",
      "I1  =  I2*(R2  +  RL  +  1j*w*L2)/(1j*w*M)\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  primary  current  I1  is  \",round(abs(I1),2),\"/_\",round(cmath.phase(complex(I1.real,I1.imag))*180/math.pi,2),\"deg  A\"\n",
      "print  \"\\n  load  current  I2  is  \",round(abs(I2),2),\"/_\",round(cmath.phase(complex(I2.real,I2.imag))*180/math.pi,2),\"deg  A\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  primary  current  I1  is   1.3 /_ -45.84 deg  A\n",
        "\n",
        "  load  current  I2  is   0.26 /_ -8.97 deg  A"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 16, page no. 862</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "E1  =  50;#  in  Volts\n",
      "thetae1  =  0;#  in  degrees\n",
      "r  =  5;#  in  ohm\n",
      "R1  =  20;#  in  ohm\n",
      "L1  =  0.2;#  in  Henry\n",
      "R  =  8;#  in  ohm\n",
      "L  =  0.1;#  in  Henry\n",
      "L2  =  0.4;#  in  Henry\n",
      "R2  =  25;#  in  ohm\n",
      "RL  =  20;#  in  ohm\n",
      "M  =  0.1;#  in  Henry\n",
      "f  =  75/math.pi;#  in  Hz\n",
      "\n",
      "#calculation:\n",
      "w  =  2*math.pi*f\n",
      " #Applying  Kirchhoff\u2019s  voltage  law  to  the  primary  circuit  gives\n",
      " #(r  +  R1  +  1j*w*L1  +  R  +  1j*w*L)*I1  -  (1j*w*M  +  R  +  1j*w*L)*I2  =  E1\n",
      " #Applying  Kirchhoff\u2019s  voltage  law  to  the  secondary  circuit  gives\n",
      " #-1*(1j*w*M  +  R  +  1j*w*L)*I1  +  (R2  +  RL  +  1j*w*L2  +  R  +  1j*w*L)*I2  =  0\n",
      " #solving  these  two\n",
      "I2  =  E1/((r  +  R1  +  1j*w*L1  +  R  +  1j*w*L)*(R2  +  RL  +  1j*w*L2  +  R  +  1j*w*L)/(1j*w*M  +  R  +  1j*w*L)  +  (-1*(1j*w*M  +  R  +  1j*w*L)))\n",
      "I1  =  I2*(R2  +  RL  +  1j*w*L2  +  R  +  1j*w*L)/(1j*w*M  +  R  +  1j*w*L)\n",
      " #reversing\n",
      " #Applying  Kirchhoff\u2019s  voltage  law  to  the  primary  circuit  gives\n",
      " #(r  +  R1  +  1j*w*L1  +  R  +  1j*w*L)*I1r  -  (-1*1j*w*M  +  R  +  1j*w*L)*I2r  =  E1\n",
      " #Applying  Kirchhoff\u2019s  voltage  law  to  the  secondary  circuit  gives\n",
      " #-1*(-1*1j*w*M  +  R  +  1j*w*L)*I1r  +  (R2  +  RL  +  1j*w*L2  +  R  +  1j*w*L)*I2r  =  0\n",
      " #solving  these  two\n",
      "I2r  =  E1/((r  +  R1  +  1j*w*L1  +  R  +  1j*w*L)*(R2  +  RL  +  1j*w*L2  +  R  +  1j*w*L)/(-1*1j*w*M  +  R  +  1j*w*L)  +  (-1*(-1*1j*w*M  +  R  +  1j*w*L)))\n",
      "I1r  =  I2r*(R2  +  RL  +  1j*w*L2  +  R  +  1j*w*L)/(-1*1j*w*M  +  R  +  1j*w*L)\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"primary  current  I1  is  \",round(abs(I1),2),\"/_\",round(cmath.phase(complex(I1.real,I1.imag))*180/math.pi,2),\"deg  A\"\n",
      "print  \"load  current  I2  is  \",round(abs(I2),2),\"/_\",round(cmath.phase(complex(I2.real,I2.imag))*180/math.pi,2),\"deg   A\"\n",
      "print  \"reversed  primary  current  I1r  is  \",round(abs(I1r),2),\"/_\",round(cmath.phase(complex(I1r.real,I1r.imag))*180/math.pi,2),\"deg   A\"\n",
      "print  \"reversed  load  current  I2r  is  \",round(abs(I2r),2),\"/_\",round(cmath.phase(complex(I2r.real,I2r.imag))*180/math.pi,2),\"deg   A\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "primary  current  I1  is   1.03 /_ -45.47 deg  A\n",
        "load  current  I2  is   0.35 /_ -25.16 deg   A\n",
        "reversed  primary  current  I1r  is   0.89 /_ -54.42 deg   A\n",
        "reversed  load  current  I2r  is   0.08 /_ -109.17 deg   A\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}