{
 "metadata": {
  "name": "",
  "signature": "sha256:3fb09c0fd0a89152f5948cdf5eed31775a718eb29c5fc9edfb34ed6af2984184"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 02:Systems of Units of Measurement"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2.1:pg-29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# To convert area in metre to feet\n",
      "# Modern Electronic Instrumentation And Measurement Techniques\n",
      "# By Albert D. Helfrick, William D. Cooper\n",
      "# First Edition Second Impression, 2009\n",
      "# Dorling Kindersly Pvt. Ltd. India\n",
      "# Example 2-1 in Page 29\n",
      "\n",
      "\n",
      "\n",
      "# Given data\n",
      "A_m = 5000 # area in metre**2 unit\n",
      "\n",
      "#Calculation\n",
      "A_ft = A_m * (1/0.3048)**2 # As 1ft = 0.3048m\n",
      "print \"The area in feet = \",round(A_ft),\" sq.ft\"\n",
      "\n",
      "#Result\n",
      "# The area in feet = 53820 sq.ft \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The area in feet =  53820.0  sq.ft\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2.2:pg-29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# To convert flux density to different units\n",
      "# Modern Electronic Instrumentation And Measurement Techniques\n",
      "# By Albert D. Helfrick, William D. Cooper\n",
      "# First Edition Second Impression, 2009\n",
      "# Dorling Kindersly Pvt. Ltd. India\n",
      "# Example 2-2 in Page 29\n",
      "\n",
      "\n",
      "\n",
      "# Given data\n",
      "B_cm = 20 # flux density in maxwell/sq.cm\n",
      "\n",
      "#Calculations\n",
      "\n",
      "B_in = B_cm *2.54**2 # converting to lines/sq.inch\n",
      "print \"The flux density in lines/sq.in =\",round(B_in),\" lines/(in**2)\"\n",
      "\n",
      "#Result\n",
      "# The flux density in lines/sq.in = 129 lines/(in**2) \n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The flux density in lines/sq.in = 129.0  lines/(in**2)\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2.3:pg-29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# To convert velocity to a different unit\n",
      "# Modern Electronic Instrumentation And Measurement Techniques\n",
      "# By Albert D. Helfrick, William D. Cooper\n",
      "# First Edition Second Impression, 2009\n",
      "# Dorling Kindersly Pvt. Ltd. India\n",
      "# Example 2-3 in Page 29\n",
      "\n",
      "\n",
      "\n",
      "# Given data\n",
      "c_s = 2.997925 * 10**8 # velocity in m/s\n",
      "\n",
      "#Calculations\n",
      "c_hr = 2.997925 *10**8* 1/10**3* 3.6*10**3 # velocity in km/hr\n",
      "print \"The velocity of light in km/hr = \",\"{:.3E}\".format(c_hr),\" km/hr\"\n",
      "\n",
      "#Result \n",
      "# The velocity of light in km/hr = 1.079e+009 km/hr "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The velocity of light in km/hr =  1.079E+09  km/hr\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2.4:pg-29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# To convert density to a different unit\n",
      "# Modern Electronic Instrumentation And Measurement Techniques\n",
      "# By Albert D. Helfrick, William D. Cooper\n",
      "# First Edition Second Impression, 2009\n",
      "# Dorling Kindersly Pvt. Ltd. India\n",
      "# Example 2-4 in Page 29\n",
      "\n",
      "\n",
      "\n",
      "# Given data\n",
      "Density_ft = 62.5\n",
      "\n",
      "#Calcualtions\n",
      "Density_in = 62.5 * (1/12.0)**3\n",
      "Density_cm = Density_in * 453.6 * (1/2.54)**3\n",
      "print \"(a)  The density of water in lb/cubic inch = \",round(Density_in,6),\" lb/(in**3).\\n\"\n",
      "print \"(b)  The density of water in g/cubic cm = \",round(Density_cm,6), \"g/(cm**3).\"\n",
      "\n",
      "#Result\n",
      "# (a)  The density of water in lb/cubic inch = 0.036169 lb/(in**3).\n",
      "# (b)  The density of water in g/cubic cm = 1.001171 g/(cm**3). \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)  The density of water in lb/cubic inch =  0.036169  lb/(in**3).\n",
        "\n",
        "(b)  The density of water in g/cubic cm =  1.001171 g/(cm**3).\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2.5:pg-30"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# To convert speed limit to a different unit\n",
      "# Modern Electronic Instrumentation And Measurement Techniques\n",
      "# By Albert D. Helfrick, William D. Cooper\n",
      "# First Edition Second Impression, 2009\n",
      "# Dorling Kindersly Pvt. Ltd. India\n",
      "# Example 2-5 in Page 30\n",
      "\n",
      "\n",
      "\n",
      "# Given data\n",
      "speed_km = 60 # speed limit in km/hr\n",
      "\n",
      "#Calculations\n",
      "speed_m = 60 *10**3 *10**2 *(1/2.54) *(1/12.0)*(1.0/5280)\n",
      "speed_ft = 37.3 *5280 *(1/(3.6*10**3))\n",
      "\n",
      "print \"(a)  The speed limit in m/hr = \",round(speed_m,1),\" mi/hr\\n\"\n",
      "print \"(b)  The speed limit in ft/s = \",round(speed_ft,1),\" ft/s\"\n",
      "\n",
      "#Result\n",
      "# (a)  The speed limit in m/hr = 37.3 mi/hr\n",
      "# (b)  The speed limit in ft/s = 54.7 ft/s \n",
      "\n",
      "\n",
      "#The answer given in textbook is printed incorrectly and does not match with calculated answer\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)  The speed limit in m/hr =  37.3  mi/hr\n",
        "\n",
        "(b)  The speed limit in ft/s =  54.7  ft/s\n"
       ]
      }
     ],
     "prompt_number": 16
    }
   ],
   "metadata": {}
  }
 ]
}