{
 "metadata": {
  "name": "",
  "signature": "sha256:57634c93bf4d4aea76e807a2cbb9e510f617e9cf546f62a2de10f5bf9157d3c1"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h1>Chapter 29: parallel resonance and Q-factor</h1>"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 1, page no. 521</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "R  =  10;#  in  ohms\n",
      "L  =  0.005;#  IN  Henry\n",
      "C  =  0.25e-6;#  IN  fARADS\n",
      "V  =  50;#in  volts\n",
      "\n",
      "#calculation:\n",
      " #Resonant  frequency,  for  parallel\n",
      "fr  =  ((1/(L*C)  -  ((R**2)/(L**2)))**0.5)/(2*math.pi)\n",
      " #dynamic  resistance\n",
      "Rd  =  L/(C*R)\n",
      " #Current  at  resonance\n",
      "Ir  =  V/Rd\n",
      "wr  =  2*math.pi*fr\n",
      " #Q-factor  at  resonance,  Q  =  wr*L/R\n",
      "Qr  =  wr*L/R\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  (a)Resonance  frequency  is  \",round(fr,2),\"  Hz\\n\"\n",
      "print  \"\\n  (b)dynamic  resistance  \",round(Rd,2),\"  ohm\\n\"\n",
      "print  \"\\n  (c)Current  at  resonance,  Ir  is  \",round(Ir,2),\"  A\\n\"\n",
      "print  \"\\n  (d)Q-factor  at  resonance  is  \",round(Qr,2),\"\\n\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  (a)Resonance  frequency  is   4490.31   Hz\n",
        "\n",
        "\n",
        "  (b)dynamic  resistance   2000.0   ohm\n",
        "\n",
        "\n",
        "  (c)Current  at  resonance,  Ir  is   0.02   A\n",
        "\n",
        "\n",
        "  (d)Q-factor  at  resonance  is   14.11 \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 2, page no. 521</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "RL1  =  0;#  in  ohms\n",
      "RL2  =  30;#  in  ohms\n",
      "L  =  0.100;#  IN  Henry\n",
      "C  =  40e-6;#  IN  fARADS\n",
      "V  =  50;#in  volts\n",
      "\n",
      "#calculation:\n",
      " #for  RL1\n",
      " #Resonant  frequency,\n",
      "wr1  =  (1/(L*C))**0.5\n",
      "fr1  =  wr1/(2*math.pi)\n",
      " #for  RL2\n",
      " #Resonant  frequency,\n",
      "wr2  =  (1/(L*C)  -  ((RL2**2)/(L**2)))**0.5\n",
      "fr2  =  wr2/(2*math.pi)\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  (a)Resonance  frequency  at  RL  =  0  is  \",round(fr1,2),\"  Hz\"\n",
      "print  \"\\n  (b)Resonance  frequency  at  RL  =  30  ohm  is  \",round(fr2,2),\"  Hz\\n\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  (a)Resonance  frequency  at  RL  =  0  is   79.58   Hz\n",
        "\n",
        "  (b)Resonance  frequency  at  RL  =  30  ohm  is   63.66   Hz\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 3, page no. 523</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "R  =  150;#  in  ohms\n",
      "L  =  0.120;#  IN  Henry\n",
      "V  =  20;#in  volts\n",
      "fr  =  4000;#  in  Hz\n",
      "\n",
      "#calculation:\n",
      " #capacitance,  C\n",
      "C  =  1/(L*((2*math.pi*fr)**2  +  ((R**2)/(L**2))))\n",
      "Rd  =  L/(C*R)\n",
      " #Current  at  resonance\n",
      "Ir  =  V/Rd\n",
      "wr  =  2*math.pi*fr\n",
      " #Q-factor  at  resonance,  Q  =  wr*L/R\n",
      "Qr  =  wr*L/R\n",
      " #bandwidth,.(f2  \u2212  f1)\n",
      "bw  =  fr/Qr\n",
      " #upper  half-power  frequency,  f2\n",
      "f2  =  (bw  +  ((bw**2)  +  4*(fr**2))**0.5)/2\n",
      " #lower  half-power  frequency,  f1\n",
      "f1  =  f2  -  bw\n",
      " #impedance  at  the  \u22123  dB  frequencies\n",
      "Z  =  Rd/(2**0.5)\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  (a)the  capacitance  of  the  capacitor,C  is  \",round(C*1E6,2),\"uF\"\n",
      "print  \"\\n  (b)dynamic  resistance  \",round(Rd,2),\"ohm\\n\"\n",
      "print  \"\\n  (c)Current  at  resonance,  Ir  is  \",round(Ir*1000,2),\"mA\\n\"\n",
      "print  \"\\n  (d)Q-factor  at  resonance  is  \",round(Qr,2),\"\\n\"\n",
      "print  \"\\n  (e)bandwidth  is  \",round(bw,2),\"  Hz\\n\"\n",
      "print  \"\\n  (f)the  upper  half-power  frequency,  f2  is  \",round(f2,2),\"  Hz  and \"\n",
      "print   \" the  lower  half-power  frequency,  f1  is  \",round(f1,2),\"  Hz\\n\"\n",
      "print  \"\\n  (g)impedance  at  the  -3  dB  frequencies  is  \",round(Z,2),\" ohm\\n\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  (a)the  capacitance  of  the  capacitor,C  is   0.01 uF\n",
        "\n",
        "  (b)dynamic  resistance   60788.85 ohm\n",
        "\n",
        "\n",
        "  (c)Current  at  resonance,  Ir  is   0.33 mA\n",
        "\n",
        "\n",
        "  (d)Q-factor  at  resonance  is   20.11 \n",
        "\n",
        "\n",
        "  (e)bandwidth  is   198.94   Hz\n",
        "\n",
        "\n",
        "  (f)the  upper  half-power  frequency,  f2  is   4100.71   Hz  and \n",
        " the  lower  half-power  frequency,  f1  is   3901.76   Hz\n",
        "\n",
        "\n",
        "  (g)impedance  at  the  -3  dB  frequencies  is   42984.21  ohm\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 4, page no. 525</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "RL  =  5;#  in  ohms\n",
      "L  =  0.002;#  IN  Henry\n",
      "C  =  25e-6;#  IN  fARADS\n",
      "Rc  =  3;#  in  ohms\n",
      "\n",
      "#calculation:\n",
      " #Resonant  frequency,  for  parallel\n",
      "fr  =  (1/(2*math.pi*((L*C)**0.5)))*((RL**2  -  (L/C))/(Rc**2  -  (L/C)))**0.5\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  resonant  frequency,  fr  is  \",round(fr,2),\"  Hz\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  resonant  frequency,  fr  is   626.45   Hz"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 5, page no. 525</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "RL  =  3;#  in  ohms\n",
      "fr  =  1000;#  in  Hz\n",
      "Xc  =  10;#  IN  ohms\n",
      "Rc  =  4;#  in  ohms\n",
      "\n",
      "#calculation:\n",
      "XL1  =  (((Rc**2  +  Xc**2)/Xc)  +  ((((Rc**2  +  Xc**2)/Xc)**2)  -  4*(RL**2))**0.5)/2\n",
      "XL2  =  (((Rc**2  +  Xc**2)/Xc)  -  ((((Rc**2  +  Xc**2)/Xc)**2)  -  4*(RL**2))**0.5)/2\n",
      "wr  =  2*math.pi*fr\n",
      " #inductance\n",
      "L1  =  XL1/wr\n",
      "L2  =  XL2/wr\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  inductance  is  either  \",round(L1*1000,2),\"mH  or  \",round(L2*1000,2),\"mH\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  inductance  is  either   1.71 mH  or   0.13 mH"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 6, page no. 526</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "QL  =  60;#  Q-factor\n",
      "Qc  =  300;#  Q-factor\n",
      "\n",
      "#calculation:\n",
      "QT  =  QL*Qc/(QL  +  Qc)\n",
      "\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  the  overall  Q-factor  is  \",round(QT,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  the  overall  Q-factor  is   50.0"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 7, page no. 527</h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "import math\n",
      "import cmath\n",
      "#initializing  the  variables:\n",
      "C  =  10.61E-9;#  in  Farad\n",
      "bw  =  500;#  in  Hz\n",
      "fr  =  150000;#  in  Hz\n",
      "x  =  0.004\n",
      "\n",
      "#calculation:\n",
      " #Q-factor\n",
      "Q  =  fr/bw\n",
      "wr  =  2*math.pi*fr\n",
      " #dynamic  resistance,  RD\n",
      "Rd =  Q/(C*wr)\n",
      "de =  x\n",
      "Z  =  Rd/(1  +  (2*de*Q*1j))\n",
      "\n",
      "#Results\n",
      "print  \"\\n\\n  Result  \\n\\n\"\n",
      "print  \"\\n  (a)Q-factor  \",round(Q,2),\"\"\n",
      "print  \"\\n  (b)dynamic  resistance  \",round(Rd,2),\"ohm\"\n",
      "print  \"\\n  (c)magnitude  of  the  impedance  \",round(abs(Z),2),\"ohm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "\n",
        "  Result  \n",
        "\n",
        "\n",
        "\n",
        "  (a)Q-factor   300.0 \n",
        "\n",
        "  (b)dynamic  resistance   30000.93 ohm\n",
        "\n",
        "  (c)magnitude  of  the  impedance   11538.82 ohm"
       ]
      }
     ],
     "prompt_number": 8
    }
   ],
   "metadata": {}
  }
 ]
}