{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 1 - Philosophy of Measurement" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1 - pg 33" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "arithmetic mean is (V)= 100.0\n", "average deviation is (V)= 0.084\n", "standard deviation is (V)= 0.1192\n", "probable error is (V)= 0.0804\n" ] } ], "source": [ "#Example 1.1:#ARITHEMATIC MEAN,AVERAGE DEVIATION ,STANDARD DEVIATION AND PROBABLE ERROR\n", "#calculate the ARITHEMATIC MEAN,AVERAGE DEVIATION ,STANDARD DEVIATION AND PROBABLE ERROR\n", "#given\n", "import math, numpy\n", "T=numpy.array([99.7,99.8,99.9,100,100.1,100.2,100.3]);#VOLTS\n", "f=numpy.array([2,8,20,40,21,6,3]);#frequency of occurence\n", "q=numpy.array([T[0]*f[0],T[1]*f[1],T[2]*f[2],T[3]*f[3],T[4]*f[4],T[5]*f[5],T[6]*f[6]]);#\n", "#calculations\n", "AM=(q[0]+q[1]+q[2]+q[3]+q[4]+q[5]+q[6])/100;#arithematic mean in mm\n", "qb=numpy.zeros(7)\n", "for i in range(0,7):\n", " qb[i]= T[i]-AM\n", "\n", "Q= numpy.array([qb[0],qb[1],qb[2],qb[3],qb[4],qb[5],qb[6]]);#\n", "AV=(-qb[0]*f[0]-qb[1]*f[1]-qb[2]*f[2]-qb[3]*f[3]+qb[4]*f[4]+qb[5]*f[5]+qb[6]*f[6])/100;#\n", "SD=math.sqrt(((qb[0]**2*f[0])+(qb[1]**2*f[1])+(qb[2]**2*f[2])+(qb[3]**2*f[3])+(qb[4]**2*f[4])+(qb[5]**2*f[5])+(qb[6]**2*f[6]))/100);#standard deviation\n", "r1= 0.6745*SD;#PROBABLE ERROR OF ONE READING\n", "#results\n", "print\"arithmetic mean is (V)=\",AM\n", "print\"average deviation is (V)=\",AV\n", "print\"standard deviation is (V)=\",round(SD,4)\n", "print\"probable error is (V)=\",round(r1,4)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2 - pg 34" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "when current reading is 5mA\n", "apparent resistance in kilo ohms is 20.0\n", "percentage gross error is 13.33\n", "when current reading is 50mA\n", "apparent resistance in kilo ohms is 2.0\n", "percentage gross error is 1.33\n" ] } ], "source": [ "#Example 1.2:#APPRABET RESISTANCE AND PERCENTAGE GROSS ERROR\n", "#calculate the APPARENT RESISTANCE AND PERCENTAGE GROSS ERROR\n", "#given\n", "print\"when current reading is 5mA\"\n", "vr=100.;#voltmeter reading\n", "ir=5.;#mA\n", "#calculations and results\n", "rt=vr/(ir);#in kilo ohms\n", "print\"apparent resistance in kilo ohms is\",rt\n", "vm=150.;#range of voltmeter\n", "s=1.;#kilo ohms per volts sensivity\n", "rv=s*vm;#kilo ohms\n", "rx=((rt*rv)/(rv-rt));#kilo ohms\n", "ge=((rx-rt)/rx)*100;#percentage gross error\n", "print\"percentage gross error is\",round(ge,2)\n", "print\"when current reading is 50mA\"\n", "vr=100.;#voltmeter reading\n", "ir1=50.;#mA\n", "rt1=vr/(ir1);#in kilo ohms\n", "print\"apparent resistance in kilo ohms is\",rt1\n", "vm=150.;#range of voltmeter\n", "s=1;#kilo ohms per volts sensivity\n", "rv=s*vm;#kilo ohms\n", "rx1=((rt1*rv)/(rv-rt1));#kilo ohms\n", "ge1=((rx1-rt1)/rx1)*100;#percentage gross error\n", "print\"percentage gross error is\",round(ge1,2)\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 3 - pg 35" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "limiting error at 150 V is (%)= 5.0\n" ] } ], "source": [ "#Example 1.3:#limiting error\n", "#calculate the limiting error\n", "#given\n", "fs=1.5;#full scale in percentage\n", "vr=500.;#voltmeter reading\n", "#calculations\n", "ea=(fs/100)*vr;#volts\n", "le=150;#limiting error voltage\n", "lep=((ea/le)*100);#limiting error\n", "#results\n", "print \"limiting error at 150 V is (%)=\",lep\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4 - pg 35" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "arithmetic mean is, (V)= 100.0\n", "average deviation is, (V)= 0.2\n", "standard deviation is, (V)= 0.228\n", "Variance is ,(V)= 0.052\n" ] } ], "source": [ "#Example 1.4:#ARITHMETIC MEAN,AVERAGE DEVIATION ,STANDARD DEVIATION AND PROBABLE ERROR\n", "#calculate the ARITHMETIC MEAN,AVERAGE DEVIATION ,STANDARD DEVIATION AND PROBABLE ERROR\n", "#given\n", "import math,numpy\n", "T=numpy.array([99.7,99.8,100,100.2,100.3]);#VOLTS\n", "q=numpy.array([T[0],T[1],T[2],T[3],T[4]]);#\n", "#calculations\n", "AM=(q[0]+q[1]+q[2]+q[3]+q[4])/5;#arithematic mean in mm\n", "qb=numpy.zeros(6)\n", "for i in range(0,5):\n", " qb[i]= T[i]-AM;\n", "\n", "Q= numpy.array([qb[0],qb[1],qb[2],qb[3],qb[4]]);#\n", "AV=(-qb[0]-qb[1]-qb[2]+qb[3]+qb[4])/5;#\n", "SD=math.sqrt(((qb[0]**2)+(qb[1]**2)+(qb[2]**2)+(qb[3]**2)+(qb[4]**2))/5);#standard deviation\n", "V=SD**2;#\n", "#results\n", "print\"arithmetic mean is, (V)=\",AM\n", "print\"average deviation is, (V)=\",AV\n", "print\"standard deviation is, (V)=\",round(SD,3)\n", "print\"Variance is ,(V)=\",V" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 5 - pg 36" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "power is,(W)= 1344.8\n", "error in power is,(W)= 40.606\n" ] } ], "source": [ "#Example 1.5:#error\n", "#calculate the error in power\n", "#given\n", "i=8.2;#in amperes\n", "r=20.;#ohms\n", "nd=100.;#divisions\n", "ra=10.;#range in amperes\n", "d=0.5;#divisions\n", "amcr=1.;#ammemeter constant error\n", "crr=-0.2;#construction error\n", "#calculations\n", "p=i**2*r;#watts\n", "rd1=ra/nd;#reading of one division\n", "per=((d*rd1)/i)*100;#possible ameter rwading error\n", "ter=amcr+per;#total ammeter error\n", "ep=(((2*ter)+crr)/nd)*p;#\n", "#results\n", "print \"power is,(W)=\",p\n", "print \"error in power is,(W)=\",round(ep,3)\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 6 - pg 37" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "arithmetic mean is (V)= 100.0\n" ] } ], "source": [ "#Example 1.6:#ARITHMETIC MEAN\n", "#calculate the arithmetic mean\n", "#given\n", "import numpy\n", "T=numpy.array([99.7,99.8,99.9,100,100.1,100.2,100.3]);#VOLTS\n", "f=numpy.array([2,8,20,40,21,6,3]);#frequency of occurence\n", "#calculations\n", "qb=numpy.zeros(8)\n", "for i in range (0,7):\n", " qb[i]=T[i]-T[5];\n", "\n", "prdtc=(qb[0]*f[0])+(qb[1]*f[1])+(qb[2]*f[2])+(qb[3]*f[3])+(qb[4]*f[4])+(qb[5]*f[5])+(qb[6]*f[6])\n", "am=T[5]+(prdtc/100);#arithemetic mean\n", "#results\n", "print \"arithmetic mean is (V)=\",am\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 7 - pg 37" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "limiting error for power is, (%)= 3.3\n" ] } ], "source": [ "#Example 1.7:#limiting error\n", "#calculate the limiting error for power\n", "#given\n", "fse=1.;#full scale deflection\n", "vr=150.;#range in volts\n", "v1=100.;#volts\n", "ve=100.;#range in mA\n", "#calculations\n", "ev=(fse/100)*vr;#voltas\n", "le100=((ev)/v1)*100;#in percentage\n", "ee=(fse/100)*ve;#mA\n", "e1=55;#mA\n", "le50=((ee/e1)*100);#in percentage\n", "ler=le100+le50;#\n", "#results\n", "print \"limiting error for power is, (%)=\",round(ler,1)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 8 - pg 37" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "volume is,(m^3)= 0.216\n", "percentage error in volume is,(%)= 3.0\n", "error in volume is,(m^3)= 0.00648\n" ] } ], "source": [ "#pg 37\n", "#Example 1.8:# error\n", "#calculate the volume, percentage error\n", "#given\n", "fse=1.;#full scale deflection\n", "e=0.60;#meters\n", "#calculations\n", "v=(e)**3;#volume in m^3\n", "ev=3*fse;#error in volume\n", "evv=(ev/100)*v;#\n", "#results\n", "print \"volume is,(m^3)=\",v\n", "print \"percentage error in volume is,(%)=\",ev\n", "print \"error in volume is,(m^3)=\",evv\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9 - pg 38" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "current in the circuit is,(A)= 2.375\n", "error in current is,(A)= 0.0356\n", "percentage error in current is,(%)= 1.5\n" ] } ], "source": [ "#Example 1.9:#error\n", "#calculate the error in circuit\n", "#given\n", "v=95.;#volts\n", "r=40.;#ohms\n", "evv=0.95;#error in voltage\n", "err=-0.2;#error in resistance\n", "#calculations\n", "i=v/r;#amperes\n", "err1=(err/r)*100;#percentage error \n", "evv1=(evv/v)*100;#percentage error\n", "x=evv1-err1;#\n", "ei=(x/100)*i;#\n", "#results\n", "print \"current in the circuit is,(A)=\",i\n", "print \"error in current is,(A)=\",round(ei,4)\n", "print \"percentage error in current is,(%)=\",x" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 10 - pg 38" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "parralel resistance case\n", "magnitude of resistance in ohms is = 17.391\n", "limiting error in ohms is = 4.348\n", "percentage error (%) = 25.0\n", "series resistance case\n", "magnitude of resistance in ohms is = 170.0\n", "percentage error (%) = 5.0\n", "limiting error in ohms is = 8.5\n" ] } ], "source": [ "#Example 1.10:#MAGNITUDE AND LIMITING ERROR\n", "#calculate the magnitude of resistance and limiting error\n", "#given\n", "print \"parralel resistance case\"\n", "r1=40.;#ohms\n", "er1=5.;#percentage error\n", "r2=80.;#ohms\n", "er2=5.;#percentage error\n", "r3=50.;#ohms\n", "er3=5.;#percentage error\n", "#calculations\n", "rp=((r1*r2*r3)/(r1*r2+r2*r3+r3*r1));#ohms\n", "Y=(r1*r2+r2*r3+r3*r1);#ohms\n", "ex=er1+er2+er3;#percentage error\n", "ey1=er1+er2;#\n", "ey2=er2+er3;#\n", "ey3=er3+er1;#\n", "y=(((r1*r2*ey1)/Y)+((r2*r3*ey2)/Y)+((r3*r1*ey3)/Y));#error\n", "mer=(y+ex)*rp;#\n", "#results\n", "print \"magnitude of resistance in ohms is = \",round(rp,3)\n", "print \"limiting error in ohms is = \",round(mer/100,3)\n", "print \"percentage error (%) = \",(y+ex)\n", "print \"series resistance case\"\n", "rs=r1+r2+r3;#ohms\n", "er=(((r1/rs)*er1)+((r2/rs)*er2)+((r3/rs)*er3));#\n", "mer1=(er/100)*rs;#ohms\n", "print \"magnitude of resistance in ohms is = \",rs\n", "print \"percentage error (%) = \",er\n", "print \"limiting error in ohms is = \",mer1\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 11 - pg 39" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "magnitude in ohm = 151.0\n", "percentage error when error in both (PS) and (Q) is positive (%) = 0.5\n", "error in ohms when error in both (PS) and (Q) is positive (ohms) = 0.755\n", "percentage error when error in (PS) is positive and (Q) is negative (%) = 1.5\n", "error in ohms when error in (PS) is positive and (Q) is negative (ohms) = 2.265\n" ] } ], "source": [ "#Example 1.11:#MAGNITUDE AND LIMITING ERROR\n", "#calculate the magintude of resistance in ohm and error\n", "#given\n", "r1=50;#ohms\n", "er1=0.5;#percentage error\n", "r2=100;#ohms\n", "er2=0.5;#percentage error\n", "r3=75.5;#ohms\n", "er3=0.5;#percentage error\n", "#calculations\n", "x=((r2/r1)*r3);#ohms\n", "eps=er1+er2;#\t\n", "erpsq=eps-er3;#when error in both (PS) and (Q) is positive\n", "erpsq1=eps+er3;#when error in (PS) is positive and (Q) is negetive\n", "oer1=(erpsq/100)*x;#ohms\n", "oer2=(erpsq1/100)*x;#ohms\n", "#results\n", "print \"magnitude in ohm = \",x\n", "print \"percentage error when error in both (PS) and (Q) is positive (%) = \",erpsq\n", "print \"error in ohms when error in both (PS) and (Q) is positive (ohms) = \",oer1\n", "print \"percentage error when error in (PS) is positive and (Q) is negative (%) = \",erpsq1\n", "print \"error in ohms when error in (PS) is positive and (Q) is negative (ohms) = \",oer2\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.9" } }, "nbformat": 4, "nbformat_minor": 0 }