{
 "metadata": {
  "name": "",
  "signature": "sha256:4381350f1f5861e39c88a88906555fe70746a56edfa9636dec1dfc702e44302a"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 5: Electromagnetism"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.1, Page 145"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "N = 100;                                 # Number of turns\n",
      "delta_phi = 10e-03;                      # Flux linked with coil, Wb\n",
      "delta_t = 2e-03;                         # Time during which flux changes, s\n",
      "\n",
      "#Calculations\n",
      "e =((-N)*delta_phi)/delta_t;            # Average induced emf, V\n",
      "\n",
      "#Result\n",
      "print \"The average emf induced in the coil = %3d V\"%e\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The average emf induced in the coil = -500 V\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.2, Page 146"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "N = 250;                                     # Number of turns\n",
      "delta_phi1 = 20e-03;                         # Flux linked with coil, Wb\n",
      "delta_phi2 = -16e-03;                        # Flux linked with coil, Wb\n",
      "delta_t1 = 0.05;                             # Time, s\n",
      "delta_t2 = 0.01;                             # Time, s\n",
      "\n",
      "#Calculations\n",
      "e_1 =((-N)*delta_phi1)/delta_t1;             # Average induced emf, V\n",
      "e_2 =((-N)*delta_phi2)/delta_t2;             # Average induced emf, V\n",
      "\n",
      "#Results\n",
      "print \"Change in flux in first case = %4.2f weber\"%delta_phi1\n",
      "print \"Emf induced in first case = %3d volts\"%e_1\n",
      "print \"Change in flux in second case = %4.2f weber\"%delta_phi2\n",
      "print \"Emf induced in second case = %3d volts\"%e_2\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Change in flux in first case = 0.02 weber\n",
        "Emf induced in first case = -100 volts\n",
        "Change in flux in second case = -0.02 weber\n",
        "Emf induced in second case = 400 volts\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.3, Page 147"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "e = 100;                                          # Induced emf, V\n",
      "\n",
      "#Calculations\n",
      "# For simplification let (delta_phi)/(delta_t) = k\n",
      "k = 0.1;                                         # Rate of chage of flux linked with coil, Wb/s\n",
      "# Since e =((-N)*delta_phi)/delta_t, soling for N\n",
      "N = (e)/k;                                      # Number of turns\n",
      "\n",
      "#Result\n",
      "print \"The number of turns on the coil = %4d\"%N"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The number of turns on the coil = 1000\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.4, Page 149"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "v = 5;                                # Velocity, m^2\n",
      "theta =(math.pi/3);                       # Angle, degrees\n",
      "phi = 1.6e-03;                        # Flux, Wb\n",
      "l = 0.1;                              # Length of pole face, m\n",
      "d = 0.4;                              # Breadth of pole face, m\n",
      "\n",
      "#Calculations\n",
      "A = l*d;                              # Cross-sectional area of pole face, m^2\n",
      "B = phi/ A;                           # Flux density, T\n",
      "e =( B*l*v)*math.sin(theta);               # Induced emf, V\n",
      "\n",
      "#Result\n",
      "print \"The emf induced = %5.4f V\"%e\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The emf induced = 0.0173 V\n"
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.5, Page 149"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "l = 0.15;                                 # Effective length of conductor, m\n",
      "v = 8;                                    # Velocity, m^2\n",
      "theta = 55;                     # Angle, degrees\n",
      "e = 2.5;                                   # Induced emf, V\n",
      "\n",
      "#Calculations\n",
      "# Since e = B*l*v*sin(theta), solving for B\n",
      "B = e/(l*v*math.sin(theta*math.pi/180));                    # Flux density, T\n",
      "\n",
      "#Result\n",
      "print \"The density of the field = %5.3f Tesla\"%B\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The density of the field = 2.543 Tesla\n"
       ]
      }
     ],
     "prompt_number": 37
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.6, Page 149"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "l = 2.2;                                 # Effective length of conductor, m\n",
      "B =38e-06;                               # Flux density, T\n",
      "theta = (math.pi/2);                         # Angle, degrees\n",
      "v = 800/36;                              # Velocity, m^2\n",
      "\n",
      "#Calculations\n",
      "e = B*l*v*math.sin(theta);                    # Induced emf, V\n",
      "\n",
      "#Result\n",
      "print \"The emf induced in the axle = %4.2f mV\"%(e/1e-03)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The emf induced in the axle = 1.84 mV\n"
       ]
      }
     ],
     "prompt_number": 38
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.7, Page 152"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "l = 0.22;                                 # Effective length of conductor, m\n",
      "B = 0.35;                               # Flux density, T\n",
      "I = 3;                                  # Current, A\n",
      "theta = (math.pi/2);                        # Angle, degrees\n",
      "\n",
      "#Calculations\n",
      "# Since the force exerted on the conductor placed in magnetic field is directly proportional to the flux density , \n",
      "#the value of current flowing through the conductor, and the length of conductor lying inside the field, therefore\n",
      "F = B*I*l*math.sin(theta);                   # Force, N\n",
      "\n",
      "#Result\n",
      "print \"The force exerted on the conductor = %5.3f N\"%F\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The force exerted on the conductor = 0.231 N\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.8, Page 153"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "phi = 2.5e-03;                             # Flux, Wb\n",
      "l = 0.05;                                  # Effective length of pole, m\n",
      "d = 0.03;                                  #  Effective width of pole, m\n",
      "F = 1.25;                                  # Force exerted on conductor, N\n",
      "A = l*d;                                   # Cross-sectional area of pole face, m^2\n",
      "B = phi/A;                                # Flux density, T\n",
      "theta = (math.pi/2);                          # Angle, degrees\n",
      "\n",
      "#Calculations\n",
      "# Since F = B*I*l*sin(theta), solving for I\n",
      "I = F/(B*l*math.sin(theta));                   # Current in conductor, A\n",
      "theta_2 = (math.pi/4);                        # New angle, degrees\n",
      "F_2 = B*I*l*math.sin(theta_2);                  # Force exerted on conductor, N\n",
      "\n",
      "#Results\n",
      "print \"The value of the current = %2d A\"%I\n",
      "print \"The force exerted on conductor when placed at 45 degrees to the field = %5.3f newton\"%F_2\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of the current = 14 A\n",
        "The force exerted on conductor when placed at 45 degrees to the field = 0.884 newton\n"
       ]
      }
     ],
     "prompt_number": 39
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.9, Page 154"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "l = 0.015;                                    # Length of coil, m\n",
      "d = 0.006;                                     # Width of  coil, m\n",
      "B = 1.2;                                      # Flux density, T\n",
      "I = 1e-02;                                    # Current, a\n",
      "r = d/2;                                      # Radius of rotation, m\n",
      "\n",
      "#Calculations\n",
      "# Since torque is given by the product of force and distance, therefore, we have\n",
      "T = 2*B*I*l*r;                               # Torque, Nm\n",
      "\n",
      "#Result\n",
      "print \"The torque exerted on the coil = %4.2f micro-Nm\"%(T/1e-06)\n",
      " "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The torque exerted on the coil = 1.08 micro-Nm\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.10, Page 155"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "N = 80;                                 # Number of turns\n",
      "l = 0.02;                               # Length of coil, m\n",
      "r = 0.012;                              # Radius of coil, m\n",
      "I = 45e-06;                              # Current in coil, A\n",
      "T = 1.4e-06;                              # Torque exerted on coil, Nm\n",
      "A = l*r;                                  # Cross-sectional area of coil, m^2\n",
      "\n",
      "#Calculations\n",
      "# Since T = 2*B*I*l*r, solving for B\n",
      "B = T/(2*A*N*I);                             # Flux density, T\n",
      "\n",
      "#Result\n",
      "print \"The flux density produced by the pole pieces = %4.2f T\"%B\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The flux density produced by the pole pieces = 0.81 T\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.11, Page 158"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "d = 0.035;                      # Distance between two parallel conductors, m\n",
      "I_1 = 50;                       # Electric current in first coil, A\n",
      "I_2 = 40;                      # Electric current in second coil, A\n",
      "\n",
      "#Calculations\n",
      "F = ((2e-07)*I_1*I_2)/d;         # Force exerted by conductors, N\n",
      "\n",
      "#Result\n",
      "print \"The force exerted between the conductors = %4.1f mN\"%(F/1e-03);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The force exerted between the conductors = 11.4 mN\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.12, Page 158"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "d = 2;                           # Distance between two parallel conductors, m\n",
      "I_1 = 1000;                     # Electric current in first coil, A\n",
      "I_2 = 300;                      # Electric current in second coil, A\n",
      "\n",
      "#Calculations\n",
      "mew_o = 4*(math.pi)*1e-07;          # Permeability for free space\n",
      "B = (mew_o*I_1)/d;              # Flux density due to first coil, T\n",
      "F = ((2e-07)*I_1*I_2)/d;         # Force exerted by conductors, N\n",
      "\n",
      "#Result\n",
      "print \"The flux density at a distance of %1d m from the centre of a conductor carrying a current of %4d A = %5.3f mT\"%(d, I_1, B/1e-03);\n",
      "print \"Force exerted by conductors = %2d mN\"%(F/1e-03);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The flux density at a distance of 2 m from the centre of a conductor carrying a current of 1000 A = 0.628 mT\n",
        "Force exerted by conductors = 30 mN\n"
       ]
      }
     ],
     "prompt_number": 40
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.13, Page 163"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "R_c = 40;                           # Resistance of coil, ohm\n",
      "I_fsd = 5e-04;                      # Full-scale deflection current, A\n",
      "I = 3;                              # Current reading, A\n",
      "\n",
      "#Calculations\n",
      "V_c = I_fsd*R_c;                    # Potential difference, V\n",
      "# Since I = I_s + I_fsd, solving for I_s\n",
      "I_s = I-I_fsd;                       # Shunt current, A\n",
      "# From Ohm's law, V_c = I_s*R_s, solving for R_s\n",
      "R_s = V_c/I_s;                       # Shunt resistance, ohm\n",
      "\n",
      "#Result\n",
      "print \"The value of required shunt resistance = %4.2f milli-ohm\"%(R_s/1e-03); \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of required shunt resistance = 6.67 milli-ohm\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.14, Page 163"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "R_c = 40;                           # Resistance of coil, ohm\n",
      "I_fsd = 5e-04;                      # Full-scale deflection current, A\n",
      "I_fsd = 5e-04;                      # Full-scale deflection current, A\n",
      "V = 10;                             # Voltage reading range, V\n",
      "V_c = 0.02;                          # Potential difference across coil resistance, V\n",
      "\n",
      "#Calculations\n",
      "# From Ohm's law, V = I_fsd*R, solving for R\n",
      "R = V/I_fsd;                         # Total resistance, ohm\n",
      "# Since R = R_m + R_c, solving R_m\n",
      "R_m = R - R_c;                       # Multiplier resistance, ohm\n",
      "\n",
      "#Result\n",
      "print \"The required value of multiplier resistance = %5.2f kilo-ohms\"%(R_m*1e-03);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The required value of multiplier resistance = 19.96 kilo-ohms\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.15, Page 164"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "R_c = 1500;                             # Coil resistance, ohm\n",
      "I_fsd = 75e-06;                         # Full-scale deflection current, A\n",
      "I = 5;                                  # Current range, A\n",
      "V = 10;                                  # Voltage range, V\n",
      "\n",
      "#Calculations\n",
      "# Part (a)\n",
      "# Using Ohm's law,\n",
      "V_c = I_fsd*R_c;                         # Potential difference across coil resistance, V\n",
      "# Since I = I_s + I_fsd, solving for I_s\n",
      "I_s = I-I_fsd;                       # Shunt current, A\n",
      "# From Ohm's law, V_c = I_s*R_s, solving for R_s\n",
      "R_s = V_c/I_s;                       # Shunt resistance, ohm\n",
      "\n",
      "# Part (b)\n",
      "# Since = V = V_m + V_c, solving for V_m\n",
      "V_m = V - V_c;                        # Potential difference across multiplier resistance, V\n",
      "# From Ohm's law, V_m = I_fsd*R_m, solving for R_m\n",
      "R_m = V_m/I_fsd                      # Multiplier resistance, ohm\n",
      "\n",
      "#Results\n",
      "print \"The required value of shunt resistance = %4.1f mega-ohm\"%(R_s/1e-03);\n",
      "print \"The required value of multiplier resistance = %4.1f mega-ohm\"%(R_m*1e-03);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The required value of shunt resistance = 22.5 mega-ohm\n",
        "The required value of multiplier resistance = 131.8 mega-ohm\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.16, Page 166"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "R_1 = 30.;                           # Resistance, ohm\n",
      "R_2 = 70.;                           # Resistance, ohm\n",
      "R_in = 200.;                          # Internal resistance of meter, ohm\n",
      "V = 12.;                              # Supply voltage, V\n",
      "\n",
      "#Calculations\n",
      "# Using voltage divider rule, we have\n",
      "V_2t = (R_2 /(R_1 + R_2))*V               #  True value of p.d across resistance R_2, V\n",
      "# Since the resistances R_2 and R-in are parallel, so their equivalent resistance is given their parallel combination\n",
      "R_BC = (R_2 * R_in)/(R_2 + R_in);                       # Resistance, ohms\n",
      "# Using the potential divider technique, \n",
      "V_2i = (R_BC / ( R_BC + R_1 ))*V                       # Indicated value of p.d across by voltmetre, volts\n",
      "err = (( V_2i-V_2t ) / V_2t)*100                      # Percentage error in the reading\n",
      "\n",
      "#Results\n",
      "print \"The p.d. indicated by the meter = %3.1f V\"%V_2i\n",
      "print \"The percentage error in the reading = %4.2f percent\"%err\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The p.d. indicated by the meter = 7.6 V\n",
        "The percentage error in the reading = -9.50 percent\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.17, Page 168"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "R_in = 200.;                                   # Internal resistance of meter, kilo-ohms\n",
      "V = 10.;                                       # Supply voltage, volts\n",
      "R_1 = 10.;                                     # Resistance, kilo-ohms\n",
      "R_2 = 47.;                                     # Resistance, kilo-ohms\n",
      "\n",
      "#Calculations\n",
      "V_1 = R_1/(R_1+R_2)*V                         # P.d across resistance R_1, V\n",
      "V_2 = R_2/(R_1+R_2)*V                         # P.d across resistance R_2, V\n",
      "\n",
      "# Part (a)\n",
      "R_AB = (R_1 * R_in)/(R_1 + R_in);                      # Resistance, kilo-ohms\n",
      "V_AB = (R_AB / ( R_AB + R_2 ))*V                       # True value of p.d across by voltmetre, V\n",
      "R_BC = (R_2 * R_in)/(R_2 + R_in);                      # Resistance, kilo-ohms\n",
      "V_BC = (R_BC / ( R_BC + R_1 ))*V                        # Indicated value of p.d across by voltmetre, V\n",
      "\n",
      "# Part (b)\n",
      "# Error for V_1 measurement\n",
      "error_AB = (V_AB - V_1)/V_1*100                        # Percentage error in the reading\n",
      "#Error for V_2 measurement\n",
      "error_BC = (V_BC-V_2)/V_2*100                           # Percentage error in the reading \n",
      "\n",
      "#Results\n",
      "print \"The p.d. indicated by the meter across  first resistor = %4.2f V\"%V_AB\n",
      "print \"The p.d. indicated by the meter across second resistor = %4.2f V\"%V_BC\n",
      "print \"Percentage error for V_1 measurement = %4.2f percent\"%error_AB\n",
      "print \"Percentage error for V_2 measurement = %4.2f percent\"%error_BC\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The p.d. indicated by the meter across  first resistor = 1.68 V\n",
        "The p.d. indicated by the meter across second resistor = 7.92 V\n",
        "Percentage error for V_1 measurement = -3.96 percent\n",
        "Percentage error for V_2 measurement = -3.96 percent\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.18, Page 176"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "L = 0.25;                                           # Self-inductance, H\n",
      "delta_I = 250e-03;                                  # Change in current, A\n",
      "delta_t = 25e-03;                                  # Time, s\n",
      "\n",
      "#Calculations\n",
      "e = ((L)*delta_I)/(delta_t);                      # Induced emf, V\n",
      "\n",
      "#Result\n",
      "print \"The value of emf induced = %3.1f V\"%e\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of emf induced = 2.5 V\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.19, Page 176"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "e = 30.;                   # Induced emf, V\n",
      "\n",
      "#Calculations\n",
      "# For simplicity, let rate of change of current i.e delta_I/delta_t = k\n",
      "k = 200;                               # Rate of change of current, ampere-second\n",
      "# Since e = ((-L)*delta_I)/(delta_t), solving for L\n",
      "L = e/k;                               # Self-inductance, H\n",
      "\n",
      "#Result\n",
      "print \"The inductance of the circuit = %4.2f H\"%L\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The inductance of the circuit = 0.15 H\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.20, Page 176"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "L = 50e-03;                               # Self-inductance, H\n",
      "e = 8;                                   # Induced emf, V\n",
      "\n",
      "#Calculations\n",
      "# Since e = ((-L)*delta_I)/(delta_t), solving for delta_I/delta_t,and for simplicity letting the  rate of change of \n",
      "#current i.e delta_I/delta_t = k\n",
      "k = e/L;                    # Rate of change of current, As\n",
      "\n",
      "#Result\n",
      "print \"The rate of change of current = %3d A/s\"%k\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The rate of change of current = 160 A/s\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.21, Page 178"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "N = 150;                             # Number of turns in a coil\n",
      "I = 10;                              # Electric current flowing through coil, A\n",
      "phi = 0.10;                          # Flux, Wb\n",
      "delta_t = 0.1;                       # Time, s\n",
      "\n",
      "#Calculations\n",
      "# Part (a)\n",
      "L  = (N * phi)/I                    # Self-inductance, H\n",
      "delta_I = 20;                        # Change in current, A\n",
      "# Part (b)\n",
      "e = abs((-L*delta_I)/(delta_t));        # Induced emf, V\n",
      "\n",
      "#Results\n",
      "print \"The inductance of the coi = %3.1f H\"%L\n",
      "print \"The emf induced in the coil = %2d V\"%e\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The inductance of the coi = 1.5 H\n",
        "The emf induced in the coil = 300 V\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.22, Page 178"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "I_1 = 8;                                   # Electric current, A\n",
      "I_2 = 2;                                   # Electric current, A\n",
      "N = 3000;                                 # Number of turns in a coil\n",
      "phi_1 = 4e-03;                            # Flux, Wb\n",
      "delta_t = 0.1;  # Reversal time of current, s\n",
      "\n",
      "#Calculations\n",
      "L  = (N * phi_1)/I_1;                    # Self-inductance, H\n",
      "delta_I = I_1 - I_2;                        # Change in current, A\n",
      "e = ((L)*delta_I)/(delta_t);        # Induced emf, V\n",
      "\n",
      "#Result\n",
      "print \"The emf induced in the coil = %2d volts\"%e\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The emf induced in the coil = 90 volts\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.23, Page 179"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "N_1 = 600;                                 # Number of turns in a coil in first case\n",
      "N_2 = 900;                                 # Number of turns in a coil in second case  \n",
      "N_3 = 900;                                 # Number of turns in a coil in third case\n",
      "l = 45e-03;                               # Effective length of coil, m\n",
      "A = 4e-04;                                # Cross-sectional area of coil, m^2\n",
      "mew_o = 4*(math.pi)*1e-07;                     # Permeability for free space\n",
      "mew_r1 = 1;                                # Relative permeability in first case\n",
      "mew_r2 = 1;                                # Relative permeability in second case\n",
      "\n",
      "#Calculations\n",
      "# Part (a)\n",
      "mew_r3 = 75;                                # Relative permeability in third case\n",
      "L_1 = (mew_o*mew_r1*(N_1**2)*A)/l;          # Self-inductance of coil in first case, H\n",
      "\n",
      "# Part (b)\n",
      "# Since self-inductance of a coil is directly proportional to the number of turns in a coil, therefore, \n",
      "#we have L_2/L_1 = (N_2^2)/(N_1^2), solving for L_2\n",
      "L_2 = (L_1*(N_2**2))/(N_1**2);          # Self-inductance of coil in second case, H\n",
      "\n",
      "# Part (c)\n",
      "# Since mew_r3 = 75*mew_r2, keeping all other quantities same we have\n",
      "L_3 = mew_r3*L_2;          # Self-inductance of coil in third case, H\n",
      "\n",
      "#Results\n",
      "print \"Self-inductance of coil in first case = %4.2f mH\"%(L_1/1e-03);\n",
      "print \"Self-inductance of coil in second case = %5.3f mH\"%(L_2/1e-03);\n",
      "print \"Self-inductance of coil in third case = %5.3f H\"%L_3\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Self-inductance of coil in first case = 4.02 mH\n",
        "Self-inductance of coil in second case = 9.048 mH\n",
        "Self-inductance of coil in third case = 0.679 H\n"
       ]
      }
     ],
     "prompt_number": 41
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.24, Page 182"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "N_A = 2000;                                 # Number of turns in a coil A\n",
      "N_B = 1500;                                 # Number of turns in a coil B\n",
      "I_A = 0.5;                                  # Electric current in coil A, A\n",
      "phi_A = 60e-06;                             # Flux linked with coil A, Wb\n",
      "\n",
      "#Calculations\n",
      "# Part (a)\n",
      "L_A = (N_A*phi_A)/I_A;                      # Self-inductance of coil A\n",
      "phi_B = 0.83*(60e-06);                     # Flux linked with coil B, Wb\n",
      "\n",
      "# Part (b)\n",
      "M = (N_B*phi_B)/I_A;                        # Mutual inductance of the two coils, H\n",
      "\n",
      "#Results\n",
      "print \"Self-inductance of coil A = %4.2f H\"%L_A\n",
      "print \"Mutual inductance of the two coils = %5.3f H\"%M\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Self-inductance of coil A = 0.24 H\n",
        "Mutual inductance of the two coils = 0.149 H\n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.25, Page 183"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "N = 400;                                 # Number of turns in a coil\n",
      "l = 0.25;                                # Effective length of coil, m\n",
      "A = 4.5e-04;                             # Cross-sectional area, m^2\n",
      "mew_r = 180;                             # Relative permeability \n",
      "\n",
      "#Calculations\n",
      "mew_o = 4*(math.pi)*1e-07;                   # Pemeability for free space\n",
      "L = (mew_o*mew_r*(N**2)*A)/l          # Self-inductance of coil, H\n",
      "\n",
      "#Result\n",
      "print \"The self inductance of the coil = %2d milli-henry\"%(L/1e-03);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The self inductance of the coil = 65 milli-henry\n"
       ]
      }
     ],
     "prompt_number": 42
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.26, Page 183"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "L_1 = 65e-03;                         # Self-inductance of first coil, H\n",
      "delta_I = 1.5;                        # Change in current, A\n",
      "delta_t = 3e-03;                      # Time, s\n",
      "k = 0.95;                             # 95 percent of flux produced\n",
      "N_1 = 400;                                 # Number of turns in a coil A\n",
      "N_2 = 650;                                 # Number of turns in a coil B \n",
      "\n",
      "#Calculations\n",
      "# Part (a)\n",
      "# Since self-inductance of a coil is directly proportional to the number of turns in a coil, therefore, \n",
      "#we have L_2/L_1 = (N_2^2)/(N_1^2), solving for L_2\n",
      "L_2 = (L_1*(N_2**2))/(N_1**2)          # Self-inductance of second coil , H\n",
      "\n",
      "# Part (b)\n",
      "M = k*math.sqrt(L_1*L_2);                 # Mutual inductance of two coils, H\n",
      "\n",
      "# Part (c)\n",
      "e_1 = ((L_1)*delta_I)/(delta_t);              # Induced emf in  first coil, V \n",
      "\n",
      "# Part (d)\n",
      "e_2 = (M*delta_I)/delta_t;                     # Induced emf in  second coil, V \n",
      "\n",
      "#Results\n",
      "print \"The self-inductance of coil 2 = %3d mH\"%(L_2/1e-03)\n",
      "print \"The value of mutual inductance = %3d mH\"%(M/1e-03)\n",
      "print \"The self-induced emf in coil 1 = %4.1f V\"%e_1\n",
      "print \"The mutually induced emf in coil 2 = %2d V\"%e_2\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The self-inductance of coil 2 = 171 mH\n",
        "The value of mutual inductance = 100 mH\n",
        "The self-induced emf in coil 1 = 32.5 V\n",
        "The mutually induced emf in coil 2 = 50 V\n"
       ]
      }
     ],
     "prompt_number": 43
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.27, Page 185"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "L = 50e-03;                                 # Self-inductance of coil, H\n",
      "I = 0.75;                                  # Electric current in coil, A\n",
      "\n",
      "#Calculations\n",
      "W = (L*(I**2))/2                            # Energy stored, J\n",
      "\n",
      "#Result\n",
      "print \"Energy stored in the inductor = %4.1f mJ\"%(W/1e-03)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Energy stored in the inductor = 14.1 mJ\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.28, Page 185"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "L_1 = 25e-03;                             # Self-inductance of first coil, H\n",
      "L_2 = 40e-03;                             # Self-inductance of  second coil, H\n",
      "I = 0.25;                                  # Electric current in coils, A\n",
      "k =0.8;                                    # Coupling coefficient\n",
      "\n",
      "#Calculations\n",
      "# Part (a)\n",
      "W_1 = (L_1*(I**2))/2;                       # Energy stored in first coil, J\n",
      "W_2 = (L_2*(I**2))/2;                       # Energy stored in second coil, J\n",
      "M = k*math.sqrt(L_1*L_2);                       # Mutual inductance of coils\n",
      "\n",
      "# Part (b)\n",
      "W_M = M*(I)*(I);                           # Energy stored due to mutual inductance of coils, J\n",
      "W_sa = W_1 + W_2 + W_M;                        # Energy stored by two inductors when connected in series aiding, J\n",
      "W_so = W_1 + W_2 - W_M;                        # Energy stored by two inductors when connected in series opposition, J\n",
      "\n",
      "#Results\n",
      "print \"Energy stored in first coil = %4.2f mJ\"%(W_1/1e-03)\n",
      "print \"Energy stored in second coil = %4.2f mJ\"%(W_2/1e-03)\n",
      "print \"Energy stored by two inductors when connected in series aiding = %3.1f mJ\"%(W_sa/1e-03)\n",
      "print \"Energy stored by two inductors when connected in series opposition = %4.2f mJ\"%(W_so/1e-03)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Energy stored in first coil = 0.78 mJ\n",
        "Energy stored in second coil = 1.25 mJ\n",
        "Energy stored by two inductors when connected in series aiding = 3.6 mJ\n",
        "Energy stored by two inductors when connected in series opposition = 0.45 mJ\n"
       ]
      }
     ],
     "prompt_number": 44
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.29, Page 189"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "V_2 = 60;                         # Output voltage, V\n",
      "V_1 = 240;                        # Input voltage, V\n",
      "N_2 = 500;                        # Secondary turns\n",
      "\n",
      "#Calculations\n",
      "# Part (a)\n",
      "# For simplicity let V_1/V_2 = N_1/N_2 = k\n",
      "k = V_1/V_2                      # Turns ratio\n",
      "\n",
      "# Part (b)\n",
      "# Since V_1/V_2 = N_1/N_2, solving for N_1\n",
      "N_1 = k*N_2;                       # Primary turns\n",
      "\n",
      "#Results\n",
      "print \"The required turns ratio = %1d:1\"%k\n",
      "print \"The number of primary turns = %4d\"%N_1\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The required turns ratio = 4:1\n",
        "The number of primary turns = 2000\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.30, Page 190"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "R_L = 15;                               # Load resistor, ohms\n",
      "V_2 = 240.;                              # Terminal p.d at secondary, V\n",
      "V_1 = 600;                              # Supply voltage, V\n",
      "\n",
      "#Calculations\n",
      "# Part (a)\n",
      "# Since V_1/V_2 = N_1/N_2 = k\n",
      "k = V_1/V_2;                            # Turns ratio\n",
      "\n",
      "# Part (b)\n",
      "I_2 = V_2/R_L;                          # Current drawn by the load, A\n",
      "P_2 = V_2*I_2;                          # Power drawn by the load, W\n",
      "\n",
      "# Part (c)\n",
      "I_1 = P_2/V_1                           # Current drawn from the supply, A\n",
      "\n",
      "#Results\n",
      "print \"The transformer turns ratio = %3.1f:1\"%k\n",
      "print \"The current drawn by the load = %2d A\"%I_2\n",
      "print \"The power drawn by the load = %4.2f W\"%(P_2*1e-03);\n",
      "print \"The current drawn from the supply = %3.1f A\"%I_1\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The transformer turns ratio = 2.5:1\n",
        "The current drawn by the load = 16 A\n",
        "The power drawn by the load = 3.84 W\n",
        "The current drawn from the supply = 6.4 A\n"
       ]
      }
     ],
     "prompt_number": 35
    }
   ],
   "metadata": {}
  }
 ]
}