{
 "metadata": {
  "name": "",
  "signature": "sha256:8e99bc6fbce377831d9d5264a85c645ae2d9072f899aca1128c61ad0649fa729"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h1>Chapter 4: Acceleration Vibration and Density<h1>"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 4.1, Page Number:209 <h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "#(a)\n",
      "\n",
      "#variable Declaration\n",
      "k=50.0                       #Spring constant  \n",
      "m=0.005                      # mass in kg\n",
      "\n",
      "#calculation\n",
      "wn=math.sqrt(k/m)\n",
      "\n",
      "#result\n",
      "print('(a)\\nNatural frequency(wn)= %d rad/s' %wn)\n",
      "\n",
      "\n",
      "#(b)\n",
      "\n",
      "#calculation\n",
      "Cc=2*(m*k)**(0.5)\n",
      "\n",
      "#result\n",
      "print('\\n(b)\\nCc=%d' %Cc)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)\n",
        "Natural frequency(wn)= 100 rad/s\n",
        "\n",
        "(b)\n",
        "Cc=1"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 4.2, Page Number:209<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#(a)\n",
      "import math\n",
      "\n",
      "#variable Declaration\n",
      "Cc=1.0                     # damping ratio \n",
      "C=0.7*Cc                   # Critical damping ratio   \n",
      "m=0.005                    # mass\n",
      "k=50.0                     # spring constant\n",
      "\n",
      "#calculation\n",
      "w=math.sqrt((k/m)-(C/(2*m))**2)\n",
      "\n",
      "#result\n",
      "print('(a)\\nw=%.1f rad/s' %w)\n",
      "\n",
      "#(b)\n",
      "\n",
      "#variable Declaration\n",
      "w1=250.0                    # angular velocity\n",
      "\n",
      "#calculation\n",
      "theta=C*w1/(k-m*w1**2)\n",
      "print('\\ntheta=%f' %theta)\n",
      "fi=math.atan(-theta)\n",
      "fi=fi*180.0/math.pi\n",
      "\n",
      "#result\n",
      "print('\\nfi = %d\u00b0'%fi)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)\n",
        "w=71.4 rad/s\n",
        "\n",
        "theta=-0.666667\n",
        "\n",
        "fi = 33\u00b0"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 4.3, PAge Number: 210<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "\n",
      "#variable Declaration\n",
      "m=0.005                # mass  \n",
      "c=0.7                  # damping ratio\n",
      "\n",
      "#calculation\n",
      "y=-math.log(0.01)\n",
      "t=y*2*m/c\n",
      "\n",
      "#result\n",
      "print('t=%.4f Secs' %t)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "t=0.0658 Secs"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 4.4, Page Number:210<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#variable Declaration\n",
      "rg1=1200.0                        #resistance in Ohm\n",
      "rg2=1200.0                        #resistance in Ohm\n",
      "rg3=1200.0                        #resistance in Ohm\n",
      "rg4=1200.0                        #resistance in Ohm\n",
      "\n",
      "#calculation\n",
      "D1=rg1*5.0/100.0\n",
      "D2=rg2*5.0/100.0\n",
      "D3=rg3*5.0/100.0\n",
      "D4=rg4*5.0/100.0\n",
      "E=12.0\n",
      "v=E*(((rg1+D1)/(rg1+D1+rg2-D2))-((rg4-D4)/(rg3+D3+rg4-D4)))\n",
      "v=v*1000.0\n",
      "\n",
      "#result\n",
      "print('V0=%d mV' %v)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "V0=600 mV"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 4.5, Page Number:211<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#variable declaration\n",
      "g=0.06                  # voltage sensitivity\n",
      "\n",
      "#calculation\n",
      "t=2.5*10**-3\n",
      "p=20*9.8*10**4\n",
      "E=g*t*p\n",
      "\n",
      "#Result\n",
      "print('E=%d V' %E)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "E=294 V"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 4.6, Page Number: 211<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#resistance in Ohm\n",
      "c0=25.0                        # capacitance in pF\n",
      "x0=0.5                         # distance between plates\n",
      "x1=0.05                        # steady state displacement \n",
      "\n",
      "#calculations\n",
      "c1=c0*x0/(x0-x1)\n",
      "c2=c0*x0/(x0+x1)\n",
      "\n",
      "#result\n",
      "print('C1=%.2f pF\\nC2=%.2f pF'%(c1,c2))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "C1=27.78 pF\n",
        "C2=22.73 pF"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 4.7, Page Number: 211<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#(a)\n",
      "\n",
      "sg_at_60=1.02\n",
      "\n",
      "#calculation\n",
      "API=(141.5/sg_at_60)-131.5\n",
      "\n",
      "#result\n",
      "print('(a)\\nDegrees API = %.2f\u00b0API' %API)\n",
      "\n",
      "#(b)\n",
      "\n",
      "#calculation\n",
      "Be=145-145/sg_at_60\n",
      "\n",
      "#result\n",
      "print('\\n(b)\\nDegrees Baume(heavy) = %.1f\u00b0Be' %Be)\n",
      "\n",
      "\n",
      "#(c)\n",
      "\n",
      "#calculation\n",
      "Bk=(sg_at_60-1)*1000\n",
      "\n",
      "#result\n",
      "print('\\n(c)\\nDegrees Barkometer = %d\u00b0Bk' %Bk)\n",
      "\n",
      "#(d)\n",
      "\n",
      "#calculation\n",
      "Q=(sg_at_60-1)*1000\n",
      "\n",
      "#result\n",
      "print('\\n(c)\\nDegrees Quevenne = %d\u00b0Q' %Q)\n",
      "\n",
      "#(e)\n",
      "\n",
      "#calculation\n",
      "Tw=200*(sg_at_60-1.0)\n",
      "\n",
      "#result\n",
      "print('\\n(d)\\nDegrees Twaddel = %d\u00b0Tw' %Tw)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)\n",
        "Degrees API = 7.23\u00b0API\n",
        "\n",
        "(b)\n",
        "Degrees Baume(heavy) = 2.8\u00b0Be\n",
        "\n",
        "(c)\n",
        "Degrees Barkometer = 20\u00b0Bk\n",
        "\n",
        "(c)\n",
        "Degrees Quevenne = 20\u00b0Q\n",
        "\n",
        "(d)\n",
        "Degrees Twaddel = 4\u00b0Tw"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 4.8, Page NUmber: 212<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math\n",
      "\n",
      "#variable Declaration\n",
      "T=0.5                   # Torque Tube Force\n",
      "sg1=1.02                # Maximum spe.gravity to be measured\n",
      "sg2=0.98                # Minimum spe.gravity to be measured\n",
      "wt=1000*10**-6\n",
      "\n",
      "#calculation\n",
      "v=T/((sg1-sg2)*wt)\n",
      "v=math.ceil(v)\n",
      "\n",
      "#result\n",
      "print('V=%d cm^3' %v)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "V=12500 cm^3"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 4.9, Page Number: 212<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import math\n",
      "\n",
      "#variavle declaration\n",
      "sg1=0.85                # Maximum spe.gravity to be measured\n",
      "sg2=0.8                 # Minimum spe.gravity to be measured\n",
      "span=150.0              # D/P cell span\n",
      "\n",
      "\n",
      "#a\n",
      "\n",
      "#calculation\n",
      "H=span/(sg1-sg2)\n",
      "\n",
      "#result\n",
      "print('(a)\\nH=%d mm = %dm' %(H,H/1000))\n",
      "\n",
      "#b\n",
      "\n",
      "#calculation\n",
      "span_min=1500.0\n",
      "span2=span_min*(sg1-sg2)\n",
      "span2=math.ceil(span2)\n",
      "\n",
      "#result\n",
      "print('\\n(b)\\nD/P span = %d mm' %span2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)\n",
        "H=3000 mm = 3m\n",
        "\n",
        "(b)\n",
        "D/P span = 75 mm"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 4.10, Page Number:212<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#variable declaration\n",
      "Ww=12-2                    # Width of water\n",
      "dw=1000.0                  # density of water\n",
      "\n",
      "#calculation\n",
      "v=Ww/dw\n",
      "dx=(10-2)/v\n",
      "sg=dx/dw \n",
      "\n",
      "#result\n",
      "print('Specific Gravity of X =%.1f' %sg)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Specific Gravity of X =0.8"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 4.11, PAge Number: 213<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#(a)\n",
      "\n",
      "#variable declaration\n",
      "wt=1.5                      # weight of object\n",
      " \n",
      "#calculation\n",
      "v_obj=2.0/1000\n",
      "dx=wt/v_obj\n",
      "sg=dx/1000\n",
      "\n",
      "#result\n",
      "print('(a)\\nSpecific Gravity = %.2f' %sg)\n",
      "\n",
      "#(b)\n",
      "\n",
      "sgl=0.8                     # specific grav of liquid\n",
      "dens=800.0                  # density\n",
      "\n",
      "#calculation\n",
      "W1=dens*v_obj-wt\n",
      "\n",
      "#result\n",
      "print('\\n(b)\\nW1 = %.1f kg' %W1)\n",
      "\n",
      "\n",
      "#(c)\n",
      "\n",
      "#variable declaration\n",
      "sg2=1.2                     # spe. grav.\n",
      "dens2=1200.0                # density\n",
      "\n",
      "#calculation\n",
      "W2=dens2*v_obj-wt\n",
      "\n",
      "#result\n",
      "print('\\n(c)\\nW2 = %.1f kg' %W2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)\n",
        "Specific Gravity = 0.75\n",
        "\n",
        "(b)\n",
        "W1 = 0.1 kg\n",
        "\n",
        "(c)\n",
        "W2 = 0.9 kg"
       ]
      }
     ],
     "prompt_number": 11
    }
   ],
   "metadata": {}
  }
 ]
}