{
 "metadata": {
  "name": "",
  "signature": "sha256:2ffa422208323473e7fa809c26d007c1a4e73e5340d80167d553ec696ed3e811"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 3 : Errors in Measurements and Their Statistical Analysis"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.1  Page No : 59"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# calculating guarantee value of capacitance\n",
      "\n",
      "# Variables\n",
      "As  =  1;\n",
      "Er = 0.05;\n",
      "\n",
      "# Calculations and Results\n",
      "Aau = As*(1+Er);\n",
      "print \"Upper limit(micro F) = \", Aau\n",
      "Aal = As*(1-Er);\n",
      "print \"Lower limit(micro F) = \", Aal\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Upper limit(micro F) =  1.05\n",
        "Lower limit(micro F) =  0.95\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.2  Page No : 61"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# calculating percentage limiting error\n",
      "\n",
      "# Variables\n",
      "As  =  150.;\n",
      "Er = 0.01;\n",
      "\n",
      "# Calculations\n",
      "dA = As*Er;\n",
      "As1 = 75.;\n",
      "Er = (dA/As1)*100;\n",
      "\n",
      "# Results\n",
      "print \"Percentage limiting error  = \", Er\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Percentage limiting error  =  2.0\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.3  Page No : 63"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Calculate the range of readings\n",
      "\n",
      "# Variables\n",
      "fsd = 1000.;\n",
      "TP = 100.;\n",
      "\n",
      "# Calculations and Results\n",
      "Efsd = (1./100)*1000;\n",
      "print \"magnitude of Error when specified in terms of full scale deflection (w) = \", Efsd\n",
      "print \"Thus the meter will read between 90W and 110W\"\n",
      "\n",
      "Etv = (1./100)*100;\n",
      "print \"magnitude of Error when specified in terms of true value (w) = \", Etv\n",
      "print \"Thus the meter will read between 99W and 101W\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "magnitude of Error when specified in terms of full scale deflection (w) =  10.0\n",
        "Thus the meter will read between 90W and 110W\n",
        "magnitude of Error when specified in terms of true value (w) =  1.0\n",
        "Thus the meter will read between 99W and 101W\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.4  Page No : 65"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Calculate the limiting error in percent\n",
      "\n",
      "# Variables\n",
      "dA = 0.05*5*10**-6;\n",
      "As = 2.5*10**-6;\n",
      "\n",
      "# Calculations\n",
      "Er = (dA/As)*100;\n",
      "\n",
      "# Results\n",
      "print \"percemtage limiting error  = +/-\", Er\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "percemtage limiting error  = +/- 10.0\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.5  Page No : 67"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Calculate the range of readings specified interms of f.s.d. and true value\n",
      "\n",
      "print \"Range when specified interms of f.s.d.\"\n",
      "\n",
      "# Calculations and Results\n",
      "Error_fsd = 1.*1000./100\n",
      "Range_lower_value = 100-Error_fsd;\n",
      "print \"Lower value of range (kN/m2)\", Range_lower_value\n",
      "Range_upper_value = 100+Error_fsd;\n",
      "print \"Upper value of range (kN/m2)\", Range_upper_value\n",
      "print \"Range when specified interms of True value\",\n",
      "Error_true = 1*100/100.\n",
      "Range_lower_value = 100-Error_true;\n",
      "print \"Lower value of range (kN/m2)\", Range_lower_value\n",
      "Range_upper_value = 100+Error_true;\n",
      "print \"Upper value of range (kN/m2)\", Range_upper_value\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Range when specified interms of f.s.d.\n",
        "Lower value of range (kN/m2) 90.0\n",
        "Upper value of range (kN/m2) 110.0\n",
        "Range when specified interms of True value Lower value of range (kN/m2) 99.0\n",
        "Upper value of range (kN/m2) 101.0\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.6  Page No : 69"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Calculate the magnitude and limiting error in ohm and in percentage of the resistance\n",
      "\n",
      "# Variables\n",
      "R1 = 37.;\n",
      "R1_le = 5.*R1/100;\n",
      "R2 = 75.;\n",
      "R2_le = 5.*R2/100;\n",
      "R3 = 50.;\n",
      "R3_le = 5.*R3/100;\n",
      "\n",
      "# Calculations and Results\n",
      "R = R1+R2+R3;\n",
      "print \"Value of resistance (ohm) = \", R\n",
      "\n",
      "R_le = R1_le+R2_le+R3_le;\n",
      "print \"Limiting Value of resistance (ohm) = \", R_le\n",
      "\n",
      "Limiting_error_percentage = R_le*100/R;\n",
      "print \"Limiting Value of resistance (percentage) = +/-\", Limiting_error_percentage\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of resistance (ohm) =  162.0\n",
        "Limiting Value of resistance (ohm) =  8.1\n",
        "Limiting Value of resistance (percentage) = +/- 5.0\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.7  Page No : 71"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# calculate the value of  relative limiting error in resistance\n",
      "\n",
      "# Variables\n",
      "Re_P = 1.5;\n",
      "Re_I = 1;\n",
      "\n",
      "# Calculations\n",
      "Re_resistance = (Re_P+2*Re_I);\n",
      "\n",
      "# Results\n",
      "print \"the value of  relative limiting error of resistance in percentage(+/-) = \", Re_resistance"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the value of  relative limiting error of resistance in percentage(+/-) =  3.5\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.8  Page No : 73"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Calculate the guaranteed values of the resistance\n",
      "\n",
      "# Variables\n",
      "R1 = 100.;\n",
      "R1_le_perunit = 0.5; # R1_le_perunit indicates dR1/R1  =  0.5%\n",
      "R2 = 1000.;\n",
      "R2_le_perunit = 0.5;\n",
      "R3 = 842.;\n",
      "R3_le_perunit = 0.5;\n",
      "\n",
      "# Calculations and Results\n",
      "Rx = R2*R3/R1;\n",
      "print \"Value of resistance (ohm) = \", Rx\n",
      "Rx_le_perunit = R1_le_perunit+R2_le_perunit+R3_le_perunit;\n",
      "\n",
      "print \"Limiting Value of resistance per unit (dRx/Rx) = \", Rx_le_perunit\n",
      "Er_Le = Rx_le_perunit*Rx/100;\n",
      "print \"Limiting Value of resistance (ohm) = +/-\", Er_Le\n",
      "print \"Guarantee value of the resistance (ohm) = \",\n",
      "G1 = Rx+Er_Le;\n",
      "G2 = Rx-Er_Le;\n",
      "print G1,G2\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of resistance (ohm) =  8420.0\n",
        "Limiting Value of resistance per unit (dRx/Rx) =  1.5\n",
        "Limiting Value of resistance (ohm) = +/- 126.3\n",
        "Guarantee value of the resistance (ohm) =  8546.3 8293.7\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.9  Page No : 75"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Calculate the percentage limiting error and range of resistance values\n",
      "print \"error in decade a =   so, decade a is set at 4000 ohm\",\n",
      "Er_a = 4000.*0.1/100;\n",
      "print Er_a\n",
      "print \"error in decade b =   so, decade b is set at 600 ohm\",\n",
      "Er_b = 600*0.1/100.;\n",
      "print Er_b\n",
      "print \"error in decade c =   so, decade c is set at 30 ohm\",\n",
      "Er_c = 30*0.1/100.;\n",
      "print Er_c\n",
      "print \"error in decade d =   so, decade d is set at 9 ohm\",\n",
      "Er_d = 9*0.1/100;\n",
      "print Er_d\n",
      "Er_total = Er_a+Er_b+Er_c+Er_d;\n",
      "Re_le_percentage = Er_total*100./4639;\n",
      "print \"Percentage Relative limiting error = \", Re_le_percentage\n",
      "Range_lower = 4639-Er_total;\n",
      "print \"Lower value of range (ohm) = \", Range_lower\n",
      "Range_upper = 4639+Er_total;\n",
      "print \"upper value of range (ohm) = \", Range_upper\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "error in decade a =   so, decade a is set at 4000 ohm 4.0\n",
        "error in decade b =   so, decade b is set at 600 ohm 0.6\n",
        "error in decade c =   so, decade c is set at 30 ohm 0.03\n",
        "error in decade d =   so, decade d is set at 9 ohm 0.009\n",
        "Percentage Relative limiting error =  0.1\n",
        "Lower value of range (ohm) =  4634.361\n",
        "upper value of range (ohm) =  4643.639\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.10  Page No : 77"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "# Calculate the magnitude of power and limiting error\n",
      "\n",
      "# Variables\n",
      "F = 4.58;\n",
      "L = 397.;\n",
      "R = 1202.*10**-9;\n",
      "t = 60.;\n",
      "\n",
      "# Calculations and Results\n",
      "P = (2*math.pi*9.81*F*L*R)/(t*10**6);\n",
      "print \"Magnitude of power (W) = \", P\n",
      "dF_pu = 0.02/F; # per unit error in force\n",
      "dL_pu = 1.3/L; # per unit error in Length\n",
      "dR_pu = 1/R; # per unit error in revolution\n",
      "dt_pu = 0.5/t; # per unit error in time\n",
      "dP_pu =  dF_pu+dL_pu+dR_pu+dt_pu;\n",
      "dP_le = dP_pu*P;\n",
      "print \"Magnitude of limiting error in power (W)\", dP_le\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Magnitude of power (W) =  2.24521573806e-09\n",
        "Magnitude of limiting error in power (W) 0.00186789998434\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.11  Page No : 79"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Calculate the magnitude of Force and limiting error\n",
      "\n",
      "# Variables\n",
      "E = 200.*10**9;\n",
      "L = 25.*10**-3;\n",
      "b = 4.75*10**-3;\n",
      "d = 0.9*10**-3;\n",
      "\n",
      "# Calculations and Results\n",
      "I = (b*d**3)/12;\n",
      "x = 2.5*10**-3;\n",
      "F = (3*E*I*x)/(L**3);\n",
      "print \"Magnitude of Force (N) = \", F\n",
      "\n",
      "dE_pu = 0./E; # per unit error in E\n",
      "db_pu = 0.0075/b; \n",
      "dd_pu = 0.0075/d;  \n",
      "dx_pu = 0.025/x; \n",
      "dL_pu = 0.025/L;\n",
      "dF_pu =  (dE_pu+db_pu+3*dd_pu+dx_pu+3*dL_pu)*10**-3;\n",
      "\n",
      "print \"limiting error in force (N) = +/-\", dF_pu\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Magnitude of Force (N) =  27.702\n",
        "limiting error in force (N) = +/- 0.0395789473684\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.12  Page No : 81"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# calculate the power loss and relative error \n",
      "\n",
      "# Variables\n",
      "I = 64.*10**-3;\n",
      "R = 3200.;\n",
      "\n",
      "# Calculations and Results\n",
      "P = (I**2)*R;\n",
      "print \"Power(W) = \", P\n",
      "Re = 2*0.75+0.2;\n",
      "print \"Relative error (%) = \", Re\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Power(W) =  13.1072\n",
        "Relative error (%) =  1.7\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.13  Page No : 83"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Calculate the true power as a percentage of measured power\n",
      "\n",
      "# Variables\n",
      "I = 30.4;\n",
      "R = 0.015;\n",
      "\n",
      "# Calculations\n",
      "I_true = I*(1+0.012);\n",
      "R_true = R*(1-0.003);\n",
      "P_true = (I_true**2)*R_true;\n",
      "P_measured = (I**2)*R;\n",
      "R = P_true*100/P_measured;\n",
      "\n",
      "# Results\n",
      "print \"true power as a percentage of measured power(%) =  \", R\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "true power as a percentage of measured power(%) =   102.1071568\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.14  Page No : 85"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the total resistance, error of each register and fractional error of total resistance\n",
      "\n",
      "# Variables\n",
      "R1 = 250.;\n",
      "R2 = 500.;\n",
      "R3 = 375.;\n",
      "\n",
      "# Calculations and Results\n",
      "R_true = 1/((1/R1)+(1/R2)+(1/R3));\n",
      "print \" True value of resistance(ohm) = \", R_true\n",
      "\n",
      "dR1 =  0.025*R1;\n",
      "dR2 = -0.36*R2;\n",
      "dR3 = 0.014*R3;\n",
      "R1_effective = R1+dR1;\n",
      "R2_effective = R2+dR2;\n",
      "R3_effective = R3+dR3;\n",
      "R_effective = 1/((1/R1_effective)+(1/R2_effective)+(1/R3_effective));\n",
      "print \" Effective value of resistance(ohm) = \", R_effective\n",
      "\n",
      "Fractional_error = (R_true-R_effective)/R_true;\n",
      "print \"Fractional_error\", Fractional_error\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " True value of resistance(ohm) =  115.384615385\n",
        " Effective value of resistance(ohm) =  103.548741621\n",
        "Fractional_error 0.102577572617\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.15  Page No : 87"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "#\n",
      "print \"When all the components have 0% error then resonant frequency (Hz)\",\n",
      "\n",
      "# Variables\n",
      "L = 160.*10**-6;\n",
      "C = 160.*10**-12;\n",
      "fr = (1./(2*math.pi))*(1/(L*C))**0.5;\n",
      "print fr\n",
      "\n",
      "# Calculations and Results\n",
      "print \"When all the components have +10% error then resonant frequency (Hz)\",\n",
      "L_new = (160.*10**-6)+0.1*L;\n",
      "C_new = (160.*10**-12)+0.1*C;\n",
      "fr_new = (1./(2*math.pi))*(1/(L_new*C_new))**0.5;\n",
      "print fr_new\n",
      "\n",
      "error = (fr_new-fr)/fr;\n",
      "print \"error = \", error\n",
      "\n",
      "print \"When all the components have -10% error then resonant frequency (Hz)\",\n",
      "L_new = (160.*10**-6)-0.1*L;\n",
      "C_new = (160.*10**-12)-0.1*C;\n",
      "fr_new = (1./(2*math.pi))*(1/(L_new*C_new))**0.5;\n",
      "print fr_new\n",
      "\n",
      "error = (fr_new-fr)/fr;\n",
      "print \"error = \", error\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "When all the components have 0% error then resonant frequency (Hz) 994718.394324\n",
        "When all the components have +10% error then resonant frequency (Hz) 904289.449386\n",
        "error =  -0.0909090909091\n",
        "When all the components have -10% error then resonant frequency (Hz) 1105242.66036\n",
        "error =  0.111111111111\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.16  Page No : 89"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "# calculate the Volume and relative error \n",
      "\n",
      "# Variables\n",
      "L = 250.;\n",
      "d = 50.;\n",
      "\n",
      "# Calculations and Results\n",
      "V = ((math.pi/4)*d**2)*L;\n",
      "print \"Volume(mm3) = \", V\n",
      "Re = 2*0.2-0.5;\n",
      "print \"Relative error (%) = \", Re\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Volume(mm3) =  490873.852123\n",
        "Relative error (%) =  -0.1\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.17  Page No : 91"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# calculate the per unit change in the value of spring for different temperature ranges\n",
      "\n",
      "# Variables\n",
      "dG_pu = -240*10**-6;\n",
      "dD_pu = 11.8*10**-6;\n",
      "\n",
      "# Calculations and Results\n",
      "print \"for temperature change of 20 degree C to 50 degree C (%)  = \",\n",
      "d_th = 30;\n",
      "dK_pu = (dG_pu+dD_pu)*d_th*100;\n",
      "print dK_pu\n",
      "\n",
      "print \"for temperature change of 20 degree C to -50 degree C (%)  = \",\n",
      "d_th = -70;\n",
      "dK_pu = (dG_pu+dD_pu)*d_th*100;\n",
      "print dK_pu\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "for temperature change of 20 degree C to 50 degree C (%)  =  -0.6846\n",
        "for temperature change of 20 degree C to -50 degree C (%)  =  1.5974\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.18  Page No : 93"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Calculate apparent resistance, actual resistance and error\n",
      "\n",
      "# Variables\n",
      "Et = 100.;\n",
      "It = 5.*10**-3;\n",
      "\n",
      "# Calculations and Results\n",
      "Rt = Et/It;\n",
      "print \"apparent value of resistance (ohm) = \", Rt\n",
      "Rv = 1000.*150;\n",
      "\n",
      "Rx = Rt*Rv/(Rv-Rt);\n",
      "print \"true value of resistance(ohm)\", Rx\n",
      "\n",
      "Er_percentage = (Rt-Rx)/Rx*100;\n",
      "print \"percentage error = \", Er_percentage\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "apparent value of resistance (ohm) =  20000.0\n",
        "true value of resistance(ohm) 23076.9230769\n",
        "percentage error =  -13.3333333333\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.19  Page No : 95"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Calculate apparent resistance, actual resistance and error\n",
      "\n",
      "# Variables\n",
      "Et = 40.;\n",
      "It = 800.*10**-3;\n",
      "\n",
      "# Calculations and Results\n",
      "Rt = Et/It;\n",
      "print \"apparent value of resistance (ohm) = \", Rt\n",
      "Rv = 1000.*150;\n",
      "Rx = Rt*Rv/(Rv-Rt);\n",
      "print \"true value of resistance(ohm)\", Rx\n",
      "Er_percentage = ((Rt-Rx)/Rx)*100;\n",
      "print \"percentage error = \", Er_percentage\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "apparent value of resistance (ohm) =  50.0\n",
        "true value of resistance(ohm) 50.0166722241\n",
        "percentage error =  -0.0333333333333\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.20  Page No : 97"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the error and percentage error in the measurement of deflection\n",
      "\n",
      "# Variables\n",
      "l = 0.2;\n",
      "E = 200*10**9;\n",
      "b = 20.*10**-3;\n",
      "d = 5.*10**-3;\n",
      "D = (4.*l**3)/(E*b*d**3);\n",
      "F = 1*9.81;\n",
      "\n",
      "# Calculations and Results\n",
      "x_true =  D*F;\n",
      "print \"True value of deflection\", x_true\n",
      "x_indicated = D*10.31/(1+.1*D);\n",
      "print \"Indicated value of deflection\", x_indicated\n",
      "Er = x_indicated-x_true;\n",
      "print \"error = \", Er\n",
      "Er_percentage = Er*100/x_true;\n",
      "print \"Percentage error = \", Er_percentage\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "True value of deflection 0.00062784\n",
        "Indicated value of deflection 0.000659835777051\n",
        "error =  3.1995777051e-05\n",
        "Percentage error =  5.09616734375\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.21  Page No : 99"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from numpy import array\n",
      "#to find the mean,deviations from the mean, Average deviation, standard deviation and variance\n",
      "\n",
      "x = [532. ,548, 543, 535, 546, 531, 543, 536];\n",
      "X = sum(x);\n",
      "n = 8; \n",
      "a = 0.;\n",
      "\n",
      "# Calculations and Results\n",
      "Mean = X/n;\n",
      "print \"mean (kHZ)\", X/n\n",
      "d = []\n",
      "for i in range(n):\n",
      "    d.append(x[i]-Mean)\n",
      "    print \"deviations  = \", d[i]\n",
      "    a = a+(abs(d[i]))\n",
      " \n",
      "d_average = a/n;\n",
      "print \"Average deviation (kHz) = \", d_average\n",
      "d_2 = sum(array(d)**2);\n",
      "s = math.sqrt(d_2/(n-1))\n",
      "print \"standard deviation(kHz)\", s\n",
      "V = s**2;\n",
      "print \"varaince (kHZ)2 = \", V\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "mean (kHZ) 539.25\n",
        "deviations  =  -7.25\n",
        "deviations  =  8.75\n",
        "deviations  =  3.75\n",
        "deviations  =  -4.25\n",
        "deviations  =  6.75\n",
        "deviations  =  -8.25\n",
        "deviations  =  3.75\n",
        "deviations  =  -3.25\n",
        "Average deviation (kHz) =  5.75\n",
        "standard deviation(kHz) 6.54107898482\n",
        "varaince (kHZ)2 =  42.7857142857\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.22  Page No : 101"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "from numpy import array\n",
      "#to find the mean,standard deviation, probable error and range\n",
      "\n",
      "# Variables\n",
      "x = [41.7, 42, 41.8, 42, 42.1, 41.9, 42, 41.9, 42.5, 41.8];\n",
      "X = sum(x) \n",
      "print X\n",
      "d = [-.27, .03, -.17, .03, .13, -.07, .03, -.07, .53, -.17];\n",
      "\n",
      "# Calculations and Results\n",
      "d_2 = sum(array(d)**2);\n",
      "n = 10.;\n",
      "print \"mean length(deg C)\", X/n\n",
      "print \"standard deviation(if data is infinite)(deg C)\", math.sqrt(d_2/n)\n",
      "print \"standard deviation(deg C)\", math.sqrt(d_2/(n-1))\n",
      "r1 = .6745*math.sqrt(d_2/(n-1));\n",
      "print \"probable error of 1 reading(deg C)\", r1\n",
      "print \"probable error of mean(deg C)\", r1/math.sqrt(n-1)\n",
      "print \"range(deg C)\", max(x)-min(x)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "419.7\n",
        "mean length(deg C) 41.97\n",
        "standard deviation(if data is infinite)(deg C) 0.21\n",
        "standard deviation(deg C) 0.221359436212\n",
        "probable error of 1 reading(deg C) 0.149306939725\n",
        "probable error of mean(deg C) 0.0497689799083\n",
        "range(deg C) 0.8\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.23  Page No : 103"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from numpy import array\n",
      "#to find the arithematic mean, maen deviation,standard deviation, prpobable error of 1 reading, standard deviation and probable error of mean, standard deviation of standard deviation\n",
      "\n",
      "# Variables\n",
      "T = [397, 398, 399, 400, 401, 402, 403, 404, 405];\n",
      "f = [1, 3, 12, 23, 37, 16, 4, 2, 2];\n",
      "\n",
      "# Calculations and Results\n",
      "Tf = sum(abs(array(T).transpose()*f));\n",
      "print \"mean temp(deg C)\", Tf/sum(f)\n",
      "d = [-3.78, -2.78, -1.78, -.78, .22, 1.22, 2.22, 3.22, 4.22];\n",
      "d = array(d)\n",
      "print \"mean deviation(deg C)\", sum(array(f).transpose()*d)/sum(f)\n",
      "print \"standard deviation(deg C)\", math.sqrt(sum(array(f).transpose()*d**2)/sum(f))\n",
      "print \"probable error of 1 reading(deg C)\", .6745*math.sqrt(sum(array(f).transpose()*d**2)/sum(f))\n",
      "print \"probable error of mean(deg C)\", (.6745*math.sqrt(sum(array(f).transpose()*d**2)/sum(f)))/math.sqrt(sum(f))\n",
      "print \"standard deviation of mean(deg C)\", (math.sqrt(sum(array(f).transpose()*d**2)/sum(f)))/math.sqrt(sum(f))\n",
      "print \"standard deviation of standard deviation(deg C)\", (math.sqrt(sum(array(f).transpose()*d**2)/sum(f)))/math.sqrt(sum(f)*2)\n",
      "\n",
      " "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " mean temp(deg C) 400\n",
        "mean deviation(deg C) -1.7763568394e-17\n",
        "standard deviation(deg C) 1.38260623462\n",
        "probable error of 1 reading(deg C) 0.932567905249\n",
        "probable error of mean(deg C) 0.0932567905249\n",
        "standard deviation of mean(deg C) 0.138260623462\n",
        "standard deviation of standard deviation(deg C) 0.0977650244208\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.24  Page No : 105"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#to find probable no of resistors\n",
      "\n",
      "# Variables\n",
      "x = .15;    #deviation \n",
      "o = .1;    #standard deviation\n",
      "t = x/o;\n",
      "A = .4432    #area under gaussian curve corresponding to t\n",
      "\n",
      "# Calculations\n",
      "n = 2*A*1000;\n",
      "\n",
      "# Results\n",
      "print \"no of resistors\", math.floor(n)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "no of resistors 886.0\n"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.25  Page No : 107"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "#to find no of 100 rsding exceed 30mm\n",
      "\n",
      "# Variables\n",
      "x = 30-26.3;    #mean value 26.3\n",
      "r = 2.5;\n",
      "o = r/.6745;\n",
      "t = x/o;\n",
      "A = .3413;#area under gaussian curve corresponding to t\n",
      "\n",
      "# Calculations\n",
      "n = 2*A*100;\n",
      "nn = 100-math.floor(n);\n",
      "\n",
      "# Results\n",
      "print \"no of readings exceed\", nn/2\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "no of readings exceed 16.0\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.26  Page No : 109"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "#to find no of rods of desired length\n",
      "\n",
      "# Variables\n",
      "n = 25000.;    #no of rods\n",
      "n1 = 12500.; #length>10mm\n",
      "n2 = 2000.;    #length>10.25\n",
      "a = n1-n2;    #10<length<10.25\n",
      "p = a/n;\n",
      "t = 1.41;    #umath.sing p\n",
      "\n",
      "# Calculations\n",
      "t1 = t*2;\n",
      "p1 = .4975;\n",
      "b = p1*n;    #9.5<length<10\n",
      "\n",
      "# Results\n",
      "print \"total no of rods\", a+math.floor(b)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "total no of rods 22937.0\n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.27  Page No : 111"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "#to find standard deviation and probability of error\n",
      "\n",
      "# Variables\n",
      "p = .2;\n",
      "x = .8;\n",
      "t = .5025;\n",
      "\n",
      "# Calculations and Results\n",
      "sd = x/t;\n",
      "print \"stndard deviation\", sd\n",
      "x = 1.2;\n",
      "t = x/sd;\n",
      "p = 2*.2743;\n",
      "print \"probability of error\", p\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "stndard deviation 1.592039801\n",
        "probability of error 0.5486\n"
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.28  Page No : 113"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "#to find no of expected readings\n",
      "\n",
      "# Variables\n",
      "x = 20;\n",
      "h = 0.04;\n",
      "\n",
      "# Calculations\n",
      "sd = 1/(math.sqrt(2)*h);\n",
      "t = x/sd;\n",
      "P = .3708;\n",
      "\n",
      "# Results\n",
      "print \"no of expected readings\", math.ceil(2*P*x)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "no of expected readings 15.0\n"
       ]
      }
     ],
     "prompt_number": 37
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.29  Page No : 115"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "#to calculate precision index of instrument\n",
      "\n",
      "# Variables\n",
      "t = .675;\n",
      "x = 2.4;\n",
      "\n",
      "# Calculations and Results\n",
      "sd = x/t;\n",
      "h = 1/(math.sqrt(2)*sd);\n",
      "print \"precision index\", h\n",
      "t = (50-44)/sd;\n",
      "p = .45;\n",
      "n = 8*30;    #sept month no of measurements\n",
      "a = ((.5-p)*n);\n",
      "print \"no of false alarms\", a\n",
      "\n",
      "rn = a/2;    #reduced no of false alarms\n",
      "p1 = rn/n;\n",
      "P = .5-p1;\n",
      "t = 1.96;\n",
      "sd = (50-44)/t;\n",
      "h = 1/(math.sqrt(2)*sd);\n",
      "print \"precision index\", h\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "precision index 0.198873782209\n",
        "no of false alarms 12.0\n",
        "precision index 0.230988215188\n"
       ]
      }
     ],
     "prompt_number": 38
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.30  Page No : 117"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#to find confidence interval for given confidence levels\n",
      "\n",
      "# Variables\n",
      "cl = [.5, .9, .95, .99];\n",
      "s = .22;\n",
      "d = [.7, 1.83, 2.26, 3.25];\n",
      "def ci(b):\n",
      "    return s*b;\n",
      "\n",
      "# Calculations\n",
      "CI = [0,0,0,0]\n",
      "CI[0] = ci(d[0]);\n",
      "CI[1] = ci(d[1]);\n",
      "CI[2] = ci(d[2]);\n",
      "CI[3] = ci(d[3]);\n",
      "\n",
      "# Results\n",
      "print \"confidence interval\", CI\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "confidence interval [0.154, 0.4026, 0.4972, 0.715]\n"
       ]
      }
     ],
     "prompt_number": 39
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.31  Page No : 119"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from numpy import array\n",
      "#to point out the reading that can be rejected by chavenets criterion\n",
      "\n",
      "# Variables\n",
      "x = array([5.3, 5.73, 6.77, 5.26, 4.33, 5.45, 6.09, 5.64, 5.81, 5.75])*10**-3;\n",
      "d = array([-.313, .117, 1.157, -.353, -1.283, -.163, .477, .027, .197, .137])*10**-3;\n",
      "n = 10.;\n",
      "\n",
      "# Calculations\n",
      "X = sum(x)/n;\n",
      "s = math.sqrt(sum(d**2)/(n-1));\n",
      "a = abs(d)/s\n",
      "print a\n",
      "\n",
      "\n",
      "for i in range(10):\n",
      "    if a[i]>1.96:\n",
      "        print \"rejected value\", x[i]\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "[ 0.49953805  0.18672828  1.84653522  0.56337678  2.04762722  0.26014282\n",
        "  0.76127684  0.04309114  0.31440574  0.21864765]\n",
        "rejected value 0.00433\n"
       ]
      }
     ],
     "prompt_number": 41
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.32  Page No : 121"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from numpy import array\n",
      "#calculate standard deviation\n",
      "\n",
      "# Variables\n",
      "x = array([.9 ,2.3, 3.3, 4.5, 5.7, 6.7]);\n",
      "y = array([1.1, 1.6, 2.6, 3.2, 4 ,5]);\n",
      "n = 6.;\n",
      "\n",
      "# Calculations\n",
      "a = ((n*sum(x*y)-(sum(x)*sum(y)))/((sum(x**2)*n)-sum(x)**2));\n",
      "b = ((sum(y)*sum(x**2)-(sum(x)*sum(x*y)))/((sum(x**2)*n)-sum(x)**2));\n",
      "\n",
      "sdy = math.sqrt((1/n)*sum((a*x+b-y)**2));\n",
      "sdx = sdy/a;\n",
      "\n",
      "sa = math.sqrt(n/(n*sum(x**2)-sum(x)**2))*sdy;\n",
      "sb = math.sqrt(sum(x**2)/(n*sum(x**2)-sum(x)**2))*sdy;\n",
      "\n",
      "# Results\n",
      "print \"s_a\", sa\n",
      "print \"s_b\", sb\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "s_a 0.0354898238647\n",
        "s_b 0.155116651415\n"
       ]
      }
     ],
     "prompt_number": 44
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.34  Page No : 123"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "#determine value of total current considering errors as limiting errors ans as smath.radians(numpy.arcmath.tan(rd deviations\n",
      "\n",
      "# Variables\n",
      "I1 = 200.;\n",
      "I2 = 100.;\n",
      "dI1 = 2.;\n",
      "dI2 = 5.;\n",
      "\n",
      "# Calculations and Results\n",
      "I = I1+I2;\n",
      "dI = ((I1/I)*(dI1/I1)+(I2/I)*(dI2/I2));\n",
      "print \"error considered as limiting errors\"\n",
      "print \"I\", I\n",
      "print \"dI\", dI*I\n",
      "sdI = math.sqrt(dI1**2+dI2**2);\n",
      "print \"error considered as standard deviations\"\n",
      "print \"I\", I\n",
      "print \"sdI\", sdI\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "error considered as limiting errors\n",
        "I 300.0\n",
        "dI 7.0\n",
        "error considered as standard deviations\n",
        "I 300.0\n",
        "sdI 5.38516480713\n"
       ]
      }
     ],
     "prompt_number": 45
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.35  Page No : 125"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#determine probable error in the computed value of resistnce\n",
      "\n",
      "# Variables\n",
      "r_V = 12.;\n",
      "I = 10.;\n",
      "r_Rv = r_V/I;\n",
      "V = 100.;\n",
      "r1 = 2.;\n",
      "\n",
      "# Calculations\n",
      "r_Ri = V*r1/I**2;\n",
      "r_R = math.sqrt(r_Rv**2+r_Ri**2);\n",
      "\n",
      "# Results\n",
      "print \"r_R\", r_R\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "r_R 2.33238075794\n"
       ]
      }
     ],
     "prompt_number": 46
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.37  Page No : 127"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "#to find Cq and its possible errors\n",
      "\n",
      "# Variables\n",
      "d = 12.5;\n",
      "A = (math.pi/4)*d**2*10**-6;\n",
      "W = 392.;\n",
      "t = 600.;\n",
      "p = 1000.;\n",
      "g = 9.81;\n",
      "h = 3.66;\n",
      "\n",
      "# Calculations and Results\n",
      "Cq = W/(t*p*A*math.sqrt(2*g*h));\n",
      "print \"Cq\", Cq\n",
      "dW = .23/W;\n",
      "dt = 2/t;\n",
      "dp = .1/100;\n",
      "dA = 2*.002;\n",
      "dg = .1/100;\n",
      "dh = .003/h;\n",
      "dd = .002;\n",
      "dCq = Cq*(dW+dt+dp+dA+dg/2+dh/2);\n",
      "print \"%age absolute error\", dCq*100/Cq\n",
      "\n",
      "sdCq = Cq*math.sqrt(dW**2+dt**2+dp**2+4*dd**2+.25*(dg**2+dh**2));\n",
      "print \"%age standard deviation error\", sdCq*100/Cq\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Cq 0.628253425224\n",
        "%age absolute error 0.982990409278\n",
        "%age standard deviation error 0.537339132325\n"
       ]
      }
     ],
     "prompt_number": 48
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.38  Page No : 129"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "V = 110.2;\n",
      "I = 5.3;\n",
      "\n",
      "# Calculations and Results\n",
      "P = V*I\n",
      "print \"power(W) dissipated\", P\n",
      "w_v = .2;\n",
      "w_i = 0.06;\n",
      "dp = math.sqrt((w_v*I)**2+(w_i*V)**2);\n",
      "print \"uncertainity in power(%)\", dp*100/P\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "power(W) dissipated 584.06\n",
        "uncertainity in power(%) 1.14653078526\n"
       ]
      }
     ],
     "prompt_number": 49
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.39  Page No : 131"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "#to find uncertainity in combined resistance in both series and in parrallel\n",
      "\n",
      "# Variables\n",
      "R1 = 100.;\n",
      "R2 = 50.;\n",
      "wR1 = .1;\n",
      "wR2 = 0.03;\n",
      "\n",
      "# Calculations and Results\n",
      "print \"series conn\"\n",
      "R = R1+R2\n",
      "print \"resistance(ohm)\", R\n",
      "dR1 = 1;\n",
      "dR2 = 1;\n",
      "wR = math.sqrt((dR1*wR1)**2+(dR2*wR2)**2)\n",
      "print \"uncertainity in resistance(ohm)\", wR\n",
      "\n",
      "print \"parrallel conn\"\n",
      "R = R1*R2*(R1+R2)**-1\n",
      "print \"resistance(ohm)\", R\n",
      "dR1 = (R2/(R1+R2))-((R1*R2)/(R1+R2)**2);\n",
      "dR2 = (R1/(R1+R2))-((R1*R2)/(R1+R2)**2);\n",
      "wR = math.sqrt((dR1*wR1)**2+(dR2*wR2)**2)\n",
      "print \"uncertainity in resistance(ohm)\", wR\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "series conn\n",
        "resistance(ohm) 150.0\n",
        "uncertainity in resistance(ohm) 0.104403065089\n",
        "parrallel conn\n",
        "resistance(ohm) 33.3333333333\n",
        "uncertainity in resistance(ohm) 0.0173561103909\n"
       ]
      }
     ],
     "prompt_number": 50
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.40  Page No : 133"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "#to calculate uncertainity in measurement\n",
      "\n",
      "# Variables\n",
      "l = 150;\n",
      "dl = 0.01;\n",
      "b = 50;\n",
      "\n",
      "# Calculations and Results\n",
      "wA = l*dl;\n",
      "print \"when no uncertainity in measurement of length\"\n",
      "print \"uncertainity in measurement of area(m*m)\", wA\n",
      "\n",
      "print \"when no certainity in measurement of length\"\n",
      "wA = 1.5*1.5;\n",
      "wB = 0.01;\n",
      "wL = math.sqrt((wA**2-(l*wB)**2)/b**2);\n",
      "print \"uncertainity in measurement of length(m)\", wL\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "when no uncertainity in measurement of length\n",
        "uncertainity in measurement of area(m*m) 1.5\n",
        "when no certainity in measurement of length\n",
        "uncertainity in measurement of length(m) 0.0335410196625\n"
       ]
      }
     ],
     "prompt_number": 51
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.41  Page No : 135"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "#to calculate uncertainity in power\n",
      "\n",
      "# Variables\n",
      "E = 100.;\n",
      "dE = .01;\n",
      "I = 10.;\n",
      "dI = 0.01;\n",
      "R = 10.;\n",
      "dR = .01;\n",
      "\n",
      "# Calculations and Results\n",
      "dP = math.sqrt(4*dE**2+dR**2)*100;    #P = E**2/R\n",
      "print \"%age uncertainity in power measurement\", dP\n",
      "\n",
      "dP = math.sqrt(dE**2+dI**2)*100;    #P = E*I\n",
      "print \"%age uncertainity in power measurement\", dP\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "%age uncertainity in power measurement 2.2360679775\n",
        "%age uncertainity in power measurement 1.41421356237\n"
       ]
      }
     ],
     "prompt_number": 53
    }
   ],
   "metadata": {}
  }
 ]
}