{
 "metadata": {
  "name": "",
  "signature": "sha256:9a66201b8d7233d025725f77699aa3bd8f73ea293b76d05e7eed8e99adada086"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter - 7 : Inductance and Capacitance Measurements"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.1 - Page No : 178"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "Z1= 100 # in \u03a9\n",
      "theta1= 30 # in \u00b0\n",
      "Z2= 50 # in \u03a9\n",
      "theta2= 0 # in \u00b0\n",
      "Z3= 200 # in \u03a9\n",
      "theta3= -90 # in \u00b0\n",
      "Z4= 100 # in \u03a9\n",
      "theta4= 30 # in \u00b0\n",
      "if Z1*Z4 == Z2*Z3 :\n",
      "    print \"The first condition is satisfied\"\n",
      "if theta1+theta4 == theta2+theta3 :\n",
      "    print \"The second condiiton is also satisfied, So it is possible to balance the bridge under the given condition\"\n",
      "else:\n",
      "    print \"The second condition is not satisfied.\"\n",
      "    print \"So balance is not possible under given condition\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The first condition is satisfied\n",
        "The second condition is not satisfied.\n",
        "So balance is not possible under given condition\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.2 - Page No : 178"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "Z1= 1000 # in \u03a9\n",
      "theta1= -90 # in \u00b0\n",
      "Z2= 500 # in \u03a9\n",
      "theta2= 0 # in \u00b0\n",
      "Z3= 1000 # in \u03a9\n",
      "theta3= 0 # in \u00b0\n",
      "R4= 100 # in \u03a9\n",
      "XL4= 500 # in \u03a9\n",
      "i_XL4= 500j # imaginary part\n",
      "Z4=(R4+i_XL4) # in \u00b0\n",
      "theta4= math.atan2(Z4.imag,Z4.real)*180/pi # in \u00b0\n",
      "if theta1+theta4 ==  theta2+theta3 :\n",
      "    print \"The first condiiton is satisfied.\"\n",
      "else :\n",
      "    print \"Balance is not possible with given configuration\"\n",
      "\n",
      "# 1/Z1=1/R1+j*omega*C1     (i)\n",
      "# According to figure  1/Z1= R4/(Z2*Z3)+%i*XL4/(Z2*Z3)        (ii) \n",
      "# Comparing real and j-components of Eqn (i) and (ii)\n",
      "R1= Z2*Z3/R4 # in \u03a9\n",
      "OmegaC1= Z2*Z3/XL4 # in \u03a9\n",
      "print \"\\nSince X_C1 is already equal to \",int(OmegaC1),\" \u03a9, the bridge can be balanced simply by placing a \"\n",
      "print \"resistance of \",int(R1),\" \u03a9 across the capacitor arm 1\"\n",
      "# Z3= R3-j*X_C3        (iii)\n",
      "    #Z3= Z1*expm(%i*theta1*pi/180)*Z4*expm(%i*theta4*pi/180)/(Z2*expm(%i*theta2*pi/180)) #       (iv)\n",
      "# Comparing real and j-components of Eqn (iii) and (iv)\n",
      "R3= 1000 # in \u03a9\n",
      "XC3= 200 # in \u03a9\n",
      "print \"\\nSince R3 is already of \",int(R3),\" \u03a9, the bridge can be balanced simply by adding a\"\n",
      "print \"capacitor of reactance X_C3 of \",int(XC3),\" \u03a9 in series with the resistor R3 in arm 3.\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Balance is not possible with given configuration\n",
        "\n",
        "Since X_C1 is already equal to  1000  \u03a9, the bridge can be balanced simply by placing a \n",
        "resistance of  5000  \u03a9 across the capacitor arm 1\n",
        "\n",
        "Since R3 is already of  1000  \u03a9, the bridge can be balanced simply by adding a\n",
        "capacitor of reactance X_C3 of  200  \u03a9 in series with the resistor R3 in arm 3.\n"
       ]
      }
     ],
     "prompt_number": 47
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.3 - Page No : 180"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "#Given data\n",
      "C2= 0.2 # in micro F\n",
      "Ratio21= 10/1 # resistance ratio R2/R1\n",
      "C1= C2*Ratio21 # in micro F\n",
      "Ratio21_desh= 1/10 \n",
      "C1_desh= C2*Ratio21_desh # in micro F\n",
      "print \"The range of measurement of unknown capacitance = \",round(C1_desh,2),\"\u00b5F to\",int(round(C1)),\"\u00b5F\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The range of measurement of unknown capacitance =  0.02 \u00b5F to 2 \u00b5F\n"
       ]
      }
     ],
     "prompt_number": 51
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.4 - Page No : 182"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from numpy import pi\n",
      "#Given data\n",
      "R2= 5 # in ohm\n",
      "R3= 2000 # in ohm\n",
      "R4= 2950 # in ohm\n",
      "C2= 0.5 # in micro F\n",
      "C2=C2*10**-6 # in F\n",
      "r2=0.4 # in  ohm\n",
      "f=450 # in Hz\n",
      "omega= 2*pi*f \n",
      "# Under Balace Condition Z1*Z4=Z2*Z3\n",
      "# [r1+1/(j*omega*C1)]*R4= [r2+R2+1/(j*omega*C2)]*R3\n",
      "# Equating the real parts we have, r1*R4= (r2+R2)*R3\n",
      "r1= (r2+R2)*R3/R4 # in ohm\n",
      "print \"Value of r1 = %0.3f ohm\" %r1\n",
      "# Equating imaginary parts we have R4/(j*omega*C1)= R3/(j*omega*C2)\n",
      "C1= R4/R3*C2 # in F\n",
      "print \"Value of C1 = %0.4f micro F\" %(C1*10**6) \n",
      "Tan_toh= omega*C1*r1 \n",
      "print \"Dissipation Factor = %0.3e\" %Tan_toh"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of r1 = 3.661 ohm\n",
        "Value of C1 = 0.7375 micro F\n",
        "Dissipation Factor = 7.634e-03\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.5 - Page No : 183"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "f=1000 #in Hz\n",
      "R1=1000 #in ohm\n",
      "R2=1000 # in ohm\n",
      "R3=2000 #in ohm\n",
      "R4=2000 #in ohm\n",
      "C1=1*10**-6 #in F\n",
      "r1= 10 # in ohm\n",
      "omega=2*pi*f \n",
      "C2=C1*R1/R2 #in F\n",
      "print \"Unknown capacitance = %0.f \u00b5F \"%(C2*10**6) \n",
      "\n",
      "r2=(R2*(R3+r1)-R1*R4)/R1 #in ohm \n",
      "del_1=omega*r1*C1 #in radian\n",
      "del_1=del_1*180/pi # in \u00b0\n",
      "print \"Phase angle error1 = %0.1f degree\" %del_1 \n",
      "del_2=omega*r2*C2 #in radian\n",
      "del_2=del_2*180/pi # in degree\n",
      "print \"Phase angle error2 = %0.1f degree\" %del_2 "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Unknown capacitance = 1 \u00b5F \n",
        "Phase angle error1 = 3.6 degree\n",
        "Phase angle error2 = 3.6 degree\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.6 - Page No :183"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "f=500 #in Hz\n",
      "R2=4.8 #in ohm\n",
      "R3=2*10**3 # in ohm\n",
      "R4=2.85*10**3 #in ohm\n",
      "C2=0.5*10**-6 #in F\n",
      "r2= 0.4 # in ohm \n",
      "omega=2*pi*f \n",
      "C1=C2*R4/R3 #in F\n",
      "print \"The value of unknown capacitance = %0.4f micro F\" %(C1*10**6) \n",
      "r1=(R3*(R2+r2))/R4 #in ohm \n",
      "print \"Resistance of unknown capacitance = %0.3f ohm\" %r1\n",
      "Tan_del_1= omega*C1*r1 \n",
      "print \"Dissipation factor = %0.5f\" %Tan_del_1"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of unknown capacitance = 0.7125 micro F\n",
        "Resistance of unknown capacitance = 3.649 ohm\n",
        "Dissipation factor = 0.00817\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.7 - Page No : 184"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "f=50 #in Hz\n",
      "R2=330*10**3 #in ohm\n",
      "R3=15*10**3 # in ohm\n",
      "R4=22*10**3 #in ohm\n",
      "C2=0.12*10**-6 #in F\n",
      "omega=2*pi*f \n",
      "R1= R2*R3/R4 # in ohm\n",
      "print \"Resistive component of unknown resistance = %0.f kohm\" %(R1*10**-3)\n",
      "C1= C2*R4/R3 # in F\n",
      "print \"Capacitive component of unknown capacitor = %0.3f micro F\" %(C1*10**6)\n",
      "D=1/(omega*C1*R1) \n",
      "print \"Dissipation factor = %0.2f\" %D"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Resistive component of unknown resistance = 225 kohm\n",
        "Capacitive component of unknown capacitor = 0.176 micro F\n",
        "Dissipation factor = 0.08\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 7.8 - Page No : 191"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "f=50 #in Hz\n",
      "R4=309 #in ohm\n",
      "R2=100 # in ohm\n",
      "C3=109*10**-12 #in F\n",
      "C4=0.5*10**-6 #in F\n",
      "omega=2*pi*f \n",
      "Cx= C3*R4/R2 # in F\n",
      "print \"Equivalent series capacitance = %0.2f \u00b5\u00b5F\"  %(Cx*10**12)\n",
      "Rx= C4*R2/C3 # in ohm\n",
      "# Power factor of the specimen\n",
      "Tan_delta= omega*Cx*Rx \n",
      "print \"Power factor of the specimen = %0.4f\" %Tan_delta"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Equivalent series capacitance = 336.81 \u00b5\u00b5F\n",
        "Power factor of the specimen = 0.0485\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.9 - Page No : 192"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import cos, tan \n",
      "from numpy import pi\n",
      "#Given data\n",
      "f=50 #in Hz\n",
      "R4=1000 #in ohm\n",
      "C3=50*10**-12 #in F\n",
      "delta=9 # in \u00b0\n",
      "epsilon_r= 2.3 \n",
      "epsilon_0= 8.854*10**-12 \n",
      "d= 0.3*10**-2 # in meter\n",
      "A=314 # area of each electrode in square cm\n",
      "A=A*10**-4 # in square meter\n",
      "omega=2*pi*f \n",
      "C1= epsilon_r*epsilon_0*A/d # in F\n",
      "# Formula tan (delta)= 1/(omega*C1*R1)\n",
      "R1= 1/(omega*C1*tan(delta*pi/180)) # in ohm\n",
      "C4= 1/(omega**2*C1*R1*R4) # in F\n",
      "print \"Variable capacitor = %0.1f micro F\" %(C4*10**6)\n",
      "R2= C3*R4*(cos(delta*pi/180))**2/C1 # in ohm\n",
      "print \"Variable resistance = %0.f ohm\" %R2\n",
      "\n",
      "# Note: Calculation of R2 in the book is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Variable capacitor = 0.5 micro F\n",
        "Variable resistance = 229 ohm\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.10 - Page No : 192"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "f=25 #in kHz\n",
      "f=f*10**3 # in Hz\n",
      "R1=3.1*10**3 #in ohm\n",
      "R2=25*10**3 #in ohm\n",
      "R4=100*10**3 #in ohm\n",
      "C1=5.2*10**-6 #in F\n",
      "omega= 2*pi*f \n",
      "# From C3/C1= R2/R4-R1/R3\n",
      "# C3= C1*(R2/R4-R1/R3)         (i)\n",
      "# and omega= 1/sqrt(R1*R3*C1*C3)\n",
      "# R3= 1/(omega**2*R1*C1*C3), putting this value in (i)\n",
      "C3= C1*R2/(R4*(1+R1**2*C1**2*omega**2)) # in F\n",
      "print \"Equivalent capacitance = %0.3f \u00b5\u00b5F\" %(C3*10**12)\n",
      "R3= 1/(omega**2*R1*C1*C3) # in ohm\n",
      "print \"Equivalent parallel resistance = %0.1f kohm\" %(R3*10**-3)\n",
      "\n",
      "\n",
      "# Note Evaluating the value of C3 in the book is wrong."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Equivalent capacitance = 0.203 \u00b5\u00b5F\n",
        "Equivalent parallel resistance = 12.4 kohm\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.11 - Page No :193"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "R2= 5 # in ohm\n",
      "R3= 2000 # in ohm\n",
      "R4= 2950 # in ohm\n",
      "C2= 0.5 # in miu F\n",
      "C2=C2*10**-6 # in F\n",
      "r2=0.4 # in  ohm\n",
      "f=450 # in Hz\n",
      "omega= 2*pi*f \n",
      "# Under Balace Condition Z1*Z4=Z2*Z3\n",
      "# [r1+1/(j*omega*C1)]*R4= [r2+R2+1/(j*omega*C2)]*R3\n",
      "# Equating the real parts we have, r1*R4= (r2+R2)*R3\n",
      "r1= (r2+R2)*R3/R4 # in ohm\n",
      "print \"Value of r1 = %0.3f ohm\" %r1\n",
      "# Equating imaginary parts we have R4/(j*omega*C1)= R3/(j*omega*C2)\n",
      "C1= R4/R3*C2 # in F\n",
      "print \"Value of C1 = %0.4f micro F\" %(C1*10**6) \n",
      "Tan_toh= omega*C1*r1 \n",
      "print \"Dissipation Factor = %0.3e\" %Tan_toh"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of r1 = 3.661 ohm\n",
        "Value of C1 = 0.7375 micro F\n",
        "Dissipation Factor = 7.634e-03\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.12 - Page No : 195"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "L1= 52.6 # in mH\n",
      "r1= 28.5 # in ohm\n",
      "R2= 1.68 # in ohm\n",
      "R3= 80 # resistance in ohm\n",
      "R4= 80 # resistance in ohm\n",
      "r2= r1*R3/R4-R2 # in ohm\n",
      "print \"Resistance of coil = %0.2f ohm\" %r2\n",
      "L2=L1*R3/R4 # in mH\n",
      "print \"Inductance of coil = %0.1f mH\" %L2 "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Resistance of coil = 26.82 ohm\n",
        "Inductance of coil = 52.6 mH\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.13 - Page No : 195"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "L= 47.8 # in mH\n",
      "R= 1.36 # in ohm\n",
      "R2= 100 # in ohm\n",
      "R3= 32.7 #in ohm\n",
      "R4= 100 #in ohm\n",
      "R1= R2*R3/R4-R # in ohm\n",
      "print \"Resistance of coil = %0.2f ohm\" %R1\n",
      "L1= R2/R4*L # in mH\n",
      "print \"Inductance of coil = %0.1f mH\" %L1 "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Resistance of coil = 31.34 ohm\n",
        "Inductance of coil = 47.8 mH\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.14 - Page No : 198"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "R2= 1000 # in ohm\n",
      "R3= 1000 #in ohm\n",
      "R4= 1000 #in ohm\n",
      "C4= 0.5 # in miu F\n",
      "C4= C4*10**-6 # in F\n",
      "R1= R2*R3/R4 # in ohm\n",
      "print \"Resistance of inductor = %0.f ohm\" %R1\n",
      "L1= C4*R2*R3 # in H\n",
      "print \"Inductance of inductor = %0.1f H\" %L1 "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Resistance of inductor = 1000 ohm\n",
        "Inductance of inductor = 0.5 H\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.15 - Page No : 200"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "r= 469 # in ohm\n",
      "R2= 1000 # in ohm\n",
      "R3= 218 #in ohm\n",
      "R4= 1000 #in ohm\n",
      "C= 10 # in miu F\n",
      "C= C*10**-6 # in F\n",
      "R1= R2*R3/R4 # in ohm\n",
      "print \"Resistance of inductor = %0.f ohm\" %R1\n",
      "L1= C*R2/R4*(r*(R3+R4)+R3*R4) # in H\n",
      "print \"Inductance of inductor = %0.3f H\" %L1\n",
      " "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Resistance of inductor = 218 ohm\n",
        "Inductance of inductor = 7.892 H\n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.16 - Page No : 200"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "r= 500 # in ohm\n",
      "R2= 400 # in ohm\n",
      "R3= 400 #in ohm\n",
      "R4= 400 #in ohm\n",
      "C= 2 # in miu F\n",
      "C= C*10**-6 # in F\n",
      "R= R2*R3/R4 # in ohm\n",
      "print \"Resistance of AB = %0.f ohm\" %R\n",
      "L= C*R2/R4*(r*(R3+R4)+R3*R4) # in H\n",
      "print \"Inductance of AB = %0.2f H\" %L"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Resistance of AB = 400 ohm\n",
        "Inductance of AB = 1.12 H\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.17 - Page No : 200"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "r= 100 # in ohm\n",
      "R2= 1000 # in ohm\n",
      "R3= 500 #in ohm\n",
      "R4= 1000 #in ohm\n",
      "C= 3 # in micro F\n",
      "C= C*10**-6 # in F\n",
      "Rx= R2*R3/R4 # in ohm\n",
      "print \"Value of Rx = %0.f ohm\" %Rx\n",
      "Lx= C*R2/R4*(r*(R3+R4)+R3*R4) # in H\n",
      "print \"Value of Lx = %0.2f H\" %Lx "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of Rx = 500 ohm\n",
        "Value of Lx = 1.95 H\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.18 - Page No : 203"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "R2= 1000 # in ohm\n",
      "R3= 16800 #in ohm\n",
      "R4= 833 #in ohm\n",
      "C4= 0.38 # in miu F\n",
      "C4= C4*10**-6 # in F\n",
      "f= 50 # in Hz\n",
      "omega=2*pi*f \n",
      "L1= R2*R3*C4/(1+(omega*C4*R4)**2) # in H\n",
      "print \"Unknown inductance = %0.2f H\" %L1 \n",
      "R1= R2*R3*R4*omega**2*C4**2/(1+(omega*C4*R4)**2) # in ohm\n",
      "print \"Unknown resistance = %0.2f ohm\" %R1"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Unknown inductance = 6.32 H\n",
        "Unknown resistance = 197.49 ohm\n"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.19 - Page No : 203"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "R1= 500 #in ohm\n",
      "R2= 1000 # in ohm\n",
      "R3= R2 #in ohm\n",
      "L1= 0.18 # in H\n",
      "f= 5000/(2*pi) # in Hz\n",
      "omega= 2*pi*f \n",
      "# L1= R2*R3*C4/(1+(omega*C4*R4)**2)     (i)  \n",
      "# and  R1= R2*R3*R4*omega**2*C4**2/(1+(omega*C4*R4)**2) or R1= omega**2*R4*C4*L1\n",
      "R4C4= R1/(omega**2*L1) \n",
      "# From eq (i)\n",
      "C4= L1*(1+(omega*R4C4)**2)/(R2*R3) # in F\n",
      "print \"The value of C = %0.4f micro F\" %(C4*10**6) \n",
      "R4= R4C4/C4 # in ohm\n",
      "print \"The value of R4 = %0.f ohm\" %R4"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of C = 0.2356 micro F\n",
        "The value of R4 = 472 ohm\n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.20 - Page No : 204"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "R2= 1000 #in ohm\n",
      "R3= 10000 # in ohm\n",
      "R4= 2000 #in ohm\n",
      "C4= 1*10**-6 # in F\n",
      "omega= 3000 # radians/sec\n",
      "L1= R2*R3*C4/(1+(omega*C4*R4)**2) # in H\n",
      "print \"Equivalent inductance of the network = %0.2f H\" %L1\n",
      "R1= R2*R3*R4*omega**2*C4**2/(1+(omega*C4*R4)**2) # in ohm\n",
      "print \"Equivalent resistance of the network = %0.3f kohm\" %(R1*10**-3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Equivalent inductance of the network = 0.27 H\n",
        "Equivalent resistance of the network = 4.865 kohm\n"
       ]
      }
     ],
     "prompt_number": 37
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.21 - Page No : 204"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "R2= 2410 #in ohm\n",
      "R3= 750 # in ohm\n",
      "R4= 64.5 #in ohm\n",
      "C4= 0.35*10**-6 # in F\n",
      "r4= 0.4 # series resistance of capacitor in ohm\n",
      "f=500 #/ in Hz\n",
      "omega= 2*pi*f # radians/sec\n",
      "R4= R4+r4 # in ohm\n",
      "R1= R2*R3*R4*omega**2*C4**2/(1+(omega*C4*R4)**2) # in ohm\n",
      "print \"Resistance of the choke coil = %0.2f ohm\" %R1\n",
      "L1= R2*R3*C4/(1+(omega*C4*R4)**2) # in H\n",
      "print \"Inductance of the choke coil = %0.4f H\" %L1\n",
      "\n",
      "# Note: Calculation of finding the value of L1 in the book is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Resistance of the choke coil = 141.11 ohm\n",
        "Inductance of the choke coil = 0.6294 H\n"
       ]
      }
     ],
     "prompt_number": 38
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.22 - Page No :205"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import atan2 \n",
      "#Given data\n",
      "R2= 834 # in \u03a9\n",
      "R3= 100 # in \u03a9\n",
      "C2= 0.124 # in \u00b5F\n",
      "C2= C2*10**-6 # in F\n",
      "C4= 0.1 # in \u00b5F\n",
      "C4= C4*10**-6 # in F\n",
      "L1= R2*R3*C4 # in H\n",
      "f= 2 # in kHz\n",
      "f= f*10**3 # in kHz\n",
      "print \"The value of L1 = %0.2f mH\" %(L1*10**3)\n",
      "R1= R3*C4/C2 # in \u03a9\n",
      "print \"The value of R1 = %0.2f \u03a9\" %R1\n",
      "pi_2_f_L1= 2*pi*f*L1 # value of 2*pi*f*L1\n",
      "i= 1j # complex number\n",
      "i_XL= i*pi_2_f_L1 #imaginary part\n",
      "Z= R1+i_XL # impedance in ohm\n",
      "print \"The magnitude of effective impedence = %0.2f \u03a9\" %abs(Z)\n",
      "theta= atan2(Z.imag,Z.real)*180/pi\n",
      "print \"The angle of effective impedence = %0.2f\u00b0\" %theta"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of L1 = 8.34 mH\n",
        "The value of R1 = 80.65 \u03a9\n",
        "The magnitude of effective impedence = 132.24 \u03a9\n",
        "The angle of effective impedence = 52.42\u00b0\n"
       ]
      }
     ],
     "prompt_number": 50
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.23 - Page No : 211"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "fr= 2 # in MHz\n",
      "fr=fr*10**6 # in Hz\n",
      "C=230+8 # in pF\n",
      "C=C*10**-12 # in F\n",
      "# Formula fr= 1/(2*pi*sqrt(L*C))\n",
      "L= 1/((2*pi*fr)**2*C) # in H\n",
      "print \"Value of L = %0.1f \u00b5H\" %(L*10**6)\n",
      "# From the first set of data\n",
      "fr= 1 # in MHz\n",
      "fr=fr*10**6 # in Hz\\\n",
      "C= 1/((2*pi*fr)**2*L) # in F\n",
      "print \"Value of C = %0.f pF\" %(C*10**12)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of L = 26.6 \u00b5H\n",
        "Value of C = 952 pF\n"
       ]
      }
     ],
     "prompt_number": 51
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.24 - Page No : 212"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "C1= 208 # in pF\n",
      "C1=C1*10**-12 # in F\n",
      "Q1= 80 \n",
      "C2= 184 # in pF\n",
      "C2=C2*10**-12 # in F\n",
      "Q2= 50 \n",
      "f=165 # in kHz\n",
      "f=f*10**3 # in Hz\n",
      "omega= 2*pi*f # in radians/sec\n",
      "# Part (i)\n",
      "Rm= 1/omega*(1/(C2*Q2)-1/(C1*Q1)) # in ohm\n",
      "print \"Resistive component of unknown impedence = %0.2f ohm\" %Rm\n",
      "# Part(ii)\n",
      "Xm= 1/omega*(1/C2-1/C1) # in ohm\n",
      "print \"Reactive component of unknown impedence = %0.f ohm\" %Xm"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Resistive component of unknown impedence = 46.88 ohm\n",
        "Reactive component of unknown impedence = 605 ohm\n"
       ]
      }
     ],
     "prompt_number": 52
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.25 - Page No : 212"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "C1= 160*10**-12 # in F\n",
      "C2= 36*10**-12 # in F\n",
      "f1=250 # in kHz\n",
      "f1=f1*10**3 # in Hz\n",
      "f2=500 # in kHz\n",
      "f2=f2*10**3 # in Hz\n",
      "Cd= (C1-4*C2)/3 # in F\n",
      "print \"Self Capacitance of the coil = %0.2f \u00b5\u00b5F\" %(Cd*10**12)\n",
      "# Formula f1= 1/(2*pi*sqrt(L*(C1+Cd)))\n",
      "L= 1/((2*pi*f1)**2*(C1+Cd)) # in H\n",
      "print \"Self inductance of the coil = %0.f \u00b5H\" %(L*10**6) "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Self Capacitance of the coil = 5.33 \u00b5\u00b5F\n",
        "Self inductance of the coil = 2451 \u00b5H\n"
       ]
      }
     ],
     "prompt_number": 53
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.26 - Page No : 213"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "C1= 251*10**-12 # in F\n",
      "C2= 50*10**-12 # in F\n",
      "f1=3 # in MHz\n",
      "f1=f1*10**6 # in Hz\n",
      "f2=6 # in MHz\n",
      "f2=f2*10**6 # in Hz\n",
      "Cd= (C1-4*C2)/3 # in F\n",
      "print \"Self Capacitance of the coil = %0.f pF\" %(Cd*10**12)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Self Capacitance of the coil = 17 pF\n"
       ]
      }
     ],
     "prompt_number": 54
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.27 - Page No : 213"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "C1= 1530 # in pF\n",
      "C2= 162 # in pF\n",
      "f1=1 # in MHz\n",
      "f1=f1*10**6 # in Hz\n",
      "f2=3 # in MHz\n",
      "f2=f2*10**6 # in Hz\n",
      "# f1= 1/(2*pi*sqrt(L*(C1+Cd)))\n",
      "#  f1= 1/(2*pi*sqrt(L*(C2+Cd))) and f2= 3*f1 so\n",
      "Cd= (C1-9*C2)/8 # in pF\n",
      "print \"Self capacitance of the coil = %0.f pF\" %Cd"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Self capacitance of the coil = 9 pF\n"
       ]
      }
     ],
     "prompt_number": 55
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.28 - Page No : 213"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "f= 450 # in kHz\n",
      "f=f*10**3 # in Hz\n",
      "C=250 # in pF\n",
      "C=C*10**-12 # in F\n",
      "Rsh= 0.75 # in ohm\n",
      "Q= 105 \n",
      "omega= 2*pi*f # in radians/sec\n",
      "# Formula f= 1/(2*pi*sqrt(L*C))\n",
      "L= 1/((2*pi*f)**2*C) # in H\n",
      "print \"Inductance of the coil = %0.f \u00b5H\" %(L*10**6)\n",
      "R= omega*L/Q-Rsh # in ohm\n",
      "print \"Resistance of the coil = %0.2f ohm\" %R"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Inductance of the coil = 500 \u00b5H\n",
        "Resistance of the coil = 12.72 ohm\n"
       ]
      }
     ],
     "prompt_number": 56
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.29 - Page No : 213"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "f= 500 # in kHz\n",
      "f=f*10**3 # in Hz\n",
      "C=120 # in pF\n",
      "C=C*10**-12 # in F\n",
      "R= 5 # in ohm\n",
      "r=0.02 # resistance used across the oscillatory circuit in ohm\n",
      "omega= 2*pi*f # in radians/sec\n",
      "Q_True= 1/(omega*C*R) \n",
      "Q_indicated= 1/(omega*C*(R+r)) \n",
      "PerError= (Q_True-Q_indicated)*100/Q_True # in %\n",
      "print \"Percentage Error = %0.1f %%\" %PerError"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Percentage Error = 0.4 %\n"
       ]
      }
     ],
     "prompt_number": 57
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.30 - Page No : 214"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "f1= 800 # in kHz\n",
      "f1=f1*10**3 # in Hz\n",
      "f2= 2.5 # in MHz\n",
      "f2=f2*10**6 # in Hz\n",
      "C1=95 # in pF\n",
      "C1=C1*10**-12 # in F\n",
      "# L= 1/(omega1**2*(C1+Cd))        (i)\n",
      "# L= 1/(omega2**2*Cd)                (ii)\n",
      "# From eq(i) and eq(ii)\n",
      "Cd= f1**2*C1/(f2**2-f1**2) # in F\n",
      "print \"Self capacitance of the radio coil = %0.2f pF\" %(Cd*10**12) "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Self capacitance of the radio coil = 10.84 pF\n"
       ]
      }
     ],
     "prompt_number": 58
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  7.31 - Page No : 214"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Given data\n",
      "f1= 1 # in MHz\n",
      "f1=f1*10**6 # in Hz\n",
      "f2= 2 # in MHz\n",
      "f2=f2*10**6 # in Hz\n",
      "C1=480 # in pF\n",
      "C1=C1*10**-12 # in F\n",
      "C2=90 # in pF\n",
      "C2=C2*10**-12 # in F\n",
      "R=10 # in ohm\n",
      "omega1= 2*pi*f1 # in radians/sec\n",
      "omega2= 2*pi*f2 # in radians/sec\n",
      "\n",
      "# Part (i)\n",
      "Cd= (C1-4*C2)/3 # in F\n",
      "print \"(i)  : Self capacitance of the coil = %0.f pF\" %(Cd*10**12)\n",
      "\n",
      "# Part(ii)\n",
      "Q_indicated1= 1/(omega1*(C1+Cd)*R) \n",
      "print \"(ii) : Indicated or effective Q for first measurement = %0.3f\" %Q_indicated1\n",
      "Q_True1=  1/(omega1*C1*R) \n",
      "print \"True Q for first measurement = %0.3f \" %Q_True1\n",
      "Q_indicated2= 1/(omega2*(C2+Cd)*R) \n",
      "print \"Indicated or effective Q for second measurement = %0.3f\" %Q_indicated2\n",
      "Q_True2=  1/(omega2*C2*R) \n",
      "print \"True Q for second measurement = %0.2f\" %Q_True2 "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)  : Self capacitance of the coil = 40 pF\n",
        "(ii) : Indicated or effective Q for first measurement = 30.607\n",
        "True Q for first measurement = 33.157 \n",
        "Indicated or effective Q for second measurement = 61.213\n",
        "True Q for second measurement = 88.42\n"
       ]
      }
     ],
     "prompt_number": 60
    }
   ],
   "metadata": {}
  }
 ]
}