{ "metadata": { "name": "", "signature": "sha256:69dc81267d132717cceb5ed01afab9cdbb37bfc431d05698243961d6dd4f91a3" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 4 : Information Analysis" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.2 Page No : 4-22" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from numpy import *\n", "\n", "#initialisation of variables\n", "y_bar = 19.5\t#in\n", "x = 396.8\t#in\n", "n = 6\t#in\n", "y1 = 2.20\t#in\n", "x1 = 51.14\t#in\n", "p = 5.64\t#in\n", "ob_y = array([44,20,24,14,12,3])\n", "ob_x = array([5.3,3.5,3.,1.2,0.48,-0.26])\n", "\n", "#CALCULATIONS\n", "Beta = round((x-n*(y_bar)*(y1))/(x1-n*(y1)**2),2)\n", "y = around(y_bar + Beta*(ob_x - 2.2),decimals=1)\n", "Ri = ob_y - y\n", "sumRi = sum(Ri)\n", "\n", "#RESULTS\n", "print \"Beta B = %.2f\"%Beta\n", "print \"residuals Ri are : \" ,Ri\n", "print 'the method of leate squares = %.2f minimum'%(sumRi)\n", "\n", "# note : answer is slighty different because of rounding off error." ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Beta B = 6.31\n", "residuals Ri are : [ 4.9 -7.7 -0.5 0.8 3.4 -1. ]\n", "the method of leate squares = -0.10 minimum\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.3 Page No : 4-30" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from numpy import *\n", "\n", "#initialisation of variables\n", "a = 12.\t #in\n", "h = 121.\t#in\n", "p = 11. #in\n", "s = 220.\t#in\n", "observed_time = array([11,12,13,14,15,16,17,18,19,20,21])\n", "i = array([1,2,3,4,5,6,7,8,9,10,11])\n", "observed_magnitude = array([2,4,6,8,10,12,14,16,18,20,22])\n", "y_uy = array([-10,-8,-6,-4,-2,0,2,4,6,8,10])\n", "\n", "#CALCULATIONS\n", "B = a/p*(h-1)*s\t#per unit\n", "n = len(i)\n", "i_6 = i - (n+1)/2\n", "i_6_y_uy = (i - (n+1)/2)*y_uy\n", "\n", "#RESULTS\n", "print \"Observed Time \", observed_time\n", "print \"Order,i \", i\n", "print \"[i-(n+1)/2] \", i_6\n", "print \"Observed magnitude \", observed_magnitude\n", "print \"Deviation from mean \", y_uy\n", "print \"[i-(n+1)/2](y-uy) \", i_6_y_uy \n", "\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Observed Time [11 12 13 14 15 16 17 18 19 20 21]\n", "Order,i [ 1 2 3 4 5 6 7 8 9 10 11]\n", "[i-(n+1)/2] [-5 -4 -3 -2 -1 0 1 2 3 4 5]\n", "Observed magnitude [ 2 4 6 8 10 12 14 16 18 20 22]\n", "Deviation from mean [-10 -8 -6 -4 -2 0 2 4 6 8 10]\n", "[i-(n+1)/2](y-uy) [50 32 18 8 2 0 2 8 18 32 50]\n" ] } ], "prompt_number": 18 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.5 Page No : 4-31" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\n", "#initialisation of variables\n", "a = 4404.\t#ft\n", "q = 9.\t#ft\n", "mu = 12.\t#ft\n", "\t\n", "#CALCULATIONS\n", "F = math.sqrt(a/q)\t#ft\n", "CF = F/mu*100\t#percent\n", "\t\n", "#RESULTS\n", "print 'the coefficient of fluctuation is = %.0f percent'%(CF)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "the coefficient of fluctuation is = 184 percent\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.7 Page No : 4-35" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\n", "#initialisation of variables\n", "h2 = 5\t#in\n", "x = 3.72\t#in\n", "x1 = 1.28\t#in\n", "\t\n", "#CALCULATIONS\n", "H = h2*x1/x\t#in\n", "\t\n", "#RESULTS\n", "print 'the either side of the center of the scale = %.2f in'%(H)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "the either side of the center of the scale = 1.72 in\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.8 Page No : 4-35" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\t\n", "#initialisation of variables\n", "p = 80\t#in\n", "q = 20\t#in\n", "\t\n", "#CALCULATIONS\n", "K = p+q\t#ft\n", "\t\n", "#RESULTS\n", "print 'the moments of the arithmetically normal frequency curve = %.0f ft'%(K)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "the moments of the arithmetically normal frequency curve = 100 ft\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4.9 Page No : 4-38" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math \n", "\t\n", "#initialisation of variables\n", "g = 3.2541\t#in\n", "g1 = 3.46\t#in\n", "m = 0.5390\t#ft\n", "h = 2./99\t#ft\n", "p = 1.52\t#ft\n", "\t\n", "#CALCULATIONS\n", "L = math.sqrt(g*h)\t#in\n", "mu = g1*p\t#in\n", "M = g1/p\t#percent\n", "\t\n", "#RESULTS\n", "print 'the points necessary to plot the straigt line of fit on math.log probability = %.2f percent'%(M)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "the points necessary to plot the straigt line of fit on math.log probability = 2.28 percent\n" ] } ], "prompt_number": 4 } ], "metadata": {} } ] }