From f270f72badd9c61d48f290c3396004802841b9df Mon Sep 17 00:00:00 2001 From: kinitrupti Date: Fri, 12 May 2017 18:53:46 +0530 Subject: Removed duplicates --- sample_notebooks/MohdAsif/Chapter2,.ipynb | 257 ++++ .../MohdAsif/Chapter2,_Measurement.ipynb | 257 ---- sample_notebooks/MohdAsif/Chapter2_-.ipynb | 1549 ++++++++++++++++++++ .../MohdAsif/Chapter2_-_Measurement.ipynb | 1549 -------------------- 4 files changed, 1806 insertions(+), 1806 deletions(-) create mode 100755 sample_notebooks/MohdAsif/Chapter2,.ipynb delete mode 100755 sample_notebooks/MohdAsif/Chapter2,_Measurement.ipynb create mode 100755 sample_notebooks/MohdAsif/Chapter2_-.ipynb delete mode 100755 sample_notebooks/MohdAsif/Chapter2_-_Measurement.ipynb (limited to 'sample_notebooks/MohdAsif') diff --git a/sample_notebooks/MohdAsif/Chapter2,.ipynb b/sample_notebooks/MohdAsif/Chapter2,.ipynb new file mode 100755 index 00000000..f8ad79f0 --- /dev/null +++ b/sample_notebooks/MohdAsif/Chapter2,.ipynb @@ -0,0 +1,257 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:7b602763fd5a9c056abb62703a3bc42ae0cb4a39b3c349f78c056ebe58b1c643" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Example 2_3_1" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Precision of the 5th measurement\n", + "#Given data : Measurements taken(Unit less)\n", + "X1=98;\n", + "X2=101;\n", + "X3=102;\n", + "X4=97;\n", + "X5=101;\n", + "X6=100;\n", + "X7=103;\n", + "X8=98;\n", + "X9=106;\n", + "X10=99.0;\n", + "#Calculation\n", + "Xn_bar=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/10;\n", + "Xn=101 # value of 5th measurement\n", + "P=(1-abs((Xn-Xn_bar)/Xn_bar))*100 #Precision\n", + "print \"Precision of the 5th measurement,P(%) = \",round(P,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Precision of the 5th measurement,P(%) = 99.502\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Example 2_3_2_a" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Absolute error\n", + "#given data :\n", + "Ae=80.0 # in V\n", + "Am=79 # in V\n", + "e=Ae-Am #absolute error\n", + "print \"Absolute error,e(V) = \",e" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Absolute error,e(V) = 1.0\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Example 2_3_2_b" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Finding error\n", + "#given data :\n", + "Ae=80.0 # in V\n", + "Am=79 # in V\n", + "e=Ae-Am #error\n", + "ep=(e/Ae)*100 #relative percent error\n", + "print \"Relative Percent Error(%) = \",ep" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Relative Percent Error(%) = 1.25\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Example 2_3_3" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# maximum error\n", + "#given data :\n", + "V1=100 # in volts\n", + "V2=200 # in volts\n", + "V=V2-V1 # Voltage difference\n", + "A=.25 # Accuracy may be \u00b1 in %\n", + "max_error=(A/100)*V # in Volts\n", + "print \"maximum error(V) = \u00b1\",max_error" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "maximum error(V) = \u00b1 0.25\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Example 2_3_4" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#sensitivity and deflection error\n", + "# given data :\n", + "C=4.0 # change in output in mm\n", + "M=8.0 # magnitude of input in ohm\n", + "S=C/M # sensitivity\n", + "print \"sensitivity,S(mm/ohm) = \",S\n", + "D=M/C # Deflection\n", + "print \"Deflection factor,D(ohm/m) = \",D" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "sensitivity,S(mm/ohm) = 0.5\n", + "Deflection factor,D(ohm/m) = 2.0\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Example 2_3_5 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Resolution\n", + "# given data :\n", + "V=200.0 # full scale reading in volts\n", + "N=100.0 # number of divisions \n", + "Scale_div=V/N # Volts\n", + "R=(1/10.0)*Scale_div # Resolution in Volts\n", + "print \"Resolution, R(V) = \",round(R,4)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Resolution, R(V) = 0.2\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Example 2_3_6" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Resolution\n", + "#given data :\n", + "V=9.999 # full scale read out in volt\n", + "c=range(0,9999) # range from 0 to 9999\n", + "R=(1/max(c))*V*10.0**3\n", + "print \"Resolution, R(mV)\", R" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Resolution, R(mV) 0.0\n" + ] + } + ], + "prompt_number": 29 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/MohdAsif/Chapter2,_Measurement.ipynb b/sample_notebooks/MohdAsif/Chapter2,_Measurement.ipynb deleted file mode 100755 index f8ad79f0..00000000 --- a/sample_notebooks/MohdAsif/Chapter2,_Measurement.ipynb +++ /dev/null @@ -1,257 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:7b602763fd5a9c056abb62703a3bc42ae0cb4a39b3c349f78c056ebe58b1c643" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Example 2_3_1" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Precision of the 5th measurement\n", - "#Given data : Measurements taken(Unit less)\n", - "X1=98;\n", - "X2=101;\n", - "X3=102;\n", - "X4=97;\n", - "X5=101;\n", - "X6=100;\n", - "X7=103;\n", - "X8=98;\n", - "X9=106;\n", - "X10=99.0;\n", - "#Calculation\n", - "Xn_bar=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/10;\n", - "Xn=101 # value of 5th measurement\n", - "P=(1-abs((Xn-Xn_bar)/Xn_bar))*100 #Precision\n", - "print \"Precision of the 5th measurement,P(%) = \",round(P,3)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Precision of the 5th measurement,P(%) = 99.502\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Example 2_3_2_a" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Absolute error\n", - "#given data :\n", - "Ae=80.0 # in V\n", - "Am=79 # in V\n", - "e=Ae-Am #absolute error\n", - "print \"Absolute error,e(V) = \",e" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Absolute error,e(V) = 1.0\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Example 2_3_2_b" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Finding error\n", - "#given data :\n", - "Ae=80.0 # in V\n", - "Am=79 # in V\n", - "e=Ae-Am #error\n", - "ep=(e/Ae)*100 #relative percent error\n", - "print \"Relative Percent Error(%) = \",ep" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Relative Percent Error(%) = 1.25\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Example 2_3_3" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# maximum error\n", - "#given data :\n", - "V1=100 # in volts\n", - "V2=200 # in volts\n", - "V=V2-V1 # Voltage difference\n", - "A=.25 # Accuracy may be \u00b1 in %\n", - "max_error=(A/100)*V # in Volts\n", - "print \"maximum error(V) = \u00b1\",max_error" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "maximum error(V) = \u00b1 0.25\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Example 2_3_4" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#sensitivity and deflection error\n", - "# given data :\n", - "C=4.0 # change in output in mm\n", - "M=8.0 # magnitude of input in ohm\n", - "S=C/M # sensitivity\n", - "print \"sensitivity,S(mm/ohm) = \",S\n", - "D=M/C # Deflection\n", - "print \"Deflection factor,D(ohm/m) = \",D" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "sensitivity,S(mm/ohm) = 0.5\n", - "Deflection factor,D(ohm/m) = 2.0\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Example 2_3_5 " - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Resolution\n", - "# given data :\n", - "V=200.0 # full scale reading in volts\n", - "N=100.0 # number of divisions \n", - "Scale_div=V/N # Volts\n", - "R=(1/10.0)*Scale_div # Resolution in Volts\n", - "print \"Resolution, R(V) = \",round(R,4)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Resolution, R(V) = 0.2\n" - ] - } - ], - "prompt_number": 18 - }, - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Example 2_3_6" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Resolution\n", - "#given data :\n", - "V=9.999 # full scale read out in volt\n", - "c=range(0,9999) # range from 0 to 9999\n", - "R=(1/max(c))*V*10.0**3\n", - "print \"Resolution, R(mV)\", R" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Resolution, R(mV) 0.0\n" - ] - } - ], - "prompt_number": 29 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/sample_notebooks/MohdAsif/Chapter2_-.ipynb b/sample_notebooks/MohdAsif/Chapter2_-.ipynb new file mode 100755 index 00000000..3442a20e --- /dev/null +++ b/sample_notebooks/MohdAsif/Chapter2_-.ipynb @@ -0,0 +1,1549 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:95b9e0f83468dda84f2de4d99c5a704a6fadf8064c232b063678fd245192ca75" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter2 - Measurement Errors" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.3.1 - page : 2-8" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#precision of the 5th measurement\n", + "#given data :\n", + "X1=98.0 \n", + "X2=101.0\n", + "X3=102.0 \n", + "X4=97.0 \n", + "X5=101.0 \n", + "X6=100.0 \n", + "X7=103.0 \n", + "X8=98.0 \n", + "X9=106.0 \n", + "X10=99.0 \n", + "Xn_bar=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/10 \n", + "Xn=101 # value of 5th measurement\n", + "P=(1-abs((Xn-Xn_bar)/Xn_bar))*100 \n", + "print \"Precision of the 5th measurement, P = \", round(P,2), \" %\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Precision of the 5th measurement, P = 99.5 %\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.3.2.i - page : 2-10" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Absolute error\n", + "#given data :\n", + "Ae=80.0 # in V\n", + "Am=79.0 # in V\n", + "e=Ae-Am \n", + "print \"Absolute error, e = \", e, \" V\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Absolute error, e = 1.0 V\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.3.2.ii - page : 2-10" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Error\n", + "#given data :\n", + "Ae=80.0 # in V\n", + "Am=79.0 # in V\n", + "e=Ae-Am \n", + "error1=(e/Ae)*100 \n", + "print \"Error = \", error1, \" %\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Error = 1.25 %\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.3.2.iii - page : 2-10" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Relative accuracy\n", + "#given data :\n", + "Ae=80.0 # in V\n", + "Am=79.0 # in V\n", + "e=Ae-Am \n", + "error1=(e/Ae)*100 \n", + "A=(1-abs(e/Ae)) \n", + "print \"Relative Accuracy, A = \", A" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Relative Accuracy, A = 0.9875\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.3.2.iv - page : 2-10" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# % accuracy\n", + "#given data :\n", + "Ae=80.0 # in V\n", + "Am=79.0 # in V\n", + "e=Ae-Am \n", + "error1=(e/Ae)*100 \n", + "A=(1-abs(e/Ae)) \n", + "accuracy=A*100 \n", + "print \"Accuracy = \", accuracy, \" %\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Accuracy = 98.75 %\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.3.2.v - page : 2-10" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# % error\n", + "#given data :\n", + "Ae=80.0 # in V\n", + "Am=79.0 # in V\n", + "e=Ae-Am \n", + "f=100.0 #full scale deflection\n", + "error1=(e/Ae)*100 \n", + "A=(1-abs(e/Ae)) \n", + "accuracy=A*100 \n", + "P_error=(e/f)*100 \n", + "print \"% error = \", P_error, \" %\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "% error = 1.0 %\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.3.3 - page : 2-11" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Maximum error\n", + "#given data :\n", + "V1=100.0 # in V\n", + "V2=200.0 #in V\n", + "V=V2-V1 \n", + "A=0.25 #may be \u00b1 in %\n", + "max_error=(A/100)*V \n", + "print \"Maximum error = \u00b1 \", max_error, \" V\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum error = \u00b1 0.25 V\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.3.4 - page : 2-12" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# sensitivity and deflection error\n", + "#given data :\n", + "C=4.0 # change in output in mm\n", + "M=8.0 # magnitude of input in ohm\n", + "S=C/M \n", + "print \"sensitivity, S = \", S, \" mm/ohm\"\n", + "D=M/C \n", + "print \"Deflection factor, D = \", D, \" ohm/mm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "sensitivity, S = 0.5 mm/ohm\n", + "Deflection factor, D = 2.0 ohm/mm\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.3.5 - page : 2-14" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Resolution\n", + "#given data :\n", + "V=200.0 # full scale reading in V\n", + "N=100.0 # number of divisions \n", + "Scale_div=V/N \n", + "R=(1.0/10)*Scale_div \n", + "print \"Resolution, R = \", R, \" V\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Resolution, R = 0.2 V\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.3.6 - page : 2-14" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Resolution\n", + "#given data :\n", + "V=9.999 # full scale read out in volt\n", + "c=9999.0 # range from 0 to 9999\n", + "R=(1/c)*V*10**3 \n", + "print \"Resolution, R = \", R, \" mV\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Resolution, R = 1.0 mV\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.6.1 - page : 2-23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Magnitude and relative error\n", + "#given data :\n", + "R1=15.0 #ohm\n", + "E1=R1*5.0/100 # \u00b1 limiting error for R1\n", + "R2=33.0 #ohm\n", + "E2=R2*2.0/100 # \u00b1 limiting error for R2\n", + "R3=75.0 #ohm\n", + "E3=R3*5.0/100 # \u00b1 limiting error for R3\n", + "RT=R1+R2+R3 # ohm(in series)\n", + "ET=E1+E2+E3 #\u00b1limiting error for RT\n", + "print \"For series connection, magnitude is \", RT, \" ohm & limiting error is \u00b1 \", ET, \" ohm.\" \n", + "Epr=ET/RT*100 #%\n", + "print \"Percent relative error : \u00b1\", round(Epr,1),\" %\" \n", + "\n", + "# Answer is not accurate in the textbook." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "For series connection, magnitude is 123.0 ohm & limiting error is \u00b1 5.16 ohm.\n", + "Percent relative error : \u00b1 4.2 %\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.6.2 - page : 2-23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Magnitude and relative error\n", + "#given data :\n", + "R1=36.0 #ohm\n", + "E1=5.0 # \u00b1 limiting error for R1\n", + "R2=75.0 #ohm\n", + "E2=5.0 # \u00b1 limiting error for R2\n", + "RT=(R1*R2)/(R1+R2) #ohm(in parallel)\n", + "EP1=E1+E2 # \u00b1 limiting error\n", + "EP2=((R1*E1)/(R1+R2))+((R2*E2)/(R1+R2)) \n", + "ET=EP1+EP2 \n", + "etm=(ET/100)*RT \n", + "print \"Magnitude of limiting error is \u00b1\", round(etm,2), \" ohm\"\n", + "print \"Percentage relative error is \u00b1\", ET, \" %\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Magnitude of limiting error is \u00b1 3.65 ohm\n", + "Percentage relative error is \u00b1 15.0 %\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.6.3 page : 2-24" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Limiting error\n", + "vr=40.0 #reading of voltmeter in volts\n", + "v=50.0 #rane in volts\n", + "va=50.0 #ammeeter reading in mA\n", + "i=125.0 #range in mA\n", + "fsd=2.0 #accurace in percentage in \u00b1\n", + "dv=(2.0/100)*v #limiting error of voltmeter\n", + "da=(2./100)*i #liming error of the ammeter in mA\n", + "erv=dv/vr #relative limiting error in voltmeter reading\n", + "eri=da/i #relative limiting error in ammeter reading\n", + "et=erv+eri \n", + "pet=et*100 #percentage limiting error of the power calcultaed\n", + "print \"Percentage limiting error of the power calcultaed is \u00b1 \",pet,\" %\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Percentage limiting error of the power calcultaed is \u00b1 4.5 %\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.6.4 - page : 2-25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# limiting error\n", + "r1=120.0 # ohm\n", + "er1=0.5 #limiting error in resistance 1 in ohm \u00b1\n", + "r2=2 #in A\n", + "er2=0.02 #limiting error in amperes \u00b1\n", + "e1=er2/r2 #limiting error in current\n", + "e2=er1/r1 #limiting eror in resistance\n", + "et=(2*e1+e2) #total error\n", + "etp=et*100 #percentage limtimg error\n", + "print \"Percentage limiting error in the value of power dissipation is \u00b1\",round(etp,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Percentage limiting error in the value of power dissipation is \u00b1 2.417\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.6.5 - page : 2-25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#magnitude and limiting error\n", + "r1=120 #in ohm\n", + "er1=0.1 #limiting error in resistance 1 in ohm \u00b1\n", + "r2=2700 #in ohm\n", + "er2=0.5 #limiting error in resistance 2 in ohm \u00b1\n", + "r3=470 #in ohm\n", + "er3=0.5 #limiting error in resistance 3 in ohm \u00b1\n", + "rxm=(r2*r3)/r1 #magnitude of unknown resistance in ohm\n", + "rxe=(er1+er2+er3) #error\n", + "er=(rxe*rxm)/100 #relative error \u00b1\n", + "print \"Magnitude of unknown resistance is \",rxm,\" kohm\"\n", + "print \"Relative limiting error is \u00b1\",er,\" ohm\"\n", + "print \"Guranteed value of resistance is between \",rxm-er, \" ohm to \" ,rxm+er,\" ohm\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Magnitude of unknown resistance is 10575 kohm\n", + "Relative limiting error is \u00b1 116.325 ohm\n", + "Guranteed value of resistance is between 10458.675 ohm to 10691.325 ohm\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.6.6 - page : 2-26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# absolute error, % error, relative error, % accuracy and % error of full scale reading\n", + "#given data :\n", + "Ae=80.0 # in volt\n", + "Am=79 # in volt\n", + "fsd=100 #full scale reading in volt\n", + "e=Ae-Am \n", + "print \"Absolute error, e = \",e,\" V\"\n", + "error1=(e/Ae)*100 \n", + "print \"Error = \",error1,\" %\"\n", + "A=1-abs(e/Ae) \n", + "print \"Relative accuracy, A = \",A,\" %\"\n", + "p_accuracy=A*100 \n", + "print \"% accuracy = \",p_accuracy,\" %\"\n", + "error2=(e/fsd)*100 \n", + "print \"% error expressed as percentage of full scale reading = \",error2,\" %\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Absolute error, e = 1.0 V\n", + "Error = 1.25 %\n", + "Relative accuracy, A = 0.9875 %\n", + "% accuracy = 98.75 %\n", + "% error expressed as percentage of full scale reading = 1.0 %\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.6.7 - page : 2-27" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# limiting error\n", + "#given data :\n", + "fsd=100.0 # in V\n", + "A=1.0 # (+ve or -ve) in %\n", + "del_A=(A/100)*fsd \n", + "As=15.0 #in V\n", + "e1=del_A/As \n", + "e=e1*100 \n", + "print \"Limiting error, e = \",round(e,4),\" %\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Limiting error, e = 6.6667 %\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.6.8 - page : 2-27 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# limiting value of current and % limiting error\n", + "#given data :\n", + "As=2.5 # in A\n", + "fsd=10 #full scale reading in A\n", + "A=1.5/100 \n", + "del_A=A*fsd \n", + "At1=As+del_A \n", + "At2=As-del_A \n", + "print \"Limiting value of current, At1 = \",At1,\" A\"\n", + "print \"Limiting value of current, At2 = \",At2,\" A\"\n", + "e=(del_A/As)*100 \n", + "print \"Percentage limiting error, e = \",e,\" %\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Limiting value of current, At1 = 2.65 A\n", + "Limiting value of current, At2 = 2.35 A\n", + "Percentage limiting error, e = 6.0 %\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.1.i - page : 2-30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#ARITHEMATIC MEAN\n", + "import numpy\n", + "q=[49.7,50.1,50.2,49.6,49.7] #\n", + "AM= numpy.mean(q) #arithematic mean in mm\n", + "print \"Arithematic mean is \",AM\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Arithematic mean is 49.86\n" + ] + } + ], + "prompt_number": 57 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.1.ii - page : 2-30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#deviation\n", + "import numpy\n", + "q=[49.7,50.1,50.2,49.6,49.7] #\n", + "AM= numpy.mean(q) #arithematic mean in mm\n", + "d=q-AM\n", + "print \"Deviations of each value are : \"\n", + "for dev in d:\n", + " print dev\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Deviations of each value are : \n", + "-0.16\n", + "0.24\n", + "0.34\n", + "-0.26\n", + "-0.16\n" + ] + } + ], + "prompt_number": 58 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.1.iii - page : 2-30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#algebric sum of deviation\n", + "import numpy\n", + "q=[49.7,50.1,50.2,49.6,49.7] #\n", + "AM= numpy.mean(q) #arithematic mean in mm\n", + "d=q-AM\n", + "dtotal=sum(d)\n", + "print \"Algebric sum of deviation is\", round(dtotal,4)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Algebric sum of deviation is 0.0\n" + ] + } + ], + "prompt_number": 59 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.1.iv - page : 2-30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#standard deviation\n", + "import numpy\n", + "q=[49.7,50.1,50.2,49.6,49.7] #\n", + "AM= numpy.mean(q) #arithematic mean in mm\n", + "d=q-AM\n", + "sigma=0\n", + "n=5 # no. of measurements\n", + "for dev in d:\n", + " sigma+=dev**2\n", + "sigma/=(n-1)\n", + "sigma**=(1.0/2)\n", + "print \"Standard Deviation is \",round(sigma,2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Standard Deviation is 0.27\n" + ] + } + ], + "prompt_number": 60 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.2.i - page : 2-31" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#ARITHEMATIC MEAN\n", + "import numpy\n", + "q=[101.2,101.4,101.7,101.3,101.3,101.2,101.0,101.3,101.5,101.1] #\n", + "AM= numpy.mean(q) #arithematic mean in mm\n", + "print \"Arithematic mean is \",AM,\" V\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Arithematic mean is 101.3 V\n" + ] + } + ], + "prompt_number": 61 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.2.ii - page : 2-31" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Deviation from mean\n", + "import numpy\n", + "q=[101.2,101.4,101.7,101.3,101.3,101.2,101.0,101.3,101.5,101.1] #\n", + "AM= numpy.mean(q) #arithematic mean in mm\n", + "d=q-AM\n", + "print \"Deviations of each value are : \"\n", + "for dev in d:\n", + " print dev\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Deviations of each value are : \n", + "-0.1\n", + "0.1\n", + "0.4\n", + "0.0\n", + "0.0\n", + "-0.1\n", + "-0.3\n", + "0.0\n", + "0.2\n", + "-0.2\n" + ] + } + ], + "prompt_number": 62 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.2.iii - page : 2-31" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#standard deviation\n", + "import numpy\n", + "q=[101.2,101.4,101.7,101.3,101.3,101.2,101.0,101.3,101.5,101.1] \n", + "AM= numpy.mean(q) #arithematic mean in mm\n", + "d=q-AM\n", + "sigma=0\n", + "n=10 # no. of measurements\n", + "for dev in d:\n", + " sigma+=dev**2\n", + "sigma/=(n-1)\n", + "sigma**=(1.0/2)\n", + "print \"Standard Deviation is \",round(sigma,2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Standard Deviation is 0.2\n" + ] + } + ], + "prompt_number": 63 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.2.iv - page : 2-31" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#probable error\n", + "import numpy\n", + "q=[101.2,101.4,101.7,101.3,101.3,101.2,101.0,101.3,101.5,101.1] \n", + "AM= numpy.mean(q) #arithematic mean in mm\n", + "d=q-AM\n", + "sigma=0\n", + "n=10 # no. of measurements\n", + "for dev in d:\n", + " sigma+=dev**2\n", + "sigma/=(n-1)\n", + "sigma**=(1.0/2)\n", + "pe1=0.6745*sigma # Probable error of one reading\n", + "print \"Probable error of one reading is \",pe1,\" V\"\n", + "pm=pe1/(n-1)**(1.0/2)\n", + "print \"Probable error of mean is \",round(pm,5)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Probable error of one reading is 0.1349 V\n", + "Probable error of mean is 0.04497\n" + ] + } + ], + "prompt_number": 64 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.3.i - page : 2-32" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Arithmetic mean\n", + "#given data :\n", + "X1=147.2 # in nF\n", + "X2=147.4 # in nF\n", + "X3=147.9 # in nF\n", + "X4=148.1 # in nF\n", + "X5=148.1 # in nF\n", + "X6=147.5 # in nF\n", + "X7=147.6 # in nF\n", + "X8=147.4 # in nF\n", + "X9=147.6 # in nF\n", + "X10=147.5 # in nF\n", + "AM=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/10 \n", + "print \"Arithmetic mean, AM = \",AM,\" nF\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Arithmetic mean, AM = 147.63 nF\n" + ] + } + ], + "prompt_number": 77 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.3.ii - page : 2-32" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Average deviation\n", + "#given data :\n", + "n=10 \n", + "X1=147.2 # in nF\n", + "X2=147.4 # in nF\n", + "X3=147.9 # in nF\n", + "X4=148.1 # in nF\n", + "X5=148.1 # in nF\n", + "X6=147.5 # in nF\n", + "X7=147.6 # in nF\n", + "X8=147.4 # in nF\n", + "X9=147.6 # in nF\n", + "X10=147.5 # in nF\n", + "AM=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/n \n", + "d1=X1-AM \n", + "d2=X2-AM \n", + "d3=X3-AM \n", + "d4=X4-AM \n", + "d5=X5-AM \n", + "d6=X6-AM \n", + "d7=X7-AM \n", + "d8=X8-AM \n", + "d9=X9-AM \n", + "d10=X10-AM \n", + "Average_deviation=(abs(d1)+abs(d2)+abs(d3)+abs(d4)+abs(d5)+abs(d5)+abs(d6)+abs(d7)+abs(d8)+abs(d9)+abs(d10))/n \n", + "print \"Average deviation = \",Average_deviation,\" nF\"\n", + "# answer is wrong in book" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Average deviation = 0.289 nF\n" + ] + } + ], + "prompt_number": 79 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.3.iii - page : 2-32" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Standard deviation\n", + "#given data :\n", + "n=10 \n", + "X1=147.2 # in nF\n", + "X2=147.4 # in nF\n", + "X3=147.9 # in nF\n", + "X4=148.1 # in nF\n", + "X5=148.1 # in nF\n", + "X6=147.5 # in nF\n", + "X7=147.6 # in nF\n", + "X8=147.4 # in nF\n", + "X9=147.6 # in nF\n", + "X10=147.5 # in nF\n", + "AM=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/n \n", + "d1=X1-AM \n", + "d2=X2-AM \n", + "d3=X3-AM \n", + "d4=X4-AM \n", + "d5=X5-AM \n", + "d6=X6-AM \n", + "d7=X7-AM \n", + "d8=X8-AM \n", + "d9=X9-AM \n", + "d10=X10-AM \n", + "sigma=((d1**2+d2**2+d3**2+d4**2+d5**2+d6**2+d7**2+d8**2+d9**2+d10**2)/(n-1))**(1.0/2) \n", + "print \"Standard deviation = \",round(sigma,4),\" nF\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Standard deviation = 0.3057 nF\n" + ] + } + ], + "prompt_number": 82 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.3.iv - page : 2-32" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#: Probable error\n", + "#given data :\n", + "n=10 \n", + "X1=147.2 # in nF\n", + "X2=147.4 # in nF\n", + "X3=147.9 # in nF\n", + "X4=148.1 # in nF\n", + "X5=148.1 # in nF\n", + "X6=147.5 # in nF\n", + "X7=147.6 # in nF\n", + "X8=147.4 # in nF\n", + "X9=147.6 # in nF\n", + "X10=147.5 # in nF\n", + "AM=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/n \n", + "d1=X1-AM \n", + "d2=X2-AM \n", + "d3=X3-AM \n", + "d4=X4-AM \n", + "d5=X5-AM \n", + "d6=X6-AM \n", + "d7=X7-AM \n", + "d8=X8-AM \n", + "d9=X9-AM \n", + "d10=X10-AM \n", + "sigma=((d1**2+d2**2+d3**2+d4**2+d5**2+d6**2+d7**2+d8**2+d9**2+d10**2)/(n-1))**(1.0/2)\n", + "Pe1=0.6745*sigma # probable error of one reading\n", + "probable_error=Pe1/(n-1)**(1.0/2)\n", + "print \"Probable error of one reading = \",round(Pe1,4),\" nF\"\n", + "print \"Probable error of mean = \",round(probable_error,4),\" nF\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Probable error of one reading = 0.2062 nF\n", + "Probable error of mean = 0.0687 nF\n" + ] + } + ], + "prompt_number": 86 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.4.i - page : 2-34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#ARITHEMATIC MEAN\n", + "import numpy\n", + "q=[10.3,10.7,10.9,9.7,9.5,9.2,10.3,11.7] #\n", + "AM= numpy.mean(q) #arithematic mean in mm\n", + "print \"Arithematic mean is \",AM,\" kg/cm2\"\n", + "#answer is wrong in textbook\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Arithematic mean is 10.2875 kg/cm2\n" + ] + } + ], + "prompt_number": 65 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.4.ii - page : 2-34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#average deviation\n", + "import numpy\n", + "n=8 # NO. OF MEASUREMENTS\n", + "q=[10.3,10.7,10.9,9.7,9.5,9.2,10.3,11.7] #\n", + "AM= numpy.mean(q) #arithematic mean in mm\n", + "d=q-AM # deviation\n", + "davg=sum(abs(d))/n # average deviation\n", + "print \"Average deviation = \",round(davg,4),\" kg/cm2\"\n", + "#answer is wrong in textbook" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Average deviation = 0.6156 kg/cm2\n" + ] + } + ], + "prompt_number": 66 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.4.iii - page : 2-34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#standard deviation\n", + "import numpy\n", + "q=[10.3,10.7,10.9,9.7,9.5,9.2,10.3,11.7] #\n", + "AM= numpy.mean(q) #arithematic mean in mm\n", + "d=q-AM\n", + "sigma=0\n", + "n=8 # no. of measurements\n", + "for dev in d:\n", + " sigma+=dev**2\n", + "sigma/=(n-1)\n", + "sigma**=(1.0/2)\n", + "print \"Standard Deviation is \",round(sigma,4),\" kg/cm2\"\n", + "#answer is wrong in textbook\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Standard Deviation is 0.8184 kg/cm2\n" + ] + } + ], + "prompt_number": 95 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7.4.iv - page : 2-34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#probable error\n", + "n=8 # no. of measurements\n", + "q=[10.3,10.7,10.9,9.7,9.5,9.2,10.3,11.7] #\n", + "AM= numpy.mean(q) #arithematic mean in mm\n", + "d=q-AM\n", + "sigma=0\n", + "n=10 # no. of measurements\n", + "for dev in d:\n", + " sigma+=dev**2\n", + "sigma/=(n-1)\n", + "sigma**=(1.0/2)\n", + "pe1=0.6745*sigma # Probable error of one reading\n", + "print \"Probable error of one reading is \",round(pe1,4),\" kg/cm2\"\n", + "pm=pe1/(n-1)**(1.0/2)\n", + "print \"Probable error of mean is \",round(pm,4),\" kg/cm2\"\n", + "#answer is wrong in textbook\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Probable error of one reading is 0.4868 kg/cm2\n", + "Probable error of mean is 0.1623 kg/cm2\n" + ] + } + ], + "prompt_number": 67 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.8.1 - page : 2-34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#ARITHEMATIC MEAN ,median value ,standard deviation and variance\n", + "q=[25.5,30.3,31.1,29.6,32.4,39.4,28.9,30.0,33.3,31.4,29.5,30.5,31.7,33.0,29.2] #\n", + "AM= numpy.mean(q) #arithematic mean in mm\n", + "n=len(q) # no. of measurements\n", + "Q=q-AM\n", + "mv=sorted(q)[n/2] # get the median value from sorted q\n", + "d=q-AM\n", + "sigma=0\n", + "for dev in d:\n", + " sigma+=dev**2\n", + "sigma/=(n-1)\n", + "sigma**=(1.0/2) #standard deviation\n", + "V=sigma**2 #variance\n", + "print \"Arithematic mean is \",round(AM,4),\" V\"\n", + "print \"Median value is\",round(mv,1)\n", + "\n", + "print \"Standard Deviation is \",round(sigma,2)\n", + "\n", + "print \"Variance is \",round(V,0)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Arithematic mean is 31.0533 V\n", + "Median value is 30.5\n", + "Standard Deviation is 3.0\n", + "Variance is 9.0\n" + ] + } + ], + "prompt_number": 116 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.8.2 - page : 2-37" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#ARITHEMATIC MEAN\n", + "#from __future__ import division\n", + "v=[10,11,12,13,14] #\n", + "f=[03,12,18,12,03] #\n", + "xn=[a*b for a,b in zip(v,f)]\n", + "am=sum(xn)/sum(f) # arithmetic mean\n", + "print \"Arithematic mean is \",am,\" V\"\n", + "dn=[x-am for x in v] # deviation\n", + "n_dn=[a*b for a,b in zip(f,dn)]\n", + "dn2=[a*b for a,b in zip(dn,dn)]\n", + "n_dn2=[a*b for a,b in zip(f,dn2)]\n", + "absn_dn=[abs(a) for a in n_dn]\n", + "mean_dev=sum(absn_dn)/sum(f)\n", + "print \"Mean deviation = \",mean_dev\n", + "sigma=(sum(n_dn2)/sum(f))**(1.0/2)\n", + "print \"Standard deviation is \", sigma\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Arithematic mean is 12.0 V\n", + "Mean deviation = 0.75\n", + "Standard deviation is 1.0\n" + ] + } + ], + "prompt_number": 46 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.8.3 - page : 2-37" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#ARITHEMATIC MEAN ,median value ,standard deviation \n", + "import numpy\n", + "q=[29.2,29.5,29.6,30.0,30.5,31.4,31.7,32.4,33.0,33.3,39.4,28.9] #\n", + "AM= numpy.mean(q)#arithematic mean in mm\n", + "print \"Arithematic mean is \",round(AM,2)\n", + "mv=sorted(q)[int(len(q)/2-1)]\n", + "print \"Median value = \",mv\n", + "d=[x-AM for x in q]\n", + "d2=[x**2 for x in d]\n", + "sigma=(sum(d2)/(len(q)-1))**(1.0/2)\n", + "print \"Standard Deviation = \",round(sigma,3)\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Arithematic mean is 31.57\n", + "Median value = 30.5\n", + "Standard Deviation = 2.886\n" + ] + } + ], + "prompt_number": 97 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.8.4 - page:2-39" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Unknown resistor \n", + "#given data :\n", + "S=1000.0 # ohm/V\n", + "V=100.0 #in V\n", + "I=5*10**-3 # in A\n", + "# part (i)\n", + "R_app=(V/I)*10**-3 \n", + "print \"(i) Apparent Resistor, R_app = \",R_app, \" kohm\"\n", + "# part (ii)\n", + "V1=150 #in V\n", + "Rv=S*V1*10**-3 \n", + "Rx=Rv/6.5 #actual resistance in kohm\n", + "print \"(ii) Actual resistance is \",round(Rx,2),\" kohm.\"\n", + "# part(iii)\n", + "per=(Rx-R_app)/Rx*100 # in %\n", + "print \"(iii) Percentage error due to loading effect of voltmeter is \",round(per,1), \" %\" \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Apparent Resistor, R_app = 20.0 kohm\n", + "(ii) Actual resistance is 23.08 kohm.\n", + "(iii) Percentage error due to loading effect of voltmeter is 13.3 %\n" + ] + } + ], + "prompt_number": 103 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.8.5 - page : 2-40" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# limiting error\n", + "#given data :\n", + "del_A=2.5 # may be +ve or-ve in %\n", + "As=400.0 \n", + "FSD=600.0 # in V\n", + "del_A1=(del_A/100)*FSD \n", + "e=(del_A1/As)*100 # in %\n", + "print \"Limiting error, e = \",e, \" %\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Limiting error, e = 3.75 %\n" + ] + } + ], + "prompt_number": 104 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/sample_notebooks/MohdAsif/Chapter2_-_Measurement.ipynb b/sample_notebooks/MohdAsif/Chapter2_-_Measurement.ipynb deleted file mode 100755 index 3442a20e..00000000 --- a/sample_notebooks/MohdAsif/Chapter2_-_Measurement.ipynb +++ /dev/null @@ -1,1549 +0,0 @@ -{ - "metadata": { - "name": "", - "signature": "sha256:95b9e0f83468dda84f2de4d99c5a704a6fadf8064c232b063678fd245192ca75" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "heading", - "level": 1, - "metadata": {}, - "source": [ - "Chapter2 - Measurement Errors" - ] - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3.1 - page : 2-8" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#precision of the 5th measurement\n", - "#given data :\n", - "X1=98.0 \n", - "X2=101.0\n", - "X3=102.0 \n", - "X4=97.0 \n", - "X5=101.0 \n", - "X6=100.0 \n", - "X7=103.0 \n", - "X8=98.0 \n", - "X9=106.0 \n", - "X10=99.0 \n", - "Xn_bar=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/10 \n", - "Xn=101 # value of 5th measurement\n", - "P=(1-abs((Xn-Xn_bar)/Xn_bar))*100 \n", - "print \"Precision of the 5th measurement, P = \", round(P,2), \" %\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Precision of the 5th measurement, P = 99.5 %\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3.2.i - page : 2-10" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Absolute error\n", - "#given data :\n", - "Ae=80.0 # in V\n", - "Am=79.0 # in V\n", - "e=Ae-Am \n", - "print \"Absolute error, e = \", e, \" V\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Absolute error, e = 1.0 V\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3.2.ii - page : 2-10" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Error\n", - "#given data :\n", - "Ae=80.0 # in V\n", - "Am=79.0 # in V\n", - "e=Ae-Am \n", - "error1=(e/Ae)*100 \n", - "print \"Error = \", error1, \" %\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Error = 1.25 %\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3.2.iii - page : 2-10" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Relative accuracy\n", - "#given data :\n", - "Ae=80.0 # in V\n", - "Am=79.0 # in V\n", - "e=Ae-Am \n", - "error1=(e/Ae)*100 \n", - "A=(1-abs(e/Ae)) \n", - "print \"Relative Accuracy, A = \", A" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Relative Accuracy, A = 0.9875\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3.2.iv - page : 2-10" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# % accuracy\n", - "#given data :\n", - "Ae=80.0 # in V\n", - "Am=79.0 # in V\n", - "e=Ae-Am \n", - "error1=(e/Ae)*100 \n", - "A=(1-abs(e/Ae)) \n", - "accuracy=A*100 \n", - "print \"Accuracy = \", accuracy, \" %\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Accuracy = 98.75 %\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3.2.v - page : 2-10" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# % error\n", - "#given data :\n", - "Ae=80.0 # in V\n", - "Am=79.0 # in V\n", - "e=Ae-Am \n", - "f=100.0 #full scale deflection\n", - "error1=(e/Ae)*100 \n", - "A=(1-abs(e/Ae)) \n", - "accuracy=A*100 \n", - "P_error=(e/f)*100 \n", - "print \"% error = \", P_error, \" %\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "% error = 1.0 %\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3.3 - page : 2-11" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Maximum error\n", - "#given data :\n", - "V1=100.0 # in V\n", - "V2=200.0 #in V\n", - "V=V2-V1 \n", - "A=0.25 #may be \u00b1 in %\n", - "max_error=(A/100)*V \n", - "print \"Maximum error = \u00b1 \", max_error, \" V\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Maximum error = \u00b1 0.25 V\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3.4 - page : 2-12" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# sensitivity and deflection error\n", - "#given data :\n", - "C=4.0 # change in output in mm\n", - "M=8.0 # magnitude of input in ohm\n", - "S=C/M \n", - "print \"sensitivity, S = \", S, \" mm/ohm\"\n", - "D=M/C \n", - "print \"Deflection factor, D = \", D, \" ohm/mm\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "sensitivity, S = 0.5 mm/ohm\n", - "Deflection factor, D = 2.0 ohm/mm\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3.5 - page : 2-14" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Resolution\n", - "#given data :\n", - "V=200.0 # full scale reading in V\n", - "N=100.0 # number of divisions \n", - "Scale_div=V/N \n", - "R=(1.0/10)*Scale_div \n", - "print \"Resolution, R = \", R, \" V\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Resolution, R = 0.2 V\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.3.6 - page : 2-14" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Resolution\n", - "#given data :\n", - "V=9.999 # full scale read out in volt\n", - "c=9999.0 # range from 0 to 9999\n", - "R=(1/c)*V*10**3 \n", - "print \"Resolution, R = \", R, \" mV\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Resolution, R = 1.0 mV\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.6.1 - page : 2-23" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Magnitude and relative error\n", - "#given data :\n", - "R1=15.0 #ohm\n", - "E1=R1*5.0/100 # \u00b1 limiting error for R1\n", - "R2=33.0 #ohm\n", - "E2=R2*2.0/100 # \u00b1 limiting error for R2\n", - "R3=75.0 #ohm\n", - "E3=R3*5.0/100 # \u00b1 limiting error for R3\n", - "RT=R1+R2+R3 # ohm(in series)\n", - "ET=E1+E2+E3 #\u00b1limiting error for RT\n", - "print \"For series connection, magnitude is \", RT, \" ohm & limiting error is \u00b1 \", ET, \" ohm.\" \n", - "Epr=ET/RT*100 #%\n", - "print \"Percent relative error : \u00b1\", round(Epr,1),\" %\" \n", - "\n", - "# Answer is not accurate in the textbook." - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "For series connection, magnitude is 123.0 ohm & limiting error is \u00b1 5.16 ohm.\n", - "Percent relative error : \u00b1 4.2 %\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.6.2 - page : 2-23" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Magnitude and relative error\n", - "#given data :\n", - "R1=36.0 #ohm\n", - "E1=5.0 # \u00b1 limiting error for R1\n", - "R2=75.0 #ohm\n", - "E2=5.0 # \u00b1 limiting error for R2\n", - "RT=(R1*R2)/(R1+R2) #ohm(in parallel)\n", - "EP1=E1+E2 # \u00b1 limiting error\n", - "EP2=((R1*E1)/(R1+R2))+((R2*E2)/(R1+R2)) \n", - "ET=EP1+EP2 \n", - "etm=(ET/100)*RT \n", - "print \"Magnitude of limiting error is \u00b1\", round(etm,2), \" ohm\"\n", - "print \"Percentage relative error is \u00b1\", ET, \" %\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Magnitude of limiting error is \u00b1 3.65 ohm\n", - "Percentage relative error is \u00b1 15.0 %\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.6.3 page : 2-24" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Limiting error\n", - "vr=40.0 #reading of voltmeter in volts\n", - "v=50.0 #rane in volts\n", - "va=50.0 #ammeeter reading in mA\n", - "i=125.0 #range in mA\n", - "fsd=2.0 #accurace in percentage in \u00b1\n", - "dv=(2.0/100)*v #limiting error of voltmeter\n", - "da=(2./100)*i #liming error of the ammeter in mA\n", - "erv=dv/vr #relative limiting error in voltmeter reading\n", - "eri=da/i #relative limiting error in ammeter reading\n", - "et=erv+eri \n", - "pet=et*100 #percentage limiting error of the power calcultaed\n", - "print \"Percentage limiting error of the power calcultaed is \u00b1 \",pet,\" %\"\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Percentage limiting error of the power calcultaed is \u00b1 4.5 %\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.6.4 - page : 2-25" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# limiting error\n", - "r1=120.0 # ohm\n", - "er1=0.5 #limiting error in resistance 1 in ohm \u00b1\n", - "r2=2 #in A\n", - "er2=0.02 #limiting error in amperes \u00b1\n", - "e1=er2/r2 #limiting error in current\n", - "e2=er1/r1 #limiting eror in resistance\n", - "et=(2*e1+e2) #total error\n", - "etp=et*100 #percentage limtimg error\n", - "print \"Percentage limiting error in the value of power dissipation is \u00b1\",round(etp,3)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Percentage limiting error in the value of power dissipation is \u00b1 2.417\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.6.5 - page : 2-25" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#magnitude and limiting error\n", - "r1=120 #in ohm\n", - "er1=0.1 #limiting error in resistance 1 in ohm \u00b1\n", - "r2=2700 #in ohm\n", - "er2=0.5 #limiting error in resistance 2 in ohm \u00b1\n", - "r3=470 #in ohm\n", - "er3=0.5 #limiting error in resistance 3 in ohm \u00b1\n", - "rxm=(r2*r3)/r1 #magnitude of unknown resistance in ohm\n", - "rxe=(er1+er2+er3) #error\n", - "er=(rxe*rxm)/100 #relative error \u00b1\n", - "print \"Magnitude of unknown resistance is \",rxm,\" kohm\"\n", - "print \"Relative limiting error is \u00b1\",er,\" ohm\"\n", - "print \"Guranteed value of resistance is between \",rxm-er, \" ohm to \" ,rxm+er,\" ohm\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Magnitude of unknown resistance is 10575 kohm\n", - "Relative limiting error is \u00b1 116.325 ohm\n", - "Guranteed value of resistance is between 10458.675 ohm to 10691.325 ohm\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.6.6 - page : 2-26" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# absolute error, % error, relative error, % accuracy and % error of full scale reading\n", - "#given data :\n", - "Ae=80.0 # in volt\n", - "Am=79 # in volt\n", - "fsd=100 #full scale reading in volt\n", - "e=Ae-Am \n", - "print \"Absolute error, e = \",e,\" V\"\n", - "error1=(e/Ae)*100 \n", - "print \"Error = \",error1,\" %\"\n", - "A=1-abs(e/Ae) \n", - "print \"Relative accuracy, A = \",A,\" %\"\n", - "p_accuracy=A*100 \n", - "print \"% accuracy = \",p_accuracy,\" %\"\n", - "error2=(e/fsd)*100 \n", - "print \"% error expressed as percentage of full scale reading = \",error2,\" %\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Absolute error, e = 1.0 V\n", - "Error = 1.25 %\n", - "Relative accuracy, A = 0.9875 %\n", - "% accuracy = 98.75 %\n", - "% error expressed as percentage of full scale reading = 1.0 %\n" - ] - } - ], - "prompt_number": 17 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.6.7 - page : 2-27" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# limiting error\n", - "#given data :\n", - "fsd=100.0 # in V\n", - "A=1.0 # (+ve or -ve) in %\n", - "del_A=(A/100)*fsd \n", - "As=15.0 #in V\n", - "e1=del_A/As \n", - "e=e1*100 \n", - "print \"Limiting error, e = \",round(e,4),\" %\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Limiting error, e = 6.6667 %\n" - ] - } - ], - "prompt_number": 22 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.6.8 - page : 2-27 " - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# limiting value of current and % limiting error\n", - "#given data :\n", - "As=2.5 # in A\n", - "fsd=10 #full scale reading in A\n", - "A=1.5/100 \n", - "del_A=A*fsd \n", - "At1=As+del_A \n", - "At2=As-del_A \n", - "print \"Limiting value of current, At1 = \",At1,\" A\"\n", - "print \"Limiting value of current, At2 = \",At2,\" A\"\n", - "e=(del_A/As)*100 \n", - "print \"Percentage limiting error, e = \",e,\" %\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Limiting value of current, At1 = 2.65 A\n", - "Limiting value of current, At2 = 2.35 A\n", - "Percentage limiting error, e = 6.0 %\n" - ] - } - ], - "prompt_number": 23 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.1.i - page : 2-30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#ARITHEMATIC MEAN\n", - "import numpy\n", - "q=[49.7,50.1,50.2,49.6,49.7] #\n", - "AM= numpy.mean(q) #arithematic mean in mm\n", - "print \"Arithematic mean is \",AM\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Arithematic mean is 49.86\n" - ] - } - ], - "prompt_number": 57 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.1.ii - page : 2-30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#deviation\n", - "import numpy\n", - "q=[49.7,50.1,50.2,49.6,49.7] #\n", - "AM= numpy.mean(q) #arithematic mean in mm\n", - "d=q-AM\n", - "print \"Deviations of each value are : \"\n", - "for dev in d:\n", - " print dev\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Deviations of each value are : \n", - "-0.16\n", - "0.24\n", - "0.34\n", - "-0.26\n", - "-0.16\n" - ] - } - ], - "prompt_number": 58 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.1.iii - page : 2-30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#algebric sum of deviation\n", - "import numpy\n", - "q=[49.7,50.1,50.2,49.6,49.7] #\n", - "AM= numpy.mean(q) #arithematic mean in mm\n", - "d=q-AM\n", - "dtotal=sum(d)\n", - "print \"Algebric sum of deviation is\", round(dtotal,4)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Algebric sum of deviation is 0.0\n" - ] - } - ], - "prompt_number": 59 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.1.iv - page : 2-30" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#standard deviation\n", - "import numpy\n", - "q=[49.7,50.1,50.2,49.6,49.7] #\n", - "AM= numpy.mean(q) #arithematic mean in mm\n", - "d=q-AM\n", - "sigma=0\n", - "n=5 # no. of measurements\n", - "for dev in d:\n", - " sigma+=dev**2\n", - "sigma/=(n-1)\n", - "sigma**=(1.0/2)\n", - "print \"Standard Deviation is \",round(sigma,2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Standard Deviation is 0.27\n" - ] - } - ], - "prompt_number": 60 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.2.i - page : 2-31" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#ARITHEMATIC MEAN\n", - "import numpy\n", - "q=[101.2,101.4,101.7,101.3,101.3,101.2,101.0,101.3,101.5,101.1] #\n", - "AM= numpy.mean(q) #arithematic mean in mm\n", - "print \"Arithematic mean is \",AM,\" V\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Arithematic mean is 101.3 V\n" - ] - } - ], - "prompt_number": 61 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.2.ii - page : 2-31" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Deviation from mean\n", - "import numpy\n", - "q=[101.2,101.4,101.7,101.3,101.3,101.2,101.0,101.3,101.5,101.1] #\n", - "AM= numpy.mean(q) #arithematic mean in mm\n", - "d=q-AM\n", - "print \"Deviations of each value are : \"\n", - "for dev in d:\n", - " print dev\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Deviations of each value are : \n", - "-0.1\n", - "0.1\n", - "0.4\n", - "0.0\n", - "0.0\n", - "-0.1\n", - "-0.3\n", - "0.0\n", - "0.2\n", - "-0.2\n" - ] - } - ], - "prompt_number": 62 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.2.iii - page : 2-31" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#standard deviation\n", - "import numpy\n", - "q=[101.2,101.4,101.7,101.3,101.3,101.2,101.0,101.3,101.5,101.1] \n", - "AM= numpy.mean(q) #arithematic mean in mm\n", - "d=q-AM\n", - "sigma=0\n", - "n=10 # no. of measurements\n", - "for dev in d:\n", - " sigma+=dev**2\n", - "sigma/=(n-1)\n", - "sigma**=(1.0/2)\n", - "print \"Standard Deviation is \",round(sigma,2)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Standard Deviation is 0.2\n" - ] - } - ], - "prompt_number": 63 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.2.iv - page : 2-31" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#probable error\n", - "import numpy\n", - "q=[101.2,101.4,101.7,101.3,101.3,101.2,101.0,101.3,101.5,101.1] \n", - "AM= numpy.mean(q) #arithematic mean in mm\n", - "d=q-AM\n", - "sigma=0\n", - "n=10 # no. of measurements\n", - "for dev in d:\n", - " sigma+=dev**2\n", - "sigma/=(n-1)\n", - "sigma**=(1.0/2)\n", - "pe1=0.6745*sigma # Probable error of one reading\n", - "print \"Probable error of one reading is \",pe1,\" V\"\n", - "pm=pe1/(n-1)**(1.0/2)\n", - "print \"Probable error of mean is \",round(pm,5)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Probable error of one reading is 0.1349 V\n", - "Probable error of mean is 0.04497\n" - ] - } - ], - "prompt_number": 64 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.3.i - page : 2-32" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Arithmetic mean\n", - "#given data :\n", - "X1=147.2 # in nF\n", - "X2=147.4 # in nF\n", - "X3=147.9 # in nF\n", - "X4=148.1 # in nF\n", - "X5=148.1 # in nF\n", - "X6=147.5 # in nF\n", - "X7=147.6 # in nF\n", - "X8=147.4 # in nF\n", - "X9=147.6 # in nF\n", - "X10=147.5 # in nF\n", - "AM=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/10 \n", - "print \"Arithmetic mean, AM = \",AM,\" nF\" " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Arithmetic mean, AM = 147.63 nF\n" - ] - } - ], - "prompt_number": 77 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.3.ii - page : 2-32" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# Average deviation\n", - "#given data :\n", - "n=10 \n", - "X1=147.2 # in nF\n", - "X2=147.4 # in nF\n", - "X3=147.9 # in nF\n", - "X4=148.1 # in nF\n", - "X5=148.1 # in nF\n", - "X6=147.5 # in nF\n", - "X7=147.6 # in nF\n", - "X8=147.4 # in nF\n", - "X9=147.6 # in nF\n", - "X10=147.5 # in nF\n", - "AM=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/n \n", - "d1=X1-AM \n", - "d2=X2-AM \n", - "d3=X3-AM \n", - "d4=X4-AM \n", - "d5=X5-AM \n", - "d6=X6-AM \n", - "d7=X7-AM \n", - "d8=X8-AM \n", - "d9=X9-AM \n", - "d10=X10-AM \n", - "Average_deviation=(abs(d1)+abs(d2)+abs(d3)+abs(d4)+abs(d5)+abs(d5)+abs(d6)+abs(d7)+abs(d8)+abs(d9)+abs(d10))/n \n", - "print \"Average deviation = \",Average_deviation,\" nF\"\n", - "# answer is wrong in book" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Average deviation = 0.289 nF\n" - ] - } - ], - "prompt_number": 79 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.3.iii - page : 2-32" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Standard deviation\n", - "#given data :\n", - "n=10 \n", - "X1=147.2 # in nF\n", - "X2=147.4 # in nF\n", - "X3=147.9 # in nF\n", - "X4=148.1 # in nF\n", - "X5=148.1 # in nF\n", - "X6=147.5 # in nF\n", - "X7=147.6 # in nF\n", - "X8=147.4 # in nF\n", - "X9=147.6 # in nF\n", - "X10=147.5 # in nF\n", - "AM=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/n \n", - "d1=X1-AM \n", - "d2=X2-AM \n", - "d3=X3-AM \n", - "d4=X4-AM \n", - "d5=X5-AM \n", - "d6=X6-AM \n", - "d7=X7-AM \n", - "d8=X8-AM \n", - "d9=X9-AM \n", - "d10=X10-AM \n", - "sigma=((d1**2+d2**2+d3**2+d4**2+d5**2+d6**2+d7**2+d8**2+d9**2+d10**2)/(n-1))**(1.0/2) \n", - "print \"Standard deviation = \",round(sigma,4),\" nF\"\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Standard deviation = 0.3057 nF\n" - ] - } - ], - "prompt_number": 82 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.3.iv - page : 2-32" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#: Probable error\n", - "#given data :\n", - "n=10 \n", - "X1=147.2 # in nF\n", - "X2=147.4 # in nF\n", - "X3=147.9 # in nF\n", - "X4=148.1 # in nF\n", - "X5=148.1 # in nF\n", - "X6=147.5 # in nF\n", - "X7=147.6 # in nF\n", - "X8=147.4 # in nF\n", - "X9=147.6 # in nF\n", - "X10=147.5 # in nF\n", - "AM=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/n \n", - "d1=X1-AM \n", - "d2=X2-AM \n", - "d3=X3-AM \n", - "d4=X4-AM \n", - "d5=X5-AM \n", - "d6=X6-AM \n", - "d7=X7-AM \n", - "d8=X8-AM \n", - "d9=X9-AM \n", - "d10=X10-AM \n", - "sigma=((d1**2+d2**2+d3**2+d4**2+d5**2+d6**2+d7**2+d8**2+d9**2+d10**2)/(n-1))**(1.0/2)\n", - "Pe1=0.6745*sigma # probable error of one reading\n", - "probable_error=Pe1/(n-1)**(1.0/2)\n", - "print \"Probable error of one reading = \",round(Pe1,4),\" nF\"\n", - "print \"Probable error of mean = \",round(probable_error,4),\" nF\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Probable error of one reading = 0.2062 nF\n", - "Probable error of mean = 0.0687 nF\n" - ] - } - ], - "prompt_number": 86 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.4.i - page : 2-34" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#ARITHEMATIC MEAN\n", - "import numpy\n", - "q=[10.3,10.7,10.9,9.7,9.5,9.2,10.3,11.7] #\n", - "AM= numpy.mean(q) #arithematic mean in mm\n", - "print \"Arithematic mean is \",AM,\" kg/cm2\"\n", - "#answer is wrong in textbook\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Arithematic mean is 10.2875 kg/cm2\n" - ] - } - ], - "prompt_number": 65 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.4.ii - page : 2-34" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#average deviation\n", - "import numpy\n", - "n=8 # NO. OF MEASUREMENTS\n", - "q=[10.3,10.7,10.9,9.7,9.5,9.2,10.3,11.7] #\n", - "AM= numpy.mean(q) #arithematic mean in mm\n", - "d=q-AM # deviation\n", - "davg=sum(abs(d))/n # average deviation\n", - "print \"Average deviation = \",round(davg,4),\" kg/cm2\"\n", - "#answer is wrong in textbook" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Average deviation = 0.6156 kg/cm2\n" - ] - } - ], - "prompt_number": 66 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.4.iii - page : 2-34" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#standard deviation\n", - "import numpy\n", - "q=[10.3,10.7,10.9,9.7,9.5,9.2,10.3,11.7] #\n", - "AM= numpy.mean(q) #arithematic mean in mm\n", - "d=q-AM\n", - "sigma=0\n", - "n=8 # no. of measurements\n", - "for dev in d:\n", - " sigma+=dev**2\n", - "sigma/=(n-1)\n", - "sigma**=(1.0/2)\n", - "print \"Standard Deviation is \",round(sigma,4),\" kg/cm2\"\n", - "#answer is wrong in textbook\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Standard Deviation is 0.8184 kg/cm2\n" - ] - } - ], - "prompt_number": 95 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.7.4.iv - page : 2-34" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#probable error\n", - "n=8 # no. of measurements\n", - "q=[10.3,10.7,10.9,9.7,9.5,9.2,10.3,11.7] #\n", - "AM= numpy.mean(q) #arithematic mean in mm\n", - "d=q-AM\n", - "sigma=0\n", - "n=10 # no. of measurements\n", - "for dev in d:\n", - " sigma+=dev**2\n", - "sigma/=(n-1)\n", - "sigma**=(1.0/2)\n", - "pe1=0.6745*sigma # Probable error of one reading\n", - "print \"Probable error of one reading is \",round(pe1,4),\" kg/cm2\"\n", - "pm=pe1/(n-1)**(1.0/2)\n", - "print \"Probable error of mean is \",round(pm,4),\" kg/cm2\"\n", - "#answer is wrong in textbook\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Probable error of one reading is 0.4868 kg/cm2\n", - "Probable error of mean is 0.1623 kg/cm2\n" - ] - } - ], - "prompt_number": 67 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.8.1 - page : 2-34" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#ARITHEMATIC MEAN ,median value ,standard deviation and variance\n", - "q=[25.5,30.3,31.1,29.6,32.4,39.4,28.9,30.0,33.3,31.4,29.5,30.5,31.7,33.0,29.2] #\n", - "AM= numpy.mean(q) #arithematic mean in mm\n", - "n=len(q) # no. of measurements\n", - "Q=q-AM\n", - "mv=sorted(q)[n/2] # get the median value from sorted q\n", - "d=q-AM\n", - "sigma=0\n", - "for dev in d:\n", - " sigma+=dev**2\n", - "sigma/=(n-1)\n", - "sigma**=(1.0/2) #standard deviation\n", - "V=sigma**2 #variance\n", - "print \"Arithematic mean is \",round(AM,4),\" V\"\n", - "print \"Median value is\",round(mv,1)\n", - "\n", - "print \"Standard Deviation is \",round(sigma,2)\n", - "\n", - "print \"Variance is \",round(V,0)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Arithematic mean is 31.0533 V\n", - "Median value is 30.5\n", - "Standard Deviation is 3.0\n", - "Variance is 9.0\n" - ] - } - ], - "prompt_number": 116 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.8.2 - page : 2-37" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#ARITHEMATIC MEAN\n", - "#from __future__ import division\n", - "v=[10,11,12,13,14] #\n", - "f=[03,12,18,12,03] #\n", - "xn=[a*b for a,b in zip(v,f)]\n", - "am=sum(xn)/sum(f) # arithmetic mean\n", - "print \"Arithematic mean is \",am,\" V\"\n", - "dn=[x-am for x in v] # deviation\n", - "n_dn=[a*b for a,b in zip(f,dn)]\n", - "dn2=[a*b for a,b in zip(dn,dn)]\n", - "n_dn2=[a*b for a,b in zip(f,dn2)]\n", - "absn_dn=[abs(a) for a in n_dn]\n", - "mean_dev=sum(absn_dn)/sum(f)\n", - "print \"Mean deviation = \",mean_dev\n", - "sigma=(sum(n_dn2)/sum(f))**(1.0/2)\n", - "print \"Standard deviation is \", sigma\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Arithematic mean is 12.0 V\n", - "Mean deviation = 0.75\n", - "Standard deviation is 1.0\n" - ] - } - ], - "prompt_number": 46 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.8.3 - page : 2-37" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#ARITHEMATIC MEAN ,median value ,standard deviation \n", - "import numpy\n", - "q=[29.2,29.5,29.6,30.0,30.5,31.4,31.7,32.4,33.0,33.3,39.4,28.9] #\n", - "AM= numpy.mean(q)#arithematic mean in mm\n", - "print \"Arithematic mean is \",round(AM,2)\n", - "mv=sorted(q)[int(len(q)/2-1)]\n", - "print \"Median value = \",mv\n", - "d=[x-AM for x in q]\n", - "d2=[x**2 for x in d]\n", - "sigma=(sum(d2)/(len(q)-1))**(1.0/2)\n", - "print \"Standard Deviation = \",round(sigma,3)\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Arithematic mean is 31.57\n", - "Median value = 30.5\n", - "Standard Deviation = 2.886\n" - ] - } - ], - "prompt_number": 97 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.8.4 - page:2-39" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "#Unknown resistor \n", - "#given data :\n", - "S=1000.0 # ohm/V\n", - "V=100.0 #in V\n", - "I=5*10**-3 # in A\n", - "# part (i)\n", - "R_app=(V/I)*10**-3 \n", - "print \"(i) Apparent Resistor, R_app = \",R_app, \" kohm\"\n", - "# part (ii)\n", - "V1=150 #in V\n", - "Rv=S*V1*10**-3 \n", - "Rx=Rv/6.5 #actual resistance in kohm\n", - "print \"(ii) Actual resistance is \",round(Rx,2),\" kohm.\"\n", - "# part(iii)\n", - "per=(Rx-R_app)/Rx*100 # in %\n", - "print \"(iii) Percentage error due to loading effect of voltmeter is \",round(per,1), \" %\" \n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(i) Apparent Resistor, R_app = 20.0 kohm\n", - "(ii) Actual resistance is 23.08 kohm.\n", - "(iii) Percentage error due to loading effect of voltmeter is 13.3 %\n" - ] - } - ], - "prompt_number": 103 - }, - { - "cell_type": "heading", - "level": 2, - "metadata": {}, - "source": [ - "Example 2.8.5 - page : 2-40" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# limiting error\n", - "#given data :\n", - "del_A=2.5 # may be +ve or-ve in %\n", - "As=400.0 \n", - "FSD=600.0 # in V\n", - "del_A1=(del_A/100)*FSD \n", - "e=(del_A1/As)*100 # in %\n", - "print \"Limiting error, e = \",e, \" %\"" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Limiting error, e = 3.75 %\n" - ] - } - ], - "prompt_number": 104 - } - ], - "metadata": {} - } - ] -} \ No newline at end of file -- cgit