From 47d7279a724246ef7aa0f5359cf417992ed04449 Mon Sep 17 00:00:00 2001 From: hardythe1 Date: Wed, 3 Jun 2015 15:27:17 +0530 Subject: add books --- sample_notebooks/DevikaRaj/Chapter1.ipynb | 221 ++++++++++++++++++++++++++++++ 1 file changed, 221 insertions(+) create mode 100755 sample_notebooks/DevikaRaj/Chapter1.ipynb (limited to 'sample_notebooks/DevikaRaj') diff --git a/sample_notebooks/DevikaRaj/Chapter1.ipynb b/sample_notebooks/DevikaRaj/Chapter1.ipynb new file mode 100755 index 00000000..2e5de774 --- /dev/null +++ b/sample_notebooks/DevikaRaj/Chapter1.ipynb @@ -0,0 +1,221 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 1 - Physics and Engineering" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1 - pg 11" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Percentage Error (percentage) = 4.0\n" + ] + } + ], + "source": [ + "#calculate the percentage error\n", + "#Given:\n", + "l=9.3; # length in cm\n", + "b=8.5;# breadth in cm\n", + "h=5.4;# height in cm\n", + "#calculations\n", + "V= l*b*h; # Volume in cm**3\n", + "delta_l = 0.1; delta_b = 0.1; delta_h = 0.1; # scale has a least count = 0.1 cm\n", + "# absolute error \n", + "delta_V = (b*h*delta_l + l*h*delta_b +l*b*delta_h); # in cm**3\n", + "#relative error \n", + "re = delta_V/V;\n", + "p= re*100; # Evaluating percentage error\n", + "#results\n", + "print \"Percentage Error (percentage) = \",round(p,0)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2 - pg 12" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Percentage error (percentage) = 2.86\n", + "Result obtained differs from that in textbook, because delta_M walue is taken 0.1 g , instead of 0.2 g as mentioned in the problem statement.\n" + ] + } + ], + "source": [ + "#calculate the percentage error\n", + "#Given :\n", + "M= 10.0; #weight in g\n", + "V= 5.80;#volume in cm**3\n", + "#calculations\n", + "Rho = M/V; # Density in g/cm**3\n", + "delta_M= 0.2 # apparatus has a least count of 0.2 g\n", + "delta_V= 0.05# apparatus has a least count of 0.05 cm**3\n", + "delta_Rho = (delta_M/V) +((M*delta_V)/V**2);# absolute error in g/cm**3\n", + "re = delta_Rho/Rho ; #Evaluating Relative Error\n", + "p = re*100;# Evaluating Percentage Error\n", + "#results\n", + "print \"Percentage error (percentage) = \",round(p,2)\n", + "print'Result obtained differs from that in textbook, because delta_M walue is taken 0.1 g , instead of 0.2 g as mentioned in the problem statement.'\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 3 - pg 16" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(a)Actual Value of c/r ranges between 5.9 - 6.6 and Percentage error = 5.3 percentage. \n", + "(b)Actual Value of c/r ranges between 6.281 - 6.288 and Percentage error = 0.06 percentage.\n" + ] + } + ], + "source": [ + "#calculate the Actual val of c/r ranges and percentage error\n", + "#Given:\n", + "#(a) \n", + "import math\n", + "lc = 0.1# least count in cm\n", + "c = 6.9 #Circumference c in cm\n", + "r= 1.1 # radius of circle in cm\n", + "val =2*math.pi;\n", + "# Circumference,c= 2*pi*r or c/r = 2*pi\n", + "# Error in c/r is , delta(c/r)= [(c/r**2)+(1/r)](LC/2) , LC is Least Count .\n", + "E= ((c/r**2)+(1./r))*(lc/2.);#Error in c/r is delta(c/r)\n", + "ob = c/r; # Observed Value\n", + "#Actual Value of c/r ranges between\n", + "ac1 = ob-E;# Evaluating Minimum value for c/r \n", + "ac2 = ob+E;# Evaluating Maximum value for c/r\n", + "p = (E/ob)*100.; #Evaluating percentage error\n", + "#results\n", + "print \"(a)Actual Value of c/r ranges between\",round(ac1,1), \"-\",round(ac2,1),\" and Percentage error =\",round(p,1),\" percentage. \"\n", + "#(b)\n", + "lc1 = 0.001;#Now the least count is 0.001 cm\n", + "c1 = 6.316;#Circumference in cm\n", + "r1=1.005;#Circle radius in cm \n", + "E1 =((c1/r1**2) + (1/r1))*(lc1/2); # Error in c/r is delta(c/r)\n", + "ob1= c1/r1; #Observed Value\n", + "p1=(E1/ob1)*100.;#Evaluating percentage error\n", + "#Actual Value of c/r ranges between\n", + "a1= ob1-E1;#Evaluating Minimum value for c/r\n", + "a2= ob1+E1;#Evaluating Maximum value for c/r\n", + "print \"(b)Actual Value of c/r ranges between\",round(a1,3),\"-\",round(a2,3),\"and Percentage error =\",round(p1,2),\" percentage.\"\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4 - pg 17" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(a) It is is 15.0 percentage lower than the experimental value.\n", + "(b) It is 0.6 percentage higher than the experimental value.\n" + ] + } + ], + "source": [ + "#calculate the percentage lower or higher than experimental value\n", + "#Given\n", + "import math\n", + "# (a) Newton's Theory\n", + "# v= (P/rho)**2 , P= Pressure , rho = density\n", + "P = 76.; # 76 cm of Hg pressure\n", + "V= 330. ; # velocity of sound in m/s\n", + "rho = 0.001293; # density for dry air at 0 degrees celsius in g/cm**3\n", + "g = 980.;#gravitational acceleration in cm/s**2\n", + "#Density of mercury at room temperature is 13.6 g/cm**3 \n", + "# 1 cm**2 = 1.0*10**-4 m**2\n", + "#calculations\n", + "v = math.sqrt(((P*13.6*g)/rho)*10**-4); # velocity of sound in m/s\n", + "p= ((V-v)/V)*100; # % lower than the experimental value\n", + "#results\n", + "print \"(a) It is is\",round(p,0),\" percentage lower than the experimental value.\"\n", + "\n", + "# (b) Laplace's Theory \n", + "# v= ((gama*P)/rho)**2., gamma = adiabatic index Thus,\n", + "#Given :\n", + "gama = 1.41 # Adiabatic index\n", + "#Density of mercury at room temperature is 13.6 g/cm**3 \n", + "# 1 cm**2 = 1.0*10**-4 m**2\n", + "v1 = math.sqrt(((gama*P*13.6*g)/rho)*10**-4);# velocity of sound in m/s\n", + "p1 = ((V-round(v1))/V)*100;# % higher than the eperimental value\n", + "#results\n", + "print \"(b) It is\",round(abs(p1),1),\"percentage higher than the experimental value.\"" + ] + } + ], + "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 +} -- cgit