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/rohitmahadev/Chapter1.ipynb | 274 +++++++++++++++++++++++++++ 1 file changed, 274 insertions(+) create mode 100755 sample_notebooks/rohitmahadev/Chapter1.ipynb (limited to 'sample_notebooks/rohitmahadev') diff --git a/sample_notebooks/rohitmahadev/Chapter1.ipynb b/sample_notebooks/rohitmahadev/Chapter1.ipynb new file mode 100755 index 00000000..2349fbd8 --- /dev/null +++ b/sample_notebooks/rohitmahadev/Chapter1.ipynb @@ -0,0 +1,274 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:85e9fe66492d8e2bf21b397989dbba9327240cd1300820fe26869c1390e3cf15" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter1-Introduction fluid mechanics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex1-pg13" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##initialization of new variables\n", + "#calculate density \n", + "M=29. ## Molecular weight of air\n", + "R=8314.3 ## J/mol K Gas constant\n", + "T=300. ##K Temperature\n", + "P=1. ##kg/cm^2 Pressure\n", + "g=9.8 ##m/s^2 Acceleration due to gravity\n", + "##calculations\n", + "R=R/M\n", + "P=P*g*10**4\n", + "rho=P/(R*T)\n", + "##result\n", + "print'%s %.2f %s'%(' Density = ',rho,' kg/m^3 ')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Density = 1.14 kg/m^3 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex2-pg13" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##initialization of new variables\n", + "#calculate shear stress\n", + "t=2. ##cm thickness\n", + "U=3. ##m/s Velocity\n", + "mu=0.29 ##kg/m s Coefficient of Viscocity\n", + "##calculations\n", + "tau=mu*U/(t*10**-2)\n", + "##results\n", + "print'%s %.2f %s'%(' Shear = ',tau,' N/m^2')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Shear = 43.50 N/m^2\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex3-pg13" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##initialization of new variables\n", + "#calculate pressure differnce\n", + "sigma=2.5*10**-2 ##N/m\n", + "D=10 ##cm\n", + "##calculations\n", + "R=D/2.\n", + "dP=2.*sigma/(R*10**-2)\n", + "##result\n", + "print'%s %.2f %s'%('The pressure difference is = ',dP,' N/m^2')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The pressure difference is = 1.00 N/m^2\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex4-pg15" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##initialization of new variables\n", + "#calculate rise of water and rise of mercury\n", + "R=1. ##mm\n", + "sigma=0.073 ##N/m\n", + "theta=0. ##degrees\n", + "rho=1000. ##kg/m^3\n", + "g=9.8 ##m/s^2\n", + "##calculations\n", + "theta=theta*math.pi/180 ##radians\n", + "h=2*sigma*math.cos(theta)/(rho*g*R*10**-3)\n", + "##result\n", + "print'%s %.2f %s'%('The rise of water = ',h,' m')\n", + "R=1. ##mm\n", + "sigma=0.48 ##N/m\n", + "theta=130. ##degrees\n", + "rho=13600. ##kg/m^3\n", + "g=9.8 ##m/s^2\n", + "##calculations\n", + "theta=theta*math.pi/180 ##radians\n", + "h=2*sigma*math.cos(theta)/(rho*g*R*10**-3)\n", + "##result\n", + "print'%s %.2e %s'%('\\n The rise of mercury = ',h,' m')\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The rise of water = 0.01 m\n", + "\n", + " The rise of mercury = -4.63e-03 m\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex5-pg15" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##initialization of new variables\n", + "#calculate chenge in pressure and change in volume\n", + "E=2.34*10**9 ##N/m^2 Modulus of Elasticity\n", + "d=1 ##km depth\n", + "rho=1000. ##kg/m^3 density\n", + "g=9.8 ##m/s^2 Acceleration due to gravity\n", + "##calculations\n", + "d=d*1000. \n", + "dp=rho*g*d\n", + "dVV=dp/E\n", + "##result\n", + "print'%s %.2e %s'%('The change in pressure is ',dp,' N/m^2 ')\n", + "print'%s %.3e %s'%('\\n Change in volume is ',dVV,'')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The change in pressure is 9.80e+06 N/m^2 \n", + "\n", + " Change in volume is 4.188e-03 \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Ex6-pg16" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "##initialization of new variables\n", + "#calculate speed of sound in air and speed of sound in sea water\n", + "T=300. ##K\n", + "gama=1.4\n", + "R=286.6\n", + "##calculation\n", + "## for air\n", + "a=math.sqrt(gama*R*T)\n", + "##result\n", + "print'%s %.2f %s'%('The speed of sound in air is ',a,' m/s ')\n", + "## for sea water\n", + "E=2.34*10**9 ## N/m^2\n", + "rho=1000. ##kg/cm^2\n", + "a=math.sqrt(E/rho)\n", + "##result\n", + "print'%s %.2f %s'%(' \\n The speed of sound in sea waer is ',a,' m/s ')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The speed of sound in air is 346.95 m/s \n", + " \n", + " The speed of sound in sea waer is 1529.71 m/s \n" + ] + } + ], + "prompt_number": 6 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file -- cgit