{
 "metadata": {
  "name": "",
  "signature": "sha256:4dacb9cd40c034de14bd116989b8eaf4736b7fcde46866cbd61e09de312f6cad"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 4 : Dynamic Characteristics of Instruments and Measurement systems"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.1  Page No : 137"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "# calculating the temperature after 1.5 s\n",
      "\n",
      "# Variables\n",
      "th0 = 100.;\n",
      "t = 1.5;\n",
      "tc = 3.5;\n",
      "\n",
      "# Calculations\n",
      "th = th0*(1-math.exp(-t/tc));\n",
      "\n",
      "# Results\n",
      "print \"temperature after 1.5 s (degree C)\", th\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "temperature after 1.5 s (degree C) 34.8560942469\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.2  Page No : 139"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "# calculate time to read half of the temperature difference\n",
      "# Variables\n",
      "tc = 10./5;\n",
      "th = 1.;\n",
      "th0 = 2.;\n",
      "\n",
      "# Calculations\n",
      "t = -tc*math.log(1-(th/th0));\n",
      "\n",
      "# Results\n",
      "print \"Time to read half of the temperature difference (s)\", t\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time to read half of the temperature difference (s) 1.38629436112\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.4  Page No : 141"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "# Calculate the temperature after 10s\n",
      "\n",
      "# Variables\n",
      "th0 = 25;\n",
      "thi = 150;\n",
      "t = 10.;\n",
      "tc = 6;\n",
      "\n",
      "# Calculations\n",
      "th = th0+(thi-th0)*(math.exp(-t/tc));\n",
      "\n",
      "# Results\n",
      "print \"the temperature after 10s (degree C)\", th\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the temperature after 10s (degree C) 48.6094503547\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.5  Page No : 143"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "# Calculate the value of resistance after 15s\n",
      "\n",
      "# Variables\n",
      "R0 = 29.44;\n",
      "Rs = 100.;\n",
      "t = 15.;\n",
      "tc = 5.5;\n",
      "\n",
      "# Calculations\n",
      "R_15 = Rs+R0*(1-math.exp(-t/tc));\n",
      "\n",
      "# Results\n",
      "print \"value of resistance after 15s(ohm)\", R_15\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "value of resistance after 15s(ohm) 127.514700449\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.6  Page No : 145"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "# Calculate the depth after one hour\n",
      "\n",
      "# Variables\n",
      "Qm = 0.16*10**-3;\n",
      "Hin = 1.2;\n",
      "K1 = Qm/(Hin)**0.5;\n",
      "Qo = 0.2*10**-3;\n",
      "Ho = (Qo/K1)**2;\n",
      "R = Hin/Qm;\n",
      "C = 0.1;\n",
      "tc = R*C;\n",
      "t = 3600;\n",
      "\n",
      "# Calculations\n",
      "H = Ho+(Hin-Ho)*math.exp(-t/tc);\n",
      "\n",
      "# Results\n",
      "print \"the depth after one hour(m)\", H\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the depth after one hour(m) 1.86944492074\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.8  Page No : 147"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "#Calculate time constant\n",
      "\n",
      "# Variables\n",
      "S = 3.5;\n",
      "Ac = (math.pi/4)*(0.25)**2;\n",
      "alpha = 0.18*10**-3;\n",
      "\n",
      "# Calculations and Results\n",
      "Vb = S*Ac/alpha;\n",
      "print \"volume of bulb(mm2)\", Vb\n",
      "\n",
      "Rb = ((Vb/math.pi)*(3/.4))**(1./3);\n",
      "Ab = 4*math.pi*Rb**2;\n",
      "D = 13.56*10**3;\n",
      "s = 139;\n",
      "H = 12;\n",
      "tc = (D*s*Vb*10**-9)/(H*Ab*10**-6);\n",
      "print \"time constant (s)\", tc\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "volume of bulb(mm2) 954.476934684\n",
        "time constant (s) 68.8965695836\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.9  Page No : 149"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "ess = 5;\n",
      "A = 0.1;\n",
      "\n",
      "# Calculations\n",
      "tc = ess/A;\n",
      "\n",
      "# Results\n",
      "print \"time constant(s)\", tc\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "time constant(s) 50.0\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.10  Page No : 151"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "# Calculate the temperature at a depth of 1000 m\n",
      "\n",
      "# Variables\n",
      "th0 = 20.;\n",
      "t = 2000.;\n",
      "\n",
      "# Calculations\n",
      "thr = th0-0.005*(t-50)-0.25*math.exp(-t/50);\n",
      "\n",
      "# Results\n",
      "print \"temperature at a depth of 1000 m (degree C)\", thr\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "temperature at a depth of 1000 m (degree C) 10.25\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.11  Page No : 153"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "# Calculate the value of resistance at different values of time\n",
      "\n",
      "# Variables\n",
      "Gain = 0.3925;\n",
      "T = 75.;\n",
      "p_duration = Gain*T;\n",
      "tc = 5.5;\n",
      "Rin = 100.;\n",
      "t = 1;\n",
      "\n",
      "# Calculations and Results\n",
      "Rt = p_duration*(1-math.exp(-t/tc))+Rin;\n",
      "print \"Value of resistance after 1s(ohm) = \", Rt\n",
      "t = 2;\n",
      "Rt = p_duration*(1-math.exp(-t/tc))+Rin;\n",
      "print \"Value of resistance after 2s(ohm) = \", Rt\n",
      "t = 3;\n",
      "Rt = p_duration*(1-math.exp(-t/tc))+Rin;\n",
      "print \"Value of resistance after 3s(ohm) = \", Rt\n",
      "R_inc = Rt-Rin;\n",
      "t = 5;\n",
      "Rt = (R_inc)*(math.exp(-(t-3)/(5.5)))+Rin;\n",
      "print \"Value of resistance after 5s(ohm) = \", Rt\n",
      "t = 10;\n",
      "Rt = (R_inc)*(math.exp(-(t-3)/(5.5)))+Rin;\n",
      "print \"Value of resistance after 10s(ohm) = \", Rt\n",
      "t = 20;\n",
      "Rt = (R_inc)*(math.exp(-(t-3)/(5.5)))+Rin;\n",
      "print \"Value of resistance after 20s(ohm) = \", Rt\n",
      "t = 30;\n",
      "Rt = (R_inc)*(math.exp(-(t-3)/(5.5)))+Rin;\n",
      "print \"Value of resistance after 30s(ohm) = \", Rt"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of resistance after 1s(ohm) =  104.893898474\n",
        "Value of resistance after 2s(ohm) =  108.974200608\n",
        "Value of resistance after 3s(ohm) =  112.376164418\n",
        "Value of resistance after 5s(ohm) =  108.603215552\n",
        "Value of resistance after 10s(ohm) =  103.46615228\n",
        "Value of resistance after 20s(ohm) =  100.562627957\n",
        "Value of resistance after 30s(ohm) =  100.091326114\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.12  Page No : 155"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "M = 8*10**-3;\n",
      "K = 1000.;\n",
      "\n",
      "# Calculations and Results\n",
      "wn = (K/M)**0.5;\n",
      "print \"for critically damped system eta = 1\",\n",
      "B = 2*(K*M);\n",
      "print \"Damping constant for critically damped system (N/ms-1) = \", B\n",
      "eta = 0.6;\n",
      "wd = wn*(1-eta**2)**0.5;\n",
      "print \"frequency of damped oscillations (rad/s) = \", wd\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "for critically damped system eta = 1 Damping constant for critically damped system (N/ms-1) =  16.0\n",
        "frequency of damped oscillations (rad/s) =  282.842712475\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.13  Page No : 157"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "K = (40.*10**-6)/(math.pi/2);\n",
      "J = 0.5*10**-6;\n",
      "B = 5.*10**-6;\n",
      "\n",
      "# Calculations and Results\n",
      "eta = B/(2*(K*J)**0.5);\n",
      "print \"damping ratio = \", eta\n",
      "wn = (K/J)**0.5;\n",
      "print \"natural frequency (rad/sec)\", wn\n",
      "wd = wn*(1-(eta)**2)**0.5;\n",
      "print \"frequency of damped oscillations (rad/s)\", wd\n",
      "tc = 1/wn;\n",
      "print \"time constant (s)\", tc\n",
      "ess = 2*eta/wn;\n",
      "print \" steady state error (V)  = \", \"for a ramp input of 5V\"\n",
      "ess = 5*2*eta/wn;\n",
      "print \"\", ess\n",
      "T_lag = 2*eta*tc;\n",
      "print \"Time lag (s)\", T_lag\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "damping ratio =  0.70062390205\n",
        "natural frequency (rad/sec) 7.13649646461\n",
        "frequency of damped oscillations (rad/s) 5.09210975819\n",
        "time constant (s) 0.14012478041\n",
        " steady state error (V)  =  for a ramp input of 5V\n",
        " 0.981747704247\n",
        "Time lag (s) 0.196349540849\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.14  Page No : 159"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "# Calculate the natural  frequency \n",
      "\n",
      "# Variables\n",
      "wn = 2*math.pi*30;\n",
      "print \" for a frequency of 30 Hz  wn = (K/M+5*10**-3)**0.5.........(i)\",\n",
      "print \"But wn = (K/M)**0.5.........(ii)\",\n",
      "print \"for a frequency of 25 Hz  wn = (K/M+5*10**-3+5*10**-3)**0.5.........(iii) \",\n",
      "print \" (ii) and (iii)\", \"on solving (i)\"\n",
      "\n",
      "# Calculations and Results\n",
      "M = 6.36*10**-3;\n",
      "K = 403.6;\n",
      "print \"M = \", M\n",
      "print \"K = \", K\n",
      "wn = (K/M)**0.5;\n",
      "f = wn/(2*math.pi);\n",
      "print \"natural frequency (Hz)\", f\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " for a frequency of 30 Hz  wn = (K/M+5*10**-3)**0.5.........(i) But wn = (K/M)**0.5.........(ii) for a frequency of 25 Hz  wn = (K/M+5*10**-3+5*10**-3)**0.5.........(iii)   (ii) and (iii) on solving (i)\n",
        "M =  0.00636\n",
        "K =  403.6\n",
        "natural frequency (Hz) 40.0928706266\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.15  Page No : 161"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "K = 60.*10**3;\n",
      "M = 30.;\n",
      "\n",
      "# Calculations and Results\n",
      "wn = (K/M)**0.5;\n",
      "print \"natural frequency (rad/sec)\", wn\n",
      "eta = 0.7;\n",
      "ts = 4/(eta*wn);\n",
      "print \"setteling time (s)\", ts\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "natural frequency (rad/sec) 44.72135955\n",
        "setteling time (s) 0.127775313\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.16  Page No : 163"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "# Calculate time lag and ratio of output and input\n",
      "\n",
      "# Variables\n",
      "print \"when time period is 600s\"\n",
      "w = 2*math.pi/600;\n",
      "tc = 60.;\n",
      "\n",
      "# Calculations and Results\n",
      "T_lag = (1/w)*math.atan(w*tc);\n",
      "print \"time lag (s) = \", T_lag\n",
      "M = 1/((1+(w*tc)**2)**0.5);\n",
      "print \"ratio of output and input = \", M\n",
      "print \"when time period is 120s\",\n",
      "w = 2*math.pi/120;\n",
      "tc = 60;\n",
      "T_lag = (1/w)*math.atan(w*tc);\n",
      "print \"time lag (s) = \", T_lag\n",
      "M = 1/((1+(w*tc)**2)**0.5);\n",
      "print \"ratio of output and input = \", M\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "when time period is 600s\n",
        "time lag (s) =  53.5698460589\n",
        "ratio of output and input =  0.846733015965\n",
        "when time period is 120s time lag (s) =  24.1144042829\n",
        "ratio of output and input =  0.303314471053\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.17  Page No : 165"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "# Calculate the maximum allowable time constant and phase shift\n",
      "\n",
      "# Variables\n",
      "M = 1-0.05;\n",
      "w = 2*math.pi*100;\n",
      "\n",
      "# Calculations and Results\n",
      "tc = (((1/M**2)-1)/(w**2))**0.5;\n",
      "print \"maximum allowable time constant (s)\", tc\n",
      "print \"phase shift at 50 Hz (degree) = \",\n",
      "ph = (-math.atan(2*math.pi*50*tc))*(180/math.pi);\n",
      "print ph\n",
      "print \"phase shift at 100 Hz (degree) = \",\n",
      "ph = (-math.atan(2*math.pi*100*tc))*(180/math.pi);\n",
      "print  ph\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "maximum allowable time constant (s) 0.00052311700055\n",
        "phase shift at 50 Hz (degree) =  -9.33268272936\n",
        "phase shift at 100 Hz (degree) =  -18.1948723388\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.18  Page No : 167"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "# Calculate maximum value of indicated temperature and delay time\n",
      "\n",
      "# Variables\n",
      "T = 120.;\n",
      "w = 2*math.pi/T;\n",
      "tc1 = 40.;\n",
      "tc2 = 20.;\n",
      "\n",
      "# Calculations and Results\n",
      "M = (1/((1+(w*tc1)**2)**0.5))*(1/((1+(w*tc2)**2)**0.5));\n",
      "M_temp = M*10;\n",
      "print \"maximum value of indicated temperature (degree C)\", M_temp\n",
      "ph = ((math.atan(w*tc1)+math.atan(w*tc2)));\n",
      "T_lag = ph/w;\n",
      "print \"Time lag (s)\", T_lag\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "maximum value of indicated temperature (degree C) 2.975684577\n",
        "Time lag (s) 36.9326231389\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.19  Page No : 169"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "\n",
      "# Find the output \n",
      "print \"when tc = 0.2\",\n",
      "print \"output = 1/(1+(2*0.2)**2)**0.5]math.sin[2t-math.atan(2*0.2)]+3/(1+(2*0.2)**2)**0.5]math.sin[20t-math.atan(20*0.2)]\",\n",
      "print \"on solving   output = 0.93 math.sin(2t-21.8)+0.073 math.sin(20t-76)\",\n",
      "print \"when tc = 0.002\",\n",
      "print \"output = 1/(1+(2*0.002)**2)**0.5]math.sin[2t-math.atan(2*0.002)]+3/(1+(2*0.002)**2)**0.5]math.sin[20t-math.atan(20*0.002)]\",\n",
      "print \"on solving   output =  1math.sin(2t-0.23)+0.3 math.sin(20t-2.3)\",\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "when tc = 0.2 output = 1/(1+(2*0.2)**2)**0.5]math.sin[2t-math.atan(2*0.2)]+3/(1+(2*0.2)**2)**0.5]math.sin[20t-math.atan(20*0.2)] on solving   output = 0.93 math.sin(2t-21.8)+0.073 math.sin(20t-76) when tc = 0.002 output = 1/(1+(2*0.002)**2)**0.5]math.sin[2t-math.atan(2*0.002)]+3/(1+(2*0.002)**2)**0.5]math.sin[20t-math.atan(20*0.002)] on solving   output =  1math.sin(2t-0.23)+0.3 math.sin(20t-2.3)\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.20  Page No : 171"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#Calculate maximum and minimum value of indicated temperature, phase shift, time lag \n",
      "\n",
      "# Variables\n",
      "T_max = 640.;\n",
      "T_min = 600.;\n",
      "T_mean = (T_max+T_min)/2;\n",
      "Ai = T_mean-T_min;\n",
      "w = 2*math.pi/80;\n",
      "tc = 10;\n",
      "\n",
      "# Calculations and Results\n",
      "Ao = Ai/((1+(w*tc)**2))**0.5;\n",
      "T_max_indicated = T_mean+Ao;\n",
      "print \"Maximum value of indicated temperature(degree C) = \", T_max_indicated\n",
      "T_min_indicated = T_mean-Ao;\n",
      "print \"Minimum value of indicated temperature(degree C) = \", T_min_indicated\n",
      "ph = -math.atan(w*tc);\n",
      "Time_lag = -ph/w;\n",
      "print \"Time lag (s)\", Time_lag\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum value of indicated temperature(degree C) =  635.728782002\n",
        "Minimum value of indicated temperature(degree C) =  604.271217998\n",
        "Time lag (s) 8.47689466383\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.21  Page No : 173"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "# determine damping ratio\n",
      "\n",
      "\n",
      "# Variables\n",
      "w = 2.;\n",
      "K = 1.5;\n",
      "J = 200.*10**-3;\n",
      "wn = (K/J)**0.5;\n",
      "u = w/wn;\n",
      "M = 1.1;\n",
      "\n",
      "# Calculations and Results\n",
      "eta = (((1/(M**2))-((1-u**2)**2))/(2*u)**2)**0.5;\n",
      "print \"damping ratio = \", eta\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "damping ratio =  0.534147321328\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.22  Page No : 175"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "# Calculate the frequency range\n",
      "\n",
      "# Variables\n",
      "eta = 0.6;\n",
      "fn = 1000;\n",
      "M = 1.1;\n",
      "print \"M = 1/[[(1-u**2)**2]+(2*u*eta)**2]**0.5 ..........(i)\",\n",
      "print \"on solving u**4-0.5u**2+0.173 = 0\",\n",
      "print \"the above equation gives imaginary values for frequency so for eta = 0.6 the output is not 1.1\",\n",
      "print \" on solving equation (i) we have\", \"Now let M = 0.9\"\n",
      "print \"u**4-0.56u**2-0.234 = 0\",\n",
      "print \"on solving u = 0.916\",\n",
      "\n",
      "# Calculations and Results\n",
      "u = 0.916;\n",
      "f = u*fn;\n",
      "print \"maximum value of range (Hz) = \", f\n",
      "print \" the range of the frequency is from 0 to 916 Hz\", \"So\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "M = 1/[[(1-u**2)**2]+(2*u*eta)**2]**0.5 ..........(i) on solving u**4-0.5u**2+0.173 = 0 the above equation gives imaginary values for frequency so for eta = 0.6 the output is not 1.1  on solving equation (i) we have Now let M = 0.9\n",
        "u**4-0.56u**2-0.234 = 0 on solving u = 0.916 maximum value of range (Hz) =  916.0\n",
        " the range of the frequency is from 0 to 916 Hz So\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.23  Page No : 177"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "# determine the error\n",
      "\n",
      "# Variables\n",
      "w = 6.;\n",
      "wn = 4.;\n",
      "u = w/wn;\n",
      "eta = 0.66;\n",
      "\n",
      "# Calculations\n",
      "M = 1/(((1-u**2)**2)+(2*eta*u)**2)**0.5;\n",
      "Error = (M-1)*100;\n",
      "\n",
      "# Results\n",
      "print \"error (%) = \", Error\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "error (%) =  -57.2934157194\n"
       ]
      }
     ],
     "prompt_number": 23
    }
   ],
   "metadata": {}
  }
 ]
}