diff --git a/ANSI_C_Programming/.ipynb_checkpoints/chapter1-checkpoint.ipynb b/ANSI_C_Programming/.ipynb_checkpoints/chapter1-checkpoint.ipynb new file mode 100644 index 00000000..d96946b1 --- /dev/null +++ b/ANSI_C_Programming/.ipynb_checkpoints/chapter1-checkpoint.ipynb @@ -0,0 +1,200 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:90d67b804f2d6ea1cd245c10aa788b889d877aef594e9fa5adb7fa4fe440ff07" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "CHAPTER 1: GETTING STARTED" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 1.1 PAGE:12" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + " \n", + "p=1000\n", + "n=3\n", + "r=8.5\n", + "si=p*n*r/100 #formula for simple interest\n", + "print \"%f\\n\" % (si)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "255.000000\n", + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 1.2 PAGE:17" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "print \"Enter values of p,n,r\"\n", + "p=eval(raw_input())\n", + "n=eval(raw_input())\n", + "r=eval(raw_input())\n", + "si=p*n*r/100\n", + "print \"%f\\n\" % (si)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter values of p,n,r\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1000\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "255.000000\n", + "\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.3 page:18" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "print \"Enter a number\"\n", + "num=eval(raw_input()) #to take user input\n", + "print \"Now I am letting you on a secret...\\n\"\n", + "print \"You have just entered the number %d\\n\" % (num)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "30\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Now I am letting you on a secret...\n", + "\n", + "You have just entered the number 30\n", + "\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 1.4 PAGE:23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "a=pow(3,2) #(3**2) will also do the same operation\n", + "print \"%d\" % (a)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + } + ], + "prompt_number": 4 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/ANSI_C_Programming/.ipynb_checkpoints/chapter10-checkpoint.ipynb b/ANSI_C_Programming/.ipynb_checkpoints/chapter10-checkpoint.ipynb new file mode 100644 index 00000000..2661180a --- /dev/null +++ b/ANSI_C_Programming/.ipynb_checkpoints/chapter10-checkpoint.ipynb @@ -0,0 +1,768 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:daf123ab814e7627f17e2eb15e9f46bef8346c280ed286a5a5d39a012e1c98c4" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "CHAPTER 10: STRUCTURES" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 10.1 PAGE:342-343" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "name=[]\n", + "price=[]\n", + "pages=[]\n", + "for i in range(3):\n", + " name.append(\"\\0\")\n", + " price.append(0)\n", + " pages.append(0)\n", + "print \"Enter names,prices and no. of pages of 3 books\\n\"\n", + "for i in range(0,3,1):\n", + " name[i]=raw_input()\n", + " price[i]=eval(raw_input())\n", + " pages[i]=eval(raw_input())\n", + "print \"\\nAnd this is what you entered\\n\"\n", + "for i in range(0,3,1):\n", + " print \"%c %f %d\\n\" % (name[i],price[i],pages[i])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter names,prices and no. of pages of 3 books\n", + "\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "A\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "100.00\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "354\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "C\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "256.50\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "682\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "F\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "233.70\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "512\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "And this is what you entered\n", + "\n", + "A 100.000000 354\n", + "\n", + "C 256.500000 682\n", + "\n", + "F 233.700000 512\n", + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 10.2 PAGE:343-344" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class book: #YOU CAN ALSO USE CTYPES FOR IMPLEMENTING STRUCTURES\n", + " def __init__(self, **kwds):\n", + " self.__dict__.update(kwds)\n", + "b1=book()\n", + "b2=book()\n", + "b3=book()\n", + "print \"Enter names,prices & no. of pages of 3 books\\n\"\n", + "b1.name=raw_input()\n", + "b1.price=eval(raw_input())\n", + "b1.pages=eval(raw_input())\n", + "b2.name=raw_input()\n", + "b2.price=eval(raw_input())\n", + "b2.pages=eval(raw_input())\n", + "b3.name=raw_input()\n", + "b3.price=eval(raw_input())\n", + "b3.pages=eval(raw_input())\n", + "print \"And this is what you entered\\n\"\n", + "print \"%c %f %d\\n\" % (b1.name,b1.price,b1.pages)\n", + "print \"%c %f %d\\n\" % (b2.name,b2.price,b2.pages)\n", + "print \"%c %f %d\\n\" % (b3.name,b3.price,b3.pages)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter names,prices & no. of pages of 3 books\n", + "\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "A\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "100.00\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "354\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "C\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "256.50\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "682\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "F\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "233.70\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "512\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "And this is what you entered\n", + "\n", + "A 100.000000 354\n", + "\n", + "C 256.500000 682\n", + "\n", + "F 233.700000 512\n", + "\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 10.3 PAGE:347" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class book():\n", + " def __init__(self,**kwds):\n", + " self.__dict__.update(kwds)\n", + "b1=book(name='B',price=130.00,pages=550)\n", + "print \"Address of name=%u\\n\" % (id(b1.name))\n", + "print \"Address of price=%u\\n\" % (id(b1.price))\n", + "print \"Address of pages=%u\\n\" % (id(b1.pages))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Address of name=20788864\n", + "\n", + "Address of price=88371144\n", + "\n", + "Address of pages=88859008\n", + "\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 10.4 PAGE:348-349" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def linkfloat():\n", + " a=0\n", + " b=id(a) #cause emulator to be linked\n", + "class book():\n", + " def __init__(self,**kwds):\n", + " self.__dict__.update(kwds)\n", + "b=[]\n", + "for i in range(3):\n", + " b.append(0) #setting initial value as zero\n", + "for i in range(0,3,1):\n", + " b[i]=book()\n", + "for i in range(0,3,1):\n", + " print \"Enter name price and pages\"\n", + " b[i].name=raw_input()\n", + " b[i].price=eval(raw_input())\n", + " b[i].pages=eval(raw_input())\n", + "for i in range(0,3,1):\n", + " print \"%c %f %d\\n\" % (b[i].name,b[i].price,b[i].pages)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name price and pages\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "A\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "100.00\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "354\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name price and pages\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "C\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "256.50\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "682\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name price and pages\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "F\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "233.70\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "512\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "A 100.000000 354\n", + "\n", + "C 256.500000 682\n", + "\n", + "F 233.700000 512\n", + "\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 10.5 PAGE:350-351" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class employee():\n", + " def __init__(self,**kwds):\n", + " self.__dict__.update(kwds)\n", + "e1=employee(name=\"Sanjay\",age=30,salary=5500.50)\n", + "e2=employee()\n", + "e3=employee()\n", + "#piece-meal copying\n", + "import copy\n", + "e2.name=copy.copy(e1.name)\n", + "e2.age=e1.age\n", + "e2.salary=e1.salary\n", + "#copying all elements at one go\n", + "e3=e2\n", + "print \"%s %d %f\\n\" % (e1.name,e1.age,e1.salary)\n", + "print \"%s %d %f\\n\" % (e2.name,e2.age,e2.salary)\n", + "print \"%s %d %f\\n\" % (e3.name,e3.age,e3.salary)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sanjay 30 5500.500000\n", + "\n", + "Sanjay 30 5500.500000\n", + "\n", + "Sanjay 30 5500.500000\n", + "\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 10.6 PAGE:351-352" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class address():\n", + " def __init__(self, **kwds):\n", + " self.__dict__.update(kwds)\n", + "class emp():\n", + " def __init__(self, **kwds):\n", + " self.__dict__.update(kwds)\n", + "a = address(phone=\"531046\", city=\"nagpur\", pin=10)\n", + "e = emp(name=\"jeru\", address=a)\n", + "print \"name=%s phone=%s\\n\" % (e.name,e.address.phone)\n", + "print \"city=%s pin=%d\\n\" % (e.address.city,e.address.pin)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "name=jeru phone=531046\n", + "\n", + "city=nagpur pin=10\n", + "\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 10.7 PAGE:353" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class book():\n", + " def __init__(self, **kwds):\n", + " self.__dict__.update(kwds)\n", + "def display(s,t,n):\n", + " print \"%s %s %d\\n\" % (s,t,n)\n", + "b1=book(name=\"Let us C\",author=\"YPK\",callno=101)\n", + "display(b1.name,b1.author,b1.callno)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Let us C YPK 101\n", + "\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 10.8 PAGE:353-354" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class book():\n", + " def __init__(self, **kwds):\n", + " self.__dict__.update(kwds)\n", + "def display(b):\n", + " print \"%s %s %d\\n\" % (b.name,b.author,b.callno)\n", + "b1=book(name=\"Let us C\",author=\"YPK\",callno=101)\n", + "display(b1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Let us C YPK 101\n", + "\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 10.9 PAGE:354-355" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class book():\n", + " def __init__(self, **kwds):\n", + " self.__dict__.update(kwds)\n", + "b1=book(name=\"Let us C\",author=\"YPK\",callno=101)\n", + "ptr=book()\n", + "ptr=b1\n", + "print \"%s %s %d\\n\" % (b1.name,b1.author,b1.callno)\n", + "print \"%s %s %d\\n\" % (ptr.name,ptr.author,ptr.callno)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Let us C YPK 101\n", + "\n", + "Let us C YPK 101\n", + "\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 10.10 PAGE:355-356" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class book():\n", + " def __init__(self, **kwds):\n", + " self.__dict__.update(kwds)\n", + "def display(b):\n", + " print \"%s %s %d\\n\" % (b.name,b.author,b.callno)\n", + "b1=book(name=\"Let us C\",author=\"YPK\",callno=101)\n", + "display(b1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Let us C YPK 101\n", + "\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 10.11 PAGE:356" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class emp():\n", + " def __init__(self, **kwds):\n", + " self.__dict__.update(kwds)\n", + "e=emp(a=0,ch='\\0',s=0.0)\n", + "print \"%u %u %u\\n\" % (id(e.a),id(e.ch),id(e.s))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "20623060 20204312 88374024\n", + "\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 10.12 PAGE:357-358" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class emp():\n", + " def __init__(self,a,ch,s): #Structure without using dictionary\n", + " self.a=a\n", + " self.ch=ch\n", + " self.s=s\n", + "e=emp(a=0,ch='\\0',s=0.0)\n", + "print \"%u %u %u\\n\" % (id(e.a),id(e.ch),id(e.s))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "20360916 19942168 88177544\n", + "\n" + ] + } + ], + "prompt_number": 10 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/ANSI_C_Programming/.ipynb_checkpoints/chapter11-checkpoint.ipynb b/ANSI_C_Programming/.ipynb_checkpoints/chapter11-checkpoint.ipynb new file mode 100644 index 00000000..c836215e --- /dev/null +++ b/ANSI_C_Programming/.ipynb_checkpoints/chapter11-checkpoint.ipynb @@ -0,0 +1,534 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:28717ddcdc2d93e1617740abd9a34bb6c9bea63b5da4ddd876a563d2216569c1" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "CHAPTER 11: CONSOLE INPUT/OUTPUT" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 11.1 PAGE:372" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "avg=346\n", + "per=69.2\n", + "print \"Average=%d\\nPercentage=%f\\n\" % (avg,per)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Average=346\n", + "Percentage=69.200000\n", + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 11.2 PAGE:374" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "weight=63\n", + "print \"weight is %d kg\\n\" % (weight)\n", + "print \"weight is %2d kg\\n\" % (weight)\n", + "print \"weight is %4d kg\\n\" % (weight)\n", + "print \"weight is %6d kg\\n\" % (weight)\n", + "print \"weight is %-6d kg\\n\" % (weight)\n", + "print \"weight is %1d kg\\n\" % (weight)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "weight is 63 kg\n", + "\n", + "weight is 63 kg\n", + "\n", + "weight is 63 kg\n", + "\n", + "weight is 63 kg\n", + "\n", + "weight is 63 kg\n", + "\n", + "weight is 63 kg\n", + "\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 11.3 PAGE:374-375" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "print \"%f%f%f\\n\" % (5.0,13.5,133.9)\n", + "print \"%f%f%f\\n\" % (305.0,1200.9,3005.3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "5.00000013.500000133.900000\n", + "\n", + "305.0000001200.9000003005.300000\n", + "\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 11.4 PAGE:375" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "print \"%10.1f%10.1f%10.1f\\n\" % (5.0,13.5,133.9)\n", + "print \"%10.1f%10.1f%10.1f\\n\" % (305.0,1200.9,3005.3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 5.0 13.5 133.9\n", + "\n", + " 305.0 1200.9 3005.3\n", + "\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 11.5 PAGE:375" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "firstname1=\"Sandy\"\n", + "surname1=\"Malya\"\n", + "firstname2=\"AjayKumar\"\n", + "surname2=\"Gurubaxani\"\n", + "print \"%20s%20s\\n\" % (firstname1,surname1)\n", + "print \"%20s%20s\\n\" % (firstname2,surname2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Sandy Malya\n", + "\n", + " AjayKumar Gurubaxani\n", + "\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 11.6 PAGE:376" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "print \"You\\tmust\\tbe\\tcrazy\\nto\\thate\\tthis\\tbook\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "You\tmust\tbe\tcrazy\n", + "to\thate\tthis\tbook\n", + "\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 11.7 PAGE:377-378" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "ch='z'\n", + "i=125\n", + "a=12.55\n", + "s=\"hello there!\"\n", + "print \"%c %d %f\\n\" % (ch,ord(ch),ord(ch))\n", + "print \"%s\\n\" % (s) #here conversation not possible\n", + "print \"%c %d %f\\n\" % (i,i,i)\n", + "print \"%f %d\\n\" % (a,a)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "z 122 122.000000\n", + "\n", + "hello there!\n", + "\n", + "} 125 125.000000\n", + "\n", + "12.550000 12\n", + "\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 11.8 PAGE:379" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "i=10\n", + "ch='A'\n", + "a=3.14\n", + "print \"%d %c %f\\n\" % (i,ch,a)\n", + "str=[i,ch,a]\n", + "print \"%s\\n\" % (str)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10 A 3.140000\n", + "\n", + "[10, 'A', 3.14]\n", + "\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 11.9 PAGE:380" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "print \"Press any key to continue\"\n", + "raw_input() #will echo the character\n", + "print \"\\nType any character\"\n", + "ch=raw_input() #will echo the character typed\n", + "print \"\\nType any character\"\n", + "raw_input() #will echo character\n", + "print \"\\nContinue Y/N\"\n", + "raw_input() #will echo character" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Press any key to continue\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Type any character\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "B\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Type any character\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "W\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Continue Y/N\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Y\n" + ] + }, + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 11, + "text": [ + "'Y'" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 11.10 PAGE:381" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "ch='A'\n", + "print ch,\n", + "print(ch),\n", + "print ch,\n", + "print 'Z',\n", + "print('Z'),\n", + "print'Z'," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "A A A Z Z Z\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 11.15 PAGE:381" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "print \"Enter name\"\n", + "name=raw_input()\n", + "print \"%s\\n\" % (name)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Jonty Rhodes\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Jonty Rhodes\n", + "\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 11.16 PAGE:382" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "print \"Enter name\"\n", + "footballer=raw_input() #sends base address of array\n", + "print \"Happy footballing!\"\n", + "print footballer" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Jonty Rhodes\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Happy footballing!\n", + "Jonty Rhodes\n" + ] + } + ], + "prompt_number": 16 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/ANSI_C_Programming/.ipynb_checkpoints/chapter12-checkpoint.ipynb b/ANSI_C_Programming/.ipynb_checkpoints/chapter12-checkpoint.ipynb new file mode 100644 index 00000000..18ea00dc --- /dev/null +++ b/ANSI_C_Programming/.ipynb_checkpoints/chapter12-checkpoint.ipynb @@ -0,0 +1,1456 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:b88ea7ba5beada8b0214f768e5c5a8dee7191df03bb14244db37b36214a7fed4" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "CHAPTER 12:FILE INPUT/OUTPUT" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 12.1 PAGE:391" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "fp=open('PR1.txt','r') #open the file for reading\n", + "ch=fp.readlines() #ch will store all content of file\n", + "print \"%s\" % (' '.join(ch)) #prints content of file\n", + "print \"\\n\"\n", + "fp.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "site:http://www.bzu.edu.pk/\n", + " user:siteuser@localhost\n", + " version:5.5.32-0ubuntu0.12.04.1\n", + " db: bzu\n", + " tables:\n", + " username:web,webadmin,webadministrator23\n", + " pass:71dc9f7af599450b23a3b5d54bc665c7,\t49fa1a081c8d5c8dcfa05d730803251a,\t*E8665C4049F515D836A3C8704D0543C6DA0FE96D\n", + "\n", + "\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 12.2 PAGE:394" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "try:\n", + " fp=open('yoyo.txt','r')\n", + " for line in fin:\n", + " print line\n", + " fp.close()\n", + "except:\n", + " print 'cannot open file'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "cannot open file\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 12.3 PAGE:395" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "nol=0\n", + "nom=0\n", + "nob=0\n", + "noc=0\n", + "fp=open('H4CK3R.txt','r')\n", + "while True:\n", + " ch=fp.read(1)\n", + " if not ch:\n", + " break\n", + " noc+=1\n", + " if ch==' ':\n", + " nob+=1\n", + " if ch=='\\n':\n", + " nol+=1\n", + " if ch=='\\t':\n", + " nom+=1\n", + "fp.close()\n", + "print \"\\n\"\n", + "fp.close()\n", + "print \"Number of characters=%d\\n\" % (noc)\n", + "print \"Number of blanks=%d\\n\" % (nob)\n", + "print \"Number of tabs=%d\\n\" % (nom)\n", + "print \"Number of lines=%d\\n\" % (nol)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + "Number of characters=162\n", + "\n", + "Number of blanks=21\n", + "\n", + "Number of tabs=3\n", + "\n", + "Number of lines=4\n", + "\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 12.4 PAGE:396-397" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import sys\n", + "try:\n", + " fs=open('H4CK3R.txt','r')\n", + "except:\n", + " print \"Cannot open file\"\n", + " sys.exit(1)\n", + "try:\n", + " ft=open('python.txt','w')\n", + "except:\n", + " print \"Cannot open file\"\n", + " fs.close()\n", + " sys.exit(2)\n", + "ch=fs.readlines()\n", + "ft.writelines(ch)\n", + "fs.close()\n", + "ft.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 12.5 PAGE:399" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "try:\n", + " fp=open('POEM.txt','w')\n", + "except:\n", + " print 'cannot open file'\n", + "print \"\\nEnter a few lines of text:\\n\"\n", + "s=' '\n", + "while (len(s)>0):\n", + " s=raw_input()\n", + " fp.writelines(s)\n", + " fp.writelines(\"\\n\")\n", + "fp.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter a few lines of text:\n", + "\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Shining and bright,they are forever,\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "so true about diamonds,\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "more so of memories,\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "especially yours!\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 12.6 PAGE:400" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "try:\n", + " fp=open('POEM.txt','r')\n", + "except:\n", + " print 'cannot open file'\n", + "s=fp.read(99)\n", + "print \"%s\" % (s)\n", + "print \"\\n\"\n", + "fp.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Shining and bright,they are forever,\n", + "so true about diamonds,\n", + "more so of memories,\n", + "especially yours!\n", + "\n", + "\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 12.7 PAGE:401-402" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class emp():\n", + " def __init__(self,**kwds):\n", + " self.__dict__.update(kwds)\n", + "another='Y'\n", + "e=emp()\n", + "try:\n", + " fp=open('EMPLOYEE.txt','w')\n", + "except:\n", + " print 'cannot open file'\n", + "while another=='Y':\n", + " print \"\\nEnter name,age and basic salary:\"\n", + " e.name=raw_input()\n", + " e.age=eval(raw_input())\n", + " e.bs=eval(raw_input())\n", + " ch=\"%s %d %f\" % (e.name,e.age,e.bs)\n", + " fp.writelines(ch)\n", + " fp.writelines(\"\\n\")\n", + " print \"Add another record(Y/N)\"\n", + " another=raw_input()\n", + "fp.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter name,age and basic salary:\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sunil\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "34\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1250.50\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Add another record(Y/N)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter name,age and basic salary:\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sameer\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "21\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1300.50\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Add another record(Y/N)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter name,age and basic salary:\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Rahul\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "34\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1400.55\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Add another record(Y/N)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "n\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 12.8 PAGE:403-404" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class emp():\n", + " def __init__(self,**kwds):\n", + " self.__dict__.update(kwds)\n", + "e=emp()\n", + "try:\n", + " fp=open('EMPLOYEE.txt','r') # open the file for reading\n", + "except:\n", + " print 'cannot open file'\n", + "for line in fp: # iterate over each line\n", + " e.name, e.age, e.bs = line.split() # split it by whitespace\n", + " e.age = int(e.age) # convert age from string to int\n", + " e.bs = float(e.bs) # convert bs from string to float\n", + " print \"%s %d %f\\n\" %(e.name, e.age, e.bs)\n", + "fp.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sunil 34 1250.500000\n", + "\n", + "Sameer 21 1300.500000\n", + "\n", + "Rahul 34 1400.550000\n", + "\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 12.9 PAGE:404-405" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import sys #for exit()\n", + "try:\n", + " fs=open('H4CK3R.txt','rb') # open the file for reading\n", + "except:\n", + " print 'cannot open file'\n", + " sys.exit(1)\n", + "try:\n", + " ft=open('python.txt','wb') # open the file for writing\n", + "except:\n", + " print 'cannot open file'\n", + " fs.close()\n", + " sys.exit(2)\n", + "ch=fs.readlines()\n", + "ft.writelines(ch)\n", + "fs.close()\n", + "ft.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 12.10 PAGE:407-408" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class emp():\n", + " def __init__(self,**kwds):\n", + " self.__dict__.update(kwds)\n", + "another='Y'\n", + "e=emp()\n", + "try:\n", + " fp=open('EMP.txt','wb') # open the file for reading\n", + "except:\n", + " print 'cannot open file' \n", + "while another=='Y':\n", + " print \"\\nEnter name,age and basic salary:\"\n", + " e.name=raw_input()\n", + " e.age=eval(raw_input())\n", + " e.bs=eval(raw_input())\n", + " ch=\"%s %d %f\" % (e.name,e.age,e.bs)\n", + " fp.writelines(ch)\n", + " print \"Add another record (Y/N)\"\n", + " another=raw_input()\n", + " if another=='Y':\n", + " fp.writelines(\"\\n\")\n", + "fp.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter name,age and basic salary:\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Suresh\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "24\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1250.50\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Add another record (Y/N)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter name,age and basic salary:\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Ranjan\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "21\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1300.60\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Add another record (Y/N)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter name,age and basic salary:\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Harish\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "28\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1400.70\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Add another record (Y/N)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "N\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 12.11 PAGE:409" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class emp():\n", + " def __init__(self,**kwds):\n", + " self.__dict__.update(kwds)\n", + "e=emp()\n", + "try:\n", + " fp=open('EMP.txt','rb')\n", + "except:\n", + " print \"Cannot open file\"\n", + "for line in fp:\n", + " e.name, e.age, e.bs = line.split() # split it by whitespace\n", + " e.age = int(e.age) # convert age from string to int\n", + " e.bs = float(e.bs) # convert bs from string to float\n", + " print \"%s %d %f\\n\" %(e.name, e.age, e.bs)\n", + "fp.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Suresh 24 1250.500000\n", + "\n", + "Ranjan 21 1300.600000\n", + "\n", + "Harish 28 1400.700000\n", + "\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 12.12 PAGE:411-414" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class emp():\n", + " def __init__(self,**kwds):\n", + " self.__dict__.update(kwds)\n", + "e=emp()\n", + "try:\n", + " fp=open('EMP.txt','rb+') # open the file for reading\n", + "except:\n", + " try:\n", + " fp=open('EMP.txt','wb+') # open the file for writing\n", + " except:\n", + " print 'cannot open file'\n", + "while 1:\n", + " print \"1.Add Records\"\n", + " print \"2.List Records\"\n", + " print \"3.Modify Records\"\n", + " print \"4.Delete Records\"\n", + " print \"0.Exit\"\n", + " print \"Your choice\"\n", + " choice=eval(raw_input())\n", + " def add():\n", + " import os\n", + " fp.seek(0,os.SEEK_END)\n", + " another='Y'\n", + " while another=='Y':\n", + " print \"\\nEnter name,age and basic salary:\"\n", + " e.name=raw_input()\n", + " e.age=eval(raw_input())\n", + " e.bs=eval(raw_input())\n", + " ch=\"%s %d %f\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\" % (e.name,e.age,e.bs)\n", + " fp.writelines(\"\\n\")\n", + " fp.writelines(ch)\n", + " print \"Add another record(Y/N)\"\n", + " another=raw_input()\n", + " def list():\n", + " import os\n", + " fp.seek(0,os.SEEK_SET)\n", + " for line in fp: # iterate over each line\n", + " if len(line)>10:\n", + " e.name, e.age, e.bs = line.split() # split it by whitespace\n", + " e.age = int(e.age) # convert age from string to int\n", + " e.bs = float(e.bs) # convert bs from string to float\n", + " print \"%s %d %f\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\" %(e.name, e.age, e.bs)\n", + " def modify():\n", + " another='Y'\n", + " while another=='Y':\n", + " print \"\\nEnter name of employee to modify\"\n", + " empname=raw_input()\n", + " import os\n", + " fp.seek(0,os.SEEK_SET)\n", + " for line in iter(fp.readline, ''):\n", + " if len(line)>10:\n", + " e.name, e.age, e.bs=line.split()\n", + " e.age = int(e.age) # convert age from string to int\n", + " e.bs = float(e.bs)\n", + " if(cmp(e.name,empname)==0):\n", + " c=len(line)\n", + " print \"\\nEnter new name,age & bs\"\n", + " e.name=raw_input()\n", + " e.age=eval(raw_input())\n", + " e.bs=eval(raw_input())\n", + " import os\n", + " fp.seek(-c,os.SEEK_CUR)\n", + " ch=\"%s %d %f\" % (e.name,e.age,e.bs)\n", + " fp.writelines(\"\\n\")\n", + " fp.writelines(ch)\n", + " fp.writelines(\"\\n\")\n", + " break\n", + " print \"\\nModify another Record(Y/N)\"\n", + " another=raw_input()\n", + " def delete():\n", + " another='Y'\n", + " global fp\n", + " while another=='Y':\n", + " print \"\\nEnter name of employee to delete\"\n", + " empname=raw_input()\n", + " ft=open('TEMP.txt','wb')\n", + " import os\n", + " fp.seek(0,os.SEEK_SET)\n", + " for line in fp:\n", + " if len(line)>10:\n", + " e.name, e.age, e.bs=line.split()\n", + " e.age = int(e.age) # convert age from string to int\n", + " e.bs = float(e.bs)\n", + " if(cmp(e.name,empname)!=0):\n", + " ch=\"%s %d %f\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\" % (e.name,e.age,e.bs)\n", + " ft.writelines(ch)\n", + " ft.writelines(\"\\n\")\n", + " fp.close()\n", + " ft.close()\n", + " import os\n", + " os.remove(\"EMP.txt\") # Delete file EMP.txt\n", + " os.rename( \"TEMP.txt\", \"D:/EMP.txt\" ) # Rename a file from TEMP.txt to EMP.txt\n", + " fp=open('EMP.txt','rb+')\n", + " print \"Delete another record(Y/N)\"\n", + " another=raw_input()\n", + " def exit():\n", + " import sys\n", + " fp.close()\n", + " sys.exit(0)\n", + " def switch(c):\n", + " return {1: add,\n", + " 2: list,\n", + " 3: modify,\n", + " 4: delete,\n", + " 0: exit,\n", + " }[c]()\n", + " switch(choice)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1.Add Records\n", + "2.List Records\n", + "3.Modify Records\n", + "4.Delete Records\n", + "0.Exit\n", + "Your choice\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Suresh 24 1250.500000\t\t\t\t\t\t\t\t\t\t\n", + "Ranjan 21 1300.600000\t\t\t\t\t\t\t\t\t\t\n", + "Harish 28 1400.700000\t\t\t\t\t\t\t\t\t\t\n", + "1.Add Records\n", + "2.List Records\n", + "3.Modify Records\n", + "4.Delete Records\n", + "0.Exit\n", + "Your choice\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter name,age and basic salary:\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Ram\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "20\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5000\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Add another record(Y/N)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter name,age and basic salary:\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "GOPAL\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "19\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6755.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Add another record(Y/N)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "N\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1.Add Records\n", + "2.List Records\n", + "3.Modify Records\n", + "4.Delete Records\n", + "0.Exit\n", + "Your choice\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Suresh 24 1250.500000\t\t\t\t\t\t\t\t\t\t\n", + "Ranjan 21 1300.600000\t\t\t\t\t\t\t\t\t\t\n", + "Harish 28 1400.700000\t\t\t\t\t\t\t\t\t\t\n", + "Ram 20 5000.000000\t\t\t\t\t\t\t\t\t\t\n", + "GOPAL 19 6755.500000\t\t\t\t\t\t\t\t\t\t\n", + "1.Add Records\n", + "2.List Records\n", + "3.Modify Records\n", + "4.Delete Records\n", + "0.Exit\n", + "Your choice\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter name of employee to modify\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Ram\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter new name,age & bs\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Radhey\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "15\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4687.66\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Modify another Record(Y/N)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "N\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1.Add Records\n", + "2.List Records\n", + "3.Modify Records\n", + "4.Delete Records\n", + "0.Exit\n", + "Your choice\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Suresh 24 1250.500000\t\t\t\t\t\t\t\t\t\t\n", + "Ranjan 21 1300.600000\t\t\t\t\t\t\t\t\t\t\n", + "Harish 28 1400.700000\t\t\t\t\t\t\t\t\t\t\n", + "Radhey 15 4687.660000\t\t\t\t\t\t\t\t\t\t\n", + "GOPAL 19 6755.500000\t\t\t\t\t\t\t\t\t\t\n", + "1.Add Records\n", + "2.List Records\n", + "3.Modify Records\n", + "4.Delete Records\n", + "0.Exit\n", + "Your choice\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter name of employee to delete\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Radhey\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Delete another record(Y/N)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "N\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1.Add Records\n", + "2.List Records\n", + "3.Modify Records\n", + "4.Delete Records\n", + "0.Exit\n", + "Your choice\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Suresh 24 1250.500000\t\t\t\t\t\t\t\t\t\t\n", + "Ranjan 21 1300.600000\t\t\t\t\t\t\t\t\t\t\n", + "Harish 28 1400.700000\t\t\t\t\t\t\t\t\t\t\n", + "GOPAL 19 6755.500000\t\t\t\t\t\t\t\t\t\t\n", + "1.Add Records\n", + "2.List Records\n", + "3.Modify Records\n", + "4.Delete Records\n", + "0.Exit\n", + "Your choice\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter name of employee to delete\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "GOPAL\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Delete another record(Y/N)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "N\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1.Add Records\n", + "2.List Records\n", + "3.Modify Records\n", + "4.Delete Records\n", + "0.Exit\n", + "Your choice\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Suresh 24 1250.500000\t\t\t\t\t\t\t\t\t\t\n", + "Ranjan 21 1300.600000\t\t\t\t\t\t\t\t\t\t\n", + "Harish 28 1400.700000\t\t\t\t\t\t\t\t\t\t\n", + "1.Add Records\n", + "2.List Records\n", + "3.Modify Records\n", + "4.Delete Records\n", + "0.Exit\n", + "Your choice\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "ename": "SystemExit", + "evalue": "0", + "output_type": "pyerr", + "traceback": [ + "An exception has occurred, use %tb to see the full traceback.\n", + "\u001b[1;31mSystemExit\u001b[0m\u001b[1;31m:\u001b[0m 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stderr", + "text": [ + "To exit: use 'exit', 'quit', or Ctrl-D.\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 12.13 PAGE:416-417" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "from StringIO import StringIO\n", + "buffer = StringIO()\n", + "print \"\\nEnter source file name\"\n", + "source=raw_input()\n", + "try:\n", + " inhandle=open(source,'rb')\n", + "except:\n", + " print \"Cannot open file\"\n", + "print \"Enter target file name\"\n", + "target=raw_input()\n", + "try:\n", + " outhandle=open(target,'wb')\n", + "except:\n", + " print \"Cannot open file\"\n", + " inhandle.close()\n", + "bytes=inhandle.readlines()\n", + "buffer.write(bytes)\n", + "outhandle.writelines(buffer.getvalue())\n", + "buffer.close()\n", + "inhandle.close()\n", + "outhandle.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter source file name\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "H4CK3R.txt\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter target file name\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "python.txt\n" + ] + } + ], + "prompt_number": 24 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/ANSI_C_Programming/.ipynb_checkpoints/chapter13-checkpoint.ipynb b/ANSI_C_Programming/.ipynb_checkpoints/chapter13-checkpoint.ipynb new file mode 100644 index 00000000..9497198b --- /dev/null +++ b/ANSI_C_Programming/.ipynb_checkpoints/chapter13-checkpoint.ipynb @@ -0,0 +1,711 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:7742db14fd252e12755c3b2a8046a8b1fad9930978c63d2533b8d746c5d4cb5e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "CHAPTER 13: MORE ISSUES IN INPUT/OUTPUT" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 13.1 PAGE:434-435" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import sys\n", + "if(len(sys.argv)!=3):\n", + " print \"Improper number of arguments\\n\"\n", + " sys.exit(0)\n", + "try:\n", + " fs=open(sys.argv[1], \"r\")\n", + "except:\n", + " sys.exit(\"Cannot open source file\\n\")\n", + "try:\n", + " ft=open(sys.argv[2], \"w\")\n", + "except:\n", + " fs.close()\n", + " sys.exit(\"Cannot open source file\\n\")\n", + "ch=fs.readlines()\n", + "ft.writelines(ch)\n", + "fs.close()\n", + "ft.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 13.2 PAGE:437-438" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "try:\n", + " fp=open('python.txt','w')\n", + " while True:\n", + " ch=fp.read(1)\n", + " if not ch:\n", + " break;\n", + " print \"%c\" % (ch)\n", + "except:\n", + " print \"Error in reading file\\n\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Error in reading file\n", + "\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 13.3 PAGE:439" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import tempfile\n", + "import win32api\n", + "import win32print\n", + "import sys\n", + "\n", + "try:\n", + " fp=open('poem.txt','r') #No need to open it\n", + "except:\n", + " sys.exit(\"Cannot open file\\n\")\n", + "win32api.ShellExecute (\n", + " 0,\n", + " \"print\",\n", + " \"poem.txt\",\n", + " '/d:\"%s\"' % win32print.GetDefaultPrinter (),\n", + " \".\",\n", + " 0\n", + ")\n", + "fp.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 3, + "text": [ + "42" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 13.4 PAGE:440-441" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import sys\n", + "ch = sys.stdin.read(1)\n", + "while (len(ch)>0):\n", + " sys.stdout.write(ch)\n", + " ch = sys.stdin.read(1)" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 13.5 PAGE:442" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "for ch in range(0,256,1):\n", + " print \"%d %c\\n\" % (ch,ch)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 \u0000\n", + "\n", + "1 \u0001\n", + "\n", + "2 \u0002\n", + "\n", + "3 \u0003\n", + "\n", + "4 \u0004\n", + "\n", + "5 \u0005\n", + "\n", + "6 \u0006\n", + "\n", + "7 \u0007\n", + "\n", + "8 \b\n", + "\n", + "9 \t\n", + "\n", + "10 \n", + "\n", + "\n", + "11 \u000b", + "\n", + "\n", + "12 \f", + "\n", + "\n", + "13 \r\n", + "\n", + "14 \u000e\n", + "\n", + "15 \u000f\n", + "\n", + "16 \u0010\n", + "\n", + "17 \u0011\n", + "\n", + "18 \u0012\n", + "\n", + "19 \u0013\n", + "\n", + "20 \u0014\n", + "\n", + "21 \u0015\n", + "\n", + "22 \u0016\n", + "\n", + "23 \u0017\n", + "\n", + "24 \u0018\n", + "\n", + "25 \u0019\n", + "\n", + "26 \u001a\n", + "\n", + "27 \u001b\n", + "\n", + "28 \u001c", + "\n", + "\n", + "29 \u001d", + "\n", + "\n", + "30 \u001e", + "\n", + "\n", + "31 \u001f\n", + "\n", + "32 \n", + "\n", + "33 !\n", + "\n", + "34 \"\n", + "\n", + "35 #\n", + "\n", + "36 $\n", + "\n", + "37 %\n", + "\n", + "38 &\n", + "\n", + "39 '\n", + "\n", + "40 (\n", + "\n", + "41 )\n", + "\n", + "42 *\n", + "\n", + "43 +\n", + "\n", + "44 ,\n", + "\n", + "45 -\n", + "\n", + "46 .\n", + "\n", + "47 /\n", + "\n", + "48 0\n", + "\n", + "49 1\n", + "\n", + "50 2\n", + "\n", + "51 3\n", + "\n", + "52 4\n", + "\n", + "53 5\n", + "\n", + "54 6\n", + "\n", + "55 7\n", + "\n", + "56 8\n", + "\n", + "57 9\n", + "\n", + "58 :\n", + "\n", + "59 ;\n", + "\n", + "60 <\n", + "\n", + "61 =\n", + "\n", + "62 >\n", + "\n", + "63 ?\n", + "\n", + "64 @\n", + "\n", + "65 A\n", + "\n", + "66 B\n", + "\n", + "67 C\n", + "\n", + "68 D\n", + "\n", + "69 E\n", + "\n", + "70 F\n", + "\n", + "71 G\n", + "\n", + "72 H\n", + "\n", + "73 I\n", + "\n", + "74 J\n", + "\n", + "75 K\n", + "\n", + "76 L\n", + "\n", + "77 M\n", + "\n", + "78 N\n", + "\n", + "79 O\n", + "\n", + "80 P\n", + "\n", + "81 Q\n", + "\n", + "82 R\n", + "\n", + "83 S\n", + "\n", + "84 T\n", + "\n", + "85 U\n", + "\n", + "86 V\n", + "\n", + "87 W\n", + "\n", + "88 X\n", + "\n", + "89 Y\n", + "\n", + "90 Z\n", + "\n", + "91 [\n", + "\n", + "92 \\\n", + "\n", + "93 ]\n", + "\n", + "94 ^\n", + "\n", + "95 _\n", + "\n", + "96 `\n", + "\n", + "97 a\n", + "\n", + "98 b\n", + "\n", + "99 c\n", + "\n", + "100 d\n", + "\n", + "101 e\n", + "\n", + "102 f\n", + "\n", + "103 g\n", + "\n", + "104 h\n", + "\n", + "105 i\n", + "\n", + "106 j\n", + "\n", + "107 k\n", + "\n", + "108 l\n", + "\n", + "109 m\n", + "\n", + "110 n\n", + "\n", + "111 o\n", + "\n", + "112 p\n", + "\n", + "113 q\n", + "\n", + "114 r\n", + "\n", + "115 s\n", + "\n", + "116 t\n", + "\n", + "117 u\n", + "\n", + "118 v\n", + "\n", + "119 w\n", + "\n", + "120 x\n", + "\n", + "121 y\n", + "\n", + "122 z\n", + "\n", + "123 {\n", + "\n", + "124 |\n", + "\n", + "125 }\n", + "\n", + "126 ~\n", + "\n", + "127 \u007f\n", + "\n", + "128 \ufffd\n", + "\n", + "129 \ufffd\n", + "\n", + "130 \ufffd\n", + "\n", + "131 \ufffd\n", + "\n", + "132 \ufffd\n", + "\n", + "133 \ufffd\n", + "\n", + "134 \ufffd\n", + "\n", + "135 \ufffd\n", + "\n", + "136 \ufffd\n", + "\n", + "137 \ufffd\n", + "\n", + "138 \ufffd\n", + "\n", + "139 \ufffd\n", + "\n", + "140 \ufffd\n", + "\n", + "141 \ufffd\n", + "\n", + "142 \ufffd\n", + "\n", + "143 \ufffd\n", + "\n", + "144 \ufffd\n", + "\n", + "145 \ufffd\n", + "\n", + "146 \ufffd\n", + "\n", + "147 \ufffd\n", + "\n", + "148 \ufffd\n", + "\n", + "149 \ufffd\n", + "\n", + "150 \ufffd\n", + "\n", + "151 \ufffd\n", + "\n", + "152 \ufffd\n", + "\n", + "153 \ufffd\n", + "\n", + "154 \ufffd\n", + "\n", + "155 \ufffd\n", + "\n", + "156 \ufffd\n", + "\n", + "157 \ufffd\n", + "\n", + "158 \ufffd\n", + "\n", + "159 \ufffd\n", + "\n", + "160 \ufffd\n", + "\n", + "161 \ufffd\n", + "\n", + "162 \ufffd\n", + "\n", + "163 \ufffd\n", + "\n", + "164 \ufffd\n", + "\n", + "165 \ufffd\n", + "\n", + "166 \ufffd\n", + "\n", + "167 \ufffd\n", + "\n", + "168 \ufffd\n", + "\n", + "169 \ufffd\n", + "\n", + "170 \ufffd\n", + "\n", + "171 \ufffd\n", + "\n", + "172 \ufffd\n", + "\n", + "173 \ufffd\n", + "\n", + "174 \ufffd\n", + "\n", + "175 \ufffd\n", + "\n", + "176 \ufffd\n", + "\n", + "177 \ufffd\n", + "\n", + "178 \ufffd\n", + "\n", + "179 \ufffd\n", + "\n", + "180 \ufffd\n", + "\n", + "181 \ufffd\n", + "\n", + "182 \ufffd\n", + "\n", + "183 \ufffd\n", + "\n", + "184 \ufffd\n", + "\n", + "185 \ufffd\n", + "\n", + "186 \ufffd\n", + "\n", + "187 \ufffd\n", + "\n", + "188 \ufffd\n", + "\n", + "189 \ufffd\n", + "\n", + "190 \ufffd\n", + "\n", + "191 \ufffd\n", + "\n", + "192 \ufffd\n", + "\n", + "193 \ufffd\n", + "\n", + "194 \ufffd\n", + "\n", + "195 \ufffd\n", + "\n", + "196 \ufffd\n", + "\n", + "197 \ufffd\n", + "\n", + "198 \ufffd\n", + "\n", + "199 \ufffd\n", + "\n", + "200 \ufffd\n", + "\n", + "201 \ufffd\n", + "\n", + "202 \ufffd\n", + "\n", + "203 \ufffd\n", + "\n", + "204 \ufffd\n", + "\n", + "205 \ufffd\n", + "\n", + "206 \ufffd\n", + "\n", + "207 \ufffd\n", + "\n", + "208 \ufffd\n", + "\n", + "209 \ufffd\n", + "\n", + "210 \ufffd\n", + "\n", + "211 \ufffd\n", + "\n", + "212 \ufffd\n", + "\n", + "213 \ufffd\n", + "\n", + "214 \ufffd\n", + "\n", + "215 \ufffd\n", + "\n", + "216 \ufffd\n", + "\n", + "217 \ufffd\n", + "\n", + "218 \ufffd\n", + "\n", + "219 \ufffd\n", + "\n", + "220 \ufffd\n", + "\n", + "221 \ufffd\n", + "\n", + "222 \ufffd\n", + "\n", + "223 \ufffd\n", + "\n", + "224 \ufffd\n", + "\n", + "225 \ufffd\n", + "\n", + "226 \ufffd\n", + "\n", + "227 \ufffd\n", + "\n", + "228 \ufffd\n", + "\n", + "229 \ufffd\n", + "\n", + "230 \ufffd\n", + "\n", + "231 \ufffd\n", + "\n", + "232 \ufffd\n", + "\n", + "233 \ufffd\n", + "\n", + "234 \ufffd\n", + "\n", + "235 \ufffd\n", + "\n", + "236 \ufffd\n", + "\n", + "237 \ufffd\n", + "\n", + "238 \ufffd\n", + "\n", + "239 \ufffd\n", + "\n", + "240 \ufffd\n", + "\n", + "241 \ufffd\n", + "\n", + "242 \ufffd\n", + "\n", + "243 \ufffd\n", + "\n", + "244 \ufffd\n", + "\n", + "245 \ufffd\n", + "\n", + "246 \ufffd\n", + "\n", + "247 \ufffd\n", + "\n", + "248 \ufffd\n", + "\n", + "249 \ufffd\n", + "\n", + "250 \ufffd\n", + "\n", + "251 \ufffd\n", + "\n", + "252 \ufffd\n", + "\n", + "253 \ufffd\n", + "\n", + "254 \ufffd\n", + "\n", + "255 \ufffd\n", + "\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/ANSI_C_Programming/.ipynb_checkpoints/chapter14-checkpoint.ipynb b/ANSI_C_Programming/.ipynb_checkpoints/chapter14-checkpoint.ipynb new file mode 100644 index 00000000..7e629ab9 --- /dev/null +++ b/ANSI_C_Programming/.ipynb_checkpoints/chapter14-checkpoint.ipynb @@ -0,0 +1,407 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:e75fb8abb9fbadffee6af07df2cc63d66fbde29a162f782fce45e1438f5886bc" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "CHAPTER 14: OPERATIONS ON BITS" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 14.1 PAGE:449" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def showbits(x):\n", + " return bin(x)[2:].zfill(16)\n", + "for j in range(0,6,1):\n", + " print \"Decimal %d is same as binary\" % (j)\n", + " print showbits(j)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Decimal 0 is same as binary\n", + "0000000000000000\n", + "Decimal 1 is same as binary\n", + "0000000000000001\n", + "Decimal 2 is same as binary\n", + "0000000000000010\n", + "Decimal 3 is same as binary\n", + "0000000000000011\n", + "Decimal 4 is same as binary\n", + "0000000000000100\n", + "Decimal 5 is same as binary\n", + "0000000000000101\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 14.2 PAGE:450" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def showbits(x):\n", + " return bin(x)[2:].zfill(16)\n", + "for j in range(0,4,1):\n", + " print \"Decimal %d is same as binary\" % (j)\n", + " print showbits(j)\n", + " k=j^65535 #using xor for making one's complement\n", + " print \"One's complement of %d is\" % (j)\n", + " print showbits(k)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Decimal 0 is same as binary\n", + "0000000000000000\n", + "One's complement of 0 is\n", + "1111111111111111\n", + "Decimal 1 is same as binary\n", + "0000000000000001\n", + "One's complement of 1 is\n", + "1111111111111110\n", + "Decimal 2 is same as binary\n", + "0000000000000010\n", + "One's complement of 2 is\n", + "1111111111111101\n", + "Decimal 3 is same as binary\n", + "0000000000000011\n", + "One's complement of 3 is\n", + "1111111111111100\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 14.3 PAGE:451" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import sys\n", + "def encrypt():\n", + " try:\n", + " fs=open('SOURCE.txt','r') #normal file\n", + " ft=open('TARGET.txt','w') #encrypted file\n", + " except:\n", + " print \"File opening error!\"\n", + " sys.exit(1)\n", + " while True:\n", + " ch=fs.read(1)\n", + " if not ch:\n", + " break\n", + " ft.write(bytearray([ord(ch)^0xff]))\n", + " fs.close()\n", + " ft.close()\n", + "encrypt()" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 14.4 PAGE:452" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def showbits(x):\n", + " return bin(x)[2:].zfill(16)\n", + "i=5225\n", + "print \"Decimal %d is same as binary\" % (i)\n", + "print showbits(i)\n", + "for j in range(0,6,1):\n", + " k=i>>j #right shift operator\n", + " print \"%d right shift %d gives\" % (i,j)\n", + " print showbits(k)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Decimal 5225 is same as binary\n", + "0001010001101001\n", + "5225 right shift 0 gives\n", + "0001010001101001\n", + "5225 right shift 1 gives\n", + "0000101000110100\n", + "5225 right shift 2 gives\n", + "0000010100011010\n", + "5225 right shift 3 gives\n", + "0000001010001101\n", + "5225 right shift 4 gives\n", + "0000000101000110\n", + "5225 right shift 5 gives\n", + "0000000010100011\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 14.5 PAGE:453-454" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def showbits(x):\n", + " return bin(x)[2:].zfill(16)\n", + "i=5225\n", + "print \"Decimal %d is same as binary\" % (i)\n", + "print showbits(i)\n", + "for j in range(0,5,1):\n", + " mask = 2 ** 16 - 1\n", + " k = (i << j) & mask #left shift operator\n", + " print \"%d right shift %d gives\" % (i,j)\n", + " print showbits(k)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Decimal 5225 is same as binary\n", + "0001010001101001\n", + "5225 right shift 0 gives\n", + "0001010001101001\n", + "5225 right shift 1 gives\n", + "0010100011010010\n", + "5225 right shift 2 gives\n", + "0101000110100100\n", + "5225 right shift 3 gives\n", + "1010001101001000\n", + "5225 right shift 4 gives\n", + "0100011010010000\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 14.6 PAGE:457-458" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "d=9\n", + "m=3\n", + "y=1990\n", + "date=(y-1980)*512+m*32+d\n", + "print \"Date=%u\\n\" % (date)\n", + "year=1980+(date>>9)\n", + "month=((date<<7)>>12)\n", + "day=((date<<11)>>11)\n", + "print \"Year=%u\" % (year)\n", + "print \"Month=%u\" % (month)\n", + "print \"Day=%u\" % (day)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Date=5225\n", + "\n", + "Year=1990\n", + "Month=163\n", + "Day=5225\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 14.7 PAGE:460" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "i=65\n", + "print \"Value of i=%d\\n\" % (i)\n", + "j=i&32\n", + "if j==0:\n", + " print \"and its fifth bit is off\\n\"\n", + "else:\n", + " print \"and its fifth bit is on\\n\"\n", + "j=i&64\n", + "if j==0:\n", + " print \"whereas its sixth bit is off\\n\"\n", + "else:\n", + " print \"whereas its sixth bit is on\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of i=65\n", + "\n", + "and its fifth bit is off\n", + "\n", + "whereas its sixth bit is on\n", + "\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 14.8 PAGE:463" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "b=50\n", + "b=b^12 #XOR operator\n", + "print \"%d\\n\" % (b) #this will print 62\n", + "b=b^12\n", + "print \"%d\\n\" % (b) #this will print 50" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "62\n", + "\n", + "50\n", + "\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 14.9 PAGE:463-464" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def showbit(n):\n", + " for i in range(15,-1,-1):\n", + " andmask=1<\n", + "\n", + "Long live viruses!!\n", + "\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE ON PAGE:481-482" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def display():\n", + " print \"\\nLong live viruses!!\"\n", + "func_ptr=display\n", + "print \"Address of function display is %s\\n\" % (display)\n", + "func_ptr()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Address of function display is \n", + "\n", + "\n", + "Long live viruses!!\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 15.8 PAGE:483" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def fun():\n", + " i=20\n", + " return (id(i))\n", + "p=fun\n", + "p()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 9, + "text": [ + "20688356" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 15.9 PAGE:483-484" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def copy(t,s):\n", + " t=\"\\0\"\n", + " for item in s:\n", + " t=t+item\n", + " return t\n", + "source=\"Jaded\"\n", + "target=[]\n", + "str1=copy(target,source)\n", + "print \"%s\\n\" % (str1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\u0000Jaded\n", + "\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 15.10 PAGE:485" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def findmax(tot_num,*num): #tuples\n", + " max=0\n", + " for count in range(0,len(num),1):\n", + " if num[count]>max:\n", + " max=num[count]\n", + " return max\n", + "max=findmax(5,23,15,1,92,50)\n", + "print \"maximum=%d\\n\" % (max)\n", + "max=findmax(3,100,300,29)\n", + "print \"maximum=%d\\n\" % (max)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "maximum=92\n", + "\n", + "maximum=300\n", + "\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 15.11 PAGE:486-487" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def display(type,num,*t):\n", + " def integer():\n", + " for j in range(0,num,1):\n", + " print \"%d\" % (t[j])\n", + " def char():\n", + " for j in range(0,num,1):\n", + " print \"%c\" % (t[j])\n", + " def floating():\n", + " for j in range(0,num,1):\n", + " print \"%f\" % (t[j])\n", + " def switch(ch):\n", + " return {1: integer,\n", + " 2: char,\n", + " 3: floating,\n", + " }[ch]()\n", + " switch(type)\n", + "display(1,2,5,6)\n", + "display(2,4,'A','a','b','c')\n", + "display(3,3,2.5,299.3,-1.0)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n", + "6\n", + "A\n", + "a\n", + "b\n", + "c\n", + "2.500000\n", + "299.300000\n", + "-1.000000\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 15.12 PAGE:488" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "from ctypes import *\n", + "class a(Union): #definition of union\n", + " _fields_= [(\"i\", c_short),\n", + " (\"ch\",c_byte*2)]\n", + "key=a()\n", + "key.i=512\n", + "print key.i\n", + "print key.ch[0]\n", + "print key.ch[1]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "512\n", + "0\n", + "2\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 15.13 PAGE:491" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "from ctypes import *\n", + "class a(Union):\n", + " _fields_= [(\"i\", c_short),\n", + " (\"ch\",c_byte*2)]\n", + "key=a()\n", + "key.i=512\n", + "print key.i\n", + "print key.ch[0]\n", + "print key.ch[1]\n", + "key.ch[0]=50\n", + "print key.i\n", + "print key.ch[0]\n", + "print key.ch[1]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "512\n", + "0\n", + "2\n", + "562\n", + "50\n", + "2\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 15.14 PAGE:492-493" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "from ctypes import *\n", + "class a(Structure):\n", + " _fields_ = [(\"i\", c_short),\n", + " (\"c\", c_byte*2)]\n", + "\n", + "class b(Structure):\n", + " _fields_ = [(\"j\", c_short),\n", + " (\"d\", c_byte*2)]\n", + "\n", + "class z(Union):\n", + " _fields_ = [(\"key\", a),\n", + " (\"data\", b)]\n", + "strange = z()\n", + "strange.key.i=512\n", + "strange.data.d[0]=0\n", + "strange.data.d[1]=32\n", + "print strange.key.i\n", + "print strange.data.j\n", + "print strange.key.c[0]\n", + "print strange.data.d[0]\n", + "print strange.key.c[1]\n", + "print strange.data.d[1]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "512\n", + "512\n", + "0\n", + "0\n", + "32\n", + "32\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 15.15 PAGE:494-495" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "from ctypes import *\n", + "class info1(Structure):\n", + " _fields_ = [(\"hobby\", c_byte*10),\n", + " (\"crcardno\", c_short)]\n", + "\n", + "class info2(Structure):\n", + " _fields_ = [(\"vehno\", c_byte*10),\n", + " (\"dist\", c_short)]\n", + "\n", + "class info(Union):\n", + " _fields_ = [(\"a\", info1),\n", + " (\"b\", info2)]\n", + "class emp(Structure):\n", + " _fields_ = [(\"n\", c_byte*20),\n", + " (\"grade\", c_byte*4),\n", + " (\"age\", c_short),\n", + " (\"f\", info)]\n", + "e=emp()" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 3 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/ANSI_C_Programming/.ipynb_checkpoints/chapter2-checkpoint.ipynb b/ANSI_C_Programming/.ipynb_checkpoints/chapter2-checkpoint.ipynb new file mode 100644 index 00000000..913a7520 --- /dev/null +++ b/ANSI_C_Programming/.ipynb_checkpoints/chapter2-checkpoint.ipynb @@ -0,0 +1,783 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:122349dba3c4e4d1f40022d5db7dbad14438b7bc81516fa77f11e6bbedd976dc" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "CHAPTER 2: THE DECISION CONTROL STRUCTURE" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 2.0 PAGE-45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "print \"Enter a number less than 10\"\n", + "num=eval(raw_input()) #Inputs float variables #you can also input float variables using input()\n", + "if num<10:\n", + " print \"What an obedient servant you are !\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number less than 10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "What an obedient servant you are !\n", + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.1: Page-47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "print \"Enter quantity and rate\"\n", + "qty=eval(raw_input()) #Inputs float variables\n", + "rate=eval(raw_input())\n", + "dis=0\n", + "if qty>1000:\n", + " dis=10\n", + "tot=(qty*rate)-(qty*rate*dis/100)\n", + "print \"Total expenses=Rs.\" ,tot" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter quantity and rate\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1200\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "15.50\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total expenses=Rs. 16740.0\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.2: Page-49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "print \"Enter current year and year of joining\"\n", + "cy=eval(raw_input())\n", + "yoj=eval(raw_input())\n", + "yos=cy-yoj\n", + "if yos>3:\n", + " bonus=2500\n", + " print \"Bonus=Rs.\" ,bonus" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter current year and year of joining\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2014\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2009\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Bonus=Rs. 2500\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.3: Page-51" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "print \"Enter basic salary\"\n", + "bs=eval(raw_input())\n", + "if bs<1500:\n", + " hra=bs*10/100\n", + " da=bs*90/100\n", + "else:\n", + " hra=500\n", + " da=bs*98/100\n", + "gs=bs+hra+da\n", + "print \"gross salary=Rs.\" ,gs" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter basic salary\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1000\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "gross salary=Rs. 2000\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE ON Page-53" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "print \"Enter either 1 or 2\"\n", + "i=eval(raw_input())\n", + "if i==1:\n", + " print \"You would go to heaven !\\n\"\n", + "else:\n", + " if i==2:\n", + " print \"Hell was created with you in mind\\n\"\n", + " else:\n", + " print \"How about mother earth !\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter either 1 or 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "How about mother earth !\n", + "\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.4: Page-55-56" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "print \"Enter marks in five subjects\"\n", + "m1=eval(raw_input())\n", + "m2=eval(raw_input())\n", + "m3=eval(raw_input())\n", + "m4=eval(raw_input())\n", + "m5=eval(raw_input())\n", + "per=(m1+m2+m3+m4+m5)*100/500\n", + "if per>=60:\n", + " print \"First division\\n\"\n", + "else:\n", + " if per>=50:\n", + " print \"Second division\\n\"\n", + " else:\n", + " if per>=40:\n", + " print \"Third division\\n\"\n", + " else:\n", + " print \"Fail\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks in five subjects\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "70\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "87\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "91\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "91\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "98\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "First division\n", + "\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 2.5 Page-56-57" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "print \"Enter marks in five subjects\"\n", + "m1=eval(raw_input())\n", + "m2=eval(raw_input())\n", + "m3=eval(raw_input())\n", + "m4=eval(raw_input())\n", + "m5=eval(raw_input())\n", + "per=(m1+m2+m3+m4+m5)*100/500\n", + "if per>=60:\n", + " print \"First division\\n\"\n", + "if per>=50 and per<60:\n", + " print \"Second division\\n\"\n", + "if per>=40 and per<50:\n", + " print \"Third division\\n\"\n", + "if per<40:\n", + " print \"Fail\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks in five subjects\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "70\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "87\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "91\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "91\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "98\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "First division\n", + "\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 2.6 Page-58" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "print \"Enter marks in five subjects\"\n", + "m1=eval(raw_input())\n", + "m2=eval(raw_input())\n", + "m3=eval(raw_input())\n", + "m4=eval(raw_input())\n", + "m5=eval(raw_input())\n", + "per=(m1+m2+m3+m4+m5)*100/500\n", + "if per>=60:\n", + " print \"First division\\n\"\n", + "elif per>=50:\n", + " print \"Second division\\n\"\n", + "elif per>=40:\n", + " print \"Third division\\n\"\n", + "else:\n", + " print \"fail\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks in five subjects\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "70\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "87\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "91\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "91\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "98\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "First division\n", + "\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.5: Page-59" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "print \"Enter age,sex,marital status\"\n", + "age=eval(raw_input())\n", + "sex=raw_input() #Inputs string variables i,e; we can't use these variables in calculations\n", + "ms=raw_input() #Inputs string variables\n", + "if ms=='M':\n", + " print \"Driver is insured\\n\"\n", + "else:\n", + " if sex=='M':\n", + " if age>30:\n", + " print \"Driver is insured\\n\"\n", + " else:\n", + " print \"Driver is not insured\\n\"\n", + " else:\n", + " if age>25:\n", + " print \"Driver is insured\\n\"\n", + " else:\n", + " print \"Driver is not insured\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter age,sex,marital status\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "20\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "M\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "U\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Driver is not insured\n", + "\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 2.6 Page-60" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "print \"Enter age,sex,marital status\"\n", + "age=eval(raw_input())\n", + "sex=raw_input()\n", + "ms=raw_input()\n", + "if (ms=='M') or (ms=='U' and sex=='M' and age>30) or (ms=='U' and sex=='F' and age>25):\n", + " print \"Driver is insured\\n\"\n", + "else:\n", + " print \"Driver is not insured\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter age,sex,marital status\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "20\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "M\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "U\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Driver is not insured\n", + "\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.6: Page-61-62" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "print \"Enter Gender,Years of Service and Qualifications(0=G,1=PG):\"\n", + "g=raw_input()\n", + "yos=eval(raw_input())\n", + "qual=eval(raw_input())\n", + "sal=0\n", + "if g=='m' and yos>=10 and qual==1:\n", + " sal=15000\n", + "elif (g=='m' and yos>=10 and qual==0) or (g=='m' and yos<10 and qual==1):\n", + " sal=10000\n", + "elif g=='m' and yos<10 and qual==0:\n", + " sal=7000\n", + "elif g=='f' and yos>=10 and qual==1:\n", + " sal=12000\n", + "elif g=='f' and yos>=10 and qual==0:\n", + " sal=9000\n", + "elif g=='f' and yos<10 and qual==1:\n", + " sal=10000\n", + "elif g=='f' and yos<10 and qual==0:\n", + " sal=6000\n", + "print \"\\nSalary of Employee=\" ,sal" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Gender,Years of Service and Qualifications(0=G,1=PG):\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "m\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Salary of Employee= 7000\n" + ] + } + ], + "prompt_number": 12 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/ANSI_C_Programming/.ipynb_checkpoints/chapter3-checkpoint.ipynb b/ANSI_C_Programming/.ipynb_checkpoints/chapter3-checkpoint.ipynb new file mode 100644 index 00000000..0657e098 --- /dev/null +++ b/ANSI_C_Programming/.ipynb_checkpoints/chapter3-checkpoint.ipynb @@ -0,0 +1,1590 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:5aef1ded8130a6ad407a81d778d6eadb1b5a8dbfd342253951b9a20be5765398" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "CHAPTER 3: THE LOOP CONTROL STRUCTURE" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 3.1 PAGE:89-90" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "count=1\n", + "while count<=3: #while loop codition check\n", + " print \"Enter values of p,n and r\"\n", + " p=eval(raw_input())\n", + " n=eval(raw_input())\n", + " r=eval(raw_input())\n", + " si=p*n*r/100\n", + " print \"Simple interest=Rs.%f\" % (si)\n", + " count=count+1 #increment" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter values of p,n and r\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1000\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "13.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Simple interest=Rs.675.000000\n", + "Enter values of p,n and r\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2000\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "13.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Simple interest=Rs.1350.000000\n", + "Enter values of p,n and r\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3500\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Simple interest=Rs.612.500000\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 3.2 PAGE:92" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "i=1\n", + "while i<=10:\n", + " print \"%d\\n\" % (i) #there is no increment/decrement thats why indefinite loop" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 3.3 PAGE:93" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "i=1\n", + "while i<=10:\n", + " print \"\\n\" ,i\n", + " i=i+1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "1\n", + "\n", + "2\n", + "\n", + "3\n", + "\n", + "4\n", + "\n", + "5\n", + "\n", + "6\n", + "\n", + "7\n", + "\n", + "8\n", + "\n", + "9\n", + "\n", + "10\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 3.4 PAGE:93" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "i=5\n", + "while i>=1:\n", + " print \"Make the computer literate!\\n\"\n", + " i=i-1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Make the computer literate!\n", + "\n", + "Make the computer literate!\n", + "\n", + "Make the computer literate!\n", + "\n", + "Make the computer literate!\n", + "\n", + "Make the computer literate!\n", + "\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 3.5 PAGE:93" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "a=10.0\n", + "while a<=10.5:\n", + " print \"Raindrops on roses...\"\n", + " print \"...and whiskers on kittens\\n\"\n", + " a=a+0.1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Raindrops on roses...\n", + "...and whiskers on kittens\n", + "\n", + "Raindrops on roses...\n", + "...and whiskers on kittens\n", + "\n", + "Raindrops on roses...\n", + "...and whiskers on kittens\n", + "\n", + "Raindrops on roses...\n", + "...and whiskers on kittens\n", + "\n", + "Raindrops on roses...\n", + "...and whiskers on kittens\n", + "\n", + "Raindrops on roses...\n", + "...and whiskers on kittens\n", + "\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 3.6 PAGE:94" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "i=1\n", + "while i<=32767: #print numbers from 1 to 32767\n", + " print \"%d\\n\" ,i \n", + " i=i+1" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 3.7 PAGE:95" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "i=1 \n", + "while i<=10:\n", + " print i\n", + " i=i+1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n", + "2\n", + "3\n", + "4\n", + "5\n", + "6\n", + "7\n", + "8\n", + "9\n", + "10\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 3.8 PAGE:96" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "i=1\n", + "while i<=10:\n", + " print \"\\n\" ,i\n", + " i+=1 #increment short hand operator" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "1\n", + "\n", + "2\n", + "\n", + "3\n", + "\n", + "4\n", + "\n", + "5\n", + "\n", + "6\n", + "\n", + "7\n", + "\n", + "8\n", + "\n", + "9\n", + "\n", + "10\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 3.9 PAGE:98" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "for count in range(1,4,1): #for loop\n", + " print \"Enter values of p,n and r\"\n", + " p=eval(raw_input())\n", + " n=eval(raw_input())\n", + " r=eval(raw_input())\n", + " si=p*n*r/100\n", + " print \"Simple Interest=Rs.%f\" % (si)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter values of p,n and r\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1000\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "13.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Simple Interest=Rs.675.000000\n", + "Enter values of p,n and r\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2000\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "13.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Simple Interest=Rs.1350.000000\n", + "Enter values of p,n and r\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3500\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Simple Interest=Rs.612.500000\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 3.10 PAGE:101" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "for i in range(1,11,1):\n", + " print \"%d\\n\" % (i)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n", + "\n", + "2\n", + "\n", + "3\n", + "\n", + "4\n", + "\n", + "5\n", + "\n", + "6\n", + "\n", + "7\n", + "\n", + "8\n", + "\n", + "9\n", + "\n", + "10\n", + "\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 3.11 PAGE:101" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "for i in range(1,11):\n", + " print \"\\n\" ,i\n", + " i=i+1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "1\n", + "\n", + "2\n", + "\n", + "3\n", + "\n", + "4\n", + "\n", + "5\n", + "\n", + "6\n", + "\n", + "7\n", + "\n", + "8\n", + "\n", + "9\n", + "\n", + "10\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 3.12 PAGE:101" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "i=1\n", + "for i in range(i,11,1):\n", + " print \"%d\\n\" % (i)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n", + "\n", + "2\n", + "\n", + "3\n", + "\n", + "4\n", + "\n", + "5\n", + "\n", + "6\n", + "\n", + "7\n", + "\n", + "8\n", + "\n", + "9\n", + "\n", + "10\n", + "\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 3.13 PAGE:102" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "i=1\n", + "for i in range(i,11):\n", + " print \"%d\\n\" % (i)\n", + " i=i+1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n", + "\n", + "2\n", + "\n", + "3\n", + "\n", + "4\n", + "\n", + "5\n", + "\n", + "6\n", + "\n", + "7\n", + "\n", + "8\n", + "\n", + "9\n", + "\n", + "10\n", + "\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 3.14 PAGE:103" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "for r in range(1,4,1): #outer loop\n", + " for c in range(1,3,1): #inner loop \n", + " sum=r+c\n", + " print \"r=%d c=%d sum=%d\\n\" % (r,c,sum)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "r=1 c=1 sum=2\n", + "\n", + "r=1 c=2 sum=3\n", + "\n", + "r=2 c=1 sum=3\n", + "\n", + "r=2 c=2 sum=4\n", + "\n", + "r=3 c=1 sum=4\n", + "\n", + "r=3 c=2 sum=5\n", + "\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 3.15 PAGE:104-105" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "while(1): #do-while loop is not present in python\n", + " print \"Enter a number\"\n", + " num=eval(raw_input())\n", + " print \"square of %d is %d\\n\" % (num,num*num)\n", + " print \"Want to enter another number y/n\"\n", + " another=raw_input()\n", + " if(another!='y'):\n", + " break" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "square of 5 is 25\n", + "\n", + "Want to enter another number y/n\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "square of 7 is 49\n", + "\n", + "Want to enter another number y/n\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "n\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 3.16 PAGE:105" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "another='y'\n", + "for i in range(1,1000): #check if another is in word\n", + " if another=='y':\n", + " print \"Enter a number\"\n", + " num=eval(raw_input())\n", + " print \"square of %d is %d\\n\" % (num,num*num)\n", + " print \"Want to enter another number y/n\"\n", + " another=raw_input()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "square of 5 is 25\n", + "\n", + "Want to enter another number y/n\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "square of 7 is 49\n", + "\n", + "Want to enter another number y/n\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "n\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 3.17 PAGE:105-106" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "another='y'\n", + "while(another=='y'):\n", + " print \"Enter a number\"\n", + " num=eval(raw_input())\n", + " print \"square of %d is %d\\n\" % (num,num*num)\n", + " print \"Want to enter another number y/n\"\n", + " another=raw_input()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "square of 5 is 25\n", + "\n", + "Want to enter another number y/n\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "square of 7 is 49\n", + "\n", + "Want to enter another number y/n\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "n\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 3.18 PAGE:106" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "print \"Enter a number\"\n", + "num=eval(raw_input())\n", + "i=2\n", + "while i<=num-1:\n", + " if num%i==0:\n", + " print \"Not a prime number\\n\"\n", + " break #exit the loop\n", + " i+=1\n", + "if i==num:\n", + " print \"Prime number\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "11\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Prime number\n", + "\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 3.19 PAGE:107" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "i=1\n", + "j=1\n", + "while (i<=100):\n", + " i+=1\n", + " while (j<=200):\n", + " j+=1\n", + " if (j==150):\n", + " break #it will terminate the inner loop only\n", + " else:\n", + " print \"%d %d\\n\" % (i,j)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "2 2\n", + "\n", + "2 3\n", + "\n", + "2 4\n", + "\n", + "2 5\n", + "\n", + "2 6\n", + "\n", + "2 7\n", + "\n", + "2 8\n", + "\n", + "2 9\n", + "\n", + "2 10\n", + "\n", + "2 11\n", + "\n", + "2 12\n", + "\n", + "2 13\n", + "\n", + "2 14\n", + "\n", + "2 15\n", + "\n", + "2 16\n", + "\n", + "2 17\n", + "\n", + "2 18\n", + "\n", + "2 19\n", + "\n", + "2 20\n", + "\n", + "2 21\n", + "\n", + "2 22\n", + "\n", + "2 23\n", + "\n", + "2 24\n", + "\n", + "2 25\n", + "\n", + "2 26\n", + "\n", + "2 27\n", + "\n", + "2 28\n", + "\n", + "2 29\n", + "\n", + "2 30\n", + "\n", + "2 31\n", + "\n", + "2 32\n", + "\n", + "2 33\n", + "\n", + "2 34\n", + "\n", + "2 35\n", + "\n", + "2 36\n", + "\n", + "2 37\n", + "\n", + "2 38\n", + "\n", + "2 39\n", + "\n", + "2 40\n", + "\n", + "2 41\n", + "\n", + "2 42\n", + "\n", + "2 43\n", + "\n", + "2 44\n", + "\n", + "2 45\n", + "\n", + "2 46\n", + "\n", + "2 47\n", + "\n", + "2 48\n", + "\n", + "2 49\n", + "\n", + "2 50\n", + "\n", + "2 51\n", + "\n", + "2 52\n", + "\n", + "2 53\n", + "\n", + "2 54\n", + "\n", + "2 55\n", + "\n", + "2 56\n", + "\n", + "2 57\n", + "\n", + "2 58\n", + "\n", + "2 59\n", + "\n", + "2 60\n", + "\n", + "2 61\n", + "\n", + "2 62\n", + "\n", + "2 63\n", + "\n", + "2 64\n", + "\n", + "2 65\n", + "\n", + "2 66\n", + "\n", + "2 67\n", + "\n", + "2 68\n", + "\n", + "2 69\n", + "\n", + "2 70\n", + "\n", + "2 71\n", + "\n", + "2 72\n", + "\n", + "2 73\n", + "\n", + "2 74\n", + "\n", + "2 75\n", + "\n", + "2 76\n", + "\n", + "2 77\n", + "\n", + "2 78\n", + "\n", + "2 79\n", + "\n", + "2 80\n", + "\n", + "2 81\n", + "\n", + "2 82\n", + "\n", + "2 83\n", + "\n", + "2 84\n", + "\n", + "2 85\n", + "\n", + "2 86\n", + "\n", + "2 87\n", + "\n", + "2 88\n", + "\n", + "2 89\n", + "\n", + "2 90\n", + "\n", + "2 91\n", + "\n", + "2 92\n", + "\n", + "2 93\n", + "\n", + "2 94\n", + "\n", + "2 95\n", + "\n", + "2 96\n", + "\n", + "2 97\n", + "\n", + "2 98\n", + "\n", + "2 99\n", + "\n", + "2 100\n", + "\n", + "2 101\n", + "\n", + "2 102\n", + "\n", + "2 103\n", + "\n", + "2 104\n", + "\n", + "2 105\n", + "\n", + "2 106\n", + "\n", + "2 107\n", + "\n", + "2 108\n", + "\n", + "2 109\n", + "\n", + "2 110\n", + "\n", + "2 111\n", + "\n", + "2 112\n", + "\n", + "2 113\n", + "\n", + "2 114\n", + "\n", + "2 115\n", + "\n", + "2 116\n", + "\n", + "2 117\n", + "\n", + "2 118\n", + "\n", + "2 119\n", + "\n", + "2 120\n", + "\n", + "2 121\n", + "\n", + "2 122\n", + "\n", + "2 123\n", + "\n", + "2 124\n", + "\n", + "2 125\n", + "\n", + "2 126\n", + "\n", + "2 127\n", + "\n", + "2 128\n", + "\n", + "2 129\n", + "\n", + "2 130\n", + "\n", + "2 131\n", + "\n", + "2 132\n", + "\n", + "2 133\n", + "\n", + "2 134\n", + "\n", + "2 135\n", + "\n", + "2 136\n", + "\n", + "2 137\n", + "\n", + "2 138\n", + "\n", + "2 139\n", + "\n", + "2 140\n", + "\n", + "2 141\n", + "\n", + "2 142\n", + "\n", + "2 143\n", + "\n", + "2 144\n", + "\n", + "2 145\n", + "\n", + "2 146\n", + "\n", + "2 147\n", + "\n", + "2 148\n", + "\n", + "2 149\n", + "\n", + "3 151\n", + "\n", + "3 152\n", + "\n", + "3 153\n", + "\n", + "3 154\n", + "\n", + "3 155\n", + "\n", + "3 156\n", + "\n", + "3 157\n", + "\n", + "3 158\n", + "\n", + "3 159\n", + "\n", + "3 160\n", + "\n", + "3 161\n", + "\n", + "3 162\n", + "\n", + "3 163\n", + "\n", + "3 164\n", + "\n", + "3 165\n", + "\n", + "3 166\n", + "\n", + "3 167\n", + "\n", + "3 168\n", + "\n", + "3 169\n", + "\n", + "3 170\n", + "\n", + "3 171\n", + "\n", + "3 172\n", + "\n", + "3 173\n", + "\n", + "3 174\n", + "\n", + "3 175\n", + "\n", + "3 176\n", + "\n", + "3 177\n", + "\n", + "3 178\n", + "\n", + "3 179\n", + "\n", + "3 180\n", + "\n", + "3 181\n", + "\n", + "3 182\n", + "\n", + "3 183\n", + "\n", + "3 184\n", + "\n", + "3 185\n", + "\n", + "3 186\n", + "\n", + "3 187\n", + "\n", + "3 188\n", + "\n", + "3 189\n", + "\n", + "3 190\n", + "\n", + "3 191\n", + "\n", + "3 192\n", + "\n", + "3 193\n", + "\n", + "3 194\n", + "\n", + "3 195\n", + "\n", + "3 196\n", + "\n", + "3 197\n", + "\n", + "3 198\n", + "\n", + "3 199\n", + "\n", + "3 200\n", + "\n", + "3 201\n", + "\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 3.20 PAGE:108" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "for i in range(1,3,1):\n", + " for j in range(1,3,1):\n", + " if i==j:\n", + " continue #it will again send back to loop without executing succeeding statements\n", + " print \"%d %d\\n\" % (i,j)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 2\n", + "\n", + "2 1\n", + "\n" + ] + } + ], + "prompt_number": 17 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/ANSI_C_Programming/.ipynb_checkpoints/chapter4-checkpoint.ipynb b/ANSI_C_Programming/.ipynb_checkpoints/chapter4-checkpoint.ipynb new file mode 100644 index 00000000..dbc56c16 --- /dev/null +++ b/ANSI_C_Programming/.ipynb_checkpoints/chapter4-checkpoint.ipynb @@ -0,0 +1,390 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:96a5edc06252e6c7317233539cfc32b4bdad4f858379c6746a8df58eb15aba24" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "CHAPTER 4: THE CASE CONTROL STRUCTURE" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 4.1 PAGE:126" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "i=2\n", + "def switch(i):\n", + " return {True: 'I am in default\\n', #default case\n", + " i==1: 'I am in case1\\n',\n", + " i==2: 'I am in case2\\n',\n", + " i==3: 'I am in case3\\n',\n", + " }[True]\n", + "print switch(i)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "I am in case2\n", + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 4.2 PAGE:128" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "i=22\n", + "def switch(i):\n", + " return{True: 'I am in default\\n',\n", + " i==121: 'I am in case 121\\n',\n", + " i==7: 'I am in case 7\\n',\n", + " i==22: 'I am in case 22\\n',\n", + " }[True]\n", + "print switch(i)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "I am in case 22\n", + "\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 4.3 PAGE:128-129" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "c='x'\n", + "def switch(c):\n", + " return {True: 'I am in default\\n',\n", + " c=='v': 'I am in case v\\n',\n", + " c=='a': 'I am in case a\\n',\n", + " c=='x': 'I am in case x\\n',\n", + " }[True]\n", + "print switch(c)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "I am in case x\n", + "\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 4.4 PAGE:129-130" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "print \"Enter any one of the alphabets a,b,or c\"\n", + "ch=raw_input()\n", + "def casea():\n", + " print \"\"\n", + "def caseb():\n", + " print \"\"\n", + "def casec():\n", + " print \"\"\n", + "def switch(ch):\n", + " return {True: 'wish you knew what are alphabets\\n',\n", + " ch=='a' or ch=='A': 'a as in ashar\\n',\n", + " ch=='b' or ch=='B': 'b as in brain\\n',\n", + " ch=='c' or ch=='C': 'c as in cookie\\n',\n", + " }[True]\n", + "print switch(ch)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter any one of the alphabets a,b,or c\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "B\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "b as in brain\n", + "\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 4.5 PAGE:130" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "print \"Enter value of i\"\n", + "i=eval(raw_input())\n", + "def switch(i):\n", + " print \"Hello\\n\" #It's python,not C :)\n", + " try:\n", + " return {1: a,\n", + " 2: b,\n", + " }[i]()\n", + " except:\n", + " print \"wrong choice\" #print message in default case\n", + "def a():\n", + " j=10\n", + " print j #print j as 10 if i=1\n", + "def b():\n", + " j=20 \n", + " print j #print j as 20 if i=2\n", + "switch(i)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter value of i\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello\n", + "\n", + "10\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 4.6 PAGE:133" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import sys\n", + "print \"Enter the number of goals scored against india\"\n", + "goals=eval(raw_input())\n", + "if goals<=5:\n", + " print \"To err is human!\\n\"\n", + "else:\n", + " print \"About time soccer players learnt C\\n\"\n", + " print \"and said goodbye! adieu! to soccer\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the number of goals scored against india\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "About time soccer players learnt C\n", + "\n", + "and said goodbye! adieu! to soccer\n", + "\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 4.7 PAGE:134-135" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "for i in range(1,4,1):\n", + " for j in range(1,4,1):\n", + " for k in range(1,4,1):\n", + " if (i==3 and j==3 and k==3):\n", + " print \"Out of the loop at last!\\n\"\n", + " else:\n", + " print \"%d %d %d\\n\" % (i,j,k)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 1 1\n", + "\n", + "1 1 2\n", + "\n", + "1 1 3\n", + "\n", + "1 2 1\n", + "\n", + "1 2 2\n", + "\n", + "1 2 3\n", + "\n", + "1 3 1\n", + "\n", + "1 3 2\n", + "\n", + "1 3 3\n", + "\n", + "2 1 1\n", + "\n", + "2 1 2\n", + "\n", + "2 1 3\n", + "\n", + "2 2 1\n", + "\n", + "2 2 2\n", + "\n", + "2 2 3\n", + "\n", + "2 3 1\n", + "\n", + "2 3 2\n", + "\n", + "2 3 3\n", + "\n", + "3 1 1\n", + "\n", + "3 1 2\n", + "\n", + "3 1 3\n", + "\n", + "3 2 1\n", + "\n", + "3 2 2\n", + "\n", + "3 2 3\n", + "\n", + "3 3 1\n", + "\n", + "3 3 2\n", + "\n", + "Out of the loop at last!\n", + "\n" + ] + } + ], + "prompt_number": 12 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/ANSI_C_Programming/.ipynb_checkpoints/chapter5-checkpoint.ipynb b/ANSI_C_Programming/.ipynb_checkpoints/chapter5-checkpoint.ipynb new file mode 100644 index 00000000..ec1588c4 --- /dev/null +++ b/ANSI_C_Programming/.ipynb_checkpoints/chapter5-checkpoint.ipynb @@ -0,0 +1,970 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:e17bf1d87d84651890e121c02b22aaef4cdd46cbf0defb5af6add7476223ce00" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "CHAPTER 5: FUNCTIONS AND POINTERS" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 5.1 PAGE:144" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def message(): #function definition\n", + " print \"Smile,and the world smiles with you...\\n\"\n", + "message() #function call\n", + "print \"Cry, and you stop the monotony!\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Smile,and the world smiles with you...\n", + "\n", + "Cry, and you stop the monotony!\n", + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 5.2 PAGE:146" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def italy():\n", + " print \"I am in italy\\n\"\n", + "def brazil():\n", + " print \"I am in brazil\\n\"\n", + "def argentina():\n", + " print \"I am in argentina\\n\"\n", + "print \"I am in main\\n\"\n", + "italy(); #italy() will be called\n", + "brazil(); #brazil() will be called\n", + "argentina(); #argentina() will be called" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "I am in main\n", + "\n", + "I am in italy\n", + "\n", + "I am in brazil\n", + "\n", + "I am in argentina\n", + "\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 5.3 PAGE:147" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def italy():\n", + " print \"I am in italy\\n\"\n", + " brazil(); #it will call brazil()\n", + " print \"I am back in italy\\n\"\n", + "def brazil():\n", + " print \"I am in brazil\\n\"\n", + " argentina(); #it will call argentina()\n", + "def argentina():\n", + " print \"I am in argentina\\n\"\n", + "print \"I am in main\\n\"\n", + "italy(); #italy() is called\n", + "print \"I am finally back in main\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "I am in main\n", + "\n", + "I am in italy\n", + "\n", + "I am in brazil\n", + "\n", + "I am in argentina\n", + "\n", + "I am back in italy\n", + "\n", + "I am finally back in main\n", + "\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 5.4 PAGE:148" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def message():\n", + " print \"Can't imagine life without C\\n\"\n", + " main() #it will call back main()\n", + "def main():\n", + " message()\n", + "main()" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 5.5 PAGE:149" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def message():\n", + " print \"Jewel Thief!!\\n\"\n", + "message() #1st call\n", + "message() #2nd call" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Jewel Thief!!\n", + "\n", + "Jewel Thief!!\n", + "\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 5.6 PAGE:149" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def message2():\n", + " print \"But the butter was bitter\\n\"\n", + "def message1():\n", + " print \"Mary bought some butter\\n\"\n", + "message1()\n", + "message2()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mary bought some butter\n", + "\n", + "But the butter was bitter\n", + "\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 5.7 PAGE:151-152" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def calsum(x,y,z): #parameterized function\n", + " d=x+y+z\n", + " return d\n", + "print \"Enter any three numbers\"\n", + "a=eval(raw_input())\n", + "b=eval(raw_input())\n", + "c=eval(raw_input())\n", + "sum=calsum(a,b,c) #passing values as arguments\n", + "print \"Sum=%d\\n\" % (sum)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter any three numbers\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "20\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "30\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sum=60\n", + "\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 5.8 PAGE:153" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def fun():\n", + " print \"Enter any number\"\n", + " n=eval(raw_input())\n", + " if (n>=10 and n<=90):\n", + " return n\n", + " else:\n", + " return n+32\n", + "fun()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter any number\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "100\n" + ] + }, + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 7, + "text": [ + "132" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 5.9 PAGE:154" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def fun(b):\n", + " b=60\n", + " print \"%d\\n\" % (b) #prints 60\n", + "a=30\n", + "fun(a) #prints 30\n", + "print \"%d\\n\" % (a)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "60\n", + "\n", + "30\n", + "\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 5.10 PAGE:155" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def display(j):\n", + " k=35\n", + " print \"%d\\n\" % (j) #we can't print i directly here because scope of variable is local by default\n", + " print \"%d\\n\" % (k)\n", + "i=20\n", + "display(i)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "20\n", + "\n", + "35\n", + "\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 5.11 PAGE:158-159" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def square(x):\n", + " y=x*x\n", + " return y\n", + "print \"Enter any number\"\n", + "a=eval(raw_input())\n", + "b=square(a)\n", + "print \"Square of %f is %f\\n\" % (a,b)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter any number\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Square of 2.500000 is 6.250000\n", + "\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 5.12 PAGE:161" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "i=3\n", + "print \"Address of i=%u\\n\" % (id(i)) #id() will return the loaction of a variable\n", + "print \"Value of i=%d\\n\" % (i)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Address of i=20688560\n", + "\n", + "Value of i=3\n", + "\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 5.13 PAGE:161" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "i=3\n", + "print \"Address of i=%u\\n\" % (id(i))\n", + "print \"Value of i=%d\\n\" % (i)\n", + "print \"Value of i=%d\\n\" % (i)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Address of i=20688560\n", + "\n", + "Value of i=3\n", + "\n", + "Value of i=3\n", + "\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 5.14 PAGE:162" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "i=3\n", + "j=id(i)\n", + "print \"Address of i=%u\\n\" % (id(i)) #print address of i\n", + "print \"Address of i=%u\\n\" % (j) #print address of i\n", + "print \"Address of j=%u\\n\" % (id(j)) #print address of j\n", + "print \"Value of j=%u\\n\" % (j) #print value of j\n", + "print \"Value of i=%d\\n\" % (i)\n", + "print \"Value of i=%d\\n\" % (i)\n", + "print \"Value of i=%d\\n\" % (i)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Address of i=20688560\n", + "\n", + "Address of i=20688560\n", + "\n", + "Address of j=88986780\n", + "\n", + "Value of j=20688560\n", + "\n", + "Value of i=3\n", + "\n", + "Value of i=3\n", + "\n", + "Value of i=3\n", + "\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 5.15 PAGE:164" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "i=3\n", + "j=id(i)\n", + "k=id(j)\n", + "print \"Address of i=%u\\n\" % (id(i)) #print address of i\n", + "print \"Address of i=%u\\n\" % (j) #print address of i\n", + "print \"Address of i=%u\\n\" % (j) #print address of i\n", + "print \"Address of j=%u\\n\" % (id(j)) #print address of i\n", + "print \"Address of j=%u\\n\" % (k) #print address of j\n", + "print \"Address of k=%u\\n\" % (id(k)) #print address of k\n", + "print \"Value of j=%u\\n\" % (j) #print value of j\n", + "print \"Value of k=%u\\n\" % (k) #print value of k\n", + "print \"Value of i=%u\\n\" % (i) #print value of i\n", + "print \"Value of i=%u\\n\" % (i)\n", + "print \"Value of i=%u\\n\" % (i)\n", + "print \"Value of i=%u\\n\" % (i)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Address of i=20688560\n", + "\n", + "Address of i=20688560\n", + "\n", + "Address of i=20688560\n", + "\n", + "Address of j=88986672\n", + "\n", + "Address of j=88986672\n", + "\n", + "Address of k=88986708\n", + "\n", + "Value of j=20688560\n", + "\n", + "Value of k=88986672\n", + "\n", + "Value of i=3\n", + "\n", + "Value of i=3\n", + "\n", + "Value of i=3\n", + "\n", + "Value of i=3\n", + "\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 5.16 PAGE:166" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def swapv(x,y):\n", + " x,y=y,x\n", + " print \"x=%d y=%d\\n\" % (x,y)\n", + "a=10\n", + "b=20\n", + "swapv(a,b)\n", + "print \"a=%d b=%d\\n\" % (a,b)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x=20 y=10\n", + "\n", + "a=10 b=20\n", + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 5.17 PAGE-167" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def swapr():\n", + " global a,b #global declaration\n", + " a,b=b,a\n", + "a=10\n", + "b=20\n", + "swapr()\n", + "print \"a=%d b=%d\\n\" % (a,b)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a=20 b=10\n", + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 5.18 PAGE:167-168" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def areaperi(r,a,p):\n", + " a=3.14*r*r #formula of area\n", + " p=2*3.14*r #formula of perimeter\n", + " print \"Area=%f\\n\" % (a)\n", + " print \"Perimeter=%f\\n\" % (p)\n", + "area=0\n", + "perimeter=0\n", + "print \"Enter radius of a circle\"\n", + "radius=eval(raw_input())\n", + "areaperi(radius,area,perimeter)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter radius of a circle\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Area=78.500000\n", + "\n", + "Perimeter=31.400000\n", + "\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 5.19 PAGE:169" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def factorial(x):\n", + " f=1\n", + " for i in range(x,1,-1):\n", + " f=f*i\n", + " return f\n", + "print \"Enter any number\"\n", + "a=eval(raw_input())\n", + "fact=factorial(a)\n", + "print \"Factorial value=%d\\n\" % (fact)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter any number\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Factorial value=6\n", + "\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 5.20 PAGE:170" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def rec(x):\n", + " if x==1:\n", + " return 1\n", + " else:\n", + " f=x*rec(x-1) \n", + " return f #will call back the rec() function\n", + "print \"Enter any number\"\n", + "a=eval(raw_input())\n", + "fact=rec(a)\n", + "print \"Factorial value=%d\\n\" % (fact)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter any number\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Factorial value=120\n", + "\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 5.21 PAGE:173" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def add(i,j):\n", + " sum=i+j\n", + " return sum\n", + "a=5\n", + "b=2\n", + "c=add(a,b) #Transfers control to add()\n", + "print \"sum=%d\\n\" % (c)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "sum=7\n", + "\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 5.22 PAGE:175-176" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def factorial(num):\n", + " f=1\n", + " for i in range(1,num+1,1):\n", + " f=f*i;\n", + " return f\n", + "f=factorial(5)\n", + "print \"%d\\n\" % f" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "120\n", + "\n" + ] + } + ], + "prompt_number": 3 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/ANSI_C_Programming/.ipynb_checkpoints/chapter6-checkpoint.ipynb b/ANSI_C_Programming/.ipynb_checkpoints/chapter6-checkpoint.ipynb new file mode 100644 index 00000000..bdeafb19 --- /dev/null +++ b/ANSI_C_Programming/.ipynb_checkpoints/chapter6-checkpoint.ipynb @@ -0,0 +1,1731 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:5d388a78001395c4ac0a5f81c0e570d2590a3825f4e8b86e7bf90249b99755a8" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "CHAPTER 6: DATA TYPES REVISITED" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 6.1 PAGE:199" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "ch=291\n", + "if ch>255:\n", + " ch=ch-256\n", + "print \"\\n%d %c\\n\" % (ch,ch)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "35 #\n", + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 6.2 PAGE:199" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "for ch in range(0,256,1):\n", + " print \"%d %c\\n\" % (ch,ch)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 \u0000\n", + "\n", + "1 \u0001\n", + "\n", + "2 \u0002\n", + "\n", + "3 \u0003\n", + "\n", + "4 \u0004\n", + "\n", + "5 \u0005\n", + "\n", + "6 \u0006\n", + "\n", + "7 \u0007\n", + "\n", + "8 \b\n", + "\n", + "9 \t\n", + "\n", + "10 \n", + "\n", + "\n", + "11 \u000b", + "\n", + "\n", + "12 \f", + "\n", + "\n", + "13 \r\n", + "\n", + "14 \u000e\n", + "\n", + "15 \u000f\n", + "\n", + "16 \u0010\n", + "\n", + "17 \u0011\n", + "\n", + "18 \u0012\n", + "\n", + "19 \u0013\n", + "\n", + "20 \u0014\n", + "\n", + "21 \u0015\n", + "\n", + "22 \u0016\n", + "\n", + "23 \u0017\n", + "\n", + "24 \u0018\n", + "\n", + "25 \u0019\n", + "\n", + "26 \u001a\n", + "\n", + "27 \u001b\n", + "\n", + "28 \u001c", + "\n", + "\n", + "29 \u001d", + "\n", + "\n", + "30 \u001e", + "\n", + "\n", + "31 \u001f\n", + "\n", + "32 \n", + "\n", + "33 !\n", + "\n", + "34 \"\n", + "\n", + "35 #\n", + "\n", + "36 $\n", + "\n", + "37 %\n", + "\n", + "38 &\n", + "\n", + "39 '\n", + "\n", + "40 (\n", + "\n", + "41 )\n", + "\n", + "42 *\n", + "\n", + "43 +\n", + "\n", + "44 ,\n", + "\n", + "45 -\n", + "\n", + "46 .\n", + "\n", + "47 /\n", + "\n", + "48 0\n", + "\n", + "49 1\n", + "\n", + "50 2\n", + "\n", + "51 3\n", + "\n", + "52 4\n", + "\n", + "53 5\n", + "\n", + "54 6\n", + "\n", + "55 7\n", + "\n", + "56 8\n", + "\n", + "57 9\n", + "\n", + "58 :\n", + "\n", + "59 ;\n", + "\n", + "60 <\n", + "\n", + "61 =\n", + "\n", + "62 >\n", + "\n", + "63 ?\n", + "\n", + "64 @\n", + "\n", + "65 A\n", + "\n", + "66 B\n", + "\n", + "67 C\n", + "\n", + "68 D\n", + "\n", + "69 E\n", + "\n", + "70 F\n", + "\n", + "71 G\n", + "\n", + "72 H\n", + "\n", + "73 I\n", + "\n", + "74 J\n", + "\n", + "75 K\n", + "\n", + "76 L\n", + "\n", + "77 M\n", + "\n", + "78 N\n", + "\n", + "79 O\n", + "\n", + "80 P\n", + "\n", + "81 Q\n", + "\n", + "82 R\n", + "\n", + "83 S\n", + "\n", + "84 T\n", + "\n", + "85 U\n", + "\n", + "86 V\n", + "\n", + "87 W\n", + "\n", + "88 X\n", + "\n", + "89 Y\n", + "\n", + "90 Z\n", + "\n", + "91 [\n", + "\n", + "92 \\\n", + "\n", + "93 ]\n", + "\n", + "94 ^\n", + "\n", + "95 _\n", + "\n", + "96 `\n", + "\n", + "97 a\n", + "\n", + "98 b\n", + "\n", + "99 c\n", + "\n", + "100 d\n", + "\n", + "101 e\n", + "\n", + "102 f\n", + "\n", + "103 g\n", + "\n", + "104 h\n", + "\n", + "105 i\n", + "\n", + "106 j\n", + "\n", + "107 k\n", + "\n", + "108 l\n", + "\n", + "109 m\n", + "\n", + "110 n\n", + "\n", + "111 o\n", + "\n", + "112 p\n", + "\n", + "113 q\n", + "\n", + "114 r\n", + "\n", + "115 s\n", + "\n", + "116 t\n", + "\n", + "117 u\n", + "\n", + "118 v\n", + "\n", + "119 w\n", + "\n", + "120 x\n", + "\n", + "121 y\n", + "\n", + "122 z\n", + "\n", + "123 {\n", + "\n", + "124 |\n", + "\n", + "125 }\n", + "\n", + "126 ~\n", + "\n", + "127 \u007f\n", + "\n", + "128 \ufffd\n", + "\n", + "129 \ufffd\n", + "\n", + "130 \ufffd\n", + "\n", + "131 \ufffd\n", + "\n", + "132 \ufffd\n", + "\n", + "133 \ufffd\n", + "\n", + "134 \ufffd\n", + "\n", + "135 \ufffd\n", + "\n", + "136 \ufffd\n", + "\n", + "137 \ufffd\n", + "\n", + "138 \ufffd\n", + "\n", + "139 \ufffd\n", + "\n", + "140 \ufffd\n", + "\n", + "141 \ufffd\n", + "\n", + "142 \ufffd\n", + "\n", + "143 \ufffd\n", + "\n", + "144 \ufffd\n", + "\n", + "145 \ufffd\n", + "\n", + "146 \ufffd\n", + "\n", + "147 \ufffd\n", + "\n", + "148 \ufffd\n", + "\n", + "149 \ufffd\n", + "\n", + "150 \ufffd\n", + "\n", + "151 \ufffd\n", + "\n", + "152 \ufffd\n", + "\n", + "153 \ufffd\n", + "\n", + "154 \ufffd\n", + "\n", + "155 \ufffd\n", + "\n", + "156 \ufffd\n", + "\n", + "157 \ufffd\n", + "\n", + "158 \ufffd\n", + "\n", + "159 \ufffd\n", + "\n", + "160 \ufffd\n", + "\n", + "161 \ufffd\n", + "\n", + "162 \ufffd\n", + "\n", + "163 \ufffd\n", + "\n", + "164 \ufffd\n", + "\n", + "165 \ufffd\n", + "\n", + "166 \ufffd\n", + "\n", + "167 \ufffd\n", + "\n", + "168 \ufffd\n", + "\n", + "169 \ufffd\n", + "\n", + "170 \ufffd\n", + "\n", + "171 \ufffd\n", + "\n", + "172 \ufffd\n", + "\n", + "173 \ufffd\n", + "\n", + "174 \ufffd\n", + "\n", + "175 \ufffd\n", + "\n", + "176 \ufffd\n", + "\n", + "177 \ufffd\n", + "\n", + "178 \ufffd\n", + "\n", + "179 \ufffd\n", + "\n", + "180 \ufffd\n", + "\n", + "181 \ufffd\n", + "\n", + "182 \ufffd\n", + "\n", + "183 \ufffd\n", + "\n", + "184 \ufffd\n", + "\n", + "185 \ufffd\n", + "\n", + "186 \ufffd\n", + "\n", + "187 \ufffd\n", + "\n", + "188 \ufffd\n", + "\n", + "189 \ufffd\n", + "\n", + "190 \ufffd\n", + "\n", + "191 \ufffd\n", + "\n", + "192 \ufffd\n", + "\n", + "193 \ufffd\n", + "\n", + "194 \ufffd\n", + "\n", + "195 \ufffd\n", + "\n", + "196 \ufffd\n", + "\n", + "197 \ufffd\n", + "\n", + "198 \ufffd\n", + "\n", + "199 \ufffd\n", + "\n", + "200 \ufffd\n", + "\n", + "201 \ufffd\n", + "\n", + "202 \ufffd\n", + "\n", + "203 \ufffd\n", + "\n", + "204 \ufffd\n", + "\n", + "205 \ufffd\n", + "\n", + "206 \ufffd\n", + "\n", + "207 \ufffd\n", + "\n", + "208 \ufffd\n", + "\n", + "209 \ufffd\n", + "\n", + "210 \ufffd\n", + "\n", + "211 \ufffd\n", + "\n", + "212 \ufffd\n", + "\n", + "213 \ufffd\n", + "\n", + "214 \ufffd\n", + "\n", + "215 \ufffd\n", + "\n", + "216 \ufffd\n", + "\n", + "217 \ufffd\n", + "\n", + "218 \ufffd\n", + "\n", + "219 \ufffd\n", + "\n", + "220 \ufffd\n", + "\n", + "221 \ufffd\n", + "\n", + "222 \ufffd\n", + "\n", + "223 \ufffd\n", + "\n", + "224 \ufffd\n", + "\n", + "225 \ufffd\n", + "\n", + "226 \ufffd\n", + "\n", + "227 \ufffd\n", + "\n", + "228 \ufffd\n", + "\n", + "229 \ufffd\n", + "\n", + "230 \ufffd\n", + "\n", + "231 \ufffd\n", + "\n", + "232 \ufffd\n", + "\n", + "233 \ufffd\n", + "\n", + "234 \ufffd\n", + "\n", + "235 \ufffd\n", + "\n", + "236 \ufffd\n", + "\n", + "237 \ufffd\n", + "\n", + "238 \ufffd\n", + "\n", + "239 \ufffd\n", + "\n", + "240 \ufffd\n", + "\n", + "241 \ufffd\n", + "\n", + "242 \ufffd\n", + "\n", + "243 \ufffd\n", + "\n", + "244 \ufffd\n", + "\n", + "245 \ufffd\n", + "\n", + "246 \ufffd\n", + "\n", + "247 \ufffd\n", + "\n", + "248 \ufffd\n", + "\n", + "249 \ufffd\n", + "\n", + "250 \ufffd\n", + "\n", + "251 \ufffd\n", + "\n", + "252 \ufffd\n", + "\n", + "253 \ufffd\n", + "\n", + "254 \ufffd\n", + "\n", + "255 \ufffd\n", + "\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE ON PAGE:200" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "for ch in range(0,255,1):\n", + " print \"%d %c\\n\" % (ch,ch)\n", + "print \"%d %c\\n\" % (ch,ch)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 \u0000\n", + "\n", + "1 \u0001\n", + "\n", + "2 \u0002\n", + "\n", + "3 \u0003\n", + "\n", + "4 \u0004\n", + "\n", + "5 \u0005\n", + "\n", + "6 \u0006\n", + "\n", + "7 \u0007\n", + "\n", + "8 \b\n", + "\n", + "9 \t\n", + "\n", + "10 \n", + "\n", + "\n", + "11 \u000b", + "\n", + "\n", + "12 \f", + "\n", + "\n", + "13 \r\n", + "\n", + "14 \u000e\n", + "\n", + "15 \u000f\n", + "\n", + "16 \u0010\n", + "\n", + "17 \u0011\n", + "\n", + "18 \u0012\n", + "\n", + "19 \u0013\n", + "\n", + "20 \u0014\n", + "\n", + "21 \u0015\n", + "\n", + "22 \u0016\n", + "\n", + "23 \u0017\n", + "\n", + "24 \u0018\n", + "\n", + "25 \u0019\n", + "\n", + "26 \u001a\n", + "\n", + "27 \u001b\n", + "\n", + "28 \u001c", + "\n", + "\n", + "29 \u001d", + "\n", + "\n", + "30 \u001e", + "\n", + "\n", + "31 \u001f\n", + "\n", + "32 \n", + "\n", + "33 !\n", + "\n", + "34 \"\n", + "\n", + "35 #\n", + "\n", + "36 $\n", + "\n", + "37 %\n", + "\n", + "38 &\n", + "\n", + "39 '\n", + "\n", + "40 (\n", + "\n", + "41 )\n", + "\n", + "42 *\n", + "\n", + "43 +\n", + "\n", + "44 ,\n", + "\n", + "45 -\n", + "\n", + "46 .\n", + "\n", + "47 /\n", + "\n", + "48 0\n", + "\n", + "49 1\n", + "\n", + "50 2\n", + "\n", + "51 3\n", + "\n", + "52 4\n", + "\n", + "53 5\n", + "\n", + "54 6\n", + "\n", + "55 7\n", + "\n", + "56 8\n", + "\n", + "57 9\n", + "\n", + "58 :\n", + "\n", + "59 ;\n", + "\n", + "60 <\n", + "\n", + "61 =\n", + "\n", + "62 >\n", + "\n", + "63 ?\n", + "\n", + "64 @\n", + "\n", + "65 A\n", + "\n", + "66 B\n", + "\n", + "67 C\n", + "\n", + "68 D\n", + "\n", + "69 E\n", + "\n", + "70 F\n", + "\n", + "71 G\n", + "\n", + "72 H\n", + "\n", + "73 I\n", + "\n", + "74 J\n", + "\n", + "75 K\n", + "\n", + "76 L\n", + "\n", + "77 M\n", + "\n", + "78 N\n", + "\n", + "79 O\n", + "\n", + "80 P\n", + "\n", + "81 Q\n", + "\n", + "82 R\n", + "\n", + "83 S\n", + "\n", + "84 T\n", + "\n", + "85 U\n", + "\n", + "86 V\n", + "\n", + "87 W\n", + "\n", + "88 X\n", + "\n", + "89 Y\n", + "\n", + "90 Z\n", + "\n", + "91 [\n", + "\n", + "92 \\\n", + "\n", + "93 ]\n", + "\n", + "94 ^\n", + "\n", + "95 _\n", + "\n", + "96 `\n", + "\n", + "97 a\n", + "\n", + "98 b\n", + "\n", + "99 c\n", + "\n", + "100 d\n", + "\n", + "101 e\n", + "\n", + "102 f\n", + "\n", + "103 g\n", + "\n", + "104 h\n", + "\n", + "105 i\n", + "\n", + "106 j\n", + "\n", + "107 k\n", + "\n", + "108 l\n", + "\n", + "109 m\n", + "\n", + "110 n\n", + "\n", + "111 o\n", + "\n", + "112 p\n", + "\n", + "113 q\n", + "\n", + "114 r\n", + "\n", + "115 s\n", + "\n", + "116 t\n", + "\n", + "117 u\n", + "\n", + "118 v\n", + "\n", + "119 w\n", + "\n", + "120 x\n", + "\n", + "121 y\n", + "\n", + "122 z\n", + "\n", + "123 {\n", + "\n", + "124 |\n", + "\n", + "125 }\n", + "\n", + "126 ~\n", + "\n", + "127 \u007f\n", + "\n", + "128 \ufffd\n", + "\n", + "129 \ufffd\n", + "\n", + "130 \ufffd\n", + "\n", + "131 \ufffd\n", + "\n", + "132 \ufffd\n", + "\n", + "133 \ufffd\n", + "\n", + "134 \ufffd\n", + "\n", + "135 \ufffd\n", + "\n", + "136 \ufffd\n", + "\n", + "137 \ufffd\n", + "\n", + "138 \ufffd\n", + "\n", + "139 \ufffd\n", + "\n", + "140 \ufffd\n", + "\n", + "141 \ufffd\n", + "\n", + "142 \ufffd\n", + "\n", + "143 \ufffd\n", + "\n", + "144 \ufffd\n", + "\n", + "145 \ufffd\n", + "\n", + "146 \ufffd\n", + "\n", + "147 \ufffd\n", + "\n", + "148 \ufffd\n", + "\n", + "149 \ufffd\n", + "\n", + "150 \ufffd\n", + "\n", + "151 \ufffd\n", + "\n", + "152 \ufffd\n", + "\n", + "153 \ufffd\n", + "\n", + "154 \ufffd\n", + "\n", + "155 \ufffd\n", + "\n", + "156 \ufffd\n", + "\n", + "157 \ufffd\n", + "\n", + "158 \ufffd\n", + "\n", + "159 \ufffd\n", + "\n", + "160 \ufffd\n", + "\n", + "161 \ufffd\n", + "\n", + "162 \ufffd\n", + "\n", + "163 \ufffd\n", + "\n", + "164 \ufffd\n", + "\n", + "165 \ufffd\n", + "\n", + "166 \ufffd\n", + "\n", + "167 \ufffd\n", + "\n", + "168 \ufffd\n", + "\n", + "169 \ufffd\n", + "\n", + "170 \ufffd\n", + "\n", + "171 \ufffd\n", + "\n", + "172 \ufffd\n", + "\n", + "173 \ufffd\n", + "\n", + "174 \ufffd\n", + "\n", + "175 \ufffd\n", + "\n", + "176 \ufffd\n", + "\n", + "177 \ufffd\n", + "\n", + "178 \ufffd\n", + "\n", + "179 \ufffd\n", + "\n", + "180 \ufffd\n", + "\n", + "181 \ufffd\n", + "\n", + "182 \ufffd\n", + "\n", + "183 \ufffd\n", + "\n", + "184 \ufffd\n", + "\n", + "185 \ufffd\n", + "\n", + "186 \ufffd\n", + "\n", + "187 \ufffd\n", + "\n", + "188 \ufffd\n", + "\n", + "189 \ufffd\n", + "\n", + "190 \ufffd\n", + "\n", + "191 \ufffd\n", + "\n", + "192 \ufffd\n", + "\n", + "193 \ufffd\n", + "\n", + "194 \ufffd\n", + "\n", + "195 \ufffd\n", + "\n", + "196 \ufffd\n", + "\n", + "197 \ufffd\n", + "\n", + "198 \ufffd\n", + "\n", + "199 \ufffd\n", + "\n", + "200 \ufffd\n", + "\n", + "201 \ufffd\n", + "\n", + "202 \ufffd\n", + "\n", + "203 \ufffd\n", + "\n", + "204 \ufffd\n", + "\n", + "205 \ufffd\n", + "\n", + "206 \ufffd\n", + "\n", + "207 \ufffd\n", + "\n", + "208 \ufffd\n", + "\n", + "209 \ufffd\n", + "\n", + "210 \ufffd\n", + "\n", + "211 \ufffd\n", + "\n", + "212 \ufffd\n", + "\n", + "213 \ufffd\n", + "\n", + "214 \ufffd\n", + "\n", + "215 \ufffd\n", + "\n", + "216 \ufffd\n", + "\n", + "217 \ufffd\n", + "\n", + "218 \ufffd\n", + "\n", + "219 \ufffd\n", + "\n", + "220 \ufffd\n", + "\n", + "221 \ufffd\n", + "\n", + "222 \ufffd\n", + "\n", + "223 \ufffd\n", + "\n", + "224 \ufffd\n", + "\n", + "225 \ufffd\n", + "\n", + "226 \ufffd\n", + "\n", + "227 \ufffd\n", + "\n", + "228 \ufffd\n", + "\n", + "229 \ufffd\n", + "\n", + "230 \ufffd\n", + "\n", + "231 \ufffd\n", + "\n", + "232 \ufffd\n", + "\n", + "233 \ufffd\n", + "\n", + "234 \ufffd\n", + "\n", + "235 \ufffd\n", + "\n", + "236 \ufffd\n", + "\n", + "237 \ufffd\n", + "\n", + "238 \ufffd\n", + "\n", + "239 \ufffd\n", + "\n", + "240 \ufffd\n", + "\n", + "241 \ufffd\n", + "\n", + "242 \ufffd\n", + "\n", + "243 \ufffd\n", + "\n", + "244 \ufffd\n", + "\n", + "245 \ufffd\n", + "\n", + "246 \ufffd\n", + "\n", + "247 \ufffd\n", + "\n", + "248 \ufffd\n", + "\n", + "249 \ufffd\n", + "\n", + "250 \ufffd\n", + "\n", + "251 \ufffd\n", + "\n", + "252 \ufffd\n", + "\n", + "253 \ufffd\n", + "\n", + "254 \ufffd\n", + "\n", + "254 \ufffd\n", + "\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 6.3 PAGE:200-201" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + " \n", + "c=raw_input()\n", + "d=raw_input()\n", + "print \"%c %c\\n\" % (c,d)\n", + "#int\n", + "i=eval(raw_input())\n", + "j=eval(raw_input())\n", + "print \"%d %u\\n\" % (i,j)\n", + "#short int\n", + "k=eval(raw_input())\n", + "l=eval(raw_input())\n", + "print \"%d %u\\n\" % (k,l)\n", + "#long int\n", + "m=eval(raw_input())\n", + "n=eval(raw_input())\n", + "print \"%ld %lu\\n\" % (m,n)\n", + "#float,double,long double\n", + "x=eval(raw_input())\n", + "y=eval(raw_input())\n", + "z=eval(raw_input())\n", + "print \"%f %lf %Lf\\n\" % (x,y,z)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "a\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "b\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a b\n", + "\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10000\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7389\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10000 7389\n", + "\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "34\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "585\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "34 585\n", + "\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "34676\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "500000\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "34676 500000\n", + "\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "445.55\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "57846.44\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "55666885.6655\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "445.550000 57846.440000 55666885.665500\n", + "\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 6.4 PAGE:205" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def main():\n", + " i=1\n", + " def main2():\n", + " def main3():\n", + " print \"%d\" % (i) #prints 1\n", + " main3()\n", + " print \"%d\" % (i) #prints 1\n", + " main2()\n", + " print \"%d\\n\" % (i) #prints 1\n", + "main()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n", + "1\n", + "1\n", + "\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 6.5 PAGE:205" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def main():\n", + " i=1\n", + " def main2():\n", + " i=2\n", + " def main3():\n", + " i=3\n", + " print \"%d\" % (i) #prints 3\n", + " main3()\n", + " print \"%d\" % (i) #prints 2\n", + " main2()\n", + " print \"%d\\n\" % (i) #prints 1\n", + "main()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n", + "2\n", + "1\n", + "\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 6.6 PAGE:206" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "for i in range(1,11,1):\n", + " print \"%d\\n\" % (i)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n", + "\n", + "2\n", + "\n", + "3\n", + "\n", + "4\n", + "\n", + "5\n", + "\n", + "6\n", + "\n", + "7\n", + "\n", + "8\n", + "\n", + "9\n", + "\n", + "10\n", + "\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 6.7 PAGE:208" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def increment():\n", + " i=1\n", + " print \"%d\\n\" % (i) #prints 1 every time\n", + " i=i+1\n", + "increment()\n", + "increment()\n", + "increment()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n", + "\n", + "1\n", + "\n", + "1\n", + "\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 6.8 PAGE:208" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def static_var(varname, value): #function to make it static\n", + " def decorate(func):\n", + " setattr(func, varname, value)\n", + " return func\n", + " return decorate\n", + "@static_var(\"i\", 1) #i is static variable\n", + "def increment():\n", + " print \"%d\\n\" % increment.i\n", + " increment.i += 1\n", + "increment()\n", + "increment()\n", + "increment()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n", + "\n", + "2\n", + "\n", + "3\n", + "\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 6.9 PAGE:209" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def fun():\n", + " k=35\n", + " return id(k) #returns address of k\n", + "j=fun() #stores address of k\n", + "print \"%d\\n\" % (j) #prints address of k" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "19639600\n", + "\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 6.10 PAGE:210" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def increment():\n", + " global i #gloabal declaration\n", + " i=i+1\n", + " print \"on incrementing i=%d\\n\" % (i)\n", + "def decrement():\n", + " global i #global declaration\n", + " i=i-1\n", + " print \"on decrementing i=%d\\n\" % (i)\n", + "i=0\n", + "print \"\\ni=%d\" % (i)\n", + "increment()\n", + "increment()\n", + "decrement()\n", + "decrement()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "i=0\n", + "on incrementing i=1\n", + "\n", + "on incrementing i=2\n", + "\n", + "on decrementing i=1\n", + "\n", + "on decrementing i=0\n", + "\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 6.11 PAGE:211" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "x=21\n", + "def main():\n", + " global x,y\n", + " print \"%d %d\\n\" % (x,y)\n", + "y=31\n", + "main()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "21 31\n", + "\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 6.12 PAGE:211" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def display():\n", + " global x #global variable\n", + " print \"%d\\n\" % (x) #prints 10\n", + "x=10\n", + "def main():\n", + " x=20 #local variable for main\n", + " print \"%d\\n\" % (x) #prints 20\n", + " display()\n", + "main()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "20\n", + "\n", + "10\n", + "\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 6.13 PAGE:212-213" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def fun1():\n", + " global i\n", + " i+=1\n", + " print \"%d\\n\" % (i)\n", + "def fun2():\n", + " global i\n", + " i-=1\n", + " print \"%d\\n\" % (i)\n", + "i=35\n", + "print \"%d\\n\" % (i)\n", + "fun1()\n", + "fun2()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "35\n", + "\n", + "36\n", + "\n", + "35\n", + "\n" + ] + } + ], + "prompt_number": 13 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/ANSI_C_Programming/.ipynb_checkpoints/chapter7-checkpoint.ipynb b/ANSI_C_Programming/.ipynb_checkpoints/chapter7-checkpoint.ipynb new file mode 100644 index 00000000..9f9dc611 --- /dev/null +++ b/ANSI_C_Programming/.ipynb_checkpoints/chapter7-checkpoint.ipynb @@ -0,0 +1,766 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:fd1ec3e67c48545fd52fb25c4fd9a7e9a12e0059838ac22b42a8d78165b23bc7" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "CHAPTER 7:THE C PREPROCESSOR" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 7.1 PAGE:226" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def UPPER(): #set UPPER() as 25\n", + " return 25\n", + "for i in range(1,UPPER()+1,1):\n", + " print \"%d\\n\" % (i)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n", + "\n", + "2\n", + "\n", + "3\n", + "\n", + "4\n", + "\n", + "5\n", + "\n", + "6\n", + "\n", + "7\n", + "\n", + "8\n", + "\n", + "9\n", + "\n", + "10\n", + "\n", + "11\n", + "\n", + "12\n", + "\n", + "13\n", + "\n", + "14\n", + "\n", + "15\n", + "\n", + "16\n", + "\n", + "17\n", + "\n", + "18\n", + "\n", + "19\n", + "\n", + "20\n", + "\n", + "21\n", + "\n", + "22\n", + "\n", + "23\n", + "\n", + "24\n", + "\n", + "25\n", + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 7.2 PAGE:227" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def PI(): #set PI() as 3.14\n", + " return 3.14\n", + "r=6.25\n", + "area=PI()*r*r\n", + "print \"Area of circle=%f\\n\" % (area)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Area of circle=122.656250\n", + "\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 7.3 PAGE:229" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def AND(x,y): #set AND(x,y) for \"and\" operation\n", + " return (x and y)\n", + "def OR(a,b): #set OR(a,b) for \"or\" operation\n", + " return (a or b)\n", + "f=1\n", + "x=4\n", + "y=90\n", + "if (AND(f<5,OR(x<=20,y<=45))):\n", + " print \"Your PC will always work fine...\\n\"\n", + "else:\n", + " print \"In front of the maintenance man\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Your PC will always work fine...\n", + "\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 7.4 PAGE:229" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def AND(x,y): #set AND(x,y) for \"and\" operation\n", + " return (x and y)\n", + "def ARANGE():\n", + " return (AND(a>25,a<50)) #check for a>25 and a<50\n", + "a=30\n", + "if (ARANGE()):\n", + " print \"within range\\n\"\n", + "else:\n", + " print \"out of range\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "within range\n", + "\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 7.5 PAGE:230" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def FOUND():\n", + " print \"The Yankee Doodle Virus\\n\"\n", + "signature='Y'\n", + "if (signature=='Y'):\n", + " FOUND()\n", + "else:\n", + " print \"Safe... as yet!\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Yankee Doodle Virus\n", + "\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 7.6 PAGE:230" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def AREA(x):\n", + " return (3.14*x*x)\n", + "r1=6.25\n", + "r2=2.5\n", + "a=AREA(r1)\n", + "print \"Area of circle=%f\\n\" % (a)\n", + "a=AREA(r2)\n", + "print \"Area of circle=%f\\n\" % (a)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Area of circle=122.656250\n", + "\n", + "Area of circle=19.625000\n", + "\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 7.7 PAGE:231" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "r1=6.25\n", + "r2=2.5\n", + "a=3.14*r1*r1\n", + "print \"Area of circle=%f\\n\" % (a)\n", + "a=3.14*r2*r2\n", + "print \"Area of circle=%f\\n\" % (a)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Area of circle=122.656250\n", + "\n", + "Area of circle=19.625000\n", + "\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 7.8 PAGE:231" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def ISDIGIT(y):\n", + " return (y>=48 and y<=57)\n", + "print \"Enter any digit\"\n", + "ch=raw_input()\n", + "if (ISDIGIT(ord(ch))):\n", + " print \"You entered a digit\\n\"\n", + "else:\n", + " print \"Illegal input\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter any digit\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "You entered a digit\n", + "\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 7.9 PAGE:232" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def SQUARE(n):\n", + " return (n*n)\n", + "j=64/SQUARE(4) #it's function not macros ,so j=4\n", + "print \"j=%d\\n\" % (j)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "j=4\n", + "\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 7.10 PAGE:233" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def HLINE():\n", + " for i in range(0,79,1):\n", + " print \"%c\" % 45, #characters are bytes and therefore encoding-dependent(non utf-8)\n", + " print \"\\n\"\n", + "def VLINE(X,Y):\n", + " print \"%c\" % 124 #If you want to write 179 in place of 124 then use utf-8 encoding\n", + "HLINE()\n", + "for y in range(1,25,1):\n", + " VLINE(39,y)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n", + "\n", + "|\n", + "|\n", + "|\n", + "|\n", + "|\n", + "|\n", + "|\n", + "|\n", + "|\n", + "|\n", + "|\n", + "|\n", + "|\n", + "|\n", + "|\n", + "|\n", + "|\n", + "|\n", + "|\n", + "|\n", + "|\n", + "|\n", + "|\n", + "|\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 7.11 PAGE:236-237" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "OKAY=False\n", + "if OKAY:\n", + " import logging\n", + " print \"statement 1\"\n", + " print \"statement 2\" #detects virus\n", + " print \"statement 3\" \n", + " print \"statement 4\" #specific to stone virus\n", + "print \"statement 5\"\n", + "print \"statement 6\"\n", + "print \"statement 7\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "statement 5\n", + "statement 6\n", + "statement 7\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 7.12 PAGE:237" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "INTEL=False\n", + "if INTEL:\n", + " print \"code suitable for an Intel PC\"\n", + "else:\n", + " print \"code suitable for a Motorola PC\"\n", + "print \"code common to both the computers\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "code suitable for a Motorola PC\n", + "code common to both the computers\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 7.13 PAGE:238" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "INTEL=True\n", + "if INTEL:\n", + " print \"code suitable for a Intel PC\"\n", + "else:\n", + " print \"code suitable for a motorola PC\"\n", + "print \"code common to both the computers\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "code suitable for a Intel PC\n", + "code common to both the computers\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 7.14 PAGE:239" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "TEST=6\n", + "if TEST<=5:\n", + " print \"statement 1\"\n", + " print \"statement 2\"\n", + " print \"statement 3\"\n", + "else:\n", + " print \"statement 4\"\n", + " print \"statement 5\"\n", + " print \"statement 6\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "statement 4\n", + "statement 5\n", + "statement 6\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 7.15 PAGE:239" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "ADAPTER='SVGA'\n", + "if ADAPTER=='VGA':\n", + " print \"code for video graphics array\"\n", + "else:\n", + " if ADAPTER=='SVGA':\n", + " print \"code for super video graphics array\"\n", + " else:\n", + " print \"code for extended graphics array\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "code for super video graphics array\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 7.16 PAGE:239-240" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "ADAPTER='SVGA'\n", + "if ADAPTER=='VGA':\n", + " print \"code for video graphics array\"\n", + "elif ADAPTER=='SVGA':\n", + " print \"code for super video graphics array\"\n", + "else:\n", + " print \"code for extented graphics adapter\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "code for super video graphics array\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 7.17 PAGE:241" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def fun1():\n", + " print \"Inside fun1\\n\"\n", + "def fun2():\n", + " print \"Inside fun 2\\n\"\n", + "def main():\n", + " print \"Inside main\\n\"\n", + "fun1()\n", + "main()\n", + "fun2()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Inside fun1\n", + "\n", + "Inside main\n", + "\n", + "Inside fun 2\n", + "\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 7.18 PAGE:242" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def f1():\n", + " a=5\n", + "def f2(x):\n", + " print \"Inside f2\" #passed parameter is not being used\n", + "def f3():\n", + " x=6\n", + " return x\n", + " x+=1 #control can never reach this statement\n", + "f1()\n", + "f2(7)\n", + "f3()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Inside f2\n" + ] + }, + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 20, + "text": [ + "6" + ] + } + ], + "prompt_number": 20 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/ANSI_C_Programming/.ipynb_checkpoints/chapter8-checkpoint.ipynb b/ANSI_C_Programming/.ipynb_checkpoints/chapter8-checkpoint.ipynb new file mode 100644 index 00000000..3aa4ab20 --- /dev/null +++ b/ANSI_C_Programming/.ipynb_checkpoints/chapter8-checkpoint.ipynb @@ -0,0 +1,1400 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:63d98a76fa221452c843fc747bf812d410d5c88883bcf929378197f7a8e2c888" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "CHAPTER 8: ARRAYS" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 8.1 PAGE:256" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "x=5\n", + "x=10\n", + "print \"x=%d\\n\" % (x) #prints 10" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x=10\n", + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 8.2 PAGE:257-258" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "sum=0\n", + "marks=[] #array declaration\n", + "for i in range(30):\n", + " marks.append(0)\n", + "for i in range(0,30,1):\n", + " print \"Enter marks\"\n", + " marks[i]=eval(raw_input()) #store data in array\n", + "for i in range(0,30,1):\n", + " sum=sum+marks[i]\n", + "avg=sum/30\n", + "print \"Average marks=%d\\n\" % (avg)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "98\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "88\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "97\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "96\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "87\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "89\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "80\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "86\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "95\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "99\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "90\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "100\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "99\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "94\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "85\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "84\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "92\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "91\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "87\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "76\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "75\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "96\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "83\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "80\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "93\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "79\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "70\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "78\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "85\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "86\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Average marks=87\n", + "\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 8.3 PAGE:261" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "num=[]\n", + "for i in range(40):\n", + " num.append(0)\n", + "for i in range(0,40,1): #be carefull about the size of the array\n", + " num[i]=i" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 8.4 PAGE:261-262" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def display(m):\n", + " print \"%d\" % (m)\n", + "marks=[55,65,75,56,78,78,90]\n", + "for i in range(0,7,1):\n", + " display(marks[i])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n", + "65\n", + "75\n", + "56\n", + "78\n", + "78\n", + "90\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 8.5 PAGE:263" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def show(n):\n", + " print \"%d\" % (n)\n", + "def disp(n):\n", + " show(n) #calls show()\n", + "marks=[55,65,75,56,78,78,90]\n", + "for i in range(0,7,1):\n", + " disp(marks[i])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n", + "65\n", + "75\n", + "56\n", + "78\n", + "78\n", + "90\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 8.6 PAGE:263-264" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "i=3\n", + "j=1.5\n", + "k='c'\n", + "print \"Value of i=%d\\n\" % (i)\n", + "print \"Value of j=%f\\n\" % (j)\n", + "print \"Value of k=%c\\n\" % (k)\n", + "x=id(i)\n", + "y=id(j)\n", + "z=id(k)\n", + "print \"Original address in x=%u\\n\" % (x)\n", + "print \"Original address in y=%u\\n\" % (y)\n", + "print \"Original address in z=%u\\n\" % (z)\n", + "x+=1\n", + "y+=1\n", + "z+=1\n", + "print \"New address in x=%u\\n\" % (x)\n", + "print \"New address in y=%u\\n\" % (y)\n", + "print \"New address in z=%u\\n\" % (z)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of i=3\n", + "\n", + "Value of j=1.500000\n", + "\n", + "Value of k=c\n", + "\n", + "Original address in x=21147312\n", + "\n", + "Original address in y=88181272\n", + "\n", + "Original address in z=21311640\n", + "\n", + "New address in x=21147313\n", + "\n", + "New address in y=88181273\n", + "\n", + "New address in z=21311641\n", + "\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 8.7 PAGE:265" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "arr=[10,20,30,45,67,56,74]\n", + "i=id(arr[1])\n", + "j=id(arr[5])\n", + "print \"%d %d\\n\" % (j-i,arr[5]-arr[1])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "-432 36\n", + "\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 8.8 PAGE:266" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "arr=[10,20,36,72,45,36]\n", + "j=id(arr[4])\n", + "k=id(arr[0+4]) #didn't get any other way\n", + "if j==k:\n", + " print \"The two pointers point to the same location\\n\"\n", + "else:\n", + " print \"The two pointers do not point to the same location\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The two pointers point to the same location\n", + "\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 8.9 PAGE:267" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "num=[24,34,12,44,56,17]\n", + "for i in range(0,6,1):\n", + " print \"element no.%d\" % (i)\n", + " print \"address=%u\\n\" % (id(num[i]))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "element no.0\n", + "address=21147060\n", + "\n", + "element no.1\n", + "address=21146940\n", + "\n", + "element no.2\n", + "address=21147204\n", + "\n", + "element no.3\n", + "address=21146820\n", + "\n", + "element no.4\n", + "address=21146676\n", + "\n", + "element no.5\n", + "address=21147144\n", + "\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 8.10 PAGE:268" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "num=[24,34,12,44,56,17]\n", + "for i in range(0,6,1):\n", + " print \"address=%u\" % (id(num[i]))\n", + " print \"element=%d\\n\" % (num[i])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "address=21147060\n", + "element=24\n", + "\n", + "address=21146940\n", + "element=34\n", + "\n", + "address=21147204\n", + "element=12\n", + "\n", + "address=21146820\n", + "element=44\n", + "\n", + "address=21146676\n", + "element=56\n", + "\n", + "address=21147144\n", + "element=17\n", + "\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 8.11 PAGE:268" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "num=[24,34,12,44,56,17]\n", + "j=id(num[0]) #assign address of zeroth element\n", + "for i in range(0,6,1):\n", + " print \"address=%u\" % (id(num[i]))\n", + " print \"element=%d\\n\" % (num[i]) " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "address=21147060\n", + "element=24\n", + "\n", + "address=21146940\n", + "element=34\n", + "\n", + "address=21147204\n", + "element=12\n", + "\n", + "address=21146820\n", + "element=44\n", + "\n", + "address=21146676\n", + "element=56\n", + "\n", + "address=21147144\n", + "element=17\n", + "\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 8.12 PAGE:270" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def display(j,n):\n", + " for item in j:\n", + " print \"element=%d\\n\" % (item)\n", + "num=[24,34,12,44,56,17]\n", + "display(num,6)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "element=24\n", + "\n", + "element=34\n", + "\n", + "element=12\n", + "\n", + "element=44\n", + "\n", + "element=56\n", + "\n", + "element=17\n", + "\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 8.13 PAGE:271" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "num=[24,34,12,44,56,17]\n", + "for i in range(0,6,1):\n", + " print \"address=%u\" % (id(num[i]))\n", + " print \"element=%d %d\" % (num[i],num[i]) #no other way\n", + " print \"%d %d\\n\" % (num[i],num[i])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "address=21147060\n", + "element=24 24\n", + "24 24\n", + "\n", + "address=21146940\n", + "element=34 34\n", + "34 34\n", + "\n", + "address=21147204\n", + "element=12 12\n", + "12 12\n", + "\n", + "address=21146820\n", + "element=44 44\n", + "44 44\n", + "\n", + "address=21146676\n", + "element=56 56\n", + "56 56\n", + "\n", + "address=21147144\n", + "element=17 17\n", + "17 17\n", + "\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 8.14 PAGE:272" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "stud=[[0,0],[0,0],[0,0],[0,0]]\n", + "for i in range(0,4,1):\n", + " print \"Enter roll no. and marks\"\n", + " stud[i][0]=eval(raw_input())\n", + " stud[i][1]=eval(raw_input())\n", + "for i in range(0,4,1):\n", + " print \"%d %d\\n\" % (stud[i][0],stud[i][1])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter roll no. and marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1206030\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "100\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter roll no. and marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1206007\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "95\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter roll no. and marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1206034\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "97\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter roll no. and marks\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1206026\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "88\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1206030 100\n", + "\n", + "1206007 95\n", + "\n", + "1206034 97\n", + "\n", + "1206026 88\n", + "\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 8.15 PAGE:275" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "s=[[1234,56],[1212,33],[1434,80],[1312,78]]\n", + "for i in range(0,4,1):\n", + " print \"Address of %dth 1-D array=%u\\n\" % (i,id(s[i]))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Address of 0th 1-D array=88430392\n", + "\n", + "Address of 1th 1-D array=89514192\n", + "\n", + "Address of 2th 1-D array=88430712\n", + "\n", + "Address of 3th 1-D array=88430312\n", + "\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 8.16 PAGE:277" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "s=[[1234,56],[1212,33],[1434,80],[1312,78]]\n", + "for i in range(0,4,1):\n", + " for j in range(0,2,1):\n", + " print \"%d\" % (s[i][j])\n", + " print \"\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1234\n", + "56\n", + "\n", + "\n", + "1212\n", + "33\n", + "\n", + "\n", + "1434\n", + "80\n", + "\n", + "\n", + "1312\n", + "78\n", + "\n", + "\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 8.17 PAGE:277-278" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "s=[[1234,56],[1212,33],[1434,80],[1312,78]]\n", + "p=[]\n", + "for i in range(2):\n", + " p.append(0)\n", + "for i in range(0,4,1):\n", + " p=s\n", + " pint=p\n", + " print \"\\n\"\n", + " for j in range(0,2,1):\n", + " print \"%d\" % (pint[i][j])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + "1234\n", + "56\n", + "\n", + "\n", + "1212\n", + "33\n", + "\n", + "\n", + "1434\n", + "80\n", + "\n", + "\n", + "1312\n", + "78\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 8.18 PAGE:279-280" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def display(q,row,col):\n", + " for item in q:\n", + " print item\n", + " print \"\\n\"\n", + "a=[[1,2,3,4],[5,6,7,8],[9,0,1,6]]\n", + "display(a,3,4)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[1, 2, 3, 4]\n", + "[5, 6, 7, 8]\n", + "[9, 0, 1, 6]\n", + "\n", + "\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 8.19 PAGE:281-282" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "arr=[]\n", + "for i in range(4):\n", + " arr.append(0)\n", + "i=31\n", + "j=5\n", + "k=19\n", + "l=71\n", + "arr[0]=i\n", + "arr[1]=j\n", + "arr[2]=k\n", + "arr[3]=l\n", + "for m in range(0,4,1):\n", + " print \"%d\\n\" % (arr[m])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "31\n", + "\n", + "5\n", + "\n", + "19\n", + "\n", + "71\n", + "\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 8.20 PAGE:282" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "a=[0,1,2,3,4]\n", + "print \"%u %u %d\\n\" % (id(id(a[0])),id(a[0]),a[0])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "88518416 21147348 0\n", + "\n" + ] + } + ], + "prompt_number": 22 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/ANSI_C_Programming/.ipynb_checkpoints/chapter9-checkpoint.ipynb b/ANSI_C_Programming/.ipynb_checkpoints/chapter9-checkpoint.ipynb new file mode 100644 index 00000000..1e3d0538 --- /dev/null +++ b/ANSI_C_Programming/.ipynb_checkpoints/chapter9-checkpoint.ipynb @@ -0,0 +1,958 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:836381c04892d46b0831f1159108d08f97f21fb1cd4da3a5ebe385abe6119124" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "CHAPTER 9: PUPPETTING ON STRINGS" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 9.1 PAGE:311" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "name=\"Klinsman\"\n", + "i=0\n", + "while i<=7:\n", + " print \"%c\" % (name[i]), #method of printing without line feed\n", + " i+=1\n", + "print \"\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "K l i n s m a n \n", + "\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 9.2 PAGE:311-312" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "name=\"Klinsman \"\n", + "i=0\n", + "while name[i]!=' ':\n", + " print \"%c\" % (name[i]), \n", + " i+=1\n", + "print \"\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " K l i n s m a n \n", + "\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 9.3 PAGE:312" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "name=\"Klinsman \"\n", + "ptr=[]\n", + "ptr=name #store base address of string\n", + "i=0\n", + "while name[i]!=' ':\n", + " print \"%c\" % (ptr[i]), \n", + " i+=1\n", + "print \"\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "K l i n s m a n \n", + "\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 9.4 PAGE:313" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "name=\"Klinsman\"\n", + "print \"%s\" % (name)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Klinsman\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 9.5 PAGE:313" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "print \"Enter your name\"\n", + "name=raw_input()\n", + "print \"Hello %s!\\n\" % (name)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your name\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Debashish\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello Debashish!\n", + "\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 9.6 PAGE:314" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "print \"Enter your full name:\"\n", + "name=raw_input()\n", + "print \"Hello!\"\n", + "print name" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your full name:\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Debashish Roy\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello!\n", + "Debashish Roy\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 9.7 PAGE:315" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "str1=\"Hello\"\n", + "s=\"Good Morning\"\n", + "str2=str1 #No error in Python since all variables are by default pointers\n", + "q=s" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 9.8 PAGE:316" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "str1=\"Hello\"\n", + "p=\"Hello\"\n", + "str1=\"Bye\" #No error in python\n", + "p=\"Bye\"" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 9.9 PAGE:317" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "arr=\"Bamboozled\"\n", + "len1=len(arr) #return length of string\n", + "len2=len(\"Humpty Dumpty\")\n", + "print \"string=%s length=%d\\n\" % (arr,len1)\n", + "print \"string=%s length=%d\\n\" % (\"Humpty Dumpty\",len2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "string=Bamboozled length=10\n", + "\n", + "string=Humpty Dumpty length=13\n", + "\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 9.10 PAGE:317-318" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def xstrlen(s):\n", + " length=0\n", + " for item in s:\n", + " if s!=\"\\0\":\n", + " length+=1\n", + " return length\n", + "arr=\"Bamboozled\"\n", + "len1=xstrlen(arr) \n", + "len2=xstrlen(\"Humpty Dumpty\")\n", + "print \"string=%s length=%d\\n\" % (arr,len1)\n", + "print \"string=%s length=%d\\n\" % (\"Humpty dumpty\",len2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "string=Bamboozled length=10\n", + "\n", + "string=Humpty dumpty length=13\n", + "\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 9.11 PAGE:319" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import copy\n", + "source=\"Sayonara\"\n", + "target=copy.copy(source) #copy string\n", + "print \"source string=%s\\n\" % (source)\n", + "print \"target string=%s\\n\" % (target)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "source string=Sayonara\n", + "\n", + "target string=Sayonara\n", + "\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 9.12 PAGE:319-320" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def xstrcpy(t,s):\n", + " t=\"\\0\"\n", + " for item in s:\n", + " t=t+str(item)\n", + " return t\n", + "source=\"Sayonara\"\n", + "target=[]\n", + "target=xstrcpy(target,source)\n", + "print \"source string=%s\\n\" % (source)\n", + "print \"target string=%s\\n\" % (target)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "source string=Sayonara\n", + "\n", + "target string=\u0000Sayonara\n", + "\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 9.13 PAGE:321" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "pi=3.14\n", + "print \"Enter radius of circle\"\n", + "r=eval(raw_input())\n", + "a=pi*r*r\n", + "print \"Area of circle=%f\\n\" % (a)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter radius of circle\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Area of circle=28.260000\n", + "\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 9.14 PAGE:322" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "source=\"Folks!\"\n", + "target=\"Hello\"\n", + "target=target+source\n", + "print \"source string=%s\\n\" % (source)\n", + "print \"target string=%s\\n\" % (target)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "source string=Folks!\n", + "\n", + "target string=HelloFolks!\n", + "\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 9.15 PAGE:322-323" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "string1=\"Jerry\"\n", + "string2=\"Ferry\"\n", + "i=cmp(string1,\"Jerry\")\n", + "j=cmp(string1,string2)\n", + "k=cmp(string1,\"Jerry boy\")\n", + "print \"%d %d %d\\n\" % (i,j,k)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 1 -1\n", + "\n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 9.16 PAGE:323-324" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def FOUND():\n", + " return 1\n", + "def NOTFOUND():\n", + " return 0\n", + "masterlist=[\"akshay\",\"parag\",\"raman\",\"srinivas\",\"gopal\",\"rajesh\"]\n", + "print \"Enter your name\"\n", + "yourname=raw_input()\n", + "flag=NOTFOUND()\n", + "for i in range(0,6,1):\n", + " a=cmp(masterlist[i],yourname)\n", + " if a==0:\n", + " print \"Welcome,you can enter the palace\\n\"\n", + " flag=FOUND()\n", + " break\n", + "if flag==NOTFOUND():\n", + " print \"Sorry,you are a trespasser\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your name\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "gopal\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Welcome,you can enter the palace\n", + "\n" + ] + } + ], + "prompt_number": 51 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 9.17 PAGE:327" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "names=[\"akshay\",\"parag\",\"raman\",\"srinivas\",\"gopal\",\"rajesh\"]\n", + "names = map(bytearray, names)\n", + "print \"Original:%s %s\\n\" % (names[2],names[3])\n", + "s = sorted((names[2], names[3]), key=len)\n", + "for i in range(len(s[1])):\n", + " try:\n", + " t=s[0][i]\n", + " s[0][i]=s[1][i]\n", + " s[1][i]=t\n", + " except IndexError:\n", + " for _ in range(i, len(s[1])):\n", + " #remove the items from the longer string to and append them to the shorter one.\n", + " s[0].append(s[1].pop(i)) \n", + "print \"New:%s %s\\n\" % (names[2],names[3])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Original:raman srinivas\n", + "\n", + "New:srinivas raman\n", + "\n" + ] + } + ], + "prompt_number": 46 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 9.18 PAGE-328" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "names=[\"akshay\",\"parag\",\"raman\",\"srinivas\",\"gopal\",\"rajesh\"]\n", + "print \"Original:%s %s\\n\" % (names[2],names[3])\n", + "t=names[2]\n", + "names[2]=names[3]\n", + "names[3]=t\n", + "print \"New:%s %s\\n\" % (names[2],names[3])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Original:raman srinivas\n", + "\n", + "New:srinivas raman\n", + "\n" + ] + } + ], + "prompt_number": 48 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 9.19 PAGE:329" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "names=[]\n", + "for i in range(6):\n", + " names.append(\"\\0\") \n", + "for i in range(0,6,1):\n", + " print \"Enter name\"\n", + " names[i]=raw_input()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "RAM\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "GOPAL\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "PANDEY\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "GOPU\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "CHOTU\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "RADHEY\n" + ] + } + ], + "prompt_number": 50 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "EXAMPLE 9.20 PAGE:329-330" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "names=[]\n", + "for i in range(0,6):\n", + " names.append('\\0')\n", + "for i in range(0,6,1):\n", + " print \"Enter name\"\n", + " n=raw_input()\n", + " length=len(n)\n", + " import copy\n", + " p=copy.copy(n)\n", + " names[i]=p\n", + "for i in range(0,6,1):\n", + " print \"%s\\n\" % (names[i])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "MUKUT\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "BIHARI\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "PANDEY\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "MADHUBALA\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "PANDEY\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "SUNITA\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "MUKUT\n", + "\n", + "BIHARI\n", + "\n", + "PANDEY\n", + "\n", + "MADHUBALA\n", + "\n", + "PANDEY\n", + "\n", + "SUNITA\n", + "\n" + ] + } + ], + "prompt_number": 7 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/ANSI_C_Programming/chapter1.ipynb b/ANSI_C_Programming/chapter1.ipynb index 1c3108fa..d96946b1 100644 --- a/ANSI_C_Programming/chapter1.ipynb +++ b/ANSI_C_Programming/chapter1.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:a5caa773def394b4fd51c60fb4856df2fdb5f2105f126537a15f6520ea337bff" + "signature": "sha256:90d67b804f2d6ea1cd245c10aa788b889d877aef594e9fa5adb7fa4fe440ff07" }, "nbformat": 3, "nbformat_minor": 0, @@ -21,7 +21,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:12" + "EXAMPLE 1.1 PAGE:12" ] }, { @@ -55,7 +55,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:17" + "EXAMPLE 1.2 PAGE:17" ] }, { @@ -120,7 +120,7 @@ "level": 2, "metadata": {}, "source": [ - "Example on page:18" + "Example 1.3 page:18" ] }, { @@ -169,7 +169,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:23" + "EXAMPLE 1.4 PAGE:23" ] }, { diff --git a/ANSI_C_Programming/chapter10.ipynb b/ANSI_C_Programming/chapter10.ipynb index 370cbcea..2661180a 100644 --- a/ANSI_C_Programming/chapter10.ipynb +++ b/ANSI_C_Programming/chapter10.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:2551d4c0f797f2bbef63a528dde1d2dd1067208b3f54db92e7a20ac687ed39db" + "signature": "sha256:daf123ab814e7627f17e2eb15e9f46bef8346c280ed286a5a5d39a012e1c98c4" }, "nbformat": 3, "nbformat_minor": 0, @@ -21,7 +21,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:342-343" + "EXAMPLE 10.1 PAGE:342-343" ] }, { @@ -151,7 +151,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:343-344" + "EXAMPLE 10.2 PAGE:343-344" ] }, { @@ -285,7 +285,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:347" + "EXAMPLE 10.3 PAGE:347" ] }, { @@ -324,7 +324,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:348-349" + "EXAMPLE 10.4 PAGE:348-349" ] }, { @@ -467,7 +467,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:350-351" + "EXAMPLE 10.5 PAGE:350-351" ] }, { @@ -515,7 +515,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:351-352" + "EXAMPLE 10.6 PAGE:351-352" ] }, { @@ -555,7 +555,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:353" + "EXAMPLE 10.7 PAGE:353" ] }, { @@ -590,7 +590,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:353-354" + "EXAMPLE 10.8 PAGE:353-354" ] }, { @@ -625,7 +625,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:354-355" + "EXAMPLE 10.9 PAGE:354-355" ] }, { @@ -663,7 +663,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:355-356" + "EXAMPLE 10.10 PAGE:355-356" ] }, { @@ -698,7 +698,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:356" + "EXAMPLE 10.11 PAGE:356" ] }, { @@ -731,7 +731,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:357-358" + "EXAMPLE 10.12 PAGE:357-358" ] }, { diff --git a/ANSI_C_Programming/chapter11.ipynb b/ANSI_C_Programming/chapter11.ipynb index f0dba284..c836215e 100644 --- a/ANSI_C_Programming/chapter11.ipynb +++ b/ANSI_C_Programming/chapter11.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:b6a9263efd333c836685db4fb9578682414d12b2c46fafab1217faab10d2f61b" + "signature": "sha256:28717ddcdc2d93e1617740abd9a34bb6c9bea63b5da4ddd876a563d2216569c1" }, "nbformat": 3, "nbformat_minor": 0, @@ -21,7 +21,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:372" + "EXAMPLE 11.1 PAGE:372" ] }, { @@ -53,7 +53,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:374" + "EXAMPLE 11.2 PAGE:374" ] }, { @@ -98,7 +98,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:374-375" + "EXAMPLE 11.3 PAGE:374-375" ] }, { @@ -130,7 +130,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:375" + "EXAMPLE 11.4 PAGE:375" ] }, { @@ -162,7 +162,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:375" + "EXAMPLE 11.5 PAGE:375" ] }, { @@ -198,7 +198,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:376" + "EXAMPLE 11.6 PAGE:376" ] }, { @@ -228,7 +228,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:377-378" + "EXAMPLE 11.7 PAGE:377-378" ] }, { @@ -270,7 +270,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:379" + "EXAMPLE 11.8 PAGE:379" ] }, { @@ -306,7 +306,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:380" + "EXAMPLE 11.9 PAGE:380" ] }, { @@ -405,7 +405,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:381" + "EXAMPLE 11.10 PAGE:381" ] }, { @@ -439,7 +439,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:381" + "EXAMPLE 11.15 PAGE:381" ] }, { @@ -485,7 +485,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:382" + "EXAMPLE 11.16 PAGE:382" ] }, { diff --git a/ANSI_C_Programming/chapter12.ipynb b/ANSI_C_Programming/chapter12.ipynb index 8bab1a13..18ea00dc 100644 --- a/ANSI_C_Programming/chapter12.ipynb +++ b/ANSI_C_Programming/chapter12.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:a886cf212382fa732d2b3df088bbcba9a65ba4a31cbe899c80e912ac04c2747f" + "signature": "sha256:b88ea7ba5beada8b0214f768e5c5a8dee7191df03bb14244db37b36214a7fed4" }, "nbformat": 3, "nbformat_minor": 0, @@ -10,7 +10,7 @@ "cells": [ { "cell_type": "heading", - "level": 1, + "level": 3, "metadata": {}, "source": [ "CHAPTER 12:FILE INPUT/OUTPUT" @@ -21,7 +21,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:391" + "EXAMPLE 12.1 PAGE:391" ] }, { @@ -61,7 +61,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:394" + "EXAMPLE 12.2 PAGE:394" ] }, { @@ -95,7 +95,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:395" + "EXAMPLE 12.3 PAGE:395" ] }, { @@ -154,7 +154,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:396-397" + "EXAMPLE 12.4 PAGE:396-397" ] }, { @@ -189,7 +189,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:399" + "EXAMPLE 12.5 PAGE:399" ] }, { @@ -269,7 +269,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:400" + "EXAMPLE 12.6 PAGE:400" ] }, { @@ -309,7 +309,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:401-402" + "EXAMPLE 12.7 PAGE:401-402" ] }, { @@ -490,7 +490,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:403-404" + "EXAMPLE 12.8 PAGE:403-404" ] }, { @@ -536,7 +536,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:404-405" + "EXAMPLE 12.9 PAGE:404-405" ] }, { @@ -571,7 +571,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:407-408" + "EXAMPLE 12.10 PAGE:407-408" ] }, { @@ -753,7 +753,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:409" + "EXAMPLE 12.11 PAGE:409" ] }, { @@ -799,7 +799,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:411-414" + "EXAMPLE 12.12 PAGE:411-414" ] }, { @@ -1382,7 +1382,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:416-417" + "EXAMPLE 12.13 PAGE:416-417" ] }, { diff --git a/ANSI_C_Programming/chapter13.ipynb b/ANSI_C_Programming/chapter13.ipynb index b37b75e4..9497198b 100644 --- a/ANSI_C_Programming/chapter13.ipynb +++ b/ANSI_C_Programming/chapter13.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:af78c3ae74c9d65bb5213be5077524875e7de56ebf2616c80d19baf13507c5b4" + "signature": "sha256:7742db14fd252e12755c3b2a8046a8b1fad9930978c63d2533b8d746c5d4cb5e" }, "nbformat": 3, "nbformat_minor": 0, @@ -21,7 +21,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:434-435" + "EXAMPLE 13.1 PAGE:434-435" ] }, { @@ -56,7 +56,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:437-438" + "EXAMPLE 13.2 PAGE:437-438" ] }, { @@ -93,7 +93,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:439" + "EXAMPLE 13.3 PAGE:439" ] }, { @@ -139,7 +139,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:440-441" + "EXAMPLE 13.4 PAGE:440-441" ] }, { @@ -163,7 +163,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:442" + "EXAMPLE 13.5 PAGE:442" ] }, { diff --git a/ANSI_C_Programming/chapter14.ipynb b/ANSI_C_Programming/chapter14.ipynb index 35f6efe1..7e629ab9 100644 --- a/ANSI_C_Programming/chapter14.ipynb +++ b/ANSI_C_Programming/chapter14.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:e28261ed5c0b0cf7c10e8c91bd2debc8e99bf24519225a056fc19ed619f1e95d" + "signature": "sha256:e75fb8abb9fbadffee6af07df2cc63d66fbde29a162f782fce45e1438f5886bc" }, "nbformat": 3, "nbformat_minor": 0, @@ -21,7 +21,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:449" + "EXAMPLE 14.1 PAGE:449" ] }, { @@ -64,7 +64,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:450" + "EXAMPLE 14.2 PAGE:450" ] }, { @@ -114,7 +114,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:451" + "EXAMPLE 14.3 PAGE:451" ] }, { @@ -149,7 +149,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:452" + "EXAMPLE 14.4 PAGE:452" ] }, { @@ -198,7 +198,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:453-454" + "EXAMPLE 14.5 PAGE:453-454" ] }, { @@ -246,7 +246,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:457-458" + "EXAMPLE 14.6 PAGE:457-458" ] }, { @@ -288,7 +288,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:460" + "EXAMPLE 14.7 PAGE:460" ] }, { @@ -332,7 +332,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:463" + "EXAMPLE 14.8 PAGE:463" ] }, { @@ -367,7 +367,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:463-464" + "EXAMPLE 14.9 PAGE:463-464" ] }, { diff --git a/ANSI_C_Programming/chapter15.ipynb b/ANSI_C_Programming/chapter15.ipynb index 6421f521..7ae94baa 100644 --- a/ANSI_C_Programming/chapter15.ipynb +++ b/ANSI_C_Programming/chapter15.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:831402bdcf6a50366e6a400bf971e09b25983de0ebf01458d42a693aa22990c1" + "signature": "sha256:4d848680349183ca407cef154e85743faaa3449ff0caf56812bd405e1a221a48" }, "nbformat": 3, "nbformat_minor": 0, @@ -21,7 +21,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:473-474" + "EXAMPLE 15.1 PAGE:473-474" ] }, { @@ -73,7 +73,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:475" + "EXAMPLE 15.2 PAGE:475" ] }, { @@ -127,7 +127,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:477-478" + "EXAMPLE 15.3 PAGE:477-478" ] }, { @@ -159,7 +159,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:478" + "EXAMPLE 15.4 PAGE:478" ] }, { @@ -191,7 +191,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:478-479" + "EXAMPLE 15.5 PAGE:478-479" ] }, { @@ -224,7 +224,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:480" + "EXAMPLE 15.6 PAGE:480" ] }, { @@ -283,7 +283,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:481" + "EXAMPLE 15.7 PAGE:481" ] }, { @@ -352,7 +352,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:483" + "EXAMPLE 15.8 PAGE:483" ] }, { @@ -385,7 +385,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:483-484" + "EXAMPLE 15.9 PAGE:483-484" ] }, { @@ -422,7 +422,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:485" + "EXAMPLE 15.10 PAGE:485" ] }, { @@ -462,7 +462,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:486-487" + "EXAMPLE 15.11 PAGE:486-487" ] }, { @@ -516,7 +516,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:488" + "EXAMPLE 15.12 PAGE:488" ] }, { @@ -554,7 +554,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:491" + "EXAMPLE 15.13 PAGE:491" ] }, { @@ -599,7 +599,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:492-493" + "EXAMPLE 15.14 PAGE:492-493" ] }, { @@ -653,7 +653,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:494-495" + "EXAMPLE 15.15 PAGE:494-495" ] }, { diff --git a/ANSI_C_Programming/chapter2.ipynb b/ANSI_C_Programming/chapter2.ipynb index 644241bb..913a7520 100644 --- a/ANSI_C_Programming/chapter2.ipynb +++ b/ANSI_C_Programming/chapter2.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:6a166cd5bc555687c7e5271b8e9483765eadd38f5e9c5bfca7169a4ded24b03b" + "signature": "sha256:122349dba3c4e4d1f40022d5db7dbad14438b7bc81516fa77f11e6bbedd976dc" }, "nbformat": 3, "nbformat_minor": 0, @@ -21,7 +21,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE-45" + "EXAMPLE 2.0 PAGE-45" ] }, { @@ -379,7 +379,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON Page-56-57" + "EXAMPLE 2.5 Page-56-57" ] }, { @@ -469,7 +469,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON Page-58" + "EXAMPLE 2.6 Page-58" ] }, { @@ -635,7 +635,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON Page-60" + "EXAMPLE 2.6 Page-60" ] }, { diff --git a/ANSI_C_Programming/chapter3.ipynb b/ANSI_C_Programming/chapter3.ipynb index 24b5eb3a..0657e098 100644 --- a/ANSI_C_Programming/chapter3.ipynb +++ b/ANSI_C_Programming/chapter3.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:2f63105cbe9f49f191de7b50016730212f162ceb128a95b6bc9a54da3a6efc20" + "signature": "sha256:5aef1ded8130a6ad407a81d778d6eadb1b5a8dbfd342253951b9a20be5765398" }, "nbformat": 3, "nbformat_minor": 0, @@ -21,7 +21,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:89-90" + "EXAMPLE 3.1 PAGE:89-90" ] }, { @@ -152,7 +152,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:92" + "EXAMPLE 3.2 PAGE:92" ] }, { @@ -173,7 +173,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:93" + "EXAMPLE 3.3 PAGE:93" ] }, { @@ -223,7 +223,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:93" + "EXAMPLE 3.4 PAGE:93" ] }, { @@ -263,7 +263,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:93" + "EXAMPLE 3.5 PAGE:93" ] }, { @@ -312,7 +312,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:94" + "EXAMPLE 3.6 PAGE:94" ] }, { @@ -334,7 +334,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:95" + "EXAMPLE 3.7 PAGE:95" ] }, { @@ -374,7 +374,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:96" + "EXAMPLE 3.8 PAGE:96" ] }, { @@ -424,7 +424,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:98" + "EXAMPLE 3.9 PAGE:98" ] }, { @@ -553,7 +553,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:101" + "EXAMPLE 3.10 PAGE:101" ] }, { @@ -601,7 +601,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:101" + "EXAMPLE 3.11 PAGE:101" ] }, { @@ -650,7 +650,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:101" + "EXAMPLE 3.12 PAGE:101" ] }, { @@ -699,7 +699,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:102" + "EXAMPLE 3.13 PAGE:102" ] }, { @@ -749,7 +749,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:103" + "EXAMPLE 3.14 PAGE:103" ] }, { @@ -791,7 +791,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:104-105" + "EXAMPLE 3.15 PAGE:104-105" ] }, { @@ -883,7 +883,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:105" + "EXAMPLE 3.16 PAGE:105" ] }, { @@ -975,7 +975,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:105-106" + "EXAMPLE 3.17 PAGE:105-106" ] }, { @@ -1066,7 +1066,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:106" + "EXAMPLE 3.18 PAGE:106" ] }, { @@ -1119,7 +1119,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:107" + "EXAMPLE 3.19 PAGE:107" ] }, { @@ -1553,7 +1553,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:108" + "EXAMPLE 3.20 PAGE:108" ] }, { diff --git a/ANSI_C_Programming/chapter4.ipynb b/ANSI_C_Programming/chapter4.ipynb index 3a15cce2..dbc56c16 100644 --- a/ANSI_C_Programming/chapter4.ipynb +++ b/ANSI_C_Programming/chapter4.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:c88e4872fc4418c2962652967a7ca0a93c345eb9f3bd38488ba817f74e5fc2eb" + "signature": "sha256:96a5edc06252e6c7317233539cfc32b4bdad4f858379c6746a8df58eb15aba24" }, "nbformat": 3, "nbformat_minor": 0, @@ -21,7 +21,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:126" + "EXAMPLE 4.1 PAGE:126" ] }, { @@ -57,7 +57,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:128" + "EXAMPLE 4.2 PAGE:128" ] }, { @@ -93,7 +93,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:128-129" + "EXAMPLE 4.3 PAGE:128-129" ] }, { @@ -129,7 +129,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:129-130" + "EXAMPLE 4.4 PAGE:129-130" ] }, { @@ -187,7 +187,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:130" + "EXAMPLE 4.5 PAGE:130" ] }, { @@ -248,7 +248,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:133" + "EXAMPLE 4.6 PAGE:133" ] }, { @@ -301,7 +301,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:134-135" + "EXAMPLE 4.7 PAGE:134-135" ] }, { diff --git a/ANSI_C_Programming/chapter5.ipynb b/ANSI_C_Programming/chapter5.ipynb index 6e2f2667..ec1588c4 100644 --- a/ANSI_C_Programming/chapter5.ipynb +++ b/ANSI_C_Programming/chapter5.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:2cf0a369761f6b9850c2adad43b1edd33ca8cbea4df08e2e06de2898a570851d" + "signature": "sha256:e17bf1d87d84651890e121c02b22aaef4cdd46cbf0defb5af6add7476223ce00" }, "nbformat": 3, "nbformat_minor": 0, @@ -21,7 +21,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:144" + "EXAMPLE 5.1 PAGE:144" ] }, { @@ -55,7 +55,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:146" + "EXAMPLE 5.2 PAGE:146" ] }, { @@ -99,7 +99,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:147" + "EXAMPLE 5.3 PAGE:147" ] }, { @@ -149,7 +149,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:148" + "EXAMPLE 5.4 PAGE:148" ] }, { @@ -173,7 +173,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:149" + "EXAMPLE 5.5 PAGE:149" ] }, { @@ -207,7 +207,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:149" + "EXAMPLE 5.6 PAGE:149" ] }, { @@ -243,7 +243,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:151-152" + "EXAMPLE 5.7 PAGE:151-152" ] }, { @@ -311,7 +311,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:153" + "EXAMPLE 5.8 PAGE:153" ] }, { @@ -362,7 +362,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:154" + "EXAMPLE 5.9 PAGE:154" ] }, { @@ -398,7 +398,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:155" + "EXAMPLE 5.10 PAGE:155" ] }, { @@ -434,7 +434,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:158-159" + "EXAMPLE 5.11 PAGE:158-159" ] }, { @@ -484,7 +484,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:161" + "EXAMPLE 5.12 PAGE:161" ] }, { @@ -517,7 +517,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:161" + "EXAMPLE 5.13 PAGE:161" ] }, { @@ -553,7 +553,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:162" + "EXAMPLE 5.14 PAGE:162" ] }, { @@ -602,7 +602,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:164" + "EXAMPLE 5.15 PAGE:164" ] }, { @@ -667,7 +667,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:166" + "EXAMPLE 5.16 PAGE:166" ] }, { @@ -704,7 +704,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE-167" + "EXAMPLE 5.17 PAGE-167" ] }, { @@ -739,7 +739,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:167-168" + "EXAMPLE 5.18 PAGE:167-168" ] }, { @@ -794,7 +794,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:169" + "EXAMPLE 5.19 PAGE:169" ] }, { @@ -846,7 +846,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:170" + "EXAMPLE 5.20 PAGE:170" ] }, { @@ -899,7 +899,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:173" + "EXAMPLE 5.21 PAGE:173" ] }, { @@ -934,7 +934,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:175-176" + "EXAMPLE 5.22 PAGE:175-176" ] }, { diff --git a/ANSI_C_Programming/chapter6.ipynb b/ANSI_C_Programming/chapter6.ipynb index 08372811..bdeafb19 100644 --- a/ANSI_C_Programming/chapter6.ipynb +++ b/ANSI_C_Programming/chapter6.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:16010659f0ef4e7689cf0cba4bf13a7155f0a2c561ad3c2947d5e5c9a18c6603" + "signature": "sha256:5d388a78001395c4ac0a5f81c0e570d2590a3825f4e8b86e7bf90249b99755a8" }, "nbformat": 3, "nbformat_minor": 0, @@ -21,7 +21,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:199" + "EXAMPLE 6.1 PAGE:199" ] }, { @@ -54,7 +54,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:199" + "EXAMPLE 6.2 PAGE:199" ] }, { @@ -1147,7 +1147,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:200-201" + "EXAMPLE 6.3 PAGE:200-201" ] }, { @@ -1316,7 +1316,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:205" + "EXAMPLE 6.4 PAGE:205" ] }, { @@ -1356,7 +1356,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:205" + "EXAMPLE 6.5 PAGE:205" ] }, { @@ -1398,7 +1398,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:206" + "EXAMPLE 6.6 PAGE:206" ] }, { @@ -1446,7 +1446,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:208" + "EXAMPLE 6.7 PAGE:208" ] }, { @@ -1485,7 +1485,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:208" + "EXAMPLE 6.8 PAGE:208" ] }, { @@ -1529,7 +1529,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:209" + "EXAMPLE 6.9 PAGE:209" ] }, { @@ -1562,7 +1562,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:210" + "EXAMPLE 6.10 PAGE:210" ] }, { @@ -1612,7 +1612,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:211" + "EXAMPLE 6.11 PAGE:211" ] }, { @@ -1646,7 +1646,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:211" + "EXAMPLE 6.12 PAGE:211" ] }, { @@ -1685,7 +1685,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:212-213" + "EXAMPLE 6.13 PAGE:212-213" ] }, { diff --git a/ANSI_C_Programming/chapter7.ipynb b/ANSI_C_Programming/chapter7.ipynb index ad0fddd9..9f9dc611 100644 --- a/ANSI_C_Programming/chapter7.ipynb +++ b/ANSI_C_Programming/chapter7.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:c550564369c57fef1a3abbaae1e7e03e923c7091530a87d2bf35262354fa8d51" + "signature": "sha256:fd1ec3e67c48545fd52fb25c4fd9a7e9a12e0059838ac22b42a8d78165b23bc7" }, "nbformat": 3, "nbformat_minor": 0, @@ -21,7 +21,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:226" + "EXAMPLE 7.1 PAGE:226" ] }, { @@ -101,7 +101,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:227" + "EXAMPLE 7.2 PAGE:227" ] }, { @@ -134,7 +134,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:229" + "EXAMPLE 7.3 PAGE:229" ] }, { @@ -173,7 +173,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:229" + "EXAMPLE 7.4 PAGE:229" ] }, { @@ -210,7 +210,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:230" + "EXAMPLE 7.5 PAGE:230" ] }, { @@ -245,7 +245,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:230" + "EXAMPLE 7.6 PAGE:230" ] }, { @@ -283,7 +283,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:231" + "EXAMPLE 7.7 PAGE:231" ] }, { @@ -319,7 +319,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:231" + "EXAMPLE 7.8 PAGE:231" ] }, { @@ -370,7 +370,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:232" + "EXAMPLE 7.9 PAGE:232" ] }, { @@ -402,7 +402,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:233" + "EXAMPLE 7.10 PAGE:233" ] }, { @@ -463,7 +463,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:236-237" + "EXAMPLE 7.11 PAGE:236-237" ] }, { @@ -502,7 +502,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:237" + "EXAMPLE 7.12 PAGE:237" ] }, { @@ -536,7 +536,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:238" + "EXAMPLE 7.13 PAGE:238" ] }, { @@ -570,7 +570,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:239" + "EXAMPLE 7.14 PAGE:239" ] }, { @@ -608,7 +608,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:239" + "EXAMPLE 7.15 PAGE:239" ] }, { @@ -643,7 +643,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:239-240" + "EXAMPLE 7.16 PAGE:239-240" ] }, { @@ -677,7 +677,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:241" + "EXAMPLE 7.17 PAGE:241" ] }, { @@ -718,7 +718,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:242" + "EXAMPLE 7.18 PAGE:242" ] }, { diff --git a/ANSI_C_Programming/chapter8.ipynb b/ANSI_C_Programming/chapter8.ipynb index 50b1b566..3aa4ab20 100644 --- a/ANSI_C_Programming/chapter8.ipynb +++ b/ANSI_C_Programming/chapter8.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:7a02054929dffb84c1e468572cd4b1d9ed109e9267a67821f68ad3b293946118" + "signature": "sha256:63d98a76fa221452c843fc747bf812d410d5c88883bcf929378197f7a8e2c888" }, "nbformat": 3, "nbformat_minor": 0, @@ -21,7 +21,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:256" + "EXAMPLE 8.1 PAGE:256" ] }, { @@ -52,7 +52,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:257-258" + "EXAMPLE 8.2 PAGE:257-258" ] }, { @@ -541,7 +541,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:261" + "EXAMPLE 8.3 PAGE:261" ] }, { @@ -565,7 +565,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:261-262" + "EXAMPLE 8.4 PAGE:261-262" ] }, { @@ -603,7 +603,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:263" + "EXAMPLE 8.5 PAGE:263" ] }, { @@ -643,7 +643,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:263-264" + "EXAMPLE 8.6 PAGE:263-264" ] }, { @@ -705,7 +705,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:265" + "EXAMPLE 8.7 PAGE:265" ] }, { @@ -737,7 +737,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:266" + "EXAMPLE 8.8 PAGE:266" ] }, { @@ -772,7 +772,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:267" + "EXAMPLE 8.9 PAGE:267" ] }, { @@ -820,7 +820,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:268" + "EXAMPLE 8.10 PAGE:268" ] }, { @@ -868,7 +868,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:268" + "EXAMPLE 8.11 PAGE:268" ] }, { @@ -917,7 +917,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:270" + "EXAMPLE 8.12 PAGE:270" ] }, { @@ -960,7 +960,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:271" + "EXAMPLE 8.13 PAGE:271" ] }, { @@ -1015,7 +1015,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:272" + "EXAMPLE 8.14 PAGE:272" ] }, { @@ -1148,7 +1148,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:275" + "EXAMPLE 8.15 PAGE:275" ] }, { @@ -1185,7 +1185,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:277" + "EXAMPLE 8.16 PAGE:277" ] }, { @@ -1232,7 +1232,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:277-278" + "EXAMPLE 8.17 PAGE:277-278" ] }, { @@ -1284,7 +1284,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:279-280" + "EXAMPLE 8.18 PAGE:279-280" ] }, { @@ -1321,7 +1321,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:281-282" + "EXAMPLE 8.19 PAGE:281-282" ] }, { @@ -1368,7 +1368,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:282" + "EXAMPLE 8.20 PAGE:282" ] }, { diff --git a/ANSI_C_Programming/chapter9.ipynb b/ANSI_C_Programming/chapter9.ipynb index 54eec269..1e3d0538 100644 --- a/ANSI_C_Programming/chapter9.ipynb +++ b/ANSI_C_Programming/chapter9.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:d543de519ea53ce295e62c624f3b779f3394a58f64540659aef438fffab60f98" + "signature": "sha256:836381c04892d46b0831f1159108d08f97f21fb1cd4da3a5ebe385abe6119124" }, "nbformat": 3, "nbformat_minor": 0, @@ -21,7 +21,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:311" + "EXAMPLE 9.1 PAGE:311" ] }, { @@ -55,7 +55,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:311-312" + "EXAMPLE 9.2 PAGE:311-312" ] }, { @@ -89,7 +89,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:312" + "EXAMPLE 9.3 PAGE:312" ] }, { @@ -125,7 +125,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:313" + "EXAMPLE 9.4 PAGE:313" ] }, { @@ -154,7 +154,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:313" + "EXAMPLE 9.5 PAGE:313" ] }, { @@ -200,7 +200,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:314" + "EXAMPLE 9.6 PAGE:314" ] }, { @@ -247,7 +247,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:315" + "EXAMPLE 9.7 PAGE:315" ] }, { @@ -270,7 +270,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:316" + "EXAMPLE 9.8 PAGE:316" ] }, { @@ -293,7 +293,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:317" + "EXAMPLE 9.9 PAGE:317" ] }, { @@ -328,7 +328,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:317-318" + "EXAMPLE 9.10 PAGE:317-318" ] }, { @@ -369,7 +369,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:319" + "EXAMPLE 9.11 PAGE:319" ] }, { @@ -404,7 +404,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:319-320" + "EXAMPLE 9.12 PAGE:319-320" ] }, { @@ -444,7 +444,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:321" + "EXAMPLE 9.13 PAGE:321" ] }, { @@ -492,7 +492,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:322" + "EXAMPLE 9.14 PAGE:322" ] }, { @@ -527,7 +527,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:322-323" + "EXAMPLE 9.15 PAGE:322-323" ] }, { @@ -561,7 +561,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:323-324" + "EXAMPLE 9.16 PAGE:323-324" ] }, { @@ -620,7 +620,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:327" + "EXAMPLE 9.17 PAGE:327" ] }, { @@ -664,7 +664,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE-328" + "EXAMPLE 9.18 PAGE-328" ] }, { @@ -700,7 +700,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:329" + "EXAMPLE 9.19 PAGE:329" ] }, { @@ -816,7 +816,7 @@ "level": 2, "metadata": {}, "source": [ - "EXAMPLE ON PAGE:329-330" + "EXAMPLE 9.20 PAGE:329-330" ] }, { diff --git a/A_Comprehensive_Textbook_Of_Applied_Physics_/.ipynb_checkpoints/Chapter1-checkpoint.ipynb b/A_Comprehensive_Textbook_Of_Applied_Physics_/.ipynb_checkpoints/Chapter1-checkpoint.ipynb new file mode 100644 index 00000000..1cb4536f --- /dev/null +++ b/A_Comprehensive_Textbook_Of_Applied_Physics_/.ipynb_checkpoints/Chapter1-checkpoint.ipynb @@ -0,0 +1,504 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:b9d3600de62f2e313ebd68d87880d0cad19ed95bdfc9a86e635db985c6359259" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "UNIT-1:Waves & Vibrations" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:1.1,Page no:11" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "#Variable declaration\n", + "n=512 #frequency in Hz\n", + "l=67 #wavelength in cm\n", + "\n", + "#Calculation\n", + "v=n*l #calculating velocity\n", + "\n", + "#Result\n", + "print\"Velocity = \",v,\" cm/sec\" \n", + "print\"NOTE:Calculation mistake in book\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Velocity = 34304 cm/sec\n", + "NOTE:Calculation mistake in book\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:1.2,Page no:11" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "#Variable declaration\n", + "v=340 #velocity in m/sec\n", + "l=0.68 #wavelength in m\n", + "\n", + "#Calculation\n", + "n=v/l #calculating frequency\n", + "\n", + "#Result\n", + "print\"Frequency\",n,\"Hz\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Frequency 500.0 Hz\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:1.3,Page no:12" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "#Variable declaration\n", + "v=3*10**8 #velocity in m/sec\n", + "n=500*10**3 #frequency in Hz\n", + "\n", + "#Calculation\n", + "l=v/n #calculating wavelength\n", + "\n", + "#Result\n", + "print\"Wavelength=\",l,\"m\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Wavelength= 600 m\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:1.4,Page no:12" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "#Variable declaration\n", + "v=330 #velocity in m/sec\n", + "n=560.0 #frequency in Hz\n", + "\n", + "#Calculation\n", + "lamda=v/n #calculating wavelength\n", + "\n", + "#Result\n", + "print\"lambda=\",round(lamda,3),\"m\"\n", + "print\"Distance travelled in 30 vibrations in m = \",round(lamda*30,2),\"m\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "lambda= 0.589 m\n", + "Distance travelled in 30 vibrations in m = 17.68 m\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:1.5,Page no:12" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "#Variable declaration\n", + "s=90.0 #distance in m\n", + "u=0 #initial velocity in m/sec\n", + "\n", + "#Calculation\n", + "t=math.sqrt(90/4.9) #calculating time using kinematical equation\n", + "later=4.56 #Time after which sound is heard\n", + "t1=later-t #calculating time taken by sound to travel\n", + "t1=round(t1,2)\n", + "v=s/t1 #calculating velocity\n", + "\n", + "#Result\n", + "print\"Velocity in m/sec = \",round(v,2),\"m/s\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Velocity in m/sec = 333.33 m/s\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:1.6,Page no:13" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "#Variable declaration\n", + "l1=1.5 #wavelength in m\n", + "l2=2 #wavelength in m\n", + "v1=120 #velocity in m/sec\n", + "\n", + "#Calculation\n", + "n=v1/l1 #calculating frequency\n", + "v2=n*l2 #calculating velocity\n", + "\n", + "#Result\n", + "print\"Velocity in m/sec = \",v2,\"m/sec\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Velocity in m/sec = 160.0 m/sec\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:1.7,Page no:14" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "#Variable declaration\n", + "l=5641*10**-10 #wavelength in m\n", + "c=3*10**8 #velocity in m/sec\n", + "u=1.58 #refractive index of glass\n", + "\n", + "#Calculation\n", + "n=c/l #calculating frequency\n", + "cg=c/u #calculating velocity of light in glass\n", + "l1=cg/n #calculating wavelegth in glass\n", + "\n", + "#Result\n", + "print\"Wavelength in glass in Angstrom =\",l1*10**10,\"Angstrom\" \n", + "print\"\\n\\nNOTE:Calculation ambiguity in book,value of cg is taken as 1.9*10**8 ,Therefore final answer is changed\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Wavelength in glass in Angstrom = 3570.25316456 Angstrom\n", + "\n", + "\n", + "NOTE:Calculation ambiguity in book,value of cg is taken as 1.9*10**8 ,Therefore final answer is changed\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:1.8,Page no:15" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "#Variable declaration\n", + "n=12*10**6 #frequency in Hz\n", + "v=3*10**8 #velocity in m/sec\n", + "\n", + "#Calculation\n", + "l=v/n #calculating wavelength\n", + "\n", + "#Result\n", + "print\"Wavelength in m = \",l,\"m\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Wavelength in m = 25 m\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:1.9,Page no:15" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "#Variable declaration\n", + "n=400 #frequency in Hz\n", + "v=300.0 #velocity in m/sec\n", + "\n", + "#Calculation\n", + "l=v/n #calculating wavelength\n", + "\n", + "#Result\n", + "print\"Wavelength=\",l,\"m\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Wavelength= 0.75 m\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:1.10,Page no:22" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "#Variable declaration\n", + "a=20 #amplitude in cm\n", + "n=6 #frequency per second\n", + "\n", + "#Calculation\n", + "w=2*(math.pi)*n #omega in radians/sec\n", + "\n", + "#Result\n", + "print\"Omega in radians/sec = \",round(w,1),\"rad/sec\" \n", + "print\"y=\",a,\"sin\",round(w,1),\"t\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Omega in radians/sec = 37.7 rad/sec\n", + "y= 20 sin 37.7 t\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:1.11,Page no:23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "#Variable declaration\n", + "a=6 #amplitude in cm\n", + "n=9 #frequency in Hz.\n", + "\n", + "#Calculation\n", + "vmax=2*(math.pi)*n*6 #calculating velocity in cm/sec\n", + "acc=-((18*(math.pi))**2)*6 #calculating acc. in m/sec square\n", + "\n", + "#Result\n", + "print\"Maximum velocity in cm/sec = \",round(vmax,2),\"cm/sec\" \n", + "print\"Velocity at extreme position = 0\" \n", + "print\"Accelaration at mean position = 0\" \n", + "print\"Accelaration at extreme position = \",round(acc,1),\"m/sec^2\" \n", + "print\"\\n\\nNOTE:Calculation mistake in book\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum velocity in cm/sec = 339.29 cm/sec\n", + "Velocity at extreme position = 0\n", + "Accelaration at mean position = 0\n", + "Accelaration at extreme position = -19186.5 m/sec^2\n", + "\n", + "\n", + "NOTE:Calculation mistake in book\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:1.12,Page no:26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "g=9.8 #gravitational constant\n", + "m=50 #mass in kg\n", + "l=0.2 #length in m\n", + "T=0.6 #time period\n", + "\n", + "#Calculation\n", + "k=(m*g)/l #calculating constant\n", + "m=2450*((T/(2*(math.pi)))**2) #calcualting mass using given time period\n", + "\n", + "#Result\n", + "print\"Mass of body= \",round(m,2),\"kg\" \n", + "print\"Weight of suspended body=\",round(m,2)*g,\"N\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass of body= 22.34 kg\n", + "Weight of suspended body= 218.932 N\n" + ] + } + ], + "prompt_number": 12 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Comprehensive_Textbook_Of_Applied_Physics_/.ipynb_checkpoints/Chapter2-checkpoint.ipynb b/A_Comprehensive_Textbook_Of_Applied_Physics_/.ipynb_checkpoints/Chapter2-checkpoint.ipynb new file mode 100644 index 00000000..b50ddf47 --- /dev/null +++ b/A_Comprehensive_Textbook_Of_Applied_Physics_/.ipynb_checkpoints/Chapter2-checkpoint.ipynb @@ -0,0 +1,339 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:bc446a4cb1141cc1fc3a73e237c82b9c455db1185763ba734b760bbf57d3288c" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "UNIT-2:Application of Sound Waves" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:2.1,Page no:41" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "v=3000 #volume in metre cube.\n", + "theta=0.2 #theta in owu(open window unit).\n", + "s=1850 #area in metre cube.\n", + "\n", + "#Calculation\n", + "a=theta*s #calculating total absorbtion of surface.\n", + "T=(0.165*v)/a #calculating T using Sabine formula\n", + "\n", + "#Result\n", + "print\"Reverberation time of Room = \",round(T,2) ,\"sec\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Reverberation time of Room = 1.34 sec\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:2.2,Page no:41" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "v=120000 #volume in metre cube.\n", + "t=1.5 #time in second.\n", + "s=25000 #area in metre cube.\n", + "\n", + "#Calculation\n", + "a=(0.16*v)/(t*s) #using Sabine formula for calculating a\n", + "\n", + "#Variable declaration\n", + "print\"Average Absorbing Power of Surface = \",a,\"o w u\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Average Absorbing Power of Surface = 0.512 o w u\n" + ] + } + ], + "prompt_number": 39 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:2.3,Page no:42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "v=6000.0 #Volume in metre cube.\n", + "a=20.0 #surface absorbtion in owu(open window unit).\n", + "\n", + "#Calculation\n", + "T=(0.165*v)/(a) #calculating T using Sabine Formula.\n", + "\n", + "#Result\n", + "print\"Reverberation Time = \",T,\"sec\"\n", + "print\"\\nNOTE:Calculation mistake in book\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Reverberation Time = 49.5 sec\n", + "\n", + "NOTE:Calculation mistake in book\n" + ] + } + ], + "prompt_number": 37 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:2.4,Page no:42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "v=3500 #volume in metre cube.\n", + "n1=370-300 #no. of audience on wooden seats.\n", + "n2=300-70 #no. of empty wooden seats.\n", + "\n", + "#Calculation\n", + "a1s1=0.04*60 #absorption due to wooden doors.\n", + "a2s2=0.03*700 #absorption due to plastered walls.\n", + "a3s3=0.06*50 #absorption due to glass work.\n", + "a4s4=4.2*370 #absorption due to audience on spungy and wooden \n", + "#seats.\n", + "a5s5=2*230 #absorption due to empty seats.\n", + "sum=a1s1+a2s2+a3s3+a4s4+a5s5 #total absorption of cinema hall.\n", + "T=(0.165*v)/sum #calculating T using Sabine Formula.\n", + "\n", + "#Result\n", + "print\"Reverberation Time = \",round(T,2),\"sec\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Reverberation Time = 0.28 sec\n" + ] + } + ], + "prompt_number": 40 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:2.5,Page no:49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable declaration\n", + "l=10 #length in centimetres.\n", + "Y=20*10**11 #Young's Modulus in dyne/cm square.\n", + "R=8 #Density in gram/cc\n", + "\n", + "#Calculation\n", + "n=(1.0/(2*l))*math.sqrt(Y/R) #calculating frequency of vibration using \n", + "#young's modulus.\n", + "\n", + "#Result\n", + "print\"Frequency of vibration=\",n,\"Hz\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Frequency of vibration= 25000.0 Hz\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:2.6,Page no:50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#Variable declaration\n", + "t=0.1 #thickness in centimetre.\n", + "Y=8.75*10**11 #Young's Modulus in dyne/cm square.\n", + "R=2.654 #Density in gram/cm square.\n", + "\n", + "#Calculation\n", + "n=(1/(2*t))*math.sqrt(Y/R) #calculating frequency using Young's modulus.\n", + "\n", + "#Result\n", + "print\"Frequency of Vibration=\",round(n),\"Hz\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Frequency of Vibration= 2870936.0 Hz\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:2.7,Page no:50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "K=2.026*10**9 #Bulk Modulus in N/m square.\n", + "R=10**3 #Density in Kg/m cube.\n", + "\n", + "#Calculation\n", + "V=math.sqrt(K/R) #Calculating speed using Bulk Modulus.\n", + "\n", + "#Result\n", + "print\"Velocity of sound waves in water = \",round(V,2),\"m/sec\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Velocity of sound waves in water = 1423.38 m/sec\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:2.8,Page no:51" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable declaration\n", + "Y=1.41 #Young's Modulus.\n", + "R=1.293*10**-3 #Density of air in g/centimetre cube.\n", + "P=76*13.6*980 #atmospheric pressure in dyne/cm square.\n", + "\n", + "#Calculation\n", + "V=math.sqrt((Y*P)/R) #calculating speed using young's modulus.\n", + "\n", + "#Result\n", + "print\"Speed of ultrasonic wave in air at n.t.p=\",round(V*10**-2,1),\"m/sec\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Speed of ultrasonic wave in air at n.t.p= 332.4 m/sec\n" + ] + } + ], + "prompt_number": 16 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Comprehensive_Textbook_Of_Applied_Physics_/.ipynb_checkpoints/Chapter3-checkpoint.ipynb b/A_Comprehensive_Textbook_Of_Applied_Physics_/.ipynb_checkpoints/Chapter3-checkpoint.ipynb new file mode 100644 index 00000000..147c1c8d --- /dev/null +++ b/A_Comprehensive_Textbook_Of_Applied_Physics_/.ipynb_checkpoints/Chapter3-checkpoint.ipynb @@ -0,0 +1,605 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:040e38e52e7b9682cfcedeffe89e523ef70aa22db1a3d6616f3de2ca6dd532ec" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "UNIT-3:Principle of Optics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:3.1,Page no:69" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "f=15.0 #focal length in cm\n", + "v=10.0 #image distance in cm\n", + "\n", + "#Calculation\n", + "u=1/((1/v)-(1/f)) #calculating u using (1/f)=(1/v)-(1/u)\n", + "\n", + "#Result\n", + "print\"Object Distance ,u= \",u,\"cm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Object Distance ,u= 30.0 cm\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:3.2,Page no:70" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "f=80.0 #focal length in cm\n", + "f1=20.0 #focallength of first lens in cm\n", + "\n", + "#Calculation\n", + "f2=1/((1/f)-(1/f1)) #using (1/F)=(1/f1)+(1/f2)\n", + "P=(100.0/f) #power in D\n", + "P1=100.0/20 #power of first lens\n", + "P2=P1-P #power in D\n", + "\n", + "#Variable declaration\n", + "print\"Power= \",P2,\"D\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Power= 3.75 D\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:3.3,Page no:71" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "P=2.5 #Power in D\n", + "\n", + "#Calculation\n", + "f=-(1/P) #calculating f in m\n", + "\n", + "#Result\n", + "print\"Focal length =\",f,\"m\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Focal length = -0.4 m\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:3.4,Page no:72" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "m=4 #magnigication\n", + "f=20 #focal length in cm\n", + "\n", + "#Calculation\n", + "u=(20*3)/(4) #on simplifying (1/f)=(1/v)-(1/u)\n", + "v=(4*u) #calculating v in cm\n", + "\n", + "#Result\n", + "print\"Object distance,u= \",u,\"cm\" \n", + "print\"Image distance,v= \",v,\"cm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Object distance,u= 15 cm\n", + "Image distance,v= 60 cm\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:3.5,Page no:72" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from scipy.optimize import fsolve \n", + "\n", + "#Variable declaration\n", + "u=14.0 #object distance in cm\n", + "f=-21.0 #focal distance in cm\n", + "\n", + "#Calculation\n", + "v=1/((1/f)-(1/u))\n", + "I=(3.0*v)/(-u) #using m=(1/0)=(v/u) \n", + "\n", + "#Result\n", + "print\"Image distance= \",v,\"cm\" \n", + "print\"I= \",I,\"cm\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Image distance= -8.4 cm\n", + "I= 1.8 cm\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:3.6,Page no:79" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "fe=5 #focal length in cm\n", + "D=25 #distance od distinct vision in cm\n", + "\n", + "#Calculation\n", + "m=1+(D/fe) #calculating magnifying power\n", + "\n", + "#Result\n", + "print\"magnifying Power = \",m " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "magnifying Power = 6\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:3.7,Page no:80" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "fe=5 #focal length in cm\n", + "D=25 #distance od distinct vision in cm\n", + "\n", + "#Calculation\n", + "mo=30/(1+(D/fe)) #calculating magnification of objective lens\n", + "\n", + "#Result\n", + "print\"Magnification produced by objective lens = \",mo " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Magnification produced by objective lens = 5\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:3.8,Page no:80" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "u=-6.0 #object distance in cm\n", + "fo=4.0 #focal distance in cm\n", + "fe=6.0 #focal length in cm\n", + "D=25.0 #distance of distinct vision in cm\n", + "\n", + "#Calculation\n", + "v=1/((1/u)+(1/fo)) #using (1/f)=(1/v)-(1/u)\n", + "m=(v/u)*(1+(D/fe)) #calculating m\n", + "\n", + "#Result\n", + "print\"Image distance in cm = \",v,\"cm\" \n", + "print\"Magnifying Power = \",round(-m,2) " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Image distance in cm = 12.0 cm\n", + "Magnifying Power = 10.33\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:3.9,Page no:81" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "D=25.0 #distance of distinct vision\n", + "u=-9.0 #object distance in cm\n", + "fe=10.0 #focal length in cm\n", + "\n", + "#Calculation\n", + "v=1/((1/fe)+(1/u)) #using (1/f)=(1/v)-(1/u)\n", + "m=(v/u) #calculating m\n", + "M=D/u #calculating Magnifying power of lens\n", + "\n", + "#Result\n", + "print\"Magnification of lens = \",m \n", + "print\"Magnifying Power = \",round(-M,1) " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Magnification of lens = 10.0\n", + "Magnifying Power = 2.8\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:3.10,Page no:82" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "fo=0.5 #focal length of eye lens\n", + "D=25 #distance of distinct vision\n", + "L=15 #length in cm\n", + "m=375 #magnification\n", + "\n", + "#Calculation\n", + "fe=(-L*D)/(fo*((L/fo)-m)) #calculating fe\n", + "\n", + "#Result\n", + "print\"Focal length of eye lens= \",round(fe,1),\"cm\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Focal length of eye lens= 2.2 cm\n" + ] + } + ], + "prompt_number": 33 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:3.11,Page no:86" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "m=5 #magnifying power\n", + "L=24 #length in cm\n", + "fe=4 #focal length in cm\n", + "\n", + "#Calculation\n", + "fo=5*fe #calculating fo\n", + "\n", + "#Result\n", + "print\"Focal length of lens = \",fo,\"cm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Focal length of lens = 20 cm\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:3.12,Page no:87" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "D=25.0 #distance of distinct vision in cm\n", + "fo=140.0 #focal length of eye lens\n", + "fe=5.0 #focal length in cm\n", + "\n", + "#Calculation\n", + "m=-(fo/fe) #calculating magnifying power\n", + "m1=-(fo/fe)*(1+(fe/D)) #calculating magnifying power\n", + "\n", + "#Result\n", + "print\"(a):Magnifying power at normal adjustment = \",m\n", + "print\"(b):Magnifying power atleast distance of distinct vision = \",m1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a):Magnifying power at normal adjustment = -28.0\n", + "(b):Magnifying power atleast distance of distinct vision = -33.6\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:3.13,Page no:88" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "M=5 #Magnifying power\n", + "fo=10 #focal length of eye lens\n", + "\n", + "#Calculation\n", + "fe=fo/M #calculating fe\n", + "\n", + "#Result\n", + "print\"Focal length of eye lens= \",fe,\"cm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Focal length of eye lens= 2 cm\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:3.14,Page no:88" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration \n", + "fo=75.0 #focal length of eye lens\n", + "D=25.0 #distance of distinct vision\n", + "fe=5.0 #focal of eye lens in cm\n", + "\n", + "#Calculation\n", + "M=-(fo/fe)*(1+(fe/D)) #calculating M\n", + "\n", + "#Result\n", + "print\"Magnifying power = \",M" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Magnifying power = -18.0\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:3.15,Page no:88" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "M=7 #magnifying power\n", + "L=40 #length\n", + "\n", + "#Calculation\n", + "fe=(L/(M+1)) #focal length of eye lens in cm\n", + "fo=(M*fe) #calculating focal length\n", + "\n", + "#Result\n", + "print\"Focal Length of lens=\",fo,\"cm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Focal Length of lens= 35 cm\n" + ] + } + ], + "prompt_number": 13 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Comprehensive_Textbook_Of_Applied_Physics_/.ipynb_checkpoints/Chapter4-checkpoint.ipynb b/A_Comprehensive_Textbook_Of_Applied_Physics_/.ipynb_checkpoints/Chapter4-checkpoint.ipynb new file mode 100644 index 00000000..67ec2ab8 --- /dev/null +++ b/A_Comprehensive_Textbook_Of_Applied_Physics_/.ipynb_checkpoints/Chapter4-checkpoint.ipynb @@ -0,0 +1,1106 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:5389b8ee7db605c2b6709900953f8acf2763d42f0399c64611452653d4ee8704" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "UNIT-4:Electrostatics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:4.1,Page no:103" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "q=1.0 #no of coulomb\n", + "e=1.6*10**-19 #charge on an electron\n", + "\n", + "#Calculation\n", + "n=(q/e) #calculating no of electrons\n", + "\n", + "#Result\n", + "print\"No of electrons =\",n\n", + "print\"NOTE:Calculation mistake in book\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "No of electrons = 6.25e+18\n", + "NOTE:Calculation mistake in book\n" + ] + } + ], + "prompt_number": 32 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:4.2,Page no:103" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "#Variable declaration\n", + "g=9.8\n", + "m=4.5 #Massin [kg]\n", + "r=0.03 #radius in [m]\n", + "\n", + "#Calculation\n", + "F=m*g #in Newton\n", + "q=math.sqrt(((r**2)*m*g)/(9*10**9)) #calculating q using F=(1/4*3.14*eo)*((q1*q2)/(r**2))\n", + "\n", + "#Result\n", + "print\"Charge = \",q,\"C\"\n", + "print\"\\nNOTE:Calculation mistake in book\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Charge = 2.1e-06 C\n", + "\n", + "NOTE:Calculation mistake in book\n" + ] + } + ], + "prompt_number": 36 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:4.3,Page no:103" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "q1=2*10**-7 #charge in C\n", + "q2=3*10**-7 #charge in C\n", + "r=30*10**-2 #r in m\n", + "\n", + "#Calculation\n", + "F=(9*10**9)*((q1*q2)/r**2) #calculating F\n", + "\n", + "#Result\n", + "print\"Force = %.e\"%F,\"N\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Force = 6e-03 N\n" + ] + } + ], + "prompt_number": 70 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:4.4,Page no:104" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "q1=1 #charge in C\n", + "q2=1 #charge in C\n", + "r=1 #r in m\n", + "\n", + "#Calculation\n", + "F=(9*10**9)*((q1*q2)/r**2) #calculating F\n", + "\n", + "#Result\n", + "print\"Force = %.e\"%F,\"N\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Force = 9e+09 N\n" + ] + } + ], + "prompt_number": 71 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:4.5,Page no:104" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "m=9*10**-31 #mass of electron in kg\n", + "q=-3.2*10**-7 #charge in C\n", + "e=-1.6*10**-19 #charge on electron in C\n", + "\n", + "#Calculation\n", + "n=(q/e) #calculating n\n", + "M=n*m #calculating mass transfered\n", + "\n", + "#Result\n", + "print\"(a):No. of electrons = \",n\n", + "print\"(b):Mass transfered to polythene= \",M,\"kg\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a):No. of electrons = 2e+12\n", + "(b):Mass transfered to polythene= 1.8e-18 kg\n" + ] + } + ], + "prompt_number": 50 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:4.6,Page no:105" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration \n", + "q1=1.6*10**-19 #charge in C\n", + "q2=-1.6*10**-19 #charge in C\n", + "r=10**-9 #r in m\n", + "\n", + "#Calculation\n", + "F=(9*10**9)*((q1*q2)/r**2) #calculating F\n", + "\n", + "#Result\n", + "print\"Force=\",F,\"N\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Force= -2.304e-10 N\n" + ] + } + ], + "prompt_number": 54 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:4.7,Page no:110" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration \n", + "Va=-10 #voltage in volts\n", + "W=100 #work in Joule\n", + "q=2 #charge in Coulomb\n", + "\n", + "#Calculation\n", + "v=(Va)+(W/q) #calculating v\n", + "\n", + "#Result\n", + "print\"Voltage = \",v,\"V\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Voltage = 40 V\n" + ] + } + ], + "prompt_number": 55 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:4.8,Page no:111" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "#Variable declaration\n", + "eo=(8.854*10**-12) #constant\n", + "E=2 #magnitude of electric field in N/C\n", + "r=0.5 #r in m\n", + "\n", + "#Calculation\n", + "q=E*4*(math.pi)*(eo)*(r**2) #calculating charge\n", + "\n", + "#Result\n", + "print\"Charge= %.2e\"%q,\"C\"\n", + "print\"\\nNOTE:Calcualtion mistake in book\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Charge= 5.56e-11 C\n", + "\n", + "NOTE:Calcualtion mistake in book\n" + ] + } + ], + "prompt_number": 73 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:4.9,Page no:111" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration \n", + "e=-1.6*10**-19 #charge on electron in Coulomb\n", + "q=20*10**-6 #charge in Coulomb\n", + "r1=0.1 #r1 in m\n", + "r2=0.05 #r2 in m\n", + "\n", + "#Calculation\n", + "Va=9*10**9*(q/r1) #calculating voltage at A\n", + "Vb=9*10**9*(q/r2) #calculating voltage at B\n", + "V=Va-Vb #potential difference\n", + "W=V*e #calculating work done in joule\n", + "\n", + "#Result\n", + "print\"Work done to take the electron from A to B = \",W,\"Joule\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Work done to take the electron from A to B = 2.88e-13 Joule\n" + ] + } + ], + "prompt_number": 69 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:4.10,Page no:112" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration \n", + "q1=(2.0*10**-8) #charge in coulomb\n", + "q2=(-2.0*10**-8) #charge in coulomb\n", + "q3=(3.0*10**-8) #charge in coulomb\n", + "q4=(6.0*10**-8) #charge in coulomb\n", + "s=1.0 #side in m\n", + "\n", + "#Calculation\n", + "V=(9.0*10**9)*(1.0/s)*(q1+q2+q3+q4) #calculating voltage\n", + "\n", + "#Result\n", + "print\"Voltage in Volts = \",V,\"Volts\"\n", + "print\"\\nNOTE:Calculation mistake in book\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Voltage in Volts = 810.0 Volts\n", + "\n", + "NOTE:Calculation mistake in book\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:4.11,Page no:123" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "eo=8.85*10**-12 #constant\n", + "q=2*10**-6 #charge in coulomb\n", + "l=9 #length in cm\n", + "\n", + "#Calculation\n", + "fi=(q/eo) #calcualting flux in (N m square)/c\n", + "\n", + "#Result\n", + "print\"Flux through the surface=%2e\"%fi,\"N m^2/c\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Flux through the surface=2.259887e+05 N m^2/c\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:4.12,Page no:124" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "#Variable declaration\n", + "eo=8.85*10**-12 #constant\n", + "r=1.2 #r in m\n", + "t=80*10**-6 #surface sharge density in c/m square\n", + "\n", + "#Calculation\n", + "q=t*4*(math.pi)*(r**2) #calculating charge\n", + "fi=q/eo #calculating flux\n", + "\n", + "#Result\n", + "print\"Flux=%g\"%fi,\"N c^-1 m^2\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Flux=1.63576e+08 N c^-1 m^2\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:4.13,Page no:124" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "#Variable declaration\n", + "eo=8.85*10**-12 #constant\n", + "E=9*10**4 #Electric field in N/C\n", + "r=2*10**-2 #r in m\n", + "\n", + "#Calculation\n", + "L=2*(math.pi)*E*eo*r #calculating linear charge density\n", + "\n", + "#Result\n", + "print\"Linear charge density = \",round(L,7),\"cm^-1\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Linear charge density = 1e-07 cm^-1\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:4.14,Page no:125" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "o=17*10**-22 #surface charge density in cm**-2\n", + "eo=8.85*10**-12 #constant\n", + "\n", + "#Calculation\n", + "E=o/eo #calculating electric intensity in region III\n", + "\n", + "#Result\n", + "print\"Electric Intensity in regions I and II = 0\" \n", + "print\"Electric Intensity in region III = \",round(E,12),\"N/C\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Electric Intensity in regions I and II = 0\n", + "Electric Intensity in region III = 1.92e-10 N/C\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:4.15,Page no:125" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "#Variable declaration\n", + "r=0.05 # in m\n", + "eo=8.85*10**-12 #constant\n", + "q=10.0**-9 #charge at point P in Coulomb\n", + "\n", + "#Calculation\n", + "E=q/(4*(math.pi)*eo*(r**2)) #calculating electric field\n", + "r1=0.2 #in m\n", + "V1=q/(4*(math.pi)*eo*r1) #calculating potential difference\n", + "\n", + "#Result\n", + "print\"Electric field= \",round(E),\"v/m\"\n", + "print\"\\nNOTE:Approximate answer is calculated in book\\n\\n\"\n", + "print\"Potential difference between two points = \",round(V1),\"V\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Electric field= 3597.0 v/m\n", + "\n", + "NOTE:Approximate answer is calculated in book\n", + "\n", + "\n", + "Potential difference between two points = 45.0 V\n" + ] + } + ], + "prompt_number": 65 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:4.16,Page no:126" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "#Variable declaration\n", + "eo=8.85*10**-12 #constant\n", + "o=80.0*10**-6 #surface charge density in c/ square\n", + "r=1.2 #in m\n", + "\n", + "#Calculation\n", + "q=o*(math.pi)*(r**2) #calculating charge in Coulomb\n", + "fi=q/eo #calculating electric flux\n", + "\n", + "#Result\n", + "print\"Charge= \",q,\"C\"\n", + "print\"Electric flux = \",fi,\"N m^2/c\"\n", + "print\"\\nNOTE:Wrong answers in book\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Charge= 0.000361911473694 C\n", + "Electric flux = 40893951.8298 N m^2/c\n", + "\n", + "NOTE:Wrong answers in book\n", + "\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:4.17,Page no:138" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration \n", + "V=250 #potential difference in Volt\n", + "C=10**-11 #capacitance in farad\n", + "\n", + "#Calculation\n", + "q=C*V #calculating charge\n", + "\n", + "#Result\n", + "print\"Charge = \",q,\"C\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Charge = 2.5e-09 C\n" + ] + } + ], + "prompt_number": 68 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:4.18,Page no:138" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "r=6.4*10**6 #in m\n", + "\n", + "#Calculation\n", + "C=r/(9*10**9) #calculating charge\n", + "\n", + "#Result\n", + "print\"Capacitance = \",round(C*10**6),\"mu F\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Capacitance = 711.0 mu F\n" + ] + } + ], + "prompt_number": 67 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:4.19,Page no:138" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration \n", + "C=2 #capacitance in Farad\n", + "d=0.5*10**-2 #distance in m\n", + "eo=8.85*10**-12 #constant\n", + "\n", + "#Calculation\n", + "A=(C*d)/(eo) #calculating area\n", + "\n", + "#Result\n", + "print\"Area=%.2e\"%A,\"m^2\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Area=1.13e+09 m^2\n" + ] + } + ], + "prompt_number": 66 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:4.20,Page no:139" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "#Variable declaration\n", + "A=0.02 #area in m square\n", + "r=0.5 #r in m\n", + "\n", + "#Calculation\n", + "d=(A/(4*(math.pi)*r)) #calculating distance\n", + "\n", + "#Result\n", + "print\"Distance between the plates = \",round(d*1000,2),\"mm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Distance between the plates = 3.18 mm\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:4.21,Page no:139" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "eo=8.85*10**-12 #constant\n", + "A=1 #area in m square\n", + "d=2*10**-3 #r in m\n", + "K=4 #constant\n", + "\n", + "#Calculation\n", + "C=(K*eo*A)/d #calculating capacitance\n", + "\n", + "#Result\n", + "print\"Capacitance = \",C,\"Farad\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Capacitance = 1.77e-08 Farad\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:4.22,Page no:140" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration \n", + "cm=10*10**-6 #capacitance in Farad\n", + "K=2 #constant\n", + "\n", + "#Calculation\n", + "co=cm/K #calculating co\n", + "\n", + "#Result\n", + "print\"capacity of capacitor with air between the plates= \",co*10**6,\"muF\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "capacity of capacitor with air between the plates= 5.0 muF\n" + ] + } + ], + "prompt_number": 37 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:4.23,Page no:140" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "v=100.0 #v in volt\n", + "c1=8.0*10**-6 #capacitance in Farad\n", + "c2=12.0*10.0**-6 #capacitance in Farad\n", + "c3=24.0*10.0**-6 #capacitance in Farad\n", + "cs=4.0/(10.0**6) #calculating series capacitance\n", + "\n", + "#Calculation\n", + "cp=(c1+c2+c3) #calculating parallel capacitance\n", + "qs=cs*v #calculating charge\n", + "\n", + "#Result\n", + "print\"Equivalent Series capacitance,C= \",cs*10**6,\"muF\"\n", + "print\"Equivalent parallel capacitance,Cp= \",cp*10**6,\"muF\" \n", + "print\"charge on plate=%.e\"%qs,\"C\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Equivalent Series capacitance,C= 4.0 muF\n", + "Equivalent parallel capacitance,Cp= 44.0 muF\n", + "charge on plate=4e-04 C\n" + ] + } + ], + "prompt_number": 48 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:4.24,Page no:141" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "C=9*10**-10 #capacitance in farad\n", + "V=100.0 #in volt\n", + "\n", + "#Calculation\n", + "U=(1/2.0)*(C*(V**2)) #calculating energy stored\n", + "\n", + "#Result\n", + "print\"Energy stored = \",U,\"J\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Energy stored = 4.5e-06 J\n" + ] + } + ], + "prompt_number": 50 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:4.25,Page no:141" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "eo=8.85*10**-12 #constant\n", + "A=90.0*10**-4 #area in m square\n", + "d=2.5*10**-3 #distance in m\n", + "V=400.0 #in volt\n", + "\n", + "#Calculation\n", + "C=(eo*A)/d #calculating capacitance\n", + "W=(1/2.0)*(C*(V**2)) #calculating electrical energy stored\n", + "\n", + "#Result\n", + "print\"Capacitance = \",C,\"Farad\"\n", + "print\"Electrical Energy stored in capacitor =%.2e\"%W,\"J\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Capacitance = 3.186e-11 Farad\n", + "Electrical Energy stored in capacitor =2.55e-06 J\n" + ] + } + ], + "prompt_number": 56 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:4.26,Page no:142" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration \n", + "v=100 #v in volt\n", + "c1=1*10**-6 #capacitance in Farad\n", + "c2=2*10**-6 #capacitance in Farad\n", + "c3=3*10**-6 #capacitance in Farad\n", + "cs=6/11.0 #calculating series capacitance\n", + "\n", + "#Calculation\n", + "cp=(c1+c2+c3) #calculating parallel capacitance\n", + "\n", + "#Result\n", + "print\"Equivalent Series capacitance = \",cs,\"muF\"\n", + "print\"Equivalent parallel capacitance= \",cp*10**6,\"muF\"\n", + "print\"Therefore Cp=(11*Cs)\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Equivalent Series capacitance = 0.545454545455 muF\n", + "Equivalent parallel capacitance= 6.0 muF\n", + "Therefore Cp=(11*Cs)\n" + ] + } + ], + "prompt_number": 60 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:4.27,Page no:143" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration \n", + "eo=8.85*10**-12 #constant\n", + "V=6 #v in volt\n", + "A=25*10**-4 #area in m square\n", + "d=10**-3 #distance in m\n", + "\n", + "#Calculation\n", + "q=(eo*A*V)/d #calculating charge\n", + "W=q*V #calculating work done\n", + "\n", + "#Result\n", + "print\"Charge through battery =%.3g\"%q,\"C\"\n", + "print\"Work done by Battery=%.e\"%W,\"J\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Charge through battery =1.33e-10 C\n", + "Work done by Battery=8e-10 J\n" + ] + } + ], + "prompt_number": 63 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Comprehensive_Textbook_Of_Applied_Physics_/.ipynb_checkpoints/Chapter5-checkpoint.ipynb b/A_Comprehensive_Textbook_Of_Applied_Physics_/.ipynb_checkpoints/Chapter5-checkpoint.ipynb new file mode 100644 index 00000000..581d450b --- /dev/null +++ b/A_Comprehensive_Textbook_Of_Applied_Physics_/.ipynb_checkpoints/Chapter5-checkpoint.ipynb @@ -0,0 +1,1035 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:1f51544adf15fc8ba28e47ac7da1a371a1d8835331773ecfcfa211468f9b325d" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "UNIT-5 Electricity" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:5.1,Page no:152" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "n=10**6 #no. of electrons\n", + "e=1.6*10**-19 #charge on an electron in C\n", + "\n", + "#Calculation\n", + "q=n*e #calculating total charge\n", + "t=10**-3 #time in second\n", + "I=q/t #calculating current\n", + "\n", + "#Result\n", + "print\"Current flowing = \",I,\"Ampere\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Current flowing = 1.6e-10 Ampere\n" + ] + } + ], + "prompt_number": 71 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:5.2,Page no:152" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "I=300*10**-3 #current n Ampere\n", + "t=60 #time in second\n", + "e=1.6*10**-19 #chatge on electron in C\n", + "\n", + "#Calculation\n", + "q=I*t #calculating charge\n", + "n=q/e #calculating no of electrons\n", + "\n", + "#Result\n", + "print\"No. of electrons = \",n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "No. of electrons = 1.125e+20\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:5.3,Page no:154" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "V=200 #voltage in volt\n", + "R=100 #resistance in Ohm\n", + "e=1.6*10**-19 #charge on an electron in C\n", + "\n", + "#Calculation\n", + "I=V/R #Ohm's law\n", + "t=1 #time in second\n", + "q=I*t #calculating charge\n", + "n=q/e #calculating no of electrons\n", + "\n", + "#Result\n", + "print\"No. of electrons = \",n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "No. of electrons = 1.25e+19\n" + ] + } + ], + "prompt_number": 72 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:5.4,Page no:156" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "l=15 #length in m\n", + "A=6*10**-7 #area in m square\n", + "R=5 #resistance in Ohm\n", + "\n", + "#Calculation\n", + "p=(A*R)/l #calculating resistivity\n", + "\n", + "#Result\n", + "print\"Resistivity= \",p,\"Ohm metre\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Resistivity= 2e-07 Ohm metre\n" + ] + } + ], + "prompt_number": 73 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:5.5,Page no:157" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "l=0.1 #length in m\n", + "A=10**-4 #area in m square\n", + "R=0.01 #resistance in Ohm\n", + "\n", + "#Calculation\n", + "p=(A*R)/l #calculating resistivity\n", + "\n", + "#Result\n", + "print\"Resistivity = \",p,\"Ohm metre\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Resistivity = 1e-05 Ohm metre\n" + ] + } + ], + "prompt_number": 74 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:5.6,Page no:157" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "#Variable declaration\n", + "L=1 #length in m\n", + "r=0.2*10**-3 #radius in m\n", + "R=2 #resistance in Ohm\n", + "\n", + "#Calculation\n", + "A=math.pi*(r)**2 #calculating area\n", + "P=(R*A)/L #calculating resistivity\n", + "\n", + "#Result\n", + "print\"Resistivity =%.2g\"%P,\"Ohm.metre\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Resistivity =2.5e-07 Ohm.metre\n" + ] + } + ], + "prompt_number": 38 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:5.7,Page no:158" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "R1=5 #resisitance in Ohm\n", + "\n", + "#Calculation\n", + "#A2=A/3\n", + "#R2/5=3l*3/A*A/l\n", + "#R2=9*5\n", + "\n", + "R2=9*R1 #calculating using R2/A1=(l2/A2)*(A1/l1)\n", + "print\"Resisitance = \",R2,\"Ohm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Resisitance = 45 Ohm\n" + ] + } + ], + "prompt_number": 75 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:5.8,Page no:159" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "R1=5 #resisitance in Ohm\n", + "\n", + "#Calculation\n", + "#A2=A/2\n", + "#R1=rho*l1/A1*R2\n", + "#R2=rho*l2/A2\n", + "#R2/R1=A1/l1\n", + "R2=4*R1 #calculating using R2/A1=(l2/A2)*(A1/l1)\n", + "\n", + "#Result\n", + "print\"Resisitance= \",R2,\"Ohm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Resisitance= 20 Ohm\n" + ] + } + ], + "prompt_number": 70 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:5.9,Page no:162" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "R1=2 #resisitance in Ohm\n", + "R2=4 #resistance in Ohm\n", + "R3=5 #resistance in Ohm\n", + "\n", + "#Calculation\n", + "R=(R1**-1)+(R2**-1)+(R3**-1) #calculating parallel resistance\n", + "Rp=(1/R) \n", + "\n", + "#Result\n", + "print\"Resisitance = \",Rp,\"Ohm\"\n", + "print\"\\nNOTE:Incorrect answer in book\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Resisitance = 1.05263157895 Ohm\n", + "\n", + "NOTE:Incorrect answer in book\n" + ] + } + ], + "prompt_number": 39 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:5.10,Page no:163" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from scipy.optimize import fsolve \n", + "\n", + "#Variable declaration\n", + "Rs=40 #resisitance in Ohm\n", + "\n", + "#Calculation\n", + "#R1+R2=40\n", + "#R1*R2=256\n", + "#R1=256/R2\n", + "#Putting this value in eq 1:\n", + "#(256/R2)+R2=40\n", + "from sympy import solve, symbols, pprint\n", + "R2= symbols('R2')\n", + "a=1\n", + "b=-40\n", + "c=256\n", + "f = a*R2**2 + b*R2 + c\n", + "solution = solve(f, R2)\n", + "\n", + "#Result\n", + "print\"When R2=\",solution[0],\"Ohm R1=\",solution[1],\"Ohm\"\n", + "print\"When R2=\",solution[1],\"Ohm R1=\",solution[0],\"Ohm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "When R2= 8 Ohm R1= 32 Ohm\n", + "When R2= 32 Ohm R1= 8 Ohm\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:5.11,Page no:164" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "V=2.0 #in volts\n", + "R1=30.0 #resisitance in Ohm\n", + "R2=60.0 #resistance in Ohm\n", + "\n", + "#Calculation\n", + "Rp=(R1*R2)/(R1+R2) #calculating parallel resistance\n", + "I=V/Rp #Ohm's law\n", + "\n", + "#Result\n", + "print\"Resisitance = \",Rp,\"Ohm\"\n", + "print\"Current = \",I,\"A\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Resisitance = 20.0 Ohm\n", + "Current = 0.1 A\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:5.12,Page no:165" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "R1=2.0 #resisitance in Ohm\n", + "R2=3.0 #resistance in Ohm\n", + "R3=1.0 #resistance in Ohm\n", + "\n", + "#Calculation\n", + "Rp=(R1*R2)/(R1+R2) #calculating parallel resistance\n", + "R=Rp+1.0 #1 Ohm in series\n", + "Rs=(R1+R2+R3) #series resistances\n", + "Rp=(1.0/R1)+(1.0/R2)+(1.0/R3) #calculating parallel resistance\n", + "\n", + "#Result\n", + "print\"(1)Equivalent Resisitance= \",R,\"Ohm\" \n", + "print\"(2)All resistances in series = \",Rs,\"Ohm\"\n", + "print\"(3)All in Parallel = \",(1/Rp),\"Ohm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(1)Equivalent Resisitance= 2.2 Ohm\n", + "(2)All resistances in series = 6.0 Ohm\n", + "(3)All in Parallel = 0.545454545455 Ohm\n" + ] + } + ], + "prompt_number": 76 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:5.13,Page no:166" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "V=20 #voltage in Volts\n", + "R1=2.0 #resisitance in Ohm\n", + "R2=4.0 #resistance in Ohm\n", + "R3=5.0 #resistance in Ohm\n", + "\n", + "#Calculation\n", + "Rp=(1/R1)+(1/R2)+(1/R3) #calculating parallel resistance\n", + "R=1/Rp #Parallel\n", + "I1=V/R1 #calculating current through R1\n", + "I2=V/R2 #calculating current through R2\n", + "I3=V/R3 #calculating current through R3\n", + "I=V/R #calculating total current\n", + "\n", + "\n", + "#Result\n", + "print\"(a)Equivalent Resisitance = \",R,\"Ohm\"\n", + "print\"Current through R1 = \",I1,\"Ampere\"\n", + "print\"Current through R2 = \",I2,\"Ampere\" \n", + "print\"Total current = \",I,\"Ampere\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)Equivalent Resisitance = 1.05263157895 Ohm\n", + "Current through R1 = 10.0 Ampere\n", + "Current through R2 = 5.0 Ampere\n", + "Total current = 19.0 Ampere\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:5.14,Page no:166" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "R=7 #Total resistanc of combination\n", + "\n", + "#Calculation\n", + "def f(n):\n", + " Rp = 6*(1/n) #resistance in parallel\n", + " return(R-Rp-5)\n", + "n=fsolve(f,1)\n", + "\n", + "#Result\n", + "print\"n=\",n[0]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n= 3.0\n" + ] + } + ], + "prompt_number": 33 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:5.15,Page no:173" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "R1=2 #resistance in Ohm\n", + "R2=6 #resistance in Ohm\n", + "R3=3 #resistance in Ohm\n", + "V=24 #voltage in volts\n", + "R=8 #resistance in Ohm\n", + "\n", + "#Calculation\n", + "I=V/R #Ohm's Law\n", + "V1=I*R1 #Ohm's Law\n", + "V2=I*R2 #Ohm's Law\n", + "V3=I*R3 #Ohm's Law\n", + "\n", + "#Result\n", + "print\"Current = \",I,\"Ampere\" \n", + "print\"Voltage drop across R1 = \",V1,\"Volts\"\n", + "print\"Voltage drop across R2 = \",V2,\"Volts\" \n", + "print\"Voltage drop across R3 = \",V3,\"Volts\"\n", + "print\"\\nNOTE:Wrong answer of R3 in book\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Current = 3 Ampere\n", + "Voltage drop across R1 = 6 Volts\n", + "Voltage drop across R2 = 18 Volts\n", + "Voltage drop across R3 = 9 Volts\n", + "\n", + "NOTE:Wrong answer of R3 in book\n" + ] + } + ], + "prompt_number": 36 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:5.16,Page no:173" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "R=15 #resistance in Ohm\n", + "print\"KVL: 16I1+15I2=6 (1)\" #KVL equation\n", + "I1=-1.66 #from(1)\n", + "I2=2.17 #from (1)\n", + "#Calculation\n", + "V=(I1+I2)*R #calculating potential difference\n", + "\n", + "#Result\n", + "print\"Potential difference= \",V,\"Volt\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "KVL: 16I1+15I2=6 (1)\n", + "Potential difference= 7.65 Volt\n" + ] + } + ], + "prompt_number": 37 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:5.17,Page no:174" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print\"3I1-I2-1=0 (1)\" #KVL equation\n", + "print\"3I1-I2+2I=2 (2)\" #KVL equation\n", + "print\"3I1-I1+2I=2 (3)\" #KVL equation\n", + "\n", + "#Variable declaration\n", + "I1=4/17.0 #from (1)(2)(3)through AB \n", + "I2=-2/17.0 #from (1)(2)(3)through BD\n", + "I=3*I1+I2 #from (1)(2)(3)through main circuit\n", + "\n", + "#Calculation\n", + "Ibc=I1-I2 #calculating current in BC\n", + "Iad=I-I1 #calculating current in AD\n", + "Idc=I-I1+I2 #calculating current in DC\n", + "\n", + "#Result\n", + "print\"Current in branch BC = \",Ibc,\"Ampere\"\n", + "print\"NOTE:Calculation mistake in book while calculating for BC\"\n", + "print\"Current in branch AD = \",Iad,\"Ampere\"\n", + "print\"Current in branch DC = \",Idc,\"Ampere\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "3I1-I2-1=0 (1)\n", + "3I1-I2+2I=2 (2)\n", + "3I1-I1+2I=2 (3)\n", + "Current in branch BC = 0.352941176471 Ampere\n", + "NOTE:Calculation mistake in book while calculating for BC\n", + "Current in branch AD = 0.352941176471 Ampere\n", + "Current in branch DC = 0.235294117647 Ampere\n" + ] + } + ], + "prompt_number": 77 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:5.18,Page no:176" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "P=10 #Ohm\n", + "Q=3 #Ohm\n", + "R=12 #Ohm\n", + "S=6 #Ohm\n", + "G=20 #Ohm\n", + "\n", + "\n", + "#Calculation\n", + "print\"-12I+22I1+IgG=0 (1)\" #KVL\n", + "print\"6I-9I1+29Ig=0 (2)\" #KVL\n", + "print\"13I1-3Ig=2 (3)\" #KVL\n", + "#From above equations\n", + "import numpy as np\n", + "a = np.array([[-12,22,20],[6,-9,29],[0,13,-3]]) \n", + "b = np.array([[0],[0],[2]])\n", + "np.linalg.solve(a,b)\n", + "\n", + "\n", + "#Result\n", + "print\"Current through Galvanometer = \",round(Ig*1000,2),\"mA\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "-12I+22I1+IgG=0 (1)\n", + "6I-9I1+29Ig=0 (2)\n", + "13I1-3Ig=2 (3)\n", + "Current through Galvanometer = 7.8 mA\n" + ] + } + ], + "prompt_number": 78 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:5.19,Page no:179" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration \n", + "P=500 #power in Watts\n", + "V=200 #voltage in Volts\n", + "V1=160 #voltage in Volts\n", + "\n", + "#Calculation\n", + "R=(V**2)/P #using P=V**2*R\n", + "P1=(V1**2)/R #calculating power\n", + "Dp=500-P1 #drop in heat\n", + "D=(Dp*100)/500 #percentage drop\n", + "\n", + "#Result\n", + "print\"Resistance= \",R,\"Ohm\"\n", + "print\"% Drop in heat production = \",D,\"%\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Resistance= 80 Ohm\n", + "% Drop in heat production = 36 %\n" + ] + } + ], + "prompt_number": 79 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:5.20,Page no:180" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "P1=100 #power in Watts\n", + "P2=500 #power in Watts\n", + "\n", + "#Calculation\n", + "P=P2/P1 #ratio\n", + "\n", + "#Result\n", + "print \"P=\",P\n", + "print\"P>0,I2=5I Therefore I2>I1\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "P= 5\n", + "P>0,I2=5I Therefore I2>I1\n" + ] + } + ], + "prompt_number": 80 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:5.21,Page no:181" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration \n", + "t=1200 #time in second\n", + "P=100 #power in Watts\n", + "V=230 #voltage in Volts\n", + "\n", + "#Calculation\n", + "R=(V**2)/P #calculating resistance\n", + "V1=115 #supply voltage in Volts\n", + "E=((V1**2)*t)/R #calculating energy\n", + "\n", + "#Result\n", + "print\"Energy dissipated by bulb = \",E,\"J\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Energy dissipated by bulb = 30000 J\n" + ] + } + ], + "prompt_number": 81 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:5.22,Page no:181" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "P=10**4 #power in Watts\n", + "V=250 #voltage in Volts\n", + "R=0.2 #resistance in ohm\n", + "\n", + "#Calculation\n", + "Pl=((P/V)*(P/V))*R #calculating power loss\n", + "print P1\n", + "E=P/(Pl+P) #calculating efficiency\n", + "\n", + "#Result\n", + "print\"Percent Efficiency = \",round(E*100),\"%\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "100\n", + "Percent Efficiency = 97.0 %\n" + ] + } + ], + "prompt_number": 56 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:5.23,Page no:182" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration \n", + "P=100.0 #power in Watts\n", + "V=220.0 #voltage in Volts\n", + "\n", + "#Calculation\n", + "I=P/V #Current in Ampere\n", + "R=V/I #resistance\n", + "\n", + "#Result\n", + "print\"Current = \",round(I,3),\"A\" \n", + "print\"Resistance=\",R,\"Ohm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Current = 0.455 A\n", + "Resistance= 484.0 Ohm\n" + ] + } + ], + "prompt_number": 59 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example no:5.24,Page no:182" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration \n", + "V=50 #voltage in Volts\n", + "I=12 #Current in Ampere\n", + "\n", + "#Calculation\n", + "P=V*I #power\n", + "Pd=P*0.7 #power dissipated\n", + "R=(Pd/(I)**2) \n", + "\n", + "#Result\n", + "print\"Resistance = \",round(R,2),\"Ohm\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Resistance = 2.92 Ohm\n" + ] + } + ], + "prompt_number": 82 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Comprehensive_Textbook_Of_Applied_Physics_/Chapter2.ipynb b/A_Comprehensive_Textbook_Of_Applied_Physics_/Chapter2.ipynb index b50ddf47..4996a0ae 100644 --- a/A_Comprehensive_Textbook_Of_Applied_Physics_/Chapter2.ipynb +++ b/A_Comprehensive_Textbook_Of_Applied_Physics_/Chapter2.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:bc446a4cb1141cc1fc3a73e237c82b9c455db1185763ba734b760bbf57d3288c" + "signature": "sha256:91d97a97be2f511dbf3ba7bc67d7e74e1d7346535a0c0e27545b2b755cdaedc7" }, "nbformat": 3, "nbformat_minor": 0, @@ -133,8 +133,7 @@ "prompt_number": 37 }, { - "cell_type": "heading", - "level": 2, + "cell_type": "raw", "metadata": {}, "source": [ "Example no:2.4,Page no:42" diff --git a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch3.ipynb b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/Chapter 3-checkpoint.ipynb similarity index 100% rename from A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch3.ipynb rename to A_Textbook_Of_Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/Chapter 3-checkpoint.ipynb diff --git a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch1-checkpoint.ipynb b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch1-checkpoint.ipynb new file mode 100644 index 00000000..a8b9ed76 --- /dev/null +++ b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch1-checkpoint.ipynb @@ -0,0 +1,377 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:c8eaf5948eadfe6d1b6a7dc0019961e94ca5ac36c2e0b4b3d3661a7c7823315b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 1 : Introduction and Basic Concepts" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.1, Page no:5 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "F = 300; \t\t\t #[N]\n", + "g_local = 4.5; \t\t\t#local gravitational acceleration[m/s**2]\n", + "g_earth = 9.81; \t\t#earth's gravitational acceleration[m/s**2]\n", + "\n", + "# Calculations\n", + "#To find man's mass and weight on earth\n", + "m = F/g_local;\t\t\t#mass of man[kg]\n", + "w = m*g_earth; \t\t\t# weight of man on earth[N]\n", + "\n", + "# Results\n", + "print 'Mass of man is %f kg'%m\n", + "print '\\nWeight of man on earth is %f N'%w\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass of man is 66.666667 kg\n", + "\n", + "Weight of man on earth is 654.000000 N\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.2, Page no:6 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "p1 = 1.15*10**5; \t\t\t#measured pressure[N/m**2]\n", + "p2 = 1.01325*10**5; \t\t#atmospheric pressure[N/m**2]\n", + "rho = 2.95*10**3; \t\t\t#specific gravity of fluid\n", + "g = 9.8067\n", + "\n", + "# Calculations\n", + "#To find height of manometer fluid\n", + "p = p1-p2; \t \t\t#difference in pressure\n", + "h = p/(rho*g); \t\t\t#height of manometer fluid[m]\n", + "\n", + "# Results\n", + "print 'Height of manometer fluid is %f m'%h\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Height of manometer fluid is 0.472697 m\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.3, Page no:8" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "PE = 1.5*10**3; \t#potential energy[J]\n", + "m = 10; \t\t\t#mass in kg\n", + "u = 50; \t\t\t# velocity in m/s\n", + "g = 9.8067\n", + "\n", + "# Calculations\n", + "h = PE/(m*g);\t\t\t# height from ground in m\n", + "#Using equation 1.9 (Page no. 8)\n", + "KE = 0.5*m*(u**2);\t\t\t# Kinetic energy in J\n", + "\n", + "# Results\n", + "print 'Height from ground is %f m'%h\n", + "print '\\nKinetic Energy of body is %3.2e J'%KE\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Height from ground is 15.295665 m\n", + "\n", + "Kinetic Energy of body is 1.25e+04 J\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.4, Page no:9 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Given\n", + "F = 600.; \t\t\t#weight in N\n", + "t = 120.; \t\t\t#time in sec\n", + "h = 0.18; \t\t\t#height of stairs in m\n", + "\n", + "# Calculations\n", + "#To determine the power developed in man\n", + "S = 20*h; \t\t\t#total vertical displacement in m\n", + "W = F*S; \t\t\t#work done in J\n", + "P = W/t; \t\t\t#power developed\n", + "\n", + "# Results\n", + "print 'Power developed is %i W'%P\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Power developed is 18 W\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.5, Page no:9 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "import math\n", + "\n", + "# Variables\n", + "#Given:\n", + "A = (math.pi/4)*(0.1**2); \t\t\t#area in m**2\n", + "P = 1.01325*10**5; \t\t\t#pressure in N/m**2\n", + "m = 50; \t\t\t#mass of piston and weight in kg\n", + "g = 9.81; \t\t\t#acceleration due to gravity (N/m**2)\n", + "\n", + "\n", + "# Calculations and Results\n", + "#To determine the force exerted pressure work done and change in potential energy\n", + "#(a)\n", + "Fa = P*A; \t\t\t#force exerted by atmosphere in N\n", + "Fp = m*g; \t\t\t#force exerted by piston and weight in N\n", + "F = Fp+Fa; \t\t\t#total force exerted in N\n", + "print 'Total force exerted by the atmosphere, the piston and the weight is %f N'%F\n", + "\n", + "#(b)\n", + "Pg = F/A; \t\t\t#pressure of gas in N/m**2\n", + "print 'Pressure of gas is %5.4e N/m^2'%Pg\n", + "\n", + "#(c)\n", + "S = 0.4; \t\t\t#displacement of gas in m\n", + "W = F*S; \t\t\t#work done by gas in J\n", + "print 'Work done by gas is %f J'%W\n", + "\n", + "#(d)\n", + "PE = m*g*S; \t\t\t#change in potential energy in J\n", + "print 'Change in potential energy is %f J'%PE\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total force exerted by the atmosphere, the piston and the weight is 1286.304689 N\n", + "Pressure of gas is 1.6378e+05 N/m^2\n", + "Work done by gas is 514.521876 J\n", + "Change in potential energy is 196.200000 J\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.6, Page no:10" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "# Variables\n", + "#P =(2*10**5)*D\n", + "Df = 2.5; \t\t\t#final diameter (m)\n", + "Di = 0.5; \t\t\t#initial diameter(m)\n", + "\n", + "# Calculations\n", + "#To determine work done by gas\n", + "W = (math.pi/4)*10**5*((Df**4)-Di**4);\n", + "\n", + "# Results\n", + "print 'Work done by gas is %6.4e J'%W\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Work done by gas is 3.0631e+06 J\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.7, Page no:19" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "T = 300.; \t\t\t #temperature in K\n", + "P = 6.5*10**5; \t\t\t#pressure in N/m**2\n", + "Pa = 1.01325*10**5; \t#atmospheric pressure in N/m**2\n", + "R = 8.314; \t\t\t #ideal gas constant\n", + "m = 2.; \t\t\t #mass of gas (kg)\n", + "M = 44.; \t\t\t #molecular weihgt of gas\n", + "\n", + "# Calculations\n", + "#To find the work done on surrounding\n", + "n = m/M; \t\t\t # n is number of kmoles\n", + "Vi = (n*R*10**3*T)/P; \t\t\t# initial volume in m**3\n", + "Vf = 2*Vi; \t\t \t#final volume in m**3\n", + "V = Vf-Vi; \t\t\t #change in volume\n", + "Ps = Pa+(5000*9.8067); \t\t\t#pressure on surroundings\n", + "W = Ps*V; \t\t\t #work done on the surroundings\n", + "\n", + "# Results\n", + "print 'Work done on surroundings is %5.2e J'%W\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Work done on surroundings is 2.62e+04 J\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from scipy import integrate\n", + "\n", + "#Taking 3rd and 2nd order derivative respectively, we get the following expression \n", + "#x = ((2*10**5*math.pi)/2)*\n", + "D = lambda x: x**3\n", + "integ,err = integrate.quad(D,0.5,2.5)\n", + "print integ\n", + "#integ,err = integrate.quad(D**3,0.5,2.5)\n", + "#print integ" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "9.75\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch2-checkpoint.ipynb b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch2-checkpoint.ipynb new file mode 100644 index 00000000..79f16566 --- /dev/null +++ b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch2-checkpoint.ipynb @@ -0,0 +1,704 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:284e048fb2debae82cffada454a9337b6feb1c0e5f0ea929952ef361ea0138a2" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 2 : First Law of Thermodynamics" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.1, Page no:26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "#Given\n", + "W = -2.25*745.7; \t\t\t#work done on system in J/s\n", + "Q = -3400.*(10.**3)/3600; \t\t\t#heat transferred to the surrounding in J/s\n", + "\n", + "# Calculations\n", + "#To find the change in internal energy\n", + "#Using equation 2.4 (Page no. 26)\n", + "U = Q-W; \t\t\t#change in internal energy in J/s\n", + "\n", + "# Results\n", + "print 'Internal energy of system increases by %f J/s'%U\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Internal energy of system increases by 733.380556 J/s\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.2, Page no:26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Given\n", + "T = 298.; \t\t\t#temperature in K\n", + "P = 101.; \t \t\t#pressure in kPa\n", + "n_iron = 2.; \t\t\t#moles of iron reacted\n", + "Q = -831.08; \t\t\t#heat liberated in kJ\n", + "R = 8.314; \t\t \t#ideal gas constant\n", + "\n", + "# Calculations and Results\n", + "#To find heat liberated work done and change in internal energy\n", + "print 'Heat liberated during the reaction is %f kJ'%Q\n", + "n_oxygen = 1.5; \t\t\t#moles of oxygen reacted\n", + "\n", + "#Using ideal gas equation P(Vf-Vi)=nRT and W=P(Vf-Vi)\n", + "W = -1.5*R*T; \t\t \t#work done by system in J\n", + "\n", + "#Using equation 2.4 (Page no. 26)\n", + "U = (Q*10**3)-W; \t\t\t#change in internal energy in J\n", + "print 'Work done by gas is %f J'%W\n", + "print 'Change in internal energy is %6.3e J'%U\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat liberated during the reaction is -831.080000 kJ\n", + "Work done by gas is -3716.358000 J\n", + "Change in internal energy is -8.274e+05 J\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.3, Page no:27" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "#Given\n", + "u = 20.; \t\t\t#speed of car in m/s\n", + "z = 30.; \t\t\t#height vertically above the bottom of hill in m\n", + "m = 1400.; \t\t\t#mass of car in kg\n", + "g = 9.81; #acceleration due to gravity \n", + "\n", + "# Calculations\n", + "#To find the heat energy dissipated by brakes\n", + "#Using equation 2.3 (Page no. 26)\n", + "KE = -0.5*m*(u**2); \t\t\t#change in kinetic energy in J\n", + "PE = -m*g*z; \t \t\t#change in potential energy in J\n", + "Q = -(KE+PE); \t\t\t#heat dissipated by brakes in J\n", + "\n", + "# Results\n", + "print 'Heat dissipated by brakes is %3.2e J'%Q\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat dissipated by brakes is 6.92e+05 J\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.4, Page no:27" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Given:\n", + "#For step 1\n", + "W1 = -50.; \t\t\t#work received in J\n", + "Q1 = -25.; \t\t\t#heat gven out in J\n", + "\n", + "# Calculations and Results\n", + "U1 = Q1-W1; \t\t\t#internal energy change in J\n", + "print 'Change in internal energy for constant pressure process is %i J'%U1\n", + "\n", + "#For step 2\n", + "W2 = 0.; \t\t\t#work done for constant volume process is zero\n", + "Q2 = 75.; \t\t\t#heat received in J\n", + "U2 = Q2; \t\t\t#internal energy change in J\n", + "print 'Change in internal energy for constant volume process is %i J'%U2\n", + "\n", + "#For step 3\n", + "Q3 = 0.; \t\t\t#no heat exchange in adiabatic process\n", + "#Since the process is cyclic\n", + "#U3+U2+U1 = 0;\n", + "U3 = -(U1+U2);\n", + "W3 = -U3; \t\t\t#work done in J\n", + "print 'Work done during adiabatic process is %i J'%W3\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Change in internal energy for constant pressure process is 25 J\n", + "Change in internal energy for constant volume process is 75 J\n", + "Work done during adiabatic process is 100 J\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.5, Page no:29" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "#Given:\n", + "n_water = 10.**3; \t\t\t#moles of water\n", + "T = 373.; \t\t\t #tempearture(K)\n", + "P = 101.3; \t\t\t #pressure(kPa)\n", + "sv_liquid = 0.00104; \t\t#specific volume of liquid(m**3/kmol)\n", + "sv_vapour = 1.675; \t\t\t#specific volume of vapour(m**3/kmol)\n", + "Q = 1.03*10**3; \t\t\t#heat added in kJ\n", + " \n", + "#To find change in internal energy and enthalpy\n", + "W = P*n_water*(sv_vapour-sv_liquid)*10**-3; \t\t\t#expansion work done in kJ\n", + "U = Q-W; \t\t\t #change in internal energy in kJ\n", + "#For constant pressure process\n", + "H = Q; \t\t\t #enthalpy change in kJ\n", + "\n", + "# Results\n", + "print 'Change in internal energy is %f kJ'%U\n", + "print 'Change in enthalpy is %3.2e J'%H\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Change in internal energy is 860.427852 kJ\n", + "Change in enthalpy is 1.03e+03 J\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.6, Page no:29" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Given:\n", + "T = 233.; \t\t\t #temperature in K\n", + "VP = 1.005*10**3; \t\t\t #vapour pressure of CO2 in kPa\n", + "sv_liquid = 0.9*10**-3; \t\t\t#specific volume of liquid CO2 in m**3/kg\n", + "sv_vapour = 38.2*10**-3; \t\t\t#specicific volume of CO2 vapour in m**3/kg\n", + "L = 320.5; \t\t\t #latent heat of vaporisation of CO2 in kJ/kg\n", + "#Assuming at these conditions CO2 is saturated liquid so\n", + "H1 = 0; \t\t\t #enthalpy in liquid state\n", + "\n", + "# Calculations\n", + "#To find internal energy of saturated liquid and internal energy and enthalpy of saturated vapour\n", + "#For saturated liquid\n", + "U1 = H1-(VP*sv_liquid); \t\t\t# internal energy in liquid state in kJ/kg\n", + "#For saturated vapour\n", + "Hv = H1+L; \t\t\t #enthalpy of saturated vapour in kJ/kg\n", + "Uv = Hv-(VP*sv_vapour); \t\t\t#internal energy in vapour state in kJ/kg\n", + "\n", + "# Results\n", + "print 'Internal Energy of saturated liquid is %f kJ/kg'%U1\n", + "print 'Enthalpy of vapour state is %f kJ/kg'%Hv\n", + "print 'Internal Energy of vapour state is %f kJ/kg'%Uv\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Internal Energy of saturated liquid is -0.904500 kJ/kg\n", + "Enthalpy of vapour state is 320.500000 kJ/kg\n", + "Internal Energy of vapour state is 282.109000 kJ/kg\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.7, Page no:30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Given:\n", + "I = 0.5; \t\t\t#current in Amperes\n", + "V = 12.; \t\t\t#voltage in volts\n", + "t = 5*60.; \t\t\t#time in sec\n", + "m = 0.798; \t\t\t#mass of water vaporised in g\n", + "M = 18.; \t\t\t#molecular mass of water in g\n", + "R = 8.314*10**-3 #ideal gas constant\n", + "T = 373 #temperature\n", + "\n", + "# Calculations\n", + "#To calculate molar internal energy change and molar enthalpy change\n", + "Q = (I*V*t/1000.); \t\t\t#electric energy supplied in kJ\n", + "#Referring equation 2.10 (Page no. 29)\n", + "H = (Q*M)/m; \t\t\t#molar enthalpy change in kJ/mole\n", + "\n", + "#BY ideal gas equation PV=RT\n", + "#Referring equation 2.9 for constant pressure process (Page no. 29)\n", + "U = H-(R*T); \t\t\t#molar internal energy change in kJ/mole\n", + "\n", + "# Results\n", + "print 'Molar Enthalpy change during the process is %i kJ/mole'%H\n", + "print 'Molar Interanl Energy change during the process is %f kJ/mole'%U\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Molar Enthalpy change during the process is 40 kJ/mole\n", + "Molar Interanl Energy change during the process is 37.500382 kJ/mole\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.8, Page no:32" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "#Given:\n", + "m = 1650.; \t\t\t#mass of steam used in kg/hr\n", + "H1 = 3200.; \t\t\t#enthalpy at 1368 kPa and 645 K in kJ/kg\n", + "H2 = 2690.; \t\t\t#enthalpy at 137 kPa and 645 K in kJ/kg\n", + "\n", + "#To determine the theoretical horsepower developed\n", + "#Using equation 2.13 (Page no.32)\n", + "Q = 0; \t\t\t#since the process is adiabatic\n", + "z = 0; \t\t\t#assuming that inlet and discharge of turbine are at same level\n", + "u = 0; \t\t\t#feed and discharge velocities being equal\n", + "\n", + "# Calculations\n", + "Ws = -(H2-H1);\n", + "Wj = Ws*10**3*m/3600.; \t\t\t#work done by turbine in J\n", + "W = Wj/745.7; \t\t\t#work done by turbine in hp\n", + "\n", + "# Results\n", + "print 'Work done by turbine is %f hp'%W\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Work done by turbine is 313.463859 hp\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.9, Page no:32" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Given:\n", + "m = 25.*10**3; \t\t#mass flow rate of water in kg/h\n", + "P = 2.; \t\t\t#power supplied by motor in hp\n", + "q = 42000.; \t\t#heat given in kJ/min\n", + "z = 20.; \t\t\t#elevation in m\n", + "T = 368.; \t\t\t#temperature in K\n", + "To = 273.; \t\t\t#standard temperature in K\n", + "Cp = 4.2; \t\t\t#specific heat of water in kJ/kg K\n", + "g = 9.81 #acceleration due to gravity(m/s^2)\n", + "\n", + "# Calculations\n", + "#To find temperature of water delivered to second storage tank\n", + "W = (P*745.7*10**-3*3600)/m; \t\t\t#work done per kg of water pumped in kJ/kg\n", + "Q = q*60./m; \t\t\t #heat given out per kg of fluid\n", + "PE = g*z*10**-3; \t\t\t #change in potential energy in kJ/kg\n", + "\n", + "#Using equation 2.13 (Page no. 32)\n", + "H = -Q+W-PE;\n", + "#H = H2-H1\n", + "H1 = Cp*(T-To);\n", + "H2 = H1+H;\n", + "#Let T1 be the temperature at second storage tank\n", + "T1 = To+(H2/Cp);\n", + "\n", + "# Results\n", + "print 'Temperature of water at second storage tank is %i K'%T1\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Temperature of water at second storage tank is 344 K\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.10, Page no:33" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Given:\n", + "D1 = 25.; \t\t\t#internal diameter of pipe in mm\n", + "u1 = 10.; \t\t\t#upstream velocity in m/s\n", + "D2 = 50.; \t\t\t#downstream diameter of pipe in mm\n", + "\n", + "# Calculations and Results\n", + "#(a)\n", + "#Let A1 nad A2 be upstream and downstream crosssectional areas of pipe\n", + "u2 = ((D1/D2)**2)*u1; \t\t\t#downstream velocity in m/s\n", + "H = 0.5*(u1**2-u2**2); \t\t\t#change in enthalpy in J/kg\n", + "print 'Change in enthalpy is %f J/kg'%H\n", + "\n", + "#(b)\n", + "#For maximum enthalpy change \n", + "u2 = 0;\n", + "Hmax = 0.5*u1**2; \t\t\t#(J/kg)\n", + "print 'Maximum enthalpy chnage for a sudden enlargement in pipe is %f J/kg'%Hmax\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Change in enthalpy is 46.875000 J/kg\n", + "Maximum enthalpy chnage for a sudden enlargement in pipe is 50.000000 J/kg\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.11, Page no:35" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "#At inlet:\n", + "T1 = 293.; \t\t\t#Temperature(K)\n", + "P1 = 300+136.8; \t\t\t#Pressure(kPa)\n", + "#At exit:\n", + "T2 = 453.; \t\t\t#Temperature(K)\n", + "P2 = 136.8; \t\t\t#Pressure(kPa)\n", + "Cp = 29.4; \t \t\t#specific heat capacity at constant pressure in kJ/kmol\n", + "m = 1000.; \t\t \t#mass of hydrogen in kg\n", + "M = 2.02; \t\t\t #molecular mass of hydrogen\n", + "\n", + "# Calculations\n", + "#To determine heat transfer rates\n", + "#Neglecting the kinetic nd potential energy changes\n", + "#Assuming the process to be occuring through a number of steps\n", + "#Step 1 be isothermal and step 2 be isobaric\n", + "H1 = 0; \t\t\t#change in enthalpy for step 1\n", + "H2 = (m/M)*Cp*(T2-T1)/1000; \t\t\t#change in enthalpy for step 2 in kJ\n", + "H = H2+H1;\n", + "Q = H; \t\t\t#heat transferred in coils in kJ\n", + "\n", + "# Results\n", + "print 'Heat transferred in coils is %f kJ'%Q\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat transferred in coils is 2328.712871 kJ\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.12, Page no:35" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Given:\n", + "m = 10.; \t\t\t#mass of air in kg\n", + "P1 = 100.; \t\t\t#initial pressure(kPa)\n", + "T1 = 300.; \t\t\t#initial temperature(K)\n", + "T2 = 600.; \t\t\t#final temperature(K)\n", + "R = 8.314; \t\t\t#ideal gas constant(kJ/kmol K)\n", + "Cp = 29.099;\t\t#specific heat capacity at constant pressure (kJ/kmol K)\n", + "Cv = 20.785;\t\t#specific heat capacity at constsant volume (kJ/kmol K)\n", + "M = 29.; \t\t\t#molecular weight of air\n", + "\n", + "# Calculations and Results\n", + "#To determine change in internal energy enthalpy heat supplied and work done\n", + "n = m/M; \t \t\t#number of moles of gas(kmol)\n", + "V1 = (n*R*T1)/P1; \t\t\t#initial volume of air (m**3)\n", + "\n", + "#(a)\n", + "#Constant volume process\n", + "V2 = V1 \t\t\t#final volume\n", + "#Change in internal energy U = n*intg(CvdT)...so\n", + "U = n*Cv*(T2-T1); \t\t\t#change in internal energy(kJ)\n", + "Q = U; \t\t\t #heat supplied(kJ)\n", + "W = 0; \t\t\t #work done\n", + "H = U+(n*R*(T2-T1)); \t\t#change in enthalpy(kJ)\n", + "print 'For constant volume process'\n", + "print 'Change in internal energy is %i kJ'%U\n", + "print 'Heat supplied is %i kJ'%Q\n", + "print 'Work done is %i kJ'%W\n", + "print 'Change in enthalpy is %i kJ'%H\n", + "\n", + "# (b)\n", + "# Constant pressure process\n", + "# Change in enthalpy H = n*intg(CpdT)...so \n", + "H = n*Cp*(T2-T1); \t\t\t#change in enthalpy(kJ)\n", + "Q = H;\t\t\t#heat supplied(kJ)\n", + "U = H-(n*R*(T2-T1));\t\t\t#change in internal energy(kJ)\n", + "W = Q-U; \t\t\t#work done(kJ)\n", + "print 'For constant pressure process'\n", + "print 'Change in internal energy is %i kJ'%U\n", + "print 'Heat supplied is %i kJ'%Q\n", + "print 'Work done is %i kJ'%W\n", + "print 'Change in enthalpy is %i kJ'%H\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "For constant volume process\n", + "Change in internal energy is 2150 kJ\n", + "Heat supplied is 2150 kJ\n", + "Work done is 0 kJ\n", + "Change in enthalpy is 3010 kJ\n", + "For constant pressure process\n", + "Change in internal energy is 2150 kJ\n", + "Heat supplied is 3010 kJ\n", + "Work done is 860 kJ\n", + "Change in enthalpy is 3010 kJ\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.13, Page no:36\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "#Given:\n", + "R = 8.314; \t\t\t#ideal gas constant(kJ/kmol K)\n", + "Cv = 20.8; \t\t\t#specific heat capacity at constant volume(kJ/kmol K)\n", + "Cp = 29.1; \t\t\t#specific heat capacity at constant pressure(kJ/kmol K)\n", + "P1 = 10.; \t\t\t#initial pressure(bar)\n", + "T1 = 280.; \t\t\t#initial temperature in K\n", + "P2 = 1.; \t\t\t#final pressure(bar)\n", + "T2 = 340.; \t\t\t#final temperature(K)\n", + "\n", + "# Calculations\n", + "#To determine the change in internal energy and change in enthalpy\n", + "#Solution\n", + "n = 1 \t\t\t#basis: 1 kmol of ideal gas\n", + "V1 = (n*R*T1)/(P1*100); \t\t\t#initial volume in m**3\n", + "V2 = (n*R*T2)/(P2*100); \t\t\t#final volume in m**3\n", + "\n", + "Po = P2; \n", + "Vo = V1;\n", + "To = (Po*100*Vo)/(n*R);\n", + "U1 = Cv*(To-T1);\n", + "H1 = U1+(V1*100*(P2-P1));\n", + "W1 = 0;\n", + "Q1 = U1;\n", + "\n", + "H2 = Cp*(T2-To);\n", + "U2 = H2-100*(V2-V1);\n", + "Q2 = H2;\n", + "W2 = Q2-U2;\n", + "#For actual process\n", + "U = U1+U2; \t\t\t#change in internal energy(kJ)\n", + "H = H1+H2; \t\t\t#change in enthalpy(kJ)\n", + "\n", + "# Results\n", + "print 'Change in internal energy is %f kJ'%U\n", + "print 'Change in enthalpy is %f kJ'%H\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Change in internal energy is 1243.632000 kJ\n", + "Change in enthalpy is 1742.472000 kJ\n" + ] + } + ], + "prompt_number": 27 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch5-checkpoint.ipynb b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch5-checkpoint.ipynb new file mode 100644 index 00000000..69a3c9fd --- /dev/null +++ b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch5-checkpoint.ipynb @@ -0,0 +1,1374 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:6996e5e5468902e09bec94067f7b5880135562adefc48c0268633a954f4745f1" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 5 : Some Applications of the Laws of Thermodynamics" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.1,page no:70" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# Variables\n", + "#Given:\n", + "u1 = 1; \t\t\t #entering velocity of water (m/s)\n", + "d_ent = 0.2; \t\t\t#entrance diameter of reducer (m)\n", + "d_exit = 0.1; \t\t\t#exit diameter of reducer (m)\n", + "P_ent = 105; \t\t\t#pressure at entrance (kPa)\n", + "z = 5; \t\t\t #distance between entrance and exit (m)\n", + "g = 9.81; \t\t\t #acceleration due to gravity \n", + "den = 1000; \t\t\t#density of water (kg/m**3)\n", + "\n", + "# Calculations\n", + "#To calculate the pressure at exit\n", + "A1 = (math.pi/4)*d_ent**2; \t\t\t #cross section area of entrance (m**2)\n", + "A2 = (math.pi/4)*d_exit**2; \t\t\t#cross section area of exit (m**2)\n", + "\n", + "#By the equation of continuity and since density of water remains constant\n", + "u2 = (A1*u1)/A2;\n", + "\n", + "#By Bernoulli's equation between section 1 and 2 (Eq 5.20 Page no. 118)\n", + "P_exit = (-((u2**2-u1**2)/2)-(g*z)+(P_ent*10**3/den))*(den/10**3)\n", + "\n", + "# Results\n", + "print 'The pressure at exit is %f kPa'%P_exit\n", + "7" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The pressure at exit is 48.450000 kPa\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.2,page no:71" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Given:\n", + "P = 1000.; \t\t\t#pressure of saturated steam (kPa)\n", + "T = 398.; \t\t\t#temperature of escaping steam (K)\n", + "\n", + "#Referring steam tables\n", + "H_vap = 2778.; \t\t\t#enthalpy of saturated vapour at 1000 kPa (kJ/kg)\n", + "H_liq = 763.; \t\t\t#enthalpy of saturated liquid at 1000 kPa (kJ/kg)\n", + "H_steam = 2726.; \t\t#enthalpy of superheated steam at 398 K (kJ/kg)\n", + "H2 = 2726; \t\t\t #[kJ/kg]\n", + "\n", + "# Calculations\n", + "#No work is done and no heat is exchanged between section 1 and 2\n", + "#S0% H1 = H2\n", + "x = (H2-H_vap)/(H_liq-H_vap)\n", + "\n", + "# Results\n", + "print 'The steam contains %f percent liquid'%(x*100)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The steam contains 2.580645 percent liquid\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.3, Page no:123,page no:72" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Given:\n", + "m = 10.; \t\t\t#mass flow rate of steam (kg/s)\n", + "H1 = 3062.; \t\t\t#enthalpy of entering steam (kJ/kg)\n", + "H2 = 2875.; \t\t\t#enthalpy of discharged steam (kJ/kg)\n", + "Q = -100./m; \t\t\t#heat loss to the surrounding (kJ/kg)\n", + "u1 = 0.; \t\t\t#entering velocity of steam\n", + "\n", + "# Calculations\n", + "import math\n", + "H = H2-H1;\n", + "u2 = math.sqrt((Q-H)*1000*2)\n", + "\n", + "# Results\n", + "print 'The discharge velocity is %i m/s'%u2\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The discharge velocity is 594 m/s\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.4, Page no:125" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Given:\n", + "To = 600.; \t\t\t#temperature of air (K)\n", + "Po = 2000.; \t\t\t#pressure of air (kPa)\n", + "gama = 1.4;\n", + "M = 0.8; \t\t\t#Mach number at throat\n", + "m = 29.; \t\t\t#molecular mass of air\n", + "R = 8.314; \t\t\t#ideal gas constant\n", + "\n", + "#To determine thermodynamical properties at throat and critical pressure\n", + "import math\n", + "\n", + "# Calculations and Results\n", + "#(a)\n", + "#Using equation 5.40 (Page no 123).. u**2 = (M**2)*gama*P*V\n", + "#Substituting this in eq. 5.39 (Page no. 123) and on rearranging we get\n", + "P = Po/((1+(((gama-1)/2)*M**2))**(gama/(gama-1)))\n", + "#Using eq. 5.39 and the relation PoVo = RTo/m\n", + "u = math.sqrt((2*gama*R*To*1000)/(m*(gama-1))*(1-(P/Po)**((gama-1)/gama)))\n", + "#Using eq. 3.23 (Page no. 49)\n", + "T = To*(P/Po)**((gama-1)/gama)\n", + "#Let d be the density\n", + "d_o = (Po*m)/(R*To)\n", + "#Since P*(V**gama) = P/(den**gama) = constant...so\n", + "d = d_o*((P/Po)**(1/gama))\n", + "print '(a). At throat'\n", + "print 'Pressure = %i kPa'%P\n", + "print 'Temperature = %i K'%T\n", + "print 'Velocity = %f m/s'%u\n", + "print 'Density = %f kg/cubic m'%d\n", + "\n", + "#(b)\n", + "#Using eq. 5.42 (Page no.124)\n", + "Pc = Po*((2/(gama+1))**(gama/(gama-1))) \t\t\t#critical pressure\n", + "print '(b).'\n", + "print 'The critical pressure is %f kPa'%Pc\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a). At throat\n", + "Pressure = 1312 kPa\n", + "Temperature = 531 K\n", + "Velocity = 369.641813 m/s\n", + "Density = 8.603873 kg/cubic m\n", + "(b).\n", + "The critical pressure is 1056.563575 kPa\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.7,page no:128" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "P1 = 1.; \t\t\t#initial pressure (bar)\n", + "T1 = 300.; \t\t\t#initial temperature (K)\n", + "P2 = 10.; \t\t\t#final pressure (bar)\n", + "gama = 1.3; \t\t\t#gama for CO2\n", + "V_rate = 100.; \t\t\t#volumetric flow rate (m**3/h)\n", + "\n", + "# Calculations and Results\n", + "#To calculate work required and temperature after compression\n", + "Ws = (gama/(gama-1))*P1*10**5*(V_rate/3600)*(1-(P2/P1)**((gama-1)/gama))\n", + "print 'The work required is %f kW'%(-Ws/1000)\n", + "\n", + "#Using equation 3.23 (Page no.49)\n", + "T2 = T1*((P2/P1)**((gama-1)/gama))\n", + "print 'Temperature of gas after compression is %f K'%T2\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The work required is 8.441024 kW\n", + "Temperature of gas after compression is 510.376284 K\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.8,page no:129" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "P1 = 100.; \t\t\t#initial pressure of saturated steam (kPa)\n", + "P2 = 500.; \t\t\t#final pressure (kPa)\n", + "eff = 0.8; \t\t\t#compression efficiency\n", + "\n", + "#Referring steam tables\n", + "#Properties of steam entering the compressor\n", + "H1 = 2675.5; \t\t\t#enthalpy (kJ/kg)\n", + "S1 = 7.3594; \t\t\t#entropy (kJ/kg K)\n", + "\n", + "#Properties of compressed steam\n", + "H2 = 3008.; \t\t\t#enthalpy (kJ/kg)\n", + "S2 = S1; \t\t\t#isentropic compression\n", + "\n", + "\n", + "# Calculations and Results\n", + "#To calculate work required and temperature\n", + "\n", + "Hs = H2-H1;\n", + "#Using eq. 5.44 (Page no. 128)\n", + "W_isentropic = -Hs;\n", + "W_act = W_isentropic/eff;\n", + "print 'The work required for compression is %f kJ/kg'%-W_act\n", + "\n", + "H = Hs/eff; \t\t\t#actual change in enthalpy\n", + "H_act = H1+H; \t\t\t#actual enthalpy of steam leaving the compressor\n", + "#From steam tables for superheated steam at 500 kPa and enthalpy of H_act\n", + "T = 586; \t\t\t#temperature (K)\n", + "print 'Temperature of exhaust steam is %i K'%T\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The work required for compression is 415.625000 kJ/kg\n", + "Temperature of exhaust steam is 586 K\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.9,page no:130" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Given:\n", + "T1 = 288.; \t\t\t#temperature of surrounding (K)\n", + "T2 = 261.; \t\t\t#temperature of solution (K)\n", + "Q2 = 1000.; \t\t\t#heat removed (kJ/min)\n", + "\n", + "# Calculations\n", + "#To determine the least amount of power\n", + "#Using eq. 5.57 (Page no. 137)\n", + "W = Q2*((T1-T2)/T2 )\t\t\t#power in kJ/min\n", + "P = (W*1000)/(746.*60) \t\t\t#power in hp\n", + "\n", + "# Results\n", + "print 'Least amount of power necessary is %f hp'%P" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Least amount of power necessary is 2.311177 hp\n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.10,page no:131" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Given:\n", + "T = 290.; \t\t\t#operating temperature (K)\n", + "W = 1000.; \t\t\t#work (J)\n", + "tof = 3516.67; \t\t\t#ton of refrigeration (W)\n", + "\n", + "# Calculations and Results\n", + "#To determine COP, heat rejected and lowest temperature\n", + "#(a)\n", + "Q2 = tof;\n", + "COP = Q2/W; \t\t\t#coeffecient of performance\n", + "print '(a). COP is %f'%COP\n", + "\n", + "#(b)\n", + "Q1 = Q2+W; \t\t\t#heat rejected\n", + "print ' (b). Heat rejected is %f kW'%(Q1/1000.)\n", + "\n", + "#(c)\n", + "#Let T2 be the lowest temperature\n", + "T2 = T*(Q2/Q1);\n", + "print ' (c). Lowest possible temperature in refrigerator is %f K'%T2\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a). COP is 3.516670\n", + " (b). Heat rejected is 4.516670 kW\n", + " (c). Lowest possible temperature in refrigerator is 225.793405 K\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.11,page no:132" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Given:\n", + "T2 = 266.;\n", + "T1 = 300.; \t\t\t#operating temperatures of vapour compression refrigeration cycle(K)\n", + "\n", + "#To determine COP at given conditions\n", + "#(a)\n", + "Ha = 656.; \t\t\t#(kJ/kg)\n", + "Hb = 724.; \t\t\t#(kJ/kg)\n", + "Hd = 144.; \t\t\t#(kJ/kg)\n", + "Hc = Hd;\n", + "\n", + "# Calculations and Results\n", + "#Using eq. 5.61 (Page no. 139)\n", + "COP = (Ha-Hd)/(Hb-Ha);\n", + "print '(a). COP = %f'%COP\n", + "\n", + "#(b)\n", + "Ha = 652.; \t\t\t#(kJ/kg)\n", + "Hb = 758.; \t\t\t#(kJ/kg)\n", + "Hd = 159.; \t\t\t#(kJ/kg)\n", + "Hc = Hd;\n", + "eff = 0.75; \t\t\t#efficiency of compressor\n", + "COP = (Ha-Hd)/((Hb-Ha)*(1./eff));\n", + "print ' (b). COP = %f'%COP\n", + "\n", + "#(c). Ideal Carnot refrigerator\n", + "COP = T2/(T1-T2);\n", + "print ' (c). COP = %f'%COP\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a). COP = 7.529412\n", + " (b). COP = 3.488208\n", + " (c). COP = 7.823529\n" + ] + } + ], + "prompt_number": 31 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.12 ,page no:133" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "#Given:\n", + "Tin_cool = 288.; \t\t\t#entering temperature of cooling water (K)\n", + "Tout_cool = 300.; \t\t\t#discharge temperature of cooling water (K)\n", + "m_c = 0.25; \t\t\t#mass flow rate of coling water (kg/s)\n", + "m = 0.5; \t\t\t#mass flow rate of ammonia (kg/min)\n", + "Ha = 1426.; \t\t\t#enthalpy of saturated ammonia vapour at 258 K (kJ/kg)\n", + "Hd = 281.5; \t\t\t#enthalpy of liquid ammonia at 294 K (kJ/kg)\n", + "eff = 0.9; \t\t\t#compressor efficiency\n", + "Cp = 4.2; \t\t\t#specific heat of water (kJ/kg K)\n", + "tof = 12660.; \t\t\t#ton of refrigeration (kJ/h)\n", + "\n", + "# Calculations and Results\n", + "#To determine the power requirement and refrigeration capacity in tons\n", + "Q1 = m_c*Cp*(Tout_cool-Tin_cool); \t\t\t#heat rejected by compressor at constant pressure (kJ/s)\n", + "Q2 = (m/60.)*(Ha-Hd); \t\t\t#heat absorbed (kJ/s)\n", + "W = Q1-Q2; \t\t\t#work required (kJ/s)\n", + "P = (W*1000)/(eff*746); \t\t\t#power requirement of compressor (hp)\n", + "print 'Power requirement of the compressor is %f hp'%P\n", + "\n", + "rc = Q2*3600/tof; \t\t\t#refrigeration capacity (ton)\n", + "print ' Refrigeration capacity is %f ton'%rc\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Power requirement of the compressor is 4.561364 hp\n", + " Refrigeration capacity is 2.712085 ton\n" + ] + } + ], + "prompt_number": 32 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.13,page no:134" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Given:\n", + "m1 = 10.; \t\t\t#machine rating (ton)\n", + "#Since 5 K approach is necessary\n", + "T1 = 293.+5; \t\t\t#temperature of cooling water (K)\n", + "T2 = 261.-5; \t\t\t#temperature of cold storage (K)\n", + "Ha = 181.; \t\t\t#enthalpy of saturated vapour at 256 K (kJ/kg)\n", + "Sa = 0.714; \t\t\t#entropy of saturated vapour at 256K (kJ/kg K)\n", + "Hc = 62.; \t\t\t#enthalpy of saturated liquid at 298 K (kJ/kg)\n", + "Sc = 0.231; \t\t\t#entropy of saturated liquid at 298 K (kJ/kg K)\n", + "Hb = 206.; \t\t\t#enthalpy of superheated vapour (kJ/kg)\n", + "Sb = 0.714; \t\t\t#entropy of superheated vapour (kJ/kg)\n", + "\n", + "# Calculations and Results\n", + "#Combining the three relations, we get\n", + "Sd = Sc; \t\t\t#isentropic process\n", + "Hd = Ha-(T2*(Sa-Sd));\n", + "\n", + "#Using eq. 5.64 (Page no. 141)\n", + "COP = (Ha-Hd)/((Hb-Hc)-(Ha-Hd));\n", + "print 'COP = %f'%COP\n", + "\n", + "#Using equation 5.63 (Page no. 140)\n", + "m = (12660*m1)/(Ha-Hd); \t\t\t#refrigerant circulation rate (kg/h)\n", + "print ' Refrigerant circulation rate is %f kg/h'%m\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "COP = 6.075472\n", + " Refrigerant circulation rate is 1023.874224 kg/h\n" + ] + } + ], + "prompt_number": 33 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.14,page no:135" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Given:\n", + "m1 = 10.; \t\t\t#machine rating (ton)\n", + "#Assuming 5 K approach in refrigerator and cooler\n", + "Ta = 261.-5; \t\t\t#temperature of air leaving the refrigerator (K)\n", + "Tc = 293.+5; \t\t\t#temperature of air leaving the cooler (K)\n", + "gama = 1.4;\n", + "Cp = 1.008; \t\t\t#sp. heat of air (kJ/kg K)\n", + "P1 = 4.052;\n", + "P2 = 1.013; \t\t\t#operating pressures in bar\n", + "\n", + "# Calculations and Results\n", + "#To determine the COP and air circulation rate\n", + "#Using eq. 5.66 (Page no. 145)\n", + "Tb = Ta*(P1/P2)**((gama-1)/gama)\n", + "Td = (Tc*Ta)/Tb;\n", + "\n", + "#Using equation 5.68 (PAge no. 146)\n", + "COP = Ta/(Tb-Ta)\n", + "print 'COP = %f'%COP\n", + "\n", + "#Considering energy balance in refrigerator [m*Cp*(Ta-Td) = m1*12660]\n", + "m = (m1*12660)/(Cp*(Ta-Td)) \t\t\t#air circulation rate (kg/h)\n", + "print ' Air circulation rate is %i kg/h'%m\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "COP = 2.057637\n", + " Air circulation rate is 2264 kg/h\n" + ] + } + ], + "prompt_number": 34 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.15,page no:136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Given:\n", + "T1 = 300.; \t\t\t#indoor temperatur (K)\n", + "T2 = 290.; \t\t\t#outside temperature (K)\n", + "W_input = 1.; \t\t\t#1 kW heat pump\n", + "W_output = 30.; \t\t\t#given output (kW)\n", + "\n", + "# Calculations and Results\n", + "#To verify that given heat pump is equivalent to 30 kW heater\n", + "Q2 = (T2/(T1-T2))*W_input; \t\t\t#heat absorbed\n", + "Q1 = Q2 + W_input; \t\t\t#heat rejected\n", + "\n", + "if(Q1==W_output):\n", + " print '1 kW pump if operated reversibly% is equivalent to a 30 kW heater'\n", + "else:\n", + " print 'The given heat pump is not equivalent to a 30 kW heater'\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 kW pump if operated reversibly% is equivalent to a 30 kW heater\n" + ] + } + ], + "prompt_number": 35 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.16,page no:137" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Given:\n", + "T1 = 295.; \t\t\t#temperature inside building (K)\n", + "T2 = 275.; \t\t\t#temperature of outside air (K)\n", + "eff = 0.25; \t\t\t#overall efficiency of unit\n", + "Hc = 890.9; \t\t\t#heat of combustion of fuel (kJ/mol)\n", + "conv = 0.33; \t\t\t#efficiency of conversion of heat of combustion to electricity\n", + "Q1 = 10**6; \t\t\t#amount of heat to be delivered\n", + "\n", + "# Calculations\n", + "#To determine the amount of fuel burned\n", + "COP = T1/(T1-T2)\n", + "W = Q1/COP; \t\t\t#work required to deliver Q1 kJ of heat\n", + "W_act = W/eff; \t\t\t#actual amount of electrical energy to be supplied\n", + "W_heat = W_act/conv; \t\t\t#heat energy required as heat of combustion\n", + "n = W_heat/Hc; \t\t\t#number of moles of fuel burned\n", + "\n", + "# Results\n", + "print 'The amount of fuel burned is %f kmol'%(n/1000)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The amount of fuel burned is 0.922412 kmol\n" + ] + } + ], + "prompt_number": 36 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.17,page no:138" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Given:\n", + "#Referring steam tables at 2.54 bar\n", + "H1 = 2717.; \t\t\t#enthalpy of saturated vapour (kJ/kg)\n", + "H2 = 538.; \t\t\t#enthalpy of saturated liquid (kJ/kg)\n", + "S1 = 7.05; \t\t\t#entropy of saturated vapour (kJ/kg K)\n", + "S2 = 1.61; \t\t\t#entropy of saturated liquid (kJ/kg K)\n", + "\n", + "H = 2700.; \t\t\t#enthalpy of superheated steam at 1 bar and 385 K (kJ/kg)\n", + "S = 7.42; \t\t\t#entropy of superheated steam at 1 bar and 385 K (kJ/kg K)\n", + "\n", + "# Calculations and Results\n", + "x = (H-H1)/(H2-H1)\n", + "#From steam tables\n", + "T = 401.; \t\t\t#temperature of steam (K)\n", + "print '(a). For isenthalpic math.expansion'\n", + "print ' The fraction of liquid in inlet stream is %f'%x\n", + "print ' The temperature of stream is %i K'%T\n", + "\n", + "#(b)..The math.expansion is isentropic\n", + "#Since entropy of saturated vapour at inlet pressure (S1) is less than entropy of steam leaving the turbine (S)\n", + "#So% the inlet stream is superheated% therefore\n", + "x = 0;\n", + "#From steam tales\n", + "T = 478.; \t\t\t#temperature of superheated steam having entropy of 7.42 kJ/kg K\n", + "print '(b). For isentropic math.expansion'\n", + "print ' The fraction of liquid in inlet stream is %i'%x\n", + "print ' The temperature of stream is %i K'%T\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a). For isenthalpic math.expansion\n", + " The fraction of liquid in inlet stream is 0.007802\n", + " The temperature of stream is 401 K\n", + "(b). For isentropic math.expansion\n", + " The fraction of liquid in inlet stream is 0\n", + " The temperature of stream is 478 K\n" + ] + } + ], + "prompt_number": 37 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.18,page no:139" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Given:\n", + "#Referring Fig. 5.15 (Page no. 151)\n", + "Hc = 516.; \t\t\t#enthalpy of high pressure gas at 120 bar and 306 K (kJ/kg)\n", + "Ha = 526.; \t\t\t#enthalpy of low pressure gas at 2 bar and 292 K (kJ/kg)\n", + "Hf = 121.; \t\t\t#entalpy of saturated liquid at 2 bar (kJ/kg)\n", + "Hg = 314.; \t\t\t#enthalpy of saturated vapour at 2 bar (kJ/kg)\n", + "\n", + "#To determine the fraction of air liquified and temperature of air\n", + "\n", + "# Calculations and Results\n", + "#(a)..\n", + "#Using equation 5.73 (Page no. 152)\n", + "x = (Hc-Ha)/(Hf-Ha) \t\t\t#fraction of air liquified\n", + "print '(a). The fraction of liquified air is %f'%x\n", + "\n", + "#(b)..\n", + "#Taking enthalpy balance around heat exchanger\n", + "Hd = Hc - (1-x)*(Ha-Hg)\n", + "#At enthalpy of Hd kJ/kg% from T-S diagram for air\n", + "T = 167.; \t\t\t#temperature in K\n", + "print ' (b). Temperature of air on high pressure side of throttle valve is %i K'%T\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a). The fraction of liquified air is 0.024691\n", + " (b). Temperature of air on high pressure side of throttle valve is 167 K\n" + ] + } + ], + "prompt_number": 38 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.19,page no:140" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Given:\n", + "P2 = 2800.; \t\t\t#pressure of superheated steam (kPa)\n", + "P1 = 5.; \t\t\t#pressure after math.expansion (kPa)\n", + "e_turbine = 0.85; \t\t\t#isentropic turbine efficiency\n", + "e_pump = 0.8; \t\t\t#isentropic pump efficiency\n", + "V = 1.005*10**-3; \t\t\t#specific volume of saturated liquid at 5 kPaHl = \n", + "\n", + "#From steam tables:\n", + "Hl = 138.; \t\t\t#enthalpy of saturated liquid at 5 kPa (kJ/kg)\n", + "Hv = 2562.; \t\t\t#enthalpy of saturated vapour at 5 kPa (kJ/kg)\n", + "H3 = 3063.; \t\t\t#enthalpy of superheated steam at 2800 kPa and 598 K (kJ/kg)\n", + "Sl = 0.4764; \t\t\t#entropy of saturated liquid at 5 kPa (kJ/kg K)\n", + "Sv = 8.3951; \t\t\t#entropy of saturated vapour at 5 kPa (kJ/kg K)\n", + "S3 = 6.6875; \t\t\t#entropy of superheated steam at 2800 kPa and 598 K (kJ/kg K)\n", + " \n", + "\n", + "# Calculations and Results\n", + "#To determine the ideal Rankine cycle efficiency% thermal efficiency and rate of steam production\n", + "\n", + "#(a)..The ideal Rankine cycle efficiency for the stated conditions\n", + "#Referring fig 5.19(b) (Page no. 155) and considering feed water pump\n", + "Ws = V*(P2-P1) \t\t\t#work done by pump (kJ/kg)\n", + "H2 = Hl+Ws;\n", + "#Considering isentropic math.expansion in turbine\n", + "S4 = S3;\n", + "x = (S4-Sl)/(Sv-Sl) \t\t\t#fraction of steam that is vapour\n", + "H4 = Hl + x*(Hv-Hl)\n", + "\t\t\t#Using eq. 5.80 (Page no. 155)\n", + "e_r = ((H3-H2)-(H4-Hl))/(H3-H2)\n", + "print '(a). The ideal Rankine cycle efficiency for the stated conditions is %i percent'%(e_r*100)\n", + "\n", + "#(b)..The thermal efficiency of plant\n", + "W_act = Ws/e_pump; \t\t\t#actual work requirement in pump\n", + "H_2 = Hl + W_act; \t\t\t#enthalpy of water leaving the feed water pump\n", + "W_out = e_turbine*(H3-H4) \t\t\t#actual work output\n", + "H_4 = H3-W_out; \t\t\t#actual enthalpy of steam leaving the turbine\n", + "e_act = ((H3-H_2)-(H_4-Hl))/(H3-H_2)\n", + "print ' (b). The actual efficiency is %f percent'%(e_act*100)\n", + "\n", + "#(c)..The rate of steam production\n", + "W_net = e_act*(H3-H_2) \t\t\t#net work output (kJ/kg)\n", + "rate = (3.6*10**6)/W_net; \t\t\t#steam produced in boiler (kg/h)\n", + "print ' (c). The rate of steam production is %f kg/h'%(rate)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a). The ideal Rankine cycle efficiency for the stated conditions is 34 percent\n", + " (b). The actual efficiency is 29.664548 percent\n", + " (c). The rate of steam production is 4153.943111 kg/h\n" + ] + } + ], + "prompt_number": 39 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.20,page no:141" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Given:\n", + "P2 = 7600.; \t\t\t#pressure of superheated steam (kPa)\n", + "P1 = 5.; \t\t\t#pressure after math.expansion (kPa)\n", + "V = 1.005*10**-3; \t\t\t#specific volume of saturated liquid (m**3/kg)\n", + "\n", + "#From steam tables:\n", + "H_l1 = 138.; \t\t\t#enthalpy of saturated liquid at 5 kPa (kJ/kg)\n", + "S_l1 = 0.4764; \t\t\t#entropy of saturated liquid at 5 kPa (kJ/kg K)\n", + "H_v1 = 2562.; \t\t\t#enthalpy of saturated vapour at 5 kPa (kJ/kg)\n", + "S_v1 = 8.3951; \t\t\t#entropy of saturated vapour at 5 kPa (kJ/kg K)\n", + "H_l2 = 830.; \t\t\t#enthalpy of saturated liquid at 1400 kPa(kJ/kg)\n", + "S_l2 = 2.2842; \t\t\t#entropy of saturated liquid at 1400 kPa (kJ/kg K)\n", + "H_v2 = 2790.; \t\t\t#enthalpy of saturated vapour at 1400 kPa (kJ/kg)\n", + "S_v2 = 6.4693; \t\t\t#entropy of saturated vapour at 1400 kPa (kJ/kg K)\n", + "H5 = 3226.; \t\t\t#enthalpy of superheated steam at 1400 kPa and 658 K\n", + "S5 = 7.2558; \t\t\t#entropy of superheated steam at 1400 kPa and 658 K\n", + "H3 = 3150.; \t\t\t#enthalpy of superheated steam at 7600 kPa and 673 K\n", + "S3 = 6.4022; \t\t\t#entropy of superheated steam at 1400 kPa and 673 K\n", + "\n", + "# Calculations and Results\n", + "#Let the fraction of steam in vapour state be x\n", + "S4 = S3; \t\t\t#as the math.expansion process is isentropic\n", + "x = (S4-S_l2)/(S_v2-S_l2)\n", + "H4 = H_l2 + x*(H_v2-H_l2)\n", + "W_high = H3-H4;\n", + "\n", + "#For low pressure turbine\n", + "S6 = S5; \t\t\t#isentropic math.expansion\n", + "x = (S6-S_l1)/(S_v1-S_l1)\n", + "H6 = H_l1 + x*(H_v1-H_l1)\n", + "W_low = H5-H6;\n", + "\n", + "print '(a)'\n", + "print ' The work output of high pressure turbine is %i kJ/kg'%W_high\n", + "print ' The work output of low pressure turbine is %i kJ/kg'%W_low\n", + "\n", + "#(b)\n", + "#Work output of feed pump is [-Ws = intg(VdP)]\n", + "Ws = V*(P2-P1)\n", + "H2 = H_l1+Ws;\n", + "#Using eq. 5.82 (Page no. 159)\n", + "eff = ((H3-H2)+(H5-H4)-(H6-H_l1))/((H3-H2)+(H5-H4))\n", + "print ' (b)'\n", + "print ' Thermal efficiency is %f percent'%(eff*100)\n", + "\n", + "#(c)\n", + "#The numerator of eq. 5.82 gives net work output\n", + "W_net = (H3-H2)+(H5-H4)-(H6-H_l1)\n", + "#For 1000 kW of net work output\n", + "rate = 3.6*10**6/W_net;\n", + "print ' (c)'\n", + "print ' The rate of steam circulation is %f kg/h'%rate\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + " The work output of high pressure turbine is 391 kJ/kg\n", + " The work output of low pressure turbine is 1012 kJ/kg\n", + " (b)\n", + " Thermal efficiency is 40.225451 percent\n", + " (c)\n", + " The rate of steam circulation is 2577.792156 kg/h\n" + ] + } + ], + "prompt_number": 40 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.21,page no:142" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Given:\n", + "P2 = 2800.; \t\t\t#pressure of superheated steam (kPa)\n", + "P1 = 275.; \t\t\t#pressure of withdrawn steam (kPa)\n", + "V = 1.070*10**-3; \t\t\t#specific volume of saturated liquid at 275 kPa\n", + "\n", + "#From steam tables:\n", + "H6 = 138.; \t\t \t#enthalpy of saturated liquid at 5 kPa\n", + "S6 = 0.4764; \t\t\t#entropy of saturated liquid at 5 kPa\n", + "H_v1 = 2562.; \t\t\t#enthalpy of saturated vapour at 5 kPa\n", + "S_v1 = 8.3951; \t\t\t#entropy of saturated vapour at 5 kPa\n", + "H1 = 549.; \t\t\t #enthalpy of saturated liquid at 275 kPa\n", + "S1 = 1.6408; \t\t\t#entropy of saturated liquid at 275 kPa\n", + "H_v2 = 2721.; \t\t\t#enthalpy of saturated vapour at 275 kPa\n", + "S_v2 = 7.0209; \t\t\t#entropy of saturated vapour at 275 kPa\n", + "H3 = 3063.; \t\t\t#enthalpy of superheated steam at 2800 kPa and 598 K\n", + "S3 = 6.6875; \t\t\t#entropy of superheated steam at 2800 kPa and 598 K\n", + "\n", + "# Calculations and Results\n", + "#To determine the fraction of steam withdrawn and thermal efficiency of cycle\n", + "#Referring fig. 5.23 (Page no.161)\n", + "S4 = S3; \t\t\t#isentropic math.expansion\n", + "x = (S4-S1)/(S_v2-S1) \t\t\t#quality of steam\n", + "H4 = H1 + x*(H_v2-H1)\n", + "H7 = H6; \t\t\t #as the power input to the condensate pump is neglegible\n", + "\n", + "#Applying energy balance around feed water heater\n", + "m = (H1-H7)/(H4-H7 )\t\t\t#fraction of steam extracted\n", + "print 'Fraction of steam withdrawn is %f'%m\n", + "\n", + "W_in = V*(P2-P1) \t\t\t#work input to the feed water pump\n", + "H2 = H1+W_in;\n", + "#Considering isentropic math.expansion in turbine\n", + "S5 = S3;\n", + "x = (S5-S6)/(S_v1-S6)\n", + "H5 = H6 + x*(H_v1-H6)\n", + "#Using eq. 5.85 (Page no.162)\n", + "eff = ((H3-H2)-(1-m)*(H5-H6))/(H3-H2)\n", + "print ' Thermal efficiency is %f percent'%(eff*100)\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Fraction of steam withdrawn is 0.167865\n", + " Thermal efficiency is 36.999645 percent\n" + ] + } + ], + "prompt_number": 41 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.22,page no:143" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Given:\n", + "r = 8.; \t\t\t#compression ratio\n", + "T1 = 290.; \t\t\t#temperature at beginning (K)\n", + "P1 = 100.; \t\t\t#pressure at the beginning (kPa)\n", + "Q1 = 450.; \t\t\t#heat transferred per cycle (kJ/kg K)\n", + "Cp = 1.005; \t\t\t#specific heat of air (kJ/kg K)\n", + "Cv = 0.718; \t\t\t#specific heat of air (kJ/kg K)\n", + "R = 8.314; \t\t\t#ideal gas constant\n", + "M = 29.; \t\t\t#molecular wt of air\n", + "\n", + "#To determine mean effective pressure\n", + "#Basis:\n", + "m = 1.; \t\t\t#mass of air (kg)\n", + "\n", + "# Calculations and Results\n", + "#(a)\n", + "#Referring fig. 5.24 (Page no. 164)\n", + "V1 = (m*R*1000*T1)/(M*P1*10**3)\n", + "\n", + "#Conditions at state 2\n", + "V2 = V1/r;\n", + "gama = Cp/Cv;\n", + "T2 = T1*(r**(gama-1))\n", + "P2 = P1*(r**gama )\n", + "print '(a)'\n", + "print ' At the end of first process'\n", + "print ' Temperature = %f K'%T2\n", + "print ' Pressure = %f kPa'%P2\n", + "\n", + "#Conditions at state 3\n", + "#Constant volume process\n", + "V3 = V2;\n", + "T3 = Q1/Cv + T2;\n", + "P3 = (T3/T2)*P2;\n", + "print ' At the end of second process'\n", + "print ' Temperature = %f K'%T3\n", + "print ' Pressure = %f kPa'%P3\n", + "\n", + "#Conditions at state 4\n", + "T4 = T3/(r**(gama-1))\n", + "P4 = P3/(r**gama)\n", + "print ' At the end of third process'\n", + "print ' Temperature = %f K'%T4\n", + "print ' Pressure = %f kPa'%P4\n", + "Q2 = Cv*(T4-T1) \t\t\t#heat rejected during the constant volume process\n", + "\n", + "#(b)\n", + "#Using eq. 5.88 (Page no. 165)\n", + "eff = 1 - ((1./r)**(gama-1))\n", + "print ' (b)'\n", + "print ' Thermal efficiency is %f'%eff\n", + "\n", + "#(c)\n", + "W = Q1-Q2; \t\t\t#work done\n", + "print ' (c)'\n", + "print ' Work done is %f kJ/kg'%W\n", + "\n", + "#(d)\n", + "Pm = W/(V1-V2)\n", + "print ' (d)'\n", + "print ' Mean effective pressure is %f kPa'%Pm\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + " At the end of first process\n", + " Temperature = 665.859247 K\n", + " Pressure = 1836.853096 kPa\n", + " At the end of second process\n", + " Temperature = 1292.600195 K\n", + " Pressure = 3565.793640 kPa\n", + " At the end of third process\n", + " Temperature = 562.962905 K\n", + " Pressure = 194.125140 kPa\n", + " (b)\n", + " Thermal efficiency is 0.564473\n", + " (c)\n", + " Work done is 254.012634 kJ/kg\n", + " (d)\n", + " Mean effective pressure is 349.170259 kPa\n" + ] + } + ], + "prompt_number": 42 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.23,page no:145" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Given:\n", + "r = 15.; \t\t\t#compression ratio\n", + "P1 = 100.; \t\t\t#pressure in the beginning (kPa)\n", + "T1 = 300.; \t\t\t#temperature in thebeginning (K)\n", + "Q1 = 500.; \t\t\t#heat transfer rate (kJ/kg)\n", + "M = 29.; \t\t\t#molecular wt of air\n", + "R = 8.314; \t\t\t#ideal gas constant\n", + "gama = 1.3997214\n", + "#Specific heats of air (kJ/kg K)\n", + "Cp = 1.005;\n", + "Cv = 0.718;\n", + "\n", + "# Calculations and Results\n", + "#To determine work done thermal efficiency and mean effective pressure\n", + "#(a)\n", + "#Isentropic compression 1-2\n", + "V1 = (R*1000*T1)/(M*P1*10**3)\n", + "T2 = T1*r**(gama-1)\n", + "P2 = P1*r**gama;\n", + "V2 = V1/r;\n", + "print '(a)'\n", + "print ' At the end of first process'\n", + "print ' Temperature = %f K'%T2\n", + "print ' Pressure = %f kPa'%P2\n", + "\n", + "#Consatnt pressure heat addition 2-3\n", + "T3 = Q1/Cp + T2;\n", + "V3 = (T3/T2)*V2;\n", + "P3 = P2;\n", + "print ' At the end of second process'\n", + "print ' Temperature = %f k'%T3\n", + "print ' Pressure = %f kPa'%P3\n", + "\n", + "#Isentropic math.expansion 3-4\n", + "V4 = V1;\n", + "T4 = T3/((V4/V3)**(gama-1))\n", + "P4 = P3*((V3/V4)**gama)\n", + "print ' At the end of third process'\n", + "print ' Temperature = %f K'%T4\n", + "print ' Pressure = %f kPa'%P4\n", + "Q2 = Cv*(T4-T1) \t\t\t#heat rejected 4-1\n", + "\n", + "#(b)\n", + "Wnet = Q1-Q2;\n", + "print ' (b)'\n", + "print ' Net work done per cycle per kg air is %f kJ/kg'%Wnet\n", + "\n", + "#(c)\n", + "eff = Wnet/Q1; \t\t\t#thermal efficiency\n", + "print ' (c)'\n", + "print ' Thermal efficiency is %f'%eff\n", + "\n", + "#(d)\n", + "Pm = Wnet/(V1-V2) \t\t\t#mean effective pressure\n", + "print ' (d)'\n", + "print ' Mean effective pressure is %f kPa'%Pm\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + " At the end of first process\n", + " Temperature = 885.584689 K\n", + " Pressure = 4427.923445 kPa\n", + " At the end of second process\n", + " Temperature = 1383.097127 k\n", + " Pressure = 4427.923445 kPa\n", + " At the end of third process\n", + " Temperature = 559.936687 K\n", + " Pressure = 186.645562 kPa\n", + " (b)\n", + " Net work done per cycle per kg air is 313.365459 kJ/kg\n", + " (c)\n", + " Thermal efficiency is 0.626731\n", + " (d)\n", + " Mean effective pressure is 390.374167 kPa\n" + ] + } + ], + "prompt_number": 43 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.24,page no:146" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Given:\n", + "T1 = 300.; \t\t\t#initial temperature (K)\n", + "P1 = 100.; \t\t\t#initial pressure (kPa)\n", + "T3 = 1200.; \t\t\t#max temperature (K)\n", + "P3 = 500.; \t\t\t#max pressure (kPa)\n", + "Cp = 1.005; \t\t\t#(kJ/kg K)\n", + "Cv = 0.718; \t\t\t#(kJ/kg K)\n", + "\n", + "# Calculations and Results\n", + "#To determine pressure and temperature work and thermal efficiency\n", + "gama = Cp/Cv;\n", + "\n", + "#(a)\n", + "P4 = P1;\n", + "P2 = P3;\n", + "#Isentropic compression 1-2\n", + "T2 = T1*((P2/P1)**((gama-1)/gama))\n", + "print '(a)'\n", + "print ' At the end of first process'\n", + "print ' Temperature = %f K'%T2\n", + "print ' Pressure = %f kPa'%P2\n", + "\n", + "#Process 2-3\n", + "print ' At the end of second process'\n", + "print ' Temperature = %f K'%T3\n", + "print ' Pressure = %f kPa'%P3\n", + "\n", + "#Isentropic math.expansion 3-4\n", + "T4 = T3/((P3/P4)**((gama-1)/gama))\n", + "print ' At the end of third process'\n", + "print ' Temperature = %f K'%T4\n", + "print ' Pressure = %f kPa'%P4\n", + "\n", + "#(b)\n", + "W_comp = Cp*(T2-T1) \t\t\t#work required by compressor\n", + "print ' (b)'\n", + "print ' Work required by compressor is %f kJ/kg'%W_comp\n", + "\n", + "#(c)\n", + "W_turb = Cp*(T3-T4 )\t\t\t#work done by turbine\n", + "print ' (c)'\n", + "print ' Work done by turbine is %f kJ/kg'%W_turb\n", + "\n", + "#(d)\n", + "eff = 1-(P1/P2)**((gama-1)/gama)\n", + "print ' (d)'\n", + "print ' Thermal efficiency is %f'%eff\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + " At the end of first process\n", + " Temperature = 475.037193 K\n", + " Pressure = 500.000000 kPa\n", + " At the end of second process\n", + " Temperature = 1200.000000 K\n", + " Pressure = 500.000000 kPa\n", + " At the end of third process\n", + " Temperature = 757.835397 K\n", + " Pressure = 100.000000 kPa\n", + " (b)\n", + " Work required by compressor is 175.912379 kJ/kg\n", + " (c)\n", + " Work done by turbine is 444.375426 kJ/kg\n", + " (d)\n", + " Thermal efficiency is 0.368471\n" + ] + } + ], + "prompt_number": 44 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch6-checkpoint.ipynb b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch6-checkpoint.ipynb new file mode 100644 index 00000000..b51d5bb4 --- /dev/null +++ b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch6-checkpoint.ipynb @@ -0,0 +1,773 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:0c6f850208261348a001037520b4c6e32782c990f422185b0a289857874323db" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 6 : Thermodynamic Properties of Pure Fluids" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.1 ,page no:147" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Given:\n", + "betta = 1.25*10**-3; \t\t\t#coeffecient of math.expansion (K**-1)\n", + "V = 0.1; \t\t\t#molar volume of organic liquid (m**3/kmol)\n", + "P2 = 20.; \t\t\t#final pressure (bar)\n", + "P1 = 1.; \t\t\t#initial pressure (bar)\n", + "\n", + "# Calculations\n", + "#To determine the change in entropy of system\n", + "#betta = (1/V)*(del V/del T)p\n", + "#Let k = (del V/del T)p\n", + "k = betta*V;\n", + "\n", + "#Considering Maxwell's relation Eq. 6.24 (Page no. 193)\n", + "#dS = -k*(dP)\n", + "S = -k*(P2-P1)*10**5; \t\t\t#entropy change (J/kmol K)\n", + "\n", + "# Results\n", + "print 'Change in entropy is %f J/kmol K'%S\n", + "print ' It is assumed that (del V/del T)p is constant in the pressure range 1 to 20 bar'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Change in entropy is -237.500000 J/kmol K\n", + " It is assumed that (del V/del T)p is constant in the pressure range 1 to 20 bar\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.2,page no:148" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# Variables\n", + "T1 = 363.; \t\t\t#temperature (K)\n", + "T2 = 373.; \t\t\t#temperature (K)\n", + "P2 = 101.3; \t\t\t#vapour pressure at 373 K (kPa)\n", + "H = 2275.*18; \t\t\t#mean heat of vaporisation (kJ/kmol)\n", + "R =8.314; \t\t\t#ideal gas constant (kJ/kmol K)\n", + "\n", + "# Calculations\n", + "#To calculate vapour pressure of water at 363 K\n", + "#Using eq. 6.28 (Page no. 196)\n", + "P1 = P2/(math.e**((H/R)*((1./T1)-(1./T2))))\n", + "\n", + "# Results\n", + "print ' Vapour pressure of water at 363 K is %f kPa'%P1\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Vapour pressure of water at 363 K is 70.408579 kPa\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.3,page no:149" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "d_l = 13.69*10**3; \t\t\t#density of mercury in liquid state (kg/m**3)\n", + "d_s = 14.193*10**3; \t\t\t#density of mercury in solid state (kg/m**3)\n", + "T1 = 234.33; \t\t\t#temperature in K\n", + "P1 = 1.; \t\t\t#initial pressure in bar\n", + "P2 = 10.; \t\t\t#final pressure in bar\n", + "Hf = 9.7876; \t\t\t#heat of fusion of mercury (kJ/kg)\n", + "\n", + "# Calculations\n", + "#Assuming del_V/del_H remains constant% math.log(T2/T1) = (del_V/del_H)*(P2-P1)\n", + "del_V = (1./d_l)-(1./d_s)\n", + "T2 = T1*(math.e**((del_V/Hf)*(P2-P1)))\n", + "\n", + "# Results\n", + "print 'The melting point of mercury at 10 bar is %f K'%T2\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The melting point of mercury at 10 bar is 234.330558 K\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.4, page no:198" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T1 = 300.; \t\t\t#initial temperature (K)\n", + "T2 = 800.; \t\t\t#final temperature (K)\n", + "\n", + "# Calculations\n", + "#Heat capacity (J/mol K)\n", + "#Cp = 26.04+(5.586*10**-3*T)+(28.476*10**4*T**-2)\n", + "import math\n", + "S = 26.04*math.log(T2/T1)+5.586*10**-3*(T2-T1)+28.476*10**4/(-2)*(T2**-2-T1**-2)\n", + "\n", + "# Results\n", + "print 'The increase in entropy of solid magnesium is %f J/mol K'%S\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The increase in entropy of solid magnesium is 29.693325 J/mol K\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.7,page no:199" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T = 773.; \t\t\t#temperature (K)\n", + "P = 100.; \t\t\t#pressure (bar)\n", + "Ho = 0; \t\t\t#enthalpy of nitrogen at 273 K and 1 bar\n", + "So = 192.4; \t\t\t#entropy of nitrogen at 298 K and 1 bar\n", + "To = 273.; \t\t\t#(K)\n", + "Po = 1.; \t\t\t#(bar)\n", + "R = 8.314; \t\t\t#ideal gas constant (kJ/kmol K)\n", + "\n", + "# Calculations\n", + "#Cp = 27.3+(4.2*10**-3*T) molal heat capacity at 1 bar\n", + "#To calculate internal energy enthalpy entropy and free energyfor one mole of nitrogen\n", + "#Step 1:\n", + "#Assuming that nitrogen is initially at 273 K and 1 bar\n", + "#del_H1 = intg(CpdT)\n", + "del_H1 = 27.3*(T-To)+4.2*10**-3*(T**2-To**2)/2;\n", + "#Assuming that nitrogen is initially at 298 K and 1 bar\n", + "#del_S1 = intg(Cp*(dT/T))\n", + "del_S1 = 27.3*math.log(T/To)+4.2*10**-3*(T-To)\n", + "H1 = Ho + del_H1;\n", + "S1 = So + del_S1;\n", + "\n", + "#Step 2:\n", + "#del_H2 = [V - T*(del_V/del_T)p]dP\n", + "#Since nitrogen behaves as ideal gas\n", + "#(del_V/del_T)p = R/P% V-(R*T)/P = 0\n", + "del_H2 = 0.;\n", + "del_S2 = -R*math.log(P/Po)\n", + "H = H1 + del_H2;\n", + "S = S1 + del_S2;\n", + "\n", + "#Internal energy: U = H-PV = H-RT (J/mol)\n", + "U = H - (R*T)\n", + "\n", + "#Gibbs free energy (J/mol)\n", + "G = H-(T*S)\n", + "\n", + "# Results\n", + "print 'Enthalpy is %5.3e J/mol'%H\n", + "print ' Entropy is %f J/mol K'%S\n", + "print ' Internal energy is %4.3e J/mol'%U\n", + "print ' Gibbs free energy is %4.3e J/mol'%G\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enthalpy is 1.475e+04 J/mol\n", + " Entropy is 184.626653 J/mol K\n", + " Internal energy is 8.322e+03 J/mol\n", + " Gibbs free energy is -1.280e+05 J/mol\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.8,page no:200" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Equation of state: P(V-B) = RT + (A*P**2)/T\n", + "Cp = 33.6; \t\t\t#mean specific heat at atmosheric pressure (J/mol K)\n", + "A = 1*10**-3; \t\t\t#m**3 K/(bar)mol\n", + "B = 8.0*10**-5; \t\t\t#m**3/mol\n", + "R = 8.314*10**-5; \t\t\t#ideal gas constant (m**3 (bar)/mol K)\n", + "\n", + "import math\n", + "#For step 1:\n", + "Po = 4.; \t\t\t#pressure at A (bar)\n", + "P1 = 1.; \t\t\t#pressure at C (bar)\n", + "T = 300.; \t\t\t#temperature (K)\n", + "\n", + "# Calculations and Results\n", + "#del_S1 = intg[(del_V/del_T)pdP]\n", + "del_S1 = (R*math.log(Po/P1) - (A/T**2)*(Po**2-P1**2)/2)*10**5; \t\t\t#(J/mol K)\n", + "\n", + "#For step 2:\n", + "T1 = 300.; \t\t\t#temperature at C (K)\n", + "T2 = 400.; \t\t\t#temperature at D (K)\n", + "del_S2 = Cp*math.log(T2/T1) \t\t\t#(J/mol K)\n", + "\n", + "#For step 3:\n", + "P2 = 1.; \t\t\t#pressure at D (bar)\n", + "P3 = 12.; \t\t\t#pressure at B (bar)\n", + "T = 400.; \t\t\t#temperature (K)\n", + "del_S3 = (R*math.log(P2/P3) - (A/T**2)*(P2**2-P3**2)/2)*10**5; \t\t\t#(J/mol K)\n", + "S = del_S1+del_S2+del_S3; \t\t\t#total entropy change\n", + "print '(a). Total entropy change is %f J/mol K'%S\n", + "\n", + "#(b). The mean heat capacity at 12 bar\n", + "P1 = 4.; \t\t\t#pressure at A (bar)\n", + "P2 = 12.; \t\t\t#pressure at Co (bar)\n", + "T = 300.; \t\t\t#temperature (K)\n", + "del_S1 = R*math.log(P1/P2) - (A/T**2)*(P1**2-P2**2)/2;\n", + "\n", + "#For CoB\n", + "T2 = 400.; \t\t\t#temperature at B (K)\n", + "T1 = 300.; \t\t\t#temperature at Co (K)\n", + "del_S2 = S-del_S1;\n", + "Cpm = del_S2/(math.log(T2/T1))\n", + "print ' (b). The mean heat capacity at 12 bar is %f J/mol K'%Cpm\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a). Total entropy change is 0.568609 J/mol K\n", + " (b). The mean heat capacity at 12 bar is 1.976835 J/mol K\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.10,page no:201" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "betta = 1.8*10**-4; \t\t\t#coeffecient of volume math.expansion (K**-1)\n", + "k = 3.9*10**-6; \t\t\t#coeffecient of compressibility (bar**-1)\n", + "T = 273.; \t\t\t#temperature in K\n", + "d = 13.596*10**3; \t\t\t#density (kg/m**3)\n", + "Cp = 0.14*10**3; \t\t\t#(J/kg K)\n", + "\n", + "# Calculations\n", + "#To calculate Cv for mercury\n", + "#Using equation 6.55 (Page no. 208)\n", + "Cv = Cp - (betta**2*T*10**5)/(k*d)\n", + "\n", + "# Results\n", + "print 'Cv for mercury is %f J/kg K'%Cv\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Cv for mercury is 123.318623 J/kg K\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.21,page no:202" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Eqution of state: P(V-b) = RT\n", + "P = 10.; \t\t\t#pressure (bar)\n", + "T = 298.; \t\t\t#temperature (K)\n", + "b = 3.707*10**-5; \t\t\t#Vander Waal's constant (m**3/mol)\n", + "R = 8.314; \t\t\t#ideal gas constant\n", + "\n", + "# Calculations\n", + "#To estimate the fugacity of ammonia\n", + "#Since PV = RT + Pb% Z = 1 + (Pb/RT)\n", + "#Using equation 6.127 (Page no. 228)\n", + "f = P*(math.e**((b*P*10**5)/(R*T)))\n", + "\n", + "# Results\n", + "print 'Fugacity f = %f bar'%f\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Fugacity f = 10.150747 bar\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.22,page no:203" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#intg(alphadP) = -556.61 J/mol\n", + "P = 50.; \t\t\t#pressure in bar\n", + "T = 300.; \t\t\t#temperature in K\n", + "R = 8.314; \t\t\t#ideal gas constant\n", + "\n", + "# Calculations\n", + "#To determine the fugacity of gas\n", + "#Using equation 6.130 (Page no. 230)\n", + "f = P*math.e**(-556.61/(R*T))\n", + "\n", + "# Results\n", + "print 'Fugacity of gas at 50 bar and 300 K is %i bar'%f\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Fugacity of gas at 50 bar and 300 K is 39 bar\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.23,page no:204" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Equation of state: PV = RT(1-0.00513P)\n", + "P = [1, 5, 10]; \t\t\t#pressures in bar\n", + "phi = [0,0,0]\n", + "\n", + "# Calculations and Results\n", + "for i in range(3):\n", + " phi[i] = math.e**(-0.00513*P[i])\n", + " print ' Fugacity coeffecient at %i bar is %f'%(P[i],phi[i])\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Fugacity coeffecient at 1 bar is 0.994883\n", + " Fugacity coeffecient at 5 bar is 0.974676\n", + " Fugacity coeffecient at 10 bar is 0.949994\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.25,page no:205" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "P = 100.; \t\t\t#pressure in bar\n", + "T = 373.; \t\t\t#temperature in K\n", + "a = 0.453; \t\t\t#Vander Waal's constant (J m**3/mol**2)\n", + "b = 0.571*10**-4; \t\t\t#Vander Waal's constant (m**3/mol)\n", + "V = 2.072*10**-4; \t\t\t#molar volume (m**3/mol)\n", + "R = 8.314; \t\t\t#ideal gas constant\n", + "\n", + "# Calculations\n", + "#To determine the fugacity of pure ethylene\n", + "#Using eq. 6.139 (Page no. 233)\n", + "ln_f = (b/(V-b)) - ((2*a)/(R*T*V)) + math.log((R*T*10**-5)/(V-b) )\n", + "f = math.e**ln_f;\n", + "\n", + "# Results\n", + "print 'Fugacity is %f bar'%f\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Fugacity is 73.789328 bar\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.26,page no:206" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T = 623.; \t\t\t#temperature in K\n", + "\n", + "#Data from steam tables:\n", + "H = 3159.; \t\t\t#enthalpy at 1000 kPa and 623 K (kJ/kg)\n", + "S = 7.3; \t\t\t#entropy at 1000 kPa and 623 K (kJ/kg K)\n", + "Ho = 3176.; \t\t\t#enthalpy at 101.3 kPa and 623 K (kJ/kg)\n", + "So = 8.38; \t\t\t#entropy at 101.3 kPa and 623 K (kJ/kg K)\n", + "fo = 101.3; \t\t\t#fugacity at 101.3 kPa (kPa)\n", + "R = 8.314/18; \t\t\t#ideal gas consatnt (kJ/kg K)\n", + "\n", + "# Calculations\n", + "#To determine fugacity and fugacity coeffecient of steam\n", + "ln_phi = (1/(R*T))*((H-Ho)-T*(S-So))\n", + "f = fo*math.e**ln_phi;\n", + "phi = f/fo;\n", + "\n", + "# Results\n", + "print 'Fugacity of steam is %f bar'%(f/100)\n", + "print ' Fugacity coeffecient is %f'%phi\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Fugacity of steam is 9.895333 bar\n", + " Fugacity coeffecient is 9.768345\n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.27,page no:207" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T = 473.; \t\t\t#temperature in K\n", + "P = 50.*10**5; \t\t\t#pressure in Pa\n", + "d = 24.3; \t\t\t#density of ammonia (kg/m**3)\n", + "m = 17.; \t\t\t#molecular wt of ammonia\n", + "R = 8.314; \t\t\t#ideal gas constant\n", + "\n", + "# Calculations\n", + "#To estimate the fugacity of ammonia\n", + "V = m/(d*1000) \t\t\t#molar volume of ammonia (m**3/kmol)\n", + "#Using eq. 6.142 (Page no. 234)\n", + "f = (V*(P**2))/(R*T)\n", + "\n", + "# Results\n", + "print 'The fugacity of ammonia is %f bar'%(f/10**5)\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The fugacity of ammonia is 44.474543 bar\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.28,page no:208" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T = 303.; \t\t\t#temperature in K\n", + "P = 10.; \t\t\t#pressure in bar\n", + "Ps = 4.241/100; \t\t\t#saturation pressure (bar)\n", + "sp_vol = 1.004 *10**-3; \t\t\t#specific volume at 303 K (m**3/kg)\n", + "R = 8.314; \t\t\t#ideal gas constant\n", + "\n", + "# Calculations\n", + "#To calculate the fugacity of liquid water\n", + "V = sp_vol*10**-3*18; \t\t\t#molar volume (m**3/mol)\n", + "#Assuming vapour behaves as an ideal gas\n", + "f_sat = Ps;\n", + "#Using Eq. 6.144 (Page no. 235)\n", + "ln_phi = (V/(R*T))*(P-Ps)*10**5;\n", + "f = f_sat*math.e**ln_phi;\n", + "\n", + "# Results\n", + "print 'Fugacity of liquid water at given conditions is %f bar'%f\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Fugacity of liquid water at given conditions is 0.042714 bar\n" + ] + } + ], + "prompt_number": 32 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.29,page no:209" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T = 350.; \t\t\t#temperature in K\n", + "P = 60.; \t\t\t#pressure in bar\n", + "Ps = 9.35; \t\t\t#vapour pressure at 350 K (bar)\n", + "V = 0.1072*10**-3; \t\t\t#molar volume (m**3/mol\n", + "phi = 0.834; \t\t\t#fugacity coeffecient\n", + "R = 8.314; \t\t\t#ideal gas constant\n", + "import math\n", + "\n", + "# Calculations\n", + "#To determine fugaity of n butane in liquid state at given conditions\n", + "f_sat = phi*Ps;\n", + "#Using eq. 6.144 (Page no. 235)\n", + "ln_phi = (V/(R*T))*(P-Ps)*10**5;\n", + "f = f_sat*math.e**ln_phi;\n", + "\n", + "# Results\n", + "print 'Fugacity of n-butane in liquid state at given conditions is %f bar'%f\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Fugacity of n-butane in liquid state at given conditions is 9.397539 bar\n" + ] + } + ], + "prompt_number": 33 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.30,page no:210" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "M = 24.32; \t\t\t#molecular wt of solid magnesium\n", + "T = 300.; \t\t\t#temperature in K\n", + "P = 10.; \t\t\t#pressure in bar\n", + "Po = 1.; \t\t\t#reference state pressure (bar)\n", + "R = 8.314\n", + "d = 1.745*10**3; \t\t\t#density of Mg at 300 K in kg/m**3\n", + "\n", + "# Calculations\n", + "#To determine the ativity of solid magnesiun\n", + "#Using eq. 6.149 (Page no. 237)\n", + "ln_a = (M/(d*10**3*R*T))*(P-Po)*10**5;\n", + "a = (math.e)**ln_a;\n", + "\n", + "# Results\n", + "print 'Acivity of solid magnesium at 300 K and 10 bar is %f'%a\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Acivity of solid magnesium at 300 K and 10 bar is 1.005042\n" + ] + } + ], + "prompt_number": 34 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch7-checkpoint.ipynb b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch7-checkpoint.ipynb new file mode 100644 index 00000000..0d1aa8d7 --- /dev/null +++ b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch7-checkpoint.ipynb @@ -0,0 +1,875 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:71915326a885e9b46062fd92497fab9cb251a079b1a67891349794cbf80af96f" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 7 : Properties of Solutions" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.2,page no:211" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "V = 0.1; \t\t\t#volume of mixture required (m**3)\n", + "Ve = 0.03; \t\t\t#volume of alcohol\n", + "Vw = 0.07; \t\t\t#volume of water\n", + "de = 789.; \t\t\t#density of ethanol (kg/m**3)\n", + "dw = 997.; \t\t\t#density of water (kg/m**3)\n", + "pe = 53.6*10**-6; \t\t\t#partial molar volume of ethanol (m**3/mol)\n", + "pw = 18.*10**-6; \t\t\t#partial molar volume of water (m**3/mol)\n", + "Me = 46.; \t\t\t#molecular wt of ethanol\n", + "Mw = 18.; \t\t\t#molecular wt of water\n", + "\n", + "# Calculations\n", + "#To find the volume of mixture\n", + "ne = (Ve*de*10**3)/Me; \t\t\t#number of moles of ethanol\n", + "nw = (Vw*dw*10**3)/Mw; \t\t\t#number of moles of water\n", + "xe = ne/(ne+nw) \t\t\t#mole fraction of ethanol\n", + "xw = 1-ne; \t\t\t#mole fraction of water\n", + "act_V = (ne*pe)+(nw*pw)\n", + "\n", + "# Results\n", + "if (V==act_V) :\n", + " print 'It is possible to prepare the required solution'\n", + "else:\n", + " Ve_act = (Ve/act_V)*V;\n", + " Vw_act = (Vw/act_V)*V;\n", + " print ' For the given volumes of ethanol and water, it is not possible to prepare 0.1 cubic m of mixture'\n", + " print ' Required volume of ethanol is %f cubic m'%Ve_act\n", + " print ' Required volume of water is %f cubic m'%Vw_act\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " For the given volumes of ethanol and water, it is not possible to prepare 0.1 cubic m of mixture\n", + " Required volume of ethanol is 0.030810 cubic m\n", + " Required volume of water is 0.071890 cubic m\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.3,page no:212" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "V = 2.; \t\t\t#volume of desired solution (m**3)\n", + "x1 = 0.3; \t\t\t#moles fraction of methanol\n", + "x2 = 0.7; \t\t\t#moles fraction of water\n", + "V1 = 38.632*10**-6; \t\t\t#partial molar volume of methanol (m**3/mol)\n", + "V2 = 17.765*10**-6; \t\t\t#partial molar volume of water (m**3/mol)\n", + "mol_V1 = 40.727*10**-6; \t\t#molar volume of ethanol (m**3/mol)\n", + "mol_V2 = 18.068*10**-6; \t\t#molar volume of water (m**3/mol)\n", + "\n", + "# Calculations\n", + "#To find the required volume of methanol and water\n", + "V_mol = (x1*V1)+(x2*V2); \t\t\t#molar volume of desired solution\n", + "n = V/V_mol; \t\t\t #no. of moles in the desired solution\n", + "n1 = x1*n; \t\t\t#moles of methanol\n", + "n2 = x2*n; \t\t\t#moles of water\n", + "V_m = n1*mol_V1;\n", + "V_w = n2*mol_V2;\n", + "\n", + "# Results\n", + "print 'Volume of methanol to be taken is %f cubic m'%V_m\n", + "print ' Volume of water to be taken is %f cubic m'%V_w\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Volume of methanol to be taken is 1.017111 cubic m\n", + " Volume of water to be taken is 1.052866 cubic m\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.4,page no:213" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "V1_w = 0.816*10**-3; \t\t\t#partial molar volume of water in 96% alcohol solution\n", + "V1_e = 1.273*10**-3; \t\t\t#partial molar volume of ethanol in 96% alcohol solution\n", + "V2_w = 0.953*10**-3; \t\t\t#partial molar volume of water in 56% alcohol solution\n", + "V2_e = 1.243*10**-3; \t\t\t#partial molar volume of ethanol in 56% alcohol solution\n", + "d = 0.997*10**3; \t\t\t #density of water (kg/m**3)\n", + "\n", + "\n", + "# Calculations\n", + "#To calculate the volume of water to be added and volume of dilute alcohol solution\n", + "#Basis: \n", + "V = 2*10**-3; \t\t\t #volume of alcohol solution (m**3)\n", + "V_sp = (0.96*V1_e)+(0.04*V1_w); \t\t\t#volume of 1 kg of laboratory alcohol\n", + "m_e = V/V_sp; \t\t\t #mass of 2*10**-3 m**3 alcohol \n", + "\n", + "#(a).\n", + "#Let mass of water added be m kg\n", + "#Taking an alcohol balance\n", + "m = (m_e*0.96)/0.56 - m_e;\n", + "v = m/d;\n", + "\n", + "# Results\n", + "print ' (a).'\n", + "print ' Mass of water added is %f kg'%m\n", + "print ' Volume of water added is %4.3e cubic m'%v\n", + "\n", + "#(b)\n", + "m_sol = m_e + m; \t\t\t #mass of alcohol solution obtained\n", + "sp_vol = (0.56*V2_e)+(0.44*V2_w); \t\t\t#specific volume of 56% alcohol\n", + "V_dil = sp_vol*m_sol; \t\t\t #volume of dilute alcohol solution\n", + "print ' (b)'\n", + "print ' Volume of dilute alcohol solution is %5.4e cubic m'%V_dil\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " (a).\n", + " Mass of water added is 1.138558 kg\n", + " Volume of water added is 1.142e-03 cubic m\n", + " (b)\n", + " Volume of dilute alcohol solution is 3.0479e-03 cubic m\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.6,page no:214" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "x1= .3\n", + "x2 = .7\n", + "\n", + "# Calculations and Results\n", + "H = 400.*x1 + 600*x2 + x1*x2*(40*x1+20*x2)\n", + "H1 = 420.-60+40;\n", + "#Using eq. 7.28 (Page no. 264)\n", + "#H = H2_bar as x2 = 1\n", + "H2 = 600.;\n", + "print ' (b).'\n", + "print ' Pure state enthalpies are:'\n", + "print ' H1 = %i J/mol'%H1\n", + "print ' H2 = %i J/mol'%H2\n", + "\n", + "\t\t\t#(c).\n", + "\t\t\t#H1_inf = H1_bar as x1 = 0, so from eq. 7.27\n", + "H1_inf = 420.;\n", + "\t\t\t#H2_inf = H2_bar as x2 = 0. so from eq 7.28\n", + "H2_inf = 640.;\n", + "print ' (c).'\n", + "print ' At infinite dilution:'\n", + "print ' H1 = %i J/mol'%H1_inf\n", + "print ' H2 = %i J/mol'%H2_inf\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " (b).\n", + " Pure state enthalpies are:\n", + " H1 = 400 J/mol\n", + " H2 = 600 J/mol\n", + " (c).\n", + " At infinite dilution:\n", + " H1 = 420 J/mol\n", + " H2 = 640 J/mol\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.7,page no:215" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def V(m):\n", + " y = 1.003*10**-3 + 0.1662*10**-4*m + 0.177*10**-5*m**1.5 + 0.12*10**-6*m**2\n", + " return y\n", + "\n", + "# Variables\n", + "m = 0.1; \t\t\t#molality of solution (mol/kg)\n", + "\n", + "# Calculations\n", + "#To calculate the partial molar volume of the components\n", + "#Differentiating Eq. 7.29 with reference to m, we get\n", + "V1_bar = 0.1662*10**-4 + 0.177*1.5*10**-5*m**0.5 + 0.12*2*10**-6*m;\n", + "V_sol = V(m) \t\t\t#volume of aqueous soluttion\n", + "n1 = m;\n", + "n2 = 1000./18;\n", + "V2_bar = (V_sol - n1*V1_bar)/n2;\n", + "\n", + "# Results\n", + "print 'Partial molar volume of water = %4.3e cubic m/mol'%V2_bar\n", + "print ' Partial molar volume of NaCl = %4.3e cubic m/mol'%V1_bar\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Partial molar volume of water = 1.805e-05 cubic m/mol\n", + " Partial molar volume of NaCl = 1.748e-05 cubic m/mol\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.10,page no:216" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "K = 4.4*10**4; \t\t\t#Henry's law constant (bar)\n", + "pp = 0.25; \t\t\t #partial pressure of oxygen in bar\n", + "M_O2 = 32.; \t\t\t#molecular wt of oxygen\n", + "M_water = 18.; \t\t\t#molecular wt of water\n", + "\n", + "# Calculations and Results\n", + "#To estimate the solubility of oxygen in water at 298 K\n", + "#Using eq. 7.72 (Page no. 275)\n", + "x_O2 = pp/K; \t\t\t#mole fraction of O2\n", + "print 'Solubility of oxygen is %5.4e moles per mole of water'%x_O2\n", + "\n", + "#In mass units\n", + "sol_O2 = (x_O2*M_O2)/M_water;\n", + "print ' Solubility of oxygen in mass units is %4.3e kg oxygen per kg water'%sol_O2\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Solubility of oxygen is 5.6818e-06 moles per mole of water\n", + " Solubility of oxygen in mass units is 1.010e-05 kg oxygen per kg water\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.11,page no:217" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "%pylab inline\t\t\t\n", + " \n", + "from numpy import *\n", + "from matplotlib.pyplot import *\n", + "import numpy\n", + "\n", + "# Variables\n", + "xb = array([0, 0.2, 0.4, 0.6, 0.8, 1.0])\n", + "pa_bar = [0.457 ,0.355, 0.243, 0.134, 0.049, 0];\n", + "pb_bar = [0,0.046, 0.108, 0.187, 0.288, 0.386];\n", + "\n", + "\n", + "#To confirm mixture conforms to Raoult's Law and to determine Henry's law constant\n", + "xa = 1 - xb\n", + "plot(xa,pa_bar)\n", + "plot(xa,pb_bar)\n", + "\n", + "# Calculations and Results\n", + "#For Henry's law plotting\n", + "x = [0,0.2, 0.4 ,0.6 ,0.8 ,1.0];\n", + "#Form the partial presures plot of component A and B\n", + "yh1 = [0,0,0,0,0,0]\n", + "yh1[0] = 0; \n", + "yh1[1] = 0.049; \t\t\t#For component A\n", + "for i in range(2,6):\n", + " yh1[i] = yh1[i-1]+(x[i]-x[i-1])*((yh1[1]-yh1[0])/(x[1]-x[0]))\n", + "\n", + "yh_2 = [0,0,0,0,0,0]\n", + "yh_2[5] = 0; \n", + "yh_2[4] = 0.046; \t\t\t#For component B\n", + "i = 3;\n", + "while (i>=0):\n", + " yh_2[i] = yh_2[i+1] + (x[i]-x[i+1])*((yh_2[5]-yh_2[4])/(x[5]-x[4]))\n", + " i = i-1;\n", + "\n", + "plot(x,yh1)\n", + "plot(x,yh_2)\n", + "\t\t\t#legend(\"Partial pressure \",\" \",\"Raoults law\",\" \",\"Henrys Law\"\n", + "show()\n", + "#(a)\n", + "print 'From the graph it can be inferred that, in the region where Raoults law is obeyed by A, the Henrys law is obeyed by B, and vice versa'\n", + "\n", + "#(b)\n", + "#Slope of Henry's law\n", + "print ' For component A, Ka = %f bar'%yh1[5]\n", + "print ' For component B, Kb = %f bar'%yh_2[0]\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Populating the interactive namespace from numpy and matplotlib\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAXYAAAEACAYAAACnJV25AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlclPX6//EXiIqKsooLGO6aCIqiqbngkrtgglnnHLM8\nFsEvW06raaUdsyzLry0qmaZHSyswwY0slRQ1FzCJTM0lA3eGTZBlmLl/f9wKmoqAM3MPw/V8PHx8\n5TjOXN36ffPxuj/39bFTFEVBCCGE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xumjTYb/ewUmVfYwsq+98ZFRVFSEiI\nJUqzqIpchzNnzhAbG0tERARQ8ecnqpuKXIujR49y9uxZevfujb+/P59//rmly7SIilyLJ554gt9+\n+43mzZvTpUsXFixYYOkyrUZl88SkIxJN/UBTdVaZ/6aEhASWLVvGrl27zFiRNipyHZ577jnefffd\n0mFHf//7YSsqci0MBgOpqals27aNK1eu0KtXL3r37o2vr68FKrScilyLOXPm0LVrVxISEjhx4gQP\nPPAAhw4dKv1Xbk1Tmdw06Yrd29ubtLS00q/T0tJu+C5zq9fcbvxAdVeRawGQkpLClClTiIuLK/ef\nYtVVRa5DUlISDz/8MK1atSImJobIyEji4uIsXarZVeRa3HPPPQwdOpR69erh7u7OgAEDSElJsXSp\nZleRa5GYmMj48eMBaNOmDa1ateL333+3aJ3WotK5acobAAUFBYqPj4+Snp6uFBcXK4GBgUpSUtJN\nNwHGjh2rKIqiJCUlKf7+/qYswWpU5FqcPn1aadOmjbJnzx6NqjS/ilyH6z322GNKTEyMBSu0nIpc\ni+TkZGXw4MFKSUmJkp+fr3Tq1Ek5ePCgRhWbT0WuRWRkpDJz5kxFURTl/PnzStOmTUtvKtuiU6dO\nlXvztDK5adJWjDzQVKYi1+Ktt94iKyurtLdcu3Zt9u3bp2XZJleR61BTVORaBAQEMHz4cPz9/dHr\n9UyZMoWuXbtqXLnpVeRavPHGG/zrX/+iU6dOGAwGZs+eXXpT2dY88sgj/PTTT2RkZNCiRQtmzZqF\nXq8Hqpab8oCSEELYGNsceC6EEDWYBLsQQtgYCXYhhLAxEuxCCGFjJNiFEMLGSLALIYSNkWAXQggb\nI8EuhBA25v8DAAQCZcrB/UMAAAAASUVORK5CYII=\n", + "text": [ + "" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "From the graph it can be inferred that, in the region where Raoults law is obeyed by A, the Henrys law is obeyed by B, and vice versa\n", + " For component A, Ka = 0.245000 bar\n", + " For component B, Kb = 0.230000 bar\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.12,page no:218" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from numpy import array\n", + "\n", + "\n", + "# Variables\n", + "xa = array([0, 0.2, 0.4, 0.6, 0.8, 1.0]);\n", + "Pa_bar = [0 ,0.049, 0.134, 0.243, 0.355, 0.457];\n", + "Pb_bar = [0.386 ,0.288, 0.187, 0.108, 0.046, 0];\n", + "\n", + "# Calculations and Results\n", + "#To calculate activity and activity coeffecient of chloroform\n", + "xb = 1-xa;\n", + "Pbo = 0.386; \t\t\t#vapour pressure of pure chloroform\n", + "#(a). Based on standard state as per Lewis-Randall rule\n", + "\n", + "print 'Based on Lewis Randall Rule'\n", + "print ' Activity Activity coeffecient'\n", + "a = [0,0,0,0,0,0]\n", + "ac = [0,0,0,0,0,0]\n", + "for i in range(6):\n", + " a[i] = Pb_bar[i]/Pbo;\n", + " print ' %f'%a[i],\n", + " if(xb[i]==0):\n", + " print ' Not defined',\n", + " else:\n", + " ac[i] = a[i]/xb[i];\n", + " print ' %f'%ac[i]\n", + "\n", + "#(b). Based on Henry's Law \n", + "Kb = 0.217; \t\t\t#bar (From Example 7.11 Page no. 276)\n", + "\n", + "print '\\n\\n Based on Henrys Law'\n", + "print ' Activity Activity coeffecient'\n", + "for i in range(6):\n", + " a[i] = Pb_bar[i]/Kb;\n", + " print ' %f'%a[i],\n", + " if(xb[i]==0):\n", + " print ' Not defined',\n", + " else:\n", + " ac[i] = a[i]/xb[i];\n", + " print ' %f'%ac[i]\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Based on Lewis Randall Rule\n", + " Activity Activity coeffecient\n", + " 1.000000 1.000000\n", + " 0.746114 0.932642\n", + " 0.484456 0.807427\n", + " 0.279793 0.699482\n", + " 0.119171 0.595855\n", + " 0.000000 Not defined \n", + "\n", + " Based on Henrys Law\n", + " Activity Activity coeffecient\n", + " 1.778802 1.778802\n", + " 1.327189 1.658986\n", + " 0.861751 1.436252\n", + " 0.497696 1.244240\n", + " 0.211982 1.059908\n", + " 0.000000 Not defined\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.13,page no:219" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "P = 20.; \t\t\t#pressure in bar\n", + "\n", + "# Calculations and Results\n", + "def f1(x1):\n", + " y = (50*x1)-(80*x1**2)+(40*x1**3)\n", + " return y\n", + "\n", + "#To determine fugacity fugacity coeffecient Henry's Law constant and activity coeffecient\n", + "\n", + "#(a)\n", + "#Fugacity of component in solution becomes fugacity of pure component when mole fraction approaches 1 i.e. \n", + "x1 = 1.;\n", + "f1_pure = f1(x1);\n", + "print '(a). Fugacity f1 of pure component 1 is %i bar'%f1_pure\n", + "\n", + "#(b)\n", + "phi = f1_pure/P;\n", + "print ' (b). Fugacity coeffecient is %f'%phi\n", + "\n", + "#(c)\n", + "#Henry's Law constant is lim (f1/x1)and x1 tends to 0 \n", + "x1 = 0;\n", + "K1 = 50 - (80*x1) + (40*x1**2);\n", + "print ' (c). Henrys Law constant is %i bar'%K1\n", + "\n", + "#(d)\n", + "print ' (d). This subpart is theoretical and does not involve any numerical computation'\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a). Fugacity f1 of pure component 1 is 10 bar\n", + " (b). Fugacity coeffecient is 0.500000\n", + " (c). Henrys Law constant is 50 bar\n", + " (d). This subpart is theoretical and does not involve any numerical computation\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.17,page no:220" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "H1_pure = 400.; \t\t\t#enthalpy of pure liquid 1 at 298 K and 1 bar (J/mol)\n", + "H2_pure = 600.; \t\t\t#enthalpy of pure liquid 2 (J/mol)\n", + "x1 = 0.;\n", + "\n", + "# Calculations\n", + "delH1_inf = 20*((1-x1)**2)*(2*x1+1);\n", + "H1_inf = H1_pure + delH1_inf; \t\t\t#(J/mol)\n", + "\n", + "#For infinite dilution of 2, x1 = 1 and delH2_inf = H2_bar\n", + "x1 = 1.;\n", + "delH2_inf = 40.*x1**3;\n", + "H2_inf = delH2_inf + H2_pure; \t\t\t#(J/mol)\n", + "\n", + "# Results\n", + "print 'Enthalpy at infinite dilution for component 1 is %i J/mol'%H1_inf\n", + "print ' Enthalpy at infinite dilution for component 2 is %i J/mol'%H2_inf\n", + "\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enthalpy at infinite dilution for component 1 is 420 J/mol\n", + " Enthalpy at infinite dilution for component 2 is 640 J/mol\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.19 ,page no:221" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "R = 8.314; \t\t\t#ideal gas constant\n", + "n1 = 100.; \t\t\t#moles of nitrogen\n", + "n2 = 100.; \t\t\t#moles of oxygen\n", + "\n", + "# Calculations\n", + "#To determine the change in entropy of the contents of the vessel\n", + "x1 = n1/(n1+n2);\n", + "x2 = n2/(n1+n2);\n", + "import math\n", + "\n", + "#Using eq. 7.122 (Page no. 292)\n", + "S = -R*(x1*math.log (x1) + x2*math.log (x2));\n", + "S_tot = S*(n1+n2);\n", + "\n", + "# Results\n", + "print 'Change in entropy of components are %f J/K'%S_tot\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Change in entropy of components are 1152.565132 J/K\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.20,page no:222" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "Hf = -408.610; \t\t\t#heat of formation (kJ)\n", + "#For reaction 2\n", + "#LiCl + 12H2O --> LiCl(12H2O)\n", + "H_sol = -33.614; \t\t\t#heat of solution (kJ)\n", + "\n", + "#To determine heat of formation of LiCl in 12 moles of water\n", + "#Adding reaction 1 and 2% we get\n", + "\n", + "# Calculations\n", + "#Li + 1/2Cl2 + 12H2O --> LiCl(12H2O)\n", + "H_form = Hf+H_sol;\n", + "\n", + "# Results\n", + "print 'Heat of formation of LiCl in 12 moles of water is %f kJ'%H_form\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat of formation of LiCl in 12 moles of water is -442.224000 kJ\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.21,page no:223" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "R = 8.314; \t\t\t#ideal gas constant\n", + "n1 = 3.; \t\t\t#moles of hydrogen\n", + "n2 = 1.; \t\t\t#moles of nitrogen\n", + "T = 298.; \t\t\t#temperature in K\n", + "P1 = 1.; \t\t\t#pressure of hydrogen in bar\n", + "P2 = 3.; \t\t\t#pressure of nitrogen in bar\n", + "import math\n", + "\n", + "# Calculations\n", + "#To calculate the free energy of mixing\n", + "V1 = (n1*R*T)/(P1*10**5); \t\t\t#volume occupied by hydrogen\n", + "V2 = (n2*R*T)/(P2*10**5); \t\t\t#volume occupied by nitrogen\n", + "V = V1+V2; \t\t\t#total volume occupied\n", + "P = ((n1+n2)*R*T)/(V*10**5); \t\t\t#final pressure attained by mixture (bar)\n", + "G1 = R*T*(n1*math.log(P/P1) + n2*math.log(P/P2));\n", + "\n", + "#For step 2, using eq. 7.121 (Page no. 292)\n", + "x1 = n1/(n1+n2);\n", + "x2 = n2/(n1+n2);\n", + "G2 = (n1+n2)*R*T*(x1*math.log (x1) + x2*math.log (x2));\n", + "G = G1+G2; \t\t\t#free energy in J\n", + "\n", + "# Results\n", + "print 'The free energy of mixing when partition is removed is %f kJ'%(G/1000)\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The free energy of mixing when partition is removed is -6.487935 kJ\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.22,page no:224" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "C_water = 4.18*10**3; \t\t\t#heat capacity of water (J/kg K)\n", + "C_ethanol = 2.58*10**3; \t\t#heat capacity of ethanol (J/kg K)\n", + "G1 = -758.; \t\t\t#heat of mixing 20 mol percent ethanol water at 298 K(J/mol)\n", + "G2 = -415.; \t\t\t#heat of mixing 20 mol percent ethanol water at 323 K (J/mol)\n", + "n_wat = 0.8; \t\t\t#moles of water\n", + "n_eth = 0.2; \t\t\t#moles of ethanol\n", + "T1 = 323.; \t\t\t#initial temperature in K\n", + "T2 = 298.; \t\t\t#final temperature in K\n", + "\n", + "# Calculations\n", + "#Step 1: Water is cooled from 323 K t0 298 K\n", + "H1 = n_wat*18*C_water*(T2-T1)/1000; \t\t\t#(J)\n", + "\n", + "#Step 2: Ethanol is cooled from 323 to 298 K\n", + "H2 = n_eth*46*C_ethanol*(T2-T1)/1000; \t\t\t#(J)\n", + "\n", + "#Step 3: 0.8 mol water and 0.2 mol ethanol are mixed at 298 K\n", + "H3 = G1; \t\t\t#(J)\n", + "\n", + "#Step 4: \n", + "H = G2;\n", + "Cpm = (H-H1-H2-H3)/(T1-T2);\n", + "\n", + "# Results\n", + "print 'Mean heat capacity of solution is %f J/mol K'%Cpm\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mean heat capacity of solution is 97.648000 J/mol K\n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.23,page no:225" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "To = 298.; \t\t\t#initial temperature (K)\n", + "Cpm = 97.65; \t\t\t#Mean heat capacity of solution (J/mol K)\n", + "Hs = -758.; \t\t\t#heat of mixing (J/mol)\n", + "H = 0.;\n", + "\n", + "# Calculations\n", + "T = (H-Hs)/Cpm + To;\n", + "\n", + "# Results\n", + "print 'The final temperature attained by the mixing is %f K'%T\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The final temperature attained by the mixing is 305.762417 K\n" + ] + } + ], + "prompt_number": 30 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch8-checkpoint.ipynb b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch8-checkpoint.ipynb new file mode 100644 index 00000000..13017199 --- /dev/null +++ b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch8-checkpoint.ipynb @@ -0,0 +1,1436 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:5bce75bac501ff67175351e42ece1f4cf6e76b54a447049ce4168abb033c71a9" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 8 : Phase equilibria" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.6,page no:226" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "P1 = 106.; \t\t\t#vapour pressure of n-heptane (kPa)\n", + "P2 = 74.; \t\t\t#vapour pressure of toluene (kPa)\n", + "P = 101.3; \t\t\t#total pressure (kPa)\n", + "\n", + "# Calculations\n", + "x = (P-P2)/(P1-P2)\n", + "y = x*(P1/P)\n", + "\n", + "# Results\n", + "print 'Composition of liquid heptane is %f mol percent'%(x*100)\n", + "print ' Composition of heptane in vapour form is %f mol percent'%(y*100)\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Composition of liquid heptane is 85.312500 mol percent\n", + " Composition of heptane in vapour form is 89.270731 mol percent\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.7,page no:228" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "P1 = 135.4; \t\t\t#vapour pressure of benzene (kPa)\n", + "P2 = 54.; \t\t\t#vapour pressure of toluene (kPa)\n", + "x = 0.5; \t\t\t#liquid phase composition\n", + "\n", + "# Calculations\n", + "#Using eq. 8.51 (Page no. 332)\n", + "P_beg = P2 + (P1-P2)*x;\n", + "\n", + "#At the end\n", + "y = 0.5; \t\t\t#vapour phase composition\n", + "#Using eq. 8.54 (Page no. 333) and rearranging\n", + "P_end = (P1*P2)/(P1-y*(P1-P2))\n", + "\n", + "# Results\n", + "print 'Pressure at the beginning of the process is %f kPa'%(P_beg)\n", + "print ' Pressure at the end of the process is %f kPa'%(P_end)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Pressure at the beginning of the process is 94.700000 kPa\n", + " Pressure at the end of the process is 77.208025 kPa\n" + ] + } + ], + "prompt_number": 31 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.8,page no:229" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "def P1(T):\n", + " y1 = math.e**(14.5463 - 2940.46/(T-35.93)) \t\t\t#vapour pressure of acetone\n", + " return y1\n", + "\n", + "def P2(T):\n", + " y2 = math.e**(14.2724 - 2945.47/(T-49.15)) \t\t\t#vapour pressure of acetonitrile\n", + " return y2\n", + "\n", + "# Variables\n", + "T = 327.; \t\t\t#temperature in K\n", + "P = 65.; \t\t\t#pressure in kPa\n", + "\n", + "# Calculations and Results\n", + "P1_s = P1(T)\n", + "P2_s = P2(T)\n", + "\t\t\t#Using eq. 8.51 (Page no. 332)\n", + "x1 = (P-P2_s)/(P1_s-P2_s)\n", + "\t\t\t#Using eq. 8.54 (Page no. 333)\n", + "y1 = x1*(P1_s/P)\n", + "print '(a)'\n", + "print ' x1 = %f'%x1\n", + "print ' y1 = %f'%y1\n", + "\n", + "\t\t\t#(b). To calculate T and y1\n", + "P = 65.; \t\t\t#pressure in kPa\n", + "x1 = 0.4;\n", + "\n", + "flag = 1.;\n", + "T2 = 340.; \t\t\t#temperatue (assumed)\n", + "while(flag==1):\n", + " P1_s = P1(T2)\n", + " P2_s = P2(T2)\n", + " P_calc = P2_s + x1*(P1_s-P2_s)\n", + " if((P_calc-P)<=1):\n", + " flag = 0;\n", + " else:\n", + " T2 = T2-0.8;\n", + "\n", + "y1 = x1*(P1_s/P)\n", + "print ' (b)'\n", + "print ' Temperature is %f K'%T2\n", + "print ' y1 = %f'%y1\n", + "\n", + "\t\t\t#(c). To calculate P and y1\n", + "T3 = 327.; \t\t\t#temperature in K\n", + "x1 = 0.4;\n", + "\n", + "P1_s = P1(T3)\n", + "P2_s = P2(T3)\n", + "P = P2_s + x1*(P1_s-P2_s)\n", + "y1 = x1*(P1_s/P)\n", + "print ' (c)'\n", + "print ' Pressure is %f kPa'%P\n", + "print ' y1 = %f'%y1\n", + "\n", + "\t\t\t#(d). To calculate T and x1\n", + "P = 65.; \t\t\t#pressure in kPa\n", + "y1 = 0.4;\n", + "\n", + "flag = 1.;\n", + "T = 340.; \t\t\t#assumed temperature (K)\n", + "while(flag==1):\n", + " P1_s = P1(T)\n", + " P2_s = P2(T)\n", + " y1_calc = (P1_s*(P-P2_s))/(P*(P1_s-P2_s))\n", + " if((y1_calc-y1)>=0.001):\n", + " flag = 0;\n", + " else:\n", + " T = T-2;\n", + "\n", + "x1 = y1*(P/P1_s)\n", + "print ' (d)'\n", + "print ' Temperature = %f K'%T\n", + "print ' x1 = %f'%x1\n", + "\n", + "#(e). To calculate P and x1\n", + "T = 327.; \t\t\t#temperature (K)\n", + "y1 = 0.4;\n", + "\n", + "P1_s = P1(T)\n", + "P2_s = P2(T)\n", + "#Using eq. 8.54 and 8.51\n", + "x1 = (y1*P2_s)/(P1_s-y1*(P1_s-P2_s))\n", + "P = x1*(P1_s/y1)\n", + "print ' (e)'\n", + "print ' Pressure = %f kPa'%P\n", + "print ' x1 = %f'%x1\n", + "\n", + "#(f). To calculate fraction of the system is liquid and vapour in equilibrium\n", + "T = 327.; \t\t\t#temperature (K)\n", + "P = 65.; \t\t\t#pressure (kPa)\n", + "y1 = 0.7344;\n", + "\n", + "P1_s = P1(T)\n", + "P2_s = P2(T)\n", + "x1 = (P-P2_s)/(P1_s-P2_s)\n", + "#Let f be the fraction of the mixture that is liquid\n", + "#Applying acetone balance\n", + "f = (0.7-y1)/(x1-y1)\n", + "print ' (f)'\n", + "print ' Fraction of mixture that is liquid is %f percent'%(f*100)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + " x1 = 0.560806\n", + " y1 = 0.734393\n", + " (b)\n", + " Temperature is 330.400000 K\n", + " y1 = 0.588617\n", + " (c)\n", + " Pressure is 57.633467 kPa\n", + " y1 = 0.590765\n", + " (d)\n", + " Temperature = 334.000000 K\n", + " x1 = 0.240940\n", + " (e)\n", + " Pressure = 50.093199 kPa\n", + " x1 = 0.235402\n", + " (f)\n", + " Fraction of mixture that is liquid is 19.816333 percent\n" + ] + } + ], + "prompt_number": 32 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.9,page no:250" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "\n", + "%pylab inline\n", + "\n", + "# Variables\n", + "P = 101.3; \t\t\t#total pressure over the system (kPa)\n", + "T = [371.4, 378, 383, 388, 393, 398.6];\n", + "Pa = [101.3 ,125.3, 140.0, 160.0 ,179.9, 205.3];\n", + "Pb = [44.4 ,55.6 ,64.5, 74.8, 86.6 ,101.3];\n", + "xa = [0,0,0,0,0,0]\n", + "ya = [0,0,0,0,0,0]\n", + "\n", + "# Calculations\n", + "#To construct boiling point and equilibrium point diagram\n", + "for i in range(6):\n", + " xa[i] = (P-Pb[i])/(Pa[i]-Pb[i]) \t\t\t#Using eq. 8.51\n", + " ya[i] = xa[i]*(Pa[i]/P )\t\t\t#Using eq. 8.54\n", + "\n", + "from matplotlib.pyplot import *\n", + "\t\t\t#(a).\n", + "\t\t\t#To construct boiling point diagram\n", + "plot(xa,T)\n", + "plot(ya,T)\n", + "\t\t\t#title(\"Boiling Point diagram xa and ya Temperature\"\n", + "\t\t\t#(b).\n", + "\t\t\t#To construct the equilibrium diagram\n", + "plot(ya,xa)\n", + "\t\t\t#title(\"Equilibrium Diagram\",\"xa\",\"ya\"\n", + "show()\n", + "#(c).\n", + "\n", + "# Results\n", + "print '(c). The given subpart is theoretical and does not involve any numerical computation'\n", + "\n", + "\n" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.11,page no:252" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "x1 = 46.1/100; \t\t\t#mole percent of A\n", + "P = 101.3; \t\t\t#total pressure of system (kPa)\n", + "P1_s = 84.8; \t\t\t#vapour pressure of component A (kPa)\n", + "P2_s = 78.2; \t\t\t#vapour pressure of component B (kPa) \n", + "\n", + "# Calculations\n", + "#To calculate van Laar constants\n", + "gama1 = P/P1_s;\n", + "gama2 = P/P2_s;\n", + "x2 = 1-x1;\n", + "import math\n", + "#van Laar constants:\n", + "#Using eq. 8.69 (Page no. 348)\n", + "A = math.log (gama1)*(1 + (x2*math.log(gama2))/(x1*math.log(gama1)))**2;\n", + "B = math.log (gama2)*(1 + (x1*math.log(gama1))/(x2*math.log(gama2)))**2;\n", + "\n", + "# Results\n", + "print 'van Laar constants are:'\n", + "print ' A = %f'%A\n", + "print ' B = %f'%B\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "van Laar constants are:\n", + " A = 1.298059\n", + " B = 0.652282\n" + ] + } + ], + "prompt_number": 34 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.12,page no:253" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "x2 = 0.448; \t\t\t#mole fraction of ethanol\n", + "P = 101.3; \t\t\t#total pressure (kPa)\n", + "P1_s = 68.9; \t\t\t#Vapour pressure of benzene (kPa)\n", + "P2_s = 67.4; \t\t\t#vapour pressure of ethanol (kPa)\n", + "\n", + "# Calculations\n", + "#To calculate activity coeffecients in a solution containing 10% alcohol\n", + "x1 = 1-x2;\n", + "gama1 = P/P1_s;\n", + "gama2 = P/P2_s;\n", + "import math\n", + "#Using eq. 8.69 (Page no. 348)\n", + "#van Laar constants:\n", + "A = math.log(gama1)*(1 + (x2*math.log(gama2))/(x1*math.log(gama1)))**2;\n", + "B = math.log(gama2)*(1 + (x1*math.log(gama1))/(x2*math.log(gama2)))**2;\n", + "\n", + "#For solution containing 10% alcohol\n", + "x2 = 0.1;\n", + "x1 = 1-x2;\n", + "ln_g1 = (A*x2**2)/(((A/B)*x1+x2)**2)\n", + "ln_g2 = (B*x1**2)/((x1+(B/A)*x2)**2)\n", + "gama1 = math.e**ln_g1;\n", + "gama2 = math.e**ln_g2;\n", + "\n", + "# Results\n", + "print 'Activity coeffecients:'\n", + "print ' For component 1: %f'%gama1\n", + "print ' For component 2: %f'%gama2\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Activity coeffecients:\n", + " For component 1: 1.025516\n", + " For component 2: 4.141567\n" + ] + } + ], + "prompt_number": 35 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.13,page no:254" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "x2 = 0.585; \t\t\t#mol fraction of hydrazine\n", + "P = 101.3; \t\t\t#total pressure of system (kPa)\n", + "P2_s = 124.76; \t\t\t#vapour pressure of hydrazine (kPa)\n", + "\n", + "# Calculations\n", + "#To calculate equilibrium vapour composition for solution containing 20% (mol) hydrazine\n", + "x1 = 1-x2;\n", + "P1_s = 1.6*P2_s; \t\t\t#vapour pressure of water (kPa)\n", + "gama1 = P/P1_s;\n", + "gama2 = P/P2_s;\n", + "\n", + "import math\n", + "#Using eq. 8.69 (Page no. 348)\n", + "#van Laar constants:\n", + "A = math.log(gama1)*(1 + (x2*math.log(gama2))/(x1*math.log(gama1)))**2;\n", + "B = math.log(gama2)*(1 + (x1*math.log(gama1))/(x2*math.log(gama2)))**2;\n", + "\n", + "#For solution containing 20% hydrazine\n", + "x2 = 0.2;\n", + "x1 = 1-x2;\n", + "ln_g1 = (A*x2**2)/(((A/B)*x1+x2)**2)\n", + "ln_g2 = (B*x1**2)/((x1+(B/A)*x2)**2)\n", + "gama1 = math.e**ln_g1;\n", + "gama2 = math.e**ln_g2;\n", + "\n", + "#Using eq. 8.47 (Page no. 325) for components 1 and 2 and rearranging\n", + "alpha = 1.6; \t\t\t#alpha = P1_s/P2_s\n", + "y1 = 1./(1 + (gama2*x2)/(gama1*x1*alpha))\n", + "y2 = 1-y1;\n", + "\n", + "# Results\n", + "print 'Equilibrium vapour composition for solution containing 20 mol percent hydrazine'\n", + "print ' Hydrazine is %f percent'%(y2*100)\n", + "print ' Water is %f percent'%(y1*100)\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Equilibrium vapour composition for solution containing 20 mol percent hydrazine\n", + " Hydrazine is 5.279270 percent\n", + " Water is 94.720730 percent\n" + ] + } + ], + "prompt_number": 36 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.15,page no:255" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Given:\n", + "x1 = 0.047; \t\t\t#mol fraction of isopropanol\n", + "P1 = 91.11; \t\t\t#vapour pessure of pure propanol (kPa)\n", + "P = 91.2; \t\t\t#toatl pressure of system (kPa)\n", + "P2 = 47.36; \t\t\t#vapour pressure of water (kPa)\n", + "\n", + "#van Laar consatnts:\n", + "A = 2.470;\n", + "B = 1.094;\n", + "\n", + "#To determine the total pressure:\n", + "x2 = 1-x1;\n", + "#Using eq. 8.68 (Page no. 348)\n", + "ln_g1 = (A*x2**2)/(((A/B)*x1 + x2)**2);\n", + "ln_g2 = (B*x1**2)/((x1 + (B/A)*x2)**2);\n", + "gama1 = math.e**ln_g1;\n", + "gama2 = math.e**ln_g2;\n", + "#Total pressure:\n", + "P_tot = (gama1*x1*P1) + (gama2*x2*P2);\n", + "\n", + "# Results\n", + "if(P==P_tot):\n", + " print 'This is equal to total pressure'\n", + "else:\n", + " print 'This is less than the total pressure. This error must have been caused by air leak'\n", + "\n", + "\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "This is less than the total pressure. This error must have been caused by air leak\n" + ] + } + ], + "prompt_number": 37 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.16,page no:256" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "P1 = 24.62; \t\t\t#vapour pressure of cyclohexane (kPa)\n", + "P2 = 24.41; \t\t\t#vapour pressure of benzene (kPa)\n", + "from numpy import array\n", + "import math\n", + "x1 = array([0, 0.2, 0.4, 0.6, 0.8, 1.0])\n", + "x2 = 1-x1;\n", + "g1 = [0,0,0,0,0,0]\n", + "g2 = [0,0,0,0,0,0]\n", + "P = [0,0,0,0,0,0]\n", + "y1 = [0,0,0,0,0,0]\n", + "\n", + "# Calculations\n", + "for i in range(6):\n", + " g1[i] = math.e**(0.458*x2[i]**2) \t\t\t#activity coeffecient for component 1\n", + " g2[i] = math.e**(0.458*x1[i]**2 )\t\t\t#activity coeffecient for component 2\n", + " P[i] = (g1[i]*x1[i]*P1) + (g2[i]*x2[i]*P2) \t\t\t#total pressure (kPa)\n", + " y1[i] = (g1[i]*x1[i]*P1)/P[i];\n", + "\n", + "\n", + "from matplotlib.pyplot import *\n", + "\n", + "# Results\n", + "#To construct P-x-y diagram\n", + "plot(x1,P)\n", + "plot(y1,P)\n", + "\t\t\t#title(\"P-x-y Diagram\",\"x1 and y1\",\"Pressure\"\n", + "show()\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAEACAYAAABfxaZOAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XdcU1cbB/BfAEEBcQJVUFFqERICcWMRsIqouKoianFU\n3ForVl9rrQVHUXmrlqoobutedTIUBw5cCOKqo2pRhig4CTOQ8/5xW5Q3EBIgCZDn+/nko7n3nOTh\nKk9Ozj2DxxhjIIQQohV0NB0AIYQQ9aGkTwghWoSSPiGEaBFK+oQQokUo6RNCiBahpE8IIVpET97J\npKQkfPXVV3jz5g3y8/Ph6+uL//znP/D29sbDhw8BAG/fvkX9+vVx48YNmfpWVlYwMTGBrq4uatWq\nhWvXrqnmpyCEEKIQuUlfX18fISEhEAgEEIvFaNu2LTw8PLB3796iMrNmzUL9+vVLrM/j8RAdHY2G\nDRtWbtSEEELKRW73jrm5OQQCAQDA2NgYQqEQqampRecZY9i3bx+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799QaZ1VQrrxZaXcc5MjJyWEtWrRg\nycnJLD8/n7Vv357FxcUVK3PgwAE2cOBAxhhjcXFxTCgUqiM0tVPkWjx9+pRZW1uzy5cvayhK9VDk\nWnxszJgx7ODBg2qMUH0UuRbx8fGse/furKCggGVlZTE7Ozt248YNDUWsOopciylTprCAgADGGGNp\naWnsk08+kVkVoKb4+++/5d7IVTZvqqV75+OJWlKpFCNHjkTbtm2LhllNnDgRgwcPxtmzZ8Hn82Fg\nYIAtW7aoIzS1U+RaLFy4EG/evCnqx65VqxauXbumybBVQpFroS0UuRYikQi9evWCUCiERCLBuHHj\n4OjoqOHIK58i1+Knn36Cj48P7OzsUFhYiMWLFxfd4K5Jhg8fjnPnziEjIwPNmjXDggULIJFIAJQ/\nb6JgRoMAAAA/SURBVNLkLEII0SK0XSIhhGgRSvqEEKJFKOkTQogWoaRPCCFahJI+IYRoEUr6hBCi\nRSjpE0KIFqGkTwghWuR/4t39YqZswywAAAAASUVORK5CYII=\n", + "text": [ + "" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.17,page no:257" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "P = 40.25; \t\t\t#total pressure (kPa)\n", + "y1 = 0.566; \t\t\t#mol fraction of benzene in vapour phase\n", + "x1 = 0.384; \t\t\t#mol fraction of benzene in liquid state\n", + "P1 = 29.6; \t\t\t#vapour pressure of benzene (kPa)\n", + "P2 = 22.9; \t\t\t#vapour pressure of ethanol (kPa)\n", + "\n", + "#To determine the composition and total pressure of azeotrope\n", + "x2 = 1-x1;\n", + "y2 = 1-y1;\n", + "\n", + "# Calculations\n", + "#Using eq. 8.47 (Page no. 325)\n", + "#Activity coeffecients:\n", + "g1 = (y1*P)/(x1*P1)\n", + "g2 = (y2*P)/(x2*P2)\n", + "\n", + "import math\n", + "\t\t\t#Using eq. 8.69 (Page no. 348)\n", + "\t\t\t#van Laar constants:\n", + "A = math.log(g1)*((1 + (x2*math.log(g2))/(x1*math.log(g1)))**2)\n", + "B = math.log(g2)*((1 + (x1*math.log(g1))/(x2*math.log(g2)))**2)\n", + "\n", + "\t\t\t#Assuming azeotropic comp. (for hit and trial method)\n", + "x1 = 0.4;\n", + "flag = 1.;\n", + "while(flag==1):\n", + " x2 =1-x1;\n", + " ln_g1 = (A*x2**2)/(((A/B)*x1 + x2)**2)\n", + " ln_g2 = (B*x1**2)/((x1 + (B/A)*x2)**2)\n", + " g1 = math.e**ln_g1;\n", + " g2 = math.e**ln_g2;\n", + " P_1 = g1*P1;\n", + " P_2 = g2*P2;\n", + " if((P_1-P_2)<=1) and ((P_1-P_2)>=-1):\n", + " flag = 0;\n", + " else:\n", + " x1 = x1+0.1;\n", + "\n", + "# Results\n", + "print 'Azeotropic compositon of benzene is %i percent'%(x1*100)\n", + "print ' Total pressure of azeotrope is %f kPa'%((P_1+P_2)/2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Azeotropic compositon of benzene is 60 percent\n", + " Total pressure of azeotrope is 40.858067 kPa\n" + ] + } + ], + "prompt_number": 39 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.19,page no:258" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "a12 = 1225.31; \t\t\t#(J/mol)\n", + "a21 = 6051.01; \t\t\t#(J/mol)\n", + "V1 = 74.05*10**-6; \t\t\t#(m**3/mol)\n", + "V2 = 18.07*10**-6; \t\t\t#(m**3/mol)\n", + "\n", + "R = 8.314; \t\t\t#ideal gas constant\n", + "T = 349; \t\t\t#temperature in K\n", + "\n", + "\n", + "# Calculations\n", + "#Antoine Equation:\n", + "#Vapour pressure of 1st element\n", + "def P1(T):\n", + " y1 = math.e**(14.39155-(2795.817/(T-43.198)))\n", + " return y1\n", + "\n", + "\t\t\t#Vapour pressure of 2nd element\n", + "def P2(T):\n", + " y2 = math.e**(16.26205-(3799.887/(T-46.854)))\n", + " return y2\n", + "\n", + "\t\t\t#To calculate equilibrium pressure and composition\n", + "\t\t\t#Using eq. 8.73 (Page no. 350)\n", + "\t\t\t#Wilson Parameters:\n", + "W12 = (V2/V1)*math.e**(-a12/(R*T));\n", + "W21 = (V1/V2)*math.e**(-a21/(R*T));\n", + "import math\n", + "\t\t\t#Using Antoine equation\n", + "P1_s = P1(T);\n", + "P2_s = P2(T);\n", + "\n", + "\t\t\t#(a). Composition of vapour in equilibrium\n", + "x1 = 0.43;\n", + "x2 = 1-x1;\n", + "\n", + "\t\t\t#Using eq. 8.72 (Page no. 350)\n", + "\t\t\t#Wilson equations:\n", + "\t\t\t#Activity coeffecient of 1st component\n", + "def g_1(n1,n2): \t\t\t#n1 is mol fraction of 1 and n2 is for 2\n", + " y3 = math.e**(-math.log(n1 + W12*n2) + n2*((W12/(n1+W12*n2))-(W21/(W21*n1+n2))));\n", + " return y3\n", + "\n", + "\t\t\t#Activity coeffecint of 2nd component\n", + "def g_2(n1,n2):\n", + " y4 = math.e**(-math.log(n2 + W21*n1) - n1*((W12/(n1+W12*n2))-(W21/(W21*n1+n2))));\n", + " return y4\n", + " \n", + "\t\t\t#Activity coeffecients:\n", + "g1 = g_1(x1,x2);\n", + "g2 = g_2(x1,x2);\n", + "\n", + "P = (g1*x1*P1_s) + (g2*x2*P2_s);\n", + "y1 = (g1*x1*P1_s)/P;\n", + "\n", + "# Results\n", + "print '(a).'\n", + "print ' Equilibrium pressure is %f kPa'%P\n", + "print ' Composition of acetone vapour in equilibrium is %f'%y1\n", + "\n", + "\n", + "#(b). Composition of liquid in equilibrium\n", + "y1 = 0.8;\n", + "y2 = 1-y1;\n", + "g1 = 1; g2 = 1; \t\t\t#assumed activity coeffecients\n", + "P_as = 1/((y1/(g1*P1_s)) + (y2/(g2*P2_s)));\n", + "\n", + "\t\t\t#Hit and trial method:\n", + "flag = 1;\n", + "while(flag==1):\n", + " x1 = (y1*P_as)/(g1*P1_s);\n", + " x2 = 1-x1;\n", + " g1 = g_1(x1,x2);\n", + " g2 = g_2(x1,x2);\n", + " P_calc = 1/((y1/(g1*P1_s)) + (y2/(g2*P2_s)));\n", + " if((P_calc-P_as)<=1) and ((P_calc-P_as)>=-1):\n", + " flag = 0;\n", + " else:\n", + " P_as = P_calc;\n", + "\n", + "print ' (b).'\n", + "print ' Equilibrium Pressure is %f kPa'%P_calc\n", + "print ' Composition of acetone in liquid in equilibrium is %f'%x1\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a).\n", + " Equilibrium pressure is 162.828251 kPa\n", + " Composition of acetone vapour in equilibrium is 0.795360\n", + " (b).\n", + " Equilibrium Pressure is 164.488565 kPa\n", + " Composition of acetone in liquid in equilibrium is 0.456817\n" + ] + } + ], + "prompt_number": 40 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.20,page no:259" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "P = 101.3; \t\t\t#total pressure of system (kPa)\n", + "T = 337.5; \t\t\t#temperature in K\n", + "x1 = 0.842;\n", + "\n", + "#Antoine constants\n", + "#For methanol(1)\n", + "A1 = 16.12609;\n", + "B1 = 3394.286;\n", + "C1 = 43.2;\n", + "\n", + "#For methyl ethyl ketone (2)\n", + "A2 = 14.04357;\n", + "B2 = 2785.225;\n", + "C2 = 57.2;\n", + "import math\n", + "\n", + "# Calculations\n", + "#To determine parameters in Wilson's equation\n", + "P1_s = math.e**(A1-(B1/(T-C1)))\n", + "P2_s = math.e**(A2-(B2/(T-C2)))\n", + "x2 = 1-x1;\n", + "g1 = P/P1_s;\n", + "g2 = P/P2_s;\n", + "\n", + "#Using eq. 8.72 and rearranging:\n", + "def Wils(n): \t\t\t#n is the Wilson's parameter W12\n", + " y1 = (((g1*x2)/(1-(n*x1/(x1+n*x2))+(x1/x2)*math.log(g1*(x1+n*x2))))**(x2/x1))*(g1*(x1+n*x2))\n", + " return y1\n", + "\n", + "flag = 1;\n", + "W12 = 0.5; \t\t\t#assumed value\n", + "while(flag==1):\n", + " res = Wils(W12)\n", + " if ((res-1)>=-0.09):\n", + " flag = 0;\n", + " else:\n", + " W12 = W12+0.087;\n", + "\n", + "\t\t\t#For 2nd Wilson parameter:\n", + "\t\t\t#Using eq. 8.72 and rearranging:\n", + "k = math.log(g1*(x1+W12*x2))/x2 - (W12/(x1+W12*x2))\n", + "W21 = (-k*x2)/(1+k*x1)\n", + "\n", + "# Results\n", + "print \"wilson parameters are: %f, %f\"%(W12,W21)\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "wilson parameters are: 0.935000, 0.470758\n" + ] + } + ], + "prompt_number": 41 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.21,page no:260" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\t\t\n", + "from numpy import *\n", + "\n", + "# Variables\n", + "P = 101.3; \t\t\t#total pressure in kPa\n", + "T = [333, 343, 353, 363]; \t\t\t#temperatures(K)\n", + "Pa = [81.97 ,133.29 ,186.61, 266.58]; \t\t\t#Partial pressure of component A (kPa)\n", + "Pb = [49.32 ,73.31, 106.63, 166.61]; \t\t\t#Partial pressure of component B (kPa)\n", + "Pc = [39.32 ,62.65, 93.30, 133.29]; \t\t\t#Partial pressure of component C (kPa)\n", + "xa = 0.45; \t\t\t#mole fraction of methanol\n", + "xb = 0.3; \t\t\t#mole fraction of ethanol\n", + "\n", + "# Calculations and Results\n", + "xc = 1-xa-xb; \t\t\t#mole fraction of propanol\n", + "\n", + "#To calculate bubble and dew point and the composition \n", + "#(a). To calculate bubble point and vapour composition\n", + "from matplotlib.pyplot import *\n", + "plot(T,Pa);\n", + "plot(T,Pb);\n", + "plot(T,Pc);\n", + "\t\t\t#title(\" \",\"Temperature\",\"Vapour pressures\");\n", + "\t\t\t#legend(\"Pa\",\"Pb\",\"Pc\");\n", + "\n", + "\t\t\t#Using eq. 8.84 (Page no. 362)\n", + "\t\t\t#At bubble temperature, sum(yi) = sum((xi*Pi)/P) = 1\n", + "sum_y = [0,0,0,0]\n", + "for i in range(4):\n", + " sum_y[i] = (xa*Pa[i])/P + (xb*Pb[i])/P + (xc*Pc[i])/P;\n", + "\n", + "Tb = interp(1,sum_y,T); \t\t\t#obtaining temperature at which sum (yi) = 1\n", + "\n", + "\t\t\t#Obtaining vapour pressures at bubble temperature\n", + "Pb1 = interp(Tb,T,Pa);\n", + "Pb2 = interp(Tb,T,Pb);\n", + "Pb3 = interp(Tb,T,Pc);\n", + "\n", + "\t\t\t#Calculating equilibrium vapour composition\n", + "ya = (xa*Pb1*100)/P;\n", + "yb = (xb*Pb2*100)/P;\n", + "yc = (xc*Pb3*100)/P;\n", + "\n", + "print '(a).'\n", + "print ' The bubble temperature is %f K'%Tb\n", + "print ' The equilibrium vapour contains %f methanol, %f ethanol and %f propanol'%(ya,yb,yc)\n", + "\n", + "#(b). The dew point and liquid composition\n", + "#Vapour phase compositions at dew point\n", + "ya = 0.45; \t\t\t#methanol\n", + "yb = 0.30; \t\t\t#ethanol\n", + "yc = 0.25; \t\t\t#propanol\n", + "\n", + "sum_x = zeros(4)\n", + "#At dew point, sum(xi) = sum ((yi*P)/Pi) = 1\n", + "for i in range(4):\n", + " sum_x[i] = (ya*P)/Pa[i] + (yb*P)/Pb[i] + (yc*P)/Pc[i];\n", + "\n", + "Td = interp(1,sum_x,T); \t\t\t#obtaining temperature at which sum (xi) = 1\n", + "\n", + "#Obtaining vapour pressures at dew temperature\n", + "Pd1 = interp(Td,T,Pa);\n", + "Pd2 = interp(Td,T,Pb);\n", + "Pd3 = interp(Td,T,Pc);\n", + "\n", + "#Calculating liquid composition\n", + "xa = (ya*P*100)/Pd1;\n", + "xb = (yb*P*100)/Pd2;\n", + "xc = (yc*P*100)/Pd3;\n", + "\n", + "print ' (c).'\n", + "print ' The dew point is %f K'%Td\n", + "print ' At dew point liquid contains %f methanol, %f ethanol and %f propanol'%(xa,xb,xc)\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a).\n", + " The bubble temperature is 343.879659 K\n", + " The equilibrium vapour contains 61.294328 methanol, 22.578783 ethanol and 16.126889 propanol\n", + " (c).\n", + " The dew point is 363.000000 K\n", + " At dew point liquid contains 17.099932 methanol, 18.240202 ethanol and 18.999925 propanol\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAXsAAAEACAYAAABS29YJAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XtYlGXeB/AvoHjCIyfNIUHMAzAgHvCELuBbFFRiWXju\n3dqUslqty9Xt7W2xdwt11/XQqmHakQ7a1moraVqAKYogHhBLTAVlMGAAUZAz87x/3M7AyEGBmXlm\nmO/nuuaSOMz8fK7p64/7vp/7tpEkSQIREXVqtnIXQERExsewJyKyAgx7IiIrwLAnIrICDHsiIivA\nsCcisgKthn1VVRXGjx8Pf39/DB8+HMuWLQMAlJSU4MEHH4Svry9CQ0NRWlqq+5mYmBh4eXlBqVTi\nwIEDxq2eiIjuic3d1tlXVlaiR48eqKurQ2BgIGJiYvDNN9/A09MTS5cuxYYNG5CdnY2NGzciPT0d\nUVFRSElJQX5+PgIDA5GVlQV7e3tT/X2IiKgZdx3G6dGjBwCgpqYG9fX1cHFxwXfffYcFCxYAAObP\nn4/4+HgAQHx8PGbPng07OzsMHjwY3t7eSE1NNWL5RER0L+4a9hqNBqNHj4arqyuCg4Ph7e0NtVoN\nR0dHAICTkxMKCwsBAHl5eVAoFLqfVSgUUKlURiqdiIjuVZe7fYOtrS1Onz6NGzduIDQ0FImJiaao\ni4iIDOiuYa/Vt29fhIeH4/jx43B2dkZRURGcnJyg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Fs\nbW0t5vq3VH9brz9vqiIisgI8lpCIyAow7ImIrADDnojICjDsiYisAMOeiMgKMOyJiKwAw56IyAow\n7ImIrMD/A7UqI330WejFAAAAAElFTkSuQmCC\n", + "text": [ + "" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.22,page no:261" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Given:\n", + "\n", + "P = 1447.14; \t\t\t#pressure of the system (kPa)\n", + "x = [0.25 ,0.4, 0.35]; \t\t\t#composition of the components\n", + "T = [355.4 ,366.5]; \t\t\t#assumed temperatures (K)\n", + "K1 = [2.00, 0.78 ,0.33]; \t\t\t#value of Ki at 355.4 K \n", + "K2 = [2.30, 0.90 ,0.40]; \t\t\t#value of Ki at 366.5 K\n", + "\n", + "\n", + "# Calculation and Result\n", + "\n", + "Kx = [0, 0];\n", + "for i in range(3):\n", + " Kx[0] = Kx[0]+K1[i]*x[i];\n", + " Kx[1] = Kx[1]+K2[i]*x[i];\n", + "\n", + "Tb = interp(1,Kx,T);\n", + "\n", + "#At Tb K, from Fig. 13.6 of Chemical Engineer's Handbook\n", + "Kb = [2.12 ,0.85 ,0.37]\n", + "\n", + "#Calculation of vapour composition\n", + "y1 = Kb[0]*x[0]*100;\n", + "y2 = Kb[1]*x[1]*100;\n", + "y3 = Kb[2]*x[2]*100;\n", + "\n", + "print '(a).'\n", + "print ' The bubble point temperature is %f K'%Tb\n", + "print ' At bubble point vapour contains %f percent propane, %f percent butane and %f percent pentane'%(y1,y2,y3)\n", + "\n", + "#(b). The dew point temperature and composition of the liquid\n", + "T = [377.6 ,388.8]; \t\t\t#assumed temperatures (K)\n", + "y = [0.25, 0.40, 0.35]; \t\t\t#vapour composition at dew point\n", + "K1 = [2.6, 1.1, 0.5]; \t\t\t#at 377.6 K\n", + "K2 = [2.9, 1.3, 0.61]; \t\t\t#at 388.8 K\n", + "\n", + "#At dew point, sum(yi/Ki) = 1\n", + "Ky = [0, 0];\n", + "for i in range(3):\n", + " Ky[0] = Ky[0] + y[i]/K1[i];\n", + " Ky[1] = Ky[1] + y[i]/K2[i];\n", + "\n", + "Td = interp(1,Ky,T);\n", + "\n", + "#At Td K,\n", + "Kd = [2.85, 1.25, 0.59];\n", + "\n", + "#Calculation of liquid composition\n", + "x1 = y[0]*100/Kd[0];\n", + "x2 = y[1]*100/Kd[1];\n", + "x3 = y[2]*100/Kd[2];\n", + "\n", + "print ' (b).'\n", + "print ' The dew point temperature is %f K'%Td\n", + "print ' Liquid at dew point contains %f percent propane, %f percent butane and %f percent pentane'%(x1,x2,x3)\n", + "\n", + "#(c). Temperature and composition when 45% of initial mixture is vaporised\n", + "#Basis: \n", + "F = 100; \n", + "V = 45; \n", + "L = 55;\n", + "\n", + "#For the given condition eq. 8.91 (Page no. 364) is to be satisfied\n", + "#sum(zi/(1+ L/(VKi))) = 0.45\n", + "\n", + "z = [0.25, 0.4, 0.35];\n", + "T = [366.5 ,377.6]; \t\t\t#assumed temperatures\n", + "K1 = [2.3 ,0.9 ,0.4]; \t\t\t#at 366.5 K\n", + "K2 = [2.6 ,1.1 ,0.5]; \t\t\t#at 377.6 K\n", + "\n", + "Kz = [0 ,0];\n", + "for i in range(3):\n", + " Kz[0] = Kz[0] + z[i]/(1 + L/(V*K1[i]));\n", + " Kz[1] = Kz[1] + z[i]/(1 + L/(V*K2[i]));\n", + "\n", + "#The required temperature is T3\n", + "T3 = interp(.45,Kz,T);\n", + "\n", + "#At T3 K\n", + "K3 = [2.5, 1.08, 0.48];\n", + "\n", + "#Calculating liquid and vapour compositions\n", + "for i in range(3):\n", + " y[i] = (z[i]/(1 + L/(V*K3[i])))/0.45;\n", + " x[i] = ((F*z[i]) - (V*y[i]))/L;\n", + " print (x[i]);\n", + "\n", + "\n", + "print ' (c).'\n", + "print ' The equilibrium temperature is %f K'%T3\n", + "print ' Liquid composition in equilibrium is %f percent propane, %f percent butane \\\n", + "and %f percent pentane'%(x[0]*100,x[1]*100,x[2]*100)\n", + "print ' Vapour composition in equilibrium is %f percent propane, %f percent butane \\\n", + "and %f percent pentane'%(y[0]*100,y[1]*100,y[2]*100);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a).\n", + " The bubble point temperature is 360.855932 K\n", + " At bubble point vapour contains 53.000000 percent propane, 34.000000 percent butane and 12.950000 percent pentane\n", + " (b).\n", + " The dew point temperature is 388.800000 K\n", + " Liquid at dew point contains 8.771930 percent propane, 32.000000 percent butane and 59.322034 percent pentane\n", + "0.149253731343\n", + "0.3861003861\n", + "0.456919060052\n", + " (c).\n", + " The equilibrium temperature is 374.651845 K\n", + " Liquid composition in equilibrium is 14.925373 percent propane, 38.610039 percent butane and 45.691906 percent pentane\n", + " Vapour composition in equilibrium is 37.313433 percent propane, 41.698842 percent butane and 21.932115 percent pentane\n" + ] + } + ], + "prompt_number": 42 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.23,page no:262" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from numpy import array\n", + "\n", + "# Variables\n", + "P = 101.3; \t\t\t#total pressure (kPa)\n", + "x1 = array([0.003, 0.449, 0.700, 0.900])\n", + "y1 = array([0.432, 0.449, 0.520, 0.719])\n", + "P1 = [65.31 ,63.98, 66.64, 81.31]; \t\t\t#(kPa)\n", + "P2 = [68.64 ,68.64, 69.31, 72.24]; \t\t\t#(kPa)\n", + "\n", + "import math\n", + "\n", + "# Calculations\n", + "#To test whether the given data are thermodynamically consistent or not\n", + "x2 = 1-x1;\n", + "y2 = 1-y1;\n", + "g1= [0,0,0,0]\n", + "g2 = [0,0,0,0]\n", + "c=[0,0,0,0]\n", + "import math\n", + "for i in range(4):\n", + " g1[i] = (y1[i]*P)/(x1[i]*P1[i])\n", + " g2[i] = (y2[i]*P)/(x2[i]*P2[i])\n", + " c[i] = math.log(g1[i]/g2[i]) \t\t\t#k = ln (g1/g2)\n", + "from matplotlib.pyplot import *\n", + "plot(x1,c)\n", + "\t\t\t#a = get(\"current_axes\"\n", + "\t\t\t#set(a,\"x_location\",\"origin\"\n", + "\n", + "# Results\n", + "show()\n", + "\t\t\t#As seen from the graph net area is not zero\n", + "print 'The given math.experimental data do not satisfy the Redlich-Kistern criterion'\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAXUAAAEACAYAAABMEua6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAH7RJREFUeJzt3XtUlOW+B/DvIKikIqKAKWjFNrnfxAsmMGy8A0qhqcfT\ntovuVpfV0Vpt29vacbJtkbbdVqelpmWZnnapZXihzBwuHneRWmaltUszVARRRARU4Dl/PA0DWTrM\nvDPPzDvfz1qzFtT0vt/VOX579/M+7+81CCEEiIhIF7xUByAiIu2w1ImIdISlTkSkIyx1IiIdYakT\nEekIS52ISEfsLvWamhpMnToVcXFxiIiIwJ49e7TIRURENjDYu0996tSpuO222zBjxgy0tLSgrq4O\nfn5+WuUjIqIOsKvUq6urMWLECHz33XdaZiIiIhvZtfzy3XffITAwELfffjuio6Pxhz/8AXV1dVpl\nIyKiDrKr1FtaWlBWVoZHH30UBw8eREBAABYuXKhVNiIi6ihhh2PHjomBAwe2/l5SUiLGjh3b7jth\nYWECAD/88MMPPx34hIWF2dTLdl2ph4aGok+fPvj2228BAB999BEiIiLafef777+HEMKlPk8++aTy\nDO6QyVVzMRMzeUKu77//3qZe9ran1AFg9erVmDlzJurr6zFw4ECsW7fO3kMSEZGN7C71uLg4lJWV\naZGFiIjs5JFPlBqNRtURruCKmQDXzMVM1mEm67lqLlvY/fDRNU9gMMDBpyAi0h1bu9Mjr9SJiPSK\npU5EpCMsdSIiHWGpExHpiFNKvbzcGWchIiKnlHpKCsBBjkREjueUUl+wAEhLAz7/3BlnIy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kZEhmpqaxIULF0RkZKTYv3+/0kxCCFFT\nUyMCAgJEfX29w7J0JNP9998v8vLyhBBCVFRUiL59+7beXFaV6dy5c+Ly5ctCCCHWrl0rpkyZcs3j\nalLqQgixbds2ERUVJSIiIsSiRYuEEEIsX75cLF++vPU7DzzwgIiMjBQJCQlX/UPqrEwnT54UISEh\nws/PT/j7+4vQ0FBx/vx5pZnuueceERAQIOLj40V8fLwYOnSoQ/NYk+mZZ54R0dHRIjo6WgwdOlSU\nlpYqz9SWs0rdmlwvvPBC67+rxMREUVRUpDyTEEIsXrxYREZGikGDBon8/HyXyLRmzRoxY8YMh2ex\nNlNFRYUYPXq0iIiIEDfffLNYtWqV8ky7d+8WN998s4iNjRW5ubmipqbmmsfkw0dERDrC19kREekI\nS52ISEdY6kREOsJSJyLSEZY6EZGOsNSJiHSEpU5EpCMsdSIiHfl/2hihodD/xAQAAAAASUVORK5C\nYII=\n", + "text": [ + "" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The given math.experimental data do not satisfy the Redlich-Kistern criterion\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.25,page no:263" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "x1 = [0.0331, 0.9652]; \t\t\t#composition of chloroform\n", + "P = [40.84 ,84.88]; \t\t\t#total pressure for system (kPa)\n", + "P1 = 82.35; \t\t\t#vapour pressure of chloroform at 328 K (kPa)\n", + "P2 = 37.30; \t\t\t#vapour pressure of acetone at 328 K (kPa) \n", + "\n", + "\n", + "# Calculations\n", + "#To estimate the constants in Margules equation\n", + "#Using eq. 8.103 and 8.104 (Page no. 375)\n", + "g1_inf = (P[0]-(1-x1[0])*P2)/(x1[0]*P1)\n", + "g2_inf = (P[1]-(x1[1]*P1))/((1-x1[1])*P2)\n", + "\n", + "import math\n", + "A = math.log(g1_inf)\n", + "B = math.log(g2_inf)\n", + "\n", + "# Results\n", + "print 'Margules constants are:'\n", + "print ' A = %f'%A\n", + "print ' B = %f'%B\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Margules constants are:\n", + " A = 0.560560\n", + " B = 1.424762\n" + ] + } + ], + "prompt_number": 44 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.26,page no:264" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "x1 = [0., 0.033, 0.117, 0.318, 0.554, 0.736, 1.000]; \t\t\t#liquid composition of acetone\n", + "pp1 = [0.,25.33, 59.05, 78.37, 89.58,94.77, 114.63]; \t\t\t#partial pressure of acetone (kPa)\n", + "Pw = 19.91; \t\t\t#vapour pressure of water at 333 K (kPa)\n", + "k = [0,0,0,0,0,0,0]\n", + "\n", + "# Calculations\n", + "for i in range(1,6):\n", + " k[i] = x1[i]/((1.-x1[i])*pp1[i])\n", + "\n", + "k[6] = 0.1; \t\t\t#k(7) should tend to infinity\n", + "from matplotlib.pyplot import *\n", + "plot(pp1,k)\n", + "show()\n", + "\t\t\t#From graph% area gives the integration and hence partiaal pressure of water is calculated\n", + "pp2 = [19.91, 19.31, 18.27, 16.99, 15.42, 13.90, 0];\n", + "\n", + "# Results\n", + "print \"The results are:\"\n", + "print ' Acetone composition Partial pressure of water'\n", + "for i in range(7):\n", + " print ' %f %f'%(x1[i],pp2[i])\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAEACAYAAAC08h1NAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAH5pJREFUeJzt3X9UlPWeB/A3vwK7WvkLyhn8Eagww2AzCxqu604/DPHH\n5gpK6h07ZC3XW+vJ3La7f+xR15Mt/jjKpnHxptxbUEZ5K28Qx2M6l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Plrt06t507d4r4\n+HgxevRoR74sX77cMb6vc+MJXEREChNkV08nIiJXGPxERArD4CciUhgGPxGRwjD4iYgUhsFPRKQw\nDH4iIoVh8BMRKcz/Axc5FnWtf/T6AAAAAElFTkSuQmCC\n", + "text": [ + "" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The results are:\n", + " Acetone composition Partial pressure of water\n", + " 0.000000 19.910000\n", + " 0.033000 19.310000\n", + " 0.117000 18.270000\n", + " 0.318000 16.990000\n", + " 0.554000 15.420000\n", + " 0.736000 13.900000\n", + " 1.000000 0.000000\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.27,page no:265 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "P = 93.30; \t\t\t#total pressure in kPa\n", + "T1 = 353.; \t\t\t#(K)\n", + "T2 = 373.; \t\t\t#(K)\n", + "Pa1 = 47.98; \t\t\t#Vapour pressure of water at 353 K (kPa)\n", + "Pb1 = 2.67; \t\t\t#Vapour pressure of liquid at 353 K (kPa)\n", + "Pa2 = 101.3; \t\t\t#Vapour pressure of water at 373 K (kPa)\n", + "Pb2 = 5.33; \t\t\t#Vapour pressure of liquid at 373 K (kPa)\n", + "\n", + "# Calculations and Results\n", + "#To calculate under three phase equilibrium:\n", + "#(a). The equilibrium temperature\n", + "P1 = Pa1+Pb1; \t\t\t#sum of vapour pressures at 353 K\n", + "P2 = Pa2+Pb2; \t\t\t#at 373 K\n", + "\n", + "#Since vapour pressure vary linearly with temperature% so T at which P = 93.30 kPa\n", + "T = T1 + ((T2-T1)/(P2-P1))*(P-P1)\n", + "print '(a). The equilibrium temperature is %f K'%T\n", + "\n", + "#(b). The composition of resulting vapour\n", + "#At equilibrium temp:\n", + "Pa = 88.5; \t\t\t#vapour pressure of water (kPa)\n", + "Pb = 4.80; \t\t\t#vapour pressure of liquid (kPa)\n", + "\n", + "#At 3-phase equilibrium% ratio of mol fractions of components is same as the ratio of vapour pressures\n", + "P = Pa+Pb; \t\t\t#sum of vapour pressures\n", + "y = Pa/P; \t\t\t#mole fraction of water\n", + "print ' The vapour contains %f mol percent water vapour'%(y*100)\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a). The equilibrium temperature is 368.237585 K\n", + " The vapour contains 94.855305 mol percent water vapour\n" + ] + } + ], + "prompt_number": 46 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.28,page no:266" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T = [323 ,333, 343, 348, 353, 363, 373]; \t\t\t#temperatures (K)\n", + "P2 = [12.40 ,19.86, 31.06, 37.99, 47.32, 70.11, 101.3]; \t\t\t#vapour pressure for benzene (kPa)\n", + "P1 = [35.85 ,51.85, 72.91, 85.31, 100.50, 135.42, 179.14]; \t\t\t#vapour pressure for water (kPa)\n", + "Tb = 353.1; \t\t\t#boiling temperature (K)\n", + "Pb = 101.3; \t\t\t#boiling pressure (kPa)\n", + "\n", + "\n", + "# Calculations and Results\n", + "#To prepare temperature composition diagram\n", + "#To find three phase temperature\n", + "P = [0,0,0,0,0,0,0]\n", + "for i in range(7):\n", + " P[i] = P1[i] + P2[i];\n", + "from matplotlib.pyplot import *\n", + "plot(P,T)\n", + "\t\t\t#From graph, at P = 101.3 kPa..\n", + "T_ = 340.; \t\t\t#three phase temperature\n", + "\n", + "\t\t\t#At three phase temperature\n", + "P1_ = 71.18; \t\t\t#(kPa)\n", + "P2_ = 30.12; \t\t\t#(kPa)\n", + "xb_ = P1_/Pb; \t\t\t#mol fraction of benzene at triple point\n", + "\n", + "\t\t\t#For the dew point curve\n", + "\t\t\t#For curve BE in temp range from 342 to 373 K\n", + "y1 = [0,0,0,0,0,0,0]\n", + "for i in range(2,7):\n", + " y1[i] = 1-(P2[i]/Pb )\n", + "\n", + "\t\t\t#xset('window',1\n", + "T1 = [0,0,0,0,0,0,0]\n", + "y1_ = [0,0,0,0,0,0,0]\n", + "T1[0] = 342\n", + "y1_[0] = 0.7;\n", + "for i in range(1,6):\n", + " T1[i] = T[i+1];\n", + " y1_[i] = y1[i+1];\n", + "\n", + "plot(y1_,T1)\n", + "y2 = [0,0,0,0,0,0,0]\n", + "\t\t\t#For the curve Ae in the temp range of 342 K to 353.1 K\n", + "for i in range(2,5):\n", + " y2[i] = P1[i]/Pb;\n", + "\n", + "T2 = [0,0,0,0,0,0,0]\n", + "y2_ = [0,0,0,0,0,0,0]\n", + "T2[0] = 342.;\n", + "y2_[0] = 0.7;\n", + "for i in range(1,4):\n", + " T2[i] = T[i+1]\n", + " y2_[i] = y2[i+1]\n", + "\n", + "plot(y2_,T2)\n", + "\t\t\t#axhspan(0.25,0.75,facecolor='0.5'\n", + "\t\t\t#title(\"Temperature Composition diagram\",\"xa,ya\",\"Temperature\"\n", + "show()\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAXsAAAD9CAYAAABdoNd6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAG+JJREFUeJzt3X9wVPW9//Hnwey0UqjQK1norvculyQNCyFZS5NMp06X\nhmC9Xtd4caKx0r0K9w+Y3hkL7S38oSZ1JLEt1wFqZrw2fr+x3DFh2oFkOpKJ07JK6dT12mTsddWk\nmmiy+VEhggSkC9nz/WO/LAY2P0g2G7Ln9ZjZYTl79nw+nznwyjvvnJw1TNM0ERGRtDZvticgIiIz\nT2EvImIBCnsREQtQ2IuIWIDCXkTEAhT2IiIWMKmwHxkZwePxcNdddwEwNDREaWkpOTk5bNiwgVOn\nTsX3ra6uJjs7m9zcXFpbW2dm1iIick0mFfZ79+7F7XZjGAYANTU1lJaW0tHRQUlJCTU1NQCEQiEa\nGxsJhUK0tLSwbds2otH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J3MN/lyzbNkyAJYsWcI999xDMBjEbrczMDAAQH9/P5mZmbM5xWkbaz1Xns/e3l4cDses\nzHE6MjMz4/+JtmzZEv9WeK6u78KFC2zcuJFNmzZRVlYGpM85vLS2Bx98ML62dDt/ADfddBN33nkn\nb7zxRtLOXUrDPt2uwT937hxnzpwB4OzZs7S2tpKXl4fP56O+vh6A+vr6+D/KuWqs9fh8PhoaGohE\nInR1ddHZ2Rm/Imku6e/vjz8/dOhQ/Eqdubg+0zTZvHkzbrebRx55JL49Hc7hWGtLl/N34sSJeAvq\n008/5eWXX8bj8STv3M3oj5YTeOmll8ycnBxzxYoV5u7du1M9fFK9//77Zn5+vpmfn2+uWrUqvp6T\nJ0+aJSUlZnZ2tllaWmp+/PHHszzTybv//vvNZcuWmTabzXQ6nebzzz8/7nqefPJJc8WKFeZXvvIV\ns6WlZRZnPjlXrq+urs7ctGmTmZeXZ65Zs8a8++67zYGBgfj+c219x44dMw3DMPPz882CggKzoKDA\nPHLkSFqcw0Rre+mll9Lm/L355pumx+Mx8/Pzzby8PPMnP/mJaZrj58m1rC/p98YREZHrjz6pSkTE\nAhT2IiIWoLAXEbEAhb2IiAUo7EVELEBhLyJiAf8PLH4K5zRwZxUAAAAASUVORK5CYII=\n", + "text": [ + "" + ] + } + ], + "prompt_number": 47 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch9-checkpoint.ipynb b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch9-checkpoint.ipynb new file mode 100644 index 00000000..84b2f311 --- /dev/null +++ b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch9-checkpoint.ipynb @@ -0,0 +1,1029 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:143cdfa176d2adff05d6185ec25c9acd8d4e3e65839a51952b6344e41d5d94f6" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 9 : Chemical Reaction Equilibria" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.6,page no:267" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Given:\n", + "Go_reac = 97540.; \t\t\t#standard free energy of formation of reactant (J/mol)\n", + "Go_pdt = 51310.; \t\t\t#standard free energy of formation of product (J/mol)\n", + "R = 8.314; \t\t\t#ideal gas constant\n", + "T = 298.; \t\t\t#temperature (K)\n", + "#Reaction: N2O4(g) --> 2NO2(g)\n", + "\n", + "# Calculations\n", + "#To calculate equilibrium constant\n", + "#Using eq. 9.50 (Page no.413)\n", + "Go = 2*Go_pdt - Go_reac;\n", + "#Using eq. 9.31 (Page no. 406)\n", + "K = math.e**(-Go/(R*T))\n", + "\n", + "# Results\n", + "print 'The equilbrium constant %f'%K\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The equilbrium constant 0.128684\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.7,page no:268" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T1 = 298.; \t\t\t#temperature in K\n", + "Hf = -46100.; \t\t\t#standard heat of formation (J/mol)\n", + "Go = -16500.; \t\t\t#standard free energy change (J/mol)\n", + "R = 8.314; \t\t\t#ideal gas constant\n", + "T = 500.; \n", + "#Reaction: N2(g) + 3H2(g) --> 2NH3(g)\n", + "#To calculate the equilibrium constant at 500 K\n", + "#Using eq. 9.50 (Page no. 413)\n", + "\n", + "# Calculations\n", + "del_Go = 2*Go;\n", + "import math\n", + "#Using eq. 9.31 (Page no. 406)\n", + "K1 = math.e**(-del_Go/(R*T1)) \t\t\t#equilibrium const at 298 K\n", + "Ho = 2*Hf; \t\t\t#standard heat of reaction\n", + "\n", + "#Using eq. 9.37 (Page no. 411)\n", + "K = K1*(math.e**((-Ho/R)*(1/T - 1/T1)))\n", + "\n", + "# Results\n", + "print 'The equilibrium constant at 500 K is %f'%K\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The equilibrium constant at 500 K is 0.179981\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.8,page no:269" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variablesa\n", + "R = 8.314; \t\t\t#ideal gas constant\n", + "T2 = 317.; \t\t\t#temperature in K\n", + "T1 = 391.; \t\t\t#(K)\n", + "x2 = 0.31; \t\t\t#mol fraction of n-butane at 317 K\n", + "x1 = 0.43; \t\t\t#mol fraction of iso-butane at 391 K\n", + "\n", + "# Calculations\n", + "#To calculate standard free energy change and heat of reaction\n", + "#At 317 K\n", + "K2 = (1-x2)/x2; \t\t\t#equilibrium constant at 317 K\n", + "K1 = (1-x1)/x1; \t\t\t#equilibrium constant at 391 K\n", + "import math\n", + "#Using eq. 9.31 (Page no. 406)\n", + "#Standard free energy change\n", + "G2 = -R*T2*math.log(K2 )\t\t\t#at 317 K (J/mol)\n", + "G1 = -R*T1*math.log(K1 )\t\t\t#at 391 K (J/mol)\n", + "\n", + "#Using eq. 9.37 (Page no. 411)\n", + "Ho = -math.log(K2/K1)*R/(1/T2 - 1/T1)\n", + "\n", + "# Calculations\n", + "print 'Standard free energy change of the reaction'\n", + "print ' At 317 K is %f J/mol'%G2\n", + "print ' At 391 K is %f J/mol'%G1\n", + "print ' Average value of heat of reaction is %f J/mol'%Ho\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Standard free energy change of the reaction\n", + " At 317 K is -2108.744820 J/mol\n", + " At 391 K is -916.234397 J/mol\n", + " Average value of heat of reaction is -7217.201631 J/mol\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.9,page no:270" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "To = 298.; \t\t\t#temperature in K\n", + "T = 700.; \t\t\t#(K)\n", + "R = 8.314; \t\t\t#ideal gas constant\n", + "Hf = -46100.; \t\t\t#standard heat of formation (J/mol)\n", + "Gf = -16500.; \t\t\t#standard free energy of formtion of ammonia (J/mol)\n", + "\n", + "# Calculations\n", + "Ho = 2*Hf;\n", + "Go = 2*Gf;\n", + "alpha = 2*29.75 - 27.27 - 3*27.01;\n", + "betta = (2*25.11 - 4.93 - 3*3.51)*10**-3;\n", + "import math\n", + "#Using eq. 9.46 (Page no. 412)\n", + "del_H = Ho - alpha*To - (betta/2)*To**2;\n", + "#Using eq. 9.48 (Page no. 413)\n", + "A = -(Go - del_H + alpha*To*math.log(To) + (betta/2)*To**2)/(R*To)\n", + "\n", + "#Using eq. 9.47 and 9.48 (Page no. 412)\n", + "K = math.e**((-del_H/(R*T)) + (alpha/R)*math.log(T) + (betta/(2*R))*T + A)\n", + "G = del_H - alpha*T*math.log(T) -(betta/2)*T**2 - A*R*T;\n", + "\n", + "# Results\n", + "print 'At 700 K'\n", + "print ' Equilibrium constant is %3.2e'%K\n", + "print ' Standard free energy change is %f J/mol'%G\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "At 700 K\n", + " Equilibrium constant is 9.99e-05\n", + " Standard free energy change is 53606.315911 J/mol\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.10,page no:271" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "T = 600.; \t\t\t#temperature in K\n", + "R = 8.314; \t\t\t#ideal gas constant\n", + "\n", + "#Gibbs free energy at 600 K (J/mol K)\n", + "Gc = -203.81; \t\t\t#for CO\n", + "Gh = -136.39; \t\t\t#for hydrogen\n", + "Gm = -249.83; \t\t\t#for methanol\n", + "\n", + "#Heats of formation at 298 K (J/mol)\n", + "Hc = -110500.; \t\t\t#for CO\n", + "Hm = -200700.; \t\t\t#for methanol\n", + "import math\n", + "\n", + "# Calculations\n", + "#To calculate equilibrium constant at 600 K\n", + "Go = T*((Gm-Gc-(2*Gh)) + (1/T)*(Hm-Hc))\n", + "\t\t\t#Using eq. 9.31 (Page no. 406)\n", + "K = math.e**(-Go/(R*T))\n", + "\n", + "# Results\n", + "print 'Equilibrium constant is %4.3e'%K\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Equilibrium constant is 1.018e-04\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.11,page no:272" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T = 500.; \t\t\t#temperature in K\n", + "R = 8.314; \t\t\t#ideal gas constant\n", + "\n", + "#Free energy at 500 K (J/mol K)\n", + "Fn = -177.5; \t\t\t#for nitrogen\n", + "Fh = -116.9; \t\t\t#for hydrogen\n", + "Fa = -176.9; \t\t\t#for ammonia\n", + "\n", + "#The function (Ho at 298 K - Ho at 0 K) [J/mol]\n", + "Hn = 8669.; \t\t\t#for nitrogen\n", + "Hh = 8468.; \t\t\t#for hydrogen\n", + "Ha = 9920.; \t\t\t#for methanol\n", + "\n", + "#Free energy of formation at 298 K (J/mol)\n", + "Hf = -46100.;\n", + "import math\n", + "#To calculate equilibrium constant at 500 K\n", + "\n", + "# Calculations\n", + "#Using eq. 9.53 (Page no. 414)\n", + "sum_F = (2*Fa - Fn - 3*Fh) - (2*Ha - Hn - 3*Hh)/T; \t\t\t#(J/mol K)\n", + "#Using eq. 9.57 (Page no.415)\n", + "Go = T*(sum_F + 2*Hf/T)\n", + "K = math.e**(-Go/(R*T))\n", + "\n", + "# Results\n", + "print 'Equilibrium constant is %f'%K\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Equilibrium constant is 0.108493\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.12,page no:273" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "P1 = 1.; \t\t\t#pressure (bar)\n", + "P2 = 2.; \t\t\t#(bar)\n", + "x1 = 0.15; \t\t\t#mol fraction of polymer at 1 bar\n", + "x2 = 0.367; \t\t\t#mol fraction of polymer at 2 bar\n", + "\n", + "# Calculations\n", + "import math\n", + "n = round((math.log(x2/x1)+math.log(2))/(math.log(2)-math.log((1-x1)/(1-x2))))\n", + "\n", + "# Results\n", + "print 'The value of n is %i'%n\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of n is 4\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.13,page no:274" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from scipy.optimize import root\n", + "\n", + "# Variables\n", + "#Reaction: N2 + 3H2 --> 2NH3\n", + "K = 2*10**-4; \t\t\t#equilibrium constant of reaction\n", + "P = 20; \t\t\t#(bar)\n", + "\n", + "# Calculations and Results\n", + "#e(4-2e)/(1-e)**2 = 0.73485\n", + "#e = poly(0,'e')\n", + "def f(e):\n", + " return 2.73845*e**2 - 5.4697*e + 0.73485;\n", + "x = root(f,0)\n", + "\n", + "print '(a) Percentage conversion is %f percent'%(x.x[0]*100)\n", + "\n", + "#(b)\n", + "P = 200; \t\t\t#(bar)\n", + "\n", + "#e(4-2e)/(1-e)**2 = 7.3485\n", + "\n", + "def f2(e):\n", + " return 9.3485*e**2 - 18.697*e + 7.3485;\n", + "x = root(f2,0)\n", + "print ' (b) Percentage conversion is %f percent'%(x.x[0]*100)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a) Percentage conversion is 14.485445 percent\n", + " (b) Percentage conversion is 53.746561 percent\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.14v,page no:75" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "K = 1; \t\t\t#equilibrium constant for reaction\n", + "\n", + "# Calculations and Results\n", + "e = 1./2;\n", + "print '(a) Fractional dissociation of steam is %i percent'%(e*100)\n", + "\n", + "#On solving we get\n", + "e = 1./2;\n", + "print ' (b) After dilution fractional distillation of steam is %i percent'%(e*100)\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a) Fractional dissociation of steam is 50 percent\n", + " (b) After dilution fractional distillation of steam is 50 percent\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.15,page no:276" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from scipy.optimize import root\n", + "\n", + "# Variables\n", + "K = 2.*10**-4; \t\t\t#equilibrium constant of reaction\n", + "P = 20.; \t\t\t#pressure in bar\n", + "\n", + "\n", + "\n", + "def f(e):\n", + " return 1.3674*e**2 - 3.7348*e + 0.3674;\n", + "x = root(f,0)\n", + "\n", + "# Results\n", + "print 'Percentage coversion in presence of argon is %f percent'%(x.x[0]*100)\n", + "print ' while in absence of argon is 14.48 percent' \t\t\t#From example 9.13\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Percentage coversion in presence of argon is 10.219587 percent\n", + " while in absence of argon is 14.48 percent\n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.16,page no:278" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "P = 1.; \t\t\t#pressure in bar\n", + "K = 1.; \t\t\t#equilibrium constant of reaction\n", + "\n", + "e)(2-e)] = K = 1% so\n", + "\n", + "e = 2./3;\n", + "print '(a). The conversion of steam is %f percent'%(e*100)\n", + "\n", + "#(b). CO supplied is only 50% of the theoretical requirement\n", + "#Mole fraction of components\n", + "#CO: (0.5-e)/1.5\n", + "#H20: (1-e)/1.5\n", + "#CO2: e/1.5\n", + "#H2: e/1.5\n", + "\n", + "#e**2/[(0.5-e)(1-e)] = K = 1\n", + "#1.5e-0.5 = 1\n", + "e = 0.5/1.5;\n", + "print ' (b). Percentage conversion of steam is %f percent'%(e*100)\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a). The conversion of steam is 66.666667 percent\n", + " (b). Percentage conversion of steam is 33.333333 percent\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.17,page no:279" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "K = 1.; \t\t\t#equilibrium constant of reaction\n", + "\n", + "# Calculations\n", + "e = 1./3;\n", + "\n", + "# Results\n", + "print 'Percentage conversion of steam is %f percent'%(e*100)\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Percentage conversion of steam is 33.333333 percent\n" + ] + } + ], + "prompt_number": 31 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.18,page no:280" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Reaction: CO(g) + 2H2(g) --> CH3OH(g)\n", + "Kf = 4.9*10**-5;\n", + "Kfi = 0.35;\n", + "P = 300.; \t\t\t#pressure in bar\n", + "n_CO = 25.;\n", + "n_H2 = 55.;\n", + "n_inert = 20.;\n", + "v = -1-2+1; \t\t\t#change in number of moles in reaction\n", + "\n", + "# Calculations\n", + "#Mole fractions in the equilibrium mixture\n", + "#CO = (25-e)/(100-2e)\n", + "#H2 = (55-2e)/(100-2e)\n", + "#CH3OH = e/(100-2e)\n", + "\n", + "Ky = (Kf/Kfi)*P**(-v)\n", + "\t\t\t#[e/(100-2e)]/[(25-e)/(100-2e)][(55-2e)/(100-2e)]**2 = Ky% so\n", + "\n", + "def f(e):\n", + " return (4+4*Ky)*e**3 - (400+320*Ky)*e**2 + (10000+8525*Ky)*e - 75625*Ky\n", + "\n", + "x = root(f,0)\n", + "conv = x.x[0]/n_CO; \t\t\t#first two roots are complex\n", + "\n", + "# Results\n", + "print 'Percentage conversion of CO is %f percent'%(conv*100)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Percentage conversion of CO is 61.015734 percent\n" + ] + } + ], + "prompt_number": 32 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.19,page no:281" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Reaction: 1/2N2 + 3/2H2 --> NH3\n", + "Kp = 1.25*10**-2 ;\t\t\t#equilibrium constant\n", + "P = 50; \t\t\t#pressure in bar\n", + "v = 1-(3./2)-(1./2) \t\t\t#change in number of moles in reaction\n", + "\n", + "#Initial composition of gas mixture\n", + "n_h = 60.;\n", + "n_n = 20.;\n", + "n_inert = 100-n_h-n_n;\n", + "\n", + "# Calculations\n", + "\n", + "Ky = Kp*(P**-v)\n", + "#e/(100-e)/[(20-(e/2)]**1/2[{60-(3e/2)}/(100-e)]**3/2 = Ky\n", + "#e = poly(0%'e'\n", + "\n", + "def f(e):\n", + " return (1.6875*Ky**2-1)*e**4 - (270*Ky**2+200)*e**3 + (16200*Ky**2-10000)*e**2 - (334800*Ky**2)*e + 4320000*Ky**2;\n", + "x = root(f,0)\n", + "e = x.x[0]\n", + "\n", + "#x(4) being the only positive root is the percentage conversion\n", + "#Mole fractions in equilibrium mixture\n", + "x_n = (20-(e/2))/(100-e)\n", + "x_h = (60-3*(e/2))/(100-e)\n", + "x_a = e/(100-e)\n", + "x_inert = 1 - x_n - x_h - x_a;\n", + "\n", + "# Results\n", + "print 'Composition of gas leaving the reactor is'\n", + "print ' Nitrogen : %f percent'%(x_n*100)\n", + "print ' Hydrogen : %f percent'%(x_h*100)\n", + "print ' Ammonia : %f percent'%(x_a*100)\n", + "print ' Inert gas : %f percent'%(x_inert*100)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Composition of gas leaving the reactor is\n", + " Nitrogen : 17.048802 percent\n", + " Hydrogen : 51.146406 percent\n", + " Ammonia : 9.837327 percent\n", + " Inert gas : 21.967465 percent\n" + ] + } + ], + "prompt_number": 33 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.20,page no:282" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "P = 85.; \t\t\t#pressure in bar\n", + "n_e = 0.015; \t\t\t#mol percent of ethanol\n", + "n_w = 0.95; \t\t\t#mole percent of water\n", + "n_a = 0.48; \t\t\t#mol percent of ethylene in vapour phase\n", + "M = 18.; \t\t\t#molecular mass of water\n", + "fc = 0.9; \t\t\t#fugacity coeffecient for ethylene\n", + "\n", + "#To evaluate the equilibrium constant\n", + "#K = a_c/(a_a*a_b)\n", + "# Calculations\n", + "m_e = n_e/(n_w*M*10**-3) \t\t\t#mol/kg water\n", + "a_c = m_e;\n", + "fa = fc*n_a*P; \t\t\t#bar\n", + "a_a = fa;\n", + "\n", + "#Since mol fraction of water is close to unity% so fugacity coeffecient of water is assumed to be 1\n", + "a_b = n_w;\n", + "K = a_c/(a_a*a_b)\n", + "\n", + "# Results\n", + "print 'The equilibrium constant is %5.4e (mol C2H4)/(kg water bar)'%K\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The equilibrium constant is 2.5146e-02 (mol C2H4)/(kg water bar)\n" + ] + } + ], + "prompt_number": 34 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.21,page no:283" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T = 1000.; \t\t\t#temperature of reaction in K\n", + "P = 1.; \t\t\t#pressure in bar\n", + "R = 8.314; \t\t\t#ideal gas constant\n", + "import math\n", + "\n", + "#Function for standard free energy of the reaction\n", + "def G(T):\n", + " y = 1.8856*10**5 - 243.42*T + 11.8478*T*math.log(T) - 3.1045*10**-3*T**2 + 1.7271*10**-6*T**3 - (4.1784*10**5)/T\n", + " return y\n", + "\n", + "# Calculations and Results\n", + "K = math.e**(-Go/(R*T))\n", + "#Using eq. 9.75 (Page no. 432)\n", + "p_CO2 = K; \t\t\t#decomposition pressure\n", + "print 'Decomposition pressure of limestone at 1000 K s %f bar'%p_CO2\n", + "\n", + "#At pressure = 1 bar\n", + "K = 1.;\n", + "Go = 0.; \t\t\t#since K = 1\n", + "\n", + "T = 1160.; \t\t\t#assumed temperature (K)\n", + "flag = 1.;\n", + "while(flag==1):\n", + " res = round(G(T))\n", + " if(res<=0):\n", + " flag = 0;\n", + " else:\n", + " T = T+1;\n", + "\n", + "print 'Decomposition temperature at 1 bar is %i K'%T\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Decomposition pressure of limestone at 1000 K s 0.048344 bar\n", + "Decomposition temperature at 1 bar is 1169 K\n" + ] + } + ], + "prompt_number": 35 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.22,page no:284" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "K = 0.403; \t\t\t#equilibrium constant of reaction\n", + "T = 1200.; \t\t\t#temperature of reaction (K)\n", + "To = 273.; \t\t\t#standard temperature (K)\n", + "Vo = 22.4*10**-3; \t\t\t#molar volume at STP \n", + "M = 55.8; \t\t\t#molecular mass of iron\n", + "n = 100.; \t\t\t#moles of gas entering\n", + "n_C = 20.; \t\t\t#moles of carbon mono oxide\n", + "n_N = 80.; \t\t\t#moles of nitrogen\n", + "\n", + "\n", + "# Calculations\n", + "#Let e be the extent of reaction\n", + "#Mole fractions in equilibrium mixture\n", + "#CO = (20-e)/100\n", + "#CO2 = e/100\n", + "#e/(20-e) = K\n", + "e = (20*K)/(1+K)\n", + "n_CO2 = e; \t\t\t#moles of CO2 at equilibrium\n", + "n_Fe = n_CO2; \t\t\t#by stoichiometry\n", + "V = (n*Vo*T)/To; \t\t\t#volume of 100 mol of gas at 1200 K and 1 bar\n", + "\n", + "#Let m be iron produced per 100 m**3 gas\n", + "m = (n_Fe*100*M)/V;\n", + "\n", + "# Results\n", + "print 'Iron produced per 100 cubic m of gas is %f kg'%(m/1000)\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Iron produced per 100 cubic m of gas is 3.255704 kg\n" + ] + } + ], + "prompt_number": 36 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.23,page no:285" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from scipy.optimize import fsolve\n", + "\n", + "# Variables\n", + "P = 1.; \t\t\t#pressure in bar\n", + "K1 = 0.574; \t\t\t#equilibrium constant for eq. 9.88 (Page no. 437)\n", + "K2 = 2.21; \t\t\t#equilibrium constant for eq. 9.89 (Page no. 437)\n", + "\n", + "v1 = 1+3-1-1;\n", + "v2 = 1+1-1-1;\n", + "Ky1 = K1*P**-v1;\n", + "Ky2 = K2*P**-v2;\n", + "\n", + "# Calculations\n", + "#mole fractions in equilibrium mixture are:\n", + "#CH4: (1-e1)/(6+2e1)\n", + "#H2O: (5-e1-e2)/(6+2e1)\n", + "#CO: (e1-e2)/(6+2e1)\n", + "#H2: (3e1+e2)/(6+2e1)\n", + "#CO2: e2/(6+2e1)\n", + "\n", + "#For 1st reaction:\n", + "#Ky1 = [(e1-e2)(3e1+e2)**3]/[(1-e1)(5-e1-e2)(6+2e1)**2]\n", + "#For 2nd reaction:\n", + "#Ky2 = [e2(3e1+e2)]/[(e1-e2)(5-e1-e2)]\n", + "#on solving% we get:\n", + "\n", + "def f2(e):\n", + " f_1 = ((e[0]-e[1])*(3*e[0]+e[1])**3)/((1-e[0])*(5-e[0]-e[1])*(6+2*e[0])**2)-Ky1\n", + " f_2 = (e[1]*(3*e[0]+e[1]))/((e[0]-e[1])*(5-e[0]-e[1]))-Ky2\n", + " y = [f_1,f_2]\n", + " return y\n", + "eo = [0.9,0.6]; \t\t\t#initial guesses\n", + "e = fsolve(f2,eo)\n", + "\n", + "\t\t\t#Mole fraction of components:\n", + "n_m = (1-e[0])/(6+2*e[0])\n", + "n_w = (5-e[0]-e[1])/(6+2*e[0])\n", + "n_CO = (e[0]-e[1])/(6+2*e[0])\n", + "n_h = (3*e[0]+e[1])/(6+2*e[0])\n", + "n_c = e[1]/(6+2*e[0])\n", + "\n", + "# Results\n", + "print 'Mole fraction of the components are:'\n", + "print ' Methane = %f'%n_m\n", + "print ' Water = %f'%n_w\n", + "print ' Carbon monoxide = %f'% n_CO\n", + "print ' Hydrogen = %f'%n_h\n", + "print ' Carbon dioxide = %f'%n_c\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mole fraction of the components are:\n", + " Methane = 0.011240\n", + " Water = 0.441597\n", + " Carbon monoxide = 0.035687\n", + " Hydrogen = 0.430593\n", + " Carbon dioxide = 0.080883\n" + ] + } + ], + "prompt_number": 37 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.24,page no:286" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#A system consisting of CO% CO2% H2% H2O% CH4\n", + "\n", + "\n", + "r = 2.;\n", + "C = 5.; \t\t\t#no. of components\n", + "pi = 1.; \t\t\t#no. of phases\n", + "\n", + "# Calculations\n", + "#From eq. 9.90 (Page no. 438)\n", + "F = C-pi-r+2;\n", + "\n", + "# Results\n", + "print 'The number of degrees of freedom are %i'%F\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The number of degrees of freedom are 4\n" + ] + } + ], + "prompt_number": 38 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/Chapter 3.ipynb b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/Chapter 3.ipynb new file mode 100644 index 00000000..6803c96b --- /dev/null +++ b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/Chapter 3.ipynb @@ -0,0 +1,722 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:2261ff03ab51ed2922b0b6d063ddc383a313c6be373040c779faf21d1a2afd0b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 3 : PVT Behaviour And Heat Effects" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.1, , Page no:45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "#Given:\n", + "T = 350.; \t\t\t#temperature in K\n", + "P = 10.**5; \t\t\t#pressure in N/m**2\n", + "R = 8.314; \t\t\t#ideal gas constant\n", + "\n", + "# Calculations\n", + "#To find the molar volume of air\n", + "V = (R*T)/P; \t\t\t#molar volume in m**3\n", + "\n", + "# Results\n", + "print 'Molar volume of air is %3.2e cubic m/mol'%V\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Molar volume of air is 2.91e-02 cubic m/mol\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.3, Page no:50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "#Given:\n", + "Cp = 29.3; \t\t\t#specific heat at constant pressure(kJ/kmol K)\n", + "R = 8.314; \t\t\t#ideal gas constant\n", + "\n", + "# Calculations and Results\n", + "#To determine heat and work effects for each step\n", + "#Step 1: Gas is heated at constant volume\n", + "T1 = 300.; \t\t \t#temperature in K\n", + "P1 = 1.; \t \t\t #initial pressure in bar\n", + "P2 = 2.; \t\t \t #final pressure in bar\n", + "T2 = (P2/P1)*T1; \t\t\t#final temperature in K\n", + "Cv = Cp-R; \t \t \t#specific heat at constant volume\n", + "W1 = 0; \t\t \t #work done is zero as volume remains constant\n", + "Q1 = Cv*(T2-T1); \t\t\t#heat supplied in kJ/kmol\n", + "print 'For step 1'\n", + "print 'Work done in step 1 is %i'%W1\n", + "print 'Heat supplied in step 1 is %f kJ/kmol'%Q1\n", + "\n", + "#Step 2: The process is adiabatic\n", + "Q2 = 0.; \t\t\t#the process is adiabatic\n", + "P3 = 1.; \t\t\t#pressure after step 2 in bar\n", + "gama = (Cp/Cv);\n", + "T3 = ((P3/P2)**((gama-1)/gama))*T2; \t\t\t#temperature after step 2\n", + "W2 = (Cv*(T2-T3)); \t\t\t#work done by system\n", + "print 'For step 2'\n", + "print 'Heat supplied in step 2 is %i'%Q2\n", + "print 'Work done by system in step 2 is %f kJ/kmol'%W2\n", + "\n", + "#Step 3: The process is isobaric\n", + "T4 = 300.; \t\t\t#temperature after step 3 (K)\n", + "Q3 = Cp*(T4-T3); \t\t\t#heat supplied during step 3(kJ/kmol)\n", + "U = (Cv*(T4-T3)); \t\t\t#change in internal energy during step 3(kJ/kmol)\n", + "W3 = Q3-U; \t\t\t#Using first law of thermodynamics\n", + "print 'For step 3'\n", + "print 'Heat given out by the system in step 3 is %f kJ/kmol'%Q3\n", + "print 'Work done on the system in step 3 is %f kJ/kmol'%W3\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "For step 1\n", + "Work done in step 1 is 0\n", + "Heat supplied in step 1 is 6295.800000 kJ/kmol\n", + "For step 2\n", + "Heat supplied in step 2 is 0\n", + "Work done by system in step 2 is 2248.222546 kJ/kmol\n", + "For step 3\n", + "Heat given out by the system in step 3 is -5651.101658 kJ/kmol\n", + "Work done on the system in step 3 is -1603.524204 kJ/kmol\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.4, Page no:51" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Given:\n", + "R = 8.314; \t\t\t#ideal gas constant\n", + "Cp = 30.; \t\t\t#specific heat at constant pressure(J/mol K)\n", + "\n", + "# Calculations and Results\n", + "#To calculate change in internal energy change in enthalpy work done and heat supplied\n", + "import math\n", + "#(a): Gas is expanded isothermally\n", + "T = 600.; \t\t\t#temperature in K\n", + "P1 = 5.; \t\t\t#initial pressure in bar\n", + "P2 = 4.; \t\t\t#final pressure in bar\n", + "U1 = 0; \t\t\t#since the process is isothermal\n", + "H1 = 0; \t\t\t#since the process is isothermal\n", + "W1 = (R*T*math.log(P1/P2)); \t\t\t#work done during the process\n", + "Q1 = W1; \t\t\t#heat supplied during the process\n", + "print 'When gas is expanded isothermally'\n", + "print 'Change in internal energy in isothermal process is %i'%U1\n", + "print 'Change in enthalpy in isothermal process is %i'%H1\n", + "print \"Work done during the process is %f kJ/kmol\"%W1\n", + "print 'Heat supplied during the process is %f kJ/kmol'%Q1\n", + "\n", + "#(b): Gas is heated at constant volume\n", + "V = 0.1; \t\t\t#volume (m**3)\n", + "P1 = 1.; \t\t\t#initial pressure(bar)\n", + "T1 = 298.; \t\t\t#initial temperature(K)\n", + "T2 = 400.; \t\t\t#final temperature(K)\n", + "n = ((P1*V*10**5)/(R*T1)); \t\t\t#number of moles of gas\n", + "Cv = Cp-R; \t\t\t#specific heat at constant volume(J/mol K)\n", + "ans = round(Cv*(T2-T1))\n", + "n = round(n,2)\n", + "U2 = n*ans #Cv*round(T2-T1); \t\t\t#change in internal energy(J)\n", + "H2 = n*Cp*(T2-T1); \t\t\t#change in enthalpy(J)\n", + "W2 = 0; \t\t\t#isochoric process\n", + "Q2 = U2+W2; \t\t\t#heat supplied(J)\n", + "print '\\nWhen gas is heated at constant volume'\n", + "print 'Change in internal energy is %.0f J'%U2\n", + "print 'Change in enthalpy is %f J'%H2\n", + "print 'Work done during the process is %i '% W2\n", + "print 'Heat supplied during the process is %.0f J'%Q2\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "When gas is expanded isothermally\n", + "Change in internal energy in isothermal process is 0\n", + "Change in enthalpy in isothermal process is 0\n", + "Work done during the process is 1113.129291 kJ/kmol\n", + "Heat supplied during the process is 1113.129291 kJ/kmol\n", + "\n", + "When gas is heated at constant volume\n", + "Change in internal energy is 8936 J\n", + "Change in enthalpy is 12362.400000 J\n", + "Work done during the process is 0 \n", + "Heat supplied during the process is 8936 J\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.5, Page no:52" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from scipy.integrate import quad\n", + "\n", + "\n", + "def Cv(T):\n", + " y = 27.4528+(6.1839*(10**-3)*T)-(8.9932*(10**-7)*(T**2))-R;\n", + " return y\n", + "\n", + "# Variables\n", + "m = 20.; \t\t\t#mass of air(kg)\n", + "n = 1.25; \t\t\t#polytropic constant\n", + "P1 = 1.; \t\t\t#initial pressure(bar)\n", + "P2 = 5.; \t\t\t#final pressure(bar)\n", + "T1 = 300.; \t\t\t#temperature(K)\n", + "R = 8.314; \t\t\t#ideal gas constant\n", + "M = 29.; \t\t\t#molecular wt of air\n", + "\n", + "# Calculations\n", + "#To determine work done and amount of heat transferred\n", + "#(a): Work done by the compressor per cycle\n", + "n_mole = m/M; \t\t\t#moles of air(kmol)\n", + "V1 = ((n_mole*10**3*R*T1)/(P1*10**5)); \t\t\t#initial volume(m**3)\n", + "V2 = (V1*((P1/P2)**(1/n))); \t\t\t #final volume(m**3)\n", + "\n", + "#Since the process is polytropic P(V**n)=c(say constant)\n", + "c = P1*10**5*(V1**n); \n", + "\t\t\t#function[z] = f(V);\n", + "\t\t\t# z = c/(V**1.25);\n", + "\t\t\t#W1 = intg(V1,V2,f); so\n", + "W = (c/(1-n))*((V2**(-n+1))-(V1**(-n+1)))/1000;\n", + "print 'Work done by compressor is %4.3e J'%(W*1000);\n", + "\n", + "#(b): Amount of heat transferred to surrounding\n", + "T2 = ((T1*V2*P2)/(V1*P1)); \t\t\t#final temp in K\n", + "U1 = quad(Cv,T1,T2)[0];\n", + "U = U1*n_mole; \t\t\t #change in internal energy(kJ)\n", + "Q = U+W; \t\t\t #heat supplied\n", + "\n", + "# Results\n", + "print 'Chnage in internal energy is %f kJ'%U\n", + "print 'Heat supplied is %f kJ'%Q\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Work done by compressor is -2.613e+06 J\n", + "Chnage in internal energy is 1667.979893 kJ\n", + "Heat supplied is -944.769684 kJ\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.6, Page no:55" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "#Given:\n", + "V = 0.3821*10**-3 \t\t\t#molar volume(m**3/mol)\n", + "T = 313.; \t\t\t#temperature (K)\n", + "R = 8.314; \t\t\t#ideal gas constant\n", + "a = 0.365; b = 4.28*10**-5; \t\t\t#Vander Waals constant\n", + "\n", + "\n", + "# Calculations and Results\n", + "#To compare the pressures\n", + "#(a): Ideal gas equation\n", + "P = ((R*T)/(V*10**5)); \t\t\t#pressure in bar\n", + "print 'Pressure obtained by ideal gas equation is %f bar'%P\n", + "\n", + "#(b): Van der Waals equation\n", + "P = ((((R*T)/(V-b))-(a/(V**2)))/(10**5));\n", + "print 'Pressure obtained by Van der Waals equation is %f bar'%P\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Pressure obtained by ideal gas equation is 68.104737 bar\n", + "Pressure obtained by Van der Waals equation is 51.695679 bar\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.7, Page no:56" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#To find Approx Value\n", + "def approx(V,n):\n", + " A=round(V*10**n)/10**n;\t\t\t#V-Value n-To what place\n", + " return A\n", + "\n", + "# Variables\n", + "#Given:\n", + "T = 300.; \t\t\t#temperature(K)\n", + "P = 100.; \t\t\t#pressure(bar)\n", + "R = 8.314; \t\t\t#ideal gas constant\n", + "a = 0.1378\n", + "b = 3.18*10**-5; \t\t\t#Van der waals constant\n", + "\n", + "# Calculations and Results\n", + "#(a): Ideal gas equation\n", + "V_ideal = approx(((R*T)/(P*10**5)),6);\n", + "print 'Volume calculated by ideal gas equation is %4.2e cubic m'%V_ideal\n", + "\n", + "#(b): Van der Waals equation\n", + "def f(V):\n", + " y=((P*10**5)+(a/(V**2)))*(V-b)-(R*T); \t\t\t#function to calculate difference between calculated and assumed volume\n", + " return y\n", + " \n", + "V_real = 0;\n", + "i = 0.20\n", + "while i<=.30: \t\t\t#Van der waals volume should be nearly equal to Ideal gas valoume\n", + " res = approx(f(i*10**-3),0);\n", + " for j in range(-5,6):\n", + " if(j==res): \t\t\t#for very small difference i may be taken as exact volume\n", + " V_real = i*10**-3;\n", + " i += 0.01\n", + "\n", + "print 'Volume calculated by Van der Waals equation is %3.2e cubic m'%V_real\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Volume calculated by ideal gas equation is 2.49e-04 cubic m\n", + "Volume calculated by Van der Waals equation is 2.30e-04 cubic m\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.9, Page no:59 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#To find Approx Value\n", + "def approx(V,n):\n", + " A=round(V*10**n)/10**n;\t\t\t#V-Value n-To what place\n", + " return A\n", + "\n", + "\n", + "# Variables\n", + "#Given:\n", + "T = 500.; \t\t\t#temperature (K)\n", + "P = 10.; \t\t\t#pressure(bar)\n", + "R = 8.314; \t\t\t#ideal gas constant\n", + "B = -2.19*10**-4; C=-1.73*10**-8; \t\t\t#Virial coeffecients\n", + "Tc = 512.6; \t\t\t#critical temperature\n", + "Pc = 81.; \t\t\t#critical pressure\n", + "\n", + "#To calculate compressibility factor and molar volume\n", + "\n", + "# Calculations and Results\n", + "#(a): Truncated form of virial equation\n", + "V_ideal = approx(((R*T)/(P*10**5)),7); \t\t\t#ideal gas volume\n", + "def f1(V):\n", + " z = (((R*T)/(P*10**5))*(1+(B/V)+(C/(V**2)))); \t\t\t#function for obtaining volume by virial equation\n", + " return z\n", + "\n", + "#loop for hit and trial method\n", + "flag = 1;\n", + "while(flag==1):\n", + " V_virial = approx(f1(V_ideal),7);\n", + " if(approx(V_ideal,5)==approx(V_virial,5)):\n", + " flag = 0;\n", + " break;\n", + " else:\n", + " V_ideal = V_virial;\n", + "\n", + "\n", + "Z = approx(((P*10**5*V_virial)/(T*R)),3); \t\t\t#compressibility factor\n", + "print 'Compressibilty factor for virial equation is %f '%Z\n", + "\n", + "#(b): Redlich Kwong Equation\n", + "#Constants in Redlich Kwong equation\n", + "a = approx(((0.4278*(R**2)*(Tc**2.5))/(Pc*10**5)),4);\n", + "b = approx(((0.0867*R*Tc)/(Pc*10**5)),9);\n", + "\n", + "V_ideal = approx(((R*T)/(P*10**5)),7); \t\t\t#ideal gas volume\n", + "\n", + "#Function to find volume by Redlich Kwong equation \n", + "def f2(V):\n", + " x = ((R*T)/(P*10**5))+b-((a*(V-b))/((T**0.5)*(P*10**5)*V*(V+b)));\n", + " return x\n", + "\n", + "#loop for hit and trial method\n", + "flag = 1;\n", + "while(flag==1):\n", + " V_redlich = approx(f2(V_ideal),7);\n", + " if(approx(V_ideal,5)==approx(V_redlich,5)):\n", + " flag = 0;\n", + " break;\n", + " else:\n", + "\t V_ideal = V_redlich;\n", + "\n", + "print 'Volume obtained by Redlich Kwong Equation is %4.3e cubic m/mol'%V_redlich\n", + "Z = approx(((P*10**5*V_redlich)/(T*R)),3); \t\t\t#compressibility factor\n", + "print 'Compressbility factor by Redlich Kwong equation is %f'%Z\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Compressibilty factor for virial equation is 0.943000 \n", + "Volume obtained by Redlich Kwong Equation is 3.963e-03 cubic m/mol\n", + "Compressbility factor by Redlich Kwong equation is 0.953000\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.10, Page no:64" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Given:\n", + "Ha = -890.94; \t\t\t#standard heat for reaction a (kJ)\n", + "Hb = -393.78; \t\t\t#standard heat for reaction b (kJ)\n", + "Hc = -286.03; \t\t\t#standard heat for reaction c (kJ)\n", + "\n", + "# Calculations\n", + "#To calculate heat of formation of methane gas\n", + "#c*2 + b - a gives the formation of methane from elements\n", + "Hf = (2*Hc)+Hb-Ha;\n", + "\n", + "# Results\n", + "print 'Heat of formation of methane is %f kJ/mol'%Hf\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat of formation of methane is -74.900000 kJ/mol\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.11, Page no:65" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Given:\n", + "Ha = -509.93; \t\t\t#heat of combustion of reaction a (kJ) \n", + "Hb = -296.03; \t\t\t#heat of combustion of reaction b (kJ)\n", + "Hc = -393.78; \t\t\t#heat of combustion of reaction c (kJ)\n", + "Hd = -167.57; \t\t\t#heat of combustion of reaction d (kJ)\n", + "\n", + "# Calculations\n", + "#To calculate heat of formation of chloroform\n", + "#c + (3*d) -a -b gives chloroform from its elements\n", + "Hf = Hc+(3*Hd)-Ha-Hb;\n", + "\n", + "# Results\n", + "print 'Heat of formation of chloroform is %f kJ/mol'%Hf" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat of formation of chloroform is -90.530000 kJ/mol\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.12, Page no:67" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "#Given:\n", + "Ho = -164987.; \t\t\t#standard heat of reaction at 298 K in J\n", + "T1 = 298.;\n", + "T2 = 773.; \t\t\t#temperature(K)\n", + "\n", + "# Calculations\n", + "#To calculate standard heat of reaction at 773 K\n", + "alpha = (2*29.16)+13.41-26.75-(4*26.88);\n", + "betta = ((2*14.49)+77.03-42.26-(4*4.35))*10**-3;\n", + "gama = ((2*-2.02)-18.74+14.25+(4*0.33))*10**-6;\n", + "#Using equation 3.54 (Page no. 67)\n", + "H1 = Ho-(alpha*T1)-(betta*(T1**2)/2)-(gama*(T1**3)/3);\n", + "#At 773 K\n", + "Hr = H1+(alpha*T2)+(betta*(T2**2)/2)+(gama*(T2**3)/3);\n", + "\n", + "# Results\n", + "print 'Heat of reaction at 773 K is %f kJ'%(Hr/1000)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat of reaction at 773 K is -183.950273 kJ\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.13, Page no:68" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "#Given:\n", + "To = 298.; \t\t\t#standard temperature(K)\n", + "T1 = 400.; \t\t\t#temperature of reactants(K)\n", + "T2 = 600.; \t\t\t#temperature of products (K)\n", + "Ho = -283.028; \t\t\t#standard heat of reaction(kJ/mol)\n", + "\n", + "# Calculations\n", + "#To determine heat added or removed\n", + "#Basis:\n", + "n_CO = 1.; \t\t\t#moles of CO reacted\n", + "n_O2 = 1.;\t\t\t#moles of oxygen supplied\n", + "n_N2 = 1.*79./21; \t\t\t#moles of nitrogen\n", + "n1_O2 = 0.5; \t\t\t#moles of oxygen required\n", + "n_CO2 = 1.; \t\t\t#moles of carbon di oxide formed\n", + "\n", + "H1 = ((n_O2*29.70)+(n_N2*29.10)+(n_CO*29.10))*(To-T1)/1000; \t\t\t#enthalpy of cooling of reactants\n", + "H2 = ((n1_O2*29.70)+(n_N2*29.10)+(n_CO2*41.45))*(T2-To)/1000; \t\t\t#enthalpy of heating the products\n", + "Hr = H1+Ho+H2;\n", + "\n", + "# Results\n", + "print 'Heat supplied is %f kJ'%Hr\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat supplied is -250.128714 kJ\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.14, Page no:69" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "#Given:\n", + "To = 298.; \t\t\t#standard temperature (K)\n", + "T1 = 373.; \t\t\t#temperature of reactants (K)\n", + "Ho = 283178.; \t\t\t#standard heat of combustion(J/mol)\n", + "\n", + "# Calculations\n", + "#To calculate theoretical flame temperature\n", + "#Basis:\n", + "n_CO = 1.; \t\t\t#moles of CO\n", + "n_O2 = 1.; \t\t\t#moles of oxygen supplied\n", + "n1_O2 = 0.5; \t\t\t#moles of oxygen reacted\n", + "n_CO2 = 1.; \t\t\t#moles of carbon di oxide formed\n", + "n_N2 = 79./21; \t\t\t#moles of nitrogen\n", + "\n", + "H1 = ((n_O2*34.83)+(n_N2*33.03)+(n_CO*29.23))*(To-T1); \t\t\t#enthalpy of cooling of reactants\n", + "#Using equation 3.55 (Page no. 69)\n", + "H2 = Ho-H1;\n", + "Tf = H2/((n1_O2*34.83)+(n_N2*33.03)+(n_CO2*53.59))+298; \t\t\t#flame temperature\n", + "\n", + "# Results\n", + "print 'Theoretical flame temperature is %f K'%Tf\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Theoretical flame temperature is 1820.588298 K\n" + ] + } + ], + "prompt_number": 24 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch5.ipynb b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch5.ipynb index c3e360ec..69a3c9fd 100644 --- a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch5.ipynb +++ b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch5.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:8647345ba179ef2ea9d3fa7f02f9c39fe17f9932a98d0fe8ec5f061488b5ae2f" + "signature": "sha256:6996e5e5468902e09bec94067f7b5880135562adefc48c0268633a954f4745f1" }, "nbformat": 3, "nbformat_minor": 0, @@ -21,7 +21,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.1" + "Example 5.1,page no:70" ] }, { @@ -53,7 +53,8 @@ "P_exit = (-((u2**2-u1**2)/2)-(g*z)+(P_ent*10**3/den))*(den/10**3)\n", "\n", "# Results\n", - "print 'The pressure at exit is %f kPa'%P_exit\n" + "print 'The pressure at exit is %f kPa'%P_exit\n", + "7" ], "language": "python", "metadata": {}, @@ -73,7 +74,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.2" + "Example 5.2,page no:71" ] }, { @@ -118,7 +119,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.3, Page no:123" + "Example 5.3, Page no:123,page no:72" ] }, { @@ -231,7 +232,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.7" + "Example 5.7,page no:128" ] }, { @@ -275,7 +276,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.8" + "Example 5.8,page no:129" ] }, { @@ -334,7 +335,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.9" + "Example 5.9,page no:130" ] }, { @@ -375,7 +376,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.10" + "Example 5.10,page no:131" ] }, { @@ -425,7 +426,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.11" + "Example 5.11,page no:132" ] }, { @@ -485,7 +486,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.12 " + "Example 5.12 ,page no:133" ] }, { @@ -538,7 +539,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.13" + "Example 5.13,page no:134" ] }, { @@ -593,7 +594,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.14" + "Example 5.14,page no:135" ] }, { @@ -647,7 +648,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.15" + "Example 5.15,page no:136" ] }, { @@ -692,7 +693,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.16" + "Example 5.16,page no:137" ] }, { @@ -738,7 +739,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.17" + "Example 5.17,page no:138" ] }, { @@ -800,7 +801,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.18" + "Example 5.18,page no:139" ] }, { @@ -850,7 +851,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.19" + "Example 5.19,page no:140" ] }, { @@ -923,7 +924,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.20" + "Example 5.20,page no:141" ] }, { @@ -1009,7 +1010,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.21" + "Example 5.21,page no:142" ] }, { @@ -1078,7 +1079,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.22" + "Example 5.22,page no:143" ] }, { @@ -1182,7 +1183,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.23" + "Example 5.23,page no:145" ] }, { @@ -1281,7 +1282,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.24" + "Example 5.24,page no:146" ] }, { diff --git a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch6.ipynb b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch6.ipynb index 2640be69..b51d5bb4 100644 --- a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch6.ipynb +++ b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch6.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:af5e98897fdd6a212dc067e1708c75ce618fcbb9ad24c85104d033a4702b884e" + "signature": "sha256:0c6f850208261348a001037520b4c6e32782c990f422185b0a289857874323db" }, "nbformat": 3, "nbformat_minor": 0, @@ -21,7 +21,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.1 " + "Example 6.1 ,page no:147" ] }, { @@ -69,7 +69,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.2" + "Example 6.2,page no:148" ] }, { @@ -112,7 +112,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.3" + "Example 6.3,page no:149" ] }, { @@ -196,7 +196,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.7" + "Example 6.7,page no:199" ] }, { @@ -268,7 +268,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.8" + "Example 6.8,page no:200" ] }, { @@ -338,7 +338,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.10" + "Example 6.10,page no:201" ] }, { @@ -379,7 +379,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.21" + "Example 6.21,page no:202" ] }, { @@ -421,7 +421,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.22" + "Example 6.22,page no:203" ] }, { @@ -461,7 +461,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.23" + "Example 6.23,page no:204" ] }, { @@ -501,7 +501,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.25" + "Example 6.25,page no:205" ] }, { @@ -546,7 +546,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.26" + "Example 6.26,page no:206" ] }, { @@ -594,7 +594,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.27" + "Example 6.27,page no:207" ] }, { @@ -638,7 +638,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.28" + "Example 6.28,page no:208" ] }, { @@ -683,7 +683,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.29" + "Example 6.29,page no:209" ] }, { @@ -728,7 +728,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.30" + "Example 6.30,page no:210" ] }, { diff --git a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch7.ipynb b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch7.ipynb index 9c3402d5..0d1aa8d7 100644 --- a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch7.ipynb +++ b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch7.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:a4d472eaa4dbf60f111758e6e0fce7c88354811184ce66088736c4ac7a13ff8b" + "signature": "sha256:71915326a885e9b46062fd92497fab9cb251a079b1a67891349794cbf80af96f" }, "nbformat": 3, "nbformat_minor": 0, @@ -21,7 +21,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 7.2" + "Example 7.2,page no:211" ] }, { @@ -80,7 +80,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 7.3" + "Example 7.3,page no:212" ] }, { @@ -131,7 +131,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 7.4" + "Example 7.4,page no:213" ] }, { @@ -196,7 +196,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 7.6" + "Example 7.6,page no:214" ] }, { @@ -256,7 +256,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 7.7" + "Example 7.7,page no:215" ] }, { @@ -305,7 +305,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 7.10" + "Example 7.10,page no:216" ] }, { @@ -350,7 +350,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 7.11" + "Example 7.11,page no:217" ] }, { @@ -440,7 +440,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 7.12" + "Example 7.12,page no:218" ] }, { @@ -525,7 +525,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 7.13" + "Example 7.13,page no:219" ] }, { @@ -585,7 +585,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 7.17" + "Example 7.17,page no:220" ] }, { @@ -632,7 +632,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 7.19 " + "Example 7.19 ,page no:221" ] }, { @@ -679,7 +679,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 7.20" + "Example 7.20,page no:222" ] }, { @@ -724,7 +724,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 7.21" + "Example 7.21,page no:223" ] }, { @@ -778,7 +778,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 7.22" + "Example 7.22,page no:224" ] }, { @@ -833,7 +833,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 7.23" + "Example 7.23,page no:225" ] }, { diff --git a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch8.ipynb b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch8.ipynb index 18de8e63..13017199 100644 --- a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch8.ipynb +++ b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch8.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:2a584685665e22931eee90916ad677c233c22b41ab4fa1c2aff95245e3dea9a5" + "signature": "sha256:5bce75bac501ff67175351e42ece1f4cf6e76b54a447049ce4168abb033c71a9" }, "nbformat": 3, "nbformat_minor": 0, @@ -21,7 +21,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 8.6" + "Example 8.6,page no:226" ] }, { @@ -63,7 +63,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 8.7" + "Example 8.7,page no:228" ] }, { @@ -108,7 +108,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 8.8" + "Example 8.8,page no:229" ] }, { @@ -253,13 +253,14 @@ "level": 3, "metadata": {}, "source": [ - "Example 8.9" + "Example 8.9,page no:250" ] }, { - "cell_type": "code", - "collapsed": false, - "input": [ + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ "\n", "%pylab inline\n", "\n", @@ -294,49 +295,14 @@ "print '(c). The given subpart is theoretical and does not involve any numerical computation'\n", "\n", "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Populating the interactive namespace from numpy and matplotlib\n" - ] - }, - { - "output_type": "stream", - "stream": "stderr", - "text": [ - "WARNING: pylab import has clobbered these variables: ['draw_if_interactive']\n", - "`%pylab --no-import-all` prevents importing * from pylab and numpy\n" - ] - }, - { - "metadata": {}, - "output_type": "display_data", - "png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAEACAYAAAC9Gb03AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHYVJREFUeJzt3X9sG/X9x/Gn7dhp2qYp5Fe3OCsoEj/ixjQtRDBS6gp1\ngYQJKkANLEEbMLWAVrVs0jYm0YRNZGOboDC0byTo/liEaGmrjS1tVb5aXQajpEthodtUASr7xunS\nOA35bcdxct8/Qt3mV20ndtIer4d08vn88d3Hn8LrfXc+5yyGYRiIiIhpWee7AyIiklwKehERk1PQ\ni4iYnIJeRMTkFPQiIianoBcRMbmYgn5kZITi4mK++c1vAtDV1cX69etxu92UlZXR3d0daVtXV0dh\nYSFFRUUcOnQoOb0WEZGYxRT0O3bsoLCwEIvFAsD27dupqKigpaWFO++8k+3btwPQ3NzMvn37+Oij\njzh48CCbNm0iFAolr/ciIhJV1KD3+Xzs37+fRx99lHO/rdq/fz/V1dUAVFVV0djYCEBjYyOVlZXY\nbDby8vJwuVw0NTUlsfsiIhJN1KDftm0bv/zlL7Fazzf1+/1kZmYCkJWVRUdHBwBtbW04nc5IO6fT\nic/nS3SfRUQkDhcN+j//+c/k5ORQXFyM/lKCiMjlKeViL/7tb3/jzTffZP/+/QSDQXp7e6muriY7\nO5vOzk6ysrLw+/3k5OQAY3vwra2tkff7fD7y8/Mnrdey1AY9own+KCIi5lZQUMAnn3wS9/sssf5R\nsyNHjvCrX/2KP/3pT3zve9+joKCArVu38vzzz3Pq1ClefPFFmpub2bx5M++99x7t7e2Ulpby8ccf\nY7fbx2/UYsEwDEIh6O426Px8GP/nAfzdQTq7A3T1BunqC9DdH6S7P0DvYIDewSB9wQADQ0EGQwEG\nh4MEwwEMWxDHogCOhUHsaQFsqUGsqQGsjgCkBCElwKgtyKg1QJggwwQYNoIMjQRIsaaQZk9jQcoC\n0lK+eLSnjZsf99oUy6d6f7S2Vsv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biZtjz6WH05NbOPz+XA6ncnq0ryJZSwAWlpa\nePTRR3nzzTcveuh2OYtlLJqbm6msrOTqq69m7969PP7447z55ptz3dWki2Usvva1r/GNb3yDtLQ0\nMjMzWbt2LS0tLXPd1aSLZSzeeecd7r//fmDsh0NXX301//73v+e0n5eCGeVmwr5BmCAQCBjLly83\nfD6fEQqFjBtvvNFobm4e12bPnj3GPffcYxiGYTQ3NxtutztZ3ZlXsYzFf/7zH6OgoMB477335qmX\ncyOWsbjQt7/9bWPv3r1z2MO5E8tYHD9+3Lj99tuNcDhsDAwMGIWFhcYHH3wwTz1OnljG4vHHHzdq\namoMwzCM9vZ2Y9myZZEvqc3m1KlTF/0yNt7cTNqpm+l+OHXukqhNmzZx7733cvjwYVwuF6mpqfzu\nd79LVnfmVSxj8cwzz/D5559Hzkvb7Xaamprms9tJEctYfFnEMhbFxcXccccduN1uhoeHefTRR1m5\ncuU89zzxYhmLp59+mqqqKgoLCxkZGeFnP/tZ5EtqM3nggQc4cuQInZ2d5OfnU1tby/DwMDDz3NQP\npkRETE63EhQRMTkFvYiIySnoRURMTkEvImJyCnoREZNT0IuImJyCXkTE5BT0IiIm9/8XDjZRk2RO\nAwAAAABJRU5ErkJggg==\n", - "text": [ - "" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "(c). The given subpart is theoretical and does not involve any numerical computation\n" - ] - } - ], - "prompt_number": 6 + ] }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ - "Example 8.11" + "Example 8.11,page no:252" ] }, { @@ -388,7 +354,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 8.12" + "Example 8.12,page no:253" ] }, { @@ -448,7 +414,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 8.13" + "Example 8.13,page no:254" ] }, { @@ -514,7 +480,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 8.15" + "Example 8.15,page no:255" ] }, { @@ -569,7 +535,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 8.16" + "Example 8.16,page no:256" ] }, { @@ -627,7 +593,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 8.17" + "Example 8.17,page no:257" ] }, { @@ -697,7 +663,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 8.19" + "Example 8.19,page no:258" ] }, { @@ -814,7 +780,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 8.20" + "Example 8.20,page no:259" ] }, { @@ -889,7 +855,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 8.21" + "Example 8.21,page no:260" ] }, { @@ -1002,7 +968,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 8.22" + "Example 8.22,page no:261" ] }, { @@ -1136,7 +1102,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 8.23" + "Example 8.23,page no:262" ] }, { @@ -1205,7 +1171,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 8.25" + "Example 8.25,page no:263" ] }, { @@ -1257,7 +1223,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 8.26" + "Example 8.26,page no:264" ] }, { @@ -1324,7 +1290,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 8.27 " + "Example 8.27,page no:265 " ] }, { @@ -1382,7 +1348,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 8.28" + "Example 8.28,page no:266" ] }, { diff --git a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch9.ipynb b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch9.ipynb index b00a214c..84b2f311 100644 --- a/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch9.ipynb +++ b/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch9.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:70e5d31cbd675202c3287b597ce34b28fa488bc5446177836cd0448444371ac9" + "signature": "sha256:143cdfa176d2adff05d6185ec25c9acd8d4e3e65839a51952b6344e41d5d94f6" }, "nbformat": 3, "nbformat_minor": 0, @@ -21,7 +21,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 9.6" + "Example 9.6,page no:267" ] }, { @@ -67,7 +67,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 9.7" + "Example 9.7,page no:268" ] }, { @@ -116,7 +116,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 9.8" + "Example 9.8,page no:269" ] }, { @@ -172,7 +172,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 9.9" + "Example 9.9,page no:270" ] }, { @@ -229,7 +229,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 9.10" + "Example 9.10,page no:271" ] }, { @@ -281,7 +281,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 9.11" + "Example 9.11,page no:272" ] }, { @@ -338,7 +338,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 9.12" + "Example 9.12,page no:273" ] }, { @@ -379,7 +379,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 9.13" + "Example 9.13,page no:274" ] }, { @@ -432,7 +432,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 9.14" + "Example 9.14v,page no:75" ] }, { @@ -472,7 +472,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 9.15" + "Example 9.15,page no:276" ] }, { @@ -517,7 +517,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 9.16" + "Example 9.16,page no:278" ] }, { @@ -567,7 +567,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 9.17" + "Example 9.17,page no:279" ] }, { @@ -604,7 +604,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 9.18" + "Example 9.18,page no:280" ] }, { @@ -658,7 +658,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 9.19" + "Example 9.19,page no:281" ] }, { @@ -724,7 +724,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 9.20" + "Example 9.20,page no:282" ] }, { @@ -775,7 +775,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 9.21" + "Example 9.21,page no:283" ] }, { @@ -836,7 +836,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 9.22" + "Example 9.22,page no:284" ] }, { @@ -892,7 +892,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 9.23" + "Example 9.23,page no:285" ] }, { @@ -974,7 +974,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 9.24" + "Example 9.24,page no:286" ] }, { diff --git a/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch1-checkpoint.ipynb b/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch1-checkpoint.ipynb new file mode 100644 index 00000000..6ff156a7 --- /dev/null +++ b/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch1-checkpoint.ipynb @@ -0,0 +1,85 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:d40864745b0958ff90d45e29ecc4874d2fd0d20b38ed09535ff46977537fd224" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter no. 1: Introduction To Electronics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.1 Page no.8" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "A=4 #NUMERICAL CODE FOR BAND YELLOW\n", + "B=7 #NUMERICAL CODE FOR BAND VIOLET\n", + "C=3 #NUMERICAL CODE FOR BAND ORANGE\n", + "D=5 #TOLERANCE VALUE FOR BAND GOLD i.e. 5%\n", + "\n", + "#Resistor Value Calculation\n", + "R=(A*10+B)*10**C\n", + "#Tolerance Value Calulation\n", + "T=D*R/100;\n", + "R1=R-T;\n", + "R2=R+T;\n", + "\n", + "# Results\n", + "print \"Therefore thr resistance should be within the range \", R1*10**(-3) ,\"kohm\",\"and\", R2*10**(-3),\"kohm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.2 Page no.8" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "A=8 #NUMERICAL CODE FOR BAND GRAY\n", + "B=6 #NUMERICAL CODE FOR BAND BLUE\n", + "C=-1 #NUMERICAL CODE FOR BAND GOLD\n", + "D=5 #TOLERANCE VALUE FOR BAND GOLD i.e. 5%\n", + "#Resistor Value Calculation\n", + "R=(A*10+B)*10**C\n", + "#Tolerance Value Calulation\n", + "T=D*R/100\n", + "R1=R-T\n", + "R2=R+T\n", + "# Results \n", + "print \"Range of Values of the Resistor is between \",R1,\"ohm\",\"and\",R2,\"ohm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch10-checkpoint.ipynb b/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch10-checkpoint.ipynb new file mode 100644 index 00000000..1268374a --- /dev/null +++ b/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch10-checkpoint.ipynb @@ -0,0 +1,130 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:c0e331b614f072bb0c21b302f0e54b6a8366fa46ba53ae4810b072360f344e0d" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 10: Power Amplifiers" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.1 Page No.345" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "RL=16 # Ohms, load resistance\n", + "RLd=10000.0 # Ohms ,effective load resistance\n", + "\n", + "#Calculation\n", + "import math\n", + "N12=math.sqrt(RLd/RL) #N12=N1/N2\n", + "\n", + "# Result\n", + "print \" The Transformer Turns Ratio is N1/N2\",N12,\":1\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Transformer Turns Ratio is N1/N2 25.0 :1\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.2 Page No.345" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Given Circuit Data\n", + "Rl=8.0 #Ohms, load resistance\n", + "N12=15.0 #N12=N1/N2, transformer turns ratio\n", + "\n", + "#Calculation\n", + "Rld=(N12)**2*Rl #effective resistance\n", + "\n", + "# Result\n", + "print \" The Effective Resistance seen looking into the Primary, Rld = \",Rld/10**3,\"k ohm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.3 Page No.353" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "I1=15 #A\n", + "I2=1.5 #A\n", + "I3=1.2 #A\n", + "I4=0.5 #A\n", + "\n", + "#Calculation\n", + "D2=(I2/I1)*100 #percentage harmonic distribution of component 2\n", + "D3=(I3/I1)*100 #percentage harmonic distribution of component 3\n", + "D4=(I4/I1)*100 #percentage harmonic distribution of component 4\n", + "\n", + "#Result\n", + "print \" The Second Harmonic Distortion is, D2 = percent .\",D2\n", + "print \" The Third Harmonic Distortion is, D3 = percent .\",D3\n", + "print \" The Fourth Harmonic Distortion is, D4 = percent .\",round(D4,2)\n", + "\n", + "#(b)\n", + "import math\n", + "P1=1 #say\n", + "\n", + "#Calculation\n", + "D=math.sqrt(D2**2+D3**2+D4**2) #Distortion Factor\n", + "P=(1+(D/100)**2)*P1\n", + "Pi=((P-P1)/P1)*100\n", + "\n", + "#Result\n", + "print \"The Percentage Increase in Power because of Distortion is, Pi (in percent)= \",round(Pi,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch11-checkpoint.ipynb b/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch11-checkpoint.ipynb new file mode 100644 index 00000000..dd06f959 --- /dev/null +++ b/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch11-checkpoint.ipynb @@ -0,0 +1,188 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:42316ce336a06a4afe76966dd3df12fd0f55e47e7182329e33e900184918fde7" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 11: Tuned Voltage mplifiers" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.1 Page No.374" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "C=300*10**(-12) #F, capacitance\n", + "L=220*10**(-6) #H, inductance\n", + "R=20.0 #Ohms, resistance\n", + "\n", + "#Calculation\n", + "import math\n", + "fr=1/(2*math.pi*math.sqrt(L*C)) #resonant frequency\n", + "#result\n", + "print \" The Resonant Frequency, fr = \",round(fr/10**3,0),\"khz\"\n", + "\n", + "#(b) find The Impedance at Resonance\n", + "#Calculation\n", + "Rr=R\n", + "#result\n", + "print \" The Impedance at Resonance, Rr = \",Rr,\"ohm\"\n", + "\n", + "#(c) find The Current at Resonance\n", + "V=10.0 #V, voltage\n", + "#Calculation\n", + "I=V/R\n", + "#result\n", + "print \" The Current at Resonance, I = \",I,\"A\"\n", + "\n", + "#(d)\n", + "#Calculation\n", + "fr=1/(2*math.pi*math.sqrt(L*C))\n", + "I=V/R\n", + "Xl=2*math.pi*fr*L #reactance of inductor\n", + "Vl=I*Xl # Voltage across the Inductance\n", + "Xc=1/(2*math.pi*fr*C) #reactance of capacitance\n", + "Vc=I*Xc # Voltage across the Capacitance,\n", + "Vr=I*R #Voltage across the Resistance\n", + "\n", + "#result\n", + "print \" Voltage across the Inductance, Vl = \",round(Vl,0),\"V\"\n", + "print \" Voltage across the Capacitance, Vc = \",round(Vc,0),\"V\"\n", + "print \" Voltage across the Resistance, Vr = \",round(Vr,0),\"V\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Resonant Frequency, fr = 620.0 khz\n", + " The Impedance at Resonance, Rr = 20.0 ohm\n", + " The Current at Resonance, I = 0.5 A\n", + " Voltage across the Inductance, Vl = 428.0 V\n", + " Voltage across the Capacitance, Vc = 428.0 V\n", + " Voltage across the Resistance, Vr = 10.0 V\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.2 Page No.378" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "C=100*10**(-12) #F\n", + "L=100*10**(-6) #H\n", + "R=10 #Ohms\n", + "V=100 #V\n", + "\n", + "#Calculation\n", + "import math\n", + "fr=1/(2*math.pi*math.sqrt(L*C)) #Hz, resonant frequency\n", + "Xl=2*math.pi*fr*L #ohm, inductive reactance\n", + "Il=V/Xl #A, current in inductive branch\n", + "Xc=1/(2*math.pi*fr*C) #ohm, capacitance reactance\n", + "Ic=V/Xc #A, current in capacitive branch \n", + "Zp=L/(R*C) #ohm , series impedance\n", + "I=V/Zp #A, line current\n", + "\n", + "#Result\n", + "print \"fr= \",round(fr/10**3,0),\"khz\"\n", + "print \"Il= \",Il,\"A\"\n", + "print \"Ic= \",Ic,\"A\"\n", + "print \"Zp= \",Zp,\"ohm\"\n", + "print \"I= \",I/10**(-3),\"mA\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "fr= 1592.0 khz\n", + "Il= 0.1 A\n", + "Ic= 0.1 A\n", + "Zp= 100000.0 ohm\n", + "I= 1.0 mA\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.3 Page no. 379" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "C=100*10**(-12) #F, capacitance\n", + "L=150*10**(-6) #H, inductance\n", + "R=15 #Ohms, resistance\n", + "\n", + "#Calculation\n", + "fr=1/(2*math.pi*math.sqrt(L*C))\n", + "Zp=L/(R*C)\n", + "Q=2*math.pi*fr*L/R\n", + "df=fr/Q #Bandwidth\n", + "\n", + "#The Result\n", + "print \" Impedance, Zp= \",Zp/10**3,\"kohm\"\n", + "print \" Quality Factor, Q= \",round(Q,1)\n", + "print \" Bandwidth, df= \",round(df/10**3,2),\"khz\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Impedance, Zp= 100.0 kohm\n", + " Quality Factor, Q= 81.6\n", + " Bandwidth, df= 15.92 khz\n" + ] + } + ], + "prompt_number": 5 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch12-checkpoint.ipynb b/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch12-checkpoint.ipynb new file mode 100644 index 00000000..5b2933a1 --- /dev/null +++ b/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch12-checkpoint.ipynb @@ -0,0 +1,208 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:1fc7b4e7810aaec71230ef3ddc13645d6efc0b44874bc6bf484268f68693d914" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 12:Feedback in amplifiers" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.1 Page no.395" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "A=100.0 #Internal Gain\n", + "B=0.1 #Feedback Factor\n", + "\n", + "#Calculation\n", + "Af=A/(1+A*B) # Gain of Feedback Amplifier \n", + "# Result\n", + "print \" The Value of the Gain of Feedback Amplifier is = \",round(Af,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Value of the Gain of Feedback Amplifier is, = 9.09\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.2 Page no. 395" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Af=100.0 #Voltage Gain\n", + "Vin=.05 #V , Input Signal without Feedaback Gain\n", + "Vi=0.6 #V , Input Signal with Feedaback Gain\n", + "\n", + "#Calculation\n", + "Vo=Af*Vi\n", + "A=Vo/Vin\n", + "B=((A/Af)-1)/A\n", + "#Result\n", + "print \"The Value of the Internal Gain A is, A = \",A\n", + "print \" The Value of the Feedback Gain B is, B = percent \",round(B*100,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Value of the Internal Gain A is, A = 1200.0\n", + " The Value of the Feedback Gain B is, B = percent 0.92\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.3 Page no. 401" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "A=1000 #60dB Voltage Gain\n", + "B=0.005 #Negative Feedback\n", + "dAbyA=-0.12 #dA/A = 12 %\n", + "\n", + "#Calculation\n", + "dAfbyAf=1/(1+A*B)*dAbyA #dAf/Af=1/(1+A*B)*dA/A\n", + "\n", + "# Result\n", + "print \" The change in overall Gain of the Feedback Amplifier is\",dAfbyAf\n", + "print \"Therefore the overall gain of feedback amplifier will be reduce by \",-dAfbyAf*100,\"%\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The change in overall Gain of the Feedback Amplifier is -0.02\n", + "Therefore the overall gain of feedback amplifier will be reduce by 2.0 %\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.4 Page no. 401" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Zi=1000.0 #Ohms\n", + "A=1000.0 #Voltage Gain\n", + "B=0.01 #Negative Feedback\n", + "\n", + "#Calculation\n", + "Zid=(1+A*B)*Zi\n", + "# Result\n", + "print \" The Value of the Input Impedance of the Feedback Amplifier is, Zid = \",Zid/10**3,\"K ohm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Value of the Input Impedance of the Feedback Amplifier is, Zid = 11.0 K ohm\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.5 Page no. 401" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "A=1000.0 #60dB, Voltage Gain\n", + "Zo=12000.0 #Ohms\n", + "Zod=600.0 #Ohms\n", + "dAbyA=0.1 #dA/A = 10 %\n", + "\n", + "#Calculation\n", + "B=((Zo/Zod)-1)/A #Zod=Zo/(1+A*B)\n", + "dAfbyAf=1/(1+A*B)*dAbyA #dAf/Af=1/(1+A*B)*dA/A\n", + "# Result\n", + "print \" The Feedback Factor of the Feedback Amplifier is, B = \",B*100,\"percent\"\n", + "print \" The change in overall Gain of the Feedback Amplifier is, dAf/Af = \",dAfbyAf*100,\"percent\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Feedback Factor of the Feedback Amplifier is, B = 1.9 percent\n", + " The change in overall Gain of the Feedback Amplifier is, dAf/Af = 0.5 percent\n" + ] + } + ], + "prompt_number": 6 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch13-checkpoint.ipynb b/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch13-checkpoint.ipynb new file mode 100644 index 00000000..47cf6410 --- /dev/null +++ b/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch13-checkpoint.ipynb @@ -0,0 +1,104 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:599e62479fb81312d9e71ded8b631cb3f6c046aff5ae2a1f3f8129c2f46ca250" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 13:Oscillators" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.1 Page no.421" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "L=58.6*10**(-6) # H, inductance\n", + "C=300*10**(-12) # F, capacitance\n", + "\n", + "#Calculation\n", + "import math\n", + "fo=1/(2*math.pi*math.sqrt(L*C))\n", + "\n", + "#Result\n", + "print \" The Frequency of Oscillation of Tuned Collector Oscillator is fo = \",round(fo/10**3,2),\"KHz\"" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.2 Page no.427" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "R=100000.0 # Ohms, resistance\n", + "C=0.01*10**(-6) #F, capacitance\n", + "\n", + "#Calculation\n", + "import math\n", + "fo=1/(2*math.pi*R*C*math.sqrt(6))\n", + "#Result\n", + "print \"The Frequency of Oscillation of Vacuum Tube Phase Shift Oscillator is fo = \",round(fo,2),\"Hz\"" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.3 Page no.427" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "R1=220000.0 # Ohms, Resistance 1\n", + "R2=220000.0 # Ohms Resistance 2\n", + "C1=250*10**(-12) #F, capacitance 1 \n", + "C2=250*10**(-12) #F, capacitance 2\n", + "\n", + "#Calculation\n", + "import math\n", + "fo=1/(2*math.pi*math.sqrt(R1*C1*R2*C2))\n", + "# Result\n", + "print \"The Frequency of Oscillation of Wein Bridge Oscillator is fo = \",round(fo/10**3,2),\"KHz\"" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch14-checkpoint.ipynb b/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch14-checkpoint.ipynb new file mode 100644 index 00000000..f2764770 --- /dev/null +++ b/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch14-checkpoint.ipynb @@ -0,0 +1,284 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:cfa443285df31619aefbaacada3721c633441a1550bfa091bb356c1fe13c7815" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 14 :Electronic Instruments" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.1 Page no.443" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Rm=100.0 #Ohms, coil resistance\n", + "Is=100*10**(-6 ) #A current sensivity\n", + "Vr=100.0 #V, voltage\n", + "\n", + "#Calculation\n", + "Rtotal=Vr/Is #series resistance\n", + "Rs=Rtotal-Rm #additional series resistance\n", + "#Result\n", + "print \" The Series Resistance to Convert given dArsonval movement into a Voltmeter is, Rs = \",Rs/10**3,\"Kohm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Series Resistance to Convert given dArsonval movement into a Voltmeter is, Rs = 999.9 Kohm\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.2 Page no. 445" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Rm=100.0 #. meter resistance #Ohms\n", + "CS=100*10**(-6) #A. current sensivity\n", + "Imax=10*10**(-3) #A. maximum current\n", + "\n", + "#Calculation\n", + "Ish=Imax-CS\n", + "Rsh=Rm*CS/Ish\n", + "# Result\n", + "print \" The Value of Shunt Resistance is, Rsh = \",round(Rsh,6),\"ohm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Value of Shunt Resistance is, Rsh = 1.010101 ohm\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.3 Page no.446" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "CS=100*10**(-6) #A, current source\n", + "R=100.0 #Ohms, resistance\n", + "Rm=900.0 #Ohms, resistance of a meter\n", + "\n", + "#(a)\n", + "#Calculation\n", + "Imax1=1*10**(-3) #A, maximum current\n", + "Rsh=CS*R/(Imax1-CS) #ohm, shunt path resistance\n", + "Rm1=Rm #ohm, meter branch resistance\n", + "Ish1=Imax1-CS #A shunt path current\n", + "Rsh1=Rm1*CS/Ish1 #ohm shunt path resistance\n", + "\n", + "#(b)\n", + "#Calculation\n", + "Imax2=0.01 #A, maximum current\n", + "Ish2=Imax2-CS #A, shunt path current\n", + "R1=(R*Ish2-Rm*CS)/(Ish2+CS) #ohm, resistance in branch 1\n", + "\n", + "#(c)\n", + "#Calculation\n", + "Imax3=100*10**(-3) #A. maximum current\n", + "Ish3=Imax3-CS #A, shunt path current\n", + "R2=((R-R1)*Ish3-Rm*CS)/(Ish3-CS) #ohm, resistance in branch 2\n", + "\n", + "#(d)\n", + "#Calculation\n", + "Imax4=500*10**(-3) #A , maximum current\n", + "Ish4=Imax4-CS #A, shunt path current\n", + "R3=((R-R1-R2)*Ish4-Rm*CS)/(Ish4-CS) #ohm, resistance in branch 3\n", + "\n", + "#(e)\n", + "#Calculation\n", + "Imax5=1 #A\n", + "Ish5=Imax5-CS #A, shunt path current\n", + "R4=((R-R1-R2-R3)*Ish5-Rm*CS)/(Ish5-CS) #ohm, resistance in branch 4\n", + "R5=R-R1-R2-R3-R4 #ohm, resistance in branch 2\n", + "\n", + "# Result\n", + "print \" Shunt Resistance =\",round(Rsh,6),\"ohm\"\n", + "print \" For Range switch at 1 mA , Rsh1 \",Rsh1,\"ohm\"\n", + "print \" For Range switch at 10 mA , R1 = \",R1,\"ohm\"\n", + "print \" For Range switch at 100 mA, R2 = \",round(R2,0),\"ohm\"\n", + "print \" For Range switch at 500 mA, R3 = \",round(R3,1),\"ohm\"\n", + "print \" For Range switch at 1 A , R4 = \",round(R4,1),\"ohm\"\n", + "print \" R5 = \",round(R5,1),\"ohm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Shunt Resistance = 11.111111 ohm\n", + " For Range switch at 1 mA , Rsh1 100.0 ohm\n", + " For Range switch at 10 mA , R1 = 90.0 ohm\n", + " For Range switch at 100 mA, R2 = 9.0 ohm\n", + " For Range switch at 500 mA, R3 = 0.7 ohm\n", + " For Range switch at 1 A , R4 = 0.1 ohm\n", + " R5 = 0.1 ohm\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.4 Page no.469" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "DS=5 #V/cm, Deflection Sensitivity\n", + "l=10 #cm, Trace Length\n", + "\n", + "#Calculation\n", + "import math\n", + "Vp=DS*l\n", + "Vm=Vp/2\n", + "V=Vm/math.sqrt(2)\n", + "# Result\n", + "print \" The RMS AC Voltage is=\",round(V,3),\"V\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The RMS AC Voltage is= 17.678 V\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "%pylab inline" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\n", + "For more information, type 'help(pylab)'.\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.5 Page no. 471" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import numpy\n", + "#Given Circuit Data\n", + "Am=3.5 #V, Amplitude\n", + "tb=0.1*10**(-3) #seconds\n", + "TP=4 #Time Period\n", + "x=linspace(-10,10,1000)\n", + "plt.grid()\n", + "plot(x,cos(x))\n", + "title('Display of a sine wave voltage on CRO ')\n", + "show()\n", + "#Calculation\n", + "import math\n", + "Vm=2*Am\n", + "V=Vm/math.sqrt(2)\n", + "T=TP*tb\n", + "f=1/T\n", + "\n", + "# Result\n", + "print \"The Magnitude of Wave Voltage, \",round(V,2),\"V\"\n", + "print \" The Frequency of Wave Voltage, f = \",f/10**3,\"KHz\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAEICAYAAACzliQjAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJztnXlcVdUa938HRUQkBBFRGUVlEAREwBxJzcyxW1pqOWSD\nV3vTNHt7K69Wt7ksy8qhNG83LSs1UVOv01GcQAVncCZMUdEUEFSm5/1jdY4cOAfOsPfZ0/p+Pnz0\nwD57P2etfX5r7d9a61k6IiJwOBwORxO4SB0Ah8PhcJwHF30Oh8PREFz0ORwOR0Nw0edwOBwNwUWf\nw+FwNAQXfQ6Hw9EQXPQlYtKkSXjnnXccOoder0dgYKBAEVnPtm3b0KtXL3h6euLw4cOiXCMtLQ0R\nERGinFsthISEYOvWrVKHwVEYXPRFICQkBE2aNMF9992H4OBg9OnTB7/++qvJMfPnz8fMmTMlitAx\n3nvvPUyYMAHFxcWIjY0V5Ro9e/ZETk6OKOdWCzqdDjqdDgDw5ptvYsyYMRJHJAwnT57EP/7xDwQF\nBcHb2xvJyclYunQp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ydz0bcBW9aYcKyj1d9J\n4CMjIzF06FCsXbsWz/FdWxwiMTER2dnZiI+PR3Z2tlU6KRt7p3qLlZSUhE2bNiEvLw96vR4uLi7w\n9PSUMDrlkZ+fDwCoqKjA8uXLMXDgQIkjUhZ8jYmwlJaWGi3GgoICbNq0iTeiApCcnIwlS5bg9u3b\nWLJkCbp27Vr/m8SZXGQdq1atooCAAGrcuDG1bNmSBgwYYPzb3LlzKSwsjCIjI2nnzp0SRqlMxowZ\nQzExMZSQkEDTpk2j69evSx2S4tDr9RQREUFhYWH0+eefSx2Oojl37hzFxsZSbGws9enThxYvXix1\nSIpj5MiR1KpVK2rUqBEFBATQkiVL7JqyKZudszgcDocjPrKxdzgcDocjPlz0ORwOR0Nw0edwOBwN\nwUWfw+FwNAQXfQ6Hw9EQXPQ5HA5HQ/x/swF7YoxaJw4AAAAASUVORK5CYII=\n" + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Magnitude of Wave Voltage, 4.95 V\n", + " The Frequency of Wave Voltage, f = 2.5 KHz\n" + ] + } + ], + "prompt_number": 2 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch2-checkpoint.ipynb b/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch2-checkpoint.ipynb new file mode 100644 index 00000000..56897172 --- /dev/null +++ b/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch2-checkpoint.ipynb @@ -0,0 +1,144 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:d04dc734c5bc464767e0da96b38331e03b832b88f0bd8644b242b3682feeb9d9" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 2:Current and Voltage Source" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.1 Page no.39" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Vs=2 #V open circuit voltage\n", + "Rs=1 #ohm . internal impedence\n", + "#Current Source or Norton's Representaion (Parallel Current Source & Resistor\n", + "Is=Vs/Rs #Ampere, short circuit current\n", + "#result\n", + "print \"The Short Circuit Current Value is \",Is,\"A\"\n", + "print \"The Source Impedence Value is \",Rs,\"ohm\"\n", + "print \"The Current Source & Source Impedance are connected in Parallel.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.2 Page no.40" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Is=0.2 #Amperes\n", + "Zs=100 #Ohms\n", + "#Voltage Source or Thevenin's Representaion (Series Voltage Source & Resistor)\n", + "Vs=Is*Zs #Volts\n", + "# Results \n", + "print \"The Open Circuit Voltage is \",Vs,\"V\"\n", + "print \"The Source Impedence Value is \",Zs,\"ohm\"\n", + "print \"The Voltage Source & Source Impedance are connected in Series.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.3 Page no.40" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Is=1.5*10**(-3) #Amperes ,source current\n", + "Zs=2000 #Ohms, resistance connected to the loads\n", + "Z1=10000 #Ohms , load resistance 1\n", + "Z2=40000 #Ohms load resistance 2\n", + "#Calculation for Current Source Representation\n", + "Zl=Z1*Z2/(Z1+Z2)\n", + "I2=Is*Zs/(Zs+Zl)\n", + "I4I=I2*Z1/(Z1+Z2) #Using Current Divider Rule\n", + "\n", + "#Calculation for Current Source Representation\n", + "Vs=Is*Zs #Open Circuit Volatge\n", + "I=Vs/(Zs+Zl)\n", + "I4V=I*Z1/(Z1+Z2) #Using Current Divider Rule\n", + "# Results \n", + "print \"The Load Current using Current Source Representaion is I4I = \",I4I,\"A\"\n", + "print \"The Load Current using Voltage Source Representaion is I4V = \",I4V,\"A\"\n", + "print \"I4I==I4V so\"\n", + "print \" Both Results are same.\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.4 Page no.45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "Vs=0.01 #V ,dc voltage\n", + "Rs=1000 # ohm, resistance\n", + "#Output Side resistance\n", + "Ro1=20000 #ohm, 20 kOhms\n", + "Ro2=2000 # Ohms\n", + "\n", + "#Calculation\n", + "i=Vs/Rs #Input Current\n", + "Io=100*i #Output Current\n", + "Il=Io*Ro1/(Ro1+Ro2) #Using Current Divider Rule\n", + "Vo=Il*Ro2 #Output Volatge\n", + "\n", + "# Result\n", + "print \"The Output Voltage Vo = \",round(Vo,3),\"V\"" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch4-checkpoint.ipynb b/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch4-checkpoint.ipynb new file mode 100644 index 00000000..701f4aaf --- /dev/null +++ b/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch4-checkpoint.ipynb @@ -0,0 +1,188 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:ae9612ced78590c195456849014e70cbd1cdee113840d747c19ee249579f79a3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 4:Semiconductor Diode" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.1 Page No.85" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Vrms=220 #Volts, power supply\n", + "n2=1 #Assumption\n", + "n1=12*n2 #Turns Ratio\n", + "\n", + "#Calculation\n", + "import math\n", + "Vp=math.sqrt(2)*Vrms #Maximum(Peak) Primary Voltage\n", + "Vm=n2*Vp/n1 #Maximum Secondary Voltage\n", + "Vdc=Vm/math.pi #DC load Voltage \n", + "# Results \n", + "print \"The DC load Voltage is = \",round(Vdc,2),\"V\"\n", + "print \"The Peak Inverse Voltage(PIV) is = \",round(Vm,1),\"V\"" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.2 Page No.90" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Vrms=220 #Volts, power supply rms voltage\n", + "n2=1 #Assumption\n", + "n1=12*n2 #Turns Ratio\n", + "\n", + "#Calculation\n", + "import math\n", + "Vp=math.sqrt(2)*Vrms #Maximum(Peak Primary Voltage\n", + "Vm=n2*Vp/n1 #Maximum Secondary Voltage\n", + "Vdc=2*Vm/math.pi #DC load Voltage \n", + "\n", + "# Results \n", + "print \"The DC load Voltage is = \",round(Vdc,1),\"V\"\n", + "print \"The Peak Inverse Voltage(PIV of Bridge Rectifier is = \",round(Vm,1),\"V\"\n", + "print \"The Peak Inverse Voltage(PIV of Centre-tap Rectifier is = \",round(2*Vm,1),\"v\"" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.3 Page No.95" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "Rl=1000.0 #Ohms, load resistance\n", + "rd=10.0 #Ohms forward base dynamic resistance\n", + "Vm=220.0 #Volts(Peak Value of Voltage)\n", + "#Calculation\n", + "Im=Vm/(rd+Rl) #Peak Value of Current\n", + "\n", + "# Result\n", + "print \"The Peak Value of Current is = \",round(Im*1000,1),\"mA\"\n", + "\n", + "#(b) dc or av value of current\n", + "\n", + "Idc=2*Im/math.pi #DC Value of Current\n", + "# Results \n", + "print \"The DC or Average Value of Current is \",round(Idc*1000,2),\"mA\"\n", + "\n", + "#(c)\n", + "Irms=Im/math.sqrt(2) #RMS Value of Current\n", + "# Results \n", + "print \"The RMS Value of Current is = \",round(Irms*1000,1),\"mA\"\n", + "\n", + "#(d)\n", + "r=math.sqrt((Irms/Idc)**2-1) #Ripple Factor\n", + "# Results i\n", + "print \" The Ripple Factor r = \",round(r,3)\n", + "\n", + "#(e)\n", + "Pdc=Idc**2*Rl\n", + "Pac=Irms**2*(rd+Rl)\n", + "n=Pdc/Pac #Rectification Efficiency\n", + "# Results\n", + "print \"The Rectification EFficiency n(eeta) = percent.\",round(n*100,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.4 Page No.103" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Vz=9.1 #Volts\n", + "P=0.364 #Watts\n", + "#Calculation\n", + "Iz=P/Vz\n", + "#Result\n", + "print \" The Maximum permissible Current is \",Iz*1000,\"mA\"" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.5 Page No.105" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Ci=18*10**(-12) #i.e. 18 pF, capacitance of diode\n", + "Vi=4 #volt, initial voltage\n", + "Vf=8 #v, final voltage\n", + "\n", + "#Calculation\n", + "import math\n", + "Vf=8 \n", + "K=Ci*math.sqrt(Vi)\n", + "Cf=K/math.sqrt(Vf)\n", + "#Result\n", + "print \" The Final Value of Capacitance is C = \",round(Cf/10**(-12),3),\"pF\"" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch5-checkpoint.ipynb b/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch5-checkpoint.ipynb new file mode 100644 index 00000000..89258a51 --- /dev/null +++ b/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch5-checkpoint.ipynb @@ -0,0 +1,385 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:fb72fb6e3e7bfcc92ab695858992d86597c1a24269bab39240e9f25a8dff8c2d" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 5: Transistors" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.1 Page No 134" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "alpha=0.98 #alpha(dc), current gain\n", + "Ico=1*10**(-6) #Ampere, collector leakage current\n", + "Ie=1*10**(-3) # Ampere, emitter current\n", + "\n", + "#Calculation\n", + "Ic=alpha*Ie+Ico #Collector Current\n", + "Ib=Ie-Ic #Base Current \n", + "#result\n", + "print \" The Collector Current is Ic= \",Ic*1000,\"mA\"\n", + "print \" The Base Current is Ib= \",Ib*10**6,\"microA\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Collector Current is Ic= 0.981 mA\n", + " The Base Current is Ib= 19.0 microA\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.2 Page No 141" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "dIe=(0.7-0.3)*10**(-3) #A, change in emitter current\n", + "dVeb=(0.7-0.62) #V, change in emitter base voltage\n", + "#Calculation\n", + "ri=dVeb/dIe #Dynamic Input Resistance at Vcb= -10 V \n", + "#Result\n", + "print \" The Dynamic Input Resistance is ri= \",ri,\"ohm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Dynamic Input Resistance is ri= 200.0 ohm\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.3 Page No 144" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "dIe=1*10**(-3) #A, change in emitter current\n", + "dIc=0.99*10**(-3) #A, change in the collector current\n", + "\n", + "#Calculation\n", + "hfb=dIc/dIe #Short Circuit Current Gain\n", + "#Result\n", + "print \"The Short Circuit Current Gain is alpha or hfb= \",hfb" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.4 Page No 147 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "dIe=1*10**(-3) #A, change in emitter current\n", + "dIc=0.995*10**(-3) #A, change in collector current\n", + "\n", + "#Calculation\n", + "alpha=dIc/dIe #Common Base Short Circuit Current Gain\n", + "#Result\n", + "print \" The Common Base Short Circuit Current Gain is alpha= \",alpha\n", + "\n", + "#(b)\n", + "beeta=alpha/(1-alpha) #Common Emitter Short Circuit Current Gain\n", + "# Result\n", + "print \" The Common Emitter Short Circuit Current Gain is beeta= \",beeta\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Common Base Short Circuit Current Gain is alpha= 0.995\n", + " The Common Emitter Short Circuit Current Gain is beeta= 199.0\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.5 Page No 147 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Beeta=100.0 #dc current gain\n", + "\n", + "#Calculation\n", + "Alpha=Beeta/(Beeta+1) #DC Current Gain in Common Base Configuration\n", + "# Result\n", + "print \" The DC Current Gain in Common Base Configuration is Alpha= \",round(Alpha,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The DC Current Gain in Common Base Configuration is Alpha= 0.99\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.6 Page No 150" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Vce=10 #V, collector emitter voltage\n", + "Ib=30*10**(-6) #A, base current\n", + "\n", + "#Calculation from Given Output Characteristics at Ib = 30uA\n", + "dVce=(12.5-7.5) #V, change in collector emitter voltage\n", + "dic=(3.7-3.5)*10**(-3) #A, change in collector current\n", + "Ic=3.6*10**(-3) #A, collector current at operating point \n", + "ro=dVce/dic # Dynamic Output Resistance\n", + "Beeta_dc=Ic/Ib # DC Current Gain\n", + "Beeta_ac=((4.7-3.6)*10**(-3))/((40-30)*10**(-6)) #AC Current Gain, From Graph, Bac=delta(ic)/delta(ib) for given Vce\n", + "\n", + "# Result\n", + "print \"Dynamic Output Resistance ,ro = \",ro/10**(3),\"kohm\"\n", + "print \" DC Current Gain ,Bdc = \",Beeta_dc\n", + "print \" AC Current Gain ,Bac = \",Beeta_ac" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Dynamic Output Resistance ,ro = 25.0 kohm\n", + " DC Current Gain ,Bdc = 120.0\n", + " AC Current Gain ,Bac = 110.0\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.7 Page No 159" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "Vcc=12 #V, collector bias juncyion voltage\n", + "Rc=1000.0 #Ohms, collector resistance\n", + "Vbb=10.7 #V. base bias junction voltage\n", + "Rb=200000.0 #Ohms, base resistance\n", + "Vbe=0.7 #V, base emitter voltage\n", + "\n", + "#Calculation\n", + "Ib=(Vbb-Vbe)/Rb # base current\n", + "#Value of Ib comes out to be 50uA. A dotted Curve is drawn for \n", + "#Ib=40uA and Ib=60uA. At the Point of Intersection:\n", + "Vce=6 #V, collector emitter voltage\n", + "Ic=6*10**(-3) #A, collector current\n", + "# Result\n", + "print \" Q point: Ib = \",Ib/10**(-6),\"microA\"\n", + "print \" Vce = \",Vce,\"V\"\n", + "print \" Ic = \",Ic/10**(-3),\"mA\"\n", + "#Plot\n", + "\n", + "#DC Load LIne AT Ib=50 microA\n", + "Vce1=[0,12]\n", + "Ic1=[12,0]\n", + "a1=plot(Vce1,Ic1)\n", + "xlim(0,14)\n", + "ylim(0,17)\n", + "\n", + "\n", + "# AT Ib=20 microA\n", + "Vce2=[0,1,12]\n", + "Ic2=[0,1.5,3]\n", + "a2=plot(Vce2,Ic2)\n", + "\n", + "# AT Ib=40 microA\n", + "Vce3=[0,1,12]\n", + "Ic3=[0,4,5]\n", + "a3=plot(Vce3,Ic3)\n", + "\n", + "#At IB=50\n", + "Vcex=[3.2,9]\n", + "Icx=[5.5,6]\n", + "ax=plot(Vcex,Icx,linestyle='--')\n", + "qx=plot(6.1,5.9,marker='o',label='$Q point$')\n", + "legend()\n", + "\n", + "# AT Ib=60 microA\n", + "Vce4=[0,1,12]\n", + "Ic4=[0,6.5,8]\n", + "a4=plot(Vce4,Ic4)\n", + "\n", + "# AT Ib=80 microA\n", + "Vce5=[0,1,12]\n", + "Ic5=[0,9,10]\n", + "a5=plot(Vce5,Ic5)\n", + "\n", + "# AT Ib=100 microA\n", + "Vce6=[0,1,12]\n", + "Ic6=[0,12,12.5]\n", + "a6=plot(Vce6,Ic6)\n", + "\n", + "# AT Ib=120 microA\n", + "Vce7=[0,1,12]\n", + "Ic7=[0,14.2,15]\n", + "a7=plot(Vce7,Ic7)\n", + "xlabel(\"$Vce(volt)$\")\n", + "ylabel(\"$Ic(mA)$\")\n", + "show(a1)\n", + "show(ax)\n", + "show(qx)\n", + "show(a2)\n", + "show(a3)\n", + "show(a4)\n", + "show(a5)\n", + "show(a6)\n", + "show(a7)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Q point: Ib = 50.0 microA\n", + " Vce = 6 V\n", + " Ic = 6.0 mA\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYYAAAEOCAYAAACNY7BQAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlcVPX++PHXDPu+CyqihJq44ZrpTSNNzcrtZplampre\n6ndbrmVp91q2maaWlX67N8u1MrO6Wm6lKWWZJWpqauK1QXFXdmQbmPP74wgyMsgMDHNm4P18PHgI\nZ87MvEH4vM/5LO+PTlEUBSGEEOIKvdYBCCGEcC6SGIQQQpiRxCCEEMKMJAYhhBBmJDEIIYQwI4lB\nCCGEGXetA7CFTqfTOgQhhHBJtqxMcLk7BkVRXPbjxRdf1DwGiV/7OBpi/K4ce32I31YulxiEEELU\nLUkMQgghzEhicKDExEStQ6gViV9brhy/K8cOrh+/rXRKTTqgNKLT6WrUXyaEEA2ZrW2nS81KEkLU\nT6GhoWRmZmodhssLCQkhIyOj1q8jdwxCCM3J37Z9VPVztPXnK2MMQgghzDg8MUyYMIHIyEg6dOhg\ndvzdd98lPj6e9u3b89xzzzk6LCGEEFc4fIxh/PjxPP7444wdO7b82Pbt2/nqq684cOAAHh4eXLx4\n0dFhCSGEuMLhdwy9e/cmJCTE7Nh7773H9OnT8fDwACAiIsLRYQkhhLjCKcYYjh07xg8//MDNN99M\nYmIiycnJWockhBANllNMVy0pKSEzM5Ndu3axe/du7rvvPv7880+L586cObP888TExAa38ESIhmbb\nhm2sfWct+iI9Ji8Tw54YRt+7+jrs+df673//y6lTp4iJiSEjI4PTp08zffp03NzcavR606ZNo2/f\nvgwYMKDGMV0rKSmJpKSkmr+AogGDwaC0b9++/Os77rhDSUpKKv86Li5OuXTpUqXnaRSuEKKOVfW3\n/d3675SH4x5WtrO9/OPhuIeV79Z/Z9Xr1vb5FZlMJmXy5MnKhx9+aHZ86tSpyhtvvGHz69VE3759\nFaPRWOXjVf0cbW07naIradiwYWzbtg2AlJQUiouLCQsL0zgqIYTW1r6zljHHx5gdG3N8DF+9+5VD\n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gwZwrJly3jggQcA8PLyAmDt2rW0atWK9evXo9PpaNmyJUajsfw1evbsydq1axk0aBAA7dq1Y/ny\n5YwZMwaAEydOEBwczO7du7npppsAOHfuXHlCKONKu8uJ+ksSg2jwgoKCyMjIQK/X4+fnR0lJCTEx\nMYC6KdSZM2fw8fFhyJAh3H333fTu3Zvz58/j5uZm9jrnz58nLCyM5ORkbr75ZoqKispf5/PPP+fB\nBx8kOTmZbt26sX379vIksXv37vKE4Irbp4r6R34LhQD+8pe/lG/+9Mgjj7Bx40a+/vprfv/9d5o0\nacLIkSM5cOAAGzZsYPXq1QQHB+Pr62v2Gn369OHzzz8nMzOTpk2bMmnSJL799luWL1/OiBEjaN26\nNXFxcfz444907NiRJk2acPr0aXJzc/H19UVRFAICArT49oUwI/sxCFFD8+bNY+LEieVjBrW1f/9+\n/vjjD0aOHGmX1xOipuSOQYgamjRpEmvWrLHb63333Xfce++9dns9IWpKEoMQNRQUFER8fHz5dNba\nOHToEP369ZMxBuEUpCtJCCGEGbk8EUIIYUYSgxBCCDOSGIQQQpiRxCCEEMKMJAYhhBBmJDEIIYQw\nI4lBCCGEGUkMQgghzPx/TjiQ+AqbBlQAAAAASUVORK5CYII=\n" + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.8 Page No 173" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "u=80.0 # Amplification Factor\n", + "gm=200*10**(-6) # S, Transconductance\n", + "\n", + "#Calculation\n", + "rd=u/gm #Dynamic Drain Resistance\n", + "# Result\n", + "print \" The Dynamic Drain Resistance of JFET is rd= \",rd/10**(3),\"kohm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Dynamic Drain Resistance of JFET is rd= 400.0 kohm\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch6-checkpoint.ipynb b/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch6-checkpoint.ipynb new file mode 100644 index 00000000..abbcf8b9 --- /dev/null +++ b/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch6-checkpoint.ipynb @@ -0,0 +1,197 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:e45efbc918d6e082147a3abf5687f38acaf875f9fd899adb5638679d888fbdcb" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 6: Vaccum Tubes" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.1 Page no.195" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from pylab import *\n", + "#Given Circuit Data\n", + "V=[0,0.5,1,1.5,2] #V, voltage\n", + "I=[0,1.6,4,6.7,9.4] #mA, current\n", + "\n", + "#Calculation\n", + "dVp=0.5 #V, change in plate voltage\n", + "dIp=2.7*10**(-3) #A, change in plate current\n", + "rp=dVp/dIp # Dynamic Plate Resistance\n", + "\n", + "#Result\n", + "print \"The Dynamic Plate Resistance is rp= \",rp,\"ohm\"\n", + "\n", + "#plot\n", + "\n", + "a=plot(V,I)\n", + "xlabel(\"V\") \n", + "ylabel(\"I (mA)\") \n", + "\n", + "show(a)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Dynamic Plate Resistance is rp= 185.185185185 ohm\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEKCAYAAAAfGVI8AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAGqNJREFUeJzt3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16SJN1zzz0aMWKEli5dqiuvvFJNmjRRZmamU+W6XjCv54IFC/TC\nCy8oLi5O8fHxmjdvnsNVu1N6erpWrVqlr7/+Wu3atdPUqVNVWVkpieMyFHW9nhyX9fPBBx9o7ty5\n6tatm5L/l8T1l7/8RXv27JEU2jHqszhdDwAxzbGlIQCAO9AIACDG0QgAIMbRCAAgxtEIgDr8/Oc/\n13vvvXfSz5599lmNHz/eoYqA8KIRAHVIT08/7ZLG+fPna9SoUQ5VBIQXl48Cddi/f7+SkpK0d+9e\nxcXFqaioSAMHDtTnn3/udGlAWDARAHVo2bKlrr76ai1dulSSNG/ePP3mN79xuCogfGgEQBBqLg/N\nnz9f6enpDlcEhA9LQ0AQysvL1b59e+Xk5Ojmm2/Wzp07nS4JCBsmAiAITZs21aBBgzR69GhOEiPq\n0AiAIKWnp2v79u0sCyHqsDQEADGOiQAAYhyNAABiHI0AAGIcjQAAYhyNAABiHI0AAGLc/wNshpbl\nb3wzYgAAAABJRU5ErkJggg==\n" + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.2 Page no.202" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from math import *\n", + "from pylab import *\n", + "#Calculation\n", + "dip=(14.0-10.7)*10**(-3) #A\n", + "dvp=20 #V\n", + "rp=dvp/dip\n", + "diP=(12.4-5.3)*10**(-3) #A\n", + "dvG=1 #V\n", + "gm=diP/dvG\n", + "u=gm*rp\n", + "ut=(192-150)/1\n", + "\n", + "# Result\n", + "print \" The Plate AC Resistance is rp= \",round(rp/10**(3),2),\"kohm\"\n", + "print \" The Mutual Conductance is gm= \",gm/10**(-3),\"mS\"\n", + "print \" The Graphical Amplification Factor is u= \",round(u,2)\n", + "print \" The Theoretical Amplification Factor is ut= \",ut\n", + "\n", + "\n", + "#plot\n", + "#At Vg=0\n", + "V1=[0,50,100,150]\n", + "I1=[0,3.5,11.2,20.0]\n", + "\n", + "#at Vg=-1\n", + "V2=[60,100,150,200]\n", + "I2=[0,4,12.4,21.5]\n", + "\n", + "\n", + "#at Vg=-2\n", + "V3=[100,150,200]\n", + "I3=[0,5.4,14.1]\n", + "\n", + "#at Vg=-3\n", + "V4=[160,200,250]\n", + "I4=[0,3.4,12.4]\n", + "\n", + "#at Vg=-4\n", + "V5=[220,250,300]\n", + "I5=[0,2.5,11.3]\n", + "\n", + "figure(1)\n", + "import numpy \n", + "import pylab\n", + "fig = plt.figure()\n", + "ax = fig.add_subplot(111)\n", + "\n", + "\n", + "a1=plot(V1,I1)\n", + "a2=plot(V2,I2)\n", + "a3=plot(V3,I3)\n", + "a4=plot(V4,I3)\n", + "a5=plot(V5,I4)\n", + "xlabel(\"Vp (V)\") \n", + "ylabel(\"Ip(mA)\") \n", + "ax.annotate('vg=0', xy=(152,21),\n", + " arrowprops=dict(facecolor='black', shrink=0.5),\n", + " )\n", + "ax.annotate('vg=-1', xy=(200,21.5), \n", + " arrowprops=dict(facecolor='black', shrink=0.5),\n", + " )\n", + "ax.annotate('vg=-2', xy=(200,14.1), \n", + " arrowprops=dict(facecolor='black', shrink=0.5),\n", + " )\n", + "ax.annotate('vg=-3', xy=(250,12.4),\n", + " arrowprops=dict(facecolor='black', shrink=0.5),\n", + " )\n", + "ax.annotate('vg=-4',xy=(300,11.3), \n", + " arrowprops=dict(facecolor='black', shrink=0.5),\n", + " )\n", + "show(a1)\n", + "show(a2)\n", + "show(a3)\n", + "show(a4)\n", + "show(a5)\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Plate AC Resistance is rp= 6.06 kohm\n", + " The Mutual Conductance is gm= 7.1 mS\n", + " The Graphical Amplification Factor is u= 43.03\n", + " The Theoretical Amplification Factor is ut= 42\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAZkAAAEMCAYAAAAWDss+AAAABHNCSVQICAgIfAh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AABJRU5ErkJggg==\n" + } + ], + "prompt_number": 30 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch7-checkpoint.ipynb b/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch7-checkpoint.ipynb new file mode 100644 index 00000000..7a081d42 --- /dev/null +++ b/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch7-checkpoint.ipynb @@ -0,0 +1,610 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:a8e6eec0c3406a8b34f53cdcd04f5f3e158306e880eeefff72f3f3980fec597f" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 7 :Transistor Biasing And Stabilization of Operation Point" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.1 Page No.230" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Vcc=9.0 #V, collector bias junction voltage\n", + "Rb=300*10**3 #Ohms, , base resistance\n", + "Rc=2*10**3 #Ohms, collector resistance\n", + "Beeta=50.0 #current gain factor\n", + "\n", + "#Calculation\n", + "Ib=(Vcc)/Rb\n", + "Ic=Beeta*Ib\n", + "Icsat=Vcc/Rc\n", + "Vce=Vcc-Ic*Rc\n", + "\n", + "#Result\n", + "print \"a) Base current is \",Ib,\"A\"\n", + "print \"b) collector current is = \",Ic/10**(-3),\"mA\"\n", + "print \"collector saturation current is = \",Icsat/10**(-3),\"mA\"\n", + "if Ic < Icsat:\n", + " \n", + " print\"Since Ic < Icsat \\nSo Transistor is not in saturation\" \n", + "else:\n", + " print \"Transistor is in saturation\"\n", + "\n", + "print \"c) The collector to emitter voltage is = \",Vce,\"V\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a) Base current is 3e-05 A\n", + "b) collector current is = 1.5 mA\n", + "collector saturation current is = 4.5 mA\n", + "Since Ic < Icsat \n", + "So Transistor is not in saturation\n", + "c) The collector to emitter voltage is = 6.0 V\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.2 Page No.230" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Vcc=10.0 #V, collector bias junction voltage\n", + "Rb=100*10**3 #Ohms, base resistance\n", + "Rc=1*10**3 #Ohms, collector resistance\n", + "Beeta=60 #current gain\n", + " \n", + "#Calculation\n", + "Ib=(Vcc)/Rb #A, base current\n", + "Ic=Beeta*Ib #A, collector current\n", + "Icsat=Vcc/Rc #A, collector saturated current\n", + "Vce=Vcc-Ic*Rc #V, collector emitter voltage\n", + "\n", + "#Result\n", + "print \"a) Base current is \",Ib*10**6,\"microA\"\n", + "print \"b) collector current is \",Ic*10**3,\"mA\"\n", + "print \"collector saturation current is \",Icsat*10**3,\"mA\"\n", + "if Ic < Icsat:\n", + " \n", + " print\"Since Ic < Icsat \\nSo Transistor is not in saturation\" \n", + "else:\n", + " print \"Transistor is in saturation\"\n", + "print \"c) The collector emitter voltage is \",Vce,\"V\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a) Base current is 100.0 microA\n", + "b) collector current is 6.0 mA\n", + "collector saturation current is 10.0 mA\n", + "Since Ic < Icsat \n", + "So Transistor is not in saturation\n", + "c) The collector emitter voltage is 4.0 V\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.3 Page No.231" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Vcc=10.0 #V, collector bias junction voltage\n", + "Rb=100*10**3 #Ohms, Base resistance\n", + "Rc=1*10**3 #Ohms, collector resistance\n", + "Beeta=150 #current gain\n", + "\n", + "#Calculation\n", + "Ib=(Vcc)/Rb #Base current\n", + "Ic=Beeta*Ib #collector resistance\n", + "Icsat=Vcc/Rc #A, collector saturation current\n", + "Vce=0 #V, collector emitter voltage\n", + "\n", + "#Result\n", + "print \"collector current is Ic = \",Ic/10**(-3),\"mA\"\n", + "print \"collector saturated current is \",Icsat*10**3,\"mA\" \n", + "if Ic < Icsat:\n", + " \n", + " print\" Transistor is not in saturation.\" \n", + "else:\n", + " print \"Since Ic > Icsat \\n So Transistor is in saturation\"\n", + "print \"collector emitter voltage is \",Vce,\"V\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "collector current is Ic = 15.0 mA\n", + "collector saturated current is 10.0 mA\n", + "Since Ic > Icsat \n", + " So Transistor is in saturation\n", + "collector emitter voltage is 0 V\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.4 Page No.231" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Vcc=6 #V,collector base junction voltage\n", + "Vbe=0.3 #V,base emittor voltage\n", + "Icbo=.000002 #A,colector leakage current\n", + "Ic=.001 #A,collector current\n", + "Beeta=20.0\n", + "\n", + "#Calculation\n", + "#Case 1: Considering Icbo and Vbe in the calculations\n", + "Ib=(Ic-(Beeta+1)*Icbo)/Beeta\n", + "print Ib\n", + "Rb1=(Vcc-Vbe)/Ib\n", + "print \"value of base resistance is =\",round(Rb1/1000,3),\"K ohm\"\n", + "\n", + "#Case 2: Neglecting Icbo and Vbe in the calculations\n", + "Ib2=Ic/Beeta\n", + "Rb2=Vcc/Ib2\n", + "#Percentage Error\n", + "E=(Rb2-Rb1)/Rb1*100\n", + "#Displaying The Results in Command Window\n", + "print\"The Base Resistance (Neglecting Icbo and Vbe) is \",Rb2/1000,\"k ohm\"\n", + "print\" Percentage Error is = \",round(E,3)\n", + "\n", + "#b Due to rise in temprature\n", + "beeta1=25.0\n", + "Icbo1=10.0\n", + "Ic1=beeta1*Ib+(beeta1+1)*Icbo1*10**-6\n", + "print \"Now collector current is \",round(Ic1*10**3,2),\"mA\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "4.79e-05\n", + "value of base resistance is = 118.998 K ohm\n", + "The Base Resistance (Neglecting Icbo and Vbe) is 120.0 k ohm\n", + " Percentage Error is = 0.842\n", + "Now collector current is 1.46 mA\n" + ] + } + ], + "prompt_number": 40 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.5 Page No.235" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Vcc=10.0 #V,collectoe base junction voltage\n", + "Rc=500.0 #Ohms,colector resistance\n", + "Rb=500000 #Ohms,base resistance\n", + "Beeta=100.0 #current gain\n", + "#Calculation\n", + "Ib=Vcc/(Rb+Beeta*Rc) #emittor currenr\n", + "Ic=Beeta*Ib\n", + "Ie=Ic\n", + "Vce=Vcc-Ic*Rc\n", + "Vc=Vce\n", + "\n", + "# Results \n", + "print \"emittor current is \",round(Ie*1000,1),\"mA\"\n", + "print\"The collector voltage is \",round(Vc,1),\"V\"" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.6 Page No.235" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Given Circuit Data\n", + "Vcc=20.0 #V,collector base voltage\n", + "Rc=2000.0 #Ohms.collector resistance\n", + "Rb=200000.0 #Ohms,base resistance\n", + "Beeta1=50.0 #current gain factor\n", + "Beeta2=200.0\n", + "\n", + "#Calculation CASE-1: Minimum Collector Current\n", + "#from fig 7.14\n", + "Ibmin=Vcc/(Rb+Beeta1*Rc)\n", + "Icmin=Beeta1*Ibmin\n", + "#result\n", + "print \"minimum base curent is \",round(Ibmin,6),\"A\"\n", + "print \"minimum collector current is \",round(Icmin*1000,3),\"mA\"\n", + "#Calculation CASE-2: Maximum Collector Current\n", + "Ibmax=Vcc/(Rb+Beeta2*Rc)\n", + "Icmax=Beeta2*Ibmax\n", + "\n", + "#Results \n", + "print\"The maximum base current = \",round(Ibmax/10**(-3),6),\"A\"\n", + "print\"The Maximum Collector Current = \",round(Icmax/10**(-3),2),\"mA\"" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.7 Page No.238" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Vcc=10.0 #V collector junction voltage\n", + "Rc=2000.0 #Ohms collector resistane\n", + "Rb=1000000.0 #Ohms,base resistance\n", + "Re=1000.0 #Ohms emittor resstance\n", + "Beeta=100.0 #current gain\n", + "\n", + "#Calculation\n", + "Ib=Vcc/(Rb+(Beeta+1)*Re)\n", + "Ic=Beeta*Ib\n", + "Ie=Ic+Ib\n", + "#Results \n", + "print \" The Collector Current Ic = \",round(Ic*1000,3),\"mA\"\n", + "print \" The Base Current Ib .\",round(Ib*1000000,2),\"microA\"\n", + "print \" The Emitter Current Ie = \",round(Ie*1000,3),\"mA\"" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.8 Page No.239" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Vcc=6 #V,collector bias junction volage\n", + "Vbe=0.3 #V base emittor voltage\n", + "Rc=50 #Ohms collector resistance\n", + "Rb=10*10**3 #Ohms base resistance\n", + "Re=100 #Ohms emittor resistance\n", + "Beeta1=50 # gain factor\n", + "Beeta2=200\n", + "\n", + "#Calculation CASE-1: Minimum Emitter Current & corresponding Vce\n", + "Iemin=(Vcc-Vbe)*(Beeta1+1)/(Rb+(Beeta1+1)*Re)\n", + "Vcemin=Vcc-(Rc+Re)*Iemin\n", + "#Calculatioen CASE-2: Maximum Emitter Current & corresponding Vce\n", + "Iemax=(Vcc-Vbe)*(Beeta2+1)/(Rb+(Beeta2+1)*Re)\n", + "Vcemax=Vcc-(Rc+Re)*Iemax\n", + "\n", + "#Results \n", + "print\"The Minimum Emitter Current Ie(min) is\",round(Iemin*1000,2),\"mA\"\n", + "print \"The Corresponding Vce = V .\",round(Vcemin,1),\"v\"\n", + "print \"The Maximum Emitter Current Ie(max) = .\",round(Iemax*1000,1),\"mA\"\n", + "print \"The Corresponding Vce = V .\",round(Vcemax,1),\"v\"" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.9 Page No. 240" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Vcc=6.0 #V, collector bias junction voltage\n", + "Vbe=0.3 #V, base emitter voltage\n", + "Rc=1*10**3 #Ohms, collector resistance\n", + "Rb=10*10**3 #Ohms, base resistance\n", + "Re=100.0 #Ohms, emitter resistance\n", + "Beeta1=50 #current gain factor\n", + "Beeta2=200\n", + "Ie1=19.25*10**(-3) #A,for beeta=50, from example 7.8 \n", + "Ie2=38.2*10**(-3) #A,for beeta=200, from example 7.8\n", + "\n", + "#Calculation (i)\n", + "\n", + "Ie1=19.25*10**(-3) #A,for beeta=50, from example 7.8 \n", + "Vce=Vcc-(Rc+Re)*Ie1 #V, collector emitter voltage\n", + "Icsat1=Vcc/(Rc+Re) #collector saturated current\n", + "Vcesat1=0\n", + "print \"The collector voltage is Vcc \",Vcc,\"V\"\n", + "print \"The collector emitter voltage is Vce\",Vce,\"V\"\n", + "print \"Because Collector voltage is greater than collector emitter voltage so Transistor is in saturation \"\n", + "print \"collector saturated current is \",round(Icsat1*10**3,2),\"mA\"\n", + "print \"collector emitter satirated voltage is\",Vcesat1,\"V\"\n", + "\n", + "# ii\n", + "Icsat2=Icsat1\n", + "Vcesat2=Vcesat1\n", + "print \"(ii) collector saturated current is \",round(Icsat2*10**3,3),\"mA\"\n", + "print \"collector emitter satirated voltage is\",Vcesat2,\"V\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The collector voltage is Vcc 6.0 V\n", + "The collector emitter voltage is Vce -15.175 V\n", + "Because Collector voltage is greater than collector emitter voltage so Transistor is in saturation \n", + "collector saturated current is 5.45 mA\n", + "collector emitter satirated voltage is 0 V\n", + "(ii) collector saturated current is 5.455 mA\n", + "collector emitter satirated voltage is 0 V\n" + ] + } + ], + "prompt_number": 48 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.10 Page No.240" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Vcc=9 #V,collector bias junction voltge\n", + "Vce=3 #V,collector emittor voltage\n", + "Re=500 #Ohms,emittor resistance\n", + "Ic=8*10**(-3) #A,collector current\n", + "Beeta=80\n", + "#Calculation\n", + "Ib=Ic/Beeta\n", + "Rb=(Vcc-(Beeta+1)*Ib*Re)/Ib\n", + "#Displaying The Results in Command Window\n", + "print\"The Base Resistance is :\",round(Rb/1000,5),\"kohm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.11 Page No.242" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Vcc=12.0 #V collector bias junction voltage\n", + "Vbe=0.3 #V base emitter junction voltage\n", + "R1=40000.0 #Ohms resistance\n", + "R2=5000.0 #Ohms resistance\n", + "Re=1000.0 #Ohms emitter reistance\n", + "Rc=5000.0 #Ohms collector resistance\n", + "Beeta=60\n", + "\n", + "#Calculation\n", + "Vb=(R2/(R1+R2))*Vcc\n", + "Ve=Vb-Vbe\n", + "Ie=Ve/Re\n", + "Ic=Ie\n", + "Vc=Vcc-Ic*Rc\n", + "Vce=Vc-Ve\n", + "# Results \n", + "print\" V2= Vb \",round(Vb,1),\"v\"\n", + "print\" Ve = \",round(Ve,1),\"v\"\n", + "print\" Ie = \",round(Ie/10**(-3),1),\"mA\"\n", + "print\" Ic = \",round(Ic/10**(-3),1),\"mA\"\n", + "print\" Vc = \",round(Vc,0),\"v\"\n", + "print\" Vce = \",round(Vce,0),\"v\"" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.12 Page No.243" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Vcc=15.0 #V collector bias junction voltage\n", + "R1=200.0 #Ohms resistor 1\n", + "R2=100.0 #Ohms resistor 2\n", + "Rc=20.0 #Ohms collector resistace\n", + "Ic=.1 #A collector current\n", + "\n", + "#Calculation\n", + "Ie=Ic\n", + "Vb=(R2/(R1+R2))*Vcc\n", + "Ve=Vb # Neglecting Vbe\n", + "Re=Ve/Ie\n", + "Vce=Vcc-(Rc+Re)*Ic\n", + "# Results\n", + "print\" The Emitter Resistance is Re = .\",Re,\"ohm\"\n", + "print\" The Collector to Emitter Voltage is Vce = \",Vce,\"v\"" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.13 Page No.246" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Vcc=12.0 #V collector bias junction voltage\n", + "Vbe=0.3 #V base emitter voltage\n", + "R1=40000.0 #Ohms given resistance\n", + "R2=5000.0 #Ohms\n", + "Re=1000.9 #Ohms emitter resistance\n", + "Rc=5000.0 #Ohms collector resistance\n", + "Beeta=60\n", + "#Calculation\n", + "Vth=(R2/(R1+R2))*Vcc\n", + "Rth=R1*R2/(R1+R2)\n", + "Ib=(Vth-Vbe)/(Rth+Beeta*Re)\n", + "Ic=Beeta*Ib\n", + "Vce=Vcc-Ic*(Rc+Re)\n", + "\n", + "# Results \n", + "print \"collector current is \",round(Ic*1000,2),\"mA\"\n", + "print \"collector to emitter voltage = \",round(Vce,2),\"v\"" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.14 Page No.248" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Vcc=12 #V collector bias junction voltage\n", + "Vee=15.0 #V emittor bias junction voltage\n", + "Rc=5000.0 #Ohms collector resistance\n", + "Re=10000.0 #Ohms emitter resistance\n", + "Rb=10000.0 #Ohms base resistance\n", + "Beeta=100\n", + "\n", + "#Calculation\n", + "Ie=Vee/Re\n", + "Ic=Ie\n", + "Vce=Vcc-Ic*Rc\n", + "#Displaying The Results in Command Window\n", + "print\" Ic = \",Ic/10**(-3),\"mA\"\n", + "print\" Vce = \",Vce,\"v\"" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch8-checkpoint.ipynb b/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch8-checkpoint.ipynb new file mode 100644 index 00000000..0309b1db --- /dev/null +++ b/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch8-checkpoint.ipynb @@ -0,0 +1,561 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:49ff0cb528d7e276dc193290984b83a2a7d93cab62d6ab90be1af99e7320d3ef" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 8:Small Signal Amplifiers" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.1 Page no.271" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Ic=2*10**(-3) #A, collector current\n", + "Vce=8.5 #V, collectoe emitter voltage\n", + "\n", + "#Calculation\n", + "#hfe=delta(ic)/delta(ib), #forward current ratio in CE mode\n", + "#Vce=constant #collector emitter voltage\n", + "hfe=(2.7-1.7)*10**(-3)/((20-10)*10**(-6))\n", + "#hoe=delta(ic)/delta(Vce), #output admittance in CE mode\n", + "#ib=constant\n", + "hoe=(2.2-2.1)*10**(-3)/(10-7)\n", + "#hie=delta(Vbe)/delta(ib), #dynamic input resistance\n", + "#Vce=constant\n", + "hie=(0.73-0.715)/((20-10)*10**(-6))\n", + "#hre=delta(Vbe)/delta(Vce),ib=constant #reverse voltage ratio in CE mode\n", + "hre=(0.73-0.72)/(20-0)\n", + "\n", + "#Result\n", + "print \"hfe = \",hfe\n", + "print \"hoe = \",round(hoe/10**(-6),2),\"microS\"\n", + "print \"hie = \",hie/10**3,\"kohm\"\n", + "print \"hre = \",hre\n", + "\n", + "#a) Plot\n", + "#Load Line \n", + "Vce0=[0,15]\n", + "Ic0=[5,0]\n", + "a0=plot(Vce0,Ic0)\n", + "q1=plot(8.5,2.1,label='Q point',marker='o')\n", + "legend()\n", + "# AT Ib=0 microA\n", + "Vce1=[0,1,15]\n", + "Ic1=[0,0.2,0.7]\n", + "a1=plot(Vce1,Ic1)\n", + "# AT Ib=10 microA\n", + "Vce2=[0,1,15]\n", + "Ic2=[0,1.2,1.9]\n", + "a2=plot(Vce2,Ic2)\n", + "# AT Ib=20 microA\n", + "Vce3=[0,1,15]\n", + "Ic3=[0,2.2,3]\n", + "a3=plot(Vce3,Ic3)\n", + "# AT Ib=30 microA\n", + "Vce4=[0,1,15]\n", + "Ic4=[0,3.1,4.1]\n", + "a4=plot(Vce4,Ic4)\n", + "# AT Ib=40 microA\n", + "Vce5=[0,1,15]\n", + "Ic5=[0,4.1,5]\n", + "a5=plot(Vce5,Ic5)\n", + "# AT Ib=50 microA\n", + "Vce6=[0,1,15]\n", + "Ic6=[0,5.1,6.1]\n", + "a6=plot(Vce6,Ic6)\n", + "# AT Ib=60 microA\n", + "Vce7=[0,1,15]\n", + "Ic7=[0,6.1,7.2]\n", + "a7=plot(Vce7,Ic7)\n", + "#At Vce=8.5 V\n", + "Vce8=[0,15]\n", + "Ice8=[2.7,2.7]\n", + "a8=plot(Vce8,Ice8)\n", + "\n", + "Vce9=[0,15]\n", + "Ice9=[1.7,1.7]\n", + "a9=plot(Vce9,Ice9)\n", + "#at Vce=8.5\n", + "Vce10=[8.5,8.5]\n", + "Ice10=[0,3]\n", + "a10=plot(Vce10,Ice10)\n", + "xlim(0,18)\n", + "ylim(0,8)\n", + "xlabel(\"$Vce(volt)$\")\n", + "ylabel(\"$Ic(mA)$\")\n", + "show(q1)\n", + "show(a0)\n", + "show(a1)\n", + "show(a2)\n", + "show(a3)\n", + "show(a4)\n", + "show(a5)\n", + "show(a6)\n", + "show(a7)\n", + "show(a8)\n", + "show(a9)\n", + "show(a10)\n", + "\n", + "#(b) Plot\n", + "#Plot\n", + "#Load Line \n", + "Vce0=[0,15]\n", + "Ic0=[5,0]\n", + "a0=plot(Vce0,Ic0)\n", + "# AT Ib=0 microA\n", + "Vce1=[0,1,15]\n", + "Ic1=[0,0.2,0.7]\n", + "a1=plot(Vce1,Ic1)\n", + "# AT Ib=10 microA\n", + "Vce2=[0,1,15]\n", + "Ic2=[0,1.2,1.9]\n", + "a2=plot(Vce2,Ic2)\n", + "# AT Ib=20 microA\n", + "Vce3=[0,1,15]\n", + "Ic3=[0,2.2,3]\n", + "a3=plot(Vce3,Ic3)\n", + "# AT Ib=30 microA\n", + "Vce4=[0,1,15]\n", + "Ic4=[0,3.1,4.1]\n", + "a4=plot(Vce4,Ic4)\n", + "# AT Ib=40 microA\n", + "Vce5=[0,1,15]\n", + "Ic5=[0,4.1,5]\n", + "a5=plot(Vce5,Ic5)\n", + "# AT Ib=50 microA\n", + "Vce6=[0,1,15]\n", + "Ic6=[0,5.1,6.1]\n", + "a6=plot(Vce6,Ic6)\n", + "# AT Ib=60 microA\n", + "Vce7=[0,1,15]\n", + "Ic7=[0,6.1,7.2]\n", + "a7=plot(Vce7,Ic7)\n", + "\n", + "#At Vce=8.5 V\n", + "Vce8=[0,8.5,10]\n", + "Ice8=[2.2,2.2,2.15]\n", + "a8=plot(Vce8,Ice8)\n", + "# and\n", + "Vce9=[0,8.5,10]\n", + "Ice9=[2.1,2.1,2.15]\n", + "a9=plot(Vce9,Ice9)\n", + "#at Vce=8.5\n", + "Vce10=[8.5,8.5]\n", + "Ice10=[0,2.2]\n", + "a10=plot(Vce10,Ice10)\n", + "\n", + "#at Vce=7 V\n", + "Vce11=[7,7]\n", + "Ice11=[0,2.5]\n", + "a11=plot(Vce11,Ice11)\n", + "#at Vce=10 V\n", + "Vce12=[10,10]\n", + "Ice12=[0,2.2]\n", + "a12=plot(Vce12,Ice12)\n", + "\n", + "q2=plot(8.5,2.15,marker='o',label='Q point')\n", + "legend()\n", + "\n", + "xlim(0,18)\n", + "ylim(0,8)\n", + "xlabel(\"$Vce(volt)$\")\n", + "ylabel(\"$Ic(mA)$\")\n", + "show(a0)\n", + "show(q2)\n", + "show(a1)\n", + "show(a2)\n", + "show(a3)\n", + "show(a4)\n", + "show(a5)\n", + "show(a6)\n", + "show(a7)\n", + "show(a8)\n", + "show(a9)\n", + "show(a10)\n", + "show(a11)\n", + "show(a12)\n", + "\n", + "#C) plot\n", + "#at Vce=0 V\n", + "Vbe1=[0.715,0.730,0.735]\n", + "Ib1=[10,20,30]\n", + "ab1=plot(Vbe1,Ib1)\n", + "q3=plot(0.722,15,marker='o',label='Q Point')\n", + "legend()\n", + "\n", + "#at Vce=8.5 V\n", + "Vbe2=[0.710,0.715,0.730,0.735]\n", + "Ib2=[5,10,20,26]\n", + "ab2=plot(Vbe2,Ib2)\n", + "\n", + "#at Vce=20 V\n", + "Vbe3=[0.6,0.715,0.730,0.740]\n", + "Ib3=[0,10,15,22]\n", + "ab3=plot(Vbe3,Ib3)\n", + "\n", + "#at Ib=10 microA\n", + "Vbe4=[0,0.7,0.75]\n", + "Ib4=[10,10,10]\n", + "ab4=plot(Vbe4,Ib4)\n", + "\n", + "#at Ib=15 microA\n", + "Vbe5=[0,0.7,0.75]\n", + "Ib5=[15,15,15]\n", + "ab5=plot(Vbe5,Ib5)\n", + "#at Ib=20microA\n", + "Vbe6=[0,0.7,0.75]\n", + "Ib6=[20,20,20]\n", + "ab6=plot(Vbe6,Ib6)\n", + " \n", + "xlim(0,0.8)\n", + "ylim(0,35)\n", + "xlabel(\"$Vbe(volt)$\")\n", + "ylabel(\"$Ib(microA)$\")\n", + "show(ab1)\n", + "show(q3)\n", + "show(ab2)\n", + "show(ab3)\n", + "show(ab4)\n", + "show(ab5)\n", + "show(ab6)\n", + "\n", + "#d) plot\n", + "#at Vce=0 V\n", + "Vbe1=[0.6,0.7,0.72,0.73]\n", + "Ib1=[0,6,15,30]\n", + "ab_1=plot(Vbe1,Ib1)\n", + "q4=plot(0.72,15,marker='o',label='$Q Point$')\n", + "legend()\n", + "#Vce=20 V\n", + "Vbe2=[0.6,0.7,0.72,0.73,0.74]\n", + "Ib2=[0,6,10,15,28]\n", + "ab_2=plot(Vbe2,Ib2)\n", + "#At Ib=15 microA\n", + "Vbe3=[0,0.72,0.73]\n", + "Ib3=[15,15,15]\n", + "ab_3=plot(Vbe3,Ib3)\n", + "\n", + "#At Vbe=0.72\n", + "Vbe4=[0.72,0.72]\n", + "Ib4=[0,15]\n", + "ab_4=plot(Vbe4,Ib4)\n", + "#At Vbe=0.73\n", + "Vbe5=[0.73,0.73]\n", + "Ib5=[0,15]\n", + "ab_5=plot(Vbe5,Ib5)\n", + "\n", + "xlim(0,0.8)\n", + "ylim(0,35)\n", + "xlabel(\"$Vbe(volt)$\")\n", + "ylabel(\"$Ib(microA)$\")\n", + "show(ab_1)\n", + "show(q4)\n", + "show(ab_2)\n", + "show(ab_3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "hfe = 100.0\n", + "hoe = 33.33 microS\n", + "hie = 1.5 kohm\n", + "hre = 0.0005\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEU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xIkT8d5776GyslJ7OfUJEyagW7dumD9/PgICAgAAarValueASBcWBHV5N44g\nduzYgeTkZBw7dgxjxowB0DyJ7enpie3bt6Nfv37YtWsXJElC37590djYqN3GiBEjsH37dkyYMAEA\nEBYWhvT0dNx///0AgIKCAnh4eODIkSOIjY0FABQVFWmL4Yba2lpj/MhEemFBUJfn7u6OsrIyWFlZ\nwdnZGRUVFejTpw/Ky8thY2ODnj17wtHREcnJyZg0aRJGjRqF4uJiWFtbt9hOcXExvL29cfToUQwf\nPhz19fXo2bMnAGDbtm2YM2cOjh49ipiYGPz444/asjhy5Ii2GKys+CtJpsPkbjlKJIe77roLycnJ\nAIApU6Zg165dqKiowPr16wEAM2fOxDvvvANbW1tUVFRg2rRp2juy3TB69Ghs27YN7u7uiImJ0d6h\n78SJE5g2bRr69++PkJAQ/Pzzz0hLS0N+fj6ysrIQEhICJycnCCFue+tHIjnwfhBEbbRq1SqkpaV1\n2C1af/nlF5w+fRozZ87skO0RtRePZ4naaP78+fjiiy86bHs//PCD9n7BRKaABUHURu7u7hg0aBAu\nXrzY7m1lZ2dj7NixnIMgk8IhJiIi0olvV4iISCcWBBER6cSCICIinVgQRESkEwuCiIh0YkEQEZFO\nLAgiItKJBUFERDr9f+uLfdE892zcAAAAAElFTkSuQmCC\n" + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAESCAYAAADnvkIDAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlYlOXCP/DvCKi4xL6oSOooJaAwiaCFMkhIgBGmaVZE\nSb6dzvFY2Xl9tV4Lu87P8KTHVDpvVqioSYtLGhxxH465gooaahKKWywakOyy3L8/iAlkzGGYmWcG\nvp/r8hIehme+TjFf7vt+FpkQQoCIiOgu3aQOQEREpokFQUREGrEgiIhIIxYEERFpxIIgIiKNWBBE\nRKSR0QuipqYGAQEB8PX1haenJxYsWAAAiI+Ph5ubGx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KjozFp0iQ0NDTg7NmzuHLlChYvXow333wTw4cPR0VFRauF5eLi\nYjg7O6OmpgaDBg2CXC7HxYsXsXHjRsTGxiIiIgL/+te/cPv2bfXl1MPDw9G/f3/MmjULrq6uAID6\n+npJXgMiTVgQ1OU1jyC2b9+OqKgonDx5EkFBQQCaFrHt7Ozw7bffYtiwYUhNTYVMJsPQoUNRV1en\n3sfYsWPx7bffIjw8HADg5eWF5ORkPP/88wCAK1euwNbWFpmZmfD39wcAFBYWqouhWVVVlTH+yURa\nYUFQl2djY4OSkhJ069YNvXv3RllZGYYMGYLS0lJYWlrC3d0d1tbWiIqKwqRJkzBu3DgUFRXBwsKi\n1X6Kiorg4OCArKwsjBkzBrW1tXB3dwcAbN68GTExMcjKyoKfnx8OHDigLovMzEx1MXTrxh9JMh0m\nd8tRIik89thjiIqKAgBMnjwZqampKCsrw+rVqwEA06dPx4oVK2BlZYWysjJMnTpVfUe2ZuPHj8fm\nzZthY2MDPz8/9R36srOzMXXqVHh4eEAul+P7779HXFwc8vPzceLECcjlcvTq1QtCiHve+pFICrwf\nBJGOli5diri4OL3dovX06dO4cOECpk+frpf9EXUUx7NEOpo1axa++eYbve1v37596vsFE5kCFgSR\njmxsbDB8+HBcvXq1w/vKyclBSEgI1yDIpHCKiYiINOKvK0REpBELgoiINGJBEBGRRiwIIiLSiAVB\nREQasSCIiEgjFgQREWnEgiAiIo3+P8ixPOMqV0GTAAAAAElFTkSuQmCC\n" + } + ], + "prompt_number": 50 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.2 Page no.276" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "ri=2000.0 #Ohms, input resistance\n", + "Rb=150000.0 #Ohms, base resistance\n", + "\n", + "#Calculation\n", + "Zin=Rb*ri/(Rb+ri)\n", + "\n", + "#result\n", + "print \" The Input Impedance of the Amplifier is Zin = \",round(Zin/10**3,3),\"kohm\"\n", + "\n", + "#(b)find the voltage gain (Av)\n", + "Beeta=100\n", + "ri=2000.0 #Ohms\n", + "Rac=5000.0 #Ohms Resistance on outputside\n", + "\n", + "#Calculation\n", + "\n", + "Av=Beeta*Rac/ri\n", + "#result\n", + "\n", + "print \" The Voltage Gain of the Amplifier with phase of pi/2 is \",Av\n", + "#(c) find the current gain (Ai)\n", + "#Let input Current ib=2A\n", + "ib=2 #A, Assumption\n", + "io=100*ib \n", + "\n", + "#Calculation\n", + "Ai=io/ib # Current Gain\n", + "#result\n", + "print \"The Current Gain of the Amplifier is Ai = \",Ai" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Input Impedance of the Amplifier is Zin = 1.974 kohm\n", + " The Voltage Gain of the Amplifier with phase of pi/2 is 250.0\n", + "The Current Gain of the Amplifier is Ai = 100\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.3 Page no.277" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Bac=150.0 #ac current gain\n", + "rin=2000.0 #Ohms, input resistance\n", + "R1=4700.00 #Ohms, resistance\n", + "R2=12000.0 #Ohms resistance\n", + "\n", + "#Calculation\n", + "Rac=R1*R2/(R1+R2) # ohm , resistance\n", + "Av=Bac*Rac/rin\n", + "#result\n", + "print \"a\"\n", + "print \"the Voltage Gain of the Amplifier with phase of pi/2 is\",round(Av,1)\n", + "\n", + "#(b)find input impedance\n", + "R3=75000.0 #Ohms\n", + "R4=7500.00 #Ohms\n", + "\n", + "#Calculation\n", + "Zin=R3*R4*rin/(R3*R4+R4*rin+rin*R3)\n", + "\n", + "#result\n", + "print \"b\"\n", + "print \"The Input Impedance of the Amplifier is Zin = \",round(Zin/10**3,1),\"kohm\"\n", + "\n", + "#(c)Q point\n", + "\n", + "Vcc=15 #V\n", + "R1=75000.0 #Ohms\n", + "R2=7500.00 #Ohms\n", + "Rc=4700.0 #Ohms\n", + "Re=1200.0 #Ohms\n", + "\n", + "#Calculation\n", + "Vb=Vcc*R2/(R1+R2) #V, base voltage\n", + "Ve=Vb\n", + "Ie=Ve/Re #A, emitter current\n", + "Vce=Vcc-(Rc+Re)*Ie #V, collector emitter voltage\n", + "#result\n", + "print \"c\"\n", + "print \"voltage at the base is \",round(Vb,2),\"V\"\n", + "print \"Emitter current is \",round(Ie/10**(-3),2),\"mA\"\n", + "print \"The collector to emitter voltage is\",round(Vce,2),\"v\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a\n", + "the Voltage Gain of the Amplifier with phase of pi/2 is 253.3\n", + "b\n", + "The Input Impedance of the Amplifier is Zin = 1.5 kohm\n", + "c\n", + "voltage at the base is 1.36 V\n", + "Emitter current is 1.14 mA\n", + "The collector to emitter voltage is 8.3 v\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.4 Page no.283" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "u=20 #amplification factor\n", + "Rl=10*10**3 #Ohms, load resistance\n", + "rp=10*10**3 #Ohms, resistance\n", + "#Calculation\n", + "A=u*Rl/(rp+Rl) #V, voltage gain\n", + "#result\n", + "print \" The Voltage Gain of the Amplifier with phase of pi/2 is\",A" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.5 Page no.286" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "gm=3000*10**(-6) #S, transconductance\n", + "Rl=22*10**3 #Ohms, resistance\n", + "rp=300*10**3 #Ohms, resistance \n", + "\n", + "#Calculation\n", + "#A=-(gm*Rl/(1+(Rl/rp))), For rp>>Rl we get\n", + "A=gm*Rl #with Phase of 180 degrees\n", + "# Results \n", + "print \"The Gain of the Amplifier with phase of pi/2 is\",A" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Gain of the Amplifier with phase of pi/2 is 66.0\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.6 Page no.286" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Rl=12000.0 #Ohms, load resistance\n", + "Rg=1000000.0 #Ohms, given resistance\n", + "Rs=1*10**3 #Ohms, given resistance\n", + "Cs=25*10**(-6) #F. capacitance\n", + "u=20 #amplification factor\n", + "rd=10**5 #Ohms, dynamic drain resistance\n", + "vi=0.1 #V, input voltage\n", + "f=1*10**3 #Hz, frequency\n", + "\n", + "#Calculation\n", + "import math\n", + "Xcs=1/(2*math.pi*f*Cs)\n", + "#As Xcs comes out to be much smaller than Rs, Rs is completely bypassed\n", + "A=u*Rl/(Rl+rd)\n", + "vo=A*vi\n", + "# Result\n", + "print \" The Output Signal Voltage of the Amplifier is vo = \",round(vo,3),\"v\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Output Signal Voltage of the Amplifier is vo = 0.214 v\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch9-checkpoint.ipynb b/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch9-checkpoint.ipynb new file mode 100644 index 00000000..3b1261da --- /dev/null +++ b/Basic_Electronics_and_Linear_Circuits/.ipynb_checkpoints/ch9-checkpoint.ipynb @@ -0,0 +1,254 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:83bf55a24e2aa90db4083899e2e7c0a6deddf51b02a3e4634d291129436942ec" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 9:Multi stage Amplifiers" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.1 Page no.305" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "A1=30 #voltage gain 1\n", + "A2=50 #voltage gain 2\n", + "A3=80 #voltage gain 3\n", + "\n", + "#Calculation\n", + "import math\n", + "A=A1*A2*A3 #overall Voltage Gain\n", + "Adb=20*math.log10(A) #Voltage Gain in dB\n", + "# Result\n", + "print \" The overall Voltage Gain of the Multistage Amplifier Adb = \",round(Adb,2),\"dB\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The overall Voltage Gain of the Multistage Amplifier Adb = 101.58 dB\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.2 Page no.312" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Vcc=30.0 #V, collector bias junction voltage\n", + "Vi=1.4 #V, input voltage\n", + "Vbe=0.7 #V. base emitter voltage \n", + "B=300 #Beeta, gain factor\n", + "R1=27000.0 #Ohms, given resistance\n", + "R2=680.0 #Ohms given resistance\n", + "R3=24000.0 #Ohms\n", + "R4=2400.0 #Ohms\n", + "\n", + "#Calculation\n", + "Ve=Vi-Vbe #V, voltage at emitter terminal\n", + "Ie1=Vbe/R2 #A, emitter current at 1st stage\n", + "Ic1=Ie1 #A, collector current\n", + "Vc1=Vcc-round(Ie1,3)*R1 #collector voltage at 1st stage\n", + "Vb2=Vc1 #V, base voltage at 2nd stage\n", + "\n", + "Ve2=Vb2-Vbe #V emitter voltage at 2nd stage\n", + "Ie2=Ve2/R4 #A, emitter current at 2nd stage\n", + "Ic2=round(Ie2,3) #A collector current at 2nd stage\n", + "Vc2=Vcc-Ic2*R3\n", + "Vo=Vc2\n", + "#Displaying The Results in Command Window\n", + "print \" The Voltage at the Output Terminal of Two Stage Direct Coupled Amplifier, Vo = \",Vo,\"V\"" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.3 Page no.319" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "A=100 #voltage gain\n", + "f1=400 #Hz, frequency 1\n", + "f2=25*10**3 #Hz, frequency 2\n", + "f3=80 #Hz, frequency 3 \n", + "f4=40*10**3 # Hz, frequency 4 \n", + "\n", + "#Calculation\n", + "import math\n", + "Adb=20*math.log10(A)\n", + "Adbc=Adb-3 #Lower by 3dB\n", + "# Result\n", + "print \" The Gain at Cutoff Frequencies is, Adb (at Cutoff Frequencies) = \",Adbc,\"dB\"\n", + "\n", + "#plot\n", + "from pylab import *\n", + "f1=[80,400,25000,40000]\n", + "Adb1=[37,40,40,37]\n", + "a=plot(f1,Adb1)\n", + "xlim(0,40000)\n", + "xlabel(\"$f(Hz)$\")\n", + "ylabel(\"$AdB$\")\n", + "ylim(0,50)\n", + "show(a1)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The Gain at Cutoff Frequencies is, Adb (at Cutoff Frequencies) = 37.0 dB\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAY0AAAESCAYAAAABl4lHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAGTNJREFUeJzt3X9M1Pfhx/HXWe2qs/5A5KDQDisg/kBgRWnWZcNaNLaK\nGldtZymtdmlM11mzatcs34x1qeKKW9S6bGvtwnTxx7oNf0StdvbU1gq11Vl1VpuhAsI5BLSgiMr7\n+4fjKiLyBu8X+HwkxLvP3XEv3vHulff78/ncOYwxRgAAWOgS6AAAgI6D0gAAWKM0AADWKA0AgDVK\nAwBgjdIAAFjr6q8nio6OVq9evXTHHXeoW7duKiwsVGVlpaZNm6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z+iAT1EawA0sXbpU06dPV3h4uM6dO6fQ\n0FDPbSkpKZowYYIyMzP1jW98Q4MHD9a0adNu+PEwMTExOnz4sC5cuODP+IDPUBrADdTV1SklJUXb\nt2/X5MmTm9xWUFCghx56yHN9586dnm92vJHHHntMq1at8llWwJ8C+h3hQDBatGiRLly4oHXr1un0\n6dPq3r17k9s/+eQTpaamej7o7b333lNubq7n9mXLlmnDhg1KTExUbGysnnvuOb355pt+/RsAX6E0\ngOukpKTIGKOJEyc2+Y7oRl9++aXeffddSVJVVZV++ctfNlm+euGFFzRhwgT95Cc/0euvvy7p6sdO\nA50BpQFc59ChQ56PxL506VKT28rLy9W/f3/P9X379jVbmqqsrNSsWbP0zjvvqGvXqy+x8+fP+zg1\n4B/s0wCuc/DgQQ0bNkySdMcddzS5raCgQMnJyZ7rn332mUaMGOG5bozRCy+8oKVLl6p79+46evSo\nJDX5uk6gI2OmAVzn1KlTnm9X7NGjh2f77t279bvf/U4hISEqLS3VgQMHtGrVKqWmpurs2bPq3bu3\nNm3apNdee02LFi1SbW2t3n77bRljmn2FLNBR8X0awP/8/e9/V319vT788EPPjuvc3FzNnDlTffv2\nbffv/de//qUjR45o2rRp3ooKBAxzZuB/unXrpuLiYr344ouebT/60Y/017/+9ZZ+7z//+U89/vjj\ntxoPCArMNIBW7Nq1S9/61rd03333tfmxhw4d0uXLl5WYmOiDZID/URoAAGssTwEArFEaAABrlAYA\nwBqlAQCwRmkAAKxRGgAAa5QGAMAapQEAsPb/7+aB+FqyhEoAAAAASUVORK5CYII=\n" + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.4 Page no 325." + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " #all the quantities of R are resistances\n", + "R1=5600.0 #Ohms\n", + "R2=56000.0 #Ohms\n", + "R3=1100.0 #Ohms\n", + "\n", + "#Calculation\n", + "Zi=R1*R2*R3/(R1*R2+R2*R3+R3*R1)\n", + "#Result\n", + "print \" The Input Impedance, Zi = \",round(Zi/10**3,3),\"kohm\"\n", + "\n", + "#(b) Calculate output Impedance \n", + "Ro1=3300.0 #Ohms\n", + "Ro2=2200 #Ohms\n", + "\n", + "#Calculation\n", + "Zo=Ro1*Ro2/(Ro1+Ro2)\n", + "\n", + "#Result\n", + "print \" The Output Impedance, Zo = \",Zo/10**3,\"kohm\"\n", + "#(c) voltage gain\n", + "hfe=120 #current amplification factor\n", + "hie=1100.0 #Ohms, dynamic input resistance\n", + "R1=6800.0 #Ohms\n", + "R2=56000.0 #Ohms\n", + "R3=5600.0 #Ohms\n", + "R4=1100.0 #Ohms\n", + "\n", + "#Calculation\n", + "Rac2=Ro1*Ro2/(Ro1+Ro2)\n", + "A2=-hfe*Rac2/hie\n", + "Rac1=R1*R2*R3*R4/(R1*R2*R3+R2*R3*R4+R1*R3*R4+R1*R2*R4)\n", + "Rac1=round(Rac1,0)\n", + "A1=-hfe*Rac1/hie\n", + "\n", + "A1=round(A1,2)\n", + "A=A1*A2 #Overall Gain\n", + "\n", + "#Result\n", + "print \" The Overall Gain, A = \",round(A,0)" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.5 Page no. 326" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Rl=10000.0 #Ohms, resistance\n", + "Rg=470000.0 #Ohms dynamic input resistance\n", + "Cs=100*10**(-12) #F Capacitance\n", + "u=25 #amplification factor\n", + "rp=8000.0 #Ohms\n", + "Cc=0.01*10**(-6) #F, capacitance\n", + "\n", + "#Calculation\n", + "import math\n", + "gm=u/rp #transconductance\n", + "Req=rp*Rl*Rg/(rp*Rl+Rl*Rg+Rg*rp) #equivalent resistance\n", + "Avm=(u/rp)*Req #voltage gain\n", + "Avmd=Avm**2 # Voltage Gain of Two Stages\n", + "Rd=(rp*Rl/(rp+Rl))+Rg\n", + "f1=1/(2*math.pi*Cc*Rd) #Lower Cutoff Frequency\n", + "f1d=f1/math.sqrt(math.sqrt(2)-1) #Lower Cutoff Frequency of Two Stages\n", + "Req =(rp*Rl)/(rp+Rl) #approximately\n", + "f2=1/(2*math.pi*Cs*Req) #Upper Cutoff Frequency\n", + "f2d=f2*math.sqrt(math.sqrt(2)-1) #Upper Cutoff Frequency of Two Stages\n", + "BW=f2d-f1d \n", + "#Bandwidth\n", + "# Result\n", + "print \" The Voltage Gain of Two Stages, Avmd = \",round(Avmd,2)\n", + "print \" The Bandwidth, BW = \",round(BW/10**3,0),\"KHz\"" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Mechanical_Engineering/.ipynb_checkpoints/bme1-checkpoint.ipynb b/Basic_Mechanical_Engineering/.ipynb_checkpoints/bme1-checkpoint.ipynb new file mode 100644 index 00000000..c8832e7f --- /dev/null +++ b/Basic_Mechanical_Engineering/.ipynb_checkpoints/bme1-checkpoint.ipynb @@ -0,0 +1,1435 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:24b9eaeeeddeacc3199362b9156ae9de4a4fc79ba4c35797142cfcc4a54f627a" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 1: Fundamental Concepts and Definitions" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.1 Page No. 34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "p=700\t\t #pressure of fluid in kN/m**2\n", + "v1=0.28\t\t#Initial volume of fluid in m**3\n", + "v2=1.68\t\t#Final volume of fluid in m**3\n", + "\n", + "#Calculations\n", + "W=p*(v2-v1)\t#Work done in kJ\n", + "\n", + "#Output\n", + "print'The Work done is',round(W,1),'KJ or',round(W/1000,3),'MJ'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Work done is 980.0 KJ or 0.98 MJ\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.2 Page No.35" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "p1=138.0\t\t#Initial pressure of gas in kN/m**2\n", + "p2=690.0\t\t#Final pressure of gas in kN/m**2\n", + "v1=0.112\t\t#Initial volume in m**3\n", + "\n", + "#Calculations\n", + "P=p1/p2\t\t#Pressure ratio\n", + "v2=v1*(P**(1/1.4))\t#Final volume of gas in m**3\n", + "\n", + "#Output\n", + "print'The new volume of the gas is',round(v2,3),\"m**3\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The new volume of the gas is 0.035 m**3\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.3 Page No. 35" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "p1=2070\t\t#Initial pressure of gas in kN/m**2\n", + "p2=207\t\t#Final pressure of gas in kN/m**2\n", + "v1=0.014\t\t#Initial volume of gas in m**3\n", + "n=1.35\t\t#constant\n", + "\n", + "#Calculations\n", + "P=p1/p2\t\t#Pressure ratio\n", + "v2=v1*(P**(1/1.35))\t#Final volume of gas in m**3\n", + "W=(p1*v1-p2*v2)/(n-1)\t#Work done in kJ\n", + "\n", + "#Output\n", + "print'(a)Final volume of gas ',round(v2,3),\"m**3 \"\n", + "print'(b)Work done by the gas during the expansion is',round(W,2),\"kJ\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)Final volume of gas 0.077 m**3 \n", + "(b)Work done by the gas during the expansion is 37.22 kJ\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.4 Page No.36" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "v1=0.056\t\t#Initial volume of gas in m**3\n", + "v2=0.007\t\t#Final volume of gas in m**3\n", + "p1=100\t\t#Initial perssure compressed Isothermally in kN/m**2\n", + "\n", + "#Calculations\n", + "p2=(p1*v1)/v2\t#Final pressure in kN/m**2\n", + "W=p1*v1*(math.log(v2/v1))\t#Work done in kJ\n", + "\n", + "#Output\n", + "print'(a)Final pressure is',round(p2,0),\"kN/m**2 \"\n", + "print'(b)The work done on gas is',round(-W,2), \"kJ\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)Final pressure is 800.0 kN/m**2 \n", + "(b)The work done on gas is 11.64 kJ\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + " Example 1.5 Page No. 37" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "v1=1.0\t\t#Initial volume in m**3\n", + "v2=3.0\t\t#Final volume in m**3\n", + "\n", + "#Calculations\n", + "import math\n", + "W=10**5*(((v2**3-v1**3)/3)+8*(math.log(v2/v1)))\t#Work done in J\n", + "\n", + "#Output\n", + "print'The work done is',round(W,0),\"Nm\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The work done is 1745556.0 Nm\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.6 Page No. 38" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "v1=0.2\t#Initial volume in m**3\n", + "v2=0.5\t#Final volume in m**3\n", + "\n", + "#Calculations\n", + "W=1500*(((v2**2-v1**2)/200)+(v2-v1))/1000\t#Work done in kJ\n", + "\n", + "#Output\n", + "print'The work done by the gas is',round(W,4),\"KJ\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The work done by the gas is 0.4516 KJ\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.8 Page No. 39" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "v1=1.5\t\t#Initial volume in m**3\n", + "v2=2\t\t#Final volume in m**3\n", + "w1=2\t\t#Work receiving in Nm\n", + "p=6\t\t#constsnt pressure of gas in N/m**2\n", + "\n", + "#Calculations\n", + "w2=p*(v2-v1)\t#Work done in Nm\n", + "W=w2-w1\t\t#Net work done by the system in Nm\n", + "\n", + "#Output\n", + "print'Net work done by the system is',round(W,2),\"Nm\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Net work done by the system is 1.0 Nm\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9 Page No. 40" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "d=13596\t\t#Density of Hg in kg/m**3\n", + "g=9.806\t\t#gravity in m/sec**2\n", + "z=760.0\t\t#Barometer pressure in mm of Hg\n", + "Pv=40.0\t\t#Vaccum pressure in cm\n", + "dw=1000.0\t\t#Density of water in kg/m**3\n", + "Zw=1.5\t\t#Level of water in m\n", + "\n", + "#Calculations\n", + "p=(d*g*z)/10**6\t#Pressure in kPa\n", + "p1=(80/76.0)*p\t#Pressure in kPa\n", + "Pa=p-Pv\t\t#Absolute pressure in kPa\n", + "p2=(36/76.0)*p\t#Pressure in kPa\n", + "p3=(dw*g*Zw)/1000.0\t\t#pressure in kPa\n", + "p4=(5.2*10**5)/1000.0\t#pressure in kPa\n", + "\n", + "#Output\n", + "print'(a)Pressure of 80cm of Hg is',round(p1,2),\"kPa\" \n", + "print'(b)Pressure of 40cm of Hg vaccum is',round(p2,2), \"kPa \"\n", + "print'(c)Pressure due to 1.5m of water coloumn is',round(p3*1000,4),\"N/m**2or Pa\" \n", + "print'(d)Pressure in kPa for 5.2bar is',round(p4,2),\"kPa\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)Pressure of 80cm of Hg is 106.66 kPa\n", + "(b)Pressure of 40cm of Hg vaccum is 48.0 kPa \n", + "(c)Pressure due to 1.5m of water coloumn is 14709.0 N/m**2or Pa\n", + "(d)Pressure in kPa for 5.2bar is 520.0 kPa\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.10 Page No.41" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "z=750\t\t#Barometric pressure in mm of Hg\n", + "g=9.81\t\t#Gravity in m/sec**2\n", + "Pa=101.325\t#one atm pressure in kN/m**2\n", + "Pg=3.3\t\t#Pressure in atm\n", + "Pf=3.2\t\t#Pressure in m of water\n", + "d=13596\t\t#Density of Hg in kg/m**3\n", + "\n", + "#calculations\n", + "Pp=(d*g*z)/10**6\t\t #Pressure in kPa\n", + "p1=(d*g*0.55)/1000.0\t\t #Pressure in kPa\n", + "p2=Pp+(Pg*101.325)\t #Pressure in kPa\n", + "p3=Pp+(Pf*g*100)/1000.0\t#Pressure in kPa\n", + "p4=4.6*100\t\t #Pressure in kPa\n", + "\n", + "#Output\n", + "print'(a)Pressure of 55cm of Hg (Abs)',round(p1,1),\"KPa\"\n", + "print'(b)Pressure at 3.3 atm (Gauge)',round(p2,1),\"kPa\" \n", + "print'(c)Pressure of 3.2m of water (Gauge)',round(p3,1),\"kPa\" \n", + "print'NOTE: In the book there is mistake in calculation p3 '\n", + "print'(d)Pressure of 4.6bar (Abs)',round(p4,1),\"kPa\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)Pressure of 55cm of Hg (Abs) 73.4 KPa\n", + "(b)Pressure at 3.3 atm (Gauge) 434.4 kPa\n", + "(c)Pressure of 3.2m of water (Gauge) 103.2 kPa\n", + "NOTE: In the book there is mistake in calculation p3 \n", + "(d)Pressure of 4.6bar (Abs) 460.0 kPa\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.11 Page No. 42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Zw=50\t\t#Manometer reading of water in cm\n", + "Zo=763\t\t#Atmospheric pressure in mm of Hg\n", + "d=13.6*10**3\t#Density of Hg in kg/m**3\n", + "dw=1000\t\t#Density of water in kg/m**3\n", + "g=9.81\t\t#Gravity in m/sec**2\n", + "\n", + "#Calculations\n", + "Pa=(d*g*Zo)/10**6\t\t#Atmospheric pressure in kPa\n", + "Pg=(dw*g*Zw)/10**5\t#Gauge pressure in kPa\n", + "Pab=Pa+Pg\t\t#Absolute pressure in kPa\n", + "\n", + "#Output\n", + "print'Absolute pressure is',round(Pab,2),\"kPa\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Absolute pressure is 106.7 kPa\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.12 Page No. 42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Z=70\t\t\t#Vaccum gauge reading in cm of Hg\n", + "Pa=101.325\t\t#Atmospheric pressure in kPa\n", + "d=13.6*10**3\t\t#Density of Hg in kg/m**3\n", + "g=9.81\t\t\t#Gravity in m/sec**2\n", + "\n", + "#Calculations\n", + "Pv=(d*g*Z)/10**5\t\t#Vaccum pressure in kPa\n", + "Pab=Pa-Pv\t\t#Absolute pressure in kPa\n", + "\n", + "#Output\n", + "print'Absolute pressure is',round(Pab,2),\"kPa\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Absolute pressure is 7.93 kPa\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.13 Page No. 43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Pv=30\t\t#Vaccum pressure in kPa\n", + "Z=755\t\t#Barometer reading in mm of Hg\n", + "d=13590\t\t#Density of Hg in kg/m**3\n", + "g=9.81\t\t#Gravity in m/sec**2\n", + "\n", + "#calculations \n", + "Pa=(d*g*Z)/10**6\t#Atmospheric perssure in kPa\n", + "Pab=Pa-Pv\t#Absolute pressure in kPa\n", + "\n", + "#Output\n", + "print'Asolute pressure in the tank is',round(Pab,2),\"kPa\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Asolute pressure in the tank is 70.66 kPa\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.14 Page No. 43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "Z=0.562\t\t#Level of open limb in m\n", + "Z1=0.761\t\t#Barometer reading in m of Hg\n", + "g=9.79\t\t#Gravity in m/sec**2\n", + "d=13640\t\t#Density of Hg in kg/m**2\n", + "\n", + "#Calculations\n", + "Pa=(d*g*Z1)/1000.0\t#Atmospheric pressure in kPa\n", + "Ph=(d*g*Z)/1000.0\t#Pressure exercterd due to height in kPa\n", + "Pab=Pa+Ph\t#Absolute pressure in kPa\n", + "\n", + "#Output\n", + "print'The gas pressure is',round(Pab,3),\"kN/m**2\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The gas pressure is 176.668 kN/m**2\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.15 Page No. 44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "d=13.596*10**3\t#Density of Hg in kg/m**3\n", + "dl=800\t\t#Density of liquid in kg/m**3\n", + "Z=30\t\t#Level of the liquid in the arm in cm\n", + "Z1=0.75\t\t#Barometric pressure in m\n", + "g=9.81\t\t#Gravity in m/sec**2\n", + "\n", + "#Calculatins\n", + "Pg=(dl*g*Z)/10**7\t#Gauge pressure in bar\n", + "Pa=(d*g*Z1)/10**5\t#Atmospheric pressure in bar\n", + "Pab=Pa+Pg #Absolute pressure in bar\n", + "\n", + "#Output\n", + "print'Absolute pressure of the gas is',round(Pab,2),\"bar\"\n", + "print'NOTE:In the book there is calculation mistake in last step'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Absolute pressure of the gas is 1.02 bar\n", + "NOTE:In the book there is calculation mistake in last step\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.16 Page No. 45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Z1=0.17\t\t#Level of liquid in m\n", + "Z=0.76\t\t#Barometer readings in m\n", + "d=13596\t\t#Density of Hg in kg/m**3\n", + "g=9.806\t\t#Gravity in m/sec**2\n", + "s=0.8\t\t#Specific gravity \n", + "d1=1000\t\t#Density of water in kg/m**3\n", + "\n", + "#Calculations\n", + "dl=s*d1\t\t#Density of given liquid in kg/m**3\n", + "Pa=d*g*Z\t\t#Atmospheric pressure in N/m**2\n", + "p=dl*g*Z1\t#Pressure in N/m**2\n", + "Pab=(Pa-p)/10**5\t#Absolute pressure in bar\n", + "\n", + "#Output\n", + "print'Absolute pressure of the gas is',round(Pab),\"bar\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Absolute pressure of the gas is 1.0 bar\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.17 Page No. 46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "g=9.806\t\t#Gravity in m/sec**2\n", + "d=13596\t\t#Density of Hg in kg/m**3\n", + "Z=9.75\t\t#Level of Hg in cm\n", + "dw=1000\t\t#Density of water in kg/m**3\n", + "Zw=0.034\t\t#Coloumn of condensate in m\n", + "Zo=0.76\t\t#Atmospheric pressure in m of Hg\n", + "\n", + "#Calculations\n", + "P=dw*g*Zw\t #Pressure in N/m**2\n", + "Pa=d*g*Zo\t #Atmospheric pressure in N/m**2\n", + "Pg=(d*g*Z)/100.0\t#Gauge pressure in N/m**2\n", + "Pab=(Pa+Pg-P)/10**5\t#Absolute pressure in bar\n", + "\n", + "#Output\n", + "print'Pressure due to height is',round(P,3),'N/m**2'\n", + "print'Atmospheric Pressure is ',round(Pa,0),'N/m**2'\n", + "print'Absolute pressure of steam is',round(Pab,4),\"bar\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Pressure due to height is 333.404 N/m**2\n", + "Atmospheric Pressure is 101325.0 N/m**2\n", + "Absolute pressure of steam is 1.1399 bar\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.18 Page No. 47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "g=9.7\t\t #Gravity in m/sec**2\n", + "d=13.69*10**3\t#Density of Hg in kg/m**3\n", + "dw=1000\t\t #Density of water in kg/m**3\n", + "Pa=98\t \t#Atmospheric pressure in kPa\n", + "Z=0.6\t \t#Manometer level difference in m of Hg\n", + "Zw=0.04\t\t #Water coloumn level in m\n", + "\n", + "#Calculations \n", + "Pw=(dw*g*Zw)/1000.0\t#Pressure due to water in kPa\n", + "Pg=(d*g*Z)/1000.0\t\t#Pressure in kPa\n", + "Pab1=Pa+Pg-Pw\t\t#Absolute pressure in kPa\n", + "Pab=Pab1/100.0\t\t #Absolute pressure in bar\n", + "\n", + "#Output \n", + "print'The absolute pressure of steam is',round(Pab,2),\"bar\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The absolute pressure of steam is 1.77 bar\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.19 Page No. 48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Z=0.76\t\t#Actual height of mercury coloumn in m\n", + "g=9.806\t\t#Gravity in m/sec**2\n", + "d=13596\t\t#Density of Hg in kg/m**3\n", + "dw=1000\t\t#Density of water in kg/m**3\n", + "Zw=0.035\t\t#Height of condensate coloumn in m\n", + "Zh=0.10\t\t#Height of mercury coloumn in m\n", + "\n", + "#Calculations\n", + "Pa=d*g*Z\t\t#Atmospheric pressure in N/m**2\n", + "Pw=dw*g*Zw\t#Pressure due to water in N/m**2\n", + "Ph=d*g*Zh\t#Pressure due to Hg in N/m**2\n", + "Pab=(Pa+Ph-Pw)/10**5\t#Absolute pressure in bar\n", + "\n", + "#Output \n", + "print'Absolute pressure of steam in the pipe is',round(Pab,2),\"bar\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Absolute pressure of steam in the pipe is 1.14 bar\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.20Page No. 49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "dk=800\t\t#Density of kerosene in kg/m**3\n", + "g=9.81\t\t#gravity in m/sec**2\n", + "Zk=0.051\t\t#Kerosene vapour on Hg coloumn in m\n", + "d=13600\t\t#Density of Hg in kg/m**3\n", + "Zh=0.1\t\t#Hg level in m\n", + "Z=0.755\t\t#Atmospheric pressure in m of Hg\n", + "\n", + "#Calculations\n", + "Pk=dk*g*Zk\t\t #Pressure of kerosene in N/m**2\n", + "Pa=d*g*Z\t\t #Atmospheric pressure in N/m**2\n", + "Ph=d*g*Zh \t#Pressure due to Hg in N/m**2\n", + "Pab=(Pa+Ph-Pk)/1000.0\t#Absolute pressure in kPa\n", + "\n", + "#Output \n", + "print'Absolute pressure of vapour is ',round(Pab,2),\"kPa\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Absolute pressure of vapour is 113.67 kPa\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.21 Page No. 50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "d=13596\t\t#Density of Hg in kg/m**3\n", + "g=9.806\t\t#Gravity in m/sec**2\n", + "df=0.8*1000\t#Density of fluid in kg/m**3\n", + "Z=0.76\t\t#Atmospheric pressure in m of Hg\n", + "Zf=0.3\t\t#Height of fluid coloumn in m\n", + "\n", + "#Calculations\n", + "Pa=d*g*Z\t\t#Atmospheric perssure in N/m**2\n", + "P=df*g*Zf\t#Pressure due to fluid in N/m**2\n", + "Pab=(Pa+P)/10**5\t#Absolute pressure in bar\n", + "Zh=((Pab*10**5-Pa)/(d*g))*100\t#Difference between the height of Hg coloumn in 2 arms in m\n", + "\n", + "#Output\n", + "print'(a)The Absolute pressure of the gas in pipe line Pab',round(Pab,2),\" bar\" \n", + "print'(b)If the fluid used is Hg then the difference of height of Hg coloumn in the 2 arms is',round(Zh,2),\"cm\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " (a)The Absolute pressure of the gas in pipe line Pab 1.04 bar\n", + "(b)If the fluid used is Hg then the difference of height of Hg coloumn in the 2 arms is 1.77 cm\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.22 Page No. 51" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Pa=1\t\t#Atmospheric pressure in bar\n", + "g=9.81\t\t#Gravity in m/sec**2\n", + "do=0.8*1000\t#Density of oil in kg/m**3\n", + "Zo=0.8\t\t#Level of oil in m\n", + "dw=1000\t\t#Density of water in kg/m**3\n", + "Zw=0.65\t\t#Level of water in m\n", + "d=13.6*10**3\t#Density of Hg in kg/m**3\n", + "Z=0.45\t\t#Level of Hg in m\n", + "\n", + "#Calculations\n", + "Po=(do*g*Zo)/10**5\t#Pressure of oil in bar\n", + "Pw=(dw*g*Zw)/10**5\t#Pressure of water in bar\n", + "P=(d*g*Z)/10**5\t\t#Pressure of Hg in bar\n", + "Pab=Pa+Po+Pw+P\t\t#Pressure at the bottom of the coloumn in bar\n", + "Pow=Pa+Po\t\t#Pressure at the interface of oil and water in bar\n", + "Poh=Pa+Po+Pw\t\t#Pressure at the interface of water and Hg\n", + "\n", + "#Output\n", + "print'(a)Pressure at the bottom of the coloumn is',round(Pab,2),\"bar\" \n", + "print'(b)Pressure at the inter surface of oil and water ia',round(Pow,3),\"bar \" \n", + "print'(c)Pressure at the inter surface of water and Hg ',round(Poh,3),\"bar\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)Pressure at the bottom of the coloumn is 1.73 bar\n", + "(b)Pressure at the inter surface of oil and water ia 1.063 bar \n", + "(c)Pressure at the inter surface of water and Hg 1.127 bar\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.23 Page No. 52" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Z=0.76\t\t#Barometer reading in m\n", + "g=9.81\t\t#Gravity in m/sec**2\n", + "d=13.6*10**3\t#Density of Hg in kg/m**3\n", + "Pab=1.2*10**5\t#Absolute pressure in N/m**2\n", + "do=0.8*1000\t#Density of oil in kg/m**3\n", + "dw=1000\t\t#Density of water in kg/m**3\n", + "dh=13.6*10**3\t#Density of Hg in kg/m**3\n", + "\n", + "#calculations\n", + "Pa=dh*g*Z\t#Atmospheric pressure in N/m**2\n", + "Pg=Pab-Pa\t#Gauge pressure in N/m**2\n", + "Zo=Pg/(do*g)\t#Height of oil in manometer in m\n", + "Pw=Pab-Pa\t#Pressure exercted by water in N/m**2\n", + "Zw=Pw/(dw*g)\t#Height of water in manometer in m\n", + "P=Pab-Pa\t\t#Pressure of Hg in N/m**2\n", + "Zh=P/(d*g)\t#Height of Hg in manometer in m\n", + "\n", + "#Output\n", + "print'(a)The height of fluid for oil Manometer',round(Zo,2),\"m \"\n", + "print'(b)The height of fluid for water Manometer ia',round(Zw,2),\"m\" \n", + "print'(c)The height of fluid for Hg Manometer is',round(Zh,3),\"m\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)The height of fluid for oil Manometer 2.37 m \n", + "(b)The height of fluid for water Manometer ia 1.9 m\n", + "(c)The height of fluid for Hg Manometer is 0.139 m\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.24 Page No. 54" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Zg=0.753\t\t#Barometer reading at ground level in m\n", + "Zp=0.690\t\t#Pilots barometer reading in the plane in m\n", + "d=13600\t\t#Density of Hg in kg/m**3\n", + "g=9.81\t\t #Gravity in m/sec**2\n", + "da=1.25\t\t#Density of air in kg/m**3\n", + "\n", + "#Calculations\n", + "Pg=d*g*Zg\t#Pressure at ground level in N/m**2\n", + "Pp=d*g*Zp\t#Pressure at plane level in N/m**2\n", + "P=Pg-Pp\t\t#Change of pressure at ground level and that of plane level in N/m**2\n", + "Za=P/(da*g)\t#Altitude of plane from ground in m\n", + "\n", + "#Output \n", + "print'The altitude of the plane from ground level is',round(Za,1),\"m\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The altitude of the plane from ground level is 685.4 m\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.25 Page No. 54" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "dw=1000\t\t#Density of water in kg/m**3\n", + "dh=13590\t\t#Density of Hg in kg/m**3\n", + "Pa=400\t\t#Pressure at A in kPa\n", + "g=9.81\t\t#Gravity in N/m**2\n", + "Zw1=2.5\t\t#First level of water in m\n", + "Zw2=0.4\t\t#Second level of water in m\n", + "Zh=0.6\t\t#Level of Hg in m\n", + "\n", + "#Calculations \n", + "Pw1=dw*g*Zw1\t#First level of water pressure in N/m**2\n", + "Pw2=dw*g*Zw2\t#Second level of water pressure in n/m**2\n", + "Ph=dh*g*Zh\t#Pressure of Hg in N/m**2\n", + "Pb=((Pa*1000)+Pw1+Pw2-Ph)/1000\t#Pressure exercted at B in kPa\n", + "\n", + "#Output\n", + "print'Pressure exercted at B is',round(Pb,2),\"KPa\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Pressure exercted at B is 348.46 KPa\n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.26 Page No. 55" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "do=0.902*10**3\t#Density of oil in kg/m**3\n", + "Pg=2*10**5\t #Gauge pressure in N/m**2\n", + "g=9.81\t\t #Gravity in m/sec**2\n", + "ho=2\t\t #Level of oil in m\n", + "d=2\t\t #Diameter of cylinder in m\n", + "pi=3.141595\t#Constant value of pi\n", + "\n", + "#Calculations\n", + "A=(pi/4.0)*d**2 #Area of cylinder \n", + "Po=do*g*ho\t # Pressure due to oil in N/m**2\n", + "W=(Pg+Po)*A\t #Weight of the piston in N\n", + "\n", + "#Output\n", + "print'The total weight of piston and slab is',round(W,2),\"N\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The total weight of piston and slab is 683916.56 N\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.27 Page No. 56" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "m=21\t\t#Mass of piston in kg\n", + "P1=600\t\t#Pressure in the pipe 1 in kPa\n", + "P2=170\t\t#Pressure in the pipe 2 in kPa\n", + "d1=0.10\t\t#Diameter of the piston 1 in m\n", + "d2=0.20\t\t#Diameter of the piston 2 in m\n", + "pi=3.14155\t#Constant value of pi\n", + "\n", + "#Calculations\n", + "F=(m*9.81)/1000\t\t#Force due to mass in kN\n", + "F1=(pi/4)*d1**2*P1\t\t#Force 1 acting on 10 cm diameter piston in kN\n", + "F2=(pi/4)*(d2**2-d1**2)*P2\t#Force 2 acting on 20 cm diameter piston in kN\n", + "F3=F+F1+F2\t\t#Total downward force in kN\n", + "P3=F3/((pi/4)*d2**2)\t#Pressure 3 in the gas in kPa\n", + "\n", + "#Output\n", + "print'The pressure in the gas is ',round(P3,2),\"KPa\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The pressure in the gas is 284.06 KPa\n" + ] + } + ], + "prompt_number": 35 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.28 Page No. 57" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "P1=0.755\t\t#Barometric reading at the bottom of the building in m\n", + "P2=0.73\t\t#Barometric reading at the top of the building in m\n", + "da=1.18\t\t#Density of air in kg/m**3\n", + "g=9.81\t\t#Gravitalional constant in m/sec**2\n", + "d=13600\t\t#Density of Hg in kg/m**3\n", + "\n", + "#Calculations\n", + "h=((P1-P2)*d*g)/(da*g) #The height of the building in m\n", + "\n", + "#Output\n", + "print'The height of the building ',round(h,1),\"m\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The height of the building 288.1 m\n" + ] + } + ], + "prompt_number": 37 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.29 Page No. 58" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "PA=200\t\t#Gauge pressure reading for A in kPa\n", + "PB=120\t\t#Gauge pressure reading for B in kPa\n", + "hb=750\t\t#Barometer reading in mm of Hg\n", + "g=9.806\t\t#Gravitational constant in m/sec**2\n", + "d=13597\t\t#Density of Hg in barometer in kg/m**3\n", + "\n", + "#Calculations\n", + "Pa=d*g*hb/10**6\t#Atmospheric pressure in kPa\n", + "Pab1=PA+Pa\t#Absolute pressure in container A in kPa\n", + "Pab2=PB+Pab1\t#Absolute pressure in container B in kPa\n", + "\n", + "#Output \n", + "print'(a)The absolute pressure in the container A is',round(Pab1,1),\"kPa\" \n", + "print'(b)The absolute pressure in the container B is ',round(Pab2,2),\"kPa\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)The absolute pressure in the container A is 300.0 kPa\n", + "(b)The absolute pressure in the container B is 420.0 kPa\n" + ] + } + ], + "prompt_number": 38 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.30 Page No. 59" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "C1=40\t\t #Temperature 1 in degree centigrade\n", + "C2=-20\t\t#Temperature 2 in degree centigrade \n", + "\n", + "#calculations\n", + "F1=((C1/100.0)*180)+32\t#Temperature 1 in Fahrenheit\n", + "F2=((C2/100.0)*180)+32\t#Temperature 2 in Fahrenheit\n", + "\n", + "#Output\n", + "print'(a)Temperature after converting 40 degree C is',round(F1,2),\"F\"\n", + "print'(b)Temperature after convertibg -20 degree C is ',round(F2,2),\"F\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)Temperature after converting 40 degree C is 104.0 F\n", + "(b)Temperature after convertibg -20 degree C is -4.0 F\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.31 Page No. 59" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "C=(-32/180.0)/((1/100.0)-(1/180.0))\t#Centrigade temperature in degree C\n", + "F=C\t\t\t#Fahrenheit temperature in degree Fahrenheit\n", + "\n", + "print'The temperature which has the same value on both the centrigrade and fahrenheit scales is',C\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The temperature which has the same value on both the centrigrade and fahrenheit scales is -40.0\n" + ] + } + ], + "prompt_number": 40 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.32 Page No. 59" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "P1=1.5\t\t#Thermometric properties at ice point\n", + "P2=7.5\t\t#Thermometric properties at steam point\n", + "P3=3.5\t\t#Thermometric property\n", + "\n", + "#Calculations\n", + "import math\n", + "M = array([[math.log(P2), 1], [math.log(P1), 1]])\n", + "N=([100,0])\n", + "X=inv(M)*N #Inverse matrix\n", + "a=X[0,0]\n", + "b=X[1,0]\n", + "t=(a*math.log(P3)+b)\t#Required temperature in degree C\n", + "\n", + "#Output\n", + "print'The required temperature is ',round(t,2),\"C\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The required temperature is 52.65 C\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.33 Page No. 60" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "T1=100\n", + "T2=300 #Temperature of ice and steam point in the scale\n", + "P1=1.86\t\t #Values of thermometric properties at ice point nad steam point respectively\n", + "P2=6.8\n", + "P=2.5\t\t\t #Thermometric property\n", + "\n", + "#Calculations\n", + "import math\n", + "#aln(P2)+b=300 #Costants in the temprature scale reading, a and b\n", + "#aln(P1)+b=100\n", + "#Solving above two equations\n", + "a=(T2-T1)/(math.log(P2/P1)) \n", + "b=T2-a*math.log(P2)\n", + "t=(a*math.log(P)+b)\t#Required temperature in degree C\n", + "\n", + "#Output\n", + "print'Temperature corresponding to the thermometric property is ',round(t,1),\"C\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Temperature corresponding to the thermometric property is 145.6 C\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.34 Page No. 60" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "p1=32.0\t\t #Pressure in mm of Hg at triple point of water\n", + "p2=76.0\t\t #Pressure in mm of Hg above atmospheric pressure\n", + "p3=752.0\t\t#Barometric pressure in mm of Hg\n", + "T=273.16\t\t#Triple point of water in K\n", + "\n", + "#Calculations\n", + "P1=p3+p1\t#Total pressure in mm of Hg\n", + "P2=p2+p3\t#Total pressure in mm of Hg\n", + "T2=((T*P2)/P1)-273.16\t#Temperture in degree C\n", + "\n", + "#Output\n", + "print'Temperature is ',round(T2,2),\"C\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Temperature is 15.33 C\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.35 Page No.61" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "T1=32\t\t#Temperatures of ice point and steam point respectively\n", + "T2=212\n", + "P1=1.86\t\t #P values at ice point and steam point respectively\n", + "P2=6.81\n", + "P=2.5\t\t\t#Reading on the thermometer\n", + "\n", + "#Calculations\n", + "import math\n", + "#aln(P1)+b=32 #Costants in the given temprature scale reading, a and b\n", + "#aln(P2)+b=212\n", + "#Solving above two equations\n", + "a=(T2-T1)/(math.log(P2/P1)) \n", + "b=T2-a*math.log(P2)\n", + "t=(a*math.log(P)+b)\t#Required temperature in degree C\n", + "\n", + "#Output\n", + "print'Temperature corresponding to the thermometric property is ',round(t,0),\"C\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Temperature corresponding to the thermometric property is 73.0 C\n" + ] + } + ], + "prompt_number": 39 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Mechanical_Engineering/.ipynb_checkpoints/bme2-checkpoint.ipynb b/Basic_Mechanical_Engineering/.ipynb_checkpoints/bme2-checkpoint.ipynb new file mode 100644 index 00000000..07d17afc --- /dev/null +++ b/Basic_Mechanical_Engineering/.ipynb_checkpoints/bme2-checkpoint.ipynb @@ -0,0 +1,1396 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:be9b81ec82ea0e8e81e59b4d7c97d91bf099bd45d69eea5f3a2ed8e0bbebe433" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 2:First Law of Thermodynamics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.1 Page No.90" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "h1=60\t\t#The heat transfer in the process in kJ\n", + "h2=-8\t\t#The heat transfer in the process in kJ\n", + "h3=-34\t\t#The heat transfer in the process in kJ\n", + "h4=6\t\t#The heat transfer in the process in kJ\n", + "\n", + "#Calculations\n", + "Q=h1+h2+h3+h4\t\t#Net work transfer in a cycle in kJ\n", + "\n", + "#Output\n", + "print'Net work transfer in a cycle is',round(Q,2),\"KJ\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Net work transfer in a cycle is 24.0 KJ\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.2 Page No. 90" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Q=-300\t\t#Heat transfer in the system consisting of the gas in kJ\n", + "u=0\t\t#Internal energy is constant\n", + "\n", + "#Calculations\n", + "W=Q-u\t\t#Work done of the system in kJ\n", + "\n", + "#Output\n", + "print'The work done of the system W = %3.0f kJ ',round(W,1),\"KJ\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The work done of the system W = %3.0f kJ -300.0 KJ\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.3 Page No. 90" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "v1=1.5\t\t#Initial volume of the process in m**3\n", + "v2=4.5\t\t#Final volume of the process in m**3\n", + "Q=2000\t\t#Amount of heat added in kJ\n", + "\n", + "#Calculations\n", + "W=100*((3.5*math.log(v2/v1))+(3*(v2-v1)))\t#Amount of work done in kJ\n", + "U=Q-W\t\t\t\t\t#The change in internal energy in kJ\n", + "\n", + "#Output\n", + "print'The change in internal energy is',round(U,2),\"KJ\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The change in internal energy is 715.49 KJ\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.4 Page No.91" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "h1=35\t\t#Enthalpy of water entering the boiler in kJ/kg\n", + "h2=705\t\t#Enthalpy of steam leaving the boiler in kJ/kg\n", + "C=0\t\t#Change in kinetic energy is neglected\n", + "Z=0\t\t#Change in potential energy is neglected\n", + "\n", + "#Calculations\n", + "q=h2-h1\t\t#The heat transfer per kg of steam in kJ/kg\n", + "\n", + "#Output\n", + "print'The heat transfer per kg of steam is',round(q,1),\"kJ/kg\"\t\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The heat transfer per kg of steam is 670.0 kJ/kg\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.5 Page No. 92" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Q=-170\t\t#Sum of all heat transfers per cycle in kJ\n", + "N=100\t\t#Total number of cycles per min in cycles/min\n", + "Q1=0\t\t#Heat developed in a-b process in kJ/min\n", + "Q2=21000\t\t#Heat developed in b-c process in kJ/min\n", + "Q3=-2100\t\t#Heat developed in c-d process in kJ/min\n", + "W1=2170\t\t#Work done in the process a-b in kJ/min\n", + "W2=0\t\t#Work done in the b-c process in kJ/min\n", + "E3=-36600\t#Change in energy in the process in kJ/min\n", + "\n", + "#Calculations\n", + "E1=Q1-W1\t\t#Change in energy in process a-b in kJ/min\n", + "E2=Q2-W2\t\t#Change in energy in b-c process in kJ/min\n", + "W3=Q3-E3\t\t#Work done in the c-d process in kJ/min\n", + "Qt=Q*N\t\t\t#Total heat transfer per min in kJ/min \n", + "Q4=Qt-Q1-Q2-Q3\t\t#Heat developed in the process d-a in kJ/min\n", + "Et=0\t\t\t#Total change in energy of the cycle\n", + "E4=Et-E1-E2-E3\t\t#Energy in the process d-a in kJ/min\n", + "W4=Q4-E4\t\t#Work done in the d-a process in kJ/min \n", + "Wn=Qt/60.0\t\t#Net rate of work output in kW\n", + "\n", + "#Output\n", + "print'(a)Change in energy in a-b process is',round(E1,2),\"kJ/min\"\n", + "print'(b)Change in energy in b-c process is',round(E2,2),\"kJ/min\"\n", + "print'(c)Work done in the c-d process is',round(W3,2),\"kJ/min\"\n", + "print'(d)Heat developed in the process d-a is',round(Q4,2),\"kJ/min\"\n", + "print'(e)Energy in the process d-a is',round(E4,2),\"kJ/min\"\n", + "print'(f)Work done in the d-a process is',round(W4,2),\"kJ/min\"\n", + "print'(g)Net rate of work output is',round(Wn,2),\"kW\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)Change in energy in a-b process is -2170.0 kJ/min\n", + "(b)Change in energy in b-c process is 21000.0 kJ/min\n", + "(c)Work done in the c-d process is 34500.0 kJ/min\n", + "(d)Heat developed in the process d-a is -35900.0 kJ/min\n", + "(e)Energy in the process d-a is 17770.0 kJ/min\n", + "(f)Work done in the d-a process is -53670.0 kJ/min\n", + "(g)Net rate of work output is -283.33 kW\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.6 Page No. 93" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Q1=50\t\t#Heat developed in the 1-2 process in kJ/kg\n", + "U1=20\t\t#Change in energy in the 1-2 process in kJ/kg\n", + "Q2=-30\t\t#Heat developed in the 2-3 process in kJ/kg\n", + "W2=-40\t\t#Work done in the 2-3 process in kj/kg\n", + "U3=-30\t\t#Change in energy in the 3-1 process in kJ/kg\n", + "Wt=30\t\t#Net work done per kg of fluid in kJ/kg\n", + "m=0.1\t\t#Mass of fluid in the cycle in kg\n", + "N=10\t\t#Number of cycles per sec in cycles/sec\n", + "\n", + "#Calculations\n", + "W1=Q1-U1\t#Work done in the 1-2 process in kJ/kg\n", + "U2=Q2-W2\t#Change in energy in the 2-3 process in kJ/kg\n", + "W3=Wt-W1-W2\t#Work done in the 3-1 process in kJ/kg\n", + "Q3=W3+U3\t#Heat developed in the process in kJ/kg\n", + "m1=m*N\t\t#mass flow rate per sec in kg/sec\n", + "P=Wt*m1\t\t#Rate of power in kW\n", + "\n", + "#Output\n", + "print'(a)Work done in the 1-2 process is',round(W1,1),\"kJ/kg\"\n", + "print'(b)Change in energy in the 2-3 process is',round(U2,1),\"kJ/kg\"\n", + "print'(c)Work done in the 3-1 process is',round(W3,1),\"kJ/kg\"\n", + "print'(d)Heat developed in the processis',round(Q3,1),\"kJ/kg\"\n", + "print'(e)mass flow rate per sec ',round(m1,1), \"kg/sec \"\n", + "print'(f)Rate of power is',round(P,2),\"kW\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)Work done in the 1-2 process is 30.0 kJ/kg\n", + "(b)Change in energy in the 2-3 process is 10.0 kJ/kg\n", + "(c)Work done in the 3-1 process is 40.0 kJ/kg\n", + "(d)Heat developed in the processis 10.0 kJ/kg\n", + "(e)mass flow rate per sec 1.0 kg/sec \n", + "(f)Rate of power is 30.0 kW\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7 Page No. 94" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "m=3.0\t\t#Mass of substance in the system in kg\n", + "P1=500.0\t\t#Initial pressure of the system in kPa\n", + "P2=100.0\t\t#Final pressure of the system in kPa\n", + "V1=0.22\t\t#Initial volume of the system in m**3\n", + "n=1.2\t\t#Polytropic index \n", + "Q1=30.0\t\t#Heat transfer for the another process\n", + "\n", + "#Calculations\n", + "V2=V1*(P1/P2)**(1/1.2)\t#Final volume of the system in m**3\n", + "U=3.56*(P2*V2-P1*V1)\t#Total change in internal energy in kJ\n", + "W1=(P2*V2-P1*V1)/(1-n)\t#Work done for the 1-2 process in kJ\n", + "Q=U+W1\t\t\t#Heat developed in the process in kJ\n", + "W2=Q1-U\t\t#Work done for the another process in kJ\n", + "\n", + "#Output\n", + "print'(a)Total change in internal energy is',round(U,0), \"kJ\" \n", + "print'(b)Work done for the 1-2 process is',round(W1,2), \"kJ\" \n", + "print'(c)Heat developed in the process is',round(Q,0), \"kJ\" \n", + "print'(d)Work done for the another process is',round(W2,0), \"kJ\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)Total change in internal energy is -92.0 kJ\n", + "(b)Work done for the 1-2 process is 129.4 kJ\n", + "(c)Heat developed in the process is 37.0 kJ\n", + "(d)Work done for the another process is 122.0 kJ\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.8 Page No. 96" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "m=5\t\t#Mass of the substance in the system in kg\n", + "P1=500\t\t#Initial pressure of the system in kPa\n", + "P2=100\t\t#Final pressure of the system in kPa\n", + "V1=0.22\t\t#Initial volume of the system in m**3\n", + "n=1.2\t\t#Polytropic index\n", + "\n", + "#Calculations \n", + "V2=V1*(P1/P2)**(1/1.2)\t#Final volume of the system in m**3\n", + "U=3.5*(P2*V2-P1*V1)\t#Change in the internal energy of the system in kJ\n", + "W=(P1*V1-P2*V2)/(n-1)\t#Work developed in the process in kJ\n", + "Q=U+W\t\t\t#Heat transfer in the process in kJ\n", + "\n", + "#Output\n", + "print'Total change in Internal Energy is',round(U,0),\"KJ\" \n", + "print'Non flow work in the process is',round(W,2),\"KJ\" \n", + "print'Heat transfer of the process is',round(Q,0),\"KJ\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total change in Internal Energy is -91.0 KJ\n", + "Non flow work in the process is 129.4 KJ\n", + "Heat transfer of the process is 39.0 KJ\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.9 Page No. 97" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "p1=170\t\t#Initial pressure of the fluid in kPa\n", + "p2=400\t\t#Final pressure of the fluid in kPa\n", + "v1=0.03\t\t#Initial volume in m**3\n", + "v2=0.06\t\t#Final volume in m**3\n", + "\n", + "#Calculations\n", + "dU=3.15*((p2*v2)-(p1*v1))\t#The change in internal energy of the fluid in kJ\n", + "#P=a+b*V #Given relation \n", + "A = array([[1,v1], \n", + " [1,v2]])\n", + "b = array([p1,p2])\n", + "X = solve(A, b)\n", + "W=(X[0]*(v2-v1))+(X[1]*((v2**2-v1**2)/2.0))\t#The work done during the process in kJ\n", + "Q=U+W\t\t#The heat transfer in kJ\n", + "\n", + "#Output\n", + "print'(a)The direction and magnitude of work is',round(W,2),\"KJ\"\n", + "print'(b)The direction and magnitude of heat transfer is',round(Q,2),\"KJ\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)The direction and magnitude of work is 8.55 KJ\n", + "(b)The direction and magnitude of heat transfer is 68.08 KJ\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.11 Page No. 99" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "E1=4000\t\t#Enthalpy at entrance in kJ/Kg\n", + "E2=4100\t\t#Enthalpy at exit in kJ/kg\n", + "V1=50\t\t#Velocity at entrance in m/s\n", + "V2=20\t\t#Velocity at exit in m/s\n", + "h1=50\t\t#Height at the entrance \n", + "h2=10\t\t#Height at the exit\n", + "m=1\t\t#mass flow rate to the system in kJ/s\n", + "Q=200\t\t#Heat transfer rate to the system in kJ/s\n", + "g=9.8\t\t#Gravitational constant in m/s**2\n", + "\n", + "#Calculations\n", + "P=m*(((V1**2-V2**2)/(2000.0))+(g*(h2-h1)/1000.0)+(E1-E2))+Q\n", + "print'Power capacity of the system ',round(P,0),\"KW\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Power capacity of the system 101.0 KW\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.12 Page No. 101" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "W=135\t\t#Work done by the system in kJ/kg\n", + "V1=0.37\t\t#Specific volume of fluid at inlet in m**3/kg\n", + "V2=0.62\t\t#Specific volume of fluid at outlet in m**3/kg\n", + "P1=600\t\t#Pressure at the inlet in kPa\n", + "P2=100\t\t#Pressure at the outlet in kPa\n", + "C1=16\t\t#Velocity at the inlet in m/s\n", + "C2=270\t\t#Velocity at the outlet in m/s\n", + "Z1=32\t\t#Inlet height from floor level in m\n", + "Z2=0\t\t#Outlet height from floor level in m\n", + "q=-9\t\t#Heat loss between inlet and discharge in kJ/kg\n", + "g=9.81\t\t#Gravitational constant in m/s**2\n", + "\n", + "#Calculations\n", + "U=((C2**2-C1**2)/2000.0)+(g*(Z2-Z1))/1000.0+(P2*V2-P1*V1)+W-q\n", + "\n", + "#Output\n", + "print'Specific Internal Energy decreases by ',round(U,2),\"kJ/kg\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Specific Internal Energy decreases by 20.01 kJ/kg\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.13 Page No. 102" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "m=5\t\t#Rate of fluid flow in the system in kg/s\n", + "P1=620\t\t#Pressure at the entrance in kPa\n", + "P2=130\t\t#Pressure at the exit in kPa\n", + "C1=300\t\t#Velocity at the entrance in m/s\n", + "C2=150\t\t#Velocity at the exit in m/s\n", + "U1=2100\t\t#Internal energy at the entrance in kJ/kg\n", + "U2=1500\t\t#Internal energy at the exit in kJ/kg\n", + "V1=0.37\t\t#Specific volume at entrance in m**3/kg\n", + "V2=1.2\t\t#Specific volume at exit in m**3/kg\n", + "Q=-30\t\t#Heat loss in the system during flow in kJ/kg\n", + "Z=0\t\t#Change in potential energy is neglected in m\n", + "g=9.81\t\t#Gravitational constant in m/s**2\n", + "\n", + "#Calculations\n", + "W=((C1**2-C2**2)/(2*1000))+(g*Z)+(U1-U2)+(P1*V1-P2*V2)+Q\n", + "P=W*m#Power capacity of the system in kW\n", + "\n", + "#Output\n", + "print'(a)Total work done in the system ',round(W,1),\"kJ/kg\"\n", + "print'(b)Power capacity of the system',round(P,1),\"KW\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " (a)Total work done in the system 676.4 kJ/kg\n", + "(b)Power capacity of the system 3382.0 KW\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.14 Page No. 103" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "P1=100\t\t#Pressure at Inlet in kPa\n", + "P2=500\t\t#Pressure at Exit in kPa\n", + "V1=0.6\t\t#Specific volume at Inlet in m**3/kg\n", + "V2=0.15\t\t#Specific volume at Exit in m**3/kg\n", + "U1=50\t\t#Specific internal energy at inlet in kJ/kg\n", + "U2=125\t\t#Specific internal energy at Exit in kJ/kg\n", + "C1=8\t\t#Velocity of air at Inlet in m/s\n", + "C2=4\t\t#Velocity of air at Exit in m/s\n", + "m=5\t\t#Mass flow rate of air in kg/s\n", + "Q=-45\t\t#Heat rejected to cooling water in kW\n", + "Z=0\t\t#Change in potential energy is neglected in m\n", + "g=9.81\t\t#Gravitational constant in m/s**2\n", + "\n", + "#Calculations\n", + "P=m*(((C1**2-C2**2)/(2*1000.0))+(g*Z)+(U1-U2)+(P1*V1-P2*V2))+Q\n", + "P1=-P\n", + "\n", + "#Output\n", + "print'The power required to drive the compressor',round(-P1,2),\"kW\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The power required to drive the compressor -494.88 kW\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.15 Page No. 104" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "m1=5000\t\t#Steam flow rate in kg/hr\n", + "Q1=-250\t\t#Heat loss from the turbine insulation to surroundings in kj/min\n", + "C1=40\t \t#Velocity of steam at entrance in m/s\n", + "h1=2500\t\t#Enthalpy of the steam at entrance in kJ/kg\n", + "C2=90\t\t #Velocity of the steam at the Exit in m/s\n", + "h2=2030\t\t#Enthalpy of the steam at exit in kj/kg\n", + "Z=0\t\t #Change in potential energy is neglected in m\n", + "g=9.81\t\t#Gravitational constant in m/s**2\n", + "\n", + "#Calculations\n", + "m=m1/3600.0\t #Steam flow rate in kg/s\n", + "Q=Q1/60.0\t\t#Heat loss from the turbine to the surroundings\n", + "P=m*(((C1**2-C2**2)/(2*1000))+(g*Z)+(h1-h2))+Q\n", + "\n", + "#Output\n", + "print'The power developed by the turbine is',round(P,1),\"KW\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The power developed by the turbine is 643.1 KW\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.16 Page No. 105" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "c1=16\t\t#Velocity of steam at entrance in m/s\n", + "c2=37\t\t#Velocity of steam at exit in m/s\n", + "h1=2990\t\t#Specific enthalpy of steam at entrance in kJ/kg\n", + "h2=2530\t\t#Specific enthalpy of steam at exit in kJ/kg\n", + "Q=-25\t\t#Heat lost to the surroundings in kJ/kg\n", + "m1=360000\t#The steam flow rate in kg/hr\n", + "\n", + "#Calculations\n", + "m=m1/3600.0 #The steam flow rate in kg/s\n", + "W=(c1**2-c2**2)/2000.0+(h1-h2)+Q\t#Total work done in the system in kJ/kg\n", + "P=m*W\t\t\t\t\t #Power developed by the turbine in kW\n", + "\n", + "#Output\n", + "print'The work output from the turbine is',round(P,1),\"kW \"\n", + "print'NOTE: In the book there is Calculation mistake'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The work output from the turbine is 43444.3 kW \n", + "NOTE: In the book there is Calculation mistake\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.17 Page No.106" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "p1=720\t\t#Pressure at the entrance in kPa\n", + "t1=850\t\t#Temperature at the entrance in degree centigrade \n", + "c1=160\t\t#Velocity of the gas at entrance in m/s\n", + "Q=0\t\t#Insulation (adiabatic turbine)\n", + "P2=115\t\t#Pressure at the exit in kPa\n", + "t2=450\t\t#Temperature at the exit in degree centigrade\n", + "c2=250\t\t#Velocity of the gas at exit in m/s\n", + "cp=1.04\t\t#Specific heat of gas at constant pressure in kJ/kg-K\n", + "\n", + "#Calculations\n", + "H=cp*(t1-t2)\t\t\t#Change in Enthalpy of the gas at entrance and exit in kJ/kg\n", + "W=((c1**2-c2**2)/(2*1000))+(H)\t#External work output of the turbine in kJ/kg\n", + "\n", + "#Output\n", + "print'The external work output of the turbine is',round(W,0),\"kJ/kg\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The external work output of the turbine is 397.0 kJ/kg\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.18 Page No. 107" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "p=5000\t\t#Power output of an adiabatic steam turbine in kW\n", + "p1=2000\t\t#Pressure at the inlet in kPa\n", + "p2=0.15\t\t#Pressure at the exit in bar\n", + "t1=400\t\t#temperature at the inlet in degree centigrade\n", + "x=0.9\t\t#Dryness at the exit\n", + "c1=50\t\t#Velocity at the inlet in m/s\n", + "c2=180\t\t#Velocity at the exit in m/s\n", + "z1=10\t\t#Elevation at inlet in m\n", + "z2=6\t\t#Elevation at exit in m\n", + "h1=3248.7\t\t#Enthalpy at the inlet from the steam table corresponding to and 20 bar in kJ/kg\n", + "hf=226\t\t#Enthalpy at exit at 0.15 bar from steam tables in kJ/kg\n", + "hfg=2373.2\t#Enthalpy at exit at 0.15 bar from steam tables in kJ/kg\n", + "g=9.81\t\t#Gravitational constant in m/s**2\n", + "\n", + "#Calculations\n", + "h2=hf+(x*hfg) #Enthalpy at the exit in kJ/kg\n", + "W=(h1-h2)+((c1**2-c2**2)/(2*1000))+((g*(z1-z2))/1000.0)\n", + "m=p/W\t\t\t\t\t\t \n", + "\n", + "#Output\n", + "print'(a)The work done per unit mass of the steam flowing through turbine is',round(W,1),\"kJ/kg\"\n", + "print'(b)The mass flow rate of the steam is',round(m,1),\"kg/s\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)The work done per unit mass of the steam flowing through turbine is 871.9 kJ/kg\n", + "(b)The mass flow rate of the steam is 5.7 kg/s\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.19 Page No. 108" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "p1=1000.0\t\t#Pressure at the inlet in kPa\n", + "t1=750.0\t\t#Temperature at the inlet in K\n", + "c1=200.0\t\t#Velocity at the inlet in m/s\n", + "p2=125.0\t\t#Pressure at the exit in kPa\n", + "c2=40.0\t\t #Velocity at the exit in m/s\n", + "m1=1000.0\t\t#Mass flow rate of air in kg/hr\n", + "cp=1.053\t\t#Specific heat at constant pressure in kJ/kgK\n", + "k=1.375\t\t #Adiabatic index\n", + "Q=0\t\t #The turbine is adiabatic\n", + "\n", + "#Calculations\n", + "m=m1/3600.0\t#The mass flow rate of air in kg/s\n", + "P=p2/p1\t\t#Ratio of the pressure\n", + "t2=t1*((p2/p1)**((k-1)/k))\t#Temperature of air at exit in K\n", + "h=cp*(t2-t1)\t\t#Change in enthalpy of the system in kJ\n", + "p=m*(((c2**2-c1**2)/(2*1000))+h)\t#Power output of the turbine in kW\n", + "p1=-p\t\t\t#Power output of the turbine in kW\n", + "\n", + "#Output\n", + "print'(a)Temperature of air at exit is',round(t2,2),\" K \"\n", + "print'(b)The power output of the turbine is',round(p1,1),\"kW\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)Temperature of air at exit is 425.37 K \n", + "(b)The power output of the turbine is 100.3 kW\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.20 Page No. 110" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "c1=7\t\t #Velocity of air at entrance in m/s\n", + "c2=5\t\t #Velocity of air at exit in m/s\n", + "p1=100\t\t #Pressure at the entrance in kPa\n", + "p2=700\t\t #Pressure at the exit in kPa\n", + "v1=0.95\t\t#Specific volume at entrance in m**3/kg\n", + "v2=0.19\t\t#Specific volume at exit in m**3/kg\n", + "u=90\t\t # Change in internal energy of the air entering and leaving in kJ/kg\n", + "z=0\t\t #Potential energy is neglected \n", + "Q=-58\t\t #Heat rejected to the surroundings in kW\n", + "m=0.5\t\t #The rate at which air flow in kg/s\n", + "g=9.81\t\t #Gravitational constant in m/s**2\n", + "\n", + "#Calculations\n", + "P=m*(((c1**2-c2**2)/(2000.0))+(p1*v1-p2*v2)-u)+(Q)\n", + "A=(v1*c2)/(v2*c1)\t#From continuity equation the ratio of areas\n", + "D=A**(1/2.0)\t #The ratio of inlet pipe diameter to the outlet pipe diameter\n", + "\n", + "#Output\n", + "print'(a)The rate of work input to the air is ',round(P,2),\"kW\"\n", + "print'(b)The ratio of inlet pipe diameter to the outlet pipe diameter is ',round(D,2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)The rate of work input to the air is -121.99 kW\n", + "(b)The ratio of inlet pipe diameter to the outlet pipe diameter is 1.89\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.21 Page No. 112" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "h1=3000\t\t#Enthalpy of the fluid passing at inlet in kJ/kg\n", + "h2=2757\t\t#Enthalpy of the fluid at the discharge in kJ/kg\n", + "c1=60\t\t#Velocity of the fluid at inlet in m/s\n", + "A1=0.1\t\t#Inlet area of the nozzle in m**2\n", + "v1=0.187\t\t#Specific volume at inlet in m**3/kg\n", + "v2=0.498\t\t#Specific volume at the outlet in m**3/kg\n", + "q=0\t\t#Heat loss during the flow is negligable\n", + "z=0\t\t#The nozzle is horizontal so change in PE is constant\n", + "w=0\t\t#The work done is also negligable\n", + "\n", + "#Calculations\n", + "c2=(2*1000*((h1-h2)+(c1**2/2000.0)))**(1/2.0)\t#Velocity at the exit in m/s\n", + "m=(A1*c1)/v1\t\t\t\t#The mass flow rate in kg/s\n", + "A2=(m*v2)/c2\t\t\t\t#Area at the exit of the nozzle in m**3\n", + "\n", + "#Output\n", + "print'(a)The velocity at the exit is',round(c2,1),\"m/s\"\n", + "print'(b)The mass flow rateis',round(m,1),\"kg/s\" \n", + "print'(c)Area at the exit is',round(A2,3),\"m**2\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)The velocity at the exit is 699.7 m/s\n", + "(b)The mass flow rateis 32.1 kg/s\n", + "(c)Area at the exit is 0.023 m**2\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.22 Page No. 113" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "h1=3000\t\t#Specific enthalpy of steam at inlet in kJ/kg\n", + "h2=2762\t\t#Specific enthalpy of steam at the outlet in kJ/kg\n", + "v1=0.187\t\t#Specific volume of steam at inlet in m**3/kg\n", + "v2=0.498\t\t#Specific volume of steam at the outlet in m**3/kg\n", + "A1=0.1\t\t#Area at the inlet in m**2\n", + "q=0\t\t#There is no heat loss\n", + "z=0\t\t#The nozzle is horizontal ,so no change in PE\n", + "c1=60\t\t#Velocity of the steam at the inlet in m/s\n", + "\n", + "#Calculations\n", + "c2=((2*1000)*((h1-h2)+(c1**2/2000.0)))**(1/2.0)\t#Velocity of the steam at the outlet in m/s\n", + "m=(A1*c1)/v1\t\t\t\t#Mass flow rate of steam in kg/s\n", + "A2=(m*v2)/c2\t\t\t\t#Area at the nozzle exit in m**2\n", + "\n", + "#Output\n", + "print'(a)Velocity of the steam at the outlet is ',round(c2,2), \"m/s \"\n", + "print'(b)Mass flow rate of steam is ',round(m,2),\"kg/s \"\n", + "print'(c)Area at the nozzle exit is',round(A2,3),\"m**2\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)Velocity of the steam at the outlet is 692.53 m/s \n", + "(b)Mass flow rate of steam is 32.09 kg/s \n", + "(c)Area at the nozzle exit is 0.023 m**2\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.23 Page No. 114" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "c1=40\t\t#Velocity of air at the inlet of nozzle in m/s\n", + "h=180\t\t#The decrease in enthalpy in the nozzle in kJ/kg\n", + "w=0\t\t#Since adiabatic\n", + "q=0\t\t#Since adiabatic\n", + "z=0\t\t#Since adiabatic\n", + "\n", + "#Calculations\n", + "c2=((2*1000)*((h)+(c1**2/(2*1000))))**(1/2.0)\t#The exit velocity of air in m/s\n", + "\n", + "#Output\n", + "print'The exit velocity of the air is',round(c2,1),\"m/s\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The exit velocity of the air is 600.0 m/s\n" + ] + } + ], + "prompt_number": 32 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.24 Page No. 115" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Input data\n", + "p1=100\t\t#Pressure at the inlet of the compressor in kPa\n", + "p2=500\t\t#Pressure at the outlet of the compressor in kPa\n", + "v1=3\t\t#Volume of the air at the inlet of the compressor in m**3/kg\n", + "v2=0.8\t\t#Volume of the air at the outlet of the compressor in m**3/kg\n", + "c1=25\t\t#The velocity of air at the inlet of the compressor in m/s\n", + "c2=130\t\t#The velocity of air at the outlet of the compressor in m/s\n", + "z=12\t\t#The height of delivery connection above the inlet in m\n", + "g=9.81\t\t#Gravitational constant in m/s**2\n", + "n=1.3\t\t#Polytropic index\n", + "\n", + "#Calculations\n", + "W=((n)*(p1*v1-p2*v2))/(n-1)\t#Workdone for open system polytropic process in kJ/kg\n", + "K=((c2**2-c1**2)/2000.0)\t#Change in kinetic energy of the system in kJ/kg\n", + "P=g*(z)/1000.0 \t\t#Change in potential energy of the system in kJ/kg\n", + "w=W-K-P\t\t\t #The shaft work of the compressor in kJ/kg\n", + "\n", + "#Output\n", + "print'The Shaft work of the compressor ',round(w,1),\"kj/kgIt is the power absorbing system\"\n", + "if w<0:\n", + " print'It is the power absorbing system'\n", + "else:\n", + " print'It is not power absorbing system'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Shaft work of the compressor -441.6 kj/kgIt is the power absorbing system\n", + "It is the power absorbing system\n" + ] + } + ], + "prompt_number": 38 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.25 Page No. 117" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Input data\n", + "m=10\t\t#The rate of fluid compressed adiabatically in kg/s\n", + "p1=500\t\t#Initial pressure of the process in kPa\n", + "p2=5000\t\t#Final pressure of the process in kPa\n", + "v=0.001\t\t#The specific volume of the fluid in m**3/kg\n", + "\n", + "#Calculations\n", + "P=m*v*(p2-p1)\t#The power required in kW\n", + "\n", + "#Output\n", + "print'The power required is',round(P,2),\"kW\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The power required is 45.0 kW\n" + ] + } + ], + "prompt_number": 40 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.26 Page No. 117" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Input data\n", + "m=2.0\t\t#Mass flow rate of air in kg/s\n", + "t1=20\t\t#Initial temperature of the air in degree centigrade\n", + "P=-30\t\t#The amount of power consumed in kW\n", + "c1=100\t\t#The inlet velocity of air in m/s\n", + "c2=150\t\t#The outlet velocity of air in m/s\n", + "R=0.287\t\t#The gas constant for air in kJ/kg-K\n", + "g=1.4\t\t#It is the adiabatic index\n", + "cp=1.005\t\t#Specific heat at constant pressure in kJ/kg-K\n", + "q=0\t\t#Heat developed as it is adiabatic condition\n", + "z=0\t\t#The change in potential energy is neglected\n", + "\n", + "#Calculations\n", + "h=(P/m)+((c2**2-c1**2)/(2*1000))\t\t#The change in enthalpy of the system in kJ/kg\n", + "t=h/cp\t\t#The change in temperature of the system in degree centigrade\n", + "t2=t1-t\t\t#The exit air temperature in degree centigrade\n", + "\n", + "#Output\n", + "print'The exit air temperature is is',round(t2,2),\"C\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The exit air temperature is is 28.96 C\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.27 Page No. 119" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Input data\n", + "m=0.6\t\t#Mass flow rate of air in kg/s\n", + "W=40\t\t#Power required to run the compressor in kW\n", + "p1=100\t\t#Initial pressure at the inlet of the compressor in kPa\n", + "t1=30\t\t#Initial temperature at the inlet of the compressor in degree centigrade\n", + "z=0\t\t#Change in potential energy is neglected\n", + "c=0\t\t#Change in kinetic energy is neglected\n", + "q=0.4\t\t#Heat lost to the cooling water ,bearings and frictional effects is 40% of input\n", + "cp=1.005\t\t#Specific heat at constant pressure in kJ/kg-K\n", + "\n", + "#Calculations\n", + "Q=q*W\t\t#Net heat losses from the system in kW\n", + "H=W-Q\t\t#Change in total enthalpy of the system in kW\n", + "t2=(H/(m*cp))+t1\t#The exit air temperature in degree centigrade\n", + "\n", + "#Output\n", + "print'The exit air temperature is',round(t2,0),\"C\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The exit air temperature is 70.0 C\n" + ] + } + ], + "prompt_number": 46 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.28 Page No. 120" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Input data\n", + "m1=100\t\t#Air flow rate in kg/hr\n", + "q1=600\t\t#The heat generated by each person in kJ/hr\n", + "h1=85\t\t#The enthalpy of air entering the room in kJ/kg\n", + "h2=60\t\t#The enthalpy of air leaving the room in kJ/kg\n", + "Q1=0.2\t\t#The heat added by each lamp in the room in kW\n", + "P1=0.2\t\t#The power consumed by each fan in kW\n", + "\n", + "#Calculations\n", + "q=(5*q1)/3600.0\t#The heat generated by 5 persons in the room in kW\n", + "Q=3*Q1\t\t #The heat added by three lamps in the room in kW\n", + "P=2*P1\t\t #The power consumed by two fans in the room in kW\n", + "m=m1/3600.0\t\t #Mass flow rate of air in kg/s\n", + "H=(q+Q+P)+(m*(h1-h2))\t#Heat to be removed by the cooler in kW\n", + "\n", + "#Output\n", + "print'The rate at which the heat is to be removed by cooler X is',round(H,1),\"kJ/sec\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The rate at which the heat is to be removed by cooler X is 2.5 kJ/sec\n" + ] + } + ], + "prompt_number": 34 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.29 Page No. 121" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Input data\n", + "p1=1000\t\t#Pressure at the inlet of the system in kPa\n", + "p2=15\t\t#Pressure at the outlet of the system in kPa\n", + "v1=0.206\t\t#Specific volume at the inlet of the system in m**3/kg\n", + "v2=8.93\t\t#Specific volume at the outlet of the system in m**3/kg\n", + "h1=2827\t\t#Specific enthalpy at the inlet of the system in kJ/kg\n", + "h2=2341\t\t#Specific enthalpy at the outlet of the system in kJ/kg\n", + "c1=20\t\t#Velocity at the inlet of the system in m/s\n", + "c2=120\t\t#Velocity at the outlet of the system in m/s\n", + "z1=3.2\t\t#Elevation at the inlet of the system in m\n", + "z2=0.5\t\t#Elevation at the outlet of the system in m\n", + "m=2.1\t\t#The fluid flow rate in kg/s\n", + "W=750\t\t#The work output of the device in kW\n", + "g=9.81\t\t#Gravitational constant in m/s**2\n", + "\n", + "#Calculations\n", + "Q=m*(((c2**2-c1**2)/(2*1000))+((g*(z2-z1)/(1000.0)))+(h2-h1))+W #The heat loss/gain by the system in kW\n", + "\n", + "#Output\n", + "print'The Heat loss by the system is',round(Q,1),\"kW\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Heat loss by the system is -256.0 kW\n" + ] + } + ], + "prompt_number": 50 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.30 Page No. 122" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Input data\n", + "t1=15\t\t#The inlet temperature of the air passing through the heat exchanger in degree centigrade\n", + "c1=30\t\t#The inlet velocity of air in m/s\n", + "t2=800\t\t#The outlet temperature of the air from heat exchanger in degree centigrade \n", + "c2=30\t\t#The inlet velocity of air to the turbine in m/s\n", + "t3=650\t\t#The outlet temperature of the air from the turbine in degree centigrade\n", + "c3=60\t\t#The outlet velocity of the air from turbine in m/s\n", + "t4=500\t\t#The temperature at the outlet of the nozzle in degree centigrade\n", + "m=2\t\t #Air flow rate in kg/s\n", + "cp=1.005\t\t#Specific heat at constant pressure in kJ/kgK\n", + "\n", + "#Calculations\n", + "Qh=m*cp*(t2-t1)\t#Rate of heat transfer to the air in the heat exchanger in kJ/s\n", + "P=m*((cp*(t2-t3))+((c2**2-c3**2)/2000.0))\t\t#Power output from the turbine in kW\n", + "c4=((2*1000)*(cp*(t3-t4))+c3**2)**(1/2.0)\t\t#Velocity of air at exit from nozzle in m/s\n", + "\n", + "#Output \n", + "print'(a)Rate of heat transfer to the air in the heat exchanger is',round(Qh,1),\"kJ/s\"\n", + "print'(b)Power output from the turbine is',round(P,1),\"kW\"\n", + "print'(c)Velocity of air at exit from nozzle is',round(c4),\"m/s\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)Rate of heat transfer to the air in the heat exchanger is 1577.8 kJ/s\n", + "(b)Power output from the turbine is 298.8 kW\n", + "(c)Velocity of air at exit from nozzle is 552.0 m/s\n" + ] + } + ], + "prompt_number": 40 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.31 Page No. 123" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Input data\n", + "p1=400.0\t\t#Initial pressure of the gas in a turbine in kPa\n", + "t1=573.0\t\t#Initial temperature of the gas in a turbine in K\n", + "p2=100.0\t\t#Final pressure of the gas in a turbine in kPa\n", + "V=2.5\t\t #It is the ratio of final volume to the inlet volume \n", + "c2=50.0\t\t#Velocity of the gas at exit in m/s\n", + "P=1000.0\t\t#Power developed by the turbine in kW\n", + "cp=5.193\t\t#Specific heat of the helium at constant pressure in kJ/kg K\n", + "G=8.314\t\t#Gas constant in kNm/kgK\n", + "M=4.0\t\t #Molecular weight of the helium\n", + "\n", + "#Calculations\n", + "import math\n", + "R=G/M\t\t #Characteristic gas constant in kNm/kgK\n", + "v1=(R*t1)/p1\t#Specific volume at the inlet in m**3/kg\n", + "v2=V*v1\t \t#Specific volume at the outlet in m**3/kg\n", + "n=math.log(p2/p1)/math.log(v1/v2)\t#Polytropic index \n", + "t2=((t1)*((p2/p1)**((n-1)/n)))\t\t#Final temperature of the gas in a turbine in K\n", + "w=(n/(n-1))*(R*(t1))*(1-((p2*v2)/(p1*v1)))\t#Specific work in kJ/kg\n", + "K=c2**2/(2*1000)\t\t\t#Change in kinetic energy in kJ/kg\n", + "Ws=w-K\t\t\t#Work done by the shaft in kJ/kg\n", + "q=Ws+(cp*(t2-t1))+K\t#The heat transfer during the process in kJ/kg\n", + "m=P/Ws\t\t\t#Mass flow rate of gas required in kg/s\n", + "A2=(m*v2)/c2\t\t#Exit area of the turbine in m**2\n", + "\n", + "#Output\n", + "print'(a)The mass flow rate of the gas required is',round(m,3),\"kg/s\" \n", + "print'(b)The heat transfer during the process is',round(q,1), \"kJ/kg\" \n", + "print'(c)Exit area of the turbine is ',round(A2,3),\"m**2\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)The mass flow rate of the gas required is 0.76 kg/s\n", + "(b)The heat transfer during the process is 201.5 kJ/kg\n", + "(c)Exit area of the turbine is 0.113 m**2\n" + ] + } + ], + "prompt_number": 31 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Mechanical_Engineering/.ipynb_checkpoints/bme6-checkpoint.ipynb b/Basic_Mechanical_Engineering/.ipynb_checkpoints/bme6-checkpoint.ipynb new file mode 100644 index 00000000..8b37ff4a --- /dev/null +++ b/Basic_Mechanical_Engineering/.ipynb_checkpoints/bme6-checkpoint.ipynb @@ -0,0 +1,922 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:3005e9f014df5b80be5a0d9ce99c3166f00b45b3269e9a4b1d59ef8c3aeabae4" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 6:Introduction to Heat Transfer" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.1 Page no:221" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Input data\n", + "t1=270\t\t#Temperature inside surface of the furnace wall in degree centigrade\n", + "t3=20\t\t#Temperature outside surface is dissipating heat by convection into air in degree centigrade\n", + "L=0.04\t\t#Thickness of the wall in m\n", + "K=1.2\t\t#Thermal conductivity of wall in W/m-K\n", + "t2=70\t\t#Temperature of outside surface should not exceed in degree centigrade\n", + "A=1\t\t #Assuming area in m**2\n", + "\n", + "#Calculations\n", + "Q1=(K*A*(t1-t2))/(L)\t#Heat transfer through the furnace wall in W\n", + "hc=(Q1)/(A*(t2-t3))\t\t#Heat transfer coefficient in W/m**2K\n", + "\n", + "#Output\n", + "print\"The minimum value of heat transfer coefficient at the outer surface is\",hc,\"W/m**2K\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The minimum value of heat transfer coefficient at the outer surface is 120.0 W/m**2K\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.2 page no:222" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Input data\n", + "t1=30\t\t #Normal temperature of black body in degree centigrade\n", + "t2=100\t\t#Heated temperature of black body in degree centigrade\n", + "s=20.52*10**-8\t#Stefan Boltzmann constant in kJ/hrK**4\n", + "A=1\t\t #Assume area in m**2\n", + "\n", + "#Calculations\n", + "T1=273+t1\t#Black body temperatures in kelvin K\n", + "T2=273+t2\t#Heated temperature of black body in kelvin K\n", + "E=s*(T2**4-T1**4)\t#Increase of emissive power in kJ/hr\n", + "\n", + "#Output\n", + "print'The change in its emissive power',round(E,4),\"kJ/hr\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The change in its emissive power 2242.4228 kJ/hr\n" + ] + } + ], + "prompt_number": 82 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.3 page no:222" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Input data\n", + "L=0.012 \t#Wall thickness of a mild steel tank in m\n", + "t1=100.0\t\t#Temperature of water in tank in degree centigrade\n", + "t4=20.0\t \t#Atmospheric temperature of air in degree centigrade\n", + "K=50.0\t\t #Thermal conductivity of mild steel in W/m-K\n", + "hi=2850.0\t\t#Convection heat transfer coefficient on water side in W/m**2-K\n", + "ho=10.0\t\t#Convection heat transfer coefficient on air side in W/m**2-K\n", + "Q1=60.0 \t#Heat trasfer from the incandicent lamp in W\n", + "s=5.67*10**-8\t#Stefan boltzmann constant in W/m**2/K**4\n", + "T1=2500.0\t #Lamp surface temperature in K\n", + "T2=300.0\t\t#Room temperature in K\n", + "A=1.0\t\t #Assuming area in m**2\n", + "\n", + "#Calculations\n", + "T=t1-t4\t\t#Temperature difference in degree centigrade\n", + "Q=(T)/((1/hi)+(L/K)+(1/ho))\t#Rate of heat loss per m**2 area of surface of tank in W\n", + "t3=(Q/(ho*A))+(t4)\t\t#Temperature of the outside surface in degree centigrade\n", + "U=(Q)/(A*T)\t\t#Overall Heat transfer coefficient in W/m**2/K\n", + "a=(Q1)/(s*(T1**4-T2**4))\t#surface area of the coil in m**2\n", + "a1=a*10**6#Surface area of the coil in mm**2\n", + "\n", + "#Output\n", + "print'(a) The rate of heat loss per sq m area of the tank is',round(Q,2),\" W \"\n", + "print '(b) Overall heat transfer coefficient is ',round(U,2),\" W/m**2/K\" \n", + "print '(c) Temperature of the outside surface of tank is ',round(t3,2),\"C\" \n", + "print '(d)The surface area of the coil is ',round(a1,3),\"mm**2\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a) The rate of heat loss per sq m area of the tank is 795.3 W \n", + "(b) Overall heat transfer coefficient is 9.94 W/m**2/K\n", + "(c) Temperature of the outside surface of tank is 99.53 C\n", + "(d)The surface area of the coil is 27.096 mm**2\n" + ] + } + ], + "prompt_number": 83 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.4 page no:225" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Input data\n", + "A1=3.5\t\t#Area of the boiler plate in m**2\n", + "X2=0.02\t\t#Thickness of the plate in m\n", + "K2=50.0\t\t#Thermal conductivity of plate in W/m-K\n", + "X1=0.002\t #Thickness of layer inside boiler in m\n", + "K1=1.0\t\t #Thermal conductivity of layer in W/m-K\n", + "t1=250.0\t\t#The hot gas temperature of the plate in degree centigrade\n", + "t3=200.0\t\t#Temperature of cold air in degree centigrade\n", + "\n", + "#Calculations \n", + "T=t1-t3\t\t#Temperature difference in degree centigrade\n", + "Q=(T*A1)/((X1/K1)+(X2/K2))\t#Rate of heat loss in W\n", + "Q1=Q/1000\t\t#Rate of heat loss in kJ/s\n", + "Q2=Q1*3600\t\t#Rate of heat loss in kJ/hr\n", + "\n", + "#Output\n", + "print'(a)Rate of heat loss is',round(Q1,2),\" kJ/s \"\n", + "print'(b)Rate of heat loss per hour is',round(Q2,2),\"kJ/hr\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)Rate of heat loss is 72.92 kJ/s \n", + "(b)Rate of heat loss per hour is 262500.0 kJ/hr\n" + ] + } + ], + "prompt_number": 84 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.5 page no:226" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Input data \n", + "L1=0.225\t\t#Thickness of the brick in m\n", + "K1=4.984\t\t#Thermal conductivity of brick in kJ/hr m C/m\n", + "L2=0.125\t\t#Thickness of insulating brick in m\n", + "K2=0.623\t\t#Thermal conductivity of insulating brick in kJ/hr m C /m\n", + "Ti=1650.0\t\t#Temperature inside the furnace in degree centigrade\n", + "hl=245.28\t\t#Conductance at inside wall in kJ/hr m**2 C\n", + "ho=40.88\t\t#Conductance at outside wall in kJ/hr m**2 C\n", + "To=27.0\t\t#Temperature of surrounding atmosphere in degree centigrade \n", + "\n", + "#Calculations \n", + "R=((1.0/hl)+(L1/K1)+(L2/K2)+(1.0/ho))\t#Total resistance of the wall in C hr/kJ\n", + "q=(Ti-To)/R\t\t\t#Rate of heat loss per m**2 of the wall in kJ/hr m**2\n", + "T1=Ti-(q*(1.0/hl))\t\t\t#Inner surface temperature in degree centigrade\n", + "T3=Ti-(q*((1.0/hl)+(L1/K1)+(L2/K2)))\t#Outer surface temperature in degree centigrade\n", + "\n", + "#Output\n", + "print'(a)The rate of heat loss per sq m of the wall is',round(q,1), \"kJ/hr m**2\"\n", + "print'(b)The temperature at the inner surface is',round(T1,2),\"C\" \n", + "print'(c)The temperature at the outer surface is',round(T3,2),\"C\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)The rate of heat loss per sq m of the wall is 5916.3 kJ/hr m**2\n", + "(b)The temperature at the inner surface is 1625.88 C\n", + "(c)The temperature at the outer surface is 171.72 C\n" + ] + } + ], + "prompt_number": 85 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.6 page no:227" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Input data\n", + "x=0.3\t\t#Thickness of the wall in degree centigrade\n", + "t1=24.0\t\t#Inside surface temperature of the wall in degree centigrade\n", + "t2=-6\t\t#Outside temperature of wall in degree centigrade\n", + "h=2.75\t\t#Height of the wall in m\n", + "L=6.1\t\t#Length of the wall in m\n", + "K=2.6\t\t#Coefficient of conductivity of brick in kJ/hr m C\n", + "\n", + "#Calculations \n", + "A=h*L\t\t#Area of the wall in m**2\n", + "A=round(A,1)\n", + "T=t2-t1\t\t#Temperature difference in degree centigrade\n", + "q=(K*A*(-T))/(x)\t#Heat transfer by conduction in kJ/hr\n", + "R=(t1-t2)/q\t#Resistance of the wall in C hr/kJ\n", + "C=1.0/R\t\t#Conductance of the wall in kJ/m C\n", + "\n", + "#Output\n", + "print'(a)The heat transfer by conduction through the wall is',q, \"kJ/hr\"\n", + "print'(b)Resistance of the wall is',round(R,5),\"C hr/kJ\"\n", + "print'(C)Conductance of the wall is',round(C,1),\"kJ/m C\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)The heat transfer by conduction through the wall is 4368.0 kJ/hr\n", + "(b)Resistance of the wall is 0.00687 C hr/kJ\n", + "(C)Conductance of the wall is 145.6 kJ/m C\n" + ] + } + ], + "prompt_number": 86 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.8 page no:230" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "T=300\t\t#Temperature of the earth as a black body in K\n", + "s=20.52*10**-8\t#Stefan Boltzmann constant in kJ/hr m**2 T**4\n", + "\n", + "#Calculations \n", + "Q=s*T**4\t#Heat received by unit area on the earths surface perpendicular to solar rays in kJ/hr\n", + "\n", + "#Output\n", + "print'Heat received by the unit area of earths surface',round(Q,2),\"kJ/hr\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat received by the unit area of earths surface 1662.12 kJ/hr\n" + ] + } + ], + "prompt_number": 87 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.9 page no:230" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Input data\n", + "D=0.07\t\t # Diameter of the steel tube in m\n", + "L=3.0\t\t #Length of the steel tube\n", + "t1=227.0\t\t#Temperature of the steel tube in m\n", + "t2=27.0\t \t#Temperature of the room in degree centigrade\n", + "s=20.52*10**-8\t#Stefan Boltzmann constant in kJ/hr m**2 T**4\n", + "pi=3.1428\t\t#Constant value of pi\n", + "\n", + "#Calculations \n", + "A=2*pi*D*L\t #Surface area of the tube in m**2\n", + "Q=(A)*(s)*((t1+273)**4-(t2+273)**4)\t#Loss of heat by radiation in kJ/hr\n", + "Q1=Q/3600.0\t #Loss of heat by radiation in kW\n", + "\n", + "#Output\n", + "print'The loss of heat by radiation from steel tube is',round(Q1,3),\"KW\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The loss of heat by radiation from steel tube is 4.093 KW\n" + ] + } + ], + "prompt_number": 88 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.10 page no:231" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Input data\n", + "T1=7.0\t\t #Inside temperature of refrigerator in degree centigrade \n", + "T0=28.0\t\t#Temperature in the kitchen in degree centigrade\n", + "K1=40.0\t\t#Thermal conductivity of mild steel in W/mC\n", + "x1=0.03\t\t#Thickness of mild sheets in m\n", + "K3=40.0\t\t#Thermal conductivity of the mild steel in W/mC\n", + "x3=0.03\t\t#Thickness of another side mild sheet in m\n", + "x2=0.05\t\t#Thickness of glass wool insulated in m\n", + "hi=10.0\t\t#Heat transfer coefficient in the inner surface of refrigerator in W/m**2 C\n", + "ho=12.5\t\t#Heat transfer coefficient in the outer surface of refrigerator in W/m**2 C\n", + "K2=0.04\t\t#Thermal conductivity of glass in W/mC\n", + "\n", + "#Calculations\n", + "Q=(T1-T0)/((1/hi)+(x1/K1)+(x2/K2)+(x3/K3)+(1/ho))\t#Heat transfer per unit area in W/m**2\n", + "\n", + "#Output\n", + "print'The rate of heat removed from the refrigirator ',round(Q,3),\"W/m**2\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The rate of heat removed from the refrigirator -14.67 W/m**2\n" + ] + } + ], + "prompt_number": 89 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.11 page no:232" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Input data\n", + "x1=0.2\t \t#Thickness of the fire brick\n", + "x2=0.2\t \t#Thickness of the common brick\n", + "Ti=1400.0 \t#Temperature of hot gases in the inner surface of the brick in degree centigrade\n", + "To=50.0\t\t#Temperature of gases in the outer surface of the brick in degree centigrade\n", + "h1=16.5\t\t#Convection heat transfer coefficient on gas side in W/mC\n", + "h2=17.5\t\t#radiation heat transfer coefficient on gas side in W/mC\n", + "h3=12.5\t\t#Convection heat transfer coefficient on outer side in W/mC\n", + "h4=6.5 \t\t#Radiation heat transfer coeeficient on outer side in W/mC\n", + "K1=4.0 \t\t#Thermal conductivity of fire brick in W/mC\n", + "K2=0.65\t\t#Thermal conductivity of common brick in W/mC\n", + "\n", + "#Calculations \n", + "hi=h1+h2\t\t#Total heat transfer coefficient in inner \n", + "ho=h3+h4\t\t#Total heat transfer coefficient in outer \n", + "Q=(Ti-To)/((1/hi)+(x1/K1)+(x2/K2)+(1/ho))\t#Heat flow through the furnace composite wall per unit area in W/m**2\n", + "Q1=Q/1000\n", + "T1=Ti-(Q/hi)\t#Temperature at the inside of the fire brick \n", + "T2=T1-(Q*(x1/K1))#Maximum temperature to which common brick is subjected in degree centigrade\n", + "\n", + "#Output\n", + "print'(a)Heat loss per m**2 area of the furnace wall is',round(Q)/1000,\"kW/m**2\" \n", + "print'(b)Maximum temperature to which common brick is subjec',round(T1,3),\"C\" \n", + "print'(c)similarly on other side is',round(T2,3),\"C\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)Heat loss per m**2 area of the furnace wall is 3.07 kW/m**2\n", + "(b)Maximum temperature to which common brick is subjec 1309.705 C\n", + "(c)similarly on other side is 1156.204 C\n" + ] + } + ], + "prompt_number": 90 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.12 page no:234" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Input data\n", + "K1=0.93\t\t#Thermal conductivity of fire clay in W/mC\n", + "K2=0.13\t\t#Thermal conductivity of diatomite brick in W/mC\n", + "K3=0.7\t\t#Thermal conductivity of red brick in W/mC\n", + "x1=0.12\t\t#Thickness of fire clay in m\n", + "x2=0.05\t\t#Thickness of diatomite in m\n", + "x3=0.25\t\t#Thickness of brick in m\n", + "T=1\t\t#Assume the difference between temperature in degree centigrade\n", + "\n", + "#Calculations\n", + "Q=(T)/((x1/K1)+(x2/K2)+(x3/K3))\t#The heat flow per unit area in W/m**2\n", + "X3=K3*((T/Q)-(x1/K1))\t\t#Thickness of the red brick layer in m\n", + "X=X3*100\t\t\t#Thickness of the red brick layer in cm\n", + "\n", + "#Output\n", + "print'The thickness of the red brick layer is',round(X,3),\"cm\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The thickness of the red brick layer is 51.923 cm\n" + ] + } + ], + "prompt_number": 91 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.13 page no:235" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Input data\n", + "R1=0.06\t\t#Thickness of material layer in m\n", + "R2=0.12\t\t#Thickness of the two insulating materials in m\n", + "R3=0.16\t\t#Thickness of material layers with pipe in m\n", + "K1=0.24\t\t#Thermal conductivity of one layer in W/mC\n", + "K2=0.4\t\t #Thermal conductivity of another layer in W/mC\n", + "L=60.0\t\t #Length of the pipe in m\n", + "hi=60.0\t\t#Heat transfer coefficient inside in W/m**2C\n", + "ho=12.0\t\t#Heat transfer coefficient outside in W/m**2C\n", + "ti=65.0\t\t#Temperature of hot air flowing in pipe in degree centigrade\n", + "to=20.0\t\t#Atmospheric temperature in degree centigrade\n", + "pi=3.1428\t #Constant value of pi\n", + "\n", + "#Calculations\n", + "Q=(ti-to)*(2*pi*L)/((1/(hi*R1))+(math.log(R2/R1)/(K1))+(math.log(R3/R2)/(K2))+(1/(ho*R3)))\t#Rate of heat loss in W\n", + "Q1=Q/1000\t#Rate of heat loss in kW\n", + "\n", + "#Output\n", + "print'The rate of heat loss is',round(Q1,4),\"kW\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The rate of heat loss is 3.8519 kW\n" + ] + } + ], + "prompt_number": 92 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.14 page no:237" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Input data\n", + "R1=8.0\t\t #Inner radius of the pipe in cm\n", + "R2=8.5\t\t #Outter radius of the pipe in cm\n", + "x1=3.0\t\t #Thickness of first layer in cm\n", + "x2=5.0\t\t #Thickness of second layer in cm\n", + "T1=300.0\t\t#Inner surface temperature of the steam pipe in degree centigrade\n", + "pi=3.1428\t #Constant value of pi \n", + "T4=50.0\t\t #Temperature at outer surface of insulation in degree centigrade\n", + "L=1.0\t\t #Length of the pipe in m\n", + "K1=50.0\t \t#Thermal conductivity of pipe in W/mC\n", + "K2=0.15\t \t#Thermal conductivity of first layer in W/mC\n", + "K3=0.08\t \t#Thermal conductivity of second layer in W/mC\n", + "h=2751.0\t\t#Enthalpy of dry and saturated steam at 300 degree centigrade in kJ/kg\n", + "q=40.0\t \t#Quantity of steam flow in gm/hr\n", + "hf=1345.0\t\t#Enthalpy of fluid at 300 degree centigrade in kJ/kg\n", + "hfg=1406.0\t\t#enthalpy at 300 degree centigrade in kJ/kg\n", + "\n", + "#Calculations\n", + "R3=R2+x1\t#Radius of pipe with first layer\n", + "R4=R3+x2\t#Radius of pipe with two layers\n", + "Q=(2*pi*L*(T1-T4))/((math.log(R2/R1)/(K1))+(math.log(R3/R2)/(K2))+(math.log(R4/R3)/(K3)))\n", + "Q1=Q/1000\t#Quantity of heat loss per meter length of pipe in kW\n", + "Q2=Q1*3600\t#Quantity of heat loss per meter length of pipe in kJ/hr\n", + "hg=((h)-(Q2/q))\t#Enthalpy of steam in kJ/kg\n", + "x=(hg-hf)/(hfg)\t#Dryness fraction of steam\n", + "\n", + "#Output\n", + "print'(a)The quantity of heat lost per meter length of steam pipe is',round(Q,2),\"W/m or\",round(Q*3600/1000),\"kJ/hr\"\n", + "print'(b)The quantity of steam coming out of one meter length pipe is',round(x,4),\"gm/h\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)The quantity of heat lost per meter length of steam pipe is 240.68 W/m or 866.0 kJ/hr\n", + "(b)The quantity of steam coming out of one meter length pipe is 0.9846 gm/h\n" + ] + } + ], + "prompt_number": 93 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.15 page no:238" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Input data\n", + "x=0.3\t\t#Thickness of brick wall in m\n", + "ti=24.0\t\t#Inside surface temperature of wall in degree centigrade\n", + "to=-6.0\t\t#Outside surface temperature of wall in degree centigrade\n", + "h=2.75\t\t#Height of the wall in m\n", + "L=6.1\t\t#Length of the wall in m\n", + "K=2.6\t\t#Thermal conductivity of brick material in kJ/m hr C\n", + "\n", + "#Calculations\n", + "T=ti-to\t\t#Temperature difference across the wall in degree centigrade\n", + "A=h*L\t\t#Area of the wall in m**2\n", + "Q=(K*A*T)/(x)\t#Heat transfer through conduction by the wall per hour in kJ/hr\n", + "R=T/Q\t\t#Resistance of the wall in hr C/kJ\n", + "C=1.0/R\t\t#Conductance of the wall in kJ/hr C\n", + "\n", + "#Output\n", + "print'(a)The heat transfer by conduction through the wall is',round(Q),\"kJ/hr \"\n", + "print'(b)The resistance of the wall is ',round(R,5),\"Chr/Kj \" \n", + "print' The conductance of the wall is',round(C,1), \"kJ/hr C \"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)The heat transfer by conduction through the wall is 4362.0 kJ/hr \n", + "(b)The resistance of the wall is 0.00688 Chr/Kj \n", + " The conductance of the wall is 145.4 kJ/hr C \n" + ] + } + ], + "prompt_number": 94 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.16 page no:240" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Input data\n", + "x1=0.3 \t#Thickness of refractory bricks in m\n", + "K1=5.66\t\t#Thermal conductivity of refractory bricks in kJ/hr mC\n", + "t1=1650.0\t\t#Inner surface temperature of the wall in degree centigrade\n", + "t2=320.0\t \t#Outside surface temperature of the wall in degree centigrade\n", + "x2=0.3\t \t#Thickness of insulating brick in m\n", + "K2=1.26\t\t#Thermal conductivity of insulating brick in kJ/hr mC\n", + "A=1.0\t \t#unit surface area in m**2\n", + "t3=27.0\t\t#Outside surface temperature of the brick in degree centigrade\n", + "\n", + "#Calculations \n", + "T1=t1-t2\t\t#Temperature difference in degree centigrade\n", + "Q1=(K1*A*T1)/(x1)\t#Heat loss without insulation in kJ/hr/m**2\n", + "R1=(K1*A)/(x1)\t#Heat loss for the change in temperature for refractory brick wall material in kJ/hrC\n", + "R2=(K2*A)/(x2)\t#Heat loss for the change in temperature for insulated brick wall material kJ/hrC\n", + "Q2=(t1-t3)/((1.0/R1)+(1.0/R2))\t#Heat loss with insulation in kJ/hr/m**2\n", + "Q3=Q1-Q2\t\t#Reduction in heat loss through the wall in kJ/hr/m**2\n", + "\n", + "#Output\n", + "print'The reduction in heat loss through the wall is ',round(Q3,1),\"kJ/hr/m**2\"\n", + "print\"\\nNOTE:Answer wrongly written in book as 1951.4\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The reduction in heat loss through the wall is 19517.2 kJ/hr/m**2\n", + "\n", + "NOTE:Answer wrongly written in book as 1951.4\n" + ] + } + ], + "prompt_number": 95 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.17 page no:241" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Input data\n", + "L=4.6\t \t #Length of the wall in m\n", + "b=2.3\t \t#Breadth of the wall in m\n", + "x1=0.025\t\t#Thickness of the wood in m\n", + "x2=0.075\t\t#Thickness of the cork slabbing in m\n", + "x3=0.115\t\t#Thickness of the brick in m\n", + "t1=18.0\t\t #Exterior temperature of the wall in degree centigrade\n", + "t4=-20.0\t\t#Interior temperature of the wall in degree centigrade\n", + "K1=7.5 \t\t #Thermal conductivity of the wood in kJ/hr mC\n", + "K2=1.9 \t\t #Thermal conductivity of the wood in kJ/hr.mC\n", + "K3=41.0\t\t #Thermal conductivity of the brick in kJ/hr mC\n", + "\n", + "#Calculations\n", + "A=L*b\t\t#Area of the wall in m**2\n", + "R1=(K1*A)/(x1)\t#Heat loss for the change in temperature for insulated wood material in kJ/hrC\n", + "R2=(K2*A)/(x2)\t#Heat loss for the change in temperature for cork material in kJ/hrC\n", + "R3=(K3*A)/(x3)\t#Heat loss for the change in temperature for brick in kJ/hrC\n", + "Q=(t1-t4)/((1.0/R1)+(1.0/R2)+(1.0/R3))\t#Heat loss with insulation in kJ/hr\n", + "Q1=Q*24.0\t\t#Heat loss with insulation in kJ/24hr\n", + "t2=t1-(Q/R1)\t#Interface temperature t2 in degree centigrade \n", + "t3=t2-(Q/R2)\t#Interface temperature t3 in degree centigrade\n", + "\n", + "#Output \n", + "print'(a)The leakage through the wall per 24 hours is',round(Q,2),\"kJ/hr=\",round(Q,2)*24 \n", + "print'(b)Temperature at the interface is',round(t2,3),\"C\" \n", + "print'(c)Temperature at interface ',round(t3,3),\"C\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)The leakage through the wall per 24 hours is 8814.37 kJ/hr= 211544.88\n", + "(b)Temperature at the interface is 15.223 C\n", + "(c)Temperature at interface -17.663 C\n" + ] + } + ], + "prompt_number": 96 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.18 page no:243" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Input data\n", + "L=0.3\t\t#Thickness of the wall in m\n", + "ti=320\t\t#Inner surface temperature in degree centigrade\n", + "to=38\t\t#Outer surface temperature in degree centigrade\n", + "A=1\t\t#Assume unit area in m**2\n", + "\n", + "#Calculations\n", + "Q=(A/L)*((0.01256/2)*(ti**2-to**2)-(4.2/3)*10**-6*(ti**3-to**3)) #Heat loss per sq metre of surface area\n", + "\n", + "#Output\n", + "print'The heat loss per sq metre of surface area for a furnace wall is',round(Q,2),\"kJ/hr/m**2 \"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The heat loss per sq metre of surface area for a furnace wall is 1960.68 kJ/hr/m**2 \n" + ] + } + ], + "prompt_number": 97 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.19 page no:245" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Input data\n", + "d=11.5\t\t#Outer diameter of steam pipe line in cm\n", + "t1=5.0\t\t#Thickness of first layer in cm\n", + "K1=0.222\t\t#Thermal conductivity of first layer in kJ/hr mC\n", + "t2=3.0\t\t#Thickness of second layer in cm\n", + "pi=3.1428\t\t#Constant value of pi\n", + "K2=3.14\t\t#Thermal conductivity of second layer in kJ/hr mC\n", + "T1=235\t\t#Outside surface temperature of steam pipe in degree centigrade\n", + "T3=38\t\t#Outer surface of lagging in degree centigrade\n", + "L=1.0\t\t#Length of the pipe in m\n", + "\n", + "#Calculations\n", + "I=math.log((d+(2*t1))/d)\t\t\t#For inner layer calculation\n", + "O=math.log((d+(2*t1)+(2*t2))/(d+(2*t1)))\t\t#For outer layer calculations\n", + "R1=(2.0*pi*L*K1)/I\t\t#Heat loss for change in temperature for first insulated material in kJ/hC\n", + "R2=(2.0*pi*L*K2)/O\t\t#Heat loss for the change in temperature for second insulated material in kJ/hC\n", + "Q=(T1-T3)/(1.0/R1+1.0/R2)\t#Heat loss per metre length of pipe per hr in kJ/hr\n", + "T2=T1-(Q/R1)#Temperature between the two layers of insulation in degree centigrade\n", + "\n", + "#Output\n", + "print'(a)The heat loss per metre length of pipe per hr is',round(Q,2),\" kJ/hr\" \n", + "print'(b)Temperature between the two layers of insulation is',round(T2,2),\"C\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)The heat loss per metre length of pipe per hr is 427.45 kJ/hr\n", + "(b)Temperature between the two layers of insulation is 43.33 C\n" + ] + } + ], + "prompt_number": 98 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.20 page no:247" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Input data\n", + "t1=24.0 \t#Temperature at the outside surface in degree centigrade \n", + "t4=-15.0 \t#Temperature at the inner surface in degree centigrade\n", + "A=1.0 \t\t#Assuming unit area in m**2\n", + "K1=23.2\t\t#Thermal conductivity of steel in W/mC\n", + "K2=0.014\t\t#Thermal conductivity of glasswood in W/mC\n", + "K3=0.052\t\t#Thermal conductivity of plywood in W/mC\n", + "x1=0.0015\t\t#Thickness of steel sheet at outer surface in m\n", + "x2=0.02\t\t#Thickness of glasswood in between in m\n", + "x3=0.01\t\t#Thickness of plywood at a inner surface in m\n", + "\n", + "#Calculations\n", + "R1=(K1*A)/x1\t#Heat loss for the change in temperature for first insulated material\n", + "R2=(K2*A)/x2\t#Heat loss for the change in temperature for second insulated material\n", + "R3=(K3*A)/x3\t#Heat loss for the change in temperature for third insulated material\n", + "Q=(t1-t4)/(1/R1+1/R2+1/R3)\t#The rate of heat flow in W/m**2\n", + "\n", + "#Output\n", + "print'The rate of heat flow is',round(Q,2),\"W/m**2 \"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The rate of heat flow is 24.06 W/m**2 \n" + ] + } + ], + "prompt_number": 21 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch1-checkpoint.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch1-checkpoint.ipynb new file mode 100644 index 00000000..c32c32f6 --- /dev/null +++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch1-checkpoint.ipynb @@ -0,0 +1,300 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:24494f10d2186cdcb9bb7efdf5bb782c5e073da13a9c9e6466d2071310209ca3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 1 : Introduction" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.1 page no : 6\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#variables\n", + "m_total=100.0; #lbm\n", + " \n", + "m_sand=0.7*m_total; #lbm\n", + "m_water=0.3*m_total; #lbm\n", + "rho_sand=165.0; #lbm/ft^3\n", + "rho_water=62.3; #lbm/ft^3\n", + "\n", + "#calculation\n", + "#rho=mass/volume\n", + "rho_mud=m_total/((m_sand/rho_sand)+(m_water/rho_water));\n", + "\n", + "#result\n", + "print \"The density of mud=\" ,rho_mud, \"lbm/ft^3\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The density of mud= 110.401675438 lbm/ft^3\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.2 page no : 8\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# variables\n", + "D1=25.15 #mm\n", + "D2=27.62 #mm\n", + "dr=0.5*(D2-D1) #mm\n", + "f=10. #rpm\n", + "\n", + "# calculations\n", + "Vo=math.pi*D1*f/60. #mm/s\n", + "#Let D denote d/dr\n", + "DV=Vo/dr #s^-1\n", + "tow=0.005 #Nm\n", + "L=92.37 #mm\n", + "s=2*tow/D1**2/(math.pi)/L*(10**6) #N/m^2\n", + "\n", + "# result\n", + "print \"The stress at the surface of the inner cylinder is %f N/m^2\"%s " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The stress at the surface of the inner cylinder is 0.054481 N/m^2\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.3 page no : 15\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# variablees\n", + "l=0.10; #m (length of sliding part)\n", + "f=0.00589; #N (pull due to 0.6 gm of mass)\n", + "\n", + "#calculation\n", + "f_onefilm=f/2; #N\n", + "#surface tension=(force for one film)/(length)\n", + "sigma=f_onefilm/l;\n", + "\n", + "# result\n", + "print \"The surface tension of fluid is\",sigma,\"N/m\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The surface tension of fluid is 0.02945 N/m\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.4 page no : 20\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variables\n", + "V=327. #miles/hr\n", + "#1 mile = 5280 ft\n", + "#1 hour = 3600 sec\n", + "\n", + "# calculation\n", + "V1=V*5280/3600.0#ft/s\n", + "\n", + "# result\n", + "print \"327 miles/hr = %f ft/s\"%V1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "327 miles/hr = 479.600000 ft/s\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.5 page no : 21\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variables\n", + "t=2.6 #hr\n", + "#1 hr = 3600 s\n", + "\n", + "# calculations\n", + "t1=2.6*3600 #s\n", + "\n", + "# result\n", + "print \"2.6 hours = %f seconds\"%t1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "2.6 hours = 9360.000000 seconds\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.6 page no : 24\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#\n", + "# variables\n", + "m=10. #lbm\n", + "F=3.5 #lbf\n", + "#1 lbf.s^2 = 32.2 lbm.ft\n", + "#1 min = 60 sec\n", + "\n", + "# calculations\n", + "a=F*32.2*60**2/m #ft/min^2\n", + "\n", + "# result\n", + "print \"The acceleration provided is %f ft/min^2\" % a" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The acceleration provided is 40572.000000 ft/min^2\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.7 page no : 24\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# variables\n", + "I=50000. #Ampere or Coulumbs/sec\n", + "#1 hr = 3600 sec\n", + "I1=50000*3600. #C/hr\n", + "\n", + "#calculation\n", + "#96500 C = 1 gm.eq\n", + "#1 mole of aluminium = 3 gm.eq\n", + "#1 mole of aluminium = 27 gm\n", + "m=I1*(1.0/96500)*(27/3.0)/1000.0 #Kg/hr\n", + "\n", + "#result\n", + "print \"the wt of metallic aluminium deposited in an electrolytic cell is %f Kg/hr\"%m" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the wt of metallic aluminium deposited in an electrolytic cell is 16.787565 Kg/hr\n" + ] + } + ], + "prompt_number": 9 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch10-checkpoint.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch10-checkpoint.ipynb new file mode 100644 index 00000000..e4b7fe7d --- /dev/null +++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch10-checkpoint.ipynb @@ -0,0 +1,789 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:9f0f51ee792551db4a5ae3ded00fa549611bdd66fece52d68af61c7a164f38e5" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 10 : Material Balances for Processes Involving Reaction" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 10.1 Page no. 264\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "F = 100 # feed to the reactor-[g mol]\n", + "CH4 = 0.4*F # [g mol]\n", + "Cl2 = 0.5*F ; # [g mol]\n", + "N2= 0.1*F ; #[g mol]\n", + "\n", + "nio_CH4 = CH4 #[g mol CH4]\n", + "vi_CH4 = -1 # coefficint of CH4\n", + "\n", + "\n", + "# Calculation and Result\n", + "ex_CH4 = -(nio_CH4)/vi_CH4 # Max. extent of reaction based on CH4\n", + "\n", + "nio_Cl2 = Cl2 ; #[g mol Cl2]\n", + "vi_Cl2 = -1 ; # coefficint of Cl2\n", + "ex_Cl2 = -(nio_Cl2)/vi_Cl2 ; # Max. extent of reaction based on Cl2\n", + "\n", + "if (ex_Cl2 > ex_CH4 ):\n", + " print ' CH4 is limiting reactant '\n", + "else:\n", + " print ' (b) Cl2 is limiting reactant '\n", + "\n", + "cn_CH4 = 67/100.0 ; # percentage conversion of CH4\n", + "ex_r = (-cn_CH4)*CH4/vi_CH4 ; # extent of reaction\n", + "\n", + "print ' extent of reaction is %.1f g moles reacting '%ex_r\n", + "\n", + "n_un = 11 ; # Number of unknowns in the given problem\n", + "n_ie = 11 ; # Number of independent equations\n", + "d_o_f = n_un-n_ie ; # Number of degree of freedom\n", + "print ' Number of degree of freedom for the given system is %i '%d_o_f\n", + "\n", + "vi_CH3Cl = 1;\n", + "vi_HCl = 1;\n", + "vi_N2 = 0;\n", + "p_CH4 = CH4+(vi_CH4*ex_r); # [g mol]\n", + "p_Cl2 = Cl2+(vi_Cl2*ex_r); # [g mol]\n", + "p_CH3Cl = 0+(vi_CH3Cl*ex_r); # [g mol]\n", + "p_HCl = 0+(vi_HCl*ex_r); # [g mol]\n", + "p_N2 = N2+(vi_N2*ex_r); # [g mol]\n", + "\n", + "print 'Composition of product stream in %% g mol of products'\n", + "print 'Product Percentage g mol'\n", + "print 'CH4 %.1f%% g mol'%p_CH4\n", + "print 'Cl2 %.1f%% g mol'%p_Cl2\n", + "print 'CH3Cl %.1f%% g mol'%p_CH3Cl\n", + "print 'HCl %.1f%% g mol'%p_HCl\n", + "print 'N2 %.1f%% g mol'%p_N2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " CH4 is limiting reactant \n", + " extent of reaction is 26.8 g moles reacting \n", + " Number of degree of freedom for the given system is 0 \n", + "Composition of product stream in %% g mol of products\n", + "Product Percentage g mol\n", + "CH4 13.2% g mol\n", + "Cl2 23.2% g mol\n", + "CH3Cl 26.8% g mol\n", + "HCl 26.8% g mol\n", + "N2 10.0% g mol\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 10.2 Page no. 266\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables \n", + "S = 5000. ; # Sulphur [lb]\n", + "CH4 = 80. ; # [%]\n", + "H2S = 20.; # [%]\n", + "\n", + "n_un = 11. ;\n", + "n_ie = 11. ;\n", + "\n", + "# Calculation and Result\n", + "d_o_f = n_un-n_ie ;\n", + "print 'Number of degree of freedom for the given system is %i '%d_o_f\n", + "\n", + "m_S = 32.0 #molecular wt. of S -[lb]\n", + "mol_S = S/32.0;\n", + "nio_S = 0 #[g mol S]\n", + "ni_S = mol_S ; #[g mol S]\n", + "vi_S = 3. # coefficint of S -from given reaction\n", + "ex_r = (ni_S-nio_S)/vi_S ; # Extent of reaction based on S\n", + "print ' Extent of reaction is %.1f g moles reacting '%ex_r\n", + "\n", + "vi_H2O = 2. ; # coefficint of H2O\n", + "vi_H2S = -2. ; # coefficint of H2S\n", + "vi_SO2 = -1. ; #coefficint of SO2\n", + "vi_CH4 = 0 ; #coefficint of CH4\n", + "P_H2O = 0+(vi_H2O*ex_r); # [lb mol]\n", + "P_H2S = P_H2O/10 ; #[lb mol]\n", + "P_SO2 = 3.*P_H2S ; #[lb mol]\n", + "\n", + "F = (P_H2S-vi_H2S*ex_r)/(H2S/100) ; # total feed-[lb mol]\n", + "F_SO2 = P_SO2-(vi_SO2*ex_r); # feed rate of SO2- [lb mol]\n", + "F_CH4 = (CH4/100.)*F+vi_CH4*ex_r ; #feed rate of CH4- [lb mol]\n", + "F_H2S = ((H2S/100.)*F) ; # feed rate of H2S-[lb mol]\n", + "\n", + "f_cn = -(vi_H2S*ex_r)/((H2S/100.)*F) # Fractional conversion of limiting reagent\n", + "\n", + "print '(1)Feed rate of H2S- %.1f lb mol'%F_H2S\n", + "print '(2)Feed rate of SO2- %.1f lb mol'%F_SO2\n", + "print '(3)Fractional conversion of limiting reagent- %.2f '%f_cn" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of degree of freedom for the given system is 0 \n", + " Extent of reaction is 52.1 g moles reacting \n", + "(1)Feed rate of H2S- 114.6 lb mol\n", + "(2)Feed rate of SO2- 83.3 lb mol\n", + "(3)Fractional conversion of limiting reagent- 0.91 \n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 10.3 Page no. 270\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables \n", + "F = 1 #CH3OH -[gmol]\n", + "f_cn = 90. #[%]\n", + "vi_CH3OH = -1. #coefficint of CH3OH\n", + "\n", + "# Calculation and Result\n", + "ex_r1 = (-90./100)/vi_CH3OH # Extent of reaction based on CH3OH \n", + "print ' Extent of reaction 1 is %.2f g moles reacting '%ex_r1\n", + "\n", + "yld = 75. #[%]\n", + "ex_r2 = ex_r1-(F*(yld/100.0));\n", + "print ' Extent of reaction 2 is %.2f g moles reacting '%ex_r2\n", + "\n", + "f_O2 = 0.21 # mol. fraction of O2\n", + "f_N2 = 0.79 # mol. fraction of N2\n", + "n_O2 = 2*((1/2.0)*F) # entering oxygen -[g mol]\n", + "air = n_O2/f_O2 # Amount of air entering\n", + "n_N2 = air-n_O2 # entering nitrogen -[g mol]\n", + "\n", + "n_un = 11. # Number of unknowns in the given problem\n", + "n_ie = 11. # Number of independent equations\n", + "d_o_f = n_un-n_ie # Number of degree of freedom\n", + "print ' Number of degree of freedom for the given system is %i '%d_o_f\n", + "\n", + "v1_CH3OH = -1 #coefficint of CH3OH\n", + "v1_O2 = -1./2 #coefficint of O2\n", + "v1_CH2O = 1 ; #coefficint of CH2O\n", + "v1_H2O = 1 ; #coefficint of H2O\n", + "v1_CO = 0 ; #coefficient of CO\n", + "\n", + "#Reaction 2\n", + "v2_O2 = -1./2 #coefficint of O2\n", + "v2_CH2O = -1 #coefficint of CH2O\n", + "v2_H2O = 1 ; #coefficint of H2O\n", + "v2_CO = 1 ; #coefficient of CO\n", + "P = F+air +(v1_CH3OH+v1_O2+v1_CH2O+v1_H2O)*ex_r1 +(v2_O2+v2_CH2O+v2_H2O+v2_CO)*ex_r2 ;# Product -[g mol]\n", + "\n", + "no_CH3OH = F+(v1_CH3OH*ex_r1)+0 ; # [g mol]\n", + "no_O2 = n_O2+(v1_O2*ex_r1)+v2_O2*ex_r2 ; # [g mol]\n", + "no_CH2O = 0 + v1_CH2O*ex_r1 +v2_CH2O*ex_r2 ; #[g mol]\n", + "no_CO = 0+v1_CO*ex_r1 +v2_CO*ex_r2 ; #[g mol]\n", + "no_H2O = 0+v1_H2O*ex_r1+v2_H2O*ex_r2 ; # [g mol]\n", + "no_N2 = n_N2-0-0 ; # [g mol]\n", + "\n", + "\n", + "y_CH3OH = (no_CH3OH/P )*100 ; # mole %\n", + "y_O2 = (no_O2/P)*100 ; # mole %\n", + "y_CH2O = (no_CH2O/P)*100 ; # mole %\n", + "y_CO = (no_CO/P)*100 ; # mole %\n", + "y_H2O = (no_H2O/P)*100 ; # mole % \n", + "y_N2 = (no_N2/P )*100; # mole %\n", + "\n", + "print 'Composition of product'\n", + "print 'Component mole percent'\n", + "print ' CH3OH %.1f %%'%y_CH3OH\n", + "print ' O2 %.1f %%'%y_O2\n", + "print ' CH2O %.1f %%'%y_CH2O\n", + "print ' CO %.1f %%'%y_CO\n", + "print ' H2O %.1f %%'%y_H2O\n", + "print ' N2 %.1f %%'%y_N2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Extent of reaction 1 is 0.90 g moles reacting \n", + " Extent of reaction 2 is 0.15 g moles reacting \n", + " Number of degree of freedom for the given system is 0 \n", + "Composition of product\n", + "Component mole percent\n", + " CH3OH 1.6 %\n", + " O2 7.6 %\n", + " CH2O 11.9 %\n", + " CO 2.4 %\n", + " H2O 16.7 %\n", + " N2 59.8 %\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 10.4 Page no. 273\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from numpy import matrix\n", + "\n", + "# Variables \n", + "F = 4000. ; #[kg]\n", + "m_H2O = 18.02 ; # molecular masss of water\n", + "m_C6H12O6 = 180.1 ; # molecular mass of glucose\n", + "m_CO2 = 44. ; #molecular mass of CO2\n", + "m_C2H3CO2H = 72.03 ; # molecular mass of C2H3CO2H\n", + "m_C2H5OH = 46.05 ; # molecular mass of ethanol\n", + "\n", + "p_H2O = 88. ; # [%]\n", + "p_C6H12O6 = 12.; # [%] \n", + "\n", + "# Calculation & Result\n", + "ni_H2O = (F*p_H2O/100.)/m_H2O ; # initial moles of water\n", + "ni_C6H12O6 = (F*(p_C6H12O6/100.))/m_C6H12O6 ; # initial moles of glucose\n", + "\n", + "n_un = 9. \n", + "n_ie = 9. \n", + "d_o_f = n_un-n_ie\n", + "print 'Number of degree of freedom for the given system is %i '%d_o_f\n", + "\n", + "ur_C6H12O6 = 90. ; #[kg]\n", + "pr_CO2 = 120. ; #[kg]\n", + "nf_C6H12O6 = ur_C6H12O6/m_C6H12O6 ; # [kmoles]\n", + "nf_CO2 = pr_CO2/m_CO2 ; # [kmoles]\n", + "\n", + "\n", + "a = matrix([[-1,-1],[2,0]]); # matrix formed by coefficients of unknowns \n", + "b = matrix([[(nf_C6H12O6-ni_C6H12O6)],[nf_CO2]]); #matrix formed by constant\n", + "x = a**(-1)*b; #matrix formed by solution\n", + " \n", + "print ' Extent of reaction 1 is %.3f kg moles reacting '%x[0]\n", + "print ' Extent of reaction 2 is %.3f kg moles reacting '%x[1]\n", + "\n", + "nf_H2O = ni_H2O+0*x[0] +2*x[1]; \n", + "nf_C2H5OH = 0+2*x[0]+0*x[1];\n", + "nf_C2H3CO2H = 0+0*x[0]+2*x[1]\n", + "total_wt = m_H2O*nf_H2O + m_C6H12O6*nf_C6H12O6 + m_CO2*nf_CO2 + \\\n", + "m_C2H3CO2H*nf_C2H3CO2H + m_C2H5OH*nf_C2H5OH;\n", + "mp_C2H5OH = (m_C2H5OH*nf_C2H5OH*100)/total_wt \n", + "mp_C2H3CO2H = (m_C2H3CO2H*nf_C2H3CO2H*100)/total_wt\n", + "\n", + "print ' Mass percent of ethanol in broth at end of fermentation process is %.1f %%'%mp_C2H5OH\n", + "print ' Mass percent of propenoic acid in broth at end of fermentation process is %.1f %%'%mp_C2H3CO2H" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of degree of freedom for the given system is 0 \n", + " Extent of reaction 1 is 1.364 kg moles reacting \n", + " Extent of reaction 2 is 0.802 kg moles reacting \n", + " Mass percent of ethanol in broth at end of fermentation process is 3.1 %\n", + " Mass percent of propenoic acid in broth at end of fermentation process is 2.9 %\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 10.5 Page no. 279\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from numpy import matrix\n", + "\n", + "# Variables \n", + "\n", + "print '(a)Solution of Example 10.1 using element balance'\n", + "F = 100 # feed to the reactor-[g mol]\n", + "\n", + "CH4 = 0.4*F ; # [g mol]\n", + "Cl2 = 0.5*F ; # [g mol]\n", + "N2 = 0.1*F #[g mol]\n", + "\n", + "n_un = 10 # Number of unknowns in the given problem(excluding extent of reaction)\n", + "n_ie = 10 ; # Number of independent equations\n", + "d_o_f = n_un-n_ie # Number of degree of freedom\n", + "print ' Number of degree of freedom for the given system is %i '%d_o_f\n", + "\n", + "nio_CH4 = CH4 ; #[g mol CH4]\n", + "vi_CH4 = -1; # coefficint of CH4\n", + "\n", + "# Calculation and Result\n", + "ex_CH4 = -(nio_CH4)/vi_CH4 ; # Max. extent of reaction based on CH4\n", + "\n", + "\n", + "nio_Cl2 = Cl2 #[g mol Cl2]\n", + "vi_Cl2 = -1 # coefficint of Cl2\n", + "ex_Cl2 = -(nio_Cl2)/vi_Cl2 # Max. extent of reaction based on Cl2\n", + "\n", + "if (ex_Cl2 > ex_CH4 ): \n", + " print ' CH4 is limiting reactant '\n", + "else:\n", + " print ' (b) Cl2 is limiting reactant '\n", + "\n", + "cn_CH4 = 67.0/100 # percentage conversion of CH4(limiting reagent)\n", + "no_CH4 = CH4-(cn_CH4*CH4) ; #CH4 in product -[g mol]\n", + "\n", + "no_N2 = N2 #N2 in product -[g mol]\n", + "\n", + "C = CH4 ; #moles of CH4 = moles of C (by molecular formula)\n", + "H = 4*CH4 ; # moles of H = 4*moles of CH4 (by molecular formula)\n", + "Cl = 2*Cl2 ; # moles of Cl = 2* moles of Cl2 (by molecular formula)\n", + "\n", + "a = matrix([[0,0,1],[0,1,3],[2,1,1]]) # matrix formed by coefficients of unknowns \n", + "b = matrix([[C-no_CH4*1],[H-4*no_CH4],[Cl]]) ; #matrix formed by constant\n", + "x = a**(-1)*b ; # matrix of solution\n", + "\n", + "print 'Composition of product stream in %% g mol of products'\n", + "print 'Product Percentage g mol'\n", + "print 'CH4 %.1f%% g mol'%no_CH4\n", + "print 'Cl2 %.1f%% g mol'%x[0]\n", + "print 'CH3Cl %.1f%% g mol'%x[2]\n", + "print 'HCl %.1f%% g mol'%x[1]\n", + "print 'N2 %.1f%% g mol'%no_N2\n", + "\n", + "#(b)Solution of Example 10.3 using element balance\n", + "print '______________________________________________________________________________'\n", + "print '(b)Solution of Example 10.3 using element balance'\n", + "\n", + "F = 1 #CH3OH -[gmol]\n", + "yld = 75 #[%]\n", + "cnv = 90 ; #conversion of methanol-[%]\n", + "\n", + "f_O2 = 0.21 ; # mol. fraction of O2\n", + "f_N2 = 0.79 ; # mol. fraction of N2\n", + "n_O2 = 2*((1/2.0)*F) # entering oxygen -[g mol]\n", + "air = n_O2/f_O2 ; # Amount of air entering\n", + "n_N2 = air-n_O2 # entering nitrogen -[g mol]\n", + "\n", + "n_un = 9 # Number of unknowns in the given problem(excluding extent of reactions)\n", + "n_ie = 9 ; # Number of independent equations\n", + "d_o_f = n_un-n_ie # Number of degree of freedom\n", + "\n", + "print ' Number of degree of freedom for the given system is %i '%d_o_f\n", + "\n", + "no_N2 = n_N2 # inert ,terefore input = output\n", + "C = 1*F #moles of C = moles of CH3OH (by molecular formula)\n", + "H = 4*F ; #moles of H = 4*moles of CH3OH (by molecular formula)\n", + "O = 1*F +2*n_O2; # moles of O = 1*moles of CH3OH + O in air\n", + "no_CH2O = yld/100.0 #[g mol]\n", + "no_CH3OH = F-((cnv/100.0)*F) # [g mol]\n", + "\n", + "a = matrix([[0,0,1],[0,2,0],[2,1,1]]) # matrix formed by coefficients of unknowns \n", + "b = matrix([[(C-(no_CH3OH*1+no_CH2O*1))],[(H-(4*no_CH3OH+2*no_CH2O))],[(O-(no_CH3OH*1+no_CH2O*1))]]);\n", + "a = a.I\n", + "x = a * b ; # matrix of solution\n", + "\n", + "P = no_CH2O+no_CH3OH+no_N2+x[0]+x[1]+x[2];\n", + "\n", + "# Composition of product\n", + "y_CH3OH = (no_CH3OH/P )*100; # mole %\n", + "y_O2 = ((x[0])/P)*100; # mole %\n", + "y_CH2O = (no_CH2O/P)*100 ; # mole %\n", + "y_CO = (x[2]/P)*100 ; # mole %\n", + "y_H2O = (x[1]/P)*100 ; # mole % \n", + "y_N2 = (no_N2/P )*100; # mole %\n", + "\n", + "\n", + "print 'Composition of product'\n", + "print 'Component mole percent'\n", + "print ' CH3OH %.1f %%'%y_CH3OH\n", + "print ' O2 %.1f %%'%y_O2\n", + "print ' CH2O %.1f %%'%y_CH2O\n", + "print ' CO %.1f %%'%y_CO\n", + "print ' H2O %.1f %%'%y_H2O\n", + "print ' N2 %.1f %%'%y_N2\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)Solution of Example 10.1 using element balance\n", + " Number of degree of freedom for the given system is 0 \n", + " CH4 is limiting reactant \n", + "Composition of product stream in %% g mol of products\n", + "Product Percentage g mol\n", + "CH4 13.2% g mol\n", + "Cl2 23.2% g mol\n", + "CH3Cl 26.8% g mol\n", + "HCl 26.8% g mol\n", + "N2 10.0% g mol\n", + "______________________________________________________________________________\n", + "(b)Solution of Example 10.3 using element balance\n", + " Number of degree of freedom for the given system is 0 \n", + "Composition of product\n", + "Component mole percent\n", + " CH3OH 1.6 %\n", + " O2 7.6 %\n", + " CH2O 11.9 %\n", + " CO 2.4 %\n", + " H2O 16.7 %\n", + " N2 59.8 %\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 10.6 Page no. 281\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from numpy import matrix\n", + "\n", + "# Variables \n", + "P=100. ; #Product from the reactor-[g mol]\n", + "C3H8 = 0.195*P ; # [g mol]\n", + "C4H10 = 0.594*P ; # [g mol]\n", + "C5H12 = 0.211*P; # [g mol]\n", + "\n", + "n_un = 3 ; # Number of unknowns in the given problem(excluding extent of reaction)\n", + "n_ie = 3 ; # Number of independent equations\n", + "\n", + "# Calculation and Result\n", + "d_o_f = n_un-n_ie ; # Number of degree of freedom\n", + "print 'Number of degree of freedom for the given system is %i '%d_o_f\n", + "\n", + "C = C3H8*3+C4H10*4+C5H12*5 # moles of C on product side\n", + "H = C3H8*8+C4H10*10+C5H12*12 ; # moles of H on product side\n", + "\n", + "a = matrix([[8,0],[18,2]]) # matrix formed by coefficients of unknowns \n", + "b = matrix([[C],[H]]) ; #matrix formed by constant\n", + "a = a.I\n", + "x = a*b ; # matrix of solution\n", + "\n", + "R = x[1]/x[0] ; # Ratio of H2 consumed to C8H18 reacted = G/F\n", + "print ' Molar ratio of H2 consumed to C8H18 reacted is %.3f '%R" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of degree of freedom for the given system is 0 \n", + " Molar ratio of H2 consumed to C8H18 reacted is 0.992 \n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 10.7 Page no. 286\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables \n", + "C3H8 = 20 #C3H8 burned in a test-[kg]\n", + "m_C3H8 = 44.09 # mol. wt . of 1 kmol C3H8\n", + "cf_O2 = 5 # coefficient of O2 in given reaction\n", + "air = 400 # Air given -[kg]\n", + "m_air = 29.0 # molecular wt. of 1kmol air-[kg]\n", + "O2p = 21 # percentage of O2 in air-[%]\n", + "p_CO2 = 44 # CO2 produced -[kg]\n", + "p_CO = 12 # CO produced -[kg]\n", + "\n", + "# Calculation \n", + "O2 = (air*O2p/100.0)/(m_air) # amount of entering O2-[k mol]\n", + "rqO2 = (C3H8*cf_O2)/(m_C3H8) # Required O2 for given reaction\n", + "ex_air = ((O2-rqO2)*100.0)/rqO2 ; # Excess air percent-[%]\n", + "\n", + "# Result\n", + "print 'Excess air percent is %.0f %%.'%ex_air" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Excess air percent is 28 %.\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 10.8 Page no. 287\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "F = 16. # feed of CH4 -[kg]\n", + "CH4p = 100. #[%]\n", + "m_CH4 = 16. ; # mass of kmol of CH4-[kg]\n", + "mol_CH4 = (F*CH4p/100)/m_CH4 #k moles of CH4 in feed-[kmol]\n", + "air = 300. ; # Air given -[kg]\n", + "m_air = 29. # molecular wt. of 1kmol air-[kg]\n", + "mol_air = air/m_air ; # kmoles of air-[kmol]\n", + "O2p = 21. # percentage of O2 in air-[%]\n", + "O2 = (mol_air*O2p/100) # amount of entering O2-[k mol]\n", + "N2 = mol_air-O2 ; # amount of entering N2-[k mol]\n", + "\n", + "n_un = 8. # Number of unknowns in the given problem(excluding extent of reactions)\n", + "n_ie = 8. # Number of independent equations\n", + "d_o_f = n_un-n_ie # Number of degree of freedom\n", + "print 'Number of degree of freedom for the given system is %i '%d_o_f\n", + "\n", + "# Product composition analysis using element balance of C,H,O and N\n", + "p_N2 = N2 # inert \n", + "C_in = 1*mol_CH4 ; # kmoles of carbon in input-[kmol]\n", + "H_in = 4*mol_CH4 # kmoles of hydrogen in input-[kmol]\n", + "O_in = 2*O2 ; # kmoles of oxygen in input-[kmol]\n", + "p_CO2 = C_in/1 ; #kmoles of CO2 in product obtained by carbon balance-[kmol]\n", + "p_H2O = H_in/2 ; #kmoles of H2O in product obtained by hydrogen balance-[kmol]\n", + "p_O2 = (O_in-(2*p_CO2+p_H2O))/2 #kmoles of O2 in product obtained by oxygen balance-[kmol]\n", + "p_CH4 = 0 # Complete reaction occurs\n", + "P = p_CH4 + p_N2+ p_CO2 + p_H2O + p_O2;\n", + "\n", + "y_N2 = p_N2*100/P ; #[mol %]\n", + "y_CO2 = p_CO2*100/P ; #[mol %]\n", + "y_H2O = p_H2O*100/P ; #[mol %]\n", + "y_O2 = p_O2*100/P ; #[mol %]\n", + "y_CH4 = p_CH4*100/P ; #[mol %]\n", + "\n", + "# Results\n", + "print 'Composition of product'\n", + "print 'Component mole percent'\n", + "print ' CH4 %.1f %%'%y_CH4\n", + "print ' O2 %.1f %%'%y_O2\n", + "print ' CO2 %.1f %%'%y_CO2\n", + "print ' H2O %.1f %%'%y_H2O\n", + "print ' N2 %.1f %%'%y_N2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of degree of freedom for the given system is 0 \n", + "Composition of product\n", + "Component mole percent\n", + " CH4 0.0 %\n", + " O2 1.5 %\n", + " CO2 8.8 %\n", + " H2O 17.6 %\n", + " N2 72.0 %\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 10.9 Page no. 290\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "F = 100. # feed of coal -[lb]\n", + "C = 83.05 #[%]\n", + "H = 4.45 #[%]\n", + "O = 3.36 ; # [%]\n", + "N = 1.08 # [%]\n", + "S = 0.70 #[%]\n", + "ash = 7.36 #[%]\n", + "H2O = 3.9 ; #[%]\n", + "w_C = 12. ; # mol. wt. of C\n", + "w_H = 1.008; #mol. wt. of H\n", + "w_O = 16. ; # mol. wt. of O\n", + "w_N = 14. ; # mol. wt. of N\n", + "w_S = 32. ; #mol. wt. of S\n", + "\n", + "CO2 = 15.4 #[%]\n", + "CO = 0.0 #[%]\n", + "O2 = 4.0 ; # [%]\n", + "N2 = 80.6 #[%]\n", + "ash_R = 86 #[%]\n", + "odr = 14 #[%]\n", + "\n", + "H2O_air = .0048 # [lb H2O/lb dry air]\n", + "m_air = 29. # mol. wt. of air\n", + "mf_O2 = 0.21 # mole fraction of O2 in air\n", + "mf_N2 = 0.79 #mole fraction of N2 in air\n", + "m_H2O = 18. # mol. wt. of H2O\n", + "\n", + "#Calculations\n", + "H_cl = (H2O*2)/m_H2O ; # lb mol of H in coal moisture\n", + "O_cl = H_cl/2. ; # lb mol of O in coal moisture\n", + "\n", + "H_air = (H2O_air*m_air )/m_H2O # lb mol of H per lb mol air\n", + "O_air = H_air/2. # lb mol of O per lb mol air \n", + "\n", + "# Ash balance to get refuse(R)\n", + "R = ash/(ash_R/100.) # Refuse-[lb]\n", + "\n", + "pub_cl = 14. # percentage of unburned coal in refuse-[%]\n", + "ub_cl = (14/100.)*R # amount of unburned coal in refuse\n", + "C_p = (C/(100-ash))*ub_cl # C in unburned coal-[lb]\n", + "H_p = (H/(100-ash))*ub_cl ; # H in unburned coal-[lb]\n", + "O_p = (O/(100-ash))*ub_cl ; # O in unburned coal-[lb]\n", + "N_p = (N/(100-ash))*ub_cl ; # N in unburned coal-[lb]\n", + "S_p = (S/(100-ash))*ub_cl ; # S in unburned coal-[lb]\n", + "mol_C = C_p/w_C; # lb mol of C\n", + "mol_H = H_p/w_H ; # lb mol of H\n", + "mol_N = N_p/w_N ; # lb mol of N\n", + "mol_O = O_p/w_O ; # lb mol of O\n", + "mol_S = S_p/w_S ; # lb mol of S \n", + "\n", + "\n", + "n_un = 4. # Number of unknowns in the given problem(excluding extent of reactions)\n", + "n_ie = 4. # Number of independent equations\n", + "d_o_f = n_un-n_ie # Number of degree of freedom\n", + "print 'Number of degree of freedom for the given system is %i '%d_o_f\n", + "\n", + "#Using element balance of C+S, N& H\n", + "P = (C/w_C + S/w_S - (mol_C+mol_S ))/.154 # mol of stack gas-[lb mol]\n", + "A = (2*P*.806 +2*mol_N-N/w_N)/(2*mf_N2) # mol of air -[lb mol]\n", + "W = (H/w_H +H_cl+H_air*A-mol_H)/2 # moles of exit water-[lb mol]\n", + "print ' Moles of stack gas(P) - %.1f lb mol'%P\n", + "print ' Moles of air (A) - %.1f lb mol '%A\n", + "print ' Moles of exit water(W) - %.1f lb mol '%W\n", + "\n", + "C_req = (C/w_C)/1\n", + "H_req = (H/w_H)/4 \n", + "N_req = 0 # inert\n", + "O_req = (O/w_O)/2 \n", + "S_req = (S/w_S)/1 \n", + "total_O2_req = C_req+H_req+N_req+O_req +S_req \n", + "O2_in = A*mf_O2 # O2 entering in air\n", + "ex_air = 100*((O2_in-total_O2_req)/total_O2_req)\n", + "\n", + "# Results\n", + "print ' Excess air is %.1f %%.'%ex_air" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of degree of freedom for the given system is 0 \n", + " Moles of stack gas(P) - 44.5 lb mol\n", + " Moles of air (A) - 45.4 lb mol \n", + " Moles of exit water(W) - 2.6 lb mol \n", + " Excess air is 16.8 %.\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "code", + "collapsed": true, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch11-checkpoint.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch11-checkpoint.ipynb new file mode 100644 index 00000000..70f855c2 --- /dev/null +++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch11-checkpoint.ipynb @@ -0,0 +1,497 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:03c09e4ffd933027d277b1c64cc2c94bd3c72b7cbc229c1b8170ffd14e813958" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 11 : Material Balance Problems involving Multiple Units" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 11.1 Page no. 311\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables \n", + "\n", + "w_A1 = 1 #concentration of A in 1\n", + "w_B2 = 1 # concentration of B in 2\n", + "w_A3 = 0.8 # concentration of A in 3\n", + "w_B3 = 0.2 # concentration of B in 3\n", + "w_C4 = 1 # concentration of C in 4\n", + "w_A5 = 0.571 #concentration of A in 5\n", + "w_B5 = 0.143 #concentration of B in 5\n", + "w_C5 = 0.286 #concentration of C in 5\n", + "w_D6 = 1 # concentration of D in 6\n", + "w_A7 = 0.714 # concentration of A in 7\n", + "w_B7 = 0.286 # concentration of B in 7\n", + "w_B8 = 0.333 #concentration of B in 8\n", + "w_C8 = .667 #concentration of C in 8\n", + "\n", + "us1 = 2 # Species involved in unit 1\n", + "us2 = 3 ; # Species involved in unit 2\n", + "us3 = 4 ; # Species involved in unit 3\n", + "\n", + "# Caculations \n", + "total_sp = us1+us2+us3 # Total species in system\n", + "\n", + "# Results\n", + "print 'Number of possible equations are 9, they are as follows- '\n", + "print ' Subsystem 1'\n", + "print ' A: F1*w_A1+F2*0 = F3*w_A3 (a)'\n", + "print ' B:F1*0 + F2*w_B2 = F3*w_B3 (b)'\n", + "print ' Subsystem 2'\n", + "print ' A: F3*w_A3+F4*0 = F5*w_A5 (c)'\n", + "print ' B:F3*w_B3 + F4*0 = F5*w_B5 (d)'\n", + "print ' C: F3*0+F4*w_C4 = F5*w_C5 (e)'\n", + "print ' Subsystem 3'\n", + "print ' A: F5*w_A5+F6*0 = F7*w_A7+F8*0 (f)'\n", + "print ' B:F5*w_B5 + F6*0 = F7*0+F8*w_B8 (g)'\n", + "print ' C: F5*w_C5+F6*0 = F7*0+F8*w_C8 (h)'\n", + "print ' D:F5*w_C5+F6*0 = F7*0+F8*w_C8 (i)'\n", + "print ' The above equations do not form a unique set'\n", + "\n", + "# By inspection we can see that only 7 equations are independent \n", + "#Independent Equations are: \n", + "# Subsystem 1\n", + "#A: F1*w_A1+F2*0 = F3*w_A3 (a)\n", + "#B:F1*0 + F2*w_B2 = F3*w_B3 (b)\n", + "#Subsystem 2\n", + "#A: F3*w_A3+F4*0 = F5*w_A5 (c)\n", + "# C: F3*0+F4*w_C4 = F5*w_C5 (e)\n", + "# Subsystem 3\n", + "#A: F5*w_A5+F6*0 = F7*w_A7+F8*0 (f)\n", + "#B:F5*w_B5 + F6*0 = F7*0+F8*w_B8 (g)\n", + "#D:F5*w_C5+F6*0 = F7*0+F8*w_C8 (i)\n", + "\n", + "print ' Number of independent equations are 7 '" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of possible equations are 9, they are as follows- \n", + " Subsystem 1\n", + " A: F1*w_A1+F2*0 = F3*w_A3 (a)\n", + " B:F1*0 + F2*w_B2 = F3*w_B3 (b)\n", + " Subsystem 2\n", + " A: F3*w_A3+F4*0 = F5*w_A5 (c)\n", + " B:F3*w_B3 + F4*0 = F5*w_B5 (d)\n", + " C: F3*0+F4*w_C4 = F5*w_C5 (e)\n", + " Subsystem 3\n", + " A: F5*w_A5+F6*0 = F7*w_A7+F8*0 (f)\n", + " B:F5*w_B5 + F6*0 = F7*0+F8*w_B8 (g)\n", + " C: F5*w_C5+F6*0 = F7*0+F8*w_C8 (h)\n", + " D:F5*w_C5+F6*0 = F7*0+F8*w_C8 (i)\n", + " The above equations do not form a unique set\n", + " Number of independent equations are 7 \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 11.2 Page no.315\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from numpy import matrix\n", + "\n", + "# Variables \n", + "\n", + "G = 1400 #[kg]\n", + "n_un = 16 # Number of unknowns in the given problem(excluding extent of reactions)\n", + "n_ie = 16 ; # Number of independent equations\n", + "d_o_f = n_un-n_ie # Number of degree of freedom\n", + "\n", + "print 'For unit 1 number of degree of freedom for the given system is %i .'%d_o_f\n", + "\n", + "o1_air = 0.995 ; # Mass fraction of air at out of unit 1 in A\n", + "i1_air = 0.95 ; # Mass fraction air at in of unit 1 in G\n", + "i1_wtr = 0.02; # Mass fraction water at in of unit 1 in G\n", + "F1_wtr = 0.81 ; # Mass fraction of water at out of unit 1 in F\n", + "o1_wtr = 0.005 ; # Mass fraction of water at out of unit 1 in A\n", + "o2_wtr = 0.96 ; # Mass fraction of water at out of unit 2 in B\n", + "o3_wtr = 0.01; # Mass fraction of water at out of unit 3 in D\n", + "i1_act = 0.03 ; # Mass fraction of acetone at in of unit 1 in G\n", + "F1_act = 0.19 ; # Mass fraction of acetone at out of unit 1 in F\n", + "o3_act = 0.99 ; # Mass fraction of acetone at out of unit 3 in D\n", + "o2_act = 0.04 ; # Mass fraction of acetone at out of unit 2 in B\n", + "\n", + "# Calculations \n", + "A = G*i1_air/o1_air ; #air-[kg]\n", + "F = G*i1_act/F1_act ; #[kg]\n", + "W = (F*F1_wtr+A*o1_wtr-G*i1_wtr)/1 #Pure water in -[kg]\n", + "\n", + "n_un = 9 ; # Number of unknowns in the given problem(excluding extent of reactions)\n", + "n_ie = 9 ; # Number of independent equations\n", + "d_o_f = n_un-n_ie \n", + "\n", + "print ' For unit 2 and 3 number of degree of freedom for the given system is %i .'%d_o_f\n", + "\n", + "a = matrix([[o3_act, o2_act],[o3_wtr, o2_wtr]]);\n", + "b = matrix([[F*F1_act],[F*F1_wtr]])\n", + "a = a.I\n", + "x = a*b \n", + "\n", + "# Results\n", + "print ' W-Pure water in to unit 1 - %.2f kg/hr'%W\n", + "print ' A-Air out of unit 1 - %.2f kg/hr'%A\n", + "print ' F-out of unit 1 - %.2f kg/hr'%F\n", + "print ' B-out of unit 2 - %.2f kg/hr'%x[1]\n", + "print ' D-out of unit 3 - %.2f kg/hr'%x[0]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "For unit 1 number of degree of freedom for the given system is 0 .\n", + " For unit 2 and 3 number of degree of freedom for the given system is 0 .\n", + " W-Pure water in to unit 1 - 157.74 kg/hr\n", + " A-Air out of unit 1 - 1336.68 kg/hr\n", + " F-out of unit 1 - 221.05 kg/hr\n", + " B-out of unit 2 - 186.15 kg/hr\n", + " D-out of unit 3 - 34.90 kg/hr\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 11.3 Page no. 318\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from numpy import matrix\n", + "\n", + "# Variables \n", + "P = 6205. #[lb mol/hr]\n", + "amt_F = 560. ; #[bbl]\n", + "C_F = 0.50 ; # [mol fraction]\n", + "H2_F = 0.47 ; #[mol fraction]\n", + "S_F = 0.03 ; #[mol fraction]\n", + "\n", + "CH4_G = 0.96 ; #[mol fraction]\n", + "C2H2_G = 0.02 ; #[mol fraction]\n", + "CO2_G = 0.02 ; #[mol fraction]\n", + "\n", + "O2_A = 0.21 ; #[mol fraction]\n", + "N2_A = 0.79 ; #[mol fraction]\n", + "\n", + "# Analysis of air into Oil furnace(A1)\n", + "O2_A1 = 0.20 ; #[mol fraction]\n", + "N2_A1 = 0.76 ; #[mol fraction]\n", + "CO2_A1 = 0.04 ; #[mol fraction]\n", + "\n", + "#Stack gas(P) analysis\n", + "N2_P = .8493 ; #[mol fraction]\n", + "O2_P = .0413 ; #[mol fraction]\n", + "SO2_P = .0010 ; # [mol fraction]\n", + "CO2_P = .1084 ; #[mol fraction]\n", + "\n", + "# Degree of freedom analysis \n", + "n_un = 5; \n", + "n_ie = 5 ;\n", + "d_o_f = n_un-n_ie; # Number of degree of freedom\n", + "print 'Number of degree of freedom for the given system is %i .'%d_o_f\n", + "\n", + "\n", + "# Calculations & Results\n", + "F = P* SO2_P/S_F ; # [lb mol/hr]\n", + "a = matrix([[2*CH4_G+C2H2_G, -1, 0, 0],[0, 0, N2_A, N2_A1],[CO2_G ,-.5, O2_A, O2_A1+CO2_A1], \n", + " [CH4_G+2*C2H2_G+CO2_G,0,0,CO2_A1]]);# matrix of coefficients\n", + "b = matrix([[-F*H2_F],[P*N2_P],[P*(O2_P+CO2_P+SO2_P)],[(P*CO2_P-F*C_F)]]); # matrix of constants\n", + "a = a.I\n", + "x = a*b \n", + "G = x[0]\n", + "m_F = 7.91\n", + "Fc = (F*m_F)/(7.578*42) # Fuel gas consumed -[bbl/hr]\n", + "time = amt_F/Fc ; # Time for which available fuel gas lasts-[hr]\n", + "\n", + " \n", + "print '(1) Fuel gas consumed(F) is %.2f bbl/hr .'%Fc\n", + "print '(2) Time for which available fuel gas lasts is %.0f hr .'%time\n", + "\n", + "# For increase in arsenic and mercury level\n", + "F_oil = Fc*42; #[gal/hr]\n", + "Em_ars2 = (3.96 *10**(-4))/1000.0 ; # [lb/gal]\n", + "Em_Hg2 = (5.92 *10**(-4))/1000.0 ; # [lb/gal]\n", + "ars_F = F_oil*Em_ars2 \n", + "Hg_F = F_oil*Em_Hg2 \n", + "G_gas = G*359 #[ft**3/hr]\n", + "Em_ars1 = (2.30 *10**(-4))/10**6 ; # [lb/ft**3]\n", + "Em_Hg1 = (1.34 *10**(-4))/10**6 ; # [lb/ft**3]\n", + "ars_G = G_gas*Em_ars1;\n", + "Hg_G = G_gas*Em_Hg1 ;\n", + "in_ars = ((ars_F-ars_G)/ars_G)*100 #[% increase in Arsenic emission]\n", + "in_Hg = ((Hg_F-Hg_G)/Hg_G)*100 #[% increase in Mercury emission]\n", + "\n", + "print '(3) Increase in Arsenic emission is %.1f %% .'%in_ars\n", + "print '(4) Increase in Mercury emission is %.1f %% .'%in_Hg" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of degree of freedom for the given system is 0 .\n", + "(1) Fuel gas consumed(F) is 5.14 bbl/hr .\n", + "(2) Time for which available fuel gas lasts is 109 hr .\n", + "(3) Increase in Arsenic emission is 107.4 % .\n", + "(4) Increase in Mercury emission is 432.3 % .\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 11.4 Page no. 322\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from numpy import matrix\n", + "\n", + "# Variables \n", + "M = 1000. ; #[lb]\n", + "F_s = 16/100. # Fraction of sugar in F\n", + "F_w = 25/100. # Fraction of water in F\n", + "F_p = 59/100. # Fraction of pulp in F\n", + "D_p = 80/100. # Fraction of pulp in D\n", + "E_s = 13/100. # Fraction of sugar in E\n", + "E_p = 14/100. # Fraction of pulp in E\n", + "G_p = 95/100. # Fraction of pulp in G\n", + "H_s = 15/100. # Fraction of sugar in H\n", + "K_s = 40/100. # Fraction of sugar in K\n", + "\n", + "# Calculations \n", + "K_w = 1 - K_s\n", + "K = M/K_s;\n", + "L = K_w*K;\n", + "\n", + "# For evaporator equations are \n", + "H_w = 1- H_s\n", + "H = K_s*K/H_s\n", + "J = H - K; \n", + "\n", + "# For screen equations are \n", + "E_w = 1 - (E_p + E_s) \n", + "\n", + "a1 = matrix([[1,-1],[E_p,-G_p]])\n", + "b1 = matrix([[H,],[0,]]) \n", + "a1 = a1.I\n", + "x1 = a1*b1\n", + "E = x1[0] \n", + "G = x1[1] \n", + "G_s = (E_s*E - H_s *H )/G\n", + "G_w = 1 -(G_s + G_p) \n", + "\n", + "a2 = matrix([[1,-1],[F_p,-D_p]]) # Matrix of coefficients of unknown\n", + "\n", + "F = 7818.93 \n", + "D = 1152.2634 \n", + "\n", + "D_s = (F_s*F - E_s*E )/D # By sugar balance\n", + "D_w = 1 -(D_s + D_p) # summation of wt. fraction is 1\n", + "\n", + "S_rec = M/(F*F_s) ; # Fraction of sugar recovered \n", + "\n", + "\n", + "# Results\n", + "print 'Flow streams and their respective compositions.'\n", + "print ' M = %.0f lb '%M\n", + "print ' Sugar: %.2f '%1\n", + "\n", + "print ' L = %.0f lb '%L\n", + "print ' Water: %.2f'%1\n", + "\n", + "print ' K = %.0f lb '%K\n", + "print ' Sugar: %.2f'%K_s\n", + "print ' Water: %.2f'%K_w\n", + "\n", + "print ' J = %.0f lb '%J\n", + "print ' Water: %.2f '%1\n", + "\n", + "print ' H = %.0f lb '%H\n", + "print ' Sugar: %.2f'%H_s\n", + "print ' Water: %.2f'%H_w\n", + "\n", + "print ' G = %.0f lb '%G\n", + "print ' Sugar: %.3f'%G_s\n", + "print ' Water: %.3f'%G_w\n", + "print ' Pulp : %.2f'%G_p\n", + "\n", + "print ' E = %.0f lb '%E\n", + "print ' Sugar: %.2f'%E_s\n", + "print ' Water: %.2f'%E_w\n", + "print ' Pulp : %.2f'%E_p\n", + "\n", + "print ' D = %.0f lb '%D\n", + "print ' Sugar: %.3f'%D_s\n", + "print ' Water: %.3f'%D_w\n", + "print ' Pulp : %.2f'%D_p\n", + "\n", + "print ' F = %.0f lb '%F\n", + "print ' Sugar: %.2f'%F_s\n", + "print ' Water: %.2f'%F_w\n", + "print ' Pulp : %.2f'%F_p" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Flow streams and their respective compositions.\n", + " M = 1000 lb \n", + " Sugar: 1.00 \n", + " L = 1500 lb \n", + " Water: 1.00\n", + " K = 2500 lb \n", + " Sugar: 0.40\n", + " Water: 0.60\n", + " J = 4167 lb \n", + " Water: 1.00 \n", + " H = 6667 lb \n", + " Sugar: 0.15\n", + " Water: 0.85\n", + " G = 1152 lb \n", + " Sugar: 0.014\n", + " Water: 0.036\n", + " Pulp : 0.95\n", + " E = 7819 lb \n", + " Sugar: 0.13\n", + " Water: 0.73\n", + " Pulp : 0.14\n", + " D = 1152 lb \n", + " Sugar: 0.204\n", + " Water: -0.004\n", + " Pulp : 0.80\n", + " F = 7819 lb \n", + " Sugar: 0.16\n", + " Water: 0.25\n", + " Pulp : 0.59\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 11.5 Page no.324\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables \n", + "F = 15. #[L/hr]\n", + "cs_in = 10. #Nutrient conc. input vessel - [g nutrient/L substrate]\n", + "V1 = 100. ; # [L]\n", + "V2 = 50. ; #[L]\n", + "Yxs = 0.2 ; # [cells/g]\n", + "umax = 0.4 ; #[hr** - 1]\n", + "Ks = 2. ; #[g/L] - Monod constant\n", + "\n", + "# Calculations\n", + "u1 = F/V1 #[hr** - 1] #[hr** - 1]\n", + "cs_out = (Ks * u1/umax)/(1 - (u1/umax)) \n", + "\n", + "x_out = Yxs * (cs_in - cs_out) #[g cells / L substrate]\n", + "\n", + "u2 = F/V2;\n", + "cs_out1 = (Ks * u2/umax)/(1 - (u2/umax)) #Nutrient conc. output vessel - [g nutrient/L substrate]\n", + "x_out1 = Yxs * (cs_in - cs_out1) #[g cells / L substrate]\n", + "\n", + "x_out2 = 1.73 # From eqn. (e),(f) and (g) - [g cells / L substrate]\n", + "\n", + "# Results\n", + "print 'g cells/L from option 1 is %.2f.'%x_out\n", + "print 'g cells/L from option 2 is %.2f.'%x_out2\n", + "print 'By comparing option 1 and option 2 the respective answers are essentially the same.'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "g cells/L from option 1 is 1.76.\n", + "g cells/L from option 2 is 1.73.\n", + "By comparing option 1 and option 2 the respective answers are essentially the same.\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "code", + "collapsed": true, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch13-checkpoint.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch13-checkpoint.ipynb new file mode 100644 index 00000000..d6a85197 --- /dev/null +++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch13-checkpoint.ipynb @@ -0,0 +1,426 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:86277517338e3080962ec366bf78a36ead36dc032944d5f67a8c58022c6af85a" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 13 : Ideal Gases" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 13.1 Page No. 404\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Variables\n", + "m_CO2 = 40. ;\t\t\t# Mass of CO2-[kg]\n", + "mol_wt_CO2 = 44. ;\t\t\t# Molecular mass of 1kmol CO2 -[kg]\n", + "mol_V = 22.42 ;\t\t\t# Molar of ideal gas at standard condition-[cubic metre/kg mol]\n", + "\n", + "# Calculations\n", + "V_CO2 = (m_CO2 * mol_V)/(mol_wt_CO2);\t\t\t# volume of CO2-[cubic metre]\n", + "\n", + "# Results\n", + "print 'Volume occupied by 40 kg CO2 at standard condition is %.1f cubic metre.'%V_CO2\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Volume occupied by 40 kg CO2 at standard condition is 20.4 cubic metre.\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 13.2 Page No. 405\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Variables\n", + "p =1. ;\t\t\t# Pressure -[atm]\n", + "V = 22415. ;\t\t\t# Molar valume -[cubic centimetre/g mol]\n", + "T = 273.15 ;\t\t\t# Temperature-[K]\n", + "\n", + "# Calculations\n", + "R = (p*V/T);\t\t\t# Universal gas constant-[(cubic centimetre.atm)/(K.g mol)]\n", + "\n", + "# Results\n", + "print 'Universal gas constant is %.2f (cubic centimetre*atm)/(K*g mol). '%R\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Universal gas constant is 82.06 (cubic centimetre*atm)/(K*g mol). \n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 13.3 Page No.406\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Variables\n", + "m_CO2 = 88. ;\t\t\t# Mass of CO2-[lb]\n", + "mol_wt_CO2 = 44. ;\t\t# Molecular mass of 1 lb mol CO2 -[lb]\n", + "mol_V = 359. ; \t\t\t# Molar volume-[cubic feet]\n", + "\n", + "# State 1-standard condition\n", + "P1 = 33.91 ; \t\t\t# Pressure -[ft of water]\n", + "T1 = 273. ;\t\t\t# Temperature-[K]\n", + "\n", + "# State 2\n", + "P2 = 32.2 ;\t\t\t# Pressure -[ft of water]\n", + "Tc = 15. ;\t\t\t # Temperature-[degree C]\n", + "T2 = Tc+273 ;\t\t\t# Temperature-[K]\n", + "\n", + "# Calculations\n", + "V1 = (m_CO2 * mol_V) / (mol_wt_CO2);\n", + "V2 = (V1 * T2 * P1) / (T1 * P2);\n", + "\n", + "# Results\n", + "print 'The volume occupied 88 lb of CO2 at given condition is %.0f cubic feet.'%V2\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The volume occupied 88 lb of CO2 at given condition is 798 cubic feet.\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 13.4 Page No. 408\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Variables\n", + "mol_wt_N2 = 28. ;\t# Molecular mass of 1 kg mol N2 -[kg]\n", + "mol_V = 22.42 ;\t\t# Molar of ideal gas at standard condition-[cubic metre/kg mol]\n", + "Tc = 27. ;\t\t\t# Temperature-[degree C]\n", + "T = Tc + 273. ;\t\t#Temperature-[K]\n", + "P = 100. ;\t\t\t#Pressure-[kPa]\n", + "\t\t\t\n", + "Ps = 101.3 ;\t\t# Pressure -[kPa]\n", + "Ts = 273. ;\t\t\t#Temperature-[K]\n", + "\n", + "# Calculations\n", + "V = (T * Ps * mol_V)/(Ts * P) ;\t\t\t# Volume occupied by N2-[cubic metre]\n", + "D_N2 = mol_wt_N2/V ;\t\t\t # Density of N2 at given condition-[kg/cubic metre]\n", + "\n", + "# Results\n", + "print ' Density of N2 at given condition is %.3f kg/cubic metre.'%D_N2\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Density of N2 at given condition is 1.122 kg/cubic metre.\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.5 Page No. 409 \n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Variables\n", + "mol_wt_N2 = 28. ;\t\t\t# Molecular mass of 1 lb mol N2 -[lb]\n", + "mol_wt_air = 29. ;\t\t\t# Molecular mass of 1 lb mol air -[lb]\n", + "mol_V = 359. ;\t\t\t # Molar volume of ideal gas-[cubic feet]\n", + "\t\n", + "Tf = 80. ;\t\t\t# Temperature-[degree F]\n", + "T = Tf + 460. ;\t\t#Temperature-[degree Rankine]\n", + "P = 745. ;\t\t\t#Pressure-[mm of Hg]\n", + "\n", + "Ps = 760. ;\t\t\t# Pressure -[mm of Hg]\n", + "Ts = 492. ;\t\t\t#Temperature-[degree Rankine]\n", + "\n", + "# Calculations\n", + "D_air = (Ts * P * mol_wt_air)/(T * Ps * mol_V) ;\t\t# Density of air at given condition-[lb/cubic feet]\n", + "D_N2 = (Ts * P * mol_wt_N2)/(T * Ps * mol_V) ;\t\t\t# Density of N2 at given condition-[lb/cubic feet]\n", + "sg_N2 = D_N2/D_air ;\t\t\t # Specific gravity of N2 compared to air at given condition \n", + "\n", + "# Results\n", + "print ' Specific gravity of N2 compared to air at given condition is %.3f .'%sg_N2\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Specific gravity of N2 compared to air at given condition is 0.966 .\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 13.6 Page No. 414\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Variables\n", + "F_gas = 1. ;\t\t\t # Flue gas [kg mol]\n", + "mf_CO2 = 14./100 ;\t\t\t# [mol fraction]\n", + "mf_O2 = 6./100 ;\t\t\t# [mol fraction]\n", + "mf_N2 = 80./100 ;\t\t\t# [mol fraction]\n", + "P = 765. ;\t\t\t #Pressure-[mm of Hg]\n", + "T = 400. ;\t\t\t # Temperature-[degree F]\n", + "\n", + "# Calculations\n", + "p_CO2 = P * mf_CO2 ;\t\t# Partial pressure of CO2-[mm of Hg]\n", + "p_O2 = P * mf_O2 ;\t\t\t# Partial pressure of O2-[mm of Hg]\n", + "p_N2 = P * mf_N2 ;\t\t\t# Partial pressure of N2-[mm of Hg]\n", + "\n", + "# Results\n", + "print ' Component pi(Partial pressure-[mm of Hg]) '\n", + "print ' CO2 %.1f mm of Hg '%p_CO2\n", + "print ' O2 %.1f mm of Hg '%p_O2\n", + "print ' N2 %.1f mm of Hg '%p_N2\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Component pi(Partial pressure-[mm of Hg]) \n", + " CO2 107.1 mm of Hg \n", + " O2 45.9 mm of Hg \n", + " N2 612.0 mm of Hg \n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 13.7 Page no. 416\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "G = 100. ;\t\t\t# Basis: Pyrolysis Gas-[lb mol] \n", + "ub_CO = 10./100 ;\t# fraction of CO left unburnt\n", + "ex_air = 40./100 ;\t# fraction of excess air\n", + "m_vol = 359. ;\t\t# molar volume of gas at std. cond.-[cubic feet]\n", + "Ts = 492. ;\t\t\t# Standard temperature -[degree Rankine]\n", + "Ps = 29.92 ;\t\t#Standard pressure -[in. Hg]\n", + "\n", + "# Calculations\n", + "# Analysis of entering gas of entering gas\n", + "Tf1 = 90. ;\t\t\t# Temperature of gas-[degree F]\n", + "T_gas = Tf1 + 460. ;\t#Temperature of gas-[degree Rankine]\n", + "P_gas = 35. ;\t\t\t#Pressure-[in. Hg]\n", + "CO2 = 6.4/100 ;\t\t\t# mol fraction of CO2\n", + "O2 = 0.1/100 ;\t\t\t# mol fraction of O2\n", + "CO = 39./100 ;\t\t\t# mol fraction of CO\n", + "H2 = 51.8/100 ;\t\t\t# mol fraction of H2\n", + "CH4 = 0.6/100 ;\t\t\t# mol fraction of CH4\n", + "N2 = 2.1/100 ;\t\t\t# mol fraction of N2\n", + "\n", + "# Analysis of entering air\n", + "Tf2 = 70. ;\t\t\t # Temperature of air -[degree F]\n", + "T_air = Tf2 + 460. ;\t#Temperature of air-[degree Rankine]\n", + "P_air = 29.4 ;\t\t\t#Pressure of air [in. Hg]\n", + "f_N2 = 79./100 ;\t\t\t# mol fraction of N2\n", + "f_O2 = 21./100 ;\t\t\t# mol fraction of O2\n", + "\n", + "\n", + "O2r_O2 = O2 * G ;\t\t\t# O2 required by O2-[lb mol]\n", + "O2r_CO = CO * G/2 ;\t\t\t# O2 required by CO-[lb mol]\n", + "O2r_H2 = H2 * G/2 ;\t\t\t# O2 required by H2-[lb mol]\n", + "O2r_CH4 = G * CH4 * 2 ;\t\t\t# O2 required by CH4-[lb mol]\n", + "O2r_total = O2r_O2 + O2r_CO + O2r_H2 + O2r_CH4 ;\t\t\t# Total O2 required-[lb mol]\n", + "ex_O2 = ex_air * O2r_total ;\t\t\t# Excess O2-[lb mol]\n", + "total_O2 = ex_O2 + O2r_total ;\t\t\t# Total amt of O2 in air-[lb mol]\n", + "total_N2 = total_O2 * (f_N2/f_O2);\t\t\t# Total amt of in air-[lb mol]\n", + "air = total_O2 + total_N2 ;\t\t\t# Total air entering -[lb mol]\n", + "\n", + "# Product analysis\n", + "P_CO = ub_CO * CO * G ;\t\t\t#Unburnt CO in P-[lb mol]\n", + "P_N2 = N2 * G + total_N2 ;\t\t\t# N2 in P-[lb mol]\n", + "P_CO2 = (CO2 + CO + CH4) * G - 1 * P_CO;\t\t\t#CO2 in P-[lb mol]\n", + "P_H2O = (H2 + 2 * CH4) * G ;\t\t\t# H2 in P-[lb mol]\n", + "P_O2 = (CO2 + O2 + 0.5 * CO) * G + total_O2 -P_CO2-0.5 * (P_H2O + P_CO);\t\t\t# O2 in P-[lb mol]\n", + "P = P_CO + P_N2 + P_CO2 + P_H2O + P_O2 ;\t\t\t# Product-[lb mol]\n", + "Tf3 = 400 ;\t\t\t# Temperature of product-[degree F]\n", + "T_prod = Tf3 + 460 ;\t\t\t#Temperature of product-[degree Rankine]\n", + "P_prod = 35 ;\t\t\t# Pressure of product -[in.Hg]\n", + "V_gas = (G * m_vol * T_gas * Ps)/(Ts * P_gas);\n", + "V_air = (air * m_vol * T_air * Ps)/(Ts * P_air);\n", + "V_prod = (P * m_vol * T_prod * Ps)/(Ts * P_prod);\n", + "air_ft3 = V_air/V_gas ;\t\t\t#Air supplied per ft**3 of gas entered-[cubic feet]\n", + "P_ft3 = V_prod/V_gas ;\t\t\t#Product gas produced per ft**3 of gas entered-[cubic feet]\n", + "\n", + "# Results\n", + "print ' Air supplied per ft**3 of gas entered %.2f cubic feet. '%air_ft3\n", + "print ' Product gas produced per ft**3 of gas entered %.2f cubic feet.'%P_ft3\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Air supplied per ft**3 of gas entered 3.57 cubic feet. \n", + " Product gas produced per ft**3 of gas entered 5.75 cubic feet.\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 13.8 Page No. 419\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Variables\n", + "T1c = 15. ;\t\t\t # Temperature of F & P -[degree C] \n", + "T1 = 273. + T1c ;S\t# Temperature of F & P -[K] \n", + "P1 = 105. ;\t\t\t# Pressure of F & P -[kPa]\n", + "\n", + "# Calculations\n", + "# F analysis\n", + "F_CO2 = 1.2/100 ;\t\t\t# Volume fraction \n", + "F_odr = 98.8/100 ;\t\t\t# Volume fraction \n", + "\n", + "# P analysis\n", + "P_CO2 = 3.4/100 ;\t\t\t# Volume fraction \n", + "P_odr = 96.6/100 ;\t\t\t# Volume fraction \n", + " \n", + "Tc_CO2 = 7. ;\t\t\t#Temperature CO2 -[degree C] \n", + "T_CO2 = 273. + Tc_CO2 ;\t\t\t# Temperature CO2 -[K]\n", + "P_CO2 = 131. ;\t\t\t# Pressure of CO2 -[kPa]\n", + "CO2 = 0.0917 ;\t\t\t# Volume flow rate of CO2-[cubic metre/min]\n", + "# Convert given volume flow rate of CO2 at temperature of F & P\n", + "nw_CO2 = (CO2 * T1 * P_CO2)/(T_CO2 * P1) ;\t\t\t# volume flow rate of CO2 at temperature of F & P-[cubic metre]\n", + "\n", + "from numpy import matrix\n", + "a = matrix([[F_odr,-P_odr],[1, -1]]);\t\t\t# Matrix formed by coefficients of unknown\n", + "b = matrix([[0],[-nw_CO2]]) ;\t\t\t# Matrix formed by constants\n", + "a = a.I\n", + "x = a*b ;\t\t\t# matrix of solution, x(1) = F;x(2) = P\n", + "F = x[0] ;\t\t\t#Volume flow rate of entering gas-[cubic metre/min]\n", + "P = x[1] ;\t\t\t#Volume flow rate of product [cubic metre/min]\n", + "\n", + "# Results\n", + "print 'Volume flow rate of entering gas is %.2f cubic metre/min'%F\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Volume flow rate of entering gas is 5.17 cubic metre/min\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "code", + "collapsed": true, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch15-checkpoint.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch15-checkpoint.ipynb new file mode 100644 index 00000000..e0ee646a --- /dev/null +++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch15-checkpoint.ipynb @@ -0,0 +1,75 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:eeb1c8da856a86d3cb60a72e738f1fe4c7b2d7aaa546df7d68c6871754268745" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 15 : Real Gases Equations of State" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 15.1 Page No. 464\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# variables\n", + "R = 82.06 # gas constant-[(cm**3 *atm)/(g mol *K)]\n", + "a = 9.24 *10**(6) ; #(atm) *(cm**3/g mol)**2\n", + "b = 90.7 ; # (cm**3)/(g mol)\n", + "m_C3H8 = 22.7 # Mass of propane-[kg]\n", + "mw_C3H8 = 44. ; # Mol. wt. of 1kmol propane-[kg]\n", + "V = 0.15 *10**(6) ; # Volume of cylinder -[cm**3]\n", + "pg = 4790. # Gauge pressure -[kPa]\n", + "\n", + "# Calculations\n", + "P = (pg +101.3)/101.3 # Pressure absolute-[atm abs]\n", + "n = (m_C3H8/mw_C3H8) *10**3 ; # Moles of propane\n", + "# Get T using Van der Waal's eqn. \n", + "T = ((P +((n**(2) *a/(V**(2))))) *(V-n *b))/(R *n) ;# Temperature of propane-[K]\n", + "\n", + "# Result\n", + "print 'Temperature of propane is %.0f K.'%T" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Temperature of propane is 384 K.\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": true, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch19-checkpoint.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch19-checkpoint.ipynb new file mode 100644 index 00000000..509330f3 --- /dev/null +++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch19-checkpoint.ipynb @@ -0,0 +1,308 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:c896c859a24a6b70446a5e83cded412ac42718005bc7d2e546816e8274c18e21" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 19 : The Phase Rule and Vapor Liquid Equilibria" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 19.1 Page No. 563\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "N1 = 1.;\n", + "P1 = 1. ;\t\t\t# Number of phases present\n", + "C1 = 1. ;\t\t\t#Number of components present\n", + "F1 = 2.-P1+C1 ;\t\t\t#Number of degree of freedom\n", + "print ' (a) Number of degree of freedom of pure benzene is %i.\\n Therefore %i additional \\\n", + "intensive variables must be specified to fix to fix the system.'%(F1,F1)\n", + "\n", + "\t\t\t# (b)\n", + "N2 = 1.;\n", + "P2 = 2. ;\t\t\t# Number of phases present\n", + "C2 = 1. ;\t\t\t#Number of components present\n", + "F2 = 2.-P2+C2 ;\t\t\t#Number of degree of freedom\n", + "print '(b) Number of degree of freedom of a mixture of ice and water only is %i.\\\n", + " \\nTherefore %i additional intensive variables must be specified to fix the system. '%(F2,F2)\n", + "\n", + "\t\t\t# (c)\n", + "N3 = 2.;\n", + "P3 = 2. ;\t\t\t# Number of phases present\n", + "C3 = 2. ;\t\t\t#Number of components present\n", + "F3 = 2.-P3+C3 ;\t\t\t#Number of degree of freedom\n", + "print '(c) Number of degree of freedom of a mixture of liquid benzene,benzene vapour and\\\n", + " helium gas is %i. \\nTherefore %i additional intensive variables must be specified to fix the system. '%(F3,F3)\n", + "\n", + "\t\t\t# (d)\n", + "N4 = 2.;\n", + "P4 = 2. ;\t\t\t# Number of phases present\n", + "C4 = 2. ;\t\t\t#Number of components present\n", + "F4 = 2.-P4+C4 ;\t\t\t#Number of degree of freedom\n", + "print '(d) Number of degree of freedom of a mixture of salt and water designed to achieve\\\n", + " a specific vapour pressure is %i. \\nTherefore %i additional intensive variables must be\\\n", + " specified to fix the system. '%(F4,F4)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " (a) Number of degree of freedom of pure benzene is 2.\n", + " Therefore 2 additional intensive variables must be specified to fix to fix the system.\n", + "(b) Number of degree of freedom of a mixture of ice and water only is 1. \n", + "Therefore 1 additional intensive variables must be specified to fix the system. \n", + "(c) Number of degree of freedom of a mixture of liquid benzene,benzene vapour and helium gas is 2. \n", + "Therefore 2 additional intensive variables must be specified to fix the system. \n", + "(d) Number of degree of freedom of a mixture of salt and water designed to achieve a specific vapour pressure is 2. \n", + "Therefore 2 additional intensive variables must be specified to fix the system. \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 19.2 Page No.564\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "N1 = 5.;\n", + "P1 = 1.; \t\t\t# Number of phases present,here 1 gas \n", + "C1 = 3. ;\t\t\t#Number of independent components present,here 3 because 3 elements(C,O and H)\n", + "F1 = 2-P1+C1 ;\t\t\t#Number of degree of freedom\n", + "print ' (a) Number of degree of gas composed of CO,CO2,H2,H2O and CH4 is %i. \\n \\\n", + "Therefore %i additional intensive variables must be specified to fix the system. '%(F1,F1)\n", + "\n", + "# (b)\n", + "N2 = 4.;\n", + "P2 = 4. ;\t\t\t# Number of phases present,here 3 different solid phases and 1 gas phase\n", + "C2 = 3. ;\t\t\t#Number of components present, here 3 because 3 elements(Zn,O and C) ,you can also use method explained \n", + " #in Appendix L1\n", + "F2 = 2.-P2+C2 ;\t\t#Number of degree of freedom\n", + "print '(b) Number of degree of freedom of a mixture of ZnO(s), C(s) ,CO(g) and Zn(s) is %i. \\n \\\n", + "Therefore %i additional intensive variables must be specified to fix the system. '%(F2,F2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " (a) Number of degree of gas composed of CO,CO2,H2,H2O and CH4 is 4. \n", + " Therefore 4 additional intensive variables must be specified to fix the system. \n", + "(b) Number of degree of freedom of a mixture of ZnO(s), C(s) ,CO(g) and Zn(s) is 1. \n", + " Therefore 1 additional intensive variables must be specified to fix the system. \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 19.3 Page No :576" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from scipy.optimize import fsolve\n", + "import math\n", + "\n", + "# Variables\n", + "P_atm = 1. ;\t\t\t#[atm]\n", + "P = 760. ;\t\t\t#[mm of Hg]\n", + "x_1 = 4./100 ;\t\t\t# Mole fraction of hexane in liquid phase\n", + "# Constant A,B and C for Antoine eqn. of n_hexane \n", + "A1 = 15.8366;\n", + "B1 = 2697.55 ;\n", + "C1 = -48.784;\n", + "# Constant A,B and C for Antoine eqn. of n_octane\n", + "A2 = 15.9798;\n", + "B2 = 3127.60 ;\n", + "C2 = -63.633;\n", + "\n", + "# Calculations\n", + "# Solve for bubble point temperature by eqn. obtained by using Antoine equation\n", + "def f(T):\n", + " return math.exp(A1-(B1/(C1+T)))*x_1 + math.exp(A2-(B2/(C2+T)))*(1-x_1) - P\n", + "T = fsolve(f,390)[0] ;\t\t\t# Bubble point temperature \n", + "\n", + "print 'Bubble point temperature is %.1f K'%T\n", + "\n", + "# Composition of first vapour\n", + "# Get vapour pressure of hexane and octane from Perry, it is\n", + "vp_1 = 3114. ;\t\t\t# vapour pressure of hexane-[mm of Hg]\n", + "vp_2 = 661. ;\t\t\t# vapour pressure of octane-[mm of Hg]\n", + "y_1 = vp_1*x_1/P ;\t\t\t# Mole fraction of hexane in vapour phase\n", + "y_2 = 1- y_1 ;\t\t\t#Mole fraction of octane in vapour phase\n", + "\n", + "# Results\n", + "print ' Composition of first vapour. '\n", + "print 'Component Mole fraction. '\n", + "print 'n_hexane %.3f'%y_1\n", + "print ' n_octane %.3f'%y_2\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Bubble point temperature is 393.6 K\n", + " Composition of first vapour. \n", + "Component Mole fraction. \n", + "n_hexane 0.164\n", + " n_octane 0.836\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 19.4 Page no. 577" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "# Basis : 100 g solution\n", + "F = 100. ;\t\t\t# Amount of solution-[g]\n", + "P_atm = 1. ;\t\t\t#[atm]\n", + "P = 760. ;\t\t\t# Total pressure -[mm of Hg]\n", + "wf_hex = 68.6/100 ;\t\t\t#Weight fraction of hexane in mixture\n", + "wf_tol = 31.4/100 ;\t\t\t#Weight fraction of toluene in mixture\n", + "mw_hex = 86.17 ;\t\t\t# Mol.wt. of hexane-[g]\n", + "mw_tol = 92.13 ;\t\t\t# Mol.wt. of toluene-[g]\n", + "\n", + "# Calculations\n", + "mol_hex = wf_hex *F/mw_hex ;\t\t\t# moles of hexane-[g mol]\n", + "mol_tol = wf_tol*F/mw_tol ;\t\t\t # moles of toluene-[g mol]\n", + "mol_total = mol_hex + mol_tol ;\t\t\t# Total moles in mixture-[g mol]\n", + "molf_hex = mol_hex/mol_total ;\t\t\t# Mole fraction of hexane \n", + "molf_tol = mol_tol/mol_total ;\t\t\t# Mole fraction of toluene \n", + "# Get vapour pressure of hexane and toluene at 80 deg. C from Perry, it is\n", + "vp_hex = 1020. ;\t\t\t# vapour pressure of hexane-[mm of Hg]\n", + "vp_tol = 290. ;\t\t\t# vapour pressure of toluene-[mm of Hg]\n", + "K_hex = vp_hex/P ;\t\t\t# K-value of hexane\n", + "K_tol = vp_tol/P ;\t\t\t# K-value of toluene\n", + "rec_K_hex = 1/K_hex ;\t\t\t# Reciprocal of K-value of hexane\n", + "rec_K_tol = 1/K_tol ;\t\t\t# Reciprocal of K-value of toluene\n", + "\n", + "# Let L/F = x, then use eqn. 19.11 to find x(L/F) \n", + "def g(x):\n", + " return (molf_hex)/(1-x*(1-rec_K_hex)) + (molf_tol)/(1-x*(1-rec_K_tol))-1\n", + "\n", + "x = fsolve(g,1)[0] ;\t\t\t# L/F value\n", + "\n", + "# Results\n", + "print ' Fraction of liquid(L/F) that will remain at equilibrium after vaporization is %.3f. '%x\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Fraction of liquid(L/F) that will remain at equilibrium after vaporization is 0.744. \n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 19.5 Page no. 578\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "Vo = 3.0 ;\t\t\t# Initial volume of the solution containing the culture and virus-[L]\n", + "Vp = 0.1 ;\t\t\t# Volume of the polymer solution added to the vessel -[L]\n", + "Kpc = 100. ;\t\t\t# Partition coefficient for virus(cp/cc) between two phases\n", + "\n", + "# Calculations\n", + "Vc = Vo ;\t\t\t# At equilibrium -[L]\n", + "cp_by_co = Vo/(Vp+(Vo/Kpc)) ;\t\t\t\n", + "Fr_rec = cp_by_co*(Vp/Vo) ;\t\t\n", + "\n", + "# Results\n", + "print ' Fraction of the initial virus in the culture phase that is recovered in the polymer phase is %.2f . '%Fr_rec\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Fraction of the initial virus in the culture phase that is recovered in the polymer phase is 0.77 . \n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "code", + "collapsed": true, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch2-checkpoint.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch2-checkpoint.ipynb new file mode 100644 index 00000000..84439d15 --- /dev/null +++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch2-checkpoint.ipynb @@ -0,0 +1,935 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:ef26cf09debc2accb827957d575ac9576db35c1e13d184b4161dad1098add2f0" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 2 : Fluid statics" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " example 2.1 page no : 40\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variables\n", + "g=32.2; #ft/s^2\n", + "rho_water=62.3; #lbm/ft^3\n", + "\n", + "# calculation\n", + "#specific weoight=(density)*(acceleration due to gravity)\n", + "specific_wt=rho_water*g; #lbm.ft/ft^3.s^2\n", + "\n", + "#1 lbf=32.2 lbm.ft/s^2\n", + "specific_wt=specific_wt/32.2; #lbf/ft^3\n", + "\n", + "# result\n", + "print \"Specific weight of water is\" ,specific_wt , \"lbf/ft^3\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Specific weight of water is 62.3 lbf/ft^3\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " example 2.2 page no : 40\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variables\n", + "d=304.9; #m\n", + "rho_water=1024.; #Kg/m^3\n", + "g=9.81; #m/s^2\n", + "p_atm=101.3; #KPa\n", + "\n", + "# calculation\n", + "#gauge pressure=(desity)*(acc. due to gravity)*(depth)\n", + "p_depth=p_atm+rho_water*g*d/1000.0; #KPa\n", + "\n", + "# result\n", + "print \"pressure at the depth is\" , (p_depth) , \"KPa\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "pressure at the depth is 3164.154656 KPa\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " example 2.3 page no : 41\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# variables\n", + "rho_oil=55.; #lbm/ft^3\n", + "g=32.2; #ft/s^2\n", + "d=60.; #ft (depth of oil cylinder)\n", + "\n", + "# calculation and result\n", + "gauge_pressure=rho_oil*g*d/32.2; #lbf/ft^2\n", + "print \"Gauge pressure is\",\n", + "print gauge_pressure,\n", + "print \"lbf/ft^2\"\n", + "\n", + "#1 ft=12 in\n", + "gauge_pressure=gauge_pressure/144.0; #lbf/in^2\n", + "print \"Gauge pressure is\",\n", + "print gauge_pressure,\n", + "print \"lbf/in^2\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Gauge pressure is 3300.0 lbf/ft^2\n", + "Gauge pressure is 22.9166666667 lbf/in^2\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " example 2.4 page no : 42\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# varirbles\n", + "#calc of density of air at a certain height\n", + "p_atm=14.7; #psia\n", + "T=289.; #K\n", + "\n", + "#P2=P1*exp^(-(acc. due to gravity)*(mass of air)*(height)/(universal gas const.)/(temp.))\n", + "g=9.81; #m/s^2\n", + "R=8314; #N.m^2/Kmol/K\n", + "\n", + "#for height of 1000 ft=304.8m\n", + "h=304.8; #m\n", + "p_1000=14.7*math.exp(-g*29*h/R/289);\n", + "print \"pressure at 1000ft is\",\n", + "print p_1000,\n", + "print \"psia\"\n", + "\n", + "#for height of 10000 ft=3048m\n", + "h=3048.; #m\n", + "p_10000=p_atm*math.exp(-g*29.*h/R/289.);\n", + "print \"pressure at 10000ft is\",\n", + "print p_10000,\n", + "print \"psia\"\n", + "\n", + "#for height of 100000 ft=30480m\n", + "h=30480.; #m\n", + "p_100000=14.7*math.exp(-g*29.*h/R/289.);\n", + "print \"pressure at 100000ft is\",\n", + "print p_100000,\n", + "print \"psia\"," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "pressure at 1000ft is 14.1789512072 psia\n", + "pressure at 10000ft is 10.2467246829 psia\n", + "pressure at 100000ft is 0.398102276652 psia\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " example 2.5 page no : 42\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variables\n", + "p_atm=14.7; #psia\n", + "g=9.81; #m/s^2\n", + "\n", + "#P2=P1*[1-(acc. due to gravity)*(mass of air)*(height)/(univ. gas const.)/(temp.)]\n", + "T=289.; #K\n", + "R=8314. #N.m^2/Kmol/K\n", + "\n", + "\n", + "# calculation and result\n", + "#for height of 1000ft=304.8m\n", + "h=304.8 #m\n", + "p_1000=p_atm*(1-g*29*h/R/T)\n", + "print \"pressure at 1000ft is\",\n", + "print p_1000,\n", + "print \"psia\"\n", + "\n", + "#for height of 10000ft=3048m\n", + "h=3048. #m\n", + "p_10000=p_atm*(1-g*29*h/R/T)\n", + "print \"pressure at 10000ft is\",\n", + "print p_10000,\n", + "print \"psia\"\n", + "\n", + "#for height of 100000ft=30480m\n", + "h=30480. #m\n", + "p_100000=p_atm*(1-g*29*h/R/T)\n", + "print \"pressure at 100000ft is\",\n", + "print p_100000,\n", + "print \"psia\"\n", + "\n", + "#NOTE that the pressure comes out to be negative at 100000ft justifying that density of air changes with altitude" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "pressure at 1000ft is 14.1694926079 psia\n", + "pressure at 10000ft is 9.39492607874 psia\n", + "pressure at 100000ft is -38.3507392126 psia\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " example 2.6 page no : 45\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# variables\n", + "#calc atm pressure on a storage tank roof\n", + "p_atm=14.7; #psia\n", + "\n", + "#diameter of roof is 120ft\n", + "d_roof=120.; #ft\n", + "\n", + "# calculation\n", + "#force=(pressure)*(area)\n", + "f_roof=p_atm*(math.pi)*d_roof**2/4.*144; #lbf ;144 because 1ft=12inch\n", + "\n", + "# result\n", + "print \"Force exerted by atmosphere on the roof is\",\n", + "print f_roof,\n", + "print \"lbf\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Force exerted by atmosphere on the roof is 23940443.9848 lbf\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " example 2.7 page no : 45\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# variables\n", + "#calc atm pressure on a storage tank roof\n", + "p_atm=14.7; #psia\n", + "\n", + "#diameter of roof is 120ft\n", + "d_roof=120.; #ft\n", + "#force=(atm. pressure + gauge pressure)*(area)\n", + "#gauge pressure=(desity)*(acc. due to gravity)*(depth)\n", + "rho_water=62.3 #lbm/ft^3\n", + "g=32.2; #ft/s^2\n", + "\n", + "# calculation\n", + "#depth of water on roof=8 inch=o.667 ft\n", + "h=0.667; #ft\n", + "gauge_pressure=rho_water*g*h/32.2*(math.pi)*d_roof**2/4.; #lbf\n", + "\n", + "# result\n", + "print gauge_pressure" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "469965.799032\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " example 2.8 page no : 46\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# variables\n", + "#lock gate has water on one side and air on the other at atm. pressure\n", + "w=20.; #m (width of the lock gate)\n", + "h=10.; #m (height of the lock gate)\n", + "p_atm=1.; #atm\n", + "rho_water=1000.; #Kg/m^3\n", + "g=9.81 #m/s^2\n", + "\n", + "# calculation\n", + "#for a small strip of dx height at the depth of x on the lock gate\n", + "#net pressure on strip = (p_atm+(rho_water)*g*x) - p_atm\n", + "#thus, net pressure on strip = (rho_water)*g*x\n", + "#force on strip = (rho_water*g*x)*w.dx = (rho_water)*g*w*(x.dx)\n", + "#force on lock gate = integration of force on strip fromm h=0 to h=10\n", + "#integration(x.dx) = x^2/2\n", + "#for h=0 to h=10; integration (x.dx) = h^2/2\n", + "force_lockgate=(rho_water)*g*w*h**2/2;\n", + "\n", + "# result\n", + "print \"The net force on the lock gate is\",force_lockgate/10**6,\"MN\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The net force on the lock gate is 9.81 MN\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.9 page no : 49\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "sigma_tensile=20000. #lbf/in^2 (tensile stress is normally 1/4 rupture stress)\n", + "\n", + "#max pressure is observed at the bottom of the storage\n", + "p_max=22.9; #lbf/in^2\n", + "\n", + "#diameter of storaeg tank = 120ft =1440in\n", + "d=1440.; #in\n", + "\n", + "# calculation\n", + "t=(p_max)*d/sigma_tensile/2; #in\n", + "\n", + "# result\n", + "print \"Thichness of the storage tank is\",\n", + "print t,\n", + "print \"in\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thichness of the storage tank is 0.8244 in\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " example 2.10 page no : 50\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# variables\n", + "p_working=250.0; #lbf/in^2\n", + "\n", + "#diameter of the cylinder = 10ft = 120in\n", + "d=120.0; #in\n", + "sigma_tensile=20000.; #lbf/in^2\n", + "\n", + "# calculation\n", + "t=p_working*d/sigma_tensile/2; #in\n", + "\n", + "# result\n", + "print \"Thichness of the storage tank is\",\n", + "print t,\n", + "print \"in\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thichness of the storage tank is 0.75 in\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " example 2.11 page no : 53\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# variables\n", + "p_atm=1.; #atm\n", + "T=293.; #K\n", + "d=3.; #m (diameter of the balloon)\n", + "\n", + "# calculation\n", + "#buoyant force=(density of air)*g*(volume of balloon)\n", + "#weight of balloon = (density of helium)*g*(volume of balloon)\n", + "#density for gases = PM/RT\n", + "#payload of balloon = buoyant force - weight\n", + "V_balloon=(math.pi)*d**3/6.; #m^3\n", + "R=8.2*10**(-2); #m^3.atm/mol/K\n", + "M_air=29.; #Kg/Kmol\n", + "M_he=4.; #Kg/Kmol\n", + "g=9.81; #m/s^2\n", + "payload=(V_balloon)*g*p_atm*(M_air-M_he)/R/T; #N\n", + "\n", + "# result\n", + "print \"Payload of the balloon is\",\n", + "print payload,\n", + "print \"N\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Payload of the balloon is 144.307841185 N\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " example 2.12 page no : 54\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# variables\n", + "#calc fraction of block in water\n", + "SG_wood=0.96; #Specific gravity\n", + "SG_gasoline=0.72;\n", + "\n", + "# calculation\n", + "#Let r be the ratio - V_water/V_wood\n", + "r=(SG_wood-SG_gasoline)/(1-SG_gasoline);\n", + "\n", + "# result\n", + "print \"Fraction of wood in water\",\n", + "print r" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Fraction of wood in water 0.857142857143\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " example 2.13 page no : 54\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variables\n", + "#height of water above pt.C = 2.5ft\n", + "rho_water=62.3; #lbm/ft^3;\n", + "h1=2.5; #ft\n", + "rho_gas=0.1; #lbm/ft^3\n", + "h2=0.5; #ft (height of gas)\n", + "g=32.2; #ft/s^2\n", + "\n", + "# calculation\n", + "gauge_pressure=((rho_water)*g*h1+(rho_gas)*g*h2)/144/32.2 #lbf/in^2\n", + "\n", + "# result\n", + "print \"Gauge pressure is\",\n", + "print gauge_pressure,\n", + "print \"lbf/in^2\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Gauge pressure is 1.08194444444 lbf/in^2\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " example 2.14 page no : 56\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "rho_water=62.3; #lbm/ft^3\n", + "SG_oil=1.1;\n", + "rho_oil=SG_oil*(rho_water);\n", + "g=32.2; #ft/s^2\n", + "h1_1=1.; #ft\n", + "h1_2=2.; #ft\n", + "h2_1=2.; #ft\n", + "h2_2=1.; #ft\n", + "\n", + "# calculation\n", + "p_diff=((rho_water)*g*(h1_1-h1_2)+(rho_oil)*g*(h2_1-h2_2))/32.2/144.0; #lbf/in^2\n", + "\n", + "# result\n", + "print \"The pressure difference is\",\n", + "print p_diff,\n", + "print \"lbf/in^2\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The pressure difference is 0.0432638888889 lbf/in^2\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " example 2.15 page no : 57\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# variables\n", + "k=10000.; #N/m (spring constant)\n", + "x=0.025; #m (displacement in spring)\n", + "A=0.01; #m^2 (area of piston)\n", + "\n", + "# calculation\n", + "gauge_pressure=k*x/A/1000.; #KPa\n", + "\n", + "# result\n", + "print \"The gauge pressure is\",\n", + "print gauge_pressure,\n", + "print \"KPa\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The gauge pressure is 25.0 KPa\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " example 2.16 page no : 60\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variables\n", + "g=32.2; #ft/s^2\n", + "h=20.; #ft (height of fireplace)\n", + "rho_air=0.075; #lbm/ft^3\n", + "T_air=293.0; #K (surrounding temperature)\n", + "T_fluegas=422.0; #K\n", + "\n", + "# calculation\n", + "p_diff=g*h*(rho_air)*(1-(T_air/T_fluegas))/32.2/144; #lbf/in^2\n", + "\n", + "# result\n", + "print \"The pressure difference is\",\n", + "print p_diff,\n", + "print \"lbf/in^2\"," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The pressure difference is 0.00318424170616 lbf/in^2\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " example 2.17 page no : 64\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# variables\n", + "rho_water=1000. #Kg/m^3\n", + "g=9.81; #m/s^2\n", + "h=5.; #m (depth of water)\n", + "\n", + "# calculation and result\n", + "#for elevator not accelerated\n", + "p_gauge=(rho_water)*g*h/1000.0; #KPa\n", + "print \"THe gauge pressure is\",\n", + "print p_gauge,\n", + "print \"KPa\"\n", + "\n", + "#for elevator accelerated at 5m/s^2 in upward direction\n", + "a=5.; #m/s^2\n", + "p_gauge=(rho_water)*(g+a)*h/1000.0; #KPa\n", + "print \"THe gauge pressure is\",\n", + "print p_gauge,\n", + "print \"KPa\"\n", + "\n", + "#for elevator accelerated at 5m/s^2 in downward direction\n", + "a=5.; #m/s^2\n", + "p_gauge=(rho_water)*(g-a)*h/1000.0; #KPa\n", + "print \"THe gauge pressure is\",\n", + "print p_gauge,\n", + "print \"KPa\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "THe gauge pressure is 49.05 KPa\n", + "THe gauge pressure is 74.05 KPa\n", + "THe gauge pressure is 24.05 KPa\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.18 page no : 65\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# variables\n", + "#angle free surface makes with the horizontal in an accelerated body\n", + "a=1.; #ft/s^2\n", + "g=32.2; #ft/s^2\n", + "\n", + "# calculation\n", + "theta=math.atan(a/g); #radians\n", + "theta=theta*180./math.pi; #degrees\n", + "\n", + "# result\n", + "print \"The angle made by free surface with the horizontal is\",\n", + "print theta,\n", + "print \"degrees\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The angle made by free surface with the horizontal is 1.77880031567 degrees\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " example 2.19 page no : 66\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "# variables\n", + "f=78/60.0; #rps\n", + "r=0.15; #m\n", + "g=9.81; #m/s^2\n", + "\n", + "# calculation\n", + "#omega=2*(%pi)*f\n", + "z=((2*(math.pi)*f)**2)*r**2/2/g; #m\n", + "\n", + "# result\n", + "print \"The liquid in the cylinder rises to a height of\",\n", + "print z,\n", + "print \"m\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The liquid in the cylinder rises to a height of 0.0765120708158 m\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " example 2.20 page no : 67\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# variables\n", + "#Let difference between heights at bottom and top be d\n", + "d=20.; #in\n", + "r_a=14.; #in\n", + "f=1000/60.; #rps\n", + "g=32.2; #ft/s^2\n", + "\n", + "# calculation\n", + "r_b=((r_a)**2-2*(d)*g*12/(2*(math.pi)*f)**2)**0.5; #in\n", + "\n", + "# result\n", + "print \"The thickness of water strip at bottom of industrial centrifuge\",\n", + "print r_b,\n", + "print \"in\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The thickness of water strip at bottom of industrial centrifuge 13.9495728181 in\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch20-checkpoint.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch20-checkpoint.ipynb new file mode 100644 index 00000000..2a777cf6 --- /dev/null +++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch20-checkpoint.ipynb @@ -0,0 +1,165 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:160cdac5d7f0b7135dad8dda86f1147a9289b5d9942c1ebb05ca32b461c42f4f" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 20 : Liquid and Gases in Equilibrium with Solids" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 20.1 Page no. 594\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "%pylab inline\n", + "\n", + "from matplotlib import pyplot as plt\n", + "\n", + "# Variables\n", + "p_CO2 = [0,25,50,100,200,400,760] ;\t\t\t# Values of partial pressure of CO2 - [mm Hg]\n", + "y = [0,6.69*10**-2,9.24*10**-2,0.108,0.114,0.127,0.137] ;\t\t\t# adsorption of CO2 -[g adorbed / g seives]\n", + "\n", + "# Results\n", + "plt.plot(p_CO2,y);\n", + "plt.title('Figure E20.1 The Freundlich and Langmuir iotherms coincide for the adsorption of CO2 on 5A molecular seives');\n", + "plt.show()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Populating the interactive namespace from numpy and matplotlib\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAqcAAAEICAYAAABiR12iAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlclPX+Pv5rFAxlR5BtQFRQlhQ1XNBStMU0RZMyqEyL\nU2ZZadavbBNaNCsry05H+5RmFnrOyaNkSGZGWoqcFPUkmmiiLGKKIqDAMMPr98d8uWXYsdGZe7ye\njwcPnbm319xz3++55l7eoxERARERERGRFehg6QKIiIiIiOownBIRERGR1WA4JSIiIiKrwXBKRERE\nRFaD4ZSIiIiIrAbDKRERERFZjcsOp87OzsjLyzNjKdeWDh064I8//rB0GVfM9OnT8fLLLwMAMjIy\nEBAQoAy7/vrrsW3btlbnYal1lJeXhw4dOqC2tvaqL/tqOHHiBJydndGeXuTa+p41JSkpCVOnTr2s\nadXAHG3hwoUL8fDDDzc7PCgoCD/88MNlzfvjjz+Gt7c3XFxccO7cucstsVmW3F+sZdu6nH3KHE6d\nOoURI0bAxcUFzz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cFRYWYvPmzZdV38yZM3Ho0CGkpqbiuuuuMxl255134rfffsO6detQVVWF\n5ORk9O/fH717925yXgaDAVVVVdDr9TAYDKiurjbb3cP1Q8yjjz6KBQsWICcnB4DxaG79C4sv16OP\nPooXXnhBCV+nT59GamoqAKB3796oqqpCWloaampq8Prrr6O6urpN842OjoadnR0++OAD1NTUYN26\ndfjvf//bpmn/9re/4eWXX8aRI0cgIti/fz/Onj3b5LgthbyKigo4OzujS5cuOHToED7++OMWl1t/\nfU+ZMgUffPABCgsLce7cObz55put1q3T6VBVVaX86fV6VFRUoHPnznB1dcXZs2dNLlhv7TXExcXh\nm2++wc6dO6HT6ZCUlPSXjtD3798fa9asgV6vx6+//oqvv/66xYarPctKSEjA66+/jjNnzuDMmTN4\n9dVXlQvmvb29UVJSYvJlsqV5Dx48GM7OznjrrbdQWVkJg8GA3377Tbnrtrlp6z/f0vx//fVX7Nq1\nCzU1NejSpQscHBya/GD19fXF2LFj8dhjj6G0tBQ1NTVKv64JCQlYsWIF9u3bh+rqarzwwgsYOnRo\nk0fYW6rljjvuwMmTJ7FkyRJUV1ejvLwcWVlZjcaLi4vDxo0b8csvv0Cn0+GVV14x+RBqaT9uzbhx\n43D48GGkpKRAr9dj7dq1OHToEMaPH9+m1wAY3+OW2vCG2lNvS/tQ9+7dERUVhfnz56OmpgY///yz\n8gEKGG/q/N///geDwQBnZ2fY29ujY8eO0Gq1GDZsGObNm4fq6mrs378fn332Ge6///4W6969ezf+\n85//QK/X4/3334eDg4MS1lpaBwEBAZe1vKa09n619l699dZbWLlyJd555x0lsO3btw8JCQkAjEeb\ntVot7r77bhw/fhw1NTX47rvv8NRTTyE5OVk5i9jS52hDCQkJeO+995CXl4eKigq88MILiI+PR4cO\nzceN5l5H3VlbEUFWVhY++OADTJw4EYDxZq7Q0FAcPnwY+/btU25m1mq1ypG9v+Luu+/Gt99+i61b\nt6KmpgaLFy+Gg4MDhg0b1mjclrbx++67D1u2bMG//vUv6PV6lJSUKAfF+vf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0nIiIH\nDv1jr2cAAAUVSURBVByQyMhI0el0cuzYMenVq5cYDIYrXuPJkyclOztbRETKy8uld+/ekpOTY3V1\niohcuHBBRERqampkyJAhsn37dqusU0Rk8eLFcu+998qECRNExPredxGRoKAgKSkpMXnOGut84IEH\n5NNPPxUR43tfWlpqlXWKiBgMBvHx8ZETJ05YXY3Hjh2THj16SFVVlYiITJkyRVauXGl1dRK1FcMp\nqcKOHTtkzJgxyuOFCxfKwoULLViR8QOhfjjt06ePFBcXi4gxGPbp00dEjEco6h/pHTNmjOzcufPq\nFisiEydOlO+//96q67xw4YJERUXJb7/9ZpV15ufny8033yxbt25VjpxaY51BQUFy5swZk+esrc7S\n0lLp0aNHo+etrc463333ndx4441WWWNJSYn07t1bzp49KzU1NTJ+/HjZvHmz1dVJ1Fa8IYpUoS19\nqFraqVOn4O3tDQDw9vbGqVOnAABFRUUmPQ9Yova8vDxkZ2djyJAhVllnbW0t+vfvD29vb4waNQoR\nERFWWeecOXPw9ttvo0OHS02nNdap0Whwyy23ICoqCp988olV1nns2DF4eXnhwQcfxMCBA/Hwww/j\nwoULVldnnTVr1iAhIQGA9a1LDw8PzJ07F4GBgfDz84ObmxtuvfVWq6uTqK0YTkkV1NK3aR2NRtNi\nzVfz9VRUVCAuLg5LliyBs7Nzozqsoc4OHTpg7969KCgowLZt2/Djjz82qsPSdW7cuBHdunXDgAED\nmu3SzBrqBIBffvkF2dnZ2LRpEz766CNs3769UR2WrlOv12PPnj147LHHsGfPHjg6OuLNN99sVIel\n6wQAnU6Hb775BnfffXeTNVi6xqNHj+L9999HXl4eioqKUFFRgdWrVzeqw9J1ErUVwympQlv6ULU0\nb29vFBcXAwBOnjyJbt26AWi6b1d/f/+rUlNNTQ3i4uIwdepUTJo0yWrrrOPq6oo77rgDu3fvtro6\nd+zYgdTUVPTo0QMJCQnYunUrpk6danV1AoCvry8AwMvLC3feeSeysrKsrk6tVgutVotBgwYBAO66\n6y7s2bMHPj4+VlUnAGzatAk33HADvLy8AFjfPvTrr79i2LBh6Nq1K+zs7DB58mTs3LnTKtclUVsw\nnJIqqKEf1NjYWHz++ecAgM8//1wJg7GxsVizZg10Oh2OHTuG3NxcDB48+IrXIyJITExEeHg4Zs+e\nbbV1njlzBqWlpQCAyspKfP/99xgwYIDV1blgwQLk5+fj2LFjWLNmDUaPHo0vvvjC6uq8ePEiysvL\nAQAXLlzA5s2b0bdvX6ur08fHBwEBATh8+DAAYMuWLYiIiMCECROsqk4ASElJUU7p19ViTTWGhoYi\nMzMTlZWVEBFs2bIF4eHhVrkuidrEwte8ErVZWlqa9O7dW3r16iULFiywaC3x8fHi6+sr9vb2otVq\n5bPPPpOSkhK5+eabm+y25Y033pBevXpJnz59JD09/arUuH37dtFoNBIZGal0hbNp0yarq3P//v0y\nYMAAiYyMlL59+8pbb70lImJ1ddaXkZGh3K1vbXX+8ccfEhkZKZGRkRIREaHsK9ZWp4jI3r17JSoq\nSvr16yd33nmnlJaWWl2dFRUV0rVrVykrK1Oes7YaRUQWLVqkdCX1wAMPiE6ns8o6idpCI8LfgyQi\nIiIi68DT+kRERERkNRhOiYiIiMhqMJwSERERkdVgOCUiIiIiq8FwSkRERERWg+GUiIiIiKzG/w8p\nc1U4iFUHtQAAAABJRU5ErkJggg==\n", + "text": [ + "" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 20.2 page no. 596\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "G = 1000.0 ;\t\t\t# Volume of solution - [L]\n", + "S_ad = 1.56 ;\t\t\t# amount of Steptomycin adsorbed per gram resin-[g strep./g resin]\n", + "cn_S = 6. ;\t\t\t# Concentration of streptomycin solution-[g/L]\n", + "\n", + "# Calculations\n", + "# Assume equilibrium occurs so that total(max) amount of streptomycin is adsorbed \n", + "max_S = cn_S*G ;\t\t\t# Maximum streptomycin adsorbed-[g]\n", + "#Use streptomycin balance to get amount of resin required \n", + "R = max_S/S_ad ;\t\t\t#Amount of resin required to adsorb required amount of streptomycin\n", + "\n", + "# Results\n", + "print 'Amount of resin required to adsorb required amount of streptomycin is %.0f g . '%R\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Amount of resin required to adsorb required amount of streptomycin is 3846 g . \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 20.3 page no. 596\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "G = 1000. ;\t\t\t# Volume of solution - [L]\n", + "x = [19.2,17.2,12.6,8.6,3.4,1.4] ;\t\t\t# concentration of solute- [g/L] \n", + "ac = [0,0.01,0.04,0.08,0.20,0.40] ;\t\t\t# Activated charcoal added-[g/1000g sol] \n", + "# Assume all concentration can be treated as g solute/1000 g sol.\n", + "\n", + "# Calculations\n", + "y2 = (x[0]-x[1])/ac[1] ;\t\t\t# -[ g solute/g carbon]\n", + "y3 = (x[0]-x[2])/ac[2] ;\t\t\t# -[ g solute/g carbon]\n", + "y4 = (x[0]-x[3])/ac[3] ;\t\t\t# -[ g solute/g carbon]\n", + "y5 = (x[0]-x[4])/ac[4] ;\t\t\t# -[ g solute/g carbon]\n", + "y6 = (x[0]-x[5])/ac[5] ;\t\t\t# -[ g solute/g carbon]\n", + "\n", + "# Use polymath to get Freundlich isotherm to bo y= 37.919*x**(0.583)\n", + "y = 37.919*x[5]**(0.583) ;\t\t\t#From Freundlich isotherm\n", + "A_by_G = (x[0]-x[5])/y ;\t\t\t#Minimum mss of activated carbon required- [g carbon/1000 g sol.]\n", + "\n", + "# Results\n", + "print 'Minimum mass of activated carbon required is %.2f g carbon/1000 g sol. '%A_by_G\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Minimum mass of activated carbon required is 0.39 g carbon/1000 g sol. \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "code", + "collapsed": true, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch21-checkpoint.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch21-checkpoint.ipynb new file mode 100644 index 00000000..69c36534 --- /dev/null +++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch21-checkpoint.ipynb @@ -0,0 +1,246 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:63761cd2f20f542c8cf7d5599bfa09993cda87c6763136710915fa76185904f1" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 21 : Energy Terminology Concepts and Units" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 21.1 Page no : 616" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from scipy.integrate import quad\n", + "\n", + "# Variables\n", + "V1 = 0.1 ;\t\t\t# Volume of gas initially -[cubic metres]\n", + "V2 = 0.2 ;\t\t\t# Volume of gas finally -[cubic metres]\n", + "T1 = 300 ;\t\t\t# Temperature of gas initially -[K]\n", + "P1 = 200 ;\t\t\t# Pressure of gas finally -[kPa]\n", + "R = 8.314 ;\t\t\t# Universal gas constant \n", + "n = (P1*V1)/(T1*R) ;\t\t\t# Moles of gas taken-[kg mol]\n", + "#You are asked to calculate work by eqn. 21.1 , but you do not know the F(force) exerted by gas , so write F = P.A, multiply divide A and eqn 21.1 reduces to W= integate(P.dv)\n", + "\n", + "# Calculations and Results\n", + "# Isobaric process see fig E21.1b to see the path followed\n", + "def f(V):\n", + " return -(P1)\n", + "W= quad(f,V1,V2)[0] ;\t\t\t# Work done by gas on piston -[kJ]\n", + "print ' (a)Work done by gas on piston for isobaric process is %.0f kJ . ',W\n", + "\n", + "def f1(V):\n", + " return -(T1*R*n/V)\n", + "W= quad(f1,V1,V2)[0] ;\t\t\t# Work done by gas on piston -[kJ]\n", + "print '(b)Work done by gas on piston for isothermal process is %.2f kJ . ',W\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " (a)Work done by gas on piston for isobaric process is %.0f kJ . -20.0\n", + "(b)Work done by gas on piston for isothermal process is %.2f kJ . -13.8629436112\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 21.2 page no. 624\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "id_ = 3. ;\t\t\t# Internal diameter of tube-[cm]\n", + "Vf = 0.001 ;\t\t\t# Volume flow rate of water in tube-[cubic meter/s]\n", + "rho = 1000. ;\t\t\t# Assumed density of water-[kg/cubic meter] \n", + "\n", + "# Calculations\n", + "rad = id_/2. ;\t\t\t# Radius of tube -[ cm]\n", + "a = 3.14*rad**2 ;\t\t\t# Area of flow of tube -[squqre centimeter]\n", + "v = Vf*(100)**2/a ;\t\t\t# Velocity of water in tube - [m/s]\n", + "KE = v**2/2. ;\t\t\t# Specific(mass=1kg) kinetic energy of water in tube -[J/kg]\n", + "\n", + "# Results\n", + "print 'Specific kinetic energy of water in tube is %.2f J/kg . '%KE\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Specific kinetic energy of water in tube is 1.00 J/kg . \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 21.3 page no. 626\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "# Let water level in first reservoir be the reference plane\n", + "h = 40. ;\t\t\t# Difference of water-[ft]\n", + "g = 32.2 ;\t\t\t# acceleration due to gravity-[ft/square second]\n", + "\n", + "# Calculations\n", + "PE=g*h/(32.2*778.2) ;\t\t\t#\t\t\t# Specific(mass=1kg) potential energy of water -[Btu/lbm]\n", + "\n", + "# Results\n", + "print 'Specific potential energy of water is %.4f Btu/lbm . '%PE\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Specific potential energy of water is 0.0514 Btu/lbm . \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 21.4 page no : 629" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "\n", + "# Variables\n", + "#Constant volume process \n", + "mol_air = 10. ;\t\t\t# Moles of air-[kg mol]\n", + "T1 = 60.+273 ;\t\t\t# Initial temperature of air-[K]\n", + "T2 = 30.+273 ;\t\t\t# final temperature of air-[K]\n", + "# Additional data needed\n", + "Cv = 2.1*10.**4 ; \t\t\t# Specific heat capacity of air at constant volume-[J/(kg mol*C)]\n", + "\n", + "# Calculations\n", + "def f(T):\n", + " return mol_air*Cv\n", + "del_U = quad(f,T1,T2)[0] ;\t\t\t#Change in internal energy-[J]\n", + "\n", + "# Results\n", + "print 'Change in internal energy is %.1e J . '%del_U\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Change in internal energy is -6.3e+06 J . \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 21.7 page no : 633" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Constant pressure process \n", + "mol_air = 10. ;\t\t\t# Moles of air-[kg mol]\n", + "T1 = 60+273 ;\t\t\t# Initial temperature of air-[K]\n", + "T2 = 30+273 ;\t\t\t# final temperature of air-[K]\n", + "\n", + "# Calculations\n", + "# Additional data needed\n", + "Cp = 2.9*10**4 ;\t\t\t# Specific heat capacity of air at constant pressure-[J/(kg mol*C)]\n", + "# Use eqn. 21.11 for del_H\n", + "def f(T):\n", + " return mol_air*Cp\n", + "\n", + "del_H = quad(f,T1,T2)[0] ;\t\t\t#Change in enthalpy-[J]\n", + "print 'Change in enthalpy is %.1e J . '%del_H\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Change in enthalpy is -8.7e+06 J . \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch22-checkpoint.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch22-checkpoint.ipynb new file mode 100644 index 00000000..52b1e9dd --- /dev/null +++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch22-checkpoint.ipynb @@ -0,0 +1,293 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:378027dede13493be733241ad48420c91ebbcd1218fa032fc3c46fa099a45a58" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 22 : Introduction to Energy Balances for Process without Reaction" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 22.1 page no. 651\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "#Assume that properties of water can be used to substitute properties of solution\n", + "# Given\n", + "V = 1.673 ;\t\t\t# Volume of closed vessel-[cubic metre]\n", + "m = 1. ;\t\t\t# mass of saturated liquid vaporized-[kg]\n", + "Pi = 1. ;\t\t\t# Initial pressure -[atm]\n", + "Ti = 10. ;\t\t\t# Initial temperature -[degree C]\n", + "Pf = 1. ;\t\t\t# final pressure -[atm]\n", + "Tf = 100. ;\t\t\t# final temperature -[degree C]\n", + "\n", + "# Use steam table to obtain additional information at given condition\n", + "Ui = 35. ;\t\t\t# Initial enthalpy-[kJ/kg]\n", + "Uf = 2506.0 ;\t\t\t# Final enthalpy -[kJ/kg]\n", + "\n", + "# Calculations\n", + "# Use eqn. 22.2 after modifiying it using given conditions(W = 0,del_KE = 0 and del_PE = 0 )\n", + "Q = m*(Uf - Ui) ;\t\t\t# Heat transferred to the vessel - [kJ]\n", + "\n", + "# Results\n", + "print 'Heat transferred to the vessel is %.1f kJ . '%Q\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat transferred to the vessel is 2471.0 kJ . \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 22.2 page no. 652\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "# Given\n", + "T1 = 80. ;\t\t\t# Initial temperature -[degree F]\n", + "T1 = 40. ;\t\t\t# final temperature -[degree F]\n", + "\n", + "# Additional data obtained from steam table at given temperatures and corresponding vapour pressures\n", + "p1 = 0.5067 ;\t\t\t# Initial saturation pressure-[psia]\n", + "p2 = 0.1217 ;\t\t\t# Final saturation pressure-[psia]\n", + "V1 = 0.01607 ;\t\t\t# Initial specific volume - [cubic feet/lb]\n", + "V2 = 0.01602 ;\t\t\t# Final specific volume - [cubic feet/lb]\n", + "H1 = 48.02 ;\t\t\t#Initial specific enthalpy -[Btu/lb]\n", + "H2 = 8.05 ;\t\t\t# Final specific enthalpy -[Btu/lb]\n", + "\n", + "# Calculations\n", + "del_P = p2 - p1 ;\t\t\t# Change in pressure -[psia]\n", + "del_V = V2 - V1 ;\t\t\t# Change in specific volume -[cubic feet/lb]\n", + "del_H = H2 - H1 ;\t\t\t# Change in specific enthalpy -[Btu/lb]\n", + "del_pV = p2*144*V2/778. - p1*144*V1/778. ;\t\t\t# Change in pv-[Btu]\n", + "del_U = del_H - del_pV ;\t\t\t# Change in specific internal energy - [Btu/lb]\n", + "del_E = del_U ;\t\t\t# Change in specific total energy(since KE=0,PE=0 and W=0) -[Btu/lb]\n", + "\n", + "# Results\n", + "print 'Change in pressure is %.3f psia . '%del_P\n", + "print 'Change in specific volume is %.5f cubic feet/lb (negligible value) . '%del_V\n", + "print 'Change in specific enthalpy is %.2f Btu/lb . '%del_H\n", + "print 'Change in specific internal energy is %.2f Btu/lb . '%del_U\n", + "print 'Change in specific total energy is %.2f Btu/lb . '%del_E\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Change in pressure is -0.385 psia . \n", + "Change in specific volume is -0.00005 cubic feet/lb (negligible value) . \n", + "Change in specific enthalpy is -39.97 Btu/lb . \n", + "Change in specific internal energy is -39.97 Btu/lb . \n", + "Change in specific total energy is -39.97 Btu/lb . \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 22.3 page no. 662\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "#Lets take tank to be system\n", + "# Given\n", + "T = 600. ; \t\t\t# Temperature of steam -[K]\n", + "P = 1000. ;\t\t\t# Pressure of steam -[kPa]\n", + "\n", + "# Calculations\n", + "# Additional data for steam obtained from CD database at T and P\n", + "U = 2837.73 ;\t\t\t# Specific internal energy-[kJ/kg]\n", + "H = 3109.44 ;\t\t\t# Specific enthalpy -[kJ/kg]\n", + "V = 0.271 ;\t\t\t# Specific volume -[cubic metre/kg]\n", + "# By the reduced equation \n", + "Ut2 = H ;\t\t\t# Internal energy at final temperature-[kJ/kg]\n", + "\n", + "# Results\n", + "print 'The specific internal energy at final temperature is %.2f kJ/kg. Now use two properties\\\n", + "of the steam (P = %i kPa and Ut2 = %.2f kJ/kg) to find final temperature (T) from steam table. \\\n", + "From steam table we get T = 764 K.'%(Ut2,P,Ut2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The specific internal energy at final temperature is 3109.44 kJ/kg. Now use two propertiesof the steam (P = 1000 kPa and Ut2 = 3109.44 kJ/kg) to find final temperature (T) from steam table. From steam table we get T = 764 K.\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 22.4 page no. 669\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "# Take milk plus water in tank to be system\n", + "# Given\n", + "T1_water = 70. ;\t\t\t# Temperature of entering water -[degree C]\n", + "T2_water = 35. ;\t\t\t# Temperature of exiting water -[degree C]\n", + "T1_milk = 15. ;\t\t\t#Temperature of entering milk -[degree C]\n", + "T2_milk = 25. ;\t\t\t#Temperature of exiting milk -[degree C]\n", + "\n", + "# Get additional data from steam table for water and milk,assuming milk to have same properties as that of water.\n", + "H_15 = 62.01 ;\t\t\t#Change in specific internal energy-[kJ/kg]\n", + "H_25 = 103.86 ;\t\t\t#Change in specific internal energy-[kJ/kg]\n", + "H_35 = 146.69 ;\t\t\t#Change in specific internal energy-[kJ/kg]\n", + "H_70 = 293.10 ;\t\t\t#Change in specific internal energy-[kJ/kg]\n", + "\n", + "# Assumptions to simplify Equation 22.8 are:\n", + "print 'Assumptions to simplify Equation 22.8 are:'\n", + "print '1. Change in KE and PE of system = 0.'\n", + "print '2. Q = 0 ,because of way we picked the system,it is is well insulated.'\n", + "print '3. W = 0,work done by or on the system.'\n", + "\n", + "# Calculations\n", + "#Basis m_milk = 1 kg/min , to directly get the answer .\n", + "m_milk = 1 ;\t\t\t# Mass flow rate of milk-[kg/min]\n", + "# By applying above assumtions eqn. 22.8 reduces to del_H = 0 .Using it get m_water-\n", + "m_water = (m_milk*(H_15 - H_25))/(H_35 - H_70) ; \t\t\t# Mass flow rate of water-[kg/min]\n", + "m_ratio = m_water/m_milk ;\t\t\t# Mass flow rate of water per kg/min of milk-[kg/min]\n", + "\n", + "# Results\n", + "print 'Mass flow rate of water per kg/min of milk is %.2f (kg water/min )/(kg milk/min).'%m_ratio\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Assumptions to simplify Equation 22.8 are:\n", + "1. Change in KE and PE of system = 0.\n", + "2. Q = 0 ,because of way we picked the system,it is is well insulated.\n", + "3. W = 0,work done by or on the system.\n", + "Mass flow rate of water per kg/min of milk is 0.29 (kg water/min )/(kg milk/min).\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 22.5 page no. 670\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "# Take pipe between initial and final level of water\n", + "# Given\n", + "h_in = -20. ;\t\t\t# Depth of water below ground-[ft]\n", + "h_out = 5. ;\t\t\t# Height of water level above ground-[ft]\n", + "h = h_out - h_in ;\t\t\t# Total height to which water is pumped-[ft]\n", + "V = 0.50 ;\t\t\t# Volume flow rate of water - [cubic feet/s]\n", + "ef = 100.; \t\t\t# Efficiency of pump - [%] \n", + "g = 32.2; \t\t\t# Acceleration due to gravity -[ft/square second] \n", + "gc = 32.2 ;\t\t\t#[(ft*lbm)/(second square*lbf)]\n", + "\n", + "M = V * 62.4 ;\t\t\t# mass flow rate - [lbm/s]\n", + "PE_in = 0 ;\t\t\t# Treating initial water level to be reference level\n", + "\n", + "# Calculations\n", + "PE_out = (M*g*h*1.055)/(gc*778.2) ;\t\t\t# PE of discharged water -[lbm*(square feet/square second)]\n", + "W = PE_out - PE_in ;\t\t\t#Work done on system = power delivered by pump, (since we are using mass flow rate and pump efficiency is 100 % , so W = Power) -[kW]\n", + "\n", + "# Results\n", + "print 'The electric power required by the pump is %.2f kW. '%W\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The electric power required by the pump is 1.06 kW. \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "code", + "collapsed": true, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch23-checkpoint.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch23-checkpoint.ipynb new file mode 100644 index 00000000..78279b16 --- /dev/null +++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch23-checkpoint.ipynb @@ -0,0 +1,532 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:85497d817768e6e1d81546cc4adcb855eed2a97589497e4f8a3f22d0bc4a6c3d" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "\n", + "Chapter 23 : Calculation of Enthalpy Changes" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 23.1 Page no. 686\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "%pylab inline\n", + "from matplotlib.pyplot import *\n", + "\n", + "# Variables\n", + "# Given\n", + "x_Tl = [90,92,97,100] ;\t\t\t# Temperature of saturated liquid- [degree C]\n", + "x_Tg = [100,102,107,110] ;\t\t\t# Temperature of saturated vapour- [degree C]\n", + "y_Hl = [376.9,385.3,406.3,418.6] ;\t\t\t# Enthalpy change of saturated liquid -[kJ/kg]\n", + "y_Hg = [2256.44,2251.2,2237.9,2229.86] ;\t\t\t# Enthalpy change of saturated vapour -[kJ/kg]\n", + "\n", + "# Results\n", + "plot(x_Tl,y_Hl,x_Tg,y_Hg);\n", + "show()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Populating the interactive namespace from numpy and matplotlib\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYEAAAD9CAYAAABazssqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAFTxJREFUeJzt3V9MW+fBx/HfCbjKXiVRclFMZkdyF0yJgwN0lZOLZXOV\nQBOkMapMqGRrSEOmCTQtVaOp20U7mLRCL7aJpkPqBZ1QJhUytUA0rRYXk9O10mCjRJrqrHE0omJj\n2DKGRFZekZDzXkTxG8J/7GDI8/1IEeb4nOPHJyfnax+Og2Xbti0AgJE2ZXoAAIDMIQIAYDAiAAAG\nIwIAYDAiAAAGIwIAYLBFIzA8PKxnnnlGe/fuVWFhod58801JUkNDg9xut0pKSlRSUqIPPvgguUxT\nU5O8Xq8KCgrU29ubnD4wMCC/3y+v16szZ848pKcDAFgJa7HPCYyOjmp0dFTFxcW6efOmvvrVr6q7\nu1sXLlzQ1q1b9fLLL8+aPxKJ6Pjx4/rLX/6ieDyuw4cPKxqNyrIsBQIBvfXWWwoEAiovL9cPf/hD\nHTly5KE/QQDAwhZ9J5Cbm6vi4mJJ0pYtW7Rnzx7F43FJ0nzt6OnpUXV1tRwOhzwej/Ly8tTX16dE\nIqHJyUkFAgFJ0okTJ9Td3Z3u5wIAWKFl/0zg+vXrGhwc1IEDByRJ586dU1FRkWprazUxMSFJGhkZ\nkdvtTi7jdrsVj8fnTHe5XMmYAAAyJ3s5M928eVPf/va31dLSoi1btqiurk6vvfaaJOnVV1/V2bNn\n1dbWlvJgLMtKeR0AYKLV/g9AS74TuHXrlo4dO6bvfve7qqyslCTl5OTIsixZlqXTp0+rv79f0t1X\n+MPDw8llY7GY3G63XC6XYrHYrOkul2vBJ8Kf9Pz56U9/mvExPEp/2J5sy/X6JxWLRsC2bdXW1srn\n8+mll15KTk8kEsnbXV1d8vv9kqSKigp1dHRoenpaQ0NDikajCgQCys3N1bZt29TX1yf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\n", + "text": [ + "" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 23.2 page no. 687\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# Variables\n", + "# Basis : 1 g mol\n", + "R = 8.314 * 10**-3 ;\t\t\t# Ideal gas constant -[kJ/(g mol * K)]\n", + "Hv = 30.20 ;\t\t\t# Experimental value of heat of vaporization of acetone -[kJ/g] \n", + "\n", + "# additional needed data for acetone from Appendix D\n", + "T = 329.2 ;\t\t\t# Normal boiling point of acetone - [K]\n", + "Tc = 508.0 ;\t\t\t# Critical temperature of acetone - [K]\n", + "Pc = 47.0 ;\t\t\t# Critical presure of acetone -[atm]\n", + "\n", + "# Calculations and Results\n", + "Tbc = T/Tc ;\t\t\t# variable required in etimation equations\n", + "lnPc = math.log(Pc) ;\t\t\t# variable required in etimation equations\n", + "\n", + "B = 2940.46 ;\n", + "C = -35.93 ;\n", + "\n", + "del_Hv1 = (R*B*T**2)/((C+T)**2) ;\t\t\t#Heat of vapourization -[kJ/g]\n", + "d1 = (abs(Hv - del_Hv1)*100)/Hv ;\t\t\t# differece of experimental and calculated value -[%]\n", + "print '(a) Heat of vapourization of acetone is %.2f kJ/g mol. And differece of experimental and calculated value is %.1f %% . '%(del_Hv1,d1);\n", + "\n", + "del_Hv2 = R*T*((3.978*Tbc - 3.938 +1.555*lnPc)/(1.07 - Tbc)) ;\t\t\t#Heat of vapourization -[kJ/g]\n", + "d2 = (abs(Hv - del_Hv2)*100)/Hv ;\t\t\t# differece of experimental and calculated value -[%]\n", + "print ' (b) Heat of vapourization of acetone is %.2f kJ/g mol. And differece of experimental and calculated value is %.1f %% . '%(del_Hv2,d2);\n", + "\n", + "\n", + "del_Hv3 = 1.093*R*Tc*((Tbc*(lnPc-1))/(0.93-Tbc)) ;\t\t\t#Heat of vapourization -[kJ/g]\n", + "d3 = (abs(Hv - del_Hv3)*100)/Hv ;\t\t\t# differece of experimental and calculated value -[%]\n", + "print ' (c) Heat of vapourization of acetone is %.2f kJ/g mol. And differece of experimental and calculated value is %.1f %% . '%(del_Hv3,d3);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a) Heat of vapourization of acetone is 30.80 kJ/g mol. And differece of experimental and calculated value is 2.0 % . \n", + " (b) Heat of vapourization of acetone is 30.01 kJ/g mol. And differece of experimental and calculated value is 0.6 % . \n", + " (c) Heat of vapourization of acetone is 30.24 kJ/g mol. And differece of experimental and calculated value is 0.1 % . \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "\n", + "Example 23.3 Page no. 693\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "c = 2.675*10**4 #*.4536)/(1055*1.8) ;\n", + "d = 42.27#*.4536)/(1055*1.8) ;\n", + "e = 1.425*10**-2#*.4536)/(1055*1.8) ;\n", + "# Calculations\n", + "#Now convert Tk (Temperature in K) to TF (temperature in F) to get answer of form x + yT - zT**2,where\n", + "x = c + d*460/1.8 - e*((460/1.8)**2) ;\n", + "y = d/1.8;\n", + "z = e/(1.8*1.8) ;\n", + "\n", + "# Results\n", + "print 'The required answer is %.2e + (%.2e)T - (%.3e) T**2 Btu/(lb mol*F) , where T is in degree F . '%(x,y,z)\n", + "\n", + "print \"Note answer in textbook seems wrong by order of 10^-3\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The required answer is 3.66e+04 + (2.35e+01)T - (4.398e-03) T**2 Btu/(lb mol*F) , where T is in degree F . \n", + "Note answer in textbook seems wrong by order of 10^-3\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 23.4 page no. 694\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "# Take all 18 experimenta data in an array Cp\n", + "Cpi = [39.87,39.85,39.90,45.16,45.23,45.17,50.72,51.03,50.90,56.85,56.80,57.02,63.01,63.09,63.14,69.52,69.68,69.63] ;\t\t\t# Array of Cpi(Heat capacity) values\n", + "# Take corresponding temperatures in array T\n", + "Ti = [300,300,300,400,400,400,500,500,500,600,600,600,700,700,700,800,800,800] ;\t\t\t# array of Ti\n", + "Ti_sqr = [300**2,300**2,300**2,400**2,400**2,400**2,500**2,500**2,500**2,600**2,600**2,600**2,700**2,700**2,700**2,800**2,800**2,800**2] ;\t\t\t# array of Ti**2\n", + "Ti_cub = [300**3,300**3,300**3,400**3,400**3,400**3,500**3,500**3,500**3,600**3,600**3,600**3,700**3,700**3,700**3,800**3,800**3,800**3];\t\t\t# array of Ti**3\n", + "Ti_qd = [300**4,300**4,300**4,400**4,400**4,400**4,500**4,500**4,500**4,600**4,600**4,600**4,700**4,700**4,700**4,800**4,800**4,800**4];\t\t\t# array of Ti**4\n", + "Cpi_Ti = [39.87*300,39.85*300,39.90*300,45.16*400,45.23*400,45.17*400,50.72*500,51.03*500,50.90*500,56.85*600,56.80*600,57.02*600,63.01*700,63.09*700,63.14*700,69.52*800,69.68*800,69.63*800] ;\t\t\t# Array of Cpi(Heat capacity)*Ti values\n", + "Cpi_Ti_sqr = [39.87*300**2,39.85*300**2,39.90*300**2,45.16*400**2,45.23*400**2,45.17*400**2,50.72*500**2,51.03*500**2,50.90*500**2,56.85*600**2,56.80*600**2,57.02*600**2,63.01*700**2,63.09*700**2,63.14*700**2,69.52*800**2,69.68*800**2,69.63*800**2] ;\t\t\t# Array of Cpi(Heat capacity)*Ti**2 values\n", + "\n", + "n = 18. ;\t\t\t# Number of data\n", + "# Calculations\n", + "\n", + "from numpy import matrix\n", + "# Solve equations (a),(b) & (c) simultaneously using matrix\n", + "a = matrix([[n,sum(Ti),sum(Ti_sqr)],[sum(Ti),sum(Ti_sqr),sum(Ti_cub)],[sum(Ti_sqr),sum(Ti_cub),sum(Ti_qd)]]) ;\t\t\t# Matrix of coefficients of unknown\n", + "b = matrix([[sum(Cpi)],[sum(Cpi_Ti)],[sum(Cpi_Ti_sqr)]]) ;\t\t\t# Matrix of constants\n", + "x = (a)**-1 * b ;\t\t\t# Matrix of solutions a = x(1), b = x(2) , c = x(3) \n", + "\n", + "# Results\n", + "print 'The solution is Cp = %.2f + %.3e T + %.2e T**2 .Therefore coefficients are as follows :'%(x[0],x[1],x[2])\n", + "print ' a = %.2f. b = %.3e . c = %.2e .'%(x[0],x[1],x[2])\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The solution is Cp = 25.44 + 4.371e-02 T + 1.44e-05 T**2 .Therefore coefficients are as follows :\n", + " a = 25.44. b = 4.371e-02 . c = 1.44e-05 .\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 23.5 page no : 695" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from scipy.integrate import quad\n", + "# Variables\n", + "# Basis : 1 g mol of gas\n", + "#Given\n", + "T1 = 550. ;\t\t\t# Initial temperature - [degree F]\n", + "T2 = 200. ;\t\t\t# Final temperature - [degree F]\n", + "CO2 = 9.2/100 ;\t\t\t# Mole fraction \n", + "CO = 1.5/100 ;\t\t\t# Mole fraction \n", + "O2 = 7.3/100 ;\t\t\t# Mole fraction \n", + "N2 = 82.0/100 ;\t\t\t#Mole fraction \n", + "\n", + "# Calculations\n", + "# Additional data needed :\n", + "a_N2 = 6.895;\t\t\t# constant\n", + "b_N2 = 0.7624*10**-3;\t\t\t# coefficient of T\n", + "c_N2 = -0.7009*10**-7;\t\t\t# coefficient of square T\n", + "a_O2 = 7.104 ;\t\t\t# constant\n", + "b_O2 = (0.7851*10**-3);\t\t\t# coefficient of T\n", + "c_O2 = (-0.5528*10**-7); \t\t\t# coefficient of square T\n", + "a_CO2 = 8.448;\t\t\t# constant\n", + "b_CO2 = 5.757*10**-3;\t\t\t# coefficient of T\n", + "c_CO2 = -21.59*10**-7;\t\t\t# coefficient of square T\n", + "d_CO2 = 3.059*10**-10;\t\t\t# coefficient of cubic T\n", + "a_CO = 6.865 ;\t\t\t# constant\n", + "b_CO = 0.8024*10**-3;\t\t\t# coefficient of T\n", + "c_CO = -0.7367*10**-7; \t\t\t# coefficient of square T\n", + "\n", + "# New coefficients after multiplying mole fraction of each component\n", + "a1_N2 = 6.895*N2 ;\t\t\t# constant\n", + "b1_N2 = N2*0.7624*10**-3; \t\t\t# coefficient of T\n", + "c1_N2 = (-0.7009*10**-7)*N2; \t\t\t# coefficient of square T \n", + "a1_O2 = 7.104*O2 ;\t\t\t# constant\n", + "b1_O2 = (0.7851*10**-3)*O2;\t\t\t# coefficient of T\n", + "c1_O2 = (-0.5528*10**-7)*O2; \t\t\t# coefficient of square T\n", + "a1_CO2 = 8.448*CO2;\t\t\t# constant\n", + "b1_CO2 = (5.757*10**-3)*CO2;\t\t\t# coefficient of T\n", + "c1_CO2 = (-21.59*10**-7)*CO2; \t\t\t# coefficient of square T\n", + "d1_CO2 = (3.059*10**-10)*CO2; \t\t\t# coefficient of cubic T\n", + "a1_CO = 6.865*CO;\t\t\t# constant\n", + "b1_CO = (0.8024*10**-3)*CO;\t\t\t# coefficient of T\n", + "c1_CO = (-0.7367*10**-7)*CO; \t\t\t# coefficient of square T\n", + "\n", + "# Get net coefficients of T , square T and cubic T by adding them\n", + "a_net = a1_N2+a1_CO2+a1_CO+a1_O2; \t\t\t#Net constant\n", + "b_net = b1_N2+b1_CO2+b1_CO+b1_O2; \t\t\t#Net coefficient of T\n", + "c_net = c1_N2+c1_CO2+c1_CO+c1_O2 ;\t\t\t#Net coefficient of square T\n", + "d_net = d1_CO2;\t\t\t#Net coefficient of cubic T\n", + "\n", + "def f(T):\n", + " return (a_net )+( b_net*T) + (c_net*(T**2)) + (d_net*(T**3))\n", + " \n", + "del_H = quad(f,T1,T2)[0] \t\t\t# Change in enthalpy of gas over given range-[Btu/lb mol gas]\n", + "\n", + "# Results\n", + "print ' Change in enthalpy of gas over given range is %.0f Btu/lb mol gas . '%del_H\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Change in enthalpy of gas over given range is -2616 Btu/lb mol gas . \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 23.6 page no. 700 \n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "# Solution \n", + "#Given\n", + "N2 = 1. ;\t\t\t# Moles of N2 - [kg mol]\n", + "P = 100. ;\t\t\t# Pressure of gas - [kPa] \n", + "T1 = 18. ;\t\t\t# Initial temperature - [degree C]\n", + "T2 = 1100. ;\t\t\t# Final temperature - [degree C]\n", + "\n", + "# Calculations\n", + "# In the book it is mentioned to use tables in Appendix D6 to calculate enthalpy change, we get \n", + "H_T1 = 0.524;\t\t\t# Initial enthalpy -[kJ/kg mol]\n", + "H_T2 = 34.715 ;\t\t\t# Final enthalpy - [kJ/kg mol]\n", + "del_H = H_T2 - H_T1 ;\t\t\t# Change in enthalpy - [kJ/kg]\n", + "\n", + "# Results\n", + "print ' Change in enthalpy of N2 over given range is %.3f kJ/kg mol N2 . '%del_H\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Change in enthalpy of N2 over given range is 34.191 kJ/kg mol N2 . \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 23.7 page no. 701\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "#Given\n", + "T1 = 640. ;\t\t\t# Initial temperature -[degree F]\n", + "T2 = 480. ;\t\t\t# Final temperature -[degree F]\n", + "P1 = 92. ;\t\t\t# Initial pressure -[psia]\n", + "P2 = 52. ;\t\t\t# Final pressure - [psia]\n", + "\n", + "\n", + "#From steam table\n", + "#At 90 psia\n", + "H1_600 = 1328.7 ;\t\t\t#H at 90 psia and 600 F-[Btu/lb]\n", + "H1_700 = 1378.1 ;\t\t\t#H at 90 psia and 700 F-[Btu/lb]\n", + "H2_600 = 1328.4 ;\t\t\t#H at 95 psia and 600 F-[Btu/lb]\n", + "H2_700 = 1377.8 ;\t\t\t#H at 95 psia and 700 F-[Btu/lb]\n", + "\n", + "# Calculations\n", + "H3_600 = H1_600+ ((H2_600-H1_600)/(95.-90))*(92-90);\t\t\t#H at 92 psia and 600 F-[Btu/lb]\n", + "H3_700 = H1_700+ ((H2_700-H1_700)/(95.-90))*(92-90);\t\t\t#H at 92 psia and 700 F-[Btu/lb]\n", + "H3_640 = H3_600+((H3_700-H3_600)/(700.-600))*(640-600);\t\t\t#H at 92 psia and 640 F-[Btu/lb]\n", + "\n", + "H1_450 = 1258.7 ;\t\t\t#H at 50 psia and 450 F-[Btu/lb]\n", + "H1_500 = 1282.6 ;\t\t\t#H at 50 psia and 500 F-[Btu/lb]\n", + "H2_450 = 1258.2 ;\t\t\t#H at 55 psia and 450 F-[Btu/lb]\n", + "H2_500 = 1282.2 ;\t\t\t#H at 55 psia and 500 F-[Btu/lb]\n", + "H3_450 = H1_450+ ((H2_450-H1_450)/(55.-50))*(52-50) ;\t\t\t#H at 52 psia and 450 F-[Btu/lb]\n", + "H3_500 = H1_500+ ((H2_500-H1_500)/(55.-50))*(52-50);\t\t\t#H at 52 psia and 500 F-[Btu/lb]\n", + "H3_480 = H3_450+((H3_500-H3_450)/(500.-450))*(480-450);\t\t\t# H at 52 psia and 480 F-[Btu/lb]\n", + "del_H = H3_480 - H3_640;\t\t\t# Change in enthalpy - [Btu/lb]\n", + "\n", + "# Results\n", + "print 'Change in enthalpy is %.1f Btu/lb .'%del_H\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Change in enthalpy is -75.5 Btu/lb .\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 23.8 page no. 702\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "# Solution \n", + "\n", + "# Variables\n", + "W = 4. ;\t\t\t# Mass of water -[kg]\n", + "Ti= 27.+273 ;\t\t\t# Initial temperature -[K]\n", + "Pi = 200. ;\t\t\t# Initial pressure -[kPa]\n", + "Pf = Pi ;\t\t\t# Final pressure -[kPa]\n", + "V1 = 0.001004 ;\t\t\t# Specific volume at Ti -[cubic metre/kg]\n", + "V2 = 1000. * V1 ;\t\t\t#Specific volume at final temperature(Tf) from given condition in problem - [cubic metre/kg]\n", + "va = 0.9024 ;\t\t\t# Specific volume -[cubic metre/kg]\n", + "Ta = 400. ;\t\t\t# [K]\n", + "vb = 1.025 ;\t\t\t# Specific volume -[cubic metre/kg]\n", + "Tb = 450. ;\t\t\t#[K]\n", + "vf = V2 ;\t\t\t# Final specific volume -[cubic metre/kg]\n", + " \n", + "# Calculations\n", + "m=(Tb - Ta)/(vb - va);\t\t\t# slope \n", + "Tf=Ta + m*(vf - va) ;\t\t\t# Final temperature - [K]\n", + "\n", + "# Results\n", + "print ' Final temperature is %.0f K.'%Tf\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Final temperature is 441 K.\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 23.9 page no. 704\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Solution \n", + "\n", + "# Variables\n", + "mv = 1. ;\t\t\t# Mass of saturated vapour - [lb]\n", + "P1 = 2. ;\t\t\t# Initial pressure -[atm]\n", + "P2 = 20. ;\t\t\t# Final pressure -[atm]\n", + "H_2 = 179. ;\t\t\t# Specific enthalpy at 2 atm - [Btu/lb]\n", + "H_20 = 233. ;\t\t\t# Specific enthalpy at 20 atm - [Btu/lb]\n", + "V_2 = 3.00 ;\t\t\t# Specific volume at 2 atm - [cubic feet/lb]\n", + "V_20 = 0.30 ;\t\t\t# Specific volume at 20 atm - [cubic feet/lb]\n", + "T_2 = 72. ;\t\t\t# Temperature at 2 atm -[degree F]\n", + "T_20 = 239. ;\t\t\t# Temperature at 20 atm -[degree F]\n", + "\n", + "# Calculations\n", + "del_H = H_20 - H_2 ;\t\t\t# Change in specific enthalpy -[Btu/lb] \n", + "del_V = V_20 - V_2 ;\t\t\t# Change in specific volume -[cubic feet/lb] \n", + "del_T = T_20 - T_2 ;\t\t\t# Change in temperature -[degree F]\n", + "\n", + "# Results\n", + "print '(a) Change in specific enthalpy is %.0f Btu/lb.'%del_H\n", + "print ' (b) Change in specific volume is %.2f cubic feet/lb.'%del_V\n", + "print ' (c) Change in temperature is %.1f degree F.'%del_T\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a) Change in specific enthalpy is 54 Btu/lb.\n", + " (b) Change in specific volume is -2.70 cubic feet/lb.\n", + " (c) Change in temperature is 167.0 degree F.\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "code", + "collapsed": true, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 9 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch24-checkpoint.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch24-checkpoint.ipynb new file mode 100644 index 00000000..b4b06951 --- /dev/null +++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch24-checkpoint.ipynb @@ -0,0 +1,549 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:81bdcd8b52f99578fa3372035df0b4461d5784b0d3f676ae0e588533ba351cbf" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 24 : Applications of Energy Balances in the Absence of Chemical Reactions" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 24.1 page no. 720\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print 'Assumptions to be made in eqn. 24.1 in following segments are:'\n", + "#(a)- 1 to 5\n", + "print '(a)- 1 to 5.'\n", + "print ' 1. Change in potential energy(del_PE) = 0(no change in level) .'\n", + "print ' 2. Probably change in kinetic energy(del_KE)=0 .'\n", + "print ' 3. Change in energy = 0 (process appears to be steady).'\n", + "print ' Result : Q + W = del_H.'\n", + "\n", + "#(b) 4 to 5\n", + "print '(b) 4 to 5.'\n", + "print ' 1. Q = W = 0 '\n", + "print ' 2. Probably change in kinetic energy(del_KE)=0.'\n", + "print ' 3. Change in energy = 0 (process appears to be steady).'\n", + "print ' Result : del_H = -del_PE . '\n", + "\n", + "#(c) 3 to 4\n", + "print '(c) 3 to 4.'\n", + "print ' 1. Q = W = 0 '\n", + "print ' 2. Probably change in kinetic energy(del_KE)=0.'\n", + "print ' 3. Change in energy = 0 (process appears to be steady).'\n", + "print ' Result : del_H = -del_PE . '\n", + "\n", + "#(d) 3 to 5\n", + "print '(d) 3 to 5.'\n", + "print ' 1. Q = W = 0 '\n", + "print ' 2. Probably change in kinetic energy(del_KE)=0.'\n", + "print ' 3. Change in energy = 0 (process appears to be steady).'\n", + "print ' 4. Change in potential energy(del_PE) = 0(no change in level) .'\n", + "print ' Result : del_H = 0 . '\n", + "\n", + "#(e)- 1 to 3\n", + "print '(e) 1 to 3.'\n", + "print ' 1. Change in potential energy(del_PE) = 0(no change in level) .'\n", + "print ' 2. Probably change in kinetic energy(del_KE)=0 .'\n", + "print ' 3. Change in energy = 0 (process appears to be steady).'\n", + "print ' Result : Q + W = del_H.'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Assumptions to be made in eqn. 24.1 in following segments are:\n", + "(a)- 1 to 5.\n", + " 1. Change in potential energy(del_PE) = 0(no change in level) .\n", + " 2. Probably change in kinetic energy(del_KE)=0 .\n", + " 3. Change in energy = 0 (process appears to be steady).\n", + " Result : Q + W = del_H.\n", + "(b) 4 to 5.\n", + " 1. Q = W = 0 \n", + " 2. Probably change in kinetic energy(del_KE)=0.\n", + " 3. Change in energy = 0 (process appears to be steady).\n", + " Result : del_H = -del_PE . \n", + "(c) 3 to 4.\n", + " 1. Q = W = 0 \n", + " 2. Probably change in kinetic energy(del_KE)=0.\n", + " 3. Change in energy = 0 (process appears to be steady).\n", + " Result : del_H = -del_PE . \n", + "(d) 3 to 5.\n", + " 1. Q = W = 0 \n", + " 2. Probably change in kinetic energy(del_KE)=0.\n", + " 3. Change in energy = 0 (process appears to be steady).\n", + " 4. Change in potential energy(del_PE) = 0(no change in level) .\n", + " Result : del_H = 0 . \n", + "(e) 1 to 3.\n", + " 1. Change in potential energy(del_PE) = 0(no change in level) .\n", + " 2. Probably change in kinetic energy(del_KE)=0 .\n", + " 3. Change in energy = 0 (process appears to be steady).\n", + " Result : Q + W = del_H.\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 24.3 page no. 728\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "# Given\n", + "m_CO2 = 10. ;\t\t\t# mass of CO2 - [lb]\n", + "Ti_CO2 = 80. ;\t\t\t# Initial temperature of CO2 - [degree F]\n", + "Vi = 4.0 ;\t\t\t# Initial volume of CO2-[cubic feet]\n", + "f_CO2 = 40./100 ;\t\t\t# Fraction of CO2 that convert to liquid finally \n", + "s_Vi = Vi /m_CO2 ;\t\t\t# Initial specific volume of CO2 - [cubic feet/lb]\n", + "s_Vf = s_Vi ;\t\t\t# Constant volume -[cubic feet/lb]\n", + "Pi = 300. ;\t\t\t# Intial pressure - [psia]\n", + "del_Hi = 160. ;\t\t\t# Intial change in specific enthalpy - [Btu/lb]\n", + "# Now again use chart to get fnal condition fixed by constant volume line and quality 0.6 , according to book it is \n", + "del_Hf = 81. ;\t\t\t# Final change in specific enthalpy - [Btu/lb]\n", + "Pf = 140. ;\t\t\t#Final pressure - [psia]\n", + "\n", + "# Calculations\n", + "Q = ((del_Hf - del_Hi) - (Pf * s_Vf * 144/778.2 - Pi * s_Vi * 144/778.2))*m_CO2 ;\t\t\t# Heat removed from the extinguisher -[Btu]\n", + "\n", + "# Results\n", + "print ' Heat removed from the extinguisher is %i Btu .'%Q\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Heat removed from the extinguisher is -671 Btu .\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 24.4 page no. 730" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from scipy.optimize import fsolve\n", + "\n", + "# Pick the system as gas plus heater \n", + "# Given\n", + "Pi = 1.5 ;\t\t\t# Intial pressure - [Pa]\n", + "Vi = 2*10**-3 ;\t\t\t# Initial volume of gas - [cubic metre]\n", + "Ti = 300 ;\t\t\t# Initial temperature - [K]\n", + "W = 480 ;\t\t\t# Work done by heater on system\n", + "t = 5 ;\t\t\t# Time for which current is supplied -[ min]\n", + "m_ht = 12 ;\t\t\t# Mass of the heater - [g]\n", + "C_ht = 0.35 ;\t\t\t# Heat capacity of heater - [ J/gK]\n", + "R = 8.314 ;\t\t\t# Ideal gas constant - [(Pa*cubic metre)/(g mol* K)]\n", + "\n", + "# It is assumed that heat transfer across system boundary for this short time is negligible , therefore Q = 0\n", + "# Using the above assumption the equation reduces to del_U = W, therefore \n", + "del_U = W ;\t\t\t# Change in nternal energy - [J]\n", + "\n", + "# Calculations\n", + "# Gas is assumed to be ideal, therefore get n by using pv = nRT\n", + "n = (Pi*Vi)/(R*Ti) ;\t\t\t# Number of moles of argon gas -[g mol]\n", + "Cp = (5./2)* R ;\t\t\t# Specific heat capacity of argon gas at constant pressure - [ J/gK]\n", + "Cv = Cp - R ;\t\t\t# Specific heat capacity of argon gas at constant volume - [ J/gK]\n", + "\n", + "def f(Tf):\n", + " return m_ht*C_ht*(Tf - Ti) + n*Cv*(Tf - Ti) - del_U\n", + " \n", + "Tf=fsolve(f,400) ;\t\t\t# Final temperature -[K] \n", + "\n", + "# Results\n", + "print ' Final temperature of gas is %.0f K .'%Tf\n", + " \n", + "Pf = (Tf/Ti)*Pi ;\t\t\t# Final pressure - [Pa]\n", + "print ' Final pressure in chamber is %.2f Pa .'%Pf\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Final temperature of gas is 414 K .\n", + " Final pressure in chamber is 2.07 Pa .\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 24.5 page no. 732\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "# Pick the system as shown in above figure of book\n", + "# Given\n", + "m_water = 10. ;\t\t\t# Mass of water - [lb]\n", + "T_water = 35. ;\t\t\t# Temperature of water - [degree F]\n", + "m_ice = 4. ;\t\t\t# Mass of ice - [lb]\n", + "T_ice = 32. ;\t\t\t# Temperature of ice - [degree F]\n", + "m_stm = 6. ;\t\t\t# Initial mass of steam -[lb]\n", + "T_stm = 250. ;\t\t\t# Temperature of stm - [degree F]\n", + "p = 20. ;\t\t\t# Pressure of system -[psia]\n", + "\n", + "m_total = m_water + m_ice + m_stm ;\t\t\t# Mass of H2O in three phases initially -[lb]\n", + "\n", + "U_ice = -143.6 ;\t\t\t# Specific internal energy of ice -[Btu/lb]\n", + "U_water = 3.025 ;\t\t\t# Specific internal energy of water -[Btu/lb]\n", + "U_stm = 1092.25 ;\t\t\t# Specific internal energy of steam -[Btu/lb]\n", + "V_water = 0.0162 ;\t\t\t# Specific volume of water -[cubic feet/lb]\n", + "V_stm = 20.80 ;\t\t\t# Specific volume of steam -[cubic feet/lb]\n", + "V_total = m_stm*V_stm ;\t\t\t#Total volume of container ignoring volume of water and ice as they are neglgible\n", + "\n", + "# Calculations\n", + "V_sys = V_total/m_total ;\t\t\t# Specific volume of system -[cubic feet/lb]\n", + "U_sys =(m_water*U_water + m_ice*U_ice + m_stm*U_stm)/m_total ;\t\t\t# Final specific internal energy of system -[Btu/lb]\n", + "\n", + "T1 = 190 ;\t\t\t# assumed temperature\n", + "U1 = [157.17,1071.83] ;\t\t\t#specific internal energy of liquid and vapour respetively -[Btu/lb]\n", + "V1 = [0.0165,41.01] ;\t\t\t# Specific volume of liquid and vapour respetively -[cubic feet/lb]\n", + "x1 = V_sys/V1[1] ;\t\t\t# Quality of vapour\n", + "U1_sys = (1-x1)*U1[0] + x1*U1[1] \t\t\t# Specific internal energy of system at T1-[Btu/lb] \n", + "\n", + "T2 = 200. ;\t\t\t# assumed temperature\n", + "U2 = [168.11, 1073.96];\t\t\t# specific internal energy of liquid and vapour respetively -[Btu/lb]\n", + "V2 = [0.017, 33.601] ;\t\t\t# Specific volume of liquid and vapour respetively -[cubic feet/lb]\n", + "x2 = V_sys/V2[1] ; \t\t\t# Quality of vapour\n", + "U2_sys = (1-x2)*U2[0] + x2*U2[1] ;\t\t\t# Specific internal energy of system at T2-[Btu/lb] \n", + "\n", + "# Results\n", + "# Check whether assumption is right\n", + "if (U_sys > U1_sys ):\n", + " if ( U_sys CO2 \n", + "R1_O2_in = (1.0/2)*air ;\t\t\t# O2 entering reactor 1-[g mol]\n", + "R1_N2_in = R1_O2_in*(79./21) ;\t\t\t# N2 entering reactor 1-[g mol]\n", + "\n", + "# Calculations\n", + "#Output of reactor 1\n", + "R1_CO_out = R1_CO_in*(1 - air) ;\t\t\t# [g mol]\n", + "R1_CO2_out = 1*( air) ;\t\t\t# [g mol]\n", + "R1_N2_out = R1_N2_in ;\t\t\t#[g mol]\n", + "\n", + "del_Hi_out = [ -109.054,-393.250,0.,-296.855,-395.263,0.] ; \t\t\t# Heat of formation - [kJ/g mol] \n", + "del_Hf_out = [35.332,35.178,22.540,20.845,34.302,16.313] ;\t\t\t#Change in enthalpy during temperature change -[kJ/g mol]\n", + "del_H_out =del_Hi_out + del_Hf_out ;\t\t\t#[-371.825,15.043,160.781,-449.650,-581.35]\t\t\t# Change in enthalpy final - [kJ/g mol]\n", + "\n", + "del_Hi_in = [ -109.054,-393.250,0.,-296.855,0.] ;\t\t\t# \t\t\t# Heat of formation - [kJ/g mol] \n", + "del_Hf_in = [17.177,17.753,11.981,0.,0.] ;\t\t\t#Change in enthalpy during temperature change -[kJ/g mol]\n", + "del_H_in = del_Hi_in+ del_Hf_in ;\t\t\t# Change in enthalpy final - [kJ/g mol]\n", + "\n", + "from numpy import matrix\n", + "# Solve eqn. (a), (b) and (c) to get F ,P , ex \n", + "a = matrix([[(R2_fSO3_out),0,-1],\n", + " [(R2_fSO2_out),-(R2_fSO2_in),1],\n", + " [- 285.50, -(del_H_in[3]*R2_fSO2_in), 0]]) ;\t\t\t# Matrix of coefficients\n", + "\n", + "b = matrix([[0],[0],[- 33.459781 ]]) ;\t\t\t# Matrix of constants\n", + "#a = a.I\n", + "#x = a*b ;\t\t\t# Matrix of solutions, P = x(1), F = x(2) ,ex = x(3)\n", + "\n", + "from numpy import *\n", + "x = linalg.solve(a,b)\n", + "\n", + "F = x[1] ;\t\t\t#exit stream of reactor 2 - [lb mol]\n", + "R2_SO2_in = R2_fSO2_in*F ;\t\t\t# Moles of SO2 required per lb mol of CO - [lb mol]\n", + "\n", + "CO = (R1_CO_in*SO2_in)/R2_SO2_in ;\t\t\t#Mole of CO burned in reactor 1 - [lb mol] \n", + "\n", + "# Results\n", + "print 'Mole of CO burned in reactor 1 is %.0f lb mol.'%CO\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mole of CO burned in reactor 1 is 2259 lb mol.\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 26.5 page no. 819\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "# Variables\n", + "CA = 10000. ;\t\t\t# Produced citric acid - [kg]\n", + "f_glucose = .30 ;\t\t\t# Fraction of glucose in solution \n", + "con_glucose = .60 ;\t\t\t# Fraction of glucose consumed\n", + "w_glucose = 180.16 ;\t\t\t# Mol. wt. of d,alpha glucose -[g]\n", + "H_glucose = -1266 ;\t\t\t# Specific enthalpy change of glucose - [kJ/g mol]\n", + "w_CA = 192.12; \t\t\t# Mol. wt. of citric acid -[g]\n", + "H_CA = -1544.8 ;\t\t\t# Specific enthalpy change of citric acid - [kJ/g mol]\n", + "w_BM = 28.6 ;\t\t\t# Mol. wt. of biomass -[g]\n", + "H_BM = -91.4 ;\t\t\t# Specific enthalpy change of biomass - [kJ/g mol]\n", + "H_CO2 = -393.51 ;\t\t\t# Specific enthalpy change of CO2 - [kJ/g mol]\n", + "\n", + "# Calculations\n", + "mol_CA = CA/w_CA ;\t\t\t# Mole of citric acid produced - [kg mol]\n", + "g_soln = (mol_CA*(3/2.22)*w_glucose*1)/(con_glucose*f_glucose) ;\t\t\t#Mass of 30 % glucose solution introduced -[kg]\n", + "i_glucose = g_soln* f_glucose / w_glucose ;\t\t\t# Initial moles of glucose - [kg mol]\n", + "f_glucose = (1 - con_glucose)*i_glucose ;\t\t\t# Final moles of glucose - [kg mol]\n", + "f_CA = mol_CA ;\t\t\t# Final moles of citric acid - [kg mol]\n", + "f_BM = f_CA*(5.35/2.22) ;\t\t\t# Using the reaction (a)- Final moles of biomass - [kg mol]\n", + "i_O2 = i_glucose*(7.8/3) ;\t\t\t# Using the reaction (a)- Initial moles of O2 - [kg mol]\n", + "f_CO2 = i_glucose*(4.5/3)*con_glucose ;\t\t\t# Using the reaction (a) - Final moles of CO2 - [kg mol]\n", + "\n", + "power = 100 ;\t\t\t# Power of aerator -[hp]\n", + "time = 220 ;\t\t\t# Time taken for reaction - [ hr ]\n", + "W = (power*745.7*time*3600)/1000 ;\t\t\t# Work done by aerator - [kJ]\n", + "\n", + "Hi_glucose = i_glucose*H_glucose*1000 ;\t\t\t# Enthalpy change of glucose input - [kJ]\n", + "Hi_O2 = i_O2*0*1000 ;\t\t\t# Enthalpy change of O2 input - [kJ]\n", + "H_in = Hi_glucose + Hi_O2 ;\t\t\t# Enthalpy change of input - [kJ]\n", + "\n", + "Hf_glucose = f_glucose*H_glucose*1000 ;\t\t\t# Enthalpy change of glucose output - [kJ]\n", + "Hf_BM = f_BM * H_BM*1000 ;\t\t\t#Enthalpy change of biomass output - [kJ]\n", + "Hf_CA = f_CA *H_CA*1000 ;\t\t\t#Enthalpy change of citric acid output - [kJ]\n", + "Hf_CO2 = f_CO2 *H_CO2*1000 ;\t\t\t#Enthalpy change of CO2 output - [kJ]\n", + "H_out = Hf_glucose + Hf_BM +Hf_CA + Hf_CO2 ;\t\t\t# Enthalpy change of output - [kJ]\n", + "del_H = H_out - H_in ;\t\t\t# Total enthalpy change in process - [kJ]\n", + "Q = del_H - W ;\t\t\t# Heat removed - [kJ]\n", + "\n", + "# Results\n", + "print 'Heat exchange from the fermentor during production of 10,000 kg citric acid is %.2e kJ(minus sign indicates heat is removed).'%Q\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat exchange from the fermentor during production of 10,000 kg citric acid is -1.03e+08 kJ(minus sign indicates heat is removed).\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "code", + "collapsed": true, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 4 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch27-checkpoint.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch27-checkpoint.ipynb new file mode 100644 index 00000000..4bcff200 --- /dev/null +++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch27-checkpoint.ipynb @@ -0,0 +1,334 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:21747075c112c6cd9e1a0a4f001fec6264fd627d603e23ce68da0341f7d86ac0" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 27 : Ideal Processes Efficiency and the Mechanical Energy Balance" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 27.1 page no. 838\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "V_w = 1. ;\t\t\t# Volume of given water -[L]\n", + "P_atm = 100. ;\t\t\t# Atmospheric pressure - [kPa]\n", + "\n", + "#W = -p*del_V\n", + "V_H2O = 0.001043 ;\t\t\t# Specific volume of water from steam table according to book- [cubic metre] \n", + "V_vap = 1.694 ;\t\t\t# Specific volume of vapour from steam table according to book- [cubic metre] \n", + "V1 = 0 ;\t\t\t# Initial volume of H2O in bag-[cubic metre]\n", + "\n", + "# Calculations\n", + "V2 = (V_w*V_vap)/(1000*V_H2O) ;\t\t\t# Final volume of water vapour -[cubic metre] \n", + "W = -P_atm*(V2 -V1)* 1000 ;\t\t\t# Work done by saturated liquid water -[J]\n", + " \n", + "# Results \n", + "print ' Work done by saturated liquid water is %.3e J.'%W\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Work done by saturated liquid water is -1.624e+05 J.\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 27.2 page no. 840\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "m_N2 = 1. ;\t\t\t# Moles of N2 taken -[kg mol]\n", + "p = 1000.;\t\t\t# Pressure of cylinder-[kPa]\n", + "T = 20. + 273. ;\t\t\t# Temperature of cylinder -[K]\n", + "a_pis = 6. ;\t\t\t# Area of piston - [square centimetre]\n", + "m_pis = 2. ;\t\t\t# Mass of pston - [kg]\n", + "R = 8.31 ;\t\t\t# Ideal gas constant - [(kPa*cubic metre)/(K * kgmol)]\n", + "\n", + "# Calculations\n", + "V = (R*T)/p ;\t\t\t# Specific volue of gas at initial stage -[cubic metre/kg mol]\n", + "V1 = V * m_N2 ;\t\t\t# Initial volume of gas - [cubic metre]\n", + "V2 = 2.*V1 ;\t\t\t# Final volume of gas according to given condition -[cubic metre]\n", + "\n", + "# Assumed surrounding pressure constant = 1 atm\n", + "p_atm = 101.3 ;\t\t\t# Atmospheric pressure-[kPa]\n", + "del_Vsys = V2 -V1 ;\t\t\t# Change in volume of system -[cubic metre]\n", + "del_Vsurr = - del_Vsys ;\t\t\t# Change in volume of surrounding -[cubic metre]\n", + "W_surr = -p_atm*del_Vsurr ;\t\t\t# Work done by surrounding - [kJ]\n", + "W_sys = -W_surr ;\t\t\t# Work done by system - [kJ]\n", + "\n", + "# Results\n", + "print ' Work done by gas(actually gas + piston system) is %.0f kJ.'%W_sys\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Work done by gas(actually gas + piston system) is -247 kJ.\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 27.3 page no. 845\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "p_plant = 20. ;\t\t\t# Power generated by plant-[MW]\n", + "h = 25. ;\t\t\t# Height of water level - [m]\n", + "V = 100. ;\t\t\t# Flow rate of water -[cubic metre/s]\n", + "d_water = 1000. ;\t\t\t# Density of water - [ 1000 kg / cubic metre]\n", + "g = 9.807 ;\t\t\t# Acceleration due to gravity-[m/square second]\n", + "\n", + "# Calculations\n", + "M_flow = V*d_water ;\t\t\t# Mass flow rate of water -[kg/s]\n", + "del_PE = M_flow*g*h ;\t\t\t# Potential energy change of water per second -[W]\n", + "eff = (p_plant*10**6) /(del_PE) ;\t\t\t# Efficiency of plant \n", + "\n", + "# Results\n", + "print ' Efficiency of plant is %.2f .'%eff\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Efficiency of plant is 0.82 .\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 27.4 page no. 845\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "LHV = 36654. ;\t\t\t# LHV value of fuel - [kJ/ cubic metre]\n", + "Q1 = 16. ;\t\t\t#- [kJ/ cubic metre]\n", + "Q2 = 0 ;\t\t\t#- [kJ/ cubic metre]\n", + "Q3 = 2432. ;\t\t\t#- [kJ/ cubic metre]\n", + "Q4 = 32114. ;\t\t\t#- [kJ/ cubic metre]\n", + "Q41 = 6988. ;\t\t\t#- [kJ/ cubic metre]\n", + "Q8 = 1948. ;\t\t\t#- [kJ/ cubic metre]\n", + "Q9 = 2643. ;\t\t\t#- [kJ/ cubic metre]\n", + "Q81 = 2352. - Q8 ;\t\t\t# - [kJ/ cubic metre]\n", + "Q567 = 9092. ;\t\t\t# Sum of Q5, Q6 and Q7- [kJ/ cubic metre]\n", + "\n", + "# Calculations and Results\n", + "#(a)\n", + "G_ef = (LHV+ Q1 +Q2 + Q3 - Q9)/(LHV) ;\t\t\t# Gross efficiency\n", + "print '(a) Gross efficiency is %.3f .'%G_ef\n", + "\n", + "#(b)\n", + "T_ef = (Q567+Q8)/(LHV+ Q1 +Q2 + Q3) ;\t\t\t#Thermal efficiency \n", + "print ' (b) Thermal efficiency is %.3f .'%T_ef\n", + "\n", + "#(c)\n", + "C_ef = Q4/(Q4 + Q41) ;\t\t\t# Combustion efficiency\n", + "print ' (c) Combustion efficiency is %.3f .'%C_ef\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a) Gross efficiency is 0.995 .\n", + " (b) Thermal efficiency is 0.282 .\n", + " (c) Combustion efficiency is 0.821 .\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 27.5 page no. 850" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "from scipy.integrate import quad\n", + "\n", + "# Variables\n", + "V1 = 5. ;\t\t\t# Volume of gas initially - [cubic feet]\n", + "P1 = 1. ;\t\t\t# Initial pressure - [atm]\n", + "P2 = 10. ;\t\t\t# Final pressure - [atm]\n", + "T1 = 100. + 460 ;\t\t\t# initial temperature - [degree Rankine]\n", + "R = 0.7302 ;\t\t\t# Ideal gas constant -[(cubic feet*atm)/(lb mol)*(R)]\n", + "\t\t\t#Equation of state pV**1.4 = constant\n", + "\n", + "\n", + "# Calculations and Results\n", + "V2 = V1*(P1/P2)**(1/1.4) ;\t\t\t# Final volume - [cubic feet] \n", + "\n", + "def f(V):\n", + " return -(P1)*(V1/V)**(1.4)\n", + " \n", + "W1_rev = quad(f,V1,V2)[0] ;\t\t\t# Reversible work done in compresion in a horizontal cylinder with piston -[cubic feet *atm]\n", + "W1 = W1_rev *1.987/.7302 ;\t\t\t# Conversion to Btu -[Btu]\n", + "print '(a)Reversible work done in compression in a horizontal cylinder with piston is %.1f Btu . '%W1\n", + "\n", + "#(b)\n", + "n1 = (P1*V1)/(R*T1) ;\t\t\t# Number of moles of gas\n", + "\n", + "def f1(P):\n", + " return (V1)*(P1/P)**(1/1.4)\n", + "W2_rev = quad(f1,P1,P2)[0]\t\t# Reversible work done in compresion in a rotary compressor -[cubic feet *atm]\n", + "W2 = W2_rev *1.987/.7302 ;\t\t\t# Conversion to Btu -[Btu]\n", + "\n", + "print '(b)Reversible work done in a rotary compressor is %.1f Btu . '%W2\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)Reversible work done in compression in a horizontal cylinder with piston is 31.7 Btu . \n", + "(b)Reversible work done in a rotary compressor is 44.3 Btu . \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 27.6 page no. 853" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from scipy.integrate import quad\n", + "# Variables\n", + "m_water = 1. ;\t\t\t# Mass flow rate of water -[lb/min]\n", + "P1 = 100. ;\t\t\t# Initial pressure - [psia]\n", + "P2 = 1000. ;\t\t\t# Final pressure - [psia]\n", + "T1 = 80. + 460 ;\t\t\t# initial temperature - [degree Rankine]\n", + "T2 = 100. + 460 ;\t\t\t# final temperature - [degree Rankine]\n", + "h = 10. ;\t\t\t# Difference in water level between entry and exit of stream-[ft]\n", + "g = 32.2 ;\t\t\t# Accleration due to gravity - [ft/ square second]\n", + "gc = 32.2 ;\t\t\t#[(ft*lbm)/(lbf*square second)]\n", + "\n", + "v1 = .01607 ;\t\t\t# specific volume of liquid water at 80 degree F -[cubic feet/lbm]\n", + "v2 = .01613 ;\t\t\t# specific volume of liquid water at 100 degree F -[cubic feet/lbm] \n", + "v= 0.0161 ;\t\t\t# -[cubic feet/lbm]\n", + "\n", + "# Calculations\n", + "del_PE = (h*g)/(gc*778) ;\t\t\t# Change in potential energy - [Btu/lbm]\n", + "\n", + "def f(P):\n", + " return (v)*(12**2/778.)\n", + " \n", + "PV_work = quad(f,P1,P2)[0]\t\t\t# PV work done -[Btu/lbm]\n", + "#From eqn. (A)\n", + "W = PV_work + del_PE ;\t\t\t# Work per minute required to pump 1 lb water per minute - [Btu/lbm]\n", + "\n", + "# Results\n", + "print ' Work per minute required to pump 1 lb water per minute is %.2f Btu/lbm . '%W\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Work per minute required to pump 1 lb water per minute is 2.69 Btu/lbm . \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 2 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch28-checkpoint.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch28-checkpoint.ipynb new file mode 100644 index 00000000..f3a9553e --- /dev/null +++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch28-checkpoint.ipynb @@ -0,0 +1,219 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:ac2f423a0dd7909a3558159c9b6408459426072d293b0494654db2eec3dde604" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 28 : Heats of Solution and Mixing" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 28.1 page no. 869\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "Ref_T = 77. ;\t\t\t#Reference temperature-[degree F]\n", + "\n", + "#(a)\n", + "mol_NH3 = 1. ;\t\t\t# Moles of NH3 - [lb mol]\n", + "mw_NH3 = 17. ;\t\t\t#Molecular t. of NH3 -[lb]\n", + "mw_H2O = 18. ;\t\t\t#Molecular t. of H2O -[lb]\n", + "\n", + "# Calculations and Results\n", + "f1_NH3 = 3./100 ;\t\t\t# Fraction of NH3 in solution \n", + "m_H2O = (mw_NH3/f1_NH3) - mw_NH3 ;\t\t\t# Mass of water in solution -[lb]\n", + "mol_H2O = m_H2O/mw_H2O ;\t\t\t# Moles of H2O in solution -[lb mol]\n", + "\n", + "print '(a) Moles of H2O in solution is %.1f lb mol . '%mol_H2O\n", + "print ' As we can see that moles of water is 30 lb mol(approx), hence we will see H_soln from table corresponding to 30 lb mol water . '\n", + "H_soln = -14800. ;\t\t\t# From table given in question in book -[Btu/lb mol NH3]\n", + "print ' The amount of cooling needed is, %.0f Btu heat removed. '%(abs(H_soln))\n", + "\n", + "#(b)\n", + "V = 100. ;\t\t\t# Volume of solution produced -[gal]\n", + "f2_NH3 = 32./100 ;\t\t\t# Fraction of NH3 in solution \n", + "sg_NH3 = .889 ;\t\t\t# Specific gravity of NH3 \n", + "sg_H2O = 1.003 ;\t\t\t# Specific gravity of H2O\n", + "d_soln = sg_NH3*62.4*sg_H2O*100/7.48 ;\t\t\t# Density of solution - [lb / 100 gal]\n", + "NH3 = d_soln*f2_NH3/mw_NH3 ;\t\t\t# Mass of NH3 - [ lb mol/ 100 gal]\n", + "m1_H2O = (mw_NH3/f2_NH3) - mw_NH3 ;\t\t\t# Mass of water in solution -[lb]\n", + "mol1_H2O = m1_H2O/mw_H2O ;\t\t\t# Moles of H2O in solution -[lb mol]\n", + "\n", + "print ' (b) Moles of H2O in solution is %.1f lb mol . '%mol1_H2O\n", + "print ' As we can see that moles of water is 2 lb mol , hence we will see H_soln from table corresponding to 2 lb mol water . '\n", + "H_soln = -13700 ;\t\t\t# From table given in question in book -[Btu/lb mol NH3]\n", + "total_H = abs(NH3*H_soln) ;\t\t\t# Total heat removed from solution -[Btu]\n", + "print ' The amount of cooling needed is, %.0f Btu heat removed. '%total_H\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a) Moles of H2O in solution is 30.5 lb mol . \n", + " As we can see that moles of water is 30 lb mol(approx), hence we will see H_soln from table corresponding to 30 lb mol water . \n", + " The amount of cooling needed is, 14800 Btu heat removed. \n", + " (b) Moles of H2O in solution is 2.0 lb mol . \n", + " As we can see that moles of water is 2 lb mol , hence we will see H_soln from table corresponding to 2 lb mol water . \n", + " The amount of cooling needed is, 191826 Btu heat removed. \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 28.2 page no. 872" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from scipy.integrate import quad\n", + "# Variables\n", + "p = 100. ;\t\t\t# Mass of product - [kg]\n", + "f_HCl = 25./100 ;\t\t\t#Fraction of HCl in product \n", + "HCl = f_HCl*p ;\t\t\t# Mass of HCl in product - [kg]\n", + "H2O = (1.-f_HCl)*p ;\t\t\t# Mass of H2O in product -[kg]\n", + "mw_HCl = 36.37 ;\t\t\t# Molecular weight of HCl -[kg]\n", + "mw_H2O = 18.02 ;\t\t\t# Molecular weight of H2O -[kg]\n", + "\n", + "# Calculations\n", + "mol_HCl = HCl /mw_HCl ;\t\t\t# Moles of HCl - [kg mol]\n", + "mol_H2O = H2O /mw_H2O; \t\t\t# Moles of H2O - [kg mol]\n", + "total_mol = mol_HCl + mol_H2O ;\t\t\t# Total no. of moles -[kg mol]\n", + "mf_HCl = mol_HCl / total_mol ;\t\t\t# mole fraction of HCl \n", + "mf_H2O = mol_H2O / total_mol ; \t\t\t# mole fraction of H2O\n", + "mr = mol_H2O/mol_HCl ;\t\t\t# Mole ratio of H2O to HCl \n", + "MW = mf_HCl*mw_HCl + mf_H2O*mw_H2O ;\t\t\t# Molecular t. of solution-[kg]\n", + "Ref_T = 25. ;\t\t\t#Reference temperature-[degree C]\n", + "\n", + "mol1_HCl = total_mol ;\t\t\t# Moles of HCl \t\t\t# Moles of HCl output -[g mol]\n", + "Hf1_HCl = -157753. ;\t\t\t# Heat of formation of HCl output-[J/ g mol HCl ]\n", + "Hf_HCl = -92311. ;\t\t\t# Heat of formation of HCl input-[J/ g mol HCl ]\n", + "Hf_H2O = 0 ;\t\t\t# Heat of formation of H2O input-[J/ g mol HCl ]\n", + "H1_HCl = 556. ;\t\t\t# Change in enthalpy during temperature change from 25 C to 35 C of HCl - [J/g mol] \n", + "\n", + "def f(T):\n", + " return (29.13 - 0.134*.01*T)\n", + "\n", + "H_HCl = quad(f,298,393)[0]\t# Change in enthalpy during temperature change from 25 C to 120 C of HCl - [J/g mol] \n", + "\n", + "H_H2O = 0 ;\t\t\t# Change in enthalpy during temperature change from 25 C to 25 C of H2O - [J/g mol] \n", + "\n", + "H_in = (Hf_HCl + H_HCl)*mol_HCl + (Hf_H2O + H_H2O)*mol_H2O ;\t\t\t# Enthalpy change of input -[J]\n", + "H_out = Hf1_HCl*mol_HCl +H1_HCl*mol1_HCl ;\t\t\t# Enthalpy change of output -[J]\n", + "\n", + "del_H = H_out - H_in ;\t\t\t# Net enthalpy change n process - [J]\n", + "Q = del_H; \t\t\t# By energy balance - [J]\n", + "\n", + "# Results\n", + "print 'The amount of heat removed from the absorber by cooling water is, %.0f J. '%Q\n", + "print 'It Seems answer is wrong in book'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The amount of heat removed from the absorber by cooling water is, -44159 J. \n", + "It Seems answer is wrong in book\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 28.3 page no. 875\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "soln1 = 600. ; \t\t\t# Mass flow rate of entering solution 1 -[lb/hr]\n", + "c1_NaOH = 10./100 ;\t\t\t# Fraction of NaOH in entering solution 1\n", + "T1 = 200. ;\t\t\t# Temperature at entry \n", + "soln2 = 400. ;\t\t\t# Mass flow rate of another solution 2 entering -[lb/hr]\n", + "c2_NaOH = 50./100 ;\t\t\t# Fraction of NaOH in another entering solution 2\n", + "\n", + "# Calculations\n", + "F = soln1 + soln2; \t\t\t# Mass flow rate of final solution - [lb/hr]\n", + "F_NaOH = c1_NaOH * soln1 + c2_NaOH * soln2 ;\t\t\t# Mass of NaOH in final solution-[lb]\n", + "F_H2O = F - F_NaOH ;\t\t\t# Mass of H2O in final solution-[lb]\n", + "H_soln1 = 152. ;\t\t\t# Specific enthalpy change for solution 1-[Btu/lb]\n", + "H_soln2 = 290. ;\t\t\t# Specific enthalpy change for solution 2-[Btu/lb]\n", + "H_F = (soln1*H_soln1 + soln2*H_soln2)/F ;\t\t\t# Specific enthalpy change for final solution -[Btu/lb]\n", + "\n", + "# Results\n", + "print ' (a) The final temperature of the exit solution from figure E28.3 using the obtained condition of final solution is 232 degree F '\n", + "\n", + "cF = F_NaOH*100/F; \t\t\t# Concentration of final solution -[wt % NaOH ]\n", + "print ' (b) The concentration of final solution is %.0f wt.%% NaOH . '%cF\n", + "\n", + "x = (F*H_F - F*175)/(1158.0 - 175) ;\t\t\t# H2O evaporated per hour -[lb]\n", + "print ' (c) H2O evaporated per hour is %.1f lb . '%x\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " (a) The final temperature of the exit solution from figure E28.3 using the obtained condition of final solution is 232 degree F \n", + " (b) The concentration of final solution is 26 wt.% NaOH . \n", + " (c) H2O evaporated per hour is 32.8 lb . \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "code", + "collapsed": true, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 3 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch29-checkpoint.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch29-checkpoint.ipynb new file mode 100644 index 00000000..7c95dcbe --- /dev/null +++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch29-checkpoint.ipynb @@ -0,0 +1,280 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:b5b2fcf9bb3d537cea245cafaa4a19d4d1dc42af6ab432d7e1ef22a8e48ae245" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 29 : Humidity Charts and their Uses" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 29.1 page no. 895\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "DBT = 90. ;\t\t\t# Dry bulb temperature - [degree F]\n", + "WBT = 70. ;\t\t\t# Wet bulb temperature - [degree F]\n", + "\n", + "#Get point A using DBT & WBT. Following information is obtained from humidity chart, fig. E29.1\n", + "# Results\n", + "print '(a) The Dew point is located at point B or about 60 degree F, using constant humidity line.'\n", + "print ' (b) By interpolation between 40%% and 30%% RH , you can find point A is at 37%% relative humidity .'\n", + "print ' (c) You can read humidity from the righthand ordinate as 0.0112 lb H2O/lb dry air .'\n", + "print ' (d) By interpolation again between 14.0 cubic feet/lb and 14.5 cubic feet/lb lines , you can find humid volume to be 14.1 cubic feet/lb dry air.'\n", + "print ' (e) The enthalpy value of saturated air with WBT 70 degree F is 34.1 Btu/lb dry air .'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a) The Dew point is located at point B or about 60 degree F, using constant humidity line.\n", + " (b) By interpolation between 40%% and 30%% RH , you can find point A is at 37%% relative humidity .\n", + " (c) You can read humidity from the righthand ordinate as 0.0112 lb H2O/lb dry air .\n", + " (d) By interpolation again between 14.0 cubic feet/lb and 14.5 cubic feet/lb lines , you can find humid volume to be 14.1 cubic feet/lb dry air.\n", + " (e) The enthalpy value of saturated air with WBT 70 degree F is 34.1 Btu/lb dry air .\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 29.2 page no. 897\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "DBT1 = 38 ;\t\t\t# Initial dry bulb temperature - [degree C]\n", + "DBT2 = 86 ;\t\t\t# Final dry bulb temperature - [degree C]\n", + "RH1 = 49 ;\t\t\t# Relative humidity - [%]\n", + "\n", + "#A is initial and B is final point , see fig. E29.2 . Dew point is obtained graphically and it is 24.8 degree C,therefore\n", + "print 'The Dew point is unchanged in the process because humidity is unchanged, and it is located at 24.8 degree C.'\n", + "\n", + "# Calculations\n", + "# Additional data is obtained from humidity chart , according to book data is as follows\n", + "A_Hsat = 90.0 ;\t\t\t# Enthalpy of saturation at point A- [kJ/kg]\n", + "A_dH = -0.5 ;\t\t\t#Enthalpy deviation-[kJ/kg]\n", + "A_Hact = A_Hsat + A_dH ;\t\t\t# Actual enthalpy at point A -[kJ/kg]\n", + "B_Hsat = 143.3 ;\t\t\t# Enthalpy of saturation at point B- [kJ/kg]\n", + "B_dH = -3.3 ;\t\t\t#Enthalpy deviation -[kJ/kg]\n", + "B_Hact = B_Hsat + B_dH ;\t\t\t# Actual enthalpy at point B -[kJ/kg]\n", + "\n", + "\t\t\t# Energy balance reduces to Q = del_H \n", + "del_H = B_Hact - A_Hact ;\t\t\t# Total change in enthalpy - [kJ/kg]\n", + "v = 0.91 ;\t\t\t# Specific volume of moist air at point A -[cubic metre / kg]\n", + "Q = del_H/v ;\t\t\t# Heat added per cubic metre of inital moist air -[kJ]\n", + "\n", + "# Results\n", + "print ' Heat added per cubic metre of inital moist air is %.1f kJ.'%Q\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Dew point is unchanged in the process because humidity is unchanged, and it is located at 24.8 degree C.\n", + " Heat added per cubic metre of inital moist air is 55.5 kJ.\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 29.3 page no. 898\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "DBT1 = 40 ;\t\t\t# Initial dry bulb temperature - [degree C]\n", + "DBT2 = 27 ;\t\t\t# Final dry bulb temperature - [degree C]\n", + "\n", + "# Process is assumed to be adiabatic, therefore wet bulb temperature is constant\n", + "WBT1 = 22 ;\t\t\t# Initial wet bulb temperature - [degree C]\n", + "WBT2 = WBT1 ;\t\t\t# Final wet bulb temperature - [degree C]\n", + "\n", + "# Calculations\n", + "#A is initial and B is final point , see fig. E29.3b . Humidity is obtained from humidity chart, according to book the respective humidities are as follows\n", + "H_B = 0.0145 ;\t\t\t# Humidity at point B -[kg H2O/kg dry air]\n", + "H_A = 0.0093 ;\t\t\t# Humidity at point A -[kg H2O/kg dry air]\n", + "Diff = H_B - H_A ;\t\t\t# Moisture added in kg per kilogram of dry air going through humidifier -[kg H2O/kg dry air] \n", + "\n", + "# Results\n", + "print 'Moisture added per kilogram of dry air going through humidifier is %.4f kg H2O.'%Diff\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Moisture added per kilogram of dry air going through humidifier is 0.0052 kg H2O.\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 29.4 page no. 900\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "c_bl = 8.30 * 10**6 ;\t\t\t# Capacity of blower - [cubic feet/hr]\n", + "DBT_A = 80 ;\t\t\t# Initial dry bulb temperature of moist air - [degree F]\n", + "DBT_B = 95 ;\t\t\t# Final dry bulb temperature of exit air - [degree F]\n", + "WBT_A = 65 ;\t\t\t# Initial wet bulb temperature of moist air - [degree F]\n", + "WBT_B = 90 ;\t\t\t# Final wet bulb temperature of exit air - [degree F]\n", + "T1_H2O = 120 ;\t\t\t# Initial temperature of water - [degree F]\n", + "T2_H2O = 90 ;\t\t\t# Final temperature of water - [degree F]\n", + "\n", + "#A is initial and B is final point , see fig. E29.4 . Humidity is obtained from humidity chart, according to book the respective humidities are as follows\n", + "H_A = 0.0098; \t\t\t# Humidity of air at A - [lb H2O / lb dry air]\n", + "H1_A = 69 ;\t\t\t# Humidity of air at A - [grains H2O / lb dry air]\n", + "\n", + "# Calculations\n", + "delH_A = 30.05 - 0.12; \t\t\t# Enthalpy of entering air -[Btu/lb dry air]\n", + "v_A = 13.82 ;\t\t\t# Specific volume of entering air -[cubic feet/lb dry air]\n", + "H_B = 0.0297;\t\t\t# Humidity of air at B - [lb H2O / lb dry air]\n", + "H1_B = 208 ;\t\t\t# Humidity of air at B - [grains H2O / lb dry air]\n", + "delH_B = 55.93 - 0.10 ;\t\t\t# Enthalpy of exit air -[Btu/lb dry air]\n", + "v_B = 14.65 ;\t\t\t# Specific volume of exit air -[cubic feet/lb dry air]\n", + "Eq_A = c_bl /v_A ;\t\t\t# Entering dry air equivalent of capacity of blower -[lb dry air]\n", + "\n", + "# Reference temperature for water stream is 32 degree F \n", + "del_H1_H2O = 1*(T1_H2O - 32) ;\t\t\t#Enthalpy of entering water -[Btu/lb H2O]\n", + "del_H2_H2O = 1*(T2_H2O - 32) ;\t\t\t#Enthalpy of exit water -[Btu/lb H2O]\n", + "tr_H2O = H_B - H_A ;\t\t\t# Transfer of water to air -[lb H2O / lb dry air] \n", + "\n", + "# Energy balance around the entire process yields W -\n", + "W = (delH_B - del_H2_H2O*tr_H2O - delH_A)/(del_H1_H2O - del_H2_H2O) ;\t\t\t# Water entering tower - [lb H2O/lb dry air]\n", + "W1 = W - tr_H2O ;\t\t\t# Water leaving tower -[lb H2O/lb dry air]\n", + "Total_W1 = W1* Eq_A ;\t\t\t# Total water leaving tower -[lb/hr]\n", + "\n", + "# Results\n", + "print 'Amount of water cooled per hour is %.2e lb/hr .'%Total_W1\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Amount of water cooled per hour is 4.83e+05 lb/hr .\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 29.5 page no. 902\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "W = 100 ;\t\t\t# Amount of entering water -[lb/hr]\n", + "H1 = .020 ;\t\t\t# Humidity of entering air -[lb H2O / lb dry air]\n", + "T1 = 155 ;\t\t\t#Temperature of entering air -[degree F]\n", + "DTB = 110 ;\t\t\t# Dry bulb temperature of exit air -[degree F]\n", + "WTB = 100 ;\t\t\t# Wet bulb temperature of exit air -[degree F]\n", + "\n", + "# Additional data is obtained from humidity chart, it is as follows\n", + "H2 = .0405 ;\t\t\t#Humidity of exit air -[lb H2O / lb dry air]\n", + "\n", + "# Calculations\n", + "del_H = H2 - H1 ;\t\t\t# Change in humidity betwween two states -[lb H2O / lb dry air]\n", + "air_in = (W*1.02)/(del_H * 1) ;\t\t\t# Amount of wet air entering -[lb]\n", + "\n", + "mol_air = 29. ;\t\t\t# Molecular wt. of air -[lb]\n", + "Ref_T = 32 + 460. ;\t\t\t# Reference temperature - [ degree R]\n", + "gi_T = 90 + 460.; \t\t\t# Given temperature on which calculation is based - [degree R] \n", + "air = (air_in *359*gi_T)/( mol_air*Ref_T) ;\t\t\t# Air consumption of dryer at 90 degree F and 1 atm -[cubic feet]\n", + "\n", + "# Results\n", + "print 'Air consumption of dryer at 90 degree F and 1 atm is %.2e cubic feet .'%air\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Air consumption of dryer at 90 degree F and 1 atm is 6.89e+04 cubic feet .\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "code", + "collapsed": true, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 5 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch3-checkpoint.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch3-checkpoint.ipynb new file mode 100644 index 00000000..4e398ea9 --- /dev/null +++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch3-checkpoint.ipynb @@ -0,0 +1,333 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:445dec12235c400efa979dcf04faa2911a77ac6433ec8e786b9205e0e8fdeeb4" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 3 : The balance equation and mass balance" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 3.4 page no : 88\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# variables\n", + "V=15.; #gal volume of gasoline\n", + "t=2.; #min\n", + "rho_water=62.3; #lbm/ft^3\n", + "sg=0.72; #specific gravity\n", + "\n", + "# calculation and Result\n", + "q=(15/2.0)*(0.1336/60) #ft^3/s vol. flow rate\n", + "print \"volumetric flow rate is %f ft^3/s\"%q\n", + "m=q*sg*rho_water #lbm/s\n", + "print \"Mass flow rate is %f lbm/s\"%m\n", + "d=1.; #in diameter of pipe\n", + "a=((math.pi)*d**2/4.0)/144.0; #ft^2 area of pipe\n", + "v_avg=q/a #ft/s\n", + "print \"The average velocity is %f ft/s\"%v_avg" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "volumetric flow rate is 0.016700 ft^3/s\n", + "Mass flow rate is 0.749095 lbm/s\n", + "The average velocity is 3.061886 ft/s\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.5 page no : 90\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# variables\n", + "d1=2.; #ft diameter of pipe at position 1\n", + "a1=(math.pi)/4*d1**2; #ft^2\n", + "v1=50.; #ft/s vel of gas at position 1\n", + "rho1=2.58; #lbm/ft^3 density of gas at position 1\n", + "d2=3.; #ft diameter of pipe at position 2\n", + "\n", + "# calculation\n", + "a2=(math.pi)/4*d2**2;\n", + "rho2=1.54; #lbm/ft^3 density at position 2\n", + "v2=(rho1/rho2)*(a1/a2)*v1 #ft/s\n", + "\n", + "# result\n", + "print \"Velocity is %f ft/s\"%v2\n", + "m=rho1*v1*a1 #lbm/s mass flow rate\n", + "print \"The mass flow rate is %f lbm/s\"%m" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Velocity is 37.229437 ft/s\n", + "The mass flow rate is 405.265452 lbm/s\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.6 page no : 91\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# variables\n", + "d1=0.25; #m diameter of pipe at position 1\n", + "v1=2.; #m/s velocity\n", + "rho=998.2; #kg/m^3 density of water\n", + "a1=(math.pi)/4*d1**2; #m^2\n", + "d2=0.125 #m diameter of pipe at position 2\n", + "\n", + "# calculation\n", + "a2=(math.pi)/4*d2**2; #m^2\n", + "m=rho*a1*v1 #kg/s mass flow rate\n", + "\n", + "# result\n", + "print \"Mass flow rate is %f kg/s\"%m\n", + "q=m/rho #m^3/s volumetric flow rate\n", + "print \"The volumetric flow rate is %f m^3/s\"%q\n", + "v2=(a1/a2)*v1 #m/s velocity\n", + "print \"Velocity of water is %f m/s\"%v2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass flow rate is 97.998056 kg/s\n", + "The volumetric flow rate is 0.098175 m^3/s\n", + "Velocity of water is 8.000000 m/s\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.7 page no : 92\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# variables\n", + "p_initial=1.; #atm pressure initially\n", + "p_final=0.0001; #atm pressure finally\n", + "V=10.; #ft^3 volume of system\n", + "q=1.; #ft^3/min vol. flow rate\n", + "\n", + "# calculation\n", + "t=(V/q)*math.log(p_initial/p_final) #min\n", + "\n", + "# result\n", + "print \"The time required is %f min\"%t" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The time required is 92.103404 min\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.8 page no : 93\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# variables\n", + "m_in=0.0001; #lbm/min\n", + "q_out=1.; #ft^3/min\n", + "rho_sys=m_in/q_out #lbm/ft^3\n", + "rho_air=0.075; #lbm/ft^3\n", + "p_initial=1.; #atm\n", + "\n", + "# calculation\n", + "p_steady=p_initial*(rho_sys/rho_air) #atm\n", + "\n", + "# result\n", + "print \"The steady state pressure is %f atm\"%p_steady" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The steady state pressure is 0.001333 atm\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.9 page no : 94\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# variables\n", + "d=3.; #m diameter of tank\n", + "a=(math.pi)*d**2/4; #m^2\n", + "d_in=0.1; #m inner diameter of inflow pipe\n", + "d_out=0.2; #m\n", + "v_in=2.0; #m/s\n", + "v_out=1.0; #m/s\n", + "\n", + "# calculation\n", + "q_in=((math.pi)*d_in**2/4.0)*v_in; #m^3/s\n", + "q_out=((math.pi)*d_out**2/4.0)*v_out; #m^3/s\n", + "\n", + "#let D represent d/dt\n", + "DV=q_in-q_out; #m^3/s\n", + "\n", + "# result\n", + "if DV>1:\n", + " print \"The water level in tank is rising\"\n", + "elif DV<1:\n", + " print \"The water level in tank is falling\"\n", + "else:\n", + " print \"No accumulation\"\n", + "#let h be the height of water in tank\n", + "Dh=DV/a #m/s \n", + "print \"The rate of level of water is rising or falling in a cylindrical tank is %f m/s\"%Dh" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The water level in tank is falling\n", + "The rate of level of water is rising or falling in a cylindrical tank is -0.002222 m/s\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.11 page no : 97\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# variables\n", + "q=5/8.0; #kg/hr mass evaporation rate of benzene\n", + "c=1.3*10**(-6); #kg/m^3 concentration of benzene\n", + "\n", + "# calculation\n", + "Q=q/c/3600.0 #m^3/s\n", + "\n", + "# result\n", + "print \"The flow rate of ventilation air supply is %f m^3/s\"%Q" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The flow rate of ventilation air supply is 133.547009 m^3/s\n" + ] + } + ], + "prompt_number": 8 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch4-checkpoint.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch4-checkpoint.ipynb new file mode 100644 index 00000000..7ed88091 --- /dev/null +++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch4-checkpoint.ipynb @@ -0,0 +1,116 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:16617b0214df1f3fa0b6950901fd2bc173679187633649259f00cd5dd8aa8d5e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 4 : Temperature" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "\n", + "Example 4.1 Page no. 92\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variable\n", + "#(a)\n", + "Temp_c=100. ; #[degree Celsius]\n", + "\n", + "# Calculation and Result\n", + "Temp_k=Temp_c+273 ; #[K]\n", + "print '(a) Temperature in kelvin is %.2f K'%Temp_k\n", + "\n", + "#(b)\n", + "Temp_f=(100*(1.8/1)) +32 ; #[degree Fahrenheit]\n", + "print ' (b) Temperature in degree Fahrenheit is %.2f '%Temp_f\n", + "\n", + "#(c)\n", + "Temp_r= Temp_f + 460 ; #[degree Rankine ]\n", + "print ' (c) Temperature in degree Rankine is %.2f '%Temp_r" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a) Temperature in kelvin is 373.00 K\n", + " (b) Temperature in degree Fahrenheit is 212.00 \n", + " (c) Temperature in degree Rankine is 672.00 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.2 Page no. 93\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "c = 139.1 + (1.56*10**-1)*(-460-32)/1.8 ;\n", + "d = (1.56*10**-1)/1.8;\n", + "\n", + "# Calculation\n", + "#Now convert c +dTR to (Btu/lb mol*degree R) to get answer of form a + bTR,where\n", + "a = c*(454/(1055*1.8)) ;\n", + "b = d*(454/(1055*1.8)) ;\n", + "\n", + "# Result\n", + "print 'The required answer is %.2f + (%.2e)T Btu/(lb mol*degree R) , where T is in degree R . '%(a,b)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The required answer is 23.06 + (2.07e-02)T Btu/(lb mol*degree R) , where T is in degree R . " + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "code", + "collapsed": true, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch5-checkpoint.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch5-checkpoint.ipynb new file mode 100644 index 00000000..7c4d25d6 --- /dev/null +++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch5-checkpoint.ipynb @@ -0,0 +1,233 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:17452ca2e9b7dcffa8d444e8e6e3bb3b7f47f9f947558729a784ae56a1f45de2" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Chapter 5 : Pressure" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.1 Page no.109\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "P = 60 ; #[Gpa]\n", + "\n", + "# Calculation and Results\n", + "#(a)\n", + "p_atm = (P*(10**6))/101.3 ; #[atm]\n", + "print '(a) Pressure in atmospheres is %.2e atm'%p_atm\n", + "\n", + "#(b)\n", + "p_s = (P*(10**6)*14.696)/101.3 ; #[psia]\n", + "print ' (b) Pressure in psia is %.2e psia'%p_s\n", + "\n", + "# (c)\n", + "p_in = (P*(10**6)*29.92)/101.3 ; #[inches of Hg]\n", + "print ' (c) Pressure in inches of Hg is %.2e in. Hg'%p_in\n", + "\n", + "# (d)\n", + "p_mm = (P*(10**6)*760)/101.3 ; #[mm of Hg]\n", + "print ' (d) Pressure in mm of Hg is %.2e mm Hg'%p_mm" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a) Pressure in atmospheres is 5.92e+05 atm\n", + " (b) Pressure in psia is 8.70e+06 psia\n", + " (c) Pressure in inches of Hg is 1.77e+07 in. Hg\n", + " (d) Pressure in mm of Hg is 4.50e+08 mm Hg" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 5.2 Page no. 110\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variable\n", + "b_rd = 28.0 ; #[in. Hg]\n", + "p_rd = 51.0 ; #[psia]\n", + "\n", + "# calculation\n", + "p_atm = b_rd*14.7/29.92 ; # [psia]\n", + "p_tnk = p_atm+p_rd ; #[psia]\n", + "\n", + "# Result\n", + "print ' Pressure in tank in psia is %.1f psia'%p_tnk" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Pressure in tank in psia is 64.8 psia\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 5.3 Page no. 111\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "b_rd = 100.0 ; #[kPa]\n", + "gp = 64.5*101.3/76.0 ; #[kPa]\n", + "\n", + "# Calculations\n", + "p_tnk = b_rd-gp ; #[kPa]\n", + "\n", + "# Results\n", + "print ' Absolute Pressure in tank in is %.1f kPa'%p_tnk\n", + "print ' Since absolute pressure in tank(%.1f kPa) is less than 20 kPa , the \\\n", + " mice probably will not survive. '%p_tnk" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Absolute Pressure in tank in is 14.0 kPa\n", + " Since absolute pressure in tank(14.0 kPa) is less than 20 kPa , the mice probably will not survive. \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 5.4 Page no. 115\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "df = 1.10*10**3 ; #[kg/m**3]\n", + "d = 1.0*10**3 ; #[kg/m**3]\n", + "g = 9.8 ; #[m/s**2]\n", + "h = 22.0 ; #[mm]\n", + "\n", + "# Calculation\n", + "dP = (df-d)*g*(h*10**(-3)) ; #[Pa]\n", + "\n", + "# Result\n", + "print 'Pressure difference across the orifice plate is %.1f Pa.'%dP" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Pressure difference across the orifice plate is 21.6 Pa.\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 5.5 Page no. 117\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "p_atm=730.0*29.92/760.0 ; #[in. Hg]\n", + "gp= (4.0*29.92)/(2.54*12*33.91) ; #[in. Hg]\n", + "\n", + "# Calculation\n", + "p_air=p_atm-gp ; #[in. Hg]\n", + "\n", + "# Result\n", + "print ' Pressure of the air is %.1f in. Hg.'%p_air" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Pressure of the air is 28.6 in. Hg.\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "code", + "collapsed": true, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch6-checkpoint.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch6-checkpoint.ipynb new file mode 100644 index 00000000..572f406f --- /dev/null +++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch6-checkpoint.ipynb @@ -0,0 +1,166 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:829300ed441b0056de124b3c59bbb1f7034cd4f5704a4d95b4ff6c77357fd0c5" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 6 : Introduction to Material Balances" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.1 Page no. 142\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from numpy import matrix\n", + "\n", + "# Variables\n", + "# Given\n", + "P_O = 89 ; # Premium octane -[octane/gal]\n", + "S_O = 93 ; # Supereme octane - [octane/gal]\n", + "R_O = 87 ; # Regular octane - [octane/gal]\n", + "CP = 1.269 ; # Cost of premium octane -[$/gal]\n", + "SP = 1.349 ; # Cost of supereme octane -[$/gal]\n", + "RP = 1.149 ; # Cost of regular octane -[$/gal]\n", + "\n", + "# Let x and y fraction of regular octane and supreme octane is blended respectively,therefore: x + y = 1 ...(a)\n", + "# and 89 = 87x + 93y ...(b)\n", + "# Solve equations (a) and (b) simultaneously\n", + "# Calculation\n", + "a = matrix([[1,1],[87,93]]) ; # Matrix of coefficients of unknown\n", + "b = matrix([[1.0],[89.0]]) ; # Matrix of constant\n", + "a = a.I\n", + "c = a * b\n", + "cost = c[0]*RP + c[1]*SP ; # Cost after blending - [$/gal]\n", + "sv = CP - cost ; # Save on blending - [$/gal]\n", + "\n", + "# Result\n", + "# Check whether there is loss or save\n", + "if (sv<0):\n", + " print 'We will not save money by blending.'\n", + "else:\n", + " print 'We will save money by blending, and save is %.3f $/gal.'%sv" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "We will save money by blending, and save is 0.053 $/gal.\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 6.2 Page no. 147\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "fd= 1000.0 ; #feed rate-[L/hr]\n", + "cfd= 500.0; #Weight of cells per litre- [mg/L]\n", + "dn= 1.0 ; #Density of feed-[g/cm**3]\n", + "wp= 50.0 ; # Weight percent of cells in product stream\n", + "\n", + "# Calculation and Result\n", + "Pg=(fd*cfd*dn)/(1000*wp*.01) ; # Mass balance for cells \n", + "print ' Product flow(P) per hour is %.1f g'%Pg\n", + "Dg= (fd*dn*1000) - Pg*(wp*.01) ; # Mass balance for the fluid\n", + "print ' Discharge flow per hour is %.3e g'%Dg" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Product flow(P) per hour is 1000.0 g\n", + " Discharge flow per hour is 9.995e+05 g\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.3 Page no. 154\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "dn = 0.80 ; #Density of motor oil-[g/cm**3]\n", + "\n", + "# Calculation and Result\n", + "in_ms = (10000*(0.1337)*62.4*dn) ; # Initial mass of motor oil in the tank -[lb]\n", + "print ' Initial mass of motor oil in the tank is %.1f lb'%in_ms\n", + "\n", + "m_fr = .0015 ; #Mass fractional loss\n", + "print ' Mass fractional loss is %.4f '%m_fr\n", + "\n", + "Dsg = m_fr*in_ms ; # Mass balance for the fluid\n", + "print ' Discharge of motor oil on flushing flow for 10000 gal motor oil is %.1f lb'%Dsg" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Initial mass of motor oil in the tank is 66743.0 lb\n", + " Mass fractional loss is 0.0015 \n", + " Discharge of motor oil on flushing flow for 10000 gal motor oil is 100.1 lb\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "code", + "collapsed": true, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch7-checkpoint.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch7-checkpoint.ipynb new file mode 100644 index 00000000..f1754ae4 --- /dev/null +++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch7-checkpoint.ipynb @@ -0,0 +1,149 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:702f6d54433444391f54642fccdef71d5ded6c19433d61198181ed7204437113" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 7 : A General Strategy for Solving Material Balance Problems" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 7.1 Page no.169\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "v_ts = 105.0 ; # velocity of train wrt station-[cm/s]\n", + "v_mt = 30.0 ; # velocity of man wrt train-[cm/s]\n", + "v_hm = 2.0 ; # velocity of hot dough wrt man-[cm/s]\n", + "v_am = 1.0 ; # velocity of ant wrt man- [cm/s]\n", + "# By careful reading of problem you can see that ant is moving away from man's mouth at 1 cm/s , so ant's velocity wrt station \n", + "#is say v_as\n", + "\n", + "# Calculation\n", + "v_as = v_ts + v_mt + v_am;\n", + "\n", + "# Results\n", + "print ' The ant is moving towards station at the rate of %.1f cm/s.'%v_as" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The ant is moving towards station at the rate of 136.0 cm/s.\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 7.4 Page no. 180\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "n_un= 7 ; # Number of unknowns in the given problem- 3 values of xi and 4 values Fi\n", + "n_ie = 5 ; # Number of independent equations\n", + "\n", + "# Calculations\n", + "d_o_f = n_un-n_ie ; # No. of degree of freedom\n", + "\n", + "# Results\n", + "print 'Number of degree of freedom for the given system is %i .'%d_o_f" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of degree of freedom for the given system is 2 .\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 7.5 Page no. 182\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# variables\n", + "n_un=8 ; # Number of unknowns in the given problem- 8 values of mole fractions\n", + "n_ie =6 ; # Number of independent equations- six elemental balances \n", + "\n", + "# Calculation\n", + "d_o_f= n_un-n_ie ;# Number of degree of freedom\n", + "\n", + "# Results\n", + "print 'Number of degree of freedom for the given system is %i .'%d_o_f\n", + "#Note: Experiments show that the change in CH1.8O.5N.16S.0045P.0055 and the change in C(alpha)H(beta)O(gamma) prove to be \n", + "#related by amount of biomass present and the maintenance coefficient(the moles of substrate per mole of biomass per second) \n", + "#so the respective quantities cannot be chosen independently.Consequently with this extra constraint,only one degree of freedom \n", + "#remains to be specified, the basis" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of degree of freedom for the given system is 2 .\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "code", + "collapsed": true, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch8-checkpoint.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch8-checkpoint.ipynb new file mode 100644 index 00000000..350e9391 --- /dev/null +++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch8-checkpoint.ipynb @@ -0,0 +1,442 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:db3a394cd915f3675da3a1ec91e93913eb152d495576bd0a47778fe0952f79fb" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 8 : Solving Material Balance Problems for Single Units without Reaction" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 8.1 Page no. 197\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "# Basis : 1 min\n", + "d_w = 1.0 ; # Density of aqueous solution-[g/cubic metre]\n", + "d_sol = 0.6 ; # Density of organic solvent-[g/cubic metre]\n", + "n_un = 8 ; # Number of unknowns in the given problem\n", + "n_ie = 8 ; # Number of independent equations\n", + "\n", + "# Calculation and Results\n", + "d_o_f = n_un-n_ie ; # Number of degree of freedom\n", + "print 'Number of degree of freedom for the given system is %i .'%d_o_f\n", + "\n", + "# Material balance of Strep.\n", + "x = (200*10+10*0-200*0.2)/10; #[g]\n", + "print 'Strep per litre of solvent is %.1f g .'%x\n", + "\n", + "cnc = x/(1000*d_sol) ; #[g Strep/g of S]\n", + "print 'Strep per gram of solvent is %.4f g Strep/g of S .'%cnc\n", + "\n", + "m_fr = cnc/(1+cnc) ; #Mass fraction\n", + "print 'Mass fraction of Strep is %.3f g .'%m_fr" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of degree of freedom for the given system is 0 .\n", + "Strep per litre of solvent is 196.0 g .\n", + "Strep per gram of solvent is 0.3267 g Strep/g of S .\n", + "Mass fraction of Strep is 0.246 g .\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 8.2 Page no. 199\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "F_O2 = 0.21 ; # fraction of O2 in feed(F) \n", + "F_N2 = 0.79 ; # fraction of N2 in feed(F) \n", + "P_O2 = 0.25 ; # fraction of O2 in product(P)\n", + "P_N2 = 0.75 ; # fraction of N2 in product(P)\n", + "F = 100 ; # Feed - [g mol]\n", + "w = 0.80 ; # Fraction of waste\n", + "W = w*F ; # Waste -[g mol]\n", + "\n", + "# Calculation\n", + "# By analysis for degree of freedom , DOF comes to be zero \n", + "P = F - W ; # By overall balance - [g mol]\n", + "W_O2 = (F_O2*F - P*P_O2)/100 # Fraction of O2 in waste stream by O2 balance \n", + "W_N2 = (W - W_O2*100)/100 ; #Fraction of N2 in waste stream\n", + " \n", + "# Results \n", + "print 'Composition of Waste Stream' \n", + "print ' Component Fraction in waste stream' \n", + "print ' O2 %.2f'%W_O2 \n", + "print ' N2 %.2f'%W_N2 " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Composition of Waste Stream\n", + " Component Fraction in waste stream\n", + " O2 0.16\n", + " N2 0.64\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 8.3 Page no. 202\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "# Basis : 1 hr so F = 1000 kg\n", + "F = 1000 ; # feed rate-[kg/hr]\n", + "P = F/10.0 ; # product mass flow rate -[kg/hr]\n", + "\n", + "n_un = 9 ; # Number of unknowns in the given problem\n", + "n_ie = 9 ; # Number of independent equations\n", + "\n", + "# Calculation and Result\n", + "d_o_f = n_un-n_ie ; # Number of degree of freedom\n", + "print 'Number of degree of freedom for the given system is %i .'%d_o_f\n", + "\n", + "# Overall mass balance: F = P+B\n", + "B = F-P ; # bottom mass flow rate -[kg/hr]\n", + "print ' Bottom mass flow rate - %.1f kg '%B\n", + "\n", + "# Composition of bottoms by material balances\n", + "m_EtOH = 0.1*F-0.6*P ; # By EtOH balance-[kg]\n", + "m_H2O = 0.9*F - 0.4*P ; # By H2O balance-[kg]\n", + "total = m_EtOH+m_H2O ; #[kg]\n", + "f_EtOH = m_EtOH/total ; # Mass fraction of EtOH\n", + "f_H2O = m_H2O/total ; # Mass fraction of H2O\n", + "\n", + "print ' Mass of EtOH in bottom - %.1f kg '%m_EtOH\n", + "print ' Mass of H2O in bottom - %.1f kg '%m_H2O\n", + "print ' Mass fraction of EtOH in bottom - %.3f '%f_EtOH\n", + "print ' Mass fraction of H2O in bottom - %.3f '%f_H2O" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of degree of freedom for the given system is 0 .\n", + " Bottom mass flow rate - 900.0 kg \n", + " Mass of EtOH in bottom - 40.0 kg \n", + " Mass of H2O in bottom - 860.0 kg \n", + " Mass fraction of EtOH in bottom - 0.044 \n", + " Mass fraction of H2O in bottom - 0.956 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 8.4 Page no. 205\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from numpy import matrix\n", + "\n", + "# Variables\n", + "# Given\n", + "A = 200 ; # Mass of added solution [kg] \n", + "P_H2SO4 = .1863 ; #Fraction of H2SO4 in P(Final solution)\n", + "P_H2O = .8137 ; #Fraction of H2O in P(Final solution)\n", + "A_H2SO4 = .777 ; #Fraction of H2SO4 in A(Added solution)\n", + "A_H2O = .223 ; #Fraction of H2O in A(Added solution)\n", + "F_H2SO4 = .1243 ; #Fraction of H2SO4 in F(Original solution)\n", + "F_H2O = .8757 ; #Fraction of H2O in F(Original solution)\n", + "\n", + "# Calculations\n", + "# P - F = A - By overall balance\n", + "a = matrix([[P_H2O,-F_H2O],[1,-1]]) ; # Matrix of coefficient\n", + "b = matrix([[A*A_H2O],[A]]) ; # Matrix of contants\n", + "a = a.I\n", + "x = a*b ; # Matrix of solutions- P = x(1) and F = x(2)\n", + "\n", + "#Results\n", + "print ' Original solution taken- %.0i kg'%x[1]\n", + "print ' Final solution or kilograms of battery acid formed- %.0i kg'%x[0]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Original solution taken- 1905 kg\n", + " Final solution or kilograms of battery acid formed- 2105 kg\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 8.5 Page no. 207\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from numpy import matrix\n", + "\n", + "# Variables\n", + "# Given\n", + "W = 100.0 ; # Water removed - [kg]\n", + "A_H2O = 0.80 ; # Fraction of water in A(intial fish cake)\n", + "A_BDC = 0.20 ; # Fraction of BDC(bone dry cake) in B(final dry fish cake)\n", + "B_H2O = 0.40 ; # Fraction of water in A(intial fish cake)\n", + "B_BDC = 0.60 ; # Fraction of BDC(bone dry cake) in B(final dry fish cake)\n", + "\n", + "# Calculations\n", + "a = matrix([[A_H2O, -B_H2O],[1, -1]]) ; # Matrix of coefficient\n", + "b = matrix([[W],[W]]) ; # Matrix of contants\n", + "a = a.I\n", + "x = a * b; # Matrix of solutions- A = x(1) and B = x(2)\n", + "\n", + "# Results\n", + "print 'Weight of the fish cake originally put into dryer -%.0i kg'%x[0]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Weight of the fish cake originally put into dryer -150 kg\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 8.6 Page no. 209\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "# Composition of initial solution at 30 degree C\n", + "s_30 = 38.8 ; # solublity of Na2CO3 at 30 degree C, by using the table for solublity of Na2CO3-[g Na2CO3/100 g H2O]\n", + "If_Na2CO3 = s_30/(s_30+100) ; # Initial mass fraction of Na2CO3\n", + "If_H2O = 1-If_Na2CO3 ; # Initial mass fraction of H2O\n", + "\n", + "# Composition of crystals\n", + "# Basis : 1g mol Na2CO3.10H2O\n", + "n_mol_Na2CO3 = 1 ; # Number of moles of Na2CO3\n", + "n_mol_H2O = 10. ; # Number of moles of H2O\n", + "mwt_Na2CO3 = 106. ; # mol. wt of Na2CO3\n", + "mwt_H2O = 18. ; # mol. wt of H2O\n", + "\n", + "# Calculation and Results\n", + "m_Na2CO3 = mwt_Na2CO3*n_mol_Na2CO3 ; # Mass of Na2CO3\n", + "m_H2O = mwt_H2O*n_mol_H2O ; # Mass of H2O\n", + "Cf_Na2CO3 = m_Na2CO3/(m_Na2CO3+m_H2O) ; # mass fraction of Na2CO3 \n", + "Cf_H2O = 1-Cf_Na2CO3 ; # mass fraction of H2O\n", + "\n", + "n_un = 9. ; # Number of unknowns in the given problem\n", + "n_ie = 9. ; # Number of independent equations\n", + "d_o_f = n_un-n_ie ; # Number of degree of freedom\n", + "\n", + "print 'Number of degree of freedom for the given system is %i .'%d_o_f\n", + "\n", + "# Final composition of tank\n", + "#Basis :I = 10000 kg\n", + "# Material balance reduces to Accumulation = final -initial = in-out(but in = 0)\n", + "I = 10000. ; #initial amount of saturated solution-[kg]\n", + "amt_C = 3000. ; # Amount of crystals formed-[kg]\n", + "Fm_Na2CO3 = I*If_Na2CO3-amt_C*Cf_Na2CO3 ; # Mass balance of Na2CO3\n", + "Fm_H2O = I*If_H2O-amt_C*Cf_H2O ; # Mass balance of H2O\n", + "\n", + "#To find temperature,T\n", + "s_T = (Fm_Na2CO3/Fm_H2O)*100 ; # Solublity of Na2CO3 at temperature T\n", + "s_20 = 21.5 ; #Solublity of Na2CO3 at temperature 20 degree C ,from given table-[g Na2CO3/100 g H2O]\n", + "\n", + "# Find T by interpolation\n", + "T = 30-((s_30-s_T)/(s_30-s_20))*(30-20) ; # Temperature -[degree C]\n", + "print ' Temperature to which solution has to be cooled to get 3000 kg crystals is %.0f degree C .'%T" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of degree of freedom for the given system is 0 .\n", + " Temperature to which solution has to be cooled to get 3000 kg crystals is 26 degree C .\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 8.7 Page no. 213\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "# Write given data\n", + "B_in = 1.1 ; # Flow rate in of blood -[L/min]\n", + "B_out = 1.2; # Flow rate out of blood -[L/min]\n", + "S_in = 1.7; # Flow rate in of solution -[L/min]\n", + "\n", + "# Composition of input blood\n", + "B_in_CR = 2.72 ; #[g/L]\n", + "B_in_UR = 1.16 ; #[g/L]\n", + "B_in_U = 18 ; #[g/L]\n", + "B_in_P = 0.77 ; #[g/L]\n", + "B_in_K = 5.77 ; #[g/L]\n", + "B_in_Na = 13.0 ; #[g/L]\n", + "B_in_water = 1100 ; #[mL/min]\n", + "\n", + "# Composition of output blood\n", + "B_out_CR = 0.120 ; #[g/L]\n", + "B_out_UR = 0.060; #[g/L]\n", + "B_out_U = 1.51 ; #[g/L]\n", + "B_out_P = 0.040 ; #[g/L]\n", + "B_out_K = 0.120 ; #[g/L]\n", + "B_out_Na = 3.21 ; #[g/L]\n", + "B_out_water = 1200. ; #[mL/min]\n", + "\n", + "# Calculation and Result\n", + "n_un = 7. ; # Number of unknowns in the given problem\n", + "n_ie = 7. ; # Number of independent equations\n", + "d_o_f = n_un-n_ie ; # Number of degree of freedom\n", + "print 'Number of degree of freedom for the given system is %i .'%d_o_f\n", + "\n", + "# Water balance in grams, assuming 1 ml is equivalent to 1 g\n", + "S_in_water = 1700. ; #[ml/min]\n", + "S_out_water = B_in_water+ S_in_water - B_out_water;\n", + "S_out = S_out_water/1000. ; #[L/min]\n", + "print ' Flow rate of water in output solution is %.2f L/min.'%S_out\n", + "\n", + "# The component balance in grams for CR,UR,U,P,K and Na are\n", + "S_out_CR = (B_in*B_in_CR - B_out*B_out_CR)/S_out;\n", + "S_out_UR = (B_in*B_in_UR - B_out*B_out_UR)/S_out;\n", + "S_out_U = (B_in*B_in_U - B_out*B_out_U)/S_out;\n", + "S_out_P = (B_in*B_in_P - B_out*B_out_P)/S_out;\n", + "S_out_K = (B_in*B_in_K - B_out*B_out_K)/S_out;\n", + "S_out_Na = (B_in*B_in_Na - B_out*B_out_Na)/S_out;\n", + "print ' Component Concentration(g/L) in output Dialysis solution '\n", + "print ' UR %.2f '%S_out_UR\n", + "print ' CR %.2f '%S_out_CR\n", + "print ' U %.2f '%S_out_U\n", + "print ' P %.2f '%S_out_P\n", + "print ' K %.2f '%S_out_K\n", + "print ' Na %.2f '%S_out_Na" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of degree of freedom for the given system is 0 .\n", + " Flow rate of water in output solution is 1.60 L/min.\n", + " Component Concentration(g/L) in output Dialysis solution \n", + " UR 0.75 \n", + " CR 1.78 \n", + " U 11.24 \n", + " P 0.50 \n", + " K 3.88 \n", + " Na 6.53 \n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "code", + "collapsed": true, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch9-checkpoint.ipynb b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch9-checkpoint.ipynb new file mode 100644 index 00000000..53f8e501 --- /dev/null +++ b/Basic_Principles_And_Calculations_In_Chemical_Engineering/.ipynb_checkpoints/ch9-checkpoint.ipynb @@ -0,0 +1,506 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:fa0721f1d96e3929565a094cfe21c7d86b4e801aa71b0940b32ef9174b4285dc" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 9 : The Chemical Reaction Equation and Stoichiometry" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.1 Page no. 228\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variables\n", + "# Given \n", + "#Main eqn. C6H12O6 + aO2 ---> bCO2 + cH2O\n", + "# By carbon balance\n", + "b = 6 ;\n", + "\n", + "#By hydrogen balance\n", + "c = 6;\n", + "\n", + "# calculation\n", + "#Balancing oxygen in reaction\n", + "a = (c*1+b*2-6)/2.0;\n", + "\n", + "#result\n", + "print 'Value of a is %i'%a\n", + "print 'Value of b is %i'%b\n", + "print 'Value of c is %i'%c" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of a is 6\n", + "Value of b is 6\n", + "Value of c is 6\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 9.2 Page no. 229\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "m_CO2 = 44.0 ; #molecular wt-[g]\n", + "m_C7H16 = 100.1 ; #molecular wt-[g]\n", + "p_con = 50. ; # percentage conversion of CO2 to dry ice\n", + "amt_di = 500. ; # amount of dry ice to be produce per hour-[kg]\n", + "\n", + "# Calculation\n", + "# By using the given equation \n", + "amt_C7H16 = (amt_di*m_C7H16)/((p_con/100.)*m_CO2*7) ;# [kg]\n", + "\n", + "# Result\n", + "print 'Amount of heptane required per hour to produce 500kg dry ice per hour is %.1f kg.'%amt_C7H16" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Amount of heptane required per hour to produce 500kg dry ice per hour is 325.0 kg.\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 9.3 Page no. 230\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "m_CaCO3 = 100.1 ; #molecular wt-[g]\n", + "m_MgCO3 = 84.32 ; #molecular wt-[g]\n", + "m_CaO = 56.08 ; #molecular wt-[g]\n", + "m_MgO = 40.32 ; #molecular wt-[g]\n", + "m_CO2 = 44.0 ; #molecular wt-[g]\n", + "\n", + "# Limestone analysis\n", + "p_CaCO3 = 92.89 ; # percentage of CaCO3\n", + "p_MgCO3 = 5.41 ; # percentage of MgCO3 \n", + "inrt = 1.7 ; #percentage of inert\n", + "\n", + "# Calculation and Results\n", + "#(a)\n", + "amt_CaO = (((p_CaCO3/100)*m_CaO)/m_CaCO3)*2000 ; #Pounds of CaO produced from 1 ton(2000lb) of limestone\n", + "print ' Amount of CaO produced from 1 ton(2000lb) of limestone is %.0f lb.'%amt_CaO\n", + "\n", + "#(b)\n", + "mol_CaCO3 = (p_CaCO3/100)/m_CaCO3 ; # lb mol of CaCO3\n", + "mol_MgCO3 = (p_MgCO3/100)/m_MgCO3 ; # lb mol of MgCO3\n", + "total_mol = mol_CaCO3+mol_MgCO3;\n", + "amt_CO2 = total_mol*m_CO2 ; # Amount of CO2 recovered per pound of limestone-[lb]\n", + "print ' Amount of CO2 recovered per pound of limestone is %.3f lb.'%amt_CO2\n", + "\n", + "#(c)\n", + "amt_CaO = m_CaO*mol_CaCO3 ; # since lb mol of CaO = CaCO3\n", + "amt_MgO = m_MgO*mol_MgCO3 ; # since lb mol of MgO = MgCO3\n", + "total_lime = amt_CaO+amt_MgO+(inrt)/100 ; # total amount of lime per pound limestone\n", + "amt_lmst = 2000/total_lime ; # Amount of limestone required to make 1 ton(2000lb) of lime \n", + "print ' Amount of limestone required to make 1 ton(2000lb) of lime %.1f lb.'%amt_lmst" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Amount of CaO produced from 1 ton(2000lb) of limestone is 1041 lb.\n", + " Amount of CO2 recovered per pound of limestone is 0.437 lb.\n", + " Amount of limestone required to make 1 ton(2000lb) of lime 3550.7 lb.\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 9.4 Page no. 235\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "f_NH3 = 5. ; # NH3 in feed-[g]\n", + "f_N2 = 100. ; # N2 in feed-[g]\n", + "f_H2 = 50. ; # H2 in feed-[g]\n", + "p_NH3 = 90. # NH3 in product-[g]\n", + "m_NH3 = 17. ; # Molecular wt. of NH3-[g]\n", + "m_N2 = 28. ; # Molecular wt. of N2-[g]\n", + "m_H2 = 2. ; # Molecular wt. of H2-[g]\n", + "\n", + "# Calculations \n", + "# Extent of reaction can be calculated by using eqn. 9.3 \n", + "# For NH3\n", + "ni = p_NH3/m_NH3 ; #[g mol NH3]\n", + "nio = f_NH3/m_NH3 ; #[g mol NH3]\n", + "vi = 2 ; # coefficint of NH3\n", + "ex_r = (ni-nio)/vi # Extent of reaction - moles reacting\n", + "\n", + "#Determine H2 and N2 in product of reaction by Eqn. 9.4\n", + "# For N2\n", + "nio_N2 = f_N2/m_N2 ; #[g mol N2]\n", + "vi_N2 = -1 ; # coefficint of N2\n", + "ni_N2 = nio_N2 + vi_N2*ex_r ; #N2 in product of reaction-[g moles ]\n", + "m_N2 = ni_N2*m_N2 ; # mass of N2 in product of reaction-[g]\n", + "\n", + "# Results\n", + "print ' N2 in product of reaction is %.2f g moles '%ni_N2\n", + "print ' Mass of N2 in product of reaction is %.2f g '%m_N2\n", + "# For H2\n", + "nio_H2 = f_H2/m_H2 ; #[g mol H2]\n", + "vi_H2 = -3 ; # coefficint of H2\n", + "ni_H2 = nio_H2 + vi_H2*ex_r ; #H2 in product of reaction-[g moles ]\n", + "m_H2 = ni_H2*m_H2 ; # mass of H2 in product of reaction-[g]\n", + "print ' H2 in product of reaction is %.2f g moles '%ni_H2\n", + "print ' Mass of H2 in product of reaction is %.2f g '%m_H2\n", + "\n", + "# ARP\n", + "m_SO2 = 64. ; # Molecular wt.of SO2-[g]\n", + "mol_SO2 = 2. ; # moles of SO2\n", + "ARP = (1./m_NH3)/(mol_SO2/m_SO2);\n", + "print ' ARP is %.2f '%ARP" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " N2 in product of reaction is 1.07 g moles \n", + " Mass of N2 in product of reaction is 30.00 g \n", + " H2 in product of reaction is 17.50 g moles \n", + " Mass of H2 in product of reaction is 35.00 g \n", + " ARP is 1.88 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 9.5 Page no. 238\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "f_N2 = 10. ; # N2 in feed-[g]\n", + "f_H2 = 10. ; # H2 in feed-[g]\n", + "m_NH3 = 17.02 # Molecular wt. of NH3-[g]\n", + "m_N2 = 28. ; # Molecular wt. of N2-[g]\n", + "m_H2 = 2. ; # Molecular wt. of H2-[g]\n", + "\n", + "# Calculations\n", + "# Extent of reaction can be calculated by using eqn. 9.3 \n", + "# Based on N2\n", + "nio_N2 = f_N2/m_N2 #[g mol N2]\n", + "vi_N2 = -1 ; # coefficint of N2\n", + "ex_N2 = -(nio_N2)/vi_N2 ; # Max. extent of reaction based on N2\n", + "\n", + "# Based on H2\n", + "nio_H2 = f_H2/m_H2 ; #[g mol H2]\n", + "vi_H2 = -3 ; # coefficint of H2\n", + "ex_H2 = -(nio_H2)/vi_H2 # Max. extent of reaction based on H2\n", + "\n", + "#(a)\n", + "vi_NH3 = 2 ; # coefficint of NH3\n", + "mx_NH3 = ex_N2*vi_NH3*m_NH3 ; # Max. amount of NH3 that can be produced\n", + "\n", + "# Results\n", + "print ' (a) Max. amount of NH3 that can be produced is %.1f g'%mx_NH3\n", + "\n", + "#(b) and (c)\n", + "if (ex_H2 > ex_N2 ):\n", + " print ' (b) N2 is limiting reactant '\n", + " print ' (c) H2 is excess reactant '\n", + " ex_r = ex_N2\n", + "else:\n", + " print ' (b) H2 is limiting reactant '\n", + " print ' (c) N2 is excess reactant '\n", + " ex_r = ex_H2 ;" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " (a) Max. amount of NH3 that can be produced is 12.2 g\n", + " (b) N2 is limiting reactant \n", + " (c) H2 is excess reactant \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 9.6 Page no. 242\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variables\n", + "#(a)\n", + "mol_bms = 0.59 ; # Biomass produced per g mol of glucose-[g mol biomass/ g mol glucose]\n", + "mw_bms = 23.74 ; # molecular wt. of biomass -[g]\n", + "mw_gls = 180.0 ; # molecular wt. of glucose -[g]\n", + "\n", + "# calculations and Results\n", + "ms_bms = (mol_bms*mw_bms)/mw_gls ; # Biomass produced per gram of glucose-[g biomass/ g glucose]\n", + "print '(a) Biomass produced per gram of glucose is %.4f g biomass/ g glucose.'%ms_bms\n", + "\n", + "#(b)\n", + "mol_etol = 1.3 ; #Ethanol produced per g mol of glucose-[g mol ethanol/ g mol glucose]\n", + "mw_etol = 46.0 ; # molecular wt. of ethanol -[g]\n", + "ms_etol = (mol_etol*mw_etol)/mw_gls ; # Ethanol produced per gram of glucose-[g ethanol/ g glucose]\n", + "print ' (b) Ethanol produced per gram of glucose is %.3f g ethanol/ g glucose.'%ms_etol" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a) Biomass produced per gram of glucose is 0.0778 g biomass/ g glucose.\n", + " (b) Ethanol produced per gram of glucose is 0.332 g ethanol/ g glucose.\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 9.7 Page no. 243\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "# By using reaction (a)\n", + "H2_a = 3-0.50 # H2 produced in reaction (a)\n", + "\n", + "# Calculations\n", + "C_a = (2./3)*H2_a ; # Nanotubes(the C) produced by reaction (a)\n", + "sel = C_a/0.50 ; # Selectivity of C reletive to C2H4-[g mol C/ g mol C2H4]\n", + "\n", + "# Results\n", + "print 'Selectivity of C reletive to C2H4 is %.2f g mol C/ g mol C2H4.'%sel" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Selectivity of C reletive to C2H4 is 3.33 g mol C/ g mol C2H4.\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 9.8 Page no. 244\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "m_C3H6 = 42.08 # molecular wt. of propene-[g]\n", + "m_C3H5Cl = 76.53 ; # molecular wt. of C3H5Cl-[g]\n", + "m_C3H6Cl2 = 112.99 ; # molecular wt. of C3H6Cl2-[g]\n", + "\n", + "# Product analysis\n", + "pml_Cl2 = 141.0 ; # [g mol]\n", + "pml_C3H6 = 651.0 ; #[g mol]\n", + "pml_C3H5Cl = 4.6 ; # [g mol]\n", + "pml_C3H6Cl2 = 24.5 ; # [g mol]\n", + "pml_HCL = 4.6 ; #[g mol]\n", + "\n", + "# Calculation & Results\n", + "#(a)\n", + "a_Cl = pml_C3H5Cl; # Chlorine reacted by eqn.(a)\n", + "b_Cl = pml_C3H6Cl2 ; # Chlorine reacted by eqn.(b)\n", + "fed_Cl = pml_Cl2+a_Cl+b_Cl ; # Total chlorine fed to reactor-[g mol]\n", + "\n", + "#by analysing reaction (a) and (b)\n", + "a_C3H6 = a_Cl+b_Cl ; # C3H6 reacted by reaction (a)\n", + "fed_C3H6 = pml_C3H6+a_C3H6 ; #Total C3H6 fed to reactor-[g mol]\n", + "\n", + "\n", + "print '(a) Total chlorine fed to reactor is %.2f g mol '%fed_Cl\n", + "print ' Total C3H6 fed to reactor is %.2f g mol '%fed_C3H6\n", + "\n", + "#(b) and (c)\n", + "# Extent of reaction can be calculated by using eqn. 9.3 \n", + "# Based on C3H6\n", + "nio_C3H6 = fed_C3H6 ; #[g mol C3H6]\n", + "vi_C3H6 = -1 ; # coefficint of C3H6\n", + "ex_C3H6 = -(nio_C3H6)/vi_C3H6 ; # Max. extent of reaction based on C3H6\n", + "\n", + "# Based on Cl2\n", + "nio_Cl2 = fed_Cl; #[g mol Cl2]\n", + "vi_Cl2 = -1 ; # coefficint of Cl2\n", + "ex_Cl2 = -(nio_Cl2)/vi_Cl2 ;# Max. extent of reaction based on Cl2\n", + "\n", + "if (ex_Cl2 > ex_C3H6 ):\n", + " print ' (b) C3H6 is limiting reactant '\n", + " print ' (c)Cl2 is excess reactant '\n", + " ex_r = ex_C3H6;\n", + "else:\n", + " print ' (b) Cl2 is limiting reactant '\n", + " print ' (c) C3H6 is excess reactant '\n", + " ex_r = ex_Cl2;\n", + "\n", + "#(d)\n", + "fr_cn = pml_C3H5Cl/fed_C3H6 ; #Fractional conversion of C3H6 to C3H5Cl\n", + "print ' (d) Fractional conversion of C3H6 to C3H5Cl is %.2e '%fr_cn\n", + "\n", + "#(e)\n", + "sel = pml_C3H5Cl/pml_C3H6Cl2 ; # Selectivity of C3H5Cl relative to C3H6Cl2\n", + "print ' (e) Selectivity of C3H5Cl relative to C3H6Cl2 is %.2f g mol C3H5Cl/g mol C3H6Cl2 '%sel\n", + "\n", + "#(f)\n", + "yld = (m_C3H5Cl*pml_C3H5Cl)/(m_C3H6*fed_C3H6) # Yield of C3H5Cl per g C3H6 fed to reactor\n", + "print ' (f) Yield of C3H5Cl per g C3H6 fed to reactor is %.3f g C3H5Cl/g C3H6 '%yld\n", + "\n", + "#(g)\n", + "vi_C3H5Cl = 1 ; # coefficint of C3H5Cl\n", + "vi_C3H6Cl2 = 1 ; # coefficint of C3H6Cl2\n", + "ex_a = (pml_C3H5Cl-0)/vi_C3H5Cl ; # Extent of reaction a as C3H5Cl is produced only in reaction a\n", + "ex_b = (pml_C3H6Cl2-0)/vi_C3H6Cl2 ; # Extent of reaction b as C3H6Cl2 is produced only in reaction b\n", + "print ' (g) Extent of reaction a as C3H5Cl is produced only in reaction a is %.1f '%ex_a\n", + "print ' Extent of reaction b as C3H6Cl2 is produced only in reaction b %.1f '%ex_b\n", + "\n", + "#(h)\n", + "in_Cl = fed_Cl*2 ; #Entering Cl -[g mol]\n", + "out_Cl = pml_HCL ; # Exiting Cl in HCl-[g mol]\n", + "ef_w = out_Cl/in_Cl ; # Mole efficiency of waste\n", + "ef_pr = 1-ef_w ; # Mole efficiency of product\n", + "print ' (h) Mole efficiency of product is %.3f '%ef_pr" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a) Total chlorine fed to reactor is 170.10 g mol \n", + " Total C3H6 fed to reactor is 680.10 g mol \n", + " (b) Cl2 is limiting reactant \n", + " (c) C3H6 is excess reactant \n", + " (d) Fractional conversion of C3H6 to C3H5Cl is 6.76e-03 \n", + " (e) Selectivity of C3H5Cl relative to C3H6Cl2 is 0.19 g mol C3H5Cl/g mol C3H6Cl2 \n", + " (f) Yield of C3H5Cl per g C3H6 fed to reactor is 0.012 g C3H5Cl/g C3H6 \n", + " (g) Extent of reaction a as C3H5Cl is produced only in reaction a is 4.6 \n", + " Extent of reaction b as C3H6Cl2 is produced only in reaction b 24.5 \n", + " (h) Mole efficiency of product is 0.986 \n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "code", + "collapsed": true, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter1-checkpoint.ipynb b/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter1-checkpoint.ipynb new file mode 100644 index 00000000..a59448aa --- /dev/null +++ b/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter1-checkpoint.ipynb @@ -0,0 +1,247 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:8e3cf2addd66f79ee38d4e50bfee328191c27b60f9cde7a75aa445057c2c6240" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 1: Programming in C" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 1.1, page no. 6" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "print \"Hello world!\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello world!\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 1.2, page no. 7" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"\\\"If at first you don't succeed, try, try, try again!\\\"\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\"If at first you don't succeed, try, try, try again!\"\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 1.3, page no. 8" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Beware the Ides of March!\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Beware the Ides of March!\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "program 1.4, page no. 14" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"My formula for success?\\nRise early, work late, strike oil.\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "My formula for success?\n", + "Rise early, work late, strike oil.\n", + "\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + " Program 1.5, page no. 14" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"\\\"It is a wise father that knows his own child.\\\"\\nShakespeare\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\"It is a wise father that knows his own child.\"\n", + "Shakespeare\n", + "\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 1.6, page no. 15" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Be careful!!\\n \\a\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Be careful!!\n", + " \u0007\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 1.7, page no. 20" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Hi there!\\nThis program is a bit longer than the others.\"\n", + "print \"But really it's only more text.\\n\\a\\a\"\n", + "print \"Hey, wait a minute!! What was that???\\n\"\n", + "print \"\\t1.\\tA bird?\"\n", + "print \"\\t2.\\tA plane?\"\n", + "print \"\\t3.\\tA control character?\"\n", + "print \"\\t\\t\\b\\bAnd how will this look when it print's out?\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hi there!\n", + "This program is a bit longer than the others.\n", + "But really it's only more text.\n", + "\u0007\u0007\n", + "Hey, wait a minute!! What was that???\n", + "\n", + "\t1.\tA bird?\n", + "\t2.\tA plane?\n", + "\t3.\tA control character?\n", + "\t\t\b\bAnd how will this look when it print's out?\n" + ] + } + ], + "prompt_number": 7 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter10-checkpoint.ipynb b/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter10-checkpoint.ipynb new file mode 100644 index 00000000..89cc83ed --- /dev/null +++ b/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter10-checkpoint.ipynb @@ -0,0 +1,821 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:67a316ecc3def0c634c382410d442033098ecf91839327bce17c0f2bf4424e27" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 10: Essential Input and Output" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 10.1, page no. 400 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import sys\n", + "\n", + "def try_input(prompt, format):\n", + " value_count = 5\n", + " print prompt\n", + " fp1 = float(raw_input(\"fp1: \"))\n", + " i = int(raw_input(\"i: \"))\n", + " j = int(raw_input(\"j: \"))\n", + " word1 = raw_input()\n", + " size_word1 = sys.getsizeof(word1)\n", + " word2 = raw_input()\n", + " size_word2 = sys.getsizeof(word2)\n", + " print \"The input format string for scanf_s() is: \\\"%s\\\"\" %format\n", + " print \"Count of bytes read = \", (size_word1 + size_word2)\n", + " print \"Count of values read = %d\" % value_count\n", + " print \"fp1 = %f i = %d j = %d\" %(fp1, i, j)\n", + " print \"word1 = %s word2 = %s\" %(word1, word2)\n", + " \n", + "try_input(\"Enter as input: -2.35 15 25 ready2go \", \"%f %d %d %[abcdefghijklmnopqrstuvwxyz] %*1d %s%n\" )\n", + "try_input(\"Enter the same input again: \", \"%4f %4d %d %*d %[abcdefghijklmnopqrstuvwxyz] %*1d %[^o]%n\")\n", + "try_input(\"Enter as input: -2.3 15 25 ready2go\\n\",\"%4f %4d %d %*d %[abcdefghijklmnopqrstuvwxyz] %*1d %[^o]%n\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter as input: -2.35 15 25 ready2go \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "fp1: -2.35\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "i: 15\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "j: 25\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "ready2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "go\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The input format string for scanf_s() is: \"%f %d %d %[abcdefghijklmnopqrstuvwxyz] %*1d %s%n\"\n", + "Count of bytes read = 82\n", + "Count of values read = 5\n", + "fp1 = -2.350000 i = 15 j = 25\n", + "word1 = ready2 word2 = go\n", + "Enter the same input again: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "fp1: -2.35\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "i: 15\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "j: 25\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "ready 2go\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2go\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The input format string for scanf_s() is: \"%4f %4d %d %*d %[abcdefghijklmnopqrstuvwxyz] %*1d %[^o]%n\"\n", + "Count of bytes read = 86\n", + "Count of values read = 5\n", + "fp1 = -2.350000 i = 15 j = 25\n", + "word1 = ready 2go word2 = 2go\n", + "Enter as input: -2.3 15 25 ready2go\n", + "\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "fp1: -2.35\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "i: 15\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "j: 225\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "ready2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "go\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The input format string for scanf_s() is: \"%4f %4d %d %*d %[abcdefghijklmnopqrstuvwxyz] %*1d %[^o]%n\"\n", + "Count of bytes read = 82\n", + "Count of values read = 5\n", + "fp1 = -2.350000 i = 15 j = 225\n", + "word1 = ready2 word2 = go\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 10.2, page no. 403" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "value_count = 2\n", + "print \"Enter: fp1 = 3.14159 i = 7 j = 8\"\n", + "print \"Input: \"\n", + "fp1 = float(raw_input(\"fp1: \"))\n", + "i = int(raw_input(\"i: \"))\n", + "j = int(raw_input(\"j: \"))\n", + "\n", + "print \"Output:\"\n", + "print \"Count of values read = \", value_count\n", + "print \"fp1 = %f\\ti = %d\\tj = %d \" %(fp1, i, j)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter: fp1 = 3.14159 i = 7 j = 8\n", + "Input: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "fp1: 3.13159\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "i: 7\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "j: 8\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Output:\n", + "Count of values read = 2\n", + "fp1 = 3.131590\ti = 7\tj = 8 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 10.3, page no. 405" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "value_count = 3\n", + "print \"Enter: 3.14 3.14 3.14\"\n", + " \n", + "print \"Input: \"\n", + "\n", + "fp1 = float(raw_input(\"fp1: \"))\n", + "fp2 = float(raw_input(\"fp2: \"))\n", + "fp3 = float(raw_input(\"fp3: \"))\n", + "\n", + "print \"Output: \"\n", + "print \"Number of values read = \", value_count\n", + "print \"fp1 = %f fp2 = %f fp3 = %f\" %(fp1, fp2, fp3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter: 3.14 3.14 3.14\n", + "Input: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "fp1: 3.14\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "fp2: 3.14\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "fp3: 3.14\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Output: \n", + "Number of values read = 3\n", + "fp1 = 3.140000 fp2 = 3.140000 fp3 = 3.140000\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 10.4, page no. 406" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter three integer values: \"\n", + "n = 3\n", + "i = int(raw_input())\n", + "j = int(raw_input(), 16)\n", + "k = int(raw_input(), 8)\n", + " \n", + "print \"Output:\"\n", + "print \"%d values read.\" % n\n", + "print \"i = %d j = %d k = %d \" %(i, j, k )" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter three integer values: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Output:\n", + "3 values read.\n", + "i = 5 j = 8 k = 6 \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 10.5, page no. 408" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter your first initial: \",\n", + "initial = raw_input()\n", + "print \"Enter your first name: \",\n", + "name = raw_input()\n", + "\n", + "if(initial != name[0]):\n", + " print \"%s, you got your initial wrong. \" % name\n", + "else:\n", + " print \"Hi, %s. Your initial is correct. Well done! \" %name \n", + " print \"Enter your full name and your age separated by a comma: \", \n", + " name_age = raw_input()\n", + " print \"Your name is %s and you are %s years old.\" %(name_age.split(',')[0], name_age.split(',')[1])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your first initial: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "M\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter your first name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Michael\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Hi, Michael. Your initial is correct. Well done! \n", + "Enter your full name and your age separated by a comma: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Michael, 35\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Your name is Michael and you are 35 years old.\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + " Program 10.6, page no. 410" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter your first initial: \",\n", + "initial = raw_input()\n", + "print \"Enter your first name: \",\n", + "name = raw_input()\n", + "\n", + "if(initial != name[0]):\n", + " print \"%s, you got your initial wrong. \" % name\n", + "else:\n", + " print \"Hi, %s. Your initial is correct. Well done! \" %name \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your first initial: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "M\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter your first name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Nichael\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Nichael, you got your initial wrong. \n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 10.7, page no. 412" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter a sequence of integers and alphabetic names in a single line(separated by spaces): \",\n", + "text = raw_input()\n", + "split_text = text.split(' ')\n", + "for element in split_text:\n", + " if element.isdigit():\n", + " print \"Integer Value: \", element\n", + " elif element.isalpha():\n", + " print \"Name: \", element\n", + " else:\n", + " pass " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a sequence of integers and alphabetic names in a single line(separated by spaces): " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Fred 22 34 Mary Jack 89 Jane\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Name: Fred\n", + "Integer Value: 22\n", + "Integer Value: 34\n", + "Name: Mary\n", + "Name: Jack\n", + "Integer Value: 89\n", + "Name: Jane\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 10.8, page no. 419" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "i = 15\n", + "j = 345\n", + "k = 4567\n", + "li = 56789\n", + "lj = 67891234567\n", + "lk = 23456789\n", + "\n", + "print \"i = %d j = %d k = %d li = %6.3d lj = %6.3d lk = %6.3d\" %(i ,j, k, i, j, k)\n", + "print \"i = %-d j = %+d k = %-d i = %-6.3d j = %-6.3d k = %-6.3d \" %(i ,j, k, i, j, k)\n", + "print \"li = %d lj = %d lk = %d \" %(li, lj, lk)\n", + "print \"li = %d lj = %d lk = %d \" %(li, lj, lk)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "i = 15 j = 345 k = 4567 li = 015 lj = 345 lk = 4567\n", + "i = 15 j = +345 k = 4567 i = 015 j = 345 k = 4567 \n", + "li = 56789 lj = 67891234567 lk = 23456789 \n", + "li = 56789 lj = 67891234567 lk = 23456789 \n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 10.9, page no. 421" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "k = \"678\"\n", + "hex_k = int(k, 16)\n", + "oct_k = int(oct(int(k)))\n", + "k = 678\n", + "print \"%%d %%o %%x %%X \"\n", + "print \"%d %d %d %d \" %(k, oct_k, hex_k, hex_k)\n", + "print \"|%%8d \\t|%%-8d \\t|%%+8d \\t|%%08d \\t|%%-+8d\"\n", + "print \"|%8d |%-8d |%+8d |%08d |%-+8d |\" %(k, k, k, k, k)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "%%d %%o %%x %%X \n", + "678 1246 1656 1656 \n", + "|%%8d \t|%%-8d \t|%%+8d \t|%%08d \t|%%-+8d\n", + "| 678 |678 | +678 |00000678 |+678 |\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 10.10, page no. 422" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "fp1 = 345.678\n", + "fp2 = 1.234E6\n", + "fp3 = 234567898.0\n", + "fp4 = 11.22334455e-6\n", + " \n", + "print \"%f %+f %-10.4f %6.4f\" %(fp1, fp2, fp1, fp2)\n", + "print \"%e %+E\\n\" %(fp1, fp2)\n", + "print \"%f %g %#+f %8.4f %10.4g \" %(fp3,fp3, fp3, fp3, fp4)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "345.678000 +1234000.000000 345.6780 1234000.0000\n", + "3.456780e+02 +1.234000E+06\n", + "\n", + "234567898.000000 2.34568e+08 +234567898.000000 234567898.0000 1.122e-05 \n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 10.11, page no. 423" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import string\n", + "\n", + "count = 0\n", + "print \"The printable characters are the following: \"\n", + "printable = string.printable\n", + "for char in printable:\n", + " if count % 32 == 0:\n", + " print \"\"\n", + " print char,\n", + " count += 1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The printable characters are the following: \n", + "\n", + "0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v \n", + "w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ! \" \n", + "# $ % & ' ( ) * + , - . / : ; < = > ? @ [ \\ ] ^ _ ` { | } ~ \t\n", + "\n", + "\r", + "\u000b", + "\f" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter11-checkpoint.ipynb b/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter11-checkpoint.ipynb new file mode 100644 index 00000000..8bed3984 --- /dev/null +++ b/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter11-checkpoint.ipynb @@ -0,0 +1,2097 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:f5ae274b34f8832ebb766131ce16691aa9f05236c3dacd19d82ce9c6b22fe7d8" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 11: Structuring Data" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 11.1, page no. 403" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Horse:\n", + " age = 0\n", + " height = 0\n", + " name = \"\"\n", + " father = \"\"\n", + " mother = \"\"\n", + "\n", + "my_horse = Horse()\n", + "print \"Enter the name of the horse: \",\n", + "my_horse.name = raw_input()\n", + " \n", + "print \"How old is %s? \" % my_horse.name,\n", + "my_horse.age = int(raw_input())\n", + " \n", + "print \"How high is %s ( in hands )? \" %my_horse.name,\n", + "my_horse.height = int(raw_input())\n", + " \n", + "print \"Who is %s's father? \" %my_horse.name,\n", + "my_horse.father = raw_input()\n", + " \n", + "print \"Who is %s's mother? \" %my_horse.name,\n", + "my_horse.mother = raw_input()\n", + " \n", + "print \"%s is %d years old, %d hands high, \" %(my_horse.name, my_horse.age, my_horse.height),\n", + "print \"and has %s and %s as parents. \" %(my_horse.father, my_horse.mother)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the name of the horse: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Neddy\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " How old is Neddy? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "12\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " How high is Neddy ( in hands )? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "14\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Who is Neddy's father? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Bertie\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Who is Neddy's mother? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Nellie\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Neddy is 12 years old, 14 hands high, and has Bertie and Nellie as parents. \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 11.2, page no. 436" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Horse:\n", + " age = 0\n", + " height = 0\n", + " name = \"\"\n", + " father = \"\"\n", + " mother = \"\"\n", + " \n", + "my_horses = []\n", + "test = ''\n", + "hcount = 0\n", + "\n", + "while(True):\n", + " print \"Do you want to enter details of a horse (Y or N)? \"\n", + " choice = raw_input()\n", + " if(choice.lower() == 'n'):\n", + " break\n", + " my_horse = Horse()\n", + " print \"Enter the name of the horse: \",\n", + " my_horse.name = raw_input()\n", + " print \"How old is %s? \" % my_horse.name,\n", + " my_horse.age = int(raw_input())\n", + " print \"How high is %s ( in hands )? \" %my_horse.name,\n", + " my_horse.height = int(raw_input())\n", + " print \"Who is %s's father? \" %my_horse.name,\n", + " my_horse.father = raw_input()\n", + " print \"Who is %s's mother? \" %my_horse.name,\n", + " my_horse.mother = raw_input()\n", + " my_horses.append(my_horse)\n", + " hcount += 1\n", + "\n", + "for i in range(hcount):\n", + " print \"%s is %d years old, %d hands high, \" %(my_horses[i].name, my_horses[i].age, my_horses[i].height),\n", + " print \"and has %s and %s as parents. \" %(my_horses[i].father, my_horses[i].mother)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Do you want to enter details of a horse (Y or N)? \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the name of the horse: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Neddy\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " How old is Neddy? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "12\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " How high is Neddy ( in hands )? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "14\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Who is Neddy's father? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Bertie\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Who is Neddy's mother? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Nellie\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Do you want to enter details of a horse (Y or N)? \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the name of the horse: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Stallion\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " How old is Stallion? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " How high is Stallion ( in hands )? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "15\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Who is Stallion's father? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Father Stallion\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Who is Stallion's mother? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mother Stallion\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Do you want to enter details of a horse (Y or N)? \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "n\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Neddy is 12 years old, 14 hands high, and has Bertie and Nellie as parents. \n", + "Stallion is 10 years old, 15 hands high, and has Father Stallion and Mother Stallion as parents. \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 11.3, page no. 440" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Horse:\n", + " age = 0\n", + " height = 0\n", + " name = \"\"\n", + " father = \"\"\n", + " mother = \"\"\n", + " \n", + "my_horses = []\n", + "test = ''\n", + "hcount = 0\n", + "\n", + "while(True):\n", + " print \"Do you want to enter details of a horse (Y or N)? \"\n", + " choice = raw_input()\n", + " if(choice.lower() == 'n'):\n", + " break\n", + " my_horse = Horse()\n", + " print \"Enter the name of the horse: \",\n", + " my_horse.name = raw_input()\n", + " print \"How old is %s? \" % my_horse.name,\n", + " my_horse.age = int(raw_input())\n", + " print \"How high is %s ( in hands )? \" %my_horse.name,\n", + " my_horse.height = int(raw_input())\n", + " print \"Who is %s's father? \" %my_horse.name,\n", + " my_horse.father = raw_input()\n", + " print \"Who is %s's mother? \" %my_horse.name,\n", + " my_horse.mother = raw_input()\n", + " my_horses.append(my_horse)\n", + " hcount += 1\n", + "\n", + "ptr_my_horses = my_horses\n", + "\n", + "for i in range(hcount):\n", + " print \"%s is %d years old, %d hands high, \" %(ptr_my_horses[i].name, ptr_my_horses[i].age, ptr_my_horses[i].height),\n", + " print \"and has %s and %s as parents. \" %(ptr_my_horses[i].father, ptr_my_horses[i].mother)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Do you want to enter details of a horse (Y or N)? \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the name of the horse: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Neddy\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " How old is Neddy? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "12\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " How high is Neddy ( in hands )? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "14\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Who is Neddy's father? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Bertie\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Who is Neddy's mother? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Nellie\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Do you want to enter details of a horse (Y or N)? \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "n\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Neddy is 12 years old, 14 hands high, and has Bertie and Nellie as parents. \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 11.4, page no. 445" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Horse:\n", + " age = 0\n", + " height = 0\n", + " name = \"\"\n", + " father = \"\"\n", + " mother = \"\"\n", + " next = None\n", + " prev = None\n", + "\n", + "first = None\n", + "previous = None\n", + "\n", + "while(True):\n", + " print \"Do you want to enter details of a horse (Y or N)? \",\n", + " choice = raw_input()\n", + " if(choice.lower() == 'n'):\n", + " break\n", + " current = Horse()\n", + " if(first == None):\n", + " first = current\n", + " if(previous != None):\n", + " previous.next = current\n", + " print \"Enter the name of the horse: \",\n", + " current.name = raw_input()\n", + " print \"How old is %s? \" %current.name,\n", + " current.age = int(raw_input())\n", + " print \"How high is %s ( in hands )? \" %(current.name),\n", + " current.height = int(raw_input())\n", + " print \"Who is %s's father? \" %current.name,\n", + " current.father = raw_input()\n", + " print \"Who is %s's mother? \" %current.name,\n", + " current.mother = raw_input()\n", + " current.next = None\n", + " previous = current\n", + "\n", + "current = first\n", + "while (current != None):\n", + " print \"%s is %d years old, %d hands high,\" %(current.name, current.age, current.height),\n", + " print \"and has %s and %s as parents.\" %(current.father, current.mother)\n", + " previous = current\n", + " current = current.next\n", + " previous = None\n", + " first = None" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Do you want to enter details of a horse (Y or N)? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the name of the horse: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Neddy\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " How old is Neddy? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "12\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " How high is Neddy ( in hands )? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "14\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Who is Neddy's father? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Brtie\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Who is Neddy's mother? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Nellie\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Do you want to enter details of a horse (Y or N)? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "n\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Neddy is 12 years old, 14 hands high, and has Brtie and Nellie as parents.\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 11.5, page no. 450" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "first = None\n", + "current = None\n", + "last = None\n", + "\n", + "class Horse:\n", + " age = 0\n", + " height = 0\n", + " name = \"\"\n", + " father = \"\"\n", + " mother = \"\"\n", + " next = None\n", + " prev = None\n", + "\n", + "\n", + "while(True):\n", + " print \"Do you want to enter details of a horse (Y or N)? \",\n", + " choice = raw_input()\n", + " if(choice.lower() == 'n'):\n", + " break \n", + "\n", + " current = Horse()\n", + " if(first == None):\n", + " first = current\n", + " last = current\n", + " else:\n", + " last.next = current\n", + " current.previous = last\n", + " last = current\n", + " print \"Enter the name of the horse: \",\n", + " current.name = raw_input()\n", + " print \"How old is %s? \" %current.name,\n", + " current.age = int(raw_input())\n", + " print \"How high is %s ( in hands )? \" %(current.name),\n", + " current.height = int(raw_input())\n", + " print \"Who is %s's father? \" %current.name,\n", + " current.father = raw_input()\n", + " print \"Who is %s's mother? \" %current.name,\n", + " current.mother = raw_input()\n", + "\n", + "current = first\n", + "while(current):\n", + " print \"%s is %d years old, %d hands h1igh,\" %(current.name, current.age, current.height),\n", + " print \"and has %s and %s as parents.\" %(current.father, current.mother)\n", + " current = current.next" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Do you want to enter details of a horse (Y or N)? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the name of the horse: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "neddy\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " How old is neddy? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "13\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " How high is neddy ( in hands )? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "14\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Who is neddy's father? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "bertie\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Who is neddy's mother? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "nellie\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Do you want to enter details of a horse (Y or N)? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the name of the horse: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "stallion\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " How old is stallion? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "14\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " How high is stallion ( in hands )? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "18\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Who is stallion's father? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "father stallio\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Who is stallion's mother? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "mother stallion\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Do you want to enter details of a horse (Y or N)? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "n\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " neddy is 13 years old, 14 hands h1igh, and has bertie and nellie as parents.\n", + "stallion is 14 years old, 18 hands h1igh, and has father stallio and mother stallion as parents.\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 11.6, page no. 456" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Date:\n", + " day = 0\n", + " month = 0\n", + " year = 0\n", + " \n", + "class Family:\n", + " dob = Date()\n", + " name = \"\"\n", + " father = \"\"\n", + " mother = \"\"\n", + " next = None\n", + " previous = None\n", + " \n", + "def get_person():\n", + " temp = Family()\n", + " print \"Enter the name of the person: \",\n", + " temp.name = raw_input()\n", + " print \"Enter %s's date of birth (day month year) \" %temp.name,\n", + " temp.dob.day = int(raw_input(\"Day: \"))\n", + " temp.dob.month = int(raw_input(\"Month: \"))\n", + " temp.dob.year = int(raw_input(\"Year: \"))\n", + " print \"Who is %s's father? \" %temp.name\n", + " temp.father = raw_input()\n", + " print \"Who is %s's mother? \" %temp.name\n", + " temp.mother = raw_input()\n", + " temp.next = None\n", + " temp.previous = None\n", + " return temp\n", + " \n", + "def show_people(pfirst):\n", + " current = pfirst\n", + " while(current):\n", + " print \"%s was born %d/%d/%d and has %s and %s as parents. \" %(current.name, current.dob.day, current.dob.month, current.dob.year, current.father, current.mother)\n", + " current = current.next\n", + "\n", + "first = None\n", + "current = None\n", + "last = None\n", + " \n", + "while(True):\n", + " print \"Do you want to enter details of a person (Y or N)? \",\n", + " choice = raw_input()\n", + " if(choice.lower() == 'n'):\n", + " break\n", + " current = get_person()\n", + " if(first == None):\n", + " first = current\n", + " current.previous = None\n", + " last = current\n", + " else:\n", + " last.next = current\n", + " current.previous = last\n", + " last = current\n", + "show_people(first)\n", + "first = None\n", + "last = None" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Do you want to enter details of a person (Y or N)? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the name of the person: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Ricky\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter Ricky's date of birth (day month year) " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Day: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Month: 6\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Year: 1970\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Who is Ricky's father? \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Michael\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Who is Ricky's mother? \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Rachel\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Do you want to enter details of a person (Y or N)? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the name of the person: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mitchel\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter Mitchel's date of birth (day month year) " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Day: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Month: 9\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Year: 1967\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Who is Mitchel's father? \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Martin\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Who is Mitchel's mother? \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hingies\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Do you want to enter details of a person (Y or N)? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "n\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Ricky was born 5/9/1967 and has Michael and Rachel as parents. \n", + "Mitchel was born 5/9/1967 and has Martin and Hingies as parents. \n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 11.7, page no. 466" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Node:\n", + " item = 0.0\n", + " count = 0\n", + " pLeft = None\n", + " pRight = None\n", + " \n", + "def create_node(value):\n", + " pNode = Node()\n", + " pNode.item = value\n", + " pNode.count = 1\n", + " return pNode\n", + "\n", + "def add_node(value, pNode):\n", + " if(pNode is None):\n", + " return create_node(value)\n", + " if(value == pNode.item):\n", + " pNode.count += 1\n", + " return pNode\n", + " if(value < pNode.item):\n", + " if(pNode.pLeft is None):\n", + " pNode.pLeft = create_node(value);\n", + " return pNode.pLeft\n", + " else:\n", + " return add_node(value, pNode.pLeft)\n", + " else:\n", + " if(pNode.pRight is None):\n", + " pNode. pRight = create_node(value)\n", + " return pNode.pRight\n", + " else:\n", + " return add_node(value, pNode.pRight)\n", + "\n", + "\n", + "def list_nodes(pNode):\n", + " if(pNode.pLeft):\n", + " list_nodes(pNode.pLeft)\n", + " print \"%10d x %10ld\" %(pNode.count, pNode.item)\n", + " if(pNode.pRight):\n", + " list_nodes(pNode.pRight)\n", + "\n", + "\n", + "pRoot = None\n", + "answer = 'n'\n", + "while(True):\n", + " print \"Enter the node value: \",\n", + " newvalue = float(raw_input())\n", + " if(pRoot is None):\n", + " pRoot = create_node(newvalue)\n", + " else:\n", + " add_node(newvalue, pRoot)\n", + " print \"Do you want to enter another (y or n)? \",\n", + " answer = raw_input()\n", + " if answer == \"n\":\n", + " break\n", + "print \"The values in ascending sequence are: \"\n", + "list_nodes(pRoot)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the node value: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "56\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Do you want to enter another (y or n)? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the node value: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "33\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Do you want to enter another (y or n)? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the node value: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "77\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Do you want to enter another (y or n)? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the node value: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "-10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Do you want to enter another (y or n)? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the node value: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "200\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Do you want to enter another (y or n)? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the node value: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "-10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Do you want to enter another (y or n)? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the node value: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "-5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Do you want to enter another (y or n)? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "n\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The values in ascending sequence are: \n", + " 2 x -10\n", + " 1 x -5\n", + " 1 x 33\n", + " 1 x 56\n", + " 1 x 77\n", + " 1 x 200\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 11.8, page no. 470" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def print_date(date):\n", + " if date.format == 0:\n", + " print \"The date is %d/%d/%d.\" %(date.date.nDate.day, date.date.nDate.month, date.date.nDate.year)\n", + " elif date.format == 1:\n", + " print \"The date is %s. \" %date.date.date_str\n", + " elif date.format == 2:\n", + " print \"The date is %s %s %d. \" %(date.date.day_date.day, date.date.day_date.date, date.date.day_date.year)\n", + " else:\n", + " print \"Invalid date format.\"\n", + "\n", + "class Date_Format:\n", + " numeric = 0\n", + " text = 1\n", + " mixed = 2\n", + "\n", + "class MixedDate:\n", + " def __init__(self, d=\"\", dt=\"\", yr=0):\n", + " self.day = d\n", + " self.date = dt\n", + " self.year = yr\n", + "\n", + "class NumericDate:\n", + " def __init__(self, d=0, mnt=0, yr=0):\n", + " self.day = d\n", + " self.month = mnt\n", + " self.year = yr\n", + "\n", + "class UDate:\n", + " date_str = \"\"\n", + " day_date = MixedDate()\n", + " nDate = NumericDate()\n", + "\n", + "class Date:\n", + " format = Date_Format()\n", + " date = UDate()\n", + "\n", + "form = Date_Format()\n", + "yesterday = NumericDate(11, 11, 2012)\n", + "today = MixedDate(\"Monday\", \"12th November\", 2012)\n", + "tomorrow = UDate()\n", + "tomorrow.date_str = \"Tues 13th Nov 2012\"\n", + "\n", + "udate = tomorrow\n", + "the_date = Date()\n", + "the_date.date = udate\n", + "the_date.format = form.text\n", + "print_date(the_date)\n", + "\n", + "the_date.date.nDate = yesterday\n", + "the_date.format = form.numeric\n", + "print_date(the_date)\n", + " \n", + "the_date.date.day_date = today\n", + "the_date.format = form.mixed\n", + "print_date(the_date)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The date is Tues 13th Nov 2012. \n", + "The date is 11/11/2012.\n", + "The date is Monday 12th November 2012. \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 11.9, page no. 482" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import numpy\n", + "import sys\n", + "\n", + "\n", + "PAGE_HEIGHT = 41\n", + "PAGE_WIDTH = 75\n", + " \n", + "class Bar:\n", + " value = 0\n", + " pNext = None\n", + " \n", + "def create_bar_list():\n", + " pFirst = None\n", + " pBar = None\n", + " pCurrent = None\n", + " pBar = new_bar()\n", + " while(pBar != None):\n", + " if(pCurrent):\n", + " pCurrent.pNext = pBar\n", + " pCurrent = pBar\n", + " else:\n", + " pFirst = pCurrent = pBar\n", + " #pCurrent = pBar\n", + " pBar = new_bar()\n", + " return pFirst\n", + " \n", + "def new_bar():\n", + " print \"Enter the value of the Bar, or Enter quit to end: \",\n", + " value = raw_input()\n", + " if(value == \"quit\"):\n", + " return None\n", + " pBar = Bar()\n", + " if(pBar is None):\n", + " print \"Oops! Couldn't allocate memory for a bar.\"\n", + " sys.exit()\n", + " pBar.value = float(value)\n", + " pBar.pNext = None\n", + " return pBar\n", + "\n", + "def bar_chart(pFirst, page_width, page_height, title):\n", + " pLast = pFirst;\n", + " max = pFirst.value\n", + " min = pFirst.value\n", + " vert_step = 0.0\n", + " bar_count = 1\n", + " bar_width = 0\n", + " space = 2\n", + " column = None\n", + " blank = None\n", + " position = 0.0\n", + " axis = False\n", + " while(pLast.pNext):\n", + " bar_count += 1\n", + " max = pLast.value if (max < pLast.value) else max\n", + " min = pLast.value if (min > pLast.value) else min\n", + " pLast = pLast.pNext\n", + " if(max < 0.0):\n", + " max = 0.0\n", + " if(min > 0.0):\n", + " min = 0.0\n", + " vert_step = (max - min)/page_height\n", + " bar_width = page_width/bar_count - space\n", + " if(bar_width < 1):\n", + " print \"Page width too narrow. \"\n", + " sys.exit()\n", + " column = chart_string(space, bar_width, '#')\n", + " if(not (column)):\n", + " print \"Failed to allocate memory in bar_chart() - terminating program.\"\n", + " sys.exit()\n", + " blank = chart_string(space, bar_width, ' ')\n", + " if(not (blank)):\n", + " print \"Failed to allocate memory in bar_chart() - terminating program.\"\n", + " sys.exit(1)\n", + " print \"\\n^ %s \" %title\n", + " position = max\n", + " for i in range(page_height):\n", + " if(position <= 0.0 and not(axis)):\n", + " draw_x_axis(bar_count*(bar_width + space))\n", + " axis = True\n", + " print \"|\",\n", + " pLast = pFirst\n", + " for bars in range(1, bar_count+1):\n", + " print \"%s\" %(column if((position <= pLast.value and position > 0.0) or (position >= pLast.value and position <= 0.0)) else blank),\n", + " pLast = pLast.pNext\n", + " print \"\"\n", + " position -= vert_step\n", + " if(not axis):\n", + " draw_x_axis(bar_count*(bar_width + space))\n", + " else:\n", + " print \"v\\n\",\n", + "\n", + "\n", + "def chart_string(space, bar_width, ch):\n", + " mystr = []\n", + " for i in range(space+bar_width):\n", + " mystr.append(\"\")\n", + " for i in range(space):\n", + " mystr[i] =' '\n", + " for j in range(space,space+bar_width):\n", + " mystr[j] = ch\n", + " return ''.join(mystr)\n", + "\n", + "def draw_x_axis(length):\n", + " print \"+\",\n", + " for x in range(length):\n", + " print \"-\",\n", + " print \">\"\n", + "\n", + "pFirst = None\n", + "print \"Enter the chart title: \",\n", + "title = raw_input()\n", + "pFirst = create_bar_list()\n", + "p = pFirst\n", + "while (p):\n", + " print p.value\n", + " p = p.pNext\n", + "bar_chart(pFirst, PAGE_WIDTH, PAGE_HEIGHT, title)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the chart title: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Average Temperatures\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the value of the Bar, or Enter quit to end: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "-12\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the value of the Bar, or Enter quit to end: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "-15\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the value of the Bar, or Enter quit to end: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the value of the Bar, or Enter quit to end: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the value of the Bar, or Enter quit to end: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "13\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the value of the Bar, or Enter quit to end: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "20\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the value of the Bar, or Enter quit to end: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "26\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the value of the Bar, or Enter quit to end: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "32\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the value of the Bar, or Enter quit to end: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "23\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the value of the Bar, or Enter quit to end: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "17\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the value of the Bar, or Enter quit to end: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "-1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the value of the Bar, or Enter quit to end: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "-4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the value of the Bar, or Enter quit to end: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "quit\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " -12.0\n", + "-15.0\n", + "2.0\n", + "5.0\n", + "13.0\n", + "20.0\n", + "26.0\n", + "32.0\n", + "23.0\n", + "17.0\n", + "-1.0\n", + "-4.0\n", + "\n", + "^ Average Temperatures \n", + "| #### \n", + "| #### \n", + "| #### \n", + "| #### \n", + "| #### \n", + "| #### \n", + "| #### #### \n", + "| #### #### \n", + "| #### #### #### \n", + "| #### #### #### \n", + "| #### #### #### \n", + "| #### #### #### #### \n", + "| #### #### #### #### \n", + "| #### #### #### #### \n", + "| #### #### #### #### #### \n", + "| #### #### #### #### #### \n", + "| #### #### #### #### #### \n", + "| #### #### #### #### #### #### \n", + "| #### #### #### #### #### #### \n", + "| #### #### #### #### #### #### \n", + "| #### #### #### #### #### #### \n", + "| #### #### #### #### #### #### \n", + "| #### #### #### #### #### #### \n", + "| #### #### #### #### #### #### \n", + "| #### #### #### #### #### #### #### \n", + "| #### #### #### #### #### #### #### \n", + "| #### #### #### #### #### #### #### \n", + "| #### #### #### #### #### #### #### #### \n", + "+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >\n", + "| #### #### #### #### \n", + "| #### #### #### \n", + "| #### #### #### \n", + "| #### #### #### \n", + "| #### #### \n", + "| #### #### \n", + "| #### #### \n", + "| #### #### \n", + "| #### #### \n", + "| #### #### \n", + "| #### #### \n", + "| #### \n", + "| #### \n", + "v\n" + ] + } + ], + "prompt_number": 2 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter12-checkpoint.ipynb b/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter12-checkpoint.ipynb new file mode 100644 index 00000000..b80c0151 --- /dev/null +++ b/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter12-checkpoint.ipynb @@ -0,0 +1,719 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:792ce9bacf230895f9bb69020ed0a90ab017f7ded1cf3c8298370c217c100f66" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 12: Working with Files" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 12.1, page no. 498" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import sys\n", + "\n", + "\n", + "mystr = []\n", + "\n", + "print \"Enter an interesting string of up to 80 characters: \",\n", + "mystr = raw_input()\n", + "\n", + "try:\n", + " fp = open(\"myfile.txt\", \"w\")\n", + "except:\n", + " print \"error opening the file...\"\n", + " sys.exit()\n", + "\n", + "for i in range(len(mystr)-1, -1, -1):\n", + " fp.write(mystr[i])\n", + "\n", + "fp.close()\n", + "\n", + "try:\n", + " fp = open(\"myfile.txt\", \"r\")\n", + "except:\n", + " print \"error opening the file...\"\n", + "\n", + "print \"the data read from the file is: \"\n", + "while(True):\n", + " c = fp.read(1)\n", + " if not c:\n", + " break\n", + " print c,\n", + "fp.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter an interesting string of up to 80 characters: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Too many cooks spoil the broth.\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " the data read from the file is: \n", + ". h t o r b e h t l i o p s s k o o c y n a m o o T\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 12.2, page no. 502" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "proverbs = [\"Many a mickle makes a muckle.\\n\",\n", + " \"Too many cooks spoil the broth.\\n\",\n", + " \"He who laughs last didn't get the joke in the first place.\\n\"]\n", + " \n", + "more = []\n", + "\n", + "try:\n", + " fp = open(\"myfile.txt\", \"w\") \n", + "except:\n", + " print \"error opening the file...\"\n", + "for proverb in proverbs:\n", + " fp.write(proverb)\n", + "fp.close()\n", + " \n", + "fp = open(\"myfile.txt\", \"a\")\n", + " \n", + "print \"Enter proverbs of up to 80 characters (separated by '.') or press Enter to end:\\n\",\n", + "string = raw_input().split('.')\n", + "\n", + "\n", + "for str in string:\n", + " fp.write(str+\"\\n\")\n", + "fp.close()\n", + "\n", + "fp = open(\"myfile.txt\", \"r\")\n", + "print \"The proverbs in the file are: \\n\"\n", + "while(True):\n", + " line = fp.readline()\n", + " if not line:\n", + " break\n", + " print line\n", + "fp.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter proverbs of up to 80 characters (separated by '.') or press Enter to end:\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Every dog has his day. Least said, soonest mended. A stitch in time saves nine. Waste not, want not.\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The proverbs in the file are: \n", + "\n", + "Many a mickle makes a muckle.\n", + "\n", + "Too many cooks spoil the broth.\n", + "\n", + "He who laughs last didn't get the joke in the first place.\n", + "\n", + "Every dog has his day\n", + "\n", + " Least said, soonest mended\n", + "\n", + " A stitch in time saves nine\n", + "\n", + " Waste not, want not\n", + "\n", + "\n", + "\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 12.3, page no. 507" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import sys\n", + "\n", + "num1 = 234567\n", + "num2 = 345123\n", + "num3 = 789234\n", + "\n", + "ival = []\n", + "\n", + "try:\n", + " fp = open(\"myfile.txt\", \"w\")\n", + "except:\n", + " print \"Error opening file for writing. Program terminated.\\n\"\n", + " sys.exit()\n", + "\n", + "fp.write(\"%6d %6d %6d\" %(num1, num2, num3))\n", + "fp.close()\n", + "print \"%6ld %6ld %6ld\" %(num1, num2, num3)\n", + "\n", + "try: \n", + " fp = open(\"myfile.txt\", \"r\")\n", + "except:\n", + " print \"Error opening file for reading. Program terminated.\\n\"\n", + " sys.exit()\n", + "\n", + "line = fp.readline()\n", + "line_split = line.split(\" \")\n", + "num4 = int(line_split[0])\n", + "num5 = int(line_split[1])\n", + "num6 = int(line_split[2])\n", + "print \"%6ld %6ld %6ld \" %(num4, num5, num6)\n", + "fp.close\n", + "\n", + "fp = open(\"myfile.txt\", \"r\")\n", + "line = fp.readline()\n", + "line_join = \"\".join(line_split)\n", + "ival.append(int(line_join[0:2]))\n", + "ival.append(int(line_join[2:5]))\n", + "ival.append(int(line_join[5:8]))\n", + "ival.append(int(line_join[8:11]))\n", + "ival.append(int(line_join[11:13]))\n", + "ival.append(int(line_join[13:15]))\n", + "fnum = (float(line_join[15:]))\n", + "\n", + "for i in range(len(ival)):\n", + " print \"%sival[%d] = %d\" %((\"\\n\\t\" if i == 4 else \"\\t\"), i, ival[i]),\n", + "print \"\\nfnum = %f \" %fnum" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "234567 345123 789234\n", + "234567 345123 789234 \n", + "\tival[0] = 23 \tival[1] = 456 \tival[2] = 734 \tival[3] = 512 \n", + "\tival[4] = 37 \tival[5] = 89 \n", + "fnum = 234.000000 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 12.4, page no. 514" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "\n", + "import math\n", + "import sys\n", + "\n", + "MEM_PRIMES = 10\n", + "PER_LINE = 8\n", + "filename = \"myfile.bin\"\n", + "fp = None\n", + "primes = [2, 3, 5]\n", + "count = 3\n", + "\n", + "def check(buff, count, n):\n", + " root_N = (1.0 + math.sqrt(n))\n", + " for i in range(0, count):\n", + " if(n % buff[i] == 0):\n", + " return 0\n", + " if(buff[i] > root_N):\n", + " return 1\n", + " return -1\n", + "\n", + "def list_array():\n", + " global primes\n", + " global count\n", + " for j in range(count):\n", + " print \"%10lu\" %primes[j]\n", + " if(((j + 1) % PER_LINE) == 0):\n", + " print \"\\n\"\n", + " \n", + "def list_primes():\n", + " global fp\n", + " global filename\n", + " global count\n", + " global primes\n", + " if(fp):\n", + " try:\n", + " fp = open(filename, \"rb\")\n", + " except:\n", + " print \"Unable to open %s to read primes for output \" %filename\n", + " sys,exit()\n", + " while(True):\n", + " line = fp.readline()\n", + " if line:\n", + " list_array()\n", + " print \"\\n\"\n", + " fp.close()\n", + " else:\n", + " list_array()\n", + "\n", + "def write_file():\n", + " global fp\n", + " global filename\n", + " global count\n", + " global primes\n", + " try:\n", + " fp = open(filename, \"ab\")\n", + " except:\n", + " print \"Unable to open %s to append\\n\" %filename\n", + " sys.exit()\n", + " for prime in primes:\n", + " fp.write(prime+\" \")\n", + " fp.close\n", + " count = 0\n", + "\n", + "def is_prime(n):\n", + " global filename\n", + " global fp\n", + " global primes\n", + " global count \n", + " buff = []\n", + " count = 0\n", + " k = 0\n", + " if(fp):\n", + " try:\n", + " fp = open(filename, \"rb\")\n", + " except:\n", + " print \"Unable to open %s to read. \" %g.filename\n", + " sys.exit()\n", + " while(True):\n", + " line = fp.readline()\n", + " if line:\n", + " nums = line.split(\" \")\n", + " for num in nums:\n", + " buff.append(int(num))\n", + " k = check(buff, count, n)\n", + " if(k == 1):\n", + " fp.close()\n", + " return True\n", + " else: \n", + " break\n", + " fp.close()\n", + " return 1 == check(primes, count, n)\n", + "\n", + "trial = primes[count - 1]\n", + "num_primes = 3\n", + "\n", + "print \"How many primes would you like? \",\n", + "total = int(raw_input())\n", + "total = 4 if total < 4 else total\n", + "print total\n", + "while(num_primes < total):\n", + " trial += 2\n", + " if(is_prime(trial)):\n", + " primes.append(trial)\n", + " count += 1\n", + " num_primes += 1\n", + " if(count == MEM_PRIMES):\n", + " write_file()\n", + "\n", + "if(fp and count > 0):\n", + " write_file()\n", + "list_primes()" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 12.5, page no. 523" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Date:\n", + " day = 0\n", + " month = 0\n", + " year = 0\n", + " \n", + "class Family:\n", + " dob = Date()\n", + " name = \"\"\n", + " pa_name = \"\"\n", + " ma_name = \"\"\n", + "\n", + "members = []\n", + "\n", + "def get_person():\n", + " while(True):\n", + " temp = Family()\n", + " print \"Enter the name of the person: \",\n", + " temp.name = raw_input()\n", + " print \"Enter %s's date of birth (day month year): \" %temp.name\n", + " temp.dob.day = int(raw_input(\"Day: \"))\n", + " temp.dob.month = int(raw_input(\"Month: \"))\n", + " temp.dob.year = int(raw_input(\"Year: \"))\n", + " print \"Who is %s's father? \" %temp.name,\n", + " temp.pa_name = raw_input()\n", + " print \"Who is %s's mother? \" %temp.name,\n", + " temp.ma_name = raw_input()\n", + " print \"\\nDo you want to enter details of a person (Y or N)? \",\n", + " more = raw_input()\n", + " members.append(temp)\n", + " if(more.lower() == 'n'):\n", + " return\n", + "\n", + "def show_person_data():\n", + " fp = open(\"myfile.bin\", \"rb\")\n", + " count = 0\n", + " while(True):\n", + " line = fp.readline()\n", + " if line:\n", + " member_data = line.split(\",\")\n", + " print \"%s's father is %s, and mother is %s.\" %(member_data[0],member_data[4], member_data[5])\n", + " found_relative, relative_info = get_parent_dob(members[count])\n", + " if found_relative:\n", + " print relative_info\n", + " else:\n", + " print \"No info on parents available\"\n", + " else:\n", + " break\n", + " fp.close()\n", + "\n", + "def get_parent_dob(member):\n", + " parent_info = \"\"\n", + " found_relative = False\n", + " for parent in members:\n", + " if parent.name == member.pa_name:\n", + " parent_info = parent_info+\"Pa was born on %d %d %d\" %(parent.dob.day, parent.dob.month, parent.dob.year)\n", + " found_relative = True\n", + " elif parent.name == member.ma_name:\n", + " parent_info = parent_info+\" Ma was born on %d %d %d\" %(parent.dob.day, parent.dob.month, parent.dob.year)\n", + " found_relative = True\n", + " return found_relative, parent_info\n", + "\n", + "\n", + "print \"Do you want to add details of a person ? (Y/N): \",\n", + "more = raw_input()\n", + "if more.lower() == 'n':\n", + " import sys\n", + " sys.exit()\n", + "\n", + "get_person()\n", + "fp = open(\"myfile.bin\", \"wb\")\n", + "for member in members:\n", + " line = member.name+\",\"+str(member.dob.day)+\",\"+str(member.dob.month)+\",\"+str(member.dob.year) +\",\"+member.pa_name+\",\"+member.ma_name\n", + " fp.write(line)\n", + " fp.write(\",\\n\")\n", + "fp.close()\n", + "show_person_data()" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 12.6, page no. 531" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "MAXLEN = 50\n", + "\n", + "def listfile():\n", + " fp = open(\"mypeople.bin\", \"rb\")\n", + " print \"The folks recorded in the mypeople.bin file are: \"\n", + " while(True):\n", + " line = fp.readline()\n", + " if line:\n", + " print line.split(\",\")[0], \"\\t\\t\\t\\t\\t\", line.split(\",\")[1]\n", + " else:\n", + " break\n", + " fp.close()\n", + "\n", + "answer = 'y'\n", + "fp = open(\"mypeople.bin\", \"wb\")\n", + "while(answer.lower() == 'y'):\n", + " print \"Enter a name less than %d characters: \" %MAXLEN,\n", + " name = raw_input()\n", + " print \"Enter the age of %s: \" %name,\n", + " age = int(raw_input())\n", + " length = len(name)\n", + " line = name+\",\"+str(age)\n", + " fp.write(line)\n", + " fp.write(\" \\n\")\n", + " print \"Do you want to enter another(y or n)? \",\n", + " answer = raw_input()\n", + "fp.close()\n", + "listfile()" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 12.7, page no. 545" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Record:\n", + " name = \"\"\n", + " age = 0\n", + "\n", + "records = []\n", + "\n", + "def write_file(mode):\n", + " global filename\n", + " fp = open(filename, mode)\n", + " more = 'y'\n", + " while(more == 'y'):\n", + " print \"Enter name less than 30 characters: \",\n", + " name = raw_input()\n", + " name = \"%30s\" %name\n", + " print \"Enter age of \", name\n", + " age = raw_input()\n", + " age = \"%3s\" %age\n", + " line = name+\",\"+age\n", + " fp.write(line)\n", + " fp.write(\" \\n\")\n", + " print \"Do you want to enter another (y/n)? \",\n", + " more = raw_input()\n", + " fp.close()\n", + " return\n", + "\n", + "def list_file():\n", + " global filename\n", + " fp = open(filename, \"rb\")\n", + " print \"The folks recorded in the mypeople.bin file are: \"\n", + " while(True):\n", + " line = fp.readline()\n", + " if line:\n", + " line_split = line.split(\",\")\n", + " print line_split[0].strip(), \"\\t\\t\\t\\t\\t\", line_split[1]\n", + " else:\n", + " break\n", + " fp.close()\n", + "\n", + "def remove(fname):\n", + " import os\n", + " os.remove(fname)\n", + "\n", + "def update_file():\n", + " global filename\n", + " new_record = Record()\n", + " fp = open(filename, \"rb+\")\n", + " print \"Enter name to be updated: \",\n", + " update_name = raw_input()\n", + " update_name = \"%30s\"%update_name\n", + " while(True):\n", + " old_pos = fp.tell()\n", + " old_line = fp.readline()\n", + " if old_line:\n", + " if old_line.split(\",\")[0] == update_name:\n", + " print \"You can now enter new name and age for \", update_name\n", + " print \"Enter name less than 30 charactesrs: \",\n", + " new_name = raw_input()\n", + " new_name = \"%30s\"%new_name\n", + " print \"Enter age for \", new_name\n", + " new_age = raw_input()\n", + " new_age = \"%3s\"%new_age\n", + " pos = fp.tell()\n", + " fp.seek(old_pos)\n", + " new_line = new_name+\",\"+new_age+\" \\n\"\n", + " new_line = old_line.replace(old_line, new_line)\n", + " fp.write(new_line)\n", + " else:\n", + " break\n", + " fp.close()\n", + " \n", + "filename = \"my-people.bin\"\n", + "answer = 'q'\n", + "while(True):\n", + " print \"Choose from the following options: \"\n", + " print \"To list the file contents enter L\"\n", + " print \"To create a new file enter C \"\n", + " print \"To add new records enter A\"\n", + " print \"To update existing records enter U\"\n", + " print \"To delete the file enter D\"\n", + " print \"To end the program enter Q: \",\n", + " answer = raw_input()\n", + " if answer.upper() == 'L':\n", + " list_file()\n", + " elif answer.upper() == 'C':\n", + " write_file(\"wb+\")\n", + " print \"File creation complete.\"\n", + " elif answer.upper() == 'A':\n", + " write_file(\"ab+\");\n", + " print \"File append complete.\"\n", + " elif answer.upper() == 'U':\n", + " update_file()\n", + " elif answer.upper() == 'D':\n", + " print \"Are you sure you want to delete %s (y or n)? \",\n", + " confirm_delete = raw_input()\n", + " if(confirm_delete.lower() == 'y'):\n", + " remove(filename)\n", + " elif answer.upper() == 'Q':\n", + " print \"Ending the program. \"\n", + " import sys\n", + " sys.exit()\n", + " else:\n", + " print \"Invalid selection. Try again.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 12.8, page no. 551" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import binascii\n", + "\n", + "print \"Enter filename: \",\n", + "filename = raw_input()\n", + "\n", + "f = open(filename, \"r\")\n", + "\n", + "for line in f.readlines():\n", + " print (binascii.hexlify(line)),\n", + " print \" | \", line\n", + "\n", + "f.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter filename: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "myfile.txt\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 2e68746f726220656874206c696f707320736b6f6f6320796e616d206f6f54 | .htorb eht liops skooc ynam ooT\n" + ] + } + ], + "prompt_number": 14 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter13-checkpoint.ipynb b/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter13-checkpoint.ipynb new file mode 100644 index 00000000..6169215b --- /dev/null +++ b/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter13-checkpoint.ipynb @@ -0,0 +1,322 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:a9141c3e95bf9510ebd3627775c232beb902109a956e0bd2f7e906b08fe40884" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 13: The Preprocessor and Debugging" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 13.2, page no. 576" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "y = 5\n", + "for x in range(20):\n", + " print \"x = %d y = %d\" %(x, y)\n", + " assert(x < y)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "AssertionError", + "evalue": "", + "output_type": "pyerr", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mAssertionError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 6\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mx\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m20\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 7\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"x = %d y = %d\"\u001b[0m \u001b[1;33m%\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0my\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 8\u001b[1;33m \u001b[1;32massert\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mx\u001b[0m \u001b[1;33m<\u001b[0m \u001b[0my\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;31mAssertionError\u001b[0m: " + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = 0 y = 5\n", + "x = 1 y = 5\n", + "x = 2 y = 5\n", + "x = 3 y = 5\n", + "x = 4 y = 5\n", + "x = 5 y = 5\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 13.3, page no. 578" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import time\n", + "import datetime\n", + "import math\n", + "\n", + "calendar_start = datetime.datetime.now()\n", + "cpu_start = time.time()\n", + "count = 0\n", + "iterations = 1000000\n", + "answer = 'y'\n", + "x = 0.0\n", + "print \"Initial clock time = \", cpu_start, \" Initial calendar time = \", calendar_start\n", + "while(answer.lower() == 'y'):\n", + " for i in range(iterations):\n", + " x = math.sqrt(3.14159265)\n", + " count += 1\n", + " print \"%d square roots completed.\\n\" %(iterations*count)\n", + " print \"Do you want to run some more(y or n)? \"\n", + " answer = raw_input()\n", + "\n", + "cpu_end = time.time()\n", + "calendar_end = datetime.datetime.now()\n", + "\n", + "\n", + "print \"Final clock time = \", cpu_end, \" Final calendar time = \", calendar_end\n", + "print \"CPU time for %d iterations is %.2f seconds\" %(count*iterations, (float(cpu_end-cpu_start)/time.clock()))\n", + "print \"Elapsed calendar time to execute the program is\", calendar_end-calendar_start, \" seconds\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Initial clock time = 1387828819.12 Initial calendar time = 2013-12-24 01:30:19.115309\n", + "1000000 square roots completed.\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Do you want to run some more(y or n)? \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "2000000 square roots completed.\n", + "\n", + "Do you want to run some more(y or n)? \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "n\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Final clock time = 1387828824.23 Final calendar time = 2013-12-24 01:30:24.232139\n", + "CPU time for 2000000 iterations is 4.49 seconds\n", + "Elapsed calendar time to execute the program is 0:00:05.116830 seconds\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 13.4, page no. 583" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from datetime import *\n", + "import time\n", + "\n", + "day = [\"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\", \"Sunday\"]\n", + "month = [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\",\n", + " \"September\", \"October\", \"November\", \"December\"]\n", + " \n", + "now = datetime.now()\n", + "suffix = \"\"\n", + "\n", + "today = day[datetime.today().weekday()]\n", + "curr_month = month[now.month-1]\n", + "\n", + "if now.day == 1 or now.day == 21 or now.day == 31:\n", + " suffix= \"st\"\n", + "elif now.day == 2 or now.day == 22:\n", + " suffix= \"nd\"\n", + "elif now.day == 3 or now.day == 23:\n", + " suffix = \"rd\"\n", + "else:\n", + " suffix= \"th\"\n", + " \n", + "print \"Today is \", today, \" the \",str(now.day)+suffix, curr_month, str(now.year)+\".\", \"The time is \", time.strftime(\"%H:%M:%S\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Today is Tuesday the 24th December 2013. The time is 01:30:43\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 13.5, page no. 586" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from datetime import *\n", + "import time\n", + "\n", + "day = [\"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\", \"Sunday\"]\n", + "month = [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\",\n", + " \"September\", \"October\", \"November\", \"December\"]\n", + " \n", + "now = datetime.now()\n", + "suffix = \"\"\n", + "\n", + "curr_month = month[now.month-1]\n", + "\n", + "print \"Enter a name: \",\n", + "name = raw_input()\n", + "print \"Enter a DOB for \", name\n", + "dob_day = int(raw_input(\"Day: \"))\n", + "dob_month = int(raw_input(\"Month: \"))\n", + "dob_year = int(raw_input(\"Year: \"))\n", + "dob_date = date(dob_year, dob_month, dob_day)\n", + "\n", + "if dob_day == 1 or dob_day == 21 or dob_day == 31:\n", + " suffix= \"st\"\n", + "elif dob_day == 2 or dob_day == 22:\n", + " suffix= \"nd\"\n", + "elif dob_day == 3 or dob_day == 23:\n", + " suffix = \"rd\"\n", + "else:\n", + " suffix= \"th\"\n", + "\n", + "dob_month = month[dob_month-1]\n", + "print name, \"Was born on \", str(dob_day)+suffix, dob_month, dob_year, \"which was a \", day[date.weekday(dob_date)]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Ricky\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter a DOB for Ricky\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Day: 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Month: 8\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Year: 1970\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Ricky Was born on 5th August 1970 which was a Wednesday\n" + ] + } + ], + "prompt_number": 4 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter14-checkpoint.ipynb b/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter14-checkpoint.ipynb new file mode 100644 index 00000000..c351c6f1 --- /dev/null +++ b/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter14-checkpoint.ipynb @@ -0,0 +1,333 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:275b458b34ae91067224e50705db107812d45fc58e5291ede57a7d2fe00a2167" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 14: Advanced and Specialized Topics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 14.1, page no. 592" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import string\n", + "import sys\n", + "\n", + "print \"Enter a character: \",\n", + "ch = raw_input()\n", + "\n", + "if ch.isalnum():\n", + " if ch.isdigit():\n", + " print \"You entered the digit \", ch\n", + " elif ch.islower():\n", + " print \"You entered a lower case \", ch.upper()\n", + " elif ch.isupper():\n", + " print \"You entered a upper case \", ch.lower()\n", + " elif ch in string.punctuation:\n", + " print \"You entered a punctuation character \", ch\n", + " else:\n", + " print \"You entered \", ch, \"but I don't know what it is!\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a character: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "g\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " You entered a lower case G\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 14.2, page no. 596" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter a string of less than 100 characters: \",\n", + "text = raw_input()\n", + "\n", + "print \"Enter the string sought: \",\n", + "sought = raw_input()\n", + "sought = sought.lower()\n", + "count = 0\n", + "\n", + "sought_len = len(sought)\n", + "\n", + "for i in range(len(text)):\n", + " substr = text[i:sought_len+i]\n", + " if substr == sought:\n", + " count += 1\n", + "\n", + "print \"First string entered: \", text\n", + "print \"Second string entered: \", sought\n", + "print \"The second string was found in first %d times\" %count\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a string of less than 100 characters: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Smith, where Jones had had, \"had\", had had \"had had\". Enter the string sought (less than 40 characters): Had\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the string sought: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "had\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " First string entered: Smith, where Jones had had, \"had\", had had \"had had\". Enter the string sought (less than 40 characters): Had\n", + "Second string entered: had\n", + "The second string was found in first 7 times\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 14.3, page no. 606" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "cx = 1.0 + 3.0j\n", + "cy = 1.0 - 4.0j\n", + "\n", + "sum = cx + cy\n", + "diff = cx - cy\n", + "product = cx * cy\n", + "quotient = cy/cy\n", + "conjugate = cx.conjugate()\n", + "\n", + "print \"Complex numbers are supported\"\n", + "print \"Working with complex numbers: \"\n", + "print \"Starting values: cx = %.2f%+.2fi cy = %.2f%+.2fi\" %(cx.real, cx.imag, cy.real, cy.imag)\n", + "print \"The sum cx + cy = %.2f%+.2fi\" %(sum.real, sum.imag)\n", + "print \"The difference cx - cy = %.2f%+.2fi\" %(diff.real, diff.imag)\n", + "print \"The product cx * cy = %.2f%+.2fi\" %(product.real, product.imag)\n", + "print \"The quotient cx / cy = %.2f%+.2fi\" %(quotient.real, quotient.imag)\n", + "print \"The conjugate of cx = %.2f%+.2fi\" %(conjugate.real, conjugate.imag)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Complex numbers are supported\n", + "Working with complex numbers: \n", + "Starting values: cx = 1.00+3.00i cy = 1.00-4.00i\n", + "The sum cx + cy = 2.00-1.00i\n", + "The difference cx - cy = 0.00+7.00i\n", + "The product cx * cy = 13.00-1.00i\n", + "The quotient cx / cy = 1.00-0.00i\n", + "The conjugate of cx = 1.00-3.00i\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 14.4, page no. 610" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from threading import Thread\n", + "\n", + "def get_data(pdata):\n", + " pd = pdata\n", + " print \"The get_data thread received: data.a=%d and data.b=%d\" %(pd[0], pd[1])\n", + " pd[0] *= 3\n", + " print \"The get_data thread makes it: data.a=%d and data.b=%d \" %(pd[0], pd[1])\n", + " \n", + "def process_data(pdata):\n", + " pd = pdata\n", + " print \"The process_data thread received: data.a=%d and data.b=%d \"%(pd[0], pd[1])\n", + " \n", + "mydata = [123, 345]\n", + "print \"Before starting the get_data thread: mydata.a=%d and mydata. b=%d\" %(mydata[0], mydata[1])\n", + "print \"get_data thread started.\"\n", + "t1 = Thread(target=get_data, args=(mydata,))\n", + "t1.start()\n", + "Thread.join(t1)\n", + "print \"process_data thread started.\"\n", + "t2 = Thread(target=process_data, args=(mydata,))\n", + "t2.start()\n", + "Thread.join(t2)\n", + "print \"After both threads finish executing: mydata.a=%d and mydata. b=%d\" %(mydata[0], mydata[1])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Before starting the get_data thread: mydata.a=123 and mydata. b=345\n", + "get_data thread started.\n", + "The get_data thread received: data.a=123 and data.b=345\n", + "The get_data thread makes it: data.a=369 and data.b=345 \n", + "process_data thread started.\n", + "The process_data thread received: data.a=369 and data.b=345 \n", + "After both threads finish executing: mydata.a=369 and mydata. b=345\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 14.5, page no. 616" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from threading import Thread\n", + "import math\n", + "import time\n", + "\n", + "thread_count = 5\n", + "\n", + "thread_id = []\n", + "task = 0\n", + "\n", + "def execute_task():\n", + " global task\n", + " task += 1\n", + " print \"Task %d started.\" %task\n", + " time.sleep(1)\n", + " for i in range(1000000):\n", + " x = math.sqrt(3.1415926)\n", + " print \"Task %d finished\" %task\n", + " \n", + "\n", + "for i in range(thread_count):\n", + " thread_id.append(Thread(target=execute_task))\n", + " thread_id[i].start()\n", + " \n", + "for j in range(thread_count):\n", + " Thread.join(thread_id[j])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Task 1 started.\n", + "Task 2 started.\n", + "Task 3 started.\n", + "Task 4 started.\n", + "Task 5 started.\n", + "Task 5 finished\n", + "Task 5 finished\n", + "Task 5 finished\n", + "Task 5 finished\n", + "Task 5 finished\n" + ] + } + ], + "prompt_number": 9 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter2-checkpoint.ipynb b/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter2-checkpoint.ipynb new file mode 100644 index 00000000..c8739188 --- /dev/null +++ b/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter2-checkpoint.ipynb @@ -0,0 +1,790 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:62d8fc451396635cdeab5f4f92b23401a31f7b72236a9f3ecb8a6d1a87f20612" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 2: First Steps in Programming" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 2.1, page no. 27" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"My salary is $10000\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "My salary is $10000\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 2.2, page no. 29" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + " \n", + "salary = 10000; #Declare and store 10000 in variable called salary\n", + "print \"My salary is %d.\" %salary" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "My salary is 10000.\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 2.3, page no. 31" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "brothers = 7 #declaring variable & storing value\n", + "brides = 7 #declaring variable & storing value\n", + " \n", + "print \"%d brides for %d brothers\" %(brides, brothers)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "7 brides for 7 brothers\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 2.4, page no. 34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "cats = 2\n", + "dogs = 1\n", + "ponies = 1\n", + "others = 46\n", + " \n", + "total_pets = cats + dogs + ponies + others;\n", + " \n", + "print \"We have %d pets in total\\n\" %total_pets" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "We have 50 pets in total\n", + "\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 2.5, page no. 37" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "cookies = 5\n", + "cookie_calories = 125\n", + "total_eaten = 0\n", + "eaten = 2\n", + "cookies = cookies - eaten\n", + "total_eaten = total_eaten + eaten\n", + "print \"I have eaten %d cookies. There are %d cookies left\" %(eaten, cookies)\n", + " \n", + "eaten = 3\n", + "cookies = cookies - eaten\n", + "total_eaten = total_eaten + eaten\n", + "print \"I have eaten %d more. Now there are %d cookies left\\n\" %(eaten, cookies)\n", + "print \"Total energy consumed is %d calories.\\n\" %(total_eaten*cookie_calories)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "I have eaten 2 cookies. There are 3 cookies left\n", + "I have eaten 3 more. Now there are 0 cookies left\n", + "\n", + "Total energy consumed is 625 calories.\n", + "\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 2.6, page no. 39" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "cookies = 45\n", + "children = 7\n", + "cookies_per_child = 0\n", + "cookies_left_over = 0\n", + " \n", + "cookies_per_child = cookies/children\n", + "print \"You have %d children and %d cookies\" %(children, cookies)\n", + "print \"Give each child %d cookies.\\n\" %cookies_per_child\n", + "cookies_left_over = cookies%children\n", + "print \"There are %d cookies left over.\\n\" %cookies_left_over" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "You have 7 children and 45 cookies\n", + "Give each child 6 cookies.\n", + "\n", + "There are 3 cookies left over.\n", + "\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 2.7, page no. 48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "plank_length = 10.0\n", + "piece_count = 4.0\n", + "piece_length = 0.0\n", + " \n", + "piece_length = plank_length/piece_count;\n", + "print \"A plank %f feet long can be cut into %f pieces %f feet long.\\n\" %(plank_length, piece_count, piece_length)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "A plank 10.000000 feet long can be cut into 4.000000 pieces 2.500000 feet long.\n", + "\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 2.8, page no. 51" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "radius = 0.0\n", + "diameter = 0.0\n", + "circumference = 0.0\n", + "area = 0.0\n", + "Pi = 3.14159265\n", + " \n", + "print \"Input the diameter of the table:\",\n", + "diameter = float(raw_input()) \n", + "radius = diameter/2.0\n", + "circumference = 2.0*Pi*radius\n", + "area = Pi*radius*radius\n", + " \n", + "print \"\\nThe circumference is %0.2f\" %circumference\n", + "print \"\\nThe area is %0.2f\\n\" %area" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Input the diameter of the table:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + "The circumference is 18.85\n", + "\n", + "The area is 28.27\n", + "\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 2.9, page no. 54" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "PI = 3.14159\n", + " \n", + "radius = 0.0\n", + "diameter = 0.0\n", + "circumference = 0.0\n", + "area = 0.0\n", + " \n", + "print \"Input the diameter of a table:\", \n", + "diameter = float(raw_input())\n", + " \n", + "radius = diameter/2.0\n", + "circumference = 2.0*PI*radius\n", + "area = PI*radius*radius;\n", + " \n", + "print \"\\nThe circumference is %.2f. \" %circumference\n", + "print \"\\nThe area is %.2f.\\n\" %area" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Input the diameter of a table:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + "The circumference is 18.85. \n", + "\n", + "The area is 28.27.\n", + "\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 2.10, page no. 55" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "diameter = 0.0\n", + "radius = 0.0\n", + "Pi = 3.14159\n", + " \n", + "print \"Input the diameter of the table:\",\n", + "diameter = float(raw_input())\n", + "radius = diameter/2.0\n", + " \n", + "print \"\\nThe circumference is %.2f.\" %(2.0*Pi*radius)\n", + "print \"\\nThe area is %.2f.\\n\" %(Pi*radius*radius)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Input the diameter of the table:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + "The circumference is 18.85.\n", + "\n", + "The area is 28.27.\n", + "\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 2.12, page no. 59" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import sys \n", + "\n", + "print \"Size of Integer is: \" + str(sys.getsizeof(int()))\n", + "print \"Size of Float is: \" + str(sys.getsizeof(float()))\n", + "print \"Size of Long is: \" + str(sys.getsizeof(long()))\n", + "print \"Size of String is: \" + str(sys.getsizeof(str()))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Size of Integer is: 24\n", + "Size of Float is: 24\n", + "Size of Long is: 24\n", + "Size of String is: 37\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 2.13, page no. 60" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "Revenue_Per_150 = 4.5\n", + "JanSold = 23500\n", + "FebSold = 19300\n", + "MarSold = 21600\n", + "RevQuarter = 0.0\n", + " \n", + "QuarterSold = JanSold + FebSold + MarSold\n", + " \n", + "print \"Stock sold in\\n Jan: %d\\n Feb: %d\\n Mar: %d\\n\" %(JanSold, FebSold, MarSold)\n", + "print \"Total stock sold in first quarter: %d\\n\" %QuarterSold\n", + " \n", + "RevQuarter = QuarterSold/150*Revenue_Per_150\n", + "print \"Sales revenue this quarter is:$%.2f\\n\" %RevQuarter" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Stock sold in\n", + " Jan: 23500\n", + " Feb: 19300\n", + " Mar: 21600\n", + "\n", + "Total stock sold in first quarter: 64400\n", + "\n", + "Sales revenue this quarter is:$1930.50\n", + "\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 2.15, page no. 68" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "first = 'T'\n", + "second = 63\n", + " \n", + "print \"The first example as a letter looks like this - \", first\n", + "print \"The first example as a number looks like this - \", ord(first)\n", + "print \"The second example as a letter looks like this - \", chr(second)\n", + "print \"The second example as a number looks like this - %d\\n\" %second" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The first example as a letter looks like this - T\n", + "The first example as a number looks like this - 84\n", + "The second example as a letter looks like this - ?\n", + "The second example as a number looks like this - 63\n", + "\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 2.16, page no. 69" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "first = 'A'\n", + "second = 'B'\n", + "last = 'Z'\n", + "number = 40\n", + "ex1 = ord(first) + 2\n", + "ex2 = ord(second) - 1\n", + "ex3 = ord(last) + 2\n", + " \n", + "print \"Character values \\t %-5c%-5c%-5c\\n\" %(chr(ex1), chr(ex2), chr(ex3))\n", + "print \"Numerical equivalents\\t %-5d%-5d%-5d\\n\" %(ex1, ex2, ex3)\n", + "print \"The number %d is the code for the character %c\" %(number, chr(number))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Character values \t C A \\ \n", + "\n", + "Numerical equivalents\t 67 65 92 \n", + "\n", + "The number 40 is the code for the character (\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 2.17 (combines 2.18 also), page no. 80" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "shorty = 0.0\n", + "lofty = 0.0\n", + "feet = 0.0\n", + "inches = 0.0\n", + "shorty_to_lofty = 0.0\n", + "lofty_to_tree = 0.0\n", + "inches_per_foot = 12.0\n", + " \n", + "print \"Enter Lofty's height to the top of his/her head, in whole feet: \",\n", + "feet = float(raw_input())\n", + "print \"...and then inches: \",\n", + "inches = float(raw_input())\n", + "lofty = feet*inches_per_foot + inches\n", + "\n", + "print \"Enter Shorty's height up to his/her eyes, in whole feet: \",\n", + "feet = float(raw_input())\n", + "print \"... and then inches: \",\n", + "inches = float(raw_input())\n", + "shorty = feet*inches_per_foot + inches\n", + " \n", + "print \"Enter the distance between Shorty and Lofty, in whole feet: \",\n", + "feet = float(raw_input())\n", + "print \"... and then inches: \",\n", + "inches = float(raw_input())\n", + "shorty_to_lofty = feet*inches_per_foot + inches\n", + " \n", + "print \"Finally enter the distance from Lofty to the tree to the nearest foot: \",\n", + "feet = float(raw_input())\n", + "lofty_to_tree = feet*inches_per_foot\n", + "\n", + "\n", + "tree_height = shorty + (shorty_to_lofty + lofty_to_tree)*(lofty-shorty)/shorty_to_lofty\n", + " \n", + "print \"The height of the tree is %ld feet and %ld inches.\\n\" %(tree_height/inches_per_foot, tree_height% inches_per_foot)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Lofty's height to the top of his/her head, in whole feet: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " ...and then inches: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter Shorty's height up to his/her eyes, in whole feet: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " ... and then inches: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the distance between Shorty and Lofty, in whole feet: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " ... and then inches: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Finally enter the distance from Lofty to the tree to the nearest foot: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "20\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The height of the tree is 12 feet and 10 inches.\n", + "\n" + ] + } + ], + "prompt_number": 15 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter3-checkpoint.ipynb b/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter3-checkpoint.ipynb new file mode 100644 index 00000000..74bd1aaf --- /dev/null +++ b/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter3-checkpoint.ipynb @@ -0,0 +1,683 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:395f91f52f5165130592aef7f92afdbea52f690b93426a4caf3da2a8b3404bd6" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 3: Making Decisions" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 3.1, page no. 88" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "number = 0;\n", + "print \"\\nEnter an integer between 1 and 10: \",\n", + "number = int(raw_input())\n", + " \n", + "if(number > 5):\n", + " print \"You entered %d which is greater than 5\\n\" % number\n", + "if(number < 6):\n", + " print \"You entered %d which is less than 6\\n\" % number" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter an integer between 1 and 10: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " You entered 6 which is greater than 5\n", + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 3.2, page no. 91" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "unit_price = 3.50\n", + "print \"Enter the number that you want to buy: \", \n", + "quantity = int(raw_input())\n", + "if(quantity > 10):\n", + " total = quantity*unit_price*0.95 # 5% discount\n", + " print \"The price for %d is $%.2f\\n\" % (quantity, total)\n", + "else:\n", + " total = quantity*unit_price #no discount\n", + " print \"The price for %d is $%.2f\\n\" % (quantity, total)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the number that you want to buy: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "20\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The price for 20 is $66.50\n", + "\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 3.3, page no. 95" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "test = 0.0\n", + "print \"Enter an integer: \",\n", + "test = int(raw_input())\n", + " \n", + "if(test % 2 == 0):\n", + " print \"The number %ld is even\" %test\n", + "if((test/2) % 2 == 0):\n", + " print \"Half of %d is also even\" %test\n", + " print \"That's interesting isn't it?\"\n", + "else:\n", + " print \"The number %d is odd\\n\" %test" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter an integer: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "20\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The number 20 is even\n", + "Half of 20 is also even\n", + "That's interesting isn't it?\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 3.4, page no. 98" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter an uppercase letter:\",\n", + "letter = raw_input()\n", + "if(ord(letter) >= ord('A')):\n", + " if(ord(letter) <= ord('Z')):\n", + " letter = chr( ord(letter) - ord('A') + ord('a'))\n", + " print \"You entered an uppercase %c\" %letter\n", + " else:\n", + " print \"Try using the shift key! I want a capital letter.\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter an uppercase letter:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "G\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " You entered an uppercase g\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 3.5, page no. 103" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter an uppercase letter:\",\n", + "letter = raw_input()\n", + "if( (ord(letter) >= ord('A')) and (ord(letter) <= ord('Z')) ):\n", + " letter = chr( ord(letter) - ord('A') + ord('a'))\n", + " print \"You entered an uppercase %c\" %letter\n", + "else:\n", + " print \"You did not enter an uppercase letter.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter an uppercase letter:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "j\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " You did not enter an uppercase letter.\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 3.6, page no. 105" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "unit_price = 3.50\n", + "discount1 = 0.05\n", + "discount2 = 0.1\n", + "discount3 = 0.15\n", + "total_price = 0.0\n", + " \n", + "print \"Enter the number that you want to buy:\",\n", + "quantity = int(raw_input())\n", + " \n", + "if(quantity >50):\n", + " total_price = quantity*unit_price*(1.0-discount3)\n", + "elif(quantity > 20):\n", + " total_price = quantity*unit_price*(1.0-discount2)\n", + "elif(quantity > 10):\n", + " total_price = quantity*unit_price*(1.0-discount1)\n", + "else:\n", + " total_price = quantity*unit_price*(1.0-0.0)\n", + "print \"The price for %d is $%.2f\\n\" %(quantity, total_price)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the number that you want to buy:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "60\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The price for 60 is $178.50\n", + "\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 3.7, page no. 109" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "age = 0\n", + "college = 0\n", + "subject = 0\n", + "interview = False # true for accept, false for reject\n", + "\n", + "print \"What college? 1 for Harvard, 2 for Yale, 3 for other: \",\n", + "college = int(raw_input())\n", + "print \"What subject? 1 for Chemistry, 2 for economics, 3 for other: \",\n", + "subject = int(raw_input())\n", + "print \"How old is the applicant? \",\n", + "age = int(raw_input())\n", + " \n", + "if( (age>25 and subject==1) and (college==3 or college == 1) ):\n", + " interview = True\n", + "if(college == 2 and subject == 1):\n", + " interview = True\n", + "if(college == 1 and subject == 2 and not(age > 28)):\n", + " interview = True\n", + "if(college == 2 and (subject == 2 or subject == 3) and age > 25):\n", + " interview = True\n", + " \n", + "if(interview):\n", + " print \"Give 'em an interview\"\n", + "else:\n", + " print \"Reject 'em\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "What college? 1 for Harvard, 2 for Yale, 3 for other: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " What subject? 1 for Chemistry, 2 for economics, 3 for other: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " How old is the applicant? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "24\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Give 'em an interview\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 3.8, page no. 117" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Pick a number between 1 and 10 and you may win a prize! \",\n", + "choice = int(raw_input())\n", + "if((choice > 10) or (choice < 1)):\n", + " choice = 11\n", + "if choice == 7:\n", + " print \"Congratulations!\"\n", + " print \"You win the collected works of Amos Gruntfuttock.\"\n", + "elif choice == 2:\n", + " print \"You win the folding thermometer-pen-watch-umbrella.\"\n", + "elif choice == 8:\n", + " print \"You win the lifetime supply of aspirin tablets.\"\n", + "elif choice == 11:\n", + " print \"Try between 1 and 10. You wasted your guess.\",\n", + "else:\n", + " print \"Sorry, you lose.\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Pick a number between 1 and 10 and you may win a prize! " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Congratulations!\n", + "You win the collected works of Amos Gruntfuttock.\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 3.9, page no. 119" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter Y or N: \",\n", + "answer = raw_input()\n", + "\n", + "if answer =='y' or answer == 'Y':\n", + " print \"You responded in the affirmative.\"\n", + "elif answer == 'n' or answer == 'N':\n", + " print \"You responded in the negative.\"\n", + "else:\n", + " print \"You did not respond correctly. . .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Y or N: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " You responded in the affirmative.\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 3.10, page no. 128" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "original = 0xABC\n", + "result = 0\n", + "mask = 0xF\n", + "\n", + "print \"original = %X\" % original\n", + "result |= original & mask\n", + " \n", + "original = original >> 4\n", + "result = result << 4\n", + "result |= original&mask\n", + " \n", + "original = original >> 4\n", + "result = result << 4\n", + "result |= original & mask\n", + "print \"result = %X\" % result" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "original = ABC\n", + "result = CBA\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + " Program 3.11, page no. 132" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter the calculation\\n\",\n", + "number1 = float(raw_input(\"Enter first number: \"))\n", + "number2 = float(raw_input(\"Enter second number: \"))\n", + "operation = raw_input(\"Enter operation '+' or '-' or '/' or '%' or '*': \")\n", + " \n", + "if operation == '+':\n", + " print \"= %f\" %(number1 + number2)\n", + "elif operation == '-':\n", + " print \"= %f\" %(number1 - number2)\n", + "elif operation == '*':\n", + " print \"= %f\" %(number1 * number2);\n", + "elif operation == '/':\n", + " if(number2 == 0):\n", + " print \"Division by zero error!\"\n", + " else:\n", + " print \"= %f\\n\" %(number1 / number2)\n", + "elif operation == '%':\n", + " if(number2 == 0):\n", + " print \"Division by zero error!\"\n", + " else:\n", + " print \"= %f\\n\" %(number1 % number2)\n", + "else:\n", + " print \"Illegal operation!\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the calculation\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter first number: 25\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter second number: 24\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter operation '+' or '-' or '/' or '%' or '*': *\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "= 600.000000\n" + ] + } + ], + "prompt_number": 13 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter4-checkpoint.ipynb b/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter4-checkpoint.ipynb new file mode 100644 index 00000000..72f009be --- /dev/null +++ b/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter4-checkpoint.ipynb @@ -0,0 +1,926 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:4c41735fb67bb40797fc8ec99d1c0b5c81a6828d699e86fe05c05b6962ed94db" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 4: Loops" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 4.1, page no. 139" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "for count in range (1, 11):\n", + " print count,\n", + "print \"\\nAfter the loop count has the value %d.\" %count" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 2 3 4 5 6 7 8 9 10 \n", + "After the loop count has the value 10.\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 4.2, page no. 140" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"**************\"\n", + "for count in range(1, 9):\n", + " print \"* *\"\n", + "print \"**************\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "**************\n", + "* *\n", + "* *\n", + "* *\n", + "* *\n", + "* *\n", + "* *\n", + "* *\n", + "* *\n", + "**************\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 4.3, page no. 144" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "sum = 0\n", + "\n", + "print \"Enter the number of integers you want to sum: \",\n", + "count = int(raw_input())\n", + " \n", + "for i in range(1, count+1):\n", + " sum = sum + i\n", + " \n", + "print \"Total of the first %d numbers is %d\" %(count, sum)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the number of integers you want to sum: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total of the first 10 numbers is 55\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 4.4, page no. 144" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "sum = 0\n", + "\n", + "print \"Enter the number of integers you want to sum: \",\n", + "count = int(raw_input())\n", + " \n", + "for i in range(1, count+1):\n", + " sum = sum + i\n", + " \n", + "print \"Total of the first %d numbers is %d\" %(count, sum)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the number of integers you want to sum: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total of the first 10 numbers is 55\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 4.5, page no. 147" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "sum = 0\n", + "\n", + "print \"Enter the number of integers you want to sum: \",\n", + "count = int(raw_input())\n", + "for i in range(count, 0, -1):\n", + " sum = sum + i\n", + "print \"Total of the first %d numbers is %d\" %(count, sum)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the number of integers you want to sum: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total of the first 10 numbers is 55\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 4.6, page no. 148" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"This program calculates the average of any number of values.\"\n", + "total = 0\n", + "count = 0\n", + "while True: # infinite loop\n", + " print \"\\nEnter a value: \",\n", + " value = float(raw_input())\n", + " total += value\n", + " count += 1\n", + " \n", + " print \"Do you want to enter another value? (Y or N): \", \n", + " answer = raw_input()\n", + " if(answer.lower() == 'n'):\n", + " break\n", + "\n", + "print \"The average is %.2f\" %(total/count)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "This program calculates the average of any number of values.\n", + "\n", + "Enter a value: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Do you want to enter another value? (Y or N): " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + "Enter a value: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Do you want to enter another value? (Y or N): " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + "Enter a value: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Do you want to enter another value? (Y or N): " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "n\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The average is 8.00\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 4.7, page no. 151" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import sys\n", + "\n", + "chosen = 15\n", + "guess = 0\n", + "count = 3\n", + " \n", + "print \"This is a guessing game.\"\n", + "print \"I have chosen a number between 1 and 20 which you must guess.\"\n", + "\n", + "for i in range(count, 0, -1):\n", + " print \"You have %d tr%s left.\" %(i, (\"y\" if i == 1 else \"ies\"));\n", + " print \"\\nEnter a guess: \",\n", + " guess = int(raw_input())\n", + " if(guess == chosen):\n", + " print \"Congratulations. You guessed it!\"\n", + " sys.exit()\n", + " elif(guess < 1 or guess > 20):\n", + " print \"I said the number is between 1 and 20.\"\n", + " else:\n", + " print \"Sorry, %d is wrong. My number is %s than that.\\n\" %(guess, (\"greater\" if chosen > guess else \"less\"))\n", + "print \"You have had three tries and failed. The number was %d\" % chosen" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "This is a guessing game.\n", + "I have chosen a number between 1 and 20 which you must guess.\n", + "You have 3 tries left.\n", + "\n", + "Enter a guess: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Sorry, 5 is wrong. My number is greater than that.\n", + "\n", + "You have 2 tries left.\n", + "\n", + "Enter a guess: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Sorry, 9 is wrong. My number is greater than that.\n", + "\n", + "You have 1 try left.\n", + "\n", + "Enter a guess: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "14\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Sorry, 14 is wrong. My number is greater than that.\n", + "\n", + "You have had three tries and failed. The number was 15\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 4.7A, page no. 154" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from random import *\n", + "\n", + "guess = 0\n", + "count = 3\n", + "limit = 20\n", + "\n", + "chosen = 1 + randint(1, limit) #Random int 1 to limit\n", + " \n", + "print \"This is a guessing game.\"\n", + "print \"I have chosen a number between 1 and 20 which you must guess.\"\n", + "\n", + "for i in range(count, 0, -1):\n", + " print \"You have %d tr%s left.\" %(i, (\"y\" if i == 1 else \"ies\"));\n", + " print \"Enter a guess: \",\n", + " guess = int(raw_input())\n", + " if(guess == chosen):\n", + " print \"Congratulations. You guessed it!\"\n", + " sys.exit()\n", + " elif(guess < 1 or guess > 20):\n", + " print \"I said the number is between 1 and 20.\"\n", + " else:\n", + " print \"Sorry, %d is wrong. My number is %s than that.\\n\" %(guess, (\"greater\" if chosen > guess else \"less\"))\n", + "print \"You have had three tries and failed. The number was %d\" % chosen" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "This is a guessing game.\n", + "I have chosen a number between 1 and 20 which you must guess.\n", + "You have 3 tries left.\n", + "Enter a guess: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Sorry, 6 is wrong. My number is greater than that.\n", + "\n", + "You have 2 tries left.\n", + "Enter a guess: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "14\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Sorry, 14 is wrong. My number is greater than that.\n", + "\n", + "You have 1 try left.\n", + "Enter a guess: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "16\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Sorry, 16 is wrong. My number is greater than that.\n", + "\n", + "You have had three tries and failed. The number was 20\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 4.8, page no. 158" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "sum = 0\n", + "i = 1\n", + "\n", + "print \"Enter the number of integers you want to sum: \",\n", + "count = int(raw_input())\n", + " \n", + "while(i <= count):\n", + " sum += i\n", + " i += 1\n", + " \n", + "print \"Total of the first %d numbers is %d\" %(count, sum)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the number of integers you want to sum: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total of the first 10 numbers is 55\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 4.9, page no. 161" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "MIN_SIZE = 3;\n", + " \n", + "print \"Enter values for the width and height (minimum of %d): \" % MIN_SIZE\n", + "width = int(raw_input(\"Width: \"))\n", + "height = int(raw_input(\"Height: \"))\n", + " \n", + "if(width < MIN_SIZE):\n", + " print \"Width value of %d is too small. Setting it to %d.\" %(width, MIN_SIZE)\n", + " width = MIN_SIZE\n", + "if(height < MIN_SIZE):\n", + " print \"Height value of %d is too small. Setting it to %d.\" %(height, MIN_SIZE)\n", + " height = MIN_SIZE\n", + "\n", + "\n", + "for i in range(0, width):\n", + " print \"*\",\n", + "print \"\\n\"\n", + "for j in range(0, height-2):\n", + " print \"*\",\n", + " for i in range(0, width-2):\n", + " print \" \",\n", + " print \"*\"\n", + "\n", + "print \"\\n\"\n", + "for i in range(0, width):\n", + " print \"*\"," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter values for the width and height (minimum of 3): \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Width: 24\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Height: 7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "* * * * * * * * * * * * * * * * * * * * * * * * \n", + "\n", + "* *\n", + "* *\n", + "* *\n", + "* *\n", + "* *\n", + "\n", + "\n", + "* * * * * * * * * * * * * * * * * * * * * * * *\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 4.10, page no. 162" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "sum = 0\n", + "count = 0\n", + "\n", + "print \"Enter the number of integers you want to sum: \",\n", + "count = int(raw_input())\n", + " \n", + "for i in range(1, count+1):\n", + " sum = 0\n", + " for j in range(1, i+1):\n", + " sum += j\n", + " print \"%d\\t%5d\" %(i, sum)\n", + "print \"\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the number of integers you want to sum: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1\t 1\n", + "2\t 3\n", + "3\t 6\n", + "4\t 10\n", + "5\t 15\n", + "6\t 21\n", + "7\t 28\n", + "8\t 36\n", + "9\t 45\n", + "10\t 55\n", + "\n", + "\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 4.11, page no. 164" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter the number of integers you want to sum: \",\n", + "count = int(raw_input())\n", + "\n", + "for i in range(1, count+1):\n", + " sum = 1\n", + " j = 1\n", + " print \"1\",\n", + " while(j < i):\n", + " j += 1\n", + " sum += j\n", + " print \"+ %d\" % j,\n", + " print \"= %d\" % sum\n", + "print \"\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the number of integers you want to sum: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1 = 1\n", + "1 + 2 = 3\n", + "1 + 2 + 3 = 6\n", + "1 + 2 + 3 + 4 = 10\n", + "1 + 2 + 3 + 4 + 5 = 15\n", + "1 + 2 + 3 + 4 + 5 + 6 = 21\n", + "1 + 2 + 3 + 4 + 5 + 6 + 7 = 28\n", + "1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 = 36\n", + "1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 = 45\n", + "1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55\n", + "\n", + "\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 4.12, page no. 167" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "rebmun = 0\n", + "print \"\\nEnter a positive integer: \",\n", + "number = int(raw_input())\n", + "temp = number\n", + "while(temp):\n", + " rebmun = 10*rebmun + temp % 10\n", + " temp = temp/10\n", + "\n", + "print \"The number %d reversed is %d rebmun ehT\" %(number, rebmun)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter a positive integer: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The number 7 reversed is 7 rebmun ehT\n" + ] + } + ], + "prompt_number": 20 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter5-checkpoint.ipynb b/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter5-checkpoint.ipynb new file mode 100644 index 00000000..8e195f37 --- /dev/null +++ b/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter5-checkpoint.ipynb @@ -0,0 +1,1065 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:a29cdeb847e548d8c74cdb11f8f6f17380a9a763c13e45e4e17605b4ec6cf4a6" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 5: Arrays" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 5.1, page no. 186" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "count = 10\n", + "sum = 0\n", + "average = 0.0\n", + "for i in range(0, count):\n", + " print \"Enter a grade: \",\n", + " grade = int(raw_input())\n", + " sum += grade\n", + " \n", + "average = sum/count\n", + "print \"Average of the ten grades entered is: \", average" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a grade: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "58\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter a grade: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "68\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter a grade: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "79\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter a grade: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter a grade: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter a grade: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "89\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter a grade: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "90\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter a grade: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "24\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter a grade: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "68\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter a grade: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "47\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Average of the ten grades entered is: 63\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 5.2, page no. 186" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "sum = 0\n", + "average = 0.0\n", + "print \"Enter the first five grades: \"\n", + "grade0 = int(raw_input(\"grade0: \"))\n", + "grade1 = int(raw_input(\"grade1: \"))\n", + "grade2 = int(raw_input(\"grade2: \"))\n", + "grade3 = int(raw_input(\"grade3: \"))\n", + "grade4 = int(raw_input(\"grade4: \"))\n", + "\n", + "print \"Enter the last five numbers in the same manner \"\n", + "grade5 = int(raw_input(\"grade5: \"))\n", + "grade6 = int(raw_input(\"grade6: \"))\n", + "grade7 = int(raw_input(\"grade7: \"))\n", + "grade8 = int(raw_input(\"grade8: \"))\n", + "grade9 = int(raw_input(\"grade9: \"))\n", + "\n", + "sum = grade0 + grade1 + grade2 + grade3 + grade4 + grade5 + grade6 + grade7 + grade8 + grade9\n", + "average = sum/10\n", + " \n", + "print \"Average of the ten grades entered is: \", average" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the first five grades: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "grade0: 58\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "grade1: 69\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "grade2: 48\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "grade3: 473\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "grade4: 37\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the last five numbers in the same manner \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "grade5: 27\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "grade6: 95\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "grade7: 75\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "grade8: 74\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "grade9: 64\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Average of the ten grades entered is: 102\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 5.3, page no. 188" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "grades = []\n", + "count = 10\n", + "sum = 0\n", + "average = 0.0\n", + "\n", + "print \"Enter the 10 grades: \"\n", + "for i in range(0, count):\n", + " print \"%2d> \" %(i + 1),\n", + " grades.append(int(raw_input()))\n", + " sum += grades[i]\n", + "average = sum/count;\n", + "print \"Average of the ten grades entered is: \", average" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 5.4, page no. 190" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "grades = []\n", + "count = 10\n", + "sum = 0\n", + "average = 0.0\n", + "\n", + "print \"Enter the 10 grades: \"\n", + "for i in range(0, count):\n", + " print \"%2d> \" %(i + 1),\n", + " grades.append(int(raw_input()))\n", + " sum += grades[i]\n", + "average = sum/count;\n", + "for i in range(0, count):\n", + " print \"Grade Number %2d is %3d\" %(i + 1, grades[i])\n", + "print \"Average of the ten grades entered is: \", average" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the 10 grades: \n", + " 1> " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "67\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 2> " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "87\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 3> " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "89\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 4> " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "90\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 5> " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "65\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 6> " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "54\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 7> " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "43\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 8> " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "45\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 9> " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "67\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 10> " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "89\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Grade Number 1 is 67\n", + "Grade Number 2 is 87\n", + "Grade Number 3 is 89\n", + "Grade Number 4 is 90\n", + "Grade Number 5 is 65\n", + "Grade Number 6 is 54\n", + "Grade Number 7 is 43\n", + "Grade Number 8 is 45\n", + "Grade Number 9 is 67\n", + "Grade Number 10 is 89\n", + "Average of the ten grades entered is: 69\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 5.5, page no. 192" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import sys\n", + "\n", + "a = 1\n", + "b = 2\n", + "c = 3\n", + "\n", + "d = 4.0\n", + "e = 5.0\n", + "f = 6.0\n", + "print \"A variable of type integer occupies %d bytes.\" %sys.getsizeof(int)\n", + "print \"Here are the addresses of some variables of type integer:\"\n", + "print \"The address of a is: %d The address of b is: %d\" %(id(a), id(b))\n", + "print \"The address of c is: %d\" % id(c)\n", + "print \"A variable of type float occupies %d bytes.\" %sys.getsizeof(float)\n", + "print \"Here are the addresses of some variables of type float: \"\n", + "print \"The address of d is: %d The address of e is: %d\" %(id(d), id(e))\n", + "print \"The address of f is: \", id(f)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "A variable of type integer occupies 872 bytes.\n", + "Here are the addresses of some variables of type integer:\n", + "The address of a is: 21367976 The address of b is: 21367952\n", + "The address of c is: 21367928\n", + "A variable of type float occupies 872 bytes.\n", + "Here are the addresses of some variables of type float: \n", + "The address of d is: 32514136 The address of e is: 38248560\n", + "The address of f is: 38248512\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 5.6, page no. 201" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "size = [['6', '6', '6', '6', '7', '7', '7', '7', '7', '7', '7', '7'],\n", + " ['1', '5', '3', '7', ' ', '1', '1', '3', '1', '5', '3', '7'],\n", + " ['2', '8', '4', '8', ' ', '8', '4', '8', '2', '8', '4', '8']]\n", + "headsize = [164, 166, 169, 172, 175, 178, 181, 184, 188, 191, 194, 197]\n", + "hat_found = False\n", + "print \"Enter the circumference of your head above your eyebrows in inches as a decimal value: \",\n", + "cranium = float(raw_input())\n", + "your_head = int(8.0*cranium)\n", + "i = 0\n", + "if(your_head == headsize[i]):\n", + " hat_found = True\n", + "else:\n", + " for i in range(1, len(headsize)):\n", + " if(your_head > headsize[i - 1] and your_head <= headsize[i]):\n", + " hat_found = True\n", + " break\n", + "if(hat_found):\n", + " print \"Your hat size is %c %c%c%c\" %(size[0][i], size[1][i], ' ' if (size[1][i]==' ') else '/', size[2][i])\n", + "else:\n", + " if(your_head < headsize[0]):\n", + " print \"You are the proverbial pinhead. No hat for you I'm afraid.\"\n", + " else:\n", + " print \"You, in technical parlance, are a fathead, No hat for you, I'm afraid.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the circumference of your head above your eyebrows in inches as a decimal value: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "22.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Your hat size is 7 1/4\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 5.7, page no. 206" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter the number of grades: \",\n", + "nGrades = int(raw_input())\n", + "grades = []\n", + "sum = 0\n", + " \n", + "print \"Enter the %d grades: \" % nGrades\n", + "\n", + "for i in range(0, nGrades):\n", + " print \"%d> \" %(i + 1),\n", + " grades.append(int(raw_input()))\n", + " sum += grades[i]\n", + " \n", + "print \"The grades you entered are: \"\n", + "for i in range(0, nGrades):\n", + " print \"Grade[%d] = %d \" %((i + 1), grades[i]),\n", + " if((i+1) % 5 == 0):\n", + " print \"\\n\"\n", + " \n", + "average = sum/nGrades\n", + "print \"Average of the %d grades entered is: %.2f\" %(nGrades, average)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the number of grades: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the 5 grades: \n", + "1> " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "56\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 2> " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "78\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 3> " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "98\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 4> " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "65\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 5> " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "43\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The grades you entered are: \n", + "Grade[1] = 56 Grade[2] = 78 Grade[3] = 98 Grade[4] = 65 Grade[5] = 43 \n", + "\n", + "Average of the 5 grades entered is: 68.00\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 5.8, page no. 213" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "player = 0\n", + "winner = 0\n", + "choice = 0\n", + "row = 0\n", + "column = 0\n", + "board = [['1','2','3'],\n", + " ['4','5','6'],\n", + " ['7','8','9']]\n", + "\n", + "i = 0\n", + "while(i < 9 and winner == 0):\n", + " print \"\\n\"\n", + " print \" %c | %c | %c\" %(board[0][0], board[0][1], board[0][2])\n", + " print \"---+---+---\"\n", + " print \" %c | %c | %c\" %(board[1][0], board[1][1], board[1][2])\n", + " print \"---+---+---\"\n", + " print \" %c | %c | %c\" %(board[2][0], board[2][1], board[2][2])\n", + " player = i % 2 + 1\n", + " while(choice < 0 or choice > 8 or board[row][column] > '9'):\n", + " print \"Player %d, please enter a valid square number for where you want to place your %c: \" %(player,'X' if (player == 1) else 'O')\n", + " choice = int(raw_input())\n", + " choice = choice - 1\n", + " row = choice/3\n", + " column = choice % 3\n", + " board[row][column] = 'X' if (player == 1) else 'O'\n", + "\n", + " if((board[0][0]==board[1][1] and board[0][0]==board[2][2]) or (board[0][2]==board[1][1] and board[0][2]==board[2][0])):\n", + " winner = player\n", + " else:\n", + " for line in range(0, 3):\n", + " if((board[line][0] == board[line][1] and board[line][0] == board[line][2]) or (board[0][line] == board[1][line] and board[0][line] == board[2][line])):\n", + " winner = player\n", + " i += 1\n", + "\n", + "print \"\\n\"\n", + "print \" %c | %c | %c\" %(board[0][0], board[0][1], board[0][2])\n", + "print \"---+---+---\"\n", + "print \" %c | %c | %c\" %(board[1][0], board[1][1], board[1][2])\n", + "print \"---+---+---\"\n", + "print \" %c | %c | %c\" %(board[2][0], board[2][1], board[2][2])\n", + " \n", + "if(winner):\n", + " print \"Congratulations, player %d, YOU ARE THE WINNER!\" % winner\n", + "else:\n", + " print \"How boring, it is a draw\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + " 1 | 2 | 3\n", + "---+---+---\n", + " 4 | 5 | 6\n", + "---+---+---\n", + " 7 | 8 | 9\n", + "\n", + "\n", + " X | 2 | 3\n", + "---+---+---\n", + " 4 | 5 | 6\n", + "---+---+---\n", + " 7 | 8 | 9\n", + "Player 2, please enter a valid square number for where you want to place your O: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + " X | O | 3\n", + "---+---+---\n", + " 4 | 5 | 6\n", + "---+---+---\n", + " 7 | 8 | 9\n", + "Player 1, please enter a valid square number for where you want to place your X: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + " X | O | 3\n", + "---+---+---\n", + " X | 5 | 6\n", + "---+---+---\n", + " 7 | 8 | 9\n", + "Player 2, please enter a valid square number for where you want to place your O: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + " X | O | 3\n", + "---+---+---\n", + " X | 5 | 6\n", + "---+---+---\n", + " O | 8 | 9\n", + "Player 1, please enter a valid square number for where you want to place your X: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + " X | O | 3\n", + "---+---+---\n", + " X | X | 6\n", + "---+---+---\n", + " O | 8 | 9\n", + "Player 2, please enter a valid square number for where you want to place your O: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + " X | O | 3\n", + "---+---+---\n", + " X | X | 6\n", + "---+---+---\n", + " O | O | 9\n", + "Player 1, please enter a valid square number for where you want to place your X: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + " X | O | 3\n", + "---+---+---\n", + " X | X | 6\n", + "---+---+---\n", + " O | O | X\n", + "Congratulations, player 1, YOU ARE THE WINNER!\n" + ] + } + ], + "prompt_number": 2 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter6-checkpoint.ipynb b/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter6-checkpoint.ipynb new file mode 100644 index 00000000..c05d45c7 --- /dev/null +++ b/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter6-checkpoint.ipynb @@ -0,0 +1,553 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:cc6cd32b3760ef9f8d727f2cbad62d4127abffa00d3c9ad693debfc7914ad190" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 6: Applications with Strings and Text" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 6.1, page no. 221" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"The character \\\\0 is used to terminate a string.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The character \\0 is used to terminate a string.\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 6.2, page no. 223" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "str1 = \"To be or not to be\"\n", + "str2 = \",that is a question\"\n", + "\n", + "print \"Length of the string \\\"\", str1, \"\\\" is \", len(str1), \" characters\"\n", + "print \"Length of the string \\\"\", str2, \"\\\" is \", len(str2), \" characters\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Length of the string \" To be or not to be \" is 18 characters\n", + "Length of the string \" ,that is a question \" is 19 characters\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 6.3, page no. 225" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "str1 = \"Computers do what you tell them to do, not what you want them to do.\"\n", + "str2 = \"When you put something in memory, remember where you put it.\"\n", + "str3 = \"Never test for a condition you don't know what to do with.\"\n", + "\n", + "print \"There are 3 strings.\"\n", + "print \"The string: \"\n", + "print str1\n", + "print \"contains \", len(str1), \" characters\"\n", + "print \"The string: \"\n", + "print str2\n", + "print \"contains \", len(str3), \" characters\"\n", + "print \"The string: \"\n", + "print str3\n", + "print \"contains \", len(str3), \" characters\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "There are 3 strings.\n", + "The string: \n", + "Computers do what you tell them to do, not what you want them to do.\n", + "contains 68 characters\n", + "The string: \n", + "When you put something in memory, remember where you put it.\n", + "contains 58 characters\n", + "The string: \n", + "Never test for a condition you don't know what to do with.\n", + "contains 58 characters\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 6.4, page no. 230" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "preamble = \"The joke is: \"\n", + "str1 = \"My dog hasn\\'t got any nose.\\n\"\n", + "str2 = \"How does your dog smell then?\\n\"\n", + "str3 = \"My dog smells horrible.\\n\"\n", + "joke = str1 + str2 + str3\n", + "\n", + "print preamble\n", + "print joke" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The joke is: \n", + "My dog hasn't got any nose.\n", + "How does your dog smell then?\n", + "My dog smells horrible.\n", + "\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 6.5, page no. 234" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Type in the first word (maximum 20 characters): \",\n", + "word1 = raw_input()\n", + "print \"Type in the second word (maximum 20 characters): \",\n", + "word2 = raw_input()\n", + "\n", + "if(word1 == word2):\n", + " print \"You have entered identical words\"\n", + "else:\n", + " print \"%s precedes %s\\n\" %((word2 if(word1 > word2) else word1), (word1 if(word1 > word2) else word2)) " + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 6.6, page no. 240 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "str1 = \"This string contains the holy grail.\"\n", + "str2 = \"the holy grail\"\n", + "str3 = \"the holy grill\"\n", + " \n", + "if str2 in str1:\n", + " print \"\\\"%s\\\" was found in \\\"%s\\\"\\n\" %(str2, str1)\n", + "else:\n", + " print \"\\n\\\"%s\\\" was not found.\" %str2\n", + " \n", + "if not(str3 in str1):\n", + " print \"\\\"%s\\\" was not found.\\n\" % str3\n", + "else:\n", + " print \"\\nWe shouldn't get to here!\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\"the holy grail\" was found in \"This string contains the holy grail.\"\n", + "\n", + "\"the holy grill\" was not found.\n", + "\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 6.7, page no. 243" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter some prose that is less than 1000 characters (go on typing hit enter to terminate):\"\n", + "str1 = raw_input()\n", + "\n", + "if len(str1) > 1000:\n", + " print \"Maximum permitted input length exceeded.\"\n", + "\n", + "list_str1 = str1.split(\" \")\n", + "\n", + "print \"The words in the prose that you entered are: \"\n", + "\n", + "for i in range(0, len(list_str1)):\n", + " print list_str1[i], \"\\t\",\n", + " if i % 5 == 0:\n", + " print \"\\n\"\n", + "\n", + "print \"Words found \", len(list_str1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter some prose that is less than 1000 characters (go on typing hit enter to terminate):\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "y father's family name being Pirrip, and my Christian name Philip, my infant tongue could make of both names nothing longer or more explicit than Pip. So, I called myself Pip, and came to be called Pip.\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The words in the prose that you entered are: \n", + "y \t\n", + "\n", + "father's \tfamily \tname \tbeing \tPirrip, \t\n", + "\n", + "and \tmy \tChristian \tname \tPhilip, \t\n", + "\n", + "my \tinfant \ttongue \tcould \tmake \t\n", + "\n", + "of \tboth \tnames \tnothing \tlonger \t\n", + "\n", + "or \tmore \texplicit \tthan \tPip. \t\n", + "\n", + "So, \tI \tcalled \tmyself \tPip, \t\n", + "\n", + "and \tcame \tto \tbe \tcalled \t\n", + "\n", + "Pip. \tWords found 37\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 6.8, page no. 249" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "nLetters = 0\n", + "nDigits = 0\n", + "nPunct = 0\n", + "print \"Enter an interesting string of less than 100 characters: \"\n", + "str1 = raw_input()\n", + "\n", + "for char in str1:\n", + " if char.isalpha():\n", + " nLetters += 1\n", + " elif char.isdigit():\n", + " nDigits += 1\n", + " elif char == \" \":\n", + " pass\n", + " else:\n", + " nPunct += 1\n", + "\n", + "print \"Your string contained %d letters, %d digits and %d punctuation characters. \" %(nLetters, nDigits, nPunct)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter an interesting string of less than 100 characters: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "I was born on the 3rd of October 1895, which is long ago.\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Your string contained 38 letters, 5 digits and 2 punctuation characters. \n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 6.9, page no. 251" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter the string to be searched (less than 100 characters): \",\n", + "text = raw_input()\n", + " \n", + "print \"Enter the string sought (less than 40 characters):\",\n", + "substring = raw_input()\n", + " \n", + "print \"First string entered: \", text\n", + "print \"Second string entered: \", substring\n", + " \n", + "text = text.upper()\n", + "substring = substring.upper() \n", + "print \"The second string %s found in the first. \" %(\"was not\" if not substring in text else \"was\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the string to be searched (less than 100 characters): " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Cry havoc, and let slip the dogs of war.\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the string sought (less than 40 characters):" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Dogs of War\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " First string entered: Cry havoc, and let slip the dogs of war.\n", + "Second string entered: The Dogs of War\n", + "The second string was found in the first. \n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 6.10, page no. 259" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import numpy\n", + "\n", + "print \"Enter text (hit enter to exit): \",\n", + "text = raw_input()\n", + "\n", + "text_split = text.split()\n", + "distinct_words = []\n", + "\n", + "for i in text_split:\n", + " if i not in distinct_words:\n", + " distinct_words.append(i)\n", + "\n", + "word_count = numpy.zeros(len(distinct_words))\n", + "\n", + "for i in range(len(distinct_words)):\n", + " for j in range(len(text_split)):\n", + " if distinct_words[i] == text_split[j]:\n", + " word_count[i] += 1\n", + "\n", + "for i in range(len(distinct_words)):\n", + " print distinct_words[i], int(word_count[i])\n", + " if i == 5:\n", + " print \"\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter text (hit enter to exit): " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "When I makes tea I makes tea, as old mother Grogan said. And when I makes water I makes water. Begob, ma'am, says Mrs Cahill, God send you don't make them in the same pot.\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " When 1\n", + "I 4\n", + "makes 4\n", + "tea 1\n", + "tea, 1\n", + "as 1\n", + "\n", + "old 1\n", + "mother 1\n", + "Grogan 1\n", + "said. 1\n", + "And 1\n", + "when 1\n", + "water 1\n", + "water. 1\n", + "Begob, 1\n", + "ma'am, 1\n", + "says 1\n", + "Mrs 1\n", + "Cahill, 1\n", + "God 1\n", + "send 1\n", + "you 1\n", + "don't 1\n", + "make 1\n", + "them 1\n", + "in 1\n", + "the 1\n", + "same 1\n", + "pot. 1\n" + ] + } + ], + "prompt_number": 21 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter7-checkpoint.ipynb b/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter7-checkpoint.ipynb new file mode 100644 index 00000000..e46960ce --- /dev/null +++ b/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter7-checkpoint.ipynb @@ -0,0 +1,869 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:711ef8d09307cb9b16d63b16134924968e61ecb1c05fd7745b7d89ba9bc4ac32" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 7: Pointers" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 7.1, page no. 266" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import sys\n", + "\n", + "number = 10;\n", + "print \"number's address: \", id(number)\n", + "print \"number's value: \", number\n", + " \n", + "pnumber = id(number)\n", + "print \"pnumber's address: \", id(pnumber)\n", + "print \"pnumber's size: %d bytes\" %(sys.getsizeof(pnumber))\n", + "print \"pnumber's value: \", pnumber\n", + "print \"value pointed to: \", number" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "number's address: 42843088\n", + "number's value: 10\n", + "pnumber's address: 54575640\n", + "pnumber's size: 24 bytes\n", + "pnumber's value: 42843088\n", + "value pointed to: 10\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 7.2, page no. 270" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "num1 = 0\n", + "num2 = 0\n", + "pnum = None\n", + " \n", + "pnum = id(num1)\n", + "num1 = 2\n", + "num2 += 1\n", + "num2 += num1\n", + "pnum = id(num2)\n", + "num2 += 1\n", + "print \"num1 = %d num2 = %d pnum = %d pnum + num2 = %d\" %(num1, num2, pnum, pnum + num2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "num1 = 2 num2 = 4 pnum = 42843256 pnum + num2 = 42843260\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 7.3, page no. 272" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Input an integer: \",\n", + "value = int(raw_input())\n", + "print \"You entered: \", value" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Input an integer: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " You entered: 7\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 7.4, page no. 276" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "multiple = ['M', 'y','s','t', 'r', 'i', 'n', 'g']\n", + " \n", + "p = id(multiple[0])\n", + "print \"The address of the first array element : \", p\n", + "p = id(multiple)\n", + "print \"The address obtained from the array name: \", p" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The address of the first array element : 140170253709440\n", + "The address obtained from the array name: 58009432\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 7.5, page no. 277" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "multiple = \"a string\"\n", + "p = multiple\n", + " \n", + "for i in range(len(multiple)):\n", + " print \"multiple[%d] = %c *(p+%d) = %c id(multiple[%d]) = %d p+%d = %d \" %(i, multiple[i], i, p[i], i, id(multiple[i]), i, id(p[i]))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "multiple[0] = a *(p+0) = a id(multiple[0]) = 140170254071168 p+0 = 140170254071168 \n", + "multiple[1] = *(p+1) = id(multiple[1]) = 140170254278248 p+1 = 140170254278248 \n", + "multiple[2] = s *(p+2) = s id(multiple[2]) = 140170254071048 p+2 = 140170254071048 \n", + "multiple[3] = t *(p+3) = t id(multiple[3]) = 140170254070208 p+3 = 140170254070208 \n", + "multiple[4] = r *(p+4) = r id(multiple[4]) = 140170254275768 p+4 = 140170254275768 \n", + "multiple[5] = i *(p+5) = i id(multiple[5]) = 140170254277248 p+5 = 140170254277248 \n", + "multiple[6] = n *(p+6) = n id(multiple[6]) = 140170254276568 p+6 = 140170254276568 \n", + "multiple[7] = g *(p+7) = g id(multiple[7]) = 140170254073528 p+7 = 140170254073528 \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 7.6, page no. 277" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import sys\n", + "\n", + "multiple = [15, 25, 35, 45]\n", + "p = multiple\n", + " \n", + "for i in range(sys.getsizeof(multiple)/sys.getsizeof(multiple[0])):\n", + " print \"address p+%d (id(multiple[%d])): %d *(p+%d) value: %d\" %( i, i, id(p[i]), i, p[i])\n", + " \n", + "print \"Type integer occupies: %d bytes\" %sys.getsizeof(int())" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "address p+0 (id(multiple[0])): 42842968 *(p+0) value: 15\n", + "address p+1 (id(multiple[1])): 42842728 *(p+1) value: 25\n", + "address p+2 (id(multiple[2])): 42842488 *(p+2) value: 35\n", + "address p+3 (id(multiple[3])): 42844240 *(p+3) value: 45\n", + "Type integer occupies: 24 bytes\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 7.7, page no. 279" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "board = [['1','2','3'],\n", + " ['4','5','6'],\n", + " ['7','8','9']]\n", + "print \"address of board : \", id(board)\n", + "print \"address of board[0][0] : \", id(board[0][0])\n", + "print \"value of board[0]: \", board[0]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "address of board : 58026608\n", + "address of board[0][0] : 140170254070808\n", + "value of board[0]: ['1', '2', '3']\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 7.7A, page no. 280" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "board = [['1','2','3'],\n", + " ['4','5','6'],\n", + " ['7','8','9']]\n", + " \n", + "print \"value of board[0][0] : %c\" % (board[0][0])\n", + "print \"value of board[0]: \", board[0][0]\n", + "print \"value of **board: \", board[0][0]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "value of board[0][0] : 1\n", + "value of board[0]: 1\n", + "value of **board: 1\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 7.8, page no. 281" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "board = [['1','2','3'],\n", + " ['4','5','6'],\n", + " ['7','8','9']]\n", + "\n", + "for i in range(3):\n", + " for j in range(3):\n", + " print \" board: \", board[i][j]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " board: 1\n", + " board: 2\n", + " board: 3\n", + " board: 4\n", + " board: 5\n", + " board: 6\n", + " board: 7\n", + " board: 8\n", + " board: 9\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + " Program 7.9, page no. 283" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "board = [['1','2','3'],\n", + " ['4','5','6'],\n", + " ['7','8','9']]\n", + "\n", + "for i in range(3):\n", + " for j in range(3):\n", + " print \" board: \", board[i][j]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " board: 1\n", + " board: 2\n", + " board: 3\n", + " board: 4\n", + " board: 5\n", + " board: 6\n", + " board: 7\n", + " board: 8\n", + " board: 9\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 7.10, page no. 285" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "size = [['6', '6', '6', '6', '7', '7', '7', '7', '7', '7', '7', '7'],\n", + " ['1', '5', '3', '7', ' ', '1', '1', '3', '1', '5', '3', '7'],\n", + " ['2', '8', '4', '8', ' ', '8', '4', '8', '2', '8', '4', '8']]\n", + "headsize = [164, 166, 169, 172, 175, 178, 181, 184, 188, 191, 194, 197]\n", + "hat_found = False\n", + "print \"Enter the circumference of your head above your eyebrows in inches as a decimal value: \",\n", + "cranium = float(raw_input())\n", + "your_head = int(8.0*cranium)\n", + "i = 0\n", + "if(your_head == headsize[i]):\n", + " hat_found = True\n", + "else:\n", + " for i in range(1, len(headsize)):\n", + " if(your_head > headsize[i - 1] and your_head <= headsize[i]):\n", + " hat_found = True\n", + " break\n", + "if(hat_found):\n", + " print \"Your hat size is %c %c%c%c\" %(size[0][i], size[1][i], ' ' if (size[1][i]==' ') else '/', size[2][i])\n", + "else:\n", + " if(your_head < headsize[0]):\n", + " print \"You are the proverbial pinhead. No hat for you I'm afraid.\"\n", + " else:\n", + " print \"You, in technical parlance, are a fathead, No hat for you, I'm afraid.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the circumference of your head above your eyebrows in inches as a decimal value: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "22.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Your hat size is 7 1/4\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 7.11, page no. 290" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "pPrimes = []\n", + "found = False\n", + " \n", + "print \"How many primes would you like - you'll get at least 4? \",\n", + "total = int(raw_input())\n", + "total = 4 if total < 4 else total\n", + " \n", + "pPrimes.append(2) # First prime\n", + "pPrimes.append(3) # Second prime\n", + "pPrimes.append(5) # Third prime\n", + "count = 3\n", + "trial = 5\n", + " \n", + "while(count < total):\n", + " trial += 2\n", + " for i in range(1, count):\n", + " if((trial % pPrimes[i]) == 0):\n", + " found = False\n", + " break\n", + " else:\n", + " found = True\n", + " if(found):\n", + " pPrimes.append(trial)\n", + " count += 1\n", + "\n", + "for i in range(total):\n", + " print \"\\t\", pPrimes[i],\n", + " if(not((i+1) % 5)):\n", + " print \"\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many primes would you like - you'll get at least 4? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "25\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \t2 \t3 \t5 \t7 \t11 \n", + "\t13 \t17 \t19 \t23 \t29 \n", + "\t31 \t37 \t41 \t43 \t47 \n", + "\t53 \t59 \t61 \t67 \t71 \n", + "\t73 \t79 \t83 \t89 \t97 \n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 7.13, page no. 300" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import sys\n", + "\n", + "print \"Enter text on an arbitrary number of lines (go on typing hit enter to terminate): \"\n", + "print \"Should be less than 10000 characters: \"\n", + "text = raw_input()\n", + "\n", + "if len(text) > 10000:\n", + " print \"Maximum length exceeded, terminating...\"\n", + " sys.exit()\n", + "\n", + "distinct_words = []\n", + "word_occurrance = []\n", + "list_text = text.split(\" \")\n", + "for word in list_text:\n", + " if not word in distinct_words:\n", + " distinct_words.append(word)\n", + " word_occurrance.append(0)\n", + " \n", + "for i in range(len(list_text)):\n", + " if list_text[i] in distinct_words:\n", + " index = distinct_words.index(list_text[i])\n", + " word_occurrance[index] += 1\n", + "\n", + "for i in range(len(distinct_words)):\n", + " if(i % 5 == 0):\n", + " print \"\\n\"\n", + " print distinct_words[i], \"\\t \", word_occurrance[i]," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter text on an arbitrary number of lines (go on typing hit enter to terminate): \n", + "Should be less than 10000 characters: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Peter Piper picked a peck of pickled pepper. A peck of pickled pepper Peter Piper picked. If Peter Piper picked a peck of pickled pepper, Where's the peck of pickled pepper Peter Piper picked?\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + "Peter \t 4 Piper \t 4 picked \t 2 a \t 2 peck \t 4 \n", + "\n", + "of \t 4 pickled \t 4 pepper. \t 1 A \t 1 pepper \t 2 \n", + "\n", + "picked. \t 1 If \t 1 pepper, \t 1 Where's \t 1 the \t 1 \n", + "\n", + "picked? \t 1\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 7.14, page no. 306" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter strings to be sorted, separated by '.' Press Enter to end: \"\n", + "text = raw_input()\n", + "\n", + "dot_separated = text.split('.')\n", + "text_sorted = sorted(dot_separated)\n", + "\n", + "for str in text_sorted:\n", + " print str" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter strings to be sorted, separated by '.' Press Enter to end: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Many a mickle makes a muckle. A fool and your money are soon partners. Every dog has his day. Do unto others before they do it to you. A nod is as good as a wink to a blind horse. The bigger they are, the harder they hit. Least said, soonest mended.\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " A fool and your money are soon partners\n", + " A nod is as good as a wink to a blind horse\n", + " Do unto others before they do it to you\n", + " Every dog has his day\n", + " Least said, soonest mended\n", + " The bigger they are, the harder they hit\n", + "Many a mickle makes a muckle\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 7.15, page no. 316" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"To use this calculator, enter any expression with or without spaces.\"\n", + "print \"An expression may include the operators\"\n", + "print \" +, -, *, /, %, or **(raise to a power).\"\n", + "print \"Use = at the beginning of a line to operate on \"\n", + "print \"the result of the previous calculation.\"\n", + "print \"Enter quit to stop the calculator.\"\n", + "\n", + "result = 0\n", + "while True:\n", + " e = raw_input()\n", + " if e == 'quit':\n", + " break\n", + " else:\n", + " try:\n", + " result = eval(str(result) + e)\n", + " print \"= \",result\n", + " except ZeroDivisionError:\n", + " print \"Division by zero\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "To use this calculator, enter any expression with or without spaces.\n", + "An expression may include the operators\n", + " +, -, *, /, %, or **(raise to a power).\n", + "Use = at the beginning of a line to operate on \n", + "the result of the previous calculation.\n", + "Enter quit to stop the calculator.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7/8\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "= 0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "/0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Division by zero\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "+3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "= 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "/2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "= 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "**5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "= 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "+8\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "= 9\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "*2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "= 18\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "quit\n" + ] + } + ], + "prompt_number": 2 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter8-checkpoint.ipynb b/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter8-checkpoint.ipynb new file mode 100644 index 00000000..54da74de --- /dev/null +++ b/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter8-checkpoint.ipynb @@ -0,0 +1,346 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:9c1a031463da8a03e6f56a08f572c87969b01883476b123f1b468e43c2cd2b66" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 8: Structuring Your Programs" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 8.1, page no. 323" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "count1 = 1\n", + "\n", + "while(count1<=5):\n", + " count1 += 1\n", + " count2 = 0\n", + " count2 += 1\n", + " print \"count1 = %d count2 = %d \" %(count1, count2)\n", + " \n", + "print \"count1 = %d\\n\" %count1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "count1 = 2 count2 = 1 \n", + "count1 = 3 count2 = 1 \n", + "count1 = 4 count2 = 1 \n", + "count1 = 5 count2 = 1 \n", + "count1 = 6 count2 = 1 \n", + "count1 = 6\n", + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 8.2, page no. 324" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "count = 0\n", + "while(count<=5):\n", + " count += 1\n", + " print \"count = \", count\n", + " \n", + "print \"count = \", count" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "count = 1\n", + "count = 2\n", + "count = 3\n", + "count = 4\n", + "count = 5\n", + "count = 6\n", + "count = 6\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 8.3, page no. 330" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def Sum(x, n):\n", + " sum = 0.0\n", + " for i in range(n):\n", + " sum += x[i]\n", + " return sum\n", + " \n", + "def Average(x, n):\n", + " return Sum(x, n)/n\n", + "\n", + "def GetData(data, t):\n", + " print \"How many values do you want to enter (Maximum 50)? \"\n", + " nValues = int(raw_input())\n", + " if(nValues > 50):\n", + " print \"Maximum count exceeded. 50 items will be read.\"\n", + " nValues = 50\n", + " for i in range(nValues):\n", + " data.append(float(raw_input()))\n", + " return nValues\n", + " \n", + "samples = []\n", + "sampleCount = GetData(samples, 50);\n", + "average = Average(samples, sampleCount);\n", + "print \"The average of the values you entered is: \", average" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many values do you want to enter (Maximum 50)? \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1.0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2.0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3.0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4.0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5.0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The average of the values you entered is: 3.0\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 8.4, page no. 339" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def sort_string(text):\n", + " dot_separated = text.split('.')\n", + " text_sorted = sorted(dot_separated)\n", + " return text_sorted\n", + "\n", + "\n", + "print \"Enter strings to be sorted, separated by '.' Press Enter to end: \"\n", + "text = raw_input()\n", + "\n", + "sorted_text = sort_string(text)\n", + "\n", + "for str in sorted_text:\n", + " print str" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter strings to be sorted, separated by '.' Press Enter to end: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sample strings. These are samples. Another Sample\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Another Sample\n", + " These are samples\n", + "Sample strings\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 8.5, page no. 344" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def IncomePlus(pPay):\n", + " pPay += 10000\n", + " return pPay\n", + "\n", + "your_pay = 30000\n", + "pold_pay = your_pay\n", + "pnew_pay = IncomePlus(pold_pay)\n", + "print \"Old pay = $\", pold_pay\n", + "print \"New pay = $\", pnew_pay" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Old pay = $ 30000\n", + "New pay = $ 40000\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 8.6, page no. 345" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def IncomePlus(pPay):\n", + " pPay += 10000\n", + " return id(pPay)\n", + "\n", + "your_pay = 30000\n", + "pold_pay = your_pay\n", + "pnew_pay = IncomePlus(pold_pay)\n", + "print \"Old pay = $\", pold_pay\n", + "print \"New pay = $\", pnew_pay" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Old pay = $ 30000\n", + "New pay = $ 38417016\n" + ] + } + ], + "prompt_number": 6 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter9-checkpoint.ipynb b/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter9-checkpoint.ipynb new file mode 100644 index 00000000..6b5e2864 --- /dev/null +++ b/Beginning_C_By_Ivon_Horton/.ipynb_checkpoints/chapter9-checkpoint.ipynb @@ -0,0 +1,805 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:6ada72776bf91dd75540d29fecfeda6a5cab8bde3c866cd455973111367e4933" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Chapter 9: More on Functions" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 9.1, page no. 351" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def sum(x, y):\n", + " return x + y\n", + " \n", + "def product(x, y):\n", + " return x * y\n", + " \n", + "def difference(x, y):\n", + " return x - y\n", + "\n", + "a = 10\n", + "b = 5\n", + "pfun = sum # points to sum() \n", + "result = pfun(a, b)\n", + "print \"pfun = sum result = \", result\n", + "pfun = product # points to product()\n", + "result = pfun(a, b)\n", + "print \"pfun = product result = \", result\n", + "pfun = difference # points to difference()\n", + "result = pfun(a, b)\n", + "print \"pfun = difference result = \", result" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "pfun = sum result = 15\n", + "pfun = product result = 50\n", + "pfun = difference result = 5\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 9.2, page no. 353" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def sum(x, y):\n", + " return x + y\n", + " \n", + "def product(x, y):\n", + " return x * y\n", + " \n", + "def difference(x, y):\n", + " return x - y\n", + "\n", + "a = 10\n", + "b = 5\n", + "result = 0\n", + "pfun = []\n", + "pfun.append(sum)\n", + "pfun.append(product)\n", + "pfun.append(difference)\n", + "\n", + "for i in range(3):\n", + " result = pfun[i](a, b)\n", + " print \"result = \", result\n", + "\n", + "result = pfun[1](pfun[0](a, b), pfun[2](a, b))\n", + "print \"The product of the sum and the difference = \", result" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "result = 15\n", + "result = 50\n", + "result = 5\n", + "The product of the sum and the difference = 75\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 9.3, page no. 356" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def sum(x, y):\n", + " return x + y\n", + " \n", + "def product(x, y):\n", + " return x * y\n", + " \n", + "def difference(x, y):\n", + " return x - y\n", + " \n", + "def any_function(pfun , x, y):\n", + " return pfun(x, y);\n", + "\n", + "a = 10\n", + "b = 5\n", + "pf = sum\n", + "result = any_function(pf, a, b)\n", + "print \"result = \", result\n", + "result = any_function(product, a, b)\n", + "print \"result = \", result\n", + "print \"result = \", any_function(difference, a, b)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "result = 15\n", + "result = 50\n", + "result = 5\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 9.4, page no. 359" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def test1():\n", + " count = 0\n", + " count += 1\n", + " print \"test1 count = \", count\n", + "\n", + "def test2():\n", + " count = 0\n", + " count += 1\n", + " print \"test2 count = \", count\n", + "\n", + "for i in range(5):\n", + " test1()\n", + " test2()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "test1 count = 1\n", + "test2 count = 1\n", + "test1 count = 1\n", + "test2 count = 1\n", + "test1 count = 1\n", + "test2 count = 1\n", + "test1 count = 1\n", + "test2 count = 1\n", + "test1 count = 1\n", + "test2 count = 1\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 9.5, page no. 361" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "count = 0\n", + "\n", + "def test1():\n", + " global count\n", + " count += 1\n", + " print \"test1 count = \", count\n", + "\n", + "def test2():\n", + " count = 0\n", + " count += 1\n", + " print \"test2 count = \", count\n", + "\n", + "for i in range(5):\n", + " test1()\n", + " test2()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "test1 count = 1\n", + "test2 count = 1\n", + "test1 count = 2\n", + "test2 count = 1\n", + "test1 count = 3\n", + "test2 count = 1\n", + "test1 count = 4\n", + "test2 count = 1\n", + "test1 count = 5\n", + "test2 count = 1\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 9.6, page no. 364" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def factorial(n):\n", + " if(n < 2):\n", + " return n\n", + " return n*factorial(n - 1)\n", + " \n", + "print \"Enter an integer value: \",\n", + "number = int(raw_input())\n", + "print \"The factorial of %d is %d \"% (number, factorial(number))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter an integer value: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The factorial of 5 is 120 \n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 9.7, page no. 368" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def average(*arg):\n", + " sum = arg[0] + arg[1]\n", + " count = 2\n", + " for i in arg:\n", + " count += 1\n", + " sum += i\n", + " average = sum/count\n", + " return average\n", + " \n", + "v1 = 10.5\n", + "v2 = 2.5\n", + "num1 = 6\n", + "num2 = 5\n", + "num3 = 12\n", + "num4 = 20\n", + "print \"Average = %.2f \" %(average(v1, 3.5, v2, 4.5, 0.0))\n", + "print \"Average = %.2f \" %(average(1.0, 2.0, 0.0))\n", + "print \"Average = %.2f \" %(average(num2, v2, num1, num4, num3, 0.0))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Average = 5.00 \n", + "Average = 1.20 \n", + "Average = 6.62 \n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 9.8, page no. 370" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import sys\n", + "\n", + "print \"Program name: \", sys.argv[0]\n", + "for i in range(1, len(sys.argv)):\n", + " print \"Argument %d: %s \"%(i, sys.argv[i])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Program name: -c\n", + "Argument 1: -f \n", + "Argument 2: /tmp/tmpL28uUI/profile_default/security/kernel-d2752270-d981-4bb2-b2bc-3d505dfa3dd5.json \n", + "Argument 3: --IPKernelApp.parent_appname='ipython-notebook' \n", + "Argument 4: --profile-dir \n", + "Argument 5: /tmp/tmpL28uUI/profile_default \n", + "Argument 6: --parent=1 \n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Program 9.9, page no. 377" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "SIZE = 6\n", + "comp_c = '@'\n", + "player_c = '0'\n", + "board = [[0, 0, 0, 0, 0, 0],\n", + " [0, 0, 0, 0, 0, 0],\n", + " [0, 0, 0, 0, 0, 0],\n", + " [0, 0, 0, 0, 0, 0],\n", + " [0, 0, 0, 0, 0, 0],\n", + " [0, 0, 0, 0, 0, 0]]\n", + "\n", + "moves = [[False, False, False, False, False, False],\n", + " [False, False, False, False, False, False],\n", + " [False, False, False, False, False, False],\n", + " [False, False, False, False, False, False],\n", + " [False, False, False, False, False, False],\n", + " [False, False, False, False, False, False]]\n", + "no_of_moves = 0\n", + "invalid_moves = 0\n", + "again = 0\n", + "next_player = True\n", + "\n", + "def get_score(board, player):\n", + " global comp_c\n", + " global player_c\n", + " return player_counters(board, player) - player_counters(board, (comp_c if player == player_c else player_c)) \n", + " \n", + "def player_counters(board,player):\n", + " count = 0;\n", + " for row in range(SIZE):\n", + " for col in range(SIZE):\n", + " if(board[row][col] == player):\n", + " count += 1\n", + " return count;\n", + "\n", + "def computer_move(board,moves, player):\n", + " best_row = 0;\n", + " best_col = 0;\n", + " new_score = 0;\n", + " score = SIZE*SIZE;\n", + " temp_board = []\n", + " temp_moves = []\n", + " for i in range(SIZE):\n", + " a = []\n", + " b = []\n", + " for j in range(SIZE):\n", + " a.append(0)\n", + " b.append(False)\n", + " temp_board.append(a)\n", + " temp_moves.append(b) \n", + " opponent = comp_c if (player == player_c) else player_c\n", + " for row in range(SIZE):\n", + " for col in range(SIZE):\n", + " if(not moves[row][col]):\n", + " continue;\n", + " temp_board = board\n", + " make_move(temp_board, row, col, player);\n", + " valid_moves(temp_board, temp_moves, opponent);\n", + " new_score = best_move(temp_board, temp_moves, opponent);\n", + " if(new_score < score):\n", + " score = new_score;\n", + " best_row = row;\n", + " best_col = col;\n", + " make_move(board, best_row, best_col, player);\n", + "\n", + " \n", + "def best_move(board, moves, player):\n", + " new_board = []\n", + " for i in range(SIZE):\n", + " a = []\n", + " for j in range(SIZE):\n", + " a.append(0)\n", + " new_board.append(a)\n", + " score = 0;\n", + " new_score = 0;\n", + "\n", + " for row in range(SIZE):\n", + " for col in range(SIZE):\n", + " if(not moves[row][col]):\n", + " continue;\n", + " new_board = board\n", + " make_move(new_board, row, col, player);\n", + " new_score = get_score(new_board, player);\n", + " if(score < new_score):\n", + " score = new_score;\n", + " return score;\n", + "\n", + "\n", + "def make_move(board,row,col,player):\n", + " rowdelta = 0;\n", + " coldelta = 0;\n", + " x = 0;\n", + " y = 0;\n", + " if player == player_c:\n", + " opponent = comp_c\n", + " else:\n", + " opponent = player_c \n", + " \n", + " board[row][col] = player\n", + " for rowdelta in range(-1,2):\n", + " for coldelta in range(-1,2):\n", + " if((row == 0 and rowdelta == -1) or row + rowdelta >= SIZE or(col == 0 and coldelta == -1) or col + coldelta >= SIZE or\n", + "(rowdelta == 0 and coldelta == 0)):\n", + " continue;\n", + "\n", + " if(board[row + rowdelta][col + coldelta] == opponent):\n", + " x = row + rowdelta;\n", + " y = col + coldelta;\n", + " \n", + " while True:\n", + " x += rowdelta;\n", + " y += coldelta;\n", + " if(x >= SIZE or y >= SIZE or board[x][y] == ' '):\n", + " break;\n", + " if(board[x][y] == player):\n", + " x -= rowdelta\n", + " y -= coldelta\n", + " while(board[x][y] == opponent):\n", + " board[x][y] = player;\n", + " x -= rowdelta\n", + " y -= coldelta\n", + " \n", + " break;\n", + "\n", + "def reset_board(board):\n", + " global SIZE\n", + " global player_c\n", + " global comp_c\n", + " for row in range(SIZE):\n", + " for col in range(SIZE):\n", + " board[row][col] = ' '\n", + " \n", + " mid = SIZE/2\n", + " board[mid][mid] = player_c\n", + " board[mid-1][mid-1] = board[mid][mid]\n", + " board[mid][mid - 1] = comp_c\n", + " board[mid-1][mid] = board[mid][mid - 1]\n", + "\n", + "def display(board):\n", + " col_label = 'a'\n", + " print \"\"\n", + " for col in range(SIZE):\n", + " print \"%c\" %((chr(ord(col_label) + col))),\n", + " print \"\"\n", + " for row in range(SIZE):\n", + " print \" +\",\n", + " for col in range(SIZE):\n", + " print \"---+\",\n", + " print \"\\n%2d|\" %(row + 1)\n", + " \n", + " for col in range(SIZE):\n", + " print \" %c |\" %(board[row][col]),\n", + " print \"\"\n", + " print \" +\"\n", + " for col in range(SIZE):\n", + " print \"---+\",\n", + " print \"\"\n", + "\n", + "def valid_moves(board, moves, player):\n", + " global SIZE\n", + " global player_c\n", + " global comp_c\n", + " rowdelta = 0\n", + " coldelta = 0\n", + " x = 0\n", + " y = 0\n", + " global no_of_moves\n", + " opponent = comp_c if (player == player_c) else player_c\n", + " for row in range(SIZE):\n", + " for col in range(SIZE):\n", + " moves[row][col] = False\n", + " for row in range(SIZE):\n", + " for col in range(SIZE):\n", + " if(board[row][col] != ' '):\n", + " continue\n", + " for rowdelta in range(-1, rowdelta+1):\n", + " for coldelta in range(-1, coldelta+1):\n", + " if((row == 0 and rowdelta == -1) or row + rowdelta >= SIZE or (col == 0 and coldelta == -1) or col + coldelta >= SIZE or (rowdelta == 0 and coldelta == 0)):\n", + " continue\n", + " if(board[row + rowdelta][col + coldelta] == opponent):\n", + " x = row + rowdelta\n", + " y = col + coldelta \n", + " while(True):\n", + " x += rowdelta\n", + " y += coldelta\n", + " if(x < 0 or x >= SIZE or y < 0 or y >= SIZE or board[x][y] == ' '):\n", + " break\n", + " if(board[x][y] == player):\n", + " moves[row][col] = True\n", + " no_of_moves += 1\n", + " break\n", + " return no_of_moves\n", + "\n", + " \n", + "print \"REVERSI\"\n", + "print \"You can go first on the first game, then we will take turns.\"\n", + "print \"You will be white - (%c)\\nI will be black - (%c). \" %(player_c, comp_c)\n", + "print \"Select a square for your move by typing a digit for the row and a letter for the column with no spaces between.\"\n", + "print \"Good luck! Press Enter to start.\"\n", + "raw_input()\n", + "while(True):\n", + " reset_board(board)\n", + " next_player = not(next_player)\n", + " no_of_moves = 4\n", + " while(True):\n", + " display(board)\n", + " next_player = not next_player\n", + " if(True == next_player):\n", + " if(valid_moves(board, moves, player_c)):\n", + " while(True):\n", + " print \"Please enter your move (row column - no space): \",\n", + " x = int(raw_input(\"row: \"))\n", + " y = raw_input(\"col: \")\n", + " y = ord(chr(ord(y.lower()) - ord('a')))\n", + " x -= 1\n", + " if(y < 0 or y >= SIZE or x >= SIZE or (not moves[x][y])):\n", + " print \"Not a valid move, try again.\\n\"\n", + " continue\n", + " make_move(board, x, y, player_c)\n", + " no_of_moves += 1\n", + " break\n", + " else:\n", + " invalid_moves += 1\n", + " if(invalid_moves < 2):\n", + " print \"You have to pass, press return\",\n", + " again = raw_input()\n", + " else:\n", + " print \"\\nNeither of us can go, so the game is over. \"\n", + " else:\n", + " if(valid_moves(board, moves, comp_c)):\n", + " invalid_moves = 0\n", + " computer_move(board, moves, comp_c)\n", + " no_of_moves += 1\n", + " else:\n", + " invalid_moves += 1\n", + " if(invalid_moves < 2):\n", + " print \"I have to pass, your go \"\n", + " else:\n", + " print \"Neither of us can go, so the game is over.\",\n", + " display(board)\n", + " print \"The final score is: \"\n", + " print \"Computer %d User %d \" %(player_counters(board, comp_c), player_counters(board, player_c))\n", + "\n", + " print \"Do you want to play again (y/n): \", \n", + " again = raw_input()\n", + " if again == 'y':\n", + " continue;\n", + " else:\n", + " break \n", + " if (no_of_moves < SIZE*SIZE and invalid_moves < 2):\n", + " continue\n", + " else:\n", + " break\n", + " if again == 'n':\n", + " break\n", + "print \"\\nGoodbye\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "REVERSI\n", + "You can go first on the first game, then we will take turns.\n", + "You will be white - (0)\n", + "I will be black - (@). \n", + "Select a square for your move by typing a digit for the row and a letter for the column with no spaces between.\n", + "Good luck! Press Enter to start.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "a b c d e f \n", + " + ---+ ---+ ---+ ---+ ---+ ---+ \n", + " 1|\n", + " | | | | | | \n", + " + ---+ ---+ ---+ ---+ ---+ ---+ \n", + " 2|\n", + " | | | | | | \n", + " + ---+ ---+ ---+ ---+ ---+ ---+ \n", + " 3|\n", + " | | 0 | @ | | | \n", + " + ---+ ---+ ---+ ---+ ---+ ---+ \n", + " 4|\n", + " | | @ | 0 | | | \n", + " + ---+ ---+ ---+ ---+ ---+ ---+ \n", + " 5|\n", + " | | | | | | \n", + " + ---+ ---+ ---+ ---+ ---+ ---+ \n", + " 6|\n", + " | | | | | | \n", + " +\n", + "---+ ---+ ---+ ---+ ---+ ---+ \n", + "Please enter your move (row column - no space): " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "row: 3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "col: e\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + "a b c d e f \n", + " + ---+ ---+ ---+ ---+ ---+ ---+ \n", + " 1|\n", + " | | | | | | \n", + " + ---+ ---+ ---+ ---+ ---+ ---+ \n", + " 2|\n", + " | | | | | | \n", + " + ---+ ---+ ---+ ---+ ---+ ---+ \n", + " 3|\n", + " | | 0 | 0 | 0 | | \n", + " + ---+ ---+ ---+ ---+ ---+ ---+ \n", + " 4|\n", + " | | @ | 0 | | | \n", + " + ---+ ---+ ---+ ---+ ---+ ---+ \n", + " 5|\n", + " | | | | | | \n", + " + ---+ ---+ ---+ ---+ ---+ ---+ \n", + " 6|\n", + " | | | | | | \n", + " +\n", + "---+ ---+ ---+ ---+ ---+ ---+ \n", + "The final score is: \n", + "Computer 1 User 4 \n", + "Do you want to play again (y/n): " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "n\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + "Goodbye\n", + "\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter1-checkpoint.ipynb b/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter1-checkpoint.ipynb new file mode 100644 index 00000000..48ad3225 --- /dev/null +++ b/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter1-checkpoint.ipynb @@ -0,0 +1,52 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:e4a8e7d7f68c55157338101fb923c578a4287a391df7f630ea67b43d6c59bd53" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 1 - How a C++ Program Works" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 1.1, page no. 20" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Hello World!\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello World!\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter10-checkpoint.ipynb b/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter10-checkpoint.ipynb new file mode 100644 index 00000000..7fcd3612 --- /dev/null +++ b/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter10-checkpoint.ipynb @@ -0,0 +1,1236 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:ffbb5815913062b1375d894b2fe1e26db393d3f99c982f5934f82d0355e05d2e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 10 - Arrays" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 10.1, page no. 206" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "testScore = [] #array defined" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 10.2, page no. 206" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter the number of test scores:\",\n", + "numTests = int(raw_input())\n", + "testScore = [numTests]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the number of test scores:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "67\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 10.3, page no. 207" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "numTests = 3\n", + "print \"Enter the number of test scores:\",\n", + "numTests = int(raw_input())\n", + "testScore = [numTests]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the number of test scores:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "67\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 10.4, page no. 208" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "numTests = 3\n", + "print \"Enter the number of test scores:\",\n", + "num = int(raw_input())\n", + "numTests = num\n", + "testScore = [numTests]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the number of test scores:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "78\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 10.5, page no. 213" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "name = ['J', 'e', 'f', 'f', '\\0']\n", + "print name" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "['J', 'e', 'f', 'f', '\\x00']\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 10.5, page no. 213" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "name = ['J', 'e', 'f', 'f']\n", + "print name" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "['J', 'e', 'f', 'f']\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 10.7, page no. 216" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "testScore = []\n", + "print \"Enter test score #1: \",\n", + "testScore.append(int(raw_input()))\n", + "print \"Enter test score #2: \",\n", + "testScore.append(int(raw_input()))\n", + "print \"Enter test score #3: \",\n", + "testScore.append(int(raw_input()))\n", + "print \"Test score #1: \", testScore[0]\n", + "print \"Test score #2: \", testScore[1]\n", + "print \"Test score #3: \", testScore[2]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter test score #1: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "78\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter test score #2: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "88\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter test score #3: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "65\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Test score #1: 78\n", + "Test score #2: 88\n", + "Test score #3: 65\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 10.8, page no. 216" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "print \"Enter test score #1: \",\n", + "testScore1 = int(raw_input())\n", + "print \"Enter test score #2: \",\n", + "testScore2 = int(raw_input())\n", + "print \"Enter test score #3: \",\n", + "testScore3 = int(raw_input())\n", + "print \"Test score #1: \", testScore1\n", + "print \"Test score #2: \", testScore2\n", + "print \"Test score #3: \", testScore3" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter test score #1: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "65\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter test score #2: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "67\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter test score #3: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "88\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Test score #1: 65\n", + "Test score #2: 67\n", + "Test score #3: 88\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 10.9, page no. 217" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "testScore = []\n", + "for i in range(3):\n", + " print \"Enter testScore #\", i+1, \": \",\n", + " testScore.append(int(raw_input()))\n", + "\n", + "for i in range(3):\n", + " print \"Test Score #\", i+1, \": \", testScore[i]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter testScore # 1 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter testScore # 2 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter testScore # 3 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Test Score # 1 : 3\n", + "Test Score # 2 : 4\n", + "Test Score # 3 : 5\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 10.10, page no. 217" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "MAX = 3\n", + "\n", + "testScore = []\n", + "for i in range(MAX):\n", + " print \"Enter testScore #\", i+1, \": \",\n", + " testScore.append(int(raw_input()))\n", + "\n", + "for i in range(MAX):\n", + " print \"Test Score #\", i+1, \": \", testScore[i]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter testScore # 1 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter testScore # 2 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter testScore # 3 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Test Score # 1 : 5\n", + "Test Score # 2 : 6\n", + "Test Score # 3 : 7\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 10.11, page no. 218" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "MAX = 3\n", + "\n", + "testScore = []\n", + "for i in range(MAX+1):\n", + " print \"Enter testScore #\", i+1, \": \",\n", + " testScore.append(int(raw_input()))\n", + "\n", + "for i in range(MAX+1):\n", + " print \"Test Score #\", i+1, \": \", testScore[i]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter testScore # 1 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter testScore # 2 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter testScore # 3 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter testScore # 4 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Test Score # 1 : 4\n", + "Test Score # 2 : 5\n", + "Test Score # 3 : 6\n", + "Test Score # 4 : 3\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 10.12, page no. 219" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "MAX = 3\n", + "grades = [0,0,0]\n", + "\n", + "for i in range(MAX):\n", + " print \"Enter Garde #\", i+1, \": \",\n", + " grades[i] = int(raw_input())" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Garde # 1 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter Garde # 2 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter Garde # 3 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 10.13, page no. 219" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "name = ['J','e','f','f']\n", + "print \"Enter your name: \",\n", + "name = raw_input()\n", + "print \"Your name is: \", name" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Jeff\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Your name is: Jeff\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 10.14, page no. 220" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "MAX = 3\n", + "testScore = []\n", + "\n", + "for i in range(MAX):\n", + " print \"Enter test score #\", i + 1, \": \",\n", + " testScore.append(int(raw_input()))\n", + "print \"The test scores are: \", testScore" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter test score # 1 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter test score # 2 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter test score # 3 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The test scores are: [4, 5, 6]\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 10.15, page no. 221" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "testScore = []\n", + "testScore = raw_input()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "45\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 10.16, page no. 222" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "name = ['J','e','f','f']\n", + "print \"Enter your name: \",\n", + "name = raw_input()\n", + "print \"Your name is: \", name" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Jeff\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Your name is: Jeff\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 10.17, page no. 222" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter your name: \",\n", + "name = raw_input()\n", + "print \"Your name is: \", name" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Jeff\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Your name is: Jeff\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 10.18, page no. 223" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter your name: \",\n", + "name = raw_input()\n", + "print \"Your name is: \", name" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Jeff\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Your name is: Jeff\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 10.19, page no. 225" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "MAX = 3\n", + "\n", + "testScore = []\n", + "for i in range(MAX):\n", + " print \"Enter test score #\", i + 1, \": \",\n", + " testScore.append(int(raw_input()))\n", + "\n", + "for i in range(MAX):\n", + " print \"Test score #\", i + 1, \": \", testScore[i]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter test score # 1 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter test score # 2 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter test score # 3 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Test score # 1 : 4\n", + "Test score # 2 : 5\n", + "Test score # 3 : 6\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 10.20, page no. 225" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "MAX = 3\n", + "\n", + "def assignValues(tests, num):\n", + " for i in range(num):\n", + " print \"Enter test score #\", i + 1, \": \",\n", + " tests.append(int(raw_input()))\n", + "\n", + "def displayValues(scores, elems):\n", + " for i in range(elems):\n", + " print \"Test score #\", i + 1, \": \", scores[i]\n", + "\n", + "\n", + "testScore = []\n", + "assignValues(testScore, MAX)\n", + "displayValues(testScore, MAX)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter test score # 1 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter test score # 2 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter test score # 3 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Test score # 1 : 5\n", + "Test score # 2 : 6\n", + "Test score # 3 : 7\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter11-checkpoint.ipynb b/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter11-checkpoint.ipynb new file mode 100644 index 00000000..28bea5a9 --- /dev/null +++ b/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter11-checkpoint.ipynb @@ -0,0 +1,1063 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:3856d250c0b05978b896337a2d03bfbc47b52567398ed488a9db68479c713e89" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 11 - What\u2019s the Address? Pointers" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 11.1, page no. 232" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import sys\n", + "\n", + "iPtr = 0\n", + "fPtr = 0.0\n", + "cPtr = 'c'\n", + "\n", + "print sys.getsizeof(iPtr)\n", + "print sys.getsizeof(fPtr)\n", + "print sys.getsizeof(cPtr)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "24\n", + "24\n", + "38\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 11.2, page no. 233 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "iPtr = 0\n", + "print \"The value of iPtr is\", iPtr" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of iPtr is 0\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 11.3, page no. 234" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "iPtr = None\n", + "print \"The value of iPtr is \", iPtr" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of iPtr is None\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 11.4, page no. 235" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "num = 5\n", + "iPtr = id(num)\n", + "print \"The address of x using id() is \", id(num)\n", + "print \"The address of x using iPtr is \", iPtr" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The address of x using id() is 42658888\n", + "The address of x using iPtr is 42658888\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 11.5, page no. 236" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "num = 5\n", + "iPtr = id(num)\n", + "print \"The value of num is \", num\n", + "num = 10\n", + "print \"The value of num after num = 10 is \", num\n", + "iPtr = 15\n", + "print \"The value of num after iPtr = 15 is \", num" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of num is 5\n", + "The value of num after num = 10 is 10\n", + "The value of num after iPtr = 15 is 10\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 11.6, page no. 238" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "num1 = 5\n", + "num2 = 14\n", + "iPtr = id(num1)\n", + "print \"The value of num1 is \", num1\n", + "iPtr = 2\n", + "print \"The value of num1 after iPtr = 2 is \", iPtr\n", + "iPtr = id(num2)\n", + "print \"The value of num2 is \", num2\n", + "iPtr /= 2\n", + "print \"The value of num after iPtr /= 2 is \", iPtr" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of num1 is 5\n", + "The value of num1 after iPtr = 2 is 2\n", + "The value of num2 is 14\n", + "The value of num after iPtr /= 2 is 21329336\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "exmple 11.7, page no. 239" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "testScore = [4, 7, 1]\n", + "print \"The address of the array using testScore is \", testScore\n", + "print \"The address of the first element of the array using &testScore[0] is \", id(testScore[0])\n", + "print \"The value of the first element of the array using *testScore is \", testScore[0]\n", + "print \"The value of the first element of the array using testScore[0] is \", testScore[0]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The address of the array using testScore is [4, 7, 1]\n", + "The address of the first element of the array using &testScore[0] is 42658912\n", + "The value of the first element of the array using *testScore is 4\n", + "The value of the first element of the array using testScore[0] is 4\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 11.8, page no. 240" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "MAX = 3\n", + "\n", + "testScore = [4, 7, 1]\n", + "for i in range(MAX):\n", + " print \"The address of index \", i, \" of the array is \", id(testScore[i])\n", + " print \"The value at index \", i, \" of the array is \", testScore[i]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The address of index 0 of the array is 42658912\n", + "The value at index 0 of the array is 4\n", + "The address of index 1 of the array is 42658840\n", + "The value at index 1 of the array is 7\n", + "The address of index 2 of the array is 42658984\n", + "The value at index 2 of the array is 1\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 11.9, page no. 241" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "MAX = 3\n", + "\n", + "testScore = [4, 7, 1]\n", + "iPtr = testScore\n", + "for i in range(MAX):\n", + " print \"The address of index \", i, \" of the array is \", id(iPtr[i])\n", + " print \"The value at index \", i, \" of the array is \", iPtr[i]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The address of index 0 of the array is 42658912\n", + "The value at index 0 of the array is 4\n", + "The address of index 1 of the array is 42658840\n", + "The value at index 1 of the array is 7\n", + "The address of index 2 of the array is 42658984\n", + "The value at index 2 of the array is 1\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 11.10, page no. 241" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "MAX = 3\n", + "\n", + "testScore = [4, 7, 1]\n", + "iPtr = testScore\n", + "for i in range(MAX):\n", + " print \"The address of index \", i, \" of the array is \", id(iPtr[i])\n", + " print \"The value at index \", i, \" of the array is \", iPtr[i]\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The address of index 0 of the array is 42658912\n", + "The value at index 0 of the array is 4\n", + "The address of index 1 of the array is 42658840\n", + "The value at index 1 of the array is 7\n", + "The address of index 2 of the array is 42658984\n", + "The value at index 2 of the array is 1\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 11.11, page no. 243" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import sys\n", + "MAX = 3\n", + "\n", + "testScore = [4, 7, 1]\n", + "iPtr = testScore\n", + "i = 0\n", + "while (id(iPtr[MAX-1]) <= id(testScore[MAX-1])):\n", + " try:\n", + " print \"The address of index \", i, \" of the array is \", id(iPtr[i])\n", + " print \"The value at index \", i, \" of the array is \", iPtr[i]\n", + " i += 1\n", + " except IndexError:\n", + " print \"\\n\\nEnd of program\"\n", + " sys.exit()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "SystemExit", + "evalue": "", + "output_type": "pyerr", + "traceback": [ + "An exception has occurred, use %tb to see the full traceback.\n", + "\u001b[1;31mSystemExit\u001b[0m\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The address of index 0 of the array is 42658912\n", + "The value at index 0 of the array is 4\n", + "The address of index 1 of the array is 42658840\n", + "The value at index 1 of the array is 7\n", + "The address of index 2 of the array is 42658984\n", + "The value at index 2 of the array is 1\n", + "The address of index 3 of the array is \n", + "\n", + "End of program\n" + ] + }, + { + "output_type": "stream", + "stream": "stderr", + "text": [ + "To exit: use 'exit', 'quit', or Ctrl-D.\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 11.12, page no. 243" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import sys\n", + "MAX = 3\n", + "\n", + "testScore = [4, 7, 1]\n", + "iPtr = id(testScore[MAX-1])\n", + "i = MAX - 1\n", + "while (iPtr >= id(testScore[0])):\n", + " print \"The address of index \", i, \" of the array is \", iPtr\n", + " print \"The value at index \", i, \" of the array is \", testScore[i]\n", + " i -= 1\n", + " if i < 0:\n", + " break" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The address of index 2 of the array is 42658984\n", + "The value at index 2 of the array is 1\n", + "The address of index 1 of the array is 42658984\n", + "The value at index 1 of the array is 7\n", + "The address of index 0 of the array is 42658984\n", + "The value at index 0 of the array is 4\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 11.13, page no. 245" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "MAX = 3\n", + "\n", + "def assignValues(tests, num):\n", + " for i in range(num):\n", + " print \"Enter test score #\", i + 1, \": \",\n", + " tests.append(int(raw_input()))\n", + "\n", + "def displayValues(scores, elems):\n", + " for i in range(elems):\n", + " print \"Test score #\", i + 1, \": \", scores[i]\n", + "\n", + "testScore = []\n", + "assignValues(testScore, MAX)\n", + "displayValues(testScore, MAX)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter test score # 1 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter test score # 2 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter test score # 3 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Test score # 1 : 4\n", + "Test score # 2 : 5\n", + "Test score # 3 : 6\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 11.14, page no. 246" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "MAX = 3\n", + "\n", + "def assignValues(tests, num):\n", + " for i in range(num):\n", + " print \"Enter test score #\", i + 1, \": \",\n", + " tests.append(int(raw_input()))\n", + "\n", + "def displayValues(scores, elems):\n", + " for i in range(elems):\n", + " print \"Test score #\", i + 1, \": \", scores[i]\n", + "\n", + "testScore = []\n", + "assignValues(testScore, MAX)\n", + "displayValues(testScore, MAX)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter test score # 1 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter test score # 2 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter test score # 3 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Test score # 1 : 3\n", + "Test score # 2 : 4\n", + "Test score # 3 : 5\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 11.15, page no. 247" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def doubleIt(x):\n", + " print \"The number to be doubled is \", x\n", + " x *= 2\n", + " print \"The number doubled in doubleIt is \", x\n", + "\n", + "\n", + "print \"Enter number: \",\n", + "num = int(raw_input())\n", + "doubleIt(num)\n", + "print \"The number doubled in main is \", num" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter number: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The number to be doubled is 4\n", + "The number doubled in doubleIt is 8\n", + "The number doubled in main is 4\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 11.16, page no. 248" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def doubleIt(x):\n", + " print \"The number to be doubled is \", x\n", + " x *= 2\n", + " print \"The number doubled in doubleIt is \", x\n", + "\n", + "\n", + "print \"Enter number: \",\n", + "num = int(raw_input())\n", + "doubleIt(num)\n", + "print \"The number doubled in main is \", num" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter number: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The number to be doubled is 4\n", + "The number doubled in doubleIt is 8\n", + "The number doubled in main is 4\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 11.17, page no. 250" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter the number of test scores: \",\n", + "numTests = int(raw_input())\n", + "iPtr = []\n", + "for i in range(numTests):\n", + " print \"Enter test score #\", i + 1,\": \",\n", + " iPtr.append(int(raw_input()))\n", + "\n", + "for i in range(numTests):\n", + " print \"Test score #\", i + 1, \" is \", iPtr[i]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the number of test scores: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter test score # 1 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter test score # 2 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter test score # 3 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Test score # 1 is 5\n", + "Test score # 2 is 6\n", + "Test score # 3 is 7\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 11.18, page no. 253" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "str = \"Jeff Kent\"\n", + "print str" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Jeff Kent\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 11.19, page no. 253" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def setName():\n", + " print \"Enter your name: \",\n", + " name = raw_input()\n", + " return name\n", + "\n", + "str = setName()\n", + "print str\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Jeff\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Jeff\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 11.20, page no. 254" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def setName():\n", + " print \"Enter your name: \",\n", + " name = raw_input()\n", + " return name\n", + "\n", + "str = setName()\n", + "print str\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Jeff\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Jeff\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 11.21, page no. 255" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def setName():\n", + " print \"Enter your name: \",\n", + " name = raw_input()\n", + " return name\n", + "\n", + "str = setName()\n", + "print str\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Jeff\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Jeff\n" + ] + } + ], + "prompt_number": 21 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter12-checkpoint.ipynb b/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter12-checkpoint.ipynb new file mode 100644 index 00000000..aad6446b --- /dev/null +++ b/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter12-checkpoint.ipynb @@ -0,0 +1,586 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:7cb05a28e7ffaf35858d238ed32ee5850136dba10511258d20543dca08f1609c" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 12 - Character, C-String, and C++ String Class\n", + "Functions" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 12.1, page no. 262" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "ch = 'a'\n", + "\n", + "while(ch != 'Q' and ch != 'q'):\n", + " print \"Press Q or q to quit, any other key to continue: \",\n", + " ch = raw_input()\n", + " if(ch != 'Q' and ch != 'q'):\n", + " print \"You want to continue? \"\n", + " else:\n", + " print \"You quit\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Press Q or q to quit, any other key to continue: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "r\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " You want to continue? \n", + "Press Q or q to quit, any other key to continue: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "q\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " You quit\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 12.2, page no. 264" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "ch = 'a'\n", + "\n", + "while(ch != 'Q' and ch != 'q'):\n", + " print \"Press Q or q to quit, any other key to continue: \",\n", + " ch = raw_input()\n", + " if(ch != 'Q' and ch != 'q'):\n", + " print \"You want to continue? \"\n", + " else:\n", + " print \"You quit\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Press Q or q to quit, any other key to continue: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "t\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " You want to continue? \n", + "Press Q or q to quit, any other key to continue: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "q\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " You quit\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 12.3, page no. 266" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "ch = 'a'\n", + "\n", + "while(ch != 'Q' and ch != 'q'):\n", + " print \"Press Q or q to quit, any other key to continue: \",\n", + " ch = raw_input()\n", + " if(ch != 'Q' and ch != 'q'):\n", + " print \"You want to continue? \"\n", + " else:\n", + " print \"You quit\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Press Q or q to quit, any other key to continue: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "q\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " You quit\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 12.4, page no. 268" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "ch = 'a'\n", + "\n", + "while(ch != 'Q' and ch != 'q'):\n", + " print \"Press Q or q to quit, any other key to continue: \",\n", + " ch = raw_input()\n", + " if(ch != 'Q' and ch != 'q'):\n", + " print \"You want to continue? \"\n", + " else:\n", + " print \"You quit\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Press Q or q to quit, any other key to continue: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "u\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " You want to continue? \n", + "Press Q or q to quit, any other key to continue: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "q\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " You quit\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 12.5, page no. 269" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "name = []\n", + "print \"Enter course number: \",\n", + "courseNum = int(raw_input())\n", + "print \"Enter your name: \",\n", + "name = raw_input()\n", + "print \"Course number is: \", courseNum\n", + "print \"Your name is: \", name" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter course number: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "321\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter your name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Jeff\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Course number is: 321\n", + "Your name is: Jeff\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 12.6, page no. 271" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "name = []\n", + "print \"Enter course number: \",\n", + "courseNum = int(raw_input())\n", + "print \"Enter your name: \",\n", + "name = raw_input()\n", + "print \"Course number is: \", courseNum\n", + "print \"Your name is: \", name" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter course number: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "222\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter your name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Jeff\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Course number is: 222\n", + "Your name is: Jeff\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 12.7, page no. 273" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "ch = 'a'\n", + "while(ch != 'Q'):\n", + " print \"Press Q or q to quit, any other key to continue: \",\n", + " ch = raw_input()\n", + " ch = ch.upper()\n", + " if(ch != 'Q'):\n", + " print \"You want to continue? \"\n", + " else:\n", + " print \"You quit\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Press Q or q to quit, any other key to continue: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "q\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " You quit\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 12.8, page no. 280" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter first string: \",\n", + "str1 = raw_input()\n", + "print \"Enter second string: \",\n", + "str2 = raw_input()\n", + "if (str1 == str2):\n", + " print \"The two Cstrings are equal\"\n", + "elif (str1 > str2):\n", + " print \"The first Cstring is larger\"\n", + "else:\n", + " print \"The second Cstring is larger\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter first string: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Jeff\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter second string: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Kent\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The second Cstring is larger\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 12.9, page no. 281" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import sys\n", + "\n", + "print \"Enter an integer: \",\n", + "input = raw_input()\n", + "for x in input:\n", + " if (x == 0):\n", + " if (not(x.isdigit()) and x != '-'):\n", + " sys.exit()\n", + " else:\n", + " if(not(x.isdigit())):\n", + " sys.exit()\n", + "num = int(input)\n", + "print num" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter an integer: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "567\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 567\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter13-checkpoint.ipynb b/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter13-checkpoint.ipynb new file mode 100644 index 00000000..a7e400b9 --- /dev/null +++ b/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter13-checkpoint.ipynb @@ -0,0 +1,415 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:60c23a8f50ffb51e0da71a6e8b36475b7941871a6f534003180327a651bb1c1c" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 13: Persistent Data: File Input and Output" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 13.1, page no. 296" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "try:\n", + " if(fp):\n", + " print \"infile = \", fp\n", + " print \"0\"\n", + "except IOError:\n", + " print \"1\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'fp' is not defined", + "output_type": "pyerr", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 6\u001b[1;33m \u001b[1;32mif\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfp\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 7\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"infile = \"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mfp\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 8\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"0\"\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mNameError\u001b[0m: name 'fp' is not defined" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 13.2, page no. 296" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "try:\n", + " fp = open(\"students.dat\", \"w\")\n", + " if(fp):\n", + " print \"infile = \", fp\n", + " print \"0\"\n", + "except IOError:\n", + " print \"1\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "infile = \n", + "0\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 13.3, page no. 299" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "fp = open(\"students.dat\", \"w\")\n", + "print \"Writing to the file\"\n", + "print \"===================\"\n", + "print \"Enter class name: \",\n", + "data = raw_input()\n", + "fp.write(data)\n", + "fp.write(\"\\n\")\n", + "print \"Enter number of students: \",\n", + "data = raw_input()\n", + "fp.write(data)\n", + "fp.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Writing to the file\n", + "===================\n", + "Enter class name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "C++\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter number of students: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "32\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 13.4, page no. 301" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "fp = open(\"students.dat\", \"w\")\n", + "print \"Writing to the file\"\n", + "print \"===================\"\n", + "print \"Enter class name: \",\n", + "data = raw_input()\n", + "fp.write(data)\n", + "fp.write(\"\\n\")\n", + "print \"Enter number of students: \",\n", + "data = raw_input()\n", + "fp.write(data)\n", + "fp.close()\n", + "fp = open(\"students.dat\", \"r\")\n", + "print \"Reading from the file\"\n", + "print \"=====================\"\n", + "lines = fp.readlines()\n", + "for line in lines:\n", + " print line\n", + "fp.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Writing to the file\n", + "===================\n", + "Enter class name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "C++\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter number of students: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "32\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Reading from the file\n", + "=====================\n", + "C++\n", + "\n", + "32\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "example 13.5, page no. 303" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "fp = open(\"students.dat\", \"w\")\n", + "print \"Writing to the file\"\n", + "print \"===================\"\n", + "print \"Enter class name: \",\n", + "data = raw_input()\n", + "fp.write(data)\n", + "fp.write(\"\\n\")\n", + "print \"Enter number of students: \",\n", + "data = raw_input()\n", + "fp.write(data)\n", + "fp.close()\n", + "fp = open(\"students.dat\", \"r\")\n", + "print \"Reading from the file\"\n", + "print \"=====================\"\n", + "lines = fp.readlines()\n", + "for line in lines:\n", + " print line\n", + "fp.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Writing to the file\n", + "===================\n", + "Enter class name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "C++\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter number of students: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "32\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Reading from the file\n", + "=====================\n", + "C++\n", + "\n", + "32\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 13.6, page no. 305" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "fp = open(\"students.dat\", \"w\")\n", + "print \"Writing to the file\"\n", + "print \"===================\"\n", + "print \"Enter class name: \",\n", + "data = raw_input()\n", + "fp.write(data)\n", + "fp.write(\"\\n\")\n", + "print \"Enter number of students: \",\n", + "data = raw_input()\n", + "fp.write(data)\n", + "fp.close()\n", + "fp = open(\"students.dat\", \"r\")\n", + "print \"Reading from the file\"\n", + "print \"=====================\"\n", + "while(fp.readline()):\n", + " print fp.readline()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Writing to the file\n", + "===================\n", + "Enter class name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "C++\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter number of students: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "32\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Reading from the file\n", + "=====================\n", + "32\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter14-checkpoint.ipynb b/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter14-checkpoint.ipynb new file mode 100644 index 00000000..ff10cf77 --- /dev/null +++ b/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter14-checkpoint.ipynb @@ -0,0 +1,752 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:016508922d0131c0ac159bf106009ef877ee5a7ded89017b639b2c0f28cf52bc" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 14: The Road Ahead: Structures and Classes" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 14.1, page no. 317" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Person:\n", + " name = \"\"\n", + " height = 0" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 14.2, page no. 318" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Person:\n", + " name = \"\"\n", + " height = 0\n", + "\n", + "MAX = 3\n", + "p = []\n", + "\n", + "for x in range(MAX):\n", + " per = Person()\n", + " print \"Enter person's name: \",\n", + " per.name = raw_input()\n", + " print \"Enter height in inches: \",\n", + " per.height = int(raw_input())\n", + " p.append(per)\n", + "\n", + "print \"Outputting person data\\n\";\n", + "print \"======================\\n\";\n", + "for x in range(MAX):\n", + " print \"Person \", x + 1, \"'s name is \", p[x].name, \" and height is \", p[x].height" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter person's name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Jeff\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter height in inches: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "50\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter person's name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Kent\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter height in inches: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "50\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter person's name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Jefff\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter height in inches: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "40\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Outputting person data\n", + "\n", + "======================\n", + "\n", + "Person 1 's name is Jeff and height is 50\n", + "Person 2 's name is Kent and height is 50\n", + "Person 3 's name is Jefff and height is 40\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 14.3, page no. 320" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Person:\n", + " name = \"\"\n", + " height = 0\n", + "\n", + "MAX = 3\n", + "p1 = Person()\n", + "print \"The person's name is \", p1.name, \" and height is \", p1.height" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The person's name is and height is 0\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 14.4, page no. 322" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Person:\n", + " def __init__(self):\n", + " self.name = \"no name assigned\"\n", + " self.height = -1\n", + "\n", + "MAX = 3\n", + "p1 = Person()\n", + "print \"The person's name is \", p1.name, \" and height is \", p1.height" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The person's name is no name assigned and height is -1\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 14.5, page no. 323" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Person:\n", + " def __init__(self, s=\"no name assigned\", h=-1):\n", + " self.name = s\n", + " self.height = h\n", + "\n", + "MAX = 3\n", + "print \"Enter a person's name: \",\n", + "s = raw_input()\n", + "print \"Enter height in inches: \",\n", + "h = int(raw_input())\n", + "p1 = Person(s, h)\n", + "print \"The person's name is \", p1.name, \" and height is \", p1.height" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a person's name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Jeff\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter height in inches: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "39\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The person's name is Jeff and height is 39\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 14.6, page no. 324" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Person:\n", + " def __init__(self, s=\"no name assigned\", h=-1):\n", + " self.name = s\n", + " self.height = h\n", + "\n", + "MAX = 3\n", + "print \"Enter a person's name: \",\n", + "s = raw_input()\n", + "print \"Enter height in inches: \",\n", + "h = int(raw_input())\n", + "p1 = Person(s, h)\n", + "print \"The person's name is \", p1.name, \" and height is \", p1.height\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a person's name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Jeff\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter height in inches: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "50\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The person's name is Jeff and height is 50\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 14.7, page no. 325" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Person:\n", + " name = \"\"\n", + " height = \"\"\n", + " def setValues(self, pers):\n", + " print \"Enter person's name: \",\n", + " pers.name = raw_input()\n", + " print \"Enter height in inches: \",\n", + " pers.height = int(raw_input())\n", + " def getValues(self, pers):\n", + " print \"Person's name is \", pers.name, \" height is \", pers.height\n", + "\n", + "p1 = Person()\n", + "p1.setValues(p1)\n", + "print \"Outputting person data\"\n", + "print \"======================\"\n", + "p1.getValues(p1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter person's name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Jeff\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter height in inches: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "60\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Outputting person data\n", + "======================\n", + "Person's name is Jeff height is 60\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 14.8, page no. 326" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Date:\n", + " month = 0\n", + " day = 0\n", + " year = 0\n", + "\n", + "class Person:\n", + " name = \"\"\n", + " height = 0\n", + " bDay = Date()\n", + " def setValues(self, pers):\n", + " print \"Enter person's name: \",\n", + " pers.name = raw_input()\n", + " print \"Enter height in inches: \",\n", + " pers.height = int(raw_input())\n", + " print \"Enter birthdate\"\n", + " pers.bDay.month = int(raw_input(\"Month: \"))\n", + " pers.bDay.day = int(raw_input(\"Day: \"))\n", + " pers.bDay.year = int(raw_input(\"Year: \"))\n", + " def getValues(self, pers):\n", + " print \"Person's name: \", pers.name\n", + " print \"Person's height\", pers.height\n", + " print \"Person's birthday in mm/dd/yyyy format is: \", pers.bDay.month, pers.bDay.day, pers.bDay.year\n", + "\n", + "p1 = Person()\n", + "p1.setValues(p1)\n", + "print \"Outputting person data\"\n", + "print \"======================\"\n", + "p1.getValues(p1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter person's name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Jeff\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter height in inches: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "59\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter birthdate\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Month: 20\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Day: 05\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Year: 1999\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Outputting person data\n", + "======================\n", + "Person's name: Jeff\n", + "Person's height 59\n", + "Person's birthday in mm/dd/yyyy format is: 20 5 1999\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 14.9, page no. 330" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Person:\n", + " name = \"\"\n", + " height = \"\"\n", + " def setValues(self, pers):\n", + " print \"Enter person's name: \",\n", + " pers.name = raw_input()\n", + " print \"Enter height in inches: \",\n", + " pers.height = int(raw_input())\n", + " def getValues(self, pers):\n", + " print \"Person's name is \", pers.name, \" height is \", pers.height\n", + "\n", + "p1 = Person()\n", + "p1.setValues(p1)\n", + "print \"Outputting person data\"\n", + "print \"======================\"\n", + "p1.getValues(p1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter person's name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "JEff\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter height in inches: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "50\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Outputting person data\n", + "======================\n", + "Person's name is JEff height is 50\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 14.10, page no. 331" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Person:\n", + " name = \"\"\n", + " height = \"\"\n", + " def setValues(self, pers):\n", + " print \"Enter person's name: \",\n", + " pers.name = raw_input()\n", + " print \"Enter height in inches: \",\n", + " pers.height = int(raw_input())\n", + " def getValues(self):\n", + " print \"Person's name is \", self.getName(), \" height is \", self.getHeight()\n", + " def getName(self):\n", + " return self.name\n", + " def getHeight(self):\n", + " return self.height\n", + "\n", + "p1 = Person()\n", + "p1.setValues(p1)\n", + "print \"Outputting person data\"\n", + "print \"======================\"\n", + "p1.getValues()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter person's name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Jeff\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter height in inches: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "60\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Outputting person data\n", + "======================\n", + "Person's name is Jeff height is 60\n" + ] + } + ], + "prompt_number": 10 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter2-checkpoint.ipynb b/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter2-checkpoint.ipynb new file mode 100644 index 00000000..a10e4f68 --- /dev/null +++ b/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter2-checkpoint.ipynb @@ -0,0 +1,60 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:609a5d3522e4231d9e4a78cca1d62620ebc8f02a9a5a670cc7f12a71d13447b3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 2 - Memory & Data Types" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 2.1, page no. 54" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import sys \n", + "\n", + "print \"Size of Integer is: \" + str(sys.getsizeof(int()))\n", + "print \"Size of Float is: \" + str(sys.getsizeof(float()))\n", + "print \"Size of Long is: \" + str(sys.getsizeof(long()))\n", + "print \"Size of String is: \" + str(sys.getsizeof(str()))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Size of Integer is: 24\n", + "Size of Float is: 24\n", + "Size of Long is: 24\n", + "Size of String is: 37\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter3-checkpoint.ipynb b/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter3-checkpoint.ipynb new file mode 100644 index 00000000..ea8d38c3 --- /dev/null +++ b/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter3-checkpoint.ipynb @@ -0,0 +1,578 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:7d3fff6ffc0709910490ced1c16839cdcfbdac70ad380dbfa135865aaf26e67d" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 3 - Variables" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 3.1, page no. 62" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "testScore = 0 #will declare testScore as an integer" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 3.2, page no. 63" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "testScore" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 3, + "text": [ + "0" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 3.3, page no. 65" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "testScore = 0\n", + "print id(testScore)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "27819200\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 3.4, page no. 66" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import sys\n", + "\n", + "testScore = 0\n", + "myGPA = 0.0\n", + "\n", + "print \"The address of testScore is: \", id(testScore)\n", + "print \"The size of testScore is: \", sys.getsizeof(testScore)\n", + "print \"The address of myGPA is: \", id(myGPA)\n", + "print \"The size of myGPA is: \", sys.getsizeof(myGPA)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The address of testScore is: 27819200\n", + "The size of testScore is: 24\n", + "The address of myGPA is: 42871928\n", + "The size of myGPA is: 24\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 3.5, page no. 68" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "testScore = 95;\n", + "print \"Your test score is: \", testScore\n", + "testScore = 75\n", + "print \"Your test score now is: \", testScore" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Your test score is: 95\n", + "Your test score now is: 75\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 3.6, page no. 69" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "testScore = 77.83;\n", + "print \"The test score is: \", testScore\n", + "print \"The test score is: \", int(testScore) # explicitly converting to integer" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The test score is: 77.83\n", + "The test score is: 77\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 3.7 page no. 69" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "testScore = 32768;\n", + "print \"Your test score is: \", testScore" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Your test score is: 32768\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 3.8 page no. 70" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "testScore = -32769\n", + "print \"Your test score is: \", testScore" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Your test score is: -32769\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 3.9, page no. 71" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "testScore = int(raw_input())\n", + "print \"Your test score is: \", testScore" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 3.10, page no. 71" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "testScore = int(raw_input(\"Enter your test score: \"))\n", + "print \"Your test score is: \", testScore" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your test score: 89\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Your test score is: 89\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 3.11, page no. 73" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter your name: \",\n", + "myName = raw_input()\n", + "print \"Enter your weight in pounds: \",\n", + "myWeight = raw_input()\n", + "print \"Enter your height in inches: \",\n", + "myHeight = raw_input()\n", + "print \"Your name score is: \", myName\n", + "print \"Your weight in pounds is \", myWeight\n", + "print \"Your height in inches is \", myHeight" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hardik\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter your weight in pounds: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "90\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter your height in inches: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "50\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Your name score is: Hardik\n", + "Your weight in pounds is 90\n", + "Your height in inches is 50\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 3.12, page no. 74" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter your name: \",\n", + "myName = raw_input()\n", + "print \"Enter your weight in pounds: \",\n", + "myWeight = raw_input()\n", + "print \"Enter your height in inches: \",\n", + "myHeight = raw_input()\n", + "print \"Your name score is: \", myName\n", + "print \"Your weight in pounds is \", myWeight\n", + "print \"Your height in inches is \", myHeight" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hardik\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter your weight in pounds: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "90\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter your height in inches: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "50\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Your name score is: Hardik\n", + "Your weight in pounds is 90\n", + "Your height in inches is 50\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 3.13, page no. 75" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter your name: \",\n", + "name = raw_input()\n", + "print \"Your name is \", name" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your name: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hardik\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Your name is Hardik\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 3.14 page no. 76" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "testScore = 32769\n", + "print \"Your test score is: \", testScore" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Your test score is: 32769\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter4-checkpoint.ipynb b/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter4-checkpoint.ipynb new file mode 100644 index 00000000..2fed811a --- /dev/null +++ b/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter4-checkpoint.ipynb @@ -0,0 +1,584 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:985e0e6b7e8ae27035cca1419b7775a3f9a570b5ac018168350c0febbe31d7b4" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 4 - Arithmetic Operators" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 4.1, page no. 82" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter number of preregistered students: \",\n", + "total = int(raw_input())\n", + "print \"Enter number of students adding the course: \",\n", + "added = int(raw_input())\n", + "total = total + added\n", + "print \"Total number of students: \", total" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter number of preregistered students: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "35\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter number of students adding the course: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total number of students: 38\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 4.2, page no. 84" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "firstName = \"Jeff\"\n", + "lastName = \"Kent\"\n", + "print \"Your name is \", firstName + lastName" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Your name is JeffKent\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 4.3, page no. 84" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter number of preregistered students: \",\n", + "total = int(raw_input())\n", + "print \"Enter number of students adding the course: \",\n", + "added = int(raw_input())\n", + "total = total + added\n", + "print \"How many students dropped? \",\n", + "dropped = int(raw_input())\n", + "total -= dropped\n", + "print \"Total number of students: \", total" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter number of preregistered students: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "30\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter number of students adding the course: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " How many students dropped? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total number of students: 28\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "exampe 4.4, page no. 85" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter number of preregistered students: \",\n", + "total = int(raw_input())\n", + "print \"Enter number of students adding the course: \",\n", + "added = int(raw_input())\n", + "total = total + added\n", + "print \"How many students dropped? \",\n", + "dropped = int(raw_input())\n", + "total -= dropped\n", + "print \"Total number of students: \", total\n", + "print \"Total tuition owed: $\",((total + dropped) * 72)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter number of preregistered students: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "30\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter number of students adding the course: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " How many students dropped? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total number of students: 28\n", + "Total tuition owed: $ 2376\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 4.5, page no. 88" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "firstOp = 10\n", + "secondOp = 4\n", + "result = firstOp / secondOp\n", + "print firstOp, \" / \", secondOp, \" = \", result" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10 / 4 = 2\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 4.6, page no. 88" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "firstOp = 10.0\n", + "secondOp = 4.0\n", + "result = firstOp / secondOp\n", + "print firstOp, \" / \", secondOp, \" = \", result" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10.0 / 4.0 = 2.5\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 4.7, page no. 89" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "firstOp = 10\n", + "secondOp = 4\n", + "result = float(firstOp) / float(secondOp) #converting both the variables to float\n", + "print firstOp, \" / \", secondOp, \" = \", result" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10 / 4 = 2.5\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 4.8, page no. 89" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter number of preregistered students: \",\n", + "total = int(raw_input())\n", + "print \"Enter number of students adding the course: \",\n", + "added = int(raw_input())\n", + "total = total + added\n", + "print \"How many students dropped? \",\n", + "dropped = int(raw_input())\n", + "total -= dropped\n", + "print \"Total number of students: \", total\n", + "tuition = (total + dropped) * 72\n", + "print \"Total tuition owed: $\",tuition\n", + "print \"Average tuition per enrolled student: $\", (float(tuition)/float(total))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter number of preregistered students: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "30\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter number of students adding the course: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " How many students dropped? " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total number of students: 28\n", + "Total tuition owed: $ 2376\n", + "Average tuition per enrolled student: $ 84.8571428571\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 4.9, page no. 91" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter radius of circle: \",\n", + "radius = float(raw_input())\n", + "area = 3.14159 * pow(radius, 2);\n", + "print \"The area is \", area" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter radius of circle: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The area is 113.09724\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 4.10, page no. 92" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter number of pennies to make change for: \",\n", + "total = int(raw_input())\n", + "dollars = total / 100\n", + "leftover = total % 100\n", + "quarters = leftover / 25\n", + "leftover %= 25\n", + "dimes = leftover / 10\n", + "leftover %= 10\n", + "nickels = leftover / 5\n", + "leftover %= 5\n", + "print \"Dollars: \", dollars\n", + "print \"Quarters: \", quarters\n", + "print \"Dimes: \", dimes\n", + "print \"Nickels: \", nickels\n", + "print \"Pennies: \", leftover" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter number of pennies to make change for: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "387\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Dollars: 3\n", + "Quarters: 3\n", + "Dimes: 1\n", + "Nickels: 0\n", + "Pennies: 2\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter5-checkpoint.ipynb b/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter5-checkpoint.ipynb new file mode 100644 index 00000000..7973421f --- /dev/null +++ b/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter5-checkpoint.ipynb @@ -0,0 +1,500 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:527aef20f7b40df168e6ff4a5ccb96d249aaf7c6743cc854ce1a221227ecfb75" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 5 - Making Decisions: if and switch Statements" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 5.1, page no. 100" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "a = 4\n", + "b = 5\n", + "print a, \" > \", b, \" is \", (a > b)\n", + "print a, \" >= \", b, \" is \", (a >= b)\n", + "print a, \" == \", b, \" is \", (a == b)\n", + "print a, \" <= \", b, \" is \", (a <= b)\n", + "print a, \" < \", b, \" is \", (a < b)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "4 > 5 is False\n", + "4 >= 5 is False\n", + "4 == 5 is False\n", + "4 <= 5 is True\n", + "4 < 5 is True\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 5.2, page no. 102" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter number of preregistered students: \",\n", + "total = int(raw_input())\n", + "print \"Enter number of students adding the course: \",\n", + "added = int(raw_input())\n", + "total = total + added\n", + "print \"Total number of students: \", total" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter number of preregistered students: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "30\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter number of students adding the course: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total number of students: 33\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 5.3, page no. 104" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter a whole number: \",\n", + "num = int(raw_input())\n", + "if (num % 2 == 0):\n", + " print \"The number is even\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a whole number: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The number is even\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 5.4, page no. 108" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter a whole number: \",\n", + "num = int(raw_input())\n", + "if (num % 2 == 0):\n", + " print \"The number is even\"\n", + "else:\n", + " print \"The number is odd\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a whole number: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The number is odd\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 5.4, page no. 109" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter a whole number: \",\n", + "num = int(raw_input())\n", + "print \"The number is\", (\"even\" if num %2 == 0 else \"odd\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a whole number: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The number is even\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 5.6, page no. 112" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter your test score: \",\n", + "testScore = int(raw_input())\n", + "if (testScore >= 90 ):\n", + " print \"Your grade is an A\"\n", + "elif (testScore >= 80 ):\n", + " print \"Your grade is a B\"\n", + "elif (testScore >= 70 ):\n", + " print \"Your grade is a C\"\n", + "elif (testScore >= 60 ):\n", + " print \"Your grade is a D\"\n", + "else:\n", + " print \"Your grade is an F\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your test score: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "70\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Your grade is a C\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 5.7, page no. 115" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter your grade: \",\n", + "grade = raw_input()\n", + "\n", + "if grade == 'A':\n", + " print \"Your average must be between 90 - 100\"\n", + "elif grade == 'B':\n", + " print \"Your average must be between 80 - 89\"\n", + "elif grade == 'C':\n", + " print \"Your average must be between 70 - 79\"\n", + "elif grade == 'D':\n", + " print \"Your average must be between 60 - 69\"\n", + "else:\n", + " print \"Your average must be below 60\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your grade: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "D\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Your average must be between 60 - 69\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 5.8, page no. 118" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "print \"Enter your grade: \",\n", + "grade = raw_input()\n", + "\n", + "if grade == 'A' or grade == 'a':\n", + " print \"Your average must be between 90 - 100\"\n", + "elif grade == 'B' or grade == 'b':\n", + " print \"Your average must be between 80 - 89\"\n", + "elif grade == 'C' or grade == 'c':\n", + " print \"Your average must be between 70 - 79\"\n", + "elif grade == 'D' or grade == 'd':\n", + " print \"Your average must be between 60 - 69\"\n", + "else:\n", + " print \"Your average must be below 60\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your grade: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "d\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Your average must be between 60 - 69\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 5.9, page no. 119" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "print \"Choose your car\"\n", + "print \"S for Standard\"\n", + "print \"L for Leather Seats\"\n", + "print \"D for Leather Seats + Chrome Wheels\"\n", + "choice = raw_input()\n", + "print \"Extra features purchased\"\n", + "if choice == 'D':\n", + " print \"Chrome wheels\\n\"\n", + "elif choice == 'L':\n", + " print \"Leather seats\"\n", + "else:\n", + " print \"None selected\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "StdinNotImplementedError", + "evalue": "raw_input was called, but this frontend does not support stdin.", + "output_type": "pyerr", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mStdinNotImplementedError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m/home/jovina/TBC/hardik/c++-demystified/\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 7\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"L for Leather Seats\"\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 8\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"D for Leather Seats + Chrome Wheels\"\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 9\u001b[1;33m \u001b[0mchoice\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mraw_input\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 10\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"Extra features purchased\"\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 11\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mchoice\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;34m'D'\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;32m/home/jovina/epd/lib/python2.7/site-packages/IPython/zmq/ipkernel.pyc\u001b[0m in \u001b[0;36m\u001b[1;34m(prompt)\u001b[0m\n\u001b[0;32m 251\u001b[0m \u001b[0mraw_input\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;32mlambda\u001b[0m \u001b[0mprompt\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m''\u001b[0m\u001b[1;33m:\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_raw_input\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mprompt\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mident\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mparent\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 252\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 253\u001b[1;33m \u001b[0mraw_input\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;32mlambda\u001b[0m \u001b[0mprompt\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m''\u001b[0m \u001b[1;33m:\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_no_raw_input\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 254\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 255\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mpy3compat\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mPY3\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;32m/home/jovina/epd/lib/python2.7/site-packages/IPython/zmq/ipkernel.pyc\u001b[0m in \u001b[0;36m_no_raw_input\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 443\u001b[0m \"\"\"Raise StdinNotImplentedError if active frontend doesn't support\n\u001b[0;32m 444\u001b[0m stdin.\"\"\"\n\u001b[1;32m--> 445\u001b[1;33m raise StdinNotImplementedError(\"raw_input was called, but this \"\n\u001b[0m\u001b[0;32m 446\u001b[0m \"frontend does not support stdin.\") \n\u001b[0;32m 447\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mStdinNotImplementedError\u001b[0m: raw_input was called, but this frontend does not support stdin." + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Choose your car\n", + "S for Standard\n", + "L for Leather Seats\n", + "D for Leather Seats + Chrome Wheels\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter6-checkpoint.ipynb b/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter6-checkpoint.ipynb new file mode 100644 index 00000000..bb24153c --- /dev/null +++ b/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter6-checkpoint.ipynb @@ -0,0 +1,315 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:9c21d1f44f5f11828308d4a5b6ab2316e8a5d933b04912def7dc67cfcb9dbaea" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 6 - Nested if Statements and Logical Operators" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 6.1, page no. 125" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter your age: \",\n", + "age = int(raw_input())\n", + "print \"Are you a citizen (Y/N): \",\n", + "choice = raw_input()\n", + "if (choice == 'Y'):\n", + " citizen = True\n", + "else:\n", + " citizen = False\n", + "if (age >= 18):\n", + " if citizen:\n", + " print \"You are eligible to vote\"\n", + " else:\n", + " print \"You are not eligible to vote\"\n", + "else:\n", + " print \"You are not eligible to vote\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your age: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "65\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Are you a citizen (Y/N): " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " You are eligible to vote\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 6.2, page no. 127" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter your age: \",\n", + "age = int(raw_input())\n", + "if (age > 12):\n", + " if (age >= 65):\n", + " print \"Admission is free\"\n", + " else:\n", + " print \"You have to pay\"\n", + "else:\n", + " print \"Admission is free\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your age: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "11\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Admission is free\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 6.3, page no. 129" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter your age: \",\n", + "age = int(raw_input())\n", + "print \"Are you a citizen (Y/N): \",\n", + "choice = raw_input()\n", + "if (choice == 'Y'):\n", + " citizen = True\n", + "else:\n", + " citizen = False\n", + "if (age >= 18 and citizen == True):\n", + " print \"You are eligible to vote\"\n", + "else:\n", + " print \"You are not eligible to vote\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter your age: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "22\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Are you a citizen (Y/N): " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "N\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " You are not eligible to vote\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 6.4, page no. 131" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter your age: \",\n", + "age = int(raw_input())\n", + "if (age <= 12 or age >= 65):\n", + " print \"Admission is free\"\n", + "else:\n", + " print \"You have to pay\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your age: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "22\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " You have to pay\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 6.5, page no. 132" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter your age: \",\n", + "age = int(raw_input())\n", + "if not ((age > 12 and age < 65)):\n", + " print \"Admission is free\"\n", + "else:\n", + " print \"You have to pay\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your age: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "22\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " You have to pay\n" + ] + } + ], + "prompt_number": 9 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter7-checkpoint.ipynb b/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter7-checkpoint.ipynb new file mode 100644 index 00000000..0272be09 --- /dev/null +++ b/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter7-checkpoint.ipynb @@ -0,0 +1,925 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:84d44e5e34aa0042556dda8bb39ee06beeff8eaea8bb2913d8710f888ef51867" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 7 - The For Loop" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 7.1, page no. 142" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "num = 2\n", + "num += 1\n", + "print num" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 7.2, page no. 142" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "num = 2\n", + "num += 1\n", + "print num" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 7.3, page no. 142" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "num = 2\n", + "print num\n", + "num += 1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 7.4, page no. 143" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "num = 2\n", + "num -= 1\n", + "print num" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 7.5, page no. 143" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "num = 2\n", + "num -= 1\n", + "print num" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 7.6, page no. 144" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "num = 2\n", + "num -= 1\n", + "print num" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 7.7, page no. 146" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "num = 1\n", + "print num\n", + "num += 1\n", + "print num\n", + "num += 1\n", + "print num\n", + "num += 1\n", + "print num\n", + "num += 1\n", + "print num\n", + "num += 1\n", + "print num\n", + "num += 1\n", + "print num\n", + "num += 1\n", + "print num\n", + "num += 1\n", + "print num\n", + "num += 1\n", + "print num" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n", + "2\n", + "3\n", + "4\n", + "5\n", + "6\n", + "7\n", + "8\n", + "9\n", + "10\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 7.8, page no. 146" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "for num in range(1, 11):\n", + " print num\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n", + "2\n", + "3\n", + "4\n", + "5\n", + "6\n", + "7\n", + "8\n", + "9\n", + "10\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 7.9, page no. 147" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "for num in range(1, 101):\n", + " print num," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 7.10, page no. 149" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "num = 1\n", + "while num <= 10:\n", + " print num,\n", + " num += 1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 2 3 4 5 6 7 8 9 10\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 7.11, page no. 149" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "num = 1\n", + "while num <= 10:\n", + " print num," + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 7.12, page no. 150" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "total = 1;\n", + "print \"Enter a number: \",\n", + "num = int(raw_input())\n", + "print \"The factorial of \", num, \" is \",\n", + "for counter in range(1, num+1):\n", + " total *= counter\n", + "print total" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The factorial of 5 is 120\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 7.13, page no. 150" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "secret = 3\n", + "print \"Guess a number between 1 and 10\"\n", + "print \"You have 3 tries\"\n", + "for counter in range(1,4):\n", + " print \"Enter the number now: \",\n", + " num = int(raw_input())\n", + " if (num == secret):\n", + " print \"You guessed the secret number!\"\n", + " break\n", + "print \"Program over\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Guess a number between 1 and 10\n", + "You have 3 tries\n", + "Enter the number now: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the number now: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter the number now: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Program over\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 7.14, page no. 151" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "secret = 3\n", + "print \"Guess a number between 1 and 10\\n\"\n", + "print \"You have 3 tries\\n\"\n", + "keepgoing = True\n", + "for counter in range(1, 4):\n", + " if keepgoing == True:\n", + " print \"Enter the number now: \",\n", + " num = int(raw_input())\n", + " if (num == secret):\n", + " print \"You guessed the secret number!\"\n", + " keepgoing = False\n", + " else:\n", + " break\n", + "print \"Program over\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Guess a number between 1 and 10\n", + "\n", + "You have 3 tries\n", + "\n", + "Enter the number now: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " You guessed the secret number!\n", + "Program over\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 7.15, page no. 152" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "num = 1\n", + "while True:\n", + " if (num > 10):\n", + " break\n", + " else:\n", + " print num, \" \",\n", + " num += 1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 2 3 4 5 6 7 8 9 10 \n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 7.16, page no 153" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "total = 0\n", + "print \"How many items do you want to buy: \",\n", + "num = int(raw_input())\n", + "for counter in range(1, num+1):\n", + " if (counter % 13 == 0):\n", + " continue\n", + " total += 3\n", + "print \"Total for \", num, \" items is $\", total" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many items do you want to buy: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total for 5 items is $ 15\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 7.17, page no. 154" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "total = 0\n", + "print \"How many items do you want to buy: \",\n", + "num = int(raw_input())\n", + "keepgoing = True\n", + "for counter in range(1, num+1):\n", + " if (not(counter % 13 == 0 )):\n", + " total += 3\n", + "print \"Total for \", num, \" items is $\", total" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many items do you want to buy: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total for 6 items is $ 18\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 7.18, page no. 154" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "for x in range(1, 6):\n", + " for y in range(1, 11):\n", + " print \"X\",\n", + " print \"\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "X X X X X X X X X X \n", + "\n", + "X X X X X X X X X X \n", + "\n", + "X X X X X X X X X X \n", + "\n", + "X X X X X X X X X X \n", + "\n", + "X X X X X X X X X X \n", + "\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 7.19, page no. 155" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter number of salespersons: \",\n", + "persons = int(raw_input())\n", + "print \"Enter number of sales per salesperson: \",\n", + "numSales = int(raw_input())\n", + "for x in range(1, persons+1):\n", + " total = 0\n", + " for y in range(1, numSales+1):\n", + " print \"Enter sale \", y, \" for salesperson \", x, \": \"\n", + " sale = int(raw_input())\n", + " total += sale\n", + " average = float(total/numSales)\n", + " print \"Average sales for salesperson #\", x, \" is \", average" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter number of salespersons: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter number of sales per salesperson: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter sale 1 for salesperson 1 : \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter sale 2 for salesperson 1 : \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Average sales for salesperson # 1 is 1.0\n", + "Enter sale 1 for salesperson 2 : \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter sale 2 for salesperson 2 : \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Average sales for salesperson # 2 is 3.0\n", + "Enter sale 1 for salesperson 3 : \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter sale 2 for salesperson 3 : \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Average sales for salesperson # 3 is 5.0\n" + ] + } + ], + "prompt_number": 24 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter8-checkpoint.ipynb b/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter8-checkpoint.ipynb new file mode 100644 index 00000000..24601877 --- /dev/null +++ b/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter8-checkpoint.ipynb @@ -0,0 +1,571 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:0900a5bcaf7054f0b4351a7d97782dfa44a0ae756b508bf87060112c13f5f981" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 8 - While and Do While Loops" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 8.1, page no. 161" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "for num in range(1, 11):\n", + " print num," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 2 3 4 5 6 7 8 9 10\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 8.2, page no. 161" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "num = 1\n", + "while num <=10:\n", + " print num,\n", + " num += 1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 2 3 4 5 6 7 8 9 10\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 8.3, page no. 162" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "num = 0\n", + "while (num <= 10):\n", + " print num,\n", + " num += 1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 1 2 3 4 5 6 7 8 9 10\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 8.4, page no. 163" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter a positive number: \",\n", + "num = int(raw_input())\n", + "while (num <= 0):\n", + " print \"Number must be positive; please retry: \",\n", + " num = int(raw_input())\n", + "print \"The number you entered is \", num, \" \"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive number: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The number you entered is 4 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 8.5, page no. 164" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter a positive number: \",\n", + "num = int(raw_input())\n", + "while (num <= 0):\n", + " print \"Number must be positive; try again (Y/N): \",\n", + " choice = raw_input()\n", + " if (choice == 'Y'):\n", + " print \"Enter number: \",\n", + " num = int(raw_input())\n", + " else:\n", + " break\n", + "print \"The number you entered is \", num, \" \"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive number: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Number must be positive; try again (Y/N): " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter number: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The number you entered is 7 \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 8.6, page no. 165" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "quit = False\n", + "print \"Enter a positive number: \",\n", + "num = int(raw_input())\n", + "while (num <= 0 and quit == False):\n", + " print \"Number must be positive; try again (Y/N): \",\n", + " choice = raw_input()\n", + " if (choice is 'Y'):\n", + " print \"Enter number: \",\n", + " num = int(raw_input())\n", + " else:\n", + " quit = True\n", + "if (quit == False):\n", + " print \"The number you entered is \", num, \" \"\n", + "else:\n", + " print \"You did not enter a positive number\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive number: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The number you entered is 3 \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 8.7, page no. 168" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "quit = False\n", + "while(True):\n", + " print \"Enter a positive number: \",\n", + " num = int(raw_input())\n", + " if (num > 0):\n", + " break\n", + " else:\n", + " print \"Number must be positive; try again (Y/N): \",\n", + " choice = raw_input()\n", + " if (choice != 'Y'):\n", + " quit = True\n", + " break\n", + "if (quit == False):\n", + " print \"The number you entered is \", num, \" \"\n", + "else:\n", + " print \"You did not enter a positive number\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive number: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "-1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Number must be positive; try again (Y/N): " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "N\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " You did not enter a positive number\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 8.8, page no. 169" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "counter = 0\n", + "total = 0\n", + "print \"How many items do you want to buy: \",\n", + "num = int(raw_input())\n", + "while(counter < num):\n", + " counter += 1\n", + " if (counter % 13 == 0):\n", + " continue\n", + " total += 3\n", + "print \"Total for \", num, \" items is $\", total" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 8.9, page no. 169" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "counter = 0\n", + "total = 0\n", + "print \"How many items do you want to buy: \",\n", + "num = int(raw_input())\n", + "keepgoing = True\n", + "while(counter < num):\n", + " counter += 1\n", + " if (not(counter % 13 == 0)):\n", + " total += 3;\n", + "print \"Total for \", num, \" items is $\", total" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many items do you want to buy: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total for 4 items is $ 12\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 8.10, page no. 170" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "x = 0\n", + "while(x < 5):\n", + " x += 1\n", + " y = 0\n", + " while(y < 5):\n", + " y += 1\n", + " print \"X\",\n", + " print '\\n'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "X X X X X \n", + "\n", + "X X X X X \n", + "\n", + "X X X X X \n", + "\n", + "X X X X X \n", + "\n", + "X X X X X \n", + "\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 8.11, page no. 171" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "quit = False\n", + "print \"Enter a positive number: \",\n", + "num = int(raw_input())\n", + "while (num <= 0 and quit == False):\n", + " print \"Number must be positive; try again (Y/N): \",\n", + " choice = raw_input()\n", + " if (choice is 'Y'):\n", + " print \"Enter number: \",\n", + " num = int(raw_input())\n", + " else:\n", + " quit = True\n", + "if (quit == False):\n", + " print \"The number you entered is \", num, \" \"\n", + "else:\n", + " print \"You did not enter a positive number\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive number: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The number you entered is 3 \n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter9-checkpoint.ipynb b/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter9-checkpoint.ipynb new file mode 100644 index 00000000..78228f18 --- /dev/null +++ b/C++_Demystified:_A_Self-Teaching_Guide/.ipynb_checkpoints/chapter9-checkpoint.ipynb @@ -0,0 +1,988 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:f0e84b29896f17b0ff44f8bccf20cf041a408375d83b3bc2290848ec54364369" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 9 - Functions" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 9.1, page no. 179" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def main(): #defining a function \n", + " print \"Hello World!\"\n", + "\n", + "main()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello World!\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 9.2, page no. 180" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def printMessage(): # defining function\n", + " print \"Hello world!\"\n", + "\n", + "printMessage() # calling the function" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello world!\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 9.3, page no. 181" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "printMessage();\n", + "\n", + "def printMessage():\n", + " print \"Hello world!\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello world!\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 9.4, page no. 182" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def printMessage():\n", + " print \"Hello world!\"\n", + "\n", + "printMessage()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello world!\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 9.5, page no. 184" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def printMessage():\n", + " times += 1\n", + " print \"This function called \", times, \" times\"\n", + "\n", + "\n", + "times = 0\n", + "choice = '1'\n", + "while(choice != 'Q'):\n", + " print \"Enter Q to quit, any other character to continue: \",\n", + " choice = raw_input()\n", + " if (choice == 'Q'):\n", + " print \"Input stopped\"\n", + " else:\n", + " printMessage()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Q to quit, any other character to continue: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "e\n" + ] + }, + { + "ename": "UnboundLocalError", + "evalue": "local variable 'times' referenced before assignment", + "output_type": "pyerr", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mUnboundLocalError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 17\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"Input stopped\"\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 18\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 19\u001b[1;33m \u001b[0mprintMessage\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;32m\u001b[0m in \u001b[0;36mprintMessage\u001b[1;34m()\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 6\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mprintMessage\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 7\u001b[1;33m \u001b[0mtimes\u001b[0m \u001b[1;33m+=\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 8\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"This function called \"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mtimes\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m\" times\"\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 9\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mUnboundLocalError\u001b[0m: local variable 'times' referenced before assignment" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 9.6, page no. 185" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def printMessage():\n", + " times = 0\n", + " times += 1\n", + " print \"This function called \", times, \" times\"\n", + "\n", + "\n", + "choice = '1'\n", + "while(choice != 'Q'):\n", + " print \"Enter Q to quit, any other character to continue: \",\n", + " choice = raw_input()\n", + " if (choice == 'Q'):\n", + " print \"Input stopped\"\n", + " else:\n", + " printMessage()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter Q to quit, any other character to continue: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "w\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " This function called 1 times\n", + "Enter Q to quit, any other character to continue: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "q\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " This function called 1 times\n", + "Enter Q to quit, any other character to continue: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Q\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Input stopped\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 9.7, page no. 186" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "times = 0\n", + "def printMessage():\n", + " global times\n", + " times += 1\n", + " print \"This function called \", times, \" times\"\n", + "\n", + "\n", + "choice = '1'\n", + "while(choice != 'Q'):\n", + " print \"Enter Q to quit, any other character to continue: \",\n", + " choice = raw_input()\n", + " if (choice == 'Q'):\n", + " print \"Input stopped\"\n", + " else:\n", + " printMessage()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Q to quit, any other character to continue: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "w\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " This function called 1 times\n", + "Enter Q to quit, any other character to continue: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "t\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " This function called 2 times\n", + "Enter Q to quit, any other character to continue: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "u\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " This function called 3 times\n", + "Enter Q to quit, any other character to continue: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Q\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Input stopped\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 9.8, page no. 189" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "times = 0\n", + "def printMessage():\n", + " global times\n", + " times += 1\n", + " print \"This function called \", times, \" times\"\n", + "\n", + "\n", + "choice = '1'\n", + "while(choice != 'Q'):\n", + " print \"Enter Q to quit, any other character to continue: \",\n", + " choice = raw_input()\n", + " if (choice == 'Q'):\n", + " print \"Input stopped\"\n", + " else:\n", + " printMessage()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Q to quit, any other character to continue: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "w\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " This function called 1 times\n", + "Enter Q to quit, any other character to continue: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "r\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " This function called 2 times\n", + "Enter Q to quit, any other character to continue: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "t\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " This function called 3 times\n", + "Enter Q to quit, any other character to continue: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Q\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Input stopped\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 9.9, page no. 190" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def printMessage():\n", + " print \"You inputted \", str\n", + "\n", + "print \"Enter a string: \",\n", + "str = raw_input()\n", + "printMessage()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a string: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Jeff\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " You inputted Jeff\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 9.10, page no. 191" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def printMessage(s):\n", + " print \"You inputted \", s\n", + "\n", + "print \"Enter a string: \",\n", + "str = raw_input()\n", + "printMessage(str)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a string: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Jeff\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " You inputted Jeff\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 9.11, page no. 193" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def printMessage(firstName, lastName):\n", + " print \"Your name is \", firstName, \" \", lastName\n", + "\n", + "print \"Enter first name:\",\n", + "name1 = raw_input()\n", + "print \"Enter last name:\",\n", + "name2 = raw_input()\n", + "printMessage(name1, name2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter first name:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Jeff\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter last name:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Kent\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Your name is Jeff Kent\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 9.12, page no. 194" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def printMessage(thename, theage):\n", + " print \"Your name is \", thename, \" and your age is\", theage\n", + "\n", + "print \"Enter name:\",\n", + "name = raw_input()\n", + "print \"Enter age:\",\n", + "age = int(raw_input())\n", + "printMessage(name, age)\n", + "printMessage(age, name)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Jeff\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter age:" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "34\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Your name is Jeff and your age is 34\n", + "Your name is 34 and your age is Jeff\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 9.13, page no. 195" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def doubleIt(x):\n", + " print \"The number to be doubled is \", x\n", + " x *= 2\n", + " print \"The number doubled in doubleIt is \", x\n", + "\n", + "print \"Enter number: \",\n", + "num = int(raw_input())\n", + "doubleIt(num)\n", + "print \"The number doubled outside the function is \", num," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter number: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "34\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The number to be doubled is 34\n", + "The number doubled in doubleIt is 68\n", + "The number doubled outside the function is 34\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 9.14, page no. 196" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "li = [0]\n", + "def doubleIt():\n", + " print \"The number to be doubled is \", li[0]\n", + " li[0] *= 2\n", + " print \"The number doubled in doubleIt is \", li[0]\n", + " \n", + "print \"Enter number: \",\n", + "num = int(raw_input())\n", + "li[0] = num\n", + "doubleIt()\n", + "print \"The number doubled outside the function is \", li[0]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter number: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The number to be doubled is 5\n", + "The number doubled in doubleIt is 10\n", + "The number doubled outside the function is 10\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 9.15, page no. 197" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "z = []\n", + "def addNumbers (a, b):\n", + " z.append(a + b)\n", + "\n", + "\n", + "print \"Enter first number: \",\n", + "firstNum = int(raw_input())\n", + "print \"Enter second number: \",\n", + "secondNum = int(raw_input())\n", + "addNumbers(firstNum, secondNum)\n", + "print firstNum, \" + \", secondNum, \" = \", z[0]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter first number: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter second number: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 3 + 4 = 7\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 9.16, page no. 199" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def addNumbers(x, y):\n", + " return x + y\n", + "\n", + "print \"Enter first number: \",\n", + "firstNum = int(raw_input())\n", + "print \"Enter second number: \",\n", + "secondNum = int(raw_input())\n", + "sum = addNumbers(firstNum, secondNum)\n", + "print firstNum, \" + \", secondNum, \" = \", sum\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter first number: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter second number: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 4 + 5 = 9\n" + ] + } + ], + "prompt_number": 24 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_from_the_Ground/.ipynb_checkpoints/Chapter_10(1)-checkpoint.ipynb b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_10(1)-checkpoint.ipynb new file mode 100644 index 00000000..b19c3a4c --- /dev/null +++ b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_10(1)-checkpoint.ipynb @@ -0,0 +1,560 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:73c04e2c14bfab695e4acf07dc7752334b6372d624570a4e051fd91aeeb761f7" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 10: Structures and Unions

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.1, Page Number: 223

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class inv_type:\n", + " def __init__(self):\n", + " self.item=None\n", + " self.cost=0\n", + " self.retail=0\n", + " self.on_hand=0\n", + " self.lead_time=0\n", + "\n", + "#Variable declaration\n", + "size=100 \n", + "invtry = []*size\n", + "i=5 #User iput for menu selection\n", + "\n", + "#Initialize the array\n", + "def init_list():\n", + " for t in range(size):\n", + " invtry.append(inv_type())\n", + " \n", + "#get a menu selection\n", + "def menu():\n", + " global i\n", + " print \"(E)nter\"\n", + " print \"(D)isplay\"\n", + " print \"(U)pdate\"\n", + " print \"(Q)uit\"\n", + " print \"choose one: \"\n", + " i-=1\n", + " return i\n", + "\n", + "#enter items into the list\n", + "def enter():\n", + " #find the first free structure\n", + " for i in range(size):\n", + " if not(invtry[i].item==None):\n", + " break\n", + " #i will be size if list is full\n", + " if i==size:\n", + " print \"List full.\"\n", + " return\n", + " input(i)\n", + " \n", + "#Input the information\n", + "def input(i):\n", + " #Enter information; User input\n", + " invtry[i].item=\"Gloves\"\n", + " invtry[i].cost=10\n", + " invtry[i].retail=25\n", + " invtry[i].on_hand=50\n", + " invtry[i].lead_time=10\n", + " \n", + "#Modify an existing item\n", + "def update():\n", + " name=\"Gloves\" #User input\n", + " for i in range(size):\n", + " if not(name==invtry[i].item):\n", + " break\n", + " if i==size:\n", + " print \"Item not found.\"\n", + " return\n", + " print \"Enter new information.\"\n", + " input(i)\n", + " \n", + "#Display the list\n", + "def display():\n", + " for t in range(size):\n", + " if not(invtry[t].item==None):\n", + " print invtry[t].item\n", + " print \"Cost: $\",invtry[t].cost\n", + " print \"Retail: $\",invtry[t].retail\n", + " print \"On hand: \",invtry[t].on_hand\n", + " print \"Resupply time: \",invtry[t].lead_time,\" days\"\n", + " \n", + "\n", + "init_list()\n", + "while True:\n", + " choice=menu()\n", + " if choice==4:\n", + " enter()\n", + " elif choice==3:\n", + " display()\n", + " elif choice==2:\n", + " update()\n", + " elif choice==1:\n", + " break" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(E)nter\n", + "(D)isplay\n", + "(U)pdate\n", + "(Q)uit\n", + "choose one: \n", + "(E)nter\n", + "(D)isplay\n", + "(U)pdate\n", + "(Q)uit\n", + "choose one: \n", + "Gloves\n", + "Cost: $ 10\n", + "Retail: $ 25\n", + "On hand: 50\n", + "Resupply time: 10 days\n", + "(E)nter\n", + "(D)isplay\n", + "(U)pdate\n", + "(Q)uit\n", + "choose one: \n", + "Enter new information.\n", + "(E)nter\n", + "(D)isplay\n", + "(U)pdate\n", + "(Q)uit\n", + "choose one: \n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.2, Page Number: 226

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class sample:\n", + " a=None\n", + " ch=None\n", + " \n", + "def f1(parm):\n", + " print parm.a,\" \",parm.ch\n", + "\n", + "#declare arg\n", + "arg=sample() \n", + "\n", + "#initialize arg\n", + "arg.a=1000\n", + "arg.ch='X'\n", + "\n", + "#call function\n", + "f1(arg)\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1000 X\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.3, Page Number: 227

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class stype:\n", + " a=None\n", + " b=None\n", + "\n", + "#Variable declaration\n", + "svar1=stype()\n", + "svar2=stype()\n", + "\n", + "svar1.a=svar1.b=10\n", + "svar2.a=svar2.b=20\n", + "\n", + "print \"Structures before assignment.\"\n", + "print \"svar1: \",svar1.a,' ',svar1.b\n", + "print \"svar1: \",svar2.a,' ',svar2.b\n", + "\n", + "svar2=svar1 #assign structures\n", + "\n", + "#Result\n", + "print \"\\nStructures before assignment.\"\n", + "print \"svar1: \",svar1.a,' ',svar1.b\n", + "print \"svar1: \",svar2.a,' ',svar2.b" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Structures before assignment.\n", + "svar1: 10 10\n", + "svar1: 20 20\n", + "\n", + "Structures before assignment.\n", + "svar1: 10 10\n", + "svar1: 10 10\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.4, Page Number: 230

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import datetime\n", + "\n", + "date=datetime.datetime.now()\n", + "\n", + "#Result\n", + "print date.time()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "17:06:28.236000\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.5, Page Number: 231

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import datetime\n", + "\n", + "date=datetime.datetime.now()\n", + "\n", + "#Result\n", + "print date.ctime()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sat Sep 14 17:07:14 2013\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.6, Page Number: 232

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class mystruct:\n", + " a=None\n", + " b=None\n", + "\n", + "def f(var):\n", + " var[0].a=var[0].a*var[0].a\n", + " var[0].b=var[0].b/var[0].b\n", + " return var[0]\n", + " \n", + "#Variable declaration\n", + "x=[]\n", + "x.append(mystruct())\n", + "y=mystruct()\n", + "\n", + "#Initializing\n", + "x[0].a=10\n", + "x[0].b=20\n", + "\n", + "print \"Original x.a and x.b: \",x[0].a,' ',x[0].b\n", + "\n", + "y=f(x) #function call\n", + "\n", + "#Result\n", + "print \"Modified x.a and x.b: \",x[0].a,' ',x[0].b\n", + "print \"Modified y.a and y.b: \",y.a,' ',y.b\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Original x.a and x.b: 10 20\n", + "Modified x.a and x.b: 100 1\n", + "Modified y.a and y.b: 100 1\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.7, Page Number: 239

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class swap_bytes:\n", + " ch=[0,0]\n", + "\n", + "#Exchange of bytes\n", + "def disp_binary(u):\n", + " t=128\n", + " while not(t==0):\n", + " if u&t:\n", + " print \"1 \",\n", + " else:\n", + " print \"0 \",\n", + " t=t/2\n", + "\n", + "#Variable declaration\n", + "sb=swap_bytes()\n", + "\n", + "sb.ch[0]=15\n", + "\n", + "print \"Original bytes: \",\n", + "disp_binary(sb.ch[1])\n", + "disp_binary(sb.ch[0])\n", + "\n", + "#Exchange bytes\n", + "temp=sb.ch[0]\n", + "sb.ch[0]=sb.ch[1]\n", + "sb.ch[1]=temp\n", + "\n", + "#Result\n", + "print \"\\nExchanged bytes: \",\n", + "disp_binary(sb.ch[1])\n", + "disp_binary(sb.ch[0])\n", + "\n", + "\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Original bytes: 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 \n", + "Exchanged bytes: 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 \n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.8, Page Number: 240

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "ch='a'\n", + "\n", + "while True:\n", + " print \"\\n\",ch,\n", + " print bin(ord(ch)) #Display the bit pattern for each character\n", + " ch=chr(ord(ch)+1)\n", + " if ch=='r':\n", + " break" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "a 0b1100001\n", + "\n", + "b 0b1100010\n", + "\n", + "c 0b1100011\n", + "\n", + "d 0b1100100\n", + "\n", + "e 0b1100101\n", + "\n", + "f 0b1100110\n", + "\n", + "g 0b1100111\n", + "\n", + "h 0b1101000\n", + "\n", + "i 0b1101001\n", + "\n", + "j 0b1101010\n", + "\n", + "k 0b1101011\n", + "\n", + "l 0b1101100\n", + "\n", + "m 0b1101101\n", + "\n", + "n 0b1101110\n", + "\n", + "o 0b1101111\n", + "\n", + "p 0b1110000\n", + "\n", + "q 0b1110001\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.9, Page Number: 242

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "ch=['X','Y']\n", + "c=\"\"\n", + "def disp_bits(u):\n", + " t=128\n", + " global c\n", + " while not(t==0):\n", + " if u&t:\n", + " c=c+\"1\"\n", + " else:\n", + " c=c+\"0\"\n", + " t=t/2 \n", + " return c\n", + "\n", + "#Result\n", + "print \"union as chars: \",ch[0],ch[1]\n", + "print \"union as integer: \",\n", + "c= disp_bits(ord(ch[1]))\n", + "c= disp_bits(ord(ch[0]))\n", + "print int(str(c),2)\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "union as chars: X Y\n", + "union as integer: 22872\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_from_the_Ground/.ipynb_checkpoints/Chapter_11(1)-checkpoint.ipynb b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_11(1)-checkpoint.ipynb new file mode 100644 index 00000000..fdd70bcf --- /dev/null +++ b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_11(1)-checkpoint.ipynb @@ -0,0 +1,877 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:5428ee61d548a6c3eefd868dac96cac83b29f85d9bfd7876e9904bdfe87b0fad" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 11: Introducing the Class

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.1, Page Number: 249

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class queue:\n", + " #Initialize the queue \n", + " def __init__(self):\n", + " self.__sloc=0\n", + " self.__rloc=-1\n", + " self.__q=[]\n", + " \n", + " #Put an integer into the queue\n", + " def qput(self,i):\n", + " if self.__sloc==100:\n", + " print \"Queue is full.\"\n", + " return\n", + " self.__sloc+=1\n", + " self.__q.append(i)\n", + " \n", + " #Get an integer from the queue\n", + " def qget(self):\n", + " if self.__rloc==self.__sloc:\n", + " print \"Queue underflow\"\n", + " return\n", + " self.__rloc+=1\n", + " return self.__q[self.__rloc] \n", + " \n", + "\n", + " \n", + "#Create two queue objects\n", + "b=queue()\n", + "a=queue()\n", + "\n", + "a.qput(10)\n", + "b.qput(19)\n", + "\n", + "a.qput(20)\n", + "b.qput(1)\n", + "\n", + "#Result\n", + "print \"Contents of queue a: \",\n", + "print a.qget(),' ',a.qget()\n", + "\n", + "print \"Contents of queue b: \",\n", + "print b.qget(),' ',b.qget()\n", + "\n", + "\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Contents of queue a: 10 20\n", + "Contents of queue b: 19 1\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.2, Page Number: 250

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + " \n", + "class myclass:\n", + " def __init__(self):\n", + " self.__a=None #private member\n", + " self.b=None #public member\n", + " #public functions\n", + " def setlab(self,i):\n", + " self.__a=i #refer to a\n", + " self.b=i*i #refer to b\n", + " return\n", + " def geta(self):\n", + " return self.__a #refer to a\n", + " def reset(self):\n", + " #call setlab using self\n", + " self.setlab(0) #the object is already known\n", + " \n", + " \n", + "ob=myclass()\n", + "ob.setlab(5) #set ob.a and ob.b\n", + "print \"ob after setlab(5): \",ob.geta(),' ',\n", + "print ob.b #can access b because it is public\n", + "\n", + "ob.b=20 #can access b because it is public\n", + "print \"ob after ob.b=20: \",\n", + "print ob.geta(),' ',ob.b\n", + "\n", + "ob.reset()\n", + "print \"ob after ob.reset(): \",ob.geta(),' ',ob.b\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "ob after setlab(5): 5 25\n", + "ob after ob.b=20: 5 20\n", + "ob after ob.reset(): 0 0\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.3, Page Number: 254

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class queue:\n", + " \n", + " #Constructor\n", + " def __init__(self): \n", + " self.__q=[]\n", + " self.__rloc=-1\n", + " self.__sloc=0\n", + " print \"Queue initialized\"\n", + " \n", + " #Destructor\n", + " def __del__(self):\n", + " print (\"Queue destroyed\")\n", + " \n", + " #Put an integer into the queue\n", + " def qput(self,i):\n", + " if self.__sloc == 100:\n", + " print \"Queue is full\"\n", + " return \n", + " self.__sloc+=1\n", + " self.__q.append(i)\n", + " \n", + " #Get an integer from the queue\n", + " def qget(self):\n", + " if self.__rloc==self.__sloc:\n", + " print \"Queue underflow\"\n", + " return\n", + " self.__rloc+=1\n", + " return self.__q[self.__rloc]\n", + " \n", + "#Create two queue objects\n", + "a=queue()\n", + "\n", + "\n", + "a.qput(10)\n", + "a.qput(20)\n", + "b=queue()\n", + "b.qput(19)\n", + "\n", + "b.qput(1)\n", + "\n", + "#Result\n", + "print a.qget(),' ',\n", + "print a.qget(),' ',\n", + "print b.qget(),' ',\n", + "print b.qget(),' '\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Queue initialized\n", + "Queue destroyed\n", + "Queue initialized\n", + "Queue destroyed\n", + "10 20 19 1 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.4, Page Number: 257

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class queue: \n", + " \n", + " #Constructor\n", + " def __init__(self,i): \n", + " self.__q=[]\n", + " self.__rloc=-1\n", + " self.__sloc=0\n", + " self.__who=i\n", + " print \"Queue \",self.__who,\" initialized.\"\n", + " \n", + " #Destructor\n", + " def __del__():\n", + " print \"Queue \",self.__who,\" destroyed\"\n", + " \n", + " #Put an integer into the queue\n", + " def qput(self,i):\n", + " if self.__sloc == 100:\n", + " print \"Queue is full\"\n", + " return \n", + " self.__sloc+=1\n", + " self.__q.append(i)\n", + " \n", + " #Get an integer from the queue\n", + " def qget(self):\n", + " if self.__rloc==self.__sloc:\n", + " print \"Queue underflow\"\n", + " return\n", + " self.__rloc+=1\n", + " return self.__q[self.__rloc]\n", + " \n", + "a=queue(1)\n", + "b=queue(2)\n", + "\n", + "a.qput(10)\n", + "b.qput(19)\n", + "\n", + "a.qput(20)\n", + "b.qput(1)\n", + "\n", + "#Result\n", + "print a.qget(),' ',\n", + "print a.qget(),' ',\n", + "print b.qget(),' ',\n", + "print b.qget(),' '\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Queue 1 initialized.\n", + "Queue destroyed\n", + "Queue 2 initialized.\n", + "Queue destroyed\n", + "10 20 19 1 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.5, Page Number: 258

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class widget:\n", + " \n", + " #Pass two arguments to the constructor\n", + " def __init__(self,a,b):\n", + " self.__i=a\n", + " self.__j=b\n", + " \n", + " def put_widget(self):\n", + " print self.__i,\" \",self.__j\n", + "\n", + "#Initializing\n", + "x=widget(10,20)\n", + "y=widget(0,0)\n", + "\n", + "x.put_widget()\n", + "y.put_widget()\n", + "\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10 20\n", + "0 0\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.6, Page Number: 259

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class myclass:\n", + " \n", + " #Constructor\n", + " def __init__(self,x):\n", + " self.a=x\n", + " #To get the vale of a\n", + " def get_a(self):\n", + " return self.a\n", + "\n", + "#Initializing\n", + "ob=myclass(4)\n", + "\n", + "#Result\n", + "print ob.get_a()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.7, Page Number: 260

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from ctypes import *\n", + "\n", + "class c1(Structure):\n", + " _fields_=[(\"__i\", c_int)] #private member\n", + " def get_i(self): #public finctions\n", + " return self.__i\n", + " def put_i(self,j):\n", + " self.__i=j\n", + "\n", + "#Variable declaration\n", + "s=c1()\n", + "\n", + "s.put_i(10)\n", + "\n", + "#Result\n", + "print s.get_i()\n", + " \n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.8, Page Number: 261

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class c1:\n", + " def __init__(self):\n", + " self.__i=None #private member\n", + " def get_i(self): #public finctions\n", + " return self.__i\n", + " def put_i(self,j):\n", + " self.__i=j\n", + "\n", + "#Variable declaration\n", + "s=c1()\n", + "\n", + "s.put_i(10)\n", + "\n", + "#Result\n", + "print s.get_i()\n", + " \n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.9, Page Number: 263

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from ctypes import *\n", + "\n", + "#Creates a union\n", + "class u_type(Union):\n", + " _fields_ = [(\"i\",c_short),\n", + " (\"ch\", c_char*2)]\n", + " #Constructor\n", + " def __init__(self,a):\n", + " self.i=a\n", + " \n", + " #Show the characters that comprise a short int.\n", + " def showchars(self):\n", + " print self.ch[0]\n", + " print self.ch[1]\n", + " \n", + " \n", + "u=u_type(1000)\n", + "\n", + "#Displays char of 1000\n", + "u.showchars()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\ufffd\n", + "\u0003\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.10, Page Number: 264

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class c1:\n", + " def __init__(self):\n", + " self.__i=None\n", + " def get_i(self):\n", + " return self.i\n", + " def put_i(self,j):\n", + " self.i=j\n", + "\n", + "#Variable declaration\n", + "s=c1()\n", + "\n", + "s.put_i(10)\n", + "\n", + "#Result\n", + "print s.get_i()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.11, Page Number: 265

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class c1:\n", + " def __init__(self):\n", + " self.__i=None\n", + " def get_i(self):\n", + " return self.i\n", + " def put_i(self,j):\n", + " self.i=j\n", + "\n", + "#Variable declaration\n", + "s=c1()\n", + "\n", + "s.put_i(10)\n", + "\n", + "#Result\n", + "print s.get_i()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.12, Page Number: 267

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class display:\n", + " def __init__(self):\n", + " width=None\n", + " height=None\n", + " res=None\n", + " def set_dim(self,w,h):\n", + " self.width=w\n", + " self.height=h\n", + " def get_dim(self):\n", + " return self.width,self.height\n", + " def set_res(self,r):\n", + " self.res=r\n", + " def get_res(self):\n", + " return self.res\n", + " \n", + "#Variable decleration\n", + "names=[\"low\",\"medium\",\"high\"] \n", + "(low,medium,high)=(0,1,2) #For enumeration type\n", + "w=None\n", + "h=None\n", + "display_mode=[]*3\n", + "\n", + "for i in range(3):\n", + " display_mode.append(display())\n", + "\n", + "#Initialize the array of objects using member functions\n", + "display_mode[0].set_res(low)\n", + "display_mode[0].set_dim(640,480)\n", + "\n", + "display_mode[1].set_res(medium)\n", + "display_mode[1].set_dim(800,600)\n", + "\n", + "display_mode[2].set_res(high)\n", + "display_mode[2].set_dim(1600,1200)\n", + "\n", + "#Result\n", + "print \"Available display modes: \"\n", + "for i in range(3):\n", + " print names[display_mode[i].get_res()],\" : \",\n", + " w,h=display_mode[i].get_dim()\n", + " print w,\" by \",h" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Available display modes: \n", + "low : 640 by 480\n", + "medium : 800 by 600\n", + "high : 1600 by 1200\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.13, Page Number: 268

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class samp:\n", + " __a=None\n", + " def __init__(self,n):\n", + " self.__a=n\n", + " def get_a(self):\n", + " return self.__a\n", + "\n", + "#Initializing the list\n", + "sampArray=[samp(-1),samp(-2),samp(-3),samp(-4)]\n", + "\n", + "#Display\n", + "for i in range(4):\n", + " print sampArray[i].get_a(),' '," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "-1 -2 -3 -4 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.14, Page Number: 269

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class samp:\n", + " __a=None\n", + " __b=None\n", + " def __init__(self,n,m):\n", + " self.__a=n\n", + " self.__b=m\n", + " def get_a(self):\n", + " return self.__a\n", + " def get_b(self):\n", + " return self.__b\n", + " \n", + "#Initializing the list\n", + "sampArray=[[samp(1,2),samp(3,4)],\n", + " [samp(5,6),samp(7,8)],\n", + " [samp(9,10),samp(11,12)],\n", + " [samp(13,14),samp(15,16)]]\n", + "\n", + "#Display\n", + "for i in range(4):\n", + " print sampArray[i][0].get_a(),' ',\n", + " print sampArray[i][0].get_b()\n", + " print sampArray[i][1].get_a(),' ',\n", + " print sampArray[i][1].get_b()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 2\n", + "3 4\n", + "5 6\n", + "7 8\n", + "9 10\n", + "11 12\n", + "13 14\n", + "15 16\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.15, Page Number: 270

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from ctypes import *\n", + "\n", + "class P_example(Structure):\n", + " __num=None\n", + " def set_num(self,val):\n", + " self.__num=val\n", + " def show_num(self):\n", + " print self.__num\n", + "\n", + "#Variable declaration\n", + "ob=P_example() #Declare an object to the structure\n", + "p=POINTER(P_example) #Declare a pointer to the structure\n", + "\n", + "ob.set_num(1) #access ob directly\n", + "ob.show_num()\n", + "\n", + "p=ob #assign p the address of ob\n", + "p.show_num() #access ob using pointer\n", + " \n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n", + "1\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.16, Page Number: 271

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class P_example(Structure):\n", + " __num=None\n", + " def set_num(self,val):\n", + " self.__num=val\n", + " def show_num(self):\n", + " print self.__num\n", + " \n", + "#Variable declaration\n", + "ob=[P_example(),P_example()] #Declare an object to the structure\n", + "p=POINTER(P_example) #Declare a pointer to the structure\n", + "\n", + "ob[0].set_num(10) #access objects directly\n", + "ob[1].set_num(20)\n", + "\n", + "p=ob #obtain pointer to first element\n", + "p[0].show_num() #access ob using pointer\n", + "\n", + "p[1].show_num()\n", + "\n", + "p[0].show_num()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n", + "20\n", + "10\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_from_the_Ground/.ipynb_checkpoints/Chapter_12(1)-checkpoint.ipynb b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_12(1)-checkpoint.ipynb new file mode 100644 index 00000000..a29c9b4d --- /dev/null +++ b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_12(1)-checkpoint.ipynb @@ -0,0 +1,904 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:0b4a52abc3f3246965d1e59241352e867e78e448510ae25e91b7d38dc4dcc202" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 12: A Closer Look at Classes

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.1, Page Number: 274

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class myclass:\n", + " __a=None\n", + " __b=None\n", + " def __init__(self,i,j):\n", + " self.__a=i\n", + " self.__b=j\n", + " def sum(self,x): #Friend function\n", + " return sum1(x)\n", + " \n", + "def sum1(x): \n", + " return x._myclass__a +x._myclass__b #accessing private members\n", + "\n", + "#Variable declaration\n", + "n=myclass(3,4)\n", + "\n", + "#Result\n", + "print n.sum(n)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.2, Page Number: 275

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class c1:\n", + " __status=None\n", + " def set_status(self,state):\n", + " self.__status=state\n", + " \n", + "class c2:\n", + " __status=None\n", + " def set_status(self,state):\n", + " self.status=state\n", + " \n", + "#Friend function \n", + "def idle(a,b):\n", + " if a._c1__status or b._c2__status :\n", + " return 0\n", + " else:\n", + " return 1\n", + " \n", + "#variable declarations\n", + "def IDLE(): #Constants\n", + " return 0\n", + "def INUSE():\n", + " return 1\n", + "x=c1()\n", + "y=c2()\n", + "\n", + "x.set_status(IDLE())\n", + "y.set_status(IDLE())\n", + "\n", + "if idle(x,y):\n", + " print \"Screen Can Be Used.\"\n", + " \n", + "x.set_status(INUSE())\n", + "\n", + "if idle(x,y):\n", + " print \"Screen Can Be Used.\"\n", + "else:\n", + " print \"Pop-up In Use.\"\n", + " \n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Screen Can Be Used.\n", + "Pop-up In Use.\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.3, Page Number: 277

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def IDLE(): \n", + " return 0\n", + "def INUSE():\n", + " return 1\n", + "\n", + "class c1:\n", + " __status=None\n", + " def set_status(self,state):\n", + " self.__status=state\n", + " def idle(self,b): #now a member of c1\n", + " if self.__status or b._c2__status :\n", + " return 0\n", + " else:\n", + " return 1\n", + " \n", + "class c2:\n", + " __status=None #IDLE if off INUSE if on screen\n", + " def set_status(self,state):\n", + " self.status=state\n", + " \n", + "#Variable declarations \n", + "x=c1()\n", + "y=c2()\n", + "\n", + "x.set_status(IDLE())\n", + "y.set_status(IDLE())\n", + "\n", + "if idle(x,y):\n", + " print \"Screen Can Be Used.\"\n", + " \n", + "x.set_status(INUSE())\n", + "\n", + "if idle(x,y):\n", + " print \"Screen Can Be Used.\"\n", + "else:\n", + " print \"Pop-up In Use.\"\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Screen Can Be Used.\n", + "Pop-up In Use.\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.4, Page Number: 278

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import time,string\n", + "\n", + "class timer:\n", + " __seconds=None\n", + " \n", + " def __init__(self,t1,t2=None):\n", + " if t2==None:\n", + " if isinstance(t1,int): #seconds specified as an integer\n", + " self.__seconds=t1\n", + " else: #seconds specified as a string\n", + " self.__seconds=string.atoi(t1)\n", + " else: #time in minutes and seconds\n", + " self.__seconds=t1*60+t2\n", + " \n", + " def run(self):\n", + " t1=time.clock()\n", + " while (time.clock()-t1)Example 12.5, Page Number: 280

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import time,string\n", + "\n", + "class timer:\n", + " __seconds=None\n", + " \n", + " def __init__(self,t1,t2=None):\n", + " if t2==None:\n", + " if isinstance(t1,int): #seconds specified as an integer\n", + " self.__seconds=t1\n", + " else: #seconds specified as a string\n", + " self.__seconds=string.atoi(t1)\n", + " else: #time in minutes and seconds\n", + " self.__seconds=t1*60+t2\n", + " \n", + " def run(self):\n", + " t1=time.clock()\n", + " while (time.clock()-t1)Example 12.6, Page Number: 282

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class myclass:\n", + " __a=None #private members\n", + " __b=None\n", + " def setab(self,i,j): #publc functons\n", + " self.__a=i\n", + " self.__b=j\n", + " def showab(self):\n", + " print \"a is \",self.__a\n", + " print \"b is \",self.__b\n", + "\n", + "#Variable declaration\n", + "ob1 = myclass()\n", + "ob2 = myclass()\n", + "\n", + "#Intalizing\n", + "ob1.setab(10,20)\n", + "ob2.setab(0,0)\n", + "\n", + "print \"ob1 before assignment: \"\n", + "ob1.showab()\n", + "print \"ob2 before assignment: \"\n", + "ob2.showab()\n", + "\n", + "ob2 = ob1 #assign ob1 to ob2\n", + "\n", + "#Result\n", + "print \"ob1 after assignment: \"\n", + "ob1.showab()\n", + "print \"ob2 after assignment: \"\n", + "ob2.showab()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "ob1 before assignment: \n", + "a is 10\n", + "b is 20\n", + "ob2 before assignment: \n", + "a is 0\n", + "b is 0\n", + "ob1 after assignment: \n", + "a is 10\n", + "b is 20\n", + "ob2 after assignment: \n", + "a is 10\n", + "b is 20\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.7, Page Number: 283

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from copy import deepcopy\n", + " \n", + "class OBJ:\n", + " def set_i(self,x):\n", + " self.__i=x\n", + " def out_i(self):\n", + " print self.__i,\n", + " \n", + "def f(x):\n", + " x=deepcopy(x)\n", + " x.out_i() #outputs 10\n", + " x.set_i(100) #this affects only local copy\n", + " x.out_i() #outputs 100\n", + " \n", + "#Variable declaration\n", + "o=OBJ()\n", + "o.set_i(10)\n", + "f(o) \n", + "o.out_i() #still outputs 10, value of i unchanged\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10 100 10\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.8, Page Number: 284

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class myclass: \n", + " def __init__(self,i):\n", + " self.__val=i\n", + " print \"Constructing\"\n", + " def __del__(self):\n", + " print \"Destructing\"\n", + " def getval(self):\n", + " return self.__val\n", + " \n", + "def display(ob):\n", + " print ob.getval()\n", + "\n", + "#Varable declaration\n", + "a=myclass(10)\n", + "\n", + "display(a)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Constructing\n", + "Destructing\n", + "10\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.9, Page Number: 286

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from ctypes import *\n", + "\n", + "class myclass:\n", + " def __init__(self,i):\n", + " print \"Allocating p\"\n", + " self.p=pointer(c_int(i))\n", + " def __del__(self):\n", + " print \"Freeing p\"\n", + " def getval(self):\n", + " return self.p[0]\n", + " \n", + "def display(ob):\n", + " print ob.getval()\n", + "\n", + "#Variable declaration\n", + "a=myclass(10)\n", + "\n", + "display(a)\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Allocating p\n", + "10\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.10, Page Number: 287

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "from ctypes import *\n", + "class myclass:\n", + " def __init__(self,i):\n", + " print \"Allocating p\"\n", + " self.p=pointer(c_int(i))\n", + " def __del__(self):\n", + " print \"Freeing p\"\n", + " def getval(self):\n", + " return self.p[0]\n", + " \n", + "def display(ob):\n", + " print ob[0].getval()\n", + "\n", + "#Variable declaration\n", + "a=[]\n", + "a.append(myclass(10))\n", + "\n", + "display(a)\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Freeing p\n", + "Allocating p\n", + "10\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.11, Page Number: 288

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class sample:\n", + " __s=None\n", + " def show(self):\n", + " print self.__s\n", + " def set(self,str):\n", + " self.__s=str\n", + "\n", + "#Return an object of type sample\n", + "def input():\n", + " str=sample()\n", + " instr = \"Hello\" #User input\n", + " str.set(instr)\n", + " return str\n", + "\n", + "#Variable declaration\n", + "ob=sample()\n", + "\n", + "#assign returned object to ob\n", + "ob=input()\n", + "\n", + "#Result\n", + "ob.show()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.12, Page Number: 289

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class sample:\n", + " __s=None\n", + " def __init__(self):\n", + " self.__s=0\n", + " def __del__(self): \n", + " print \"Freeing p\"\n", + " def show(self):\n", + " print self.__s\n", + " def set(self,str):\n", + " self.__s=str\n", + " \n", + "#This function takes one object parameter\n", + "def input():\n", + " str=sample()\n", + " instr=\"Hello\" #User input\n", + " str.set(instr)\n", + " return str\n", + "\n", + "#Variable declaration\n", + "ob=sample()\n", + "\n", + "#assign returned object to ob\n", + "ob=input()\n", + "\n", + "#Result\n", + "ob.show()\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Freeing p\n", + "Freeing p\n", + "Hello\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.13, Page Number: 292

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class myclass:\n", + " __p=None\n", + " def __init__(self,i):\n", + " if isinstance(i,int):\n", + " print \"Allocating p\"\n", + " self.__p=i\n", + " else:\n", + " print \"Copy constructor called\"\n", + " self.__p=i.getval()\n", + " def __del__(self): \n", + " print \"Freeing p\"\n", + " def getval(self):\n", + " return self.__p\n", + " \n", + "#This function takes one object parameter\n", + "def display(ob):\n", + " print ob.getval()\n", + "\n", + "#Variable declaration\n", + "ob=myclass(10)\n", + "\n", + "#Result\n", + "display(ob)\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Allocating p\n", + "10\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.14, Page Number: 294

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "class myclass:\n", + " __p=None\n", + " def __init__(self,i):\n", + " if isinstance(i,int):\n", + " print \"Allocating p\"\n", + " self.__p=i\n", + " else:\n", + " print \"Copy constructor called\"\n", + " self.__p=i.getval()\n", + " def __del__(self): \n", + " print \"Freeing p\"\n", + " def getval(self):\n", + " return self.__p\n", + " \n", + "\n", + "#Variable declaration\n", + "a=myclass(10) #calls normal constructor\n", + "b=myclass(a) #calls copy constructor\n", + "\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Allocating p\n", + "Copy constructor called\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.15, Page Number: 295

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class myclass:\n", + " def __init__(self,i=0):\n", + " if isinstance(i,int):\n", + " print \"Normal constructor\"\n", + " else:\n", + " print \"Copy constructor\"\n", + "\n", + "\n", + "#Variable declaration\n", + "a=myclass() #calls normal constructor\n", + "\n", + "f=myclass()\n", + "a=myclass(f) #Invoke copyconstructor\n", + "\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Normal constructor\n", + "Normal constructor\n", + "Copy constructor\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.16, Page Number: 297

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class c1:\n", + " def __init__(self):\n", + " self.__i=None\n", + " def load_i(self,val):\n", + " self.__i=val\n", + " def get_i(self):\n", + " return self.__i\n", + " \n", + "#Variable declaration \n", + "o=c1()\n", + "\n", + "o.load_i(100)\n", + "\n", + "#Result\n", + "print o.get_i()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "100\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_from_the_Ground/.ipynb_checkpoints/Chapter_13(1)-checkpoint.ipynb b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_13(1)-checkpoint.ipynb new file mode 100644 index 00000000..6d12a5a7 --- /dev/null +++ b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_13(1)-checkpoint.ipynb @@ -0,0 +1,883 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:be0df45a07fa8844875025463a4211b5faab9834d4e1dd155b475b36ae6ea27e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 13: Operator Overloading

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 13.1, Page Number: 300

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class three_d:\n", + " def __init__(self,i=None,j=None,k=None):\n", + " if i==None:\n", + " self.x=self.y=self.z=0\n", + " else:\n", + " self.x=i\n", + " self.y=j\n", + " self.z=k\n", + " #Overload +\n", + " def __add__(self,op2):\n", + " temp=three_d()\n", + " temp.x=self.x + op2.x #These are integer additions\n", + " temp.y=self.y + op2.y #and the + retains its original\n", + " temp.z=self.z + op2.z #meaning relative to them.\n", + " return temp\n", + " #Overload assignment\n", + " def __assign__(self,op2):\n", + " self.x=op2.x #These are integer assignments\n", + " self.y=op2.y #and the = retains its original \n", + " self.z=op2.z #meaning relative to them\n", + " return self\n", + " #Show x,y,z coordinates\n", + " def show(self):\n", + " print self.x,\",\",self.y,\",\",self.z\n", + " \n", + "#Variable declaration\n", + "a=three_d(1,2,3)\n", + "b=three_d(10,10,10)\n", + "c=three_d()\n", + "\n", + "a.show()\n", + "b.show()\n", + "\n", + "#add a and b together\n", + "c=a+b\n", + "c.show()\n", + "\n", + "#add a,b and c together\n", + "c=a+b+c\n", + "c.show()\n", + "\n", + "#demonstrate multiple assignment\n", + "c=b=a\n", + "c.show()\n", + "b.show()\n", + " \n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 , 2 , 3\n", + "10 , 10 , 10\n", + "11 , 12 , 13\n", + "22 , 24 , 26\n", + "1 , 2 , 3\n", + "1 , 2 , 3\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 13.2, Page Number: 303

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class three_d:\n", + " def __init__(self,i=None,j=None,k=None):\n", + " if i==None:\n", + " self.x=self.y=self.z=0\n", + " else:\n", + " self.x=i\n", + " self.y=j\n", + " self.z=k\n", + " #Overload +\n", + " def __add__(self,op2):\n", + " temp=three_d()\n", + " temp.x=self.x + op2.x #These are integer additions\n", + " temp.y=self.y + op2.y #and the + retains its original\n", + " temp.z=self.z + op2.z #meaning relative to them.\n", + " return temp\n", + " #Overload assignment\n", + " def __assign__(self,op2):\n", + " self.x=op2.x #These are integer assignments\n", + " self.y=op2.y #and the = retains its original \n", + " self.z=op2.z #meaning relative to them\n", + " return self\n", + " #Overload the increment operator\n", + " def __iadd__(self,op2):\n", + " self.x+=op2\n", + " self.y+=op2\n", + " self.z+=op2\n", + " return self\n", + " #Show x,y,z coordinates\n", + " def show(self):\n", + " print self.x,\",\",self.y,\",\",self.z\n", + " \n", + "a=three_d(1,2,3)\n", + "b=three_d(10,10,10)\n", + "c=three_d()\n", + "\n", + "a.show()\n", + "b.show()\n", + "\n", + "#add a and b together\n", + "c=a+b\n", + "c.show()\n", + "\n", + "#add a,b and c together\n", + "c=a+b+c\n", + "c.show()\n", + "\n", + "#demonstrate multiple assignment\n", + "c=b=a\n", + "c.show()\n", + "b.show()\n", + " \n", + "#Increment c\n", + "c+=1\n", + "c.show()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 , 2 , 3\n", + "10 , 10 , 10\n", + "11 , 12 , 13\n", + "22 , 24 , 26\n", + "1 , 2 , 3\n", + "1 , 2 , 3\n", + "2 , 3 , 4\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 13.3, Page Number: 306

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class three_d:\n", + " def __init__(self,i=None,j=None,k=None):\n", + " if i==None:\n", + " self.x=self.y=self.z=0\n", + " else:\n", + " self.x=i\n", + " self.y=j\n", + " self.z=k\n", + " #Overload +\n", + " def __add__(self,op2):\n", + " temp=three_d()\n", + " temp.x=self.x + op2.x #These are integer additions\n", + " temp.y=self.y + op2.y #and the + retains its original\n", + " temp.z=self.z + op2.z #meaning relative to them.\n", + " return temp\n", + " #Overload assignment\n", + " def __assign__(self,op2):\n", + " self.x=op2.x #These are integer assignments\n", + " self.y=op2.y #and the = retains its original \n", + " self.z=op2.z #meaning relative to them\n", + " return self\n", + " #Overload the increment operator\n", + " def __iadd__(self,op2):\n", + " self.x+=op2\n", + " self.y+=op2\n", + " self.z+=op2\n", + " return self\n", + " #Show x,y,z coordinates\n", + " def show(self):\n", + " print self.x,\",\",self.y,\",\",self.z\n", + " \n", + "a=three_d(1,2,3)\n", + "b=three_d(10,10,10)\n", + "c=three_d()\n", + "\n", + "a.show()\n", + "b.show()\n", + "\n", + "#add a and b together\n", + "c=a+b\n", + "c.show()\n", + "\n", + "#add a,b and c together\n", + "c=a+b+c\n", + "c.show()\n", + "\n", + "#demonstrate multiple assignment\n", + "c=b=a\n", + "c.show()\n", + "b.show()\n", + " \n", + "#Increment c (prefix)\n", + "c+=1\n", + "c.show()\n", + "\n", + "#Increment c (postfix)\n", + "c+=1\n", + "c.show()\n", + "\n", + "#Implementing prefix\n", + "c+=1\n", + "a=c\n", + "a.show()\n", + "c.show()\n", + "\n", + "#Implementing postfix\n", + "a=c\n", + "a.show()\n", + "c+=1\n", + "c.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 , 2 , 3\n", + "10 , 10 , 10\n", + "11 , 12 , 13\n", + "22 , 24 , 26\n", + "1 , 2 , 3\n", + "1 , 2 , 3\n", + "2 , 3 , 4\n", + "3 , 4 , 5\n", + "4 , 5 , 6\n", + "4 , 5 , 6\n", + "4 , 5 , 6\n", + "5 , 6 , 7\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 13.4, Page Number: 310

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class three_d:\n", + " def __init__(self,i=None,j=None,k=None):\n", + " if i==None:\n", + " self.x=self.y=self.z=0\n", + " else:\n", + " self.x=i\n", + " self.y=j\n", + " self.z=k\n", + " #Overload +\n", + " def __add__(self,op2):\n", + " return add(self,op2)\n", + " #Overload assignment\n", + " def __assign__(self,op2):\n", + " self.x=op2.x #These are integer assignments\n", + " self.y=op2.y #and the = retains its original \n", + " self.z=op2.z #meaning relative to them\n", + " return self\n", + " #Show x,y,z coordinates\n", + " def show(self):\n", + " print self.x,\",\",self.y,\",\",self.z\n", + " \n", + "#friending the funcion\n", + "def add(op1,op2):\n", + " temp=three_d()\n", + " temp.x=op1.x + op2.x #These are integer additions\n", + " temp.y=op1.y + op2.y #and the + retains its original\n", + " temp.z=op1.z + op2.z #meaning relative to them.\n", + " return temp\n", + "\n", + "a=three_d(1,2,3)\n", + "b=three_d(10,10,10)\n", + "c=three_d()\n", + "\n", + "a.show()\n", + "b.show()\n", + "\n", + "#add a and b together\n", + "c=a+b\n", + "c.show()\n", + "\n", + "#add a,b and c together\n", + "c=a+b+c\n", + "c.show()\n", + "\n", + "#demonstrate multiple assignment\n", + "c=b=a\n", + "c.show()\n", + "b.show()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 , 2 , 3\n", + "10 , 10 , 10\n", + "11 , 12 , 13\n", + "22 , 24 , 26\n", + "1 , 2 , 3\n", + "1 , 2 , 3\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 13.5, Page Number: 311

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class CL:\n", + " def __init__(self):\n", + " self.count=0\n", + " def __assign__(self,obj):\n", + " self.count=obj.count\n", + " return self\n", + " def __add__(self,i): \n", + " return add(self,i)\n", + " def __radd__(self,i):\n", + " return radd(self,i)\n", + "\n", + "#This handles ob + int\n", + "def add(ob,i):\n", + " temp=CL()\n", + " temp.count=ob.count+i\n", + " return temp\n", + " \n", + "#This handles int + ob \n", + "def radd(ob,i):\n", + " temp=CL()\n", + " temp.count=i+ob.count\n", + " return temp\n", + "\n", + "#Variable declaration\n", + "o=CL()\n", + "o.count = 10\n", + "\n", + "#Result\n", + "print o.count, #outputs 10\n", + "o=10+o\n", + "print o.count, #outputs 20\n", + "o=o+12\n", + "print o.count #outputs 32\n", + "\n", + "\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10 20 32\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 13.6, Page Number: 314

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class three_d:\n", + " def __init__(self,i=None,j=None,k=None):\n", + " if i==None:\n", + " self.x=self.y=self.z=0\n", + " else:\n", + " self.x=i\n", + " self.y=j\n", + " self.z=k\n", + " #Overload +\n", + " def __add__(self,op2):\n", + " return add(self,op2)\n", + " #Overload assignment\n", + " def __assign__(self,op2):\n", + " self.x=op2.x #These are integer assignments\n", + " self.y=op2.y #and the = retains its original \n", + " self.z=op2.z #meaning relative to them\n", + " return self\n", + " #Overload the increment operator\n", + " def __iadd__(self,op2):\n", + " return iadd(self,op2)\n", + " #Show x,y,z coordinates\n", + " def show(self):\n", + " print self.x,\",\",self.y,\",\",self.z\n", + "\n", + "#friending the funcion\n", + "def add(op1,op2):\n", + " temp=three_d()\n", + " temp.x=op1.x + op2.x #These are integer additions\n", + " temp.y=op1.y + op2.y #and the + retains its original\n", + " temp.z=op1.z + op2.z #meaning relative to them.\n", + " return temp\n", + "def iadd(op1,op2):\n", + " op1.x+=op2\n", + " op1.y+=op2\n", + " op1.z+=op2\n", + " return op1\n", + " \n", + "a=three_d(1,2,3)\n", + "b=three_d(10,10,10)\n", + "c=three_d()\n", + "\n", + "a.show()\n", + "b.show()\n", + "\n", + "#add a and b together\n", + "c=a+b\n", + "c.show()\n", + "\n", + "#add a,b and c together\n", + "c=a+b+c\n", + "c.show()\n", + "\n", + "#demonstrate multiple assignment\n", + "c=b=a\n", + "c.show()\n", + "b.show()\n", + " \n", + "#Increment c (prefix)\n", + "c+=1\n", + "c.show()\n", + "\n", + "#Increment c (postfix)\n", + "c+=1\n", + "c.show()\n", + "\n", + "#Implementing prefix\n", + "c+=1\n", + "a=c\n", + "a.show()\n", + "c.show()\n", + "\n", + "#Implementing postfix\n", + "a=c\n", + "a.show()\n", + "c+=1\n", + "c.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 , 2 , 3\n", + "10 , 10 , 10\n", + "11 , 12 , 13\n", + "22 , 24 , 26\n", + "1 , 2 , 3\n", + "1 , 2 , 3\n", + "2 , 3 , 4\n", + "3 , 4 , 5\n", + "4 , 5 , 6\n", + "4 , 5 , 6\n", + "4 , 5 , 6\n", + "5 , 6 , 7\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 13.7, Page Number: 318

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class sample:\n", + " def __init__(self,ob=0):\n", + " if isinstance(ob,int):\n", + " #Normal constructor\n", + " self.__s=\"\"\n", + " return\n", + " else:\n", + " #Copy constructor\n", + " self.__s=obj._sample__s\n", + " return\n", + " def __del__(self):\n", + " print \"Freeing s\"\n", + " def show(self):\n", + " print self.__s\n", + " def set(self,str):\n", + " self.__s=str\n", + " def __assign__(self,ob): #Overload assignment\n", + " self.s=ob._sample__s\n", + " return self\n", + " \n", + "def input():\n", + " str=sample()\n", + " instr=\"Hello\" #User input\n", + " str.set(instr)\n", + " return str\n", + "\n", + "ob=sample()\n", + "\n", + "#assign returned object to ob\n", + "ob=input()\n", + "\n", + "#Result\n", + "ob.show()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Freeing s\n", + "Freeing s\n", + "Hello\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 13.8, Page Number: 321

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class atype:\n", + " def __init__(self):\n", + " self.__a=[]\n", + " for i in range(SIZE):\n", + " self.__a.append(i)\n", + " def a(self,i):\n", + " return self.__a[i]\n", + " \n", + "#Variable declaration\n", + "SIZE=3\n", + "ob=atype()\n", + "\n", + "#Result\n", + "print ob.a(2),\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 13.9, Page Number: 322

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class atype:\n", + " def __init__(self):\n", + " self.__a=[]\n", + " for i in range(SIZE):\n", + " self.__a.append(i)\n", + " def a(self,i,j=None):\n", + " if j==None:\n", + " return self.__a[i]\n", + " else:\n", + " self.__a[i]=j\n", + " \n", + "#Variable declaration\n", + "SIZE=3 \n", + "ob=atype()\n", + "\n", + "print ob.a(2), #displays 2\n", + "\n", + "ob.a(2,25)\n", + "\n", + "print ob.a(2) #now displays 25" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "2 25\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 13.10, Page Number: 323

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class atype:\n", + " def __init__(self):\n", + " self.__a=[]\n", + " for i in range(SIZE):\n", + " self.__a.append(i)\n", + " def a(self,i,j=None):\n", + " if (i<0 or i>SIZE-1):\n", + " print \"Index value of\",\n", + " print i,\"is out of bounds.\"\n", + " return\n", + " if j==None:\n", + " return self.__a[i]\n", + " else:\n", + " self.__a[i]=j\n", + " \n", + "#Variable declaration\n", + "SIZE=3 \n", + "ob=atype()\n", + "\n", + "print ob.a(2), #displays 2\n", + "\n", + "ob.a(2,25)\n", + "\n", + "print ob.a(2) #now displays 25\n", + "\n", + "ob.a(44,3) #generates runtime error, 3 out of bounds" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "2 25\n", + "Index value of 44 is out of bounds.\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 13.11, Page Number: 324

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class three_d:\n", + " def __init__(self,i=None,j=None,k=None):\n", + " if i==None:\n", + " self.x=self.y=self.z=0 #3-D coordinates\n", + " else:\n", + " self.x=i\n", + " self.y=j\n", + " self.z=k\n", + " #Show X,Y,Z coordinates\n", + " def show(self):\n", + " print self.x,\",\",self.y,\",\",self.z\n", + " #Overload ()\n", + " def a(self,a,b,c):\n", + " temp = three_d()\n", + " temp.x=self.x+a\n", + " temp.y=self.y+b\n", + " temp.z=self.z+c\n", + " return temp\n", + " \n", + "#Variable declaration\n", + "ob1=three_d(1,2,3)\n", + "\n", + "ob2=ob1.a(10,11,12) #invoke operator ()\n", + "\n", + "#Result\n", + "print \"ob1: \",\n", + "ob1.show()\n", + "print \"ob2: \",\n", + "ob2.show()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "ob1: 1 , 2 , 3\n", + "ob2: 11 , 13 , 15\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 13.12, Page Number: 326

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class str_type:\n", + " def __init__(self,str=\"\"):\n", + " self.__string=str\n", + " #String concatenation\n", + " def __add__(self,str):\n", + " temp=str_type()\n", + " if isinstance(str,str_type):\n", + " temp.__string=self.__string+str.__string\n", + " else:\n", + " temp.__string=self.__string+str\n", + " return temp\n", + " #String copy\n", + " def __assign__(self,str):\n", + " if isinstance(str,str_type):\n", + " self.__string=str.__string\n", + " else:\n", + " self.__string=str\n", + " return self\n", + " def show_str(self):\n", + " print self.__string\n", + " \n", + "a=str_type(\"Hello \")\n", + "b=str_type(\"There\")\n", + "c=a+b\n", + "c.show_str()\n", + "\n", + "a=str_type(\"to program in because\")\n", + "a.show_str()\n", + "\n", + "b=c=str_type(\"C++ is fun\")\n", + "\n", + "c=c+\" \"+a+\" \"+b\n", + "c.show_str()\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello There\n", + "to program in because\n", + "C++ is fun to program in because C++ is fun\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_from_the_Ground/.ipynb_checkpoints/Chapter_14(1)-checkpoint.ipynb b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_14(1)-checkpoint.ipynb new file mode 100644 index 00000000..2f8447ba --- /dev/null +++ b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_14(1)-checkpoint.ipynb @@ -0,0 +1,924 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:d3cc78f10810f320519cd1c8becefb4790578385b5c2b528dc88273651f18c12" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 14: Inheritance

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.1, Page Number: 333

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class road_vehicle:\n", + " def __init__(self):\n", + " self.__wheels=None\n", + " self.__passengers=None\n", + " def set_wheels(self,num):\n", + " self.__wheels=num\n", + " def get_wheels(self):\n", + " return self.__wheels\n", + " def set_pass(self,num):\n", + " self.__passengers=num\n", + " def get_pass(self):\n", + " return self.__passengers\n", + "\n", + "#Define a truck\n", + "class truck(road_vehicle):\n", + " def __init__(self):\n", + " self.__cargo=None\n", + " def set_cargo(self,size):\n", + " self.__cargo=size\n", + " def get_cargo(self):\n", + " return self.__cargo\n", + " def show(self):\n", + " print \"wheels: \",self.get_wheels()\n", + " print \"passengers: \",self.get_pass()\n", + " print \"cargo capacity in cubic feet: \",self.__cargo\n", + " \n", + "#Define an enum type\n", + "(car,van,wagon)=(1,2,3)\n", + "type=[\"car\",\"van\",\"wagon\"]\n", + " \n", + "#Define an automobile\n", + "class automobile(road_vehicle):\n", + " def __init__(self):\n", + " self.car_type=None\n", + " def set_type(self,t):\n", + " self.car_type=t\n", + " def get_type(self):\n", + " return self.car_type\n", + " def show(self):\n", + " print \"wheels: \",self.get_wheels()\n", + " print \"passengers: \",self.get_pass()\n", + " print \"type: \",\n", + " if self.get_type()==1:\n", + " print \"car\"\n", + " elif self.get_type()==2:\n", + " print \"van\"\n", + " elif self.get_type()==3:\n", + " print \"wagon\"\n", + " \n", + "#Variable declaration\n", + "t1=truck()\n", + "t2=truck()\n", + "c=automobile()\n", + "\n", + "t1.set_wheels(18)\n", + "t1.set_pass(2)\n", + "t1.set_cargo(3200)\n", + "\n", + "t2.set_wheels(6)\n", + "t2.set_pass(3)\n", + "t2.set_cargo(1200)\n", + "\n", + "t1.show()\n", + "t2.show()\n", + "\n", + "c.set_wheels(4)\n", + "c.set_pass(6)\n", + "c.set_type(van)\n", + "\n", + "c.show() \n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "wheels: 18\n", + "passengers: 2\n", + "cargo capacity in cubic feet: 3200\n", + "wheels: 6\n", + "passengers: 3\n", + "cargo capacity in cubic feet: 1200\n", + "wheels: 4\n", + "passengers: 6\n", + "type: van\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.2, Page Number: 335

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class base:\n", + " def __init__(self):\n", + " self.__i=self.__j=None\n", + " def set(self,a,b):\n", + " self.__i=a\n", + " self.__j=b\n", + " def show(self):\n", + " print self.__i,self.__j\n", + " \n", + "class derived(base):\n", + " def __init__(self,x):\n", + " self.__k=x\n", + " def showk(self):\n", + " print self.__k\n", + " \n", + "#Variable declaration\n", + "ob = derived(3)\n", + "\n", + "ob.set(1,2) #access member of base\n", + "ob.show() #access member of base\n", + "\n", + "ob.showk() #uses member of derived class\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 2\n", + "3\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.3, Page Number: 337

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class base:\n", + " def __init__(self):\n", + " self.__i=self.__j=None #These act as protected members\n", + " def set(self,a,b):\n", + " self.__i=a\n", + " self.__j=b\n", + " def show(self):\n", + " print self.__i,self.__j\n", + " \n", + "class derived(base):\n", + " def __init__(self):\n", + " self.__k=None\n", + " def setk(self):\n", + " self.__k=self._base__i*self._base__j #accessing private variables in derived class\n", + " def showk(self):\n", + " print self.__k\n", + " \n", + "#Variable declaration\n", + "ob = derived()\n", + "\n", + "ob.set(2,3) #OK, known to be derived\n", + "ob.show() #OK, known to be derived\n", + "\n", + "ob.setk()\n", + "ob.showk() #uses member of derived class\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "2 3\n", + "6\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.4, Page Number: 338

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class base:\n", + " def __init__(self):\n", + " self.__i=None\n", + " self.__j=None\n", + " def set(self,a,b):\n", + " self.__i=a\n", + " self.__j=b\n", + " def show(self):\n", + " print self.__i,self.__j\n", + " \n", + "class derived1(base):\n", + " def __init__(self):\n", + " self.__k=None\n", + " def setk(self):\n", + " self.__k=self._base__i*self._base__j\n", + " def showk(self):\n", + " print self.__k\n", + "\n", + "class derived2(derived1):\n", + " def __init__(self):\n", + " self.__m=None\n", + " def setm(self):\n", + " self.__m=self._base__i-self._base__j\n", + " def showm(self):\n", + " print self.__m\n", + " \n", + " \n", + "#Variable declaration\n", + "ob1 = derived1()\n", + "ob2 = derived2()\n", + "\n", + "ob1.set(2,3) #access member of base\n", + "ob1.show() #access member of base\n", + "ob1.setk() #uses member of derived1 class\n", + "ob1.showk() #uses member of derived1 class\n", + "\n", + "ob2.set(3,4) #access member of base\n", + "ob2.show() #access member of base\n", + "ob2.setk() #access member of derived1 class\n", + "ob2.setm() #access member of derived2 class\n", + "ob2.showk() #uses member of derived1 class\n", + "ob2.showm() #uses member of derived1 class\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "2 3\n", + "6\n", + "3 4\n", + "12\n", + "-1\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.5, Page Number: 341

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class base:\n", + " def __init__(self):\n", + " self.__i=None\n", + " self._j=None\n", + " self.k=None\n", + " def seti(self,a):\n", + " self.__i=a\n", + " def geti(self):\n", + " return i\n", + " \n", + "class derived(base):\n", + " def setj(self,a):\n", + " self._j=a\n", + " def setk(self,a):\n", + " self.k=a\n", + " def getj(self):\n", + " return self._j\n", + " def getk(self):\n", + " return self.k\n", + " \n", + "#Variable declaration \n", + "ob=derived()\n", + "\n", + "ob.setk(10)\n", + "print ob.getk(),\n", + "ob.setj(12)\n", + "print ob.getj()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10 12\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.6, Page Number: 342

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class base1:\n", + " def __init__(self):\n", + " self.x=None\n", + " def showx(self):\n", + " print self.x\n", + " \n", + "class base2:\n", + " def __init__(self):\n", + " self.y=None\n", + " def showy(self):\n", + " print self.y\n", + " \n", + "class derived(base1,base2):\n", + " def set(self,i,j):\n", + " self.x=i\n", + " self.y=j\n", + " \n", + "#Variable declaration\n", + "ob = derived()\n", + "\n", + "ob.set(10,20) #provided by derived\n", + "ob.showx() #from base1\n", + "ob.showy() #from base2\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n", + "20\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.7, Page Number: 343

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class base:\n", + " def __init__(self):\n", + " print \"Constructing base\"\n", + " def __del__(self):\n", + " print \"Destructing base\"\n", + "\n", + "class derived(base):\n", + " def __init__(self):\n", + " base.__init__(self)\n", + " print \"Constructing derived\"\n", + " def __del__(self):\n", + " print \"Destructing derived\"\n", + " for b in self.__class__.__bases__:\n", + " b.__del__(self)\n", + "\n", + "#Variable declaration\n", + "ob=derived()\n", + "\n", + "#Does nothing but construct and destruct ob" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Constructing base\n", + "Constructing derived\n", + "Destructing derived\n", + "Destructing base\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.8, Page Number: 344

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class base:\n", + " def __init__(self):\n", + " print \"Constructing base\"\n", + " def __del__(self):\n", + " print \"Destructing base\"\n", + "\n", + "class derived1(base):\n", + " def __init__(self):\n", + " base.__init__(self)\n", + " print \"Constructing derived1\"\n", + " def __del__(self):\n", + " print \"Destructing derived1\"\n", + " super(derived1,self).__del__(self)\n", + "\n", + "class derived2(derived1):\n", + " def __init__(self):\n", + " derived1.__init__(self)\n", + " print \"Constructing derived2\"\n", + " def __del__(self):\n", + " print \"Destructing derived2\"\n", + " super(self.__class__,self).__del__(self)\n", + " \n", + "#Variable declaration\n", + "ob=derived2()\n", + "\n", + "#Does nothing but construct and destruct ob" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.9, Page Number: 345

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class base1:\n", + " def __init__(self):\n", + " print \"Constructing base1\"\n", + " def __del__(self):\n", + " print \"Destructing base1\"\n", + " \n", + "class base2:\n", + " def __init__(self):\n", + " print \"Constructing base2\"\n", + " def __del__(self):\n", + " print \"Destructing base2\"\n", + " \n", + "class derived(base1,base2):\n", + " def __init__(self):\n", + " for b in self.__class__.__bases__:\n", + " b.__init__(self)\n", + " print \"Constructing derived\"\n", + " def __del__(self):\n", + " print \"Destructing derived\"\n", + " for b in self.__class__.__bases__:\n", + " b.__del__(self)\n", + " \n", + "#Variable declaration\n", + "ob = derived()\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Constructing base1\n", + "Constructing base2\n", + "Constructing derived\n", + "Destructing derived\n", + "Destructing base1\n", + "Destructing base2\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.10, Page Number: 347

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class base:\n", + " def __init__(self,x):\n", + " self._i=x\n", + " print \"Constructing base\"\n", + " def __del__(self):\n", + " print \"Destructing base\"\n", + "\n", + "class derived(base):\n", + " def __init__(self,x,y):\n", + " base.__init__(self,y)\n", + " self.__j=x\n", + " print \"Constructing derived\"\n", + " def __del__(self):\n", + " print \"Destructing derived\"\n", + " for b in self.__class__.__bases__:\n", + " b.__del__(self)\n", + " def show(self):\n", + " print self._i,self.__j\n", + "\n", + "#Variable declaration\n", + "ob=derived(3,4)\n", + "\n", + "#Result\n", + "ob.show() #shows 4 3" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Constructing base\n", + "Constructing derived\n", + "Destructing derived\n", + "Destructing base\n", + "4 3\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.11, Page Number: 348

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class base1:\n", + " def __init__(self,x):\n", + " self._i=x\n", + " print \"Constructing base1\"\n", + " def __del__(self):\n", + " print \"Destructing base1\"\n", + " \n", + "class base2:\n", + " def __init__(self,x):\n", + " self._k=x\n", + " print \"Constructing base2\"\n", + " def __del__(self):\n", + " print \"Destructing base2\"\n", + " \n", + "class derived(base1,base2):\n", + " def __init__(self,x,y,z):\n", + " self.__j=x\n", + " i=0\n", + " for b in self.__class__.__bases__:\n", + " if i==0:\n", + " b.__init__(self,y)\n", + " else :\n", + " b.__init__(self,z)\n", + " i+=1\n", + " print \"Constructing derived\"\n", + " def __del__(self):\n", + " print \"Destructing derived\"\n", + " for b in self.__class__.__bases__:\n", + " b.__del__(self)\n", + " def show(self):\n", + " print self._i,self.__j,self._k\n", + " \n", + "#Variable declaration\n", + "ob = derived(3,4,5)\n", + "\n", + "#Result\n", + "ob.show()\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Constructing base1\n", + "Constructing base2\n", + "Constructing derived\n", + "Destructing derived\n", + "Destructing base1\n", + "Destructing base2\n", + "4 3 5\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.12, Page Number: 348

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class base1:\n", + " def __init__(self,x):\n", + " self._i=x\n", + " print \"Constructing base1\"\n", + " def __del__(self):\n", + " print \"Destructing base1\"\n", + " \n", + "class base2:\n", + " def __init__(self,x):\n", + " self._k=x\n", + " print \"Constructing base2\"\n", + " def __del__(self):\n", + " print \"Destructing base2\"\n", + " \n", + "class derived(base1,base2):\n", + " def __init__(self,x,y):\n", + " i=0\n", + " for b in self.__class__.__bases__:\n", + " if i==0:\n", + " b.__init__(self,x)\n", + " else :\n", + " b.__init__(self,y)\n", + " i+=1\n", + " print \"Constructing derived\"\n", + " def __del__(self):\n", + " print \"Destructing derived\"\n", + " for b in self.__class__.__bases__:\n", + " b.__del__(self)\n", + " def show(self):\n", + " print self._i,self._k\n", + " \n", + "#Variable declaration\n", + "ob = derived(3,4)\n", + "\n", + "#Result\n", + "ob.show()\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Constructing base1\n", + "Constructing base2\n", + "Constructing derived\n", + "Destructing derived\n", + "Destructing base1\n", + "Destructing base2\n", + "3 4\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.13, Page Number: 351

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class base:\n", + " def __init__(self):\n", + " self.__i=None\n", + " self.j=self.k=None\n", + " def seti(self,x):\n", + " self.__i=x\n", + " def geti(self):\n", + " return self.__i\n", + "\n", + "class derived(base):\n", + " def __init__(self):\n", + " self.a=None\n", + "\n", + "\n", + "#Variable declaration\n", + "ob=derived()\n", + "\n", + "ob._base__i=10 #Accessing private members of base class\n", + "ob.j=20 #legal because j and k are public variable in base\n", + "ob.k=30\n", + "\n", + "ob.a=40 #legal because a is public in derived class\n", + "ob.seti(10)\n", + "\n", + "#Result\n", + "print ob.geti(),ob.j,ob.a" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10 20 40\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.14, Page Number: 354

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class base:\n", + " def __init__(self):\n", + " self.i=None\n", + "\n", + "#derived1 inherits base\n", + "class derived1(base):\n", + " def __init__(self):\n", + " self.__j=None\n", + " \n", + "#derived2 inherits base\n", + "class derived2(base):\n", + " def __init__(self):\n", + " self.__k=None\n", + "\n", + "#derived3 inherits from both derived1 and derived2\n", + "class derived3(derived1,derived2):\n", + " def __init__(self):\n", + " self.__sum=None\n", + " \n", + "#Variable declaration\n", + "ob=derived3()\n", + "\n", + "ob.i=10\n", + "ob.j=20\n", + "ob.k=30\n", + "\n", + "ob.sum=ob.i+ob.j+ob.k\n", + "\n", + "#Result\n", + "print ob.i,ob.j,ob.k,ob.sum" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10 20 30 60\n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.15, Page Number: 355

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class base:\n", + " def __init__(self):\n", + " self.i=None\n", + "\n", + "#derived1 inherits base\n", + "class derived1(base):\n", + " def __init__(self):\n", + " self.__j=None\n", + " \n", + "#derived2 inherits base\n", + "class derived2(base):\n", + " def __init__(self):\n", + " self.__k=None\n", + "\n", + "#derived3 inherits from both derived1 and derived2\n", + "class derived3(derived1,derived2):\n", + " def __init__(self):\n", + " self.__sum=None\n", + " \n", + "#Variable declaration\n", + "ob=derived3()\n", + "\n", + "ob.i=10\n", + "ob.j=20\n", + "ob.k=30\n", + "\n", + "ob.sum=ob.i+ob.j+ob.k\n", + "\n", + "#Result\n", + "print ob.i,ob.j,ob.k,ob.sum" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10 20 30 60\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_from_the_Ground/.ipynb_checkpoints/Chapter_15(1)-checkpoint.ipynb b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_15(1)-checkpoint.ipynb new file mode 100644 index 00000000..211b1c7d --- /dev/null +++ b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_15(1)-checkpoint.ipynb @@ -0,0 +1,427 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:1198072630a182533bf651767f275df9ee5758e0d781322254bb408a8b4cffaa" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 15: Virtual Functions and Polymorphism

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 15.1, Page Number: 358

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "class B_class:\n", + " def __init__(self):\n", + " self.author=None\n", + " def put_author(self,s):\n", + " self.author=s\n", + " def show_author(self):\n", + " print self.author\n", + " \n", + "class D_class(B_class):\n", + " def __init__(self):\n", + " self.title=None\n", + " def put_title(self,num):\n", + " self.title=num\n", + " def show_title(self):\n", + " print \"Title:\",self.title\n", + " \n", + "#Variable declaration\n", + "p=[B_class()] #acts as a pointer to B_class type\n", + "B_ob=B_class()\n", + "\n", + "dp=[D_class()] #acts as a pointer to D_class type\n", + "D_ob=D_class()\n", + "\n", + "p[0]=B_ob #assigning p to object of base\n", + "\n", + "\n", + "#Access B_class via pointer\n", + "p[0].put_author(\"Tom Clancy\")\n", + "\n", + "#Access D_class via base pointer\n", + "p[0]=D_ob\n", + "p[0].put_author(\"William Shakespeare\")\n", + "\n", + "#Show that each author went into proper object\n", + "B_ob.show_author()\n", + "D_ob.show_author()\n", + "print \"\\n\"\n", + "\n", + "#Since put_title() and show_title() are not part of the base class, \n", + "#they are not accessible via the base pointer p and must be accessed \n", + "#either directly, or, as shown here, through a pointer to the \n", + "#derived type\n", + "dp[0]=D_ob\n", + "dp[0].put_title(\"The Tempest\")\n", + "p[0].show_author()\n", + "dp[0].show_title()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Tom Clancy\n", + "William Shakespeare\n", + "\n", + "\n", + "William Shakespeare\n", + "Title: The Tempest\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 15.2, Page Number: 361

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class base:\n", + " def who(self): #virtual function\n", + " print \"Base\"\n", + "\n", + "class first_d(base):\n", + " def who(self): #redifine who() relative to first_d\n", + " print \"First derivation\"\n", + " \n", + "class second_d(base):\n", + " def who(self): #redifine who() relative to second_d\n", + " print \"Second derivation\"\n", + " \n", + " \n", + "#Variable declaration\n", + "base_obj=base()\n", + "p=[base()]\n", + "first_obj=first_d()\n", + "second_obj=second_d()\n", + "\n", + "p[0]=base_obj\n", + "p[0].who() #access base's who\n", + "\n", + "p[0]=first_obj\n", + "p[0].who() #access first_d's who\n", + "\n", + "p[0]=second_obj\n", + "p[0].who() #access second_d's who\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Base\n", + "First derivation\n", + "Second derivation\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 15.3, Page Number: 363

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class base:\n", + " def who(self): #virtual function\n", + " print \"Base\"\n", + "\n", + "class first_d(base):\n", + " def who(self): #redifine who() relative to first_d\n", + " print \"First derivation\"\n", + " \n", + "class second_d(base):\n", + " #who not defined\n", + " pass\n", + " \n", + " \n", + "#Variable declaration\n", + "base_obj=base()\n", + "p=[base()]\n", + "first_obj=first_d()\n", + "second_obj=second_d()\n", + "\n", + "p[0]=base_obj\n", + "p[0].who() #access base's who\n", + "\n", + "p[0]=first_obj\n", + "p[0].who() #access first_d's who\n", + "\n", + "p[0]=second_obj\n", + "p[0].who() #access base's who because\n", + " #second_d does not redefine it.\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Base\n", + "First derivation\n", + "Base\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 15.4, Page Number: 364

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class base:\n", + " def who(self): #virtual function\n", + " print \"Base\"\n", + "\n", + "class first_d(base):\n", + " def who(self): #redifine who() relative to first_d\n", + " print \"First derivation\"\n", + " \n", + "#second_d now inherited first_d -- not base\n", + "class second_d(first_d):\n", + " #who not defined\n", + " pass\n", + " \n", + " \n", + "#Variable declaration\n", + "base_obj=base()\n", + "p=[base()]\n", + "first_obj=first_d()\n", + "second_obj=second_d()\n", + "\n", + "p[0]=base_obj\n", + "p[0].who() #access base's who\n", + "\n", + "p[0]=first_obj\n", + "p[0].who() #access first_d's who\n", + "\n", + "p[0]=second_obj\n", + "p[0].who() #access first_d's who because\n", + " #second_d does not redefine it.\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Base\n", + "First derivation\n", + "First derivation\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 15.5, Page Number: 366

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class figure:\n", + " def __init__(self):\n", + " self._x=None\n", + " self._y=None\n", + " def set_dim(self,i,j):\n", + " self._x=i\n", + " self._y=j\n", + " def show_area(self):\n", + " print \"No area computation defined\",\n", + " print \"for this class.\"\n", + " \n", + "class triangle(figure):\n", + " def show_area(self):\n", + " print \"Triangle with height\",\n", + " print self._x,\"and base\",self._y,\n", + " print \"has an area of\",\n", + " print self._x*0.5*self._y,\".\"\n", + " \n", + "class rectangle(figure):\n", + " def show_area(self):\n", + " print \"Rectangle with dimensions\",\n", + " print self._x,\"x\",self._y,\n", + " print \"has an area of\",\n", + " print self._x*self._y,\".\"\n", + " \n", + "#Variable declaration\n", + "p=[figure()] #pointer to base type\n", + "t=triangle() #objects of derived type\n", + "r=rectangle()\n", + "\n", + "p[0]=t\n", + "p[0].set_dim(10.0,5.0)\n", + "p[0].show_area()\n", + "\n", + "p[0]=r\n", + "p[0].set_dim(10.0,5.0)\n", + "p[0].show_area()\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Triangle with height 10.0 and base 5.0 has an area of 25.0 .\n", + "Rectangle with dimensions 10.0 x 5.0 has an area of 50.0 .\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 15.6, Page Number: 368

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class figure:\n", + " def __init__(self):\n", + " self._x=None\n", + " self._y=None\n", + " def set_dim(self,i,j=0):\n", + " self._x=i\n", + " self._y=j\n", + " def show_area(self):\n", + " print \"No area computation defined\",\n", + " print \"for this class.\"\n", + " \n", + "class triangle(figure):\n", + " def show_area(self):\n", + " print \"Triangle with height\",\n", + " print self._x,\"and base\",self._y,\n", + " print \"has an area of\",\n", + " print self._x*0.5*self._y,\".\"\n", + " \n", + "class rectangle(figure):\n", + " def show_area(self):\n", + " print \"Rectangle with dimensions\",\n", + " print self._x,\"x\",self._y,\n", + " print \"has an area of\",\n", + " print self._x*self._y,\".\"\n", + " \n", + "class circle(figure):\n", + " def show_area(self):\n", + " print \"Circle with radius\",\n", + " print self._x,\n", + " print \"has an area of\",\n", + " print 3.14*self._x*self._x,\".\"\n", + " \n", + " \n", + "#Variable declaration\n", + "p=[figure()] #pointer to base type\n", + "t=triangle() #objects of derived type\n", + "r=rectangle()\n", + "c=circle()\n", + "\n", + "p[0]=t\n", + "p[0].set_dim(10.0,5.0)\n", + "p[0].show_area()\n", + "\n", + "p[0]=r\n", + "p[0].set_dim(10.0,5.0)\n", + "p[0].show_area()\n", + "\n", + "p[0]=c\n", + "p[0].set_dim(9.0)\n", + "p[0].show_area()\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Triangle with height 10.0 and base 5.0 has an area of 25.0 .\n", + "Rectangle with dimensions 10.0 x 5.0 has an area of 50.0 .\n", + "Circle with radius 9.0 has an area of 254.34 .\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_from_the_Ground/.ipynb_checkpoints/Chapter_16(1)-checkpoint.ipynb b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_16(1)-checkpoint.ipynb new file mode 100644 index 00000000..98e3dc8a --- /dev/null +++ b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_16(1)-checkpoint.ipynb @@ -0,0 +1,674 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:60d976a21b55caeaa47bb2c8586e986eed54234a29f15a816e7270f74ad2660e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 16: Templates

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 16.1, Page Number: 376

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def swapargs(a,b):\n", + " temp=a[0]\n", + " a[0]=b[0]\n", + " b[0]=temp\n", + "\n", + "#Variable declaration\n", + "i=[10]\n", + "j=[20]\n", + "x=[10.1]\n", + "y=[23.3]\n", + "a=['x']\n", + "b=['z']\n", + "\n", + "print \"Original i, j: \",i[0],j[0]\n", + "print \"Original x,y: \",x[0],y[0]\n", + "print \"Original a,b: \",a[0],b[0]\n", + "\n", + "swapargs(i,j) #swap integers\n", + "swapargs(x,y) #swap floats\n", + "swapargs(a,b) #swap chars\n", + "\n", + "#Result\n", + "print \"Swapped i, j: \",i[0],j[0]\n", + "print \"Swapped x,y: \",x[0],y[0]\n", + "print \"Swapped a,b: \",a[0],b[0]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Original i, j: 10 20\n", + "Original x,y: 10.1 23.3\n", + "Original a,b: x z\n", + "Swapped i, j: 20 10\n", + "Swapped x,y: 23.3 10.1\n", + "Swapped a,b: z x\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 16.2, Page Number: 378

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def myfunc(x,y):\n", + " print x,y\n", + " \n", + "myfunc(10,\"hi\")\n", + "myfunc(0.23,10L)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10 hi\n", + "0.23 10\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 16.3, Page Number: 379

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def swapargs(a,b):\n", + " if isinstance(a[0],int): #integer version\n", + " temp=a[0]\n", + " a[0]=b[0]\n", + " b[0]=temp\n", + " print \"Inside swapargs int specialization.\"\n", + " else: #generic version\n", + " temp=a[0]\n", + " a[0]=b[0]\n", + " b[0]=temp\n", + " print \"Inside template swapargs.\"\n", + "\n", + "#Variable declaration\n", + "i=[10]\n", + "j=[20]\n", + "x=[10.1]\n", + "y=[23.3]\n", + "a=['x']\n", + "b=['z']\n", + "\n", + "print \"Original i, j: \",i[0],j[0]\n", + "print \"Original x,y: \",x[0],y[0]\n", + "print \"Original a,b: \",a[0],b[0]\n", + "\n", + "swapargs(i,j) #calls explicitly overloaded swapargs()\n", + "swapargs(x,y) #calls generic swapargs()\n", + "swapargs(a,b) #calls generic swapargs()\n", + "\n", + "#Result\n", + "print \"Swapped i, j: \",i[0],j[0]\n", + "print \"Swapped x,y: \",x[0],y[0]\n", + "print \"Swapped a,b: \",a[0],b[0]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Original i, j: 10 20\n", + "Original x,y: 10.1 23.3\n", + "Original a,b: x z\n", + "Inside swapargs int specialization.\n", + "Inside template swapargs.\n", + "Inside template swapargs.\n", + "Swapped i, j: 20 10\n", + "Swapped x,y: 23.3 10.1\n", + "Swapped a,b: z x\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 16.4, Page Number: 381

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def f(a,b=None):\n", + " if(b==None): #First version of f()\n", + " print \"Inside f(X a)\"\n", + " else: #Second version of f()\n", + " print \"Inside f(X a, Y b)\"\n", + " \n", + "f(10) #calls f(X)\n", + "f(10,20) #calls f(X,Y)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Inside f(X a)\n", + "Inside f(X a, Y b)\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 16.5, Page Number: 382

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def repeat(data,times):\n", + " while times:\n", + " print data\n", + " times-=1\n", + " \n", + "repeat(\"This is a test\",3)\n", + "repeat(100,5)\n", + "repeat(99.0/2, 4)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "This is a test\n", + "This is a test\n", + "This is a test\n", + "100\n", + "100\n", + "100\n", + "100\n", + "100\n", + "49.5\n", + "49.5\n", + "49.5\n", + "49.5\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 16.6, Page Number: 383

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def myabs(val):\n", + " if val<0:\n", + " return -val\n", + " else:\n", + " return val\n", + "\n", + "#Result\n", + "print myabs(-10)\n", + "print myabs(-10.0)\n", + "print myabs(-10L)\n", + "print myabs(-10.0)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n", + "10.0\n", + "10\n", + "10.0\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 16.7, Page Number: 385

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def SIZE():\n", + " return 100\n", + "class queue:\n", + " def __init__(self):\n", + " self.q=[]\n", + " self.sloc=self.rloc=0\n", + " #Put an object into the queue\n", + " def qput(self,i):\n", + " if self.sloc==SIZE():\n", + " print \"Queue is full.\"\n", + " return\n", + " self.sloc+=1\n", + " self.q.append(i)\n", + " #Get an object from the queue.\n", + " def qget(self):\n", + " if self.rloc==self.sloc:\n", + " print \"Queue Underflow.\"\n", + " return\n", + " a=self.rloc\n", + " self.rloc+=1\n", + " return self.q[a]\n", + " \n", + "#Create two integer queues\n", + "a=queue()\n", + "b=queue()\n", + "a.qput(10)\n", + "b.qput(19)\n", + "a.qput(20)\n", + "b.qput(1)\n", + "\n", + "print a.qget(),\n", + "print a.qget(),\n", + "print b.qget(),\n", + "print b.qget()\n", + "\n", + "#Create two double queues\n", + "c=queue()\n", + "d=queue()\n", + "c.qput(10.12)\n", + "d.qput(19.99)\n", + "c.qput(-20.0)\n", + "d.qput(0.986)\n", + "\n", + "print c.qget(),\n", + "print c.qget(),\n", + "print d.qget(),\n", + "print d.qget()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10 20 19 1\n", + "10.12 -20.0 19.99 0.986\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 16.8, Page Number: 387

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class myclass:\n", + " def __init__(self,a,b):\n", + " self.__i=a\n", + " self.__j=b\n", + " def show(self):\n", + " print self.__i,self.__j\n", + "\n", + "ob1=myclass(10,0.23)\n", + "ob2=myclass('X',\"This is a test\")\n", + "\n", + "#Result\n", + "ob1.show() #Show int,double\n", + "ob2.show() #Show char.char*\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10 0.23\n", + "X This is a test\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 16.9, Page Number: 388

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def SIZE():\n", + " return 10\n", + "\n", + "class atype:\n", + " def __init__(self):\n", + " self.a=[]\n", + " for i in range(SIZE()):\n", + " self.a.append(i)\n", + " #Implementing the [] overloading\n", + " def op1(self,i,j):\n", + " if (i<0 or i>=SIZE()):\n", + " print \"\\nIndex value of \",\n", + " print i,\" is out-of-bounds.\"\n", + " return \n", + " self.a[i]=j\n", + " def op2(self,i):\n", + " if (i<0 or i>SIZE()-1):\n", + " print \"\\nIndex value of \",\n", + " print i,\" is out-of-bounds.\"\n", + " return\n", + " return self.a[i]\n", + " \n", + "#Variable declaration\n", + "intob=atype()\n", + "doubleob=atype()\n", + " \n", + "print \"Integer array: \",\n", + "for i in range(SIZE()):\n", + " intob.op1(i,i)\n", + "for i in range(SIZE()):\n", + " print intob.op2(i),\n", + " \n", + "print \"\"\n", + "\n", + "print \"Double array: \",\n", + "for i in range(SIZE()):\n", + " doubleob.op1(i,float(i)/3)\n", + "for i in range(SIZE()):\n", + " print doubleob.op2(i),\n", + " \n", + "intob.op1(12,100)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Integer array: 0 1 2 3 4 5 6 7 8 9 \n", + "Double array: 0.0 0.333333333333 0.666666666667 1.0 1.33333333333 1.66666666667 2.0 2.33333333333 2.66666666667 3.0 \n", + "Index value of 12 is out-of-bounds.\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 16.10, Page Number: 389

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class atype:\n", + " def __init__(self,size):\n", + " self.a=[]\n", + " self.size=size\n", + " for i in range(size):\n", + " self.a.append(i)\n", + " #Implementing the [] overloading\n", + " def op1(self,i,j):\n", + " if (i<0 or i>self.size-1):\n", + " print \"\\nIndex value of \",\n", + " print i,\" is out-of-bounds.\"\n", + " return\n", + " self.a[i]=j\n", + " def op2(self,i):\n", + " if (i<0 or i>self.size-1):\n", + " print \"\\nIndex value of \",\n", + " print i,\" is out-of-bounds.\"\n", + " return\n", + " return self.a[i]\n", + " \n", + "#Variable declaration\n", + "intob=atype(10)\n", + "doubleob=atype(15)\n", + " \n", + "print \"Integer array: \",\n", + "for i in range(10):\n", + " intob.op1(i,i)\n", + "for i in range(10):\n", + " print intob.op2(i),\n", + " \n", + "print \"\"\n", + "\n", + "print \"Double array: \",\n", + "for i in range(15):\n", + " doubleob.op1(i,float(i)/3)\n", + "for i in range(15):\n", + " print doubleob.op2(i),\n", + " \n", + "intob.op1(12,100) #generates runtime error\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Integer array: 0 1 2 3 4 5 6 7 8 9 \n", + "Double array: 0.0 0.333333333333 0.666666666667 1.0 1.33333333333 1.66666666667 2.0 2.33333333333 2.66666666667 3.0 3.33333333333 3.66666666667 4.0 4.33333333333 4.66666666667 \n", + "Index value of 12 is out-of-bounds.\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 16.11, Page Number: 391

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class atype:\n", + " def __init__(self,size=10):\n", + " self.a=[]\n", + " for i in range(size):\n", + " self.a.append(i)\n", + " #Implementing the [] overloading\n", + " def op1(self,i,j):\n", + " if (i<0 and i>SIZE()-1):\n", + " print \"Index value of \"\n", + " print i,\" is out-of-bounds.\"\n", + " exit(1)\n", + " self.a[i]=j\n", + " def op2(self,i):\n", + " if (i<0 and i>SIZE()-1):\n", + " print \"Index value of \"\n", + " print i,\" is out-of-bounds.\"\n", + " exit()\n", + " return self.a[i]\n", + " \n", + "#Variable declaration\n", + "intob=atype(100)\n", + "doubleob=atype()\n", + "defarray=atype()\n", + " \n", + "print \"Integer array: \",\n", + "for i in range(100):\n", + " intob.op1(i,i)\n", + "for i in range(100):\n", + " print intob.op2(i),\n", + " \n", + "print \"\"\n", + "\n", + "print \"Double array: \",\n", + "for i in range(10):\n", + " doubleob.op1(i,float(i)/3)\n", + "for i in range(10):\n", + " print doubleob.op2(i),\n", + " \n", + "print \"\"\n", + "\n", + "print \"Defarray array: \",\n", + "for i in range(10):\n", + " doubleob.op1(i,i)\n", + "for i in range(10):\n", + " print doubleob.op2(i),\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Integer array: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 \n", + "Double array: 0.0 0.333333333333 0.666666666667 1.0 1.33333333333 1.66666666667 2.0 2.33333333333 2.66666666667 3.0 \n", + "Defarray array: 0 1 2 3 4 5 6 7 8 9\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 16.12, Page Number: 393

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class myclass:\n", + " def __init__(self,a):\n", + " if isinstance(a,int):\n", + " print \"Inside myclassspecialization\"\n", + " self.__x=a*a\n", + " else:\n", + " print \"Inside generic myclass\"\n", + " self.__x=a\n", + " def getx(self):\n", + " return self.__x\n", + " \n", + "d=myclass(10.1)\n", + "print \"double: \",d.getx(),\"\\n\"\n", + "\n", + "i=myclass(5)\n", + "print \"int: \",i.getx()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Inside generic myclass\n", + "double: 10.1 \n", + "\n", + "Inside myclassspecialization\n", + "int: 25\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_from_the_Ground/.ipynb_checkpoints/Chapter_17(1)-checkpoint.ipynb b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_17(1)-checkpoint.ipynb new file mode 100644 index 00000000..c50f48aa --- /dev/null +++ b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_17(1)-checkpoint.ipynb @@ -0,0 +1,730 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:636fe844c88ef46d09064f199c6b3a4c62e262611a41cc6f126f08459b94982e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 17: Exception Handling

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 17.1, Page Number: 397

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"start\"\n", + "\n", + "try: #start a try block\n", + " print \"Inside try block\"\n", + " raise Exception(99) #raise an error\n", + " print \"This will not execute\"\n", + "except Exception,i: #catch an error\n", + " print \"Caught an exception -- value is:\",\n", + " print i\n", + "\n", + "print \"end\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "start\n", + "Inside try block\n", + "Caught an exception -- value is: 99\n", + "end\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 17.2, Page Number: 399

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import sys\n", + "\n", + "\n", + "\n", + "def main():\n", + " print \"start\"\n", + " try: #start a try block\n", + " print \"Inside try block\"\n", + " raise Exception(99) #raise an error\n", + " print \"This will not execute\"\n", + " except Exception,i: #catch an error\n", + " if isinstance(i,float):\n", + " print \"Caught an exception -- value is:\",\n", + " print i\n", + " else:\n", + " print \"Abnormal program termination\"\n", + " return\n", + " print \"end\"\n", + "\n", + " \n", + "main()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "start\n", + "Inside try block\n", + "Abnormal program termination\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 17.3, Page Number: 400

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def Xtest(test):\n", + " print \"Inside Xtest, test is: \",test\n", + " if(test):\n", + " raise Exception(test)\n", + " \n", + "print \"start\"\n", + "\n", + "try: #start a try block\n", + " print \"Inside try block\"\n", + " Xtest(0)\n", + " Xtest(1)\n", + " Xtest(2)\n", + "except Exception,i: #catch an error\n", + " print \"Caught an exception -- value is:\",\n", + " print i\n", + "\n", + "print \"end\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "start\n", + "Inside try block\n", + "Inside Xtest, test is: 0\n", + "Inside Xtest, test is: 1\n", + "Caught an exception -- value is: 1\n", + "end\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 17.4, Page Number: 401

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def Xhandler(test):\n", + " try:\n", + " if(test):\n", + " raise Exception(test)\n", + " except Exception,i:\n", + " print \"Caught One! Ex #:\",i\n", + " \n", + "print \"start\"\n", + "\n", + "Xhandler(1)\n", + "Xhandler(2)\n", + "Xhandler(0)\n", + "Xhandler(3)\n", + "\n", + "print \"end\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "start\n", + "Caught One! Ex #: 1\n", + "Caught One! Ex #: 2\n", + "Caught One! Ex #: 3\n", + "end\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 17.5, Page Number: 401

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class MyException:\n", + " def __init__(self,s):\n", + " self.str_what=s\n", + " \n", + "#Variable declaration\n", + "a=None \n", + "b=None\n", + "\n", + "try:\n", + " print \"Enter numerator and denominator:\"\n", + " #User-input\n", + " a=10 \n", + " b=0\n", + " if not(b):\n", + " raise MyException(\"Cannot divide by zero!\")\n", + " else:\n", + " print \"Quotient is\",a/b\n", + "except MyException as e: #catch an error\n", + " print e.str_what\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter numerator and denominator:\n", + "Cannot divide by zero!\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 17.6, Page Number: 403

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class MyException:\n", + " def __init__(self,s):\n", + " self.x=s\n", + " \n", + "def Xhandler(test):\n", + " try:\n", + " if(test):\n", + " raise MyException(test)\n", + " else:\n", + " raise MyException(\"Value is zero\")\n", + " except MyException as i:\n", + " if isinstance(i.x,int):\n", + " print \"Caught One! Ex #:\",i.x\n", + " else:\n", + " print \"Caught a string:\",\n", + " print i.x\n", + " \n", + "print \"start\"\n", + "\n", + "Xhandler(1)\n", + "Xhandler(2)\n", + "Xhandler(0)\n", + "Xhandler(3)\n", + "\n", + "print \"end\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "start\n", + "Caught One! Ex #: 1\n", + "Caught One! Ex #: 2\n", + "Caught a string: Value is zero\n", + "Caught One! Ex #: 3\n", + "end\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 17.7, Page Number: 404

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class B:\n", + " pass\n", + "\n", + "class D(B):\n", + " pass\n", + "\n", + "derived=D()\n", + "\n", + "try:\n", + " raise B()\n", + "except B as b:\n", + " print \"Caught a base class.\"\n", + "except D as d:\n", + " print \"This wont execute.\"\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Caught a base class.\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 17.8, Page Number: 405

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def Xhandler(test):\n", + " try:\n", + " if test==0:\n", + " raise Exception(test) #throw int\n", + " if test==1:\n", + " raise Exception('a') #throw char\n", + " if test==2:\n", + " raise Exception(123.23) #throw double\n", + " except: #Catches all exceptions\n", + " print \"Caught One!\"\n", + "\n", + "print \"start\"\n", + "\n", + "Xhandler(0)\n", + "Xhandler(1)\n", + "Xhandler(2)\n", + "\n", + "print \"end\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "start\n", + "Caught One!\n", + "Caught One!\n", + "Caught One!\n", + "end\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 17.9, Page Number: 405

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class MyException:\n", + " def __init__(self,s):\n", + " self.x=s\n", + " \n", + "def Xhandler(test):\n", + " try:\n", + " if test==0:\n", + " raise MyException(test) #throw int\n", + " if test==1:\n", + " raise MyException('a') #throw char\n", + " if test==2:\n", + " raise MyException(123.23) #throw double\n", + " except MyException as i:\n", + " if isinstance(i.x,int): #catch an int exception\n", + " print \"Caught\",i.x \n", + " else: #catch all other exceptions\n", + " print \"Caught One!\"\n", + " \n", + "\n", + "print \"start\"\n", + "\n", + "Xhandler(0)\n", + "Xhandler(1)\n", + "Xhandler(2)\n", + "\n", + "print \"end\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "start\n", + "Caught 0\n", + "Caught One!\n", + "Caught One!\n", + "end\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 17.10, Page Number: 407

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class MyException:\n", + " def __init__(self,s):\n", + " self.x=s\n", + " \n", + "#This function can only throw ints, chars and doubles\n", + "def Xhandler(test):\n", + " if test==0:\n", + " raise MyException(test) #throw int\n", + " if test==1:\n", + " raise MyException('a') #throw char\n", + " if test==2:\n", + " raise MyException(123.23) #throw double\n", + " \n", + "\n", + "print \"start\"\n", + "try:\n", + " Xhandler(0)\n", + "except MyException as i:\n", + " if isinstance(i.x,int): #catch an int exception\n", + " print \"Caught int\" \n", + " elif isinstance(i.x,str): #catch a char exception\n", + " print \"Caught char\"\n", + " elif isinstance(i.x,float): #catch a float exception\n", + " print \"Caught double\"\n", + "\n", + "print \"end\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "start\n", + "Caught int\n", + "end\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 17.11, Page Number: 408

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def Xhandler():\n", + " try:\n", + " raise Exception(\"hello\") #throw a char *\n", + " except Exception,c: #catch a char *\n", + " print \"Caugh char * inside Xhandler\"\n", + " raise #rethrow char * out of function\n", + " \n", + "print \"start\"\n", + "try:\n", + " Xhandler()\n", + "except Exception,c:\n", + " print \"Caught char * inside main\"\n", + " \n", + "print \"end\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "start\n", + "Caugh char * inside Xhandler\n", + "Caught char * inside main\n", + "end\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 17.12, Page Number: 410

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from ctypes import *\n", + "\n", + "#Variable declaration\n", + "p=[]\n", + "\n", + "try:\n", + " for i in range(32):\n", + " p.append(c_int())\n", + "except MemoryError,m:\n", + " print \"Allocation failure.\"\n", + " \n", + "for i in range(32):\n", + " p[i]=i\n", + " \n", + "for i in range(32):\n", + " print p[i],\n", + " \n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 17.13, Page Number: 410

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from ctypes import *\n", + "\n", + "#Variable declaration\n", + "p=[]\n", + "\n", + "\n", + "for i in range(32):\n", + " p.append(c_int()) \n", + "if not(p):\n", + " print \"Allocation failure.\"\n", + " \n", + "for i in range(32):\n", + " p[i]=i\n", + " \n", + "for i in range(32):\n", + " print p[i],\n", + " \n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 17.13, Page Number: 412

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class three_d:\n", + " def __init__(self,i=0,j=0,k=0): #3=D coordinates\n", + " if(i==0 and j==0 and k==0):\n", + " self.x=self.y=self.z=0\n", + " print \"Constructing 0, 0, 0\"\n", + " else:\n", + " self.x=i\n", + " self.y=j\n", + " self.z=k\n", + " print \"Constructing\",i,\",\",j,\",\",k\n", + " def __del__(self):\n", + " print \"Destructing\"\n", + " #new overloaded relative to three_d.\n", + " def __new__(typ, *args, **kwargs):\n", + " obj = object.__new__(typ, *args, **kwargs)\n", + " return obj\n", + " def show(self):\n", + " print self.x,\",\",\n", + " print self.y,\",\",\n", + " print self.z\n", + " \n", + "p1=[]*3\n", + "p2=[]\n", + " \n", + "try:\n", + " print \"Allocating array of three_d objects.\"\n", + " for i in range(3): #allocate array\n", + " p1.append(three_d())\n", + " print \"Allocating three_d object.\"\n", + " p2.append(three_d(5,6,7)) #allocate object\n", + "except MemoryError:\n", + " print \"Allocation error\"\n", + " \n", + "p1[2].show()\n", + "p2[0].show()\n", + "\n", + "\n", + "for i in xrange(2,-1,-1):\n", + " del p1[i] #delete array\n", + "print \"Deleting array of thee_d objects.\"\n", + "\n", + "del p2[0] #delete object\n", + "print \"Deleting three_d object.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Allocating array of three_d objects.\n", + "Constructing 0, 0, 0\n", + "Constructing 0, 0, 0\n", + "Constructing 0, 0, 0\n", + "Allocating three_d object.\n", + "Constructing 5 , 6 , 7\n", + "0 , 0 , 0\n", + "5 , 6 , 7\n", + "Destructing\n", + "Destructing\n", + "Destructing\n", + "Deleting array of thee_d objects.\n", + "Destructing\n", + "Deleting three_d object.\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_from_the_Ground/.ipynb_checkpoints/Chapter_18(1)-checkpoint.ipynb b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_18(1)-checkpoint.ipynb new file mode 100644 index 00000000..df4cabc2 --- /dev/null +++ b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_18(1)-checkpoint.ipynb @@ -0,0 +1,881 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:85eae8322c208f1f26e859bb0f4dac6f86b35c3ac105ed98ac2d0fbf05287f0e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 18: The C++ I/O System

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.1, Page Number: 421

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class three_d:\n", + " def __init__(self,a,b,c): #3D coordinates\n", + " self.x=a\n", + " self.y=b\n", + " self.z=c\n", + " #Display x,y,z coordinates - three_d inserter.\n", + " def __repr__(self):\n", + " return str(self.x)+\", \"+str(self.y)+\", \"+str(self.z)+\"\\n\"\n", + "\n", + "#Variable declaration\n", + "a=three_d(1,2,3)\n", + "b=three_d(3,4,5)\n", + "c=three_d(5,6,7)\n", + "\n", + "#Result\n", + "print a,b,c" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1, 2, 3\n", + " 3, 4, 5\n", + " 5, 6, 7\n", + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.2, Page Number: 423

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class thrnee_d:\n", + " def __init__(self,a,b,c): #3D coordinates\n", + " self.x=a\n", + " self.y=b\n", + " self.z=c\n", + " #Display x,y,z coordinates - three_d inserter.\n", + " __repr__=repr \n", + " \n", + "#Friend function \n", + "def repr():\n", + " return str(self.x)+\", \"+str(self.y)+\", \"+str(self.z)+\"\\n\"\n", + "\n", + "#Variable declaration\n", + "a=three_d(1,2,3)\n", + "b=three_d(3,4,5)\n", + "c=three_d(5,6,7)\n", + "\n", + "print a,b,c" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1, 2, 3\n", + " 3, 4, 5\n", + " 5, 6, 7\n", + "\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.3, Page Number: 424

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class three_d:\n", + " def __init__(self,a,b,c): #3D coordinates\n", + " self.x=a\n", + " self.y=b\n", + " self.z=c\n", + " #Display x,y,z coordinates - three_d inserter.\n", + " def __repr__(self):\n", + " return str(self.x)+\", \"+str(self.y)+\", \"+str(self.z)\n", + "\n", + "#Variable declaration\n", + "a=three_d(1,2,3)\n", + "\n", + "print a\n", + "\n", + "#User input\n", + "print \"Enter X,Y,Z values:\"\n", + "a=three_d(4,5,6) \n", + "print a" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1, 2, 3\n", + "Enter X,Y,Z values:\n", + "4, 5, 6\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.4, Page Number: 428

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print '{0:+d}'.format(123), #for ios::showpos\n", + "if(123.23>0):\n", + " i='{0:e}'.format(123.23) #for ios::scientific \n", + " i='+'+i\n", + " print i\n", + "else :\n", + " print '{0:e}'.format(123.23)\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "+123 +1.232300e+02\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.5, Page Number: 430

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import string\n", + "\n", + "print '{0:+d}'.format(123), #for ios::showpos\n", + "if(123.23>0):\n", + " i='{0:e}'.format(123.23) #for ios::scientific \n", + " i='+'+i\n", + " print i\n", + "else :\n", + " print '{0:e}'.format(123.23)\n", + "\n", + " \n", + "print '{:10.2f}'.format(123.23), #2 digits left of decimal\n", + "if(123.23>0):\n", + " i='{0:.2e}'.format(123.23) #for ios::scientific \n", + " i='+'+i\n", + " print i\n", + "else :\n", + " print '{0:.2e}'.format(123.23)\n", + " \n", + " \n", + "print '{:#>10}'.format(str(123)), #for ios::fill\n", + "if(123.23>0): \n", + " i='{0:.2e}'.format(123.23) #for ios::scientific \n", + " i='+'+i\n", + " print i\n", + "else :\n", + " print '{0:.2e}'.format(123.23)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "+123 +1.232300e+02\n", + " 123.23 +1.23e+02\n", + "#######123 +1.23e+02\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.6, Page Number: 432

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print '{0:.0e}'.format(1000.243) #for setprecision\n", + "print '{:>20}'.format(\"Hello There\") #to set width and right align\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1e+03\n", + " Hello There\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.7, Page Number: 433

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print '{0:+d}'.format(123), #for ios::showpos\n", + "if(123.23>0):\n", + " i='{0:e}'.format(123.23) #for ios::scientific \n", + " i='+'+i\n", + " print i\n", + "else :\n", + " print '{0:e}'.format(123.23)\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "+123 +1.232300e+02\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.8, Page Number: 433

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#User input\n", + "s=\" Hello\"\n", + "\n", + "#Result\n", + "print s.lstrip() #lstrip removes leading spaces" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.9, Page Number: 434

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def setup(s):\n", + " return '{:$<10}'.format(str(s))\n", + "\n", + "\n", + "#Result\n", + "print 10,setup(10)\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10 10$$$$$$$$\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.10, Page Number: 435

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def prompt():\n", + " print \"Enter number using hex format:\"\n", + " hex=0x46\n", + " return hex\n", + "\n", + "\n", + "#Result\n", + "i=prompt()\n", + "print i\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.11, Page Number: 438

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "out=open(\"test\",'w')\n", + "\n", + "\n", + "if(not(out)):\n", + " print \"Cannot open file.\"\n", + "else:\n", + " #Write to file\n", + " out.write(\"10 123.23\\n\")\n", + " out.write(\"This is a short text file.\")\n", + " #Close the file\n", + " out.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.12, Page Number: 438

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + " \n", + "In=open(\"test\",'r')\n", + " \n", + "if(not(In)):\n", + " print \"Cannot open file.\"\n", + "else:\n", + " #Read file\n", + " i=In.read(2)\n", + " ch=In.read(1)\n", + " f=In.read(6)\n", + " str=In.read()\n", + " print i,f,ch\n", + " print str\n", + " #Close the file\n", + " out.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10 123.23 \n", + "\n", + "This is a short text file.\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.13, Page Number: 439

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import sys\n", + " \n", + "if not(len(sys.argv)==2):\n", + " print \"Usage: PR \\n\"\n", + "else:\n", + " #Open a file\n", + " In=open(sys.argv[1],'r')\n", + "\n", + " #In case file cannot open\n", + " if(not(In)):\n", + " print \"Cannot open file.\"\n", + " else:\n", + " #Read file\n", + " ch=In.read()\n", + " print ch\n", + " In.close()\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Usage: PR \n", + "\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.14, Page Number: 440

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import sys\n", + "\n", + "p=\"hello there\"\n", + "\n", + "out=open(\"test\",'w')\n", + "\n", + "#In case file cannot open\n", + "if(not(out)):\n", + " print \"Cannot open file.\"\n", + "else:\n", + " #Write to file\n", + " for i in range(len(p)):\n", + " out.write(p[i])\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.15, Page Number: 441

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import sys\n", + "\n", + "n=[1,2,3,4,5]\n", + "\n", + "#Open a file 'test'\n", + "out=open(\"test\",'w')\n", + "\n", + "#In case file cannot open\n", + "if(not(out)):\n", + " print \"Cannot open file.\"\n", + "else:\n", + " #Write to file\n", + " for i in range(5):\n", + " out.write(chr(n[i]))\n", + " out.close()\n", + " \n", + "for i in range(5): #clear array\n", + " n[i]=0\n", + " \n", + "#Open the file\n", + "In=open(\"test\",'r')\n", + "\n", + "#In case file cannot open\n", + "if(not(In)):\n", + " print \"Cannot open file.\"\n", + "else:\n", + " #Read file\n", + " for i in range(5):\n", + " n[i]=ord(In.read(1))\n", + "\n", + "#Result, shows value from file\n", + "for i in range(5):\n", + " print n[i],\n", + " \n", + "In.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 2 3 4 5\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.16, Page Number: 442

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import sys\n", + " \n", + "if not(len(sys.argv)==2):\n", + " print \"Usage: PR \\n\"\n", + "else:\n", + " #Open a file\n", + " In=open(sys.argv[1],'r')\n", + "\n", + " #In case file cannot open\n", + " if(not(In)):\n", + " print \"Cannot open file.\"\n", + " else:\n", + " #Read file\n", + " while True:\n", + " ch=In.read(1)\n", + " if not ch:\n", + " break\n", + " print ch,\n", + " #Close file\n", + " In.close()\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Usage: PR \n", + "\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.17, Page Number: 443

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "out=open(\"test1\",'w')\n", + "out.write(\"Hello\")\n", + "out.close()\n", + " \n", + "out=open(\"test2\",'w')\n", + "out.write(\"There\")\n", + "out.close()\n", + "\n", + " \n", + "f1=open(\"test1\",'r')\n", + " \n", + "if(not(In)):\n", + " print \"Cannot open file.\"\n", + "\n", + " \n", + "f2=open(\"test2\",'r')\n", + " \n", + "if(not(In)):\n", + " print \"Cannot open file.\"\n", + " \n", + "print \"Comparing files...\"\n", + "\n", + "buf1=f1.read()\n", + "buf2=f2.read()\n", + "print buf1,buf2\n", + "\n", + "if len(buf1)==len(buf2):\n", + " print \"Files are of different sizes.\"\n", + " f1.close()\n", + " f2.close()\n", + "else:\n", + " \n", + " flag=1\n", + " for i in range(len(buf1)):\n", + " if not(buf1[i]==buf2[i]):\n", + " print \"Files differ.\"\n", + " f1.close()\n", + " f2.close()\n", + " flag=0\n", + " break\n", + " if flag==1:\n", + " print \"Files are the same.\"\n", + " \n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Comparing files...\n", + "Hello There\n", + "Files are of different sizes.\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.18, Page Number: 445

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter your name:\"\n", + " \n", + "str=\"hello world\"\n", + "\n", + "print str" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your name:\n", + "hello world\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.19, Page Number: 447

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " out=open(\"test\",'r+b')\n", + "out.write(\"Hello\")\n", + "\n", + " \n", + "if(not(out)):\n", + " print \"Cannot open file.\"\n", + "else:\n", + " out.seek(2,0)\n", + " out.write('X')\n", + " out.close()\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.20, Page Number: 447

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + " \n", + "out=open(\"test\",'r+b')\n", + "out.write(\"Hello\")\n", + "out.close()\n", + "\n", + "In=open(\"test\",'r')\n", + " \n", + "if(not(In)):\n", + " print \"Cannot open file.\"\n", + "else:\n", + " In.seek(2,0)\n", + " ch=In.read()\n", + " print ch\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "llo\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.21, Page Number: 450

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class three_d:\n", + " def __init__(self,a,b,c):\n", + " self.__x=a\n", + " self.__y=b\n", + " self.__z=c\n", + " def __repr__(self):\n", + " c=(\"%d\"%self.__x)+\", \"+(\"%d\"%self.__y)+\", \"+(\"%d\"%self.__z)+\"\\n\"\n", + " return c \n", + "\n", + " \n", + "a=three_d(1,2,3)\n", + "b=three_d(3,4,5)\n", + "c=three_d(5,6,7)\n", + " \n", + "out=open(\"threed\",'w')\n", + " \n", + "if(not(out)):\n", + " print \"Cannot open file.\"\n", + "else:\n", + " out.write(a.__repr__())\n", + " out.write(b.__repr__())\n", + " out.write(c.__repr__())\n", + "\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 18 + }, + { + "cell_type": "raw", + "metadata": {}, + "source": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_from_the_Ground/.ipynb_checkpoints/Chapter_19(1)-checkpoint.ipynb b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_19(1)-checkpoint.ipynb new file mode 100644 index 00000000..7f04b7ea --- /dev/null +++ b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_19(1)-checkpoint.ipynb @@ -0,0 +1,725 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:20d38d92a3a25bc02f8bf5fb1b35ef1503e1987dff61d43c4881deab4561fe2c" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 19: Run-Time Type ID and the Casting Operators

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 19.1, Page Number: 453

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class myclass:\n", + " pass\n", + "\n", + "#Variable declaration\n", + "i=j=0\n", + "f=0.0\n", + "ob=myclass()\n", + "\n", + "print \"The type of i is:\",type(i).__name__\n", + "print \"The type of f is:\",type(f).__name__\n", + "print \"The type of ob is:\",ob.__class__.__name__\n", + "print \"\\n\"\n", + "\n", + "if type(i)==type(j):\n", + " print \"The types of i and j are the same\"\n", + " \n", + "if not(type(i)==type(f)):\n", + " print \"The types of i and f are not the same\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The type of i is: int\n", + "The type of f is: float\n", + "The type of ob is: myclass\n", + "\n", + "\n", + "The types of i and j are the same\n", + "The types of i and f are not the same\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 19.2, Page Number: 454

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Base:\n", + " pass\n", + "class Derived1(Base):\n", + " pass\n", + "class Derived2(Base):\n", + " pass\n", + "\n", + "#Variable declaration\n", + "baseob=Base()\n", + "p=[Base()]\n", + "ob1=Derived1()\n", + "ob2=Derived2()\n", + "\n", + "\n", + "p[0]=baseob\n", + "print \"p is pointing to an object of type\",\n", + "print p[0].__class__.__name__\n", + "\n", + "p[0]=ob1\n", + "print \"p is pointing to an object of type\",\n", + "print p[0].__class__.__name__\n", + "\n", + "p[0]=ob2\n", + "print \"p is pointing to an object of type\",\n", + "print p[0].__class__.__name__" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "p is pointing to an object of type Base\n", + "p is pointing to an object of type Derived1\n", + "p is pointing to an object of type Derived2\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 19.3, Page Number: 455

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Base:\n", + " pass\n", + "class Derived1(Base):\n", + " pass\n", + "class Derived2(Base):\n", + " pass\n", + "\n", + "def WhatType(ob):\n", + " print \"ob is referencing an object of type\",\n", + " print ob.__class__.__name__\n", + " \n", + " \n", + "#Variable declaration\n", + "baseob=Base()\n", + "p=[Base()]\n", + "ob1=Derived1()\n", + "ob2=Derived2()\n", + "\n", + "WhatType(baseob)\n", + "WhatType(ob1)\n", + "WhatType(ob2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "ob is referencing an object of type Base\n", + "ob is referencing an object of type Derived1\n", + "ob is referencing an object of type Derived2\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 19.4, Page Number: 456

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import random\n", + "\n", + "class figure:\n", + " def __init__(self,i,j):\n", + " self._x=i\n", + " self._y=j\n", + " \n", + "class triangle(figure):\n", + " def __init__(self,i,j):\n", + " figure.__init__(self,i,j)\n", + " def area(self):\n", + " return self._x*0.5*self._y\n", + " \n", + "class rectangle(figure):\n", + " def __init__(self,i,j):\n", + " figure.__init__(self,i,j)\n", + " def area(self):\n", + " return self._x*self._y\n", + " \n", + "class circle(figure):\n", + " def __init__(self,i,j=0):\n", + " figure.__init__(self,i,j)\n", + " def area(self):\n", + " return self._x*self._x*3.14\n", + " \n", + "def factory():\n", + " i=random.randint(0,2)\n", + " if i==0:\n", + " return circle(10.0)\n", + " elif i==1:\n", + " return triangle(10.1,5.3)\n", + " elif i==2:\n", + " return rectangle(4.3,5.7)\n", + " \n", + "\n", + "t=c=r=0 \n", + "p=[None]\n", + "\n", + "#generate and count objects\n", + "for i in range(10):\n", + " p[0]=factory() #generate an object\n", + " print \"Object is \",p[0].__class__.__name__,\". \",\n", + " #count it\n", + " if p[0].__class__.__name__==triangle.__name__:\n", + " t+=1\n", + " if p[0].__class__.__name__==rectangle.__name__:\n", + " r+=1\n", + " if p[0].__class__.__name__==circle.__name__:\n", + " c+=1\n", + " #display its area\n", + " print \"Area is\",p[0].area()\n", + "\n", + "print \"Objects generated:\"\n", + "print \"Triangles:\",t\n", + "print \"Rectangles:\",r\n", + "print \"Circles:\",c" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Object is circle . Area is 314.0\n", + "Object is rectangle . Area is 24.51\n", + "Object is rectangle . Area is 24.51\n", + "Object is circle . Area is 314.0\n", + "Object is rectangle . Area is 24.51\n", + "Object is circle . Area is 314.0\n", + "Object is rectangle . Area is 24.51\n", + "Object is triangle . Area is 26.765\n", + "Object is rectangle . Area is 24.51\n", + "Object is circle . Area is 314.0\n", + "Objects generated:\n", + "Triangles: 1\n", + "Rectangles: 5\n", + "Circles: 4\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 19.5, Page Number: 456

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class myclass:\n", + " def __init__(self,i):\n", + " self.__a=i\n", + " \n", + "o1=myclass(10)\n", + "o2=myclass(9)\n", + "o3=myclass(7.2)\n", + "\n", + "print \"Type of o1 is\",o1.__class__.__name__\n", + "\n", + "print \"Type of o2 is\",o2.__class__.__name__\n", + "\n", + "print \"Type of o3 is\",o3.__class__.__name__\n", + "\n", + "print\n", + "\n", + "if o1.__class__.__name__==o2.__class__.__name__:\n", + " print \"o1 and o2 are the same type\"\n", + " \n", + "if o1.__class__.__name__==o3.__class__.__name__:\n", + " print \"Error\"\n", + "else:\n", + " print \"o1 and o3 are different types\"\n", + "\n", + "#This prints error because python doesnt use templates." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Type of o1 is myclass\n", + "Type of o2 is myclass\n", + "Type of o3 is myclass\n", + "\n", + "o1 and o2 are the same type\n", + "Error\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 19.6, Page Number: 460

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import random\n", + "\n", + "class figure:\n", + " def __init__(self,i,j):\n", + " self._x=i\n", + " self._y=j\n", + " \n", + "class triangle(figure):\n", + " def __init__(self,i,j):\n", + " figure.__init__(self,i,j)\n", + " def area(self):\n", + " return self._x*0.5*self._y\n", + " \n", + "class rectangle(figure):\n", + " def __init__(self,i,j):\n", + " figure.__init__(self,i,j)\n", + " def area(self):\n", + " return self._x*self._y\n", + " \n", + "class circle(figure):\n", + " def __init__(self,i,j=0):\n", + " figure.__init__(self,i,j)\n", + " def area(self):\n", + " return self._x*self._x*3.14\n", + " \n", + "def factory():\n", + " i=random.randint(0,2)\n", + " if i==0:\n", + " return circle(10.0)\n", + " elif i==1:\n", + " return triangle(10.1,5.3)\n", + " elif i==2:\n", + " return rectangle(4.3,5.7)\n", + " \n", + "\n", + "t=c=r=0 \n", + "p=[None]\n", + "\n", + "#generate and count objects\n", + "for i in range(10):\n", + " p[0]=factory() #generate an object\n", + " print \"Object is \",p[0].__class__.__name__,\". \",\n", + " #count it\n", + " if p[0].__class__.__name__==triangle.__name__:\n", + " t+=1\n", + " if p[0].__class__.__name__==rectangle.__name__:\n", + " r+=1\n", + " if p[0].__class__.__name__==circle.__name__:\n", + " c+=1\n", + " #display its area\n", + " print \"Area is\",p[0].area()\n", + "\n", + "print \"Objects generated:\"\n", + "print \"Triangles:\",t\n", + "print \"Rectangles:\",r\n", + "print \"Circles:\",c" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Object is triangle . Area is 26.765\n", + "Object is circle . Area is 314.0\n", + "Object is circle . Area is 314.0\n", + "Object is rectangle . Area is 24.51\n", + "Object is rectangle . Area is 24.51\n", + "Object is rectangle . Area is 24.51\n", + "Object is circle . Area is 314.0\n", + "Object is circle . Area is 314.0\n", + "Object is rectangle . Area is 24.51\n", + "Object is triangle . Area is 26.765\n", + "Objects generated:\n", + "Triangles: 2\n", + "Rectangles: 4\n", + "Circles: 4\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 19.7, Page Number: 463

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Base:\n", + " def f(self):\n", + " print \"Inside Base\"\n", + " \n", + "class Derived(Base):\n", + " def f(self):\n", + " print \"Inside Derived\"\n", + " \n", + "bp=[Base()] #pointer to base\n", + "b_ob=Base() \n", + "dp=[Derived()] #pointer to derived\n", + "d_ob=Derived()\n", + "\n", + "dp[0]=d_ob\n", + "if dp[0]:\n", + " print \"Cast from Derived * to Derived * OK.\"\n", + " dp[0].f()\n", + "else:\n", + " print \"Error\"\n", + "print\n", + "\n", + "bp[0]=d_ob\n", + "if bp[0]:\n", + " print \"Cast from Derived * to Base * OK.\"\n", + " bp[0].f()\n", + "else:\n", + " print \"Error\"\n", + "print\n", + "\n", + "bp[0]=b_ob\n", + "if bp[0]:\n", + " print \"Cast from Base * to Base * OK.\"\n", + " bp[0].f()\n", + "else:\n", + " print \"Error\"\n", + "print\n", + "\n", + "dp[0]=b_ob\n", + "if dp[0]:\n", + " print \"Error\"\n", + "else:\n", + " print \"Cast from Base * to Derived * not OK.\"\n", + "print\n", + "\n", + "bp[0]=d_ob #bp points to Derived object\n", + "dp[0]=bp[0]\n", + "if dp[0]:\n", + " print \"Cast bp to a Derived * OK.\"\n", + " print \"because bp is really pointing\\n\",\n", + " print \"to a Derived object.\"\n", + " dp[0].f()\n", + "else:\n", + " print \"Error\"\n", + "print\n", + "\n", + "bp[0]=b_ob #bp points to Base object\n", + "dp[0]=bp[0]\n", + "if dp[0]:\n", + " print \"Error\"\n", + "else:\n", + " print \"Now casting bp to a Derived *\\n\",\n", + " print \"is not OK because bp is really\\n\",\n", + " print \" pointing to a Base object.\"\n", + "print\n", + "\n", + "dp[0]=d_ob #dp points to Derived object\n", + "bp[0]=dp[0]\n", + "if bp[0]:\n", + " print \"Casting dp to a Base * is OK.\"\n", + " bp[0].f()\n", + "else:\n", + " print \"Error\"\n", + "print\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Cast from Derived * to Derived * OK.\n", + "Inside Derived\n", + "\n", + "Cast from Derived * to Base * OK.\n", + "Inside Derived\n", + "\n", + "Cast from Base * to Base * OK.\n", + "Inside Base\n", + "\n", + "Error\n", + "\n", + "Cast bp to a Derived * OK.\n", + "because bp is really pointing\n", + "to a Derived object.\n", + "Inside Derived\n", + "\n", + "Error\n", + "\n", + "Casting dp to a Base * is OK.\n", + "Inside Derived\n", + "\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 19.8, Page Number: 465

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Base:\n", + " def f(self):\n", + " pass\n", + " \n", + "class Derived(Base):\n", + " def derivedOnly(self):\n", + " print \"Is a Derived Object\"\n", + " \n", + "bp=[Base()] #pointer to base\n", + "b_ob=Base() \n", + "dp=[Derived()] #pointer to derived\n", + "d_ob=Derived()\n", + "\n", + "#Use typeid\n", + "\n", + "bp[0]=b_ob\n", + "if bp[0].__class__.__name__==Derived.__name__:\n", + " dp[0]=bp[0]\n", + " dp[0].derivedOnly()\n", + "else:\n", + " print \"Cast from Base to Derived failed.\"\n", + " \n", + "bp[0]=d_ob\n", + "if bp[0].__class__.__name__==Derived.__name__:\n", + " dp[0]=bp[0]\n", + " dp[0].derivedOnly()\n", + "else:\n", + " print \"Error, cast should work!\"\n", + " \n", + "#Use dynamic_cast\n", + "\n", + "bp[0]=b_ob\n", + "dp[0]=bp[0]\n", + "if dp[0].__class__.__name__==Derived.__name__:\n", + " dp[0].derivedOnly()\n", + "else:\n", + " print \"Cast from Base to Derived failed.\"\n", + " \n", + "bp[0]=d_ob\n", + "dp[0]=bp[0]\n", + "if dp:\n", + " dp[0].derivedOnly()\n", + "else:\n", + " print \"Error, cast should work!\"\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Cast from Base to Derived failed.\n", + "Is a Derived Object\n", + "Cast from Base to Derived failed.\n", + "Is a Derived Object\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 19.9, Page Number: 467

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def f(p):\n", + " v=p\n", + " v[0]=100\n", + " \n", + "#Variable declaration\n", + "x=[]\n", + "\n", + "x.append(99)\n", + "print \"x before call:\",x[0]\n", + "f(x)\n", + "print \"x after call:\",x[0]\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x before call: 99\n", + "x after call: 100\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 19.10, Page Number: 468

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "f=199.22\n", + "\n", + "i=f\n", + "print i\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "199.22\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 19.11, Page Number: 469

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "i=0 #int\n", + "p=\"This is a string\"\n", + "\n", + "i=p #cast pointer to integer \n", + "\n", + "#Result\n", + "print i\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "This is a string\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_from_the_Ground/.ipynb_checkpoints/Chapter_2(1)-checkpoint.ipynb b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_2(1)-checkpoint.ipynb new file mode 100644 index 00000000..b3976867 --- /dev/null +++ b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_2(1)-checkpoint.ipynb @@ -0,0 +1,416 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:05876b24f412fcea817693bad944dc90f3dae4fb5142aeb7d9c2c98569067083" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 2: An Overview of C++

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.1, Page Number: 12

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"This is my first C++ program.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "This is my first C++ program.\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.2, Page Number: 17

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "x=None \n", + "\n", + "x=1023 #this assigns 1023 to x\n", + "\n", + "#Result\n", + "print \"This program prints the value of x: \",x #prints x,i.e, 1023\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "This program prints the value of x: 1023\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.3, Page Number: 18

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "gallons=10 #User input\n", + "liters=None\n", + "\n", + "liters=gallons*4 #convert to liters\n", + "\n", + "#Result\n", + "print \"Liters: \",liters" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Liters: 40\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.4, Page Number: 20

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "#Variable declaration\n", + "gallons=10.20 #User input\n", + "liters=None\n", + "\n", + "liters=gallons*3.7854 #convert to liters\n", + "\n", + "#Result\n", + "print \"Liters: \",liters" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Liters: 38.61108\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.5, Page Number: 21

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def myfunc():\n", + " print \"Inside myfunc() \"\n", + " \n", + "print \"In main()\"\n", + "myfunc() #call myfunc()\n", + "print \"Back in main()\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "In main()\n", + "Inside myfunc() \n", + "Back in main()\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.6, Page Number: 22

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "print abs(-10)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.7, Page Number: 23

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def mul(x,y):\n", + " print x*y,\n", + "\n", + "#calling mul\n", + "mul(10,20)\n", + "mul(5,6)\n", + "mul(8,9)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "200 30 72\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.8, Page Number: 24

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def mul(x,y):\n", + " return x*y #return product of x and y\n", + "\n", + "#Variable declaration\n", + "answer=mul(10,11) #assign return values\n", + "\n", + "#Result\n", + "print \"The answer is: \",answer\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The answer is: 110\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.9, Page Number: 26

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"one\"\n", + "print \"two\" #prints in different line\n", + "print \"three\",\"four\" #prints all in same line" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "one\n", + "two\n", + "three four\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.10, Page Number: 27

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#Variable declaration\n", + "a=10 #user input for two numbers\n", + "b=20\n", + "\n", + "#Result\n", + "if aExample 2.11, Page Number: 28

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "for count in range(1,100+1):\n", + " print count," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.12, Page Number: 30

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "a=10 #User input for two numbers\n", + "b=20\n", + "\n", + "#Result\n", + "if aChapter 20: Namespaces and Other Advanced Topics

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.1, Page Number:474

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "class CounterNameSpace:\n", + " upperbound=None\n", + " lowerbound=None\n", + " class counter:\n", + " def __init__(self,n):\n", + " if n<=CounterNameSpace.upperbound:\n", + " self.count=n\n", + " else:\n", + " self.count=CounterNameSpace.upperbound\n", + " def reset(self,n):\n", + " if n<=CounterNameSpace.upperbound:\n", + " self.count=n\n", + " def run(self):\n", + " if self.count>CounterNameSpace.lowerbound:\n", + " self.count-=1\n", + " return self.count\n", + " else:\n", + " return CounterNameSpace.lowerbound\n", + " \n", + "CounterNameSpace.upperbound=100\n", + "CounterNameSpace.lowerbound=0\n", + "\n", + "\n", + "ob1=CounterNameSpace.counter(10)\n", + "while True:\n", + " i=ob1.run()\n", + " print i,\n", + " if i<=CounterNameSpace.lowerbound:\n", + " break \n", + "print\n", + "\n", + "\n", + "ob2=CounterNameSpace.counter(20)\n", + "while True:\n", + " i=ob2.run()\n", + " print i,\n", + " if i<=CounterNameSpace.lowerbound:\n", + " break \n", + "print\n", + "\n", + "\n", + "ob2.reset(100)\n", + "CounterNameSpace.lowerbound=90\n", + "while True:\n", + " i=ob2.run()\n", + " print i,\n", + " if i<=CounterNameSpace.lowerbound:\n", + " break " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "9 8 7 6 5 4 3 2 1 0\n", + "19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0\n", + "99 98 97 96 95 94 93 92 91 90\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.2, Page Number:476

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class CounterNameSpace:\n", + " upperbound=None\n", + " lowerbound=None\n", + " class counter:\n", + " def __init__(self,n):\n", + " if n<=c.upperbound:\n", + " self.count=n\n", + " else:\n", + " self.count=c.upperbound\n", + " def reset(self,n):\n", + " if n<=c.upperbound:\n", + " self.count=n\n", + " def run(self):\n", + " if self.count>c.lowerbound:\n", + " self.count-=1\n", + " return self.count\n", + " else:\n", + " return c.lowerbound\n", + "\n", + "#Use only upperbound using c\n", + "c=CounterNameSpace()\n", + "c.upperbound=100\n", + "CounterNameSpace.lowerbound=0\n", + "\n", + "\n", + "ob1=CounterNameSpace.counter(10)\n", + "while True:\n", + " i=ob1.run()\n", + " print i,\n", + " if i<=CounterNameSpace.lowerbound:\n", + " break \n", + "print\n", + "\n", + "#Now use entre CounterName Space using c\n", + "\n", + "ob2=c.counter(20)\n", + "while True:\n", + " i=ob2.run()\n", + " print i,\n", + " if i<=c.lowerbound:\n", + " break \n", + "print\n", + "\n", + "\n", + "ob2.reset(100)\n", + "c.lowerbound=90\n", + "while True:\n", + " i=ob2.run()\n", + " print i,\n", + " if i<=c.lowerbound:\n", + " break " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "9 8 7 6 5 4 3 2 1 0\n", + "19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0\n", + "99 98 97 96 95 94 93 92 91 90\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.3, Page Number:479

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#User-input\n", + "print \"Enter a number:\"\n", + "val= 10.00\n", + "\n", + "#Result\n", + "print \"This is your number:\",val" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number:\n", + "This is your number: 10.0\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.4, Page Number:479

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import sys\n", + "\n", + "#User-input\n", + "sys.stdout.write(\"Enter a number:\")\n", + "val= 10.00\n", + "\n", + "#Result\n", + "sys.stdout.write(\"\\nThis is your number: \")\n", + "sys.stdout.write(str(val))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number:\n", + "This is your number: 10.0" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.5, Page Number:479

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from sys import stdout\n", + "\n", + "#User-input\n", + "stdout.write(\"Enter a number:\")\n", + "val= 10.00\n", + "\n", + "#Result\n", + "stdout.write(\"\\nThis is your number: \")\n", + "stdout.write(str(val))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number:\n", + "This is your number: 10.0" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.6, Page Number:480

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def vline(i):\n", + " for j in xrange(i,0,-1):\n", + " print \"|\"\n", + "def hline(i):\n", + " for j in xrange(i,0,-1):\n", + " print \"-\",\n", + " print \n", + "\n", + "p=vline #p points to vline\n", + "p(4) #call vline()\n", + "\n", + "p=hline #p now points to hline\n", + "p(3) #call hline" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "|\n", + "|\n", + "|\n", + "|\n", + "- - -\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.7, Page Number:482

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import string\n", + "\n", + "def qsort(p):\n", + " if p == []: \n", + " return []\n", + " else:\n", + " pivot = p[0]\n", + " lesser = qsort([x for x in p[1:] if x < pivot])\n", + " greater = qsort([x for x in p[1:] if x >= pivot])\n", + " return lesser + [pivot] + greater\n", + " \n", + "#Variable Declaration \n", + "str=\"Function pointers provide flexibility.\" \n", + "\n", + "#sorting the string\n", + "str=qsort(str)\n", + "str=string.join(str)\n", + "\n", + "#Result\n", + "print \"sorted strng: \",str\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "sorted strng: . F b c d e e e f i i i i i i l l n n n o o o p p r r s t t t u v x y\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.8, Page Number:482

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import string\n", + "\n", + "def qsort(p):\n", + " \"\"\"Quicksort using list comprehensions\"\"\"\n", + " if p == []: \n", + " return []\n", + " else:\n", + " pivot = p[0]\n", + " lesser = qsort([x for x in p[1:] if x < pivot])\n", + " greater = qsort([x for x in p[1:] if x >= pivot])\n", + " return lesser + [pivot] + greater\n", + " \n", + "#Variable Declaration \n", + "num=[10,4,3,6,5,7,8]\n", + "\n", + "#sorting the string\n", + "num=qsort(num)\n", + "\n", + "#Result\n", + "for i in range(7):\n", + " print num[i],\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "3 4 5 6 7 8 10\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.9, Page Number:484

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def space(count,ch=None):\n", + " if ch==None:\n", + " for i in xrange(count,0,-1):\n", + " print '',\n", + " else:\n", + " for i in xrange(count,0,-1):\n", + " print ch,\n", + " \n", + "\n", + "fp1=space\n", + "fp2=space\n", + "\n", + "fp1(22) #outputs 20 spaces\n", + "print \"|\\n\" \n", + "\n", + "fp2(30,'x') #output 30 xs \n", + "print \"|\\n\"\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " |\n", + "\n", + "x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x |\n", + "\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.10, Page Number:485

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "num=None #static variable\n", + "\n", + "class ShareVar:\n", + " def setnum(i=0):\n", + " global num\n", + " num=i\n", + " def shownum(self):\n", + " global num\n", + " print num\n", + " \n", + "#Variables declaration\n", + "a=ShareVar()\n", + "b=ShareVar()\n", + "\n", + "a.shownum() #prints None\n", + "b.shownum() #prints None\n", + "\n", + "num=10 #set static num to 10\n", + "\n", + "a.shownum() #prints 10\n", + "b.shownum() #prints 10\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "None\n", + "None\n", + "10\n", + "10\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.11, Page Number:487

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Demo:\n", + " i=None\n", + " j=None\n", + " def geti(self):\n", + " return self.i\n", + " def seti(self,x):\n", + " self.i=x\n", + " \n", + "ob=Demo()\n", + "\n", + "ob.seti(1900)\n", + "print ob.geti()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1900\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.12, Page Number:488

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class myclass:\n", + " def __init__(self,x):\n", + " self.__a=x\n", + " def geta(self):\n", + " return self.__a\n", + " \n", + "#Variable declaration\n", + "ob=myclass(4)\n", + "\n", + "#Result\n", + "print ob.geta()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.13, Page Number:489

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class myclass:\n", + " def __init__(self,x):\n", + " self.__a=x\n", + " def geta():\n", + " return self.__a\n", + " \n", + "ob = myclass(110)" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.14, Page Number:490

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class myclass:\n", + " def __init__(self,i):\n", + " self.__num=i\n", + " def getnum(self):\n", + " return self.__num\n", + " \n", + "#Variable declaration\n", + "o=myclass(10)\n", + "\n", + "print o.getnum() #display 10\n", + "\n", + "o=myclass(1000)\n", + "\n", + "print o.getnum() #display 1000" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n", + "1000\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.15, Page Number:491

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class myclass:\n", + " def __init__(self,x,y):\n", + " self.__numA=x\n", + " self.__numB=y\n", + " def getnumA(self):\n", + " return self.__numA\n", + " def getnumB(self):\n", + " return self.__numB\n", + " \n", + "#Variable declaration\n", + "ob1=myclass(7,9)\n", + "ob2=myclass(5,2)\n", + "\n", + "#Result\n", + "print \"Values in ob1 are \",ob1.getnumB(),\"and\",ob1.getnumA()\n", + "print \"Values in ob2 are \",ob2.getnumB(),\"and\",ob2.getnumA()\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Values in ob1 are 9 and 7\n", + "Values in ob2 are 2 and 5\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.16, Page Number:492

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class myclass:\n", + " def __init__(self,x,y):\n", + " self.__numA=x\n", + " self.__numB=y\n", + " def getnumA(self):\n", + " return self.__numA\n", + " def getnumB(self):\n", + " return self.__numB\n", + " \n", + "#Variable declaration\n", + "ob1=myclass(7,9)\n", + "ob2=myclass(5,2)\n", + "\n", + "#Result\n", + "print \"Values in ob1 are \",ob1.getnumB(),\"and\",ob1.getnumA()\n", + "print \"Values in ob2 are \",ob2.getnumB(),\"and\",ob2.getnumA()\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Values in ob1 are 9 and 7\n", + "Values in ob2 are 2 and 5\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.17, Page Number:494

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def myfunc():\n", + " print \"This links as a C function.\"\n", + " \n", + "myfunc()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "This links as a C function.\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.18, Page Number:495

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from ctypes import *\n", + "\n", + "class myclass: \n", + " sum=c_int(0)\n", + " def sum_it(self,x):\n", + " for i in range(x+1):\n", + " self.sum.value+=i\n", + " fp=sum_it #pointer to function\n", + "\n", + "#Variable declaration\n", + "c=myclass()\n", + "fp=myclass.sum_it #get address of function\n", + "dp=pointer(c.sum) #address of data\n", + "c.fp(7) #compute summation of 7\n", + "\n", + "\n", + "#Result\n", + "print \"summation of 7 is\",dp[0]\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "summation of 7 is 28\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.19, Page Number:496

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from ctypes import *\n", + "\n", + "class myclass:\n", + " sum=c_int(0)\n", + " def sum_it(self,x): \n", + " for i in range(x+1):\n", + " self.sum.value+=i\n", + " fp=sum_it #pointer to function\n", + "\n", + "#Variable declaration\n", + "d=myclass()\n", + "c=[d] #ponter to object\n", + "fp=myclass.sum_it #get address of function\n", + "dp=pointer(c[0].sum) #get address of data\n", + "\n", + "c[0].fp(7) #compute summation of 7\n", + "\n", + "\n", + "#Result\n", + "print \"summation of 7 is\",dp[0]\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " summation of 7 is 28\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.20, Page Number:497

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class three_d:\n", + " def __init__(self,a,b,c): #3D coordinates\n", + " self.x=a\n", + " self.y=b\n", + " self.z=c\n", + " #Display x,y,z coordinates - three_d inserter.\n", + " def __repr__(self):\n", + " return str(self.x)+\", \"+str(self.y)+\", \"+str(self.z)+\"\\n\"\n", + " def __add__(self,op2):\n", + " if isinstance(op2,int):\n", + " c=self.x*self.y*self.z+op2\n", + " return c\n", + " temp=three_d(self.x+op2.x,self.y+op2.y,self.z+op2.z)\n", + " return temp\n", + " \n", + "a=three_d(1,2,3)\n", + "b=three_d(2,3,4)\n", + "\n", + "print a,b,\n", + "\n", + "print b+100 #displays 124 because of conversion to int\n", + "\n", + "a=a+b #add two three_d objects - no conversion\n", + "\n", + "print a #displays 3,5,7" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1, 2, 3\n", + " 2, 3, 4\n", + " 124\n", + "3, 5, 7\n", + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_from_the_Ground/.ipynb_checkpoints/Chapter_21(1)-checkpoint.ipynb b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_21(1)-checkpoint.ipynb new file mode 100644 index 00000000..76345922 --- /dev/null +++ b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_21(1)-checkpoint.ipynb @@ -0,0 +1,1187 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:1f6065242a1ea235eb4712b9ec147fb29625df8861301b52ad6c880a94467811" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 21: Introducing the Standard Template Library

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.1, Page Number:507

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "v=[] #Create a zero length vector\n", + " \n", + "print \"Size =\",len(v)\n", + " \n", + "\n", + "for i in range(10):\n", + " v.append(i)\n", + " \n", + "#display current size of v\n", + "print \"Current contents: \"\n", + "print \"Size now =\",len(v)\n", + "\n", + "#display contents of vector\n", + "for i in range(len(v)):\n", + " print v[i],\n", + " \n", + "print\n", + " \n", + "#put more values onto end of vector\n", + "#again, vector will grow as needed.\n", + "for i in range(10):\n", + " v.append(i+10)\n", + "#display current size of v\n", + "print \"Size now =\",len(v)\n", + "\n", + "#display contents of vector\n", + "print \"Current contents:\"\n", + "for i in range(len(v)):\n", + " print v[i],\n", + "print\n", + " \n", + "#change contents of vector\n", + "for i in range(len(v)):\n", + " v[i]=v[i]+v[i]\n", + " \n", + "#display contents of vector\n", + "print \"Contents doubled:\"\n", + "for i in range(len(v)):\n", + " print v[i]," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Size = 0\n", + "Current contents: \n", + "Size now = 10\n", + "0 1 2 3 4 5 6 7 8 9\n", + "Size now = 20\n", + "Current contents:\n", + "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19\n", + "Contents doubled:\n", + "0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.2, Page Number:508

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "v=[] #Create a zero length vector\n", + "\n", + "#put values onto end of vector\n", + "for i in range(10):\n", + " v.append(chr(ord('A')+i))\n", + " \n", + "#can access vector contents using subscripts\n", + "for i in range(len(v)):\n", + " print v[i], \n", + "print\n", + " \n", + "#access via iterator\n", + "for p in v:\n", + " print p,\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "A B C D E F G H I J\n", + "A B C D E F G H I J\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.3, Page Number:509

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "v=[] #Create a zero length vector\n", + "\n", + "#put values onto end of vector\n", + "for i in range(10):\n", + " v.append(chr(ord('A')+i))\n", + " \n", + "#Display original contents of vector\n", + "print \"Size =\",len(v)\n", + "print \"Original contents:\"\n", + "for i in range(len(v)):\n", + " print v[i], \n", + "print \"\\n\"\n", + " \n", + "p=2 #point to 3rd element\n", + "for i in range(10):\n", + " v.insert(p+i,'X')\n", + " \n", + "#display contents after insertion\n", + "print \"Size after insert =\",len(v)\n", + "print \"Contents after insert:\"\n", + "for i in range(len(v)):\n", + " print v[i],\n", + "print \"\\n\"\n", + "\n", + "#remove those elements\n", + "p=2 #point to 3rd element\n", + "for i in range(10):\n", + " v.pop(p)\n", + " \n", + "#display contents after insertion\n", + "print \"Size after erase =\",len(v)\n", + "print \"Contents after insert:\"\n", + "for i in range(len(v)):\n", + " print v[i],\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Size = 10\n", + "Original contents:\n", + "A B C D E F G H I J \n", + "\n", + "Size after insert = 20\n", + "Contents after insert:\n", + "A B X X X X X X X X X X C D E F G H I J \n", + "\n", + "Size after erase = 10\n", + "Contents after insert:\n", + "A B C D E F G H I J\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.4, Page Number:511

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class three_d:\n", + " def __init__(self,a,b,c): #3D coordinates\n", + " self.x=a\n", + " self.y=b\n", + " self.z=c\n", + " #Display x,y,z coordinates - three_d inserter.\n", + " def __repr__(self):\n", + " return str(self.x)+\", \"+str(self.y)+\", \"+str(self.z)+\"\\n\"\n", + " def __add__(self,a):\n", + " self.x+=a\n", + " self.y+=a\n", + " self.z+=a\n", + " return self\n", + " def __lt__(self,b):\n", + " return (self.x+self.y+self.z)<(b.x+b.y+b.z)\n", + " def __eq__(self,b):\n", + " return (self.x+self.y+self.z)==(b.x+b.y+b.z) \n", + " \n", + "#Variable declaration\n", + "v=[]\n", + "\n", + "#add objects to the vector\n", + "for i in range(10):\n", + " v.append(three_d(i,i+2,i-3))\n", + " \n", + "#Display contents of vector\n", + "for i in range(len(v)):\n", + " print v[i], \n", + "print\n", + "\n", + "\n", + "#Modify objects in a vector\n", + "for i in range(len(v)):\n", + " v[i]=v[i]+10 \n", + "\n", + "#Display modified vector\n", + "for i in range(len(v)):\n", + " print v[i], \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0, 2, -3\n", + " 1, 3, -2\n", + " 2, 4, -1\n", + " 3, 5, 0\n", + " 4, 6, 1\n", + " 5, 7, 2\n", + " 6, 8, 3\n", + " 7, 9, 4\n", + " 8, 10, 5\n", + " 9, 11, 6\n", + "\n", + "10, 12, 7\n", + " 11, 13, 8\n", + " 12, 14, 9\n", + " 13, 15, 10\n", + " 14, 16, 11\n", + " 15, 17, 12\n", + " 16, 18, 13\n", + " 17, 19, 14\n", + " 18, 20, 15\n", + " 19, 21, 16\n", + "\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.5, Page Number:513

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "v=[]\n", + "v2=[]\n", + "\n", + "for i in range(10):\n", + " v.append(chr(ord('A')+i))\n", + " \n", + "#Display original contents of vector\n", + "print \"Size =\",len(v)\n", + "print \"Original contents:\"\n", + "for i in range(len(v)):\n", + " print v[i], \n", + "print \"\\n\"\n", + "\n", + "#initialze second vector\n", + "str=\"-STL Power-\"\n", + "for i in range(len(str)):\n", + " v2.append(str[i])\n", + " \n", + "#get iterators to the middle of v and to the start and end of v2.\n", + "p=5\n", + "p2start=0\n", + "p2end=len(v2)-1\n", + "\n", + "#insert v2 into v\n", + "for i in range(p2end):\n", + " v.insert(p+i,v2[p2start+i])\n", + " \n", + "#display result\n", + "print \"Contents of v after inserton:\"\n", + "for i in range(len(v)):\n", + " print v[i],\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Size = 10\n", + "Original contents:\n", + "A B C D E F G H I J \n", + "\n", + "Contents of v after inserton:\n", + "A B C D E - S T L P o w e r F G H I J\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.6, Page Number:517

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "lst=[] #create an empty list\n", + "\n", + "for i in range(10):\n", + " lst.append(chr(ord('A')+i))\n", + " \n", + "print \"Size =\",len(lst)\n", + "\n", + "print \"Contents:\",\n", + "for p in lst:\n", + " print p, \n", + "print \"\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Size = 10\n", + "Contents: A B C D E F G H I J \n", + "\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.7, Page Number:518

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "lst=[] \n", + "revlst=[]\n", + "\n", + "for i in range(10):\n", + " lst.append(chr(ord('A')+i))\n", + " \n", + "print \"Size of list =\",len(lst)\n", + "\n", + "print \"Original Contents:\",\n", + "#Remove elements from lst and put them into revlst in reverse order.\n", + "for p in lst:\n", + " print p, \n", + " revlst.insert(0,p) \n", + "for i in range(10):\n", + " lst.pop(0)\n", + "print \"\\n\"\n", + "\n", + "print \"Size of revlst =\",len(revlst)\n", + "\n", + "print \"Reversed Contents:\",\n", + "for p in revlst:\n", + " print p," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Size of list = 10\n", + "Original Contents: A B C D E F G H I J \n", + "\n", + "Size of revlst = 10\n", + "Reversed Contents: J I H G F E D C B A\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.8, Page Number:519

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import random\n", + "\n", + "#Variable declaration\n", + "lst=[] \n", + "\n", + "#create a list of random integers\n", + "for i in range(10):\n", + " lst.append(random.randint(0,100))\n", + "\n", + "print \"Original Contents:\",\n", + "for p in lst:\n", + " print p, \n", + "print \"\\n\"\n", + "\n", + "#sort the list\n", + "lst.sort()\n", + "\n", + "print \"Sorted Contents:\",\n", + "for p in lst:\n", + " print p," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Original Contents: 75 73 72 4 88 7 85 21 67 42 \n", + "\n", + "Sorted Contents: 4 7 21 42 67 72 73 75 85 88\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.9, Page Number:520

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "lst1=[] \n", + "lst2=[]\n", + "\n", + "for i in xrange(0,10,2):\n", + " lst1.append(chr(ord('A')+i))\n", + "for i in xrange(1,11,2):\n", + " lst2.append(chr(ord('A')+i))\n", + "\n", + "print \"Contents of lst1:\",\n", + "for p in lst1:\n", + " print p, \n", + "print \"\\n\"\n", + "\n", + "print \"Contents of lst2:\",\n", + "for p in lst2:\n", + " print p, \n", + "print \"\\n\"\n", + "\n", + "#merge the lists\n", + "lst1=lst1+lst2\n", + "lst1.sort()\n", + "lst2=[]\n", + "\n", + "if lst2==[]:\n", + " print \"lst2 is now empty\"\n", + "\n", + "print \"Contentsof lst1 after merge:\"\n", + "for p in lst1:\n", + " print p," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Contents of lst1: A C E G I \n", + "\n", + "Contents of lst2: B D F H J \n", + "\n", + "lst2 is now empty\n", + "Contentsof lst1 after merge:\n", + "A B C D E F G H I J\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.10, Page Number:521

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class myclass:\n", + " def __init__(self,i=0,j=0):\n", + " self.__a=i\n", + " self.__b=j\n", + " self.sum=self.__a+self.__b\n", + " def getsum(self):\n", + " return self.sum\n", + " def __lt__(self,o2):\n", + " return self.sumo2.sum\n", + " def __eq__(self,o2):\n", + " return self.sum==o2.sum\n", + " def __ne__(self, other):\n", + " return not self.__eq__(self)\n", + " \n", + "#create first list\n", + "lst1=[]\n", + "for i in range(10):\n", + " lst1.append(myclass(i,i))\n", + " \n", + "print \"First list:\",\n", + "for p in lst1:\n", + " print p.getsum(),\n", + "print\n", + "\n", + "#create second list\n", + "lst2=[]\n", + "for i in range(10):\n", + " lst2.append(myclass(i*2,i*3))\n", + " \n", + "print \"First list:\",\n", + "for p in lst2:\n", + " print p.getsum(),\n", + "print\n", + " \n", + "#Now merge list\n", + "lst1=lst1+lst2\n", + "lst1.sort()\n", + "\n", + "#Display merge list\n", + "print \"Merged list:\",\n", + "for p in lst1:\n", + " print p.getsum(),\n", + "print" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "First list: 0 2 4 6 8 10 12 14 16 18\n", + "First list: 0 5 10 15 20 25 30 35 40 45\n", + "Merged list: 0 0 2 4 5 6 8 10 10 12 14 15 16 18 20 25 30 35 40 45\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.11, Page Number:527

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "m=[] \n", + "\n", + "#define the function find\n", + "def find(x,ch):\n", + " for p in x:\n", + " if p[0]==ch:\n", + " return p\n", + " return -1\n", + "\n", + "#put pairs into map\n", + "for i in range(10):\n", + " m.append([chr(ord('A')+i),i])\n", + " \n", + "#User Input\n", + "ch='D'\n", + "\n", + "#find value of the given key\n", + "p=find(m,ch)\n", + "\n", + "if not(p==-1):\n", + " print p[1]\n", + "else:\n", + " print \"Key not in the map\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.12, Page Number:528

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def find(x,ch):\n", + " for p in x:\n", + " if p[0].get()==ch.get():\n", + " return p\n", + " return -1\n", + "\n", + "\n", + "class word:\n", + " def __init__(self,s=\"\"):\n", + " self.str=s\n", + " def get(self):\n", + " return self.str\n", + " #must define less than relative to word objects\n", + " def __lt__(self,b):\n", + " return self.strExample 21.13, Page Number:532

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def isvowel(ch):\n", + " ch=ch.lower()\n", + " if (ch=='a' or ch=='e'or ch=='i' or ch=='o' or ch=='u'):\n", + " return 1\n", + " else:\n", + " return 0\n", + "\n", + "str=\"STL programming is powerful.\"\n", + "v=[]\n", + "\n", + "for i in range(len(str)):\n", + " v.append(str[i])\n", + " \n", + "print \"Sequence:\",\n", + "for i in range(len(v)):\n", + " print v[i],\n", + "print\n", + "\n", + "n=str.count('p')\n", + "print n,\"characters are p\"\n", + "\n", + "#count if vowel\n", + "n=0\n", + "for i in v:\n", + " if isvowel(i):\n", + " n+=1\n", + " \n", + "print n,\"characters are vowels.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sequence: S T L p r o g r a m m i n g i s p o w e r f u l .\n", + "2 characters are p\n", + "7 characters are vowels.\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.14, Page Number:534

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "str=\"This is a test\"\n", + "v=[]\n", + "v2=[]\n", + "\n", + "for i in range(len(str)):\n", + " v.append(str[i])\n", + " \n", + "# ***implement remove_copy***\n", + "print \"Input sequence:\",\n", + "for i in range(len(v)):\n", + " print v[i],\n", + "print \n", + "\n", + "#Remove all i's\n", + "v2 = str.replace(\"i\", \"\")\n", + "\n", + "print \"Result after removing i's: \",\n", + "print v2,\"\\n\"\n", + "\n", + "\n", + "# ***implement replace_copy***\n", + "print \"Input sequence:\",\n", + "for i in range(len(v)):\n", + " print v[i],\n", + "print \n", + "\n", + "#Replace s's with X's\n", + "v2 = str.replace(\"s\", \"X\")\n", + "\n", + "print \"Result after replacning s's with X's: \",\n", + "print v2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Input sequence: T h i s i s a t e s t\n", + "Result after removing i's: Ths s a test \n", + "\n", + "Input sequence: T h i s i s a t e s t\n", + "Result after replacning s's with X's: ThiX iX a teXt\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.15, Page Number:535

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "v=[]\n", + "\n", + "for i in range(10):\n", + " v.append(i)\n", + " \n", + "print \"Initial:\",\n", + "for i in range(len(v)):\n", + " print v[i],\n", + "print\n", + "\n", + "#Reversing the list\n", + "v.reverse()\n", + "\n", + "print \"Reversed:\",\n", + "for i in range(len(v)):\n", + " print v[i],\n", + "print \n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Initial: 0 1 2 3 4 5 6 7 8 9\n", + "Reversed: 9 8 7 6 5 4 3 2 1 0\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.16, Page Number:536

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def xform(i):\n", + " return i*i #square original value\n", + "\n", + "#the transorm function\n", + "def transform(x,f):\n", + " for i in range(len(x)):\n", + " x[i]= f(x[i])\n", + " \n", + "#Variable declaration\n", + "x1=[]\n", + "\n", + "#put values into list\n", + "for i in range(10):\n", + " x1.append(i)\n", + "\n", + "print \"Original contents of x1: \",\n", + "for p in x1:\n", + " print p,\n", + "print \n", + "\n", + "#transform x1\n", + "p=transform(x1,xform)\n", + "\n", + "print \"Transformed contents of x1:\",\n", + "for p in x1:\n", + " print p," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Original contents of x1: 0 1 2 3 4 5 6 7 8 9\n", + "Transformed contents of x1: 0 1 4 9 16 25 36 49 64 81\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.17, Page Number:540

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "str1=\"The string class gives \"\n", + "str2=\"C++ high strng handlng.\"\n", + "\n", + "#assign a string\n", + "str3=str1\n", + "print str1,\"\\n\",str3\n", + "\n", + "#Concatenate two strings\n", + "str3=str1+str2\n", + "print str3\n", + "\n", + "#Compare strings\n", + "if str3>str1:\n", + " print \"str3 > str1\"\n", + "if str3==str1+str2:\n", + " print \"str3 == str1+str2\"\n", + " \n", + "str1=\"This is a null-terminated string.\"\n", + "print str1\n", + "\n", + "#create a string object using another string object\n", + "str4=str1\n", + "print str4\n", + "\n", + "#nput a string\n", + "print \"Enter a string:\"\n", + "str4=\"Hello\"\n", + "print str4" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The string class gives \n", + "The string class gives \n", + "The string class gives C++ high strng handlng.\n", + "str3 > str1\n", + "str3 == str1+str2\n", + "This is a null-terminated string.\n", + "This is a null-terminated string.\n", + "Enter a string:\n", + "Hello\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.18, Page Number:542

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "str1=\"This is a test\"\n", + "str2=\"ABCDEFG\"\n", + "\n", + "print \"Initial strings:\"\n", + "print \"str1:\",str1\n", + "print \"str2:\",str2\n", + "print\n", + "\n", + "#demonstrate insert\n", + "print \"Insert str2 into str1:\"\n", + "str1=str1[:5]+str2+str1[5:]\n", + "print str1,\"\\n\"\n", + "\n", + "#demonstrate erase\n", + "print \"Remove 7 charecters from str1:\"\n", + "str1=str[:5]+str[5:]\n", + "print str1,\"\\n\"\n", + "\n", + "#demonstrate replace\n", + "print \"Replace 2 characters in str1 with str2:\"\n", + "str1=str1[:5]+str2+str1[7:]\n", + "print str1\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Initial strings:\n", + "str1: This is a test\n", + "str2: ABCDEFG\n", + "\n", + "Insert str2 into str1:\n", + "This ABCDEFGis a test \n", + "\n", + "Remove 7 charecters from str1:\n", + "This is a test \n", + "\n", + "Replace 2 characters in str1 with str2:\n", + "This ABCDEFG a test\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.19, Page Number:543

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import string\n", + "\n", + "#Variable declaration \n", + "s1=\"The string class makes string handling easy.\"\n", + "\n", + "i=string.find(s1,\"class\")\n", + "if not(i==-1):\n", + " print \"Match found at\",i\n", + " print \"Remaining string is:\",\n", + " s2=s1[i:]\n", + " print s2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Match found at 11\n", + "Remaining string is: class makes string handling easy.\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.20, Page Number:545

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def find(x,ch):\n", + " for p in x:\n", + " if p[0]==ch:\n", + " return p\n", + " return -1\n", + "\n", + "\n", + "dictionary=[]\n", + "\n", + "dictionary.append([\"house\",\"A place of dwelling\"])\n", + "dictionary.append([\"keyboard\",\"An input device\"])\n", + "dictionary.append([\"programming\",\"The act of writing a program\"])\n", + "dictionary.append([\"STL\",\"Standard Template Library\"])\n", + "\n", + "#given a word, find meaning\n", + "print \"Enter word:\"\n", + "str=\"house\" #User input\n", + "\n", + "p=find(dictionary,str)\n", + "\n", + "if not(p==-1):\n", + " print \"Definition:\",p[1]\n", + "else:\n", + " print \"Word not in the dictionary.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter word:\n", + "Definition: A place of dwelling\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_from_the_Ground/.ipynb_checkpoints/Chapter_22(1)-checkpoint.ipynb b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_22(1)-checkpoint.ipynb new file mode 100644 index 00000000..39b8cb88 --- /dev/null +++ b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_22(1)-checkpoint.ipynb @@ -0,0 +1,347 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:2d1838d005f866ea4e20c93ff6de54ebfd0d0c26c2e3055fc05467a06502c1dc" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 22: The C++ Preprocessor

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 22.1, Page Number: 550

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def MIN(a,b):\n", + " if aExample 22.2, Page Number: 551

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def EVEN(a):\n", + " if a%2==0:\n", + " return 1\n", + " else:\n", + " return 0\n", + "\n", + "if EVEN(9+1):\n", + " print \"is even\"\n", + "else:\n", + " print \"is odd\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "is even\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 22.3, Page Number: 551

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def EVEN(a):\n", + " if a%2==0:\n", + " return 1\n", + " else:\n", + " return 0\n", + "\n", + "if EVEN(9+1):\n", + " print \"is even\"\n", + "else:\n", + " print \"is odd\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "is even\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 22.4, Page Number: 553

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def MAX():\n", + " return 100\n", + "\n", + "if MAX()>10:\n", + " print \"Extra memory required.\"\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Extra memory required.\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 22.5, Page Number: 554

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def MAX():\n", + " return 6\n", + "\n", + "if MAX()>10:\n", + " print \"Extra memory required.\"\n", + "else:\n", + " print \"Current memory OK.\"\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Current memory OK.\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 22.6, Page Number: 556

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def TOM():\n", + " pass\n", + "\n", + "\n", + "try:\n", + " TOM()\n", + "except NameError:\n", + " print \"Programmer is unknown.\"\n", + "else:\n", + " print \"Programmer is Tom.\"\n", + " \n", + "try:\n", + " RALPH()\n", + "except NameError:\n", + " print \"RALPH not defined.\"\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Programmer is Tom.\n", + "RALPH not defined.\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 22.7, Page Number: 558

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import inspect\n", + " \n", + "def lineno():\n", + " return inspect.currentframe().f_back.f_lineno\n", + " \n", + "print lineno()+200\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "209\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 22.8, Page Number: 559

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def mkstr(s):\n", + " return str(s)\n", + "\n", + "#Result\n", + "print mkstr('I like C++')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "I like C++\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 22.9, Page Number: 560

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def concat(a,b):\n", + " return a+b\n", + "#Variable declaration\n", + "xy=10\n", + "\n", + "#Result\n", + "exec(\"print %s\")%concat('x','y')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_from_the_Ground/.ipynb_checkpoints/Chapter_3(1)-checkpoint.ipynb b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_3(1)-checkpoint.ipynb new file mode 100644 index 00000000..9d0cf326 --- /dev/null +++ b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_3(1)-checkpoint.ipynb @@ -0,0 +1,473 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:13095677f4efa0909d9aeb25aa7b8b57bea864fd1d9a0a797f9e06000e52dc18" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 3: The Basic Data Types

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.1, Page Number: 35

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def func():\n", + " x=-199 #local to func\n", + " print x #displays -199 \n", + " \n", + "x=10 #local to main\n", + "\n", + "func()\n", + "print x #displays 10\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "-199\n", + "10\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.2, Page Number: 37

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def func1():\n", + " global count\n", + " print \"count: \",count #access global count\n", + " func2()\n", + "\n", + "def func2():\n", + " for count in range(3): #this is local variable\n", + " print '.',\n", + "\n", + " \n", + "count=None #global variables\n", + "\n", + "for i in range(10):\n", + " count=i*2\n", + " func1()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "count: 0\n", + ". . . count: 2\n", + ". . . count: 4\n", + ". . . count: 6\n", + ". . . count: 8\n", + ". . . count: 10\n", + ". . . count: 12\n", + ". . . count: 14\n", + ". . . count: 16\n", + ". . . count: 18\n", + ". . .\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.3, Page Number: 40

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from ctypes import *\n", + "\n", + "#Variable declaration\n", + "j=c_uint(60000)\n", + "i=c_int(60000)\n", + "\n", + "#Result\n", + "print i.value,j.value" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "60000 60000\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.4, Page Number: 41

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "for letter in xrange(ord('Z'),ord('A')-1,-1):\n", + " print chr(letter),\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Z Y X W V U T S R Q P O N M L K J I H G F E D C B A\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.5, Page Number: 44

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "print \"\\n\\\\\\b\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\\\b\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.6, Page Number: 45

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def total(x):\n", + " sum=0\n", + " for i in xrange(1,x+1):\n", + " sum=sum+i\n", + " for count in range(10):\n", + " print '-',\n", + " print \"The current sum is\",sum\n", + " \n", + "print \"Computing summation of 5.\"\n", + "total(5)\n", + "\n", + "print \"Computing summation of 6.\"\n", + "total(6)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Computing summation of 5.\n", + "- - - - - - - - - - The current sum is 1\n", + "- - - - - - - - - - The current sum is 3\n", + "- - - - - - - - - - The current sum is 6\n", + "- - - - - - - - - - The current sum is 10\n", + "- - - - - - - - - - The current sum is 15\n", + "Computing summation of 6.\n", + "- - - - - - - - - - The current sum is 1\n", + "- - - - - - - - - - The current sum is 3\n", + "- - - - - - - - - - The current sum is 6\n", + "- - - - - - - - - - The current sum is 10\n", + "- - - - - - - - - - The current sum is 15\n", + "- - - - - - - - - - The current sum is 21\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.7, Page Number: 47

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "x=10\n", + "y=3\n", + "\n", + "print x/y #will display 3\n", + "print x%y #will display1, the remainder\n", + "\n", + "x=1\n", + "y=2\n", + "\n", + "#Result\n", + "print x/y,x%y #will display 0 1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n", + "1\n", + "0 1\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.8, Page Number: 51

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def xor(a,b):\n", + " return (a or b)and(not(a and b))\n", + "\n", + "#User-input\n", + "print \"Enter P(0 or 1):\"\n", + "p=1 \n", + "print \"Enter Q(0 or 1):\"\n", + "q=0\n", + "\n", + "#Result\n", + "print \"P AND Q:\",(p and q)\n", + "print \"P OR Q:\",(p or q)\n", + "print \"P XOR Q:\",xor(p,q)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter P(0 or 1):\n", + "Enter Q(0 or 1):\n", + "P AND Q: 0\n", + "P OR Q: 1\n", + "P XOR Q: True\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.9, Page Number: 54

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "for i in xrange(1,100+1):\n", + " print i,\"/ 2 is:\",float(i)/2\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 / 2 is: 0.5\n", + "2 / 2 is: 1.0\n", + "3 / 2 is: 1.5\n", + "4 / 2 is: 2.0\n", + "5 / 2 is: 2.5\n", + "6 / 2 is: 3.0\n", + "7 / 2 is: 3.5\n", + "8 / 2 is: 4.0\n", + "9 / 2 is: 4.5\n", + "10 / 2 is: 5.0\n", + "11 / 2 is: 5.5\n", + "12 / 2 is: 6.0\n", + "13 / 2 is: 6.5\n", + "14 / 2 is: 7.0\n", + "15 / 2 is: 7.5\n", + "16 / 2 is: 8.0\n", + "17 / 2 is: 8.5\n", + "18 / 2 is: 9.0\n", + "19 / 2 is: 9.5\n", + "20 / 2 is: 10.0\n", + "21 / 2 is: 10.5\n", + "22 / 2 is: 11.0\n", + "23 / 2 is: 11.5\n", + "24 / 2 is: 12.0\n", + "25 / 2 is: 12.5\n", + "26 / 2 is: 13.0\n", + "27 / 2 is: 13.5\n", + "28 / 2 is: 14.0\n", + "29 / 2 is: 14.5\n", + "30 / 2 is: 15.0\n", + "31 / 2 is: 15.5\n", + "32 / 2 is: 16.0\n", + "33 / 2 is: 16.5\n", + "34 / 2 is: 17.0\n", + "35 / 2 is: 17.5\n", + "36 / 2 is: 18.0\n", + "37 / 2 is: 18.5\n", + "38 / 2 is: 19.0\n", + "39 / 2 is: 19.5\n", + "40 / 2 is: 20.0\n", + "41 / 2 is: 20.5\n", + "42 / 2 is: 21.0\n", + "43 / 2 is: 21.5\n", + "44 / 2 is: 22.0\n", + "45 / 2 is: 22.5\n", + "46 / 2 is: 23.0\n", + "47 / 2 is: 23.5\n", + "48 / 2 is: 24.0\n", + "49 / 2 is: 24.5\n", + "50 / 2 is: 25.0\n", + "51 / 2 is: 25.5\n", + "52 / 2 is: 26.0\n", + "53 / 2 is: 26.5\n", + "54 / 2 is: 27.0\n", + "55 / 2 is: 27.5\n", + "56 / 2 is: 28.0\n", + "57 / 2 is: 28.5\n", + "58 / 2 is: 29.0\n", + "59 / 2 is: 29.5\n", + "60 / 2 is: 30.0\n", + "61 / 2 is: 30.5\n", + "62 / 2 is: 31.0\n", + "63 / 2 is: 31.5\n", + "64 / 2 is: 32.0\n", + "65 / 2 is: 32.5\n", + "66 / 2 is: 33.0\n", + "67 / 2 is: 33.5\n", + "68 / 2 is: 34.0\n", + "69 / 2 is: 34.5\n", + "70 / 2 is: 35.0\n", + "71 / 2 is: 35.5\n", + "72 / 2 is: 36.0\n", + "73 / 2 is: 36.5\n", + "74 / 2 is: 37.0\n", + "75 / 2 is: 37.5\n", + "76 / 2 is: 38.0\n", + "77 / 2 is: 38.5\n", + "78 / 2 is: 39.0\n", + "79 / 2 is: 39.5\n", + "80 / 2 is: 40.0\n", + "81 / 2 is: 40.5\n", + "82 / 2 is: 41.0\n", + "83 / 2 is: 41.5\n", + "84 / 2 is: 42.0\n", + "85 / 2 is: 42.5\n", + "86 / 2 is: 43.0\n", + "87 / 2 is: 43.5\n", + "88 / 2 is: 44.0\n", + "89 / 2 is: 44.5\n", + "90 / 2 is: 45.0\n", + "91 / 2 is: 45.5\n", + "92 / 2 is: 46.0\n", + "93 / 2 is: 46.5\n", + "94 / 2 is: 47.0\n", + "95 / 2 is: 47.5\n", + "96 / 2 is: 48.0\n", + "97 / 2 is: 48.5\n", + "98 / 2 is: 49.0\n", + "99 / 2 is: 49.5\n", + "100 / 2 is: 50.0\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_from_the_Ground/.ipynb_checkpoints/Chapter_4(1)-checkpoint.ipynb b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_4(1)-checkpoint.ipynb new file mode 100644 index 00000000..ca8e76db --- /dev/null +++ b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_4(1)-checkpoint.ipynb @@ -0,0 +1,1340 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:f944500666c92742656b5a25638e93a82042acafb19b205aac684e2d9ac2df51" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 4: Program Control Statements

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.1, Page Number: 58

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import random\n", + "\n", + "#Variable declaration and initialization\n", + "magic = random.randint(0,100) #Number which the user has to guess\n", + "guess = 10 #Number which the user guesses\n", + "\n", + "if guess == magic:\n", + " print \"***Right***\" #Result\n", + "\n", + "\n", + " \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.2, Page Number: 59

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "import random\n", + "\n", + "#Variable decleration and initialization\n", + "magic=random.randint(0,100) #Number to be guessed\n", + "guess = 10 #Number the user guesses\n", + "\n", + "#Result\n", + "if guess == magic:\n", + " print \"***Right***\"\n", + "else:\n", + " print \"... Sorry, you're wrong.\"\n", + "\n", + "\n", + "\n", + " \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "... Sorry, you're wrong.\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.3, Page Number: 60

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable decleration and initialization\n", + "a = 30 #User input for the two nos.\n", + "b = 10\n", + "\n", + "#Calculation and Result\n", + "if b:\n", + " print a/b\n", + "else:\n", + " print \"Cannot divide by zero.\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.4, Page Number: 61

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "import random\n", + "\n", + "#Variable decleration \n", + "magic = random.randint(0,100) #Numbr to be guessed\n", + "guess = 10 #Number the user guesses\n", + "\n", + "#Result\n", + "if guess == magic:\n", + " print \"***Right***\"\n", + " print magic,\" is the magic number.\"\n", + "else:\n", + " print \"... Sorry, you're wrong\" \n", + " if(guess>magic): #use a nested if statement\n", + " print \"Your guess is too high\"\n", + " else:\n", + " print \"Your guess is too low\"\n", + "\n", + " \n", + " \n", + "\n", + " \n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.5, Page Number: 62

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "for x in range(6):\n", + " if x==1: #using if-else ladder in a for loop\n", + " print \"x is one\"\n", + " elif x==2:\n", + " print \"x is two\"\n", + " elif x==3:\n", + " print \"x is three\"\n", + " elif x==4:\n", + " print \"x is four\"\n", + " else:\n", + " print \"x is not between 1 nd 4\"\n", + " \n", + " \n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x is not between 1 nd 4\n", + "x is one\n", + "x is two\n", + "x is three\n", + "x is four\n", + "x is not between 1 nd 4\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.6, Page Number: 63

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "for num in range(100):\n", + " sq_root = math.sqrt(float(num)) #Calculation\n", + " print num,\" \",sq_root #Result\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 0.0\n", + "1 1.0\n", + "2 1.41421356237\n", + "3 1.73205080757\n", + "4 2.0\n", + "5 2.2360679775\n", + "6 2.44948974278\n", + "7 2.64575131106\n", + "8 2.82842712475\n", + "9 3.0\n", + "10 3.16227766017\n", + "11 3.31662479036\n", + "12 3.46410161514\n", + "13 3.60555127546\n", + "14 3.74165738677\n", + "15 3.87298334621\n", + "16 4.0\n", + "17 4.12310562562\n", + "18 4.24264068712\n", + "19 4.35889894354\n", + "20 4.472135955\n", + "21 4.58257569496\n", + "22 4.69041575982\n", + "23 4.79583152331\n", + "24 4.89897948557\n", + "25 5.0\n", + "26 5.09901951359\n", + "27 5.19615242271\n", + "28 5.29150262213\n", + "29 5.38516480713\n", + "30 5.47722557505\n", + "31 5.56776436283\n", + "32 5.65685424949\n", + "33 5.74456264654\n", + "34 5.83095189485\n", + "35 5.9160797831\n", + "36 6.0\n", + "37 6.0827625303\n", + "38 6.16441400297\n", + "39 6.2449979984\n", + "40 6.32455532034\n", + "41 6.40312423743\n", + "42 6.48074069841\n", + "43 6.5574385243\n", + "44 6.63324958071\n", + "45 6.7082039325\n", + "46 6.78232998313\n", + "47 6.8556546004\n", + "48 6.92820323028\n", + "49 7.0\n", + "50 7.07106781187\n", + "51 7.14142842854\n", + "52 7.21110255093\n", + "53 7.28010988928\n", + "54 7.34846922835\n", + "55 7.4161984871\n", + "56 7.48331477355\n", + "57 7.54983443527\n", + "58 7.61577310586\n", + "59 7.68114574787\n", + "60 7.74596669241\n", + "61 7.81024967591\n", + "62 7.87400787401\n", + "63 7.93725393319\n", + "64 8.0\n", + "65 8.0622577483\n", + "66 8.12403840464\n", + "67 8.18535277187\n", + "68 8.24621125124\n", + "69 8.30662386292\n", + "70 8.36660026534\n", + "71 8.42614977318\n", + "72 8.48528137424\n", + "73 8.54400374532\n", + "74 8.60232526704\n", + "75 8.66025403784\n", + "76 8.71779788708\n", + "77 8.77496438739\n", + "78 8.83176086633\n", + "79 8.88819441732\n", + "80 8.94427191\n", + "81 9.0\n", + "82 9.05538513814\n", + "83 9.11043357914\n", + "84 9.16515138991\n", + "85 9.21954445729\n", + "86 9.2736184955\n", + "87 9.32737905309\n", + "88 9.38083151965\n", + "89 9.43398113206\n", + "90 9.48683298051\n", + "91 9.53939201417\n", + "92 9.59166304663\n", + "93 9.64365076099\n", + "94 9.69535971483\n", + "95 9.74679434481\n", + "96 9.79795897113\n", + "97 9.8488578018\n", + "98 9.89949493661\n", + "99 9.94987437107\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.7, Page Number: 64

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "for i in xrange(100,-100,-5): \n", + " print i,\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "100 95 90 85 80 75 70 65 60 55 50 45 40 35 30 25 20 15 10 5 0 -5 -10 -15 -20 -25 -30 -35 -40 -45 -50 -55 -60 -65 -70 -75 -80 -85 -90 -95\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.8, Page Number: 66

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "#Variable decleration\n", + "x=0\n", + "\n", + "#Loop till 123 is entered\n", + "while x!=123:\n", + " print \"Enter a number: \"\n", + " x = 123\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number: \n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.9, Page Number: 68

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "print \"Help on:\"\n", + "print \"1. for\"\n", + "print \"2. if\"\n", + "print \"3. while\"\n", + "\n", + "\n", + "choice = 2 #Choice of user\n", + "\n", + "if choice==1: #Executing users choice with if-else\n", + " print \"for is c++'s most versatile loop.\"\n", + "elif choice==2:\n", + " print \"if is c++'s conditional branch statement.\"\n", + "elif choice==3:\n", + " print \"switch is C++'s multiway branch statement. \"\n", + "else:\n", + " print \"You must enter a number between 1 and 3.\"\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Help on:\n", + "1. for\n", + "2. if\n", + "3. while\n", + "if is c++'s conditional branch statement.\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.10, Page Number: 69

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "for i in range(5):\n", + " if i==0:\n", + " print \"less than 1\"\n", + " elif i==1:\n", + " print \"less than 2\"\n", + " elif i==2:\n", + " print \"less than 3\"\n", + " elif i==3:\n", + " print \"less than 4\"\n", + " elif i==4:\n", + " print \"less than 5\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "less than 1\n", + "less than 2\n", + "less than 3\n", + "less than 4\n", + "less than 5\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.11, Page Number: 71

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#Variable decleration\n", + "ch = 32\n", + "\n", + "#Loop to print the characters\n", + "for ch in range(128):\n", + " print chr(ch)\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\u0000\n", + "\u0001\n", + "\u0002\n", + "\u0003\n", + "\u0004\n", + "\u0005\n", + "\u0006\n", + "\u0007\n", + "\b\n", + "\t\n", + "\n", + "\n", + "\u000b", + "\n", + "\f", + "\n", + "\r\n", + "\u000e\n", + "\u000f\n", + "\u0010\n", + "\u0011\n", + "\u0012\n", + "\u0013\n", + "\u0014\n", + "\u0015\n", + "\u0016\n", + "\u0017\n", + "\u0018\n", + "\u0019\n", + "\u001a\n", + "\u001b\n", + "\u001c", + "\n", + "\u001d", + "\n", + "\u001e", + "\n", + "\u001f\n", + " \n", + "!\n", + "\"\n", + "#\n", + "$\n", + "%\n", + "&\n", + "'\n", + "(\n", + ")\n", + "*\n", + "+\n", + ",\n", + "-\n", + ".\n", + "/\n", + "0\n", + "1\n", + "2\n", + "3\n", + "4\n", + "5\n", + "6\n", + "7\n", + "8\n", + "9\n", + ":\n", + ";\n", + "<\n", + "=\n", + ">\n", + "?\n", + "@\n", + "A\n", + "B\n", + "C\n", + "D\n", + "E\n", + "F\n", + "G\n", + "H\n", + "I\n", + "J\n", + "K\n", + "L\n", + "M\n", + "N\n", + "O\n", + "P\n", + "Q\n", + "R\n", + "S\n", + "T\n", + "U\n", + "V\n", + "W\n", + "X\n", + "Y\n", + "Z\n", + "[\n", + "\\\n", + "]\n", + "^\n", + "_\n", + "`\n", + "a\n", + "b\n", + "c\n", + "d\n", + "e\n", + "f\n", + "g\n", + "h\n", + "i\n", + "j\n", + "k\n", + "l\n", + "m\n", + "n\n", + "o\n", + "p\n", + "q\n", + "r\n", + "s\n", + "t\n", + "u\n", + "v\n", + "w\n", + "x\n", + "y\n", + "z\n", + "{\n", + "|\n", + "}\n", + "~\n", + "\u007f\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.12, Page Number: 72

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable decleration\n", + "len = 5\n", + "\n", + "while (len>0 & len<80):\n", + " print \".\"\n", + " len-=1\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + ".\n", + ".\n", + ".\n", + ".\n", + ".\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.13, Page Number: 73

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable Declaration\n", + "num=95\n", + "\n", + "while True:\n", + " print \"Enter a number(100 to stop): \"\n", + " num+=1 #User input, incrementing num till it reaches 100\n", + " if(num==100): #Condition check to stop loop\n", + " break\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number(100 to stop): \n", + "Enter a number(100 to stop): \n", + "Enter a number(100 to stop): \n", + "Enter a number(100 to stop): \n", + "Enter a number(100 to stop): \n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.14, Page Number: 73

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import random\n", + "\n", + "#Variable decleration\n", + "magic = random.randint(0,100) #Number which the user has to guess\n", + "low=0\n", + "high=100\n", + "\n", + "#Play thr magic number game\n", + "while True:\n", + " guess = random.randint(low,high) #Number which the user guesses\n", + " if guess==magic: \n", + " print \"**Right**\"\n", + " print magic,\" is the magic number.\"\n", + " break\n", + " else:\n", + " print \"...Sorry, you're wrong.\"\n", + " if(guess>magic):\n", + " print \"Your guess is too high.\"\n", + " high=guess\n", + " else:\n", + " print \"Your guess is too low.\"\n", + " low=guess\n", + " \n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "...Sorry, you're wrong.\n", + "Your guess is too low.\n", + "...Sorry, you're wrong.\n", + "Your guess is too high.\n", + "...Sorry, you're wrong.\n", + "Your guess is too low.\n", + "...Sorry, you're wrong.\n", + "Your guess is too high.\n", + "...Sorry, you're wrong.\n", + "Your guess is too low.\n", + "...Sorry, you're wrong.\n", + "Your guess is too high.\n", + "...Sorry, you're wrong.\n", + "Your guess is too low.\n", + "...Sorry, you're wrong.\n", + "Your guess is too high.\n", + "...Sorry, you're wrong.\n", + "Your guess is too low.\n", + "...Sorry, you're wrong.\n", + "Your guess is too low.\n", + "...Sorry, you're wrong.\n", + "Your guess is too high.\n", + "...Sorry, you're wrong.\n", + "Your guess is too high.\n", + "...Sorry, you're wrong.\n", + "Your guess is too high.\n", + "...Sorry, you're wrong.\n", + "Your guess is too low.\n", + "**Right**\n", + "72 is the magic number.\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.15, Page Number: 74

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "for x in range(100+1):\n", + " if x%2: #Condition check to continue the loop\n", + " continue\n", + " print x,\n", + " \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.16, Page Number: 75

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "for t in range(100):\n", + " if t==10: #Condition check to break out of the loop\n", + " break\n", + " print t,\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 1 2 3 4 5 6 7 8 9\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.17, Page Number: 75

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "for t in range(100):\n", + " count = 1 \n", + " while True:\n", + " print count,\n", + " count+=1\n", + " if count==10: \n", + " break #Breaks from the inner loop\n", + " print\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n", + "1 2 3 4 5 6 7 8 9\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.18, Page Number: 76

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "for i in range(2,1000):\n", + " j=2\n", + " for j in range(2,i/j): #Nested for loop\n", + " if i%j == False: #Check for prime no.\n", + " break\n", + " if j>(i/j):\n", + " print i,\" is prime.\" #Result\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "2 is prime.\n", + "3 is prime.\n", + "11 is prime.\n", + "13 is prime.\n", + "17 is prime.\n", + "19 is prime.\n", + "23 is prime.\n", + "29 is prime.\n", + "31 is prime.\n", + "37 is prime.\n", + "41 is prime.\n", + "43 is prime.\n", + "47 is prime.\n", + "53 is prime.\n", + "59 is prime.\n", + "61 is prime.\n", + "67 is prime.\n", + "71 is prime.\n", + "73 is prime.\n", + "79 is prime.\n", + "83 is prime.\n", + "89 is prime.\n", + "97 is prime.\n", + "101 is prime.\n", + "103 is prime.\n", + "107 is prime.\n", + "109 is prime.\n", + "113 is prime.\n", + "127 is prime.\n", + "131 is prime.\n", + "137 is prime.\n", + "139 is prime.\n", + "149 is prime.\n", + "151 is prime.\n", + "157 is prime.\n", + "163 is prime.\n", + "167 is prime.\n", + "173 is prime.\n", + "179 is prime.\n", + "181 is prime.\n", + "191 is prime.\n", + "193 is prime.\n", + "197 is prime.\n", + "199 is prime.\n", + "211 is prime.\n", + "223 is prime.\n", + "227 is prime.\n", + "229 is prime.\n", + "233 is prime.\n", + "239 is prime.\n", + "241 is prime.\n", + "251 is prime.\n", + "257 is prime.\n", + "263 is prime.\n", + "269 is prime.\n", + "271 is prime.\n", + "277 is prime.\n", + "281 is prime.\n", + "283 is prime.\n", + "293 is prime.\n", + "307 is prime.\n", + "311 is prime.\n", + "313 is prime.\n", + "317 is prime.\n", + "331 is prime.\n", + "337 is prime.\n", + "347 is prime.\n", + "349 is prime.\n", + "353 is prime.\n", + "359 is prime.\n", + "367 is prime.\n", + "373 is prime.\n", + "379 is prime.\n", + "383 is prime.\n", + "389 is prime.\n", + "397 is prime.\n", + "401 is prime.\n", + "409 is prime.\n", + "419 is prime.\n", + "421 is prime.\n", + "431 is prime.\n", + "433 is prime.\n", + "439 is prime.\n", + "443 is prime.\n", + "449 is prime.\n", + "457 is prime.\n", + "461 is prime.\n", + "463 is prime.\n", + "467 is prime.\n", + "479 is prime.\n", + "487 is prime.\n", + "491 is prime.\n", + "499 is prime.\n", + "503 is prime.\n", + "509 is prime.\n", + "521 is prime.\n", + "523 is prime.\n", + "541 is prime.\n", + "547 is prime.\n", + "557 is prime.\n", + "563 is prime.\n", + "569 is prime.\n", + "571 is prime.\n", + "577 is prime.\n", + "587 is prime.\n", + "593 is prime.\n", + "599 is prime.\n", + "601 is prime.\n", + "607 is prime.\n", + "613 is prime.\n", + "617 is prime.\n", + "619 is prime.\n", + "631 is prime.\n", + "641 is prime.\n", + "643 is prime.\n", + "647 is prime.\n", + "653 is prime.\n", + "659 is prime.\n", + "661 is prime.\n", + "673 is prime.\n", + "677 is prime.\n", + "683 is prime.\n", + "691 is prime.\n", + "701 is prime.\n", + "709 is prime.\n", + "719 is prime.\n", + "727 is prime.\n", + "733 is prime.\n", + "739 is prime.\n", + "743 is prime.\n", + "751 is prime.\n", + "757 is prime.\n", + "761 is prime.\n", + "769 is prime.\n", + "773 is prime.\n", + "787 is prime.\n", + "797 is prime.\n", + "809 is prime.\n", + "811 is prime.\n", + "821 is prime.\n", + "823 is prime.\n", + "827 is prime.\n", + "829 is prime.\n", + "839 is prime.\n", + "853 is prime.\n", + "857 is prime.\n", + "859 is prime.\n", + "863 is prime.\n", + "877" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " is prime.\n", + "881 is prime.\n", + "883 is prime.\n", + "887 is prime.\n", + "907 is prime.\n", + "911 is prime.\n", + "919 is prime.\n", + "929 is prime.\n", + "937 is prime.\n", + "941 is prime.\n", + "947 is prime.\n", + "953 is prime.\n", + "967 is prime.\n", + "971 is prime.\n", + "977 is prime.\n", + "983 is prime.\n", + "991 is prime.\n", + "997 is prime.\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.19, Page Number: 78

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import random\n", + "\n", + "#Variable declaration\n", + "magic = random.randint(0,100) #Number to be guessed\n", + "i=1\n", + "high=100\n", + "low=0\n", + "\n", + "#Function to play the magic number game\n", + "def play(m):\n", + " low=0\n", + " high=100\n", + " for t in range(100):\n", + " x = random.randint(low,high) #Number guessed by the user\n", + " if x==m:\n", + " print \"***Right***\"\n", + " return\n", + " else:\n", + " if(x=1 and option<=3:\n", + " break\n", + " if option==1:\n", + " magic=random.randint(0,100) #Number to be guessed\n", + " elif option==2:\n", + " play(magic) #Calls the function play\n", + " elif option==3:\n", + " print \"Goodbye\" \n", + " break\n", + " i+=1 #increments i such that the 3 options get selected sequentially\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1.Get a new magic number.\n", + "2.Play\n", + "3.Quit\n", + "1.Get a new magic number.\n", + "2.Play\n", + "3.Quit\n", + "Too low.\n", + "Too low.\n", + "Too low.\n", + "Too low.\n", + "Too high.\n", + "Too low.\n", + "Too high.\n", + "Too low.\n", + "Too high.\n", + "Too high.\n", + "Too high.\n", + "Too high.\n", + "Too low.\n", + "***Right***\n", + "1.Get a new magic number.\n", + "2.Play\n", + "3.Quit\n", + "Goodbye\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_from_the_Ground/.ipynb_checkpoints/Chapter_5(1)-checkpoint.ipynb b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_5(1)-checkpoint.ipynb new file mode 100644 index 00000000..13085f5e --- /dev/null +++ b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_5(1)-checkpoint.ipynb @@ -0,0 +1,1191 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:f41d93d043c68dcb6af847a40af38d47fc3a3d45c60675afb574707e38d804d9" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 5: Arrays ans Strings

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.1, Page Number: 82

\n", + " " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "sample = range(10) #Declares an array [0,1,2,3,4,5,6,7,8,9]\n", + "\n", + "#Displays the array\n", + "for t in range(10):\n", + " print sample[t],\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 1 2 3 4 5 6 7 8 9\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.2, Page Number: 83

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import random\n", + "\n", + "#Variable declaration\n", + "list = [] #List of integers\n", + "\n", + "for i in range(10):\n", + " list.append(random.randint(0,1000)) #randomely assigning integers\n", + " \n", + "#Finding the minimum value\n", + "min_value = list[0]\n", + "\n", + "for i in range(10):\n", + " if min_value>list[i]:\n", + " min_value=list[i]\n", + "print \"minimum value: \",min_value #Result:Minimum value\n", + "\n", + "#Finding maximum value\n", + "max_value = list[0]\n", + "\n", + "for i in range(10):\n", + " if max_valueExample 5.3, Page Number: 85

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "import random\n", + "\n", + "#Variable declaration\n", + "nums = []\n", + "size = 10\n", + "\n", + "#Initializing list with random numbers\n", + "for t in range(size):\n", + " nums.append(random.randint(0,1000))\n", + "\n", + "#Displays original array\n", + "print \"Original array is: \"\n", + "print nums\n", + "\n", + "#Bubble Sort\n", + "for a in range(size):\n", + " for b in xrange(size-1,a,-1):\n", + " if nums[b-1]>nums[b]:\n", + " t=nums[b-1]\n", + " nums[b-1]=nums[b]\n", + " nums[b] = t\n", + "\n", + "#Display sorted array\n", + "print \"Sorted array is: \"\n", + "print nums\n", + "\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Original array is: \n", + "[388, 661, 218, 595, 167, 46, 704, 140, 559, 428]\n", + "Sorted array is: \n", + "[46, 140, 167, 218, 388, 428, 559, 595, 661, 704]\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.4, Page Number: 87

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable decleration\n", + "str = \"Hello\"\n", + "\n", + "#Result\n", + "print \"Here is your string:\",\n", + "print str\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Here is your string: Hello\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.5, Page Number: 88

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "print \"Enter a string: \"\n", + "\n", + " \n", + "str = \"Hello\"\n", + "\n", + "#Result\n", + "print \"Here is your string:\",\n", + "print str\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a string: \n", + "Here is your string: Hello\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.6, Page Number: 89

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable decleration\n", + "s=str\n", + "str = s #copying s into str\n", + "\n", + "#Result\n", + "print str\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.7, Page Number: 89

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable decleration\n", + "s1 = \"Hello\"\n", + "s2 = \" There\"\n", + "\n", + "#Concatenation\n", + "s1+=s2\n", + "\n", + "#Result\n", + "print s1\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello There\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.8, Page Number: 90

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def password():\n", + " print \"Enter password: \" #User input for password\n", + " s= \"pass\"\n", + " if s==\"password\":\n", + " return True\n", + " else:\n", + " print \"Invalid password.\"\n", + " return False\n", + "\n", + "#Result\n", + "if password() :\n", + " print \"Logged On.\"\n", + "else:\n", + " print \"Access denied\"\n", + " \n", + " \n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter password: \n", + "Invalid password.\n", + "Access denied\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.9, Page Number: 91

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import string\n", + "\n", + " s=raw_input(\"Enter a string: \") #User input of string;\n", + " if s==\"quit\": #Sting comparison\n", + " break\n", + " \n", + " \n", + "\n", + " \n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a string: ddc\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a string: hello\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a string: quit\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.10, Page Number: 91

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "str = \"Hello\"\n", + "\n", + "#Result\n", + "print \"Length is: \",len(str)\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Length is: 5\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.11, Page Number: 92

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "str = \"Hello World\"\n", + "\n", + "#Reversing a String\n", + "rev = str[::-1]\n", + "\n", + "#Result\n", + "print rev\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "dlroW olleH\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.12, Page Number: 92

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "s1 = \"Hello\"\n", + "s2 = \"there\"\n", + "\n", + "#Printing lengths\n", + "print \"lengths: \",len(s1),' ',len(s2)\n", + "\n", + "#Comparing\n", + "if(s1==s2):\n", + " print \"The strings are equal\"\n", + "else:\n", + " print \"not equal\"\n", + "\n", + "#Concatenation\n", + "s1+=s2\n", + "print s1\n", + "\n", + "\n", + "#Copying\n", + "s1=s2\n", + "\n", + "#Result\n", + "print s1,\"and\",s2,\" are now the same\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "lengths: 5 5\n", + "not equal\n", + "Hellothere\n", + "there and there are now the same\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.13, Page Number: 93

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import string\n", + "\n", + "#Variable Initialization\n", + "str= \"this is a test\"\n", + "\n", + "str=string.upper(str)\n", + "\n", + "#Result\n", + "print str\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "THIS IS A TEST\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.14, Page Number: 94

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "arr=[] #The 2-D list\n", + "new=[] #The nested list\n", + "\n", + "#Initializing the 2-D array\n", + "for i in range(3):\n", + " new=[]\n", + " for j in range(4):\n", + " new.append(i*4+j+1)\n", + " arr.append(new)\n", + "\n", + "#Result\n", + "for i in range(3):\n", + " for j in range(4):\n", + " print arr[i][j],\n", + " print" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 2 3 4\n", + "5 6 7 8\n", + "9 10 11 12\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.15, Page Number: 98

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variabe Initialzation\n", + "sqrs= [[1,1],[2,4],[3,9],[4,16],[5,25],\n", + " [6,36],[7,49],[8,64],[9,81],[10,100]] #Array storing the squares\n", + "i=6 #User input of number whose square is to be looked up\n", + "\n", + "#Search for the number\n", + "for j in range(10):\n", + " if sqrs[j][0]==i:\n", + " break\n", + " \n", + "#Result\n", + "print \"The square of \",i,\" is \", sqrs[j][1]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The square of 6 is 36\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.16, Page Number: 99

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def f1():\n", + " s=\"this is a test\" #initial s\n", + " print s\n", + " s=\"CHANGED\" #s is now changed \n", + " print s\n", + "\n", + "#Calling the function twice\n", + "f1()\n", + "f1()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "this is a test\n", + "CHANGED\n", + "this is a test\n", + "CHANGED\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.17, Page Number: 101

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable decleration\n", + "text=[]\n", + "str=['eat','play','work'] #user input of strings\n", + "p=len(str)\n", + "\n", + "for t in range(p):\n", + " print t,\":\"\n", + " text.append(str[t]) #Here, user input taken from the list\n", + " \n", + "#Result; redisplay the strings\n", + "for i in range(p):\n", + " print text[i]\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 :\n", + "1 :\n", + "2 :\n", + "eat\n", + "play\n", + "work\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.18, Page Number: 103

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import random \n", + "\n", + "#Variable decleration\n", + "name=[] #this list holds employee names\n", + "wage=[] #their phone numbers\n", + "phone=[] #hours worked per week\n", + "hours=[] #wage\n", + "num=0 #User choice\n", + "\n", + "#Menu \n", + "def menu():\n", + " global num #All options are chosen one by one\n", + " print \"0.Quit.\"\n", + " print \"1.Enter information\"\n", + " print \"2.Report information\"\n", + " print \"Choose one: \"\n", + " num=int(input())\n", + " return num #Return users selction\n", + "\n", + "#Enter information\n", + "def enter():\n", + " for i in range(10):\n", + " n=raw_input(\"Enter your name: \")\n", + " name.append(n)\n", + " phone.append(int(input(\"Enter your phone number\")))\n", + " hours.append(int(input(\"Enter number of hours worked: \")))\n", + " wage.append(int(input(\"Enter wage: \")))\n", + "\n", + "#Display report\n", + "def report():\n", + " p=len(name)\n", + " for i in range(p):\n", + " print name[i],' ',phone[i]\n", + " print \"Pay for the week: \",wage[i]*hours[i]\n", + "\n", + "\n", + "while True:\n", + " ch=menu() #get selection\n", + " if ch==0:\n", + " break\n", + " elif ch==1:\n", + " enter()\n", + " elif ch==2:\n", + " report()\n", + " else:\n", + " print \"Try again.\"\n", + " if ch==0:\n", + " break\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0.Quit.\n", + "1.Enter information\n", + "2.Report information\n", + "Choose one: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your name: Anny\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your phone number987654321\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter number of hours worked: 10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter wage: 50\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your name: Billy\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your phone number9456783652\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter number of hours worked: 10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter wage: 50\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your name: Catherene\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your phone number9476836578\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter number of hours worked: 10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter wage: 50\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your name: Dolly\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your phone number9831356748\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter number of hours worked: 15\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter wage: 50\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your name: Emily\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your phone number9576843721\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter number of hours worked: 15\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter wage: 40\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your name: Jack\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your phone number9485738567\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter number of hours worked: 10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter wage: 45\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your name: Kevin\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your phone number9345678923\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter number of hours worked: 10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter wage: 45\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your name: Lily\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your phone number9345672831\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter number of hours worked: 10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter wage: 45\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your name: Monica\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your phone number9475867483\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter number of hours worked: 10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter wage: 50\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your name: Irene\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your phone number5674356776\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter number of hours worked: 10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter wage: 20\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0.Quit.\n", + "1.Enter information\n", + "2.Report information\n", + "Choose one: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Anny 987654321\n", + "Pay for the week: 500\n", + "Billy 9456783652\n", + "Pay for the week: 500\n", + "Catherene 9476836578\n", + "Pay for the week: 500\n", + "Dolly 9831356748\n", + "Pay for the week: 750\n", + "Emily 9576843721\n", + "Pay for the week: 600\n", + "Jack 9485738567\n", + "Pay for the week: 450\n", + "Kevin 9345678923\n", + "Pay for the week: 450\n", + "Lily 9345672831\n", + "Pay for the week: 450\n", + "Monica 9475867483\n", + "Pay for the week: 500\n", + "Irene 5674356776\n", + "Pay for the week: 200\n", + "0.Quit.\n", + "1.Enter information\n", + "2.Report information\n", + "Choose one: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_from_the_Ground/.ipynb_checkpoints/Chapter_6(1)-checkpoint.ipynb b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_6(1)-checkpoint.ipynb new file mode 100644 index 00000000..5010922a --- /dev/null +++ b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_6(1)-checkpoint.ipynb @@ -0,0 +1,558 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:b382733cd221154cfe7c9ffe63477448084168d501d248c2b1d0c253ed011821" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 6: Pointers

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.1, Page Number: 107

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from ctypes import *\n", + "\n", + "balance =c_int(3200) #int variable\n", + "balptr=pointer(balance) #pointer to int\n", + "value=balptr[0] #accessing the value using the pointer\n", + "\n", + "#Result\n", + "print \"balance: \",value \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "balance: 3200\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.2, Page Number: 109

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "x=123.23\n", + "y=c_double()\n", + "p=POINTER(c_int)\n", + "\n", + "p=pointer(c_int(int(x))) #type case double to int\n", + "y=p[0]\n", + "\n", + "#Result\n", + "print y" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "123\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.3, Page Number: 110

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from ctypes import *\n", + "\n", + "#Variable declaration\n", + "num=c_int() #declaring int\n", + "p=pointer(num) #pointer to int\n", + "\n", + "p[0]=100\n", + "print num.value,\n", + "p[0]+=1\n", + "print num.value,\n", + "p[0]-=1\n", + "print num.value" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "100 101 100\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.4, Page Number: 111

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from ctypes import *\n", + "\n", + "#Variable declaration\n", + "j=c_int()\n", + "g=c_double()\n", + "i=pointer(j)\n", + "f=pointer(g)\n", + "\n", + "\n", + "for x in range(10):\n", + " print addressof(i.contents)+x,addressof(f.contents)+x\n", + " \n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "84638480 84639248\n", + "84638481 84639249\n", + "84638482 84639250\n", + "84638483 84639251\n", + "84638484 84639252\n", + "84638485 84639253\n", + "84638486 84639254\n", + "84638487 84639255\n", + "84638488 84639256\n", + "84638489 84639257\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.5, Page Number: 114

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from ctypes import *\n", + "\n", + "#Variable declaration\n", + "str=\"This is a test\"\n", + "token =\"\"\n", + "i=0\n", + "\n", + "#Read a token at a time from the string\n", + "while iExample 6.6, Page Number: 115

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "str=\"This is a test\"\n", + "i=0\n", + "\n", + "#Read a token at a time from the string\n", + "while iExample 6.7, Page Number: 115

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import string\n", + "\n", + "str=c_char_p(\"hello tom\")\n", + "q=\"\"\n", + "p=pointer(str) #put address of str into p\n", + " \n", + "p[0]=string.upper(p[0])\n", + "\n", + "#Result\n", + "print p[0]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "HELLO TOM\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.8, Page Number: 117

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Varible declaration\n", + "s=\"Pointers are fun to use\"\n", + "\n", + "#Result\n", + "print s\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Pointers are fun to use\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.9, Page Number: 118

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from ctypes import *\n", + "\n", + "#Variable declaration\n", + "num=[]\n", + "\n", + "#User input\n", + "for i in range(10):\n", + " num.append(i)\n", + " \n", + "start=num #set start to the starting pointer \n", + "for i in range(10):\n", + " print start[i],\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 1 2 3 4 5 6 7 8 9\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.10, Page Number: 119

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import random\n", + "\n", + "fortunes=[\"Soon, you will come into some money.\",\n", + " \"A new love will enter your lifr. \",\n", + " \"You will live long and prosper.\",\n", + " \"Now is a good time to invest for the future.\",\n", + " \"A close friend will ask for a favour.\"]\n", + "\n", + "print \"To see your fortune, press a key: \"\n", + "\n", + "#Randomize the random number generator\n", + "chance=random.randint(0,100)\n", + "chance=chance%5\n", + "\n", + "#Result\n", + "print fortunes[chance]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "To see your fortune, press a key: \n", + "A close friend will ask for a favour.\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.11, Page Number: 120

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "keyword=[[\"for\",\"for(initialization; condition; increment\"],\n", + " [\"if\",\"if(condition) ... else ...\"],\n", + " [\"switch\",\"switch(value) { case-list }\"],\n", + " [\"while\",\"while(condition) ...\"],\n", + " [\"\",\"\"]] #Terminates the list with nulls\n", + " \n", + "#User input \n", + "print \"Enter keyword: \"\n", + "str=\"for\" \n", + "\n", + "for i in range(4):\n", + " if str==keyword[i][0]:\n", + " print keyword[i][1]\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter keyword: \n", + "for(initialization; condition; increment\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.12, Page Number: 123

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from ctypes import *\n", + "\n", + "#Variable declaration\n", + "x=c_int(10) #int variable\n", + "p=pointer(x) #pointer to int\n", + "q=pointer(p) #pointer to a pointer\n", + "\n", + "#Result\n", + "print q[0][0] #accessing the value using a pointer to a pointer\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.13, Page Number: 126

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from ctypes import *\n", + "\n", + "#Variable declaration\n", + "s=c_char_p()\n", + "p1=pointer(s)\n", + "x=0\n", + "\n", + "while True:\n", + " print \"\\nEnter a string: \",\n", + " if x==2:\n", + " p1[0]=c_char_p(\"done\")\n", + " else:\n", + " p1[0]=c_char_p(\"Hello\")\n", + " #print the ASCII values of each characcter\n", + " for i in range(0,len(p1[0])):\n", + " print ord(p1[0][i]),\n", + " x+=1\n", + " if p1[0]==\"done\":\n", + " break\n", + " \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Enter a string: 72 101 108 108 111 \n", + "Enter a string: 72 101 108 108 111 \n", + "Enter a string: 100 111 110 101\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_from_the_Ground/.ipynb_checkpoints/Chapter_7(1)-checkpoint.ipynb b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_7(1)-checkpoint.ipynb new file mode 100644 index 00000000..027b30f5 --- /dev/null +++ b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_7(1)-checkpoint.ipynb @@ -0,0 +1,908 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:ab47bb393809bc88589e7e92320813b90077813594dc417229af49780e24b53b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 7: Functions,Part One: The Fundamentals

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.1, Page Number: 129

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def f1():\n", + " print \"Enter something: \"\n", + " str= \"Hello\" #User-input\n", + " print str\n", + " \n", + "#Variable decleration\n", + "str=\"This is str in main\"\n", + "\n", + "print str\n", + "f1() #function call\n", + "print str" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "This is str in main\n", + "Enter something: \n", + "Hello\n", + "This is str in main\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.2, Page Number: 130

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable decleration\n", + "choice=0\n", + "\n", + "print \"(1) add numbers or (2) concatenate strings?: \"\n", + "choice=2 #User Input taken as 2\n", + "\n", + "if choice==1:\n", + " print \"Enter two numbers: \"\n", + " a=5 #Variable decleration; User Input\n", + " b=7\n", + " print a+b #Result\n", + "else :\n", + " print \"Enter two strings: \"\n", + " s1=\"Hello\" #Variable decleration; User Input\n", + " s2=\"World\"\n", + " s1+=s2 #Concatenation\n", + " print s1 #Result" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(1) add numbers or (2) concatenate strings?: \n", + "Enter two strings: \n", + "HelloWorld\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.3, Page Number: 131

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable decleration\n", + "i=10\n", + "j=100\n", + "\n", + "if j>0:\n", + " i=None \n", + " i= j/2\n", + " print \"inner i: \",i #Result\n", + "\n", + "print \"outer i: \",i #Result" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "inner i: 50\n", + "outer i: 50\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.4, Page Number: 132

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "a=5 #Variable decleration; user input\n", + "\n", + "b=10 #declaration of another variable; user input\n", + "\n", + "#Result\n", + "print \"Product: \",a*b" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Product: 50\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.5, Page Number: 134

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import random\n", + "\n", + "#Variable decleration\n", + "count=None\n", + "num_right=0\n", + "\n", + "#Function for the drill\n", + "def drill():\n", + " #Generate two numbers between 0 and 99.\n", + " a=random.randint(0,99)\n", + " b=random.randint(0,99)\n", + " #The user gets three tries to get it right.\n", + " for count in range(3):\n", + " print \"What is \",a,\" + \",b,\"? \"\n", + " ans = random.randint(0,200) #user input\n", + " if ans==a+b:\n", + " print \"Right\"\n", + " num_right+=1\n", + " print \"You've used up all your tries.\"\n", + " print \"The answer is \",a+b\n", + " \n", + "#Main function \n", + "print \"How many practice problems: \"\n", + "count=2 #User input taken as 2\n", + "num_right=0\n", + "while True:\n", + " drill()\n", + " count-=1\n", + " if(count==0):\n", + " break\n", + " \n", + "#Result\n", + "print \"You got \",num_right,\" right. \" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "How many practice problems: \n", + "What is 9 + 89 ? \n", + "What is 9 + 89 ? \n", + "What is 9 + 89 ? \n", + "You've used up all your tries.\n", + "The answer is 98\n", + "What is 85 + 98 ? \n", + "What is 85 + 98 ? \n", + "What is 85 + 98 ? \n", + "You've used up all your tries.\n", + "The answer is 183\n", + "You got 0 right. \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.6, Page Number: 136

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from ctypes import *\n", + " \n", + "def f(j):\n", + " j[0]=100 #j is assigned 100\n", + "\n", + "#Variable decleration\n", + "i=c_int(1)\n", + "p=pointer(i)\n", + "\n", + "#Calling the function\n", + "f(p) \n", + "\n", + "print i" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "c_long(100)\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.7, Page Number: 137

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from ctypes import *\n", + "\n", + " \n", + "def f(j):\n", + " j[0]=100 #j is assigned 100\n", + "\n", + "#Variable decleration\n", + "i=c_int(1)\n", + "p=pointer(i)\n", + "\n", + "#Calling the function\n", + "f(p) \n", + "\n", + "print i" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "c_long(100)\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.8, Page Number: 137

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def display(num):\n", + " for i in range(10):\n", + " print num[i],\n", + " \n", + "#Variable declaration\n", + "t=[]\n", + "\n", + "for i in range(10):\n", + " t.append(i)\n", + "#Pass list to a function\n", + "display(t)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 1 2 3 4 5 6 7 8 9\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.9, Page Number: 138

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def display(num):\n", + " print num,\n", + "\n", + "#Variable declaration\n", + "t=[]\n", + "\n", + "for i in range(10):\n", + " t.append(i)\n", + " \n", + "#Printing without passing entire list\n", + "for i in range(10):\n", + " display(t[i])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 1 2 3 4 5 6 7 8 9\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.10, Page Number: 139

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def cube(n,num):\n", + " num-=1\n", + " while num:\n", + " n[num]=n[num]*n[num]*n[num]\n", + " num-=1\n", + "\n", + "#Variable declaration\n", + "nums=[]\n", + "\n", + "for i in range(10):\n", + " nums.append(i+1)\n", + " \n", + "print \"Original contents: \",\n", + "for i in range(10):\n", + " print nums[i],\n", + "print\n", + "\n", + "cube(nums,10) #Compute cubes\n", + "\n", + "#Result\n", + "print \"Altered contents: \",\n", + "for i in range(10):\n", + " print nums[i]," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Original contents: 1 2 3 4 5 6 7 8 9 10\n", + "Altered contents: 1 8 27 64 125 216 343 512 729 1000\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.11, Page Number: 140

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import string\n", + "\n", + "def stringupper(str):\n", + " str=string.upper(str) #convert to uppercase\n", + " return str\n", + "\n", + "#Variable declaration \n", + "str=\"this is a test\"\n", + "\n", + "#Calling the function\n", + "str=stringupper(str)\n", + "\n", + "#Result\n", + "print str" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "THIS IS A TEST\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.12, Page Number: 141

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def mystrlen(str):\n", + " l=len(str)\n", + " return l\n", + "\n", + "#Result\n", + "print \"Length of Hello There is: \",\n", + "print mystrlen(\"Hello There\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Length of Hello There is: 11\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.13, Page Number: 142

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import sys\n", + "\n", + "def main():\n", + " if len(sys.argv)!=2:\n", + " print \"You forgot to type your name.\" #CHECK!!!!\n", + " return\n", + " #Result\n", + " print \"Hello \",sys.argv[1]\n", + "\n", + "main()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "You forgot to type your name.\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.14, Page Number: 143

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import sys\n", + "\n", + "#Result\n", + "for t in range(len(sys.argv)):\n", + " i=0\n", + " print sys.argv[t] " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "-c\n", + "-f\n", + "C:\\Users\\Anandi\\.ipython\\profile_default\\security\\kernel-6e851974-75ff-4911-bdf9-e089a03e5741.json\n", + "--KernelApp.parent_appname='ipython-notebook'\n", + "--interrupt=904\n", + "--parent=876\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.15, Page Number: 144

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import sys\n", + "\n", + "if len(sys.argv)!=3:\n", + " print \"usage: add num num\" \n", + "else :\n", + " #Variable Decleration\n", + " a=sys.argv[1]\n", + " b=sys.argv[2]\n", + " #Result\n", + " print a+b\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "usage: add num num\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.16, Page Number: 145

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import string\n", + "\n", + "#Variable Decleration\n", + "i=string.atoi(\"100\")\n", + "j=string.atoi(\"100000\")\n", + "k=string.atof(\"-0.123\")\n", + "\n", + "#Result\n", + "print i,\" \",j,\" \",k" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "100 100000 -0.123\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.17, Page Number: 147

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable Decleration\n", + "i=abs(-10)\n", + "\n", + "#Result\n", + "print abs(-23)\n", + "abs(100)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "23\n" + ] + }, + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 5, + "text": [ + "100" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.18, Page Number: 148

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def find_substr(sub,str):\n", + " l=str.find(sub)\n", + " return l\n", + "\n", + "#Variable decleration;Calling the function\n", + "index=find_substr(\"three\",\"one two three four\")\n", + "\n", + "#Result\n", + "print \"Index of three is \",index" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Index of three is 8\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.19, Page Number: 149

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import sys\n", + "\n", + "def print_vertical(str):\n", + " l=len(str)\n", + " for i in range(l):\n", + " print str[i],\n", + " \n", + "print_vertical(sys.argv[1])\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "- f\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.20, Page Number: 150

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def find_substr(sub,str):\n", + " return str.find(sub)\n", + "\n", + "#Variable declaration\n", + "s=\"one two three four\"\n", + "\n", + "substr = find_substr(\"three\",s)\n", + "\n", + "#Result\n", + "print \"substring found:\",s[substr:]\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "substring found: three four\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.21, Page Number: 154

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def factr(n):\n", + " if n==1:\n", + " return 1\n", + " answer=factr(n-1)*n\n", + " return answer\n", + "\n", + "#Iterative version\n", + "def fact(n):\n", + " answer=1\n", + " for t in range(n):\n", + " answer=answer*(t+1)\n", + " return answer\n", + "\n", + "#Using recursion version\n", + "print \"4 factorial is \",factr(4)\n", + "\n", + "#Using iterative version\n", + "print \"4 factorial is \",fact(4)\n", + "\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "4 factorial is 24\n", + "4 factorial is 24\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.22, Page Number: 155

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def reverse(s):\n", + " r = \"\"\n", + " for c in s:\n", + " r=c+r\n", + " print r\n", + " \n", + "#VariabDecleration \n", + "str=\"this is a test\"\n", + "\n", + "#Calling function\n", + "reverse(str)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "tset a si siht\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_from_the_Ground/.ipynb_checkpoints/Chapter_8(1)-checkpoint.ipynb b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_8(1)-checkpoint.ipynb new file mode 100644 index 00000000..4684861e --- /dev/null +++ b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_8(1)-checkpoint.ipynb @@ -0,0 +1,1783 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:cb32b4e80623f372b375323b458cf1a594dc5626da9cbe9346e1ec33417221d4" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 8: Functions,Part Two: References, Overloading, and Default Arguments

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.1, Page Number: 158

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def sqr_it(x):\n", + " x=x*x\n", + " return x\n", + "\n", + "#Variable decleration\n", + "t=10\n", + "\n", + "#Result; function calling\n", + "print sqr_it(t),' ',t\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "100 10\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.2, Page Number: 159

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def swap(x,y):\n", + " temp=x\n", + " x=y\n", + " y=temp\n", + " return x, y\n", + "\n", + "#Variable decleration\n", + "i=10\n", + "j=20 \n", + "\n", + "#Initial values\n", + "print \"Initial values of i and j: \",\n", + "print i,' ',j\n", + "\n", + "#Calling function to swap\n", + "i, j=swap(i,j)\n", + "\n", + "#Result\n", + "print \"Swapped values of i and j: \",\n", + "print i,' ',j" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Initial values of i and j: 10 20\n", + "Swapped values of i and j: 20 10\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.3, Page Number: 161

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def f(i):\n", + " i=10\n", + " return i #Returning the value since the function cannot access the variables in the calling scope.\n", + "\n", + "#Variable Decleration\n", + "val=1\n", + "\n", + "print \"Old value for val: \",val\n", + "val=f(val) #Function call\n", + "\n", + "#Result\n", + "print \"New value for val: \",val\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Old value for val: 1\n", + "New value for val: 10\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.4, Page Number: 162

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def swap(i,j):\n", + " temp=i[0]\n", + " i[0]=j[0]\n", + " j[0]=temp\n", + " return i, j\n", + "\n", + "#Variable decleration\n", + "i=[]\n", + "j=[]\n", + "i.append(10)\n", + "j.append(20)\n", + "\n", + "#Initial values\n", + "print \"Initial values of i and j: \",\n", + "print i[0],' ',j[0]\n", + "\n", + "#Calling function to swap\n", + "i, j=swap(i,j)\n", + "\n", + "#Result\n", + "print \"Swapped values of i and j: \",\n", + "print i[0],' ',j[0]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Initial values of i and j: 10 20\n", + "Swapped values of i and j: 20 10\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.5, Page Number: 164

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable Decleration\n", + "val = 100.0\n", + "\n", + "def f():\n", + " global val\n", + " return val\n", + "\n", + "#Result\n", + "print val\n", + "\n", + "newval=f() #function call\n", + "print newval\n", + "\n", + "val=99.1 #change val's value\n", + "print f() #print val's new value\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "100.0\n", + "100.0\n", + "99.1\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.6, Page Number: 166

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Function definition\n", + "def change_it(i,n):\n", + " global vals\n", + " vals[i]=n\n", + "\n", + "#Variable Decleration\n", + "vals=[1.1,2.2,3.3,4.4,5.5]\n", + "\n", + "print \"Here are the original values: \",\n", + "for i in range(5):\n", + " print vals[i],\n", + "print\n", + " \n", + "#Function call\n", + "change_it(1,5298.23)\n", + "change_it(3,-98.8)\n", + "\n", + "#Result\n", + "print \"Here are the changed values: \",\n", + "for i in range(5):\n", + " print vals[i]," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Here are the original values: 1.1 2.2 3.3 4.4 5.5\n", + "Here are the changed values: 1.1 5298.23 3.3 -98.8 5.5\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.7, Page Number: 167

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable Decleration\n", + "vals=[None]*10\n", + "error=-1\n", + "\n", + "#put values into the array\n", + "def put(i,n):\n", + " global vals\n", + " if i>=0 and i<10:\n", + " vals[i]=n\n", + " else:\n", + " print \"Bounds Error!\"\n", + " error=n\n", + "\n", + "#obtain a value from the array\n", + "def get(i):\n", + " if i>=0 and i<10:\n", + " return vals[i]\n", + " else:\n", + " print \"Bounds error!\"\n", + " return -1\n", + " \n", + "#put values into the array\n", + "put(0,10)\n", + "put(1,20)\n", + "put(9,30)\n", + "\n", + "#Result\n", + "print get(0),' ',get(1),' ',get(9),\n", + "\n", + "#now, intentionally generate an errer\n", + "put(12,1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10 20 30 Bounds Error!\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.8, Page Number: 169

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable Decleration\n", + "i=[]\n", + "j=i #independent reference\n", + "\n", + "j.append(10) #Here i and j are just references to [10]\n", + "\n", + "print j[0],\" \",i[0] \n", + "\n", + "k=121\n", + "i[0]=k #copies k's value into j[0] \n", + "\n", + "#Result\n", + "print j[0]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10 10\n", + "121\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.9, Page Number: 170

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def f(i,j=None):\n", + " if j==None: \n", + " if isinstance(i,int): #for 1st function\n", + " print \"In f(int), i is \",i \n", + " else: #for 3rd function\n", + " print \"In f(double), k is \",i\n", + " else: #for 2nd arguments\n", + " print \"In f(int,int), i is \",i,\", j is \",j\n", + " \n", + "#calling function\n", + "f(10)\n", + "f(10,20)\n", + "f(12.23)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "In f(int), i is 10\n", + "In f(int,int), i is 10 , j is 20\n", + "In f(double), k is 12.23\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.10, Page Number: 171

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def myabs(i):\n", + " if isinstance(i,int): #first instance\n", + " print \"Using integer myabs(): \",\n", + " if i<0:\n", + " return -i\n", + " else:\n", + " return i\n", + " elif isinstance(i,float): #second instance\n", + " print \"Using double myabs(): \",\n", + " if(i<0.0):\n", + " return -i\n", + " else:\n", + " return i\n", + " elif isinstance(i,long): #third instance\n", + " print \"Using long myabs(): \",\n", + " if i<0:\n", + " return -i\n", + " else:\n", + " return i\n", + "\n", + "#Result; calling the function \n", + "print myabs(-10)\n", + "print myabs(-11.0)\n", + "print myabs(-9L)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Using integer myabs(): 10\n", + "Using double myabs(): 11.0\n", + "Using long myabs(): 9\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.11, Page Number: 174

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import os\n", + "\n", + "def clrscr(size=25):\n", + " while(size):\n", + " print \"\"\n", + " size-=1\n", + " \n", + "for i in range(30):\n", + " print i\n", + " clrscr() #clears 25 lines\n", + "\n", + "for i in range(30):\n", + " print i\n", + " clrscr(10) #clears 10 lines\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "1\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "2\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "3\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "4\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "5\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "6\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "7\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "8\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "9\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "10\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "11\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "12\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "13\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "14\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "15\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "16\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "17\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "18\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "19\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "20\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "21\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "22\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "23\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "24\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "25\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "26\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "27\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "28\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "29\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "0\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "1\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "2\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "3\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "4\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "5\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "6\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "7\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "8\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "9\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "10\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "11\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "12\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "13\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "14\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "15\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "16\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "17\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "18\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "19\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "20\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "21\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "22\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "23\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "24\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "25\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "26\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "27\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "28\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "29\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.12, Page Number: 176

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable Decleration\n", + "str1 = \"This is a test\"\n", + "str2 = \"0123456789\"\n", + "\n", + "#function for concatenation\n", + "def mystrcat(s1,s2,l=-1):\n", + " if l==-1:\n", + " l=len(str2)\n", + " s2=s2[:l] #truncates s2\n", + " s1=s1+s2 #concatenates the 2 strings\n", + " return s1\n", + "\n", + "str1=mystrcat(str1,str2,5) #concatenate 5 chars\n", + "print str1\n", + "\n", + "str1 = \"this is a test\" #reset str1\n", + "\n", + "str1=mystrcat(str1, str2) #concatenate entire string\n", + "print str1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "This is a test01234\n", + "this is a test0123456789\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.13, Page Number: 177

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def myfunc(i):\n", + " return i\n", + " \n", + "print myfunc(10.1),\n", + "print myfunc(10)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10.1 10\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.14, Page Number: 178

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from ctypes import *\n", + "\n", + "def myfunc(ch):\n", + " if isinstance(ch,c_int):\n", + " return chr(ch.value+1)\n", + " elif isinstance(ch,c_uint):\n", + " return chr(ch.value-1)\n", + " \n", + " \n", + "print myfunc(c_int(ord('c'))),\n", + "print myfunc(c_uint(88))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " d W\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.15, Page Number: 179

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def myfunc(i,j=1):\n", + " if j==1:\n", + " return i*j\n", + " else:\n", + " return i\n", + " \n", + " \n", + "print myfunc(4,5),\n", + "print myfunc(10)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "4 10\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_from_the_Ground/.ipynb_checkpoints/Chapter_9(1)-checkpoint.ipynb b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_9(1)-checkpoint.ipynb new file mode 100644 index 00000000..0f30e9a8 --- /dev/null +++ b/C++_from_the_Ground/.ipynb_checkpoints/Chapter_9(1)-checkpoint.ipynb @@ -0,0 +1,813 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:441f69a4dc3d0bee097a6151c42e10920892966ba4b3b82086ec3feb521e7da7" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 9: More Data Types and Operations

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.1, Page Number: 182

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def code(str):\n", + " print str\n", + "\n", + "#Calling function\n", + "code(\"this is a test\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "this is a test\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.2, Page Number: 183

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def f(i):\n", + " i=100\n", + " print i\n", + " \n", + "#Variable declaration\n", + "k=10\n", + "\n", + "#function call\n", + "f(k)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "100\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.3, Page Number: 187

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable Declaration\n", + "first=10 #global definition of first and last\n", + "last=20\n", + "\n", + "#Result\n", + "print first,last\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10 20\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.4, Page Number: 188

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "sum=0 \n", + "count=0\n", + "num=5 #Loop for user entries\n", + "\n", + "#compute a running average\n", + "def r_avg(i):\n", + " global sum,count\n", + " sum=sum+i\n", + " count+=1\n", + " return sum/count\n", + "\n", + "\n", + "while True:\n", + " print \"Enter numbers(-1 to quit): \"\n", + " num-=1 #User input\n", + " if not(num==-1):\n", + " print \"Running average is: \",r_avg(num) #Result\n", + " if num<0:\n", + " break" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter numbers(-1 to quit): \n", + "Running average is: 4\n", + "Enter numbers(-1 to quit): \n", + "Running average is: 3\n", + "Enter numbers(-1 to quit): \n", + "Running average is: 3\n", + "Enter numbers(-1 to quit): \n", + "Running average is: 2\n", + "Enter numbers(-1 to quit): \n", + "Running average is: 2\n", + "Enter numbers(-1 to quit): \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.5, Page Number: 189

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "sum=0 \n", + "count=0\n", + "num=10 #Loop for user entries\n", + "\n", + "#user input given: 9,8,7,6,-2,4,3,2,1,-1\n", + "\n", + "#compute a running average\n", + "def r_avg(i):\n", + " global sum,count\n", + " sum=sum+i\n", + " count+=1\n", + " return sum/count\n", + "\n", + "def reset():\n", + " global sum,count\n", + " sum=0\n", + " count=0\n", + " \n", + "while True:\n", + " print \"Enter numbers(-1 to quit, -2 to reset): \"\n", + " num-=1 #User input\n", + " if num==5:\n", + " num=-2\n", + " if num==-2: #for reset\n", + " num=4\n", + " reset()\n", + " continue\n", + " if not(num==-1):\n", + " print \"Running average is: \",r_avg(num) #Result\n", + " else:\n", + " break" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter numbers(-1 to quit, -2 to reset): \n", + "Running average is: 9\n", + "Enter numbers(-1 to quit, -2 to reset): \n", + "Running average is: 8\n", + "Enter numbers(-1 to quit, -2 to reset): \n", + "Running average is: 8\n", + "Enter numbers(-1 to quit, -2 to reset): \n", + "Running average is: 7\n", + "Enter numbers(-1 to quit, -2 to reset): \n", + "Enter numbers(-1 to quit, -2 to reset): \n", + "Running average is: 3\n", + "Enter numbers(-1 to quit, -2 to reset): \n", + "Running average is: 2\n", + "Enter numbers(-1 to quit, -2 to reset): \n", + "Running average is: 2\n", + "Enter numbers(-1 to quit, -2 to reset): \n", + "Running average is: 1\n", + "Enter numbers(-1 to quit, -2 to reset): \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.6, Page Number: 196

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "name=[\"Jonathan\",\"Golden Delicious\",\"Red Delicious\",\"Winesap\",\n", + " \"Cortland\",\"McIntosh\"]\n", + "\n", + "#enumeration type\n", + "(Jonathan,Golden_Delicious,Red_Delicious,Winesap,Cortland,McIntosh) = (0,1,2,3,4,5)\n", + "\n", + "fruit=Jonathan\n", + "print name[fruit]\n", + "\n", + "fruit = Winesap\n", + "print name[fruit]\n", + "\n", + "fruit = McIntosh\n", + "print name[fruit]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Jonathan\n", + "Winesap\n", + "McIntosh\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.7, Page Number: 198

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "ch='j' #User input\n", + "while True:\n", + " #This statement turns off the 6th but.\n", + " c=chr(ord(ch)&223) #ch is now uppercase\n", + " print c\n", + " if c=='Q':\n", + " break \n", + " else:\n", + " ch = chr(ord(ch)+1) #incrementing for different user inputs\n", + " \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "J\n", + "K\n", + "L\n", + "M\n", + "N\n", + "O\n", + "P\n", + "Q\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.8, Page Number: 200

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "ch='J' #User input\n", + "while True:\n", + " #This statement turns off the 6th but.\n", + " c=chr(ord(ch)|32) #ch is now uppercase\n", + " print c\n", + " if c=='q':\n", + " break \n", + " else:\n", + " ch = chr(ord(ch)+1) #incrementing for different user inputs\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "j\n", + "k\n", + "l\n", + "m\n", + "n\n", + "o\n", + "p\n", + "q\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.9, Page Number: 201

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def disp_binary(u):\n", + " t=128\n", + " while t:\n", + " if u&t:\n", + " print 1,\n", + " else:\n", + " print 0,\n", + " t=t/2\n", + " print \"\"\n", + " \n", + "#Variable declaration\n", + "u=99 #User Input\n", + "\n", + "print \"Here's the number in binary: \",\n", + "disp_binary(u)\n", + "\n", + "print \"Here's the complement of th number: \",\n", + "disp_binary(~u)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Here's the number in binary: 0 1 1 0 0 0 1 1 \n", + "Here's the complement of th number: 1 0 0 1 1 1 0 0 \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.10, Page Number: 202

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def disp_binary(u):\n", + " t=128\n", + " while t:\n", + " if u&t:\n", + " print 1,\n", + " else:\n", + " print 0,\n", + " t=t/2\n", + " print \"\"\n", + " \n", + "#Variable dclaration\n", + "i=1\n", + "\n", + "#Result\n", + "for t in range(8):\n", + " disp_binary(i)\n", + " i=i<<1\n", + "\n", + "print\"\\n\"\n", + "\n", + "for t in range(8):\n", + " i=i>>1\n", + " disp_binary(i)\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 0 0 0 0 0 0 1 \n", + "0 0 0 0 0 0 1 0 \n", + "0 0 0 0 0 1 0 0 \n", + "0 0 0 0 1 0 0 0 \n", + "0 0 0 1 0 0 0 0 \n", + "0 0 1 0 0 0 0 0 \n", + "0 1 0 0 0 0 0 0 \n", + "1 0 0 0 0 0 0 0 \n", + "\n", + "\n", + "1 0 0 0 0 0 0 0 \n", + "0 1 0 0 0 0 0 0 \n", + "0 0 1 0 0 0 0 0 \n", + "0 0 0 1 0 0 0 0 \n", + "0 0 0 0 1 0 0 0 \n", + "0 0 0 0 0 1 0 0 \n", + "0 0 0 0 0 0 1 0 \n", + "0 0 0 0 0 0 0 1 \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.11, Page Number: 204

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def div_zero():\n", + " print \"Cannot divide by zero.\"\n", + " return 0\n", + " \n", + "#Variable declaration\n", + "i=10 #User Input\n", + "j=0\n", + "\n", + "#This statement prevents a divide by zero\n", + "if j:\n", + " result=i/j\n", + "else:\n", + " result=div_zero()\n", + "\n", + "#Result\n", + "print \"Result: \",result" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Cannot divide by zero.\n", + "Result: 0\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.12, Page Number: 206

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "j=10\n", + "i=None\n", + "\n", + "j+=1\n", + "j+100\n", + "i=999+j\n", + "\n", + "#Result\n", + "print i" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1010\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.13, Page Number: 207

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from ctypes import *\n", + "\n", + "#Variable declaration\n", + "ch=c_char\n", + "i=c_int\n", + "\n", + "print sizeof(ch), #size of char\n", + "print sizeof(i), #size of int\n", + "print sizeof(c_float), #size of float\n", + "print sizeof(c_double) #size of double\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 4 4 8\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.14, Page Number: 209

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from ctypes import *\n", + "\n", + "#Variabke declaration \n", + "i=c_int(20) #allocate memory for int\n", + "p=pointer(i) #assign a pointer to the memory\n", + "\n", + "#Result\n", + "print p[0] #proove that it works by displaying value\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "20\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.15, Page Number: 210

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from ctypes import *\n", + "\n", + "#Variable declaration \n", + "i=c_int(99) #initialize with 99\n", + "p=pointer(i) #assign a pointer to the value\n", + "\n", + "#Result\n", + "print p[0] #displays 99\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "99\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.16, Page Number: 211

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from ctypes import *\n", + "\n", + "#Variable declaration \n", + "i=c_double(10) \n", + "p=pointer(i)\n", + "\n", + "#assign the values 100 to 109\n", + "for i in range(10):\n", + " p[i]=100.00+i\n", + "\n", + "#display the contents of the array\n", + "for i in range(10):\n", + " print p[i],\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "100.0 101.0 102.0 103.0 104.0 105.0 106.0 107.0 108.0 109.0\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.17, Page Number: 211

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "i=c_int() \n", + "j=c_double()\n", + "pi=pointer(i) #pointer to int\n", + "pj=pointer(j) #pointer to double\n", + "\n", + "#Assign values using pointers\n", + "pi[0]=10\n", + "pj[0]=100.123\n", + "\n", + "#Result\n", + "print pi[0],pj[0]\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10 100.123\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.18, Page Number: 212

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from ctypes import *\n", + "\n", + "#Variable declaration\n", + "i=pointer(c_int())\n", + "j=pointer(c_double())\n", + "\n", + "#Checking if i and j have been allocated memory addresses\n", + "if not(id(i)):\n", + " print \"Allocation Failure.\"\n", + " \n", + "if not(id(j)):\n", + " print \"Allocation Failure.\" \n", + "\n", + "i[0]=10\n", + "j[0]=100.123\n", + "\n", + "\n", + "#Result\n", + "print i[0],j[0]\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10 100.123\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch1-checkpoint.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch1-checkpoint.ipynb new file mode 100644 index 00000000..f4b7ee3f --- /dev/null +++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch1-checkpoint.ipynb @@ -0,0 +1,284 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:37f13004fc5f3a508673a34bf43303c84f6e4e316a16ef38a0b0379046c2213e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 1 : Naming" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 1.1 Page no : 2 \n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "strL = 0 # Not recommended\n", + "stringLength = 0 # Recommended" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2 Page no : 3\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class EmcFruit:\n", + " def print_(self):\n", + " pass\n", + "\n", + "class EmcApple(EmcFruit):\n", + " def print_(self):\n", + " pass\n", + "\n", + "fp = EmcApple()\n", + "print fp " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "<__main__.EmcApple instance at 0x9d29c8c>\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 1.3 Page no : 4\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Point:\n", + " def __init__(self,a,b):\n", + " self.x = a\n", + " self.y = b\n", + " def x1(self,a):\n", + " self.x = a\n", + "\n", + "p = Point(0,0) # a point in a 2-dimensional space\n", + "p.x1(1); # set X-coordinate\n", + "print p.x # prints X-coordinate, \"1\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 1.4 page no : 4\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def check_assign(a,i,t):\n", + " if (i < len(a)):\n", + " a[i] = t;" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 1.5 Page no : 6\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class String:\n", + " pass\n", + "\n", + "class DynamicArray:\n", + " pass" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 1.6 page no : 6\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "a = 'aaa' \n", + "s1 = 'xyz'\n", + "s = 'abc' # Emc::String s;\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 1.8 page no : 7\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "s1 = EmcString() # Belongs to the Emc Class Library\n", + "s2 = OtherString() # Belongs to the Other Class Library" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'EmcString' is not defined", + "output_type": "pyerr", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[0mNote\u001b[0m \u001b[1;33m:\u001b[0m \u001b[0mthis\u001b[0m \u001b[0mwill\u001b[0m \u001b[0mgive\u001b[0m \u001b[0merror\u001b[0m \u001b[0mbecause\u001b[0m \u001b[0mfile\u001b[0m \u001b[0mdoesn\u001b[0m\u001b[0;31m'\u001b[0m\u001b[0mt\u001b[0m \u001b[0mhave\u001b[0m \u001b[1;32mclass\u001b[0m \u001b[0mEmcString\u001b[0m \u001b[1;32mand\u001b[0m \u001b[0mOtherString\u001b[0m\u001b[1;33m.\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m '''\n\u001b[1;32m----> 6\u001b[1;33m \u001b[0ms1\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mEmcString\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;31m# Belongs to the Emc Class Library\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 7\u001b[0m \u001b[0ms2\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mOtherString\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;31m# Belongs to the Other Class Library\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mNameError\u001b[0m: name 'EmcString' is not defined" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 1.9 Page no : 8\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import RWCstring #include \"RWCstring.h\" /* Recommended */\n", + "from rw import cstring #include \"rw/cstring.h\" /* Sometimes needed */" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "ImportError", + "evalue": "No module named RWCstring", + "output_type": "pyerr", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mImportError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[0mNote\u001b[0m \u001b[1;33m:\u001b[0m \u001b[0mthis\u001b[0m \u001b[0mwould\u001b[0m \u001b[0mgive\u001b[0m \u001b[0merror\u001b[0m \u001b[0mbecause\u001b[0m \u001b[0mwe\u001b[0m \u001b[0mdont\u001b[0m \u001b[0mhave\u001b[0m \u001b[0mpackages\u001b[0m \u001b[0mwritten\u001b[0m \u001b[0mhere\u001b[0m\u001b[1;33m.\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 6\u001b[0m '''\n\u001b[1;32m----> 7\u001b[1;33m \u001b[1;32mimport\u001b[0m \u001b[0mRWCstring\u001b[0m \u001b[1;31m#include \"RWCstring.h\" /* Recommended */\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 8\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[0mrw\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mcstring\u001b[0m \u001b[1;31m#include \"rw/cstring.h\" /* Sometimes needed */\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mImportError\u001b[0m: No module named RWCstring" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 1.10 page no : 9\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "i__j = 11;\n", + "_K = 22;\n", + "_m = 33;\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 9 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch10-checkpoint.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch10-checkpoint.ipynb new file mode 100644 index 00000000..a5c9da2e --- /dev/null +++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch10-checkpoint.ipynb @@ -0,0 +1,497 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:d2950e71a4d0bcb937c28bb6a6a53b7b95fffdbbe552d0a0131c5c28ce96f972" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 10 : Object-oriented programming

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.1 page no :105" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "s = \"hello\" # length() == 5\n", + "print s\n", + "print len(s)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "hello\n", + "5" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 10.2 page no : 106" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "s = \"Hello\"\n", + "\n", + "s = s.lower()\n", + "print s" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "hello" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

example 10.3 page no :107" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class EmcCollection:\n", + " \n", + " def insert(self,t):\n", + " pass\n", + " \n", + " def operator(self, coll):\n", + " pass\n", + "\n", + "class EmcArrayCollection(EmcCollection):\n", + " initialSize = 10\n", + "\n", + " def __init__(self,maxsize):\n", + " pass\n", + "\n", + "\n", + "class InvalidCollectionType(EmcException):\n", + " \n", + " def __init__(self,i):\n", + " pass\n", + "\n", + "class EmcCollectionFactory:\n", + " def __init__(self):\n", + " pass\n", + "\n", + " def create(self,type):\n", + " pass\n", + "\n", + " def createArray(self):\n", + " pass" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'EmcException' is not defined", + "output_type": "pyerr", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m/home/jay/\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 22\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 23\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 24\u001b[0;31m \u001b[0;32mclass\u001b[0m \u001b[0mInvalidCollectionType\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mEmcException\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 25\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 26\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mi\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mNameError\u001b[0m: name 'EmcException' is not defined" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

example 10.4 page no :109" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "factory = EmcCollectionFactory()\n", + "collection = factory.create(ArrayId)\n", + "collection.insert(42); # EmcArrayCollection::insert() is called\n", + "print collection" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'EmcCollectionFactory' is not defined", + "output_type": "pyerr", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m/home/jay/\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 5\u001b[0m '''\n\u001b[1;32m 6\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m \u001b[0mfactory\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mEmcCollectionFactory\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 8\u001b[0m \u001b[0mcollection\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfactory\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcreate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mArrayId\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0mcollection\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0minsert\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m42\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m \u001b[0;31m# EmcArrayCollection::insert() is called\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mNameError\u001b[0m: name 'EmcCollectionFactory' is not defined" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

example 10.5 page no : 111" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "class EmcCollection:\n", + " def __del__(self):\n", + " pass\n", + "\n", + "class EmcArrayCollection( EmcCollection):\n", + " def __del__(self):\n", + " pass" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

example 10.6 page no :112" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "class EmcLogged:\n", + " def writeClassName(self,o):\n", + " pass\n", + "\n", + " def writeValue(self,o):\n", + " pass\n", + "\n", + " def logMessage(self,message):\n", + " pass\n", + "\n", + " def __del__(self):\n", + " pass\n", + "\n", + "class EmcLoggedCollection(EmcCollection):\n", + "\n", + " def writeValue(self,o):\n", + " pass\n", + "\n", + " def __del__(self):\n", + " pass " + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 10.7 Page no : 117" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "\n", + "\n", + "class EmcIntStack:\n", + " def empty(self):\n", + " pass\n", + "\n", + " def full(self):\n", + " pass\n", + " \n", + " def top(self):\n", + " pass\n", + " \n", + " def push(self,i):\n", + " pass\n", + " \n", + " def pop(self):\n", + " pass" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 10.8 Page no : 117" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "\n", + "def makeString(stack):\n", + " returnValue = ''\n", + " copy = stack\n", + " while (not copy.empty()):\n", + " # loop condition makes precondition valid\n", + " print copy.pop() # Precondition: ! copy.empty()\n", + " returnValue += copy.pop\n", + "\n", + " return returnValue;" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 10.9 page no : 118" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "\n", + "class EmcString:\n", + " def cStr(self):\n", + " pass\n", + " # cStr() returns 0-terminated string\n", + "\n", + " def length(self):\n", + " pass" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 10.10 page no : 119" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "\n", + "class EmcCollection:\n", + " def __del__(self):\n", + " pass\n", + "\n", + " def insert(self,T):\n", + " pass\n", + "\n", + " def clear(self):\n", + " pass\n", + "\n", + " def remove(self):\n", + " pass" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 10.11 page no : 120" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "factrory = EmcCollectionFactory()\n", + "collection = factory.create(ArrayId);\n", + "if (not collection.isFull()):\n", + " collection.insert(42);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'EmcCollectionFactory' is not defined", + "output_type": "pyerr", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m/home/jay/\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 5\u001b[0m '''\n\u001b[1;32m 6\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m \u001b[0mfactrory\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mEmcCollectionFactory\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 8\u001b[0m \u001b[0mcollection\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfactory\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcreate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mArrayId\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0;32mnot\u001b[0m \u001b[0mcollection\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misFull\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mNameError\u001b[0m: name 'EmcCollectionFactory' is not defined" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 10.12 page no : 121" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "def insertObject(c,element):\n", + " \n", + " if (not c.isFull()):\n", + " c.insert(element)\n", + " return True\n", + " return False" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 12 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 10.13 Page no : 121" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "def insert(T):\n", + " pass" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 13 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 10.14 page no : 123" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "\n", + "class EmcCollection:\n", + " pass" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 14 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 10.15 page no : 124" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "class EmcCollection:\n", + " def templateRequirements(self):\n", + " pass\n", + "\n", + " def templateRequirements(self):\n", + " \n", + " t1 = T1()\n", + " \n", + " t2 =t1\n", + "\n", + " t2 = t1;\n", + " # Assignable\n", + " b = (t2 == t1); # EqualityComparable" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 15 + }, + { + "cell_type": "code", + "collapsed": true, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch11-checkpoint.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch11-checkpoint.ipynb new file mode 100644 index 00000000..34493505 --- /dev/null +++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch11-checkpoint.ipynb @@ -0,0 +1,79 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:d4deb246a9bd56a3c6cdfb40f5c92d61fa63821825ffc120e7cc6ecddafbf829" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 11 : Assertions" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 11.1 page no : 130" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "\n", + "def check(answer):\n", + " assert answer ==42" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 11.2 page no : 131" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "class EmcString:\n", + " def at(self,index):\n", + " if (index >= self.lengthM):\n", + " raise Exception;\n", + " return self.cpM[index];\n", + "\n", + " # Unchecked version\n", + " def operator(self,index):\n", + " assert(index < self.lengthM)\n", + " return self.cpM[index];" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 2 + }, + { + "cell_type": "code", + "collapsed": true, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch12-checkpoint.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch12-checkpoint.ipynb new file mode 100644 index 00000000..cba2d9a9 --- /dev/null +++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch12-checkpoint.ipynb @@ -0,0 +1,363 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:ea3c47e539ea1c36c95f4b3634f53eb8fd0bf8b2905837e67036101fa90254a4" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 12 : Error handling" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 12.1 page no : 135" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "socketfd = socket(AF_UNIX, SOCK_STREAM, 0);\n", + "if(socketfd < 0):\n", + " pass" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'socket' is not defined", + "output_type": "pyerr", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m/home/jay/\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 10\u001b[0m \u001b[0;34m//\u001b[0m \u001b[0mcreate\u001b[0m \u001b[0msocket\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 11\u001b[0m '''\n\u001b[0;32m---> 12\u001b[0;31m \u001b[0msocketfd\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msocket\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mAF_UNIX\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mSOCK_STREAM\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 13\u001b[0m \u001b[0;32mif\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msocketfd\u001b[0m \u001b[0;34m<\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 14\u001b[0m \u001b[0;32mpass\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mNameError\u001b[0m: name 'socket' is not defined" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 12.2 page no : 136" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "class EmcException:\n", + " def operator(self,n):\n", + " pass\n", + "\n", + "class EmcSystemException( EmcException):\n", + " def __init__(self,m):\n", + " pass\n", + " \n", + " def emcSocket(self,family,t,protocol):\n", + " # create socket\n", + " socketfd = socket(family, t, protocol);\n", + " if (socketfd < 0): # check status value\n", + " raise EmcSystemException(\"emcSocket\");\n", + " return socketfd;" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 12.3 page no : 139" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "\n", + "def __init__(self,cp):\n", + " self.lengthM = len(cp)\n", + " self.cpM = cp" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 13 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 12.5 page no : 141" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "class EmcLog:\n", + " def __init__(self,filename):\n", + " pass\n", + "\n", + " def message(self,EmcString):\n", + " pass\n", + "\n", + " def __del__(self):\n", + " if uncaught_exception():\n", + " self.flush()\n", + " \n", + " def flush(self):\n", + " if ( not uncaught_exception()):\n", + " raise EmcSystemException(\"EmcLog::flush()\")" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 12.6 page no : 142" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "class EmcException:\n", + " def __init__(self,m):\n", + " maxSizeM = 100\n", + " actualLength = len(m);\n", + " self.lengthM = min(maxSizeM,actualLength);\n", + " self.messageM = message" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 12.7" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "\n", + "def f():\n", + " ip = 1\n", + " g(ip)\n", + "\n", + "\n", + "def g(i):\n", + " raise Exception(i)" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 12.8 page no : 146" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "\n", + "def f():\n", + " ip = 1\n", + " g(ip)\n", + "\n", + "def g(i):\n", + " raise Exception(i)" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 12.9 page no :146" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "def f():\n", + " ip = 1\n", + " g(ip)" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 12.10 page no : 148" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "class EmcStack:\n", + " defaultSizeM = 100\n", + " def __init__(self,size = 100):\n", + " pass\n", + "\n", + " def __del__(self):\n", + " pass\n", + "\n", + " def operator(self,s):\n", + " pass\n", + "\n", + " def empty(self):\n", + " pass\n", + " \n", + " def top(self):\n", + " pass\n", + "\n", + " def push(self,i):\n", + " pass\n", + " \n", + " def pop(self):\n", + " pass" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 12.12 page no : 151" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "class EmcException:\n", + " def __init__(self,m):\n", + " pass\n", + " \n", + " def operator(self,o,EmcException):\n", + " pass\n", + "\n", + " def printOn(self,o): \n", + " print self.messageM;" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 12.13 page no : 153" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "try:\n", + " socketfd = emcSocket(AF_UNIX, SOCK_STREAM, 0);\n", + "except Exception,e:\n", + " print e" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "name 'emcSocket' is not defined" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 12.14 page no : 155" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "\n", + "def at(s,pos):\n", + " if (pos > len(s)):\n", + " raise Exception;" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 12 + }, + { + "cell_type": "code", + "collapsed": true, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch13-checkpoint.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch13-checkpoint.ipynb new file mode 100644 index 00000000..3345163e --- /dev/null +++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch13-checkpoint.ipynb @@ -0,0 +1,352 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:d6906960a00c4b8d0c283cfb9825297a96b65f1e56eeb225bcbb3e1b7512c87d" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 13 : Parts of C++ to avoid" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 13.1 page no : 159" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "s = 'abc' #raw_input()\n", + "print s" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "abc" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 13.2 page no : 160" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class DangerousString:\n", + " def __init__(self,cp):\n", + " pass\n", + " \n", + " def char(self):\n", + " pass\n", + "\n", + "hello = \"Hello World!\";\n", + "print hello # Works perfectly\n", + "print \"%s\"%hello" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello World!\n", + "Hello World!" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 13.3 page no : 160" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class EmcString:\n", + " def __init__(self,cp):\n", + " pass\n", + "\n", + "\n", + "s = \"Hello World!\";\n", + "print s " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello World!" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 13.4 page no :161" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "SIZE = 1024;\n", + "print SIZE" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1024" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 13.5 page no : 162" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "class X:\n", + " class Color:\n", + " green = 1\n", + " yellow = 2\n", + " red = 3" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 13.6 page no : 162" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "class X:\n", + " maxBuf = 1024\n", + " class Color:\n", + " green = 1\n", + " yellow = 2\n", + " red = 3" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 13.7 page no : 162" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def SQUARE(x):\n", + " return x*x\n", + "\n", + "i = SQUARE(3 + 4); \n", + "print i" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "49" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 13.8 page no : 163" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def square(x):\n", + " return x * x;\n", + "c = 2;\n", + "d = square(c)\n", + "print d" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "4" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 13.9 page no : 163" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def SQUARE(x):\n", + " return x*x\n", + "i = SQUARE(\"hello\");\n", + "print i" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "TypeError", + "evalue": "can't multiply sequence by non-int of type 'str'", + "output_type": "pyerr", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m/home/jay/\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mSQUARE\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 8\u001b[0;31m \u001b[0mi\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mSQUARE\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"hello\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 9\u001b[0m \u001b[0;32mprint\u001b[0m \u001b[0mi\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/home/jay/\u001b[0m in \u001b[0;36mSQUARE\u001b[0;34m(x)\u001b[0m\n\u001b[1;32m 5\u001b[0m '''\n\u001b[1;32m 6\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mSQUARE\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 8\u001b[0m \u001b[0mi\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mSQUARE\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"hello\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;32mprint\u001b[0m \u001b[0mi\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mTypeError\u001b[0m: can't multiply sequence by non-int of type 'str'" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 13.10 page no : 163" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#define Velocity int\n", + "#typedef int Velocity;\n", + "# Not recommended" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 11, + "text": [ + "'\\nEXAMPLE 13.10 page no : 163\\nHow to define synonyms for a type\\nNote : Python doesnot have synonyms for type as we do not have to explicitely \\ndeclare variables.\\n'" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 13.11 page no : 164" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "\n", + "def printFruits(fruits,size):\n", + " for i in range(size):\n", + " print fruits[i] " + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 12 + }, + { + "cell_type": "code", + "collapsed": true, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch15-checkpoint.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch15-checkpoint.ipynb new file mode 100644 index 00000000..959b8ea2 --- /dev/null +++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch15-checkpoint.ipynb @@ -0,0 +1,623 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:67c3bd60f39852adfa5ba947f72fe1de41fb056b7ba742f5dbc11c9e1b748ae1" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 15 : Portability" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 15.1 page no : 172" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "c = -100;\n", + "if (c < 0):\n", + " pass" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 15.2 page no : 173" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class BasicAttrType:\n", + " counterGauge = 0x1000\n", + " counterPeg = 0x2000\n", + " conterAcc = 0x3000\n", + " \n", + "\n", + "\n", + "t = BasicAttrType.counterGauge\n", + "print t" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "4096" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 15.3 page no : 173" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "a = ''\n", + "print a" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

example 15.5 page no : 174" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "result = 1234 * 567\n", + "print result" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "699678" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 15.6 page no : 175" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "import math # python has only one way to importing file.\n", + "from math import *" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

exmaple 15.7 page no : 176" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + " \n", + "# import inc.MyFile\n", + "# import inc.MyFile\n", + "\n", + "# import gui.xinterface" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 6, + "text": [ + "'\\nexmaple 15.7 page no : 176\\nDirectory names in include directives\\nNote : python has . operator to import a file from directory\\n'" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 15.8 page no : 176" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "\n", + "import math\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 15.9 page no : 178" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "\n", + "class PersonRecord:\n", + " ageM = ''\n", + " phoneNumberM = 0\n", + " nameM = ''" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 15.10 page no : 178" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def stepAndConvert(a,n):\n", + " b = a + str(n) # step n chars ahead\n", + " return b # NO: Dangerous cast of const char* to int*\n", + "\n", + "\n", + "data = \"abcdefghijklmnop\"\n", + "anInt = 3;\n", + "i = stepAndConvert(data, anInt)\n", + "print i" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "abcdefghijklmnop3" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 15.11 page no : 179" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "INT_MIN = -2147483648\n", + "INT_MAX = 2147483647\n", + "UINT_MAX = 4294967295\n", + "i = 42\n", + "ui = 2222222242;\n", + "j = i - ui;\n", + "print j" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "-2222222200" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 15.12 page no : 180" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "zero = 0;\n", + "one = 1;\n", + "minusOne = zero - one;\n", + "print minusOne\n", + "result = one + minusOne;\n", + "print result" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "-1\n", + "0" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 15.13 page no : 180" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "pid1 = fork(); # NO: should use pid_t\n", + "\n", + "pid2 = fork();" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'fork' is not defined", + "output_type": "pyerr", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m/home/jay/\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mNote\u001b[0m \u001b[0;34m:\u001b[0m \u001b[0mIt\u001b[0m \u001b[0mwould\u001b[0m \u001b[0mshoot\u001b[0m \u001b[0merror\u001b[0m \u001b[0mbecause\u001b[0m \u001b[0mfork\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mdefined\u001b[0m \u001b[0mhere\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m '''\n\u001b[0;32m----> 6\u001b[0;31m \u001b[0mpid1\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfork\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m \u001b[0;31m# NO: should use pid_t\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 7\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0mpid2\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfork\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mNameError\u001b[0m: name 'fork' is not defined" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 15.14 page no : 181" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "famousClimber = \"Edmund Hillary\"; # Uses Emc as prefix\n", + "print famousClimber" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Edmund Hillary" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 15.15 page no : 183" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "\n", + "class EmcArray:\n", + " def __init__(self,size):\n", + " pass" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 14 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 15.16 page no : 183" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "\n", + "\n", + "false = 0;\n", + "true = 1;" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 15 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 15.17 page no : 184" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "i = 0;\n", + "for i in range(last()):\n", + " pass\n", + "\n", + "for i in range(first()):\n", + " pass" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'last' is not defined", + "output_type": "pyerr", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m/home/jay/\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 5\u001b[0m '''\n\u001b[1;32m 6\u001b[0m \u001b[0mi\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m \u001b[0;32mfor\u001b[0m \u001b[0mi\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlast\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 8\u001b[0m \u001b[0;32mpass\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mNameError\u001b[0m: name 'last' is not defined" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 15.18 page no : 185" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "\n", + "def emcMax(a, b):\n", + " if a>b:\n", + " return a\n", + " return b\n", + "\n", + "def foo(i,j):\n", + " m = emcMax(i, j); # usage of emcMax\n", + "\n", + "q = 0 # usage of class EmcQueue and\n", + "s = 0 # EmcQueue:s default constructor" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 15.19 page no : 186" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "class EmcQueue:\n", + " pass" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 15.20 page no : 187" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "\n", + "class DangerousString:\n", + " def __init__(self,cp):\n", + " pass\n", + "\n", + " def char(self):\n", + " pass" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

example 15.22 page no : 189" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "def main(self):\n", + " return 0" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 15.23" + ] + }, + { + "cell_type": "code", + "collapsed": true, + "input": [ + "\n", + "\n", + "func(f1(), f2(), f3()) # f1 may be evaluated before f2 and f3,\n", + "# but don't depend on it!" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

EXAMPLE 15.24 page no : 189" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "a = [0,0,0]\n", + "i = 0\n", + "a[i] = i;\n", + "i += 1\n", + "print i \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "code", + "collapsed": true, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch2-checkpoint.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch2-checkpoint.ipynb new file mode 100644 index 00000000..01190be5 --- /dev/null +++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch2-checkpoint.ipynb @@ -0,0 +1,260 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:604aba6dc2241fd2ccb159b6fd79a1425cbc4a19e69fbc864a6d341dc4499d86" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 2 : Organizing the code" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 2.1 Page no : 12\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import EmcArray # EmcArray.py\n", + "import iostream # The rest of the EmcArray.cc file " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "ImportError", + "evalue": "No module named EmcArray", + "output_type": "pyerr", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mImportError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[0mNote\u001b[0m \u001b[1;33m:\u001b[0m \u001b[0mwould\u001b[0m \u001b[0mgive\u001b[0m \u001b[0merror\u001b[0m \u001b[0mbecause\u001b[0m \u001b[0mwe\u001b[0m \u001b[0mdont\u001b[0m \u001b[0mhave\u001b[0m \u001b[0mEmcArray\u001b[0m \u001b[1;32mand\u001b[0m \u001b[0miostream\u001b[0m \u001b[0mpackages\u001b[0m\u001b[1;33m.\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m '''\n\u001b[1;32m----> 6\u001b[1;33m \u001b[1;32mimport\u001b[0m \u001b[0mEmcArray\u001b[0m \u001b[1;31m# EmcArray.py\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 7\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0miostream\u001b[0m \u001b[1;31m# The rest of the EmcArray.cc file\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mImportError\u001b[0m: No module named EmcArray" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 2.2 page no : 13\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "class X :\n", + " def __init__(self):\n", + " pass #self.aM = A()\n", + " \n", + " def returnA(self):\n", + " pass #return self.aM\n", + " \n", + " def withAParameter(self,a):\n", + " pass #self.aM = a" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 2.3 page no :14\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Y :\n", + " def __init__(self):\n", + " pass #self.bM = B()\n", + " \n", + " def returnBPtr(self):\n", + " pass #return self.aM\n", + " \n", + " def withAParameter(self,b):\n", + " pass #self.bM = a\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 2.4 page no : 15\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def module_exists(module_name):\n", + " try:\n", + " __import__(module_name)\n", + " except ImportError:\n", + " return False\n", + " else:\n", + " return True" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 2.5 page no : 15\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def cStr(cpM):\n", + " return cpM\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 2.6 page no : 17\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "def max_(x,y):\n", + " if x > y:\n", + " return x\n", + " return y\n", + "\n", + "def function(i,j):\n", + " m = max_(i,j) # must instantiate max(int,int)\n", + " print m\n", + "\n", + "function(5,10) \n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 2.7 page no : 17\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class EmcQueue:\n", + " def __init__(self):\n", + " pass\n", + " \n", + " def insert(self,t):\n", + " pass\n", + "\n", + "q = EmcQueue()\n", + "q.insert(42);" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 2.8 page no : 18\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class EmcQueue:\n", + " pass" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 8 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch3-checkpoint.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch3-checkpoint.ipynb new file mode 100644 index 00000000..0a94e52d --- /dev/null +++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch3-checkpoint.ipynb @@ -0,0 +1,144 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:a85e6484ac7cb551f2a4143517b76dce8f3df91fe103a5d8d9d3ea8d4c88f202" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 3 : Comments" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 3.1 Page no : 22\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "rcsid = \"$Id: $\"\n", + "print rcsid" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "$Id: $\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 3.2 Page no : 22\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "cpM = ''; # A String variable\n", + "lenM = 0 # The length of the character array " + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.3 Page no : 22\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "''' No: this nesting of C-style comments will not work !!!\n", + "char* cpM;\n", + "int lenM;\n", + "# A pointer to the characters\n", + "# The length of the character array \n", + "'''" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 2, + "text": [ + "' No: this nesting of C-style comments will not work !!!\\nchar* cpM;\\nint lenM;\\n# A pointer to the characters\\n# The length of the character array \\n'" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch4-checkpoint.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch4-checkpoint.ipynb new file mode 100644 index 00000000..7e36550e --- /dev/null +++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch4-checkpoint.ipynb @@ -0,0 +1,237 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:99935b32a9ea7a27a503a454b81a0e17df24ed0a832a692bc01c74562838da9f" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 4 : Control flow" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.1 page no : 27\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "numberOfObjects = 42;\n", + "a = []\n", + "for i in range(numberOfObjects):\n", + " # Recommended\n", + " print i \n", + " a.append(i)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n", + "1\n", + "2\n", + "3\n", + "4\n", + "5\n", + "6\n", + "7\n", + "8\n", + "9\n", + "10\n", + "11\n", + "12\n", + "13\n", + "14\n", + "15\n", + "16\n", + "17\n", + "18\n", + "19\n", + "20\n", + "21\n", + "22\n", + "23\n", + "24\n", + "25\n", + "26\n", + "27\n", + "28\n", + "29\n", + "30\n", + "31\n", + "32\n", + "33\n", + "34\n", + "35\n", + "36\n", + "37\n", + "38\n", + "39\n", + "40\n", + "41\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 4.2 page no :27\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "numberOfObjects = 42;\n", + "a = []\n", + "for i in range(numberOfObjects):\n", + " # Recommended\n", + " a.append(i)\n", + "\n", + "print \"Enter value: \";\n", + "value = int(raw_input())\n", + "\n", + "if value == 1 or value==2:\n", + " print \"1 or 2: \" , a[value] \n", + "else:\n", + " if (value > 2 and value < numberOfObjects):\n", + " print \"Not 1 or 2: \" , a[value] " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter value: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Not 1 or 2: 10\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 4.3 page no : 28\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Status:\n", + " red = 1\n", + " green = 2\n", + "\n", + "def convertStatus(status):\n", + " if status == Status.red:\n", + " return \"Red\"\n", + " elif status == Status.green:\n", + " return \"Green\"\n", + " else: \n", + " return \"Illegal value\" \n", + "\n", + "print convertStatus(1) \n", + "print convertStatus(2)\n", + "print convertStatus(5)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Red\n", + "Green\n", + "Illegal value\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 4.4 page no : 29" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "m = 10;\n", + "errorflag = False;\n", + "\n", + "for i in range(m):\n", + " if (True):\n", + " errorflag = True;\n", + " break; # leaves loop\n", + "\n", + "# no goto needed\n", + "if(errorflag):\n", + " pass" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 4 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch5-checkpoint.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch5-checkpoint.ipynb new file mode 100644 index 00000000..a029736b --- /dev/null +++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch5-checkpoint.ipynb @@ -0,0 +1,366 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:4901ffb994257f0e8fa6db1b9dab89e04d2d4445470183e0a767fe68fc2e6c1a" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 5 : Object Life Cycle" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.1 page no: 32\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "i = 10;\n", + "j = 10;" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.2 page no : 33\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "string1 = \"hello\";\n", + "string2 = \"hello\"; \n", + "print string1, string2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "hello hello\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 5.3 page no : 33\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "i = int(raw_input()) # no reason to initialize i\n", + "print i" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 5.4 page no : 34\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "oldLm = 0;\n", + "newLm = 0;" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 5.5 page no : 34\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "charMapSize = 256;\n", + "for i in range(charMapSize):\n", + " pass" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 5.6 page no : 36\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Base:\n", + " def __init__(self,i=0):\n", + " self.iM = 0\n", + "\n", + "class Derived(Base):\n", + " def __init__(self,i=0):\n", + " Base.__init__(self,i)\n", + " self.jM = i" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 5.7 page no : 37\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Base:\n", + " def __init__(self,i=0):\n", + " self.iM = 0\n", + "\n", + "class Derived(Base):\n", + " def __init__(self,i=0):\n", + " self.jM = i\n", + " bm = Base(i)" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.8 page no : 40\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def dangerous():\n", + " i = 5;\n", + " return i\n", + "j = dangerous(); # NO: j is dangerous to use\n", + "print j;\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 5.9 page no : 41\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class CommunicationPort:\n", + " def __init__(self,port):\n", + " pass\n", + " \n", + " def __del__(self):\n", + " pass" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 5.10 page no : 42\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class EmcIntStack:\n", + " def __init__(self,d):\n", + " self.allocatedM = d\n", + " self.vectorM = []\n", + "\n", + " def __del__():\n", + " pass " + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.11 page no : 43\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "s = \"Aguirre\";\n", + "s = s;\n", + "print s " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Aguirre\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.12 page no : 43\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "s = \"Aguirre\";\n", + "r = s;\n", + "print r" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Aguirre\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch6-checkpoint.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch6-checkpoint.ipynb new file mode 100644 index 00000000..fd64d436 --- /dev/null +++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch6-checkpoint.ipynb @@ -0,0 +1,252 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:c1979706be64935f09ceb3554d978452d5424275b8414b3d1169cfa595dbe5ba" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 6 : Conversions" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 6.1 page no : 48\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "large = 456789; # Potentially dangerous conversion\n", + "size = float(large)\n", + "print size" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "456789.0\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 6.2 page no : 49\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class DangerousString :\n", + " def __init__(self):\n", + " pass # self.s = ''\n", + "\n", + " def __str__(self):\n", + " pass # return self.s" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 6.3 page no : 51\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "large = 456789\n", + "size = int(large);\n", + "three = \"three\" \n", + "print large,size,three" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "456789 456789 three\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 6.4 page no : 51\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class B:\n", + " pass\n", + " \n", + "class D( B):\n", + " pass\n", + "\n", + "class E:\n", + " pass\n", + " \n", + "def dynamicCast(b):\n", + " \n", + " return D(b)\n", + "\n", + "def constCast(d1):\n", + " \n", + " return D(d1)\n", + "\n", + "def reinterpretCast(d):\n", + " \n", + " return E(d)" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 6.5 page no : 52\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def addToFileList(s):\n", + " pass\n", + " \n", + "def addFiles(s):\n", + " m = len(s)\n", + " for i in range(m):\n", + " addToFileList(s[i])" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 6.6 page no : 52\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + " \n", + "ci = 22;\n", + "pi = ci # NO: Const cast away\n", + "i = pi; # OK\n", + " \n", + "pi = 7 \n", + "print ci, pi, i " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "22 7 22\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.7 page no : 53\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class EmcMatrix:\n", + " def __init__(self):\n", + " self.isDirtyM = False\n", + " self.detM = 0.0\n", + "\n", + " def calculateDeterminant(self):\n", + " pass\n", + "\n", + " def determinant(self):\n", + " if(isDirtyM):\n", + " # OK, access to mutable data members\n", + " self.detM = self.calculateDeterminant();\n", + " self.isDirtyM = False;\n", + " return self.detM;" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 8 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch7-checkpoint.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch7-checkpoint.ipynb new file mode 100644 index 00000000..44f3a6f2 --- /dev/null +++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch7-checkpoint.ipynb @@ -0,0 +1,796 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:b4e731202bf742910c6ef5036e32c8b7cfe5b2f75ed97368c4ae21a1da57a421" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 7 : The class interface" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 7.1 page no : 57\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Point:\n", + " def __init__(self,x,y):\n", + " self.xM = x\n", + " self.yM = y\n", + "\n", + " def x(self):\n", + " return self.xM\n", + " \n", + " def y(self):\n", + " return self.yM\n", + "\n", + " def x_(self,x):\n", + " self.xM = x\n", + " \n", + " def y_(self,y):\n", + " self.yM = y\n", + "\n", + " def __add__(self,p2): \n", + " return Point(self.x() + p2.x(), self.y() + p2.y())" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.2 page no : 59\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def valueFunc(t):\n", + " pass\n", + "\n", + "def pointerFunc(tp):\n", + " pass\n", + "\n", + "def referenceFunc(tr):\n", + " pass" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.3 page no : 60\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def func1(c):\n", + " pass\n", + "\n", + "def func2(i):\n", + " pass\n", + " \n", + "def func3(d):\n", + " pass\n", + " \n", + "def func(c):\n", + " pass" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 7.4 page no : 61\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class EmcMathVector:\n", + " def __init__(self,x,y):\n", + " self.xM = x\n", + " self.yM = y\n", + "\n", + " def __mul__(self,i):\n", + " self.xM *= i\n", + " self.yM *= i\n", + "\n", + " def x(self):\n", + " return self.xM\n", + " \n", + " def y(self):\n", + " return self.yM\n", + "\n", + " def x_(self,x):\n", + " self.xM = x\n", + " \n", + " def y_(self,y):\n", + " yM = y\n", + "\n", + "a = EmcMathVector(5,10)\n", + "print a.xM,a.yM\n", + "a * 5\n", + "print a.xM,a.yM" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "5 10\n", + "25 50\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 7.5 page no : 63\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class vector:\n", + " def __init__(self,first,last):\n", + " pass\n", + "\n", + " def begin(self):\n", + " pass\n", + "\n", + " def push_back(self,x):\n", + " pass\n", + " \n", + " def insert(self,x):\n", + " pass" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 7.6 page no : 64\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class basic_ofstream:\n", + " def __init__(self,x,y):\n", + " self.x = x\n", + " self.y = y\n", + "\n", + " def print_(self):\n", + " print self.x , \", \" , self.y;\n", + "\n", + "\n", + "v = basic_ofstream(1.2, 5.5);\n", + "v.print_()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1.2 , 5.5\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 7.7 page no : 65 \n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def uselessPrint(v):\n", + " # NO: Compile error\n", + " print v.x() , \", \" , v.y();" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.8 page no : 65\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "array = ['','','']\n", + "# assign to first element\n", + "arrayPointer = 42 #*(arrayPointer = array) = 42\n", + "print arrayPointer" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "42\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 7.10 page no : 67\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def arraySum(array,first,last):\n", + " s = 0\n", + " for i in array:\n", + " # It is possible to update first since\n", + " # it has not been declared const.\n", + " s += i\n", + " return s;\n", + " \n", + "print arraySum([5,4,3,2],5,2) " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "14\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 7.11 page no : 68\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class EmcStack:\n", + " def __init__(self):\n", + " self.repM = []\n", + " self.allocatedM = 0\n", + " self.topM = 0\n", + " \n", + " def push(t):\n", + " if self.topM == allocatedM : # allocate more memory\n", + " pass #size_t newSize = 2 * allocatedM;\n", + " self.repM.append(t)\n", + " self.topM +=1" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 7.12 page no : 69\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "message1 = \"Calling Orson\";\n", + "message2 = \"Ice Hockey\";\n", + "message3 = \"Terminator\";\n", + "message4 = \"I like candy\"\n", + "\n", + "print message1\n", + "print message2\n", + "print message3\n", + "print message4" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Calling Orson\n", + "Ice Hockey\n", + "Terminator\n", + "I like candy\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 7.13 page no : 70\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class UselessString:\n", + " def __init__(self,c=None):\n", + " pass\n", + " \n", + " def cStr(self):\n", + " pass\n", + " \n", + " def length(self):\n", + " pass\n", + " \n", + " def at(self,index):\n", + " pass\n", + " \n", + " def print_(self):\n", + " print self.s " + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 7.14 page no : 71\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Silly:\n", + " def __init__(self,val):\n", + " self.valM = val\n", + " \n", + " def me(self,s):\n", + " pass" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 7.15 page no : 72\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "name = \"John Bauer\";\n", + "print name[0]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "J\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 7.16 page no : 75\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "cosmonaut = \"Juri Gagarin\"\n", + "c = 'a';\n", + "cValue = c in cosmonaut # cValue == true\n", + "uri = \"uri\"\n", + "uriValue = uri in cosmonaut # uriValue == true\n", + "print cValue\n", + "print uriValue" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "True\n", + "True\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 7.17 page no : 76 \n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def max_(x,y):\n", + " if (x > y): # could use: < instead\n", + " # We also expect that:\n", + " # y < x\n", + " return x;\n", + " else:\n", + " # We also expect that:\n", + " # x <= y\n", + " return y;\n", + "\n", + "x = 42;\n", + "y = 0;\n", + "print max(x,y)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "42\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 7.18 page no : 76\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''\n", + "Implementation of closely related operators\n", + "Python has inbuilt this facility. No need to write functions for that.\n", + "''' " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 17, + "text": [ + "'\\nEXAMPLE 7.18 page no : 76\\nImplementation of closely related operators\\nPython has inbuilt this facility. No need to write functions for that.\\n'" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 7.19 page no : 77\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Base:\n", + " def f(char):\n", + " pass\n", + " def f(i):\n", + " pass\n", + " def v(char):\n", + " pass\n", + "\n", + "class Derived(Base):\n", + " def __init__(self):\n", + " pass\n", + "\n", + " def f(self,i):\n", + " pass\n", + " \n", + " def v(self,c):\n", + " self.f(c)" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 7.20 page no : 79\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class EmcCollection:\n", + " def isEqual(self):\n", + " pass\n", + " \n", + "class EmcBoundedCollection(EmcCollection):\n", + "\n", + " def isEqual(a):\n", + " pass" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.21 page no : 80\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def f(x,y = 2):\n", + " print x\n", + " print y\n", + " \n", + "f(1)\n", + "f(2,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n", + "2\n", + "2\n", + "3\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 7.22 page no : 80\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class RanDraw:\n", + " def __init__(self, limit,seed, t = 'Good' ):\n", + " pass # Default argument for t in class definition\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 7.23 page no : 82\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Other:\n", + " def __init__(self,a): #No implicit conversion from Any\n", + " pass\n", + " \n", + " def foo(self,o):\n", + " pass" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.24 page no : 82\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class EmcString:\n", + " def cStr(): # conversion to const char*\n", + " pass\n", + "\n", + " def log(cp): \n", + " pass\n", + "\n", + "magicPlace =\"Ngoro-Ngoro crater at dusk\"\n", + "print magicPlace # Explicit conversion from String to const char*" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Ngoro-Ngoro crater at dusk\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch8-checkpoint.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch8-checkpoint.ipynb new file mode 100644 index 00000000..f1327778 --- /dev/null +++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch8-checkpoint.ipynb @@ -0,0 +1,173 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:f5f5ad66b7a095f610fb30e8ad8d0186b3071c148d58ac53f7a316ab1df3ec7b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 8 : new and delete" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 8.1 page no : 89\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "sp = \"Hello\" \n", + "arraySize = 5;\n", + "sa = []\n", + "print sp, arraySize\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello 5\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 8.2 page no : 90\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "sp = \"Hello\"\n", + "print sp\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 8.3 page no : 90\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class W:\n", + " def __init__(self):\n", + " pass\n", + "\n", + " def goAway(self):\n", + " pass\n", + " \n", + " def foo(self):\n", + " pass\n", + " \n", + " def bar(self):\n", + " pass" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 8.4 page no : 91\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "maxSize = 100; # get storage for object\n", + "storage = [] # call placement new to create object\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 8.5 page no : 93 \n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class BadArgument:\n", + " def __init__(self):\n", + " pass\n", + "\n", + "class A:\n", + " def __init__(self):\n", + " pass" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 5 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch9-checkpoint.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch9-checkpoint.ipynb new file mode 100644 index 00000000..309b48de --- /dev/null +++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/.ipynb_checkpoints/ch9-checkpoint.ipynb @@ -0,0 +1,248 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:e66ca7aa618599290172b157388396bd9cebae6436e92f6bfe733e6b45d83c32" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 9 : Static Objects" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 9.1 page no : 97\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def randomValue(seed):\n", + " oldValue = seed; # calculate new value\n", + " return oldValue\n", + " \n", + "print randomValue(5) " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 9.2 page no : 97\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class EmcSingleton:\n", + " def instance():\n", + " pass\n", + " \n", + " def create(i = 0):\n", + " self.instanceM = EmcSingleton(i)\n", + "\n", + " def __init__(self,i):\n", + " pass\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 9.3 page no : 98\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "sccsid = \"@(#)myfile.cc\"\n", + "print sccsid" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "@(#)myfile.cc\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 9.4 page no : 98\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "sccsid = \"@(#)myfile.cc\"\n", + "print sccsid" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "@(#)myfile.cc\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 9.5 page no : 98\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class EmcLog:\n", + " def __init__(self,out=None):\n", + " print \"Creating log\"\n", + "\n", + "t = EmcLog()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Creating log\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 9.6 page no : 100\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "sccsid = \"@(#)myfile.cc\"\n", + "release = \"@(#)Emc Class Library, 1.2\"\n", + "print sccsid, release" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "@(#)myfile.cc @(#)Emc Class Library, 1.2\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "EXAMPLE 9.7 page no : 100\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class EmcObject:\n", + " def __init__(self):\n", + " pass\n", + " \n", + " def __del__(self):\n", + " pass\n", + " \n", + " def initialize(self):\n", + " pass\n", + " \n", + " def finalize(self):\n", + " pass" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 12 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch1.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch1.ipynb index 834bacf2..f4b7ee3f 100644 --- a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch1.ipynb +++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch1.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:2af50dca95bb8940069ca1eefad39c58f8f97bbf13a194cd9fff16b4f6521b4f" + "signature": "sha256:37f13004fc5f3a508673a34bf43303c84f6e4e316a16ef38a0b0379046c2213e" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Chapter One : Naming" + "Chapter 1 : Naming" ] }, { diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch10.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch10.ipynb index 52781089..a5c9da2e 100644 --- a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch10.ipynb +++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch10.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:70f9ab632bffbd9fecc3bdcee575cac266cb09d4df74fddec4e595d028f134df" + "signature": "sha256:d2950e71a4d0bcb937c28bb6a6a53b7b95fffdbbe552d0a0131c5c28ce96f972" }, "nbformat": 3, "nbformat_minor": 0, @@ -12,7 +12,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Chapter Ten : Object-oriented programming

" + "

Chapter 10 : Object-oriented programming

" ] }, { diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch11.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch11.ipynb index 9dc6882e..34493505 100644 --- a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch11.ipynb +++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch11.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:2e265a79f479b0afc28156201c75dda9d71f161b6acb07438df53ecda65f24e0" + "signature": "sha256:d4deb246a9bd56a3c6cdfb40f5c92d61fa63821825ffc120e7cc6ecddafbf829" }, "nbformat": 3, "nbformat_minor": 0, @@ -12,7 +12,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Chapter Eleven : Assertions" + "

Chapter 11 : Assertions" ] }, { diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch12.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch12.ipynb index a4d7907e..cba2d9a9 100644 --- a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch12.ipynb +++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch12.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:3fda869111a137bc83ae4b79f3c57ac84f247031c3e08ac7d6dfb9bb168b3105" + "signature": "sha256:ea3c47e539ea1c36c95f4b3634f53eb8fd0bf8b2905837e67036101fa90254a4" }, "nbformat": 3, "nbformat_minor": 0, @@ -12,7 +12,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Chapter Twelve : Error handling" + "

Chapter 12 : Error handling" ] }, { diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch13.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch13.ipynb index a23bdf0e..3345163e 100644 --- a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch13.ipynb +++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch13.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:121cbe714f8e854e8d9ce1fe8dcdc370535cc7140b2f83bdae09063602e644f9" + "signature": "sha256:d6906960a00c4b8d0c283cfb9825297a96b65f1e56eeb225bcbb3e1b7512c87d" }, "nbformat": 3, "nbformat_minor": 0, @@ -12,7 +12,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Chapter Thirteen : Parts of C++ to avoid" + "

Chapter 13 : Parts of C++ to avoid" ] }, { diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch15.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch15.ipynb index 32ad5666..959b8ea2 100644 --- a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch15.ipynb +++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch15.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:24f5f3b754e3fd6e8afab7bcb99e41e817ec5bce9faae498ba9fb75dd53f93ff" + "signature": "sha256:67c3bd60f39852adfa5ba947f72fe1de41fb056b7ba742f5dbc11c9e1b748ae1" }, "nbformat": 3, "nbformat_minor": 0, @@ -12,7 +12,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Chapter Fifteen : Portability" + "

Chapter 15 : Portability" ] }, { diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch2.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch2.ipynb index 8660012f..01190be5 100644 --- a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch2.ipynb +++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch2.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:025b4c65298f5bb6d48b99d717b6d0fce940f5a97ad7eb75ea5897c4c9595891" + "signature": "sha256:604aba6dc2241fd2ccb159b6fd79a1425cbc4a19e69fbc864a6d341dc4499d86" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Chapter : Two : Organizing the code" + "Chapter 2 : Organizing the code" ] }, { diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch3.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch3.ipynb index ce027b4e..0a94e52d 100644 --- a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch3.ipynb +++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch3.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:dbc95d125151940c8402c8ffda427c3e959c7eb724b40434b79a3b03a164fff8" + "signature": "sha256:a85e6484ac7cb551f2a4143517b76dce8f3df91fe103a5d8d9d3ea8d4c88f202" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Chapter Three : Comments" + "Chapter 3 : Comments" ] }, { diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch4.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch4.ipynb index 16c0834c..7e36550e 100644 --- a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch4.ipynb +++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch4.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:814e2a9ffe7448c8830af394019244e2f81fe0819c83f253105a48f1b6c7edaf" + "signature": "sha256:99935b32a9ea7a27a503a454b81a0e17df24ed0a832a692bc01c74562838da9f" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Chapter Four : Control flow" + "Chapter 4 : Control flow" ] }, { diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch5.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch5.ipynb index 4e630070..a029736b 100644 --- a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch5.ipynb +++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch5.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:862ed788d417ee363a92882e2a970648b380a2f974a44d4fd4e62dfc3b0fcdf2" + "signature": "sha256:4901ffb994257f0e8fa6db1b9dab89e04d2d4445470183e0a767fe68fc2e6c1a" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Chapter Five : Object Life Cycle" + "Chapter 5 : Object Life Cycle" ] }, { diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch6.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch6.ipynb index 3f83e4d0..fd64d436 100644 --- a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch6.ipynb +++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch6.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:7e4ca4515204ca5f28b7ad14f25998ad16f2910d212e32a1071b57e6d0d7e56b" + "signature": "sha256:c1979706be64935f09ceb3554d978452d5424275b8414b3d1169cfa595dbe5ba" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Chapter Six : Conversions" + "Chapter 6 : Conversions" ] }, { diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch7.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch7.ipynb index f8b112a8..44f3a6f2 100644 --- a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch7.ipynb +++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch7.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:fbefe45753ab0203894f5afad5e792e20da756faab0edd14dfdedec2c8be513a" + "signature": "sha256:b4e731202bf742910c6ef5036e32c8b7cfe5b2f75ed97368c4ae21a1da57a421" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Chapter Seven : The class interface" + "Chapter 7 : The class interface" ] }, { diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch8.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch8.ipynb index 657c42ba..f1327778 100644 --- a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch8.ipynb +++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch8.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:9aeef576f29f7c783f96768a664cb437cbd4922734a99612921a48bd58c127b5" + "signature": "sha256:f5f5ad66b7a095f610fb30e8ad8d0186b3071c148d58ac53f7a316ab1df3ec7b" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Chapter Eight : new and delete" + "Chapter 8 : new and delete" ] }, { diff --git a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch9.ipynb b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch9.ipynb index 35b80cf8..309b48de 100644 --- a/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch9.ipynb +++ b/C++_in_Action_-_Industrial-Strength_Programming_Techniques/ch9.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:bb23348ad3296a941665bd16b2187a89f9e17bfa05baf675e9a0cf4ac9ab49e8" + "signature": "sha256:e66ca7aa618599290172b157388396bd9cebae6436e92f6bfe733e6b45d83c32" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Chapter Nine : Static Objects" + "Chapter 9 : Static Objects" ] }, { diff --git a/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch10_1-checkpoint.ipynb b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch10_1-checkpoint.ipynb new file mode 100644 index 00000000..0a1b388b --- /dev/null +++ b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch10_1-checkpoint.ipynb @@ -0,0 +1,2533 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:3b50ad151f89e9ea380ce80c8112ec5468586c82e236862a1e3d8e194fa15249" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 10 : Residual Properties by Equations of State" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.2 Page Number : 334" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# Variables\n", + "T = 40 + 273.15;\t\t\t#[C] - Temperature\n", + "P_1 = 0;\t\t\t#[bar]\n", + "P_2 = 10;\t\t\t#[bar]\n", + "V_liq = 90.45;\t\t\t#[cm**(3)/mol]\n", + "V_liq = V_liq*10**(-6);\t\t\t#[m**(3)/mol]\n", + "P_sat = 4.287;\t\t\t#[bar] \n", + "\n", + "# For butadiene\n", + "T_c = 425.0;\t\t\t#[K] - Critical temperature\n", + "P_c = 43.3;\t\t\t#[bar] - Critical pressure\n", + "P_c = P_c*10**(5);\t\t\t#[N/m**(2)]\n", + "w = 0.195;\t\t\t# Acentric factor\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "# Calculations and Results\n", + "# Let us calculate second virial coefficient at 40 C\n", + "Tr = T/T_c;\t\t\t# Reduced temperature\n", + "B_0 = 0.083-(0.422/(Tr)**(1.6));\n", + "B_1 = 0.139-(0.172/(Tr)**(4.2));\n", + "#We know,(B*Pc)/(R*Tc) = B_0+(w*B_1)\n", + "B = ((B_0 + (w*B_1))*(R*T_c))/P_c;\t\t\t#[m**(3)/mol] - Second virial coefficient\n", + "\n", + "# math.log(f/P) = (B*P)/(R*T)\n", + "# f = P*exp((B*P)/(R*T))\n", + "\n", + "print \" The table is as follows\"\n", + "print \" Pbar \\t\\t fbar \\t\\t phi\";\n", + "from numpy import zeros\n", + "P = [1,2,3,4,4.287,5,6,8,10];\n", + "f = zeros(9);\n", + "phi = zeros(9);\n", + "for i in range(5):\n", + " f[i]=P[i]*(math.exp((B*P[i]*10**(5))/(R*T)));\t\t\t#[bar] # Pressure inside the exponential term has to be in N/m**(2)\n", + " phi[i]= (f[i]/P[i]);\n", + " print \" %f \\t %f \\t\\t\\t %f\"%(P[i],f[i],phi[i]) \n", + "\n", + "f_sat = f[4];\n", + "\n", + "# From pressure of 4.287 bar onwards the valid equation to compute fugacity of compressed liquid is given by\n", + "# f = f_sat*exp[V_liq*(P-P_sat)/(R*T)]\n", + "\n", + "for j in range(5,9):\n", + " f[j] = f_sat*math.exp((V_liq*(P[j]-P_sat)*10**(5))/(R*T));\t#[bar] # Pressure inside the exponential term has to be in N/m**(2)\n", + " phi[j] = f[j]/P[j]; \n", + " print \" %f \\t %f \\t\\t\\t %f\"%(P[j],f[j],phi[j]);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The table is as follows\n", + " Pbar \t\t fbar \t\t phi\n", + " 1.000000 \t 0.978336 \t\t\t 0.978336\n", + " 2.000000 \t 1.914284 \t\t\t 0.957142\n", + " 3.000000 \t 2.809221 \t\t\t 0.936407\n", + " 4.000000 \t 3.664484 \t\t\t 0.916121\n", + " 4.287000 \t 3.902801 \t\t\t 0.910380\n", + " 5.000000 \t 3.912481 \t\t\t 0.782496\n", + " 6.000000 \t 3.926097 \t\t\t 0.654349\n", + " 8.000000 \t 3.953471 \t\t\t 0.494184\n", + " 10.000000 \t 3.981037 \t\t\t 0.398104\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.3 Page Number : 334" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "# Variables\n", + "n = 100.;\t\t\t#[mol] - No of moles\n", + "T_1 = 600.;\t\t\t#[K] - Initial temperature\n", + "T_2 = 300.;\t\t\t#[K] - Final temperature\n", + "P_1 = 10.;\t\t\t#[atm] - Initial pressure\n", + "P_1 = P_1*101325;\t\t\t#[Pa]\n", + "P_2 = 5.;\t\t\t#[atm] - Final presssure\n", + "P_2 = P_2*101325;\t\t\t#[Pa]\n", + "Tc = 369.8;\t\t\t#[K] - Critical temperature\n", + "Pc = 42.48;\t\t\t#[bar] - Critical pressure\n", + "Pc = Pc*10**(5);\t\t\t#[Pa]\n", + "w = 0.152;\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "# Calculations\n", + "# At 600 K\n", + "Tr = T_1/Tc;\t\t\t# Reduced temperature\n", + "B_0 = 0.083-(0.422/(Tr)**(1.6));\n", + "B_1 = 0.139-(0.172/(Tr)**(4.2));\n", + "#We know,(B*Pc)/(R*Tc) = B_0 + (w*B_1)\n", + "B = ((B_0 + (w*B_1))*(R*Tc))/Pc;\t\t\t#[m**(3)/mol] - Second virial coefficient\n", + "dB0_dT = 0.422*1.6*Tc**(1.6)*T_1**(-2.6);\t\t\t# (dB_0/dT)\n", + "dB1_dT = 0.172*4.2*Tc**(4.2)*T_1**(-5.2);\t\t\t# (dB_1/dT)\n", + "dB_dT = ((R*Tc)/(Pc))*(dB0_dT + w*dB1_dT);\t\t\t# dB/dT\n", + "\n", + "# Now let us calculate B and dB/dT at 300 K\n", + "Tr_prime = T_2/Tc;\t\t\t# Reduced temperature\n", + "B_0_prime = 0.083-(0.422/(Tr_prime)**(1.6));\n", + "B_1_prime = 0.139-(0.172/(Tr_prime)**(4.2));\n", + "#We know,(B*Pc)/(R*Tc) = B_0 + (w*B_1)\n", + "B_prime = ((B_0_prime + (w*B_1_prime))*(R*Tc))/Pc;\t\t\t#[m**(3)/mol] - Second virial coefficient\n", + "dB0_dT_prime = 0.422*1.6*Tc**(1.6)*T_2**(-2.6);\t\t\t# (dB_0/dT)\n", + "dB1_dT_prime = 0.172*4.2*Tc**(4.2)*T_2**(-5.2);\t\t\t# (dB_1/dT)\n", + "dB_dT_prime = ((R*Tc)/(Pc))*(dB0_dT_prime + w*dB1_dT_prime);\t\t\t# dB/dT\n", + "\n", + "# The change in enthalpy for ideal gas is given by\n", + "\n", + "def f16(T): \n", + " return -0.966+7.279*10**(-2)*T-3.755*10**(-5)*T**(2)+7.58*10**(-9)*T**(3)\n", + "\n", + "delta_H_ig = quad(f16,T_1,T_2)[0]\n", + "\n", + "delta_H_ig = delta_H_ig*4.184;\t\t\t#[J/mol]\n", + "\n", + "# We know that delta_H_ig = delta_U_ig + R*delta_T. Therefore change in internal energy is given by \n", + "delta_U_ig = delta_H_ig - R*(T_2 - T_1);\t\t\t#[J/mol]\n", + "\n", + "# The change in entropy of ideal gas is given by \n", + "\n", + "def f17(T): \n", + " return Cp_0/T\n", + "\n", + "#delta_S_ig = quad(f17,T_1,T_2) - R*math.log(P_2/P_1)[0]\n", + "\n", + "\n", + "def f18(T): \n", + " return (-0.966+7.279*10**(-2)*T-3.755*10**(-5)*T**(2)+7.58*10**(-9)*T**(3))/T\n", + "\n", + "delta_S_ig = quad(f18,T_1,T_2)[0]*4.184 - R*math.log(P_2/P_1)\n", + "\n", + "\n", + "# Now let us calculate the change in enthalpy of gas. We know that\n", + "# delta_H = delta_H_ig + delta_H_R\n", + "# delta_H_R = H_2_R - H_1_R\n", + "H_2_R = B_prime*P_2 - P_2*T_2*dB_dT_prime;\t\t\t# [J/mol]\n", + "H_1_R = B*P_1 - P_1*T_1*dB_dT;\t\t\t# [J/mol]\n", + "delta_H_R = H_2_R - H_1_R;\t\t\t# [J/mol]\n", + "delta_H = delta_H_ig + delta_H_R;\t\t\t# [J/mol]\n", + "\n", + "# Let us calculate the residual entropy of gas\n", + "S_2_R = -P_2*dB_dT_prime;\t\t\t#[J/mol-K]\n", + "S_1_R = -P_1*dB_dT;\t\t\t#[J/mol-K]\n", + "delta_S = delta_S_ig + (S_2_R - S_1_R);\t\t\t#[J/mol-K]\n", + "\n", + "# Let us calculate the residual internal energy of gas\n", + "U_2_R = -P_2*T_2*dB_dT_prime;\t\t\t#[J/mol-K]\n", + "U_1_R = -P_1*T_1*dB_dT;\t\t\t#[J/mol-K]\n", + "delta_U = delta_U_ig + (U_2_R - U_1_R);\t\t\t#[J/mol-K]\n", + "\n", + "# For 100 mol sample,\n", + "delta_H_ig = delta_H_ig*n*10**(-3);\t\t\t#[kJ/mol]\n", + "delta_H = delta_H*n*10**(-3);\t\t\t#[kJ/mol]\n", + "\n", + "delta_U_ig = delta_U_ig*n*10**(-3);\t\t\t#[kJ/mol]\n", + "delta_U = delta_U*n*10**(-3);\t\t\t#[kJ/mol]\n", + "\n", + "delta_S_ig = delta_S_ig*n*10**(-3);\t\t\t#[kJ/mol]\n", + "delta_S = delta_S*n*10**(-3);\t\t\t#[kJ/mol]\n", + "\n", + "# Results\n", + "print \" The value of delta_H = %f kJ/mol\"%(delta_H);\n", + "print \" The value of delta_H_ig ideal gas)= %f J/mol\"%(delta_H_ig);\n", + "print \" The value of delta_U = %f kJ/mol\"%(delta_U);\n", + "print \" The value of delta_U_ig ideal gas) = %f kJ/mol\"%(delta_U_ig);\n", + "print \" The value of delta_S = %f kJ/mol\"%(delta_S);\n", + "print \" The value of delta_S_ig ideal gas) = %f kJ/mol\"%(delta_S_ig);\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The value of delta_H = -3130.406247 kJ/mol\n", + " The value of delta_H_ig ideal gas)= -3096.763542 J/mol\n", + " The value of delta_U = -2867.753839 kJ/mol\n", + " The value of delta_U_ig ideal gas) = -2847.343542 kJ/mol\n", + " The value of delta_S = -6.466831 kJ/mol\n", + " The value of delta_S_ig ideal gas) = -6.358994 kJ/mol\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.4 Page Number : 337" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 35 + 273.15;\t\t\t#[K] - Temperature\n", + "P = 10;\t\t\t#[atm] - Pressure\n", + "P = P*101325;\t\t\t#[Pa]\n", + "# Methane obeys the equation of state\n", + "# Z = 1 + (P*B)/(R*T)\n", + "\n", + "# Calculations\n", + "# At 35 C,\n", + "B = -50;\t\t\t#[cm**(3)/mol]\n", + "dB_dT = 1.0;\t\t\t#[cm**(3)/mol-K] - dB/dT\n", + "dB_dT = dB_dT*10**(-6);\t\t\t#[m**(3)/mol-K]\n", + "d2B_dT2 = -0.01;\t\t\t#[cm**(3)/mol-K**(2)] - d**2(B)/d(T**2)\n", + "d2B_dT2 = d2B_dT2*10**(-6);\t\t\t#[m**(3)/mol-K**(2)]\n", + "\n", + "# Ideal gas molar heat capacity of methane is given by\n", + "# Cp_0 = 4.75 + 1.2*10**(-2)*T + 0.303*10**(-5)*T**(2) - 2.63*10**(-9)*T**(3)\n", + "\n", + "# The molar heat capacity is given by\n", + "# Cp = Cp_0 + Cp_R\n", + "# For virial gas equation of state \n", + "Cp_R = -P*T*d2B_dT2;\t\t\t#[J/mol-K]\n", + "\n", + "# thus heat capacity is given by \n", + "# Cp = a + b*T + c*T**(2) + d*T**(3) - P*T*d2B_dT2\n", + "# Putting the values, we get\n", + "Cp = (4.75 + 1.2*10**(-2)*T + 0.303*10**(-5)*T**(2) - 2.63*10**(-9)*T**(3))*4.184 - P*T*d2B_dT2;\t\t\t#[J/mol-K]\n", + "\n", + "# Results\n", + "print \" The molar heat capacity of methane is %f J/mol-K\"%(Cp);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The molar heat capacity of methane is 39.349753 J/mol-K\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.5 Page Number : 338" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "from scipy.optimize import fsolve \n", + "\n", + "# Variables\n", + "T_1 = 360;\t\t\t#[K] - Initial temperature\n", + "P_1 = 10;\t\t\t#[bar] - Initial pressure\n", + "P_1 = P_1*10**(5);\t\t\t#[Pa]\n", + "Tc = 408.1;\t\t\t#[K] - Critical temperature\n", + "Pc = 36.48;\t\t\t#[bar] - Critical pressure\n", + "Pc = Pc*10**(5);\t\t\t#[Pa]\n", + "w = 0.181;\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "Cv_0 = 106.0;\t\t\t#[J/mol-K]\n", + "\n", + "# Calculations\n", + "# At 360 K\n", + "Tr = T_1/Tc;\t\t\t# Reduced temperature\n", + "B_0 = 0.083-(0.422/(Tr)**(1.6));\n", + "B_1 = 0.139-(0.172/(Tr)**(4.2));\n", + "#We know,(B*Pc)/(R*Tc) = B_0 + (w*B_1)\n", + "B = ((B_0 + (w*B_1))*(R*Tc))/Pc;\t\t\t#[m**(3)/mol] - Second virial coefficient\n", + "dB0_dT = 0.422*1.6*Tc**(1.6)*T_1**(-2.6);\t\t\t# (dB_0/dT)\n", + "dB1_dT = 0.172*4.2*Tc**(4.2)*T_1**(-5.2);\t\t\t# (dB_1/dT)\n", + "dB_dT = ((R*Tc)/(Pc))*(dB0_dT + w*dB1_dT);\t\t\t# dB/dT\n", + "\n", + "# At state 1\n", + "V_1 = B + (R*T_1)/P_1;\t\t\t#[m**(3)/mol] - Molar volume\n", + "# At state 1\n", + "V_2 = 10*V_1;\t\t\t#[m**(3)/mol] - Molar volume\n", + "\n", + "T_2 = -(P_1*T_1*(dB_dT))/Cv_0 + T_1;\t\t\t#[K]\n", + "\n", + "T = 350;\n", + "\n", + "fault = 10;\n", + "def f(T): \n", + " return 106*(T-T_1)+972.72-((R*T**(2))/(V_2-B_prime))*dB_dT_prime\n", + "while(fault>0.007):\n", + " Tr_prime = T/Tc;\t\t\t# Reduced temperature\n", + " B_0_prime = 0.083-(0.422/(Tr_prime)**(1.6));\n", + " B_1_prime = 0.139-(0.172/(Tr_prime)**(4.2));\n", + " #We know,(B*Pc)/(R*Tc) = B_0 + (w*B_1)\n", + " B_prime = ((B_0_prime + (w*B_1_prime))*(R*Tc))/Pc;\t\t\t#[m**(3)/mol] - Second virial coefficient\n", + " dB0_dT_prime = 0.422*1.6*Tc**(1.6)*T_2**(-2.6);\t\t\t# (dB_0/dT)\n", + " dB1_dT_prime = 0.172*4.2*Tc**(4.2)*T_2**(-5.2);\t\t\t# (dB_1/dT)\n", + " dB_dT_prime = ((R*Tc)/(Pc))*(dB0_dT_prime + w*dB1_dT_prime);\t\t\t# dB/dT\n", + " T_prime = fsolve(f,0.15)\n", + " fault=abs(T-T_prime);\n", + " T = T + 0.001;\n", + "\n", + "# Results\n", + "print \" The final temperature is %f K\"%(T);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The final temperature is 351.910000 K\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.6 Page Number : 339" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 220 + 273.15;\t\t\t#[K] - Temperature\n", + "Tc = 562.2;\t\t\t#[K] - Critical temperature\n", + "Pc = 48.98;\t\t\t#[bar] - Critical pressure\n", + "Pc = Pc*10**(5);\t\t\t#[Pa]\n", + "w = 0.210;\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "P_sat = 1912.86;\t\t\t#[kPa] - Saturation pressure at 220 C\n", + "P_sat = P_sat*10**(3);\t\t\t#[Pa]\n", + "Mol_wt = 78.114;\t\t\t#[g/mol] - Molecular weight of benzene\n", + "\n", + "# Calculations and Results\n", + "#(1)\n", + "# Since liquid and vapour are in equilibrium the fugacity is saturated fugacity (f_sat) and can be calculated using virial gas equation of state\n", + "# At 220 C\n", + "Tr = T/Tc;\t\t\t# Reduced temperature\n", + "B_0 = 0.083-(0.422/(Tr)**(1.6));\n", + "B_1 = 0.139-(0.172/(Tr)**(4.2));\n", + "#We know,(B*Pc)/(R*Tc) = B_0 + (w*B_1)\n", + "B = ((B_0 + (w*B_1))*(R*Tc))/Pc;\t\t\t#[m**(3)/mol] - Second virial coefficient\n", + "\n", + "# We know that math.log(f/P) = (B*P)/(R*T)\n", + "# Thus at saturated conditions\n", + "# math.log(f_sat/P_sat) = B*P_sat/(R*T)\n", + "f_sat = P_sat*(math.exp((B*P_sat)/(R*T)));\t\t\t#[Pa]\n", + "f_sat = f_sat*10**(-3);\t\t\t#[kPa]\n", + "\n", + "print \" 1).The fugacity of liquid benzene is %f kPa\"%(f_sat);\n", + "\n", + "#(2)\n", + "P = 2014.7;\t\t\t# [psia] - Total gauge pressure\n", + "P = 138.94;\t\t\t# [bar]\n", + "P = P*10**(5);\t\t\t# [Pa]\n", + "den = 0.63;\t\t\t# [g/cm**(3)] - density of benzene\n", + "den = den*10**(3);\t\t\t# [kg/m**(3)]\n", + "\n", + "# Therefore specific volume is \n", + "V = 1/den;\t\t\t#[m/**(3)/kg]\n", + "# Molar volume is given by\n", + "V = V*Mol_wt*10**(-3);\t\t\t#[m**(3)/mol]\n", + "\n", + "# Thus fugacity at 220 C and pressure P is given by \n", + "f = f_sat*(math.exp((V*(P-P_sat))/(R*T)));\n", + "\n", + "print \" 2).The fugacity of liquid benzene is %f kPa\"%(f);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The fugacity of liquid benzene is 1551.083216 kPa\n", + " 2).The fugacity of liquid benzene is 2228.386532 kPa\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.7 Page Number : 341" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "# C = -0.067 + 30.7/T\n", + "# D = 0.0012 - 0.416/T\n", + "\n", + "T = 80 + 273.15;\t\t\t#[K]\n", + "P = 30;\t\t\t#[bar]\n", + "#P = P;\t\t\t#[N/m**(2)]\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "\n", + "# Calculations\n", + "# We have the relation derived in the book\n", + "# d(G/(R*T)) = (V/(R*T))dP - (H/(R*T**(2)))dT\n", + "# Writing the same equation for ideal gas and subtracting it from the above equation we get\n", + "# d(G_R/(R*T)) = (V_R/(R*T))dP - (H_R/(R*T**(2)))dT\n", + "# Therefore, H_R/(R*T**(2)) = -[del((G_R)/(R*T))/del(T)]_P\n", + "\n", + "# Substituting the relation G_R/(R*T) = math.log(f/P), we get\n", + "# H_R/(R*T**(2)) = -[del(math.log(f/P))/del(T)]_P = -[del(-C*P - D*P**(2))/del(T)]_P\n", + "# or, H_R/(R*T**(2)) = P*(dC/dT) + P**(2)*dD/dT\n", + "# Note that in the above equation the partial derivative is replaced by full derivative as C and D are functions of temperature. Therfore we get\n", + "# H_R/(R*T**(2)) = (30.7*P)/T**(2) + (0.416*P**(2))/T**(2)\n", + "# H_R/R = - 30.7*P + 0.416*P**(2)\n", + "\n", + "# Substituting the given conditions we get\n", + "H_R = R*(-30.7*P + 0.416*P**(2));\t\t\t#[J/mol]\n", + "\n", + "# Results\n", + "print \" The molar enthalpy of the gas relative to that of the ideal gas at 80 C and 30 bar pressure is H_R = %f J/mol\"%(H_R);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The molar enthalpy of the gas relative to that of the ideal gas at 80 C and 30 bar pressure is H_R = -4544.432400 J/mol\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.8 Page Number : 341" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "# (1)\n", + "T = 311;\t\t\t#[K] - Temperature\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "# Pressure in 'bar' is given below\n", + "P = [0.690,1.380,2.760,5.520,8.280,11.034,13.800,16.550];\n", + "# Molar volume in 'm**(3)/mol' is given below\n", + "V = [0.0373,0.0186,0.00923,0.00455,0.00298,0.00220,0.00175,0.00144];\n", + "\n", + "# Z = 1 + (B/V) + (C/V**(2))\n", + "# (Z-1)*V = B + (C/V)\n", + "\n", + "from numpy import zeros\n", + "Z=zeros(8);\n", + "k=zeros(8);\n", + "t=zeros(8);\n", + "\n", + "# Calculations and Results\n", + "for i in range(8):\n", + " Z[i]=(P[i]*10**(5)*V[i])/(R*T);\n", + " k[i]=(Z[i]-1)*V[i];\n", + " t[i]=1./V[i];\n", + "\n", + "from scipy.stats import linregress\n", + "from numpy import array\n", + "t = array(t)\n", + "k = array(k)\n", + "C,B,c,d,e = linregress(t.T,k.T)\n", + "#[C,B,sig]=reglin(t',k');\n", + "\n", + "#From the regression, we get intercept = B and slope = C,and thus,\n", + "\n", + "print \" 1).The second virial coefficient of CO2 is given by B = %e m**3)/mol\"%(B);\n", + "print \" The thied virial coefficient of CO2 is given by C = %e m**6)/mol**2)\"%(C);\n", + "\n", + "# (2)\n", + "P_final = 13.8;\t\t\t#[bar]\n", + "\n", + "def f40(P): \n", + "\t return V-(R*T)/P\n", + "\n", + "# We know that R*T*math.log(f/P) = quad(f40,0,P)[0]\n", + "\n", + "# Therefore we have to plot V - (R*T)/P versus P and calculate the area beneath the curve from 0 to 13.8 bar\n", + "# For this we need the value of the term V - (R*T)/P at P = 0. At low pressure the virial equation becomes\n", + "# Z = 1 + (B/V)\n", + "#and V - (R*T)/P = (Z*R*T)/P - (R*T)/P = (1 + (B/V))*((R*T)/P) - (R*T)/P = (B*R*T)/(P*V) = (B/Z)\n", + "# Thus lim P tending to zero (V - (R*T)/P) = B ( as P tend to zero, Z tend to 1 ) \n", + "\n", + "P_prime = [0.000,0.690,1.380,2.760,5.520,8.280,11.034,13.800];\n", + "V_prime = [0.000,0.0373,0.0186,0.00923,0.00455,0.00298,0.00220,0.00175];\n", + "summation = 0;\n", + "x=zeros(8);\n", + "y=zeros(8);\n", + "z=zeros(8);\n", + "for j in range(2,8):\n", + " x[j]=V_prime[j]-(R*T)/(P_prime[j]*10**(5));\t\t\t#[m**(3)/mol]\n", + " y[j]=(x[j] + x[j-1])/2;\n", + " z[j]=y[j]*((P_prime[j]-P_prime[j-1]))*10**(5);\n", + " summation = summation + z[j] ;\t\t\t#[J/mol]\n", + "\n", + "summation = summation + 2*z[1] - z[1];\t\t\t# Because in the above calculation,in order to calculate the average a summation of z(2) is not included,only half of it gets added\n", + "\n", + "\n", + "def f41(P): \n", + "\t return V - (R*T)/P\n", + "\n", + "\t\t\t# Now we have, area = quad(f41,0,13.8*10**(5))[0]\n", + "\n", + "\t\t\t# R*T*math.log(f/P) = summation\n", + "f = P_final*(math.exp(summation/(R*T)));\t\t\t#[bar]\n", + "\n", + "\n", + "print \" 2).The fugacity of steam at 311 K and 13.8 bar pressure is %f bar\"%(f);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The second virial coefficient of CO2 is given by B = -1.515264e-04 m**3)/mol\n", + " The thied virial coefficient of CO2 is given by C = 5.618543e-08 m**6)/mol**2)\n", + " 2).The fugacity of steam at 311 K and 13.8 bar pressure is 12.892780 bar\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.9 Page Number : 344" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 0 + 273.15;\t\t\t#[K] - Temperature\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\t\t\t# Pressure in 'atm' is given below\n", + "P = [100,200,300,400,500,600,700,800,900,1000];\n", + "\t\t\t# The compressibility factor values are\n", + "Z = [1.069,1.138,1.209,1.283,1.356,1.431,1.504,1.577,1.649,1.720];\n", + "\n", + "# Z = 1 + (B/V) + (C/V**(2))\n", + "# (Z-1)*V = B + (C/V)\n", + "from numpy import zeros\n", + "\n", + "V = zeros(10);\n", + "k = zeros(10);\n", + "t = zeros(10);\n", + "\n", + "# Calculations and Results\n", + "for i in range(10):\n", + " V[i]=Z[i]*R*T/(P[i]*101325);\t\t\t#[m**(3)/mol]\n", + " k[i]=(Z[i]-1)*V[i];\n", + " t[i]=1/V[i];\n", + "\n", + "from scipy.stats import linregress\n", + "C,B,c,d,e = linregress(t,k)\n", + "\t\t\t#[C,B,sig]=reglin(t,k);\n", + "\n", + "\t\t\t#From the regression, we get intercept = B and slope = C,and thus,\n", + "\n", + "print \" 1).The second virial coefficient of H2 is given by B = %e m**3)/mol\"%(B);\n", + "print \" The thied virial coefficient of H2 is given by C = %e m**6)/mol**2)\"%(C);\n", + "\n", + "\t\t\t# (2)\n", + "\t\t\t# We know that, limit P tending to zero (V-(R*T)/P) = B, therfore P = 0, V-(R*T)/P = B\n", + "\n", + "def f42(P): \n", + "\t return V-(R*T)/P \t\t\t#and determine the integral integrate((V-(R*T)/P)\n", + "\n", + "\t\t\t# Now let us tabulate V-(R*T)/P and determine the integral quad(f42,0,1000)[0]\n", + "\n", + "\n", + "P_prime = [0,100,200,300,400,500,600,700,800,900,1000];\n", + "Z_prime = [0,1.069,1.138,1.209,1.283,1.356,1.431,1.504,1.577,1.649,1.720];\n", + "\n", + "summation = 0;\n", + "V_prime = zeros(11);\n", + "x = zeros(11);\n", + "y = zeros(11);\n", + "z = zeros(11);\n", + "for j in range(1,11):\n", + " V_prime[j]=Z_prime[j]*R*T/(P_prime[j]*101325);\t\t\t#[m**(3)/mol]\n", + " x[j]=V_prime[j]-(R*T)/(P_prime[j]*101325);\n", + " y[j]=(x[j] + x[j-1])/2;\n", + " z[j]=y[j]*((P_prime[j]-P_prime[j-1]))*101325;\n", + " summation = summation + z[j] ;\t\t\t#[J/mol]\n", + "\n", + "summation = summation + 2*z[1] - z[1];\t\t\t# Because in the above calculation,in order to calculate the average a summation of z(2) is not included,only half of it gets added\n", + "\n", + "\t\t\t# Now we have\n", + "\t\t\t# R*T*math.log(f/P) = summation\n", + "P_dash = 1000;\t\t\t#[atm] - Pressure at which fugacity is to be calculated\n", + "T_dash = 273.15;\t\t\t#[K] - Temperature at which fugacity is to be calculated\n", + "f = P_dash*math.exp(summation/(R*T_dash));\t\t\t#[atm] \n", + "\n", + "print \" 2).The fugacity of H2 at 0 C and 1000 atm pressure is f = %f atm\"%(f);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The second virial coefficient of H2 is given by B = 1.345242e-05 m**3)/mol\n", + " The thied virial coefficient of H2 is given by C = 5.286525e-10 m**6)/mol**2)\n", + " 2).The fugacity of H2 at 0 C and 1000 atm pressure is f = 2030.305169 atm\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.10 Page Number : 345" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "from scipy.optimize import fsolve \n", + "import math\n", + "from scipy.integrate import quad \n", + "\n", + "# Variables\n", + "P_1 = 1*10.**(6.);\t\t\t#[Pa] - Initial pressure\n", + "T_1 = 200. + 273.15;\t\t#[K] - Initial temperature\n", + "P_2 = 8*10.**(6);\t\t\t#[Pa] - Final pressure\n", + "Tc = 647.1;\t\t\t #[K] - Critical temperature of water\n", + "Pc = 220.55; \t\t\t#[bar] - Critical pressure of water\n", + "Pc = Pc*10**(5);\t\t\t#[Pa]\n", + "w = 0.345;\n", + "R = 8.314;\t\t \t#[J/mol*K] - Universal gas constant\n", + "\n", + "# For the virial gas the following are the relations for residual enthalpy and entropy\n", + "# H_R = B*P - P*T*(dB/dT) \n", + "# S_R = -P*(dB/dT)\n", + "# Where, (dB/dT) = ((R*Tc)/Pc)*((dB_0/dT) + w*(dB_1/dT))\n", + "# dB0_dT = 0.422*1.6*Tc**(1.6)*T**(-2.6);\t\t\t# (dB_0/dT)\n", + "# dB1_dT = 0.172*4.2*Tc**(4.2)*T**(-5.2);\t\t\t# (dB_1/dT)\n", + "\n", + "# (1)\n", + "Cp_0 = 29.114;\t\t\t#[J/mol-K] - Specific heat capacity at constant pressure\n", + "# For the isentropic process entropy change is zero, thus\n", + "# delta_S = Cp_0*math.log(T_2/T_1) - P_2*(dB/dT)_2 + P_1*(dB/dT)_1 = 0\n", + "\n", + "# Calculations\n", + "# At state 1, \n", + "Tr_1 = T_1/Tc;\n", + "B0_1 = 0.083 - 0.422/(Tr_1**(1.6));\n", + "B1_1 = 0.139 - 0.172/(Tr_1**(4.2));\n", + "# (B*Pc)/(R*Tc) = B0 + w*B1\n", + "B_1 = ((B0_1 + w*B1_1)*(R*Tc))/Pc;\t\t\t# [m**(3)/mol] - Second virial coefficient at state 1\n", + "dB0_dT_1 = 0.422*1.6*Tc**(1.6)*T_1**(-2.6);\t\t\t# (dB_0/dT)\n", + "dB1_dT_1 = 0.172*4.2*Tc**(4.2)*T_1**(-5.2);\t\t\t# (dB_1/dT)\n", + "dB_dT_1 = ((R*Tc)/Pc)*((dB0_dT_1) + w*(dB1_dT_1));\t\t\t# (dB/dT)_1\n", + "\n", + "# Now let us assume the exit temperature to be 870 K, at this temperature\n", + "# T_2 = 870;\t\t\t#[K] - \n", + "# At this temperature\n", + "# delta_S = Cp_0*math.log(T_2/T_1) - P_2*(dB/dT)_2 + P_1*(dB/dT)_1 = \n", + "\n", + "\n", + "T_2 = 860.;\t\t\t#[K] - Exit temperature\n", + "# Therefore at state 2, we have\n", + "Tr_2 = T_2/Tc;\n", + "B0_2 = 0.083 - 0.422/(Tr_2**(1.6));\n", + "B1_2 = 0.139 - 0.172/(Tr_2**(4.2));\n", + "# (B*Pc)/(R*Tc) = B0 + w*B1\n", + "B_2 = ((B0_2 + w*B1_2)*(R*Tc))/Pc;\t\t\t# [m**(3)/mol] - Second virial coefficient at state 2\n", + "dB0_dT_2 = 0.422*1.6*Tc**(1.6)*T_2**(-2.6);\t\t\t# (dB_0/dT)\n", + "dB1_dT_2 = 0.172*4.2*Tc**(4.2)*T_2**(-5.2);\t\t\t# (dB_1/dT)\n", + "dB_dT_2 = ((R*Tc)/Pc)*((dB0_dT_2) + w*(dB1_dT_2));\t\t\t# (dB/dT)_2\n", + "\n", + "delta_H_s = Cp_0*(T_2 - T_1) + B_2*P_2 -P_2*T_2*(dB_dT_2) - B_1*P_1 + P_1*T_1*(dB_dT_1);\t\t\t#[J/mol] - Enthalpy change\n", + "\n", + "# As no heat exchange is assumed to take place with the surroundings,work transfer is given by\n", + "W_1 = - delta_H_s;\t\t\t# [J/mol]\n", + "\n", + "# Results\n", + "print \" 1).The exit temperature is %f K\"%(T_2);\n", + "print \" The required amount of work is %f J/mol\"%(W_1);\n", + "\n", + "\n", + "# (2)\n", + "eff = 0.8;\t\t\t# Adiabatic efficiency\n", + "delta_H_a = delta_H_s/0.8;\t\t\t# Actual enthalpy change\n", + "\n", + "# Now for calculating the value of T_exit\n", + "# delta_H_a = Cp_0*(T_exit - T_1) + B*P_2 -P_2*T_exit*(dB_dT) - B_1*P_1 + P_1*T_1*(dB_dT_1)\n", + "# On simplification we get\n", + "# 29.114*(T_2 - T_1)*B_2*8*10**(6)-8*10**(6)*T_2*(dB/dT)_2 = 12643.77 \n", + "\n", + "# Let us assume a temperature of say\n", + "T = 900.;\t\t\t#[K]\n", + "fault=10.;\n", + "\n", + "def f(T_exit): \n", + "\t return delta_H_a - Cp_0*(T_exit - T_1) + B*P_2 -P_2*T_exit*(dB_dT) - B_1*P_1 + P_1*T_1*(dB_dT_1)\n", + "\t \n", + "while(fault>0.3):\n", + " Tr = T/Tc;\n", + " B0 = 0.083 - 0.422/(Tr**(1.6));\n", + " B1 = 0.139 - 0.172/(Tr**(4.2));\n", + " \t\t\t# (B*Pc)/(R*Tc) = B0 + w*B1\n", + " B = ((B0 + w*B1)*(R*Tc))/Pc;\t\t\t# [m**(3)/mol] - Second virial coefficient at state 2\n", + " dB0_dT = 0.422*1.6*Tc**(1.6)*T**(-2.6);\t\t\t# (dB_0/dT)\n", + " dB1_dT = 0.172*4.2*Tc**(4.2)*T**(-5.2);\t\t\t# (dB_1/dT)\n", + " dB_dT = ((R*Tc)/Pc)*((dB0_dT) + w*(dB1_dT));\t\t\t# (dB/dT)_1\n", + "\n", + " T_exit = fsolve(f,900)\n", + " fault=abs(T-T_exit);\n", + " T = T + 0.2;\n", + "\n", + "Texit = T;\n", + "\n", + "\t\t\t# As no heat exchange is assumed to take place with the surroundings,work transfer is given by\n", + "W_2 = - delta_H_a;\t\t\t# [J/mol]\n", + "\n", + "print \" 2).The exit temperature is %f K\"%(Texit);\n", + "print \" The required amount of work is %f J/mol\"%(W_2);\n", + "\n", + "\n", + "def f20(T): \n", + "\t return Cp_0/T\n", + "\n", + "T_prime = 700.;\t\t\t#[K]\n", + "fault1=10.;\n", + "\n", + "def f1(T_out): \n", + "\t return 32.2168*math.log(T_out) + 0.1922*10**(-2)*T_out + 0.5274*10**(-5) \\\n", + "\t *T_2**(2) - 1.1976*10**(-9)*T_out**(3)-8*10**(6)*dB_dT_prime -216.64\n", + "\n", + "while(fault1>0.5):\n", + " Tr_prime = T_prime/Tc;\n", + " B0_prime = 0.083 - 0.422/(Tr_prime**(1.6));\n", + " B1_prime = 0.139 - 0.172/(Tr_prime**(4.2));\n", + " B_prime = ((B0_prime + w*B1_prime)*(R*Tc))/Pc;\t\t\t# [m**(3)/mol] - Second virial coefficient at state 2\n", + " dB0_dT_prime = 0.422*1.6*Tc**(1.6)*T_prime**(-2.6);\t\t\t# (dB_0/dT)\n", + " dB1_dT_prime = 0.172*4.2*Tc**(4.2)*T_prime**(-5.2);\t\t\t# (dB_1/dT)\n", + " dB_dT_prime = ((R*Tc)/Pc)*((dB0_dT_prime) + w*(dB1_dT_prime));\t\t\t# (dB/dT)_1\n", + " T_out = fsolve(f1,10)\n", + " fault1=abs(T_prime-T_out);\n", + " T_prime = T_prime + 0.5;\n", + "\n", + "T_out = T_prime;\n", + "\n", + "# Now we have to calculate enthalpy change as W = -delta_H\n", + "\n", + "def f21(T): \n", + "\t return (7.7 + 0.04594*10**(-2.)*T + 0.2521*10**(-5.)*T**(2.) - 0.8587*10.**(-9.)*T**(3.))*4.184\n", + "\n", + "delta_H_3 = quad(f21,T_1,T_out)[0] + B_prime*P_2 - P_2*T_out*dB_dT_prime - B_1*P_1 + P_1*T_1*dB_dT_1\n", + "print T_1,T_out\n", + "\n", + "\n", + "W_3 = - delta_H_3;\t\t\t# [J/mol]\n", + "\n", + "print \" 3).The exit temperature is %f K\"%(T_out);\n", + "print \" The required amount of work is %f J/mol\"%(W_3);\n", + "\n", + "#(4)\n", + "n = 0.8;\t\t\t# Adiabatic efficiency\n", + "delta_H_a_4 = delta_H_3/n;\t\t\t#[J/mol]\n", + "W_4 = -delta_H_a_4;\t\t\t#[J/mol]\n", + "\n", + "\n", + "T_prime1 = 700.;\t\t\t#[K]\n", + "fault2=10.;\n", + "\n", + "def f2(T_2): \n", + "\t return 7.7*4.184*(T_2-T_1) + ((0.04594*4.184*10**(-2))/2)* \\\n", + "\t (T_2**(2)-T_1**(2)) + ((0.2521*4.184*10**(-5))/3)*(T_2**(3)-T_1**(3)) - \\\n", + "\t ((0.8587*4.184*10**(-9))/4)*(T_2**(4)-T_1**(4)) + B_prime1*8*10**(6) \\\n", + "\t - 8*10**(6)*T_2*dB_dT_prime1 + 191.7 + 496.81 - delta_H_a_4\n", + "\n", + "while(fault2>0.5):\n", + " Tr_prime1 = T_prime1/Tc;\n", + " B0_prime1 = 0.083 - 0.422/(Tr_prime1**(1.6));\n", + " B1_prime1 = 0.139 - 0.172/(Tr_prime1**(4.2));\n", + " \t\t\t# (B*Pc)/(R*Tc) = B0 + w*B1\n", + " B_prime1 = ((B0_prime1 + w*B1_prime1)*(R*Tc))/Pc;\t\t\t# [m**(3)/mol] - Second virial coefficient at state 2\n", + " dB0_dT_prime1 = 0.422*1.6*Tc**(1.6)*T_prime1**(-2.6);\t\t\t# (dB_0/dT)\n", + " dB1_dT_prime1 = 0.172*4.2*Tc**(4.2)*T_prime1**(-5.2);\t\t\t# (dB_1/dT)\n", + " dB_dT_prime1 = ((R*Tc)/Pc)*((dB0_dT_prime1) + w*(dB1_dT_prime1));\t\t\t# (dB/dT)_1\n", + " T_out1 = fsolve(f2,100)\n", + " fault2=abs(T_prime1-T_out1);\n", + " T_prime1 = T_prime1 + 0.5;\n", + "\n", + "T_out1 = T_prime1;\n", + "\n", + "print \" 4).The exit temperature is %f K\"%(T_out1);\n", + "print \" The required amount of work is %f J/mol\"%(W_4);\n", + "\n", + "\n", + "# answers are varies because of rounding error. please check it manually." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The exit temperature is 860.000000 K\n", + " The required amount of work is -10667.724150 J/mol\n", + " 2).The exit temperature is 916.600000 K\n", + " The required amount of work is -13334.655188 J/mol\n", + "473.15" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 755.5\n", + " 3).The exit temperature is 755.500000 K\n", + " The required amount of work is -9282.701079 J/mol\n", + " 4).The exit temperature is 809.500000 K" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " The required amount of work is -11603.376349 J/mol\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.11 Page Number : 348" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "Vol = 0.15;\t\t\t #[m**(3)] - Volume of the cylinder\n", + "P_1 = 100.;\t\t\t #[bar] - Initial pressure\n", + "P_1 = P_1*10**(5);\t\t#[Pa]\n", + "T_1 = 170.;\t\t\t #[K] - Initial temperature\n", + "n_withdrawn = 500.;\t\t#[mol] - Withdrawn number of moles\n", + "R = 8.314;\t\t \t#[J/mol*K] - Universal gas constant\n", + "\n", + "\n", + "# Calculations and Results\n", + "#(1)\n", + "Y = 1.4;\t\t\t# Coefficient of adiabatic expansion\n", + "n_total = (P_1*Vol)/(R*T_1);\t\t\t#[mol] - Total number of moles\n", + "n_2 = n_total - n_withdrawn;\t\t\t#[mol] - Left number of moles\n", + "V_1 = Vol/n_total;\t\t\t#[m**(3)/mol] - Molar volume at initial state.\n", + "# At final state\n", + "V_2 = Vol/n_2;\t\t\t#[m**(3)/mol] - Molar volume at final state\n", + "\n", + "# During duscharging P_1*V_1**(Y) = P_2*V_2**(Y), therefore\n", + "P_2_1 = P_1*((V_1/V_2)**(Y));\t\t\t#[Pa] - Final pressure\n", + "P_2_1 = P_2_1*10**(-5);\t\t\t#[bar]\n", + "T_2_1 = ((P_2_1*10**(5))*V_2)/R;\t\t\t#[K] - Final temperature\n", + "\n", + "print \" 1).The final temperature %f K\"%(T_2_1);\n", + "print \" The final pressure %f bar\"%(P_2_1);\n", + "\n", + "\n", + "def f53(T): \n", + "\t return Cp_0/T\n", + "\n", + "T_prime = 150;\t\t\t#[K]\n", + "error = 10;\n", + "while(error>1):\n", + " f_T = 18.886*math.log(T_prime) + 4.2*10**(-3)*T_prime - 92.4;\n", + " f_T_dash = 18.886/T_prime + 4.2*10**(-3);\n", + " T_new = T_prime - (f_T/f_T_dash);\n", + " error=abs(T_prime - T_new);\n", + " T_prime = T_new;\n", + "\n", + "T_2_2 = T_prime;\t\t\t#[K] - Final temperature\n", + "P_2_2 = ((n_2*R*T_2_2)/Vol)*10**(-5);\t\t\t#[bar] - Final pressure\n", + "\n", + "print \" 2).The final temperature %f K\"%(T_2_2);\n", + "print \" The final pressure %f bar\"%(P_2_2);\n", + "\n", + "#(3)\n", + "Tc = 126.2;\t\t\t#[K] - Critical temperature of nitrogen\n", + "Pc = 34.0;\t\t\t#[bar] - Critical pressure of nitrogen\n", + "Pc = Pc*10**(5);\t\t\t#[Pa]\n", + "w = 0.038;\t\t\t# Acentric factor\n", + "\n", + "\n", + "dB0_dT = 0.422*1.6*Tc**(1.6)*T_1**(-2.6);\t\t\t# (dB_0/dT) at state 1\n", + "dB1_dT = 0.172*4.2*Tc**(4.2)*T_1**(-5.2);\t\t\t# (dB_1/dT) at state 1\n", + "dB_dT = ((R*Tc)/Pc)*((dB0_dT) + w*(dB1_dT));\t\t\t# (dB/dT) at state 1\n", + "# The residual entropy at the initial state is given by \n", + "S_R_1 = -P_1*(dB_dT);\t\t\t#[J/mol-K]\n", + "\n", + "# Now let us calculate molar volume at initial state\n", + "Tr = T_1/Tc;\t\t\t# Reduced temperature\n", + "B_0 = 0.083-(0.422/(Tr)**(1.6));\n", + "B_1 = 0.139-(0.172/(Tr)**(4.2));\n", + "\n", + "#We know,(B*Pc)/(R*Tc) = B_0 + (w*B_1)\n", + "B = ((B_0+(w*B_1))*(R*Tc))/Pc;\t\t\t#[m**(3)/mol]\n", + "\n", + "V_1_3 = B + (R*T_1)/P_1;\t\t\t#[m**(3)/mol]\n", + "# Therefore number of moles in the initial state is\n", + "n_1_3 = Vol/V_1_3;\t\t\t#[mol]\n", + "# Therefore final number of moles is\n", + "n_2_3 = n_1_3 - n_withdrawn;\n", + "\n", + "# Therefore molar volume at final state is\n", + "V_2_3 = Vol/n_2_3;\t\t\t#[m**(3)/mol]\n", + "\n", + "# Now let us determine the relation between pressure and temperature in the final state\n", + "# P_2_3 = (R*T_2_3)/(V_2_3 - B_2)\n", + "#delta_S = 0, thus delta_S_ig + delta_S_R = 0\n", + "delta_S_R = - S_R_1;\n", + "\n", + "def f54(T): \n", + "\t return Cp_0/T\n", + "\n", + "\n", + "T_2_prime = 135;\t\t\t#[K]\n", + "delta = 0.1;\n", + "error = 10;\n", + "while(error>0.01):\n", + " T_r = T_2_prime/Tc;\t\t\t# Reduced temperature\n", + " B_0_3 = 0.083-(0.422/(T_r)**(1.6));\n", + " B_1_3 = 0.139-(0.172/(T_r)**(4.2));\n", + " B_3 = ((B_0_3+(w*B_1_3))*(R*Tc))/Pc;\t\t\t#[m**(3)/mol]\n", + " dB0_dT_3 = 0.422*1.6*Tc**(1.6)*T_2_prime**(-2.6);\t\t\t# (dB_0/dT)\n", + " dB1_dT_3 = 0.172*4.2*Tc**(4.2)*T_2_prime**(-5.2);\t\t\t# (dB_1/dT)\n", + " dB_dT_3 = ((R*Tc)/Pc)*((dB0_dT_3) + w*(dB1_dT_3));\t\t\t# (dB/dT)\n", + " P_2_3 = (R*T_2_prime)/(V_2_3 - B_3);\n", + " delta_S = 27.2*(math.log(T_2_prime/T_1)) + 4.2*10**(-3)*(T_2_prime - T_1) - R*(math.log(P_2_3/P_1)) - P_2_3*(dB_dT_3) + delta_S_R;\n", + " T_new = T_2_prime + delta;\n", + " error=abs(delta_S);\n", + " T_2_prime = T_new;\n", + "\n", + "T_2_3 = T_2_prime;\t\t\t#[K] - Final temperature\n", + "\t\t\t# Therefore at T_2_3\n", + "P_2_3 = P_2_3*10**(-5);\t\t\t#[bar] - Final pressure\n", + "\n", + "print \" 3).The final temperature %f K\"%(T_2_3);\n", + "print \" The final pressure %f bar\"%(P_2_3);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The final temperature 131.761821 K\n", + " The final pressure 40.991361 bar\n", + " 2).The final temperature 129.504151 K\n", + " The final pressure 40.288995 bar\n", + " 3).The final temperature 141.300000 K\n", + " The final pressure 57.079997 bar\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.12 Page Number : 351" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "P_1 = 80.;\t\t\t #[bar] - Initial pressure\n", + "P_1 = P_1*10.**(5);\t\t\t#[Pa]\n", + "T_1 = 300. + 273.15;\t\t#[T] - Initial temperature\n", + "P_2 = 40.;\t\t\t #[bar] - Final pressure\n", + "P_2 = P_2*10**(5);\t\t\t#[Pa]\n", + "T_2 = 300. + 273.15;\t\t#[K] - Final temperature\n", + "T_0 = 25. + 273.15;\t\t\t#[K] - Surrounding temperature\n", + "P_0 = 1.;\t\t\t #[atm] - Surrounding pressure\n", + "P_0 = P_0*101325;\t\t\t#[Pa]\n", + "Tc = 647.1;\t\t\t #[K]\n", + "Pc = 220.55;\t\t\t #[bar]\n", + "Pc = Pc*10.**(5);\t\t\t#[Pa]\n", + "R = 8.314;\t\t\t #[J/mol*K] - Universal gas constant\n", + "\n", + "\n", + "# Calculations\n", + "# For van der Walls equation of state\n", + "a = (27*R**(2)*Tc**(2))/(64*Pc);\t\t\t#[Pa-m**(6)/mol**(2)]\n", + "b = (R*Tc)/(8*Pc);\t\t\t#[m**(3)/mol]\n", + "\n", + "\n", + "def f(V): \n", + "\t return V**(3)-(b+(R*T_1)/P_1)*V**(2)+(a/P_1)*V-(a*b)/P_1\n", + "V_1_1=fsolve(f,0.1)\n", + "V_1_2=fsolve(f,10)\n", + "V_1_2=fsolve(f,100)\n", + "# The largest root is considered because of vapour\n", + "V_1 = V_1_1;\n", + "\n", + "U_R_1 = -a/V_1;\t\t\t#[J/mol] - Internal energy\n", + "H_R_1 = P_1*V_1 - R*T_1 - a/V_1;\t\t\t#[J/mol] - Enthalpy\n", + "S_R_1 = R*math.log((P_1*(V_1-b))/(R*T_1));\n", + "\n", + "def f1(V): \n", + "\t return V**(3)-(b+(R*T_2)/P_2)*V**(2)+(a/P_2)*V-(a*b)/P_2\n", + "V_2_1 = fsolve(f1,0.1)\n", + "V_2_2 = fsolve(f1,10)\n", + "V_2_3 = fsolve(f1,100)\n", + "V_2 = V_2_1;\n", + "\n", + "U_R_2 = -a/V_2;\t\t\t#[J/mol] - Internal energy\n", + "H_R_2 = P_2*V_2 - R*T_2 - a/V_2;\t\t\t#[J/mol] - Enthalpy\n", + "S_R_2 = R*math.log((P_2*(V_2-b))/(R*T_2));\n", + "\n", + "delta_U_R = U_R_2 - U_R_1;\t\t\t#\n", + "delta_H_R = H_R_2 - H_R_1;\t\t\t#\n", + "delta_S_R = S_R_2 - S_R_1;\t\t\t#\n", + "\n", + "delta_U_ig = 0;\t\t\t#[J/mol] - As temperature is constant\n", + "delta_H_ig = 0;\t\t\t#[J/mol] - As temperature is constant\n", + "delta_S_ig = - R*math.log(P_2/P_1);\t\t\t# [J/mol-K]\n", + "delta_U = delta_U_R + delta_U_ig;\t\t\t#[J/mol]\n", + "delta_H = delta_H_R + delta_H_ig;\t\t\t#[J/mol]\n", + "delta_S = delta_S_R + delta_S_ig;\t\t\t#[J/mol-K]\n", + "\n", + "\t\t\t# Change in exergy is given by\n", + "\t\t\t# delta_phi = phi_1 - phi_2 = U_1 - U_2 + P_0*(V_1 - _V_2) - T_0*(S_1 - S_2)\n", + "delta_phi = - delta_U + P_0*(V_1 - V_2) - T_0*(-delta_S);\t\t\t#[J/mol]\n", + "\n", + "# Results\n", + "print \" The change in internal energy is %f J/mol\"%(delta_U);\n", + "print \" The change in enthalpy is %f J/mol\"%(delta_H);\n", + "print \" The change in entropy is %f J/mol-K\"%(delta_S);\n", + "print \" The change in exergy is %f J/mol\"%(delta_phi);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The change in internal energy is 615.070900 J/mol\n", + " The change in enthalpy is 1053.220316 J/mol\n", + " The change in entropy is 6.930264 J/mol-K\n", + " The change in exergy is 1389.940735 J/mol\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.13 Page Number : 353" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T_1 = 500.;\t\t\t#[K] - Initial temperature\n", + "P_1 = 30.;\t\t\t#[atm] - Initial pressure\n", + "P_1 = P_1*101325;\t\t\t#[Pa]\n", + "P_2 = 1;\t\t\t#[atm] - Final pressure\n", + "P_2 = P_2*101325;\t\t\t#[Pa]\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\t\t\t# For chlorine\n", + "Tc = 417.2;\t\t\t#[K] - Critical temperature\n", + "Pc = 77.10;\t\t\t#[bar] - Critical pressure\n", + "Pc = Pc*10**(5);\t\t\t#[Pa]\n", + "\n", + "#Redlich Kwong equation of state,\n", + "a = (0.42748*(R**(2))*(Tc**(2.5)))/Pc;\t\t\t# [Pa*m**(6)*K**(1/2)/mol]\n", + "b = (0.08664*R*Tc)/Pc;\t\t\t# [m**(3)/mol]\n", + "\n", + "# Calculations\n", + "def f1(V): \n", + "\t return V**(3)-((R*T_1)/P_1)*V**(2)-((b**(2))+((b*R*T_1)/P_1)-(a/(T_1**(1./2)*P_1)))*V-(a*b)/(T_1**(1./2)*P_1)\n", + "V_1=fsolve(f1,1)\n", + "V_2=fsolve(f1,10)\n", + "V_3=fsolve(f1,100)\n", + "\n", + "V = V_1;\t\t\t#[m**(3)/mol]\n", + "\n", + "\n", + "Z = (P_1*V_1)/(R*T_1);\t\t\t#compressibility factor\n", + "\n", + "# The residual enthalpy at state 1 is given by\n", + "H_R_1 = (Z-1)*R*T_1 + ((3*a)/(2*b*T_1**(1./2)))*(math.log(V/(V+b)));\t\t\t#[J/mol]\n", + " \n", + "# Since chlorine is assumed to behave ideally under the final condition,therefore\n", + "H_R_2 = 0;\t\t\t# Residual enthalpy at state 2\n", + "delta_H_R = H_R_2 - H_R_1;\t\t\t#[J/mol] - Residual enthalpy change\n", + "# and since isothermal conditions are maintained, therfore\n", + "delta_H_ig = 0;\t\t\t# Enthalpy change under ideal condition\n", + "delta_H = delta_H_R + delta_H_ig;\t\t\t#[J/mol]\n", + "\n", + "# Results\n", + "print \" The change in enthalpy is given by delta_H = %f J/mol\"%(delta_H);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The change in enthalpy is given by delta_H = 1053.558471 J/mol\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.14 Page Number : 353" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "# Variables\n", + "Vol_1 = 0.1;\t\t\t#[m**(3)] - Initial volume of each compartment\n", + "n_1 = 400;\t\t\t#[mol] - Initial number of moles in compartment 1\n", + "V_1 = Vol_1/n_1;\t\t\t#[m**(3)/mol] - Molar volume at state 1\n", + "T_1 = 294;\t\t\t#[K]\n", + "Vol_2 = 0.2;\t\t\t#[m**(3)] - Final volume of the compartment after removing the partition.\n", + "n_2 = n_1;\t\t\t#[mol] - Number of moles remains the same\n", + "V_2 = Vol_2/n_2;\t\t\t#[m**(3)/mol] - Molar volume at state 2\n", + "\n", + "a = 0.1362;\t\t\t#[Pa-m**(6)/mol**(2)]\n", + "b = 3.215*10**(-5);\t\t\t#[m**(3)/mol]\n", + "Cv_0 = 12.56;\t\t\t#[J/mol-K] - Heat capacity in ideal gas state\n", + "\n", + "# Calculations\n", + "# For overall system q = 0, and no work is done, therefore delta_U = 0\n", + "# Therfore from the relation proved in part (1), we have\n", + "T_2 = T_1 + (a/Cv_0)*(1/V_2 - 1/V_1);\t\t\t#[K]\n", + "\n", + "# Results\n", + "print \" 2).The final temperatutre is %f K\"%(T_2)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 2).The final temperatutre is 272.312102 K\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.17 Page Number : 356" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "P_1 = 1*10**(6);\t\t\t#[Pa] - Initial pressure\n", + "T_1 = 200 + 273.15;\t\t\t#[K] - Initial temperature\n", + "P_2 = 8*10**(6);\t\t\t#[Pa]\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "Y = 1.4;\t\t\t# Index of expansion\n", + "Cp_0 = 29.114;\t\t\t#[J/mol-K]\n", + "\t\n", + "a = 0.55366;\t\t\t#[Pa-m**(6)/mol**(2)]\n", + "b = 3.049*10**(-5);\t\t\t#[m**(3)/mol]\n", + "\n", + "# Calculations\n", + "V_1 = 3.816*10**(-3);\t\t\t#[m**(3)/mol]\n", + "Z_1 = (P_1*V_1)/(R*T_1);\n", + "\n", + "T_2 = T_1*(P_2/P_1)**((Y-1)/Y);\t\t\t#[K]\n", + "\n", + "# At 8 MPa and T_2,\n", + "# The molar volume of steam following van der Walls equation of state (as reported in the book) is\n", + "V_2 = 8.41*10**(-4);\t\t\t#[m**(3)/mol]\n", + "# And the compressibility factor is \n", + "Z_2 = (P_2*V_2)/(R*T_2);\n", + "\n", + "# For van der Walls equation of state we know that\n", + "# delta_S_R/R = math.log(Z_2/Z_1) + math.log((V_2 - b)/V_2) - math.log((V_1 - b)/V_1)\n", + "delta_S_R = R*(math.log(Z_2/Z_1) + math.log((V_2 - b)/V_2) - math.log((V_1 - b)/V_1));\t\t\t#[J/mol]\n", + "\n", + "# delta_S_ig = Cp_0*math.log(T_2/T_1) - R*math.log(P_2/P_1)\n", + "# The entropy change is therefore\n", + "# delta_S = delta_S_ig + delta_S_R\n", + "# But during an isentropic process the total entropy change is zero\n", + "# Therefore we have to modify the exit temperature so that the entropy change is zero\n", + "\n", + "# Let us assume a temperature, say T = 870 K\n", + "# At 870 K the molar volume of steam following van der Walls equation of state (as reported in the book) is\n", + "# V_3 = 8.57*10**(-4);\t\t\t# [m**(3)/mol]\n", + "# Therefore\n", + "# Z_3 = (P_2*V_3)/(R*T_2);\n", + "# At this temperature,\n", + "# delta_S = Cp_0*math.log(T/T_1) - R*math.log(P_2/P_1) + R*(math.log(Z/Z_1) + R*math.log((V - b)/V) - R*math.log((V_1 - b)/V_1))\n", + "\n", + "T = 800;\t\t\t#[K]\n", + "fault=10;\n", + "\n", + "def f1(V): \n", + "\t return V**(3)-(b+(R*T)/P_2)*V**(2)+(a/P_2)*V-(a*b)/P_2\n", + "\t \n", + "def f2(T): \n", + "\t return Cp_0*math.log(T/T_1) - R*math.log(P_2/P_1) + R*(math.log(Z/Z_1) + R*(math.log((V - b)/V)) - R*(math.log((V_1 - b)/V_1)))\n", + "\n", + "\n", + "while(fault>0.3):\n", + " \t\t\t# At T and 8 MPa\n", + " V = fsolve(f1,1)\n", + " Z = (P_2*V)/(R*T);\n", + " \n", + " T_exit = fsolve(f2,0.1)\n", + " fault=abs(T-T_exit);\n", + " T = T + 0.5;\n", + "\n", + "Texit = T;\n", + "\n", + "# Now applying the first law to an adiabatic process we get\n", + "# W = - delta_H\n", + "\n", + "# For van der Walls gas the enthalpy change is given by\n", + "delta_H_s = Cp_0*(T_exit - T_1) + (Z - 1)*R*T_exit - a/V - (Z_1-1)*R*T_1 + a/V_1;\t\t\t#[J/mol]\n", + "W = - delta_H_s;\t\t\t#[J/mol]\n", + "\n", + "# Results\n", + "print \" 1).The exit temperature is %f K\"%(Texit);\n", + "print \" The work required is given by W = %f J/mol\"%(W);\n", + "\n", + "#(2)\n", + "eff = 0.8;\t\t\t# Adiabatic efficiency\n", + "delta_H_a = eff*delta_H_s;\t\t\t#[J/mol] - Actual enthalpy change\n", + "W_2 = - delta_H_a;\n", + "\n", + "\t\t\t# Let us assume a temperature, say\n", + "T_prime= 900;\t\t\t#[K]\n", + "fault1=10;\n", + "def f22(V): \n", + "\t return V**(3)-(b+(R*T_prime)/P_2)*V**(2)+(a/P_2)*V-(a*b)/P_2\n", + "\n", + "def f3(T_prime): \n", + "\t return Cp_0*(T_prime - T_1) + (Z_prime - 1)*R*T_prime - a/V_prime - 13230.49\n", + "\t \n", + "while(fault1>0.3):\n", + " \t\t\t# At T_prime and 8 MPa\n", + " V_prime=fsolve(f22,1)\n", + " Z_prime = (P_2*V_prime)/(R*T_prime);\n", + " T_exit1 = fsolve(f3,100)\n", + " fault1=abs(T_prime-T_exit1);\n", + " T_prime = T_prime + 0.2;\n", + "\n", + "Texit1 = T_prime;\n", + "\n", + "print \" 2).The exit temperature is %f K\"%(Texit1);\n", + "print \" The work required is given by W = %f J/mol\"%(W_2);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The exit temperature is 916.500000 K\n", + " The work required is given by W = -12195.093996 J/mol\n", + " 2).The exit temperature is 958.400000 K" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " The work required is given by W = -9756.075197 J/mol\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.19 Page Number : 359" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 100 + 273.15;\t\t\t#[K] - Temperature\n", + "Tc = 647.1;\t\t\t#[K] - Critical temperature of water\n", + "Pc = 220.55;\t\t\t#[bar] - Critical pressure of water\n", + "Pc = Pc*10**(5);\t\t\t#[Pa]\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "# Calculations\n", + "a = (27*R**(2)*Tc**(2))/(64*Pc);\t\t\t#[Pa-m**(6)/mol**(2)]\n", + "b = (R*Tc)/(8*Pc);\t\t\t#[m**(3)/mol]\n", + "\n", + "# The cubic form of van der Walls equation of state is given by,\n", + "# V**(3) - (b + (R*T)/P)*V**(2) + (a/P)*V - (a*b)/P = 0\n", + "\n", + "# For water vapour at 100 C under saturated conditions pressure is 1 atm, therefore\n", + "P = 1;\t\t\t#[atm]\n", + "P = P*101325;\t\t\t#[Pa]\n", + "\n", + "# At 100 C and 1 atm \n", + "def f(V): \n", + "\t return V**(3)-(b+(R*T)/P)*V**(2)+(a/P)*V-(a*b)/P\n", + "V_1 = fsolve(f,0.1)\n", + "V_1 = fsolve(f,10)\n", + "V_1 = fsolve(f,100)\n", + "V = V_1;\t\t\t#[m**(3)/mol]\n", + "\n", + "\n", + "f = P*(math.exp(math.log((R*T)/(P*(V-b))) + b/(V-b) - (2*a)/(R*T*V)));\t\t\t#[Pa]\n", + "f = f/101325;\t\t\t#[atm]\n", + "\n", + "# Results\n", + "print \" The molar volume is %f m**3)/mol\"%(V);\n", + "print \" The fugacity is %f atm\"%(f);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The molar volume is 0.030469 m**3)/mol\n", + " The fugacity is 0.995168 atm\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.20 Page Number : 359" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "P_1 = 6;\t\t\t#[bar] - Initial pressure\n", + "P_1 = P_1*10**(5);\t\t\t#[Pa]\n", + "T_1 = 100 + 273.15;\t\t\t#[T] - Initial temperature\n", + "P_2 = 12;\t\t\t#[bar] - Final pressure\n", + "P_2 = P_2*10**(5);\t\t\t#[Pa]\n", + "T_2 = 500 + 273.15;\t\t\t#[K] - Final temperature\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "Y = 1.126;\t\t\t# Index of expansion\n", + "Cp_0 = (R*Y)/(Y-1);\t\t\t#[J/mol-K]\n", + "\n", + "# For propane\n", + "Tc = 369.8;\t\t\t#[K]\n", + "Pc = 42.48;\t\t\t#[bar]\n", + "Pc = Pc*10**(5);\n", + "w = 0.152;\n", + "\n", + "# Calculations and Results\n", + "#(1)\n", + "# For van der Walls equation of state\n", + "a = (27*R**(2)*Tc**(2))/(64*Pc);\t\t\t#[Pa-m**(6)/mol**(2)]\n", + "b = (R*Tc)/(8*Pc);\t\t\t#[m**(3)/mol]\n", + "\n", + "# The cubic form of van der Walls equation of state is given by,\n", + "# V**(3) - (b + (R*T)/P)*V**(2) + (a/P)*V - (a*b)/P = 0\n", + "\n", + "# At state 1 (100 C and 6 bar) \n", + "def f(V): \n", + "\t return V**(3)-(b+(R*T_1)/P_1)*V**(2)+(a/P_1)*V-(a*b)/P_1\n", + "V_1_1 = fsolve(f,1)\n", + "V_1_2 = fsolve(f,10)\n", + "V_1_3 = fsolve(f,100)\n", + "# The largest root is considered because of molar volume of vapour phase is to determined\n", + "V_1 = V_1_1;\t\t\t#[m**(3)/mol]\n", + "# Thus compressibility factor is\n", + "Z_1 = (P_1*V_1)/(R*T_1);\t\t\t#compressibility factor\n", + "\n", + "H_R_1 = (Z_1 - 1)*R*T_1 - (a/V_1);\t\t\t# [J/mol]\n", + "S_R_1 = R*math.log((P_1*(V_1-b))/(R*T_1));\t\t\t# [J/mol-K]\n", + "\n", + "# At state 2 (500 C and 12 bar) \n", + "def f1(V): \n", + " return V**(3)-(b+(R*T_2)/P_2)*V**(2)+(a/P_2)*V-(a*b)/P_2\n", + "V_2_1 = fsolve(f1,1)\n", + "V_2_2 = fsolve(f1,10)\n", + "V_2_3 = fsolve(f1,100)\n", + "# The largest root is considered because of molar volume of vapour phase is to determined\n", + "V_2 = V_2_1;\t\t\t#[m**(3)/mol]\n", + "# Thus compressibility factor is\n", + "Z_2 = (P_2*V_2)/(R*T_2);\t\t\t#compressibility factor\n", + "\n", + "H_R_2 = (Z_2 - 1)*R*T_2 - (a/V_2);\t\t\t# [J/mol]\n", + "S_R_2 = R*math.log((P_2*(V_2-b))/(R*T_2));\t\t\t# [J/mol-K]\n", + "\n", + "# Ideal gas entropy change is given by\n", + "delta_S_ig = Cp_0*math.log(T_2/T_1) - R*math.log(P_2/P_1);\t\t\t#[J/mol-K]\n", + "# Entropy change is given by\n", + "delta_S = delta_S_ig + (S_R_2 - S_R_1);\t\t\t#[J/mol-k]\n", + "\n", + "# Ideal gas enthalpy change is given by\n", + "delta_H_ig = Cp_0*(T_2 - T_1);\t\t\t#[J/mol]\n", + "# Enthalpy change is given by\n", + "delta_H = delta_H_ig + (H_R_2 - H_R_1);\t\t\t#[J/mol]\n", + "\n", + "print \"1).The change in enthalpy is %f J/mol\"%(delta_H);\n", + "print \" The change in entropy is %f J/mol-K\"%(delta_S);\n", + "\n", + "#(2)\n", + "# Virial equation of state\n", + "\n", + "# At state 1 (372.15 K, 6 bar) let us calculate B and dB/dT\n", + "Tr = T_1/Tc;\t\t\t# Reduced temperature\n", + "B_0 = 0.083-(0.422/(Tr)**(1.6));\n", + "B_1 = 0.139-(0.172/(Tr)**(4.2));\n", + "\n", + "#We know,(B*Pc)/(R*Tc) = B_0 + (w*B_1)\n", + "B = ((B_0+(w*B_1))*(R*Tc))/Pc;\t\t\t#[m**(3)/mol]\n", + "dB0_dT = 0.422*1.6*Tc**(1.6)*T_1**(-2.6);\t\t\t# (dB_0/dT) at state 1\n", + "dB1_dT = 0.172*4.2*Tc**(4.2)*T_1**(-5.2);\t\t\t# (dB_1/dT) at state 1\n", + "dB_dT = ((R*Tc)/Pc)*((dB0_dT) + w*(dB1_dT));\t\t\t# (dB/dT) at state 1\n", + "\n", + "H_R_1_2 = B*P_1 - P_1*T_1*dB_dT;\t\t\t#[J/mol] - Residual enthalpy at state 1\n", + "S_R_1_2 = -P_1*(dB_dT);\t\t\t#[J/mol-K] - Residual entropy at state 1\n", + "\n", + "# At state 2 (773.15 K, 12 bar)\n", + "Tr_2 = T_2/Tc;\t\t\t# Reduced temperature\n", + "B_0_2 = 0.083-(0.422/(Tr_2)**(1.6));\n", + "B_1_2 = 0.139-(0.172/(Tr_2)**(4.2));\n", + "\n", + "#We know,(B*Pc)/(R*Tc) = B_0 + (w*B_1)\n", + "B_2 = ((B_0_2+(w*B_1_2))*(R*Tc))/Pc;\t\t\t#[m**(3)/mol]\n", + "dB0_dT_2 = 0.422*1.6*Tc**(1.6)*T_2**(-2.6);\t\t\t# (dB_0/dT) at state 1\n", + "dB1_dT_2 = 0.172*4.2*Tc**(4.2)*T_2**(-5.2);\t\t\t# (dB_1/dT) at state 1\n", + "dB_dT_2 = ((R*Tc)/Pc)*((dB0_dT_2) + w*(dB1_dT_2));\t\t\t# (dB/dT) at state 1\n", + "\n", + "H_R_2_2 = B_2*P_2 - P_2*T_2*dB_dT_2;\t\t\t#[J/mol] - Residual enthalpy at state 1\n", + "S_R_2_2 = -P_2*(dB_dT_2);\t\t\t#[J/mol-K] - Residual entropy at state 1\n", + "\n", + "delta_H_2 = delta_H_ig + (H_R_2_2 - H_R_1_2);\t\t\t#[J/mol]\n", + "delta_S_2 = delta_S_ig + (S_R_2_2 - S_R_1_2);\t\t\t#[J/mol]\n", + "\n", + "print \"2).The change in enthalpy is %f J/mol\"%(delta_H_2);\n", + "print \" The change in entropy is %f J/mol-K\"%(delta_S_2);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1).The change in enthalpy is 29798.211799 J/mol\n", + " The change in entropy is 48.649067 J/mol-K\n", + "2).The change in enthalpy is 29992.807365 J/mol\n", + " The change in entropy is 49.021724 J/mol-K\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.21 Page Number : 362" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "P = 2.76*10**(6);\t\t\t#[N/m**(2)] - Pressure\n", + "T = 310.93;\t\t\t#[K] - Temperature\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "# For n-butane\n", + "Tc = 425.18;\t\t\t#[K] - Critical temperature\n", + "Pc = 37.97;\t\t\t#[bar] - Critical pressure\n", + "Pc = Pc*10**(5);\t\t\t#[Pa]\n", + "w = 0.193;\n", + "den = 0.61;\t\t\t#[g/cm**(3)]\n", + "mol_wt = 58;\t\t\t#[g/mol] - Molecular weight of butane\n", + "\n", + "# Calculations and Results\n", + "# math.log(P_sat) = 15.7374 - 2151.63/(T-36.24)\n", + "P_sat = math.exp(15.7374 - 2151.63/(T-36.24));\t\t\t#[mm Hg]\n", + "P_sat = (P_sat/760)*101325;\t\t\t#[N/m**(2)]\n", + "\n", + "#(1)\n", + "# Let us determine the second virial coefficient at 310.93 K\n", + "Tr = T/Tc;\t\t\t# Reduced temperature\n", + "B_0 = 0.083-(0.422/(Tr)**(1.6));\n", + "B_1 = 0.139-(0.172/(Tr)**(4.2));\n", + "#We know,(B*Pc)/(R*Tc) = B_0 + (w*B_1)\n", + "B = ((B_0+(w*B_1))*(R*Tc))/Pc;\t\t\t#[m**(3)/mol]\n", + "\n", + "# Fugacity under saturated conditions is given by\n", + "# math.log(f_sat/P_sat) = (B*P_sat)/(R*T)\n", + "f_sat = P_sat*(math.exp((B*P_sat)/(R*T)));\t\t\t#[N/m**(2)]\n", + "\n", + "# The molar volume is given by\n", + "V_liq = (1/(den*1000))*(mol_wt/1000);\t\t\t#[m**(3)/mol]\n", + "\n", + "f = f_sat*math.exp(V_liq*(P-P_sat)/(R*T));\n", + "\n", + "print \" 1).The fugacity of n-butane is %e N/m**2)\"%(f);\n", + "\n", + "#(2)\n", + "# For van der Walls equation of state\n", + "a = (27*R**(2)*Tc**(2))/(64*Pc);\t\t\t#[Pa-m**(6)/mol**(2)]\n", + "b = (R*Tc)/(8*Pc);\t\t\t#[m**(3)/mol]\n", + "\n", + "# The cubic form of van der Walls equation of state is given by,\n", + "# V**(3) - (b + (R*T)/P)*V**(2) + (a/P)*V - (a*b)/P = 0\n", + "\n", + "# At 100 C and 1 atm \n", + "def f(V): \n", + " return V**(3)-(b+(R*T)/P)*V**(2)+(a/P)*V-(a*b)/P\n", + "V_1 = fsolve(f,0.1)\n", + "V_1 = fsolve(f,10)\n", + "V_1 = fsolve(f,100)\n", + "# The above equation has only 1 real root, other two roots are imaginary\n", + "V = V_1;\t\t\t#[m**(3)/mol]\n", + "\n", + "# math.log(f/P) = math.log((R*T)/(P*(V-b))) + b/(V-b) -(2*a)/(R*T*V)\n", + "f_2 = P*(math.exp(math.log((R*T)/(P*(V-b))) + b/(V-b) -(2*a)/(R*T*V)));\n", + "\n", + "print \" 2).The fugacity of n-butane is %e N/m**2)\"%(f_2);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The fugacity of n-butane is 3.293476e+05 N/m**2)\n", + " 2).The fugacity of n-butane is 8.997352e+05 N/m**2)\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.22 Page Number : 363" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 50+273.15;\t\t\t#[K] - Temperature\n", + "P = 25.*10**(3);\t\t\t#[Pa] - Pressure\n", + "y1 = 0.5;\t\t\t#[mol] - mole fraction of equimolar mixture\n", + "y2 = 0.5;\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "#For component 1 (methyl ethyl ketone)\n", + "Tc_1 = 535.5;\t\t\t#[K] - Critical temperature\n", + "Pc_1 = 41.5*10**(5);\t\t\t#[N/m**(2)] - Critical pressure\n", + "Vc_1 = 267.;\t\t\t#[cm**(3)/mol] - Critical volume\n", + "Zc_1 = 0.249;\t\t\t# Critical compressibility factor\n", + "w_1 = 0.323;\t\t\t# acentric factor\n", + "\n", + "#For component 2 (toluene)\n", + "Tc_2 = 591.8;\t\t\t#[K]\n", + "Pc_2 = 41.06*10**(5);\t\t\t#[N/m**(2)]\n", + "Vc_2 = 316.;\t\t\t#[cm**(3)/mol]\n", + "Zc_2 = 0.264;\n", + "w_2 = 0.262;\n", + "\n", + "# Calculations and Results\n", + "# For equation of state Z = 1 + B/V\n", + "#For component 1, let us calculate B and dB/dT\n", + "Tr_1 = T/Tc_1;\t\t\t#Reduced temperature\n", + "#At reduced temperature\n", + "B1_0 = 0.083-(0.422/(Tr_1)**(1.6));\n", + "B1_1 = 0.139-(0.172/(Tr_1)**(4.2));\n", + "#We know,(B*Pc)/(R*Tc) = B_0+(w*B_1)\n", + "B_11 = ((B1_0+(w_1*B1_1))*(R*Tc_1))/Pc_1;\t\t\t# [m**(3)/mol-K] \n", + "dB0_dT_1 = 0.422*1.6*Tc_1**(1.6)*T**(-2.6);\t\t\t# [m**(3)/mol-K] - (dB_0/dT)\n", + "dB1_dT_1 = 0.172*4.2*Tc_1**(4.2)*T**(-5.2);\t\t\t# [m**(3)/mol-K] - (dB_1/dT)\n", + "dB_dT_1 = ((R*Tc_1)/Pc_1)*((dB0_dT_1) + w_1*(dB1_dT_1));\t\t\t#[m**(3)/mol-K] - (dB/dT)_\n", + "\n", + "#Similarly for component 2\n", + "Tr_2 = T/Tc_2;\t\t\t#Reduced temperature\n", + "#At reduced temperature Tr_2,\n", + "B2_0 = 0.083 - (0.422/(Tr_2)**(1.6));\n", + "B2_1 = 0.139 - (0.172/(Tr_2)**(4.2));\n", + "B_22 = ((B2_0+(w_2*B2_1))*(R*Tc_2))/Pc_2;\t\t\t#[m**(3)/mol]\n", + "dB0_dT_2 = 0.422*1.6*Tc_2**(1.6)*T**(-2.6);\t\t\t# [m**(3)/mol-K] - (dB_0/dT)\n", + "dB1_dT_2 = 0.172*4.2*Tc_2**(4.2)*T**(-5.2);\t\t\t# [m**(3)/mol-K] - (dB_1/dT)\n", + "dB_dT_2 = ((R*Tc_2)/Pc_2)*((dB0_dT_2) + w_2*(dB1_dT_2));\t\t\t#[m**(3)/mol-K] - (dB/dT)_\n", + "\n", + "#For cross coeffcient, let us calculate B and dB/dT\n", + "Tc_12 = (Tc_1*Tc_2)**(1./2);\t\t\t#[K]\n", + "w_12 = (w_1 + w_2)/2.;\n", + "Zc_12 = (Zc_1 + Zc_2)/2;\n", + "Vc_12 = (((Vc_1)**(1./3) + (Vc_2)**(1./3))/2)**(3);\t\t\t#[cm**(3)/mol]\n", + "Vc_12 = Vc_12*10**(-6);\t\t\t#[m**(3)/mol]\n", + "Pc_12 = (Zc_12*R*Tc_12)/Vc_12;\t\t\t#[N/m**(2)]\n", + "\n", + "#Now we have,(B_12*Pc_12)/(R*Tc_12) = B_0+(w_12*B_1)\n", + "#where B_0 and B_1 are to be evaluated at Tr_12\n", + "Tr_12 = T/Tc_12;\n", + "#At reduced temperature Tr_12\n", + "B_0 = 0.083 - (0.422/(Tr_12)**(1.6));\n", + "B_1 = 0.139 - (0.172/(Tr_12)**(4.2));\n", + "B_12 = ((B_0 + (w_12*B_1))*R*Tc_12)/Pc_12;\t\t\t#[m**(3)/mol]\n", + "dB0_dT_12 = 0.422*1.6*Tc_12**(1.6)*T**(-2.6);\t\t\t# [m**(3)/mol-K] - (dB_0/dT)\n", + "dB1_dT_12 = 0.172*4.2*Tc_12**(4.2)*T**(-5.2);\t\t\t# [m**(3)/mol-K] - (dB_1/dT)\n", + "dB_dT_12 = ((R*Tc_12)/Pc_12)*((dB0_dT_12) + w_12*(dB1_dT_12));\t\t\t#[m**(3)/mol-K] - (dB/dT)_12\n", + "\n", + "#For the mixture\n", + "B = y1**(2)*B_11 + 2*y1*y2*B_12 + y2**(2)*B_22;\t\t\t#[m**(3)/moL]\n", + "\n", + "# The equation of state can be written as\n", + "# V**(2) - ((R*T)/P) - (B*R*T)/P = 0\n", + "# V**(2) - 0.1075*V + 1.737*10**(-4) = 0\n", + "def f(V): \n", + " return V**(2) - 0.1075*V + 1.737*10**(-4)\n", + "V1 = fsolve(f,0.1)\n", + "V2 = fsolve(f,1)\n", + "# We will consider the root which is near to R*T/P\n", + "V = V1;\n", + "# dB/dT = y_1**(2)*dB_11/dT + y_2**(2)*dB_22/dT + 2*y_1*y_2*dB_12/dT\n", + "dB_dT = y1**(2)*dB_dT_1 + y2**(2)*dB_dT_2 + 2*y1*y2*dB_dT_12;\t\t\t#[m**(3)/mol-K]\n", + "\n", + "# For equation of state Z = 1 + B/V\n", + "H_R = (B*R*T)/V - ((R*T**(2))/V)*dB_dT;\t\t\t#[J/mol]\n", + "\n", + "print \" 1).The value of H_R for the mixture using virial equation of state is %f J/mol\"%(H_R);\n", + "\n", + "#(2)\n", + "# For van der Walls equation of state \n", + "a_11 = (27*R**(2)*Tc_1**(2))/(64*Pc_1);\t\t\t#[Pa-m**(6)/mol**(2)]\n", + "a_22 = (27*R**(2)*Tc_2**(2))/(64*Pc_2);\t\t\t#[Pa-m**(6)/mol**(2)]\n", + "a_12 = (a_11*a_22)**(1./2);\n", + "b_1 = (R*Tc_1)/(8*Pc_1);\t\t\t#[m**(3)/mol]\n", + "b_2 = (R*Tc_2)/(8*Pc_2);\t\t\t#[m**(3)/mol]\n", + "\n", + "# For the mixture\n", + "a = y1**(2)*a_11 + y2**(2)*a_22 + 2*y1*y2*a_12;\t\t\t#[Pa-m**(6)/mol**(2)]\n", + "b = y1*b_1 + y2*b_2;\t\t\t#[m**(3)/mol]\n", + "\n", + "# From the cubic form of van der Walls equation of state\n", + "def f1(V): \n", + " return V**(3)-(b+(R*T)/P)*V**(2)+(a/P)*V-(a*b)/P\n", + "V2_1 = fsolve(f1,0.1)\n", + "V2_2 = fsolve(f1,10)\n", + "V2_3 = fsolve(f1,100)\n", + "# The largest root is considered\n", + "V_2 = V2_1;\n", + "\n", + "# The residual enthalpy is given by\n", + "H_R_2 = P*V_2 - R*T -a/V_2;\t\t\t#[J/mol]\n", + "\n", + "print \" 2).The value of H_R for the mixture using van der Walls equation of state is %f J/mol\"%(H_R_2);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The value of H_R for the mixture using virial equation of state is -151.289795 J/mol\n", + " 2).The value of H_R for the mixture using van der Walls equation of state is -38.476127 J/mol\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.23 Page Number : 366" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 320 + 273.15;\t\t\t#[K]\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "# For water\n", + "Tc = 647.1;\t\t\t#[K]\n", + "Pc = 220.55;\t\t\t#[bar]\n", + "Pc = Pc*10**(5);\t\t\t#[Pa]\n", + "\n", + "# The cubic form of Redlich Kwong equation of state is given by,\n", + "# V**(3) - ((R*T)/P)*V**(2) - ((b_1**(2)) + ((b_1*R*T)/P) - (a/(T**(1/2)*P))*V - (a*b)/(T**(1/2)*P) = 0\n", + "\n", + "# At 320 C and 70 bar pressure\n", + "P_1 = 70;\t\t\t#[bar]\n", + "P_1 = P_1*10**(5);\t\t\t#[Pa]\n", + "\n", + "# Calculations and Results\n", + "a = (0.42748*(R**(2))*(Tc**(2.5)))/Pc;\t\t\t#[Pa*m**(6)*K**(1/2)/mol]\n", + "b = (0.08664*R*Tc)/Pc;\t\t\t#[m**(3)/mol]\n", + "# Solving the cubic equation\n", + "def f1(V): \n", + " return V**(3)-((R*T)/P_1)*V**(2)-((b**(2))+((b*R*T)/P_1)-(a/(T**(1./2)*P_1)))*V-(a*b)/(T**(1./2)*P_1)\n", + "V1=fsolve(f1,1)\n", + "V2=fsolve(f1,10)\n", + "V3=fsolve(f1,100)\n", + "# The largest root is considered because at 320 C and 70 bar vapour phase exists.\n", + "V_1 = V1;\t\t\t#[m**(3)/mol]\n", + "# Thus compressibility factor is\n", + "Z_1 = (P_1*V_1)/(R*T);\n", + "\n", + "# For Redlich-Kwong equation of state\n", + "# math.log(f/P) = Z - 1 - math.log(V_1/(V_1-b)) + (a/(b*R*(T**(3/2))))*math.log(V/(V+b))\n", + "f_1 = P_1*(math.exp(Z_1-1-math.log(Z_1)+math.log(V_1/(V_1-b))+(a/(b*R*(T**(3./2))))*math.log(V_1/(V_1+b))));\t\t\t#[Pa]\n", + "f_1 = f_1*10**(-5);\t\t\t#[bar]\n", + "\n", + "print \" The fugacity of water vapour at 320 C and 70 bar pressure is %f bar\"%(f_1);\n", + "\n", + "# At 320 C and 170 bar pressure, we have\n", + "P_2 = 170;\t\t\t#[bar]\n", + "P_2 = P_2*10**(5);\t\t\t#[Pa]\n", + "\n", + "# Solving the cubic equation\n", + "def f2(V): \n", + " return V**(3)-((R*T)/P_2)*V**(2)-((b**(2))+((b*R*T)/P_2)-(a/(T**(1./2)*P_2)))*V-(a*b)/(T**(1./2)*P_2)\n", + "V4 = fsolve(f2,1)\n", + "V5 = fsolve(f2,10)\n", + "V6 = fsolve(f2,100)\n", + "# The above equation has only 1 real root,other two roots are imaginary. Therefore,\n", + "V_2 = V6;\t\t\t#[m**(3)/mol]\n", + "# Thus compressibility factor is\n", + "Z_2 = (P_2*V_2)/(R*T);\n", + "\n", + "# For Redlich-Kwong equation of state\n", + "# math.log(f/P) = Z - 1 - math.log(V_1/(V_1-b)) + (a/(b*R*(T**(3/2))))*math.log(V/(V+b))\n", + "f_2 = P_2*(math.exp(Z_2-1-math.log(Z_2)+math.log(V_2/(V_2-b))+(a/(b*R*(T**(3./2))))*math.log(V_2/(V_2+b))));\t\t\t#[Pa]\n", + "f_2 = f_2*10**(-5);\t\t\t#[bar]\n", + "\n", + "print \" The fugacity of water vapour at 320 C and 170 bar pressure is %f bar\"%(f_2);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The fugacity of water vapour at 320 C and 70 bar pressure is 60.456239 bar\n", + " The fugacity of water vapour at 320 C and 170 bar pressure is 101.590989 bar\n" + ] + }, + { + "output_type": "stream", + "stream": "stderr", + "text": [ + "/usr/lib/python2.7/dist-packages/scipy/optimize/minpack.py:227: RuntimeWarning: The iteration is not making good progress, as measured by the \n", + " improvement from the last ten iterations.\n", + " warnings.warn(msg, RuntimeWarning)\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.24 Page Number : 367" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "Vol = 0.057;\t\t\t#[m**(3)] - Volume of car tyre\n", + "P_1 = 300.;\t\t\t#[kPa] - Initial pressure\n", + "P_1 = P_1*10**(3);\t\t\t#[Pa]\n", + "T_1 = 300.;\t\t\t#[K] - Initial temperature\n", + "P_2 = 330.;\t\t\t#[kPa] - Finnal pressure\n", + "P_2 = P_2*10**(3);\t\t\t#[Pa]\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "Cv_0 = 21.;\t\t\t#[J/mol-K] - Heat capacity for air \n", + "\n", + "# For oxygen\n", + "Tc_O2 = 154.6;\t\t\t#[K] - Critical temperature\n", + "Pc_O2 = 50.43;\t\t\t#[bar] - Critical pressure\n", + "Pc_O2 = Pc_O2*10**(5);\t\t\t#[Pa]\n", + "y1 = 0.21;\t\t\t# - Mole fraction of oxygen\n", + "# For nitrogen\n", + "Tc_N2 = 126.2;\t\t\t#[K] - Critical temperature\n", + "Pc_N2 = 34.00;\t\t\t#[bar] - Critical pressure\n", + "Pc_N2 = Pc_N2*10**(5);\t\t\t#[Pa]\n", + "y2 = 0.79;\t\t\t# - Mole fraction of nitrogen\n", + "\n", + "# Calculations and Results\n", + "# (1)\n", + "# Assuming ideal gas behaviour. The volume remains the same,therefore,we get\n", + "# P_1/T_1 = P_2/T_2\n", + "T_2 = P_2*(T_1/P_1);\t\t\t#[K]\n", + "\n", + "n = (P_1*Vol)/(R*T_1);\t\t\t#[mol] - Number of moles\n", + "delta_U = n*Cv_0*(T_2-T_1);\t\t\t#[J]\n", + "\n", + "print \" 1).The change in internal energy for ideal gas behaviour) is %f J\"%(delta_U);\n", + "\n", + "#(2)\n", + "# For van der Walls equation of state \n", + "a_O2 = (27*R**(2)*Tc_O2**(2))/(64*Pc_O2);\t\t\t#[Pa-m**(6)/mol**(2)]\n", + "a_N2 = (27*R**(2)*Tc_N2**(2))/(64*Pc_N2);\t\t\t#[Pa-m**(6)/mol**(2)]\n", + "a_12 = (a_O2*a_N2)**(1./2);\n", + "b_O2 = (R*Tc_O2)/(8*Pc_O2);\t\t\t#[m**(3)/mol]\n", + "b_N2 = (R*Tc_N2)/(8*Pc_N2);\t\t\t#[m**(3)/mol]\n", + "\n", + "# For the mixture\n", + "a = y1**(2)*a_O2 + y2**(2)*a_N2 + 2*y1*y2*a_12;\t\t\t#[Pa-m**(6)/mol**(2)]\n", + "b = y1*b_O2 + y2*b_N2;\t\t\t#[m**(3)/mol]\n", + "\n", + "# From the cubic form of van der Walls equation of state\n", + "# At 300 K and 300 kPa,\n", + "def f1(V): \n", + " return V**(3)-(b+(R*T_1)/P_1)*V**(2)+(a/P_1)*V-(a*b)/P_1\n", + "V_1 = fsolve(f1,0.1)\n", + "V_2 = fsolve(f1,10)\n", + "V_3 = fsolve(f1,100)\n", + "# The above equation has only 1 real root, other two roots are imaginary\n", + "V = V_1;\t\t\t#[m**(3)/mol]\n", + "\n", + "# Now at P = 330 kPa and at molar volume V\n", + "# The van der Walls equation of state is\n", + "# (P + a/V**(2))*(V - b) = R*T\n", + "T_2_prime = ((P_2 + a/V**(2))*(V - b))/R;\t\t\t#[K]\n", + "n_prime = Vol/V;\t\t\t#[mol]\n", + "\n", + "# Total change in internal energy is given by\n", + "# delta_U_prime = n_prime*delta_U_ig + n_prime*(U_R_2 - U_R_1)\n", + "# delta_U_prime = n_prime*Cv_0*(T_2_prime - T_1) + n_prime*a(1/V_2 - 1/V_1);\n", + "# Since V_1 = V_2 = V, therefore\n", + "delta_U_prime = n_prime*Cv_0*(T_2_prime - T_1);\n", + "\n", + "print \" 2).The change in internal energy for van der Walls equation of state) is %f J\"%(delta_U_prime);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The change in internal energy for ideal gas behaviour) is 4319.220592 J\n", + " 2).The change in internal energy for van der Walls equation of state) is 4299.872282 J\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.25 Page Number : 369" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T_1 = 150 + 273.15;\t\t\t#[K] - Initial emperature\n", + "T_2 = T_1;\t\t\t# Isothermal process\n", + "P_1 = 100.*10**(3);\t\t\t#[Pa] - Initial pressure\n", + "P_2 = 450.*10**(3);\t\t\t#[Pa] - Final pressure\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "# For water\n", + "Tc = 647.1;\t\t\t#[K] - Critical temperature\n", + "Pc = 220.55;\t\t\t#[bar] - Critical pressure\n", + "Pc = Pc*10.**(5);\n", + "w = 0.345;\n", + "Mol_wt = 18.015;\t\t\t#[g/mol] - Molecular weight of water\n", + "Cp_0 = 4.18;\t\t\t#[J/mol-K] - Smath.tan(math.radiansard heat capacity of water\n", + "\n", + "# Calculations\n", + "# Both phases are superheated vapour phases because at 150 C the vapour pressure of steam is 4.67 bar and both operating pressures are below saturated pressure.\n", + "# In Peng-Robinson equation of state\n", + "m = 0.37464 + 1.54226*w - 0.26992*w**(2);\n", + "# At T_1 and P_1, we have\n", + "Tr = T_1/Tc;\n", + "alpha = (1 + m*(1 - Tr**(1./2)))**(2);\n", + "a = ((0.45724*(R*Tc)**(2))/Pc)*alpha;\t\t\t#[Pa*m**(6)/mol**(2)]\n", + "b = (0.07780*R*Tc)/Pc;\t\t\t#[m**(3)/mol]\n", + "\n", + "# Cubuc form of Peng-Robinson equation of stste is given by\n", + "# V**(3)+(b-(R*T)/P)*V**(2)-((3*b**(2))+((2*R*T*b)/P)-(a/P))*V+b**(3)+((R*T*(b**(2))/P)-((a*b)/P)=0;\n", + "# Solving the cubic equation\n", + "def f(V): \n", + " return V**(3)+(b-(R*T_1)/P_1)*V**(2)-((3*b**(2))+((2*R*T_1*b)/P_1)-(a/P_1))*V+b**(3)+((R*T_1*(b**(2)))/P_1)-((a*b)/P_1)\n", + "V1 = fsolve(f,-1)\n", + "V2 = fsolve(f,0)\n", + "V3 = fsolve(f,1)\n", + "#The largest root is for vapour phase,\n", + "#The largest root is only considered as the systemis gas\n", + "V_1 = V3;\t\t\t#[m**(3)/mol]\n", + "# Thus compressibility factor is\n", + "Z_1 = (P_1*V_1)/(R*T_1);\n", + "\n", + "# At T_2 and P_2, we have\n", + "# Cubuc form of Peng-Robinson equation of stste is given by\n", + "# V**(3)+(b-(R*T)/P)*V**(2)-((3*b**(2))+((2*R*T*b)/P)-(a/P))*V+b**(3)+((R*T*(b**(2))/P)-((a*b)/P)=0;\n", + "# Solving the cubic equation\n", + "def f1(V): \n", + " return V**(3)+(b-(R*T_2)/P_2)*V**(2)-((3*b**(2))+((2*R*T_2*b)/P_2)-(a/P_2))*V+b**(3)+((R*T_2*(b**(2)))/P_2)-((a*b)/P_2)\n", + "V4 = fsolve(f1,-1)\n", + "V5 = fsolve(f1,0)\n", + "V6 = fsolve(f1,1)\n", + "#The largest root is for vapour phase,\n", + "#The largest root is only considered as the systemis gas\n", + "V_2 = V6;\t\t\t#[m**(3)/mol]\n", + "# Thus compressibility factor is\n", + "Z_2 = (P_2*V_2)/(R*T_2);\n", + "\n", + "# In the Peng-Robinson equation of stste\n", + "# da/dT = -(a*m)/((alpha*T*Tc)**(1/2))\n", + "# The residual enthalpy is given by\n", + "# H_R = R*T*(Z-1) + (((T*(da_dT))-a)/(2*2**(1/2)*b))*math.log((Z+(1+2**(1/2)*((P*b)/(R*T))))/(Z+(1-2**(1/2)*((P*b)/(R*T)))))\n", + "\n", + "# At state 1\n", + "da_dT_1 = -(a*m)/((alpha*T_1*Tc)**(1./2));\t\t\t#[Pa*m**(6)/mol**(2)]\n", + "H_R_1 = R*T_1*(Z_1-1) + (((T_1*(da_dT_1))-a)/(2*(2**(1./2))*b))* \\\n", + "math.log((Z_1+(1+2**(1./2))*((P_1*b)/(R*T_1)))/(Z_1+(1-2**(1./2))*((P_1*b)/(R*T_1))));\n", + "\n", + "# At state 2\n", + "da_dT_2 = -(a*m)/((alpha*T_2*Tc)**(1/2.));\t\t\t#[Pa*m**(6)/mol**(2)]\n", + "H_R_2 = R*T_2*(Z_2-1) + (((T_2*(da_dT_2))-a)/(2*2**(1./2)* \\\n", + "b))*math.log((Z_2+(1+2**(1./2))*((P_2*b)/(R*T_1)))/(Z_2+(1-2**(1./2))*((P_2*b)/(R*T_1))));\n", + "\n", + "# Since the temperature is the same,therefore ideal gas change in enthalpy is zero and thus\n", + "delta_H = H_R_2 - H_R_1;\t\t\t#[J/mol]\n", + "delta_H = delta_H/Mol_wt;\t\t\t#[kJ/kg]\n", + "\n", + "# The residual entropy relation for a substance following Peng - Robinson equation of state ia\n", + "# S_R = R*math.log(Z - (P*b)/(R*T)) + (da_dT/(2*2**(1/2)*b))*math.log((Z+(1+2**(1/2))*((P*b)/(R*T)))/(Z+(1-2**(1/2))*((P*b)/(R*T))))\n", + "\n", + "# The residual entropy at state 1 is\n", + "S_R_1 = R*math.log(Z_1 - (P_1*b)/(R*T_1)) + (da_dT_1/(2*2**(1./2)*b))* \\\n", + "math.log((Z_1+(1+2**(1./2))*((P_1*b)/(R*T_1)))/(Z_1+(1-2**(1./2))*((P_1*b)/(R*T_1))));\n", + "\n", + "# The residual entropy at state 2 is\n", + "S_R_2 = R*math.log(Z_2 - (P_2*b)/(R*T_2)) + (da_dT_2/(2*2**(1./2)*b)) \\\n", + "*math.log((Z_2+(1+2**(1./2))*((P_2*b)/(R*T_2)))/(Z_2+(1-2**(1./2))*((P_2*b)/(R*T_2))));\n", + "\n", + "delta_S_R = S_R_2 - S_R_1;\t\t\t#[J/mol-K]\n", + "\n", + "# The ideal gas change in entropy is\n", + "delta_S_ig = Cp_0*math.log(T_2/T_1) - R*math.log(P_2/P_1);\t\t\t#[J/mol-K]\n", + "\n", + "# Therefore\n", + "delta_S = delta_S_R + delta_S_ig;\t\t\t#[J/mol-K]\n", + "\n", + "# Results\n", + "print \" The enthalpy change is given by delta_H = %f kJ/mol\"%(delta_H);\n", + "print \" The entropy change is given by delta_S = %f J/mol-K\"%(delta_S);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The enthalpy change is given by delta_H = -11.747722 kJ/mol\n", + " The entropy change is given by delta_S = -12.826050 J/mol-K\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.26 Page Number : 370" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Variables\n", + "Vol = 0.15;\t\t\t#[m**(3)]\n", + "T_1 = 170;\t\t\t#[K] - Initial emperature\n", + "P_1 = 100;\t\t\t#[bar] - Initial pressure\n", + "P_1 = P_1*10**(5);\t\t\t#[Pa]\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "# For nitrogen\n", + "Tc = 126.2;\t\t\t#[K] - Critical tempeature\n", + "Pc = 34;\t\t\t#[bar] - Critical pressure\n", + "Pc = Pc*10**(5);\t\t\t#[Pa]\n", + "w = 0.038;\n", + "# Cp_0 = 27.2+4.2*10**(-3)*T\n", + "\n", + "# Calculations and Results\n", + "#(1)\n", + "# For van der Walls equation of state\n", + "a = (27*R**(2)*Tc**(2))/(64*Pc);\t\t\t#[Pa-m**(6)/mol**(2)]\n", + "b = (R*Tc)/(8*Pc);\t\t\t#[m**(3)/mol]\n", + "\n", + "# The cubic form of van der Walls equation of state is given by,\n", + "# V**(3) - (b + (R*T)/P)*V**(2) + (a/P)*V - (a*b)/P = 0\n", + "# On simplification the equation changes to\n", + "# V**(3) - 1.799*10**(4)*V**(2) + 1.366*10**(-8)*V - 5.269*10**(-13) = 0\n", + "\n", + "# Solving the cubic equation \n", + "def f(V): \n", + " return V**(3)-1.799*10**(-4)*V**(2) + 1.366*10**(-8)*V - 5.269*10**(-13)\n", + "V1 = fsolve(f,1)\n", + "V2 = fsolve(f,10)\n", + "V3 = fsolve(f,100)\n", + "# The above equation has only 1 real root, other two roots are imagimnary\n", + "V_1 = V1;\t\t\t#[m**(3)/mol]\n", + "# Thus total number of moles is given by\n", + "n_1 = Vol/V_1;\t\t\t#[mol]\n", + "\n", + "# After 500 mol are withdrawn, the final number of moles is given by\n", + "n_2 = n_1 - 500;\t\t\t#[mol]\n", + "# Thus molar volume at final state is \n", + "V_2 = Vol/n_2;\t\t\t#[m**(3)/mol]\n", + "\n", + "# The ideal entropy change is guven by\n", + "\n", + "def f24(T): \n", + " return 27.2+4.2*10**(-3)*T\n", + "\n", + "# delta_S_ig = quad(f24,T_1,T_2) - R*math.log(P_2/P_1)[0]\n", + "\n", + "# The residual entropy change is given by\n", + "# delta_S_R = R*math.log((P_2*(V_2-b))/(R*T_2)) - R*math.log((P_1*(V_1-b))/(R*T_1)) \n", + "# delta_S = delta_S_ig = delta_S_R\n", + "\n", + "def f25(T): \n", + " return 27.2+4.2*10**(-3)*T\n", + "\n", + "# delta_S = quad(f25,T_1,T_2) + R*math.log((V_2-b)/(V_1-b))[0]\n", + "\n", + "# During discharging delta_S = 0, thus on simplification we get\n", + "# 18.886*math.log(T_2) + 4.2*10**(-3)*T_2 - 92.937 = 0\n", + "# Solving the above equation we get\n", + "def f1(T_2): \n", + " return 18.886*math.log(T_2) + 4.2*10**(-3)*T_2 - 92.937\n", + "T_2 = fsolve(f1,1)\n", + "\n", + "# Thus at T_2, \n", + "P_2 = (R*T_2)/(V_2-b) - a/V_2**(2);\t\t\t#[N/m**(2)]\n", + "P_2 = P_2*10**(-5);\t\t\t#[bar]\n", + "\n", + "print \" 1).The final temperature is %f K\"%(T_2);\n", + "print \" The final pressure is %f bar\"%(P_2);\n", + "\n", + "#(2)\n", + "# In Peng-Robinson equation of state\n", + "m = 0.37464 + 1.54226*w - 0.26992*w**(2);\n", + "# At T_1 and P_1, we have\n", + "Tr = T_1/Tc;\n", + "alpha = (1 + m*(1 - Tr**(1./2)))**(2);\n", + "a_2 = ((0.45724*(R*Tc)**(2))/Pc)*alpha;\t\t\t#[Pa*m**(6)/mol**(2)]\n", + "b_2 = (0.07780*R*Tc)/Pc;\t\t\t#[m**(3)/mol]\n", + "\n", + "# Cubuc form of Peng-Robinson equation of stste is given by\n", + "# V**(3)+(b-(R*T)/P)*V**(2)-((3*b**(2))+((2*R*T*b)/P)-(a/P))*V+b**(3)+((R*T*(b**(2))/P)-((a*b)/P)=0;\n", + "# Solving the cubic equation\n", + "def f2(V): \n", + " return V**(3)+(b_2-(R*T_1)/P_1)*V**(2)-((3*b_2**(2))+((2*R*T_1*b_2)/P_1)-(a_2/P_1))*V+b_2**(3)+((R*T_1*(b_2**(2)))/P_1)-((a_2*b_2)/P_1)\n", + "V4 = fsolve(f2,-1)\n", + "V5 = fsolve(f2,0)\n", + "V6 = fsolve(f2,0.006)\n", + "#The above equation has only 1 real root,the other two roots are imaginary\n", + "V_1_2 = V6;\t\t\t#[m**(3)/mol]\n", + "\n", + "# The number of moles in the initial state is given by\n", + "n_1_2 = Vol/V_1_2;\t\t\t#[mol]\n", + "# After 500 mol are withdrawn, the final number of moles is given by\n", + "n_2_2 = n_1_2 - 500;\t\t\t#[mol]\n", + "# Thus molar volume at final state is \n", + "V_2_2 = Vol/n_2_2;\t\t\t#[m**(3)/mol]\n", + "\n", + "# At the final state the relation between pressure and temperature is\n", + "# P_2_2 = (R*T_2_2)/(V_2_2-b_2) - a_2/V_2_2**(2)\n", + "# P_2_2 = 7.23*10**(4)*T_2 - 3.93*10**(7)*a_2\n", + "\n", + "# Now let us calculate the residual entropy at initial state\n", + "Z_1 = (P_1*V_1_2)/(R*T_1);\n", + "da_dT_1 = -(a*m)/((alpha*T_1*Tc)**(1./2));\t\t\t#[Pa*m**(6)/mol**(2)] - da/dT\n", + "\n", + "# The residual entropy change for Peng-Robinson equatiob of state is given by\n", + "# S_R = R*math.log(Z-(P*b)/(R*T)) + (da_dT/(2*2**(1/2)*b))*math.log((V+(1+2**(1/2))*b))/((V+(1-2**(1/2)*b))));\n", + "S_R_1 = R*(math.log(Z_1-(P_1*b_2)/(R*T_1))) + (da_dT_1/(2*2**(1.2)*b_2))*(math.log((V_1_2+(1+2**(1./2))*b_2)/(V_1_2+(1-2**(1./2))*b_2)));\n", + "\n", + "# The total entropy change is given by\n", + "# delta_S = delta_S_ig + delta_S_R\n", + "\n", + "def f26(T): \n", + " return 27.2+4.2*10**(-3)*T\n", + "\n", + "# where, delta_S_ig = quad(f26,T_1,T_2_2) - R*math.log(P_2_2/P_1)[0]\n", + "\n", + "# and, P_2_2 = (R*T_2_2)/(V_2_2-b_2) - a_2/V_2_2**(2)\n", + "# On simplification we get\n", + "# delta_S = 27.2*math.log(T_2_2-T_1) + 4.2*10**(-3)*(T_2_2-T_1) - R*math.log(P_2_2/P_1) + R*math.log(Z_2-(P_2_2*b)/(R*T_2_2)) + 6226*(da_dT_2) + 9.22\n", + "\n", + "# Now we have the determine the value of T_2_2 such that delta_S = 0\n", + "# Starting with a temperature of 150 K\n", + "T_prime = 100.;\t\t\t#[K]\n", + "error = 10.;\n", + "while(error>0.1):\n", + " Tr_prime = T_prime/Tc;\n", + " alpha_prime = (1 + m*(1 - Tr_prime**(1./2)))**(2);\n", + " a_prime = ((0.45724*(R*Tc)**(2))/Pc)*alpha_prime;\n", + " P_prime = 7.23*10**(4)*T_prime - 3.93*10**(7)*a_prime;\n", + " Z_prime = (P_prime*V_2_2)/(R*T_prime);\n", + " da_dT_prime = -(a_prime*m)/((alpha_prime*T_prime*Tc)**(1./2));\n", + " delta_S = 27.2*math.log(T_prime/T_1) + 4.2*10**(-3)*(T_prime-T_1) - R*math.log(P_prime/P_1) + R*math.log(Z_prime-((P_prime*b_2)/(R*T_prime))) + 6226*(da_dT_prime) + 9.22;\n", + " error=abs(delta_S);\n", + " T_prime = T_prime + 0.3;\n", + "\n", + "T_2_2 = T_prime;\t\t\t#[K] - Final temperature\n", + "P_2_2 = P_prime*10**(-5);\t\t\t#[bar] - Final pressure\n", + "\n", + "print \" 2).The final temperature is %f K\"%(T_2_2);\n", + "print \" The final pressure is %f bar\"%(P_2_2);\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The final temperature is 133.131844 K\n", + " The final pressure is 39.636659 bar\n", + " 2).The final temperature is 134.200000 K\n", + " The final pressure is 40.130674 bar\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.27 Page Number : 374" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 373.15;\t\t\t#[K]\n", + "Tc = 562.16;\t\t\t#[K]\n", + "Pc = 48.98;\t\t\t#[bar]\n", + "Pc = Pc*10**(5);\t\t\t#[Pa]\n", + "R = 8.314;\t\t\t#[J/mol-K] - Universal gas constant\n", + "\n", + "# The cubic form of Redlich Kwong equation of state is given by,\n", + "# V**(3) - ((R*T)/P)*V**(2) - ((b_1**(2)) + ((b_1*R*T)/P) - (a/(T**(1/2)*P))*V - (a*b)/(T**(1/2)*P) = 0\n", + "\n", + "# Calculations\n", + "a = (0.42748*(R**(2))*(Tc**(2.5)))/Pc;\t\t\t#[Pa*m**(6)*K**(1/2)/mol]\n", + "b = (0.08664*R*Tc)/Pc;\t\t\t#[m**(3)/mol]\n", + "\n", + "# At 373.15 K, let us assume the pressure to be 2.5 bar and under these conditions \n", + "P_1 = 2.5;\t\t\t#[bar]\n", + "P_1 = P_1*10**(5);\t\t\t#[bar]\n", + "\n", + "# Putting the values in Redlich Kwong equation of state, the equation becomes\n", + "# V**(3) - 0.0124*V**(2) + 8.326*10**(-6)*V - 7.74*10**(-10) = 0\n", + "# Solving the cubic equation\n", + "\n", + "def f(V): \n", + " return V**(3) - 0.0124*V**(2) + 8.326*10**(-6)*V - 7.74*10**(-10)\n", + "V1=fsolve(f,-9)\n", + "V2=fsolve(f,10)\n", + "V3=fsolve(f,0.1)\n", + "# The largest root and the smallest root is considered for liquid phase and vapour phase respectively.\n", + "V_liq = V1;\t\t\t#[m**(3)/mol] - Molar volume in liquid phase\n", + "V_vap = V3;\t\t\t#[m**(3)/mol] - Molar volume in vapour phase\n", + "\n", + "# Let us calculate the fugacity of vapour phase\n", + "# math.log(f_vap/P) = b/(V-b) + math.log((R*T)/(P*(V-b))) - (a/(R*T**(1.5)))*(1/(V+b) - (1/b)*math.log(V/(V+b)))\n", + "f_vap = P_1*math.exp(b/(V_vap-b) + math.log((R*T)/(P_1*(V_vap-b))) - (a/(R*T**(1.5)))*(1/(V_vap+b) - (1/b)*math.log(V_vap/(V_vap+b))));\t\t\t#[Pa]\n", + "\n", + "# Let us calculate the fugacity of the liquid phase\n", + "f_liq = P_1*math.exp(b/(V_liq-b) + math.log((R*T)/(P_1*(V_liq-b))) - (a/(R*T**(1.5)))*(1/(V_liq+b) - (1/b)*math.log(V_liq/(V_liq+b))));\n", + "\n", + "\n", + "# The two fugacities are not same; therefore another pressure is to be assumed. The new pressure is\n", + "P_new = P_1*(f_liq/f_vap);\t\t\t#[Pa]\n", + "\n", + "# At P_new\n", + "def f1(V): \n", + " return V**(3) - ((R*T)/P_new)*V**(2) - (b**(2) + ((b*R*T)/P_new) - a/(T**(1/2)*P_new))*V - (a*b)/(T**(1/2)*P_new)\n", + "V4=fsolve(f1,-9)\n", + "V5=fsolve(f1,10)\n", + "V6=fsolve(f1,0.1)\n", + "# The largest root and the smallest root is considered for liquid phase and vapour phase respectively.\n", + "V_liq_2 = V4;\t\t\t#[m**(3)/mol] - Molar volume in liquid phase\n", + "V_vap_2 = V6;\t\t\t#[m**(3)/mol] - Molar volume in vapour phase\n", + "\n", + "f_vap_prime = P_new*math.exp(b/(V_vap_2-b) + math.log((R*T)/(P_new*(V_vap_2-b))) - (a/(R*T**(1.5)))*(1/(V_vap_2+b) - (1/b)*math.log(V_vap_2/(V_vap_2+b))));\t\t\t#[Pa]\n", + "f_liq_prime = P_new*math.exp(b/(V_liq_2-b) + math.log((R*T)/(P_new*(V_liq_2-b))) - (a/(R*T**(1.5)))*(1/(V_liq_2+b) - (1/b)*math.log(V_liq_2/(V_liq_2+b))));\n", + "\n", + "# Since the fugacities of liquid and vapour phasesare almost same the assumed pressure may be taken as vapour pressure at 373.15 K\n", + "P_new = P_new*10**(-5);\t\t\t#[bar]\n", + "\n", + "# Results\n", + "print \" The vapour pressure of benzene using Redlich Kwong equation of state is %f bar\"%(P_new);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The vapour pressure of benzene using Redlich Kwong equation of state is 2.666995 bar\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.28 Page Number : 374" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 150 + 273.15;\t\t\t#[K]\n", + "Tc = 647.1;\t\t\t#[K]\n", + "Pc = 220.55;\t\t\t#[bar]\n", + "Pc = Pc*10**(5);\t\t\t#[Pa]\n", + "w = 0.345;\n", + "R = 8.314;\t\t\t#[J/mol-K] - Universal gas constant\n", + "\n", + "# Let us assume a pressure of 100 kPa.\n", + "P_1 = 100.*10**(3);\t\t\t#[Pa]\n", + "\n", + "# Calculations\n", + "# At 100 kPa and 423.15 K, from Peng-Robinson equation of stste \n", + "m = 0.37464 + 1.54226*w - 0.26992*w**(2);\n", + "Tr = T/Tc;\n", + "alpha = (1 + m*(1 - Tr**(1./2)))**(2);\n", + "a = ((0.45724*(R*Tc)**(2))/Pc)*alpha;\t\t\t#[Pa*m**(6)/mol**(2)]\n", + "b = (0.07780*R*Tc)/Pc;\t\t\t#[m**(3)/mol]\n", + "# Cubic form of Peng-Robinson equation of stste is given by\n", + "# V**(3)+(b-(R*T)/P)*V**(2)-((3*b**(2))+((2*R*T*b)/P)-(a/P))*V+b**(3)+((R*T*(b**(2))/P)-((a*b)/P)=0;\n", + "# Solving the cubic equation\n", + "def f(V): \n", + " return V**(3)+(b-(R*T)/P_1)*V**(2)-((3*b**(2))+((2*R*T*b)/P_1)-(a/P_1))*V+b**(3)+((R*T*(b**(2)))/P_1)-((a*b)/P_1)\n", + "V1 = fsolve(f,-1)\n", + "V2 = fsolve(f,0)\n", + "V3 = fsolve(f,1)\n", + "# The largest root and the smallest root is considered for liquid phase and vapour phase respectively.\n", + "V_liq = V1;\t\t\t#[m**(3)/mol] - Molar volume in liquid phase\n", + "V_vap = V3;\t\t\t#[m**(3)/mol] - Molar volume in vapour phase\n", + "\n", + "# The compressibility factor is given by\n", + "Z_vap = (P_1*V_vap)/(R*T);\t\t\t# For liquid phase\n", + "Z_liq = (P_1*V_liq)/(R*T);\t\t\t# For vapour phase\n", + "\n", + "# The math.expression for fugacity of Peng Robinson equation is\n", + "# math.log(f/P) = (Z-1) - math.log(Z-((P*b)/(R*T))) - (a/(2*2**(1/2)*b*R*T))*math.log((Z+(1+2**(1/2))*((P*b)/(R*T)))/((Z+(1-2**(1/2))*((P*b)/(R*T)))\n", + "# For vapour phase\n", + "f_P_vap = math.exp((Z_vap-1) - math.log(Z_vap-((P_1*b)/(R*T))) - (a/(2*2**(1./2)*b*R*T))*math.log((Z_vap+(1+2**(1./2))*((P_1*b)/(R*T)))/(Z_vap+(1-2**(1./2))*((P_1*b)/(R*T)))));\n", + "# For liquid phase\n", + "f_P_liq = math.exp((Z_liq-1) - math.log(Z_liq-((P_1*b)/(R*T))) - (a/(2*2**(1./2)*b*R*T))*math.log((Z_liq+(1+2**(1./2))*((P_1*b)/(R*T)))/(Z_liq+(1-2**(1./2))*((P_1*b)/(R*T)))));\n", + "\n", + "# Therefore f_liq/f_vap can be calculated as\n", + "fL_fV = (f_P_liq/f_P_vap);\n", + "\n", + "# The two values (f/P)_vap and (f/P)_vap are not same [ (f_P_liq/f_P_vap) >1 ]; therefore another pressure is to be assumed. The new pressure be\n", + "P_new = P_1*(f_P_liq/f_P_vap);\t\t\t#[Pa]\n", + "\n", + "# At P_new and 423.15 K, from Peng-Robinson equation of stste \n", + "\n", + "# V**(3)+(b-(R*T)/P)*V**(2)-((3*b**(2))+((2*R*T*b)/P)-(a/P))*V+b**(3)+((R*T*(b**(2))/P)-((a*b)/P)=0;\n", + "# Solving the cubic equation\n", + "def f(V): \n", + " return V**(3)+(b-(R*T)/P_new)*V**(2)-((3*b**(2))+((2*R*T*b)/P_new)-(a/P_new))*V+b**(3)+((R*T*(b**(2)))/P_new)-((a*b)/P_new)\n", + "V4 = fsolve(f,-1)\n", + "V5 = fsolve(f,0)\n", + "V6 = fsolve(f,1)\n", + "# The largest root and the smallest root is considered for liquid phase and vapour phase respectively.\n", + "V_liq_2 = V4;\t\t\t#[m**(3)/mol] - Molar volume in liquid phase\n", + "V_vap_2 = V6;\t\t\t#[m**(3)/mol] - Molar volume in vapour phase\n", + "\n", + "# The compressibility factor is given by\n", + "Z_vap_2 = (P_new*V_vap_2)/(R*T);\t\t\t# For liquid phase\n", + "Z_liq_2 = (P_new*V_liq_2)/(R*T);\t\t\t# For vapour phase\n", + "\n", + "# For vapour phase\n", + "f_P_vap_2 = math.exp((Z_vap_2-1) - math.log(Z_vap_2-((P_new*b)/(R*T))) - (a/(2*2**(1./2)*b*R*T))*math.log((Z_vap_2+(1+2**(1./2))*((P_new*b)/(R*T)))/(Z_vap_2+(1-2**(1./2))*((P_new*b)/(R*T)))));\n", + "# For liquid phase\n", + "f_P_liq_2 = math.exp((Z_liq_2-1) - math.log(Z_liq_2-((P_new*b)/(R*T))) - (a/(2*2**(1./2)*b*R*T))*math.log((Z_liq_2+(1+2**(1./2))*((P_new*b)/(R*T)))/(Z_liq_2+(1-2**(1./2))*((P_new*b)/(R*T)))));\n", + "\n", + "# Therefore f_liq/f_vap can be calculated as\n", + "fL_fV_2 = (f_P_liq_2/f_P_vap_2);\n", + "\n", + "# And new pressure is given by\n", + "P_new_prime = P_new*(f_P_liq_2/f_P_vap_2);\t\t\t#[Pa]\n", + "P_new_prime = P_new_prime*10**(-5);\n", + "\n", + "# Since the change in pressure is small, so we can take this to be the vapour pressure at 150 C\n", + "\n", + "# Results\n", + "print \" The vapour pressure of water using Peng-Robinson equation of stste is %f bar\"%(P_new_prime);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The vapour pressure of water using Peng-Robinson equation of stste is 4.675976 bar\n" + ] + } + ], + "prompt_number": 24 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch11_1-checkpoint.ipynb b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch11_1-checkpoint.ipynb new file mode 100644 index 00000000..79f48f9c --- /dev/null +++ b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch11_1-checkpoint.ipynb @@ -0,0 +1,331 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:ea5fa2ce45062851dc4892fcc5b621c33d72fa0443d476b1ef4133dade9e39b0" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 11 : Properties of a Component in a Mixture" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.1 Page Number : 385" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "\n", + "# Variables\n", + "Vol_total = 3;\t\t\t#[m**(3)] - Total volume of solution\n", + "x_ethanol = 0.6;\t\t\t#Mole fraction of ethanol\n", + "x_water = 0.4;\t\t\t#Mole fraction of water\n", + "\n", + "# Calculations\n", + "#The partial molar volumes of the components in the mixture are\n", + "V_ethanol_bar = 57.5*10**(-6);\t\t\t#[m**(3)/mol]\n", + "V_water_bar = 16*10**(-6);\t\t\t#[m**(3)/mol]\n", + "\n", + "#The molar volumes of the pure components are\n", + "V_ethanol = 57.9*10**(-6);\t\t\t#[m**(3)/mol]\n", + "V_water = 18*10**(-6);\t\t\t#[m**(3)/mol]\n", + "\n", + "#The molar volume of the solution is\n", + "V_sol = x_ethanol*V_ethanol_bar + x_water*V_water_bar;\t\t\t#[m**(3)/mol]\n", + "#Total number of moles can be calculated as \n", + "n_total = Vol_total/V_sol;\t\t\t#[mol]\n", + "\n", + "#Moles of the components are\n", + "n_ethanol = n_total*x_ethanol;\t\t\t#[mol]\n", + "n_water = n_total*x_water;\t\t\t#[mol]\n", + "\n", + "#Finally the volume of the pure components required can be calculated as\n", + "Vol_ethanol = V_ethanol*n_ethanol;\n", + "Vol_water = V_water*n_water;\n", + "\n", + "# Results\n", + "print \"Required volume of ethanol is %f cubic metre\"%(Vol_ethanol);\n", + "print \"Required volume of water is %f cubic metre\"%(Vol_water);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Required volume of ethanol is 2.548166 cubic metre\n", + "Required volume of water is 0.528117 cubic metre\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.2 Page Number : 385" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 25+273.15;\t\t\t#[K] - Temperature\n", + "P = 1;\t\t\t#[atm]\n", + "#Component 1 = water\n", + "#component 2 = methanol\n", + "a = -3.2;\t\t\t#[cm**(3)/mol] - A constant\n", + "V2 = 40.7;\t\t\t#[cm**(3)/mol] - Molar volume of pure component 2 (methanol)\n", + "#V1_bar = 18.1 + a*x_2**(2)\n", + "\n", + "# Calculations and Results\n", + "#From Gibbs-Duhem equation at constant temperature and pressure we have\n", + "#x_1*dV1_bar + x_2*dV2_bar = 0\n", + "#dV2_bar = -(x_1/x_2)*dV1_bar = -(x_1/x_2)*a*2*x_2*dx_2 = -2*a*x_1*dx_2 = 2*a*x_1*dx_1\n", + "\n", + "#At x_1 = 0: x_2 = 1 and thus V2_bar = V2\n", + "#Integrating the above equation from x_1 = 0 to x_1 in the RHS, and from V2_bar = V2 to V2 in the LHS, we get\n", + "#V2_bar = V2 + a*x_1**(2) - Molar volume of component 2(methanol) in the mixture \n", + "\n", + "print \"The expression for the partial molar volume of methanol2 isV2_bar = V2 + a*x_1**2 [cm**3/mol]\";\n", + "\n", + "#At infinite dilution, x_2 approach 0 and thus x_1 approach 1, therefore\n", + "x_1 = 1;\t\t\t# Mole fraction of component 1(water) at infinite dilution\n", + "V2_bar_infinite = V2 + a*(x_1**(2));\t\t\t#[cm**(3)/mol]\n", + "\n", + "print \"The partial molar volume of methanol at infinite dilution is %f cm**3/mol\"%(V2_bar_infinite);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The expression for the partial molar volume of methanol2 isV2_bar = V2 + a*x_1**2 [cm**3/mol]\n", + "The partial molar volume of methanol at infinite dilution is 37.500000 cm**3/mol\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.4 Page Number : 387" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "#H = a*x_1 + b*x_2 +c*x_1*x_2\n", + "\n", + "#The values of the constants are\n", + "a = 15000;\t\t\t#[J/mol]\n", + "b = 20000;\t\t\t#[J/mol]\n", + "c = -2000;\t\t\t#[J/mol]\n", + "\n", + "# Calculations and Results\n", + "#(1)\n", + "#Enthalpy of pure component 1 = H1 is obtained at x_2 = 0, thus \n", + "x_2 = 0;\n", + "x_1 = 1;\n", + "H1 = a*x_1 + b*x_2 +c*x_1*x_2;\t\t\t#[J/mol]\n", + "print \"a).The enthalpy of pure component 1 is %f J/mol\"%(H1);\n", + "\n", + "#Similarly for component 2,\n", + "#Enthalpy of pure component 2 = H2 is obtained at x_1 = 0, thus \n", + "x_1_prime = 0;\n", + "x_2_prime = 1;\n", + "H2 = a*x_1_prime + b*x_2_prime +c*x_1_prime*x_2_prime;\t\t\t#[J/mol]\n", + "print \" The enthalpy of pure component 2 is %f J/mol\"%(H2);\n", + "\n", + "#(b)\n", + "#This part involves proving a relation in which no mathematics and no calculations are involved.\n", + "#For prove refer to this example 11.4 on page number 387 of the book.\n", + "\n", + "#(c)\n", + "#From part (b), we have the relation\n", + "#H1_bar = a + c*(x_2**(2))\n", + "#H2_bar = b + c*(x_1**(2))\n", + "\n", + "#For enthalpy of component 1 at infinite dilution, x_1 approach 0 and thus x_2 approach 1, therefore\n", + "x_1_c = 0;\n", + "x_2_c = 1;\n", + "H1_infinite = a + c*(x_2_c**(2));\t\t\t#[cm**(3)/mol]\n", + "print \"C).The enthalpy of componenet 1 at infinite dilution at x_1 = 0) is %f J/mol\"%(H1_infinite);\n", + "\n", + "#At x_1 = 0.2\n", + "x_1_c1 = 0.2;\n", + "x_2_c1 = 0.8;\n", + "H1_bar_c1 = a + c*(x_2_c1**(2));\t\t\t#[J/mol]\n", + "print \" The enthalpy of componenet 1 at at x_1 = 0.2) is %f J/mol\"%(H1_bar_c1);\n", + "\n", + "#At x_1 = 0.8\n", + "x_1_c2 = 0.8;\n", + "x_2_c2 = 0.2;\n", + "H1_bar_c2 = a + c*(x_2_c2**(2));\t\t\t#[J/mol]\n", + "print \" The enthalpy of componenet 1 at at x_1 = 0.8) is %f J/mol\"%(H1_bar_c2);\n", + "\n", + "#As x_1 increases, 'H1_bar' approaches the value of 'H1' \n", + "\n", + "#(d)\n", + "#This part involves proving a relation in which no mathematics and no calculations are involved.\n", + "#For prove refer to this example 11.4 on page number 387 of the book.\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a).The enthalpy of pure component 1 is 15000.000000 J/mol\n", + " The enthalpy of pure component 2 is 20000.000000 J/mol\n", + "C).The enthalpy of componenet 1 at infinite dilution at x_1 = 0) is 13000.000000 J/mol\n", + " The enthalpy of componenet 1 at at x_1 = 0.2) is 13720.000000 J/mol\n", + " The enthalpy of componenet 1 at at x_1 = 0.8) is 14920.000000 J/mol\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.9 Page Number : 395" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "n = 1*10**(3);\t\t\t#[mol] - No of moles\n", + "P = 0.1;\t\t\t#[MPa] - Pressure of the surrounding\n", + "T = 300;\t\t\t#[K] - Temperature of the surrounding\n", + "x_1 = 0.79;\t\t\t#Mole fraction of N2 in the air\n", + "x_2 = 0.21;\t\t\t#Mole fraction of O2 in the air\n", + "R=8.314;\t\t\t#[J/mol*K]\n", + "\n", + "# Calculations\n", + "#Change in availability when x_1 moles of component 1 goes from pure state to that in the mixture is\n", + "#x_1*(si_1 - si_2) = x_1*[H1 - H1_bar - T_0*(S1 - S1_bar)]\n", + "#Similarly change in availability of x_2 moles of component 2 is\n", + "#x_2*(si_1 - si_2) = x_2*[H2 - H2_bar - T_0*(S2 - S2_bar)]\n", + "\n", + "#and thus total availability change when 1 mol of mixture is formed from x_1 mol of component 1 and x_2 mol of component 2 is equal to reversible work\n", + "#W_rev = x_1*[H1 - H1_bar - T_0*(S1 - S1_bar)] + x_2*[H2 - H2_bar - T_0*(S2 - S2_bar)]\n", + "#W_rev = -[x_1*(H1_bar - H1) + x_2*(H2_bar - H2)] + T_0*[x_1*(S1_bar - S1) + x_2*(S2_bar - S2)]\n", + "#W_rev = -[delta_H_mix] +T_0*[delta_S_mix]\n", + "\n", + "#If T = T_0 that is,temperature of mixing is same as that of surroundings, W_rev = -delta_G_mix.\n", + "#W_rev = -delta_G_mix = R*T*(x_1*math.log(x_1) + x_2*math.log(x_2))\n", + "W_rev = R*T*(x_1*math.log(x_1) + x_2*math.log(x_2));\t\t\t#[J/mol]\n", + "\n", + "#Therefore total work transfer is given by\n", + "W_min = (n*W_rev)/1000;\t\t\t#[kJ]\n", + "\n", + "# Results\n", + "print \"The minimum work required is %f kJ\"%(W_min);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The minimum work required is -1281.910728 kJ\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.10 Page Number : 400" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "x_A = 0.20;\t\t\t# Mole fraction of A\n", + "x_B = 0.35;\t\t\t# Mole fraction of B\n", + "x_C = 0.45;\t\t\t# Mole fraction of C\n", + "\n", + "phi_A = 0.7;\t\t\t# Fugacity coefficient of A\n", + "phi_B = 0.6;\t\t\t# Fugacity coefficient of B\n", + "phi_C = 0.9;\t\t\t# Fugacity coefficient of C\n", + "\n", + "P = 6.08;\t\t\t#[MPa] - Pressure\n", + "T = 384;\t\t\t#[K] - Temperature\n", + "\n", + "# Calculations\n", + "#We know that\n", + "#math.log(phi) = x_1*math.log(phi_) + x_2*math.log(phi_2) + x_3*math.log(phi_3)\n", + "math.log_phi = x_A*math.log(phi_A) + x_B*math.log(phi_B) + x_C*math.log(phi_C);\t\t\t# Fugacity coefficient\n", + "phi = math.exp(math.log_phi);\n", + "\n", + "#Thus fugacity is given by,\n", + "f_mixture = phi*P;\t\t\t#[MPa]\n", + "\n", + "# Results\n", + "print \"The fugacity of the mixture is %f MPa\"%(f_mixture);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The fugacity of the mixture is 4.515286 MPa\n" + ] + } + ], + "prompt_number": 5 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch12_1-checkpoint.ipynb b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch12_1-checkpoint.ipynb new file mode 100644 index 00000000..0ee70a67 --- /dev/null +++ b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch12_1-checkpoint.ipynb @@ -0,0 +1,503 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:acb0234cca7ef04cf2e231ae1d04809101d746587fbd14cf847d456347c563ea" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 12 : Partial Molar Volume and Enthalpy from Experimental Data " + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.1 Page Number : 419" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "import math \n", + "from numpy import *\n", + "\n", + "\n", + "# Variables\n", + "T = 0 + 273.15;\t\t\t#[K] - Temperature\n", + "P = 1;\t\t\t#[atm] - Pressure\n", + "x_methanol = 0.5;\t\t\t#Mole fraction of methanol at which molar volume is to be calculated\n", + "x_water = 0.5;\t\t\t#Mole fraction at which molar volume is to be calculated\n", + "\n", + "#V = V1 at x1 = 1 and V = V2 at x1 = 0, therefore\n", + "V1 = 40.7;\t\t\t#[cm**(3)/mol] - Molar volume of pure component 1\n", + "V2 = 18.1;\t\t\t#[cm**(3)/mol] - Molar volume of pure component 2\n", + "from numpy import zeros,linalg\n", + "x1=[0.114,0.197,0.249,0.495,0.692,0.785,0.892];\t\t\t# Values of mole fraction of component 1\n", + "V=[20.3,21.9,23.0,28.3,32.9,35.2,37.9];\t\t\t# Values of molar volume\n", + "x2=zeros(7);\t\t\t# Mole fraction of component 2\n", + "x_V=zeros(7);\t\t\t# x_V = x1*V_1 + x2*V_2\n", + "V_mix=zeros(7);\t\t\t# V_mix = V - x1*V_1 - x2*V_2\n", + "del_V=zeros(7);\t\t\t#del_V = V_mix/(x1*x2)\n", + "\n", + "# Calculations\n", + "for i in range(7):\n", + " x2[i]=1-x1[i];\n", + " x_V[i]=x1[i]*V1 + x2[i]*V2;\n", + " V_mix[i]=V[i]-x1[i]*V1- x2[i]*V2;\n", + " del_V[i]=V_mix[i]/(x1[i]*x2[i]);\n", + "\n", + "x1 = array(x1)\n", + "\t\t\t#From the matrix method to solve simultaneous linear equations, we have\n", + "a=array([[7, sum(x1), sum(x1**2)],[sum(x1), sum(x1**2), sum(x1**3)],[sum(x1**2), sum(x1**3), sum(x1**4)]])\n", + "b=array([sum(del_V),sum(x1*del_V),sum((x1**2)*del_V)])\n", + "\n", + "soln=linalg.solve(a,b);\n", + "\n", + "a0=soln[0]\n", + "a1=soln[1]\n", + "a2=soln[2]\n", + "#del_V = V_mix/(x1*x2) = a0 + a1*x1 + a2*x1**(2)\n", + "#V_mix = (a0 + a1*x1 + a2*x1**(2))*(x1*(1 - x1))\n", + "# For x1 = 0.5\n", + "x1 = 0.5;\n", + "V_mix_prime = (a0+(a1*x1)+(a2*x1**2))*(x1*(1-x1));\t\t\t#[cm**(3)/mol]\n", + "\n", + "#Now differentiating the above equation with respect to x we get\n", + "#d/dx(V_mix) = (-4*a2*x1**3) + (3*(a2-a1)*x1**2) + (2*(a1-a0)*x1)+ a0\n", + "#Again for x1 = 0.5\n", + "x1_prime = 0.5;\n", + "del_V_mix_prime = (-4*a2*x1_prime**3)+(3*(a2-a1)*x1_prime**2)+(2*(a1-a0)*x1_prime)+a0;\n", + "\n", + "#Finally,calculating the partial molar volumes\n", + "V1_bar = V1 + V_mix_prime + x_water*del_V_mix_prime;\t\t\t#[cm**(3)/mol] \n", + "V2_bar = V2 + V_mix_prime - x_methanol*del_V_mix_prime;\t\t\t#[cm**(3)/mol]\n", + "\n", + "# Results\n", + "print \"The partial molar volume of methanol component 1) is %f cm**3)/mol\"%(V1_bar);\n", + "print \"The partial molar volume of water component 2) is %f cm**3)/mol\"%(V2_bar);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The partial molar volume of methanol component 1) is 39.721188 cm**3)/mol\n", + "The partial molar volume of water component 2) is 17.079639 cm**3)/mol\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.2 Page Number : 421" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "#component 1 = water\n", + "#component 2 = methanol\n", + "T = 25 + 273.15;\t\t\t#[K] - Temperature\n", + "\n", + "#delta_V_mix = x_1*x_2*(-3.377 - 2.945*x_1 + 3.31*x_1**(2))\n", + "V1 = 18.0684;\t\t\t#[cm**(3)/mol] - Molar volume of pure component 1\n", + "V2 = 40.7221;\t\t\t#[cm**(3)/mol] - Molar volume of pure component 2\n", + "Vol_1 = 1000;\t\t\t#[cm**(3)] - Volume of pure component 1\n", + "Vol_2 = 1000;\t\t\t#[cm**(3)] - Volume of pure component 2\n", + "\n", + "# Calculations\n", + "#Moles of the componenets can be calculated as \n", + "n_1 = round(Vol_1/V1,4);\t\t\t#[mol]\n", + "n_2 = round(Vol_2/V2,4);\t\t\t#[mol]\n", + "\n", + "#Mole fraction of the components \n", + "x_1 = round(n_1/(n_1 + n_2),4);\n", + "x_2 = round(n_2/(n_1 + n_2),4);\n", + "\n", + "delta_V_mix = round(x_1*x_2*(-3.377 - 2.945*x_1 + 3.31*x_1**(2)),4);\t\t\t#[cm**(3)/mol]\n", + "\n", + "#Differentiating the above equation, we get\n", + "#d/dx(delta_V_mix) = (1 - 2*x_1)*(-3.377 - 2.945*x_1 + 3.31*x_1**(2)) + (x_1 - x_1**(2))*(-2.945 + 6.62*x_1)\n", + "del_delta_V_mix = round((1 - 2*x_1)*(-3.377 - 2.945*x_1 + 3.31*x_1**(2)) + (x_1 - x_1**(2))*(-2.945 + 6.62*x_1),4);\t\t\t#[cm**(3)/mol]\n", + "\n", + "#Now calculating the partial molar volumes\n", + "V1_bar = V1 + delta_V_mix + x_2*del_delta_V_mix;\t\t\t#[cm**(3)/mol] \n", + "V2_bar = V2 + delta_V_mix - x_1*del_delta_V_mix;\t\t\t#[cm**(3)/mol]\n", + "\n", + "print del_delta_V_mix, V1_bar, V2_bar\n", + "#Finally molar volume of the solution is given by\n", + "V_sol = x_1*V1_bar + x_2*V2_bar;\t\t\t#[cm**(3)/mol]\n", + "\n", + "# Total volume of the solution is given by\n", + "V_total = (n_1 + n_2)*V_sol;\t\t\t#[cm**(3)]\n", + "\n", + "# Results\n", + "print \"The molar volume of the solution is %.4f cm**3)/mol\"%(V_sol);\n", + "print \"The total volume of the solution is %.2f cm**3)\"%(V_total);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1.8248 17.81416104 38.64306104\n", + "The molar volume of the solution is 24.2149 cm**3)/mol\n", + "The total volume of the solution is 1934.82 cm**3)\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.3 Page Number : 422" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + " \n", + "\n", + "Vol = 20;\t\t\t#[cm**(3)] - Volume of the solution\n", + "T = 22 + 273.15;\t\t\t#[K] - Temperature\n", + "W_bottle = 11.5485;\t\t\t#[g] - Weight of density bottle\n", + "Mol_meth = 32.04;\t\t\t#Molecular weight of methanol\n", + "Mol_water = 18.015;\t\t\t# Molecular weight of water\n", + "\n", + "#Density of pure components can be found out at 0% and 100% of volume percent.\n", + "den_meth = 0.7929;\t\t\t#[cm**(3)/mol] - Density of pure methanol\n", + "den_water = 0.9937;\t\t\t#[cm**(3)/mol] - Density of pure water\n", + "\n", + "\n", + "Vol_perc=[5,10,20,30,40,50,60,70,80,90,95];\t\t\t# Volumes percent of component 1 (methanol)\n", + "W_total=[31.2706,31.1468,30.8907,30.6346,30.3396,30.0053,29.5865,29.1453,28.5978,28.0325,27.7320];\t\t\t# Weight of solution + weight of density bottle\n", + "\n", + "W_sol=zeros(11);\t\t\t# Weight of 20 cm**(3) of solution\n", + "den=zeros(11);\t\t\t# density of the solution\n", + "x1=zeros(11);\t\t\t# Mole fraction of methanol\n", + "x2=zeros(11);\t\t\t# Mole fraction of water\n", + "\n", + "# Calculations\n", + "for i in range(11):\n", + " W_sol[i]=W_total[i]-W_bottle;\n", + " den[i]=W_sol[i]/Vol;\n", + " x1[i]=((Vol_perc[i]*den_meth)/Mol_meth)/(((Vol_perc[i]*den_meth)/Mol_meth)+(((100-Vol_perc[i])*den_water)/Mol_water));\n", + " x2[i]=1-x1[i];\n", + "\n", + "\n", + "#Again we have,\n", + "V_kg=zeros(11);\t\t\t#[cm**(3)] - Volume of 1 kg of solution\n", + "n_mol=zeros(11);\t\t\t#[mol] - Number of moles in 1 kg of solution\n", + "V_mol=zeros(11);\t\t\t#[cm**(3)/mol] - Volume of 1 mol of solution\n", + "x_V=zeros(11);\t\t\t#[cm**(3)/mol] - x_V = x1*V_meth + x2*V_water\n", + "V_mix=zeros(11);\t\t\t#[cm**(3)/mol] - V_mix = V_mol - x1*V_meth - x2*V_water\n", + "del_V=zeros(11);\t\t\t# [cm**(3)/mol] - del_V = V_mix/(x1*x2)\n", + "\n", + "#V_mol = V_meth at x1 = 1 and V_mol = V_water at x1 = 0, therefore\n", + "V_meth = 40.4114;\t\t\t#[cm**(3)/mol] - Molar volume of pure component 1 (methanol)\n", + "V_water = 18.1286;\t\t\t#[cm**(3)/mol] - Molar volume of pure component 2 (water)\n", + "\n", + "for i in range(11):\n", + " V_kg[i]=1000/den[i];\n", + " n_mol[i]=1000/(x1[i]*Mol_meth+x2[i]*Mol_water);\n", + " V_mol[i]=V_kg[i]/n_mol[i];\n", + " x_V[i]=V_meth*x1[i]+V_water*x2[i];\n", + " V_mix[i]=V_mol[i]-x1[i]*V_meth-x2[i]*V_water;\n", + " del_V[i]=V_mix[i]/(x1[i]*x2[i]);\n", + "\n", + "#Now employing the concept of quadratic regression of the data ( x1 , del_V ) to solve the equation of the type\n", + "#y = a0 + a1*x + a2*x**(2) \n", + "#Here the above equation is in the form of\n", + "#del_V = V_mix/(x1*x2) = a0 + a1*x1 + a2*x1**(2) \n", + "\n", + "#From the matrix method to solve simultaneous linear equations, we have\n", + "a = array([[11, sum(x1), sum(x1**2)],[sum(x1), sum(x1**2), sum(x1**3)],[sum(x1**2), sum(x1**3), sum(x1**4)]])\n", + "b = array([sum(del_V),sum(x1*del_V),sum((x1**2)*del_V)])\n", + "\n", + "soln=linalg.solve(a,b);\n", + "a0=soln[0]\n", + "a1=soln[1]\n", + "a2=soln[2]\n", + "\n", + "#del_V = V_mix/(x1*x2) = a0 + a1*x1 + a2*x1**(2)\n", + "#V_mix = (a0 + a1*x1 + a2*x1**(2))*(x1*(1 - x1))\n", + "#Solving the above equation for x1,\n", + "def f(x1): \n", + " return (a0+(a1*x1)+(a2*x1**2))*(x1*(1-x1))\n", + "\n", + "#Now differentiating the above equation with respect to x we get\n", + "#d/dx(V_mix) = (-4*a2*x1**3) + (3*(a2-a1)*x1**2) + (2*(a1-a0)*x1)+ a0\n", + "#Again solving it for x1\n", + "def f1(x1): \n", + " return (-4*a2*x1**3)+(3*(a2-a1)*x1**2)+(2*(a1-a0)*x1)+a0\n", + "\n", + "#Now \n", + "\n", + "x1_prime=[0,0.25,0.50,0.75,1.0];\n", + "V_mix_prime=zeros(5);\t\t\t#[cm**(3)/mol] - V_mix = V - x1*V_meth - x2*V_water\n", + "del_V_prime=zeros(5);\t\t\t#[cm**(3)/mol] - del_V = V_mix/(x1*x2)\n", + "V1_bar=zeros(5);\t\t\t#[cm**(3)/mol] - Partial molar volume of component 1\n", + "V2_bar=zeros(5);\t\t\t#[cm**(3)/mol] - Partial molar volume of component 1\n", + "\n", + "# Results\n", + "for j in range(5):\n", + " V_mix_prime[j]=f(x1_prime[j]);\n", + " del_V_prime[j]=f1(x1_prime[j]);\n", + " V1_bar[j]=V_meth+V_mix_prime[j]+(1-x1_prime[j])*del_V_prime[j];\n", + " V2_bar[j]=V_water+V_mix_prime[j]-x1_prime[j]*del_V_prime[j];\n", + " print \"For x1 = %f\"%(x1_prime[j]);\n", + " print \"The partial molar volume of methanol component 1) is %f cm**3)/mol\"%(V1_bar[j])\n", + " print \"The partial molar volume of water component 2) is %f cm**3)/mol\"%(V2_bar[j])\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "For x1 = 0.000000\n", + "The partial molar volume of methanol component 1) is 37.937941 cm**3)/mol\n", + "The partial molar volume of water component 2) is 18.128600 cm**3)/mol\n", + "For x1 = 0.250000\n", + "The partial molar volume of methanol component 1) is 38.124350 cm**3)/mol\n", + "The partial molar volume of water component 2) is 18.031910 cm**3)/mol\n", + "For x1 = 0.500000\n", + "The partial molar volume of methanol component 1) is 39.496329 cm**3)/mol\n", + "The partial molar volume of water component 2) is 17.177237 cm**3)/mol\n", + "For x1 = 0.750000\n", + "The partial molar volume of methanol component 1) is 40.332855 cm**3)/mol\n", + "The partial molar volume of water component 2) is 15.841550 cm**3)/mol\n", + "For x1 = 1.000000\n", + "The partial molar volume of methanol component 1) is 40.411400 cm**3)/mol\n", + "The partial molar volume of water component 2) is 15.800306 cm**3)/mol\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.4 Page Number : 424" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "from numpy import *\n", + "\n", + "\n", + "# Variables\n", + "T = 20 + 273.15;\t\t\t#[K] - Temperature\n", + "Mol_form = 46.027;\t\t\t#Molecular weight of formic acid\n", + "Mol_water = 18.015;\t\t\t# Molecular weight of water\n", + "\n", + "Wt_perc=[10,18,30,50,72,78];\t\t\t#Weight percent of formic acid\n", + "den=[1.0246,1.0441,1.0729,1.1207,1.1702,1.1818];\t\t\t#[g/cm**(3)] - Density of solution\n", + "\n", + "V_g=zeros(6);\t\t\t#[cm**(3)/g] - Volume of 1 g of solution\n", + "x1=zeros(6);\t\t\t# Mole fraction of component 1\n", + "x2=zeros(6);\t\t\t# Mole fraction of component 2\n", + "n=zeros(6);\t\t\t# Number of moles in 1 g\n", + "V_mol=zeros(6);\t\t\t#[cm**(3)/mol] - Volume of 1 mol of solution\n", + "x_V=zeros(6);\t\t\t#[cm**(3)/mol] - x_V = x1*V_form + x2*V_water\n", + "V_mix=zeros(6);\t\t\t#[cm**(3)/mol] - V_mix = V - x1*V_form - x2*V_water\n", + "del_V=zeros(6);\t\t\t# [cm**(3)/mol] - del_V = V_mix/(x1*x2)\n", + "\n", + "#V_mol = V_form at x1 = 1 and V_mol = V_water at x1 = 0, therefore\n", + "V_form = 37.737;\t\t\t#[cm**(3)/mol] - Molar volume of pure formic acid (component 1)\n", + "V_water = 18.050;\t\t\t#[cm**(3)/mol] - Molar volume of pure water (component 2)\n", + "\n", + "# Calculations\n", + "for i in range(6):\n", + " V_g[i]=1/den[i];\n", + " x1[i]=(Wt_perc[i]/Mol_form)/((Wt_perc[i]/Mol_form)+((100-Wt_perc[i])/Mol_water));\n", + " x2[i]=1-x1[i];\n", + " n[i]=((Wt_perc[i]/100.)/Mol_form)+(((100-Wt_perc[i])/100.)/Mol_water);\n", + " V_mol[i]=V_g[i]/n[i];\n", + " x_V[i]=V_form*x1[i]+V_water*x2[i];\n", + " V_mix[i]=V_mol[i]-x1[i]*V_form-x2[i]*V_water;\n", + " del_V[i]=V_mix[i]/(x1[i]*x2[i]);\n", + "\n", + "\n", + "a = array([[11, sum(x1), sum(x1**2)],[sum(x1), sum(x1**2) ,sum(x1**3)],[sum(x1**2), sum(x1**3) ,sum(x1**4)]])\n", + "b = array([sum(del_V),sum(x1*del_V),sum((x1**2)*del_V)])\n", + "\n", + "soln = linalg.solve(a,b)\n", + "\n", + "a0=soln[0]\n", + "a1=soln[1]\n", + "a2=soln[2]\n", + "\n", + "def f(x1): \n", + "\t return (a0+(a1*x1)+(a2*x1**2))*(x1*(1-x1))\n", + "\n", + "def f1(x1): \n", + "\t return (-4*a2*x1**3)+(3*(a2-a1)*x1**2)+(2*(a1-a0)*x1)+a0\n", + "\n", + "#At 15 Wt% of formic acid, x1 is given by\n", + "x1_prime_1 = round((15/Mol_form)/((15/Mol_form)+((100-15)/Mol_water)),3); \n", + "#Similarly at 75 Wt% of formic acid, x1 is given by\n", + "x1_prime_2 = round((75/Mol_form)/((75/Mol_form)+((100-75)/Mol_water)),4); \n", + "\n", + "Wt_perc_prime=[15,75];\n", + "x1_prime=[x1_prime_1,x1_prime_2];\n", + "V_mix_prime=zeros(2);\t\t\t#[cm**(3)/mol] - V_mix = V - x1*V_meth - x2*V_water\n", + "del_V_prime=zeros(2);\t\t\t#[cm**(3)/mol] - del_V = V_mix/(x1*x2)\n", + "V1_bar=zeros(2);\t\t\t#[cm**(3)/mol] - Partial molar volume of component 1\n", + "V2_bar=zeros(2);\t\t\t#[cm**(3)/mol] - Partial molar volume of component 1\n", + "\n", + "# Results\n", + "for j in range(2):\n", + " V_mix_prime[j]=f(x1_prime[j]);\n", + " del_V_prime[j]=f1(x1_prime[j]);\n", + " V1_bar[j]=V_form+V_mix_prime[j]+(1-x1_prime[j])*del_V_prime[j];\n", + " V2_bar[j]=V_water+V_mix_prime[j]-x1_prime[j]*del_V_prime[j];\n", + " print \"For weight percent of formic acid = %f percent\"%(Wt_perc_prime[j]);\n", + " print \"The partial molar volume of formic acid component 1) is %f cm**3)/mol\"%(V1_bar[j]);\n", + " print \"The partial molar volume of water component 2) is %f cm**3)/mol\"%(V2_bar[j]);\n", + "\n", + "# answers are vary because of rounding error. Please review it manually. " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "For weight percent of formic acid = 15.000000 percent\n", + "The partial molar volume of formic acid component 1) is 35.429311 cm**3)/mol\n", + "The partial molar volume of water component 2) is 18.102339 cm**3)/mol\n", + "For weight percent of formic acid = 75.000000 percent\n", + "The partial molar volume of formic acid component 1) is 38.853189 cm**3)/mol\n", + "The partial molar volume of water component 2) is 15.646974 cm**3)/mol\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.5 Page Number : 426" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 40 + 273.15;\t\t\t#[K] - Temperature\n", + "\n", + "x1=array([0.083,0.176,0.268,0.353,0.428,0.720,0.780,0.850,0.900]) \t\t\t# Mole fraction of component 1\n", + "delta_H_mix=array([0.250,0.488,0.670,0.790,0.863,0.775,0.669,0.510,0.362])\t\t\t#[kJ/mol] - Enthalpy of the solution\n", + "\n", + "x2=zeros(9);\t\t\t# Mole fraction of component 2\n", + "del_H=zeros(9);\t\t\t#[kJ/mol] - del_H = delta_H_mix/(x1*x2)\n", + "\n", + "for i in range(9):\n", + " x2[i]=1-x1[i];\n", + " del_H[i]=delta_H_mix[i]/(x1[i]*x2[i]);\n", + "\n", + "\n", + "# Calculations\n", + "#Now employing the concept of quadratic regression of the data ( x1 , del_H ) to solve the equation of the type\n", + "#y = a0 + a1*x + a2*x**(2) \n", + "#Here the above equation is in the form of\n", + "#del_H = delta_H_mix/(x1*x2) = a0 + a1*x1 + a2*x1**(2) \n", + "\n", + "#From the matrix method to solve simultaneous linear equations, we have\n", + "a = array([[9, sum(x1), sum(x1**2)],[sum(x1), sum(x1**2), sum(x1**3)],[sum(x1**2), sum(x1**3), sum(x1**4)]])\n", + "b = array([sum(del_H),sum(x1*del_H),sum((x1**2)*del_H)])\n", + "soln= linalg.solve(a,b)\n", + "a0=soln[0]\n", + "a1=soln[1]\n", + "a2=soln[2]\n", + "\n", + "#del_H = delta_H_mix/(x1*x2) = a0 + a1*x1 + a2*x1**(2)\n", + "#delta_H_mix = (a0 + a1*x1 + a2*x1**(2))*(x1*(1 - x1))\n", + "#At x1 = 0.25,\n", + "x_1 = 0.25;\t\t\t#[mol]\n", + "delta_H_mix = (a0+(a1*x_1)+(a2*x_1**2))*(x_1*(1-x_1));\t\t\t#[kJ/mol]\n", + "\n", + "#Now differentiating the above equation with respect to x we get\n", + "#d/dx(delta_H_mix) = del_delta_H_mix = (-4*a2*x1**3) + (3*(a2-a1)*x1**2) + (2*(a1-a0)*x1)+ a0\n", + "#Again for x1 = 0.25\n", + "x_1_prime = 0.25;\t\t\t#[mol]\n", + "del_delta_H_mix = (-4*a2*x_1_prime**3)+(3*(a2-a1)*x_1_prime**2)+(2*(a1-a0)*x_1_prime)+a0;\t\t\t#[kJ/mol]\n", + "\n", + "#We have the relation\n", + "# H1_bar - H1 = delta_H_mix + x2*del_delta_H_mix, and\n", + "# H2_bar - H2 = delta_H_mix - x1*del_delta_H_mix\n", + "\n", + "#Let us suppose\n", + "#k_1 = H1_bar - H1 , and\n", + "#k_2 = H2_bar - H2\n", + "\n", + "k_1 = delta_H_mix + (1-x_1_prime)*del_delta_H_mix;\t\t\t#[kJ/mol]\n", + "k_2 = delta_H_mix - x_1_prime*del_delta_H_mix;\t\t\t#[kJ/mol]\n", + "\n", + "# Results\n", + "print \"The value of H1_bar - H1) at x1 = 0.25 is %f kJ/mol\"%(k_1);\n", + "print \"The value of H2_bar - H2) at x1 = 0.25 is %f kJ/mol\"%(k_2);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of H1_bar - H1) at x1 = 0.25 is 2.010734 kJ/mol\n", + "The value of H2_bar - H2) at x1 = 0.25 is 0.179079 kJ/mol\n" + ] + } + ], + "prompt_number": 5 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch13_1-checkpoint.ipynb b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch13_1-checkpoint.ipynb new file mode 100644 index 00000000..3cee342e --- /dev/null +++ b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch13_1-checkpoint.ipynb @@ -0,0 +1,312 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:894f18dec91baf4a10867e0d301a68220274d02a1e24c4e2bef1038061daa009" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "\n", + "Chapter 13 : Fugacity of a Component in a Mixture by Equations of State" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.2 Page Number : 433" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math \n", + "\n", + "\n", + "# Variables\n", + "T = 310.93;\t\t\t#[K] - Temperature\n", + "P = 2.76*10**(6);\t\t\t#[Pa] - Pressure\n", + "y1 = 0.8942;\t\t\t#[mol] - mole fraction of component 1\n", + "y2 = 1 - y1;\t\t\t#[mol] - mole fraction of component 2\n", + "R=8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "#For component 1 (methane)\n", + "Tc_1 = 190.6;\t\t\t#[K] - Critical temperature\n", + "Pc_1 = 45.99*10**(5);\t\t\t#[N/m**(2)] - Critical pressure\n", + "Vc_1 = 98.6;\t\t\t#[cm**(3)/mol] - Critical molar volume\n", + "Zc_1 = 0.286;\t\t\t# - Critical compressibility factor\n", + "w_1 = 0.012;\t\t\t# - Critical acentric factor\n", + "#Similarly for component 2 (n-Butane)\n", + "Tc_2 = 425.1;\t\t\t#[K]\n", + "Pc_2 = 37.96*10**(5);\t\t\t#[N/m**(2)]\n", + "Vc_2 = 255;\t\t\t#[cm**(3)/mol]\n", + "Zc_2=0.274;\n", + "w_2=0.2;\n", + "\n", + "# Calculations\n", + "#For component 1\n", + "Tr_1 = T/Tc_1;\t\t\t#Reduced temperature\n", + "#At reduced temperature\n", + "B1_0 = 0.083-(0.422/(Tr_1)**(1.6));\n", + "B1_1 = 0.139-(0.172/(Tr_1)**(4.2));\n", + "#We know,(B*Pc)/(R*Tc) = B_0+(w*B_1)\n", + "B_11 = ((B1_0+(w_1*B1_1))*(R*Tc_1))/Pc_1;\t\t\t#[m**(3)/mol]\n", + "\n", + "#Similarly for component 2\n", + "Tr_2 = T/Tc_2;\t\t\t#Reduced temperature\n", + "#At reduced temperature Tr_2,\n", + "B2_0 = 0.083-(0.422/(Tr_2)**(1.6));\n", + "B2_1 = 0.139-(0.172/(Tr_2)**(4.2));\n", + "B_22 = ((B2_0+(w_2*B2_1))*(R*Tc_2))/Pc_2;\t\t\t#[m**(3)/mol]\n", + "\n", + "#For cross coeffcient\n", + "Tc_12 = (Tc_1*Tc_2)**(1./2);\t\t\t#[K]\n", + "w_12 = (w_1+w_2)/2;\n", + "Zc_12 = (Zc_1+Zc_2)/2;\n", + "Vc_12 = (((Vc_1)**(1./3)+(Vc_2)**(1./3))/2)**(3);\t\t\t#[cm**(3)/mol]\n", + "Vc_12 = Vc_12*10**(-6);\t\t\t#[m**(3)/mol]\n", + "Pc_12 = (Zc_12*R*Tc_12)/Vc_12;\t\t\t#[N/m**(2)]\n", + "\n", + "# Variables, Z = 1 + (B*P)/(R*T)\n", + "#Now we have,(B_12*Pc_12)/(R*Tc_12) = B_0 + (w_12*B_1)\n", + "#where B_0 and B_1 are to be evaluated at Tr_12\n", + "Tr_12 = T/Tc_12;\n", + "#At reduced temperature Tr_12\n", + "B_0 = 0.083-(0.422/(Tr_12)**(1.6));\n", + "B_1 = 0.139-(0.172/(Tr_12)**(4.2));\n", + "B_12 = ((B_0+(w_12*B_1))*R*Tc_12)/Pc_12;\t\t\t#[m**(3)/mol]\n", + "#For the mixture\n", + "B = y1**(2)*B_11+2*y1*y2*B_12+y2**(2)*B_22;\t\t\t#[m**(3)/mol]\n", + "\n", + "#Now del_12 can be calculated as,\n", + "del_12 = 2*B_12 - B_11 - B_22;\t\t\t#[m**(3)/mol]\n", + "\n", + "#We have the relation, math.log(phi_1) = (P/(R*T))*(B_11 + y2**(2)*del_12), therefore\n", + "phi_1 = math.exp((P/(R*T))*(B_11 + y2**(2)*del_12));\n", + "#Similarly for component 2\n", + "phi_2 = math.exp((P/(R*T))*(B_22 + y1**(2)*del_12));\n", + "\n", + "# Results\n", + "print \" The value of fugacity coefficient of component 1 phi_1) is %f\"%(phi_1);\n", + "print \" The value of fugacity coefficient of component 2 phi_2) is %f\"%(phi_2);\n", + "\n", + "#Finally fugacity coefficient of the mixture is given by\n", + "#math.log(phi) = y1*math.log(phi_1) + y2*math.log(phi_2);\n", + "phi = math.exp(y1*math.log(phi_1) + y2*math.log(phi_2));\n", + "\n", + "print \" The value of fugacity coefficient of the mixture phi) is %f \"%(phi);\n", + "#The fugacity coefficient of the mixture can also be obtained using\n", + "#math.log(phi) = (B*P)/(R*T)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The value of fugacity coefficient of component 1 phi_1) is 0.965152\n", + " The value of fugacity coefficient of component 2 phi_2) is 0.675374\n", + " The value of fugacity coefficient of the mixture phi) is 0.929376 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.7 Page Number : 447" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "# Variables\n", + "T = 460.;\t\t\t#[K] - Temperature\n", + "P = 40.*10**(5);\t\t\t#[Pa] - Pressure\n", + "R=8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "# component 1 = nitrogen\n", + "# component 2 = n-Butane\n", + "y1 = 0.4974;\t\t\t# Mole percent of nitrogen\n", + "y2 = 0.5026;\t\t\t# Mole percent of n-Butane\n", + "Tc_nit = 126.2;\t\t\t#[K]\n", + "Pc_nit = 34.00*10**(5);\t\t\t#[Pa]\n", + "Tc_but = 425.1;\t\t\t#[K]\n", + "Pc_but = 37.96*10**(5);\t\t\t#[Pa]\n", + "\n", + "# (1). van der Walls equation of state\n", + "\n", + "# The fugacity coefficient of component 1 in a binary mixture following van der Walls equation of state is given by,\n", + "# math.log(phi_1) = b_1/(V-b) - math.log(Z-B) -2*(y1*a_11 + y2*a_12)/(R*T*V)\n", + "# and for component 2 is given by,\n", + "# math.log(phi_2) = b_2/(V-b) - math.log(Z-B) -2*(y1*a_12 + y2*a_22)/(R*T*V)\n", + "# Where B = (P*b)/(R*T)\n", + "\n", + "# Calculations\n", + "# For componenet 1 (nitrogen)\n", + "a_1 = (27*R**(2)*Tc_nit**(2))/(64*Pc_nit);\t\t\t#[Pa-m**(6)/mol**(2)]\n", + "b_1 = (R*Tc_nit)/(8*Pc_nit);\t\t\t#[m**(3)/mol]\n", + "\n", + "# Similarly for componenet 2 (n-Butane)\n", + "a_2 = (27*R**(2)*Tc_but**(2))/(64*Pc_but);\t\t\t#[Pa-m**(6)/mol**(2)]\n", + "b_2 = (R*Tc_but)/(8*Pc_but);\t\t\t#[m**(3)/mol]\n", + "\n", + "# Here\n", + "a_11 = a_1;\n", + "a_22 = a_2;\n", + "# For cross coefficient\n", + "a_12 = (a_1*a_2)**(1./2);\t\t\t#[Pa-m**(6)/mol**(2)]\n", + "\n", + "# For the mixture \n", + "a = y1**(2)*a_11 + y2**(2)*a_22 + 2*y1*y2*a_12;\t\t\t#[Pa-m**(6)/mol**(2)]\n", + "b = y1*b_1 + y2*b_2;\t\t\t#[m**(3)/mol]\n", + "\n", + "# The cubic form of the van der Walls equation of state is given by,\n", + "# V**(3) - (b+(R*T)/P)*V**(2) + (a/P)*V - (a*b)/P = 0\n", + "# Substituting the value and solving for V, we get\n", + "# Solving the cubic equation\n", + "def f(V): \n", + " return V**(3)-(b+(R*T)/P)*V**(2)+(a/P)*V-(a*b)/P\n", + "V_1=fsolve(f,-1)\n", + "V_2=fsolve(f,0)\n", + "V_3=fsolve(f,1)\n", + "# The molar volume V = V_3, the other two roots are imaginary\n", + "V = V_3;\t\t\t#[m**(3)/mol]\n", + "\n", + "# The comprssibility factor of the mixture is \n", + "Z = (P*V)/(R*T);\n", + "# And B can also be calculated as\n", + "B = (P*b)/(R*T);\n", + "\n", + "# The fugacity coefficient of component 1 in the mixture is\n", + "phi_1 = math.exp(b_1/(V-b) - math.log(Z-B) -2*(y1*a_11 + y2*a_12)/(R*T*V));\n", + "# Similarly fugacity coefficient of component 2 in the mixture is \n", + "phi_2 = math.exp(b_2/(V-b) - math.log(Z-B) -2*(y1*a_12 + y2*a_22)/(R*T*V));\n", + "\n", + "# The fugacity coefficient of the mixture is given by,\n", + "# math.log(phi) = y1*math.log(phi_1) + y2*math.log(phi_2)\n", + "phi = math.exp(y1*math.log(phi_1) + y2*math.log(phi_2));\n", + "\n", + "# Also the fugacity coefficient of the mixture following van der Walls equation of state is given by,\n", + "# math.log(phi) = b/(V-b) - math.log(Z-B) -2*a/(R*T*V)\n", + "phi_dash = math.exp(b/(V-b) - math.log(Z-B) -2*a/(R*T*V));\n", + "# The result is same as obtained above\n", + "\n", + "# Results\n", + "print \" 1van der Walls equation of state\";\n", + "print \" The value of fugacity coefficient of component 1 nitrogen) is %f\"%(phi_1);\n", + "print \" The value of fugacity coefficient of component 2 n-butane) is %f\"%(phi_2);\n", + "print \" The value of fugacity coefficient of the mixture is %f\"%(phi);\n", + "print \" Also the fugacity coefficient of the mixture from van der Walls equation of state is %f which is same as above)\"%(phi_dash);\n", + "\n", + "# (2). Redlich-Kwong equation of state\n", + "\n", + "# For component 1,\n", + "a_1_prime = (0.42748*R**(2)*Tc_nit**(2.5))/Pc_nit;\t\t\t#[Pa-m**(6)/mol**(2)]\n", + "b_1_prime = (0.08664*R*Tc_nit)/Pc_nit;\t\t\t#[m**(3)/mol]\n", + "\n", + "#similarly for component 2,\n", + "a_2_prime = (0.42748*R**(2)*Tc_but**(2.5))/Pc_but;\t\t\t#[Pa-m**(6)/mol**(2)]\n", + "b_2_prime = (0.08664*R*Tc_but)/Pc_but;\t\t\t#[m**(3)/mol]\n", + "\n", + "# For cross coefficient\n", + "a_12_prime = (a_1_prime*a_2_prime)**(1./2);\t\t\t#[Pa-m**(6)/mol**(2)]\n", + "# For the mixture\n", + "a_prime = y1**(2)*a_1_prime + y2**(2)*a_2_prime +2*y1*y2*a_12_prime;\t\t\t#[Pa-m**(6)/mol**(2)]\n", + "b_prime = y1*b_1_prime +y2*b_2_prime;\t\t\t#[m**(3)/mol]\n", + "\n", + "\n", + "#The cubic form of Redlich Kwong equation of state is given by,\n", + "# V**(3)-((R*T)/P)*V**(2)-((b**(2))+((b*R*T)/P)-(a/(T**(1/2)*P))*V-(a*b)/(T**(1/2)*P)=0\n", + "# Solving the cubic equation\n", + "def f1(V): \n", + " return V**(3)-((R*T)/P)*V**(2)-((b_prime**(2))+((b_prime*R*T)/P)-(a_prime/(T**(1./2)*P)))*V-(a_prime*b_prime)/(T**(1./2)*P)\n", + "V_4=fsolve(f1,1)\n", + "V_5=fsolve(f1,0)\n", + "V_6=fsolve(f1,-1)\n", + "# The molar volume V = V_4, the other two roots are imaginary\n", + "V_prime = V_4;\t\t\t#[m**(3)/mol]\n", + "\n", + "# The compressibility factor of the mixture is\n", + "Z_prime = (P*V_prime)/(R*T);\n", + "# And B can also be calculated as\n", + "B_prime = (P*b_prime)/(R*T);\n", + "\n", + "# The fugacity coefficient of component 1 in the binary mixture is given by\n", + "# math.log(phi_1) = b_1/(V-b) - math.log(Z-B) + ((a*b_1)/((b**(2)*R*T**(3/2))))*(math.log((V+b)/V)-(b/(V+b)))-(2*(y1*a_1+y2*a_12)/(R*T**(3/2)b))*(math.log(V+b)/b)\n", + "\n", + "phi_1_prime = math.exp((b_1_prime/(V_prime-b_prime))-math.log(Z_prime-B_prime)+((a_prime*b_1_prime)/((b_prime**(2))*R*(T**(3./2))))*(math.log((V_prime+b_prime)/V_prime)-(b_prime/(V_prime+b_prime)))-(2*(y1*a_1_prime+y2*a_12_prime)/(R*(T**(3./2))*b_prime))*(math.log((V_prime+b_prime)/V_prime)));\n", + "\n", + "\n", + "# Similarly fugacity coefficient of component 2 in the mixture is \n", + "phi_2_prime = math.exp((b_2_prime/(V_prime-b_prime))-math.log(Z_prime-B_prime)+((a_prime*b_2_prime)/((b_prime**(2))*R*(T**(3./2))))*(math.log((V_prime+b_prime)/V_prime)-(b_prime/(V_prime+b_prime)))-(2*(y1*a_12_prime+y2*a_2_prime)/(R*(T**(3./2))*b_prime))*(math.log((V_prime+b_prime)/V_prime)));\n", + "\n", + "# The fugacity coefficient of the mixture is given by,\n", + "# math.log(phi) = y1*math.log(phi_1) + y2*math.log(phi_2)\n", + "phi_prime = math.exp(y1*math.log(phi_1_prime) + y2*math.log(phi_2_prime));\n", + "\n", + "# Also the fugacity coefficient for the mixture following Redlich-kwong equation of state is also given by\n", + "# math.log(phi) = b/(V-b) - math.log(Z-B) - (a/(R*T**(3/2)))*(1/(V+b)+(1/b)*math.log((V+b)/V))\n", + "phi_prime_dash = math.exp(b_prime/(V_prime-b_prime) - math.log(Z_prime-B_prime) - (a_prime/(R*T**(3./2)))*(1/(V_prime+b_prime)+(1./b_prime)*math.log((V_prime+b_prime)/ V_prime)));\n", + "\n", + "print \" \\nRedlich-Kwong equation of state\";\n", + "print \" The value of fugacity coefficient of component 1 nitrogen) is %f\"%(phi_1_prime);\n", + "print \" The value of fugacity coefficient of component 2 n-butane) is %f\"%(phi_2_prime);\n", + "print \" The value of fugacity coefficient of the mixture is %f\"%(phi_prime);\n", + "print \" Also the fugacity coefficient for the mixture from Redlich-kwong equation of state is %f which is same as above)\"%(phi_prime_dash);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1van der Walls equation of state\n", + " The value of fugacity coefficient of component 1 nitrogen) is 1.057500\n", + " The value of fugacity coefficient of component 2 n-butane) is 0.801865\n", + " The value of fugacity coefficient of the mixture is 0.920192\n", + " Also the fugacity coefficient of the mixture from van der Walls equation of state is 0.920192 which is same as above)\n", + " \n", + "Redlich-Kwong equation of state\n", + " The value of fugacity coefficient of component 1 nitrogen) is 1.071129\n", + " The value of fugacity coefficient of component 2 n-butane) is 0.793063\n", + " The value of fugacity coefficient of the mixture is 0.920948\n", + " Also the fugacity coefficient for the mixture from Redlich-kwong equation of state is 0.920948 which is same as above)\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch14_1-checkpoint.ipynb b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch14_1-checkpoint.ipynb new file mode 100644 index 00000000..be081f3c --- /dev/null +++ b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch14_1-checkpoint.ipynb @@ -0,0 +1,723 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:98f2e1e0f1c561d3ee302fd629093b7572c8b263613f73036059e7020f90d8cc" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 14 : Activity Coefficients Models for Liquid Mixtures" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.4 Page Number : 461" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "\n", + "# Variables,\n", + "T = 300;\t\t\t#[K] - Temperature\n", + "b = 100;\t\t\t#[cal/mol]\n", + "R = 1.987;\t\t\t#[cal/mol*K] - Universal gas constant\n", + "# R*T*math.log(Y_1) = b*x_2**(2)\n", + "# R*T*math.log(Y_2) = b*x_1**(2)\n", + "\n", + "#For equimolar mixture\n", + "x_1 = 0.5;\t\t\t#Mole fraction of component 1\n", + "x_2 = 0.5;\t\t\t#Mole fraction of component 2\n", + "\n", + "# Calculations and Results\n", + "#The excess Gibbs free energy is given by\n", + "# G_excess = R*T*(x_1*math.log(Y_1) + x_2*math.log(Y_2)) = b*x_1*x_2**(2) + b*x_2*x_1**(2) = b*x_1*(x_1 + x_2) = b*x_1*x_2\n", + "G_excess = b*x_1*x_2;\t\t\t#[cal/mol]\n", + "\n", + "#The ideal Gibbs free energy change of mixing is given by,\n", + "delta_G_id_mix = R*T*(x_1*math.log(x_1)+x_2*math.log(x_2));\t\t\t#[cal/mol]\n", + "\n", + "#The Gibbs free energy of mixing is given by\n", + "delta_G_mix = delta_G_id_mix + G_excess;\t\t\t#[cal/mol]\n", + "\n", + "#It is given that entropy change of mixing is that of ideal mixture,therefore\n", + "# delta_S_mix = delta_S_id_mix = - R*sum(x_i*math.log(x_i))\n", + "\n", + "#delta_G_mix = delta_H_mix - T*delta_S_mix = delta_H_mix + R*T*(x_1*math.log(x_1)+x_2*math.log(x_2))\n", + "delta_H_mix = b*x_1*x_2;\t\t\t#[cal/mol]\n", + "\n", + "print \"The value of Gibbs free energy change for equimolar mixture formation is %f cal/mol\"%(delta_G_mix);\n", + "print \"The value of enthalpy change for equimolar mixture formation is %f cal/mol\"%(delta_H_mix);\n", + "\n", + "#Work required for separation of mixture into pure components is\n", + "W = delta_G_mix;\n", + "print \"The least amount of work required for separation at 300 K is %f cal/mol\"%(W);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of Gibbs free energy change for equimolar mixture formation is -388.185034 cal/mol\n", + "The value of enthalpy change for equimolar mixture formation is 25.000000 cal/mol\n", + "The least amount of work required for separation at 300 K is -388.185034 cal/mol\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.10 Page Number : 466" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math \n", + "from numpy import zeros\n", + "from scipy.stats import linregress\n", + "\n", + "# Variables,\n", + "T = 25 +173.15;\t\t\t#[K] - Temperature\n", + "x_1=[0.0115,0.0160,0.0250,0.0300,0.0575,0.1125,0.1775,0.2330,0.4235,0.5760,0.6605,0.7390,0.8605,0.9250,0.9625];\n", + "y_1=[8.0640,7.6260,7.2780,7.2370,5.9770,4.5434,3.4019,2.8023,1.7694,1.3780,1.2302,1.1372,1.0478,1.0145,1.0070];\n", + "y_2=[1.0037,1.0099,1.0102,1.0047,1.0203,1.0399,1.1051,1.1695,1.4462,1.8520,2.2334,2.6886,3.7489,4.8960,5.6040];\n", + "\n", + "x_2 = zeros(15);\t\t\t# x_2 = (1 - x_1)\n", + "G_RT = zeros(15);\t\t\t# G_RT = G_excess/(R*T)\n", + "x1x2_G_RT = zeros(15);\t\t\t# x1x2_G_RT = (x_1*x_2/(G_excess/(R*T)))\n", + "G_RTx1x2 = zeros(15);\t\t\t# G_RTx1x1 = G_excess/(R*T*x_1*x_2)\n", + "\n", + "# Calculations and Results\n", + "for i in range(15):\n", + " x_2[i]=(1-x_1[i]);\n", + " G_RT[i]=(x_1[i]*math.log(y_1[i]))+(x_2[i]*math.log(y_2[i]));\n", + " x1x2_G_RT[i]=(x_1[i]*x_2[i])/G_RT[i];\n", + " G_RTx1x2[i]=1/x1x2_G_RT[i];\n", + "\n", + "\n", + "slop,intr,sig,d,e=linregress(x_1,x1x2_G_RT);\n", + "\n", + "A = 1/intr;\n", + "B = 1/(slop+(1/A));\n", + "print \" The value of van Laar parameters are A = %f and B = %f\"%(A,B);\n", + "\n", + "# Now from Margules equation\n", + "# G_RTx1x2 = G_excess/(R*T*x_1*x_2) = B1*x_1 + A1*x_1 = A1 + (B1 - A1)*x_1\n", + "#slope = (B1 - A1) and intercept = A1\n", + "\n", + "# Again employing the concept of linear regression of the data ( x_1 , G_RTx1x2 ) to find the value of intercept and slope of the above equation\n", + "#Let slope = slop1 and intercept = intr1\n", + "\n", + "slop1,intr1,sig1,d,e=linregress(x_1,G_RTx1x2);\n", + "\n", + "A1 = intr1;\n", + "B1 = slop1 + A1;\n", + "print \" The value of Margules parameters are A = %f and B = %f\"%(A1,B1);\n", + "\n", + "print \" Because of the higher value of correlation factor for Van Laar model it fits the data better.\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The value of van Laar parameters are A = 2.271326 and B = 1.781420\n", + " The value of Margules parameters are A = 2.293274 and B = 1.746000\n", + " Because of the higher value of correlation factor for Van Laar model it fits the data better.\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.11 Page Number : 470" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables,\n", + "T = 60 + 273.15;\t\t\t#[K] - Temperature\n", + "R = 1.987;\t\t\t#[cal/mol*K] - Universal gas constant\n", + "#component 1 = acetone\n", + "#component 2 = water\n", + "x_1 = 0.3;\t\t\t# Mole fraction of component 1\n", + "x_2 = 1 - x_1;\t\t\t#Mole fraction of component 2\n", + "V_mol_1 = 74.05;\t\t\t#[cm**(3)/mol] - Molar volume of pure component 1\n", + "V_mol_2 = 18.07;\t\t\t#[cm**(3)/mol] - Molar volume of pure component 2\n", + "\n", + "#for Wilson equation\n", + "a_12 = 291.27;\t\t\t#[cal/mol]\n", + "a_21 = 1448.01;\t\t\t#[cal/mol]\n", + "\n", + "#For NRTL\n", + "b_12 = 631.05;\t\t\t#[cal/mol]\n", + "b_21 = 1197.41;\t\t\t#[cal/mol]\n", + "alpha = 0.5343;\n", + "\n", + "# Calculations and Results\n", + "#Froom wilson equation\n", + "A_12=(V_mol_2/V_mol_1)*(math.exp(-a_12/(R*T)));\n", + "A_21 = (V_mol_1/V_mol_2)*(math.exp(-a_21/(R*T)));\n", + "Beta = A_12/(x_1+x_2*A_12) - A_21/(x_2+x_1*A_21);\n", + "#math.log(Y1) = -math.log(x_1 + x_2*A_12) + x_2*Beta; \n", + "Y1 = math.exp(-math.log(x_1+x_2*A_12)+x_2*Beta);\n", + "#similarly for Y2\n", + "Y2 = math.exp(-math.log(x_2+x_1*A_21)-x_1*Beta);\n", + "print \"The value of activity coefficients for Wilson equation are Y1 = %f \\t and \\t Y2 = %f\"%(Y1,Y2);\n", + "\n", + "#From NRTL equation,\n", + "t_12 = b_12/(R*T);\n", + "t_21 = b_21/(R*T);\n", + "G_12 = math.exp(-alpha*t_12);\n", + "G_21 = math.exp(-alpha*t_21);\n", + "\n", + "#math.log(Y1) = x_1**(2)*[t_12*(G_12/(x_1+x_2*G_12))**(2) + (G_12*t_12)/((G_12/(x_1+x_2*G_12))**(2))]\n", + "Y1_prime = math.exp(x_2**(2)*(t_21*(G_21/(x_1+x_2*G_21))**(2)+(G_12*t_12)/(((x_2+x_1*G_12))**(2))));\n", + "#Similarly for Y2\n", + "Y2_prime = math.exp(x_1**(2)*(t_12*(G_12/(x_2+x_1*G_12))**(2)+(G_21*t_21)/(((x_1+x_2*G_21))**(2))));\n", + "\n", + "print \"The value of activity coefficients for NRTL equation are Y1 = %f \\t and \\t Y2 = %f\"%(Y1_prime,Y2_prime);\n", + "\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of activity coefficients for Wilson equation are Y1 = 2.172258 \t and \t Y2 = 1.254121\n", + "The value of activity coefficients for NRTL equation are Y1 = 2.143030 \t and \t Y2 = 1.262506\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.12 Page Number : 474" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables \n", + "T = 307;\t\t\t#[K]\n", + "x_1 = 0.047;\n", + "x_2 = 1 - x_1;\n", + "\n", + "# The subgroups in the two components are\n", + "# Acetone (1) : 1 CH3, 1 CH3CO\n", + "# n-pentane (2) : 2 CH3, 3 CH2\n", + "\n", + "#Group volume (Rk) and surface area (Qk) parameters of the subgroup are\n", + "k_CH3 = 1;\n", + "k_CH2 = 2;\n", + "k_CH3CO = 19;\n", + "Rk_CH3 = 0.9011;\n", + "Rk_CH2 = 0.6744;\n", + "Rk_CH3CO = 1.6724;\n", + "Qk_CH3 = 0.848;\n", + "Qk_CH2 = 0.540;\n", + "Qk_CH3CO = 1.4880;\n", + "\n", + "# Interaction parameters of the subgroups in kelvin (K) are\n", + "a_1_1 = 0;\n", + "a_1_2 = 0;\n", + "a_1_19 = 476.40;\n", + "a_2_1 = 0;\n", + "a_2_2 = 0;\n", + "a_2_19 = 476.40;\n", + "a_19_1 = 26.76;\n", + "a_19_2 = 26.76;\n", + "a_19_19 = 0;\n", + "\n", + "# Calculations\n", + "r_1 = 1*Rk_CH3 + 1*Rk_CH3CO;\n", + "r_2 = 2*Rk_CH3 + 3*Rk_CH2;\n", + "q_1 = 1*Qk_CH3 + 1*Qk_CH3CO;\n", + "q_2 = 2*Qk_CH3 + 3*Qk_CH2;\n", + "\n", + "J_1 = r_1/(r_1*x_1+r_2*x_2);\n", + "J_2 = r_2/(r_1*x_1+r_2*x_2);\n", + "L_1 = q_1/(q_1*x_1+q_2*x_2);\n", + "L_2 = q_2/(q_1*x_1+q_2*x_2);\n", + "t_1_1 = math.exp(-a_1_1/T);\n", + "t_1_2 = math.exp(-a_1_2/T);\n", + "t_1_19 = math.exp(-a_1_19/T);\n", + "t_2_1 = math.exp(-a_2_1/T);\n", + "t_2_2 = math.exp(-a_2_2/T);\n", + "t_2_19 = math.exp(-a_2_19/T);\n", + "t_19_1 = math.exp(-a_19_1/T);\n", + "t_19_2 = math.exp(-a_19_2/T);\n", + "t_19_19 = math.exp(-a_19_19/T);\n", + "\n", + "e_1_1 = 1*Qk_CH3/q_1;\n", + "e_2_1 = 0;\n", + "e_19_1 = (1*Qk_CH3CO/q_1);\n", + "e_1_2 = 2*Qk_CH3/q_2;\n", + "e_2_2 = 3*Qk_CH2/q_2;\n", + "e_19_2 = 0;\n", + "\n", + "B_1_1 = e_1_1*t_1_1 + e_2_1*t_2_1 + e_19_1*t_19_1;\n", + "B_1_2 = e_1_1*t_1_2 + e_2_1*t_2_2 + e_19_1*t_19_2;\n", + "B_1_19 = e_1_1*t_1_19 + e_2_1*t_2_19 + e_19_1*t_19_19;\n", + "B_2_1 = e_1_2*t_1_1 + e_2_2*t_2_1 + e_19_2*t_19_1;\n", + "B_2_2 = e_1_2*t_1_2 + e_2_2*t_2_2 + e_19_2*t_19_2;\n", + "B_2_19 = e_1_2*t_1_19 + e_2_2*t_2_19 + e_19_2*t_19_19;\n", + "\n", + "theta_1 = (x_1*q_1*e_1_1 + x_2*q_2*e_1_2)/(x_1*q_1 + x_2*q_2);\n", + "theta_2 = (x_1*q_1*e_2_1 + x_2*q_2*e_2_2)/(x_1*q_1 + x_2*q_2);\n", + "theta_19 = (x_1*q_1*e_19_1 + x_2*q_2*e_19_2)/(x_1*q_1 + x_2*q_2);\n", + "\n", + "s_1 = theta_1*t_1_1 + theta_2*t_2_1 + theta_19*t_19_1;\n", + "s_2 = theta_1*t_1_2 + theta_2*t_2_2 + theta_19*t_19_2;\n", + "s_19 = theta_1*t_1_19 + theta_2*t_2_19 + theta_19*t_19_19;\n", + "\n", + "# math.log(Y1_C) = 1 - J_1 + math.log(J_1) - 5*q_1*(1- (J_1/L_1) + math.log(J_1/L_1))\n", + "# math.log(Y2_C) = 1 - J_2 + math.log(J_2) - 5*q_2*(1- (J_2/L_2) + math.log(J_2/L_2))\n", + "Y1_C = math.exp(1 - J_1 + math.log(J_1) - 5*q_1*(1- (J_1/L_1) + math.log(J_1/L_1)));\n", + "Y2_C = math.exp(1 - J_2 + math.log(J_2) - 5*q_2*(1- (J_2/L_2) + math.log(J_2/L_2)));\n", + "\n", + "# For species 1\n", + "summation_theta_k_1 = theta_1*(B_1_1/s_1) + theta_2*(B_1_2/s_2) + theta_19*(B_1_19/s_19);\n", + "summation_e_ki_1 = e_1_1*math.log(B_1_1/s_1) + e_2_1*math.log(B_1_2/s_2) + e_19_1*math.log(B_1_19/s_19);\n", + "\n", + "# For species 2\n", + "summation_theta_k_2 = theta_1*(B_2_1/s_1) + theta_2*(B_2_2/s_2) + theta_19*(B_2_19/s_19);\n", + "summation_e_ki_2 = e_1_2*math.log(B_2_1/s_1) + e_2_2*math.log(B_2_2/s_2) + e_19_2*math.log(B_2_19/s_19);\n", + "\n", + "# math.log(Y1_R) = q_1(1 - summation_theta_k_1 + summation_e_ki_1)\n", + "# math.log(Y2_R) = q_2(1 - summation_theta_k_2 + summation_e_ki_2)\n", + "Y1_R = math.exp(q_1*(1 - summation_theta_k_1 + summation_e_ki_1));\n", + "Y2_R = math.exp(q_2*(1 - summation_theta_k_2 + summation_e_ki_2));\n", + "\n", + "# math.log(Y1) = math.log(Y1_C) + math.log(Y1_R)\n", + "# math.log(Y2) = math.log(Y2_C) + math.log(Y2_R)\n", + "Y1 = math.exp(math.log(Y1_C) + math.log(Y1_R));\n", + "Y2 = math.exp(math.log(Y2_C) + math.log(Y2_R));\n", + "\n", + "# Results\n", + "print \" The activity coefficients are Y1 = %f and Y2 = %f\"%(Y1,Y2);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The activity coefficients are Y1 = 4.992034 and Y2 = 1.005260\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.13 Page Number : 481" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables,\n", + "T = 25 + 273.15;\t\t\t#[K] - Temperature\n", + "R = 1.987;\t\t\t#[cal/mol*K] - Universal gas constant\n", + "#component 1 = chloroform\n", + "#component 2 = carbon tetrachloride\n", + "x_1 = 0.5;\t\t\t#Mole fraction of component 1 \t\t\t#Equimolar mixture\n", + "x_2 = 0.5;\t\t\t#Mole fraction of component 2\n", + "V_mol_1 = 81;\t\t\t#[cm**(3)/mol] - Molar volume of pure component 1\n", + "V_mol_2 = 97;\t\t\t#[cm**(3)/mol] - Molar volume of pure component 2\n", + "del_1 = 9.2;\t\t\t#[(cal/cm**(3))**(1/2)] - Mole fraction of component 1\n", + "del_2 = 8.6;\t\t\t#[(cal/cm**(3))**(1/2)] - Mole fraction of component 2\n", + "\n", + "# Calculations\n", + "#Scatchard - Hilderbrand model\n", + "phi_1 = (x_1*V_mol_1)/(x_1*V_mol_1+x_2*V_mol_2);\n", + "phi_2 = (x_2*V_mol_2)/(x_1*V_mol_1+x_2*V_mol_2);\n", + "\n", + "#math.log(Y1) = (V_mol_1/(R*T))*phi_1**(2)*(del_1-del_2)**(2)\n", + "Y1 = math.exp((V_mol_1/(R*T))*(phi_1**(2))*((del_1-del_2)**(2)));\n", + "\n", + "#Similarly, for Y2\n", + "Y2 = math.exp((V_mol_2/(R*T))*(phi_2**(2))*((del_1-del_2)**(2)));\n", + "\n", + "# Results\n", + "print \"The value of activity coefficients for Scatchard-Hilderbrand model are Y1 = %f \\t and \\t Y2 = %f\"%(Y1,Y2);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of activity coefficients for Scatchard-Hilderbrand model are Y1 = 1.010245 \t and \t Y2 = 1.017658\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.14 Page Number : 485" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables,\n", + "T = 25 + 273.15;\t\t\t#[K] - Temperature\n", + "mol_HCl = 0.001;\t\t\t#[mol/kg] - Molality of HCl\n", + "A = 0.510;\t\t\t#[(kg/mol)**(1/2)]\n", + "Z_positive = 1;\t\t\t#Stoichiometric coefficient of 'H' ion\n", + "Z_negative = -1;\t\t\t#Stoichiometric coefficient of 'Cl' ion\n", + "m_H_positive = mol_HCl;\t\t\t#\n", + "m_Cl_negative = mol_HCl;\n", + "\n", + "# Calculations and Results\n", + "# I = 1/2*[((Z_positive)**(2))*m_H_positive + ((Z_negative)**(2))*m_Cl_negative]\n", + "I = 1./2*(((Z_positive)**(2))*m_H_positive + ((Z_negative)**(2))*m_Cl_negative);\n", + "\n", + "#Using Debye-Huckel limiting law wee get,\n", + "# math.log(Y1) = -A*(abs(Z_positive*Z_negative))*(I**(1/2)))\n", + "Y = 10**(-A*(abs(Z_positive*Z_negative))*(I**(1./2)));\n", + "print \"The mean activity coefficient at 25 C using Debye-Huckel limiting law is Y = %f\"%(Y);\n", + "\n", + "#Using Debye-Huckel extended model we get\n", + "#math.log(Y_prime) = (-A*(abs(Z_positive*Z_negative))*(I**(1/2)))/(1 + (I**(1/2)));\n", + "Y_prime = 10**((-A*(abs(Z_positive*Z_negative))*(I**(1./2)))/(1 + (I**(1./2))));\n", + "print \"The mean activity coefficient at 25 C using Debye-Huckel extended model is Y = %f\"%(Y_prime);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The mean activity coefficient at 25 C using Debye-Huckel limiting law is Y = 0.963546\n", + "The mean activity coefficient at 25 C using Debye-Huckel extended model is Y = 0.964643\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.15 Page Number : 485" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables,\n", + "T = 25 + 273.15;\t\t\t#[K] - Temperature\n", + "mol_CaCl2 = 0.001;\t\t\t#[mol/kg] - Molality of HCl\n", + "A = 0.510;\t\t\t#[(kg/mol)**(1/2)]\n", + "Z_positive = 2;\t\t\t#Stoichiometric coefficient of 'Ca' ion\n", + "Z_negative = -1;\t\t\t#Stoichiometric coefficient of 'Cl' ion\n", + "m_Ca_positive = mol_CaCl2;\n", + "m_Cl_negative = 2*mol_CaCl2;\n", + "\n", + "# Calculations\n", + "# I = 1/2*[((Z_positive)**(2))*m_Ca_positive + ((Z_negative)**(2))*m_Cl_negative]\n", + "I = 1./2*(((Z_positive)**(2))*m_Ca_positive + ((Z_negative)**(2))*m_Cl_negative);\n", + "\n", + "#Using Debye-Huckel limiting law wee get,\n", + "# math.log(Y1) = -A*(abs(Z_positive*Z_negative))*(I**(1/2)))\n", + "Y = 10**(-A*(abs(Z_positive*Z_negative))*(I**(1./2)));\n", + "\n", + "# Results\n", + "print \"The mean activity coefficient at 25 C using Debye-Huckel limiting law is Y = %f\"%(Y);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The mean activity coefficient at 25 C using Debye-Huckel limiting law is Y = 0.879290\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.17 Page Number : 488" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables,\n", + "T = 50 + 273.15;\t\t\t#[K] - Temperature\n", + "R=8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "x_1 = 0.3;\t\t\t# Mole fraction of component 1\n", + "x_2 = (1-x_1);\t\t\t# Mole fraction of component 2\n", + "#Increment of 1% means Y2 = 1.01*Y1\n", + "\n", + "# Calculations\n", + "#Excess volume of the mixture is given by,\n", + "V_excess = 4*x_1*x_2;\t\t\t#[cm**(3)/mol]\n", + "#Amd threfore\n", + "V_1_excess = 4*x_2*x_2*10**(-6);\t\t\t#[m**(3)/mol] - Exces volume of component 1\n", + "V_2_excess = 4*x_1*x_1*10**(-6);\t\t\t#[m**(3)/mol] - Exces volume of component 2\n", + "\n", + "#We have from equation 14.89 of the book,\n", + "#V_i_excess/(R*T) = (del_math.log(Y_i)/del_P)_T,x\n", + "\n", + "#Rearranging above equation\n", + "#d(math.log(Y1)) = (V1_excess/(R*T))dP\n", + "#Integrating the above equation at constant 'T' and 'x' in the limit from 'Y1' to '1.01*Y1' in the LHS and from 'P' to 'P+delta_P' in the RHS\n", + "#On simplification we get\n", + "#math.log(1.01*Y1/Y1) = (V_1_exces/(R*T))*delta_P\n", + "delta_P = math.log(1.01)/(V_1_excess/(R*T));\t\t\t#[N/m**(2)]\n", + "delta_P = delta_P*10**(-6);\t\t\t#[MPa]\n", + "\n", + "# Results\n", + "print \"The required pressure to increase the activity coefficient by 1%% is %f MPa\"%(delta_P);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The required pressure to increase the activity coefficient by 1% is 13.639411 MPa\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.21 Page Number : 490" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 293.15;\t\t\t#[K] - Temperature\n", + "R=8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "A = 1280;\t\t\t#[J/mol]\n", + "\n", + "#(dA/dT)_P,x = del_A (say)\n", + "dA_dT = -7.0;\t\t\t#[J/mol-K]\n", + "\n", + "#For equilomar mixture,\n", + "x_1 = 0.5;\t\t\t# Mole fraction of component 1\n", + "x_2 = 0.5;\t\t\t# Mole fraction of component 2\n", + "\n", + "# Calculations\n", + "#math.log(Y1) = (A/(R*T))*x_2**(2)\n", + "#math.log(Y2) = (A/(R*T))*x_1**(2)\n", + "Y1 = math.exp((A/(R*T))*x_2**(2));\n", + "Y2 = math.exp((A/(R*T))*x_1**(2));\n", + "\n", + "#G_excess/(R*T*) = x_1*math.log(Y1) + x_2*math.log(Y2) = (A/(R*T))*x_1*x_2\n", + "G_excess = A*x_1*x_2;\t\t\t#[J/mol] - Excess Gibbs free energy\n", + "\n", + "#H_excess/(R*T**(2)) = -[d/dT(G_excess/(R*T))]_P,x\n", + "#H_excess/(R*T**(2)) = -((x_1*x_2)/R)*[d/dT(A/T)]_P,x\n", + "#On simplification and putting the values we get\n", + "H_excess = A*x_1*x_2 - T*dA_dT*x_1*x_2;\t\t\t#[J/mol] - Excess enthalpy\n", + "\n", + "#Now excess entropy is given by\n", + "S_excess = (H_excess - G_excess)/T;\t\t\t#[J/mol-K] - Excess entropy\n", + "\n", + "# Results\n", + "print \"For equimolar mixture\";\n", + "print \"Excess Gibbs free energy G_excess) is %f J/mol\"%(G_excess);\n", + "print \"Excess enthalpy H_excess) is %f J/mol\"%(H_excess);\n", + "print \"Excess entropy S_excess) is %f J/mol\"%(S_excess);\n", + "print \"The value of activity coefficient Y1 is %f\"%(Y1);\n", + "print \"The value of activity coefficient Y2 is %f\"%(Y2);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "For equimolar mixture\n", + "Excess Gibbs free energy G_excess) is 320.000000 J/mol\n", + "Excess enthalpy H_excess) is 833.012500 J/mol\n", + "Excess entropy S_excess) is 1.750000 J/mol\n", + "The value of activity coefficient Y1 is 1.140305\n", + "The value of activity coefficient Y2 is 1.140305\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.22 Page Number : 491" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Given\n", + "T = 60 + 273.15;\t\t\t#[K] - Temperature\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "# math.log(Y1_inf) = math.log(Y2_inf) = 0.15 + 10/T\n", + "\n", + "# Since the two liquids are slightly dissimilar , we assume the activity coeffiecients to follow van Laar equation \n", + "# From van L# Variablesr equation \n", + "# A = math.log(Y1_inf) and B = math.log(Y2_inf) and since it is given that math.log(Y1_inf) = math.log(Y2_inf), therefore A = B\n", + "#(x_1*x_2)/(G_excess/R*T) = x_1/B + x_2/A = X_1/A + x_2/A = 1/A\n", + "# G_excess/(R*T) = A*x_1*x_2\n", + "\n", + "# For equilomar mixture,\n", + "x_1 = 0.5;\t\t\t# Mole fraction of component 1\n", + "x_2 = 0.5;\t\t\t# Mole fraction of component 2\n", + "\n", + "# Calculations and Results\n", + "# Expression for A can be written as\n", + "# A = 0.15 + 10/T, where T is in C. Therefore\n", + "A = 0.15 + 10/(T - 273.15);\n", + "# Differentiating it with respect to temprature we get\n", + "dA_dT = - 10/((T-273.15)**(2));\n", + "\n", + "# The excess Gibbs free energy can be calculated as\n", + "G_excess = A*x_1*x_2*(R*T);\t\t\t#[J/mol]\n", + "\n", + "# The ideal Gibbs free energy change can be calculated as\n", + "delta_G_id_mix = R*T*(x_1*math.log(x_1) + x_2*math.log(x_2));\t\t\t#[J/mol]\n", + "\n", + "# Finally we have,\n", + "delta_G_mix = G_excess + delta_G_id_mix;\t\t\t#[J/mol]\n", + "\n", + "print \"The Gibbs free energy change of mixing for equimolar mixture is %f J/mol\"%(delta_G_mix);\n", + "\n", + "\n", + "# Now let us determine the excess enthalpy. We know that\n", + "# H_excess/(R*T**(2)) = -[d/dT(G_excess/R*T)]_P,x = - x_1*x_2*[d/dT(A)]_P,x\n", + "# Therefore at 'T' = 60 C the excess enthalpy is given by\n", + "H_excess = -R*(T**(2))*x_1*x_2*dA_dT;\t\t\t#[J/mol]\n", + "\n", + "delta_H_id_mix = 0;\t\t\t#[J/mol] - Enthalpy change of mixing for ideal solution is zero.\n", + "\n", + "#Thus enthalpy change of mixing for an equimolar mixture at 333.15 K is given by\n", + "delta_H_mix = delta_H_id_mix + H_excess;\t\t\t#[J/mol]\n", + "\n", + "\n", + "print \"The enthalpy change of mixing for equimolar mixture is %f J/mol\"%(delta_H_mix);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Gibbs free energy change of mixing for equimolar mixture is -1700.608815 J/mol\n", + "The enthalpy change of mixing for equimolar mixture is 640.806876 J/mol\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch15_1-checkpoint.ipynb b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch15_1-checkpoint.ipynb new file mode 100644 index 00000000..fcfb0cd5 --- /dev/null +++ b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch15_1-checkpoint.ipynb @@ -0,0 +1,2075 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:aa6f699613cdf9bcba2dda4617212630ca1760d21939d5cd99d17e7e03b7e885" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 15 : Vapour Liquid Equilibrium" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.1 Page Number : 503" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 90+ 273.15;\t\t\t#[K] - Temperature\n", + "P = 1;\t\t\t#[atm] - Pressure\n", + "x_1 = 0.5748;\t\t\t# Equilibrium composition of liquid phase\n", + "y_1 = 0.7725;\t\t\t# Equilibrium composition of vapour phase\n", + "\n", + "\t\t\t# We start with 1 mol of mixture of composition z_1 = 0.6, from marterial balance we get\n", + "\t\t\t# (L + V)*z_1 = L*x_1 + V*y_1\n", + "\t\t\t# Since total number of moles is 1, we get\n", + "\t\t\t# z_1 = L*x_1 + (1-L)*y_1\n", + "\n", + "# Calculations and Results\n", + "z_1_1 = 0.6;\t\t\t# - Mole fraction of benzene\n", + "L_1 = (z_1_1 - y_1)/(x_1 - y_1);\n", + "V_1 = 1 - L_1;\n", + "\n", + "print \" For z_1 = 0.6\";\n", + "print \" The moles in the liquid phase is %f mol\"%(L_1);\n", + "print \" The moles in the vapour phase is %f mol\"%(V_1);\n", + "\n", + "z_1_2 = 0.7;\t\t\t# - Mole fraction of benzene\n", + "L_2 = (z_1_2 - y_1)/(x_1 - y_1);\n", + "V_2 = 1 - L_2;\n", + "\n", + "print \" For z_1 = 0.7\";\n", + "print \" The moles in the liquid phase is %f mol\"%(L_2);\n", + "print \" The moles in the vapour phase is %f mol\"%(V_2);\n", + "\n", + "\n", + "\t\t\t# For z = 0.8\n", + "\t\t\t# The feed remains vapour and the liquid is not formed at all as it is outside the two-phase region (x_1 = 0.5748 and y_1 = 0.7725).\n", + "print \" For z_1 = 0.8\";\n", + "print \" The feed remains vapour and the liquid is not formed at all as it is outside the two-phase region x_1 = 0.5748 and y_1 = 0.7725\"\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " For z_1 = 0.6\n", + " The moles in the liquid phase is 0.872534 mol\n", + " The moles in the vapour phase is 0.127466 mol\n", + " For z_1 = 0.7\n", + " The moles in the liquid phase is 0.366717 mol\n", + " The moles in the vapour phase is 0.633283 mol\n", + " For z_1 = 0.8\n", + " The feed remains vapour and the liquid is not formed at all as it is outside the two-phase region x_1 = 0.5748 and y_1 = 0.7725\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.2 Page Number : 515" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "\n", + "# Variables\n", + "\t\t\t# math.log(P_1_sat) = 14.39155 - 2795.817/(t + 230.002)\n", + "\t\t\t# math.log(P_2_sat) = 16.26205 - 3799.887/(t + 226.346)\n", + "\n", + "\t\t\t#(a)\n", + "x_1_a =0.43;\t\t\t# Equilibrium composition of liquid phase\n", + "t_a = 76;\t\t\t#[C] - Temperature\n", + "x_2_a = 1 - x_1_a;\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# Since liquid phase composition is given we use the relation \n", + "\t\t\t# P = x_1*P_1_sat + x_2*P_2_sat\n", + "\t\t\t# At t = 76 C\n", + "P_1_sat_a = math.exp(14.39155 - 2795.817/(t_a + 230.002));\n", + "P_2_sat_a = math.exp(16.26205 - 3799.887/(t_a + 226.346));\n", + "\t\t\t# Therefore total pressure is\n", + "P_a = x_1_a*P_1_sat_a + x_2_a*P_2_sat_a;\t\t\t#[kPa]\n", + "y_1_a = (x_1_a*P_1_sat_a)/(P_a);\n", + "y_2_a = (x_2_a*P_2_sat_a)/(P_a);\n", + "\n", + "print \"a).The system pressure is = %f kPa\"%(P_a);\n", + "print \" The vapour phase composition is y_1 = %f\"%(y_1_a);\n", + "\n", + "\t\t\t#(b)\n", + "y_1_b = 0.43;\t\t\t# Equilibrium composition of vapour phase\n", + "y_2_b = 1 - y_1_b;\n", + "t_b = 76;\t\t\t#[C] - Temperature\n", + "\n", + "P_1_sat_b = math.exp(14.39155 - 2795.817/(t_b + 230.002));\n", + "P_2_sat_b = math.exp(16.26205 - 3799.887/(t_b + 226.346));\n", + "\n", + "\t\t\t# Since vapour phase composition is given ,the system pressure is given by\n", + "\t\t\t# 1/P = y_1/P_1_sat + y_2/P_2_sat\n", + "P_b = 1/(y_1_b/P_1_sat_b + y_2_b/P_2_sat_b);\n", + "\n", + "x_1_b = (y_1_b*P_b)/P_1_sat_b;\n", + "x_2_b = (y_2_b*P_b)/P_2_sat_b;\n", + "\n", + "print \"b).The system pressure is P = %f kPa\"%(P_b);\n", + "print \" The liquid phase composition is x_1 = %f\"%(x_1_b);\n", + "\n", + "\t\t\t#(c)\n", + "x_1_c = 0.32;\t\t\t# Equilibrium composition of liquid phase\n", + "x_2_c = 1 - x_1_c;\n", + "P_c = 101.33;\t\t\t#[kPa] - Pressure of the system\n", + "\n", + "\t\t\t# We have, P = x_1*P_1_sat + x_2*P_2_sat\n", + "t_1_sat = 2795.817/(14.39155 - math.log(P_c)) - 230.002;\n", + "t_2_sat = 3799.887/(16.26205 - math.log(P_c)) - 226.346;\n", + "t = x_1_c*t_1_sat + x_2_c*t_2_sat;\n", + "\n", + "error = 10;\n", + "while(error>0.1):\n", + " P_1_sat = math.exp(14.39155 - 2795.817/(t + 230.002));\n", + " P_2_sat = math.exp(16.26205 - 3799.887/(t + 226.346));\n", + " P = x_1_c*P_1_sat + x_2_c*P_2_sat;\n", + " error=abs(P - P_c);\n", + " t = t - 0.1;\n", + "\n", + "P_1_sat_c = math.exp(14.39155 - 2795.817/(t + 230.002));\n", + "P_2_sat_c = math.exp(16.26205 - 3799.887/(t + 226.346));\n", + "\n", + "y_1_c = (x_1_c*P_1_sat_c)/(P_c);\n", + "y_2_c = 1 - y_1_c;\n", + "\n", + "print \"c).The system temperature is t = %f C\"%(t);\n", + "print \" The vapour phase composition is y_1 = %f\"%(y_1_c);\n", + "\n", + "\t\t\t#(d)\n", + "y_1_d = 0.57;\t\t\t# Vapour phase composition\n", + "y_2_d = 1 - y_1_d;\n", + "P_d = 101.33;\t\t\t#[kPa] - Pressure of the system\n", + "\n", + "\t\t\t# Since vapour phase composition is given, we can use the relation\n", + "\t\t\t# 1/P = y_1/P_1_sat + y_2/P_2_sat\n", + "t_1_sat_d = 2795.817/(14.39155 - math.log(P_d)) - 230.002;\n", + "t_2_sat_d = 3799.887/(16.26205 - math.log(P_d)) - 226.346;\n", + "t_d = y_1_d*t_1_sat_d + y_2_d*t_2_sat_d;\n", + "\n", + "fault = 10;\n", + "while(fault>0.1):\n", + " P_1_sat_prime = math.exp(14.39155 - 2795.817/(t_d + 230.002));\n", + " P_2_sat_prime = math.exp(16.26205 - 3799.887/(t_d + 226.346));\n", + " P_prime = 1/(y_1_d/P_1_sat_prime + y_2_d/P_2_sat_prime);\n", + " fault=abs(P_prime - P_d);\n", + " t_d = t_d + 0.01;\n", + "\n", + "P_1_sat_d = math.exp(14.39155 - 2795.817/(t_d + 230.002));\n", + "P_2_sat_d = math.exp(16.26205 - 3799.887/(t_d + 226.346));\n", + "\n", + "x_1_d = (y_1_d*P_d)/(P_1_sat_d);\n", + "x_2_d = 1 - x_1_d;\n", + "\n", + "print \"d).The system temperature is t = %f C\"%(t_d);\n", + "print \" The liquid phase composition is x_1 = %f\"%(x_1_d);\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a).The system pressure is = 105.268363 kPa\n", + " The vapour phase composition is y_1 = 0.782290\n", + "b).The system pressure is P = 60.894254 kPa\n", + " The liquid phase composition is x_1 = 0.136725\n", + "c).The system temperature is t = 79.943314 C\n", + " The vapour phase composition is y_1 = 0.679347\n", + "d).The system temperature is t = 84.600005 C\n", + " The liquid phase composition is x_1 = 0.234934\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.3 Page Number : 516" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "x_1_a = 0.25;\t\t\t# Equilibrium composition of liquid phase\n", + "x_2_a = 0.35;\n", + "x_3_a = 1 - x_1_a - x_2_a;\n", + "t_a = 80;\t\t\t#[C] - Temperature\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# At t = 80 C\n", + "P_1_sat_a = math.exp(14.3916 - 2795.82/(t_a + 230.00));\n", + "P_2_sat_a = math.exp(14.2724 - 2945.47/(t_a + 224.00));\n", + "P_3_sat_a = math.exp(14.2043 - 2972.64/(t_a + 209.00));\n", + "\n", + "\t\t\t# Since liquid phase composition is given we use the relation \n", + "P_a = x_1_a*P_1_sat_a + x_2_a*P_2_sat_a + x_3_a*P_3_sat_a;\t\t\t#[kPa]\n", + "\n", + "y_1_a = (x_1_a*P_1_sat_a)/(P_a);\n", + "y_2_a = (x_2_a*P_2_sat_a)/(P_a);\n", + "y_3_a = (x_3_a*P_3_sat_a)/(P_a);\n", + "\n", + "print \"a).The system pressure is P = %f kPa\"%(P_a);\n", + "print \" The vapour phase composition is given by y_1 = %f y_2 = %f and y_3 = %f \"%(y_1_a,y_2_a,y_3_a);\n", + "\n", + "\t\t\t#(2)\n", + "y_1_b = 0.50;\t\t\t# Equilibrium composition of liquid phase\n", + "y_2_b = 0.30;\n", + "y_3_b = 1 - y_1_a - y_2_a;\n", + "t_b = 85;\t\t\t#[C] - Temperature\n", + "\n", + "\t\t\t# At t = 80 C\n", + "P_1_sat_b = math.exp(14.3916 - 2795.82/(t_b + 230.00));\n", + "P_2_sat_b = math.exp(14.2724 - 2945.47/(t_b + 224.00));\n", + "P_3_sat_b = math.exp(14.2043 - 2972.64/(t_b + 209.00));\n", + "\n", + "\t\t\t# Since vapour phase composition is given we use the relation \n", + "P_b = 1/(y_1_b/P_1_sat_b + y_2_b/P_2_sat_b + y_3_b/P_3_sat_b);\t\t\t#[kPa]\n", + "\n", + "\t\t\t# Therefore we have\n", + "x_1_b = (y_1_b*P_b)/P_1_sat_b;\n", + "x_2_b = (y_2_b*P_b)/P_2_sat_b;\n", + "x_3_b = (y_3_b*P_b)/P_3_sat_b;\n", + "\n", + "print \"b).The system pressure is P = %f kPa\"%(P_b);\n", + "print \" The liquid phase composition is given by x_1 = %f x_2 = %f and x_3 = %f \"%(x_1_b,x_2_b,x_3_b);\n", + "\n", + "\t\t\t#(c)\n", + "x_1_c = 0.30;\t\t\t# Equilibrium composition of liquid phase\n", + "x_2_c = 0.45;\n", + "x_3_c = 1 - x_1_c - x_2_c;\n", + "P_c = 80;\t\t\t#[kPa] - Pressure of the system\n", + "\n", + "\t\t\t# We have, P = x_1*P_1_sat + x_2*P_2_sat + x_3*P_3_sat\n", + "t_1_sat = 2795.82/(14.3916 - math.log(P_c)) - 230.00;\t\t\t#[C]\n", + "t_2_sat = 2945.47/(14.2724 - math.log(P_c)) - 224.00;\t\t\t#[C]\n", + "t_3_sat = 2972.64/(14.2043 - math.log(P_c)) - 209.00;\t\t\t#[C]\n", + "t = x_1_c*t_1_sat + x_2_c*t_2_sat + x_3_c*t_3_sat;\n", + "\n", + "error = 10;\n", + "while(error>0.5):\n", + " P_1_sat = math.exp(14.3916 - 2795.82/(t + 230.00));\n", + " P_2_sat = math.exp(14.2724 - 2945.47/(t + 224.00));\n", + " P_3_sat = math.exp(14.2043 - 2972.64/(t + 209.00));\n", + " P = x_1_c*P_1_sat + x_2_c*P_2_sat + x_3_c*P_3_sat;\n", + " error=abs(P - P_c);\n", + " t = t - 0.2;\n", + "\n", + "P_1_sat_c = math.exp(14.3916 - 2795.82/(t + 230.00));\n", + "P_2_sat_c = math.exp(14.2724 - 2945.47/(t + 224.00));\n", + "P_3_sat_c = math.exp(14.2043 - 2972.64/(t + 209.00));\n", + "\n", + "y_1_c = (x_1_c*P_1_sat_c)/(P_c);\n", + "y_2_c = (x_2_c*P_2_sat_c)/(P_c);\n", + "y_3_c = 1 - y_1_c - y_2_c;\n", + "\n", + "print \"c).The system temperature is t = %f C\"%(t);\n", + "print \" The vapour phase composition is y_1 = %f y_2 %f and y_3 = %f\"%(y_1_c,y_2_c,y_3_c);\n", + "\n", + "\t\t\t#(d)\n", + "y_1_d = 0.6;\t\t\t# Vapour phase composition\n", + "y_2_d = 0.2;\n", + "y_3_d = 1 - y_1_d - y_2_d;\n", + "P_d = 90;\t\t\t#[kPa] - Pressure of the system\n", + "\n", + "\t\t\t# Since vapour phase composition is given, we can use the relation\n", + "\t\t\t# 1/P = y_1/P_1_sat + y_2/P_2_sat + y_3/P_3_sat\n", + "t_1_sat_d = 2795.82/(14.3916 - math.log(P_d)) - 230.00;\n", + "t_2_sat_d = 2945.47/(14.2724 - math.log(P_d)) - 224.00;\n", + "t_3_sat_d = 2972.64/(14.2043 - math.log(P_d)) - 209.00;\n", + "t_d = y_1_d*t_1_sat_d + y_2_d*t_2_sat_d + y_3_d*t_3_sat_d;\n", + "\n", + "fault = 10;\n", + "while(fault>0.5):\n", + " P_1_sat_prime = math.exp(14.3916 - 2795.82/(t_d + 230.00));\n", + " P_2_sat_prime = math.exp(14.2724 - 2945.47/(t_d + 224.00));\n", + " P_3_sat_prime = math.exp(14.2043 - 2972.64/(t_d + 209.00));\n", + " P_prime = 1/(y_1_d/P_1_sat_prime + y_2_d/P_2_sat_prime + y_3_d/P_3_sat_prime);\n", + " fault=abs(P_prime - P_d);\n", + " t_d = t_d + 0.2;\n", + "\n", + "P_1_sat_d = math.exp(14.3916 - 2795.82/(t_d + 230.00));\n", + "P_2_sat_d = math.exp(14.2724 - 2945.47/(t_d + 224.00));\n", + "P_3_sat_d = math.exp(14.2043 - 2972.64/(t_d + 209.00));\n", + "\n", + "x_1_d = (y_1_d*P_d)/(P_1_sat_d);\n", + "x_2_d = (y_2_d*P_d)/(P_2_sat_d);\n", + "x_3_d = 1 - x_1_d - x_2_d;\n", + "\n", + "print \"d).The system temperature is t = %f C\"%(t_d);\n", + "print \" The liquid phase composition is x_1 = %f x_2 = %f and x_3 = %f\"%(x_1_d,x_2_d,x_3_d);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a).The system pressure is P = 108.239332 kPa\n", + " The vapour phase composition is given by y_1 = 0.497672 y_2 = 0.316379 and y_3 = 0.185948 \n", + "b).The system pressure is P = 129.287998 kPa\n", + " The liquid phase composition is given by x_1 = 0.259997 x_2 = 0.338895 and x_3 = 0.401108 \n", + "c).The system temperature is t = 67.020387 C\n", + " The vapour phase composition is y_1 = 0.544826 y_2 0.357251 and y_3 = 0.097922\n", + "d).The system temperature is t = 73.127683 C\n", + " The liquid phase composition is x_1 = 0.307471 x_2 = 0.230183 and x_3 = 0.462346\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.4 Page Number : 519" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "\n", + "# Variables\n", + "T = 120;\t\t\t#[C] - Temperature\n", + "P_1 = 1;\t\t\t#[atm] - Initial pressure\n", + "P_1 = P_1*101.325;\t\t\t#[kPa]\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "y_1 = 0.3;\t\t\t# Mole fraction of propane\n", + "y_2 = 0.5;\t\t\t# Mole fraction of butane\n", + "y_3 = 0.2;\t\t\t# Mole fraction of hexane\n", + "\n", + "\t\t\t# math.log(P_1_sat) = 13.7713 - 1892.47/(t + 248.82)\n", + "\t\t\t# math.log(P_2_sat) = 13.7224 - 2151.63/(t + 236.91)\n", + "\t\t\t# math.log(P_3_sat) = 13.8216 - 2697.55/(t + 224.37)\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#(a)\n", + "P_1_sat = math.exp(13.7713 - 1892.47/(T + 248.82));\n", + "P_2_sat = math.exp(13.7224 - 2151.63/(T + 236.91));\n", + "P_3_sat = math.exp(13.8216 - 2697.55/(T + 224.37));\n", + "\n", + "\t\t\t# Since vapour phase composition is given we can use the relation,\n", + "P_2 = 1/(y_1/P_1_sat + y_2/P_2_sat + y_3/P_3_sat);\t\t\t#[kPa]\n", + "\n", + "print \" a).The pressure of the mixture when first drop condenses is given by P = %f kPa\"%(P_2);\n", + "\n", + "\t\t\t#(b)\n", + "x_1 = (y_1*P_2)/P_1_sat;\n", + "x_2 = (y_2*P_2)/P_2_sat;\n", + "x_3 = (y_3*P_2)/P_3_sat;\n", + "\n", + "print \" b).The liquid phase composition is given by x_1 propane = %f x_2 butane = %f and x_3 hexane = %f \"%(x_1,x_2,x_3);\n", + "\n", + "\t\t\t# (c)\n", + "\t\t\t# Work transfer per mol is given by\n", + "\t\t\t# W = integral(P*dV) = integral((R*T/V)*dV) = R*T*math.log(V_2/V_1) = R*T*math.log(P_1/P_2)\n", + "w = R*(T+273.15)*math.log(P_1/P_2);\t\t\t#[J/mol]\n", + "\t\t\t# For 100 mol\n", + "W = w*100;\t\t\t#[J]\n", + "W = W*10**(-3);\t\t\t#[kJ]\n", + "print \" c).The work required for 100 mol of mixture handeled is %f kJ\"%(W);\n", + "\n", + "\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a).The pressure of the mixture when first drop condenses is given by P = 1278.060855 kPa\n", + " b).The liquid phase composition is given by x_1 propane = 0.067811 x_2 butane = 0.291139 and x_3 hexane = 0.641049 \n", + " c).The work required for 100 mol of mixture handeled is -828.526086 kJ\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.5 Page Number : 520" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "# Variables\n", + "T = 27;\t\t\t#[C] - Temperature\n", + "\n", + "\t\t\t# math.log(P_1_sat) = 13.8216 - 2697.55/(t + 224.37)\n", + "\t\t\t# math.log(P_2_sat) = 13.8587 - 2911.32/(t + 216.64)\n", + "\n", + "\t\t\t#(a)\n", + "x_1_a = 0.2;\n", + "x_2_a = 1 - x_1_a;\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# At t = 27 C\n", + "P_1_sat = math.exp(13.8216 - 2697.55/(T + 224.37));\t\t\t#[kPa]\n", + "P_2_sat = math.exp(13.8587 - 2911.32/(T + 216.64));\t\t\t#[kPa]\n", + "P_a = x_1_a*P_1_sat + x_2_a*P_2_sat;\t\t\t#[kPa]\n", + "\n", + "y_1_a = x_1_a*P_1_sat/P_a;\n", + "y_2_a = x_2_a*P_2_sat/P_a;\n", + "\n", + "print \"a).The total pressure is P = %f kPa\"%(P_a);\n", + "print \" The vapour phase composition is given by y_1 = %f and y_2 = %f\"%(y_1_a,y_2_a);\n", + "\n", + "\t\t\t#(b)\n", + "y_1_b = 0.2;\n", + "y_2_b = 1 - y_1_b;\n", + "\t\t\t# Since vapour phase composition is given we can use the relation \n", + "P_b = 1/(y_1_b/P_1_sat + y_2_b/P_2_sat);\t\t\t#[kPa]\n", + "\n", + "\t\t\t# Therefore we have\n", + "x_1_b = (y_1_b*P_b)/P_1_sat;\n", + "x_2_b = (y_2_b*P_b)/P_2_sat;\n", + "\n", + "print \"b).The total pressure is, P = %f kPa\"%(P_b);\n", + "print \" The liquid phase composition is given by x_1 = %f and x_2 = %f\"%(x_1_b,x_2_b);\n", + "\n", + "\t\t\t#(c)\n", + "P_c = 30;\t\t\t#[kPa] - Total pressure\n", + "x_1_c = 0.2;\n", + "x_2_c = 1 - x_1_c;\n", + "\n", + "\t\t\t# We have, P = x_1*P_1_sat + x_2*P_2_sat\n", + "t_1_sat = 2697.55/(13.8216 - math.log(P_c)) - 224.37;\n", + "t_2_sat = 2911.32/(13.8587 - math.log(P_c)) - 216.64;\n", + "t = x_1_c*t_1_sat + x_2_c*t_2_sat;\n", + "\n", + "fault = 10;\n", + "while(fault>0.3):\n", + " P_1_sat = math.exp(13.8216 - 2697.55/(t + 224.37));\n", + " P_2_sat = math.exp(13.8587 - 2911.32/(t + 216.64));\n", + " P = x_1_c*P_1_sat + x_2_c*P_2_sat;\n", + " fault = abs(P - P_c);\n", + " t = t - 0.1;\n", + "\n", + "P_1_sat_c = math.exp(13.8216 - 2697.55/(t + 224.37));\n", + "P_2_sat_c = math.exp(13.8587 - 2911.32/(t + 216.64));\n", + "\n", + "y_1_c = (x_1_c*P_1_sat_c)/(P_c);\n", + "y_2_c = 1 - y_1_c;\n", + "\n", + "print \"c).The system temperature is t = %f C\"%(t);\n", + "print \" The vapour phase composition is y_1 = %f and y_2 = %f \"%(y_1_c,y_2_c);\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a).The total pressure is P = 9.795726 kPa\n", + " The vapour phase composition is given by y_1 = 0.448801 and y_2 = 0.551199\n", + "b).The total pressure is, P = 7.835131 kPa\n", + " The liquid phase composition is given by x_1 = 0.071288 and x_2 = 0.928712\n", + "c).The system temperature is t = 53.904663 C\n", + " The vapour phase composition is y_1 = 0.413592 and y_2 = 0.586408 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.6 Page Number : 521" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "P = 90;\t\t\t#[kPa] - Pressure\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "\t\t\t# math.log(P_sat) = A - B/(t + C)\n", + "\n", + "\t\t\t# For benzene\n", + "A_1 = 13.8594;\n", + "B_1 = 2773.78;\n", + "C_1 = 220.07;\n", + "\t\t\t# For ethyl benzene\n", + "A_2 = 14.0045;\n", + "B_2 = 3279.47;\n", + "C_2 = 213.20;\n", + "\n", + "x_1 = 0.5;\t\t\t# Equimolar mixture\n", + "x_2 = 0.5;\n", + "\n", + "\t\t\t# The bubble point temperature equation is\n", + "\t\t\t# P = x_1*P_1_sat + x_2*P_2_sat\n", + "\n", + "# Calculations and Results\n", + "t_1_sat = B_1/(A_1 - math.log(P)) - C_1;\n", + "t_2_sat = B_2/(A_2 - math.log(P)) - C_2;\n", + "t = x_1*t_1_sat + x_2*t_2_sat;\n", + "\n", + "fault = 10;\n", + "while(fault>0.3):\n", + " P_1_sat = math.exp(A_1 - B_1/(t + C_1));\n", + " P_2_sat = math.exp(A_2 - B_2/(t + C_2));\n", + " P_net = x_1*P_1_sat + x_2*P_2_sat;\n", + " fault=abs(P_net - P);\n", + " t = t - 0.1;\n", + "\n", + "print \" The bubble point temperature is %f C\"%(t);\n", + "\n", + "\t\t\t# Now let us determine dew point temperature for y_1 = 0.5, and P = 90 kPa\n", + "y_1 = 0.5;\t\t\t# Equimolar mixture\n", + "y_2 = 0.5;\n", + "\n", + "\t\t\t# 1/P = y_1/P_1_sat + y_2/P_2_sat\n", + "\t\t\t# Let us statrt with t = 104.07\n", + "t_old = 104.07;\n", + "error = 10;\n", + "while(error>0.3):\n", + " P_1_sat_prime = math.exp(A_1 - B_1/(t_old + C_1));\n", + " P_2_sat_prime = math.exp(A_2 - B_2/(t_old + C_2));\n", + " P_net_prime = 1/(y_1/P_1_sat_prime + y_2/P_2_sat_prime);\n", + " error=abs(P_net_prime - P);\n", + " t_old = t_old + 0.1;\n", + "\n", + "print \" The dew point temperature is %f C\"%(t_old);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The bubble point temperature is 93.862003 C\n", + " The dew point temperature is 114.470000 C\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.7 Page Number : 522" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "P = 1;\t\t\t#[bar] - Pressure\n", + "P = P*10**(2);\t\t\t#[kPa]\n", + "\n", + "\t\t\t# math.log(P_1_sat) = 13.8594 - 2773.78/(t + 220.07)\n", + "\t\t\t# math.log(P_2_sat) = 14.0098 - 3103.01/(t + 219.79)\n", + "\n", + "\t\t\t# The bubble point equation is\n", + "\t\t\t# P = x_1*P_1_sat + x_2*P_2_sat;\n", + "\n", + "t_1_sat = 2773.78/(13.8594 - math.log(P)) - 220.07;\n", + "t_2_sat = 3103.01/(14.0098 - math.log(P)) - 219.79;\n", + "\n", + "\t\t\t# For x_1 = 0.1\n", + "\t\t\t# t = x_1_1*t_1_sat + x_2_1*t_2_sat;\n", + "x_1 = [0.1,0.5,0.9];\n", + "x_2 = [0,0,0]\n", + "\n", + "# Calculations and Results\n", + "for i in range(3):\n", + " x_2[i] = 1 - x_1[i];\n", + " t = x_1[i]*t_1_sat + x_2[i]*t_2_sat;\n", + " fault = 10;\n", + " while(fault>0.3):\n", + " P_1_sat = math.exp(13.8594 - 2773.78/(t + 220.07));\n", + " P_2_sat = math.exp(14.0098 - 3103.01/(t + 219.79));\n", + " P_net = x_1[i]*P_1_sat + x_2[i]*P_2_sat;\n", + " fault=abs(P_net - P);\n", + " t = t - 0.1;\n", + " print \" The bubble point temperature for x_1 = %f) is %f C\"%(x_1[i],t);\n", + "\n", + "\n", + "\n", + "\t\t\t# Now let us determine dew point temperature\n", + "\t\t\t# 1/P = y_1/P_1_sat + y_2/P_2_sat\n", + "\n", + "y_1 = [0.1,0.5,0.9];\n", + "y_2 = [0,0,0]\n", + "for j in range(3):\n", + " y_2[j] = 1 - y_1[j];\n", + " t_prime = y_1[j]*t_1_sat + y_2[j]*t_2_sat;\n", + " error = 10;\n", + " while(error>0.3):\n", + " P_1_sat = math.exp(13.8594 - 2773.78/(t_prime + 220.07));\n", + " P_2_sat = math.exp(14.0098 - 3103.01/(t_prime + 219.79));\n", + " P_net = 1/(y_1[j]/P_1_sat + y_2[j]/P_2_sat);\n", + " error=abs(P_net - P);\n", + " t_prime = t_prime + 0.1;\n", + " \n", + " print \" The dew point temperature for y_1 = %f is %f C\"%(y_1[j],t_prime);\n", + "\n", + "\n", + "\t\t\t#Therefore\n", + "print \" The temperature range for z_1 = 0.1 which two phase exist is 105.61 C to 108.11 C\";\n", + "print \" The temperature range for z_1 = 0.5 which two phase exist is 91.61 C to 98.40 C\";\n", + "print \" The temperature range for z_1 = 0.9 which two phase exist is 81.71 C to 84.51 C\";\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The bubble point temperature for x_1 = 0.100000) is 105.605549 C\n", + " The bubble point temperature for x_1 = 0.500000) is 91.607993 C\n", + " The bubble point temperature for x_1 = 0.900000) is 81.710437 C\n", + " The dew point temperature for y_1 = 0.100000 is 108.105549 C\n", + " The dew point temperature for y_1 = 0.500000 is 98.407993 C\n", + " The dew point temperature for y_1 = 0.900000 is 84.510437 C\n", + " The temperature range for z_1 = 0.1 which two phase exist is 105.61 C to 108.11 C\n", + " The temperature range for z_1 = 0.5 which two phase exist is 91.61 C to 98.40 C\n", + " The temperature range for z_1 = 0.9 which two phase exist is 81.71 C to 84.51 C\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.8 Page Number : 524" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "# Variables\n", + "x_1 = 0.20;\n", + "x_2 = 0.45;\n", + "x_3 = 0.35;\n", + "P = 10;\t\t\t#[atm]\n", + "P = P*101325*10**(-3);\t\t\t#[kPa]\n", + "\n", + "\t\t\t# math.log(P_1_sat) = 13.7713 - 1892.47/(t + 248.82)\n", + "\t\t\t# math.log(P_2_sat) = 13.7224 - 2151.63/(t + 236.91)\n", + "\t\t\t# math.log(P_3_sat) = 13.8183 - 2477.07/(t + 233.21)\n", + "\n", + "\t\t\t#(a)\n", + "\t\t\t# The bubble point equation is\n", + "\t\t\t# P = x_1*P_1_sat + x_2*P_2_sat + x_3*P_3_sat\n", + "\n", + "# Calculations and Results\n", + "t_1_sat = 1892.47/(13.7713 - math.log(P)) - 248.82;\n", + "t_2_sat = 2151.63/(13.7224 - math.log(P)) - 236.91;\n", + "t_3_sat = 2477.07/(13.8183 - math.log(P)) - 233.21;\n", + "t = x_1*t_1_sat + x_2*t_2_sat + x_3*t_3_sat;\n", + "\n", + "fault = 10;\n", + "while(fault>0.1):\n", + " P_1_sat = math.exp(13.7713 - 1892.47/(t + 248.82));\n", + " P_2_sat = math.exp(13.7224 - 2151.63/(t + 236.91));\n", + " P_3_sat = math.exp(13.8183 - 2477.07/(t + 233.21));\n", + " P_net = x_1*P_1_sat + x_2*P_2_sat + x_3*P_3_sat;\n", + " fault=abs(P_net - P);\n", + " t = t - 0.003;\n", + "\n", + "BPT = t;\n", + "print \" a).The bubble point temperature is %f C\"%(BPT);\n", + "\n", + "\t\t\t# (b)\n", + "\t\t\t# Now let us determine dew point temperature for y_1 = 0.5, and P = 90 kPa\n", + "y_1 = 0.20;\n", + "y_2 = 0.45;\n", + "y_3 = 0.35;\n", + "\n", + "\t\t\t# 1/P = y_1/P_1_sat + y_2/P_2_sat + y_3/P_3_sat\n", + "\n", + "t_old = 90;\t\t\t#[C]\n", + "error = 10;\n", + "while(error>0.1):\n", + " P_1_sat_prime = math.exp(13.7713 - 1892.47/(t_old + 248.82));\n", + " P_2_sat_prime = math.exp(13.7224 - 2151.63/(t_old + 236.91));\n", + " P_3_sat_prime = math.exp(13.8183 - 2477.07/(t_old + 233.21));\n", + " P_net_prime = 1/(y_1/P_1_sat_prime + y_2/P_2_sat_prime + y_3/P_3_sat_prime);\n", + " error=abs(P_net_prime - P);\n", + " t_old = t_old + 0.003;\n", + "\n", + "DPT = t_old;\n", + "print \" b).The dew point temperature is %f C\"%(DPT);\n", + "\n", + "\t\t\t# (c)\n", + "\t\t\t# For the given composition and pressure the two phase region exists in the temperature range of DPT and BPT\n", + "\t\t\t# Therefore at 82 C two phase exists\n", + "\t\t\t# At 82 C and P = 1013.25 kPa pressure\n", + "T_c = 82;\t\t\t#[C]\n", + "P_c = 1013.25;\t\t\t#[kPa]\n", + "z_1 = 0.20;\n", + "z_2 = 0.45;\n", + "z_3 = 0.35;\n", + "\n", + "P_1_sat_c = math.exp(13.7713 - 1892.47/(T_c + 248.82));\n", + "P_2_sat_c = math.exp(13.7224 - 2151.63/(T_c + 236.91));\n", + "P_3_sat_c = math.exp(13.8183 - 2477.07/(T_c + 233.21));\n", + "\n", + "K_1 = P_1_sat_c/P_c;\n", + "K_2 = P_2_sat_c/P_c;\n", + "K_3 = P_3_sat_c/P_c;\n", + "\n", + "\t\t\t# We have to find such a V that the following equation is satisfied.\n", + "\t\t\t# summation(y_i) = K_i*z_i/(1-V+V*K_i) = 1\n", + "\t\t\t# K_1*z_1/(1-V+V*K_1) + K_2*z_2/(1-V+V*K_2) + K_3*z_3/(1-V+V*K_3) = 1\n", + "\n", + "def f1(V): \n", + "\t return K_1*z_1/(1-V+V*K_1) + K_2*z_2/(1-V+V*K_2) + K_3*z_3/(1-V+V*K_3)-1\n", + "V = fsolve(f1,0.4)\n", + "\n", + "\t\t\t# Therefore now we have\n", + "y_1_c = K_1*z_1/(1-V+V*K_1);\n", + "y_2_c = K_2*z_2/(1-V+V*K_2);\n", + "y_3_c = K_3*z_3/(1-V+V*K_3);\n", + "x_1_c = y_1_c/K_1;\n", + "x_2_c = y_2_c/K_2;\n", + "x_3_c = y_3_c/K_3;\n", + "\n", + "print \" c).The proportion of vapour is given by V = %f\"%(V);\n", + "print \" The composition of vapour foemed is given by y_1 = %f y_2 = %f and y_3 = %f \"%(y_1_c,y_2_c,y_3_c);\n", + "print \" The composition of liquid formed is given by x_1 = %f x_2 = %f and x_3 = %f \"%(x_1_c,x_2_c,x_3_c);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a).The bubble point temperature is 71.833954 C\n", + " b).The dew point temperature is 97.254000 C\n", + " c).The proportion of vapour is given by V = 0.332143\n", + " The composition of vapour foemed is given by y_1 = 0.365018 y_2 = 0.466574 and y_3 = 0.168408 \n", + " The composition of liquid formed is given by x_1 = 0.117932 x_2 = 0.441757 and x_3 = 0.440311 \n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.9 Page Number : 526" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "# Variables\n", + "T = 27;\t\t\t#[C] - Temperature\n", + "z_1 = 0.4;\n", + "z_2 = 0.3;\n", + "z_3 = 0.3;\n", + "\n", + "\t\t\t# math.log(P_sat) = A - B/(t + C)\n", + "\n", + "\t\t\t# For propane\n", + "A_1 = 13.7713;\n", + "B_1 = 1892.47;\n", + "C_1 = 248.82;\n", + "\t\t\t# For i-butane\n", + "A_2 = 13.4331;\n", + "B_2 = 1989.35;\n", + "C_2 = 236.84;\n", + "\t\t\t# For n-butane\n", + "A_3 = 13.7224;\n", + "B_3 = 2151.63;\n", + "C_3 = 236.91;\n", + "\n", + "\t\t\t#(a)\n", + "\t\t\t# The pressure range for the existence of two phase region lies between dew point and bubble point pressures.\n", + "\t\t\t# At the dew point the whole feed lies in the vapour phase and a drop of liquid is formed, therefore\n", + "y_1 = z_1;\n", + "y_2 = z_2;\n", + "y_3 = z_3;\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# At 27 C,\n", + "P_1_sat = math.exp(A_1 - B_1/(T + C_1));\n", + "P_2_sat = math.exp(A_2 - B_2/(T + C_2));\n", + "P_3_sat = math.exp(A_3 - B_3/(T + C_3));\n", + "\n", + "\t\t\t# The dew point pressure is given by\n", + "P_1 = 1/(y_1/P_1_sat + y_2/P_2_sat + y_3/P_3_sat); \n", + "\n", + "\t\t\t# At the bubble point the whole feed lies in the liquid phase and an infinitesimal amount of vapour is formed, therefore\n", + "x_1 = z_1;\n", + "x_2 = z_2;\n", + "x_3 = z_3;\n", + "\n", + "\t\t\t# The bubble point pressure is given by\n", + "P_2 = x_1*P_1_sat + x_2*P_2_sat + x_3*P_3_sat;\n", + "\n", + "print \" a).The two phase region exists between %f and %f kPa\"%(P_1,P_2);\n", + "\n", + "\t\t\t#(b)\n", + "\t\t\t# The mean of the two-phase pressure range is given by\n", + "P_mean = (P_1 + P_2)/2;\n", + "\n", + "\t\t\t# Now let us calculate the K values of the components\n", + "K_1 = P_1_sat/P_mean;\n", + "K_2 = P_2_sat/P_mean;\n", + "K_3 = P_3_sat/P_mean;\n", + "\n", + "\t\t\t# summation of y_i = 1, gives\n", + "\t\t\t# (K_1*z_1)/(1-V-K_1*V) + (K_2*z_2)/(1-V-K_2*V) + (K_3*z_3)/(1-V-K_3*V) = 1\n", + "\t\t\t# Solving we get\n", + "def f(V): \n", + "\t return (K_1*z_1)/(1-V+K_1*V) + (K_2*z_2)/(1-V+K_2*V) + (K_3*z_3)/(1-V+K_3*V)-1\n", + "V = fsolve(f,0.1)\n", + "\n", + "y_1_prime = (z_1*K_1)/(1-V+K_1*V);\n", + "\n", + "print \" b).The mole fraction of propane in vapour phase is %f whereas in the feed is %f and fraction of vapour in the system is %f\"%(y_1_prime,z_1,V);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a).The two phase region exists between 421.886904 and 588.370027 kPa\n", + " b).The mole fraction of propane in vapour phase is 0.559489 whereas in the feed is 0.400000 and fraction of vapour in the system is 0.425313\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.10 Page Number : 527" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 50;\t\t\t#[C] - Temperature\n", + "P = 64;\t\t\t#[kPa] - Pressure\n", + "z_1 = 0.7;\n", + "z_2 = 0.3;\n", + "\n", + "# math.log(P_sat) = A - B/(t + C)\n", + "\n", + "# For acetone\n", + "A_1 = 14.37824;\n", + "B_1 = 2787.498;\n", + "C_1 = 229.664;\n", + "# For acetonitrile\n", + "A_2 = 14.88567;\n", + "B_2 = 3413.099;\n", + "C_2 = 250.523;\n", + "\n", + "# Calculations\n", + "# At 50 C,\n", + "P_1_sat = math.exp(A_1 - B_1/(T + C_1));\t\t\t#[kPa]\n", + "P_2_sat = math.exp(A_2 - B_2/(T + C_2));\t\t\t#[kPa]\n", + "\n", + "# Now let us calculate the K values of the components\n", + "K_1 = P_1_sat/P;\n", + "K_2 = P_2_sat/P;\n", + "\n", + "# summation of y_i = 1, gives\n", + "# (K_1*z_1)/(1-V-K_1*V) + (K_2*z_2)/(1-V-K_2*V) = 1\n", + "# Solving we get\n", + "def f(V): \n", + " return (K_1*z_1)/(1-V+K_1*V) + (K_2*z_2)/(1-V+K_2*V) -1\n", + "V = fsolve(f,0.1)\n", + "L = 1 - V;\n", + "# Therefore\n", + "y_1 = (K_1*z_1)/(1-V+K_1*V);\n", + "y_2 = (K_2*z_2)/(1-V+K_2*V);\n", + "\n", + "x_1 = y_1/K_1;\n", + "x_2 = y_2/K_2;\n", + "\n", + "# Results\n", + "print \" The value of V = %f\"%(V);\n", + "print \" The value of L = %f\"%(L);\n", + "print \" The liquid phase composition is x_1 = %f and x_2 = %f\"%(x_1,x_2);\n", + "print \" The vapour phase composition is y_1 = %f and y_2 = %f\"%(y_1,y_2);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The value of V = 0.450368\n", + " The value of L = 0.549632\n", + " The liquid phase composition is x_1 = 0.619963 and x_2 = 0.380037\n", + " The vapour phase composition is y_1 = 0.797678 and y_2 = 0.202322\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.11 Page Number : 528" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "P = 12.25*101325*10**(-3);\t\t\t#[kPa]\n", + "z_1 = 0.8;\n", + "z_2 = 1 - z_1;\n", + "V = 0.4;\n", + "# math.log(P_1_sat) = 13.7713 - 2892.47/(T + 248.82)\n", + "# math.log(P_2_sat) = 13.7224 - 2151.63/(T + 236.91)\n", + "\n", + "# P_1_sat = math.exp(13.7713 - 21892.47/(T + 248.82));\n", + "# P_2_sat = math.exp(13.7224 - 2151.63/(T + 236.91));\n", + "\n", + "# Let the total mixture be 1 mol\n", + "# We have to assume a temperature such that,\n", + "# y_1 + y_2 = (K_1*z_1)/(1-V-K_1*V) + (K_2*z_2)/(1-V-K_2*V) = 1\n", + "\n", + "# To assume a temperature we have to determine the BPT and DPT and take a temperature in between the range BPT to DPT\n", + "\n", + "# At the bubble point the whole feed lies in the liquid phase and an infinitesimal amount of vapour is formed, therefore\n", + "x_1 = z_1;\n", + "x_2 = z_2;\n", + "\n", + "# The bubble point pressure is given by\n", + "# P = x_1*(math.exp(13.7713 - 21892.47/(T + 248.82))) + x_2*(math.exp(13.7224 - 2151.63/(T + 236.91)));\n", + "\n", + "# Calculations\n", + "def f(T): \n", + "\t return x_1*(math.exp(13.7713 - 1892.47/(T + 248.82))) + x_2*(math.exp(13.7224 - 2151.63/(T + 236.91))) - P\n", + "T_1 = fsolve(f,0.1)\n", + "BPT = T_1;\n", + "\n", + "# At the dew point the whole feed lies in the vapour phase and a drop of liquid is formed, therefore\n", + "y_1 = z_1;\n", + "y_2 = z_2;\n", + "\n", + "# The dew point equation is given by\n", + "# 1/P = y_1/P_1_sat + y_2/P_2_sat\n", + "def f1(T): \n", + "\t return 1/(y_1/(math.exp(13.7713 - 1892.47/(T + 248.82))) + y_2/(math.exp(13.7224 - 2151.63/(T + 236.91)))) - P\n", + "T_2 = fsolve(f1,0.1)\n", + "DPT = T_2;\n", + "\n", + "T = 47;\t\t\t#[C]\n", + "error = 10;\n", + "while(error>0.001):\n", + " P_1_sat = math.exp(13.7713 - 1892.47/(T + 248.82));\n", + " P_2_sat = math.exp(13.7224 - 2151.63/(T + 236.91));\n", + " K_1 = P_1_sat/P;\n", + " K_2 = P_2_sat/P;\n", + " y1 = (K_1*z_1)/(1-V+K_1*V);\n", + " y2 = (K_2*z_2)/(1-V+K_2*V);\n", + " y = y1 + y2;\n", + " error=abs(y - 1);\n", + " T = T - 0.0001;\n", + "\n", + "# Results\n", + "print \" The temperature when 40 mol of mixture is in the vapour is %f C\"%(T);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The temperature when 40 mol of mixture is in the vapour is 45.333000 C\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.12 Page Number : 529" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 105;\t\t\t#[C]\n", + "P = 1.5;\t\t\t#[atm]\n", + "P = P*101325*10**(-3);\t\t\t#[kPa]\n", + "z = [0.4,0.3667,0.2333];\t\t\t# Feed composition\n", + "x = [0.3,0.3,0.4];\t\t\t# Equilibrium liquid phase composition\n", + "y = [0.45,0.40,0.15];\t\t\t# Equilibrium vapour phase composition\n", + "\n", + "# From the material balance equation of component 1, we get\n", + "# (L + V)*z_1 = L*x_1 + V*y_1\n", + "\n", + "# Since total moles are one, therefore L + V = 1 and thus\n", + "# z_1 = L*x_1 + (1-L)*y_1\n", + "# Calculations and Results\n", + "for i in range(3):\n", + " L = (z[i] - y[i])/(x[i] - y[i]);\n", + " V = 1 - L;\n", + " print \" The number of moles in liquid phase z = %f is given by L = %f\"%(z[i],L);\n", + " print \" The number of moles in vapour phase z = %f is given by V = %f\"%(z[i],V);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The number of moles in liquid phase z = 0.400000 is given by L = 0.333333\n", + " The number of moles in vapour phase z = 0.400000 is given by V = 0.666667\n", + " The number of moles in liquid phase z = 0.366700 is given by L = 0.333000\n", + " The number of moles in vapour phase z = 0.366700 is given by V = 0.667000\n", + " The number of moles in liquid phase z = 0.233300 is given by L = 0.333200\n", + " The number of moles in vapour phase z = 0.233300 is given by V = 0.666800\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.13 Page Number : 530" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 90;\t\t\t#[C]\n", + "P = 1;\t\t\t#[atm]\n", + "P = P*101325*10**(-3);\t\t\t#[kPa]\n", + "z_1 = [0.1,0.5,0.8];\n", + "\n", + "# Calculations\n", + "# math.log(P_1_sat) = 13.8594 - 2773.78/(t + 220.07)\n", + "# math.log(P_2_sat) = 14.0098 - 3103.01/(t + 219.79)\n", + "\n", + "#At T = 90 C\n", + "P_1_sat = math.exp(13.8594 - 2773.78/(T + 220.07));\n", + "P_2_sat = math.exp(14.0098 - 3103.01/(T + 219.79));\n", + "K_1 = P_1_sat/P;\n", + "K_2 = P_2_sat/P;\n", + "\n", + "# For z_1 = 0.1\n", + "# y1 = (K_1*z_1(i))/(1-V+K_1*V);\n", + "# y2 = (K_2*z_2)/(1-V+K_2*V);\n", + "# We do not get a value between 0 and 1 such that, y = y1 + y2 = 1; \n", + "# This means that at z_1 = 0.1 two phases do not exist.\n", + "# At given temperature and pressure, let us determine the equilibrium liquid and vapour phase compositions\n", + "\n", + "x_1 = (P - P_2_sat)/(P_1_sat - P_2_sat);\n", + "y_1 = (x_1*P_1_sat)/(P);\n", + "\n", + "# For two phase region to exist at 90 C and 101.325 kPa,z_1 sholud lie between x_1 and y_1\n", + "\n", + "# Results\n", + "print \" For two phase region to exist at 90 C and 101.325 kPa, z_1 sholud lie between %f and %f\"%(x_1,y_1);\n", + "print \" For z_1 = 0.1 and z_1 = 0.5 only liquid phase exists V = 0.\"\n", + "print \" For z_1 = 0.8 only vapour exists V = 1.\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " For two phase region to exist at 90 C and 101.325 kPa, z_1 sholud lie between 0.574884 and 0.772458\n", + " For z_1 = 0.1 and z_1 = 0.5 only liquid phase exists V = 0.\n", + " For z_1 = 0.8 only vapour exists V = 1.\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.14 Page Number : 531" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "from numpy import zeros\n", + "\n", + "# Variables\n", + "T = 90;\t\t\t#[C]\n", + "P = 1;\t\t\t#[atm]\n", + "P = P*101325*10**(-3);\t\t\t#[kPa]\n", + "z_1 = [0.1,0.5,0.8];\n", + "\n", + "# math.log(P_1_sat) = 13.8594 - 2773.78/(t + 220.07)\n", + "# math.log(P_2_sat) = 14.0098 - 3103.01/(t + 219.79)\n", + "\n", + "# Calculations and Results\n", + "#(a)\n", + "#At T = 90 C\n", + "P_1_sat = math.exp(13.8594 - 2773.78/(T + 220.07));\n", + "P_2_sat = math.exp(14.0098 - 3103.01/(T + 219.79));\n", + "K_1 = P_1_sat/P;\n", + "\n", + "x_1 = [0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0];\n", + "P_prime = zeros(11);\n", + "x_2 = zeros(11);\n", + "y_1 = zeros(11);\n", + "\n", + "print \" a.\";\n", + "print \" x_1 \\t\\t P \\t\\t y_1 \";\n", + "\n", + "for i in range(11):\n", + " x_2[i] = 1 - x_1[i];\n", + " P_prime[i] = x_1[i]*P_1_sat + x_2[i]*P_2_sat;\n", + " y_1[i] = (x_1[i]*P_1_sat)/P_prime[i];\n", + " print \" %f \\t %f \\t %f \"%(x_1[i],P_prime[i],y_1[i]);\n", + "\n", + "\t\t\t#(b)\n", + "T_1_sat = 2773.78/(13.8594-math.log(P)) - 220.07;\t\t\t#[C]\n", + "T_2_sat = 3103.01/(14.0098-math.log(P)) - 219.79;\t\t\t#[C]\n", + "\n", + "T_prime = [110.62,107,104,101,98,95,92,89,86,83,80.09];\n", + "\n", + "P1_sat = zeros(11);\n", + "P2_sat = zeros(11);\n", + "x_1 = zeros(11);\n", + "y_1 = zeros(11);\n", + "\n", + "print \" b.\";\n", + "print \" TC \\t\\t P_1_sat kPa \\t\\t P_2_sat kPa \\t\\t x_1 \\t\\t y_1 \";\n", + "\n", + "for j in range(11):\n", + " P1_sat[j] = math.exp(13.8594 - 2773.78/(T_prime[j] + 220.07));\n", + " P2_sat[j] = math.exp(14.0098 - 3103.01/(T_prime[j] + 219.79));\n", + " x_1[j] = (P-P2_sat[j])/(P1_sat[j]-P2_sat[j]);\n", + " y_1[j] = (x_1[j]*P1_sat[j])/P;\n", + " print \" %f \\t %f \\t %f \\t %f \\t %f \"%(T_prime[j],P1_sat[j],P2_sat[j],x_1[j],y_1[j]);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a.\n", + " x_1 \t\t P \t\t y_1 \n", + " 0.000000 \t 54.233834 \t 0.000000 \n", + " 0.100000 \t 62.425251 \t 0.218098 \n", + " 0.200000 \t 70.616668 \t 0.385597 \n", + " 0.300000 \t 78.808085 \t 0.518277 \n", + " 0.400000 \t 86.999502 \t 0.625971 \n", + " 0.500000 \t 95.190920 \t 0.715131 \n", + " 0.600000 \t 103.382337 \t 0.790162 \n", + " 0.700000 \t 111.573754 \t 0.854176 \n", + " 0.800000 \t 119.765171 \t 0.909433 \n", + " 0.900000 \t 127.956588 \t 0.957615 \n", + " 1.000000 \t 136.148005 \t 1.000000 \n", + " b.\n", + " TC \t\t P_1_sat kPa \t\t P_2_sat kPa \t\t x_1 \t\t y_1 \n", + " 110.620000 \t 237.827187 \t 101.332530 \t -0.000055 \t -0.000129 \n", + " 107.000000 \t 216.742019 \t 91.320455 \t 0.079767 \t 0.170629 \n", + " 104.000000 \t 200.376847 \t 83.629571 \t 0.151570 \t 0.299740 \n", + " 101.000000 \t 184.975751 \t 76.460482 \t 0.229134 \t 0.418300 \n", + " 98.000000 \t 170.500977 \t 69.787769 \t 0.313139 \t 0.526923 \n", + " 95.000000 \t 156.915208 \t 63.586616 \t 0.404360 \t 0.626206 \n", + " 92.000000 \t 144.181607 \t 57.832824 \t 0.503680 \t 0.716718 \n", + " 89.000000 \t 132.263848 \t 52.502830 \t 0.612106 \t 0.799008 \n", + " 86.000000 \t 121.126156 \t 47.573718 \t 0.730789 \t 0.873601 \n", + " 83.000000 \t 110.733338 \t 43.023234 \t 0.861050 \t 0.941001 \n", + " 80.090000 \t 101.331285 \t 38.950606 \t 0.999899 \t 0.999961 \n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.15 Page Number : 533" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "P_1_sat = 79.80;\t\t\t#[kPa]\n", + "P_2_sat = 40.45;\t\t\t#[kPa]\n", + "\n", + "#(1)\n", + "T = 373.15;\t\t\t#[K]\n", + "x_1 = 0.05;\n", + "x_2 = 1 - x_1;\n", + "Y1 = math.exp(0.95*x_2**(2));\n", + "Y2 = math.exp(0.95*x_1**(2));\n", + "\n", + "# Calculations and Results\n", + "# The total pressure of the system is given by\n", + "P = x_1*Y1*P_1_sat + x_2*Y2*P_2_sat;\t\t\t#[kPa]\n", + "y_1 = x_1*Y1*P_1_sat/P;\n", + "y_2 = x_2*Y2*P_2_sat/P;\n", + "\n", + "print \" 1).The first bubble is formed at %f kPa and the composition y_1 = %f\"%(P,y_1);\n", + "\n", + "#(2)\n", + "T = 373.15;\t\t\t#[K]\n", + "y_1_prime = 0.05;\n", + "y_2_prime = 1 - y_1_prime;\n", + "\n", + "# Let us assume a value of x_1,\n", + "x_1_prime = 0.0001;\n", + "\n", + "error = 10;\n", + "while(error>0.001):\n", + " x_2_prime = 1 - x_1_prime;\n", + " Y1_prime = math.exp(0.95*x_2_prime**(2));\n", + " Y2_prime = math.exp(0.95*x_1_prime**(2));\n", + " P_prime = x_1_prime*Y1_prime*P_1_sat + x_2_prime*Y2_prime*P_2_sat;\n", + " x_1 = (y_1_prime*P_prime)/(Y1_prime*P_1_sat);\n", + " error=abs(x_1_prime - x_1);\n", + " x_1_prime = x_1_prime + 0.00001;\n", + "\n", + "P_2 = x_1_prime*Y1_prime*P_1_sat + x_2_prime*Y2_prime*P_2_sat;\n", + "\n", + "print \" 2).The first drop is formed at %f kPa and has the composition x_1 = %f\"%(P_2,x_1_prime);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The first bubble is formed at 47.923166 kPa and the composition y_1 = 0.196237\n", + " 2).The first drop is formed at 41.974204 kPa and has the composition x_1 = 0.009370\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.16 Page Number : 534" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "T = 78.15;\t\t\t#[C]\n", + "P_1_sat = 755;\t\t\t#[mm Hg]\n", + "P_2_sat = 329;\t\t\t#[mm Hg]\n", + "\n", + "z_1 = 0.3;\n", + "V = 0.5;\n", + "\n", + "# math.log(Y1) = 0.845/(1 + 0.845*(x_1/x_2))**(2)\n", + "# math.log(Y2) = 1/(1 + 1.183*(x_2/x_1))**(2)\n", + "\n", + "# A value of x_1 is to determined for which V = 0.5\n", + "# Let us assume a value of x_1, say x_1 = 0.150\n", + "x_1 = 0.150;\n", + "\n", + "# Calculations\n", + "error = 10;\n", + "while(error>0.001):\n", + " x_2 = 1 - x_1;\n", + " Y1 = math.exp(0.845/(1 + 0.845*(x_1/x_2))**(2));\n", + " Y2 = math.exp(1/(1 + 1.183*(x_2/x_1))**(2));\n", + " P = x_1*Y1*P_1_sat + x_2*Y2*P_2_sat;\n", + " y_1 = (x_1*Y1*P_1_sat)/P;\n", + " V_prime = (z_1 - x_1)/(y_1 - x_1);\n", + " error=abs(V_prime - V);\n", + " x_1 = x_1 + 0.00001;\n", + "\n", + "P_prime = x_1*Y1*P_1_sat + x_2*Y2*P_2_sat;\t\t\t#[mm hg]\n", + "\n", + "# At x_1 , V = 0.5, \n", + "# Therefore when the mixture is 50 % vaporized at 78.15 C the mole fraction of component 1 in the liquid phase is x_1 and the system pressure is P_prime\n", + "\n", + "# Results\n", + "print \" The required pressure is %f mm Hg\"%(P_prime);\n", + "print \" and the mole fraction of component 1 in the liquid phase for this pressure is x_1 = %f\"%(x_1);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The required pressure is 505.838606 mm Hg\n", + " and the mole fraction of component 1 in the liquid phase for this pressure is x_1 = 0.157650\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.17 Page Number : 536" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "from scipy.stats import linregress\n", + "\n", + "# Variables\n", + "T = 25;\t\t\t#[C] - Temperature\n", + "P = [118.05,124.95,137.90,145.00,172.90,207.70,227.70,237.85,253.90,259.40,261.10,262.00,258.70,252.00,243.80];\t\t\t#[mm Hg]\n", + "x_1 = [0.0115,0.0160,0.0250,0.0300,0.0575,0.1125,0.1775,0.2330,0.4235,0.5760,0.6605,0.7390,0.8605,0.9250,0.9625];\n", + "y_1 = [0.1810,0.2250,0.3040,0.3450,0.4580,0.5670,0.6110,0.6325,0.6800,0.7050,0.7170,0.7390,0.8030,0.8580,0.9160];\n", + "\n", + "# Pressure value for which x_1 = y_1 = 0, corresponds to P_2_sat,therefore\n", + "P_2_sat = 97.45;\t\t\t#[mm Hg]\n", + "# Pressure value for which x_1 = y_1 = 1, corresponds to P_1_sat,therefore\n", + "P_1_sat = 230.40;\t\t\t#[mm Hg]\n", + "\n", + "x_2 = zeros(15);\n", + "y_2 = zeros(15);\n", + "Y1 = zeros(15);\n", + "Y2 = zeros(15);\n", + "GE_RT = zeros(15);\n", + "x1x2_GE_RT = zeros(15);\n", + "\n", + "# Calculations\n", + "for i in range(15):\n", + " x_2[i] = 1 - x_1[i];\n", + " y_2[i] = 1 - y_1[i];\n", + " Y1[i] = (y_1[i]*P[i])/(x_1[i]*P_1_sat);\n", + " Y2[i] = (y_2[i]*P[i])/(x_2[i]*P_2_sat);\n", + " GE_RT[i] = x_1[i]*math.log(Y1[i]) + x_2[i]*math.log(Y2[i]);\t\t\t# G_E/(R*T)\n", + " x1x2_GE_RT[i] = (x_1[i]*x_2[i])/GE_RT[i];\n", + "\n", + "\n", + "#[M,N,sig]=reglin(x_1,x1x2_GE_RT);\n", + "M,N,sig,d,e = linregress(x_1,x1x2_GE_RT);\n", + "\n", + "# Linear regression between x_1 and x_1*x_2/(G_E/R*T) gives intercept = N and slope = M\n", + "\n", + "# van Laar equation is x_1*x_2/(G_E/R*T) = 1/A + (1/B - 1/A)\n", + "# 1/A = N\n", + "A = 1/N;\n", + "B = 1/(M + 1/A);\n", + "\n", + "# Results\n", + "print \" The value of Van Laar coefficient A = %f\"%(A);\n", + "print \" The value of Van Laar coefficient B = %f\"%(B);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The value of Van Laar coefficient A = 2.270624\n", + " The value of Van Laar coefficient B = 1.781821\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.18 Page Number : 541" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "# Variables\n", + "T = 343.15;\t\t\t#[K] - Temperature\n", + "# At 343.15 K\n", + "# math.log(Y1) = 0.95*x_2**(2)\n", + "# math.log(Y2) = 0.95*x_1**(2)\n", + "P_1_sat = 79.80;\t\t\t#[kPa]\n", + "P_2_sat = 40.50;\t\t\t#[kPa]\n", + "\n", + "# Calculations\n", + "# At x_1 = 0,\n", + "Y1_infinity = math.exp(0.95);\n", + "alpha_12_x0 = (Y1_infinity*P_1_sat)/(P_2_sat);\n", + "# At x_1 = 1,\n", + "Y2_infinity = math.exp(0.95);\n", + "alpha_12_x1 = (P_1_sat)/(Y2_infinity*P_2_sat);\n", + "\n", + "# Within the range alpha_12_x0 and alpha_12_x1, the relative volatility continuously decrease and thus a value of 1.0 is obtained and thus azeotrope is formed.\n", + "# At azeotrope, Y1*P1_sat = Y2*P2_sat\n", + "# Y2/Y1 = P_1_sat/P_2_sat\n", + "# Taking math.logarithm of both sides we get\n", + "# math.log(Y2) - math.log(Y1) = math.log(P_1_sat/P_2_sat)\n", + "# 0.95*x_1**(2) - 0.95*x_2**(2) = math.log(P_1_sat/P_2_sat)\n", + "# Solving the above equation\n", + "def f(x_1): \n", + "\t return 0.95*x_1**(2) - 0.95*(1-x_1)**(2) - math.log(P_1_sat/P_2_sat)\n", + "x_1 = fsolve(f,0.1)\n", + "\n", + "# At x_1\n", + "x_2 = 1 - x_1;\n", + "Y1 = math.exp(0.95*x_2**(2));\n", + "Y2 = math.exp(0.95*x_1**(2));\n", + "P = x_1*Y1*P_1_sat + x_2*Y2*P_2_sat;\t\t\t#[kPa] - Azeotrope pressure\n", + "y_1 = (x_1*Y1*P_1_sat)/P;\n", + "\n", + "# Since x_1 = y_1, (almost equal) ,the above condition is of azeotrope formation\n", + "\n", + "# Since alpha_12 is a continuous curve and in between a value of alpha_12 = 1, shall come and at this composition the azeotrope shall get formed.\n", + "\n", + "# Results\n", + "print \" Since alpha_12_x=0 = %f and alpha_12_x=1 = %f \"%(alpha_12_x0,alpha_12_x1);\n", + "print \" and since alpha_12 is a continuous curve and in between a value of alpha_12 = 1, shall come and at this composition the azeotrope shall get formed.\"\n", + "print \" The azeotrope composition is x_1 = y_1 = %f\"%(x_1);\n", + "print \" The azeotrope presssure is %f kPa\"%(P);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Since alpha_12_x=0 = 5.094806 and alpha_12_x=1 = 0.762023 \n", + " and since alpha_12 is a continuous curve and in between a value of alpha_12 = 1, shall come and at this composition the azeotrope shall get formed.\n", + " The azeotrope composition is x_1 = y_1 = 0.856959\n", + " The azeotrope presssure is 81.366308 kPa\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.19 Page Number : 541" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 45;\t\t\t#[C] - Temperature\n", + "\n", + "x_1 = [0.0455,0.0940,0.1829,0.2909,0.3980,0.5069,0.5458,0.5946,0.7206,0.8145,0.8972,0.9573];\n", + "y_1 = [0.1056,0.1818,0.2783,0.3607,0.4274,0.4885,0.5098,0.5375,0.6157,0.6913,0.7869,0.8916];\n", + "P = [31.957,33.553,35.285,36.457,36.996,37.068,36.978,36.778,35.792,34.372,32.331,30.038];\n", + "\n", + "\t\t\t# Pressure value for which x_1 = y_1 = 0, corresponds to P_2_sat,therefore\n", + "P_2_sat = 29.819;\t\t\t#[kPa]\n", + "\t\t\t# Pressure value for which x_1 = y_1 = 1, corresponds to P_1_sat,therefore\n", + "P_1_sat = 27.778;\t\t\t#[kPa]\n", + "\n", + "x_2 = zeros(12);\n", + "y_2 = zeros(12);\n", + "Y1 = zeros(12);\n", + "Y2 = zeros(12);\n", + "alpha_12 = zeros(12);\n", + "GE_RT = zeros(12);\n", + "x1x2_GE_RT = zeros(12);\n", + "# Calculations and Results\n", + "print \" x_1 \\t\\t y_1 \\t P \\t\\t Y1 \\t\\tY2 \\t alpha_12 \\t G_E/RT \\t x1*x2/G_E/RT\";\n", + "\n", + "for i in range(12):\n", + " x_2[i] = 1 - x_1[i];\n", + " y_2[i] = 1 - y_1[i];\n", + " Y1[i] = (y_1[i]*P[i])/(x_1[i]*P_1_sat);\n", + " Y2[i] = (y_2[i]*P[i])/(x_2[i]*P_2_sat);\n", + " alpha_12[i] = (y_1[i]/x_1[i])/(y_2[i]/x_2[i]);\n", + " GE_RT[i] = x_1[i]*math.log(Y1[i]) + x_2[i]*math.log(Y2[i]);\t\t\t# G_E/(R*T)\n", + " x1x2_GE_RT[i] = (x_1[i]*x_2[i])/GE_RT[i];\n", + " print \" %f\\t %f\\t %f \\t %f \\t %f \\t %f\\t %f \\t%f\"%(x_1[i],y_1[i],P[i],Y1[i],Y2[i],alpha_12[i],GE_RT[i],x1x2_GE_RT[i]);\n", + "\n", + "\t\t\t#[M,N,sig]=reglin(x_1,x1x2_GE_RT);\n", + "M,N,sig,d,e=linregress(x_1,x1x2_GE_RT);\n", + "\n", + "\t\t\t# Linear regression between x_1 and x_1*x_2/(G_E/R*T) gives intercept = N and slope = M\n", + "\n", + "\t\t\t# Now let us assume the system to follow van Laar activity coefficient model. \n", + "\t\t\t# x_1*x_2/(G_E/(R*T)) = x_1/B + x_2/A = x_1/B + (1 - x_1)/A = 1/A + (1/B - 1/A)*x_1 = N + M*x_1\n", + "\n", + "\t\t\t# 1/A = N\n", + "A = 1/N;\n", + "\t\t\t# (1/B - 1/A) = M\n", + "B = 1/(M + 1/A);\n", + "\n", + "print \"\"\n", + "print \" The value of van Laar parameters are, A = %f and B = %f \"%(A,B);\n", + "\n", + "Y1_infinity = math.exp(A);\n", + "Y2_infinity = math.exp(B);\n", + "\n", + "\n", + "\t\t\t# Azeotrope is formed when maxima ( or mainina) in pressure is observed and relative volatility becomes 1.\n", + "\t\t\t# This is the case for x_1 between 0.2980 and 0.5458. \n", + "\t\t\t# The ezeotropr os maximum pressure (and thus minimum boiling) because at azeotrope the system pressure is greater than vapour pressure of pure components.\n", + "\n", + "\t\t\t# Now let us calculate the azeotrope composition.\n", + "\t\t\t# At azeotrope, Y1*P1_sat = Y2*P2_sat\n", + "\t\t\t# math.log(Y1/Y2) = math.log(P_2_sat/P_1_sat)\n", + "\t\t\t# From van Laar model we get\n", + "\t\t\t# math.log(P_2_sat/P_1_sat) = (A*B**(2)*2*x_2**(2))/(A*x_1 + B*x_2)**(2) + (B*A**(2)*2*x_1**(2))/(A*x_1 + B*x_2)**(2)\n", + "\t\t\t# Solving the above equation\n", + "def f(x_1): \n", + "\t return math.log(P_2_sat/P_1_sat) - (A*B**(2)*(1-x_1)**(2))/(A*x_1 + B*(1-x_1))**(2) + (B*A**(2)*x_1**(2))/(A*x_1 + B*(1-x_1))**(2)\n", + "x_1 = fsolve(f,0.1)\n", + "\n", + "print \" The azeotrope composition is given by x_1 = y_1 = %f\"%(x_1);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " x_1 \t\t y_1 \t P \t\t Y1 \t\tY2 \t alpha_12 \t G_E/RT \t x1*x2/G_E/RT\n", + " 0.045500\t 0.105600\t 31.957000 \t 2.670039 \t 1.004220 \t 2.476833\t 0.048705 \t0.891698\n", + " 0.094000\t 0.181800\t 33.553000 \t 2.336127 \t 1.016177 \t 2.141582\t 0.094298 \t0.903137\n", + " 0.182900\t 0.278300\t 35.285000 \t 1.932808 \t 1.045150 \t 1.722733\t 0.156610 \t0.954268\n", + " 0.290900\t 0.360700\t 36.457000 \t 1.627355 \t 1.102263 \t 1.375325\t 0.210697 \t0.979023\n", + " 0.398000\t 0.427400\t 36.996000 \t 1.430228 \t 1.180094 \t 1.129007\t 0.242105 \t0.989635\n", + " 0.506900\t 0.488500\t 37.068000 \t 1.285998 \t 1.289486 \t 0.929034\t 0.252871 \t0.988458\n", + " 0.545800\t 0.509800\t 36.978000 \t 1.243394 \t 1.338371 \t 0.865446\t 0.251278 \t0.986567\n", + " 0.594600\t 0.537500\t 36.778000 \t 1.196853 \t 1.407094 \t 0.792366\t 0.245302 \t0.982671\n", + " 0.720600\t 0.615700\t 35.792000 \t 1.100930 \t 1.650961 \t 0.621199\t 0.209369 \t0.961630\n", + " 0.814500\t 0.691300\t 34.372000 \t 1.050218 \t 1.918247 \t 0.510015\t 0.160745 \t0.939933\n", + " 0.897200\t 0.786900\t 32.331000 \t 1.020818 \t 2.247586 \t 0.423097\t 0.101740 \t0.906550\n", + " 0.957300\t 0.891600\t 30.038000 \t 1.007145 \t 2.557286 \t 0.366877\t 0.046909 \t0.871410\n", + "\n", + " The value of van Laar parameters are, A = 1.049085 and B = 1.064514 \n", + " The azeotrope composition is given by x_1 = y_1 = 0.468254\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.20 Page Number : 541" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 25;\t\t\t#[C] - Temperature\n", + "P_1_sat = 230.4;\t\t\t#[mm Hg]\n", + "P_2_sat = 97.45;\t\t\t#[mm Hg]\n", + "Y1_infinity = 8.6;\n", + "Y2_infinity = 6.6;\n", + "\n", + "\t\t\t# Assuming ideal vpour behaviour means that phi = 1 and since system pressure is low, therefore\n", + "\t\t\t# f_i = P_i_sat \n", + "\t\t\t# Assuming the activity coefficients to follow van Laar model we get\n", + "A = math.log(Y1_infinity);\n", + "B = math.log(Y2_infinity);\n", + "\n", + "\t\t\t#math.log(Y1) = A/(1+ (A*x_1)/(B*x_2))**(2)\n", + "\t\t\t# math.log(Y2) = B/(1+ (B*x_2)/(A*x_1))**(2)\n", + "\n", + "x_1 = [0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9];\n", + "\n", + "x_2 = zeros(9);\n", + "Y1 = zeros(9);\n", + "Y2 = zeros(9);\n", + "y1_P = zeros(9);\n", + "y2_P = zeros(9);\n", + "P = zeros(9);\n", + "y_1 = zeros(9);\n", + "\n", + "print \" a.\";\n", + "print \" x_1 \\t\\t Y1 \\t\\t Y2 \\t\\t y1*P \\t\\t y2*P \\t\\t P \\t\\t y_1 \";\n", + "# Calculations and Results\n", + "for i in range(9):\n", + " x_2[i] = 1 - x_1[i];\n", + " Y1[i] = math.exp(A/(1+ (A*x_1[i])/(B*x_2[i]))**(2));\n", + " Y2[i] = math.exp(B/(1+ (B*x_2[i])/(A*x_1[i]))**(2));\n", + " y1_P[i] = x_1[i]*Y1[i]*P_1_sat;\n", + " y2_P[i] = x_2[i]*Y2[i]*P_2_sat;\n", + " P[i] = x_1[i]*Y1[i]*P_1_sat + x_2[i]*Y2[i]*P_2_sat;\n", + " y_1[i] = (x_1[i]*Y1[i]*P_1_sat)/P[i];\n", + " print \" %f\\t\\t %f\\t\\t %f \\t\\t %f \\t\\t %f \\t\\t %f \\t %f\"%(x_1[i],Y1[i],Y2[i],y1_P[i],y2_P[i],P[i],y_1[i]);\n", + "\n", + "\t\t\t#(b)\n", + "\t\t\t# The total system pressure versus x_1 shows a maxima and thus azeotrope is formed by the VLE system\n", + "\t\t\t# The maxima occurs in the range of x_1 = 0.6 to 0.8, so an azeotrope is formed in this composition range\n", + "\n", + "\t\t\t# At the azeotrope point, Y1*P1_sat = Y2*P2_sat\n", + "\t\t\t# math.log(Y1) - math.log(Y2) = math.log(P_2_sat/P_1_sat)\n", + "\t\t\t# On putting the values and then solving the above equation we get\n", + "def f(x_1): \n", + "\t return A/(1+1.14*x_1/(1-x_1))**(2)- B/(1+0.877*(1-x_1)/x_1)**(2) - math.log(P_2_sat/P_1_sat)\n", + "x_1_prime = fsolve(f,0.1)\n", + "\n", + "\t\t\t# At x_1\n", + "x_2_prime = 1 - x_1_prime;\n", + "Y1_prime = math.exp(A/(1+ (A*x_1_prime)/(B*x_2_prime))**(2));\n", + "Y2_prime = math.exp(B/(1+ (B*x_2_prime)/(A*x_1_prime))**(2));\n", + "P_prime = x_1_prime*Y1_prime*P_1_sat + x_2_prime*Y2_prime*P_2_sat;\t\t\t#[kPa] - Azeotrope pressure\n", + "y_1_prime = (x_1_prime*Y1_prime*P_1_sat)/P_prime;\n", + "\n", + "\t\t\t# Since x_1 = y_1,azeotrope formation will take place\n", + "print \" b\";\n", + "print \" The total system pressure versus x_1 shows a maxima and thus azeotrope is formed by the VLE system\";\n", + "print \" The azeotrope composition is x_1 = y_1 = %f\"%(x_1_prime);\n", + "print \" The azeotrope presssure is %f mm Hg\"%(P_prime);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a.\n", + " x_1 \t\t Y1 \t\t Y2 \t\t y1*P \t\t y2*P \t\t P \t\t y_1 \n", + " 0.100000\t\t 5.446877\t\t 1.024149 \t\t 125.496041 \t\t 89.822961 \t\t 215.319002 \t 0.582838\n", + " 0.200000\t\t 3.680305\t\t 1.097308 \t\t 169.588473 \t\t 85.546152 \t\t 255.134625 \t 0.664702\n", + " 0.300000\t\t 2.640401\t\t 1.225500 \t\t 182.504521 \t\t 83.597451 \t\t 266.101972 \t 0.685844\n", + " 0.400000\t\t 2.002736\t\t 1.421865 \t\t 184.572186 \t\t 83.136461 \t\t 267.708646 \t 0.689452\n", + " 0.500000\t\t 1.599580\t\t 1.708524 \t\t 184.271623 \t\t 83.247849 \t\t 267.519472 \t 0.688816\n", + " 0.600000\t\t 1.340316\t\t 2.120132 \t\t 185.285311 \t\t 82.642744 \t\t 267.928055 \t 0.691549\n", + " 0.700000\t\t 1.174189\t\t 2.709824 \t\t 189.373156 \t\t 79.221704 \t\t 268.594861 \t 0.705051\n", + " 0.800000\t\t 1.072057\t\t 3.558780 \t\t 197.601501 \t\t 69.360613 \t\t 266.962114 \t 0.740186\n", + " 0.900000\t\t 1.017109\t\t 4.791470 \t\t 210.907696 \t\t 46.692876 \t\t 257.600573 \t 0.818739\n", + " b\n", + " The total system pressure versus x_1 shows a maxima and thus azeotrope is formed by the VLE system\n", + " The azeotrope composition is x_1 = y_1 = 0.706548\n", + " The azeotrope presssure is 268.599631 mm Hg\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.21 Page Number : 544" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T = 50;\t\t\t#[C]\n", + "\t\t\t# At 50 C\n", + "P_1_sat = 0.67;\t\t\t#[atm]\n", + "P_2_sat = 0.18;\t\t\t#[atm]\n", + "Y1_infinity = 2.5;\n", + "Y2_infinity = 7.2;\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#(1)\n", + "\t\t\t# alpha_12 = (y_1/x_1)/(y_2/x_2) = (Y1*P_1_sat)/((Y2*P_2_sat))\n", + "\t\t\t# At x_1 tending to zero,\n", + "alpha_12_x0 = (Y1_infinity*P_1_sat)/(P_2_sat);\n", + "\t\t\t# At x_1 tending to 1,\n", + "alpha_12_x1 = (P_1_sat)/((Y2_infinity*P_2_sat));\n", + "\n", + "\t\t\t# Since alpha_12 is a continuous curve and in between a value of alpha_12 = 1, shall come and at this composition the azeotrope shall get formed.\n", + "print \" 1).Since alpha_12_x=0) = %f and alpha_12_x=1) = %f \"%(alpha_12_x0,alpha_12_x1);\n", + "print \" and since alpha_12 is a continuous curve and in between a value of alpha_12 = 1 shall come and at this composition azeotrope shall get formed.\"\n", + "\n", + "\t\t\t#(b)\n", + "\t\t\t# Since the activity coefficient values are greater than 1 ,therefore the deviations from Roult's law is positive\n", + "\t\t\t# and the azeotrope is maximum pressure (or minimum boiling)\n", + "print \" 2).Since the activity coefficient values are greater than 1 therefore the deviations from Roults law is positive\"\n", + "print \" and the azeotrope is maximum pressure or minimum boiling\";\n", + "\n", + "\t\t\t#(3)\n", + "\t\t\t# Let us assume the system to follow van Laar activity coefficient model\n", + "A = math.log(Y1_infinity);\n", + "B = math.log(Y2_infinity);\n", + "\n", + "\t\t\t# math.log(Y1) = A/(1+ (A*x_1)/(B*x_2))**(2)\n", + "\t\t\t# math.log(Y2) = B/(1+ (B*x_2)/(A*x_1))**(2)\n", + "\n", + "\t\t\t# At the azeotrope point, Y1*P1_sat = Y2*P2_sat\n", + "\t\t\t# math.log(Y1) - math.log(Y2) = math.log(P_2_sat/P_2_sat)\n", + "\t\t\t# On putting the values and then solving the above equation\n", + "def f(x_1): \n", + "\t return A/(1+ (A*x_1)/(B*(1-x_1)))**(2)- B/(1+ (B*(1-x_1))/(A*x_1))**(2) - math.log(P_2_sat/P_1_sat)\n", + "x_1 = fsolve(f,0.1)\n", + "\n", + "\t\t\t# At x_1\n", + "x_2 = 1 - x_1;\n", + "Y1 = math.exp(A/(1+ (A*x_1)/(B*x_2))**(2));\n", + "Y2 = math.exp(B/(1+ (B*x_2)/(A*x_1))**(2));\n", + "P = x_1*Y1*P_1_sat + x_2*Y2*P_2_sat;\t\t\t#[kPa] - Azeotrope pressure\n", + "y_1 = (x_1*Y1*P_1_sat)/P;\n", + "\n", + "\t\t\t# Since x_1 = y_1,the azeotrope formation will take place\n", + "\n", + "print \" 3).The azeotrope composition is x_1 = y_1 = %f\"%(x_1);\n", + "print \" The azeotrope presssure is %f atm\"%(P);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).Since alpha_12_x=0) = 9.305556 and alpha_12_x=1) = 0.516975 \n", + " and since alpha_12 is a continuous curve and in between a value of alpha_12 = 1 shall come and at this composition azeotrope shall get formed.\n", + " 2).Since the activity coefficient values are greater than 1 therefore the deviations from Roults law is positive\n", + " and the azeotrope is maximum pressure or minimum boiling\n", + " 3).The azeotrope composition is x_1 = y_1 = 0.910173\n", + " The azeotrope presssure is 0.689143 atm\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.22 Page Number : 545" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 25;\t\t\t#[C]\n", + "\t\t\t# At 50 C\n", + "P_1_sat = 7.866;\t\t\t#[kPa]\n", + "P_2_sat = 3.140;\t\t\t#[kPa]\n", + "\n", + "\t\t\t# G_E/(R*T) = 1.4938*x_1*x_2/(1.54*x_1 + 0.97*x_2)\n", + "\n", + "\t\t\t# The excess Gibbs free energy math.expression can be written as\n", + "\t\t\t# x_1*x_2/(G_E/(R*T)) = 1.54*x_1/1.4938 + 0.97*x_2/1.4938 = x_1/0.97 + x_2/1.54\n", + "\n", + "\t\t\t# Comparing with the van Laar math.expression\n", + "\t\t\t# x_1*x_2/(G_E/(R*T)) = x_1/B + x_2/A, we get\n", + "A = 1.54;\n", + "B = 0.97;\n", + "\n", + "\t\t\t# The activity coefficients are thus given by\n", + "\t\t\t# math.log(Y1) = A/(1+ (A*x_1)/(B*x_2))**(2)\n", + "\t\t\t# math.log(Y2) = B/(1+ (B*x_2)/(A*x_1))**(2)\n", + "\n", + "x_1 = [0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,0.95];\n", + "\n", + "x_2 = zeros(10);\n", + "Y1 = zeros(10);\n", + "Y2 = zeros(10);\n", + "P = zeros(10);\n", + "y_1 = zeros(10);\n", + "\n", + "print \" x_1 \\t\\t Y1 \\t\\t Y2 \\t\\t P kPa \\t\\t y_1 \";\n", + "\n", + "# Calculations and Results\n", + "for i in range(10):\n", + " x_2[i] = 1 - x_1[i];\n", + " Y1[i] = math.exp(A/(1+ (A*x_1[i])/(B*x_2[i]))**(2));\n", + " Y2[i] = math.exp(B/(1+ (B*x_2[i])/(A*x_1[i]))**(2));\n", + " P[i] = x_1[i]*Y1[i]*P_1_sat + x_2[i]*Y2[i]*P_2_sat;\n", + " y_1[i] = (x_1[i]*Y1[i]*P_1_sat)/P[i];\n", + " print \" %f\\t\\t %f\\t\\t %f \\t\\t %f \\t\\t %f \"%(x_1[i],Y1[i],Y2[i],P[i],y_1[i]);\n", + "\n", + "\n", + "\t\t\t# The azeotrope is formed near x_1 = 0.95 as in this region a maxima in pressure is obtained.\n", + "\n", + "\t\t\t# At the azeotrope point, Y1*P1_sat = Y2*P2_sat\n", + "\t\t\t# math.log(Y1) - math.log(Y2) = math.log(P_2_sat/P_2_sat)\n", + "\t\t\t# On putting the values and then solving the above equation\n", + "def f(x_1): \n", + "\t return A/(1+ (A*x_1)/(B*(1-x_1)))**(2)- B/(1+ (B*(1-x_1))/(A*x_1))**(2) - math.log(P_2_sat/P_1_sat)\n", + "x_1_prime = fsolve(f,0.1)\n", + "\n", + "\t\t\t# At x_1\n", + "x_2_prime = 1 - x_1_prime;\n", + "Y1_prime = math.exp(A/(1+ (A*x_1_prime)/(B*x_2_prime))**(2));\n", + "Y2_prime = math.exp(B/(1+ (B*x_2_prime)/(A*x_1_prime))**(2));\n", + "P_prime = x_1_prime*Y1_prime*P_1_sat + x_2_prime*Y2_prime*P_2_sat;\t\t\t#[kPa] - Azeotrope pressure\n", + "y_1_prime = (x_1_prime*Y1_prime*P_1_sat)/P_prime;\n", + "\n", + "\t\t\t# Since x_1_prime = y_1_prime,the azeotrope formation will take place\n", + "\n", + "print \" Part II \";\n", + "print \" The azeotrope composition is x_1 = y_1 = %f\"%(x_1_prime);\n", + "print \" The azeotrope presssure is %f kPa \"%(P_prime);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " x_1 \t\t Y1 \t\t Y2 \t\t P kPa \t\t y_1 \n", + " 0.100000\t\t 3.042798\t\t 1.022050 \t\t 5.281779 \t\t 0.453155 \n", + " 0.200000\t\t 2.201629\t\t 1.081457 \t\t 6.180223 \t\t 0.560433 \n", + " 0.300000\t\t 1.725242\t\t 1.172375 \t\t 6.648107 \t\t 0.612389 \n", + " 0.400000\t\t 1.438293\t\t 1.292347 \t\t 6.960227 \t\t 0.650186 \n", + " 0.500000\t\t 1.258593\t\t 1.440723 \t\t 7.211980 \t\t 0.686364 \n", + " 0.600000\t\t 1.144175\t\t 1.617876 \t\t 7.432102 \t\t 0.726584 \n", + " 0.700000\t\t 1.072060\t\t 1.824770 \t\t 7.621913 \t\t 0.774475 \n", + " 0.800000\t\t 1.028913\t\t 2.062721 \t\t 7.770131 \t\t 0.833286 \n", + " 0.900000\t\t 1.006610\t\t 2.333241 \t\t 7.858834 \t\t 0.906775 \n", + " 0.950000\t\t 1.001587\t\t 2.481217 \t\t 7.874109 \t\t 0.950528 \n", + " Part II \n", + " The azeotrope composition is x_1 = y_1 = 0.958680\n", + " The azeotrope presssure is 7.874467 kPa \n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.23 Page Number : 547" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 58.7;\t\t\t#[C]\n", + "P = 1;\t\t\t#[atm]\n", + "P = P*101325*10**(-3);\t\t\t#[kPa]\n", + "\n", + "\t\t\t# math.log(P_sat) = 16.6758 - 3674.49/(t + 226.45) - For ethyl alcohol\n", + "\t\t\t# math.log(P_sat) = 13.8216 - 2697.55/(t + 224.37) - For hexane\n", + "\n", + "\t\t\t# Let us take hexane as (1) and ethanol as (2)\n", + "\t\t\t# At 58.7 C\n", + "P_1_sat = math.exp(13.8216 - 2697.55/(T + 224.37));\t\t\t#[kPa]\n", + "P_2_sat = math.exp(16.6758 - 3674.49/(T + 226.45));\t\t\t#[kPa]\n", + "\n", + "# Calculations and Results\n", + "Y1 = P/P_1_sat;\n", + "Y2 = P/P_2_sat;\n", + "\n", + "x_2 = 0.332;\t\t\t# Mol % of ethanol (given)\n", + "x_1 = 1 - x_2;\t\t\t# Mol % of hehane\n", + "\n", + "\t\t\t# The van Laar parameters are given by\n", + "A = ((1 + (x_2*math.log(Y2))/(x_1*math.log(Y1)))**(2))*math.log(Y1);\n", + "B = ((1 + (x_1*math.log(Y1))/(x_2*math.log(Y2)))**(2))*math.log(Y2);\n", + "\n", + "print \" The value of van Laar parameters are A = %f and B = %f \"%(A,B);\n", + "\n", + "\t\t\t# Now let us calvulate the distribution coefficient K\n", + "x_1_prime = 0.5;\t\t\t#[given]\n", + "x_2_prime = 1 - x_1_prime;\n", + "\n", + "\t\t\t# The activity coefficients are thus given by\n", + "\t\t\t# math.log(Y1) = A/(1+ (A*x_1)/(B*x_2))**(2)\n", + "\t\t\t# math.log(Y2) = B/(1+ (B*x_2)/(A*x_1))**(2)\n", + "\n", + "Y1_prime = math.exp(A/(1+ (A*x_1_prime)/(B*x_2_prime))**(2));\n", + "Y2_prime = math.exp(B/(1+ (B*x_2_prime)/(A*x_1_prime))**(2));\n", + "P_prime = x_1_prime*Y1_prime*P_1_sat + x_2_prime*Y2_prime*P_2_sat;\n", + "\n", + "\t\t\t# We have, K_1 = y_1/x_1 = Y1*P_1_sat/P\n", + "K_1 = Y1_prime*P_1_sat/P_prime;\n", + "\n", + "print \" The distribution coefficient is given by K_1 = %f\"%(K_1)\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The value of van Laar parameters are A = 1.669879 and B = 2.662289 \n", + " The distribution coefficient is given by K_1 = 1.352866\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch16_1-checkpoint.ipynb b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch16_1-checkpoint.ipynb new file mode 100644 index 00000000..69003cd3 --- /dev/null +++ b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch16_1-checkpoint.ipynb @@ -0,0 +1,753 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:a00a89ec39a5812cdf143d7f00f601a0bb401404f1638737e2689f71d07acb65" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 16 : Other Phase Equilibria" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 16.1 Page Number : 564" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math \n", + "\n", + "# Variables\t\t\t\n", + "T = 0 + 273.15;\t\t\t#[K] - Temperature\n", + "P = 20*10**(5);\t\t\t#[Pa] - Pressure\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "\t\t\t#componenet 1 : methane (1)\n", + "\t\t\t#componenet 2 : methanol (2)\n", + "\n", + "H_constant = 1022;\t\t\t#[bar] - Henry's law constant\n", + "H_constant = H_constant*10**(5);\t\t\t#[Pa]\n", + "\n", + "\t\t\t# The second virial coefficients are\n", + "B_11 = -53.9;\t\t\t#[cm**(3)/mol]\n", + "B_11 = B_11*10**(-6);\t\t\t#[m**(3)/mol]\n", + "B_12 = -166;\t\t\t#[cm**(3)/mol]\n", + "B_12 = B_12*10**(-6);\t\t\t#[m**(3)/mol]\n", + "B_22 = -4068;\t\t\t#[cm**(3)/mol]\n", + "B_22 = B_22*10**(-6);\t\t\t#[m**(3)/mol]\n", + "\n", + "den_meth = 0.8102;\t\t\t#[g/cm**(3)] - Density of methanol at 0 C\n", + "Mol_wt_meth = 32.04;\t\t\t# Molecular weight of methanol\n", + "P_2_sat = 0.0401;\t\t\t#[bar] - Vapour pressure of methanol at 0 C\n", + "\n", + "# Calculations\n", + "\t\t\t#The molar volume of methanol can be calculated as\n", + "V_2_liq = (1/(den_meth/Mol_wt_meth))*10**(-6);\t\t\t#[m**(3)/mol]\n", + "\n", + "\t\t\t#The phase equilibrium equation of the components at high pressure\n", + "\t\t\t#y1*phi_1*P = x_1*H_1\n", + "\t\t\t#y2*phi_2*P = x_2*H_2\n", + "\n", + "\t\t\t#Since methane follows Henry's law therefore methanol follows the lewis-Rnadall rule\n", + "\t\t\t#f_2 is the fugacity of the compressed liquid which is calculated using\n", + "\t\t\t#f_2 = f_2_sat*math.exp[V_2_liq*(P - P_sat_2)/(R*T)]\n", + "\t\t\t#where f_2_sat can be calculated using virial equation \n", + "\t\t\t# math.log(phi_2_sat) = math.log(f_2_sat/P_2_sat) = (B_22*P_2_sat)/(R*T)\n", + "\n", + "f_2_sat = P_2_sat*math.exp((B_22*P_2_sat*10**(5))/(R*T));\t\t\t#[bar]\n", + "\n", + "\t\t\t#Putting the value of 'f_2_sat' in the math.expression of f_2 , we get\n", + "f_2 = f_2_sat*math.exp(V_2_liq*(P - P_2_sat*10**(5))/(R*T));\t\t\t#[bar]\n", + "\n", + "\t\t\t#Now let us calculate the fugacity coefficients of the species in the vapour mixture\n", + "del_12 = 2*B_12 - B_11 - B_22;\t\t\t#[m**(3)/mol]\n", + "\n", + "\t\t\t#math.log(phi_1) = (P/(R*T))*(B_11 + y2**(2)*del_12)\n", + "\t\t\t#math.log(phi_2) = (P/(R*T))*(B_22 + y1**(2)*del_12)\n", + "\n", + "\n", + "\t\t\t#The calculation procedure is to assume a value of y1, calculate 'phi_1' and 'phi_2' and calculate 'x_1' and 'x_2' from the phase equilibrium equations and see whether x_1 + x_2 = 1,if not then another value of y1 is assumed.\n", + "\n", + "y2 = 0.1;\n", + "error=10;\n", + "\n", + "while(error>0.001):\n", + " y1=1-y2;\n", + " phi_1 = math.exp((P/(R*T))*((B_11 + y2**(2)*del_12)));\n", + " phi_2 = math.exp((P/(R*T))*((B_22 + y1**(2)*del_12)));\n", + " x_1 = (y1*phi_1*P)/H_constant;\n", + " x_2 = (y2*phi_2*P)/(f_2*10**(5));\n", + " x = x_1 + x_2;\n", + " error=abs(1-x);\n", + " y2=y2 - 0.000001;\n", + "\n", + "# Results\n", + "print \" The solubility of methane in methanol is given by x1 = %f\"%(x_1);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The solubility of methane in methanol is given by x1 = 0.018614\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 16.2 Page Number : 566" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "# Variables\n", + "x_C2H6_1 = 0.33*10**(-4);\t\t\t# Solubility of ethane in water at 25 C and 1 bar\n", + "\n", + "\t\t\t#componenet 1 : ethane (1)\n", + "\t\t\t#componenet 2 : water (2)\n", + "\n", + "\t\t\t# Z = 1 - 7.63*10**(3)*P - 7.22*10**(-5)*P**(2)\n", + "\n", + "\t\t\t#The phase equilibrium equation of ethane is\n", + "\t\t\t#f_1_V = x_1*H_1\n", + "\t\t\t#since vapour is pure gas, f_1_V = x_1*H_1 or, phi_1*P = x_1*H_1, where 'phi_1' is fugacity coefficient of pure ethane\n", + "\t\t\t# math.log(phi) = integral('Z-1)/P) from limit '0' to 'P'\n", + "\n", + "P1 = 0;\n", + "P2 = 1;\n", + "P3 = 35;\n", + "\n", + "# Calculations\n", + "def f51(P): \n", + "\t return (1-7.63*10**(-3)*P-7.22*10**(-5)*P**(2)-1)/P\n", + "\n", + "intgral = quad(f51,P1,P2)[0]\n", + "\n", + "phi_1_1 = math.exp(intgral);\t\t\t# - Fugacity coefficient of ethane at 1 bar\n", + "f_1_1 = phi_1_1*P2;\t\t\t#[bar] - Fugacity of ethane at 1 bar\n", + "\n", + "\t\t\t#Similarly\n", + "\n", + "def f52(P): \n", + "\t return (1-7.63*10**(-3)*P-7.22*10**(-5)*P**(2)-1)/P\n", + "\n", + "intgral_1 = quad(f52,P1,P3)[0]\n", + "\n", + "phi_1_35 = math.exp(intgral_1);\t\t\t# Fugacity coefficient of ethane at 35 bar\n", + "f_1_35 = phi_1_35*P3;\t\t\t#[bar] - Fugacity of ethane at 35 bar\n", + "\n", + "\t\t\t# At ethane pressure of 1 bar , x_C2H6_1*H_1 = phi_1_1\n", + "H_1 = phi_1_1/x_C2H6_1;\t\t\t#[bar] - Henry's constant\n", + "\n", + "\t\t\t# At ethane pressure of 35 bar , x_C2H6_35*H_1 = phi_1_35\n", + "x_C2H6_35 = f_1_35/H_1;\t\t\t# Solubility of ethane at 35 bar pressure\n", + "\n", + "# Results\n", + "print \"The solubility of ethane at 35 bar is given by x_C2H6 = %e \"%(x_C2H6_35);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The solubility of ethane at 35 bar is given by x_C2H6 = 8.525648e-04 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 16.4 Page Number : 571" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "# Variables\n", + "T = 200;\t\t\t#[K]\n", + "R = 8.314;\t\t\t#[J/mol*K] - universal gas constant\n", + "\t\t\t# G_E = A*x_1*x_2\n", + "A = 4000;\t\t\t#[J/mol]\n", + "x_1 = 0.6;\t\t\t# Mle fraction of feed composition\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# Since A is given to be independent of temperature\n", + "UCST = A/(2*R);\t\t\t#[K] - Upper critical solution temperature\n", + "print \" The UCST of the system is %f K\"%(UCST);\n", + "\n", + "\t\t\t# Since the given temperature is less than UCST therefore two phase can get formed at the given temperature.\n", + "\n", + "\t\t\t# x1_alpha = 1 - x1_beta\n", + "\t\t\t# We know that, x1_alpha*Y_1_alpha = x2_alpha*Y_2_alpha\n", + "\t\t\t# x1_alpha*math.exp[(A/(R*T))*(x2_alpha)**(2)] = (1 - x1_alpha)*math.exp[(A/(R*T))*(x1_alpha)**(2)]\n", + "\t\t\t# where use has beeen made of the fact that x1_alpha = 1 - x1_beta and x2_beta = 1 - x1_beta = x1_alpha .Taking math.logarithm of both side we get\n", + "\t\t\t# math.log(x1_alpha) + (A/(R*T))*(1 - x1_alpha)**(2) = math.log(1 - x1_alpha) + (A/(R*T))*x1_alpha**(2)\n", + "\t\t\t# math.log(x1_alpha/(1-x1_alpha)) = (A/(R*T))*(2*x1_alpha - 1)\n", + "\n", + "def f(x1_alpha): \n", + "\t return math.log(x1_alpha/(1-x1_alpha)) - (A/(R*T))*(2*x1_alpha - 1)\n", + "x1_alpha = fsolve(f,0.1)\n", + "x1_beta = fsolve(f,0.9)\n", + "\t\t\t# Because of symmetry 1 - x1_beta = x1_alpha\n", + "\n", + "\t\t\t# It can be seen that the equation, math.log(x1/(1-x1)) = (A/(R*T))*(2*x1 - 1) has two roots.\n", + "\t\t\t# The two roots acn be determined by taking different values \n", + "\t\t\t# Starting with x1 = 0.1, we get x1 = 0.169 as the solution and starting with x1 = 0.9,we get x1 = 0.831 as the solution.\n", + "\t\t\t# Thus x1 = 0.169 is the composition of phase alpha and x1 = 0.831 is of phase beta\n", + "print \" The composition of two liquid phases in equilibrium is given by x1_alpha = %f and x1_beta = %f\"%(x1_alpha,x1_beta);\n", + "\n", + "\t\t\t# From the equilibrium data it is seen that if the feed has composition x1 less than 0.169 or more than 0.831 the liquid mixture is of single phase\n", + "\t\t\t# whereas if the overall (feed) composition is between 0.169 and 0.831 two phases shall be formed.\n", + "\t\t\t# The amounts of phases can also be calculated. The feed composition is given to be z1 = 0.6\n", + "z1 = 0.6;\n", + "\t\t\t# z1 = x1_alpha*alpha + x1_beta*beta\n", + "\t\t\t# beta = 1 - alpha\n", + "alpha = (z1-x1_beta)/(x1_alpha-x1_beta);\t\t\t#[mol]\n", + "Beta = 1 - alpha;\t\t\t#[mol]\n", + "print \" The relative amount of phases is given by alpha = %f mol and beta = %f mol\"%(alpha,Beta);\n", + "\n", + "\t\t\t# the relative amounts of the phases changes with the feed composition \n", + "\n", + "\t\t\t#math.log(x1/(1-x1)) = (A/(R*T))*(2*x1 - 1)\n", + "\t\t\t# If the above equation has two real roots of x1 (one for phase alpha and the other for phase beta) then two liquid phases get formed\n", + "\t\t\t# and if it has no real roots then a homogeneous liquid mixtures is obtained.\n", + "\n", + "print \" math.logx1/1-x1 = A/R*T*2*x1 - 1\";\n", + "print \" If the above equation has two real roots of x1 one for phase alpha and the other for phase beta then two liquid phases get formed\";\n", + "print \" and if it has no real roots then a homogeneous liquid mixture is obtained\";\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The UCST of the system is 240.558095 K\n", + " The composition of two liquid phases in equilibrium is given by x1_alpha = 0.169102 and x1_beta = 0.830898\n", + " The relative amount of phases is given by alpha = 0.348896 mol and beta = 0.651104 mol\n", + " math.logx1/1-x1 = A/R*T*2*x1 - 1\n", + " If the above equation has two real roots of x1 one for phase alpha and the other for phase beta then two liquid phases get formed\n", + " and if it has no real roots then a homogeneous liquid mixture is obtained\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 16.5 Page Number : 573" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 300;\t\t\t#[K]\n", + "R = 8.314;\t\t\t#[J/mol*K] - universal gas constant\n", + "A = 7000;\t\t\t#[J/mol]\n", + "\n", + "\t\t\t# math.log(x_1/(1-x_1)) = (A/(R*T))*(2*x_1-1)\n", + "\n", + "# Calculations\n", + "def f(x_1): \n", + "\t return math.log(x_1/(1-x_1))-((A/(R*T))*(2*x_1-1))\n", + "\n", + "x1_alpha=fsolve(f,0.1)\n", + "\n", + "x1_beta=1-x1_alpha;\n", + "\n", + "# Results\n", + "print \"The equilibrium compositin of the two liquid phase system is given by x1_alpha \\t = %f x1_beta \\t = %f\"%(x1_alpha,x1_beta);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The equilibrium compositin of the two liquid phase system is given by x1_alpha \t = 0.091897 x1_beta \t = 0.908103\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 16.7 Page Number : 579" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "M_wt_meth = 32;\t\t\t# Molecular weight of methanol \n", + "M_wt_water = 18;\t\t\t# Molecular weight of water \n", + "m_meth = 0.01;\t\t\t#[g] - Mass of methanol added per cm**(3) of solution\n", + "\n", + "\t\t\t#Since the concentration of methanol is very small therefore we can assume that the density of solution = pure water\n", + "den_sol = 1;\t\t\t#[g/cm**(3)]\n", + "\n", + "# Calculations\n", + "\t\t\t#The mole fraction of solute is given by\n", + "\t\t\t#x_2 = (moles of solute in cm**(3) of solution)/(moles of solute + moles of water) in 1 cm**(3) of solution\n", + "x_2 = (m_meth/M_wt_meth)/((m_meth/M_wt_meth)+((1-m_meth)/M_wt_water));\n", + "\n", + "\t\t\t#We know that heat of fusion of water is\n", + "H_fus = -80;\t\t\t#[cal/g] - Enthalpy change of fusion at 0 C\n", + "H_fus = H_fus*4.186*M_wt_water;\t\t\t#[J/mol]\n", + "\n", + "\t\t\t#Therefore freezing point depression is given by\n", + "\t\t\t# T - T_m = (R*(T**(2))*x_2)/H_fus\n", + "T_f = 273.15;\t\t\t#[K] - Freezing point of water\n", + "delta_T_f = (R*(T_f**(2))*x_2)/H_fus;\t\t\t#[K]\n", + "\n", + "# Results\n", + "print \"The depression in freezing point is given by delta_T = %f K\"%(delta_T_f);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The depression in freezing point is given by delta_T = -0.581403 K\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 16.8 Page Number : 580" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "R = 8.314;\t\t\t#[J/mol*K] - universal gas constant\n", + "T_f = 273.15;\t\t\t#[K] - Freezing point of water\n", + "m_water = 100;\t\t\t#[g] - Mass of water\n", + "m_NaCl = 3.5;\t\t\t#[g] - Mass of NaCl\n", + "M_wt_water = 18.015;\t\t\t# Molecular weight of water \n", + "M_wt_NaCl = 58.5;\t\t\t# Molecular weight of NaCl\n", + "mol_water = m_water/M_wt_water;\t\t\t#[mol] - Moles of water\n", + "mol_NaCl = m_NaCl/M_wt_NaCl;\t\t\t#[mol] - Moles of NaCl\n", + "\n", + "H_fus = -80;\t\t\t#[cal/g] - Enthalpy change of fusion at 0 C\n", + "H_fus = H_fus*4.186*M_wt_water;\t\t\t#[J/mol]\n", + "\n", + "# Calculations\n", + "\t\t\t#Mole fraction of the solute (NaCl) is given by\n", + "x_2 = mol_NaCl/(mol_NaCl+mol_water);\n", + "\n", + "\t\t\t#But NaCl is compietely ionized and thus each ion acts independently to lower the water mole fraction.\n", + "x_2_act = 2*x_2;\t\t\t# Actual mole fraction\n", + "\n", + "\t\t\t#Now depression in freezing point is given by\n", + "\t\t\t# T - T_m = (R*(T**(2))*x_2_act)/H_fus\n", + "delta_T_f = (R*(T_f**(2))*x_2_act)/H_fus;\t\t\t#[C]\n", + "\n", + "\t\t\t#Thus freezing point of seawater = depression in freezing point\n", + "\n", + "# Results\n", + "print \"The freezing point of seawater is %f C\"%(delta_T_f);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The freezing point of seawater is -2.192853 C\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 16.10 Page Number : 583" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "R = 8.314;\t\t\t#[J/mol*K] - universal gas constant\n", + "T_b = 373.15;\t\t\t#[K] - Boiling point of water\n", + "m_water = 100.;\t\t\t#[g] - Mass of water\n", + "m_C12H22 = 5.;\t\t\t#[g] - Mass of glucise (C12H22)\n", + "M_wt_water = 18.015;\t\t\t# Molecular weight of water \n", + "M_wt_C12H22 = 342.30;\t\t\t# Molecular weight of C12H22\n", + "mol_water = m_water/M_wt_water;\t\t\t#[mol] - Moles of water\n", + "mol_C12H22 = m_C12H22/M_wt_C12H22;\t\t\t#[mol] - Moles of C12H22\n", + "\n", + "# Calculations\n", + "H_vap = 540.;\t\t\t#[cal/g] - Enthalpy change of vaporisation\n", + "H_vap = H_vap*4.186*M_wt_water;\t\t\t#[J/mol]\n", + "\n", + "\t\t\t#Mole fraction of the solute (C12H22) is given by\n", + "x_2 = mol_C12H22/(mol_C12H22+mol_water);\n", + "\n", + "\t\t\t#The boiling point elevation is given by\n", + "\t\t\t# T - T_b = (R*T_b**(2)*x_2**(2))/H_vap**(2)\n", + "\n", + "delta_T_b = (R*T_b**(2)*x_2)/(H_vap);\n", + "\n", + "# Results\n", + "print \"The elevation in boiling point is given by delta_T = %f C\"%(delta_T_b)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The elevation in boiling point is given by delta_T = 0.074611 C\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 16.11 Page Number : 584" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "T = 25 + 273.15;\t\t\t#[K] - Surrounding temperature \n", + "den_water = 1000.;\t\t\t#[kg/m**(3)] - Density of water\n", + "m_water = 100.;\t\t\t#[g] - Mass of water\n", + "m_C12H22 = 5.;\t\t\t#[g] - Mass of glucise (C12H22)\n", + "M_wt_water = 18.015;\t\t\t# Molecular weight of water \n", + "M_wt_C12H22 = 342.30;\t\t\t# Molecular weight of C12H22\n", + "mol_water = m_water/M_wt_water;\t\t\t#[mol] - Moles of water\n", + "mol_C12H22 = m_C12H22/M_wt_C12H22;\t\t\t#[mol] - Moles of C12H22\n", + "\n", + "# Calculations\n", + "\t\t\t#Mole fraction of the water is given by\n", + "x_1 = mol_water/(mol_C12H22+mol_water);\n", + "\n", + "\t\t\t#Molar volume of water can be calculated as\n", + "V_l_water = (1./den_water)*M_wt_water*10**(-3);\t\t\t#[m**(3)/mol]\n", + "\n", + "\t\t\t#The osmotic pressure is given by\n", + "pi = -(R*T*math.log(x_1))/V_l_water;\t\t\t#[N/m**(2)]\n", + "pi = pi*10**(-5);\t\t\t#[bar]\n", + "\n", + "# Results\n", + "print \"The osmotic pressure of the mixture is %f bar\"%(pi);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The osmotic pressure of the mixture is 3.616073 bar\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 16.12 Page Number : 585" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "R = 8.314;\t\t\t#[J/mol*K] - universal gas constant\n", + "T = 25 + 273.15;\t\t\t#[K] - Surrounding temperature\n", + "den_water = 1000.;\t\t\t#[kg/m**(3)] - Density of water\n", + "m_water = 100.;\t\t\t#[g] - Mass of water\n", + "m_NaCl = 3.5;\t\t\t#[g] - Mass of NaCl\n", + "M_wt_water = 18.015;\t\t\t# Molecular weight of water \n", + "M_wt_NaCl = 58.5;\t\t\t# Molecular weight of NaCl\n", + "mol_water = m_water/M_wt_water;\t\t\t#[mol] - Moles of water\n", + "mol_NaCl = m_NaCl/M_wt_NaCl;\t\t\t#[mol] - Moles of NaCl\n", + "\n", + "# Calculations\n", + "H_fus = -80.;\t\t\t#[cal/g] - Enthalpy change of fusion at 0 C\n", + "H_fus = H_fus*4.186*M_wt_water;\t\t\t#[J/mol]\n", + "\n", + "\t\t\t#Mole fraction of the solute (NaCl) is given by\n", + "x_2 = mol_NaCl/(mol_NaCl+mol_water);\n", + "\n", + "\t\t\t#But NaCl is compietely ionized and thus each ion acts independently to lower the water mole fraction.\n", + "x_2_act = 2*x_2;\t\t\t# Actual mole fraction\n", + "\n", + "x_1 = 1 - x_2_act;\n", + "\n", + "\t\t\t#Molar volume of water can be calculated as\n", + "V_l_water = (1/den_water)*M_wt_water*10**(-3);\t\t\t#[m**(3)/mol]\n", + "\n", + "\t\t\t#The osmotic pressure is given by\n", + "pi = -(R*T*math.log(x_1))/V_l_water;\t\t\t#[N/m**(2)]\n", + "pi = pi*10**(-5);\t\t\t#[bar]\n", + "\t\t\t#The minimum pressure to desalinate sea water is nothing but the osmotic pressure\n", + "\n", + "# Results\n", + "print \"The minimum pressure to desalinate sea water is %f bar\"%(pi);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The minimum pressure to desalinate sea water is 29.662232 bar\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 16.13 Page Number : 586" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "R = 8.314;\t\t\t#[J/mol*K] - universal gas constant\n", + "T = 173.15;\t\t\t#[K] - Surrounding temperature\n", + "P = 60;\t\t\t#[bar]\n", + "P = P*10**(5);\t\t\t#[Pa] \n", + "\n", + "\t\t\t#componenet 1 : CO2 (1)\n", + "\t\t\t#componenet 2 : H2 (2)\n", + "P_1_sat = 0.1392;\t\t\t#[bar] - Vapour pressre of pure solid CO2\n", + "P_1_sat = P_1_sat*10**(5);\t\t\t#[bar]\n", + "V_s_1 = 27.6;\t\t\t#[cm**(3)/mol] - Molar volume of solid CO2\n", + "V_s_1 = V_s_1*10**(-6);\t\t\t#[m**(3)/mol]\n", + "n_1 = 0.01;\t\t\t#[mol] - Initial number of moles of CO2\n", + "n_2 = 0.99;\t\t\t#[mol] - Initial number of moles of H2\n", + "\n", + "\t\t\t#Let us determine the fugacity of solid CO2 (1) at 60 C and 173.15 K\n", + "\t\t\t# f_1 = f_1_sat*math.exp(V_s_1*(P-P_1_sat)/(R*T))\n", + "\n", + "# Calculations\n", + "\t\t\t#Since vapour pressure of pure solid CO2 is very small, therefore\n", + "f_1_sat = P_1_sat;\n", + "f_1 = f_1_sat*math.exp(V_s_1*(P-P_1_sat)/(R*T));\n", + "\n", + "\t\t\t#Since gas phase is ideal therefore\n", + "\t\t\t# y1*P = f_1\n", + "y1 = f_1/P;\n", + "\n", + "\t\t\t#Number of moles of H2 in vapour phase at equilibrium remains the same as initial number of moles.\n", + "\t\t\t#Number of moles of CO2 in vapour phase at equilibrium can be calculated as\n", + "\t\t\t#y1 = (n_1_eq/(n_1_eq + n_2)). Therefore\n", + "n_1_eq = n_2*y1/(1-y1);\n", + "\n", + "\t\t\t#Therefore moles of CO2 precipitated is\n", + "n_ppt = n_1 - n_1_eq;\t\t\t#[mol]\n", + "\n", + "# Results\n", + "print \"The moles of CO2 precipitated is %f mol\"%(n_ppt);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The moles of CO2 precipitated is 0.007417 mol\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 16.14 Page Number : 586" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "R = 8.314;\t\t\t#[J/mol*K] - universal gas constant\n", + "T = 350.;\t\t\t#[K] - Surrounding temperature\n", + "\n", + "\t\t\t#componenet 1 : organic solid (1)\n", + "\t\t\t#componenet 2 : CO2 (2)\n", + "\n", + "P_1_sat = 133.3;\t\t\t#[N/m**(2)] - Vapour pressre of organic solid\n", + "V_s_1 = 200.;\t\t\t#[cm**(3)/mol] - Molar volume of organic solid\n", + "V_s_1 = V_s_1*10.**(-6);\t\t\t#[m**(3)/mol]\n", + "\n", + "\t\t\t#/At 350 K, the values of the coefficients \n", + "B_11 = -500.;\t\t\t#[cm**(3)/mol]\n", + "B_22 = -85.;\t\t\t#[cm****(3)/mol]\n", + "B_12 = -430.;\t\t\t#[cm**(3)/mol]\n", + "\n", + "# Calculations\n", + "\t\t\t#From phase equilibrium equation of component 1, we get\n", + "\t\t\t# y1*P*phi_1 = f_1\n", + "\t\t\t# f_1 = f_1_sat*math.exp(V_s_1*(P-P_1_sat)/(R*T))\n", + "\n", + "\t\t\t#Since vapour pressure of organic solid is very small, therefore\n", + "f_1_sat = P_1_sat;\n", + "\n", + "\t\t\t# Now let us determine the fugacity coefficient of organic solid in the vapour mixture.\n", + "\t\t\t# math.log(phi_1) = (P/(R*T))*(B_11 + y2**(2)*del_12) \n", + "del_12 = (2*B_12 - B_11 - B_22)*10**(-6);\t\t\t#[m**(3)/mol]\n", + "\n", + "\t\t\t#It is given that the partial pressure of component 1 in the vapour mixture is 1333 N?m**(2)\n", + "\t\t\t# y1*P = 1333 N/m**(2) or, y1 = 1333/P\n", + "\t\t\t# y2 = 1- 1333/P\n", + "\t\t\t# math.log(phi_1) = (P/(R*T))*(B_11 + (1- 1333/P)**(2)*del_12)\n", + "\n", + "\t\t\t#The phase equilibrium equation becomes\n", + "\t\t\t# y1*P*phi_1 = f_1_sat*math.exp(V_s_1*(P-P_1_sat)/(R*T))\n", + "\t\t\t#Taking math.log on both side we have\n", + "\t\t\t# math.log(y1*P) + math.log(phi_1) = math.log(f_1_sat) + (V_s_1*(P-P_1_sat)/(R*T))\n", + "\t\t\t# (V_s_1*(P-P_1_sat)/(R*T)) - math.log(phi_1) = math.log(1333/133.3) = math.log(10)\n", + "\n", + "\t\t\t#substituting for math.log(phi_1) from previous into the above equation we get\n", + "\t\t\t# (V_s_1*(P-P_1_sat)/(R*T)) - (P/(R*T))*(B_11 + (1- 1333/P)**(2)*del_12) - math.log(10) = 0\n", + "\t\t\t# On simplification we get,\n", + "\t\t\t# 975*P**(2) - 6.7*10**(9)*P + 4.89*10**(8) = 0\n", + "\t\t\t# Solving the above qyadratic equation using shreedharcharya rule\n", + "\n", + "P3 = (6.7*10**(9) + ((-6.7*10**(9))**(2)-4*975*4.98*10**(8))**(1./2))/(2*975);\t\t\t#[Pa]\n", + "P4 = (6.7*10**(9) - ((-6.7*10**(9))**(2)-4*975*4.98*10**(8))**(1./2))/(2*975);\t\t\t#[Pa]\n", + "\t\t\t# The second value is not possible, therefore pressure of the system is P3\n", + "P3 = P3*10**(-5);\t\t\t#[bar]\n", + "\n", + "# Results\n", + "print \" The total pressure of the system is %f bar\"%(P3);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The total pressure of the system is 68.717948 bar\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 11 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch17_1-checkpoint.ipynb b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch17_1-checkpoint.ipynb new file mode 100644 index 00000000..004b3bab --- /dev/null +++ b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch17_1-checkpoint.ipynb @@ -0,0 +1,2081 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:e354b0525ce1aff27214eb76f8a2c9be56cfff2939a8a4b8688a7fe1cea4959c" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 17 : Chemical Reactions Equilibria" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 17.2 Page Number : 598" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "\n", + "# Variables\n", + "P = 1;\t\t\t#[atm] - Reactor pressure\n", + "T = 749;\t\t\t#[K] - Reactor temperature\n", + "K = 74;\t\t\t# Equlibrium constant\n", + "\n", + "\t\t\t# SO2 + (1/2)*O2 - SO3\n", + "\n", + "# Calculations and Results\n", + "Kp = P**(1);\n", + "Ky = K/Kp;\n", + "\n", + "\t\t\t#(1)\n", + "\t\t\t# Initial number of moles of the components are\n", + "n_SO2_1_in = 12;\n", + "n_O2_1_in = 9;\n", + "n_SO3_1_in = 0;\n", + "\n", + "\t\t\t# Let the reaction coordinate at equilibrium for the reaction be X\n", + "\t\t\t# At equilibrium, the moles of the components be\n", + "\t\t\t# n_SO2_1_eq = 12 - X\n", + "\t\t\t# n_O2_1_eq = 9 - 0.5*X\n", + "\t\t\t# n_SO3_1_eq = X\n", + "\t\t\t# Total moles = 21 - 0.5*X\n", + "\n", + "\t\t\t# The mole fractions of the components at equilibrium are\n", + "\t\t\t# y_SO3 = X/(21-0.5*X)\n", + "\t\t\t# y_SO2 = (12-X)/(21-0.5*X)\n", + "\t\t\t# y_O2 = (9-0.5*X)/(21-0.5*X)\n", + "\n", + "\t\t\t# Ky = y_SO3/(y_SO2*y_O2**(2))\n", + "\t\t\t# Ky = (X*(21-0.5*X)**(1/2))/((12-X)*(9-0.5*X)**(1/2))\n", + "def f(X): \n", + "\t return Ky-(X*(21-0.5*X)**(1./2))/((12-X)*(9-0.5*X)**(1./2))\n", + "X_1 = fsolve(f,11)\n", + "\n", + "y_SO3_1 = X_1/(21-0.5*X_1);\n", + "y_SO2_1 = (12-X_1)/(21-0.5*X_1);\n", + "y_O2_1 = (9-0.5*X_1)/(21-0.5*X_1);\n", + "\n", + "print \" 1).The moles of SO3 formed = %f mol\"%(X_1);\n", + "print \" The mole fractions at equilibrium are y_S03 = %f y_SO2 = %f and y_O2 = %f\"%(y_SO3_1,y_SO2_1,y_O2_1);\n", + "\n", + "\t\t\t#(2)\n", + "\t\t\t# Initial number of moles of the components are\n", + "n_SO2_2_in = 24;\n", + "n_O2_2_in = 18;\n", + "n_SO3_2_in = 0;\n", + "\n", + "\t\t\t# At equilibrium, the moles of the components be\n", + "\t\t\t# n_SO2_1_eq = 24 - X\n", + "\t\t\t# n_O2_1_eq = 18 - 0.5*X\n", + "\t\t\t# n_SO3_1_eq = X\n", + "\t\t\t# Total moles = 42 - 0.5*X\n", + "\n", + "\t\t\t# The mole fractions of the components at equilibrium are\n", + "\t\t\t# y_SO3 = X/(42-0.5*X)\n", + "\t\t\t# y_SO2 = (24-X)/(42-0.5*X)\n", + "\t\t\t# y_O2 = (18-0.5*X)/(42-0.5*X)\n", + "\n", + "\t\t\t# Ky = y_SO3/(y_SO2*y_O2**(2))\n", + "\t\t\t# Ky = (X*(42-0.5*X)**(1/2))/((24-X)*(18-0.5*X)**(1/2))\n", + "def f1(X): \n", + "\t return Ky-(X*(42-0.5*X)**(1./2))/((24-X)*(18-0.5*X)**(1./2))\n", + "X_2 = fsolve(f1,22)\n", + "\n", + "y_SO3_2 = X_2/(42-0.5*X_2);\n", + "y_SO2_2 = (24-X_2)/(42-0.5*X_2);\n", + "y_O2_2 = (18-0.5*X_2)/(42-0.5*X_2);\n", + "print \" 2).The moles of SO3 formed = %f mol\"%(X_2);\n", + "print \" The mole fractions at equilibrium are y_S03 = %f, y_SO2 = %f and y_O2 = %f\"%(y_SO3_2,y_SO2_2,y_O2_2);\n", + "\n", + "\t\t\t#(3)\n", + "\t\t\t# Initial number of moles of the components are\n", + "n_SO2_3_in = 12;\n", + "n_O2_3_in = 9;\n", + "n_SO3_3_in = 0;\n", + "n_N2 = 79;\n", + "\n", + "\t\t\t# At equilibrium, the moles of the components be\n", + "\t\t\t# n_SO2_1_eq = 12 - X\n", + "\t\t\t# n_O2_1_eq = 9 - 0.5*X\n", + "\t\t\t# n_SO3_1_eq = X\n", + "\t\t\t# Total moles = 100 - 0.5*X\n", + "\n", + "\t\t\t# The mole fractions of the components at equilibrium are\n", + "\t\t\t# y_SO3 = X/(100-0.5*X)\n", + "\t\t\t# y_SO2 = (12-X)/(100-0.5*X)\n", + "\t\t\t# y_O2 = (9-0.5*X)/(100-0.5*X)\n", + "\n", + "\t\t\t# Ky = y_SO3/(y_SO2*y_O2**(2))\n", + "\t\t\t# Ky = (X*(100-0.5*X)**(1/2))/((12-X)*(9-0.5*X)**(1/2))\n", + "def f2(X): \n", + "\t return Ky-(X*(100-0.5*X)**(1./2))/((12-X)*(9-0.5*X)**(1./2))\n", + "X_3 = fsolve(f2,10)\n", + "\n", + "y_SO3_3 = X_3/(100-0.5*X_3);\n", + "y_SO2_3 = (12-X_3)/(100-0.5*X_3);\n", + "y_O2_3 = (9-0.5*X_3)/(100-0.5*X_3);\n", + "\n", + "print \" 3).The moles of SO3 formed = %f mol\"%(X_3);\n", + "print \" The mole fractions at equilibrium are y_S03 = %f y_SO2 = %f and y_O2 = %f\"%(y_SO3_3,y_SO2_3,y_O2_3);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The moles of SO3 formed = 11.655537 mol\n", + " The mole fractions at equilibrium are y_S03 = 0.768215 y_SO2 = 0.022704 and y_O2 = 0.209081\n", + " 2).The moles of SO3 formed = 23.311074 mol\n", + " The mole fractions at equilibrium are y_S03 = 0.768215, y_SO2 = 0.022704 and y_O2 = 0.209081\n", + " 3).The moles of SO3 formed = 11.202213 mol\n", + " The mole fractions at equilibrium are y_S03 = 0.118669 y_SO2 = 0.008451 and y_O2 = 0.036006\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 17.3 Page Number : 599" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 600;\t\t\t#[K] - Reactor temperature\n", + "P = 300;\t\t\t#[atm] - Reactor pressure\n", + "K = 0.91*10**(-4);\t\t\t# Equilibrium constant\n", + "\n", + "\t\t\t# The fugacity coefficients of the components are\n", + "phi_CO = 1.0;\n", + "phi_H2 = 1.2;\n", + "phi_CH3OH = 0.47;\n", + "\n", + "\t\t\t# CO + 2*H2 - CH3OH \n", + "\n", + "\t\t\t# For gas phase reactions the smath.tan(math.radiansard state is pure ideal gas and thus fi_0 = 1 atm and thus\n", + "\t\t\t# ai_cap = fi_cap/fi_0 = yi*P*phi_i_cap/1\n", + "\t\t\t# Thus K = Ky*Kp*K_phi\n", + "# Calculations and Results \n", + "Kp = P**(1-3);\n", + "K_phi = phi_CH3OH/(phi_CO*phi_H2**(2));\n", + "Ky = K/(Kp*K_phi);\n", + "\n", + "\t\t\t# Let the reaction coordinate at equilibrium for the reaction be X\n", + "\t\t\t# At equilibrium ,the moles of the components be \n", + "\t\t\t# n_CO = 1 - X\n", + "\t\t\t# n_H2 = 3 - 2*X\n", + "\t\t\t# n_CH3OH = X\n", + "\t\t\t# Total moles = 4 - 2*X\n", + "\n", + "\t\t\t# The mole fractions of the components at equilibrium are\n", + "\t\t\t# y_CO = (1-X)/(4-2*X)\n", + "\t\t\t# y_H2 = (3-2*X)/(4-2*X)\n", + "\t\t\t# y_CH3OH = (X)/(4-2*X)\n", + "\n", + "\t\t\t# Ky = y_CH3OH/(y_CO*y_H2**(2)) = (X/(4-2*X))/(((1-X)/(4-2*X))*((3-2*X)/(4-2*X))**(2))\n", + "def f(X): \n", + "\t return Ky-(X/(4-2*X))/(((1-X)/(4-2*X))*((3-2*X)/(4-2*X))**(2))\n", + "X = fsolve(f,0.1)\n", + "\n", + "\t\t\t# Therefore at equilibrium \n", + "y_CO = (1-X)/(4-2*X);\n", + "y_H2 = (3-2*X)/(4-2*X);\n", + "y_CH3OH = (X)/(4-2*X);\n", + "\n", + "print \" The mole fractions at equilibrium are y_CO = %f y_H2 = %f and y_CH3OH = %f\"%(y_CO,y_H2,y_CH3OH);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The mole fractions at equilibrium are y_CO = 0.051857 y_H2 = 0.551857 and y_CH3OH = 0.396286\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 17.4 Page Number : 600" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\t\t\n", + "T = 600;\t\t\t#[K] - Reactor temperature\n", + "P = 4;\t\t\t#[atm] - Reactor pressure\n", + "K = 1.175;\t\t\t# Equilibrium constant\n", + "\n", + "\t\t\t# (1/2)*N2 + (3/2)*H_2 - NH3\n", + "\n", + "\t\t\t# Initial number of moles of the components are\n", + "n_N2 = 1;\n", + "n_H2 = 3;\n", + "n_HN3 = 0;\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# Let the reaction coordinate at equilibrium for the reaction be X.\n", + "\t\t\t# At equilibrium ,the moles of the components be \n", + "\t\t\t# n_N2 = 1 - 0.5*X\n", + "\t\t\t# n_H2 = 3 - 1.5*X\n", + "\t\t\t# n_NH3 = X\n", + "\t\t\t# Total moles = 4 - X\n", + "\n", + "\t\t\t# We have, K = Ky*Kp\n", + "Kp = P**(1-2);\t\t\t#[atm**(-1)]\n", + "Ky = K/(Kp);\n", + "\n", + "\t\t\t# Ky = y_NH3/(y_N2**(1/2)*y_H2**(3/2)) = (X/(4-X))/(((1-0.5*X)/(4-X))**(1/2)*((3-1.5*X)/(4-X))**(3/2))\n", + "\t\t\t# Solving the above equation we get\n", + "def f(X): \n", + "\t return Ky - (X/(4-X))/(((1-0.5*X)/(4-X))**(1./2)*((3-1.5*X)/(4-X))**(3./2))\n", + "X = fsolve(f,0.1)\n", + "\n", + "y_NH3 = X/(4-X);\t\t\t# Mole fraction of NH3 at equilibrium\n", + "\n", + "print \" The value of Kp = %f and Ky = %f \"%(Kp,Ky);\n", + "print \" The mole fractions of NH3 at equilibrium is %f\"%(y_NH3);\n", + "\n", + "\t\t\t# If reaction carried out at constant temperature and volume\n", + "\n", + "\t\t\t# We know that for ideal gas, P*V = n*R*T and thus P is directly proportional to n at constant V and T.\n", + "\t\t\t# Let P = k*n\n", + "\t\t\t# Initially P = 4 atm and n = 4 moles, thus K = 1 and we get p = n, where P is in atm. \n", + "\t\t\t# Thus at equilibrium P = 4 - X\n", + "\n", + "\t\t\t# Ky = K/Kp = 1.175*P = 1.175*(4 - X)\n", + "\t\t\t# (X/(4-X))/(((1-0.5*X)/(4-X))**(1/2)*((3-1.5*X)/(4-X))**(3/2)) = 1.175*(4 - X)\n", + "\t\t\t# Solving the above equation we get\n", + "def f1(X): \n", + "\t return (X/(4-X))/(((1-0.5*X)/(4-X))**(1./2)*((3-1.5*X)/(4-X))**(3./2))-1.175*(4-X)\n", + "X_prime = fsolve(f1,1)\n", + "\n", + "\t\t\t# Therefore at equilibrium \n", + "P_prime = 4 - X_prime;\n", + "y_NH3_prime = X_prime/(4-X_prime);\n", + "\n", + "print \" If reaction is carried out at constant temperature and volumethen\"\n", + "print \" The equilibrium pressure is %f atm\"%(P_prime);\n", + "print \" The equilibrium mole fractions of NH3 in the reactor is %f\"%(y_NH3_prime);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The value of Kp = 0.250000 and Ky = 4.700000 \n", + " The mole fractions of NH3 at equilibrium is 0.454388\n", + " If reaction is carried out at constant temperature and volumethen" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " The equilibrium pressure is 2.863057 atm\n", + " The equilibrium mole fractions of NH3 in the reactor is 0.397108\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 17.5 Page Number : 601" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 400;\t\t\t#[K] - Reactor temperature\n", + "P = 1;\t\t\t#[atm] - Reactor pressure\n", + "K = 1.52;\t\t\t# Equilibrium constant\n", + "y_H2 = 0.4;\t\t\t# Equilibrium mole fraction of hydrogen\n", + "\n", + "# Calculations\n", + "\t\t\t# CO(g) + 2*H_2(g) - CH3OH(g)\n", + "\n", + "\t\t\t# K = y_CH3OH/(y_CO*y_H2**(2)*P**(2))\n", + "\t\t\t# Let total number of moles at equilibrium be 1\n", + "\t\t\t# y_CH3OH = 0.6 - y_CO;\n", + "\t\t\t# (0.6 - y_CO)/y_CO = K*P**(2)*y_H2**(2)\n", + "\n", + "y_CO = 0.6/(1 + K*P**(2)*y_H2**(2));\n", + "y_CH3OH = 0.6 - y_CO;\n", + "\n", + "\n", + "# Results\n", + "print \" The mole fractions are y_CO = %f and y_CH3OH = %f \"%(y_CO,y_CH3OH);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The mole fractions are y_CO = 0.482625 and y_CH3OH = 0.117375 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 17.6 Page Number : 602" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "# Variables\n", + "T = 749.;\t\t\t#[K] - Reactor temperature\n", + "P = 1.;\t\t\t#[atm] - Reactor pressure\n", + "K = 74.;\n", + "\n", + "# Calculations and Results\n", + "Kp = P**(-1./2);\t\t\t#[atm**(-1/2)]\n", + "Ky = K/Kp;\n", + "\n", + "\t\t\t# SO2 + (1/2)*O2 - SO3\n", + "\n", + "\t\t\t# Initial number of moles of the components are\n", + "n_SO2_1_in = 10;\n", + "n_O2_1_in = 8;\n", + "n_SO3_1_in = 0;\n", + "\n", + "\t\t\t# Let the reaction coordinate at equilibrium for the reaction be X\n", + "\t\t\t# At equilibrium, the moles of the components be\n", + "\t\t\t# n_SO2_1_eq = 10 - X\n", + "\t\t\t# n_O2_1_eq = 8 - 0.5*X\n", + "\t\t\t# SO3_1_eq = X\n", + "\t\t\t# Total moles = 18 - 0.5*X\n", + "\n", + "\t\t\t# The mole fractions of the components at equilibrium are\n", + "\t\t\t# y_SO3 = X/(18-0.5*X)\n", + "\t\t\t# y_SO2 = (10-X)/(18-0.5*X)\n", + "\t\t\t# y_O2 = (8-0.5*X)/(18-0.5*X)\n", + "\n", + "\t\t\t# Ky = y_SO3/(y_SO2*y_O2**(2))\n", + "\t\t\t# Ky = (X*(18-0.5*X)**(1/2))/((10-X)*(8-0.5*X)**(1/2))\n", + "def f(X): \n", + "\t return Ky-(X*(18-0.5*X)**(1./2))/((10-X)*(8-0.5*X)**(1./2))\n", + "X_1 = fsolve(f,11)\n", + "\n", + "n_SO3 = X_1;\n", + "n_SO2 = 10 - X_1;\n", + "n_O2 = 8 - 0.5*X_1;\n", + "\n", + "print \" 1).The moles of the components at equilibrium are n_SO3 = %f mol n_SO2 = %f mol and n_O2 = %f mol\"%(n_SO3,n_SO2,n_O2);\n", + "\n", + "\t\t\t# Now for the reaction\n", + "\t\t\t# 2*SO2 + O2 - 2*SO3\n", + "\n", + "\t\t\t# The equilibrium constant for this reaction is KP**(2)\n", + "Ky_prime = Ky**(2);\n", + "\n", + "\t\t\t# At equilibrium, the moles of the components be\n", + "\t\t\t# n_SO2_1_eq = 10 - 2*X\n", + "\t\t\t# n_O2_1_eq = 8 - X\n", + "\t\t\t# SO3_1_eq = 2*X\n", + "\t\t\t# Total moles = 18 - X\n", + "\n", + "\t\t\t# The mole fractions of the components at equilibrium are\n", + "\t\t\t# y_SO3 = 2*X/(18-X)\n", + "\t\t\t# y_SO2 = (10-2*X)/(18-X)\n", + "\t\t\t# y_O2 = (8- X)/(18-X)\n", + "\n", + "\t\t\t# Ky_prime = y_SO3**(2)/(y_SO2**(2)*y_O2)\n", + "\t\t\t# Ky_prime = ((2*X)**(2)*(18-X))/((10-2*X)**(2)*(8-X))\n", + "def f1(X): \n", + "\t return Ky_prime-((2*X)**(2)*(18-X))/(((10-2*X)**(2))*(8-X))\n", + "X_2 = fsolve(f1,6)\n", + "\n", + "n_SO3_prime = 2*X_2;\n", + "n_SO2_prime = 10 - 2*X_2;\n", + "n_O2_prime = 8 - X_2;\n", + "\n", + "print \" 2).The moles of the components at equilibrium are n_SO3 = %f mol n_SO2 = %f mol and n_O2 = %f mol\"%(n_SO3_prime,n_SO2_prime,n_O2_prime);\n", + "print \" Thus the number of moles remains the same irrespective of the stoichoimetry of the reaction\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The moles of the components at equilibrium are n_SO3 = 9.730824 mol n_SO2 = 0.269176 mol and n_O2 = 3.134588 mol\n", + " 2).The moles of the components at equilibrium are n_SO3 = 9.730824 mol n_SO2 = 0.269176 mol and n_O2 = 3.134588 mol\n", + " Thus the number of moles remains the same irrespective of the stoichoimetry of the reaction\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 17.7 Page Number : 603" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "# Variables\n", + "T = 500;\t\t\t#[K]\n", + "\t\t\t# For the reaction, 0.5*A2 + 0.5*B2 - AB\n", + "delta_G = -4200;\t\t\t#[J/mol]\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "\t\t\t#(1)\n", + "\t\t\t# A2 + B2 - 2*AB\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# We know delta_G_rkn_0 = -R*T*math.log(K) \n", + "delta_G_1 = 2*delta_G;\n", + "K_1 = math.exp(-delta_G_1/(R*T));\t\t\t# Equilibrium constant at 500 K for the above reaction\n", + "\t\t\t# As can be seen the reaction is not affected by pressure and therefore K = Ky as Kp = 1 \n", + "Ky = K_1;\n", + "\n", + "\t\t\t# Initial number of moles of the components are\n", + "n_A2_1_in = 0.5;\n", + "n_B2_1_in = 0.5;\n", + "n_AB_1_in = 0;\n", + "\n", + "\t\t\t# Let the reaction coordinate at equilibrium for the reaction be X\n", + "\t\t\t# At equilibrium, the moles of the components be\n", + "\t\t\t# n_A2_1_eq = 0.5 - X\n", + "\t\t\t# n_B2_1_eq = 0.5- X\n", + "\t\t\t# n_AB_1_eq = 2*X\n", + "\t\t\t# Total moles = 1\n", + "\n", + "\t\t\t# Ky = (2*X)**(2)/(0.5-X)**(2)\n", + "def f(X): \n", + "\t return Ky-(2*X)**(2)/(0.5-X)**(2)\n", + "X_1 = fsolve(f,0.2)\n", + "\n", + "\t\t\t# The mole fractions of the components at equilibrium are\n", + "y_A2_1 = 0.5 - X_1;\n", + "y_B2_1 = 0.5- X_1;\n", + "y_AB_1 = 2*X_1;\n", + "\n", + "print \" 1).The mole fractions at equilibrium are y_A2 = %f y_B2 = %f and y_AB = %f\"%(y_A2_1,y_B2_1,y_AB_1);\n", + "\n", + "\t\t\t#(2)\n", + "\t\t\t# 0.5*A2 + 0.5*B2 - AB\n", + "\n", + "\t\t\t# We know delta_G_rkn_0 = -R*T*math.log(K) \n", + "delta_G_2 = delta_G;\n", + "K_2 = math.exp(-delta_G_2/(R*T));\t\t\t# Equilibrium constant at 500 K for the above reaction\n", + "\n", + "\t\t\t# As can be seen the reaction is not affected by pressure and therefore K = Ky as Kp = 1 \n", + "Ky_2 = K_2;\n", + "\n", + "\t\t\t# Initial number of moles of the components are\n", + "n_A2_2_in = 0.5;\n", + "n_B2_2_in = 0.5;\n", + "n_AB_2_in = 0;\n", + "\n", + "\t\t\t# Let the reaction coordinate at equilibrium for the reaction be X\n", + "\t\t\t# At equilibrium, the moles of the components be\n", + "\t\t\t# n_A2_2_eq = 0.5 - 0.5*X\n", + "\t\t\t# n_B2_2_eq = 0.5- 0.5*X\n", + "\t\t\t# n_AB_2_eq = X\n", + "\t\t\t# Total moles = 1\n", + "\n", + "\t\t\t# Ky = y_AB/(y_A2**(1/2)*y_B2**(1/2))\n", + "\t\t\t# Ky = X/(0.5 - 0.5*X)\n", + "X_2 = 0.5*Ky_2/(1+0.5*Ky_2);\n", + "\n", + "\t\t\t# The mole fractions of the components at equilibrium are\n", + "y_A2_2 = 0.5 - 0.5*X_2;\n", + "y_B2_2 = 0.5- 0.5*X_2;\n", + "y_AB_2 = X_2;\n", + "\n", + "print \" 2).The mole fractions at equilibrium are y_A2 = %f y_B2 = %f and y_AB = %f\"%(y_A2_2,y_B2_2,y_AB_2);\n", + "\n", + "\t\t\t#(3)\n", + "\t\t\t# 2*AB - A2 + B2\n", + "\n", + "K_3 = 1/K_1;\t\t\t# Equilibrium constant at 500 K for the above reaction\n", + "\t\t\t# As can be seen the reaction is not affected by pressure and therefore K = Ky as Kp = 1 \n", + "Ky_3 = K_3;\n", + "\n", + "\t\t\t# Initial number of moles of the components are\n", + "n_AB_3_in = 1;\n", + "n_A2_3_in = 0;\n", + "n_B2_3_in = 0;\n", + "\n", + "\t\t\t# Let the reaction coordinate at equilibrium for the reaction be X\n", + "\t\t\t# At equilibrium, the moles of the components be\n", + "\t\t\t# n_AB_3_eq = 1 - X\n", + "\t\t\t# n_A2_3_eq = X/2\n", + "\t\t\t# n_B2_3_eq = X/2\n", + "\t\t\t# Total moles = 1\n", + "\n", + "\t\t\t# Ky = (X/2)**(2)/(1-X)**(2)\n", + "def f1(X): \n", + "\t return Ky_3-(X/2)**(2)/(1-X)**(2)\n", + "X_3 = fsolve(f1,0.4)\n", + "\n", + "\t\t\t# The mole fractions of the components at equilibrium are\n", + "y_A2_3 = X_3/2;\n", + "y_B2_3 = X_3/2;\n", + "y_AB_3 = 1-X_3;\n", + "\n", + "print \" 3).The mole fractions at equilibrium are y_A2 = %f y_B2 = %f and y_AB = %f\"%(y_A2_3,y_B2_3,y_AB_3);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The mole fractions at equilibrium are y_A2 = 0.210680 y_B2 = 0.210680 and y_AB = 0.578641\n", + " 2).The mole fractions at equilibrium are y_A2 = 0.210680 y_B2 = 0.210680 and y_AB = 0.578641\n", + " 3).The mole fractions at equilibrium are y_A2 = 0.210680 y_B2 = 0.210680 and y_AB = 0.578641\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 17.9 Page Number : 606" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "from scipy.optimize import fsolve \n", + "import math \n", + "from scipy.integrate import quad \n", + "\t\t\n", + "\n", + "# Variables\n", + "R = 1.987;\t\t\t#[cal/mol-K]\n", + "\n", + "delta_H_SO2_298 = -70.96;\t\t\t#[kcal/mol] - Enthalpy of formation of S02 at 298.15 K\n", + "delta_H_SO3_298 = -94.45;\t\t\t#[kcal/mol] - Enthalpy of formation of S03 at 298.15 K\n", + "delta_G_SO2_298 = -71.79;\t\t\t#[kcal/mol] - Gibbs free energy change for formation of SO2 at 298.15 K\n", + "delta_G_SO3_298 = -88.52;\t\t\t#[kcal/mol] - Gibbs free energy change for formation of SO3 at 298.15 K\n", + "\n", + "\t\t\t# Cp_0 = a + b*T + c*T**(2) + d*T**(3)\n", + "\n", + "a_SO2 = 6.157;\n", + "a_SO3 = 3.918;\n", + "a_O2 = 6.085;\n", + "b_SO2 = 1.384*10**(-2);\n", + "b_SO3 = 3.483*10**(-2);\n", + "b_O2 = 0.3631*10**(-2);\n", + "c_SO2 = -0.9103*10**(-5);\n", + "c_SO3 = -2.675*10**(-5);\n", + "c_O2 = -0.1709*10**(-5);\n", + "d_SO2 = 2.057*10**(-9);\n", + "d_SO3 = 7.744*10**(-9);\n", + "d_O2 = 0.3133*10**(-9);\n", + "\n", + "\t\t\t#(1)\n", + "T_1 = 298.15;\t\t\t#[K]\n", + "\n", + "# Calculations and Results\n", + "delta_H_rkn_298 = delta_H_SO3_298 - delta_H_SO2_298;\t\t\t#[kcal]\n", + "delta_H_rkn_298 = delta_H_rkn_298*10**(3);\t\t\t#[cal]\n", + "delta_G_rkn_298 = delta_G_SO3_298 - delta_G_SO2_298;\t\t\t#[kcal]\n", + "delta_G_rkn_298 = delta_G_rkn_298*10**(3);\t\t\t#[cal]\n", + "\n", + "delta_a = a_SO3 - a_SO2 - (a_O2/2);\n", + "delta_b = b_SO3 - b_SO2 - (b_O2/2);\n", + "delta_c = c_SO3 - c_SO2 - (c_O2/2);\n", + "delta_d = d_SO3 - d_SO2 - (d_O2/2);\n", + "\n", + "\n", + "def f60(T): \n", + "\t return delta_a+(delta_b*T)+(delta_c*T**(2))+(delta_d*T**(3))\n", + "\n", + "\t\t\t# delta_H_rkn_T = delta_H_rkn_298 + quad(f60,T_1,T)[0]\n", + "\n", + "\t\t\t# On simplification we get\n", + "\t\t\t# delta_H_rkn_T = -22630.14 - 5.2815*T + 0.9587*10**(-2)*T**(2) - 0.5598*10**(-5)*T**(3) + 1.3826*10**(-9)*T**(4)\n", + "\n", + "print \" 1.The math.expression for delta_H_rkn_T as a function of T is given by\";\n", + "print \" delta_H_rkn_T = -22630.14 - 5.2815*T + 0.9587*10**-2*T**2 - 0.5598*10**-5*T**3 + 1.3826*10**-9*T**4\";\n", + "\n", + "\t\t\t#(2)\n", + "\n", + "\n", + "\t\t\t#def f61(T): \n", + "\t\t\t#\t return K_T/K_298) = integrate(delta_H_rkn_T/T**(2)\n", + "\n", + "\t\t\t# R*math.log(K_T/K_298) = quad(f61,T_1,T)[0]\n", + "\n", + "\t\t\t# First let us calculate K_298.\n", + "\t\t\t# delta_G_rkn_T = - R*T*math.log(K)\n", + "K_298 = math.exp(-delta_G_rkn_298/(R*T_1));\n", + "\n", + "\t\t\t# On substituting the values and simplifying we get the math.expression\n", + "\t\t\t# math.log(K) = 3.87 + 11380.10/T - 2.6580*math.log(T) + 0.4825*10**(-2)*T - 0.1409*10**(-5)*T**(2) + 0.2320*10**(-9)*T**(3)\n", + "\n", + "print \" 2.The math.expression for math.logK as a function of T is given by\";\n", + "print \" math.logK = 3.87 + 11380.10/T - 2.6580*math.logT + 0.4825*10**-2*T - 0.1409*10**-5*T**2 + 0.2320*10**-9*T**3\";\n", + "\n", + "\t\t\t#(3)\n", + "P = 1;\t\t\t#[atm]\n", + "T = 880;\t\t\t#[K]\n", + "K = math.exp(3.87 + 11380.10/T - 2.6580*math.log(T) + 0.4825*10**(-2)*T - 0.1409*10**(-5)*T**(2) + 0.2320*10**(-9)*T**(3));\n", + "Kp = P**(-1./2);\t\t\t#[atm**(-1/2)]\n", + "Ky = K/Kp;\n", + "\n", + "\t\t\t# Let the reaction coordinate at equilibrium for the reaction be X\n", + "\t\t\t# At equilibrium, the moles of the components be\n", + "\t\t\t# n_SO2_eq = 1 - X\n", + "\t\t\t# n_O2_eq = 0.5- 0.5*X\n", + "\t\t\t# n_SO3_1_eq = X\n", + "\t\t\t# Total moles = 1.5-0.5*X\n", + "\n", + "\t\t\t# Ky = (X*(1.5-0.5*X)**(1/2))/((1-X)*(0.5-0.5*X)**(1/2))\n", + "def f(X): \n", + "\t return Ky - (X*(1.5-0.5*X)**(1./2))/((1-X)*(0.5-0.5*X)**(1./2))\n", + "X = fsolve(f,0.8)\n", + "\n", + "\t\t\t# The mole fraction of SO3 at equilibrium is given by\n", + "y_SO3 = X/(1.5-0.5*X);\n", + "\n", + "print \" 3).The mole fraction of SO3 at equilibrium is given by y_SO3 = %f\"%(y_SO3);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1.The math.expression for delta_H_rkn_T as a function of T is given by\n", + " delta_H_rkn_T = -22630.14 - 5.2815*T + 0.9587*10**-2*T**2 - 0.5598*10**-5*T**3 + 1.3826*10**-9*T**4\n", + " 2.The math.expression for math.logK as a function of T is given by\n", + " math.logK = 3.87 + 11380.10/T - 2.6580*math.logT + 0.4825*10**-2*T - 0.1409*10**-5*T**2 + 0.2320*10**-9*T**3\n", + " 3).The mole fraction of SO3 at equilibrium is given by y_SO3 = 0.649167\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 17.10 Page Number : 609" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "from numpy import *\n", + "\n", + "# Variables\n", + "\t\t\t# (1/2)*N2 + (1/2)*O2 - NO\n", + "\n", + "R = 1.987;\t\t\t#[cal/mol-K]\n", + "\n", + "delta_H_NO_298 = 21.600;\t\t\t#[kcal/mol] - Enthalpy of formation of S02 at 298.15 K\n", + "delta_G_NO_298 = 20.719;\t\t\t#[kcal/mol] - Gibbs free energy change for formation of SO2 at 298.15 K\n", + "\n", + "\t\t\t# Cp_0 = a + b*T + c*T**(2) + d*T**(3)\n", + "\n", + "a_N2 = 6.157;\n", + "a_O2 = 6.085;\n", + "a_NO = 6.461;\n", + "b_N2 = -0.03753*10**(-2);\n", + "b_O2 = 0.3631*10**(-2);\n", + "b_NO = 0.2358*10**(-2);\n", + "c_N2 = 0.1930*10**(-5);\n", + "c_O2 = -0.1709*10**(-5);\n", + "c_NO = -0.07705*10**(-5);\n", + "d_N2 = -0.6861*10**(-9);\n", + "d_O2 = 0.3133*10**(-9);\n", + "d_NO = 0.08729*10**(-9);\n", + "\n", + "\t\t\t#(1)\n", + "T_1 = 298.15;\t\t\t#[K]\n", + "\n", + "# Calculations and Results\n", + "delta_H_rkn_298 = delta_H_NO_298;\t\t\t#[kcal]\n", + "delta_H_rkn_298 = delta_H_rkn_298*10**(3);\t\t\t#[cal]\n", + "delta_G_rkn_298 = delta_G_NO_298;\t\t\t#[kcal]\n", + "delta_G_rkn_298 = delta_G_rkn_298*10**(3);\t\t\t#[cal]\n", + "\n", + "delta_a = a_NO - (a_N2/2) - (a_O2/2);\n", + "delta_b = b_NO - (b_N2/2) - (b_O2/2);\n", + "delta_c = c_NO - (c_N2/2) - (c_O2/2);\n", + "delta_d = d_NO - (d_N2/2) - (d_O2/2);\n", + "\n", + "\n", + "def f49(T): \n", + "\t return delta_a+(delta_b*T)+(delta_c*T**(2))+(delta_d*T**(3))\n", + "\n", + "\t\t\t# delta_H_rkn_T = delta_H_rkn_298 + quad(f49,T_1,T)[0]\n", + "\n", + "\t\t\t# On simplification we get\n", + "\t\t\t# delta_H_rkn_T = 21584.63 - 0.033*T + 0.0365*10**(-2)*T**(2) - 0.0293*10**(-5)*T**(3) + 0.0685*10**(-9)*T**(4)\n", + "\n", + "print \" The math.expression for delta_H_rkn_T as a function of T is given by\";\n", + "print \" delta_H_rkn_T = 21584.63 - 0.033*T + 0.0365*10**-2*T**2 - 0.0293*10**-5*T**3 + 0.0685*10**-9*T**4\";\n", + "\n", + "\t\t\t# Now let us calculate K_298 (at 298 K)\n", + "\t\t\t# We know delta_G_rkn_298 = -R*T*math.log(K_298) \n", + "K_298 = math.exp(-delta_G_rkn_298/(R*T_1));\t\t\t# Equilibrium constant at 298.15 K\n", + "\n", + "\n", + "\t\t\t#def f50(T): \n", + "\t\t\t#\t return K_2/K_1) = integrate(delta_H_rkn_298/(R*T**(2))\n", + "\n", + "\t\t\t# math.log(K_2/K_1) = quad(f50,T_1,T)[0]\n", + "\n", + "\t\t\t# On substituting the values and simplifying we get the math.expression\n", + "\t\t\t# math.log(K) = 1.5103 - 10862.92/T - 0.0166*math.log(T) + 1.84*10**(-4)*T - 7.35*10**(-8)*T**(2) + 1.15*10**(-11)*T**(3)\n", + "\n", + "print \" The math.expression for math.logK as a function of T is given by\";\n", + "print \" math.logK = 1.5103 - 10862.92/T - 0.0166*math.logT + 1.84*10**-4*T - 7.35*10**-8*T**2 + 1.15*10**-11*T**3\"\n", + "\n", + "T = [500,1000,1500,2000,2500];\n", + "K = zeros(5);\n", + "\n", + "print \" T K \\t\\t\\t K \";\n", + "\n", + "for i in range(5):\n", + " K[i] = math.exp(1.5103-10862.92/T[i] - 0.0166*math.log(T[i]) + 1.84*10**(-4)*T[i] - 7.35*10**(-8)*T[i]**(2) + 1.15*10**(-11)*T[i]**(3));\n", + " \n", + " print \" %f \\t\\t %e \"%(T[i],K[i]);\n", + "\n", + "\n", + "\t\t\t# It can be seen that for endothermic reactions equilibrium constant increases with temperature.\n", + "print \" It can be seen that for endothermic reactions equilibrium constant increases with temperature\";\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The math.expression for delta_H_rkn_T as a function of T is given by\n", + " delta_H_rkn_T = 21584.63 - 0.033*T + 0.0365*10**-2*T**2 - 0.0293*10**-5*T**3 + 0.0685*10**-9*T**4\n", + " The math.expression for math.logK as a function of T is given by\n", + " math.logK = 1.5103 - 10862.92/T - 0.0166*math.logT + 1.84*10**-4*T - 7.35*10**-8*T**2 + 1.15*10**-11*T**3\n", + " T K \t\t\t K \n", + " 500.000000 \t\t 1.615470e-09 \n", + " 1000.000000 \t\t 8.737610e-05 \n", + " 1500.000000 \t\t 3.333913e-03 \n", + " 2000.000000 \t\t 2.062328e-02 \n", + " 2500.000000 \t\t 6.176400e-02 \n", + " It can be seen that for endothermic reactions equilibrium constant increases with temperature\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 17.11 Page Number : 611" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "# Variables\n", + "\t\t\t# SO2 + (1/2)*O2 - SO3\n", + "R = 8.314;\t\t\t#[J/mol-K]\n", + "\n", + "K_800 = 0.0319;\t\t\t# Equilibrium constant at 800 K\n", + "K_900 = 0.153;\t\t\t# Equilibrium constant at 900 K\n", + "T_1 = 800.;\t\t\t#[K]\n", + "T_2 = 900.;\t\t\t#[K]\n", + "\n", + "# Calculations\n", + "\t\t\t# We have the relation \n", + "\t\t\t# math.log(K_2/K_1) = -(delta_H_rkn/R)*(1/T_2 - 1/T_1)\n", + "\t\t\t# math.log(K_900/K_800) = -(delta_H_rkn_850/R)*(1/T_2 - 1/T_1)\n", + "delta_H_rkn_850 = -R*math.log(K_900/K_800)/(1/T_2 - 1/T_1);\t\t\t#[J]\n", + "delta_H_rkn_850 = delta_H_rkn_850*10**(-3);\t\t\t#[kJ]\n", + "\n", + "# Results\n", + "print \" The mean standard enthalpy change of reaction in the region 800 t0 900 is given by delta_H_rkn_850 = %f KJ\"%(delta_H_rkn_850);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The mean standard enthalpy change of reaction in the region 800 t0 900 is given by delta_H_rkn_850 = 93.851672 KJ\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 17.13 Page Number : 611" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "# Variables\n", + "T_1 = 298.15;\t\t\t#[K]\n", + "T = 2600;\t\t\t#[K]\n", + "R = 1.987;\t\t\t#[cal/mol-K] - Universal gas constant\n", + "\n", + "\t\t\t# Cp_0 = a + b*T + c*T**(2) + d*T**(3)\n", + "delta_H_CO_298 = -26.416;\t\t\t#[kcal/mol] - Enthalpy of formation of CO at 298.15 K\n", + "delta_G_CO_298 = -32.808;\t\t\t#[kcal/mol] - Gibbs free energy change for formation of CO at 298.15 K\n", + "delta_H_CO2_298 = -94.052;\t\t\t#[kcal/mol] - Enthalpy of formation of C02 at 298.15 K\n", + "delta_G_CO2_298 = -94.260;\t\t\t#[kcal/mol] - Gibbs free energy change for formation of CO2 at 298.15 K\n", + "\n", + "\t\t\t# CO + (1/2)*O2 - CO2\n", + "\n", + "a_CO = 6.726;\n", + "a_O2 = 6.0685;\n", + "a_CO2 = 5.316;\n", + "b_CO = 0.04001*10**(-2);\n", + "b_O2 = 0.3631*10**(-2);\n", + "b_CO2 = 1.4285*10**(-2);\n", + "c_CO = 0.1283*10**(-5);\n", + "c_O2 = -0.1709*10**(-5);\n", + "c_CO2 = -0.8362*10**(-5);\n", + "d_CO = -0.5307*10**(-9);\n", + "d_O2 = 0.3133*10**(-9);\n", + "d_CO2 = 1.784*10**(-9);\n", + "\n", + "# Calculations and Results\n", + "delta_H_rkn_298 = delta_H_CO2_298 - delta_H_CO_298;\t\t\t#[kcal]\n", + "delta_H_rkn_298 = delta_H_rkn_298*10**(3);\t\t\t#[cal]\n", + "delta_G_rkn_298 = delta_G_CO2_298 - delta_G_CO_298;\t\t\t#[kcal]\n", + "delta_G_rkn_298 = delta_G_rkn_298*10**(3);\t\t\t#[cal]\n", + "\n", + "delta_a = a_CO2 - (a_CO) - (a_O2/2);\n", + "delta_b = b_CO2 - (b_CO) - (b_O2/2);\n", + "delta_c = c_CO2 - (c_CO) - (c_O2/2);\n", + "delta_d = d_CO2 - (d_CO) - (d_O2/2);\n", + "\n", + "\n", + "def f47(T): \n", + "\t return delta_a+(delta_b*T)+(delta_c*T**(2))+(delta_d*T**(3))\n", + "\n", + "\t\t\t# delta_H_rkn_T = delta_H_rkn_298 + quad(f47,T_1,T)[0]\n", + "\n", + "\t\t\t# On simplification we get\n", + "delta_H_rkn_T = -66773.56 - 4.45*T + 0.605*10**(-2)*T**(2) - 0.29*10**(-5)*T**(3) + 0.54*10**(-9)*T**(4);\n", + "\n", + "\n", + "\t\t\t#def f48(T): \n", + "\t\t\t#\t return K/K_298) = integrate(delta_H_rkn_T/(R*T**(2))\n", + "\n", + "\t\t\t# math.log(K/K_298) = quad(f48,T_1,T)[0]\n", + "\n", + "\n", + "\t\t\t# We know that delta_G_rkn_T = -R*T*math.log(K)\n", + "\t\t\t# At 298.15 K\n", + "K_298 = math.exp(-delta_G_rkn_298/(R*T_1) );\n", + "\n", + "\t\t\t# Therfore on simplification we get\n", + "\t\t\t#math.log(K) = 2.94 + 33605.2/T - 2.24*math.log(T) + 0.304*10(-2)*T - 0.073*10**(-5)*T**(2) + 0.09*10**(-9)*T**(3)\n", + "K = math.exp(2.94 + 33605.2/T - 2.24*math.log(T) + 0.304*10**(-2)*T - 0.073*10**(-5)*T**(2) + 0.09*10**(-9)*T**(3));\n", + "\n", + "print \" The value of equilibrium constant at 2600 K is given by K_298 = %f\"%(K);\n", + "\n", + "\n", + "\t\t\t#(a)\n", + "P_1 = 1;\t\t\t#[atm]\n", + "Kp_1 = P_1**(-1./2);\n", + "Ky_1 = K/Kp_1;\n", + "\n", + "\t\t\t# Let the reaction coordinate at equilibrium for the reaction be X\n", + "\t\t\t# At equilibrium, the moles of the components be\n", + "\t\t\t# n_CO_1_eq = 1 - X\n", + "\t\t\t# n_02_1_eq = 0.5- 0.5X\n", + "\t\t\t# n_CO2_1_eq = X\n", + "\t\t\t# Total moles = 1.5 - 0.5*X\n", + "\n", + "\t\t\t# Ky = y_CO2/(y_CO**(1/2)*y_CO)\n", + "\t\t\t#ky = (X*(1.5-0.5*X)**(1/2))/((1-X)*(0.5-0.5*X)**(1/2))\n", + "\n", + "def f(X): \n", + "\t return Ky_1-(X*(1.5-0.5*X)**(1./2))/((1-X)*(0.5-0.5*X)**(1./2))\n", + "X_1 = fsolve(f,0.9)\n", + "\n", + "y_CO2_1 = X_1/(1.5-0.5*X_1);\n", + "y_CO_1 = (1-X_1)/(1.5-0.5*X_1);\n", + "y_O2_1 = (0.5-0.5*X_1)/(1.5-0.5*X_1);\n", + "\n", + "print \" a).The equilibrium composition at 1 atm) is given by y_CO2 = %f y_CO = %f and y_O2 = %f\"%(y_CO2_1,y_CO_1,y_O2_1);\n", + "\n", + "\t\t\t#(b)\n", + "P_2 = 10;\t\t\t#[atm]\n", + "Kp_2 = P_2**(-1./2);\n", + "Ky_2 = K/Kp_2;\n", + "\n", + "\t\t\t# Ky = y_CO2/(y_CO**(1/2)*y_CO)\n", + "\t\t\t#ky = (X*(1.5-0.5*X)**(1/2))/((1-X)*(0.5-0.5*X)**(1/2))\n", + "\n", + "def f1(X): \n", + "\t return Ky_2-(X*(1.5-0.5*X)**(1./2))/((1-X)*(0.5-0.5*X)**(1./2))\n", + "X_2 = fsolve(f1,0.9)\n", + "\n", + "y_CO2_2 = X_2/(1.5-0.5*X_2);\n", + "y_CO_2 = (1-X_2)/(1.5-0.5*X_2);\n", + "y_O2_2 = (0.5-0.5*X_2)/(1.5-0.5*X_2);\n", + "\n", + "print \" b).The equilibrium composition at 10 atm) is given by y_CO2 = %f y_CO = %f and y_O2 = %f\"%(y_CO2_2,y_CO_2,y_O2_2);\n", + "\n", + "\t\t\t#(c)\n", + "P_3 = 1;\t\t\t#[atm]\n", + "Kp_3 = P_3**(-1./2);\n", + "Ky_3 = K/Kp_3;\n", + "\n", + "\t\t\t# Ky = y_CO2/(y_CO**(1/2)*y_CO)\n", + "\t\t\t#ky = (X*(1.5-0.5*X)**(1/2))/((1-X)*(0.5-0.5*X)**(1/2))\n", + "\n", + "\t\t\t# At equilibrium, the moles of the components be\n", + "\t\t\t# n_CO_3_eq = 1 - X\n", + "\t\t\t# n_02_3_eq = 0.5- 0.5X\n", + "\t\t\t# n_CO2_3_eq = X\n", + "\t\t\t# n_N2_eq = 1;\n", + "\t\t\t# Total moles = 2.5 - 0.5*X\n", + "\n", + "def f2(X): \n", + "\t return Ky_3-(X*(2.5-0.5*X)**(1./2))/((1-X)*(0.5-0.5*X)**(1./2))\n", + "X_3 = fsolve(f2,0.9)\n", + "\n", + "y_CO2_3 = X_3/(2.5-0.5*X_3);\n", + "y_CO_3 = (1-X_3)/(2.5-0.5*X_3);\n", + "y_O2_3 = (0.5-0.5*X_3)/(2.5-0.5*X_3);\n", + "y_N2 = 1./(2.5-0.5*X_3);\n", + "\n", + "print \" c).The equilibrium composition at 1 atm and 1 mol N2) is given by y_CO2 = %f y_CO = %f y_O2 = %f and y_N2 = %f\"%(y_CO2_3,y_CO_3,y_O2_3,y_N2);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The value of equilibrium constant at 2600 K is given by K_298 = 16.484152\n", + " a).The equilibrium composition at 1 atm) is given by y_CO2 = 0.757531 y_CO = 0.161646 and y_O2 = 0.080823\n", + " b).The equilibrium composition at 10 atm) is given by y_CO2 = 0.876008 y_CO = 0.082662 and y_O2 = 0.041331\n", + " c).The equilibrium composition at 1 atm and 1 mol N2) is given by y_CO2 = 0.373822 y_CO = 0.100943 y_O2 = 0.050471 and y_N2 = 0.474764\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 17.14 Page Number : 614" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "# Variables\n", + "T = 25 + 298.15;\t\t\t#[K] - Temperature\n", + "R = 8.314;\t\t\t#[J/mol-K]\n", + "delta_G_298 = -1000;\t\t\t#[J] - Gibbs free energy change at 298 K\n", + "\n", + "\t\t\t# G_E/(R*T) = x_1*x_2\n", + "# Calculations and Results\n", + "\t\t\t# We know that delta_G_rkn = - R*T*math.log(K), therefore\n", + "K = math.exp(-delta_G_298/(R*T));\n", + "\n", + "\t\t\t#(1)\n", + "\t\t\t# Let x_1 is the mole fraction of A and x_2 be the mole fraction of B\n", + "\t\t\t# If A and B form an ideal mixture then,\n", + "Ky = 1;\n", + "\t\t\t# and K = Kx = x_2/x_1\n", + "\t\t\t# and at equilibrium x_2/x_1 = K\n", + "\t\t\t# (1-x_1)/x_1 = K\n", + "x_1 = 1/(1+K);\n", + "\n", + "print \" 1).The equilibrium composition for ideal behaviour) is given by x_1 = %f\"%(x_1);\n", + "\n", + "\t\t\t#(2)\n", + "\t\t\t# The activity coefficients are given by\n", + "\t\t\t# math.log(Y1) = [del(n*G_E/(R*T))/del(n_1)]_T,P,n_2 = x_2**(2)\n", + "\t\t\t# similarly, math.log(Y2) = x_1**(2)\n", + "\n", + "\t\t\t# The equilibrium constant for the liquid phase reaction is given by\n", + "\t\t\t# K = Kx*Ky = (x_2*Y2)/(x_1*Y1) = (x_2*math.exp(x_1**(2)))/(x_1*math.exp(x_2**(2)))\n", + "\t\t\t# Solving the above equation we get\n", + "\n", + "def f2(x_1): \n", + "\t return K -((1-x_1)*math.exp(x_1**(2)))/(x_1*math.exp((1-x_1)**(2)))\n", + "x_1_prime = fsolve(f2,0.9)\n", + "\n", + "print \" 2).The equilibrium composition for non-ideal behaviour) is given by x_1 = %f\"%(x_1_prime);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The equilibrium composition for ideal behaviour) is given by x_1 = 0.408008\n", + " 2).The equilibrium composition for non-ideal behaviour) is given by x_1 = 0.328409\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 17.15 Page Number : 615" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "# Variables\t\t\t\n", + "T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard reaction temperature\n", + "T_2 = 373.;\t\t\t#[K] - Reaction temperature\n", + "P = 1.;\t\t\t#[atm]\n", + "R = 1.987;\t\t\t#[cal/mol-K] - Universal gas constant\n", + "\n", + "\t\t\t# CH3COOH (l) + C2H5OH (l) - CH3COOC2H5 (l) + H2O (l)\n", + "\n", + "delta_H_CH3COOH_298 = -116.2*10**(3.);\t\t\t# [cal/mol]\n", + "delta_H_C2H5OH_298 = -66.35*10**(3.);\t\t\t# [cal/mol]\n", + "delta_H_CH3COOC2H5_298 = -110.72*10**(3.);\t\t\t# [cal/mol]\n", + "delta_H_H2O_298 = -68.3174*10**(3.);\t\t\t# [cal/mol]\n", + "\n", + "delta_G_CH3COOH_298 = -93.56*10**(3.);\t\t\t# [cal/mol]\n", + "delta_G_C2H5OH_298 = -41.76*10**(3.);\t\t\t# [cal/mol]\n", + "delta_G_CH3COOC2H5_298 = -76.11*10**(3.);\t\t\t# [cal/mol]\n", + "delta_G_H2O_298 = -56.6899*10**(3.);\t\t\t# [cal/mol]\n", + "\n", + "# Calculations and Results\n", + "delta_H_rkn_298 = delta_H_CH3COOC2H5_298 + delta_H_H2O_298 - delta_H_CH3COOH_298 - delta_H_C2H5OH_298;\t\t\t#[cal/mol]\n", + "delta_G_rkn_298 = delta_G_CH3COOC2H5_298 + delta_G_H2O_298 - delta_G_CH3COOH_298 - delta_G_C2H5OH_298;\t\t\t#[cal/mol]\n", + "\n", + "\t\t\t# We know that delta_G_rkn_T = -R*T*math.log(K)\n", + "\t\t\t# At 298.15 K\n", + "K_298 = math.exp(-delta_G_rkn_298/(R*T_1) );\n", + "\n", + "\t\t\t# We know that dmath.log(K)/dT = delta_H_rkn/(R*T**(2))\n", + "\t\t\t# If delta_H_rkn is assumed constant we get\n", + "\t\t\t# math.log(K_2/K_1) = (-delta_H_rkn/R)*(1/T_2 - 1/T_1)\n", + "\t\t\t# math.log(K_373/K_298) = (-delta_H_rkn_298/R)*(1/T_2 - 1/T_1)\n", + "\n", + "K_373 = math.exp(math.log(K_298) + (-delta_H_rkn_298/R)*(1./T_2 - 1./T_1));\n", + "\t\t\t# Note that the equilibrium constant value rises becauses the reaction is endothermic\n", + "\n", + "print \" The value of equilibrium constant at 373 K is K_373 = %f\"%(K_373);\n", + "\n", + "\t\t\t# Let the reaction coordinate at equilibrium for the reaction be X\n", + "\t\t\t# At equilibrium, the moles of the components be\n", + "\t\t\t# n_CH3COOH = 1 - X\n", + "\t\t\t# n_C2H5OH = 1 - X\n", + "\t\t\t# n_CH3COOC2H5 = X\n", + "\t\t\t# n_H20 = X\n", + "\t\t\t# Total moles = 2\n", + "\n", + "\t\t\t# Kx = (x_CH3COOH*x_C2H5OH)/(x_CH3COOC2H5*x_H2O)\n", + "\t\t\t# Assuming the liquid mixture to be ideal,that is Ky = 1, therefore K_x = K\n", + "K_x = K_373;\n", + "\t\t\t# X**(2)/(1-X)**(2) = K_x\n", + "X = (K_x)**(1./2)/(1+(K_x)**(1./2));\n", + "\n", + "\t\t\t# The mole fraction of ethyl acetate is given by\n", + "x_CH3COOC2H5 = X/2;\n", + "\n", + "print \" The mole fraction of ethyl acetate in the equilibrium reaction mixture is given by x_CH3COOC2H5 = %f\"%(x_CH3COOC2H5);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The value of equilibrium constant at 373 K is K_373 = 0.046697\n", + " The mole fraction of ethyl acetate in the equilibrium reaction mixture is given by x_CH3COOC2H5 = 0.088848\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 17.16 Page Number : 617" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "# Variables\n", + "\t\t\t# CaCO3 (s1) - CaO (s2) + CO2 (g)\n", + "T_1 = 898 + 273.15;\t\t\t#[K]\n", + "T_2 = 700 + 273.15;\t\t\t#[K]\n", + "R = 8.314;\t\t\t#[J/mol-K] - Universal gas constant\n", + "\n", + "P_CO2_T_1 = 1;\t\t\t#[atm] - Decomposition pressure of CO2 over CaCO3 at 898 C\n", + "P_CO2_T_2 = 0.0333;\t\t\t#[atm] - Decomposition pressure of CO2 over CaCO3 at 700 C\n", + "\n", + "\t\t\t# The equilibrium constant of the reaction is given by\n", + "\t\t\t# K = (a_CO2*a_CaO)/a_CaCO3\n", + "\n", + "\t\t\t# Since the pressure is small therefore carbon dioxide can be assumed to behave as ideal gas and thus\n", + "\t\t\t# a_CO2 = y_CO2*P/1 = P_CO2\n", + "\n", + "\t\t\t# The activity of CaO is (CaO is pure)\n", + "\t\t\t# a_CaO = f_CaO/f_0_CaO = exp[V_CaO*(P - P_0)/(R*T)] = 1 (since pressure is low)\n", + "\n", + "\t\t\t# The activity of CaCO3 is (CaCO3 is pure)\n", + "\t\t\t# a_CaCO3 = f_CaCO3/f_0_CaCO3 = exp[V_CaCO3*(P - P_0)/(R*T)] = 1 (since pressure is low)\n", + "\n", + "\t\t\t#Since pressures are around 1 atm,therefore Poynting factors are also near 1, and thus activity of CaO and CaCO3 is unity and equilibrium constant is given by\n", + "\t\t\t#K = P_CO2 , therefore\n", + "# Calculations \n", + "\t\t\t# At 898 C\n", + "K_T_1 = P_CO2_T_1;\n", + "delta_G_T_1 = -R*T_1*math.log(K_T_1);\n", + "\n", + "\t\t\t# At 700 C\n", + "K_T_2 = P_CO2_T_2;\n", + "delta_G_T_2 = -R*T_2*math.log(K_T_2);\n", + "\n", + "# Results\n", + "print \" The value of delta_G_rkn at 700 C is %f J\"%(delta_G_T_1);\n", + "print \" The value of delta_G_rkn at 898 C is %f J\"%(delta_G_T_2);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The value of delta_G_rkn at 700 C is -0.000000 J\n", + " The value of delta_G_rkn at 898 C is 27526.397496 J\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 17.17 Page Number : 618" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "# Variables\n", + "T = 700 + 273.15;\t\t\t#[K]\n", + "K = 7.403;\t\t\t# Equilibrium constant for the reaction at 700 C\n", + "\n", + "\t\t\t# CH4 - C (s) + 2*H2 \n", + "\n", + "\t\t\t# The equilibrium constant of the reaction is given by\n", + "\t\t\t# K = (a_C*a_H2**(2))/a_CH4\n", + "\n", + "\t\t\t# Since carbon is pure therefore its activity is given by\n", + "\t\t\t# a_C = f/f_0 = 1 as pressure is 1 atm.\n", + "\t\t\t# Since the pressure is low,therefore the gas phase can be taken to be ideal,therefore\n", + "\t\t\t# K = (y_H2**(2)*P**(2))/(y_CH4*P) = y_H2**(2)/y_CH4 (as P = 1 atm)\n", + "Ky = K;\t\t\t# (Kp = 1 atm)\n", + "\n", + "\t\t\t# Initial moles of the species are\n", + "n_CH4 = 1;\n", + "n_H2 = 0;\n", + "n_C = 0;\n", + "\n", + "\t\t\t# Let the reaction coordinate at equilibrium for the reaction be X\n", + "\t\t\t# Moles at equilibrium be\n", + "\t\t\t# n_CH4_eq = 1 -X\n", + "\t\t\t# n_H2_eq = 2*x\n", + "\t\t\t# n_C_eq = X\n", + "\n", + "\t\t\t# Moles present in gas phase\n", + "\t\t\t# n_CH4_gas = 1 -X\n", + "\t\t\t# n_H2_gas = 2*x\n", + "\t\t\t# Total moles = 1 + X\n", + "\n", + "\t\t\t# gas phase mole fraction \n", + "\t\t\t# y_CH4_gas = (1 -X)/(1+X)\n", + "\t\t\t# y_H2_gas = 2*x/(1+X)\n", + "\n", + "# Calculations and Results\n", + "# Ky = y_H2_gas**(2)/y_CH4_gaS\n", + "X = (K/(4+K))**(1./2);\n", + "\n", + "print \" The number of moles of carbon black formed from one mole of methane is %f mol\"%(X);\n", + "\n", + "\t\t\t# Therefore mole fraction of components in the gas phase at equilibrium is \n", + "y_CH4 = (1-X)/(1+X);\n", + "y_H2 = 2*X/(1+X);\n", + "\n", + "print \" The mole fraction of components in the gas phase at equilibrium is given by y_CH4 = %f and y_H2 = %f \"%(y_CH4,y_H2);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The number of moles of carbon black formed from one mole of methane is 0.805739 mol\n", + " The mole fraction of components in the gas phase at equilibrium is given by y_CH4 = 0.107580 and y_H2 = 0.892420 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 17.18 Page Number : 619" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables \n", + "T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard reaction temperature\n", + "T_2 = 1042;\t\t\t#[K] - Reaction temperature\n", + "R = 1.987;\t\t\t#[cal/mol-K] - Universal gas constant\n", + "\n", + "\t\t\t# CaCO3 (s1) - CaO (s2) + CO2 (g)\n", + "\n", + "delta_H_CaCO3_298 = -289.5;\t\t\t#[kcal/mol] - Enthalpy of formation of CaCO3 at 298.15 K\n", + "delta_H_CaO_298 = -151.7;\t\t\t#[kcal/mol] - Enthalpy of formation of CaO at 298.15 K\n", + "delta_H_CO2_298 = -94.052;\t\t\t#[kcal/mol] - Enthalpy of formation of CO2 at 298.15 K\n", + "delta_G_CaCO3_298 = -270.8;\t\t\t#[kcal/mol] - Gibbs free energy change for formation of CaCO3 at 298.15 K\n", + "delta_G_CaO_298 = -144.3;\t\t\t#[kcal/mol] - Gibbs free energy change for formation of CaO at 298.15 K\n", + "delta_G_CO2_298 = -94.260;\t\t\t#[kcal/mol] - Gibbs free energy change for formation of CO2 at 298.15 K\n", + "\n", + "\t\t\t# The smath.tan(math.radiansard heat capacity data as a function of temperature are given below\n", + "\t\t\t# Cp_CO2 = 5.316 + 1.4285*10**(2)*T - 0.8362*10**(-5)*T**(2) + 1.784*10**(-9)*T**(3)\n", + "\t\t\t# Cp_CaO = 12.129 + 0.88*10**(-3)*T - 2.08*10**(5)*T**(-2)\n", + "\t\t\t# Cp_CaCO3 = 24.98 + 5.240*10**(-3)*T - 6.199*10**(5)*T**(-2)\n", + "\t\t\t# Therefore Cp_0 is given by\n", + "\t\t\t# Cp_0 = Cp_CO2 + Cp_CaO - Cp_CaCO3\n", + "\t\t\t# Cp_0 = -7.535 + 9.925*10**(-3)*T - 0.8362*10**(-5)*T**(2) + 1.784*10**(-9)*T**(3) + 4.119*10**(5)*T**(-2)\n", + "# Calculations and Results\n", + "\t\t\t# The smath.tan(math.radiansard enthalpy change of the reaction at 298.15 K is given by\n", + "delta_H_rkn_298 = delta_H_CO2_298 + delta_H_CaO_298 - delta_H_CaCO3_298;\t\t\t#[kcal]\n", + "delta_H_rkn_298 = delta_H_rkn_298*10**(3);\t\t\t#[cal]\n", + "delta_G_rkn_298 = delta_G_CO2_298 + delta_G_CaO_298 - delta_G_CaCO3_298;\t\t\t#[kcal]\n", + "delta_G_rkn_298 = delta_G_rkn_298*10**(3);\t\t\t#[cal]\n", + "\n", + "\t\t\t# The smath.tan(math.radiansard enthalpy change of the reaction at temperature T is given by\n", + "\n", + "def f7(T): \n", + "\t return -7.535 + 9.925*10**(-3)*T - 0.8362*10**(-5)*T**(2) + 1.784*10**(-9)*T**(3) + 4.119*10**(5)*T**(-2)\n", + "\n", + "\t\t\t# delta_H_rkn_T = delta_H_rkn_298 + quad(f7,T_1,T)[0]\n", + "\n", + "\t\t\t# On simplification we get\n", + "\t\t\t# delta_H_rkn_T = 47005.3 - 7.535*T + 4.9625*10**(-3)*T**(2) - 0.2787*10**(-5)*T**(3) + 0.446*10**(-9)*T**(4) - 4.119*10**(5)*T**(-1)\n", + "\n", + "\n", + "\n", + "\t\t\t#def f8(T): \n", + "\t\t\t#\t return K_2/K_1) = integrate(delta_H_rkn_T/(R*T**(2))\n", + "\n", + "\t\t\t# math.log(K_2/K_1) = quad(f8,T_1,T)[0]\n", + "\n", + "\n", + "def f9(T): \n", + "\t return (47005.3-7.535*T+4.9625*10**(-3)*T**(2)-0.2787*10**(-5)*T**(3)+0.446*10**(-9)*T**(4) - 4.119*10**(5)*T**(-1))/T**(2)\n", + "\n", + "math.log_K2_K1 = quad(f9,T_1,T_2)[0];\t\t\t# math.log(K_2/K_1)[0]\n", + "\n", + "\n", + "\t\t\t# We know that delta_G_rkn_T = -R*T*math.log(K)\n", + "\t\t\t# At 298.15 K\n", + "K_298 = math.exp(-delta_G_rkn_298/(R*T_1) );\n", + "\n", + "\t\t\t# Putting the values in the above math.expression we get\n", + "\t\t\t# math.log(K_1042/K_298) = math.log_K2_K1/R\n", + "K_1042 = K_298*math.exp(math.log_K2_K1/R);\n", + "\n", + "print \" The value of equilibrium constant at 1042 K is K_1042 = %f\"%(K_1042);\n", + "\n", + "\t\t\t# Since for the given reaction K = P_CO2,where P is in atm, therefore,\n", + "P_CO2 = K_1042;\n", + "\t\t\t# and thus decomposition takes place till the partial pressure of CO2 reaches 0.095 atm\n", + "\t\t\t# After that the decomposition in the closed vessel stops as equilibrium is achieved.\n", + "\n", + "print \" The equilibrium pressure of CO2 is P_CO2 = %f atm \"%(P_CO2);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The value of equilibrium constant at 1042 K is K_1042 = 0.095017\n", + " The equilibrium pressure of CO2 is P_CO2 = 0.095017 atm \n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 17.19 Page Number : 620" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "# Variables \n", + "T_1 = 298.15;\t\t\t#[k] - Smath.tan(math.radiansard reaction temperature\n", + "T_2 = 1200;\t\t\t#[K] - Reaction temperature\n", + "R = 1.987;\t\t\t#[cal/mol-K] - Universal gas consatnt\n", + "\n", + "\t\t\t# C (s) + CO2 (g) - 2*CO2 (g) \t\t\t# Reaction 1\n", + "\t\t\t# CO2 + H2 - CO + H2O \t\t\t# Reacction 2\n", + "\n", + "K_1 = 63;\t\t\t# Equilibrium constant for the first reaction\n", + "K_2 = 1.4;\t\t\t# Equilibrium constant for the secind reaction\n", + "\n", + "delta_G_H2O_298 = -54640;\t\t\t#[cal/mol] - Smath.tan(math.radiansard Gibbs free energy of formation of water vapour\n", + "delta_H_H2O_298 = -57800;\t\t\t#[cal/mol] - Smath.tan(math.radiansard enthalpy change of formation of water vapour\n", + "delta_G_rkn_298 = delta_G_H2O_298;\n", + "\n", + "\t\t\t# The smath.tan(math.radiansard heat capacity data of the components in cal/mol-K are given below\n", + "\t\t\t# Cp_H2 = 6.947 - 0.2*10**(-3)*T + 4.8*10**(-7)*T**(2)\n", + "\t\t\t# Cp_O2 = 6.148 + 3.1*10**(-3)*T - 9.2*10**(-7)*T**(2)\n", + "\t\t\t# Cp_H2O = 7.256 + 2.3*10**(-3)*T + 2.8*10**(-7)*T**(2)\n", + "\n", + "\t\t\t# Let us consider two more reactions\n", + "\t\t\t# C (s) + (1/2)*O2 - CO \t\t\t# Reaction 3\n", + "\t\t\t# H2 + (1/2)*O2 - H2O \t\t\t# Reaction 4\n", + "\n", + "\t\t\t# Considering the above 4 reactions, it can be shown that reaction (3) = reaction (1) + reaction (4) - reaction (2)\n", + "\t\t\t# Thus, delta_G_rkn_3 = delta_G_rkn_1 + delta_G_rkn_4 - delta_G_rkn_2\n", + "\t\t\t# or, -R*T*math.log(K_3) = -R*T*math.log(K_1) + -R*T*math.log(K_4) - -R*T*math.log(K_2)\n", + "\t\t\t# K_3 = (K_1*K_4/K_2)\n", + "\n", + "\t\t\t# Now we have to determine K_4 at 1200 K.\n", + "\t\t\t# The smath.tan(math.radiansard enthalpy change of reaction (4) as a fuction of temperature is given by\n", + "\t\t\t# delta_H_rkn_T = -57020 - 2.765*T + 0.475*10**(-3)*T**(2) + 8.67*10**(-8)*T**(3);\n", + "\n", + "\n", + "\t\t\t#def f2(T): \n", + "\t\t\t#\t return K_4_2/K_4_1) = integrate(delta_H_rkn_T/(R*T**(2))\n", + "\n", + "\t\t\t# math.log(K_4_2/K_4_1) = quad(f2,T_1,T)[0]\n", + "\n", + "# Calculations\n", + "def f3(T): \n", + "\t return (-57020-2.765*T+0.475*10**(-3)*T**(2)+8.67*10**(-8)*T**(3))/T**(2)\n", + "\n", + "math.log_K2_K1_4 = quad(f3,T_1,T_2)[0]\n", + "\n", + "\n", + "\t\t\t# We know that delta_G_rkn_T = -R*T*math.log(K)\n", + "\t\t\t# At 298.15 K\n", + "K_4_298 = math.exp(-delta_G_rkn_298/(R*T_1) );\n", + "\n", + "\t\t\t# Putting the values in the above math.expression we get\n", + "\t\t\t# math.log(K_4_1200/K_4_298) = math.log_K2_K1_R/R\n", + "K_4_1200 = K_4_298*math.exp(math.log_K2_K1_4/R);\n", + "K_4 = K_4_1200;\n", + "\n", + "\t\t\t# Therefore the equilibrium constant for reaction (3) at 1200 K is given by\n", + "K_3 = (K_1*K_4)/K_2;\n", + "\n", + "# Results\n", + "print \" The equilibrium constant at 1200 K for the given reaction is K = %e\"%(K_3);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The equilibrium constant at 1200 K for the given reaction is K = 3.622432e+09\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 17.20 Page Number : 622" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "delta_G_H2O_298 = -237.034;\t\t\t#[kJ/mol] - Smath.tan(math.radiansard Gibbs free energy of formation of H2O (l) at 298 K\n", + "F = 96485;\t\t\t#[C/mol] - Faraday constant\n", + "\n", + "\t\t\t#(1)\n", + "\t\t\t# For the reaction\n", + "\t\t\t# H2 (g) + (1/2)*O2 (g) - H2O (l)\n", + "n = 2;\t\t\t# Number of electrons transferred in the reaction\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# The smath.tan(math.radiansard Gibbs free energy change of the reaction is given by\n", + "\t\t\t# delta_G_rkn = delta_G_for_H2O(l) - delta_G_for_H2(g) - (1/2/)*delta_G_for_O2(g)\n", + "\t\t\t# Since delta_G_for_H2 = 0 and delta_G_for_O2 = 0 (pure components)\n", + "delta_G_rkn = delta_G_H2O_298;\t\t\t#[kJ]\n", + "delta_G_rkn = delta_G_rkn*10**(3);\t\t\t#[J]\n", + "\n", + "\t\t\t# delta_G_rkn = -n*F*E_0\n", + "\t\t\t# Thus smath.tan(math.radiansard equilibrium cell voltage is given by\n", + "E_0 = - delta_G_rkn/(n*F);\t\t\t#/[V]\n", + "\n", + "print \" 1).The standard equilibrium cell voltage is %f V\"%(E_0);\n", + "\n", + "\t\t\t#(2)\n", + "\t\t\t# For the reaction\n", + "\t\t\t# 2*H2 (g) + O2 (g) - 2*H2O (l)\n", + "n_prime = 4;\t\t\t# Number of electrons transferred in the reaction\n", + "\n", + "\t\t\t# The smath.tan(math.radiansard Gibbs free energy change of the reaction is given by\n", + "\t\t\t# delta_G_rkn = 2*delta_G_for_H2O(l) - 2*delta_G_for_H2(g) - delta_G_for_O2(g)\n", + "\t\t\t# Since delta_G_for_H2 = 0 and delta_G_for_O2 = 0 (pure components)\n", + "delta_G_rkn_prime = 2*delta_G_H2O_298;\t\t\t#[kJ]\n", + "delta_G_rkn_prime = delta_G_rkn_prime*10**(3);\t\t\t#[J]\n", + "\n", + "\t\t\t# delta_G_rkn = -n*F*E_0\n", + "\t\t\t# Thus smath.tan(math.radiansard equilibrium cell voltage is given by\n", + "E_0_prime = - delta_G_rkn_prime/(n_prime*F);\t\t\t#/[V]\n", + "\n", + "print \" 2).The standard equilibrium cell voltage is %f V\"%(E_0_prime);\n", + "\n", + "\t\t\t# Thus the result obtained is same for both the reactions\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The standard equilibrium cell voltage is 1.228346 V\n", + " 2).The standard equilibrium cell voltage is 1.228346 V\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 17.21 Page Number : 624" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\t\t\t\n", + "P = 2;\t\t\t# Number of phases\n", + "C = 5;\t\t\t# Number of components\n", + "\n", + "# Calculations\t\n", + " \t\t# First we write chemical equations for formation of each component from basic elements\n", + "\t\t\t# C + 2*H2 = CH4 \t\t\t# (reaction 1) \n", + "\t\t\t# H2 + (1/2)*O2 = H20 \t\t\t# (reaction 2)\n", + "\t\t\t# C + (1/2)*O2 = CO \t\t\t# (reaction 3)\n", + "\t\t\t# C + O2 = CO2 \t\t\t# (reaction 4)\n", + "\n", + "\t\t\t# We do not have C in the equilibrium reaction mixture, therefore we have to eliminate it.\n", + "\t\t\t# Substituting for C from reaction (1) into reactions (3) and (4) we get the following set of reactions\n", + "\t\t\t# H2 + (1/2)*O2 = H20\n", + "\t\t\t# CH4 - 2*H2 + (1/2)*O2 = CO\n", + "\t\t\t# CH4 - 2*H2 + O2 = CO2\n", + "\n", + "\t\t\t# or,\n", + "\t\t\t# H2 + (1/2)*O2 = H2O\n", + "\t\t\t# CH4 + (1/2)*O2 = CO + 2*H2\n", + "\t\t\t# CH4 + O2 = CO2 + 2*H2\n", + "\n", + "\t\t\t# We do not have O2 in the equilibrium reaction mixture,therefore we have to eliminateit\n", + "\t\t\t# Substituting for O2 from the first reaction of the above set into seecond and third reactions of the above set we get the following set of reactions.\n", + "\t\t\t# CH4 + H2O - H2 = CO + 2*H2\n", + "\t\t\t# CH4 + 2*H20 - 2*H2 = CO2 + 2*H2 \n", + "\n", + "\t\t\t# Therefore one set of independent reactions is\n", + "\t\t\t# CH4 + H20 = CO + 3*H2\n", + "\t\t\t# CH4 + 2*H2O = CO2 + 4*H2\n", + "\n", + "\t\t\t# Another set of independent reactions can be obtained by substituting for CH4 from the first reaction into second and we get\n", + "\t\t\t# CH4 + H2O = CO + 3*H2\n", + "\t\t\t# CO + 3*H2 - H2O + 2*H2O = CO2 4*H2\n", + "\n", + "\t\t\t# Or, \n", + "\t\t\t# CH4 + H2O = CO + 3*H2\n", + "\t\t\t# CO + H2O = CO2 + H2\n", + "\t\t\t# This is another set of independent reactions. Thus whatever be the set of independent reactions, the number of independent reactions are two\n", + "\t\t\t# If different set of reactions are considered, then we get different equilibrium constants,different reaction coordinates but the final composition will be same\n", + "\t\t\t# Thus only 2 independent reactions occur,therefore \n", + "r = 2;\n", + "\n", + "\t\t\t# and the number of degree of freedom becomes,\n", + "F = r - P + C;\n", + "\n", + "# Results\n", + "print \" The number of independent chemical reactions are %f \"%(r);\n", + "\n", + "print \" The first set of independent reactions are given below\";\n", + "print \" CH4 + H20 = CO + 3*H2\";\n", + "print \" CH4 + 2*H2O = CO2 + 4*H2\";\n", + "\n", + "print \" The second set of independent reactions are given below\";\n", + "print \" CH4 + H20 = CO + 3*H2\";\n", + "print \" CO + H2O = CO2 + H2\";\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The number of independent chemical reactions are 2.000000 \n", + " The first set of independent reactions are given below\n", + " CH4 + H20 = CO + 3*H2\n", + " CH4 + 2*H2O = CO2 + 4*H2\n", + " The second set of independent reactions are given below\n", + " CH4 + H20 = CO + 3*H2\n", + " CO + H2O = CO2 + H2\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 17.22 Page Number : 626" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\t\t\t\n", + "T = 400.;\t\t\t#[K] - Temperature\n", + "P = 1.;\t\t\t#[atm] - Pressure\n", + "R = 1.987;\t\t\t#[cal/mol-K] - Universal gas consatnt\n", + "\n", + "delta_G_n_pentane_400 = 9600.;\t\t\t#[cal/mol] - Smath.tan(math.radiansard Gibbs free energy of formation of n-pentane at 400 K\n", + "delta_G_iso_pentane_400 = 8200.;\t\t\t#[cal/mol] - Smath.tan(math.radiansard Gibbs free energy of formation of iso-pentane at 400 K\n", + "delta_G_neo_pentane_400 = 9000.;\t\t\t#[cal/mol] - Smath.tan(math.radiansard Gibbs free energy of formation of neo-pentane at 400 K\n", + "\n", + "\t\t\t# The three reactions for the formation of these isomers can be written as follows\n", + "\t\t\t# 5*C + 6*H2 = n-pentane\n", + "\t\t\t# 5*C + 6*H2 = iso-pentane\n", + "\t\t\t# 5*C + 6*H2 = neo-pentane\n", + "\n", + "\t\t\t# We can eliminate elemental carbon and hydrogen as they are not present in equilibrium reaction mixture and get the following two sets of independent reactions\n", + "\t\t\t# n-pentane = iso-pentane \n", + "\t\t\t# n-pentane = neo-pentane \n", + "\n", + "\t\t\t# or,\n", + "\t\t\t# iso-pentane = n-pentane \n", + "\t\t\t# iso-pentane = neo-pentane \n", + "\n", + "\t\t\t# or,\n", + "\t\t\t# noe-pentane = iso-pentane \n", + "\t\t\t# neo-pentane = n-pentane \n", + "# Calculations and Results\n", + "\t\t\t# Let us take the following set of independent reactions\n", + "\t\t\t# iso-pentane = n-pentane \t\t\t# (reaction 1)\n", + "delta_G_rkn_1 = delta_G_n_pentane_400 - delta_G_iso_pentane_400;\t\t\t#[cal]\n", + "K_1 = math.exp(-delta_G_rkn_1/(R*T));\n", + "\t\t\t# iso-pentane = neo-pentane \t\t\t# (reaction 2)\n", + "delta_G_rkn_2 = delta_G_neo_pentane_400 - delta_G_iso_pentane_400;\t\t\t#[cal]\n", + "K_2 = math.exp(-delta_G_rkn_2/(R*T));\n", + "\n", + "\t\t\t# Let the initial number of moles be\n", + "\t\t\t# n_iso_pentane = 1\n", + "\t\t\t# n_n_pentane = 0\n", + "\t\t\t# n_neo_pentane = 0\n", + "\n", + "\t\t\t# Let the reaction coordinate at equilibrium for the two reaction be X_1 and X_2 respectively\n", + "\t\t\t# At equilibrium, the moles of the components be\n", + "\t\t\t# n_iso_pentane_eq = 1 - X_1 - X_2\n", + "\t\t\t# n_n_pentane_eq = X_1\n", + "\t\t\t# n_neo_pentane_eq = X_2\n", + "\t\t\t# Total moles = 1 \n", + "\n", + "\t\t\t# Pressure has no effect on these reactions ( P = 1 atm) and therefore\n", + "Ky_1 = K_1;\n", + "Ky_2 = K_2;\n", + "\n", + "\t\t\t# From reaction (1), we get\n", + "\t\t\t# Ky_1 = X_1/(1-X_1-X_2)\n", + "\n", + "\t\t\t# From reaction (2), we get\n", + "\t\t\t# Ky_2 = X_2/(1-X_1-X_2)\n", + "\n", + "\t\t\t# Putting the value of X_1 from first equation into the second we get\n", + "\t\t\t# X_1 = (Ky_1*(1-X_2))/(1+Ky_1)\n", + "\t\t\t# Now putting it into the second equation we grt\n", + "\t\t\t# Ky_2 = X_2/(1-((Ky_1*(1-X_2))/(1+Ky_1))-X_2)\n", + "\t\t\t# Now solving for X_2\n", + "def f(X_2): \n", + "\t return Ky_2 - X_2/(1-((Ky_1*(1-X_2))/(1+Ky_1))-X_2)\n", + "X_2 = fsolve(f,0.8)\n", + "\n", + "\t\t\t# Therefore X_1 can be calculated as\n", + "X_1 = (Ky_1*(1-X_2))/(1+Ky_1);\n", + "\n", + "\t\t\t# Finally the mole fractions of the components at equilibrium\n", + "y_n_pentane = X_1;\n", + "y_neo_pentane = X_2;\n", + "y_iso_pentane = 1 -X_1 - X_2;\n", + "\n", + "print \" The equilibrium composition is given by y_n_pentane = %f y_neo_pentane = %f and y_iso_pentane = %f\"%(y_n_pentane,y_neo_pentane,y_iso_pentane);\n", + "\n", + "\t\t\t# Let us consider another set of independent reactions\n", + "\n", + "\t\t\t# n-pentane = iso-pentane \t\t\t# (reaction 3)\n", + "delta_G_rkn_3 = delta_G_iso_pentane_400 - delta_G_n_pentane_400;\t\t\t#[cal]\n", + "K_3 = math.exp(-delta_G_rkn_3/(R*T));\n", + "\t\t\t# n-pentane = neo-pentane \t\t\t# (reaction 4)\n", + "delta_G_rkn_4 = delta_G_neo_pentane_400 - delta_G_n_pentane_400;\t\t\t#[cal]\n", + "K_4 = math.exp(-delta_G_rkn_4/(R*T));\n", + "\n", + "\t\t\t# Let the initial number of moles be\n", + "\t\t\t# n_n_pentane = 1\n", + "\t\t\t# n_iso_pentane = 0\n", + "\t\t\t# n_neo_pentane = 0\n", + "\n", + "\t\t\t# Let the reaction coordinate at equilibrium for the two reaction be X_3 and X_4 respectively\n", + "\t\t\t# At equilibrium, the moles of the components be\n", + "\t\t\t# n_n_pentane_eq = 1 - X_3 - X_4\n", + "\t\t\t# n_iso_pentane_eq = X_4\n", + "\t\t\t# n_neo_pentane_eq = X_4\n", + "\t\t\t# Total moles = 1 \n", + "\n", + "\t\t\t# Pressure has no effect on these reactions (P = 1 atm) and therefore\n", + "Ky_3 = K_3;\n", + "Ky_4 = K_4;\n", + "\n", + "\t\t\t# From reaction (3), we get\n", + "\t\t\t# Ky_3 = X_3/(1-X_3-X_4)\n", + "\n", + "\t\t\t# From reaction (4), we get\n", + "\t\t\t# Ky_4 = X_4/(1-X_3-X_4)\n", + "\n", + "\t\t\t# Putting the value of X_3 from first equation into the second we get\n", + "\t\t\t# X_3 = (Ky_3*(1-X_4))/(1+Ky_3)\n", + "\t\t\t# Now putting it into the second equation we grt\n", + "\t\t\t# Ky_4 = X_4/(1-((Ky_1*(1-X_4))/(1+Ky_3))-X_4)\n", + "\t\t\t# Now solving for X_4\n", + "def f1(X_4): \n", + "\t return Ky_4 - X_4/(1-((Ky_3*(1-X_4))/(1+Ky_3))-X_4)\n", + "X_4 = fsolve(f1,0.8)\n", + "\n", + "\t\t\t# Therefore X_3 can be calculated as\n", + "X_3 = (Ky_3*(1-X_4))/(1+Ky_3);\n", + "\n", + "\t\t\t# Finally the mole fractions of the components at equilibrium\n", + "y_n_pentane1 = 1 - X_3 - X_4;\n", + "y_neo_pentane1 = X_4;\n", + "y_iso_pentane1 = X_3;\n", + "\n", + "\t\t\t# The final composition does not depend on the set of reactions considered. \n", + "\n", + "print \" For another set of independent reactions considered\";\n", + "print \" The equilibrium composition is given by y_n_pentane = %f y_neo_pentane = %f and y_iso_pentane = %f\"%(y_n_pentane1,y_neo_pentane1,y_iso_pentane1);\n", + "print \" Thus the final composition does not depend on the set of reactions considered\";\n", + "print \" The number of independent reactions taking place is two\";\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The equilibrium composition is given by y_n_pentane = 0.111753 y_neo_pentane = 0.237745 and y_iso_pentane = 0.650501\n", + " For another set of independent reactions considered\n", + " The equilibrium composition is given by y_n_pentane = 0.111753 y_neo_pentane = 0.237745 and y_iso_pentane = 0.650501\n", + " Thus the final composition does not depend on the set of reactions considered\n", + " The number of independent reactions taking place is two\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 17.23 Page Number : 628" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T = 600;\t\t\t#[K] - Temperature\n", + "P = 1;\t\t\t#[atm] - Pressure\n", + "R = 1.987;\t\t\t#[cal/mol-K] - Universal gas consatnt\n", + "\n", + "\t\t\t# CH4 + H2O = CO + 3*H2 \t\t\t# (Reaction 1)\n", + "\t\t\t# CO + H2O = CO2 + H2 \t\t\t# (Reaction 2)\n", + "\n", + "K_1 = 0.574;\t\t\t# Equilibrium constant of first reaction\n", + "K_2 = 2.21;\t\t\t# Equilibrium constant of second reaction\n", + "\n", + "\t\t\t# Initial number of moles of the components are\n", + "\t\t\t# n_CH4 = 1\n", + "\t\t\t# n_H2O = 5\n", + "\t\t\t# n_CO = 0\n", + "\t\t\t# n_H2 = O\n", + "\t\t\t# n_CO2 = 0\n", + "\n", + "\t\t\t# Let the reaction coordinate at equilibrium for the two reaction be X_1 and X_2 respectively\n", + "\t\t\t# At equilibrium, the moles of the components be\n", + "\t\t\t# n_CH4_eq = 1 - X_1\n", + "\t\t\t# n_H20_eq = 5 - X_1 - X_2\n", + "\t\t\t# n_CO_eq = X_1 - X_2\n", + "\t\t\t# n_H2_eq = 3*X_1 + X_2\n", + "\t\t\t# n_CO2_eq = X_2\n", + "\t\t\t# Total moles = 6 + 2*X_1\n", + "\n", + "\t\t\t# Since the pressure is 1 atm, K = Kp, Ky = K\n", + "Ky_1 = K_1;\n", + "Ky_2 = K_2;\n", + "\n", + "\t\t\t# From reaction (1), we get\n", + "\t\t\t# Ky_1 = ((X_1-X_2)*(3*X_1+X_2)**(3))/((1-X_1)*(5-X_1-X_2)*(6+2*X_1)**(2))\n", + "\n", + "\t\t\t# From reaction (2), we get\n", + "\t\t\t# Ky_2 = (X_2*(3*X_1+X_2))/((X_1-X_2)*(5-X_1-X_2))\n", + "\n", + "# Calculations\n", + "\t\t\t# Let us assume a value of X_1\n", + "X_1 = 0.1;\n", + "def f(X_2): \n", + "\t return Ky_1-((X_1-X_2)*(3*X_1+X_2)**(3))/((1-X_1)*(5-X_1-X_2)*(6+2*X_1)**(2))\n", + "\n", + "def f1(X_1_prime): \n", + "\t return Ky_2-(X_2_prime*(3*X_1_prime+X_2_prime))/((X_1_prime-X_2_prime)*(5-X_1_prime-X_2_prime))\n", + "\n", + "fault = 10;\n", + "while(fault>0.05):\n", + " X_2 = fsolve(f,0.8)\n", + " X_2_prime = X_2;\n", + " X_1_prime = fsolve(f1,0.8)\n", + " fault=abs(X_1 - X_1_prime);\n", + " X_1 = X_1 + 0.001;\n", + "\n", + "n_CH4 = 1 - X_1;\n", + "n_H20 = 5 - X_1 - X_2;\n", + "n_CO = X_1 - X_2;\n", + "n_H2 = 3*X_1 + X_2;\n", + "n_CO2 = X_2;\n", + "Total_moles = 6 + 2*X_1;\n", + "\n", + "# Results\n", + "print \" The equilibrium composition of the resulting mixture is given by\";\n", + "print \" n_CH4 = % f mol n_H2O = %f mol n_CO = %f mol n_H2 = %f mol and n_CO2 = %f mol\"%(n_CH4,n_H20,n_CO,n_H2,n_CO2);\n", + "print \" The total number of moles is %f mol\"%(Total_moles);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The equilibrium composition of the resulting mixture is given by\n", + " n_CH4 = 0.089000 mol n_H2O = 3.471420 mol n_CO = 0.293420 mol n_H2 = 3.350580 mol and n_CO2 = 0.617580 mol\n", + " The total number of moles is 7.822000 mol\n" + ] + }, + { + "output_type": "stream", + "stream": "stderr", + "text": [ + "/home/jovina/virtualenvs/scipy/local/lib/python2.7/site-packages/scipy/optimize/minpack.py:236: RuntimeWarning: The iteration is not making good progress, as measured by the \n", + " improvement from the last ten iterations.\n", + " warnings.warn(msg, RuntimeWarning)\n", + "/home/jovina/virtualenvs/scipy/local/lib/python2.7/site-packages/scipy/optimize/minpack.py:236: RuntimeWarning: The iteration is not making good progress, as measured by the \n", + " improvement from the last five Jacobian evaluations.\n", + " warnings.warn(msg, RuntimeWarning)\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 17.24 Page Number : 631" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T = 600 + 273.15;\t\t\t#[K] - Reaction temperature\n", + "P = 1;\t\t\t#[atm] - Reaction pressure\n", + "\n", + "\t\t\t# The Gibbs free energy of formation of various species at 873.15 K are\n", + "delta_G_CH4_RT = -2.82;\t\t\t# delta_G_CH4/(R*T)\n", + "delta_G_H2O_RT = -29.73;\t\t\t# delta_G_CH4/(R*T)\n", + "delta_G_CO_RT = -27.51;\t\t\t# delta_G_CH4/(R*T)\n", + "delta_G_H2_RT = -1.46;\t\t\t# delta_G_CH4/(R*T)\n", + "delta_G_CO2_RT = -56.68;\t\t\t# delta_G_CH4/(R*T)\n", + "\n", + "# Calculations\t\t\n", + " \t# Initial number of moles of the components are\n", + "\t\t\t# n_CH4 = 1\n", + "\t\t\t# n_H2O = 5\n", + "\t\t\t# n_CO = 0\n", + "\t\t\t# n_H2 = O\n", + "\t\t\t# n_CO2 = 0\n", + "\n", + "\t\t\t# The del(F)/del(n_i) = 0 equations for CH4 (1), H2O (2), CO (3), H2 (4) and CO2 (5) becomes\n", + "\t\t\t# delta_G_1_T + R*T*math.log((n_1*P)/n) + lambda_C + 4*lambda_H = 0\n", + "\t\t\t# delta_G_2_T + R*T*math.log((n_2*P)/n) + 2*lambda_C + lambda_O = 0\n", + "\t\t\t# delta_G_3_T + R*T*math.log((n_3*P)/n) + lambda_c + lambda_O = 0\n", + "\t\t\t# delta_G_4_T + R*T*math.log((n_4*P)/n) + 2*lambda_H = 0\n", + "\t\t\t# delta_G_5_T + R*T*math.log((n_5*P)/n) + lambda_C + 2*lambda_O = 0\n", + "\n", + "\t\t\t# Where n is the total number of moles in the equilibrium reaction mixture. Dividing the above equations by R*T we get\n", + "\t\t\t# delta_G_1_T/(R*T) + math.log((n_1*P)/n) + lambda_C/(R*T) + 4*lambda_H/(R*T) = 0\n", + "\t\t\t# delta_G_2_T/(R*T) + math.log((n_2*P)/n) + 2*lambda_C/(R*T) + lambda_O/(R*T) = 0\n", + "\t\t\t# delta_G_3_T/(R*T) + math.log((n_3*P)/n) + lambda_c/(R*T) + lambda_O/(R*T) = 0\n", + "\t\t\t# delta_G_4_T/(R*T) + math.log((n_4*P)/n) + 2*lambda_H/(R*T) = 0\n", + "\t\t\t# delta_G_5_T/(R*T) + math.log((n_5*P)/n) + lambda_C/(R*T) + 2*lambda_O/(R*T) = 0\n", + "\n", + "\t\t\t# Substituting the values of delta_G_i_T/(R*T) in the above equations,the full set of equations (including elemental balance) becomes\n", + "\t\t\t# -2.82 + math.log(n_1/n) + lambda_C/(R*T) + 4*lambda_H/(R*T) = 0\n", + "\t\t\t# -29.73 + math.log(n_2/n) + 2*lambda_H/(R*T) + lambda_O/(R*T) = 0\n", + "\t\t\t# -27.51 + math.log(n_3/n) + lambda_C/(R*T) + lambda_O/(R*T) = 0\n", + "\t\t\t# -1.46 + math.log(n_4/n) + 2*lambda_H/(R*T) = 0\n", + "\t\t\t# -56.68 + math.log(n_5/n) + lambda_C/(R*T) + 2*lambda_O/(R*T) = 0\n", + "\n", + "\t\t\t# The constraint equations are\n", + "\t\t\t# n_1 + n_3 + n_5 = 1 \t\t\t# (moles of C in the reaction mixture = 1)\n", + "\t\t\t# 4*n_1 + 2*n_2 + 2*n_4 = 14 \t\t\t# (moles of H in the reaction mixture = 14)\n", + "\t\t\t# n_2 + n_3 + 2*n_5 = 5 \t\t\t# (moles of O in the raection mixture = 5)\n", + "\n", + "\t\t\t# The total moles are given by\n", + "\t\t\t# n = n_1 + n_2 + n_3 + n_4 + n_5\n", + "\n", + "def solution(x):\n", + " f = [0,0,0,0,0,0,0,0,0]\n", + " f[0]= -2.82 + math.log(x[0]/x[5]) + x[6] + 4*x[7];\n", + " f[1] = -29.73 + math.log(x[1]/x[5]) + 2*x[7] + x[8];\n", + " f[2] = -27.51 + math.log(x[2]/x[5]) + x[6] + x[8];\n", + " f[3] = -1.46 + math.log(x[3]/x[5]) + 2*x[7];\n", + " f[4] = -56.68 + math.log(x[4]/x[5]) + x[6] + 2*x[8];\n", + " f[5] = x[0] + x[2] +x[4] - 1;\n", + " f[6] = 4*x[0] + 2*x[1] + 2*x[3] - 14;\n", + " f[7] = x[1] + x[2] +2*x[4] - 5;\n", + " f[8] = x[0]+ x[1] + x[2] + x[3] + x[4] - x[5]; \n", + " return f\n", + "\n", + "\n", + "x = [0.01,3.5,0.2,3.0,0.5,5.0,2.0,1.0,25.0];\n", + "y = fsolve(solution,x)\n", + "\n", + "# Results\n", + "print \" n_1 = %f mol\"%(y[0]);\n", + "print \" n_2 = %f mol\"%(y[1]);\n", + "print \" n_3 = %f mol\"%(y[2]);\n", + "print \" n_4 = %f mol\"%(y[3]);\n", + "print \" n_5 = %f mol\"%(y[4]);\n", + "print \" n = %f mol\"%(y[5]);\n", + "print \" lambda_C/RT = %f\"%(y[6]);\n", + "print \" lambda_H/RT = %f\"%(y[7]);\n", + "print \" lambda_O/RT = %f\"%(y[8]);\n", + "\n", + "print \" The Lagrange multiplier values do not have any physical significance\";\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " n_1 = 0.091556 mol\n", + " n_2 = 3.442034 mol\n", + " n_3 = 0.258922 mol\n", + " n_4 = 3.374855 mol\n", + " n_5 = 0.649522 mol\n", + " n = 7.816888 mol\n", + " lambda_C/RT = 2.667225\n", + " lambda_H/RT = 1.149967\n", + " lambda_O/RT = 28.250290\n", + " The Lagrange multiplier values do not have any physical significance\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch18_1-checkpoint.ipynb b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch18_1-checkpoint.ipynb new file mode 100644 index 00000000..46865b0c --- /dev/null +++ b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch18_1-checkpoint.ipynb @@ -0,0 +1,595 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:32121f42f5b148741ef15da1993d191234c228c3ab7dcf05f69114fbe323a883" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 18 : Adiabatic Reaction Temperature" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 18.1 Page Number : 650" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "\n", + "# Variables\n", + "T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard reaction temperature\n", + "T_2 = 500;\t\t\t#[K] - Reaction temperature\n", + "P = 1;\t\t\t#[atm] - Pressure \n", + "\n", + "a_CO2 = 5.316;\n", + "a_O2 = 6.085;\n", + "a_N2 = 6.903;\n", + "a_H2O = 7.700;\n", + "a_C3H8 = -0.966;\n", + "b_CO2 = 1.4285*10**(-2);\n", + "b_O2 = 0.3631*10**(-2);\n", + "b_N2 = -0.03753*10**(-2);\n", + "b_H2O = 0.04594*10**(-2);\n", + "b_C3H8 = 7.279*10**(-2);\n", + "c_CO2 = -0.8362*10**(-5);\n", + "c_O2 = -0.1709*10**(-5);\n", + "c_N2 = 0.1930*10**(-5);\n", + "c_H2O = 0.2521*10**(-5);\n", + "c_C3H8 = -3.755*10**(-5);\n", + "d_CO2 = 1.784*10**(-9);\n", + "d_O2 = 0.3133*10**(-9);\n", + "d_N2 = -0.6861*10**(-9);\n", + "d_H2O = -0.8587*10**(-9);\n", + "d_C3H8 = 7.580*10**(-9);\n", + "\n", + "\t\t\t# The smath.tan(math.radiansard enthalpy of formation at 298.15 K is given by\n", + "delta_H_for_CO2 = -94.052;\t\t\t#[kcal/mol]\n", + "delta_H_for_C3H8 = -24.820;\t\t\t#[kcal/mol]\n", + "delta_H_for_H2O = -57.7979;\t\t\t#[kcal/mol]\n", + "\n", + "\t\t\t# The reaction with stoichiometric amount of air is\n", + "\t\t\t# C3H8 + 5(O2 + 3.7N2) - 3CO2 + 4H2O + 18.8N2\n", + "\n", + "\t\t\t# The reaction with 100% excess air is\n", + "\t\t\t# C3H8 + 10(O2 + 3.7N2) - 3CO2 + 4H2O + 5O2 + 37.6N2\n", + "\n", + "# Calculations\n", + "\t\t\t# The smath.tan(math.radiansard enthalpy change of reaction at 298.15 K\n", + "delta_H_rkn_298 = 3*delta_H_for_CO2 + 4*delta_H_for_H2O - delta_H_for_C3H8;\n", + "\n", + "\t\t\t# For exit stream\n", + "sum_ai_ni = 3*a_CO2 + 4*a_H2O + 5*a_O2 + 37.6*a_N2;\n", + "sum_bi_ni = 3*b_CO2 + 4*b_H2O + 5*b_O2 + 37.6*b_N2;\n", + "sum_ci_ni = 3*c_CO2 + 4*c_H2O + 5*c_O2 + 37.6*c_N2;\n", + "sum_di_ni = 3*d_CO2 + 4*d_H2O + 5*d_O2 + 37.6*d_N2;\n", + "\n", + "\n", + "\t\t\t# To raise the exit species from 298.15 to 500 K the enthalpy change is\n", + "\n", + "def f1(T): \n", + "\t return sum_ai_ni+sum_bi_ni*T+sum_ci_ni*T**(2)+sum_di_ni*T**(3)\n", + "\n", + "delta_H_rkn = quad(f1,T_1,T_2)[0]\n", + "\n", + "delta_H_rkn = delta_H_rkn*10**(-3);\t\t\t#[kcal]\n", + "\n", + "\t\t\t# Therefore per mole of fuel the heat exchange is\n", + "\t\t\t# Q = Heat exchange in step 1 + Heat exchange in step 2\n", + "Q = delta_H_rkn_298 + delta_H_rkn;\n", + "\n", + "# Results\n", + "print \" The heat transfer from the combustion chamber per mole of fuel is %f kcal (per mol of C3H8)\"%(Q);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The heat transfer from the combustion chamber per mole of fuel is -415.328732 kcal (per mol of C3H8)\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 18.2 Page Number : 650" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "from scipy.optimize import fsolve \n", + "\n", + "# Variables\n", + "T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard reaction temperature\n", + "\n", + "a_CO2 = 5.316;\n", + "a_H2O = 7.700;\n", + "a_O2 = 6.085;\n", + "a_C2H6 = 1.648;\n", + "b_CO2 = 1.4285*10**(-2);\n", + "b_H2O = 0.04595*10**(-2);\n", + "b_O2 = 0.3631*10**(-2);\n", + "b_C2H6 = 4.124*10**(-2);\n", + "c_CO2 = -0.8362*10**(-5);\n", + "c_H2O = 0.2521*10**(-5);\n", + "c_O2 = -0.1709*10**(-5);\n", + "c_C2H6 = -1.530*10**(-5);\n", + "d_CO2 = 1.784*10**(-9);\n", + "d_H2O = -0.8587*10**(-9);\n", + "d_O2 = 0.3133*10**(-9);\n", + "d_C2H6 = 1.740*10**(-9);\n", + "\n", + "\t\t\t# The smath.tan(math.radiansard enthalpy of formation at 298.15 K is given by\n", + "delta_H_for_CO2 = -94.052;\t\t\t#[kcal/mol]\n", + "delta_H_for_C2H6 = -20.236;\t\t\t#[kcal/mol]\n", + "delta_H_for_H2O = -57.7979;\t\t\t#[kcal/mol]\n", + "\n", + "# Calculations\t\t\n", + " \t# The reaction with stoichiometric amount of air is\n", + "\t\t\t# C2H6 + (7/2)O2 - 2CO2 + 3H2O\n", + "\n", + "\t\t\t# The reaction with 4 mol of O2 and 10 mol CO2 is\n", + "\t\t\t# C2H6 + 4O2 + 10CO2 - 12H2O + 3H2O + 0.5O2\n", + "\t\t\t# The product consists of 12 mol of CO2, 3 mol of water vapour and 0.5 mol of oxygen\n", + "delta_H_rkn_298 = 2*delta_H_for_CO2 + 3*delta_H_for_H2O - delta_H_for_C2H6;\t\t\t#[kcal]\n", + "delta_H_rkn_298 = delta_H_rkn_298*10**(3);\t\t\t#[cal]\n", + "\n", + "\t\t\t# For exit stream\n", + "sum_ai_ni = 12*a_CO2 + 3*a_H2O + 0.5*a_O2;\n", + "sum_bi_ni = 12*b_CO2 + 3*b_H2O + 0.5*b_O2;\n", + "sum_ci_ni = 12*c_CO2 + 3*c_H2O + 0.5*c_O2;\n", + "sum_di_ni = 12*d_CO2 + 3*d_H2O + 0.5*d_O2;\n", + "\n", + "\t\t\t# From energy balance equation we get\n", + "\t\t\t# delta_H_rkn_298 + sum_ai_ni*(T_2 - T_1) + (sum_bi_ni/2)*(T_2**(2) - T_1**(2)) + (sum_ci_ni/3)*(T_2**(3) - T_1**(3)) + (sum_di_ni/4)*(T_2**(4) - T_1**(4))\n", + "\t\t\t# Solving above equation for T_2\n", + "def f(T_2): \n", + "\t return delta_H_rkn_298 +sum_ai_ni*(T_2-T_1)+(sum_bi_ni/2)*(T_2**(2)-T_1**(2))+(sum_ci_ni/3)*(T_2**(3)-T_1**(3))+(sum_di_ni/4)*(T_2**(4)-T_1**(4))\n", + "T_2 = fsolve(f,-1)\n", + "\n", + "# Results\n", + "print \" The adiabatic flame temperature is %f K\"%(T_2);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The adiabatic flame temperature is 2090.385277 K\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 18.3 Page Number : 651" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard reaction temperature\n", + "\n", + "\t\t\t# The reaction with theoritical air is\n", + "\t\t\t# CH4 + 2(O2 + 3.76N2) - CO2 + 2H20 + 7.52N2\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#(1)\n", + "n_product = (1 + 2 + 7.52);\t\t\t# Total number of moles of product\n", + "\t\t\t# The mole fraction of water vapour is\n", + "y_H2O = 2/(n_product);\n", + "print \" 1).The mole fraction of water vapour is %f\"%(y_H2O);\n", + "\n", + "\t\t\t#(2)\n", + "delta_H_rkn_298 = -730*10**(3);\t\t\t#[J/mol]\n", + "C = 40;\t\t\t#[J/mol-K] - Average molar heat capacity\n", + "\n", + "\t\t\t# From energy balance we have\n", + "\t\t\t# delta_H_rkn_298 + n_product*C(T_2 - T_1) = 0\n", + "T_2 = - delta_H_rkn_298/(n_product*C) + T_1;\t\t\t#[K]\n", + "T_max = T_2 - T_1;\n", + "\n", + "print \" 2).The maximum temperature rise of the exhaust gases is %f K\"%(T_max);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The mole fraction of water vapour is 0.190114\n", + " 2).The maximum temperature rise of the exhaust gases is 1734.790875 K\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 18.4 Page Number : 651" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "from scipy.optimize import fsolve \n", + "\n", + "\n", + "# Variables\n", + "T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard reaction temperature\n", + "\n", + "\t\t\t# The smath.tan(math.radiansard enthalpy of formation at 298.15 K is given by\n", + "delta_H_for_CO2 = -94.052;\t\t\t#[kcal/mol]\n", + "delta_H_for_C8H18 = -59.780;\t\t\t#[kcal/mol]\n", + "delta_H_for_H2O = -57.7979;\t\t\t#[kcal/mol]\n", + "\n", + "a_CO2 = 5.316;\n", + "a_H2O = 7.700;\n", + "a_N2 = 6.903;\n", + "b_CO2 = 1.4285*10**(-2);\n", + "b_H2O = 0.04595*10**(-2);\n", + "b_N2 = -0.03753*10**(-2);\n", + "c_CO2 = -0.8362*10**(-5);\n", + "c_H2O = 0.2521*10**(-5);\n", + "c_N2 = 0.1930*10**(-5);\n", + "d_CO2 = 1.784*10**(-9);\n", + "d_H2O = -0.8587*10**(-9);\n", + "d_N2 = -0.6861*10**(-9);\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#(a)\n", + "\t\t\t# The reaction with stoichiometric amount of air is\n", + "\t\t\t# C3H18 + 12.5(O2 + 3.76N2) - 8CO2 + 9H2O + 47N2\n", + "\n", + "\t\t\t# The smath.tan(math.radiansard enthalpy change of reaction at 298.15 K is\n", + "delta_H_rkn_298 = 8*delta_H_for_CO2 + 9*delta_H_for_H2O - delta_H_for_C8H18;\t\t\t#[kcal]\n", + "delta_H_rkn_298 = delta_H_rkn_298*10**(3);\t\t\t#[cal]\n", + "\n", + "\t\t\t# For exit stream\n", + "sum_ai_ni = 8*a_CO2 + 9*a_H2O + 47*a_N2;\n", + "sum_bi_ni = 8*b_CO2 + 9*b_H2O + 47*b_N2;\n", + "sum_ci_ni = 8*c_CO2 + 9*c_H2O + 47*c_N2;\n", + "sum_di_ni = 8*d_CO2 + 9*d_H2O + 47*d_N2;\n", + "\n", + "\t\t\t# From energy balance equation we get\n", + "\t\t\t# delta_H_rkn_298 + sum_ai_ni*(T_2 - T_1) + (sum_bi_ni/2)*(T_2**(2) - T_1**(2)) + (sum_ci_ni/3)*(T_2**(3) - T_1**(3)) + (sum_di_ni/4)*(T_2**(4) - T_1**(4))\n", + "\t\t\t# Solving above equation for T_2\n", + "def f(T_2): \n", + "\t return delta_H_rkn_298 +sum_ai_ni*(T_2-T_1)+(sum_bi_ni/2)*(T_2**(2)-T_1**(2))+(sum_ci_ni/3)*(T_2**(3)-T_1**(3))+(sum_di_ni/4)*(T_2**(4)-T_1**(4))\n", + "T_2 = fsolve(f,-1)\n", + "\n", + "print \" 1).The adiabatic flame temperature is %f K\"%(T_2);\n", + "\n", + "\t\t\t#(2)\n", + "\t\t\t# The mean smath.tan(math.radiansard heat capacity of various components over the temperature range from 25 to 3000 C is \n", + "Cp_CO2 = 13.91;\t\t\t#[cal/mol-K]\n", + "Cp_H2O = 10.16;\t\t\t#[cal/mol-K]\n", + "Cp_O2 = 7.88;\t\t\t#[cal/mol-K]\n", + "Cp_N2 = 7.45;\t\t\t#[cal/mol-K]\n", + "\n", + "\t\t\t# From energy balance equation we get\n", + "\t\t\t# delta_H_rkn_298 + (8*Cp_CO2 + 9*Cp_H2O + 47*Cp_N2)*(T_2_prime)\n", + "T_2_prime = - delta_H_rkn_298/(8*Cp_CO2 + 9*Cp_H2O + 47*Cp_N2);\t\t\t#[K]\n", + "print \" 2).The adiabatic flame temperature is %f K\"%(T_2_prime);\n", + "\n", + "# The answer is correct. Please calculate it manually. Wrong answer is given in book." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The adiabatic flame temperature is 2415.861178 K\n", + " 2).The adiabatic flame temperature is 2193.675005 K\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 18.5 Page Number : 652" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "\t\t\t# N2 + 3H2 - 2NH3\n", + "T_1 = 700;\t\t\t#[K] - Reaction temperature\n", + "Max_adia_rise = 100;\t\t\t#/[K] - Maximum adiabatic rise in temperature\n", + "T_2 = T_1 + Max_adia_rise;\t\t\t#[K] - \n", + "\n", + "delta_H_rkn_700 = -94.2;\t\t\t#[kJ] - Smath.tan(math.radiansard enthalpy of reaction at 700 K\n", + "delta_H_rkn_700 = delta_H_rkn_700*10**(3);\t\t\t#[J]\n", + "\n", + "\t\t\t# The mean smath.tan(math.radiansard heat capacity of various components over the temperature range from 700 to 800 K is \n", + "Cp_N2 = 30.0;\t\t\t#[cal/mol-K]\n", + "Cp_H2 = 28.9;\t\t\t#[cal/mol-K]\n", + "Cp_NH3 = 49.2;\t\t\t#[cal/mol-K]\n", + "\n", + "# Calculations\t\t\t\n", + " # The energy balance equation is\n", + "\n", + "def f46(T): \n", + "\t return (sum_ni_Cpi_exit)*dT\n", + "\n", + "\t\t\t# X*delta_H_rkn_700 + quad(f46,T_1,T_2)[0]\n", + "\n", + "\n", + "\t\t\t#At exit, let moles of NH3 = (1-X), moles of H2 = (3-3X), moles of NH3 = 2X . Therefore we have,\n", + "\t\t\t# delta_H_rkn_700*X + {(1-X)*Cp_N2 + (3-3X)*Cp_H2 + (2X)*Cp_NH3}*(T_2 - T_1)\n", + "\t\t\t# On simplification we get, 960.3*X = 116.7\n", + "X = 116.7/960.3;\n", + "\n", + "# Results\n", + "print \" The maximum allowable conversion fraction in the reactor is given by X = %f \"%(X);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The maximum allowable conversion fraction in the reactor is given by X = 0.121525 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 18.6 Page Number : 653" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "from scipy.optimize import fsolve \n", + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "\n", + "# Variables\n", + "T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard reaction temperature\n", + "V = 2.0*10**(-3);\t\t\t#[m**(3)] - Volume of calorimeter\n", + "m = 10.;\t\t\t#[g] - Mass of liquid octane\n", + "Mol_wt = 114.;\t\t\t#[g/mol] - Molecular weight of octane\n", + "n = m/Mol_wt;\t\t\t#[mol] - No of moles of octane\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "\t\t\t# The smath.tan(math.radiansard enthalpy of formation at 298.15 K is given by\n", + "delta_H_for_CO2 = -94.052;\t\t\t#[kcal/mol]\n", + "delta_H_for_C8H18 = -59.780;\t\t\t#[kcal/mol]\n", + "delta_H_for_H2O = -57.7979;\t\t\t#[kcal/mol]\n", + "\n", + "\t\t\t# The smath.tan(math.radiansard molar heat capacity of various components in high temperature range from is given by \n", + "\t\t\t# Cp_H2O = 6.970 + 0.3464*10**(-2)*T - 0.04833*10**(-5)*T**(2);\n", + "\t\t\t# Cp_O2 = 6.732 + 0.1505*10**(-2)*T - 0.01791*10**(-5)*T**(2);\n", + "\t\t\t# Cp_CO2 = 18.036 - 4.474*10**(-5)*T - 158.08/(T**(1/2));\n", + "\t\t\t# Therefore we have\n", + "\t\t\t# Sum_ni_Cpi_exit = 249.09 + 0.04*T - 0.547*10**(-5)*T**(2) - 1264.64/(T**(1/2))\n", + "\n", + "\t\t\t# The reaction with stoichiometric amount of oxygen is\n", + "\t\t\t# C8H18 + 12.5O2 - 8CO2 + 9H2O\n", + "\n", + "\t\t\t# The reaction with 50% excess oxygen is\n", + "\t\t\t# C8H18 + 18.75O2 - 8CO2 +9H2O + 6.25O2\n", + "\n", + "# Calculations\n", + "\t\t\t# The smath.tan(math.radiansard enthalpy change of reaction at 298.15 K is\n", + "delta_H_rkn_298 = 8*delta_H_for_CO2 + 9*delta_H_for_H2O - delta_H_for_C8H18;\t\t\t#[kcal]\n", + "delta_H_rkn_298 = delta_H_rkn_298*10**(3);\t\t\t#[cal]\n", + "\n", + "\t\t\t# From the energy balance equation we get\n", + "\n", + "def f10(T): \n", + "\t return (sum_ni_Cpi_exit)*dT\n", + "\n", + "\t\t\t# delta_H_rkn_298 + quad(f10,T_1,T_2)[0]\n", + "\n", + "\t\t\t# delta_H_rkn_298 + 249.09*(T_2 - T_1) + (0.04/2)*(T_2**(2) - T_1**(2)) - ((0.547*10**(-5))/3)*(T_2**(3)-T_1**(3)) - (1264.64*2)*(T_2**(1/2)-T_1**(1/2))\n", + "\t\t\t# Solving above equation for T_2\n", + "def f(T_2): \n", + "\t return delta_H_rkn_298 + 249.09*(T_2 - T_1) + (0.04/2)*(T_2**(2)-T_1**(2)) - ((0.547*10**(-5))/3)*(T_2**(3)-T_1**(3)) - (1264.64*2)*(T_2**(1./2)-T_1**(1./2))\n", + "T_2 = fsolve(f,1000)\n", + "\n", + "\t\t\t# When 1 mol of octane reacts the final number of moles in the calorimeter is 23.25\n", + "\t\t\t# When n mol of octane reacts the final number of moles in the calorimeter is\n", + "n_total = n*23.25;\t\t\t#[mol]\n", + "\n", + "\t\t\t# The maximum explosion pressure is calculated when no heat is dissipated to the surroundings and thus bomb calorimeter attains the adiabatic flame temperature\n", + "\t\t\t# Thus maximum explosion pressure is given by\n", + "P = (n_total*R*T_2)/V;\t\t\t#[N/m**(2)]\n", + "P = P*10**(-5);\t\t\t#[bar]\n", + "\n", + "# Results\n", + "print \" The maximum explosion pressure inside the bomb calorimeter is %f bar\"%(P);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The maximum explosion pressure inside the bomb calorimeter is 397.138166 bar\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 18.7 Page Number : 656" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from scipy.optimize import fsolve\n", + "import math\n", + " \n", + "\n", + "# Variables\n", + "T_1 = 400 + 273.15;\t\t\t#[K]\n", + "\t\t\t# SO2(g) + 1./2*(O2) (g) - SO3 (g)\n", + "\n", + "a_SO2 = 6.157;\n", + "a_SO3 = 3.918;\n", + "a_O2 = 6.085;\n", + "a_N2 = 6.903;\n", + "b_SO2 = 1.384*10**(-2);\n", + "b_SO3 = 3.483*10**(-2);\n", + "b_O2 = 0.3631*10**(-2);\n", + "b_N2 = -0.03753*10**(-2);\n", + "c_SO2 = -0.9103*10**(-5);\n", + "c_SO3 = -2.675*10**(-5);\n", + "c_O2 = -0.01709*10**(-5);\n", + "c_N2 = 0.1930;\n", + "d_SO2 = 2.057*10**(-9);\n", + "d_SO3 = 7.744*10**(-9);\n", + "d_O2 = 0.3133*10**(-9);\n", + "d_N2 = -0.6861*10**(-9);\n", + "\n", + "# Calculations\n", + "\t\t\t# At 400 C, from the given math.expressions\n", + "delta_H_rkn_T_1 = -22630.14 - 5.2815*T_1 + 0.9587*10**(-2)*T_1**(2) - 0.5598*10**(-5)*T_1**(3) + 1.3826*10**(-9)*T_1**(4);\t\t\t#[cal]\n", + "\t\t\t# This is the smath.tan(math.radiansard enthalpy change of reaction for 1 mol of SO2 reacted. Since X moles of SO2 are reactants therefore \n", + "\t\t\t# delta_H_rkn_T_X (for X moles of SO2 reacted) = delta_H_rkn_T_1*X\n", + "\n", + "\t\t\t# Let the number of moles at equilibrium be\n", + "\t\t\t# n_O2 = 9-0.5*X\n", + "\t\t\t# n_SO2 = 12-X\n", + "\t\t\t# n_SO3 = X\n", + "\t\t\t# n_N2 = 79\n", + "\t\t\t# Total moles at equilibrium = 100-0.5X\n", + "\t\t\t# Ky = y_SO3/(y_SO2*y_O2**(1./2))\n", + "\t\t\t# Ky = (X*(100-0.5*X)**(1./2))/((12-X)*(9-0.5*X)**(1./2))\n", + "\t\t\t# We know that K = Ky*Kp. Since P = 1 atm, therefore Ky = K\n", + "\n", + "\t\t\t# Now we have to account for the heat required to raise 9-0.5*X mol of O2, 12-X mol of SO2, X mol of SO3 and 79 mol of N2 from T to ART\n", + "\t\t\t# sum_ni_Cp_i = (12-X)*(a + b*T + c*T**(2) + d*T**(3)) + (9-0.5*X)*(a + b*T + c*T**(2) + d*T**(3)) + X*(a + b*T + c*T**(2) + d*T**(3)) + 79*(a + b*T + c*T** (2) + d*T**(3))\n", + "\n", + "\t\t\t# From energy balance equation we get\n", + "\n", + "def f19(T): \n", + "\t return sum_ni_Cp_i\n", + "\n", + "\t\t\t# delta_H_rkn_T_1 + quad(f19,T_1,T)[0]\n", + "\n", + "\t\t\t# The above equation on simplification becomes\n", + "\t\t\t# (673.99-5.2815*X)*(T-T_1) + (16.91+1.9175*X)*(10**(-2)/2)*(T**(2)-T_1**(2)) + (2.79-1.6793*X)*(10**(-5)/3)*(T**(3)-T_1**(3)) + (-26.70+5.5304*X)*(10**(-9) /4)*(T**(4)-T_1**(4)) = delta_H_rkn_T_1*X\n", + "\n", + "\t\t\t# Let us assume a temperature, say\n", + "T = 800;\t\t\t#[K]\n", + "fault = 10;\n", + "def f(X): \n", + "\t return K - (X*(100-0.5*X)**(1./2))/((12-X)*(9-0.5*X)**(1./2))\n", + "\n", + "def f1(X): \n", + "\t return (673.99-5.2815*X)*(T-T_1)+(16.91+1.9175*X)*(10**(-2)/2)*(T**(2)-T_1**(2))+(2.79-1.6793*X)*(10**(-5)/3)*(T**(3)-T_1**(3))+(-26.70+5.5304*X)*(10**(-9)/4)*(T**(4)-T_1**(4))+delta_H_rkn_T_1*X\n", + "\n", + "while(fault>0.01):\n", + " K = math.exp(3.87 + (11389.10/T) - 2.6580*math.log(T) + 0.4825*10**(-2)*T - 0.1409*10**(-5)*T**(2) + 0.2320*10**(-9)*T**(3));\n", + " X1 = fsolve(f,0.1)\n", + " X2 = fsolve(f1,1)\n", + " fault = abs(X1-X2);\n", + " T = T + 0.01;\n", + "\n", + "# Results\n", + "print \" The moles of SO2 reacted are %f mol\"%(X1);\n", + "print \" The adiabatic reaction temperature is %f K\"%(T);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The moles of SO2 reacted are 7.594592 mol\n", + " The adiabatic reaction temperature is 886.860000 K\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch1_2-checkpoint.ipynb b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch1_2-checkpoint.ipynb new file mode 100644 index 00000000..b7e6716d --- /dev/null +++ b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch1_2-checkpoint.ipynb @@ -0,0 +1,774 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:05ef5db2afef7232054abda0278780d1df8c92b807546fcd7648e8885fa4539f" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 1 : Introduction" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 1.1 Page number - 6" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# \n", + "# Variables\n", + "#(a)\n", + " \n", + "m = 50.;\t\t\t#[kg] - Mass of piston\n", + "A = 0.05;\t\t\t#[m**(2)] - Area of piston\n", + "g = 9.81;\t\t\t#[m/s**(2)] - Acceleration due to gravity\n", + "Po = 101325;\t\t\t#[N/m**(2)] - Atmospheric pressure\n", + "\n", + "# Calculations and Results\n", + "P = (m*g/A)+Po;\t\t\t#[N/m**(2)]\n", + "P = P/100000.;\t\t\t#[bar]\n", + "print \" (a).Pressure = %f bar\"%P\n", + "\n", + "#(b)\n", + "print \" (b).Since the piston weight and surroundings pressure are the same, \\\n", + "the gas pressure in the piston-cylinder assembly remains %f bar\"%P\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " (a).Pressure = 1.111350 bar\n", + " (b).Since the piston weight and surroundings pressure are the same, the gas pressure in the piston-cylinder assembly remains 1.111350 bar\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 1.2 Page number - 8\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "# Variables\n", + "P = 1.;\t\t\t#[atm] - Atmospheric pressure\n", + "P = 101325.;\t\t\t#[N/m**(2)]\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "T = 30.;\t\t\t#[C] - Temperature of air\n", + "T = 30.+273.15;\t\t\t#[K]\n", + "V = 5.*5*5;\t\t\t#[m**(3)] - Volume of the room\n", + "\n", + "# Calculations\n", + "#The number of moles of air is given by\n", + "n = (P*V)/(R*T)\t\t\t#[mol]\n", + "\n", + "#Molecular weight of air(21 vol% O2 and 79 vol% N2)=(0.21*32)+(0.79*28)= 28.84 g/mol\n", + "m = n*28.84;\t\t\t#[g]\n", + "m = m/1000.;\t\t\t#[kg]\n", + "\n", + "# Results\n", + "print \"The mass of air is, m = %f kg\"%m\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The mass of air is, m = 144.928664 kg\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 1.3 Page number - 13\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "# Variables\n", + "P1 = 3.;\t\t\t# [bar] - initial pressure\n", + "V1 = 0.5;\t\t\t# [m**(3)] - initial volume\n", + "V2 = 1.0;\t\t\t# [m**(3)] - final volume\n", + "import math\n", + "#(a)\n", + "n = 1.5;\n", + "\n", + "# Calculations and Results\n", + "#Let P*V**(n)=C \t\t\t# Variables relation\n", + "#W (work done per mole)= (integrate('P'%'V'%V1%V2))\n", + "#W = (integrate('(C/V**(n))'%'V'%V1%V2)) = (C*((V2***(1-n))-(V1***(1-n))))/(1-n)\n", + "#Where C=P*V**(n)=P1*V1**(n)=P2*V2**(n)\n", + "#Thus w=((P2*V2**(n)*V2**(1-n))-(P1*V1**(n)*V1**(1-n)))/(1-n)\n", + "#w = ((P2*V2**(n))-(P1*V1**(n)))/(1-n)\n", + "#and thus W=((P2*V2)-(P1*V1))/(1-n)\n", + "#The above math.expression is valid for all values of n%except n=1.0\n", + "P2 = (P1*((V1/V2)**(n)))\t\t\t#[bar] \t\t\t#pressure at state 2\n", + "\n", + "#we have%(V1/V2)=(V1t/(V2t)%since the number of moles are constant.Thus\n", + "W = ((P2*V2)-(P1*V1))/(1-n)*10**(5)\t\t\t#[J]\n", + "W = W/1000.;\t\t\t#[kJ]\n", + "print \" (a).The work done (for n=1.5) is %f kJ\"%W\n", + "\n", + "#(b)\n", + "#For n=1.0%we have% PV=C.\n", + "# w(wok done per mol)= (integrate('P'%'V'%V1%V2)) = (integrate('C/V'%'V'%V1%V2)) = C*ln(V2/V1)=P1*V1*ln(V2/V1)\n", + "W1 = P1*V1*math.log(V2/V1)*10**(5)\t\t\t#[J]\n", + "W1 = W1/1000.;\t\t\t#[kJ]\n", + "print \" (b).The work done (for n=1.0) is %f kJ\"%W1\n", + "\n", + "#(c)\n", + "#For n=0%we get P=Constant and thus\n", + "P = P1;\t\t\t#[bar]\n", + "# w =(integrate('P'%'V'%V1%V2)) = P*(V2-V1)\n", + "W2 = P*(V2-V1)*10**(5)\t\t\t#[J]\n", + "W2 = W2/1000.;\t\t\t#[kJ]\n", + "print \" (c).The work done (for n=0) is %f kJ\"%W2\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " (a).The work done (for n=1.5) is 87.867966 kJ\n", + " (b).The work done (for n=1.0) is 103.972077 kJ\n", + " (c).The work done (for n=0) is 150.000000 kJ\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 1.4 Page number - 17\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "# Variables\n", + "#(a)\n", + "# Variables\n", + "V = 9.;\t\t\t# [m/s] - velocity\n", + "d = 1.;\t\t\t#[m] - diameter\n", + "A = 3.14*(d/2)**(2)\t\t\t#[m**(2)] - area\n", + "P = 1.;\t\t\t#[atm] - pressure\n", + "P = 101325.;\t\t\t# [N/m**(2)]\n", + "T = 300.;\t\t\t#[K] - Temperature\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "# Calculations and Results\n", + "E = (V**(2))/2.;\t\t\t#[J/kg]\n", + "print \" (a).The wind energy per unit mass of air is %f J/kg\"%E\n", + "\n", + "#(b)\n", + "# Molecular weight of air(21 vol% O2 and 79 vol% N2)=(0.21*32)+(0.79*28)= 28.84 g/mol\n", + "M = 28.84*10**(-3)\t\t\t#[kg/mol]\n", + "r = (P*M)/(R*T)\t\t\t#[kg/m**(3)] - density\n", + "m = r*V*A;\t\t\t# [kg/s] - mass flow rate of air\n", + "pi = m*E;\t\t\t#[Watt] - power input\n", + "print \" (b).The wind power input to the turbine is %f Watt\"%pi\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " (a).The wind energy per unit mass of air is 40.500000 J/kg\n", + " (b).The wind power input to the turbine is 335.233787 Watt\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 1.5 Page number - 23\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Given\n", + "P = 1.;\t\t\t # [bar] - atospheric pressure\n", + "P1guz = 0.75;\t\t\t# [bar] - gauze pressure in 1st evaporator\n", + "P2Vguz = 0.25;\t\t\t# [bar] - vaccum gauze pressure in 2nd evaporator\n", + "\n", + "# Calculations\n", + "P1abs = P + P1guz;\t\t\t# [bar] - absolute pressure in 1st evaporator\n", + "P2abs = P - P2Vguz;\t\t\t# [bar] -absolute pressure in 2nd evaporator\n", + "\n", + "# Results\n", + "#From saturated steam table as reported in the book\n", + "print \" For P1abs (absolute pressure) = %f bar\"%P1abs\n", + "print \" The saturation temperature in first evaporator is 116.04 C\"\n", + "print \" For P2abs (absolute pressure) = %f bar\"%P2abs\n", + "print \" The saturation temperature in second evaporator is 91.76 C\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " For P1abs (absolute pressure) = 1.750000 bar\n", + " The saturation temperature in first evaporator is 116.04 C\n", + " For P2abs (absolute pressure) = 0.750000 bar\n", + " The saturation temperature in second evaporator is 91.76 C\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 1.6 Page number - 23\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "V = 1.;\t\t\t # [kg] - volume of tank\n", + "P = 10.;\t\t\t# [bar] - pressure\n", + "\n", + "#Here degree of freedom =1(C=1%P=2%threfore F=1)\n", + "#From steam table at 10 bar as reported in the book\n", + "V_liq = 0.001127;\t\t\t# [m**(3)/kg] - volume in liquid phase\n", + "V_vap = 0.19444;\t\t\t# [m**(3)/kg] - volume in vapour phase\n", + "\n", + "# Calculations\n", + "#x*Vv=(1-x)*Vl \t\t\t# since two volumes are equal\n", + "x = (V_liq/(V_liq+V_vap))\t\t\t# [kg]\n", + "y = (1-x)\t\t\t#[kg]\n", + "\n", + "# Results\n", + "print \" Mass of saturated vapour is %f kg\"%x\n", + "print \" Mass of saturated liquid is %f kg\"%y\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Mass of saturated vapour is 0.005763 kg\n", + " Mass of saturated liquid is 0.994237 kg\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 1.7 Page number - 23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "V = 1.;\t\t\t# [m**(3)] - volume of tank\n", + "M = 10.;\t\t\t# [m**(3)] - total mass\n", + "T = (90+273.15)\t\t\t#[K] - temperature\n", + "\n", + "#From steam table at 90 C as reported in the book\n", + "#vapour pressure(pressure of rigid tank) = 70.14[kPa] = 0.7014[bar]\n", + "print \" Pressure of tank = 0.7014 bar\"\n", + "\n", + "# Calculations and Results\n", + "V_liq_sat=0.001036;\t\t\t# [m**(3)/kg] - saturated liquid specific volume\n", + "V_vap_sat=2.36056;\t\t\t# [m**(3)/kg] - saturated vapour specific volume\n", + "\n", + "#1=(V_liq_sat*(10-x))+(V_vap_sat*x)\n", + "x = (1-(10*V_liq_sat))/(V_vap_sat-V_liq_sat)\t\t\t#[kg]\n", + "y = (10-x)\t\t\t#[kg]\n", + "\n", + "print \" The amount of saturated liquid is %f kg\"%y\n", + "print \" The amount of saturated vapour is %f kg \"%x\n", + "\n", + "z = y*V_liq_sat;\t\t\t#[m**(3)] - Volume of saturated liquid \n", + "w = x*V_vap_sat;\t\t\t#[m**(3)] - Volume of saturated vapour\n", + "\n", + "print \" Total volume of saturated liquid is %f m**(3)\"%z\n", + "print \" Total volume of saturated vapour is %f m**(3)\"%w\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Pressure of tank = 0.7014 bar\n", + " The amount of saturated liquid is 9.580576 kg\n", + " The amount of saturated vapour is 0.419424 kg \n", + " Total volume of saturated liquid is 0.009925 m**(3)\n", + " Total volume of saturated vapour is 0.990075 m**(3)\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 1.8 Page number - 24" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "V = 10.;\t\t\t# [m**(3)] - volume of vessel\n", + "P_1 = 1.;\t\t\t# [bar] - initial pressure\n", + "V_liq_sat = 0.05;\t\t\t# [m**(3)] - saturated liquid volume\n", + "V_gas_sat = 9.95;\t\t\t# [m**(3)] - saturated vapour volume\n", + "\n", + "#At 1 bar pressure\n", + "V_liq_1 = 0.001043;\t\t\t# [m**(3/kg)] - specific saturated liquid volume\n", + "U_liq_1 = 417.33;\t\t\t# [kJ/kg] - specific internal energy\n", + "V_gas_1 = 1.69400;\t\t\t# [m**(3/kg)] - specific saturated vapour volume\n", + "U_gas_1 = 2506.06;\t\t\t# [kJ/kg]\n", + "\n", + "# Calculations\n", + "M_liq_1 = V_liq_sat/V_liq_1;\t\t\t# [kg] - mass of saturated liqid\n", + "M_gas_1 = V_gas_sat/V_gas_1;\t\t\t# [kg] - mass of saturated vapour\n", + "M = (M_liq_1+M_gas_1)\t\t\t# [kg] - total mass\n", + "U_1t = (M_liq_1*U_liq_1)+(M_gas_1*U_gas_1)\t\t\t# [kJ] - initial internal energy\n", + "V_gas_2 = (V/M)\t\t\t#[m**(3/kg)]\n", + "\n", + "#from steam table at 10 bar pressure as reported in the book\n", + "V_vap_2 = 0.19444;\t\t\t# [m**(3/kg)]\n", + "U_vap_2 = 2583.64;\t\t\t# [kJ/kg]\n", + "\n", + "#from steam table at 11 bar pressure as reported in the book\n", + "V_vap_3 = 0.17753;\t\t\t#[m**(3/kg)]\n", + "U_vap_3 = 2586.40;\t\t\t#[kJ/kg]\n", + "\n", + "#Now computing pressure when molar volume of saturated vapour=Vg_2\n", + "#By interpolation (P2-10)/(11-10)=(Vg_2-Vv_2)/(Vv_3-Vv_2)\n", + "P_2 = (((V_gas_2 - V_vap_2)/(V_vap_3 - V_vap_2)*1)+10)\t\t\t# [bar] - final pressure\n", + "\n", + "#By interpolation calculating internal energy at state 2\n", + "#(P2-10)/(11-10)=(U2-Uv_2)/(Uv_3-Uv_2)\n", + "U_2 = (((P_2-10)/(11-10))*(U_vap_3 - U_vap_2))+U_vap_2;\t\t\t#[kJ/kg]\n", + "U_2t = U_2*M;\t\t\t#[kJ]\n", + "H = U_2t - U_1t;\t\t\t#[kJ] - Heat supplied\n", + "H = H/1000;\t\t\t#[MJ]\n", + "\n", + "# Results\n", + "print \" Total heat supplied is %f MJ\"%H\n", + "# since volume is constant%no work is done by the system and heat supplied is used in increasing the internal energy of the system.\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total heat supplied is 104.381244 MJ\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 1.9 Page number - 26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "#Antoine equation for water ln(Psat)=16.262-(3799.89/(T_sat + 226.35))\n", + "P = 2.;\t\t\t#[atm] - Pressure\n", + "P = (2.*101325)/1000;\t\t\t#[kPa]\n", + "\n", + "# Calculations\n", + "P_sat = P;\t\t\t# Saturation pressure\n", + "T_sat = (3799.89/(16.262-math.log(P_sat)))-226.35;\t\t\t#[C] - Saturation temperature\n", + "#Thus boiling at 2 atm occurs at Tsat = 120.66 C.\n", + "\n", + "#From steam tables%at 2 bar%Tsat = 120.23 C and at 2.25 bar%Tsat = 124.0 C\n", + "#From interpolation for T_sat = 120.66 C%P = 2.0265 bar\n", + "#For P_= 2.0265 bar%T_sat% from steam table by interpolation is given by\n", + "#((2.0265-2)/(2.25-2))=((Tsat-120.23)/(124.0-120.23))\n", + "T_sat_0 = (((2.0265-2)/(2.25-2))*(124.0-120.23))+120.23;\t\t\t#[C]\n", + "\n", + "# Results\n", + "print \" Saturation temperature (Tsat) = %f C which is close \\\n", + "to %f C as determined from Antoine equation\"%(T_sat_0,T_sat)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Saturation temperature (Tsat) = 120.629620 C which is close to 120.655450 C as determined from Antoine equation\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 1.10 Page number - 27" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "# math.log(P)=-(1640/T)+10.56 (solid)\n", + "# math.log(P)=-(1159/T)+7.769 (liquid)%where T is in K\n", + "# F+P=C+2% at triple point F+3=1+2 or%F=0 i.e%vapour pressure of liquid and solid at triple point are same%we get\n", + "# -(1640/T)+10.56 = -(1159/T)+7.769\n", + "\n", + "# Calculations\n", + "T = (1640-1159)/(10.56-7.769)\t\t\t#[K]\n", + "P = 10**((-1640/T)+10.56)\t\t\t#[torr]\n", + "\n", + "# Results\n", + "print \" The temperature is %f K\"%T\n", + "print \" The pressure is %f torr (or mm Hg)\"%P\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The temperature is 172.339663 K\n", + " The pressure is 11.063907 torr (or mm Hg)\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 1.11 Page number - 29" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "M_O2 = 31.999;\t\t\t#molecular weight of oxygen\n", + "M_N2 = 28.014;\t\t\t#molecular weight of nitrogen\n", + "Y = 1.4;\t\t\t#molar heat capacities ratio for air\n", + "\n", + "# Calculations and Results\n", + "#Molecular weight of air(21 vol% O2 and 79 vol% N2)is given by\n", + "M_air = (0.21*M_O2)+(0.79*M_N2)\t\t\t#(vol% = mol%)\n", + "\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "R = (R*1/M_air)\t\t\t#[kJ/kg*K]\n", + "\n", + "print \" The value of universal gas constant (R) = %f kJ/kg-K \"%R\n", + "\n", + "#Y=Cp0/Cv0 and Cp0-Cv0=R\n", + "Cv_0 = R/(Y-1)\t\t\t#[kJ/kg*K] \n", + "Cp_0 = Y*Cv_0;\t\t\t#[kJ/kg*K]\n", + "print \" The value of Cp_0 for air is %f kJ/kg-K\"%Cp_0\n", + "print \" The value of Cv_0 for air is %f kJ/kg-K\"%Cv_0\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The value of universal gas constant (R) = 0.288172 kJ/kg-K \n", + " The value of Cp_0 for air is 1.008601 kJ/kg-K\n", + " The value of Cv_0 for air is 0.720429 kJ/kg-K\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 1.12 Page number - 30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "Y = 1.4;\t\t\t#molar heat capacities ratio for air\n", + "R = 8.314;\t\t\t# [J/mol*K] - Universal gas constant\n", + "\n", + "# Calculations\n", + "Cv_0 = R/(Y-1)\t\t\t# [J/mol*K]\n", + "Cp_0 = Y*Cv_0;\t\t\t# [J/mol*K]\n", + "\n", + "# Results\n", + "print \" The molar heat capacity at constant volume (Cv_0) is %f J/mol-K\"%Cv_0\n", + "print \" The molar heat capacity at constant pressure (Cp_0) is %f J/mol-K\"%Cp_0\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The molar heat capacity at constant volume (Cv_0) is 20.785000 J/mol-K\n", + " The molar heat capacity at constant pressure (Cp_0) is 29.099000 J/mol-K\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 1.13 Page number - 30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "from scipy.integrate import quad\n", + "\n", + "# Variables\n", + "# Cp0=7.7+(0.04594*10**(-2)*T)+(0.2521*10**(-5)*T**(2))-(0.8587*10**(-9)*T**(3))\n", + "T_1 = 400.;\t\t\t#[K]\n", + "T_2 = 500.;\t\t\t#[K]\n", + "\n", + "# Calculations\n", + "def f(T):\n", + " return 7.7+(0.04594*10**(-2)*T)+(0.2521*10**(-5)*T**(2))-(0.8587*10**(-9)*T**(3))\n", + "#(C)avg = q/(T_2 - T_1) = 1/(T_2 - T_1)*{(integrate('C'%'T'%T_1%T_2))}\n", + "#(Cp0)avg = 1/(T_2 - T_1)*{(integrate('Cp0'%'T'%T_1%T_2))}\n", + "Cp0_avg = (1/(T_2 - T_1))*quad(f,T_1,T_2)[0]\n", + "\n", + "# Results\n", + "print \" The mean heat capacity (Cp0_avg) for temerature range of 400 to 500 K is %f cal/mol-K\"%Cp0_avg\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The mean heat capacity (Cp0_avg) for temerature range of 400 to 500 K is 8.340118 cal/mol-K\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 1.14 Page number - 31" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "#(a)\n", + "P_1 = 0.2;\t\t\t# [MPa] - pressure\n", + "x_1 = 0.59;\t\t\t# mole fraction\n", + "\n", + "# Calculations and Results\n", + "#From saturated steam tables at 0.2 MPa\n", + "H_liq_1 = 504.7;\t\t\t# [kJ/kg] - Enthalpy of saturated liquid\n", + "H_vap_1 = 2706.7;\t\t\t# [kJ/kg]- Enthalpy of saturated vapour\n", + "H_1 = (H_liq_1*(1-x_1))+(x_1*H_vap_1)\t\t\t# [kJ/kg]\n", + "print \" (a).Enthalpy of 1 kg of water in tank is %f kJ/kg\"%H_1\n", + "\n", + "#(b)\n", + "T_2 = 120.23;\t\t\t# [C] - temperature\n", + "V_2 = 0.6;\t\t\t# [m**(3)/kg] - specific volume\n", + "\n", + "#From saturated steam tables at 120.23 C% as reported in the book\n", + "V_liq_2=0.001061;\t\t\t# [m**(3)/kg]\n", + "V_vap_2=0.8857;\t\t\t# [m**(3)/kg]\n", + "#since V_2 < Vv_2%dryness factor will be given by% V = ((1-x)*V_liq)+(x*V_vap)\n", + "x_2 = (V_2- V_liq_2)/(V_vap_2 - V_liq_2)\n", + "\n", + "#From steam table%at 120.2 C%the vapour pressure of water is 0.2 MPa.So%enthalpy is given by\n", + "H_2 = (H_liq_1*(1-x_2))+(H_vap_1*x_2)\t\t\t#kJ/kg]\n", + "print \" (b).Enthalpy of saturated steam is %f kJ/kg\"%H_2\n", + "\n", + "#(c)\n", + "P_3 = 2.5;\t\t\t#[MPa]\n", + "T_3 = 350;\t\t\t#[C]\n", + "#From steam tables at 2.5 MPa%T_sat = 223.99 C%as reported in the book\n", + "#since%T_3 > Tsat% steam is superheated\n", + "print \" (c).As steam is superheated%from steam table%enthalpy (H) is 3126.3 kJ/kg\"\n", + "\n", + "#(d)\n", + "T_4 = 350;\t\t\t#[C]\n", + "V_4 = 0.13857;\t\t\t#[m**(3)/kg]\n", + "#From steam table%at 350 C% V_liq = 0.001740 m**(3)/kg and V_vap = 0.008813 m**(3)/kg.Since%V > V_vap%therefore it is superheated.\n", + "#From steam table at 350 C and 1.6 MPa% V = 0.17456 m**(3)/kg\n", + "#At 350 C and 2.0 MPa% V = 0.13857 m**(3)/kg. So%\n", + "print \" (d).The enthalpy of superheated steam (H) is 3137.0 kJ/kg\"\n", + "\n", + "#(e)\n", + "P_4 = 2.0;\t\t\t#[MPa]\n", + "U_4 = 2900;\t\t\t# [kJ/kg] - internal energy\n", + "#From saturated table at 2.0 MPa% U_liq = 906.44kJ and U_vap = 2600.3 kJ/kg\n", + "#scince%U_4 > Uv% it is saturated.\n", + "#From superheated steam table at 2.0 MPa and 350 C% as reported in the book\n", + "U_1 = 2859.8;\t\t\t#[kJ/kg]\n", + "H_1 = 3137.0;\t\t\t#[kJ/kg]\n", + "#At 2.0 MPa and 400 C%\n", + "U_2 = 2945.2;\t\t\t#[kJ/kg]\n", + "H_2 = 3247.6;\t\t\t#[kJ/kg]\n", + "T = (((U_4 - U_1)/(U_2 - U_1))*(400 - 350)) + 350;\t\t\t#[C] - By interpolation\n", + "H = (((T - 350)/(400 - 350))*(H_2 - H_1)) + H_1;\t\t\t#[kJ/kg]\n", + "print \" (e).The enthalpy value (of superheated steam) obtained after interpolation is %f kJ/kg\"%H\n", + "\n", + "#(f)\n", + "P_5 = 2.5;\t\t\t#[MPa]\n", + "T_5 = 100;\t\t\t#[C]\n", + "#At 100 C%P_sat=101350 N/m**(2). Since P_5 > P_sat%it is compressed liquid\n", + "P_sat = 0.101350;\t\t\t#[MPa]\n", + "H_liq = 419.04;\t\t\t#[kJ/kg] - At 100 C and 0.10135 MPa\n", + "V_liq = 0.001044;\t\t\t#[m**(3)/kg] - At 100 C and 0.10135 MPa\n", + "H_0 = H_liq + (V_liq*(P_5 - P_sat))*1000;\t\t\t#kJ/kg]\n", + "print \" (f).The enthalpy of compressed liquid is %f kJ/kg\"%H_0\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " (a).Enthalpy of 1 kg of water in tank is 1803.880000 kJ/kg\n", + " (b).Enthalpy of saturated steam is 1995.549576 kJ/kg\n", + " (c).As steam is superheated%from steam table%enthalpy (H) is 3126.3 kJ/kg\n", + " (d).The enthalpy of superheated steam (H) is 3137.0 kJ/kg\n", + " (e).The enthalpy value (of superheated steam) obtained after interpolation is 3189.062295 kJ/kg\n", + " (f).The enthalpy of compressed liquid is 421.544191 kJ/kg\n" + ] + } + ], + "prompt_number": 15 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch2_2-checkpoint.ipynb b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch2_2-checkpoint.ipynb new file mode 100644 index 00000000..b3f8bd13 --- /dev/null +++ b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch2_2-checkpoint.ipynb @@ -0,0 +1,1287 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:6aa23fb1475338cf467e7afb5732b8b9e456bbb3ad63c14224d73232d920457e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "\n", + "Chapter 2 : Equations of state" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 2.2 Page number - 42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "\n", + "# Variables\n", + "Tc = 647.1;\t\t\t#[K] - Critical temperature\n", + "Pc = 220.55;\t\t#[bar] - Critical pressure\n", + "Tr = 0.7;\t\t\t# Reduced temperature\n", + "\n", + "# Calculations\n", + "T = Tr*Tc;\t\t\t#[K]\n", + "\t\t\t#From steam table%vapour pressure of H2O at T is 10.02 [bar]% as reported in the book\n", + "P = 10.02;\t\t\t#[bar]\n", + "w = -1-math.log10((P/Pc))\n", + "\n", + "# Results\n", + "print \" The acentric factor (w) of water at given condition is %f \"%w\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The acentric factor (w) of water at given condition is 0.342639 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 2.3 Page number - 42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "\t\t\t#math.log10(Psat)=8.1122-(1592.864/(t+226.184))\t\t\t# 'Psat' in [mm Hg] and 't' in [c]\n", + "Tc = 513.9;\t\t\t#[K] - Critical temperature\n", + "Pc = 61.48;\t\t\t#[bar] - Critical pressure\n", + "Pc = Pc*10**(5)\t\t\t#[N/m**(2)]\n", + "Tr = 0.7;\t\t\t# Reduced temperature\n", + "\n", + "# Calculations\n", + "T = Tr*Tc;\t\t\t#[K] - Temperature\n", + "T = T - 273.15;\t\t\t#[C]\n", + "P_sat = 10**(8.1122 - (1592.864/(T + 226.184)))\t\t\t#[mm Hg]\n", + "P_sat = (P_sat/760)*101325;\t\t\t#[N/m**(2)]\n", + "Pr_sat = P_sat/Pc;\n", + "w = -1-math.log10(Pr_sat)\t\t\t# Acentric factor\n", + "\n", + "# Results\n", + "print \" The acentric factor (w) for ethanol at given condition is %f\"%w\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The acentric factor (w) for ethanol at given condition is 0.644493\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 2.4 Page number - 45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 380;\t\t\t#[K] - Temperature\n", + "Tc = 562.1;\t\t\t#[K] - Critical temperature\n", + "P = 7;\t\t\t#[atm] - Pressure\n", + "P = P*101325;\t\t\t#[N/m**(2)]\n", + "Pc = 48.3;\t\t\t#[atm] - Critical pressure\n", + "Pc = Pc*101325;\t\t\t#[N/m**(2)]\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "w = 0.212;\t\t\t# acentric factor\n", + "Tr = T/Tc;\t\t\t# Reduced temperature\n", + "\n", + "# Calculations and Results\n", + "B_0 = 0.083-(0.422/(Tr)**(1.6))\n", + "B_1 = 0.139-(0.172/(Tr)**(4.2))\n", + "\n", + "\t\t\t#We know%(B*Pc)/(R*Tc) = B_0+(w*B_1)\n", + "B = ((B_0+(w*B_1))*(R*Tc))/Pc;\t\t\t#[m**(3)/mol]\n", + "print \" The second virial coefficient for benzene is %e m**(3)/mol\"%B\n", + "\n", + "\t\t\t#Compressibility factor is given by\n", + "Z = 1 + ((B*P)/(R*T))\n", + "print \" The compressibility factor at 380 K is %f\"%Z\n", + "\n", + "\t\t\t#We know thar Z=(P*V)/(R/*T)%therfore\n", + "V = (Z*R*T)/P;\t\t\t#[m**(3)/mol]\n", + "print \" The molar volume is %e m**(3)/mol\"%V\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The second virial coefficient for benzene is -8.267963e-04 m**(3)/mol\n", + " The compressibility factor at 380 K is 0.814382\n", + " The molar volume is 3.627499e-03 m**(3)/mol\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 2.5 Page number - 46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "V_1 = 0.3;\t\t\t#[m**(3)]\t\t\t#volume of cylinder\n", + "T = 60+273.15;\t\t\t#[K] - Temperature\n", + "P = 130*10**(5)\t\t\t#[N/m**(2)] - Pressure\n", + "Tc = 305.3;\t\t\t#[K] - Critical temperature\n", + "Pc = 48.72*10**(5)\t\t\t#[N/m**(2)] - Critical pressure\n", + "w = 0.100;\t\t\t#acentric factor\n", + "M = 30.07;\t\t\t#molecular weight of ethane\n", + "Tr = T/Tc;\t\t\t# Reduced temperature\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "# Calculations and Results\n", + "B_0 = 0.083-(0.422/(Tr)**(1.6))\n", + "B_1 = 0.139-(0.172/(Tr)**(4.2))\n", + "\n", + "\t\t\t#We know%(B*Pc)/(R*Tc) = B_0+(w*B_1)\n", + "B = ((B_0 + (w*B_1))*(R*Tc))/Pc;\t\t\t#[m**(3)/mol] - Second virial coefficient\n", + "Z = 1 + ((B*P)/(R*T))\t\t\t#Compressibility factor\n", + "V = (Z*R*T)/P;\t\t\t#[m**(3)/mol] - Molar volume\n", + "\n", + "\t\t\t#No.of moles in 0.3 m**(3) cylinder is given by\n", + "n1 = V_1/V;\t\t\t#[mol]\n", + "\n", + "\t\t\t#Mass of gas in cylinder is given by \n", + "m1 = (n1*M)/1000.;\t\t\t#[kg]\n", + "print \" Under actual conditions, the mass of ethane is, %f kg\"%m1\n", + "\n", + "\t\t\t#Under ideal condition% taking Z = 1%\n", + "V_ideal = (R*T)/P;\t\t\t#[m**(3)/mol]\n", + "n2 = V_1/V_ideal;\t\t\t#[mol]\n", + "m2 = (n2*M)/1000;\t\t\t#[kg]\n", + "print \" Under ideal conditions,the mass of ethane is, %f kg\"%m2\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Under actual conditions, the mass of ethane is, 136.395203 kg\n", + " Under ideal conditions,the mass of ethane is, 42.339741 kg\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 2.6 Page number - 47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 373.15;\t\t\t#[K] - Temperature\n", + "P = 101325;\t\t\t#[N/m**(2)] - Pressure\n", + "Tc = 647.1;\t\t\t#[K] - Critical temperature\n", + "Pc = 220.55*10**(5)\t#[N/m**(2)] - Critical pressure\n", + "w = 0.345;\t\t\t#acentric factor\n", + "Tr = T/Tc;\t\t\t# Reduced temperature\n", + "R = 8.314;\t\t\t#[J/mol*K] - UNiversal gas constant\n", + "\n", + "# Calculations\n", + "B_0 = 0.083-(0.422/(Tr)**(1.6))\n", + "B_1 = 0.139-(0.172/(Tr)**(4.2))\n", + "\n", + "\t\t\t#We know%(B*Pc)/(R*Tc) = B_0+(w*B_1)\n", + "B = ((B_0+(w*B_1))*(R*Tc))/Pc;\t\t\t#[m**(3)/mol] - Second virial coefficient\n", + "\n", + "\t\t\t#We have% Z = 1+(B/V) and Z = (P*V)/(R*T). Substituting the value of Z%we get\n", + "\t\t\t# V**(2)-((R*T)/P)*V-((B*R*T)/P)=0 .Solving the quadratic equation by shreedharcharya rule\n", + "V1 = (((R*T)/P) + (((R*T)/P)**(2) + 4*1*((B*R*T)/P))**(1./2))/2*1;\n", + "\n", + "# Results\n", + "print \" The molar volume of water vapour is %f m**(3)/mol\"%V1\n", + "\n", + "\t\t\t#The roots are%V1 = 0.0003670 [m**(3)/mol] and V2 = 0.0302510 [m**(3)/mol].\n", + "\t\t\t#As 'V2' is near to ideal volume (0.030618 [m**(3)/mol])%it is taken as the molar volume\n", + "\t\t\t#The other root 'V1' hss no physical significance\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The molar volume of water vapour is 0.030251 m**(3)/mol\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 2.7 Page number - 47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 50+273.15;\t\t\t#[K] - Temperature\n", + "P = 15*10**(5)\t\t\t#[N/m**(2)] - Pressure\n", + "Tc = 305.3;\t\t\t#[K] - Critical temperature\n", + "Pc = 48.72*10**(5)\t\t\t#[N/m**(2)] - Critical pressure\n", + "w = 0.100;\t\t\t# Acentric factor\n", + "B = -157.31;\t\t\t#[cm**(3)/mol] - second virial coefficient\n", + "B = B*10**(-6)\t\t\t#[m**(3)/mol]\n", + "C = 9650;\t\t\t#[cm**(6)/mol**(2)] - third virial coefficient\n", + "C = C*10**(-12)\t\t\t#[cm**(6)/mol**(2)]\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# (1)\n", + "V_1 = (R*T)/P;\t\t\t#[m**(3)/mol] - Molar volume\n", + "print \" (1).The molar volume for ideal equation of state is %e m**(3)/mol\"%V_1\n", + "\n", + "\t\t\t# (2)\n", + "Tr = T/Tc;\t\t\t# Reduced temperature\n", + "\t\t\t# At this temperature\n", + "B_0 = 0.083-(0.422/(Tr)**(1.6))\n", + "B_1 = 0.139-(0.172/(Tr)**(4.2))\n", + "\n", + "\t\t\t# We know%(B*Pc)/(R*Tc) = B_0+(w*B_1)\n", + "B_2 = ((B_0 + (w*B_1))*(R*Tc))/Pc;\t\t\t#[m**(3)/mol]\t\t\t#second virial coefficient\n", + "print \" (2).The second virial coefficent using Pitzer correlation is \\\n", + "found to be %e m**(3)/mol which is same as given value\"%B_2\n", + "\n", + "\t\t\t# (3)\n", + "\t\t\t# Given (virial equation)%Z=1+(B/V)\n", + "V_3 = B + (R*T)/P;\t\t\t#[m**(3)/mol] - Molar volume\n", + "print \" (3).The molar volume using virial equation of state is %e m**(3)/mol\"%V_3\n", + "\n", + "\t\t\t# (4)\n", + "\t\t\t# Given (virial equation)%Z = 1 + ((B*P)/(R*T)) + ((C - B**(2))/(R*T)**(2))*P**(2)\n", + "V_4 = B + (R*T)/P + ((C - B**(2))/(R*T))*P;\t\t\t# [m**(3)/mol]\n", + "print \" (4).The molar volume using given virial equation of state is %e m**(3)/mol\"%V_4\n", + "\n", + "\t\t\t# (5)\n", + "\t\t\t# Given%Z = 1 + (B/V)\n", + "\t\t\t# Also%Z = (P*V)/(R*T). Substituting the value of Z%we get\n", + "\t\t\t# V**(2)-((R*T)/P)*V-((B*R*T)/P)=0.Solving the quadratic equation\n", + "from scipy.optimize import fsolve\n", + "def f(V):\n", + " global R,T,P,B\n", + " return V**(2)-((R*T)/P)*V-((B*R*T)/P)\n", + "V_5_1 = fsolve(f,0)\n", + "V_5_2 = fsolve(f,1)\n", + "\n", + "print \" (5).The molar volume using given virial equation of state is %e m**(3)/mol\"%V_5_2\n", + "\n", + "\t\t\t# The roots are%V_5_1=0.0001743 [m**(3)/mol] and V_5_2=0.0016168 [m**(3)/mol].\n", + "\t\t\t# As 'V_2' is near to ideal volume (0.0017911 [m**(3)/mol])%it is taken as the molar volume\n", + "\n", + "\t\t\t# (6)\n", + "\t\t\t# Given%Z = 1 + (B/V) + (C/V**(2))\n", + "\t\t\t# Also%Z = (P*V)/(R*T). Substituting the value of Z%we get\n", + "\t\t\t# V**(3)-((R*T)/P)*V**(2)-((B*R*T)/P)*V-((C*R*T)/P)=0. Solving the cubic equation\n", + "def f1(V):\n", + " global P,R,T,B,C\n", + " return V**(3)-((R*T)/P)*V**(2)-((B*R*T)/P)*V-((C*R*T)/P)\n", + " \n", + "V_6_3=fsolve(f1,-1)\n", + "V_6_4=fsolve(f1,0)\n", + "V_6_5=fsolve(f1,1)\n", + "\t\t\t#The above equation has 1 real and 2 imaginary roots. We consider only real root.\n", + "print \" (6).The molar volume using given virial equation of state is %e m**(3)/mol\"%V_6_5\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " (1).The molar volume for ideal equation of state is 1.791113e-03 m**(3)/mol\n", + " (2).The second virial coefficent using Pitzer correlation is found to be -1.573258e-04 m**(3)/mol which is same as given value\n", + " (3).The molar volume using virial equation of state is 1.633803e-03 m**(3)/mol\n", + " (4).The molar volume using given virial equation of state is 1.625374e-03 m**(3)/mol\n", + " (5).The molar volume using given virial equation of state is 1.616848e-03 m**(3)/mol" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " (6).The molar volume using given virial equation of state is 1.624187e-03 m**(3)/mol\n" + ] + }, + { + "output_type": "stream", + "stream": "stderr", + "text": [ + "/home/jovina/virtualenvs/scipy/local/lib/python2.7/site-packages/scipy/optimize/minpack.py:236: RuntimeWarning: The iteration is not making good progress, as measured by the \n", + " improvement from the last ten iterations.\n", + " warnings.warn(msg, RuntimeWarning)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 2.8 Page number - 49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T = 0 + 273.15;\t\t\t#[K] - Temperature\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "from numpy import linalg,array\n", + "from scipy.stats import linregress\n", + "\t\t\t#Virial equation of state% Z=1+(B/V)+(C/V**(2))\n", + "\t\t\t#From above equation we get (Z-1)*V=B+(C/V)\n", + "\n", + "P=[50,100,200,400,600,1000];\n", + "Z=[0.9846,1.0000,1.0365,1.2557,1.7559,2.0645];\n", + "V=[0,0,0,0,0,0]\n", + "k= []\n", + "t=array([0,0,0,0,0,0])\n", + "\n", + "# Calculations\n", + "for i in range(6):\n", + " V[i]=(Z[i]*R*T)/(P[i]*101325.)\t\t\t#[m**(3)/mol]\n", + " k.append((Z[i]-1.)*V[i])\n", + " t[i]=1./V[i]\n", + " \n", + "k = array(k)\n", + "\n", + "\t\t\t#w = linalg.lstsq(t.T,k.T)\n", + "\t\t\t#[C,B,sig]=reglin(t',k')\n", + "C,B,c,d,e = linregress(t.T,k.T)\n", + "\n", + "# Results\n", + "#From the regression% we get intercept=B and slope=C%and thus%\n", + "print \" The value of second virial coefficient (B) is %e m**(3)/mol\"%B\n", + "print \" The value of third virial coefficient (C) is %e m**(6)/mol**(2)\"%C\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The value of second virial coefficient (B) is -1.563305e-05 m**(3)/mol\n", + " The value of third virial coefficient (C) is 3.133359e-09 m**(6)/mol**(2)\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 2.9 Page number - 51" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T = 444.3;\t\t\t#[K] - Temperature\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "B_11 = -8.1;\t\t\t#[cm**(3)/mol]\n", + "B_11 = -8.1*10**(-6)\t\t\t#[m**(3)/mol]\n", + "B_22 = -293.4*10**(-6)\t\t\t#[m**(3)/mol]\n", + "y1 = 0.5;\t\t\t# mole fraction \t\t\t# equimolar mixture\n", + "y2 = 0.5;\n", + "\n", + "# For component 1 (methane)\n", + "Tc_1 = 190.6;\t\t\t#[K] - cricitical temperature\n", + "Vc_1 = 99.2;\t\t\t#[cm**(3)/mol] - cricitical molar volume\n", + "Zc_1 = 0.288;\t\t\t# critical compressibility factor\n", + "w_1 = 0.012;\t\t\t# acentric factor\n", + "\n", + "# For component 2 (n-butane)\n", + "Tc_2 = 425.2;\t\t\t#[K]\n", + "Vc_2 = 255.0;\t\t\t#[cm**(3)/mol]\n", + "Zc_2 = 0.274;\n", + "w_2 = 0.199;\n", + "\n", + "# Calculations\n", + "#Using virial mixing rule%we get\n", + "Tc_12 = (Tc_1*Tc_2)**(1./2)\t\t\t#[K]\n", + "w_12 = (w_1 + w_2)/2.;\n", + "Zc_12 = (Zc_1+Zc_2)/2.;\n", + "Vc_12 = (((Vc_1)**(1./3) + (Vc_2)**(1./3))/2.)**(3)\t\t\t#[cm**(3)/mol]\n", + "Vc_12 = Vc_12*10**(-6)\t\t\t#[cm**(3)/mol]\n", + "Pc_12 = (Zc_12*R*Tc_12)/Vc_12;\t\t\t#[N/m**(2)]\n", + "Tr_12 = T/Tc_12;\t\t\t#Reduced temperature\n", + "B_0 = 0.083 - (0.422/(Tr_12)**(1.6))\n", + "B_1 = 0.139 - (0.172/(Tr_12)**(4.2))\n", + "\n", + "\t\t\t#We know%(B_12*Pc_12)/(R*Tc_12) = B_0 + (w_12*B_1)\n", + "B_12 = ((B_0+(w_12*B_1))*(R*Tc_12))/Pc_12;\t\t\t#[m**(3)/mol] - Cross coefficient\n", + "B = y1**(2)*B_11+2*y1*y2*B_12+y2**(2)*B_22;\t\t\t#[m**(3)/mol] - Second virial coefficient for mixture\n", + "B = B*10**(6)\t\t\t#[cm**(3)/mol]\n", + "\n", + "# Results\n", + "print \" The second virial coefficient,(B) for the mixture of gas is %f cm**(3)/mol\"%B\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The second virial coefficient,(B) for the mixture of gas is -108.309380 cm**(3)/mol\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 2.10 Page number - 52" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T = 71+273.15;\t\t\t#[K] - Temperature\n", + "P = 69*10**(5)\t\t\t#[N/m**(2)] - Pressure\n", + "y1 = 0.5;\t\t\t#[mol] - mole fraction of equimolar mixture\n", + "y2 = 0.5;\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "\t\t\t#For component 1 (methane)\n", + "Tc_1 =190.6;\t\t\t#[K] - Critical temperature\n", + "Pc_1 = 45.99*10**(5)\t\t\t#[N/m**(2)] - Critical pressure\n", + "Vc_1 = 98.6;\t\t\t#[cm**(3)/mol] - Critical volume\n", + "Zc_1 = 0.286;\t\t\t# Critical compressibility factor\n", + "w_1 = 0.012;\t\t\t# acentric factor\n", + "\n", + "\t\t\t#For component 2 (hydrogen sulphide)\n", + "Tc_2 = 373.5;\t\t\t#[K]\n", + "Pc_2 = 89.63*10**(5)\t\t\t#[N/m**(2)]\n", + "Vc_2 = 98.5;\t\t\t#[cm**(3)/mol]\n", + "Zc_2 = 0.284;\n", + "w_2 = 0.094;\n", + "\n", + "# Calculations\n", + "\t\t\t#For component 1\n", + "Tr_1 = T/Tc_1;\t\t\t#Reduced temperature\n", + "\t\t\t#At reduced temperature\n", + "B1_0 = 0.083-(0.422/(Tr_1)**(1.6))\n", + "B1_1 = 0.139-(0.172/(Tr_1)**(4.2))\n", + "\t\t\t#We know%(B*Pc)/(R*Tc) = B_0+(w*B_1)\n", + "B_11 = ((B1_0+(w_1*B1_1))*(R*Tc_1))/Pc_1;\t\t\t#[m**(3)/mol]\n", + "\n", + "\t\t\t#Similarly for component 2\n", + "Tr_2 = T/Tc_2;\t\t\t#Reduced temperature\n", + "\t\t\t#At reduced temperature Tr_2%\n", + "B2_0 = 0.083 - (0.422/(Tr_2)**(1.6))\n", + "B2_1 = 0.139 - (0.172/(Tr_2)**(4.2))\n", + "B_22 = ((B2_0+(w_2*B2_1))*(R*Tc_2))/Pc_2;\t\t\t#[m**(3)/mol]\n", + "\n", + "\t\t\t#For cross coeffcient\n", + "Tc_12 = (Tc_1*Tc_2)**(1./2)\t\t\t#[K]\n", + "w_12 = (w_1 + w_2)/2;\n", + "Zc_12 = (Zc_1 + Zc_2)/2;\n", + "Vc_12 = (((Vc_1)**(1./3) + (Vc_2)**(1./3))/2)**(3)\t\t\t#[cm**(3)/mol]\n", + "Vc_12 = Vc_12*10**(-6)\t\t\t#[m**(3)/mol]\n", + "Pc_12 = (Zc_12*R*Tc_12)/Vc_12;\t\t\t#[N/m**(2)]\n", + "\n", + "\t\t\t#Now we have%(B_12*Pc_12)/(R*Tc_12) = B_0+(w_12*B_1)\n", + "\t\t\t#where B_0 and B_1 are to be evaluated at Tr_12\n", + "Tr_12 = T/Tc_12;\n", + "\t\t\t#At reduced temperature Tr_12\n", + "B_0 = 0.083 - (0.422/(Tr_12)**(1.6))\n", + "B_1 = 0.139 - (0.172/(Tr_12)**(4.2))\n", + "B_12=((B_0 + (w_12*B_1))*R*Tc_12)/Pc_12;\t\t\t#[m**(3)/mol]\n", + "\n", + "\t\t\t#For the mixture\n", + "B = y1**(2)*B_11+2*y1*y2*B_12 + y2**(2)*B_22;\t\t\t#[m**(3)/mol]\n", + "\n", + "\t\t\t#Now given virial equation is% Z=1+(B*P)/(R*T)\n", + "Z = 1 + (B*P)/(R*T)\n", + "\n", + "\t\t\t#Also Z = (P*V)/(R*T).Therefore%\n", + "V = (Z*R*T)/P;\t\t\t#[m**(3)/mol]\n", + "\n", + "# Results\n", + "print \" The molar volume of the mixture is %e m**(3)/mol\"%V\n", + "\t\t\t#The value obtained is near the math.experimental value of V_math.exp = 3.38*10**(-4) m**(3)/mol\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The molar volume of the mixture is 3.390411e-04 m**(3)/mol\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example - 2.11 Page number - 53" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "P = 6.*10**(6)\t\t\t# [Pa] - Pressure\n", + "P_max = 12.*10**(6)\t\t\t# [Pa] - Max pressure to which cylinder may be math.exposed\n", + "T = 280.;\t\t\t#[K] - Temperature\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#(1).Assuming ideal gas behaviour%\n", + "V_ideal = (R*T)/P;\t\t\t#[m**(3)/mol]\n", + "\t\t\t#Now when temperature and pressure are increased%the molar volume remains same%as total volume and number of moles are same.\n", + "\t\t\t#For max pressure of 12 MPa%temperature is\n", + "T_max_ideal = (P_max*V_ideal)/R;\n", + "print \" (1).The maximum temperature assuming ideal behaviour is %f K\"%T_max_ideal\n", + "\n", + "\t\t\t# (2).Assuming virial equation of state\n", + "\t\t\t# For component 1 (methane)%at 280 K\n", + "Tc_1 = 190.6;\t\t\t#[K]\n", + "Pc_1 = 45.99*10**(5)\t\t\t#[N/m**(2)]\n", + "Vc_1 = 98.6;\t\t\t#[cm**(3)/mol]\n", + "Zc_1 = 0.286;\n", + "w_1 = 0.012;\n", + "Tr_1 = T/Tc_1;\t\t\t#Reduced temperature\n", + "B1_0 = 0.083 - (0.422/(Tr_1)**(1.6))\n", + "B1_1 = 0.139 - (0.172/(Tr_1)**(4.2))\n", + "\n", + "\t\t\t#We know%(B*Pc)/(R*Tc) = B_0+(w*B_1)\n", + "B_11 = ((B1_0 + (w_1*B1_1))*(R*Tc_1))/Pc_1;\t\t\t#[m**(3)/mol]\n", + "\n", + "\t\t\t#For component 2 (Propane)\n", + "Tc_2 = 369.8;\t\t\t#[K]\n", + "Pc_2 = 42.48*10**(5)\t\t\t#[N/m**(2)]\n", + "Vc_2 = 200;\t\t\t#[cm**(3)/mol]\n", + "Zc_2 = 0.276;\n", + "w_2 = 0.152;\n", + "Tr_2 = T/Tc_2;\t\t\t# Reduced temperature\n", + "B2_0 = 0.083 - (0.422/(Tr_2)**(1.6))\n", + "B2_1 = 0.139 - (0.172/(Tr_2)**(4.2))\n", + "B_22 = ((B2_0 + (w_2*B2_1))*(R*Tc_2))/Pc_2;\t\t\t#[m**(3)/mol]\n", + "\n", + "\t\t\t#For cross coeffcient\n", + "y1 = 0.8;\t\t\t#mole fraction of component 1\n", + "y2 = 0.2;\t\t\t#mole fraction of component 2\n", + "Tc_12 = (Tc_1*Tc_2)**(1/2.)\t\t\t#[K]\n", + "w_12 = (w_1 + w_2)/2;\n", + "Zc_12 = (Zc_1 + Zc_2)/2;\n", + "Vc_12 = (((Vc_1)**(1./3) + (Vc_2)**(1./3))/2)**(3)\t\t\t#[cm**(3)/mol]\n", + "Vc_12 = Vc_12*10**(-6)\t\t\t#[m**(3)/mol]\n", + "Pc_12 = (Zc_12*R*Tc_12)/Vc_12;\t\t\t#[N/m**(2)]\n", + "Tr_12 = T/Tc_12;\n", + "\n", + "\t\t\t#At reduced temperature%Tr_12%\n", + "B_0 = 0.083 - (0.422/(Tr_12)**(1.6))\n", + "B_1 = 0.139 - (0.172/(Tr_12)**(4.2))\n", + "B_12 = ((B_0 + (w_12*B_1))*R*Tc_12)/Pc_12;\t\t\t#[m**(3)/mol]\n", + "\n", + "\t\t\t#For the mixture\n", + "B = y1**(2)*B_11+2*y1*y2*B_12 + y2**(2)*B_22;\t\t\t#[m**(3)/mol]\n", + "\n", + "\t\t\t#Now given virial equation is% Z=1+(B*P)/(R*T)\n", + "Z = 1 + (B*P)/(R*T)\n", + "\t\t\t#Also Z = (P*V)/(R*T).Therefore%\n", + "V_real = (Z*R*T)/P;\t\t\t#[m**(3)/mol]\n", + "\n", + "\t\t\t# This molar volume remains the same as the volume and number of moles remains fixed.\n", + "\t\t\t# Sice Z is a function of presure and temperature%we shall assume a temperature%calculate Z and again calculate temperature%till convergence is obtained.\n", + "\t\t\t# We will use the concept of iteration to compute the convergent value of temperature\n", + "\t\t\t# Let us start with the temperature at ideal conditions i.e T = 560 K%\n", + "\n", + "T_prime = 560.;\t\t\t#[K]\n", + "fault = 10.;\n", + "\n", + "while(fault > 1):\n", + " T_prime_r1 = T_prime/Tc_1;\n", + " B_prime1_0 = 7.7674*10**(-3)\n", + " B_prime1_1 = 0.13714;\n", + " B_prime_11 = ((B_prime1_0 + (w_1*B_prime1_1))*(R*Tc_1))/Pc_1;\t\t\t#[m**(3)/mol]\n", + "\n", + " \t\t\t#Similarly for component 2%\n", + " T_prime_r2 = T_prime/Tc_2;\n", + " B_prime2_0 = -0.1343;\n", + " B_prime2_1 = 0.10887;\n", + " B_prime_22 = ((B_prime2_0 + (w_2*B_prime2_1))*(R*Tc_2))/Pc_2;\t\t\t#[m**(3)/mol]\n", + "\n", + " \t\t\t#For cross coefficient (assuming k12=0)\n", + " \t\t\t#Tc_12 % w_12 % Zc_12 % Vc_12 and Pc_12 have already been calculated above%now\n", + " T_prime_r12 = T_prime/Tc_12;\t\t\t#\n", + " \t\t\t#At reduced temperature%T_prime_r12%\n", + " B_prime_0 = 0.083 - (0.422/(T_prime_r12)**(1.6))\n", + " B_prime_1 = 0.139 - (0.172/(T_prime_r12)**(4.2))\n", + " B_prime_12 = ((B_prime_0+(w_12*B_prime_1))*R*Tc_12)/Pc_12;\t\t\t#[m**(3)/mol]\n", + "\n", + " \t\t\t#For the mixture\n", + " B_prime = y1**(2)*B_prime_11 + 2*y1*y2*B_prime_12 + y2**(2)*B_prime_22;\t\t\t#[m**(3)/mol]\n", + " Z_prime = 1 + (B_prime*P_max)/(R*T_prime)\n", + " T_new = (P_max*V_real)/(Z_prime*R)\n", + " fault = abs(T_prime - T_new)\n", + " T_prime = T_new;\n", + "\n", + "print \" (2).The maximum temperature assuming the gas to follow virial equation of state is %f K\"%T_new\n", + "\n", + "# Note : Answers varies because of rounding error. Please check it manually." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " (1).The maximum temperature assuming ideal behaviour is 560.000000 K\n", + " (2).The maximum temperature assuming the gas to follow virial equation of state is 440.112497 K\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example - 2.12 Page number - 64" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "V_vessel = 0.1;\t\t\t#[m**(3)]\t\t\t# Volume of vessel\n", + "T = 25 + 273.15;\t\t#[K] - Temperature\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "m = 25*1000;\t\t\t#[g]\t\t\t# Mass of ethylene\n", + "Tc = 282.3;\t\t\t#[K] - Critical temperature\n", + "Pc = 50.40;\t\t\t#[bar] - Critical pressure\n", + "Pc = Pc*10**(5)\t\t\t#[N/m**(2)]\n", + "Zc = 0.281;\t\t\t# Critical compressibility factor\n", + "Vc = 131;\t\t\t#[cm**(3)/mol] - Critical volume\n", + "Vc = Vc*10**(-6)\t\t\t#[m**(3)/mol]\n", + "w = 0.087;\t\t\t# Acentric factor\n", + "M = 28.054;\t\t\t# Molecular weight of ethylene\n", + "\n", + "# Calculations\n", + "n = m/M;\t\t\t#[mole] - No. of moles of ethylene\n", + "V = V_vessel/n;\t\t#[m**(3)/mol] - Molar volume\n", + "\n", + "\t\t\t#Under Redlich Kwong equation of state% we have\n", + "a = (0.42748*(R**(2))*(Tc**(2.5)))/Pc;\t\t\t#[Pa*m**(6)*K**(1/2)/mol]\n", + "b = (0.08664*R*Tc)/Pc;\t\t\t#[m**(3)/mol]\n", + "P = ((R*T)/(V-b))-(a/(T**(1./2)*V*(V+b)))\t\t\t#[N/m**(2)]\n", + "\n", + "# Results\n", + "print \" The required pressure using Redlich Kwong equation of state is %e N/m**(2)\"%P\n", + "\n", + "\t\t\t#For ideal gas equation of state%\n", + "P_ideal = (R*T)/V;\t\t\t#[N/m**(2)]\n", + "print \" For ideal gas equation of state,the required pressure is %e N/m**(2)\"%P_ideal\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The required pressure using Redlich Kwong equation of state is 7.934745e+06 N/m**(2)\n", + " For ideal gas equation of state,the required pressure is 2.208971e+07 N/m**(2)\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example - 2.13 Page number - 65" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "V_vessel = 360*10**(-3)\t\t\t#[m**(3)] - volume of vessel\n", + "T = 62+273.15;\t\t\t#[K] - Temperature\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "m = 70.*1000;\t\t\t#[g]/ - Mass of carbon dioxide\n", + "\n", + "\t\t\t#For carbon dioxide\n", + "Tc = 304.2;\t\t\t#[K] - Cricitical temperature\n", + "Pc = 73.83;\t\t\t#[bar] - Cricitical pressure\n", + "Pc = Pc*10**(5)\t\t\t# [N/m**(2)]\n", + "Zc = 0.274;\t\t\t# Critical compressibility factor\n", + "Vc = 94.0;\t\t\t#[cm**(3)/mol]\n", + "Vc = Vc*10**(-6)\t\t\t#[m**(3)/mol]\n", + "w = 0.224;\t\t\t# Acentric factor\n", + "M = 44.01;\t\t\t# Molecular weight of carbon dioxide\n", + "\n", + "# Calculations and Results\n", + "n = m/M;\t\t\t#[mol] - No. of moles\n", + "V = V_vessel/n;\t\t\t#[m**(3)/mol]\t\t\t#molar volume\n", + "\n", + "\t\t\t# (1)\n", + "\t\t\t# Ideal gas behaviour\n", + "P_1 = (R*T)/V;\t\t\t#[N/m**(2)]\n", + "print \" (1).The required pressure using ideal equation of state is %e N/m**(2)\"%P_1\n", + "\n", + "\t\t\t# (2)\n", + "\t\t\t# Virial equation of state% Z = 1 + (B*P)/(R*T)\n", + "\t\t\t# (P*V)/(R*T) = 1 + (B*P)/(R*T)% and thus P = (R*T)/(V - B). Now\n", + "Tr = T/Tc;\t\t\t#Reduced temperature\n", + "\t\t\t# At reduced temperature Tr%\n", + "B_0 = 0.083 - (0.422/(Tr)**(1.6))\n", + "B_1 = 0.139 - (0.172/(Tr)**(4.2))\n", + "B = ((B_0 + (w*B_1))*(R*Tc))/Pc;\t\t\t#[m**(3)/mol]\n", + "P_2 = (R*T)/(V - B)\t\t\t#[N/m**(2)]\n", + "print \" (2).The required pressure using given virial equation of state is %e N/m**(2)\"%P_2\n", + "\n", + "\t\t\t# (3)\n", + "\t\t\t# Virial equation of state% Z = 1 + (B/V)\n", + "\t\t\t# (P*V)/(R*T) = 1 + (B/V)\n", + "P_3 = ((R*T)/V) + (B*R*T)/(V**(2))\t\t\t#[N/m**(2)]\n", + "print \" (3).The required pressure using given virial equation of state is %e N/m**(2)\"%P_3\n", + "\n", + "\t\t\t# (4)\n", + "\t\t\t# Van der Walls equation of state%P = ((R*T)/(V-b)) - a/(V**(2))\n", + "a = (27*(R**(2))*(Tc**(2)))/(64*Pc)\t\t\t#[Pa*m**(6)/mol**(2)]\n", + "b = (R*Tc)/(8*Pc)\t\t\t#[m**(3)/mol]\n", + "P_4 = ((R*T)/(V-b)) - a/(V**(2))\t\t\t#[N/m**(2)]\n", + "print \" (4).The required pressure using van der Walls equation of state is %e N/m**(2)\"%P_4\n", + "\n", + "\t\t\t#(5)\n", + "\t\t\t# Redlich Kwong equation of state%\n", + "a_1 = (0.42748*(R**(2))*(Tc**(2.5)))/Pc;\t\t\t#[Pa*m**(6)*K**(1/2)/mol]\n", + "b_1 = (0.08664*R*Tc)/Pc;\t\t\t#[m**(3)/mol]\n", + "P_5 = ((R*T)/(V - b_1)) - (a_1/(T**(1./2)*V*(V + b_1)))\t\t\t#[N/m**(2)]\n", + "print \" (5).The required pressure using Redlich Kwong equation of state is %e N/m**(2)\"%P_5\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " (1).The required pressure using ideal equation of state is 1.231100e+07 N/m**(2)\n", + " (2).The required pressure using given virial equation of state is 8.712394e+06 N/m**(2)\n", + " (3).The required pressure using given virial equation of state is 7.226009e+06 N/m**(2)\n", + " (4).The required pressure using van der Walls equation of state is 8.048790e+06 N/m**(2)\n", + " (5).The required pressure using Redlich Kwong equation of state is 8.079803e+06 N/m**(2)\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example - 2.14 Page number - 66" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T = 500+273.15;\t\t\t#[K] - Temperature\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "P = 325*1000;\t\t\t#[Pa] - Pressure\n", + "Tc = 647.1;\t\t\t#[K] - Cricitical temperature\n", + "Pc = 220.55;\t\t\t#[bar] - Cricitical pressure\n", + "Pc = Pc*10**(5)\t\t\t#[N/m**(2)]\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#(1)\n", + "\t\t\t# Van der Walls equation of state%\n", + "a = (27*(R**(2))*(Tc**(2)))/(64*Pc)\t\t\t#[Pa*m**(6)/mol**(2)]\n", + "b = (R*Tc)/(8*Pc)\t\t\t#[m**(3)/mol]\n", + "\t\t\t# The cubic form of van der Walls equation of state is given by%\n", + "\t\t\t# V**(3)-(b+(R*T)/P)*V**(2)+(a/P)*V-(a*b)/P=0\n", + "\t\t\t# Solving the cubic equation\n", + "def f(V):\n", + " global b,R,T,P,a\n", + " return V**(3)-(b+(R*T)/P)*V**(2)+(a/P)*V-(a*b)/P\n", + "from scipy.optimize import fsolve\n", + "V_1 = fsolve(f,1)\n", + "V_2 = fsolve(f,10)\n", + "V_3 = fsolve(f,100)\n", + "\t\t\t# The above equation has 1 real and 2 imaginary roots. We consider only real root%\n", + "Z_1 = (P*V_1)/(R*T)\t\t\t#compressibility factor\n", + "print \" (1).The compressibility factor of steam using van der Walls equation of state is %f\"%Z_1\n", + "\n", + "\t\t\t#(2)\n", + "\n", + "\t\t\t#Redlich Kwong equation of state%\n", + "a_1 = (0.42748*(R**(2))*(Tc**(2.5)))/Pc;\t\t\t#[Pa*m**(6)*K**(1/2)/mol]\n", + "b_1 = (0.08664*R*Tc)/Pc;\t\t\t#[m**(3)/mol]\n", + "\t\t\t# The cubic form of Redlich Kwong equation of state is given by%\n", + "\t\t\t# V**(3)-((R*T)/P)*V**(2)-((b_1**(2))+((b_1*R*T)/P)-(a/(T**(1/2)*P))*V-(a*b)/(T**(1/2)*P)=0\n", + "\t\t\t#Solving the cubic equation\n", + "def f1(V):\n", + " return V**(3)-((R*T)/P)*V**(2)-((b_1**(2))+((b_1*R*T)/P)-(a_1/(T**(1./2)*P)))*V-(a_1*b_1)/(T**(1./2)*P)\n", + " \n", + "V_4=fsolve(f1,1)\n", + "V_5=fsolve(f1,10)\n", + "V_6=fsolve(f1,100)\n", + "\t\t\t# The above equation has 1 real and 2 imaginary roots. We consider only real root%\n", + "\t\t\t# Thus compressibility factor is\n", + "Z_2 = (P*V_4)/(R*T)\t\t\t#compressibility factor\n", + "print \" (2).The compressibility factor of steam using Redlich Kwong equation of state is %f\"%Z_2\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " (1).The compressibility factor of steam using van der Walls equation of state is 0.997181\n", + " (2).The compressibility factor of steam using Redlich Kwong equation of state is 0.997028\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example - 2.15 Page number - 67" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "from scipy.optimize import fsolve\n", + "\n", + "\n", + "# Variables\n", + "T = 250+273.15;\t\t\t#[K]\n", + "R = 8.314;\t\t\t#[J/mol*K]\n", + "P = 39.76;\t\t\t#[bar] Vapour pressure of water at T\n", + "P = P*10**(5)\t\t\t#[N/m**(2)]\n", + "Tc = 647.1;\t\t\t#[K] - Cricitical temperature\n", + "Pc = 220.55*10**(5)\t\t\t#[N/m**(2)] - Cricitical pressure\n", + "w = 0.345;\t\t\t#Acentric factor\n", + "M = 18.015;\t\t\t# Molecular weight of water\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# Using peng-Robinson equation of stste \n", + "m = 0.37464 + 1.54226*w - 0.26992*w**(2)\n", + "Tr = T/Tc;\n", + "alpha = (1 + m*(1 - Tr**(1./2)))**(2)\n", + "a = ((0.45724*(R*Tc)**(2))/Pc)*alpha;\t\t\t#[Pa*m**(6)/mol**(2)]\n", + "b = (0.07780*R*Tc)/Pc;\t\t\t#[m**(3)/mol]\n", + "\t\t\t# Cubuc form of Peng-Robinson equation of stste is given by\n", + "\t\t\t# V**(3) + (b-(R*T)/P)*V**(2) - ((3*b**(2)) + ((2*R*T*b)/P) - (a/P))*V+b**(3) + ((R*T*(b**(2))/P) - ((a*b)/P) = 0;\n", + "\t\t\t# Solving the cubic equation\n", + "def f(V):\n", + " global b,R,T,P,a\n", + " return V**(3)+(b-(R*T)/P)*V**(2)-((3*b**(2))+((2*R*T*b)/P)-(a/P))*V+b**(3)+((R*T*(b**(2)))/P)-((a*b)/P)\n", + "V_1 = fsolve(f,-1)\n", + "V_2 = fsolve(f,0)\n", + "V_3 = fsolve(f,1)\n", + "\t\t\t#The largest root is for vapour phase%\n", + "V_vap = V_3;\t\t\t#[m**(3)/mol] - Molar volume (saturated vapour)\n", + "V_vap = V_vap*10**(6)/M;\t\t\t#[cm**(3)/g]\n", + "\n", + "print \" The moar volume of saturated water in the vapour phase (V_vap) is %f cm**(3)/g\"%V_vap\n", + "\n", + "\t\t\t#The smallest root is for liquid phase%\n", + "V_liq = V_1;\t\t\t#[m**(3)/mol] - molar volume (saturated liquid)\n", + "V_liq = V_liq*10**(6)/M;\t\t\t#[cm**(3)/g]\n", + "print \" The moar volume of saturated water in the liquid phase (V_liq) is %f cm**(3)/g\"%V_liq\n", + "\n", + "\t\t\t#From steam table at 250 C% V_vap = 50.13 [cm**(3)/g] and V_liq = 1.251 [cm**(3)/g].\n", + "print \" From steam table at 250 C, V_vap = 50.13 [cm**(3)/g] and V_liq = 1.251 [cm**(3)/g]\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The moar volume of saturated water in the vapour phase (V_vap) is 51.757097 cm**(3)/g\n", + " The moar volume of saturated water in the liquid phase (V_liq) is 1.554560 cm**(3)/g\n", + " From steam table at 250 C, V_vap = 50.13 [cm**(3)/g] and V_liq = 1.251 [cm**(3)/g]\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example - 2.16 Page number - 68" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 500+273.15;\t\t\t#[K] - Temperature\n", + "P = 15.;\t\t\t#[atm] - Pressure\n", + "P = P*101325;\t\t\t#[N/m**(2)]\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "Tc = 190.6;\t\t\t#[K] - Cricitical temperature\n", + "Pc = 45.99*10**(5)\t\t\t#[N/m**(2)] - Cricitical pressure\n", + "Vc = 98.6;\t\t\t#[cm**(3)/mol] - Cricitical molar volume\n", + "Zc = 0.286;\t\t\t# Critical compressibility factor\n", + "w = 0.012;\t\t\t# Acentric factor\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#(1)\n", + "\t\t\t#Virial equation of state%Z = 1 + (B*P)/(R*T)\n", + "Tr_1 = T/Tc;\t\t\t#Reduced temperature\n", + "B_0 = 0.083-(0.422/(Tr_1)**(1.6))\n", + "B_1 = 0.139-(0.172/(Tr_1)**(4.2)) \t\t\t# We know%(B*Pc)/(R*Tc) = B_0+(w*B_1)\n", + "B = ((B_0+(w*B_1))*(R*Tc))/Pc;\t\t\t#[m**(3)/mol]\t\t\t#second virial coefficient\n", + "Z = 1 + (B*P)/(R*T)\t\t\t#compressibility factor\n", + "\t\t\t#(P*V)/(R*T)=1+(B*P)/(R*T)%and thus%\n", + "V_1 = (Z*R*T)/P;\t\t\t#[m**(3)/mol]\n", + "print \" (1).The molar volume of methane using given virial equation is %e m**(3)/mol\"%V_1\n", + "\n", + "\t\t\t#(2).\n", + "\t\t\t#Virial equation of state%Z = 1 + (B/V)\n", + "\t\t\t#Also%Z = (P*V)/(R*T). Substituting the value of Z%we get\n", + "\t\t\t# V**(2) - ((R*T)/P)*V - ((B*R*T)/P) = 0.Solving the quadratic equation\n", + "def f(V):\n", + " global R,T,P,B\n", + " return V**(2)-((R*T)/P)*V-((B*R*T)/P)\n", + "V2_1=fsolve(f,0)\n", + "V2_2=fsolve(f,1)\n", + "\t\t\t# Out of two roots%we will consider only positive root\n", + "print \" (2).The molar volume of methane using given virial equation is %e m**(3)/mol\"%V2_2\n", + "\n", + "\t\t\t# (3)\n", + "\t\t\t# Van der Walls equation of state%\n", + "\t\t\t# (P + (a/V**(2)))*(V - b) = R*T\n", + "a_3 = (27*(R**(2))*(Tc**(2)))/(64*Pc)\t\t\t#[Pa*m**(6)/mol**(2)]\n", + "b_3 = (R*Tc)/(8*Pc)\t\t\t#[m**(3)/mol]\n", + "\t\t\t# The cubic form of van der Walls equation of state is given by%\n", + "\t\t\t# V**(3) - (b + (R*T)/P)*V**(2) + (a/P)*V - (a*b)/P = 0\n", + "\t\t\t# Solving the cubic equation\n", + "def f1(V):\n", + " global b,R,T,P,a_3\n", + " return V**(3)-(b_3+(R*T)/P)*V**(2)+(a_3/P)*V-(a_3*b_3)/P\n", + "V3_1=fsolve(f1,1)\n", + "V3_2=fsolve(f1,10)\n", + "V3_3=fsolve(f1,100)\n", + "\t\t\t# The above equation has 1 real and 2 imaginary roots. We consider only real root.\n", + "print \" (3).The molar volume of methane using van der Walls equation of state is %e m**(3)/mol\"%V3_1\n", + "\n", + "\t\t\t# (4)\n", + "\t\t\t# Redlich Kwong equation of state\n", + "a_4 = (0.42748*(R**(2))*(Tc**(2.5)))/Pc;\t\t\t#[Pa*m**(6)*K**(1/2)/mol]\n", + "b_4 = (0.08664*R*Tc)/Pc;\t\t\t#[m**(3)/mol]\n", + "\t\t\t# The cubic form of Redlich Kwong equation of state is given by%\n", + "\t\t\t# V**(3) - ((R*T)/P)*V**(2) - ((b_1**(2)) + ((b_1*R*T)/P) - (a/(T**(1/2)*P))*V - (a*b)/(T**(1/2)*P) = 0\n", + "\t\t\t# Solving the cubic equation\n", + "def f2(V):\n", + " global R,T,P,b_4,a_4\n", + " return V**(3)-((R*T)/P)*V**(2)-((b_4**(2))+((b_4*R*T)/P)-(a_4/(T**(1./2)*P)))*V-(a_4*b_4)/(T**(1./2)*P)\n", + "V4_1=fsolve(f2,1)\n", + "V4_2=fsolve(f2,10)\n", + "V4_3=fsolve(f2,100)\n", + "\t\t\t#The above equation has 1 real and 2 imaginary roots. We consider only real root.\n", + "print \" (4).The molar volume of methane using Redlich Kwong equation of state is %e m**(3)/mol\"%V4_1\n", + "\n", + "\t\t\t# (5)\n", + "\t\t\t# Using Peng-Robinson equation of state \n", + "m = 0.37464 + 1.54226*w - 0.26992*w**(2)\n", + "Tr_5 = T/Tc;\n", + "alpha = (1 + m*(1 - Tr_5**(1./2)))**(2)\n", + "a = ((0.45724*(R*Tc)**(2))/Pc)*alpha;\t\t\t#[Pa*m**(6)/mol**(2)]\n", + "b = (0.07780*R*Tc)/Pc;\t\t\t#[m**(3)/mol]\n", + "\t\t\t# Cubic form of Peng-Robinson equation of stste is given by\n", + "\t\t\t# V**(3)+(b-(R*T)/P)*V**(2)-((3*b**(2))+((2*R*T*b)/P)-(a/P))*V+b**(3)+((R*T*(b**(2))/P)-((a*b)/P)=0;\n", + "\t\t\t# Solving the cubic equation\n", + "def f3(V):\n", + " global b,R,T,P,a\n", + " return V**(3)+(b-(R*T)/P)*V**(2)-((3*b**(2))+((2*R*T*b)/P)-(a/P))*V+b**(3)+((R*T*(b**(2)))/P)-((a*b)/P)\n", + "V5_1=fsolve(f3,-1)\n", + "V5_2=fsolve(f3,0)\n", + "V5_3=fsolve(f3,1)\n", + "\t\t\t#The largest root is for vapour phase%\n", + "\t\t\t#The largest root is only considered as the systemis gas\n", + "print \" (5).The molar volume of methane using Peng-Robinson equation of state is %e m**(3)/mol\"%V5_3\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " (1).The molar volume of methane using given virial equation is 4.242974e-03 m**(3)/mol\n", + " (2).The molar volume of methane using given virial equation is 4.242930e-03 m**(3)/mol\n", + " (3).The molar volume of methane using van der Walls equation of state is 4.236938e-03 m**(3)/mol\n", + " (4).The molar volume of methane using Redlich Kwong equation of state is 4.241402e-03 m**(3)/mol\n", + " (5).The molar volume of methane using Peng-Robinson equation of state is 4.242341e-03 m**(3)/mol\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example - 2.17 Page number - 70" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 310.93;\t\t\t#[K] - Temperature\n", + "P = 2.76*10**(6)\t\t\t#[N/m**(2)] - Pressure\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "y1 = 0.8942;\t\t\t# Mole fraction of component 1 (methane)\n", + "y2 = 1-y1;\t\t\t# Mole fraction of component 2 (n-butane)\n", + "\n", + "#For component 1 (methane)\n", + "Tc_1 = 190.58;\t\t\t#[K] - Cricitical temperature\n", + "Pc_1 = 46.05;\t\t\t#[bar] - Cricitical pressure\n", + "Pc_1 = Pc_1*10**(5)\t\t\t#[N/m**(2)]\n", + "Zc_1 = 0.288;\t\t\t# Critical compressibility factor\n", + "Vc_1 = 99.1;\t\t\t#[cm**(3)/mol]\n", + "Vc_1 = Vc_1*10**(-6)\t\t\t#[m**(3)/mol]\n", + "w_1 = 0.011;\t\t\t# Acentric factor\n", + "\n", + "\t\t\t#For component 2 (n-butane)\n", + "Tc_2 = 425.18;\t\t\t#[K] - Cricitical temperature\n", + "Pc_2 = 37.97;\t\t\t#[bar] - Cricitical pressure\n", + "Pc_2 = Pc_2*10**(5)\t\t\t# [N/m**(2)]\n", + "Zc_2 = 0.274;\t\t\t# Critical compressibility factor\n", + "Vc_2 = 255.1;\t\t\t# [cm**(3)/mol]\n", + "Vc_2 = Vc_2*10**(-6)\t\t\t# [m**(3)/mol]\n", + "w_2 = 0.193;\t\t\t# Acentric factor\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# (1)\n", + "\t\t\t# Virial equation of state% Z = 1 + (B*P)/(R*T)\n", + "\t\t\t# For component 1 (methane)\n", + "Tr_1 = T/Tc_1;\t\t\t#Reduced temperature\n", + "\t\t\t# At reduced temperature\n", + "B1_0 = 0.083 - (0.422/(Tr_1)**(1.6))\n", + "B1_1 = 0.139 - (0.172/(Tr_1)**(4.2))\n", + "\t\t\t# We know%(B*Pc)/(R*Tc) = B_0+(w*B_1)\n", + "B_11 = ((B1_0+(w_1*B1_1))*(R*Tc_1))/Pc_1;\t\t\t#[m**(3)/mol]\n", + "\n", + "\t\t\t#Similarly for component 2\n", + "Tr_2 = T/Tc_2;\t\t\t#Reduced temperature\n", + "\t\t\t#At reduced temperature Tr_2%\n", + "B2_0 = 0.083 - (0.422/(Tr_2)**(1.6))\n", + "B2_1 = 0.139 - (0.172/(Tr_2)**(4.2))\n", + "B_22 = ((B2_0 + (w_2*B2_1))*(R*Tc_2))/Pc_2;\t\t\t#[m**(3)/mol]\n", + "\n", + "\t\t\t#For cross coeffcient\n", + "Tc_12 = (Tc_1*Tc_2)**(1./2)\t\t\t#[K]\n", + "w_12 = (w_1 + w_2)/2;\n", + "Zc_12 = (Zc_1 + Zc_2)/2;\n", + "Vc_12 = (((Vc_1)**(1./3)+(Vc_2)**(1./3))/2)**(3)\t\t\t#[m**(3)/mol]\n", + "Pc_12 =(Zc_12*R*Tc_12)/Vc_12;\t\t\t#[N/m**(2)]\n", + "\n", + "\t\t\t#Now we have%(B_12*Pc_12)/(R*Tc_12) = B_0+(w_12*B_1)\n", + "\t\t\t#where B_0 and B_1 are to be evaluated at Tr_12\n", + "Tr_12 = T/Tc_12;\n", + "\t\t\t#At reduced temperature Tr_12\n", + "B_0 = 0.083 - (0.422/(Tr_12)**(1.6))\n", + "B_1 = 0.139 - (0.172/(Tr_12)**(4.2))\n", + "B_12 = ((B_0+(w_12*B_1))*R*Tc_12)/Pc_12;\t\t\t#[m**(3)/mol]\n", + "\n", + "\t\t\t#For the mixture\n", + "B = y1**(2)*B_11+2*y1*y2*B_12+y2**(2)*B_22;\t\t\t#[m**(3)/mol]\n", + "Z_1 = 1+(B*P)/(R*T)\t\t\t#compressibility factor\n", + "print \" (1).The compressibility factor of mixture using Virial equation of state is %f\"%Z_1\n", + "\n", + "\t\t\t# (2)\n", + "\t\t\t# Pseudo reduced method.\n", + "T_pc = (y1*Tc_1)+(y2*Tc_2)\t\t\t#[K] - Cricitical temperature\n", + "P_pc = (y1*Pc_1)+(y2*Pc_2)\t\t\t#[N/m**(2)] - Cricitical pressure\n", + "w = (y1*w_1)+(y2*w_2)\t\t\t# Acentric factor\n", + "T_pr = T/T_pc;\t\t\t# Reduced temperature\n", + "P_pr = P/P_pc;\t\t\t# Reduced pressure\n", + "\t\t\t#At this value of Tpr%\n", + "B0 = 0.083 - (0.422/(T_pr)**(1.6))\n", + "B1 = 0.139 - (0.172/(T_pr)**(4.2))\n", + "Z0 = 1 + B0*(P_pr/T_pr)\n", + "Z1 = B1*(P_pr/T_pr)\n", + "Z = Z0 + w*Z1;\n", + "print \" (2).The compressibility factor of mixture using pseudo reduced method is %f\"%Z\n", + "\n", + "\t\t\t# (3)\n", + "\t\t\t# Redlich Kwong equation of state is given by\n", + "\t\t\t# P = ((R*T)/(V-b)) - (a/(T**(1/2)*V*(V+b)))\n", + "\t\t\t# For methane%component 1\n", + "a_1 = (0.42748*(R**(2))*(Tc_1**(2.5)))/Pc_1;\t\t\t#[Pa*m**(6)*K**(1/2)/mol]\n", + "b_1 = (0.08664*R*Tc_1)/Pc_1;\t\t\t#[m**(3)/mol]\n", + "\t\t\t#For n-butane%component 2\n", + "a_2 = (0.42748*(R**(2))*(Tc_2**(2.5)))/Pc_2;\t\t\t#[Pa*m**(6)*K**(1/2)/mol]\n", + "b_2 = (0.08664*R*Tc_2)/Pc_2;\t\t\t#[m**(3)/mol]\n", + "\t\t\t#For the mixture\n", + "a_12 = (a_1*a_2)**(1./2)\t\t\t#[Pa*m**(6)*K**(1/2)/mol]\n", + "a = y1**(2)*a_1 + 2*y1*y2*a_12 + y2**(2)*a_2;\t\t\t#[Pa*m**(6)*K**(1/2)/mol]\n", + "b = (y1*b_1) + (y2*b_2)\t\t\t#[m**(3)/mol]\n", + "\t\t\t# The cubic form of Redlich Kwong equation of state is given by%\n", + "\t\t\t# V**(3) - ((R*T)/P)*V**(2) - ((b_1**(2)) + ((b_1*R*T)/P) - (a/(T**(1/2)*P))*V - (a*b)/(T**(1/2)*P) = 0\n", + "\t\t\t# Solving the cubic equation\n", + "def f(V):\n", + " global R,T,P,b,a\n", + " return V**(3)-((R*T)/P)*V**(2)-((b**(2))+((b*R*T)/P)-(a/(T**(1./2)*P)))*V-(a*b)/(T**(1./2)*P)\n", + "V_1=fsolve(f,1)\n", + "V_2=fsolve(f,10)\n", + "V_3=fsolve(f,100)\n", + "\t\t\t# Thus compressibility factor is\n", + "Z_3 = (P*V_1)/(R*T)\t\t\t#compressibility factor\n", + "print \" (3).The compressibility factor of mixture using Redlich Kwong equation of state is %f\"%Z_3\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " (1).The compressibility factor of mixture using Virial equation of state is 0.926842\n", + " (2).The compressibility factor of mixture using pseudo reduced method is 0.937191\n", + " (3).The compressibility factor of mixture using Redlich Kwong equation of state is 0.927540\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch3_2-checkpoint.ipynb b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch3_2-checkpoint.ipynb new file mode 100644 index 00000000..1dbe2b34 --- /dev/null +++ b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch3_2-checkpoint.ipynb @@ -0,0 +1,1545 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:8255c3a74c7b52da7fb922c8e6e009ed3e07e5e50a88f1302c38a2c832cbdc1f" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 3 : The First Law and Its Applications" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 3.1 Page number - 80 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "\n", + "# Variables\n", + "V_vessel = 4.*10**(-3);\t\t\t#[m**(-3)] - Volume of vessel\n", + "T = 200+273.15;\t\t\t#[K] - Temperature\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal fas constant\n", + "P = 1.5*10**(6);\t\t\t#[Pa] - Pressure\n", + "Q = 40.*1000;\t\t\t#[J] - Heat input\n", + "\t\t\t# From steam table at 200 C,Psat=1.55549 MPa,therefore the steam is superheated.\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# (1)\n", + "\t\t\t# Using steam table,at 1.5 MPa and 200 C,\n", + "V_1 = 0.1325;\t\t\t#[m**(3)/mol] - Specific volume\n", + "U_1 = 2598.1;\t\t\t#[kJ/kg] - Specific internal energy\n", + "\t\t\t# From first law under constant pressure,\n", + "\t\t\t# Q - m*P*(V2 - V1) = m*(U2 - U1)\n", + "m = V_vessel/V_1;\t\t\t#[kg] - Mass of system\n", + "\t\t\t# Putting the values,the above equation becomes\n", + "\t\t\t# 45283*(V2 - 0.1325) + 30.1887*(U2 - 2598.1) = 40000\n", + "\t\t\t# From steam table at 700 C LHS is 33917.0 and at 800 C,it is 40925.3.\n", + "\t\t\t# Therefore the final temperature lies between 700 and 800 C\n", + "print \" 1.From steam table the final temperature lies between 700 and 800 C\";\n", + "\n", + "\t\t\t# Alternate method\n", + "\t\t\t# Here we use first law at constant pressure,\n", + "\t\t\t# Q = m*(H_2 - H_1)\n", + "H_1 = 2796.8;\t\t\t#[kJ/kg]\n", + "\t\t\t# Substituting the values,\n", + "\t\t\t# 40 = 0.0301887*(H_2 - 2796.8)\n", + "H_2 = (40/0.0301887) + 2796.9;\t\t\t#[kJ/kg]\n", + "\t\t\t# Threfore,final enthalpy is (H2) 4121.8 [kJ/kg] and pressure is 1.5 [MPa].\n", + "\t\t\t# From steam table at 1.5 [MPa]and 700 C,enthalpy is 3920.3 [kj/kg] and at 1.5 [MPa]and 800 C,enthalpy is 4152.6 [kj/kg]\n", + "print \"\\tAlternate method\";\n", + "print \"\\tBy linear interpolation we get the temperature at which enthlpy is 4121.8 kJ/kg to be 786.74 C\";\n", + "\n", + "\t\t\t# (2)\n", + "\t\t\t# Assuming ideal behaviour.\n", + "n = (P*V_vessel)/(R*T);\t\t\t#[mol] - No of moles\n", + "M = 18.015;\t\t\t# Molecular weight of water\n", + "m_2 = n*M;\t\t\t#[g] - mass of moles\n", + "Cp_1 = 7.7 + 0.04594*10**(-2)*T + 0.2521*10**(-5)*T**(2) - 0.8587*10**(-9)*T**(3);\t\t\t#[cal/mol*K] - Heat capacity at constant presure\n", + "R0 = 1.987;\t\t\t#[cal/mol*K] - universal gas constant\n", + "Cv_1 = Cp_1 - R0;\t\t\t#[cal/mol*K] - Heat capacity at constant volume\n", + "Cv_1 = Cv_1*4.184/M;\t\t\t#[J/g*K]\n", + "T1 = T;\n", + "\t\t\t# From 1st law energy balance for constant pressure, we have Q-W= m*(delta_U)\n", + "\t\t\t# Q = P*(V2 - V1)*m = m*Cv*(T2 - T1)\n", + "\t\t\t# Q = P*((T2/T1)-1)*V1*m = m*Cv*(T2-T1)\n", + "\t\t\t# But, (V1*Cv)=initial total volume of system = V_vessel\n", + "\t\t\t# Q-P((T2/T1)-1)*V_vessel = m_2*Cv_0*(T2-T1);\n", + "def f(T2): \n", + "\t return Q-P*((T2/T1)-1)*V_vessel-m_2*Cv_1*(T2-T1)\n", + "T2_1 = fsolve(f,1)\n", + "\t\t\t#The heat capacity should be evaluted at mean temperature\n", + "T_mean = (T1 + T2_1)/2;\n", + "Cp_2 = 7.7 + 0.04594*10**(-2)*T_mean+0.2521*10**(-5)*T_mean**(2) - 0.8587*10**(-9)*T_mean**(3);\t\t\t#[cal/mol*K] - Heat capacity at constant presure\n", + "Cv_2 = Cp_2-R0;\t\t\t#[cal/mol*K] - Heat capacity at constant volume\n", + "Cv_2 = Cv_2*4.184/M;\t\t\t#[J/g*K]\n", + "\t\t\t#Now again solving the equation Q=P*((T2/T1)-1)*V1*m = m*Cv*(T2-T1),for Cv=Cv_2\n", + "def f1(T2): \n", + "\t return Q-P*((T2/T1)-1)*V_vessel-m_2*Cv_2*(T2-T1)\n", + "T2_2 = fsolve(f1,1)\n", + "print \" 2).The temperature assuming ideal behaviour is %f K\"%(T2_2);\n", + "\n", + "\t\t\t# Alternate method\n", + "\t\t\t# From 1st law at constant pressure, we have Q = m*Cp(T2-T1)\n", + "T2_3 = Q/(m_2*(Cp_1*4.184/M))+T1;\n", + "\t\t\t#We can calculate the mean temperature as done above\n", + "T_mean1 = (T1 + T2_3)/2;\t\t\t#[J/g*K]\n", + "\t\t\t#The heat capacity should be evaluted at mean temperature\n", + "Cp_3 = 7.7 + 0.04594*10**(-2)*T_mean1 + 0.2521*10**(-5)*T_mean1**(2)-0.8587*10**(-9)*T_mean1**(3);\t\t\t#[cal/mol*K] - Heat capacity at constant presure\n", + "Cp_3 = Cp_3*4.184/M;\t\t\t#[J/g*K]\n", + "\t\t\t# Again solving the equation Q = m*Cp(T2-T1), for Cp=Cp_3\n", + "T2_4 = Q/(m_2*Cp_3) + T1;\n", + "print \"\\tAlternate method\";\n", + "print \"\\tThe temperature assuming ideal behaviour alternate method) is %f K\"%(T2_4);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1.From steam table the final temperature lies between 700 and 800 C\n", + "\tAlternate method\n", + "\tBy linear interpolation we get the temperature at which enthlpy is 4121.8 kJ/kg to be 786.74 C\n", + " 2).The temperature assuming ideal behaviour is 1141.732355 K\n", + "\tAlternate method\n", + "\tThe temperature assuming ideal behaviour alternate method) is 1141.738180 K\n" + ] + }, + { + "output_type": "stream", + "stream": "stderr", + "text": [ + "/usr/lib/python2.7/dist-packages/scipy/optimize/minpack.py:227: RuntimeWarning: The iteration is not making good progress, as measured by the \n", + " improvement from the last ten iterations.\n", + " warnings.warn(msg, RuntimeWarning)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 3.2 Page number - 83" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "\n", + "# Variables\n", + "V_tank = 1;\t\t\t#[m**(3)] - Volume of the tank\n", + "V_liq = 0.05;\t\t\t#[m**(3)] - Volume of saturated water\n", + "V_vap = 0.95;\t\t\t#[m**(3)] - Volume of saturated vapour\n", + "P = 1;\t\t\t#[bar] - Pressure\n", + "V_liq_sat = 0.001043;\t\t\t#[m**(3)/kg] - Specific volume of saturated water\n", + "V_vap_sat = 1.6940;\t\t\t#[m**(3)/kg] - Specific volume of saturated vapour\n", + "U_liq_sat = 417.4;\t\t\t#[kJ/kg] - Saturated liquid internal energy\n", + "U_vap_sat = 2506.1;\t\t\t#[kJ/kg] - Saturated vapour internal energy\n", + "\n", + "# Calculations\n", + "m = (V_liq/V_liq_sat) + (V_vap/V_vap_sat);\t\t\t#[kg] - Total mass of water\n", + "U_1 = (V_liq/V_liq_sat)*U_liq_sat + (V_vap/V_vap_sat)*U_vap_sat;\t\t\t#[kJ] - Total internal energy\n", + "\n", + "\t\t\t# At final state,which is saturated vapour\n", + "V = V_tank/m;\t\t\t#[m**(3)/kg] - Molar volume\n", + "\t\t\t# From saturated steam table at 8 MPa,as reported in the book V_vap = 0.02352[m**(3)/kg] and U_vap = 2569.8[kJ/kg]\n", + "\t\t\t# At 9 MPa, Vv = 0.02048[m**(3)/kg] and Uv = 2557.8[kJ/kg]\n", + "\t\t\t# Therefore final state pressure of the system (from interpolation) is 8.954 [MPa] and internal energy of saturated vapour is 2558.35 [kJ/kg]\n", + "U_2 = m*2558.35;\t\t\t#[kJ] - Final total internal energy\n", + "del_Ut = U_2 - U_1;\t\t\t#[kJ] \n", + "\t\t\t#we have, del_U = Q - W\n", + "\t\t\t#Here work done is zero because volume is rigid.\n", + "Q = del_Ut;\t\t\t#[kJ]\n", + "Q = del_Ut*10**(-3);\t\t\t#[MJ]\n", + "\n", + "# Results\n", + "print \" The amount of heat to be added is %f MJ\"%( Q);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The amount of heat to be added is 102.663530 MJ\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.3 Page number - 83" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "M_vap_sat = 0.22;\t\t\t#[kg] - mass of saturated vapour\n", + "M_liq_sat = 1.78;\t\t\t#[kg] - mass of saturated liquid\n", + "P = 700;\t\t\t#[kPa] - Pressure\n", + "\n", + "#At P=700 kPa,the systen is saturated,from steam table as reported in the book\n", + "T_sat1 = 164.97;\t\t\t#[C]\n", + "V_liq_1 = 0.001108;\t\t\t#[m**(3)/kg] \n", + "V_vap_1 = 0.2729;\t\t\t#[m**(3)/kg]\n", + "\n", + "# Calculations and Results\n", + "Vt_1 = V_liq_1*M_liq_sat + V_vap_1*M_vap_sat;\t\t\t#[m**(3)] - total volume\n", + "\n", + "\t\t\t#At final state,P = 8 MPa\n", + "T_sat2 = 295.06;\t\t\t#[C]\n", + "V_liq_2 = 0.001384;\t\t\t#[m**(3)/kg] \n", + "V_vap_2=0.02352;\t\t\t#[m**(3)/kg]\n", + "Vt_2 = Vt_1;\t\t\t# Since the volume is rigid.\n", + "\t\t\t# Since the volume of 2 kg of vapour is 0.062 [m**(3)]\n", + "V = Vt_2/2;\t\t\t#[m**(3)/kg] - specific volume\n", + "\n", + "\t\t\t# (a)\n", + "\t\t\t# From steam table at 8 [MPa]and 350 [C],V=0.02995[m**(3)/kg]; \n", + "V_1 = 0.02995;\t\t\t#[m**(3)/kg]\n", + "\t\t\t# And at 8 [MPa]and 400 [C],\n", + "V_2 = 0.03432;\t\t\t#[m**(3)/kg]\n", + "\t\t\t# By interpolation,\n", + "T = ((V-V_1)/(V_2 - V_1))*(400-350)+350;\n", + "print \" a).The final temperature is %f c\"%(T);\n", + "\n", + "\t\t\t# (b)\n", + "\t\t\t# From steam table \n", + "U_1 = 2747.7;\t\t\t#[kJ/kg]\n", + "H_1 = 2987.3;\t\t\t#[kJ/kg]\n", + "\t\t\t# And at 8 [MPa]and 400 C,\n", + "U_2 = 2863.8;\t\t\t#[kJ/kg]\n", + "H_2 = 3138.3;\t\t\t#[kJ/kg]\n", + "\t\t\t# Therefore at T = 362.01 C\n", + "U = U_1+((U_2 - U_1)/(400 - 350))*(T - 350);\n", + "print \" b).The internal energy is %f kJ/kg\"%(U);\n", + "\n", + "\t\t\t#(c)\n", + "H = H_1+((H_2 - H_1)/(400 - 350))*(T - 350);\n", + "print \" b).The enthalpy is %f kJ/kg\"%(H);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a).The final temperature is 362.072311 c\n", + " b).The internal energy is 2775.731907 kJ/kg\n", + " b).The enthalpy is 3023.758380 kJ/kg\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 3.4 Page number - 85" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "from scipy.optimize import fsolve \n", + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "# Variables\n", + "T = 300;\t\t\t#[K] - Temperature\n", + "P1 = 1;\t\t\t#[bar] - Initial pressure\n", + "P1 = P1*10**(5);\t\t\t#[N/m**(2)]\n", + "P2 = 8;\t\t\t#[bar] - Final pressure\n", + "P2 = P2*10**(5);\t\t\t#[N/m**(2)]\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "Tc = 126.2;\t\t\t#[K] - Critical temperature\n", + "Pc = 34;\t\t\t#[bar] - Critical pressure\n", + "Pc = Pc*10**(5);\t\t\t#[N/m**(2)]\n", + "w = 0.038;\t\t\t# Acentric factor\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# w = integral(Pdv)\n", + "\t\t\t# Z = 1 + (B/V)\n", + "\t\t\t# (P*V)/(R*T) = 1 + (B/V)\n", + "\t\t\t# P = (R*T)/V + (B*R*T)/V**(2)\n", + "\n", + "def f29(V): \n", + "\t return (R*T/V) + (B*R*T)/V**(2)\n", + "\n", + "\t\t\t# w = quad(f29,V1,V2)[0]\n", + "\n", + "\t\t\t# Under isothermal conditions,\n", + "\t\t\t# w = R*T*math.log(V2/V1) - B*R*T*((1/V2) - (1/V1));\n", + "\t\t\t# The second virial coefficient at state 1 is same as at state 2,as the temperature is the same i.e, T=300 [K]\n", + "Tr = T/Tc;\n", + "B_0 = 0.083 - (0.422/(Tr)**(1.6));\n", + "B_1 = 0.139 - (0.172/(Tr)**(4.2));\n", + "B = ((B_0+(w*B_1))*(R*Tc))/Pc;\t\t\t#[m**(3)/mol]\n", + "\n", + "\t\t\t# Now we have to calculate molar volume i.e V1 and V2 at given conditions\n", + "\t\t\t# At state 1,\n", + "def f(V): \n", + "\t return V**(2)-(R*T/P1)*V-(B*R*T)/P1\n", + "V_1 = fsolve(f,-1)\n", + "V_2 = fsolve(f,1)\n", + "\t\t\t# We will take root near to (R*T)/P, i.e V_2\n", + "V1 = V_2;\n", + "\n", + "\t\t\t# At state 2,\n", + "def f1(V): \n", + "\t return V**(2)-(R*T/P2)*V-(B*R*T)/P2\n", + "V_3=fsolve(f1,-1)\n", + "V_4=fsolve(f1,1)\n", + "V2 = V_4;\n", + "\t\t\t# The work done is thus,\n", + "w = R*T*math.log(V2/V1) - B*R*T*((1/V2) - (1/V1));\t\t\t#[J]\n", + "w = w*10**(-3);\t\t\t#[kJ]\n", + "\n", + "print \" The work done is %f kJ/mol\"%(w);\n", + "print \" Negative sign indicates that work is done on the gas\";\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The work done is -5.186547 kJ/mol\n", + " Negative sign indicates that work is done on the gas\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 3.5 Page number - 86" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "\n", + "T = 300;\t\t\t#[K] - Temperature\n", + "P1 = 1;\t\t\t#[bar] - Initial pressure\n", + "P1 = P1*10**(5);\t\t\t#[N/m**(2)]\n", + "P2 = 8;\t\t\t#[bar] - Final pressure\n", + "P2 = P2*10**(5);\t\t\t#[N/m**(2)]\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "y1 = 0.21;\t\t\t# Mole fraction of component 1 (oxygen)\n", + "y2 = 0.79;\t\t\t# Mole fraction of component 1 (nitroen)\n", + "\n", + "# For component 1 (Oxygen)\n", + "Tc_1 = 154.6;\t\t\t#[K]\n", + "Pc_1 = 50.43*10**(5);\t\t\t#[N/m**(2)]\n", + "Vc_1 = 73.4;\t\t\t#[cm**(3)/mol]\n", + "Zc_1 = 0.288;\n", + "w_1 = 0.022;\n", + "\n", + "\t\t\t#For component 2 (Nitrogen)\n", + "Tc_2 = 126.2;\t\t\t#[K]\n", + "Pc_2 = 34*10**(5);\t\t\t#[N/m**(2)]\n", + "Vc_2 = 89.2;\t\t\t#[cm**(3)/mol]\n", + "Zc_2 = 0.289;\n", + "w_2 = 0.038;\n", + "\n", + "# Calculations\n", + "\t\t\t#For component 1\n", + "Tr_1 = T/Tc_1;\t\t\t#Reduced temperature\n", + "\t\t\t#At reduced temperature\n", + "B1_0 = 0.083 - (0.422/(Tr_1)**(1.6));\n", + "B1_1 = 0.139 - (0.172/(Tr_1)**(4.2));\n", + "\t\t\t# We know,(B*Pc)/(R*Tc) = B_0+(w*B_1)\n", + "B_11 = ((B1_0+(w_1*B1_1))*(R*Tc_1))/Pc_1;\t\t\t#[m**(3)/mol]\n", + "\n", + "\t\t\t# Similarly for component 2\n", + "Tr_2 = T/Tc_2;\t\t\t#Reduced temperature\n", + "\t\t\t# At reduced temperature Tr_2,\n", + "B2_0 = 0.083 - (0.422/(Tr_2)**(1.6));\n", + "B2_1 = 0.139 - (0.172/(Tr_2)**(4.2));\n", + "B_22 = ((B2_0 + (w_2*B2_1))*(R*Tc_2))/Pc_2;\t\t\t#[m**(3)/mol]\n", + "\n", + "\t\t\t#For cross coeffcient\n", + "Tc_12 = (Tc_1*Tc_2)**(1/2);\t\t\t#[K]\n", + "w_12 = (w_1 + w_2)/2;\n", + "Zc_12 = (Zc_1+Zc_2)/2;\n", + "Vc_12 = (((Vc_1)**(1/3)+(Vc_2)**(1/3))/2)**(3);\t\t\t#[cm**(3)/mol]\n", + "Vc_12 = Vc_12*10**(-6);\t\t\t#[m**(3)/mol]\n", + "Pc_12 = (Zc_12*R*Tc_12)/Vc_12;\t\t\t#[N/m**(2)]\n", + "\n", + "\t\t\t# Now we have,(B_12*Pc_12)/(R*Tc_12) = B_0 + (w_12*B_1)\n", + "\t\t\t# where B_0 and B_1 are to be evaluated at Tr_12\n", + "Tr_12 = T/Tc_12;\n", + "\t\t\t# At reduced temperature Tr_12\n", + "B_0 = 0.083 - (0.422/(Tr_12)**(1.6));\n", + "B_1 = 0.139 - (0.172/(Tr_12)**(4.2));\n", + "B_12 = ((B_0+(w_12*B_1))*R*Tc_12)/Pc_12;\t\t\t#[m**(3)/mol]\n", + "\n", + "\t\t\t# For the mixture\n", + "B = y1**(2)*B_11 + 2*y1*y2*B_12+y2**(2)*B_22;\t\t\t#[m**(3)/mol]\n", + "\t\t\t# Now we have to calculate molar volume i.eV1 and V2 at given conditions\n", + "\n", + "\t\t\t# At state 1,\n", + "def f(V): \n", + "\t return V**(2)-(R*T/P1)*V-(B*R*T)/P1\n", + "V_1=fsolve(f,-1)\n", + "V_2=fsolve(f,1)\n", + "\t\t\t# We will take root near to (R*T)/P, i.e V_2\n", + "V1 = V_2;\t\t\t#[m**(3)/mol]\n", + "\n", + "\t\t\t# At state 2,\n", + "def f1(V): \n", + "\t return V**(2)-(R*T/P2)*V-(B*R*T)/P2\n", + "V_3=fsolve(f1,-1)\n", + "V_4=fsolve(f1,1)\n", + "V2 = V_4;\t\t\t#[m**(3)/mol]\n", + "\n", + "\t\t\t# Work done per mole of air is given by, w=integral(Pdv)\n", + "\t\t\t# Z = 1 + (B/V)\n", + "\t\t\t# (P*V)/(R*T) = 1 +( B/V)\n", + "\t\t\t# P = (R*T)/V+(B*R*T)/V**(2)\n", + "\n", + "def f43(V): \n", + "\t return (R*T/V)+(B*R*T)/V**(2)\n", + "\n", + "\t\t\t# w = quad(f43,V1,V2)[0]\n", + "\n", + "\t\t\t# Under isothermal conditions,\n", + "w = R*T*math.log(V2/V1)-B*R*T*((1/V2)-(1/V1));\n", + "w = w*10**(-3);\t\t\t#[kJ/mol]\n", + "\n", + "# Results\n", + "print \" The work done is %f kJ/mol\"%(w);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The work done is -5.186545 kJ/mol\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 3.6 Page number - 88" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 125+273.15;\t\t\t#[K] - Temperature\n", + "P1 = 1;\t\t\t#[bar] - Initial pressure\n", + "P1 = P1*10**(5);\t\t\t#[N/m**(2)]\n", + "P2 = 60;\t\t\t#[bar] - Final pressure\n", + "P2 = P2*10**(5);\t\t\t#[N/m**(2)]\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "Tc = 416.3;\t\t\t#[K] - Critical temperature\n", + "Pc = 66.80*10**(5);\t\t\t#[N/m**(2)] - Critical pressure\n", + "\n", + "\t\t\t# (1)\n", + "\t\t\t# Virial equation of state, Z = 1 + (B/V)+(C/V**(2))\n", + "\t\t\t# (P*V)/(R*T) = 1 + (B/V)+(C/V**(2))\n", + "\t\t\t# P = (R*T)/V+(B*R*T)/V**(2)+(C*R*T)/V**(3)\n", + "\t\t\t# w = integral(PdV)=R*T*math.log(V2/V1)-(B*R*T)*(1/V2-1/V1)-(C*R*T/2)*(1/V2**(2)-1/V1**(2))\n", + "\n", + "B = -207.5;\t\t\t#[cm**(3)/mol] - Second virial coefficient\n", + "B = -207.5*10**(-6);\t\t\t#[m**(3)/mol]\n", + "C = 18200;\t\t\t#[cm**(6)/mol**(2)] - Third virial coefficient\n", + "C = 18200*10**(-12);\t\t\t#[m**(6)/mol**(2)]\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# We need to calculate molar volume at state 1 and 2,\n", + "\t\t\t# At state 1,P = P1,\n", + "\t\t\t# V**(3)-(R*T/P)*V**(2)-(B*R*T/P)*V-(C*R*T/P)=0\n", + "\t\t\t# Solving the cubic equation\n", + "def f1(V): \n", + "\t return V**(3)-(R*T/P1)*V**(2)-(B*R*T/P1)*V-(C*R*T/P1)\n", + "V_1=fsolve(f1,-1)\n", + "V_2=fsolve(f1,0)\n", + "V_3=fsolve(f1,10)\n", + "\t\t\t# The cubic equation has only 1 real root,other two roots are imaginary.\n", + "V1 = V_3;\n", + "\n", + "\t\t\t# Similarly at state 2,P=P2\n", + "\t\t\t# V**(3) - (R*T/P)*V**(2) - (B*R*T/P)*V - (C*R*T/P) = 0\n", + "\t\t\t# Solving the cubic equation\n", + "def f2(V): \n", + "\t return V**(3)-(R*T/P2)*V**(2)-(B*R*T/P2)*V-(C*R*T/P2)\n", + "V_4=fsolve(f2,-1)\n", + "V_5=fsolve(f2,0)\n", + "V_6=fsolve(f2,1)\n", + "V2 = V_6;\n", + "\t\t\t# Finally work done is given by,\n", + "w1 = R*T*math.log(V2/V1)-(B*R*T)*(1/V2-1/V1)-(C*R*T/2)*(1/V2**(2)-1/V1**(2));\t\t\t#[J/mol]\n", + "w1 = w1*10**(-3);\t\t\t#[kJ/mol]\n", + "print \" 1).The work done using given virial equation of state is %f kJ/mol\"%(w1);\n", + "\n", + "\t\t\t# (2)\n", + "\t\t\t# Virial equation of state, Z = 1+(B*P)/(R*T)+((C-B**(2))/(R*T)**(2))*P**(2)\n", + "\t\t\t# (P*V)/(R*T)= 1+(B*P)/(R*T)+((C-B**(2))/(R*T)**(2))*P**(2)\n", + "\t\t\t# V = (R*T)/P+B+((C-B**(2))/(R*T))*P\n", + "\t\t\t# Differentiating both sides by P and integrating we get,\n", + "\t\t\t# w = integral(PdV)=-(R*T)*math.log(P2/P1)+((C-B**(2))/(2*R*T))*(P2**(2)-P1**(2))\n", + "w2 = -(R*T)*math.log(P2/P1) + ((C-B**(2))/(2*R*T))*(P2**(2)-P1**(2));\t\t\t#[J/mol]\n", + "w2 = w2*10**(-3);\t\t\t#[kJ/mol]\n", + "print \" 2).The work done using given virial equation of state is %f kJ/mol\"%(w2);\n", + "\n", + "\t\t\t# (3)\n", + "\t\t\t# Van der Walls equation of state is given by,\n", + "a = (27*(R**(2))*(Tc**(2)))/(64*Pc);\t\t\t#[Pa*m**(6)/mol**(2)]\n", + "b = (R*Tc)/(8*Pc);\t\t\t#[m**(3)/mol]\n", + "\t\t\t# P = ((R*T)/(V-b))-a/(V**(2));\t\t\t#[N/m**(2)]\n", + "\t\t\t# w = integral(PdV)=R*T*math.log((V2-b)/(V1-a))+a*(1/V2-1/V1)\n", + "\t\t\t# The cubic form of van der Walls equation of state is given by,\n", + "\t\t\t# V**(3) - (b+(R*T)/P)*V**(2) + (a/P)*V - (a*b)/P = 0\n", + "\t\t\t# Solving the cubic equation for P=P1\n", + "def f3(V): \n", + "\t return V**(3)-(b+(R*T)/P1)*V**(2)+(a/P1)*V-(a*b)/P1\n", + "V2_1=fsolve(f3,1)\n", + "V2_2=fsolve(f3,10)\n", + "V2_3=fsolve(f3,100)\n", + "\t\t\t# The above equation has 1 real and 2 imaginary roots. We consider only real root (V2_3).\n", + "\n", + "\t\t\t# Similarly at state 2,for P=P2,\n", + "def f4(V): \n", + "\t return V**(3)-(b+(R*T)/P2)*V**(2)+(a/P2)*V-(a*b)/P2\n", + "V2_4=fsolve(f4,1)\n", + "V2_5=fsolve(f4,10)\n", + "V2_6=fsolve(f4,100)\n", + "\t\t\t# The above equation has 1 real and 2 imaginary roots. We consider only real root (V2_6).\n", + "\t\t\t# Finally work done is given by\n", + "w3 = R*T*math.log((V2_6-b)/(V2_3-b))+a*(1/V2_6-1/V2_3);\t\t\t#[J/mol]\n", + "w3 = w3*10**(-3);\t\t\t#[kJ/mol]\n", + "print \" 3).The work done using van der Walls equation of state is %f kJ/mol\"%(w3);\n", + "\n", + "\t\t\t# (4)\n", + "\t\t\t# Redlich Kwong equation of state,\n", + "a_1 = (0.42748*(R**(2))*(Tc**(2.5)))/Pc;\t\t\t#[Pa*m**(6)*K**(1/2)/mol]\n", + "b_1 = (0.08664*R*Tc)/Pc;\t\t\t#[m**(3)/mol]\n", + "\t\t\t# P = ((R*T)/(V-b_1))-(a_1/(T**(1/2)*V*(V+b_1)));\t\t\t#[N/m**(2)]\n", + "\t\t\t# Work done is given by\n", + "\n", + "def f4(V): \n", + "\t return (V2-b)/(V1-b)-a/T**(1./2)*integrate(1/V*(V+b))\n", + "\n", + "\t\t\t# w = R*T*math.log((V2-b)/(V1-b))-a/T**(1/2)* quad(f4,V1,V2)[0]\n", + "\n", + "\t\t\t# Using the factorization 1/(V*(V+b))=(1/b)*((1/V)-(1/V+b)),we get\n", + "\t\t\t# w = R*T*math.log((V2-b)/(V1-b))-(a/(b*T**(1/2)))*(math.log(V2/V1)-math.log((V2+b)/(V1+b))\n", + "\t\t\t# Now we have calculate V1 and V2,\n", + "\t\t\t# The cubic form of Redlich Kwong equation of state is given by,\n", + "\t\t\t# V**(3) - ((R*T)/P)*V**(2) - ((b_1**(2)) + ((b_1*R*T)/P) - (a/(T**(1/2)*P))*V - (a*b)/(T**(1/2)*P) = 0\n", + "\t\t\t# Solving the cubic equation at state 1,\n", + "def f5(V): \n", + "\t return V**(3)-((R*T)/P1)*V**(2)-((b_1**(2))+((b_1*R*T)/P1)-(a_1/(T**(1./2)*P1)))*V-(a_1*b_1)/(T**(1./2)*P1)\n", + "V3_1=fsolve(f5,1)\n", + "V3_2=fsolve(f5,10)\n", + "V3_3=fsolve(f5,100)\n", + "\t\t\t# The above equation has 1 real and 2 imaginary roots. We consider only real root (V3_3).\n", + "\n", + "\t\t\t# Similarly at state 2,for P = P2,\n", + "def f6(V): \n", + "\t return V**(3)-((R*T)/P2)*V**(2)-((b_1**(2))+((b_1*R*T)/P2)-(a_1/(T**(1./2)*P2)))*V-(a_1*b_1)/(T**(1./2)*P2)\n", + "V3_4=fsolve(f6,1)\n", + "V3_5=fsolve(f6,10)\n", + "V3_6=fsolve(f6,100)\n", + "\t\t\t# The above equation has 1 real and 2 imaginary roots. We consider only real root (V3_6).\n", + "\t\t\t# Finally work done is given by\n", + "w4 = R*T*math.log((V3_6-b_1)/(V3_3-b_1))-(a_1/(b_1*T**(1./2)))*(math.log(V3_6/V3_3)-math.log((V3_6+b_1)/(V3_3+b_1)));\t\t\t#[J/mol]\n", + "w4 = w4*10**(-3);\t\t\t#[kJ/mol]\n", + "print \" 3).The work done using Redlich Kwong equation of state is %f kJ/mol\"%(w4);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The work done using given virial equation of state is -13.848149 kJ/mol\n", + " 2).The work done using given virial equation of state is -13.688301 kJ/mol\n", + " 3).The work done using van der Walls equation of state is -14.802420 kJ/mol\n", + " 3).The work done using Redlich Kwong equation of state is -14.704965 kJ/mol\n" + ] + }, + { + "output_type": "stream", + "stream": "stderr", + "text": [ + "/usr/lib/python2.7/dist-packages/scipy/optimize/minpack.py:227: RuntimeWarning: The iteration is not making good progress, as measured by the \n", + " improvement from the last five Jacobian evaluations.\n", + " warnings.warn(msg, RuntimeWarning)\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 3.8 Page number - 93" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T = 20 + 273.15;\t\t\t#[K] - Temperature\n", + "P_1 = 140.;\t\t\t#[kPa] - Initial pressure\n", + "P_1 = P_1*10.**(3);\t\t\t#[Pa]\n", + "P_2 = 560.;\t\t\t#[kPa] - Final pressure\n", + "P_2 = P_2*10.**(3);\t\t\t#[Pa]\n", + "R = 1.987;\t\t\t#[cal/mol*K] - Universal gas constant\n", + "\n", + "# Calculations\n", + "\t\t\t# Cp_0 = 1.648+4.124*10**(-2)*T - 1.53*10**(-5)*T**(2) + 1.74*10**(-9)*T**(3)\n", + "\t\t\t# Using adiabatic compression, P*V**(Y)=constant. For ideal gases\n", + "\t\t\t# P*(R*T/P)**(Y) = constant\n", + "\t\t\t# P**(1-Y)*T**(Y) = constant or,P1**(1-Y)*T1**(Y)=P2**(1-Y)*T2**(Y)\n", + "\t\t\t# Now,at state 1, i.e at T=20[C]\n", + "Cp_1 = 1.648+4.124*10**(-2)*T-1.53*10**(-5)*T**(2)+1.74*10**(-9)*T**(3);\t\t\t#[cal/mol*K] - Heat capacity at constant pressure\n", + "Cv_1 = Cp_1 - R;\t\t\t#[cal/mol*K] - Heat capacity at constant volume\n", + "Y1 = Cp_1/Cv_1;\t\t\t# Ratio of heat capacities\n", + "\n", + "\t\t\t# Now calculatung the temperature at state 2 (T2)\n", + "\t\t\t# (T2/T1)=(P1/P2)**((1-Y1)/Y1)\n", + "T_1 = T;\n", + "T_2 = ((P_1/P_2)**((1-Y1)/Y1))*T_1;\t\t\t#[K]\n", + "\n", + "\t\t\t# Now calculating the mean temperature\n", + "T_mean = (T_1 + T_2)/2;\t\t\t#[K]\n", + "\t\t\t# At mean temperature\n", + "Cp_2 = 1.648+4.124*10**(-2)*T_mean - 1.53*10**(-5)*T_mean**(2) + 1.74*10**(-9)*T_mean**(3);\t\t\t#[cal/mol*K] - Heat capacity at constant pressure\n", + "Cv_2 = Cp_2 - R;\t\t\t#[cal/mol*K] - Heat capacity at constant volume\n", + "Y2 = Cp_2/Cv_2;\n", + "\n", + "\t\t\t# Calculating exit temperature\n", + "\t\t\t# Again using the realation,(T2/T1)=(P1/P2)**((1-Y1)/Y1)\n", + "T_exit = ((P_1/P_2)**((1-Y2)/Y2))*T_1;\t\t\t#[K]\n", + "\t\t\t# Since value of mean temperature has not changed much the molar heat capacity ratio can be assumed to be same.Therefore\n", + "\t\t\t# w = -delta(U)=Cv_0*(T2-T1)\n", + "w = Cv_2*(T_1 - T_exit);\t\t\t#[cal/mol]\n", + "w = w*4.184;\t\t\t#[J/mol]\n", + "\n", + "# Results\n", + "print \" The work done for adiabatic compression is %f J/mol\"%(w);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The work done for adiabatic compression is -3198.427072 J/mol\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 3.9 Page number - 93" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "m_ice = 1000;\t\t\t#[g] - Mass of ice\n", + "m_water = 1000;\t\t\t#[g] - Mass of water\n", + "T_ice = 273.15;\t\t\t#[K] - Temperature of ice\n", + "T_water = 373.15;\t\t\t#[K] - Temperature of water\n", + "L = 79.71;\t\t\t#[cal/g] - Latent heat of melting of ice.\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#(1)\n", + "Cp_1 = 1;\t\t\t#[cal/g-K] - Heat capacity at constant pressure\n", + "\t\t\t# Let the final temperature be T\n", + "\t\t\t# We assume that all of the ice melts.Energy taken up by ice is\n", + "\t\t\t# E1 = L*m_ice + m_ice*Cp_1*(T - T_ice)\n", + "\t\t\t# Energy given by hot water is,\n", + "\t\t\t# E2 = m_water*Cp_1*(T_water - T)\n", + "\t\t\t# No heat exchange with surrounding.Solving for T\n", + "T_1 = (m_ice*Cp_1*T_ice + m_water*Cp_1*T_water - L*m_ice)/(m_ice*Cp_1 + m_water*Cp_1);\t\t\t#[K]\n", + "T_1 = T_1 - 273.15;\t\t\t#[C]\n", + "\n", + "print \" 1).The final temperature taking Cp_water = 1 cal/g-K) is %f C\"%(T_1);\n", + "\t\t\t#Since the final temperature is greater than 273.15 K,so our assumption that all of ice melts is correct\n", + "\n", + "\t\t\t# (2)\n", + "\t\t\t# Cp_2 = 1.00874-0.7067*10**(-3)*T+15.93*10**(-6)*T**(2)-83.8*10**(-9)*T**(3);\n", + "\n", + "def f15(T): \n", + "\t return Cp_2\n", + "\n", + "\t\t\t# From energy balance,we get L*m_ice + m_ice* quad(f15,0,T) + m_water*integrate(Cp_2)[0]\n", + "\n", + "\t\t\t# On putting the values and then simplifying we get\n", + "\t\t\t# 2.01748*T - 0.0007067*T**(2) + 1.062*10**(-5)*T**(3) - 4.19*10**(-8)*T**(4) - 20.8455 = 0\n", + "\t\t\t# Solving the above equation we get\n", + "def f1(T): \n", + "\t return 2.01748*T - 0.0007067*T**(2) + 1.062*10**(-5)*T**(3) - 4.19*10**(-8)*T**(4) - 20.8455\n", + "T_0 = fsolve(f1,1)\n", + "print \" 2).The final temperature using specific heat capacity equation is %f C\"%(T_0);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The final temperature taking Cp_water = 1 cal/g-K) is 10.145000 C\n", + " 2).The final temperature using specific heat capacity equation is 10.364452 C\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 3.11 Page number - 97" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "n = 1.5;\t\t\t# - ratio of heat capacities\n", + "T_1 = 500.;\t\t\t#[K] - Initial temperature\n", + "T_2 = 1000.;\t\t\t#[K] - Final temperature\n", + "P_1 = 1.;\t\t\t#[bar] - Initial pressure\n", + "P_1 = P_1*10.**(5);\t\t\t#[Pa]\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# The compression path is given by, P*V**(1.5) = constant\n", + "\t\t\t# P*(R*T/P)**(1.5) = constant\n", + "\t\t\t# P1**(-0.5)*T1**(1.5) = P2**(-0.5)*T2**(1.5)\n", + "P_2 = P_1*(T_1/T_2)**(-3);\t\t\t#[Pa]\n", + "P_2_final = P_2*10**(-5);\t\t\t#[bar] - Final pressure in bar\n", + "print \" The final pressure is %f bar\"%(P_2_final);\n", + "\n", + "\t\t\t# From first law q - w = delta(U). \n", + "\t\t\t# First w and delta(U) are calculated and thereafter heat exchange is determined.\n", + "V_1 = R*T_1/P_1;\t\t\t#[m**(3)/mol] - Initial volume\n", + "V_2 = R*T_2/P_2;\t\t\t#[m**(3)/mol] - Final volume\n", + "w = ((P_1*V_1)/(n - 1))*(1 - (P_2/P_1)**(1 - 1/n));\t\t\t#[J/mol] - work done\n", + "\n", + "\t\t\t# Mean temperature is given by,\n", + "T_mean = (T_1 + T_2)/2;\t\t\t#[K]\n", + "\n", + "\t\t\t#Now, heat capacity at T_mean is given by,\n", + "Cp_0 = R*(3.3 + 0.63*10**(-3)*T_mean);\t\t\t#[J/mol*K]\n", + "Cv_0 = Cp_0 - R;\t\t\t#[J/mol*K]\n", + "\t\t\t#Therefore delta(U) is given by\n", + "del_U = Cv_0*(T_2 - T_1);\t\t\t#[J/mol] - Change in internal energy\n", + "q = w + del_U;\t\t\t#[J/mol] - heat change\n", + "print \" The amount of heat supplied to the system is %f J/mol\"%(q);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The final pressure is 8.000000 bar\n", + " The amount of heat supplied to the system is 3211.282500 J/mol\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 3.12 Page number - 99" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "P_1 = 150*10**(3);\t\t\t#[Pa] - Initial pressure\n", + "V_1 = 0.001;\t\t\t#[m**(3)] - Initial volume\n", + "P_2 = 1000*10**(3);\t\t\t#[Pa] - Final pressure\n", + "V_2 = 0.003;\t\t\t#[m**(3)] - Final volume\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# At x = 0, Vt(total volume) = 0.001 m**(3), therefore x = (V_t - V_1)/A; where A is area of cross section and x is length\n", + "\t\t\t# Force exerted b sprig is given by, F = Ps*A = k*x = k*(V_t - V_1)/A\n", + "\t\t\t# Ps = (k/A**(2))*(V_t - V_1)\n", + "\t\t\t# Total pressure = Initial pressre + Pressre due to spring\n", + "\t\t\t# P = P_1 + (k/A**(2))*(V_t - V_1)\n", + "\t\t\t# Let (k/A**(2)) = t (say)\n", + "\t\t\t# At state 2, i.e at P2 and V_t = V_2.\n", + "def f(t): \n", + "\t return P_2-P_1 - t*(V_2-V_1)\n", + "t = fsolve(f,1000)\n", + "\t\t\t# Therefore,pressure is related to total volume as P = P_1-t*(V_t - V_1)\n", + "\n", + "\t\t\t# (a)\n", + "\t\t\t#slope = (k/A**(2))\n", + "print \" a).The slope of the line on P-Vt diagram is %e N/m**5)\"%(t);\n", + "\n", + "\t\t\t# (b)\n", + "\t\t\t# Work done by the gas is given by w=integral(PdVt)\n", + "\n", + "def f30(V_t): \n", + "\t return P_1+t*(V_t-V_1)\n", + "\n", + "w = quad(f30,V_1,V_2)[0]\n", + "\n", + "w = w*10**(-3);\t\t\t#[kJ]\n", + "print \" b).The work done by gas is %f kJ\"%(w);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a).The slope of the line on P-Vt diagram is 4.250000e+08 N/m**5)\n", + " b).The work done by gas is 1.150000 kJ\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 3.13 Page number - 99" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "V = 36;\t\t\t#[L] - Vol of gas on each side\n", + "P_1 = 1;\t\t\t#[atm] - pressure on left side of the piston\n", + "P_1 = P_1*101325;\t\t\t#[Pa]\n", + "T = 273.15;\t\t\t#[K]\n", + "P_2 = 3.375;\t\t\t#[atm] - Pressure on right side of the piston\n", + "P_2 = P_2*101325;\t\t\t#[Pa]\n", + "Y = 1.44;\t\t\t# Ratio of heat capacities\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constnt\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# (a)\n", + "\t\t\t# For total system, del(U_total) = Q. \n", + "\t\t\t# Onto gas on right hand side no heat is supplied,as the piston is non conducting. Therefore,for gas on the right hand side, del(U) = -W.\n", + "\t\t\t# As heat is slowly supplied to the left hand side,expansion on right hand side is slow and process is adiabatic.\n", + "\t\t\t# For gas on right hand side, PV**(Y) = constant.\n", + "\t\t\t# T_2/T_1 = (P_2/P_1)**((Y - 1)/Y)\n", + "T_right = T*(P_2/P_1)**((Y - 1)/Y);\t\t\t#[K]\n", + "\n", + "Cv_0 = R/(Y-1);\t\t\t#[J/mol*K] - Heat capacity at constant volume.\n", + "\t\t\t# Now work done on the gas on right hand side is given by\n", + "\t\t\t# W = (P_1*V_1 - P_2*V_2)/(Y - 1) = R*(T_2 - T_1)/(Y - 1) = Cv_0*(T_1 - T_2)\n", + "W_left = Cv_0*(T - T_right);\t\t\t#[J/mol]\n", + "\t\t\t# Negative sign for the work done on LHS gas implies work is done on the gas\n", + "\n", + "\t\t\t# For right hand side of the gas\n", + "\t\t\t# P*Vt = n*R*T\n", + "n = P_1*(V*10**(-3))/(R*T);\t\t\t# number of moles\n", + "W_right = (-W_left)*n;\t\t\t#[J] - We used negative sign for 'W_left' because it is negative in magnitude.\n", + "W_right = W_right/1000;\t\t\t#[kJ]\n", + "print \" a).Total work done on gas on the right hand side is %f kJ\"%(W_right);\n", + "\n", + "\t\t\t#(b)\n", + "print \" b).The final temperature of the gas on right side is %f K\"%(T_right);\n", + "\n", + "\t\t\t# (c)\n", + "\t\t\t# Pressure is same on both sides as piston is frictionless.\n", + "\t\t\t# The number of moles on both sides are also same as they have same temperature,presure and volume.\n", + "\t\t\t# We have (P_left*V_left)/T_left = (P_right*V_right)/T_right.\n", + "\t\t\t# Since P_left = P_right, (V_left/T_left) = (V_right/T-right) and also P*V**(Y) = constant.\n", + "V_right = V*(P_1/P_2)**(1/Y);\t\t\t#[L] - The total volume on right side \n", + "\n", + "\t\t\t# The total volume on right side can also be calculated using P2*V2 = n*R*T2.\n", + "\t\t\t# Since total volume = 72 [L], therefore volume of left side is\n", + "V_left = 2*V - V_right;\t\t\t#[L]\n", + "T_left = T_right*(V_left/V_right);\n", + "print \" c).Final temperature of the gas on the left side is %f K\"%(T_left);\n", + "\n", + "\t\t\t#(d)\n", + "\t\t\t#The first law applied to the total system (left side and right side) gives.\n", + "\t\t\t#Q - W = del(U_left) + del(U_right)\n", + "\t\t\t#There is no net work done by the total system as the cylinder is closed at both ends.\n", + "Q = n*Cv_0*(T_left-T) + n*Cv_0*(T_right-T);\t\t\t#[J]\n", + "Q = Q/1000;\t\t\t#[kJ]\n", + "print \" d).Amount of heat added to the gas on the left side is %f kJ\"%(Q);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a).Total work done on gas on the right hand side is 3.731958 kJ\n", + " b).The final temperature of the gas on right side is 396.112176 K\n", + " c).Final temperature of the gas on the left side is 1447.650324 K\n", + " d).Amount of heat added to the gas on the left side is 39.378580 kJ\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 3.14 Page number - 105" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "P_2 = 0.2;\t\t\t#[bar]\n", + "P_2 = P_2*10**(5);\t\t\t#[Pa]\n", + "int_dia_2 = 2.4*10**(-2);\t\t\t#[m] - internal diameter at state 2.\n", + "Q = 5*10**(-3);\t\t\t#[cubic metre/s] - Flow rate at point 2.\n", + "den = 1000;\t\t\t#[kg/cubic metre] - density\n", + "delta_z = 1;\t\t\t#[m] - Difference in height\n", + "g = 9.81;\t\t\t#[m/s**(2)] - Acceleration due to gravity\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# (1)\n", + "\t\t\t# Pressure at state 1 is atmospheric pressure and at state 2 is gauze pressure at state 2 + atmospheric pressure,thus\n", + "\t\t\t# (delta(P)/den) = (P2-P1)/den = P2/den\n", + "Vel_2 = Q/(3.14*(int_dia_2/2)**(2));\t\t\t#[m/s] - Velocity of water at state 2.\n", + "\t\t\t# Velocity at state 1 i negligible as compared to velocity at state 2,because the diameter of reservoir is very large as compared to diameter of pipe at state 2\n", + "\n", + "\t\t\t# From bernaulli equation we get,\n", + "\t\t\t# -w = (delta(P)/den) + delta(v**(2))/2 + g*delta_z\n", + "w = -((P_2/den )+ (Vel_2**(2)/2) + (g*delta_z));\t\t\t#[J/kg]\n", + "\t\t\t# w multiplied by m = (den*Q), will give the fluid power.\n", + "m = den*Q;\t\t\t#[kg/s]\n", + "W_net = m*w;\t\t\t#[Watt]\n", + "print \" 1).The fluid power is %f Watt\"%(W_net);\n", + "\n", + "\t\t\t#(2)\n", + "\t\t\t# Total discharge head developed by the pump is given by\n", + "\t\t\t# h = (delta(P)/den*g) + (Vel_2**(2)/2*g) + delta_z\n", + "h = (P_2/(den*g)) + (Vel_2**(2)/(2*g)) + delta_z;\t\t\t#[m]\n", + "print \" 2).Total discharge head developed by the pump is given by h = %f m\"%(h);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The fluid power is -454.750210 Watt\n", + " 2).Total discharge head developed by the pump is given by h = 9.271156 m\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 3.15 Page number - 106" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T_1 = 1000.;\t\t\t#[K] - Temperature at entry\n", + "P_1 = 0.6;\t\t\t#[MPa] - Pressure at entry\n", + "P_2 = 0.2;\t\t\t#[MPa] - Exit pressure\n", + "Vel_1 = 50.;\t\t\t#[m/s] - Entry velocity \n", + "Y = 1.4;\t\t\t# Ratio of heat capacities\n", + "Mol_wt = 28.;\t\t\t#[g/mol] - Molecular weight of air\n", + "Cp = 29.099;\t\t\t#[J/mol-K] - Specific heat capacity at constant pressure\n", + "Cp = (Cp/Mol_wt)*1000;\t\t\t#[J/kg-K]\n", + "\n", + "# Calculations\n", + "\t\t\t# We know that for a flow process \n", + "\t\t\t# delta_H + delta_V**(2)/2 + delta_(g*z) = q - w\n", + "\t\t\t# Since process is adiabatic,therefore q = 0 and since no work is done by the gas, therefore w = 0\n", + "\t\t\t# Assuming there is no change in the potenial energy between entry and exit, we have\n", + "\t\t\t# delta_H + delta_V**(2)/2 = 0\n", + "\n", + "\t\t\t# For a reversible process P*V**(Y) = constant and thus (T_2/T_1) = (P_2/P_1)**((Y-1)/Y)\n", + "T_2 = T_1*(P_2/P_1)**((Y-1)/Y);\t\t\t#[K] - Exit temperature\n", + "\n", + "\t\t\t# delta_H + delta_V**(2)/2 = 0\n", + "\t\t\t# Vel_2**(2)/2 - Vel_1**(2)/2 - (H_1 - H_2)= 0\n", + "\t\t\t# Vel_2**(2)/2 - Vel_1**(2)/2 - Cp*(T_1 - T_2) = 0\n", + "Vel_2_square = 2*(Vel_1**(2.)/2 - Cp*(T_2 - T_1));\t\t\t#[m**(2)/s**(2)]\n", + "Vel_2 = (Vel_2_square)**(1./2);\t\t\t#[m/s]\n", + "\n", + "# Results\n", + "print \" The discharge velocity is %f m/s\"%(Vel_2);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The discharge velocity is 749.965327 m/s\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 3.16 Page number - 107" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "P_entry = 10;\t\t\t#[bar] - Pressure at entry\n", + "V_entry = 200;\t\t\t#[m/s] - Velocity at entry\n", + "P_exit = 1;\t\t\t#[bar] - Vressure at exit\n", + "V_exit = 800;\t\t\t#[m/s] - Velocity at exit\n", + "g = 9.81;\t\t\t#[m/s**(2)] - Acceleration due to gravity\n", + "\n", + "# Calculations\n", + "\t\t\t#Heat balance gives\n", + "\t\t\t# delta_H + (delta_V**(2))/2 + g*delta_z = q - w\n", + "\t\t\t#delta_H = q - w - (delta_V**(2))/2 \n", + "\t\t\t#From nozzle no work is extracted,therefore\n", + "delta_H = -(V_exit**(2)- V_entry**(2))/2;\t\t\t#[J/kg]\n", + "delta_H = delta_H*10**(-3);\t\t\t#[kJ/kg]\n", + "\n", + "# Results\n", + "print \" The change in enthalpy per kg of steam is %f kJ/kg\"%(delta_H);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The change in enthalpy per kg of steam is -300.000000 kJ/kg\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 3.17 Page number - 111" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T_1 = 280;\t\t\t#[K] - Temperature at entry\n", + "P_1 = 100;\t\t\t#[kPa] - Pressure at entry\n", + "T_2 = 400;\t\t\t#[K] - Temperature at exit\n", + "P_2 = 600;\t\t\t#[kPa] - Pressure at exit\n", + "m = 0.02;\t\t\t#[kg/s] - Mass flow rate\n", + "m = m*10**(3);\t\t\t#[g/s]\n", + "heat_loss = 16;\t\t\t#[kJ/kg]\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#Cp_0 = 28.11 + 0.1967*10**(-2)*T + 0.4802*10**(-5)*T**(2) - 1.966*10**(-9)*T**(3)\n", + "\t\t\t#delta_H = q - w (neglecting kinetic and potential changes)\n", + "\t\t\t#delta_H = integral(Cp_0*dT)\n", + "\n", + "def f22(T): \n", + "\t return 28.11 + 0.1967*10**(-2)*T + 0.4802*10**(-5)*T**(2) - 1.966*10**(-9)*T**(3)\n", + "\n", + "delta_H = quad(f22,T_1,T_2)[0]\n", + "\n", + "print \" Change in enthalpy is %f J/mol\"%(delta_H);\n", + "\n", + "\t\t\t#Molecular weight of air(21 vol% O2 and 79 vol% N2)=(0.21*32)+(0.79*28)= 28.84 g/mol\n", + "Mol_wt = 28.84;\t\t\t#[g/mol]\n", + "q = - (heat_loss*Mol_wt);\t\t\t#[J/mol]\n", + "w = q - delta_H;\t\t\t#[J/mol]\n", + "print \" The work done per mole of air is %f J/mol\"%(w);\n", + "\t\t\t#the negative sign implies that work is done on the compressor.\n", + "\n", + "n = m/Mol_wt;\t\t\t#[mol/s] - Mole flow rate\n", + "W_net = delta_H*n;\t\t\t#[W]\n", + "W_net = -W_net*10**(-3);\t\t\t#[kW]\n", + "print \" And the necessary power input to the compressor is %f kW\"%(W_net);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Change in enthalpy is 3511.197066 J/mol\n", + " The work done per mole of air is -3972.637066 J/mol\n", + " And the necessary power input to the compressor is -2.434949 kW\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 3.18 Page number - 112" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T_1 = 300;\t\t\t#[K] - Temperature at entry\n", + "P_1 = 100;\t\t\t#[kPa] - Pressure at entry\n", + "P_2 = 900;\t\t\t#[kPa] - Pressure at exit\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# (a)\n", + "\t\t\t# Reversible adiabatic compression\n", + "Y = 1.4;\t\t\t#Ratio of specific heat capacities\n", + "\t\t\t# For ideal gas, P*V**(Y)= constant and it takes the form of (T_2/T_1) = (P_2/P_1)**((Y-1)/Y)\n", + "T_2 = T_1*(P_2/P_1)**((Y - 1)/Y);\t\t\t#[K]\n", + "\t\t\t# The work exchange for adiabatic process is given by\n", + "\t\t\t# W_adia = -delta_H = -Cp*(T2-T1) = Cp*(T1-T2) = ((Y*R)/(Y-1))*(T1-T2)\n", + "W_adia = ((Y*R)/(Y - 1))*(T_1 - T_2);\t\t\t#[J/mol] -work done\n", + "\t\t\t# Molecular weight of air(21 vol% O2 and 79 vol% N2)=(0.21*32)+(0.79*28)= 28.84 g/mol\n", + "Mol_wt = 28.84;\t\t\t#[g/mol]\n", + "W_adia = W_adia/Mol_wt;\t\t\t#[J/g]\n", + "print \" a).The compressor work done for reversible adiabatic compession is %f J/g\"%(W_adia);\n", + "\n", + "\t\t\t#(b)\n", + "\t\t\t#Isothermal compression\n", + "\t\t\t#W_iso = -integral(V*dP) = -integral((R*T/P)*dP) = R*T*ln(P_2/P_1)\n", + "W_iso = -R*T_1*math.log(P_2/P_1);\t\t\t#[J/mol]\n", + "W_iso = W_iso/Mol_wt;\t\t\t#[J/g]\n", + "print \" b).The compressor work done for isothermal compession is %f J/g\"%(W_iso);\n", + "\t\t\t#Note that in isothermal compression between the same states work done is less as compared to reversible adiabatic compression.\n", + "\n", + "\t\t\t#(c)\n", + "\t\t\t#Ideal two-stage compression \n", + "n = 1.3;\t\t\t#Polytropic exponent.\n", + "\t\t\t#Minimum work done in two stage compression is given by\n", + "\t\t\t#W_comp = ((2*n*R*T_1)/(n-1))*[1-(P_x/P_1)**(n-1)/n]\n", + "\t\t\t#where for minimum work, (P_x/P_1) = (P_x/P_2), and thus\n", + "P_x = (P_1*P_2)**(1./2);\t\t\t#[kPa]\n", + "\t\t\t#therefore, work done is given by,\n", + "W_comp = ((2*n*R*T_1)/(n-1))*(1-(P_x/P_1)**((n-1)/n));\t\t\t#[J/mol]\n", + "W_comp = W_comp/Mol_wt;\t\t\t#[J/g]\n", + "print \" c).The compressor work done for ideal two-stage compession is %f J/g\"%(W_comp);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a).The compressor work done for reversible adiabatic compession is -264.386412 J/g\n", + " b).The compressor work done for isothermal compession is -190.024880 J/g\n", + " c).The compressor work done for ideal two-stage compession is -216.284501 J/g\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 3.19 Page number - 113" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T_1 = 600;\t\t\t#[C] - Temperature at entry\n", + "P_1 = 15;\t\t\t#[MPa] - Pressure at entry\n", + "T_2 = 400;\t\t\t#[K] - Temperature at exit\n", + "P_2 = 100;\t\t\t#[kPa] - Pressure at exit\n", + "A_in = 0.045;\t\t\t#[metre square] - flow in area\n", + "A_out = 0.31;\t\t\t#[metre square] - flow out area\n", + "m = 30;\t\t\t#[kg/s] - mass flow rate.\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#At 15 MPa and 600 C,it has been reported in the book that the properties of steam are,\n", + "Vol_1 = 0.02491;\t\t\t#[m**(3)/kg] - Specific volume\n", + "H_1 = 3582.3;\t\t\t#[kJ/kg] - Enthalpy\n", + "\t\t\t# m = den*vel*A = (Vel*A)/Vol, substituting the values\n", + "vel_1 = (m*Vol_1)/A_in;\t\t\t#[m/s] - Velocity at point 1.\n", + "print \" The inlet velocity is %f m/s\"%(vel_1);\n", + "\n", + "\t\t\t#At 100 MPa (saturated vapour),it has been reported in the book that the properties of steam are, T_sat = 99.63 C, and\n", + "Vol_vap_2 = 1.6940;\t\t\t#[m**(3)/kg] - specific volume of saturated vapour.\n", + "H_vap_2 = 2675.5;\t\t\t#[kJ/kg] - Enthalpy os saturated vapour.\n", + "vel_2 = (m*Vol_vap_2)/A_out;\t\t\t#[m/s] - Velocity at point 2.\n", + "print \" The exit velocity is %f m/s\"%(vel_2);\n", + "\n", + "\t\t\t#From first law we get, q - w =delta_H + delta_V**(2)/2\n", + "\t\t\t#q = 0, therefore, -w = delta_H + delta_V**(2)/2\n", + "delta_H = H_vap_2 - H_1;\t\t\t#[kJ/kg] - change in enthalpy.\n", + "delta_V_square = (vel_2**(2) - vel_1**(2))/2;\t\t\t#[J/kg]\n", + "delta_V_square = delta_V_square*10**(-3);\t\t\t#[kJ/kg]\n", + "w = -(delta_H + delta_V_square);\t\t\t#[J/kg] \n", + "W_net = w*m;\t\t\t#[kW]\n", + "W_net = W_net*10**(-3);\t\t\t#[MW] - power produced.\n", + "print \" The power that can be produced by the turbine is %f MW\"%(W_net);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The inlet velocity is 16.606667 m/s\n", + " The exit velocity is 163.935484 m/s\n", + " The power that can be produced by the turbine is 26.805014 MW\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 3.20 Page number - 117" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "R = 8.314;\t\t\t#[J/mol-K] - Universal gas constant\n", + "Cp_0 = 2.5*R;\t\t\t#[J/mol-K] - Specific heat capacity at constant pressure\n", + "Cv_0 = 1.5*R;\t\t\t#[J/mol-K] - Specific heat capacity at constant volume\n", + "T_L = 300;\t\t\t#[K] - Temperature at which port properties are constant.\n", + "\n", + "# Calculations\n", + "Y = Cp_0/Cv_0;\t\t\t# Ratio of heat capacities.\n", + "\t\t\t#From part(1) we obtained the relation,\n", + "\t\t\t# T_2 = 1/(((P_2-P_1)/(Y*T_L*P_2))+(P_1/(P_2*T_1)))\n", + "\t\t\t# Not that when P_2 >> P_1 ,T_2 approaches Y*T_L and thus\n", + "T_2 = Y*T_L;\t\t\t#[K]\n", + "\n", + "# Results\n", + "print \" b).The final temperature is %f K\"%(T_2);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " b).The final temperature is 500.000000 K\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 3.21 Page number - 119" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T_1 = 40 + 273.15;\t\t\t#[K] - Initial temperature.\n", + "P_1 = 1;\t\t\t#[bar] - Initial pressure.\n", + "P_1 = P_1*10**(5);\t\t\t#[Pa]\n", + "Vol_1 = 0.01;\t\t\t#[cubic metre] - Initial volume of the cylinder.\n", + "T_2 = 100 + 273.15;\t\t\t#[K] - Final temperature.\n", + "P_2 = 100;\t\t\t#[kPa] - Final pressure.\n", + "P_2 = P_2*10**(5);\t\t\t#[Pa]\n", + "Vol_2 = 0.02;\t\t\t#[cubic metre] - Final volume of the cylinder.\n", + "Cp = 1.005;\t\t\t#[J/g-K] - Specific heat capacity at constant pressure.\n", + "Cv = 0.718;\t\t\t#[J/g-K] - Specific heat capacity at constant volume.\n", + "Mol_wt = 28.84;\t\t\t#[g/mol] - Molecular weight of air.\n", + "R = 8.314;\t\t\t#[J/mol-K] - universal gas constant\n", + "\n", + "# Calculations\n", + "delta_Vol = Vol_2 - Vol_1;\t\t\t# [cubic metre] - Change in volume.\n", + "\t\t\t# Assuming ideal gas P*V = R*T\n", + "V_1 = (R*T_1)/P_1;\t\t\t# [m**(3)/mol] - Initial specific volume.\n", + "\t\t\t# Therefore,the total number of moles initially in the system is,\n", + "n_1 = (Vol_1/V_1);\t\t\t# [mol]\n", + "m_1 = n_1*Mol_wt;\t\t\t# [g] - Initial mass of the system.\n", + "Y = Cp/Cv;\t\t\t#Ratio of heat capacities\n", + "\n", + "\t\t\t# The energy balance equation is given by\n", + "\t\t\t# -P*delta_Vol + H_liq*(m_2 - m_1) = m_2*Cv*(P*V2)/R - m_1*Cv*T_1\n", + "\t\t\t# m_2*Cv*(P*V2)/R = (Cv*P_1*Vol_2)/R\n", + "\t\t\t# Cv/R = 1/(Y-1)\n", + "\t\t\t# Since pressure of the gas in system is assumed constant,therefore it remains at 1 bar and thus P = P_1,\n", + "H_liq = Cp*T_2;\t\t\t# [J/g] - Enthalpy of liquid\n", + "m_2 = (P_1*delta_Vol + ((P_1*Vol_2)/(Y-1)) + H_liq*m_1 - m_1*Cv*T_1)/H_liq;\t\t\t#[g]\n", + "\n", + "\t\t\t#The mass entering the assembly during the filling process is given by\n", + "m = m_2 - m_1;\t\t\t#[g]\n", + "n_2 = m_2/Mol_wt;\t\t\t#[mol] - Number of moles in the final state.\n", + "V_2 = Vol_2/n_2;\t\t\t#[m**(3)/mol] - Final specific volume.\n", + "\t\t\t# Therfore,final temperature is given by,\n", + "T_2 = (P_1*V_2)/R;\t\t\t#[K] - Final temperature.\n", + "\n", + "# Results\n", + "print \" The final equilibrium temperature is %f K\"%(T_2);\n", + "print \" The mass entering through the valve is %f g\"%(m);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The final equilibrium temperature is 339.343160 K\n", + " The mass entering through the valve is 9.367211 g\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example - 3.22 Page number - 122" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "V_total = 5;\t\t\t#[L] - Volume of pressure cooker.\n", + "V_total = V_total*10**(-3);\t\t\t#m**(3)\n", + "P_gauze = 15;\t\t\t#[psi] - Operating pressure (gauze)of pressure cooker.\n", + "P_gauze = (P_gauze/14.5)*10**(5);\t\t\t#[N/m**(2)]\n", + "P_atm = 0.966*10**(5);\t\t\t#[N/m**(2)] - Atmospheric pressure.\n", + "m_1 = 1;\t\t\t#[kg] - Initial mass.\n", + "t = 30*60;\t\t\t#[s] - Total time.\n", + "J = 500;\t\t\t#[W] - Rate of heat supply\n", + "\n", + "# Calculations\n", + "P_abs = P_gauze + P_atm;\t\t\t#[N/m**(2)] - Absolute pressure.\n", + "\t\t\t#The energy balance equqtion gives,\n", + "\t\t\t# Q = m_e*H_e +(m_2*U_2 - m_1*U_1), where 'm_e' is the mass exit from the system and 'H_e' is enthalpy at exit conditions.\n", + "\n", + "\t\t\t#It has been reported in the book that from steam table at P_abs,\n", + "T_sat = 120.23;\t\t\t#[K]- Saturated temperature\n", + "V_liq = 0.001061;\t\t\t#[m**(3)/kg] - specific volume of liquid.\n", + "V_vap = 0.8857;\t\t\t#[m**(3)/kg] - specific volume of vapour.\n", + "U_liq = 504.49;\t\t\t#[kJ/kg] - specific internal energy of liquid.\n", + "U_vap = 2529.5;\t\t\t#[kJ/kg] - specific internal energy of vapour.\n", + "H_liq = 504.70;\t\t\t#[kJ/kg] - specific enthalpy of liquid.\n", + "H_vap = 2706.7;\t\t\t#[kJ/kg] - specific internal energy of vapour.\n", + "\n", + "\t\t\t#We know that total volume occupied by 1 kg of fluid is \n", + "\t\t\t#V_total = (1-x)*V_liq + x*V_vap\n", + "x1 = (V_liq - V_total)/(V_liq - V_vap);\t\t\t#[g]\n", + "\n", + "\t\t\t#Internal energy at this state is\n", + "U_1 = (1-x1)*U_liq + x1*U_vap;\t\t\t#[kJ/kg] - specific internal energy\n", + "U_1_net = m_1*U_1;\t\t\t#[kJ] - Internal energy\n", + "\n", + "\t\t\t#The amount of heat suplied is given by,\n", + "J_net = J*t;\t\t\t#[J] - Net heat supplied.\n", + "J_net = J_net*10**(-3);\t\t\t#[kJ]\n", + "\n", + "\t\t\t#Let the dryness factor at the end of the process be x\n", + "\t\t\t#The specific properties of the liquid and vapour remain same as P and T_sat are the same in the cooker.\n", + "\t\t\t#Let the total mass of H2O (liquid + vapour) at the end of the process be 'm' kg.\n", + "\t\t\t# V_total/m = (1-x)*(V_liq) + x*V_vap ......equqtion(1)\n", + "\n", + "\t\t\t#the specific internal energy at the end of process is\n", + "\t\t\t#U = (1-x)*U_liq + x*U_vap\n", + "\t\t\t#The total internal energy at the end of the process is\n", + "\t\t\t#U_net = m*U = x*[(1-x)*U_liq + x*U_vap]\n", + "\n", + "\t\t\t#The energy balance equqtion gives,\n", + "\t\t\t# Q = m_e*H_e +(m_2*U_2 - m_1*U_1), where 'm_e' is the mass exit from the system and 'H_e' is enthalpy at exit conditions.\n", + "\t\t\t#Since the vapour which exits out have enthalpy equal to that of saturated vapour,we get on simplification\n", + "\t\t\t# 900 = (1-m)*(2706.7) + m*((1-x)*504.49 + x*2529.5) - 513.5..........equation(2)\n", + "\t\t\t# The second equation on simplification becomes\n", + "\t\t\t# x = ((0.005/m) - 0.001061)/0.884639\n", + "\n", + "\t\t\t# Putting the expression of x in first equation and then simplifying, we get\n", + "\t\t\t# - 1293.2 = -2202.21*m + 11.445 - 2.429*m\n", + "m = (11.445+1293.2)/(2202.21+2.429);\t\t\t#[kg]\n", + "\n", + "\t\t\t# Therefore x can be calculated as\n", + "x = ((0.005/m) - 0.001061)/0.884639;\n", + "\n", + "\t\t\t# Therfore total water (liquid + vapour) present in the pressure cooker at the end of the process is m kg.\n", + "m_vapour = x*m;\t\t\t#[kg] - Mass of vapour\n", + "m_liquid = (1-x)*m;\t\t\t#[kg] - Mass of vapour\n", + "\n", + "# Results\n", + "print \" Total water liquid + vapour) present in the pressure cooker at the end of the process is %f kg\"%(m);\n", + "print \" The mass of vapour is %f kg\"%(m_vapour);\n", + "print \" The mass of liquid is %f kg\"%(m_liquid);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total water liquid + vapour) present in the pressure cooker at the end of the process is 0.591773 kg\n", + " The mass of vapour is 0.004942 kg\n", + " The mass of liquid is 0.586830 kg\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 20 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch4_2-checkpoint.ipynb b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch4_2-checkpoint.ipynb new file mode 100644 index 00000000..52c2044d --- /dev/null +++ b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch4_2-checkpoint.ipynb @@ -0,0 +1,1513 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:8185298e7063d37f738c422b0f9a0946dd677189cdf544f54e436d8d650cb521" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 4 : The Secomd Law and Its Applications" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.1 Page Number : 148" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "\n", + "# Variables\n", + "n = 1000.;\t\t\t#[mol]\n", + "T = 400.;\t\t\t#[K]\n", + "P_1 = 100.;\t\t\t#[kPa]\n", + "P_2 = 1000.;\t\t\t#[kPa]\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#(a)\n", + "T_surr = 400.;\t\t\t#[K] - surrounding temperature\n", + "\t\t\t# Total change in entropy of the system is given by\n", + "\t\t\t# delta_S_sys = n*(Cp_0*math.log(T_2/T_1) - R*math.log(P_2/P_1))\n", + "\t\t\t# The process being isothermal the first term is zero and the total entropy change of the system is\n", + "delta_S_sys_a = - n*R*math.log(P_2/P_1);\t\t\t#[J/K]\n", + "delta_S_sys_a = delta_S_sys_a*10**(-3);\t\t\t#[kJ/K]\n", + "\n", + "\t\t\t# Since the process is reversible therefore\n", + "Q_sys = T_surr*delta_S_sys_a;\t\t\t#[kJ] - Heat change in the system\n", + "\t\t\t# Negative sign in the value of Q_sys implies that heat is released from the system and is released to the surroundings,therefore\n", + "Q_surr = - Q_sys;\t\t\t#[kJ] - Heat change in the surrounding\n", + "delta_S_surr_a = Q_surr/T_surr;\t\t\t#[kJ/K]\n", + "\n", + "delta_S_univ_a = delta_S_sys_a + delta_S_surr_a;\t\t\t#[kJ/K]\n", + "\t\t\t# We get delta_S_univ = 0, which is true for a reversible process\n", + "\n", + "print \" a).The entropy change of the gas is given by delta_S_sys = %f kJ/K \"%(delta_S_sys_a);\n", + "print \" The entropy change of the surrounding is delta_S_surr = %f kJ/K \"%(delta_S_surr_a);\n", + "print \" The total entropy change of the gas is delta_S_univ = %f kJ/K \"%(delta_S_univ_a);\n", + "\n", + "\t\t\t#(b)\n", + "T_surr_b = 300.;\t\t\t#[K] - surrounding temperature\n", + "\t\t\t# Since the initial and final states are fixed therefore the entropy change of the system is same whether the process is carried out reversibly or irreversibly.\n", + "delta_S_sys_b = delta_S_sys_a;\n", + "\n", + "\t\t\t# Work done under reversible condition is given by\n", + "\t\t\t# W = integral(P*dV) = integral(((R*T)/V)*dV) = R*T*math.log(V_2/V_1)\n", + "\t\t\t# For ideal gas we have, P1*V1/T1 = P2*V2/T2 or, V2/V1 = P1/P2 (for isothermal conditions)\n", + "W = R*T*math.log(P_1/P_2);\t\t\t#[J/mol]\n", + "W = W*10**(-3);\t\t\t#[kJ/mol]\n", + "\t\t\t# 20% extra work has to be done for the system to reach the same final state as under reversible conditions. Therefore\n", + "W = W*(120./100);\t\t\t#[kJ/mol]\n", + "W = W*n;\t\t\t#[kJ] - Total work done for n moles\n", + "\n", + "\t\t\t# Using the first law we have delta_U = Q - W. Now under isothermal conditions for ideal gas, delta_U = 0. Therefore,\n", + "Q = -W;\n", + "\t\t\t# It implies that whatever work is done on the system is lost as heat to the surroundings.\n", + "\t\t\t# Since heat is gained by the surroundings therefore\n", + "delta_S_surr_b = Q/T_surr_b;\t\t\t#[kJ/K]\n", + "\n", + "delta_S_univ_b = delta_S_sys_b + delta_S_surr_b;\t\t\t#[kJ/K]\n", + "\n", + "print \" b).The entropy change of the gas is given by delta_S_sys = %f kJ/K \"%(delta_S_sys_b);\n", + "print \" The entropy change of the surrounding is delta_S_surr = %f kJ/K \"%(delta_S_surr_b);\n", + "print \" The total entropy change of the gas is delta_S_univ = %f kJ/K \"%(delta_S_univ_b);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a).The entropy change of the gas is given by delta_S_sys = -19.143692 kJ/K \n", + " The entropy change of the surrounding is delta_S_surr = 19.143692 kJ/K \n", + " The total entropy change of the gas is delta_S_univ = 0.000000 kJ/K \n", + " b).The entropy change of the gas is given by delta_S_sys = -19.143692 kJ/K \n", + " The entropy change of the surrounding is delta_S_surr = 30.629908 kJ/K \n", + " The total entropy change of the gas is delta_S_univ = 11.486215 kJ/K \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.2 Page Number : 148" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 400.;\t\t\t#[K] - Temperature\n", + "P_1 = 500.*10**(3);\t\t\t#[Pa] - Initial pressure\n", + "P_2 = 100.*10**(3);\t\t\t#[Pa] - Final pressure\n", + "V_1 = 750.*10**(-6);\t\t\t#[m**(3)] - Initial volume\n", + "W_actual = 0.55*10**(3);\t\t\t#[J] - Actual work done\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal fas constant\n", + "\n", + "# Calculations\n", + "\t\t\t# Suppose that the surroundings are at 400 K.\n", + "\t\t\t# Therefore the process is externally reversible as temperature of the surroundings is same as system temperature.\n", + "\t\t\t# The number of moles is given by\n", + "n = (P_1*V_1)/(R*T);\t\t\t#[mol]\n", + "\t\t\t# The entropy change of ideal gas under isothermal condition is given by\n", + "delta_S_sys = - n*R*math.log(P_2/P_1);\t\t\t#[J/mol]\n", + "\n", + "\t\t\t# The heat supplied to the system in the internally reversible process is\n", + "Q_theot = T*delta_S_sys;\t\t\t#[J]\n", + "\t\t\t# Since the process is isothermal therefore, workdone is given by\n", + "W_theot = Q_theot;\t\t\t#[J] - Theoritical work done\n", + "\t\t\t# Since actual work done by the gas is 0.55 kJ therefore actual heat supplied is also 0.55 kJ because under isothermal conditions delta_U = 0\n", + "Q_actual = W_actual;\n", + "\n", + "# Results\n", + "\t\t\t# Since Q_theot > Q_actual, so the process is irreversible\n", + "print \" Since Q_theot = %f J is greater than Q_actual = %f J\"%(Q_theot,Q_actual);\n", + "print \" Therefore, the process is internally irreversible\"\n", + "\n", + "\t\t\t# Moreover delta_S_sys is same whether the process is reversible or irreversible as the initial and final states is the same.\n", + "\t\t\t# In the reversible process higher amount of heat is supplied (as compared to irreversible) due to which delta_S_sys take place.\n", + "\t\t\t# In the irreversible process the entropy of system increases due two reasons : heat supplied and entropy generation\n", + "\t\t\t# So in the irreversible case amount of heat supplied is less as compared to reversible case as entropy generation term also adds to the entropy change of system\n", + "\t\t\t# delta_S_sys = Q/T_b + S_gen\n", + "S_gen = delta_S_sys - (Q_theot/T);\t\t\t#[J/K]\n", + "\t\t\t# The entropy generated may be due to friction and other dissipayive effects or due to non-quasi-static expansion\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Since Q_theot = 603.539217 J is greater than Q_actual = 550.000000 J\n", + " Therefore, the process is internally irreversible\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.3 Page Number : 150" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\t\t\t# For side A\n", + "V_A = 1;\t\t\t#[L] - Volume\n", + "V_A = V_A*10**(-3);\t\t\t#[m**(3)]\n", + "T_A = 300;\t\t\t#[K] - Temperature\n", + "P_A = 2;\t\t\t#[atm] - Pressure\n", + "P_A = P_A*101325;\t\t\t#[Pa]\n", + "\n", + "\t\t\t# For side B\n", + "V_B = 1;\t\t\t#[L] - volume\n", + "V_B = V_B*10**(-3);\t\t\t#[m**(3)]\n", + "T_B = 300;\t\t\t#[K] - Temperature\n", + "P_B = 1;\t\t\t#[atm] - Pressure\n", + "P_B = P_B*101325;\t\t\t#[Pa]\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# From first law final temperature and pressure are given by (example 3.30)\n", + "\t\t\t# T = ((n_A*T_A) + (n_B*T_B))/(n_A + n_B)\n", + "\t\t\t# P = ((P_A*V_A) + (P_A*V_B))/(V_A + V_B)\n", + "\n", + "\t\t\t# Since in this case T_A = T_B, therefore final pressure is given by\n", + "P = ((P_A*V_A) + (P_B*V_B))/(V_A + V_B);\t\t\t#[Pa]\n", + "P = P/101325;\t\t\t#[atm]\n", + "\n", + "print \" The final temperature is %f K\"%(T_A);\n", + "print \" The final pressure is %f atm\"%(P);\n", + "\n", + "\t\t\t# The number of moles of air on each side are\n", + "n_A = (P_A*V_A)/(R*T_A);\t\t\t#[mol]\n", + "n_B = (P_B*V_B)/(R*T_B);\t\t\t#[mol]\n", + "\n", + "delta_S_A = -n_A*R*math.log((P*101325)/P_A);\t\t\t#[J/K] - Entropy change on side A\n", + "delta_S_B = -n_B*R*math.log((P*101325)/P_B);\t\t\t#[J/K] - Entropy change on side B\n", + "delta_S_sys = delta_S_A + delta_S_B;\t\t\t#[J/K] - Total entropy change of system\n", + "\n", + "\t\t\t# Since the system is insulated there is no heat exchange with the surroundings, therefore entropy change of surrounding is zero\n", + "delta_S_surr = 0;\t\t\t#[J/K]\n", + "delta_S_univ = delta_S_sys + delta_S_surr;\t\t\t#[J/K]\n", + "print \" The total increase in entropy is %f J/K\"%(delta_S_univ);\n", + "\n", + "\t\t\t# The entropy change of the system can also be writtten as\n", + "\t\t\t# delta_s_sys = Q/T_b + S_gen\n", + "\t\t\t# Since there is no heat transfer, therefore\n", + "S_gen = delta_S_univ;\t\t\t#[J/K]\n", + "\t\t\t# The process is reversible because of entropy generation due to spontaneous release of piston.\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The final temperature is 300.000000 K\n", + " The final pressure is 1.500000 atm\n", + " The total increase in entropy is 0.057383 J/K\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.4 Page Number : 151" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "V_vessel = 0.2;\t\t\t#[m**(3)] - Volume of the vessel\n", + "P_1 = 10;\t\t\t#[bar] - Initial pressure inside the vessel\n", + "P_1 = P_1*10**(5);\t\t\t#[Pa]\n", + "P_2 = 3.5;\t\t\t#[bar] - Final pressure inside the vessel\n", + "P_2 = P_2*10**(5);\t\t\t#Pa\n", + "T_1 = 250 + 273.15;\t\t\t#[K] - Initial temperature of the vesssel\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# (a)\n", + "\t\t\t# At 10 bar and 250 C the steam is superheated. From steam table as reported in book we have\n", + "V_1 = 0.2327;\t\t\t#[m**(3)/kg] - specific volume\n", + "U_1 = 2709.9;\t\t\t#[kJ/kg] - specific internal energy\n", + "H_1 = 2942.6;\t\t\t#[kj/kg] - Specific enthalpy\n", + "S_1 = 6.9247;\t\t\t#[kJ/kg-K] - Specific entropy\n", + "\t\t\t# the quantity of steam is given by\n", + "m = V_vessel/V_1;\t\t\t#[kg]\n", + "\n", + "\t\t\t# At final state \n", + "V_2 = 0.2327;\t\t\t#[m**(3)/kg] - Molar volume\n", + "V_liq_2 = 0.001079;\t\t\t# [m**(3)/kg]\n", + "V_vap_2 = 0.5243;\t\t\t# [m**(3)/kg]\n", + "\t\t\t# Since overall volume lies between saturated liquid and saturated vapour therefore the steam is saturated and its dryness fraction at final state is given by\n", + "x = (V_2 - V_liq_2)/(V_vap_2 - V_liq_2);\n", + "\t\t\t# Final temperature = T_sat (at 3 bar) from steam table\n", + "T_final = 138.88;\t\t\t#[C]\n", + "\n", + "\t\t\t# At 3.5 bar saturated conditions \n", + "S_liq = 1.7275;\t\t\t#[kJ/kg-K] - Entropy of saturated liquid\n", + "S_vap = 6.9405;\t\t\t#[kJ/kg-K] - Entropy of saturated vapour\n", + "U_liq = 583.95;\t\t\t#[kJ/kg] - Internal energy of saturated liquid\n", + "U_vap = 2548.9;\t\t\t#[kJ/kg] - Internal energy of saturated vapour\n", + "\t\t\t# Therefore at final state \n", + "U_2 = U_liq*(1 - x) + x*U_vap;\t\t\t#[kJ/kg]\n", + "S_2 = S_liq*(1 - x) + x*S_vap;\t\t\t#[kJ/kg-K]\n", + "Q_1 = m*(U_2 - U_1);\t\t\t#[kJ]\n", + "delta_S_1 = m*(S_2 - S_1);\t\t\t#[kJ/kg-K]\n", + "\n", + "print \" a).The final temperature is %f C\"%(T_final);\n", + "print \" The amount of heat transfer is %f kJ\"%(Q_1);\n", + "print \" The change of entropy is %f kJ/kg-K\"%(delta_S_1);\n", + "\n", + "\t\t\t# (b)\n", + "Y = 1.4;\t\t\t# Ratio of heat capacities for air\n", + "\t\t\t# (P_1*V_1)/T_1 = (P_2*V_2)/T_2 and since V_1 = V_2\n", + "T_2 = (P_2/P_1)*T_1;\t\t\t#[K]\n", + "\n", + "\t\t\t# Since the volume is fixed therefore work done (W) = 0 and from first law we get\n", + "\t\t\t# Q = delta_U = n*Cv_0*(T_2 - T_1)\n", + "Cv_0 = R/(Y - 1);\t\t\t#[J/mol-K] - Heat capacity at constant volume\n", + "Cp_0 = (Y*R)/(Y - 1);\t\t\t#[J/mol-K] - Heat capacity at constant pressure\n", + "n = (P_1*V_vessel)/(R*T_1);\t\t\t#[mol] - No. of moles\n", + "Q_2 = n*Cv_0*(T_2 - T_1);\t\t\t#[J] - Heat change\n", + "Q_2 = Q_2*10**(-3);\t\t\t#[kJ]\n", + "\n", + "delta_S_2 = Cp_0*math.log(T_2/T_1) - R*math.log(P_2/P_1);\t\t\t#[J/mol-K]\n", + "delta_S_2 = n*delta_S_2*10**(-3);\t\t\t#[kJ/K]\n", + "\n", + "print \" b).The final temperature is %f C\"%(T_2);\n", + "print \" The amount of heat transfer is %f kJ\"%(Q_2);\n", + "print \" The change of entropy is %f kJ/K\"%(delta_S_2);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a).The final temperature is 138.880000 C\n", + " The amount of heat transfer is -1079.587621 kJ\n", + " The change of entropy is -2.483450 kJ/kg-K\n", + " b).The final temperature is 183.102500 C\n", + " The amount of heat transfer is -325.000000 kJ\n", + " The change of entropy is -1.003366 kJ/K\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.5 Page Number : 153" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "from math import *\n", + "# Variables\n", + "m = 1000.;\t\t\t#[g] - Mass of fluid\n", + "P_1 = 20.;\t\t\t#[bar] - Initial pressure\n", + "P_1 = P_1*10.**(5);\t\t\t#[Pa]\n", + "P_2 = 2;\t\t\t#[bar] - Final pressure\n", + "P_2 = P_2*10.**(5);\t\t\t#Pa\n", + "T_1 = 250 + 273.15;\t\t\t#[K] - Initial temperature\n", + "n = 1.25;\n", + "R = 8.314;\t\t\t#[J/mol*-] - Universal gas constant\n", + "Y = 1.4;\t\t\t# Index of expansion\n", + "Cv_0 = R/(Y- 1);\t\t\t#[J/mol-K]\n", + "Cp_0 = R + Cv_0;\t\t\t#[J/mol-K]\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#(a)\n", + "\t\t\t# For steam at 20 bar and 250 C, from steam table as reported in the book\n", + "V_1 = 0.11144;\t\t\t#[m**(3)/kg]\n", + "U_1 = 2679.6;\t\t\t#[kJ/kg]\n", + "S_1 = 6.5453;\t\t\t#[kJ/kg-K]\n", + "\t\t\t# P_1*V_1**(n) = P_2*V_2**(n)\n", + "V_2 = ((P_1*V_1**(n))/P_2)**(1/n);\t\t\t#[m**(3)/kg]\n", + "\n", + "\t\t\t# At 2 bar under saturated conditions,from steam table as reported in the book\n", + "V_liq = 0.001061;\t\t\t#[m**(3)/kg]\n", + "V_vap = 0.8857;\t\t\t#[m**(3)/kg]\n", + "x = (V_2 - V_liq)/(V_vap - V_liq);\t\t\t# Dryness fraction\n", + "T_sat = 120.23;\t\t\t#[C] - The final temperature\n", + "U_liq = 504.49;\t\t\t#[kJ/kg] - Internal energy of saturate liquid\n", + "U_vap = 2529.5;\t\t\t#[kJ/kg] - Internal energy of saturate vapour\n", + "\t\t\t# Therefore, internal energy at state 2 is given by\n", + "U_2 = U_liq*(1 - x) + x*U_vap;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t# Work transfer is given by\n", + "W = (P_1*V_1 - P_2*V_2)/(n - 1);\t\t\t#[J/kg]\n", + "W = W*10**(-3);\t\t\t#[kJ/kg]\n", + "delta_U = U_2 - U_1;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t# From first law, q - W = delta_U\n", + "q = W + delta_U;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t# At final state (2 bar saturated), as reported in the book\n", + "S_liq = 1.5301;\t\t\t#[kJ/kg-K] - Entropy of saturated liquid\n", + "S_vap = 7.1271;\t\t\t#[kJ/kg-K] - Entropy of saturated vapour\n", + "\t\t\t# Therefore, entropy at state 2 is given by\n", + "S_2 = S_liq*(1 - x) + x*S_vap;\t\t\t#[kJ/kg-K]\n", + "delta_S = S_2 - S_1;\t\t\t#[kJ/kg-K]\n", + "\n", + "print \" a).The final temperature is %f C\"%(T_sat);\n", + "print \" The work done is equal to %f kJ/kg\"%(W);\n", + "print \" The heat change is equal to %f kJ/kg\"%(q);\n", + "print \" The entropy change is equal to %f kJ/kg-K\"%(delta_S);\n", + "\n", + "\t\t\t#(b)\n", + "\t\t\t# P*V**(n) = constant\n", + "\t\t\t# Since the gas behaves as ideal we can write\n", + "\t\t\t# P_1**(1-n)*T_1**(n) = P_2**(1-n)*T_2**(n)\n", + "T_2 = T_1*(P_1/P_2)**((1-n)/n);\t\t\t#[K]\n", + "\n", + "\t\t\t# Molar volume is given by\n", + "V_2_1 = (R*T_1)/P_1;\t\t\t#[m**(3)/mol] - At state 1\n", + "V_2_2 = (R*T_2)/P_2;\t\t\t#[m**(3)/mol] - At state 2\n", + "\n", + "\t\t\t# Work transfer is given by\n", + "w_2 = ((P_1*V_2_1) - (P_2*V_2_2))/(n-1);\t\t\t#[J/mol]\n", + "Mol_wt_air = 0.21*32 + 0.79*28;\t\t\t#[g/mol] - Molecular weight of air\n", + "n_mole = m/Mol_wt_air;\n", + "\t\t\t# Total work transfer is given by\n", + "W_2 = w_2*n_mole*10**(-3);\t\t\t#[kJ]\n", + "\t\t\t# Internal energy change is given by\n", + "delta_U = n_mole*Cv_0*(T_2 - T_1)*10**(-3);\t\t\t#[kJ]\n", + "\n", + "\t\t\t# Heat transfer is given by\n", + "Q = W_2 + delta_U;\t\t\t#[kJ]\n", + "\n", + "\t\t\t# Entropy change is given by\n", + "delta_S_2 = Cp_0*log(T_2/T_1) - R*log(P_2/P_1);\t\t\t#[J/mol-K]\n", + "delta_S_2 = delta_S_2*n_mole;\t\t\t#[J/mol]\n", + "\n", + "print \" b).The final temperature is %f C\"%(T_2);\n", + "print \" The work done is equal to %f kJ/kg\"%(W_2);\n", + "print \" The total heat change is equal to %f kJ\"%(Q);\n", + "print \" The entropy change is equal to %f J/kg-K\"%(delta_S_2);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a).The final temperature is 120.230000 C\n", + " The work done is equal to 329.008908 kJ/kg\n", + " The heat change is equal to -238.988250 kJ/kg\n", + " The entropy change is equal to -0.573241 kJ/kg-K\n", + " b).The final temperature is 330.085335 C\n", + " The work done is equal to 222.626855 kJ/kg\n", + " The total heat change is equal to 83.485071 kJ\n", + " The entropy change is equal to 199.136884 J/kg-K\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.6 Page Number : 154" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "m = 1000;\t\t\t#[g] - Mass of fluid\n", + "P_1 = 20;\t\t\t#[bar] - Initial pressure\n", + "P_2 = 2;\t\t\t#[bar] - Final ressure\n", + "T_1 = 250 + 273.15;\t\t\t#[K] - Initial tempearture\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "\t\t\t# (a).\n", + "\t\t\t# At 20 bar and 250 C as reported in the book\n", + "V_1 = 0.11144;\t\t\t#[m**(3)/kg] - Specific volume\n", + "U_1 = 2679.6;\t\t\t#[kJ/kg] - Specific internal energy\n", + "S_1 = 6.5453;\t\t\t#[kJ/kg-K] - Specific entropy\n", + "S_2 = S_1;\t\t\t# Isentropic expansion\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# At 2 bar under saturated conditions \n", + "S_liq = 1.5301;\t\t\t#[kJ/kg-K]\n", + "S_vap = 7.1271;\t\t\t#[kJ/kg-K]\n", + "U_liq = 504.49;\t\t\t#[kJ/kg-K]\n", + "U_vap = 2529.5;\t\t\t#[kJ/kg-K]\n", + "\t\t\t# Therefore dryness factor can be determined as\n", + "x = (S_1 - S_liq)/(S_vap - S_liq);\n", + "U_2 = U_liq*(1 - x) + x*U_vap;\t\t\t#[kJ/kg] - Specific internal energy at final state\n", + "delta_U = U_2 - U_1;\t\t\t#[kJ/kg] - change in internal energy\n", + "W = - delta_U;\t\t\t# - Work done\n", + "\n", + "\t\t\t# The final saturated temperature at 2 bar from steam table is\n", + "T_2 = 120.23;\t\t\t#[C]\n", + "\n", + "print \" a).The final temperature is %f C\"%(T_2);\n", + "print \" The work done is equal to %f kJ/kg\"%(W);\n", + "\n", + "\t\t\t# (b).\n", + "Y = 1.4;\t\t\t# Index of expansion for air\n", + "Cv_0 = R/(Y-1);\t\t\t#[J/mol*K] - Specific heat capacity at constant volume\n", + "\t\t\t# Ideal gas under isentropic expansion P_1**(1-Y)*T_1**(Y) =P_2**(1-Y)*T_2**(Y)\n", + "T_2_prime = T_1*(P_1/P_2)**((1-Y)/Y);\t\t\t#[K] - Final temperature\n", + "delta_U_prime = Cv_0*(T_2_prime - T_1);\t\t\t#[J/mol] - change in internal energy\n", + "\n", + "\t\t\t# Number of moles is given by\n", + "n = m/28.84;\t\t\t#[mol]\n", + "delta_U_prime = delta_U_prime*n*10**(-3);\t\t\t#[kJ]\n", + "W_prime = - delta_U_prime;\t\t\t# Work done\n", + "\n", + "print \" b).The final temperature is %f C\"%(T_2_prime);\n", + "print \" The work done is equal to %f kJ/kg\"%(W_prime);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a).The final temperature is 120.230000 C\n", + " The work done is equal to 360.596841 kJ/kg\n", + " b).The final temperature is 270.964218 C\n", + " The work done is equal to 181.750398 kJ/kg\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.7 Page Number : 155" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "P_1 = 15.;\t\t\t#[bar] - Initial pressure\n", + "P_2 = 0.15;\t\t\t#[bar] - Final pressure\n", + "\n", + "\t\t\t# We know that during isentropic expansion\n", + "\t\t\t# W = ((P_1*V_1) - (P_2*V_2))/(Y - 1)\n", + "\n", + "\t\t\t# At 15 bar (saturated vapour), from steam table as reported in the book\n", + "V_1 = 0.13177;\t\t\t#[m**(3)/kg]\n", + "U_1 = 2594.5;\t\t\t#[kJ/kg]\n", + "S_1 = 6.4448;\t\t\t#[kJ/kg-K]\n", + "\n", + "\t\t\t# Now at state 2 (P_2 = 0.15 bar),from steam table as reported in the book\n", + "S_2 = S_1;\t\t\t# Isentropic expansion\n", + "S_liq = 0.7549;\t\t\t#[kJ/kg-K]\n", + "S_vap = 8.0085;\t\t\t#[kJ/kg-K]\n", + "U_liq = 225.92;\t\t\t#[kJ/kg]\n", + "U_vap = 2448.7;\t\t\t#[kJ/kg]\n", + "V_liq = 0.001014;\t\t\t#[m**(3)/kg]\n", + "V_vap = 10.02;\t\t\t#[m**(3)/kg]\n", + "\n", + "# Calculations\n", + "\t\t\t# Therefore dryness factor can be calculated as\n", + "x = round((S_1 - S_liq)/(S_vap - S_liq),3);\n", + "U_2 = round(U_liq*(1 - x) + x*U_vap,2);\t\t\t#[kJ/kg] - Specific internal energy at final state\n", + "delta_U = U_2 - U_1;\t\t\t#[kJ/kg] - change in internal energy\n", + "W = - delta_U;\t\t\t# - Work done\n", + "\n", + "\t\t\t# The specific volume at the final state is\n", + "V_2 = round(V_liq*(1 - x) + x*V_vap,3);\t\t\t#[m**(3)/kg]\n", + "\n", + "\t\t\t# From work done under adiabatic conditions we get\n", + "\t\t\t# W = ((P_1*V_1) - (P_2*V_2))/(Y - 1)\n", + "Y = (((P_1*V_1) - (P_2*V_2))*10**2/W) + 1;\n", + "\n", + "# Results\n", + "print \" The index of expansion is given by Y = %.4f\"%(Y);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The index of expansion is given by Y = 1.1275\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.8 Page Number : 157" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "P_1 = 40;\t\t\t#[bar] - Initial pressure\n", + "T_1 = 500;\t\t\t#[C] - Initial temperature\n", + "Vel_1 = 140;\t\t\t#[m/s] - Initial velocity\n", + "T_2 = 100;\t\t\t#[C] - Final temperature\n", + "Vel_2 = 80;\t\t\t#[m/s] - Final velocity\n", + "W = 746.0;\t\t\t#[kJ/kg] - Work output\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# (a).\n", + "\t\t\t# From steam table as reported in the book\n", + "H_1 = 3445.3;\t\t\t#[kJ/kg]\n", + "H_2 = 2676.1;\t\t\t#[kJ/kg]\n", + "S_1 = 7.0901;\t\t\t#[kJ/kh-K]\n", + "S_2 = 7.3549;\t\t\t#[kJ/kg-K]\n", + "\n", + "\t\t\t# The temperature at which heat exchange take place is given by \n", + "T_b =(T_1 + T_2)/2 + 273.15;\t\t\t#[K]\n", + "\n", + "\t\t\t# From first law in a control volume \n", + "\t\t\t# q - W = delta_H + (delta_V**(2))/2 , therefore\n", + "q = W*10**(3) + (H_2 - H_1)*10**(3) + (Vel_2**(2) - Vel_1**(2))/2;\t\t\t#[J/kg]\n", + "q = q*10**(-3);\t\t\t#[kJ/kg]\n", + "\n", + "S_gen = (S_2 - S_1) - (q/T_b);\t\t\t#[kJ/kg-K]\n", + "\n", + "print \" a).The specific entropy production within turbine is %f kJ/kg-K\"%(S_gen);\n", + "\n", + "\t\t\t#(b)\n", + "\t\t\t# If control volume is too large to include the turbine and the environment then T_b becomes equal to 289 K. In this case\n", + "T_b_prime = 298;\t\t\t#[K]\n", + "\n", + "\t\t\t# The entropy change of the sysytem is given by \n", + "\t\t\t#delta_S = q/T_b + S_gen\n", + "S_gen = (S_2 - S_1) - (q/T_b_prime);\t\t\t#[kJ/kg-K]\n", + "\n", + "print \" b).The specific entropy production within turbine is %f kJ/kg-K\"%(S_gen);\n", + "\n", + "\t\t\t# In the first part only irreversibilities within the turbine are evaluated\n", + "\t\t\t# whereas in part (2) irreversible heat transfer between the turbine cover and environment are also included.\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a).The specific entropy production within turbine is 0.316793 kJ/kg-K\n", + " b).The specific entropy production within turbine is 0.364800 kJ/kg-K\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.9 Page Number : 160" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "P_1 = 1.;\t\t\t#[MPa] - Initial pressure\n", + "T_1 = 200 + 273.15;\t\t\t#[K] - Initial temperature\n", + "P_2 = 8.;\t\t\t#[MPa] - Final pressure\n", + "Y = 1.4;\t\t\t# Index of expansion of gas\n", + "R = 8.314;\t\t\t#[J/mol-K] - Universal gas constant\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#(1)\n", + "\t\t\t# The exit temperature for ideal gas under isentropic conditions is given by \n", + "T_2 = round(T_1*(round((P_2/P_1)**((Y-1)/Y),2)),1);\t\t\t#[K] - Exit temperature\n", + "\n", + "Cp_0 = round(Y*R/(Y-1),1);\t\t\t#[J/mol-K] - Specific heat capacity at constant pressure\n", + "\t\t\t# For isentropic conditions the enthalpy change for ideal gas is given by\n", + "delta_H_s = Cp_0*(T_2 - T_1);\t\t\t#[J/mol]\n", + "\t\t\t# Therefore work is given by\n", + "W = - delta_H_s;\t\t\t#[J/mol]\n", + "\n", + "print \" 1).The exit temperature of steam is %.2f K\"%(T_2);\n", + "print \" The required work is %.2f J/mol\"%(W);\n", + "\n", + "\t\t\t#(2)\n", + "eff = 0.8;\t\t\t# Adiabatic efficiency\n", + "\t\t\t# delta_H_s/delta_H_a = 0.8\n", + "delta_H_a = delta_H_s/eff;\t\t\t#[J/mol] - Actual enthalpy change\n", + "W_a = - delta_H_a;\t\t\t#[J/mol]\n", + "\n", + "\t\t\t# The ideal gas enthalpy is a function only of temperature,therefore actual exit temperature T_2a is given by \n", + "\t\t\t# delta_H_a = Cp_0*(T_2a - T_1)\n", + "T_2a = (delta_H_a/Cp_0) + T_1;\n", + "\n", + "print \" 2).The exit temperature of steam is %.2f K\"%(T_2a);\n", + "print \" The required work is %.2f J/mol\"%(W_a);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The exit temperature of steam is 856.40 K\n", + " The required work is -11152.58 J/mol\n", + " 2).The exit temperature of steam is 952.21 K\n", + " The required work is -13940.72 J/mol\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.10 Page Number : 161" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "from scipy.optimize import fsolve \n", + "import math \n", + "from scipy.integrate import quad \n", + "\t\t\t\n", + "\n", + "# Variables\n", + "P_1 = 1;\t\t\t#[MPa] - Initial pressure\n", + "T_1 = 200 + 273.15;\t\t\t#[K] - Initial temperature\n", + "P_2 = 8;\t\t\t#[MPa] - Final pressure\n", + "Y = 1.4;\t\t\t# Index of expansion of gas\n", + "R = 1.987;\t\t\t#[cal/mol*K] - Universal gas constant\n", + "\t\t\t# Cp_0 = 7.7 + 0.04594*10**(-2)*T + 0.2521*10**(-5)*T**(2) - 0.8587*10**(-9)*T**(3), here T is in K and Cp_0 is in cal/mol-K\n", + "a = 7.7;\n", + "b = 0.04594*10**(-2);\n", + "c = 0.2521*10**(-5);\n", + "d = - 0.8587*10**(-9);\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# delta_S = integral((Cp_0/T)*dT) - R*math.log(P_2/P_1) = 0\n", + "\t\t\t# delta_S = integral(((a + b*T + c*T**(2) + d*T**(3))/T)*dT) - R*math.log(P_2/P_1) = 0\n", + "\t\t\t# delta_S = a*math.log(T_2/T_1) + b*(T_2 - T_1) + (c/2)*(T_2**(2) - T_1**(2)) + (d/3)*(T_2**(3) - T_1**(3)) - R*math.log(P_2/P_1) = 0\n", + "\t\t\t# Solving for T_2 in the above equation we get\n", + "def f(T_2): \n", + "\t return a*math.log(T_2/T_1)+b*(T_2-T_1)+(c/2)*(T_2**(2)-T_1**(2))+(d/3)*(T_2**(3)-T_1**(3))-R*math.log(P_2/P_1)\n", + "T_2 = fsolve(f,100)\n", + "\n", + "\t\t\t# Now let us calculate the enthalpy change under these conditions \n", + "\n", + "def f0(T): \n", + "\t return 7.7+0.04594*10**(-2)*T+0.2521*10**(-5)*T**(2)-0.8587*10**(-9)*T**(3)\n", + "\n", + "delta_H_s = quad(f0,T_1,T_2)[0]\n", + "\n", + "delta_H_s = delta_H_s*4.184;\t\t\t#[J/mol]\n", + "\t\t\t# Therefore isentropic work done is\n", + "W = - delta_H_s;\n", + "\n", + "print \" 1).The exit temperature of steam is %f K\"%(T_2);\n", + "print \" The required work is %f J/mol\"%(W);\n", + "\n", + "\t\t\t#(2)\n", + "eff = 0.8;\n", + "delta_H_a = delta_H_s/eff;\t\t\t#[J/mol] - Actual enthalpy change\n", + "\t\t\t# Therefore actual work done is given by \n", + "W_a = - delta_H_a;\t\t\t#[J/mol]\n", + "\n", + "\t\t\t# Now we have to determine the exit temperature under actual conditions\n", + "\t\t\t# delta_H_a = integral(Cp_0*dT) from limit T_1 = 473.15 K to T_2\n", + "\t\t\t# On putting the values and simplifying we get\n", + "\t\t\t# 7.7*T_2 + 0.02297*10**(-2)*T_2**(2) + 0.084*10**(-5)*T_2**(3) - 0.214675*10**(-9)*T_2**(4) - 6907.106 = 0\n", + "\n", + "def f1(T_2_prime): \n", + "\t return a*(T_2_prime-T_1)+(b/2)*(T_2_prime**(2)-T_1**(2))+(c/3)*(T_2_prime**(3)-T_1**(3))+(d/4)*(T_2_prime**(4)-T_1**(4))-(delta_H_a/4.184)\n", + "T_2_prime = fsolve(f1,100)\n", + "\n", + "print \" 2).The exit temperature of steam is %f K\"%(T_2_prime);\n", + "print \" The required work is %f J/mol\"%(W_a);\n", + "\n", + "# Answers are vary because of rounding error. Calculations are correct. " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The exit temperature of steam is 760.037501 K\n", + " The required work is -10499.128839 J/mol\n", + " 2).The exit temperature of steam is 828.044888 K\n", + " The required work is -13123.911049 J/mol\n" + ] + } + ], + "prompt_number": 31 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.11 Page Number : 162" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "P_1 = 1;\t\t\t#[MPa] - Initial pressure\n", + "T_1 = 200 + 273.15;\t\t\t#[K] - Initial temperature\n", + "P_2 = 8;\t\t\t#[MPa] - Final pressure\n", + "Y = 1.4;\t\t\t# Index of expansion of gas\n", + "\n", + "\t\t\t# At state 1 (1 MPa and 200 C) from steam table as reported in the book\n", + "H_1 = 2827.9;\t\t\t#[kJ/kg]\n", + "S_1 = 6.694;\t\t\t#[kJ/kg]\n", + "\t\t\t# At state 2 (8 MPa)\n", + "S_2 = S_1;\t\t\t# Isentropic process\n", + "\t\t\t# From steam table at 8 MPa and 450 C\n", + "S_21 = 6.5551;\t\t\t#[kJ/kg-K]\n", + "\t\t\t# From steam table at 8 MPa and 500 C\n", + "S_22 = 6.7240;\t\t\t#[kJ/kg-K]\n", + "\t\t\t# Therefore temperature at which entropy of steam is 6.694 kJ/kg-K is given by\n", + "T_2 = 450 + (500-450)/(S_22-S_21)*(S_2-S_21);\t\t\t#[C]\n", + "T_2 = T_2 + 273.15;\t\t\t#[K]\n", + "\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# Enthalpy of steam at 8 MPa and 450 C from steam table as reported in the book \n", + "H_21 = 3272.0;\t\t\t#[kJ/kg]\n", + "\t\t\t# And at 8 MPA and 500 C\n", + "H_22 = 3398.3;\t\t\t#[kJ/kg]\n", + "\t\t\t# Therefore enthalpy of steam at 8 MPa and T_2 \n", + "H_2 = H_21 + ((H_22-H_21)/(500-450))*((T_2-273.15) - 450); \n", + "\t\t\t# Work done is given by \n", + "\t\t\t# W = - delta_H_s\n", + "W = - (H_2 - H_1);\t\t\t#[J/g]\n", + "W = W*18.015;\t\t\t#[J/mol]\n", + "delta_H_s = - W;\n", + "\n", + "print \" 1).The exit temperature of steam is %f K\"%(T_2);\n", + "print \" The required work is %f J/mol\"%(W);\n", + "\n", + "\t\t\t#(2)\n", + "eff = 0.8;\t\t\t# Adiabatic efficiency\n", + "\t\t\t# delta_H_s/delta_H_a = 0.8\n", + "delta_H_a = delta_H_s/eff;\t\t\t#[J/mol] - Actual enthalpy change\n", + "\t\t\t# Therefore actual work done \n", + "W_a = - delta_H_a;\t\t\t#[J/mol]\n", + "\t\t\t# Enthalpy at actual exit conditions is \n", + "H_2_a = H_1 + delta_H_a/18.015;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t# Enthalpy of steam at 8 MPa and 500 C from steam table as reported in the book \n", + "H_21_a = 3398.3;\t\t\t#[kJ/kg]\n", + "\t\t\t# And at 8 MPA and 550 C\n", + "H_22_a = 3521.0;\t\t\t#[kJ/kg]\n", + "\t\t\t# Therefore temperature at H_22_a is given by\n", + "T_2_a = 500 + ((550-500)*(H_2_a - H_21_a))/(H_22_a - H_21_a);\t\t\t#[C]\n", + "T_2_a = T_2_a + 273.15;\t\t\t#[K]\n", + "\n", + "print \" 2).The exit temperature of steam is %f K\"%(T_2_a);\n", + "print \" The required work is %f J/mol\"%(W_a);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The exit temperature of steam is 764.269005 K\n", + " The required work is -9871.618433 J/mol\n", + " 2).The exit temperature of steam is 819.832257 K\n", + " The required work is -12339.523042 J/mol\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.12 Page Number : 163" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "P_1 = 140.;\t\t\t#[kPa] - Initial pressure\n", + "T_1 = 20. + 273.15;\t\t\t#[K] - Initial temperature\n", + "P_2 = 560.;\t\t\t#[kPa] - Final pressure\n", + "eff = 0.75;\t\t\t# Compressor efficiency\n", + "R = 1.987;\t\t\t#[cal/mol*K] - Universal gas constant\n", + "\t\t\t# Cp_0 = 4.750 + 1.200*10**(-2)*T + 0.3030*10**(-5)*T**(2) - 2.630*10**(-9)*T**(3), here T is in K and Cp_0 is in cal/mol-K\n", + "a = 7.7;\n", + "b = 0.04594*10**(-2);\n", + "c = 0.2521*10**(-5);\n", + "d = - 0.8587*10**(-9);\n", + "\n", + "# Calculations and Results\n", + "# At 20 C,as reported in the book\n", + "Cp_0 = 8.46;\t\t\t#[cal/mol-K] - Specific heat capacity at constant pressure\n", + "Cv_0 = Cp_0 - R;\t\t\t#[cal/mol-K] - Specific heat capacity at constant volume\n", + "Y = Cp_0/Cv_0;\t\t\t# Index of expansion\n", + "\n", + "\t\t\t# Assuming 100 % efficiency,for reversible and adiabatic process the final temperature is given by\n", + "\t\t\t# P*V**(Y) = constant or, P*((R*T)/P)**(Y) = constant\n", + "T_2 = ((P_1/P_2)**((1-Y)/Y))*T_1;\t\t\t#[K]\n", + "\n", + "\t\t\t# Since at final temperature the value of heat capacity ratio would have changed \n", + "\t\t\t# So let us determine Y at mean temperature and then calculating final temperature\n", + "T_mean = (T_1 + T_2)/2;\t\t\t#[K]\n", + "\n", + "\t\t\t# At T_mean,as reported in the book\n", + "Cp_0_new = 9.153;\t\t\t#[cal/mol-K]\n", + "Cv_0_new = Cp_0_new - R;\t\t\t#[cal/mol-K]\n", + "Y_new = Cp_0_new/Cv_0_new;\n", + "T_2_new = T_1*((P_1/P_2)**((1-Y_new)/Y_new));\t\t\t#[K]\n", + "\n", + "\t\t\t# The enthalpy change is given by \n", + "\n", + "def f23(T): \n", + "\t return 4.750+1.200*10**(-2)*T+0.3030*10**(-5)*T**(2)-2.630*10**(-9)*T**(3)\n", + "\n", + "delta_H = quad(f23,T_1,T_2_new)[0]\n", + "\n", + "\n", + "\t\t\t#For adiabatic process\n", + "W = - delta_H;\t\t\t#[cal/mol]\n", + "\t\t\t# Now actual work done on the system is given by \n", + "W_a = W/eff;\t\t\t#[cal/mol]\n", + "\n", + "\t\t\t# Since the actual process is adiabatic the work done is change in negative of enthalpy\n", + "\t\t\t# Therefore actual change in enthalpy is - W_a, or\n", + "\t\t\t# - W_a = 4.750*(T_2-T_1) + (1.2*10**(-2)/2)*(T_2**(2)-T_1**(2)) + (0.3030*10**(-5)/3)*(T_2**(3)-T_1**(3)) - (2.63*10**(-9)/4)*(T_2***(4)-T_1**(4));\n", + "\t\t\t# Solving for T_2 in the above equation\n", + "def f1(T_2_prime): \n", + "\t return 4.750*(T_2_prime-T_1)+((1.2*10**(-2))/2)*(T_2_prime**(2)-T_1**(2))+((0.3030*10**(-5))/3)*(T_2_prime**(3)-T_1**(3))-((2.63*10**(-9))/4)*(T_2_prime**(4)-T_1**(4))+W_a\n", + "T_2_prime=fsolve(f1,100)\n", + "\n", + "print \" The required work is %f cal/mol\"%(W_a);\n", + "print \" The discharge temperature of methane is %f K\"%(T_2_prime);\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The required work is -1254.158148 cal/mol\n", + " The discharge temperature of methane is 427.374758 K\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.13 Page Number : 164" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "P_1 = 10;\t\t\t#[bar] - Initial pressure\n", + "T_1 = 500 + 273.15;\t\t\t#[K] - Initial temperature\n", + "P_2 = 2;\t\t\t#[psia] - Final pressure\n", + "P_2 = P_2/14.5;\t\t\t#[bar]\n", + "P_2 = P_2*10**(2);\t\t\t#[kPa]\n", + "m = 1.8;\t\t\t#[kg/s] - Mass flux\n", + "eff = 0.8;\t\t\t# Efficiency\n", + "\n", + "\t\t\t# At state 1, from steam table\n", + "H_1 = 3478.5;\t\t\t#[kJ/kg]\n", + "S_1 = 7.7622;\t\t\t#[kJ/kg-K]\n", + "S_2 = S_1;\t\t\t# Adiabatic process\n", + "\n", + "\t\t\t# From saturated steam table at 10 kPa\n", + "S_liq_1 = 0.6493;\t\t\t#[kJ/kg-K]\n", + "S_vap_1 = 8.1502;\t\t\t#[kJ/kg-K]\n", + "\t\t\t# From saturated steam table at 15 kPa\n", + "S_liq_2 = 0.7549;\t\t\t#[kJ/kg-K]\n", + "S_vap_2 = 8.0085;\t\t\t#[kJ/kg-K]\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# Threfore at P_2 \n", + "S_liq = S_liq_1 + ((S_liq_2-S_liq_1)/(15-10))*(P_2-10);\n", + "S_vap = S_vap_1 + ((S_vap_2-S_vap_1)/(15-10))*(P_2-10);\n", + "\n", + "\t\t\t# The dryness fraction at exit state is\n", + "x_2 = (S_1-S_liq)/(S_vap-S_liq);\n", + "\t\t\t# The enthalpy at exit to be determined. At 10 kPa\n", + "H_liq_1 = 191.83;\t\t\t#[kJ/kg]\n", + "H_vap_1 = 2584.7;\t\t\t#[kJ/kg]\n", + "\t\t\t# At 15 kPa\n", + "H_liq_2 = 225.94;\t\t\t#[kJ/kg]\n", + "H_vap_2 = 2599.1;\t\t\t#[kJ/kg]\n", + "\t\t\t# Therfore at P_2\n", + "H_liq = H_liq_1 + ((H_liq_2-H_liq_1)/(15-10))*(P_2-10);\n", + "H_vap = H_vap_1 + ((H_vap_2-H_vap_1)/(15-10))*(P_2-10);\n", + "\n", + "\t\t\t# Enthalpy at state 2\n", + "H_2_s = H_liq*(1-x_2) + x_2*H_vap;\t\t\t#[kJ/kg]\n", + "W = m*(H_1 - H_2_s);\t\t\t#[kW]\n", + "\n", + "print \" 1).The power output is %f kW\"%(W);\n", + "\n", + "\t\t\t#(2)\n", + "\t\t\t# If the process is 80 % efficient the enthalpy change is\n", + "\t\t\t# H_1 - H_2_a = eff*(H_1 - H_2_s)\n", + "H_2_a = H_1 - (0.8*(H_1 - H_2_s));\n", + "\n", + "\t\t\t# Now under these conditions temperature and entropy have to be determined. From superheated steam tables,as reported in the book\n", + "\t\t\t# At 10 kPa and 100 C\n", + "H_2_1 = 2687.5;\t\t\t#[kJ/kg]\n", + "S_2_1 = 8.4479;\t\t\t#[kJ/kg-k]\n", + "\t\t\t# At 10 kPa and 150 C\n", + "H_2_2 = 2783.0;\t\t\t#[kJ/kg]\n", + "S_2_2 = 8.6882;\t\t\t#[kJ/kg-k]\n", + "\t\t\t# At 50 kPa and 100 C\n", + "H_3_1 = 2682.5;\t\t\t#[kJ/kg]\n", + "S_3_1 = 7.6947;\t\t\t#[kJ/kg-k]\n", + "\t\t\t# At 50 kPa and 150 C\n", + "H_4_1 = 2780.1;\t\t\t#[kJ/kg]\n", + "S_4_1 = 7.9401;\t\t\t#[kJ/kg-k]\n", + "\t\t\t# Therefore at P_2 and 100 C\n", + "H_prime_1 = H_2_1 + ((H_3_1-H_2_1)/(50-10))*(P_2-10);\t\t\t#[kJ/kg]\n", + "S_prime_1 = S_2_1 + ((S_3_1-S_2_1)/(50-10))*(P_2-10);\t\t\t#[kJ/kg-K]\n", + "\t\t\t# Therefore at P_2 and 150 C\n", + "H_prime_2 = H_2_2 + ((H_4_1-H_2_2)/(50-10))*(P_2-10);\t\t\t#[kJ/kg]\n", + "S_prime_2 = S_2_2 + ((S_4_1-S_2_2)/(50-10))*(P_2-10);\t\t\t#[kJ/kg-K]\n", + "\n", + "\t\t\t# Enthalpy at exit is H_2_a. So at this condition temperature can be nom be determined\n", + "T_exit = ((H_2_a - H_prime_1)/(H_prime_2 - H_prime_1))/(150-100) + 100;\t\t\t#[C]\n", + "\t\t\t# The entropy at exit is\n", + "S_exit = ((H_2_a - H_prime_1)/(H_prime_2 - H_prime_1))/(S_prime_2 - S_prime_1) + S_prime_1;\t\t\t#[kJ/kg-K]\n", + "\n", + "print \" 2).The entropy at exit is %f kJ/kg-K\"%(S_exit);\n", + "print \" The temperature of the exit state is %f C\"%(T_exit);\n", + "\n", + "print \" The irreversibility is advatageous because the exit steam is superheated and therefore\";\n", + "print \" the blades of the turbine are not eroded by water droplets which get formed when the process is isentropic\";\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The power output is 1753.346828 kW\n", + " 2).The entropy at exit is 8.906311 kJ/kg-K\n", + " The temperature of the exit state is 100.002552 C\n", + " The irreversibility is advatageous because the exit steam is superheated and therefore\n", + " the blades of the turbine are not eroded by water droplets which get formed when the process is isentropic\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.14 Page Number : 166" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "P_1 = 6;\t\t\t#[MPa] - Initial pressure\n", + "T_1 = 500 + 273.15;\t\t\t#[K] - Initial temperature\n", + "P_2 = 10;\t\t\t#[kPa] - Final pressure\n", + "out_qlty = 0.9;\t\t\t# Output quality\n", + "\n", + "\t\t\t# At 6 MPa and 500 C, from steam table as reported in the book\n", + "H_1 = 3422.2;\t\t\t#[kJ/kg]\n", + "S_1 = 6.8803;\t\t\t#[kJ/kg-K]\n", + "S_2 = S_1;\t\t\t# Adiabatic reversible conditions\n", + "\t\t\t# At 10 kPa saturated\n", + "H_liq = 191.83;\t\t\t#[kJ/kg]\n", + "H_vap = 2584.7;\t\t\t#[kJ/kg]\n", + "S_liq = 0.6493;\t\t\t#[kJ/kg-K]\n", + "S_vap = 8.1502;\t\t\t#[kJ/kg-K]\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# The dryness fraction is given by \n", + "x = (S_1-S_liq)/(S_vap-S_liq);\n", + "\n", + "\t\t\t# Now the exit enthalpy is given by\n", + "H_2 = H_liq*(1-x) + x*H_vap;\t\t\t#[kJ/kg]\n", + "W = - (H_2 - H_1);\t\t\t#[kJ/kg] - Under isentropic conditions\n", + "\n", + "\t\t\t# We know that, delta_S = q/T_b + S_gen\n", + "\t\t\t# Since delta_S = 0, therefore under isentropic conditions\n", + "S_gen = 0;\t\t\t#[kJ/kg-K]\n", + "\n", + "\t\t\t# Now for output quality 0.9\n", + "H_2_a = H_liq*(1-out_qlty) + out_qlty*H_vap;\t\t\t#[kJ/kg]\n", + "S_2_a = S_liq*(1-out_qlty) + out_qlty*S_vap;\t\t\t#[kJ/kg]\n", + "W_a = - (H_2_a - H_1);\t\t\t#[kJ/kg]\n", + "delta_S_a = S_2_a - S_1;\t\t\t#[kJ/kg-k]\n", + "\t\t\t# Again, delta_S = q/T_b + S_gen\n", + "\t\t\t# Since q = 0, therefore under isentropic conditions\n", + "S_gen_a = delta_S_a;\t\t\t#[kJ/kg-K\n", + "\t\t\t# Now efficiency is given by eff = delta_H_a/delta_H_s\n", + "eff = W_a/W;\n", + "\n", + "print \" For output quality = 0.9\";\n", + "print \" The work output per unit mass is %f kJ/kg\"%(W_a);\n", + "print \" The entropy generation is given by S_gen = %f kJ/kg-K\"%(S_gen_a);\n", + "print \" The efficiency with respect to reversible adiabatic case is given by eff = %f\"%(eff);\n", + "\n", + "\t\t\t# Now for output quality 1\n", + "out_qlty_1 = 1;\n", + "H_2_a_1 = H_liq*(1-out_qlty_1) + out_qlty_1*H_vap;\t\t\t#[kJ/kg]\n", + "S_2_a_1 = S_liq*(1-out_qlty_1) + out_qlty_1*S_vap;\t\t\t#[kJ/kg]\n", + "W_a_1 = - (H_2_a_1 - H_1);\t\t\t#[kJ/kg]\n", + "delta_S_a_1 = S_2_a_1 - S_1;\t\t\t#[kJ/kg-k]\n", + "\t\t\t# Again, delta_S = q/T_b + S_gen\n", + "\t\t\t# Since q = 0, therefore under isentropic conditions\n", + "S_gen_a_1 = delta_S_a_1;\t\t\t#[kJ/kg-K\n", + "\t\t\t# Now efficiency is given by eff = delta_H_a/delta_H_s\n", + "eff_1 = W_a_1/W;\n", + "\n", + "print \" For output quality = 1.0\";\n", + "print \" The work output per unit mass is %f kJ/kg\"%(W_a_1);\n", + "print \" The entropy generation is given by S_gen = %f kJ/kg-K\"%(S_gen_a_1);\n", + "print \" The efficiency with respect to reversible adiabatic case is given by eff = %f\"%(eff_1);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " For output quality = 0.9\n", + " The work output per unit mass is 1076.787000 kJ/kg\n", + " The entropy generation is given by S_gen = 0.519810 kJ/kg-K\n", + " The efficiency with respect to reversible adiabatic case is given by eff = 0.866551\n", + " For output quality = 1.0\n", + " The work output per unit mass is 837.500000 kJ/kg\n", + " The entropy generation is given by S_gen = 1.269900 kJ/kg-K\n", + " The efficiency with respect to reversible adiabatic case is given by eff = 0.673983\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.15 Page Number : 168" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "P_1 = 3.;\t\t\t#[bar] - Initial pressure\n", + "T_1 = 150. + 273.15;\t\t\t#[K] - Initial temperature\n", + "Vel_1 = 90.;\t\t\t#[m/s] - Initial velocity\n", + "P_2 = 1.;\t\t\t#[bar] - Final pressure\n", + "eff = 0.95;\t\t\t# Adiabatic effciciency of the nozzle\n", + "R = 8.314;\t\t\t#[J/mol*-] - Universal gas constant\n", + "\n", + "\t\t\t# At 3 bar and 150 C, from steam table\n", + "S_1 = 7.0778;\t\t\t#[kJ/kg-K]\n", + "H_1 = 2761.0;\t\t\t#[kJ/kg]\n", + "S_2 = S_1;\t\t\t# \n", + "\n", + "\t\t\t# At 1 bar saturated\n", + "S_liq = 1.3026;\t\t\t#[kJ/kg-K]\n", + "S_vap = 7.3594;\t\t\t#[kJ/kg-K]\n", + "H_liq = 417.46;\t\t\t#[kJ/kg]\n", + "H_vap = 2675.5;\t\t\t#[kJ/kg]\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# The dryness factor of exit steam can be determined as\n", + "x = (S_1-S_liq)/(S_vap-S_liq);\n", + "\t\t\t# Enthalpy of exit steam is given by \n", + "H_2 = H_liq*(1-x) + x*H_vap;\t\t\t#[kJ/kg]\n", + "delta_H_s = H_2 - H_1;\t\t\t#[kJ/kg] - Enthalpy change\n", + "delta_H_a = eff*delta_H_s;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t# Assuming no heat exchange with surroundings and since no work is done\n", + "\t\t\t# delta_H + (delta_V**(2))/2 = 0\n", + "delta_Vel_square = 2*(-delta_H_a)*1000;\t\t\t#[m**(2)/s**(2)]\n", + "Vel_2 = (delta_Vel_square + Vel_1**(2))**(1./2);\t\t\t#[m/s]\n", + "\n", + "print \" 1).The final velocity when fluid is steam) is %f m/s\"%(Vel_2);\n", + "\n", + "\t\t\t# (2)\n", + "Y = 1.4;\t\t\t# Index of expansion\n", + "Cp_0 = (Y*R)/(Y-1);\t\t\t#[J/mol-K] - Specific heat capacity at constant pressure\n", + "\t\t\t# The final temperature has to be determined such that entropy change is zero. Under isentropic conditions\n", + "\t\t\t# P_1**(1-Y)*T_1**(Y) = P_2**(1-Y)*T_2**(Y)\n", + "T_2 = T_1*(P_1/P_2)**((1-Y)/Y);\t\t\t#[K]\n", + "delta_H_s_2 = Cp_0*(T_2 - T_1);\t\t\t#[J/mol]\n", + "delta_H_a_2 = eff*delta_H_s_2;\t\t\t#[J/mol]\n", + "delta_H_a_2 = (delta_H_a_2*1000)/28.84;\t\t\t#[J/kg]\n", + "\n", + "delta_Vel_square_2 = 2*(-delta_H_a_2);\t\t\t#[m**(2)/s**(2)]\n", + "Vel_2_2 = (delta_Vel_square_2 + Vel_1**(2))**(1./2);\t\t\t#[m/s]\n", + "\n", + "print \" 2).The final velocity when fluid is air which behaves as an ideal gas) is %f m/s\"%(Vel_2_2);\n", + "\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The final velocity when fluid is steam) is 608.291583 m/s\n", + " 2).The final velocity when fluid is air which behaves as an ideal gas) is 476.065890 m/s\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.16 Page Number : 169" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "P_1 = 300.;\t\t\t#[kPa] - Initial pressure\n", + "T_1 = 450.;\t\t\t#[K] - Initial temperature\n", + "Vel_1 = 90.;\t\t\t#[m/s] - Initial velocity\n", + "P_2 = 180.;\t\t\t#[kPa] - Final pressure\n", + "eff = 0.95;\t\t\t# Adiabatic effciciency of the nozzle\n", + "R = 8.314;\t\t\t#[J/mol*-] - Universal gas constant\n", + "Cp = 5.19;\t\t\t#[kJ/kg-K] - Specific heat capacity at constant pressure\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#(a)\n", + "\t\t\t# Exit velocity is highest when drop in enthalpy is highest or when isentropic conditions are maintained\n", + "\n", + "Mol_wt_He = 4;\t\t\t#[g/mol] - Molecular weight of helium\n", + "R_He = R/Mol_wt_He;\t\t\t# 'R' for helium\n", + "Y = Cp/(Cp - R_He);\n", + "\n", + "\t\t\t# Now temperature at exit to be determined\n", + "T_2s = T_1*(P_1/P_2)**((1-Y)/Y);\t\t\t#[K]\n", + "delta_H_2s = Cp*(T_2s - T_1);\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t# Since no work is done and heat exchange is zero,from first law we get\n", + "\t\t\t# delta_H + delta_Vel**(2)/2 = 0\n", + "delta_Vel_square = 2*(-delta_H_2s)*1000;\t\t\t#[m**(2)/s**(2)]\n", + "Vel_2 = (delta_Vel_square)**(1./2);\t\t\t#[m/s] - ( as Vel_1 << Vel_2)\n", + "\n", + "print \" a).The maximum exit velocity is %f m/s\"%(Vel_2);\n", + "\n", + "\t\t\t#(b)\n", + "T_2a = 373;\t\t\t#[K] - Measured temperature of helium\n", + "delta_H_a = Cp*(T_2a - T_1);\t\t\t#[kJ/kg]\n", + "delta_Vel_square_a = 2*(-delta_H_a)*1000;\t\t\t#[m**(2)/s**(2)]\n", + "Vel_2a = (delta_Vel_square_a)**(1./2);\t\t\t#[m/s] - ( as Vel_1 << Vel_2a)\n", + "\n", + "print \" b).The actual exit velocity is %f m/s\"%(Vel_2a);\n", + "\n", + "\t\t\t#(c)\n", + "delta_S_sys = Cp*math.log(T_2a/T_1) - R_He*math.log(P_2/P_1);\n", + "\t\t\t# we know that delta_S_sys = q/T_b + S_gen and since q = 0, therfore\n", + "S_gen = delta_S_sys;\t\t\t#[kJ/kg-K]\n", + "\n", + "print \" c).The increasse in entropy per unit mass is %f kJ/kg-K\"%(S_gen);\n", + "\n", + "\t\t\t# The source of irreversibility is friction in the nozzle.\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a).The maximum exit velocity is 929.607346 m/s\n", + " b).The actual exit velocity is 894.013423 m/s\n", + " c).The increasse in entropy per unit mass is 0.087748 kJ/kg-K\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.17 Page Number : 170" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "P_1 = 1;\t\t\t#[bar] - Initial pressure\n", + "T_1 = 150 + 273.15;\t\t\t#[K] - Initial temperature\n", + "V_2 = 0.28;\t\t\t#[m**(3)/kg] - Final specific volume\n", + "T_2 = T_1;\t\t\t#[K] - Isothermal process\n", + "R = 8.314;\t\t\t#[J/mol-K] - Universal gas constant\n", + "\n", + "\t\t\t# At 1 bar and 150 C, from steam table\n", + "S_1 = 7.6134;\t\t\t#[kJ/kg-K]\n", + "H_1 = 2776.4;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t# At 150 C saturated\n", + "V_liq = 0.001091;\t\t\t#[m**(3)/kg]\n", + "V_vap = 0.3928;\t\t\t#[m**(3)/kg]\n", + "H_liq = 632.2;\t\t\t#[kJ/kg]\n", + "H_vap = 2746.5;\t\t\t#[kJ/kg]\n", + "S_liq = 1.8418;\t\t\t#[kJ/kg-K]\n", + "S_vap = 6.8379;\t\t\t#[kJ/kg-K]\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# The dryness factor of exit steam can be determined as\n", + "x = (V_2 - V_liq)/(V_vap - V_liq);\n", + "S_2 = S_liq*(1-x) + x*S_vap;\t\t\t#[kJ/kg-K] -Entropy \n", + "H_2 = H_liq*(1-x) + x*H_vap;\t\t\t#[kJ/kg] -Enthalpy \n", + "delta_H = H_2 - H_1;\t\t\t#[kJ/kg] - Enthalpy change\n", + "delta_S = S_2 - S_1;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t# Since the compression is reversible\n", + "q = T_1*delta_S;\t\t\t#[kJ/kg] - Heat transfer\n", + "\t\t\t# From first law q - W = delta_H\n", + "W = q - delta_H;\t\t\t#[kJ/kg]\n", + "\n", + "print \" 1).The amount of heat transfer when fluid is steam) is %f kJ/kg\"%(q)\n", + "print \" The amount of work transfer when fluid is steam) is %f kJ/kg\"%(W)\n", + "\n", + "\t\t\t#(2)\n", + "V_2 = V_2*(28.84/1000);\t\t\t#[m**(3)/mol] - Molar volume at exit\n", + "\t\t\t# Pressure at exit is given by \n", + "P_2 = ((R*T_2)/V_2);\t\t\t#[N/m**(2)]\n", + "P_2 = P_2*10**(-5);\t\t\t#[bar]\n", + "\n", + "\t\t\t# Entropy change is given by, delta_S_2 = Cp*math.log(T_2/T_1) - R*math.log(P_2/P_1), but since T_1 = T_2, therfore\n", + "delta_S_2 = - R*math.log(P_2/P_1);\t\t\t#[J/mol-K]\n", + "\n", + "q_2 = T_1*delta_S_2;\t\t\t#[J/mol] - Heat change\n", + "q_2 = q_2/28.84;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t# Enthalpy change is given by, delta_H_2 = Cp*(T_2 - T_1) = 0 (as T_1 = T_2)\n", + "delta_H_2 = 0;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t# From first law q - W = delta_H, therefore\n", + "W_2 = q_2 - delta_H_2;\t\t\t#[kJ/kg]\n", + "\n", + "print \" 2).The amount of heat transfer when fluid is ideal gas) is %f kJ/kg\"%(q_2)\n", + "print \" The amount of work transfer when fluid is ideal gas) is %f kJ/kg\"%(W_2)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The amount of heat transfer when fluid is steam) is -936.947741 kJ/kg\n", + " The amount of work transfer when fluid is steam) is -298.195149 kJ/kg\n", + " 2).The amount of heat transfer when fluid is ideal gas) is -179.526401 kJ/kg\n", + " The amount of work transfer when fluid is ideal gas) is -179.526401 kJ/kg\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.18 Page Number : 171" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "P_1 = 7*10**(5);\t\t\t#[Pa] - Initial pressure\n", + "T_1 = 95 + 273.15;\t\t\t#[K] - Initial temperature\n", + "P_2 = 3.5*10**(5);\t\t\t#[Pa] - Final pressure\n", + "dia = 15*10**(-2);\t\t\t#[m] - Diameter of pipe\n", + "m = 2;\t\t\t#[kg/s] - Mass flow rate\n", + "R = 8.314;\t\t\t#[J/mol-K] - Universal gas constant\n", + "Y = 1.4;\t\t\t# Index of expansion\n", + "Cp_0 = (R*Y)/(Y-1);\t\t\t#[J/mol-K] - Specific heat capacity at constant pressure\n", + "Cp_0 = (Cp_0/28.84)*1000;\t\t\t#[J/kg-K]\n", + "rho_1 = 6.6;\t\t\t#[kg/m**(3)] - Density\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# velocity before throttling is to be determined m = rho*Vol*Area\n", + "V_1 = (R*T_1)/P_1;\t\t\t#[m**(3)/mol] - Specific volume\n", + "V_1 = (V_1/28.84)*1000;\t\t\t#[m**(3)/kg]\n", + "Vel_1 = m/(rho_1*3.14*(dia/2)**(2));\t\t\t#[m/s] - Velocity before throttling\n", + "\n", + "\t\t\t# Let the temperature after throttling be T_2, then\n", + "\t\t\t# V_2 = (((R*T_2)/P_2)/28.84)*1000\n", + "\t\t\t# Vel_2 = m/(rho_2*Area) = (m*V_2)/(3.14*(dia/2)**(2))\n", + "\t\t\t# From first law, since q = W = 0, we get\n", + "\t\t\t# delta_H + (delta_V**(2))/2 = 0\n", + "\t\t\t# Cp_0*(T_2 - T_1) + ((Vel_2)**(2) - (Vel_1)**(2))/2 = 0\n", + "\t\t\t#Cp_0*(T_2 - T_1) + (((m*((((R*T_2)/P_2)/28.84)*1000))/(3.14*(dia/2)**(2)))**(2) - (Vel_1)**(2))/2 = 0\n", + "\t\t\t# Solving the above equation for T_2, we get\n", + "def f1(T_2): \n", + "\t return Cp_0*(T_2 - T_1) + (((m*((((R*T_2)/P_2)/28.84)*1000))/(3.14*(dia/2)**(2)))**(2) - (Vel_1)**(2))/2\n", + "T_2 =fsolve(f1,100)\n", + "\t\t\t# Therefore velocity of air downstream of restriction is given by \n", + "Vel_2 = ((m*((((R*T_2)/P_2)/28.84)*1000))/(3.14*(dia/2)**(2)));\t\t\t#[m/s]\n", + "\n", + "print \" The velocity of air downstream of restriction is %f m/s\"%(Vel_2);\n", + "\n", + "delta_T = (T_2 - T_1);\n", + "\t\t\t# Since temperature difference (delta_T) is very small, therefore enthalpy change is also very small\n", + "\n", + "\t\t\t# Entropy change is given by, delta_S = Cp_0*math.log(T_2/T_1) - R*math.log(P_2/P_1), but since T_1 and T_2 are almost equal\n", + "delta_S = - R*math.log(P_2/P_1);\t\t\t#[J/mol-K]\n", + "\n", + "print \" The change in entropy is %f kJ/mol-k\"%(delta_S);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The velocity of air downstream of restriction is 34.295216 m/s\n", + " The change in entropy is 5.762826 kJ/mol-k\n" + ] + } + ], + "prompt_number": 18 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch5_2-checkpoint.ipynb b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch5_2-checkpoint.ipynb new file mode 100644 index 00000000..82489a66 --- /dev/null +++ b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch5_2-checkpoint.ipynb @@ -0,0 +1,747 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:beb354ab1f11a4413c580f54f984be6db9b7dd2c39bed82bc1f4874533d75759" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 5 : Exergy" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.1 Page Number : 184" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "\n", + "# Variables\n", + "T_1 = 500+273.15;\t\t\t#[C] - Condensation temperature\n", + "T_2 = 250+273.15;\t\t\t#[C] - Temperature at which vaporization takes place.\n", + "\n", + "T_3 = 25+273.15;\t\t\t#[C] - Ambient atmospheric temperature.\n", + "\n", + "Q = 1;\t\t\t#We are taking a fictitious value of Q, its value is not given.But we need to initialize it wid some value,so we are taking its value as Q=1.\n", + "\n", + "# Calculations\n", + "\t\t\t#The exergy content of the vapour at 500 C,\n", + "Ex_T_1 = Q*(1-(T_3/T_1));\n", + "Ex_T_2 = Q*(1-(T_3/T_2));\n", + "\t\t\t#Therefore,loss in exergy is given by\n", + "Ex_loss = Ex_T_1 - Ex_T_2;\n", + "\t\t\t#Fraction of exergy lost due to irreversible process is,\n", + "Ex_fraction =(Ex_loss/Ex_T_1);\n", + "\n", + "# Results\n", + "print \" The fraction of exergy lost due to irreversible process is %f\"%(Ex_fraction);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The fraction of exergy lost due to irreversible process is 0.299954\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.2 Page Number : 188" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T_1 = 300.;\t\t\t#[K] - Initial temperature.\n", + "P_1 = 100.;\t\t\t#[kPa] - Initial pressure.\n", + "T_2 = 500.;\t\t\t#[K] - Final temperature.\n", + "T_0 = 300.;\t\t\t#[K] - Environment temperature.\n", + "P_0 = 1.;\t\t\t#[atm] - Environment pressure.\n", + "R = 8.314;\t\t\t#[J/mol*K]\n", + "\t\t\t#(Cp_0/R)= 3.626\n", + "Cp_0 = 3.626*R;\t\t\t#[J/mol-K] - Heat capacity at constant pressure\n", + "\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#(1).\n", + "\t\t\t#The availability change is given by, (phi_1 - phi_2) = U_1 - U_2 + P_0*(V_1 - V_2) - T_0*(S_1 - S_2)\n", + "\t\t\t#Let us determine the change in internal energy\n", + "\t\t\t#For ideal gas the molar internal energy change is given by delta_U = Cv_0*(T_2-T_1)\n", + "\t\t\t#For ideal gas Cp_0 - Cv_0 = R, and therefore\n", + "Cv_0 = ((Cp_0/R)- 1)*R;\t\t\t#[J/mol-K] - Heat capacity at constant volume\n", + "delta_U = Cv_0*(T_2-T_1);\t\t\t#[J/mol]\n", + "\t\t\t#delta_U = -w (from energy balance). Therefore, U1-U2 = -delta_U.\n", + "\t\t\t#The entropy change of ideal gas is given by\n", + "\t\t\t#delta_S = Cp_0*math.log(T_2/T_1) - R*math.log(P_2/P_1), but,(P1*V1/T1) = (P1*V1/T1) and therefore (P2/P1) = (T2/T1)\n", + "delta_S = Cp_0*math.log(T_2/T_1) - R*math.log(T_2/T_1);\t\t\t#[J/mol-K]\n", + "\t\t\t#The exergy change is given by, (phi_1 - phi_2) = U_1 - U_2 + P_0*(V_1 - V_2) - T_0*(S_1 - S_2)\n", + "\t\t\t#(V_1 - V_2) = 0, because the tank is rigid and so the volume is constant\n", + "delta_phi = (-delta_U) - T_0*(-delta_S);\t\t\t#[J/mol]\n", + "print \" 1).The change in exergy is %f J/mol\"%(delta_phi);\n", + "\n", + "\t\t\t#(2).\n", + "\t\t\t#Entropy change of the system is given by, delta_S_sys = q/T_b + S_gen\n", + "\t\t\t#Since the system is adiabatic therefore, delta_S_sys = S_gen\n", + "S_gen = delta_S;\n", + "\t\t\t#Irreversibility is given by\n", + "i = T_0*S_gen;\t\t\t#[J/mol]\n", + "print \" 2).The value of irreversibility is %f J/mol\"%(i);\n", + "\t\t\t#Irreversibility can also be determined using\n", + "\t\t\t#i = (W_rev_use - W_use)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The change in exergy is -1020.722863 J/mol\n", + " 2).The value of irreversibility is 3345.789937 J/mol\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.3 Page Number : 190" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "# Variables\n", + "P_1 = 15.;\t\t\t#[bar] - Initial pressure\n", + "P_1 = P_1*10**(5);\t\t\t#[Pa]\n", + "T_1 = 300.+273.15;\t\t\t#[K] - Initial temperature\n", + "T_0 = 298.15;\t\t\t#[K]\n", + "T_R = 1200.;\t\t\t#[K] - Reservoir temerature.\n", + "P_0 = 1.;\t\t\t#[bar]\n", + "P_0 = P_0*10**(5);\t\t\t#[Pa]\n", + "n = 1.;\t\t\t#[mol] - No of moles\n", + "R = 8.314;\t\t\t#[J/mol*K]\n", + "Y = 1.4;\t\t\t# - Ratio of heat capacities.\n", + "Cv_0 = R/(Y-1);\t\t\t#[J/mol-K] - Heat capacity at constant volume\n", + "Cp_0 = Cv_0 + R;\t\t\t#[J/mol-K] - Heat capacity at constant pressure\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#(1)\n", + "\t\t\t#V_2 = 2*V_1 and since pressure is constant,we get (V_1/T_1) = (2*V_1/T_1), or, T_2 = 2*T_1.\n", + "T_2 = 2*T_1;\t\t\t#[K]\n", + "W = P_1*(((R*T_2)/P_1)-((R*T_1)/P_1));\t\t\t#[J/mol] - Actual work done\n", + "delta_U = Cv_0*(T_2-T_1);\t\t\t#[J/mol] - Change in internal energy.\n", + "q = W + delta_U;\t\t\t#[J/mol] - Heat change\n", + "\t\t\t#Now the availability change is given by, (phi_1 - phi_2) = U_1 - U_2 + P_0*(V_1 - V_2) - T_0*(S_1 - S_2) + q*(1-(T_0/T_R))\n", + "\t\t\t#delta_S = Cp_0*math.log(T_2/T_1) - R*math.log(P_2/P_1), and P_1 = P_2, Therefore\n", + "delta_S = Cp_0*math.log(T_2/T_1);\t\t\t#[J/mol-K] - Entropy change.\n", + "\t\t\t#Substituting expressions for delta_phi calculation. Decrease in availability is given by,\n", + "delta_phi = (-delta_U) + P_0*(((R*T_1)/P_1)-((R*T_2)/P_1)) - T_0*(-delta_S) + q*(1-(T_0/T_R));\t\t\t#[J/mol]\n", + "\t\t\t#Actual work done is given by, W = P_1*(V2-V1)\n", + "\t\t\t#Work done to print lace the atmosphere is given by, W = P_0*(V_2-V_1)\n", + "\t\t\t#Therefore, W_use = (P_1*(V2-V1) - P_0*(V2-V1))\n", + "W_use = (P_1-P_0)*(((R*T_2)/P_1)-((R*T_1)/P_1));\t\t\t#[J/mol] - useful work done\n", + "W_rev_use = delta_phi;\t\t\t# reversible useful work done\n", + "\t\t\t#Irreversibility is given by,\n", + "i = W_rev_use - W_use;\t\t\t#[J/mol]\n", + "print \" a).When the system is confined at constant pressure by a piston and is heated until it's volume is doubled \\n the ireversibility value is %f J/mol\"%(i);\n", + "\n", + "\t\t\t#The irreversibility can also be calculated using \n", + "\t\t\t# i = T_0*S_gen\n", + "\t\t\t#S_gen = delta_S - (q/T_R)\n", + "\n", + "\t\t\t#(b)\n", + "\t\t\t#V2 = 2*V_1 and therefore T_2 = 2*T_1, as P_2 = P_1\n", + "\t\t\t#Actual work done is same as before\n", + "\t\t\t#Let work done on stirrer be W_stir. Thus net work done by the system is W - W_stir.Fron energy balance we get,\n", + "W_stir = W + delta_U;\n", + "\t\t\t#Initially the exergy is due to that of the system at state 1 and stirrer work,'W_stir' and finally we have the exergy due to system at state 2,the stirrer work is spent,thus availability is given by\n", + "delta_phi_b = (-delta_U) + P_0*(((R*T_1)/P_1)-((R*T_2)/P_1)) - T_0*(-delta_S) + W_stir;\t\t\t#[J/mol]\n", + "W_rev_use_b = delta_phi_b;\t\t\t# reversible useful work done\n", + "W_use_b = W_use;\t\t\t# useful work done\n", + "\t\t\t#Now the irreversibility is given by,\n", + "i_b = W_rev_use_b - W_use_b;\t\t\t#[J/mol]\n", + "print \" b).When the system is confined at constant pressure by a piston and is stirred until it's volume is doubled \\n the ireversibility value is %f J/mol\"%(i_b);\n", + "\n", + "\t\t\t#The irreversibility can also be calculated using \n", + "\t\t\t# i_b = T_0*S_gen\n", + "\t\t\t#S_gen = delta_S - (q/T_R) and here, q = 0\n", + "\n", + "\t\t\t#(c)\n", + "P_2_c = 10;\t\t\t#[bar] - Final pressure, (Given)\n", + "P_2_c = P_2_c*10**(5);\t\t\t#[Pa]\n", + "\t\t\t#(P_1**(1-Y))*(T_1**(Y)) = (P_2**(1-Y))*(T_2**(Y))\n", + "T_2_c = T_1*((P_1/P_2_c)**((1-Y)/Y));\t\t\t#[K]\n", + "\t\t\t#Work done is given by, W = -delta_U = -Cv_0*(T_2_c - T_1)\n", + "W_c = -Cv_0*(T_2_c - T_1);\t\t\t#[J/mol]\n", + "\t\t\t#The final molar volume is calculated using P_1*V_1**(Y) = P_2*V_2**(Y)\n", + "\t\t\t#V_2 = V_1*((P_1/P_2_c)**(1/Y))\n", + "V_1 = (R*T_1)/P_1;\t\t\t#[cubic metre/mol] - Initial molar volume\n", + "V_2 = V_1*((P_1/P_2_c)**(1/Y));\t\t\t#[cubic metre/mol] - Final molar volume\n", + "\t\t\t#Now let us determine the work done to print lace the atmosphere,\n", + "W_atm_c = P_0*(V_2 - V_1);\t\t\t#[J/mol] - work done to print lace the atmosphere\n", + "\t\t\t#Thus useful work is given by,\n", + "W_use_c = W - W_atm_c;\t\t\t#[J/mol] - useful work done\n", + "\t\t\t#Here delta_S = 0,for reversible adiabatic process.Therefore,\n", + "W_rev_use_c = W_use_c;\n", + "\t\t\t#Now finally the irreversibility is given by,\n", + "i_c = W_rev_use_c - W_use_c;\t\t\t#[J/mol]\n", + "print \" c).When the system expands reversibly and adiabatically behind a piston \\n the ireversibility value is %f J/mol\"%(i_c);\n", + "\n", + "\t\t\t#(d)\n", + "\t\t\t#Here temperature is constant,but V_2 = 2*V_1, therefore P_2 = P_1/2\n", + "V_2_d = 2*V_1;\n", + "P_2_d = P_1/2;\n", + "\t\t\t#Under isothermal conditions work done is\n", + "W_d = R*T_1*math.log(V_2_d/V_1);\t\t\t#[J/mol]\n", + "\t\t\t#Work done to print lace the atmosphere is given by,\n", + "W_atm_d = P_0*(V_2_d - V_1);\t\t\t#[J/mol] - work done to print lace the atmosphere\n", + "\t\t\t#Thus useful work is given by,\n", + "W_use_d = W_d - W_atm_d;\t\t\t#[J/mol] - useful work done\n", + "delta_U_d = 0;\t\t\t#isothermal conditions\n", + "q_d = W_d;\t\t\t# since, delta_U_d = 0\n", + "\t\t\t#delta_S_d = Cp_0*math.log(T_2/T_1) - R*math.log(P_2/P_1), and T_1 = T_2, Therefore\n", + "delta_S_d = -R*math.log(P_2_d/P_1);\t\t\t#[J/mol-K] - Entropy change\n", + "\t\t\t#The reversible useful work is given by,\n", + "W_rev_use_d = P_0*(V_1 - V_2_d) - T_0*(-delta_S_d) + q_d*(1-(T_0/T_R));\t\t\t#[J/mol] - Reversible useful work done.\n", + "\t\t\t#The irreversibility is given by,\n", + "i_d = W_rev_use_d - W_use_d;\t\t\t#[J/mol]\n", + "print \" d).When the system expands reversibly and isothermally behind a piston until it's volume is doubled \\n the ireversibility value is %f J/mol\"%(i_d);\n", + "\n", + "\t\t\t#(e)\n", + "P_2_e = 10;\t\t\t#[bar] - Final pressure, (Given)\n", + "P_2_e = P_2_e*10**(5);\t\t\t#[Pa]\n", + "\t\t\t#During the expansion of an ideal gas in into vacuum the temperature of the gas remains the same,\n", + "T_2_e = T_1;\t\t\t# Final temperature\n", + "\t\t\t#Since boundary of the system is fixed so no net work is done, W = 0 and thus\n", + "W_use_e = 0;\t\t\t#[J/mol] - Useful work done\n", + "\t\t\t#Here, delta_U = 0,as temperature is same and\n", + "\t\t\t#(V_1-V_2) = 0,as for overall system there is no change in volume\n", + "delta_S_e = - R*math.log(P_2_e/P_1);\t\t\t#[J/mol-K] - Entropy change\n", + "\t\t\t#The reversible useful work is given by,\n", + "W_rev_use_e = - T_0*(-delta_S_e);\t\t\t#[J/mol] - Reversible useful work done.\n", + "\t\t\t#The irreversibility is given by,\n", + "i_e = W_rev_use_e - W_use_e;\t\t\t#[J/mol]\n", + "print \" e).When the system expands adiabatically into an adjacent chamber \\n the ireversibility value is %f J/mol\"%(i_e);\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a).When the system is confined at constant pressure by a piston and is heated until it's volume is doubled \n", + " the ireversibility value is 1869.841742 J/mol\n", + " b).When the system is confined at constant pressure by a piston and is stirred until it's volume is doubled \n", + " the ireversibility value is 6013.652646 J/mol\n", + " c).When the system expands reversibly and adiabatically behind a piston \n", + " the ireversibility value is 0.000000 J/mol\n", + " d).When the system expands reversibly and isothermally behind a piston until it's volume is doubled \n", + " the ireversibility value is 897.537657 J/mol\n", + " e).When the system expands adiabatically into an adjacent chamber \n", + " the ireversibility value is 1005.074654 J/mol\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.4 Page Number : 194" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T_1 = 150+273.15;\t\t\t#[K] - Initial temperature.\n", + "m = 4.6;\t\t\t#[kg] - mass of water\n", + "P_1 = 1;\t\t\t#[MPa] - Initial pressure\n", + "Q = 11000;\t\t\t#[kJ] - Heat transferred to the system.\n", + "T_R = 600+273.15;\t\t\t#[K] - Temperature of the reservior.\n", + "T_0 = 298;\t\t\t#[K] - Temperature of the environment\n", + "P_0 = 100;\t\t\t#[kPa] - Pressure of the environment\n", + "\n", + "# Calculations\n", + "\t\t\t#(1)\n", + "\t\t\t#The entropy change of an isothermal system undergoing an internally reversible process is given by,\n", + "delta_S_t = (Q/T_1);\t\t\t#[kJ] - Entropy change\n", + "delta_S = delta_S_t/m;\t\t\t#[kJ/kg-K] - \n", + "\n", + "\t\t\t#At 150 C,it has been reported in the book that, P_sat - 0.4758 kPa, V_liq = 0.001091 m**(3)/kg, U_liq = 631.68 kJ/kg, S_liq = 1.8418 kJ/kg-K, S_vap = 6.8379 kJ/kg-K\n", + "V_1 = 0.001091;\t\t\t#[m**(3)/kg] - initial specific volume\n", + "U_1 = 631.68;\t\t\t#[kJ/kg] - initial specific internal energy\n", + "S_1 = 1.8418;\t\t\t#[kJ/kg-K] - initial entropy\n", + "\t\t\t#The initial state of the water is a compressed liquid state,and S_1 is therefore equal to the entropy of the saturated liquid of the saturated liquid at the same temperature.\n", + "S_2 = S_1 + delta_S;\t\t\t#[kJ/kg-K] - Final entropy\n", + "\n", + "\t\t\t#At the final state the temperature is 150 C and S = 7.499 kJ/kg-K which is more than S_vap therefore it is superheated steam.\n", + "S_final = 7.494;\t\t\t#[kJ/kg-K]\n", + "\t\t\t#At 150 C, and 0.1 MPa: V = 1.9364 m**(3)/kg, U = 2582.8 kJ/kg, S = 7.6134 kJ/kg-K\n", + "\t\t\t#At 150 C, and 0.2 MPa: V = 0.9596 m**(3)/kg, U = 2576.9 kJ/kg, S = 7.2795 kJ/kg-K\n", + "U_t_1 = 2582.8;\t\t\t#[kJ/kg] - Internal energy\n", + "U_t_2 = 2576.9;\t\t\t#[kJ/kg]\n", + "V_t_1 = 1.9364;\t\t\t#[m**(3)/kg] - Specific volume\n", + "V_t_2 = 0.9596;\t\t\t#[m**(3)/kg]\n", + "S_t_1 = 7.6134;\t\t\t#[kJ/kg-K] - Entropy\n", + "S_t_2 = 7.2795;\t\t\t#[kJ/kg-K]\n", + "\t\t\t#The pressure at exit is given by,\n", + "P_2 = ((S_final - S_t_1)/(S_t_2 - S_t_1))*(0.2 - 0.1) + 0.1;\t\t\t#[Mpa] - Final pressure\n", + "\t\t\t#At final state\n", + "U_2 = U_t_1 + (U_t_2 - U_t_1)*((S_final - S_t_1)/(S_t_2 - S_t_1));\t\t\t#[kJ/kg] - Final specific internal energy\n", + "V_2 = V_t_1 + (V_t_2 - V_t_1)*((S_final - S_t_1)/(S_t_2 - S_t_1));\t\t\t#[m**(3)/kg] - Final specific volume\n", + "\n", + "q = Q/m;\t\t\t#[kJ/kg] - Heat supplied per unit kg of mass.\n", + "W_rev_use = U_1 - U_2 + P_0*(V_1 - V_2) - T_0*(S_1 - S_2) + q*(1 - (T_0/T_R));\t\t\t#[kJ/kg] - Reversible useful work done.\n", + "\n", + "\t\t\t#Now let us calculate the actual work done. We know q - W = delta_U, therefore\n", + "W = q - (U_2 - U_1);\t\t\t#[kJ/kg] - Work done\n", + "W_use = W - P_0*(V_2 - V_1);\t\t\t#[kJ/kg]\n", + "i = W_rev_use - W_use;\t\t\t#[kJ/kg] - Irreversibility\n", + "\t\t\t#Since the system contains 4.6 g therefore, \n", + "W_use_new = W_use*m;\t\t\t#[kJ]\n", + "W_rev_use_new = W_rev_use*m;\t\t\t#[kJ]\n", + "I = W_rev_use_new - W_use_new;\t\t\t#[kJ]\n", + "\n", + "# Results\n", + "print \" 1).The useful work obtained is %f kJ\"%(W_use_new);\n", + "print \" 2).The reversible usefuk work done is %f kJ\"%(W_rev_use_new);\n", + "print \" 3).The irreversibility is %f kJ\"%(I);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The useful work obtained is 1304.987050 kJ\n", + " 2).The reversible usefuk work done is 5297.425775 kJ\n", + " 3).The irreversibility is 3992.438725 kJ\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.5 Page Number : 197" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T_1 = 700+273.15;\t\t\t#[K] - Initial temperature.\n", + "P_1 = 12;\t\t\t#[MPa] - Initial pressure\n", + "P_2 = 0.6;\t\t\t#[MPa] - Final pressure\n", + "\t\t\t#At 12 MPa and 700 C,\n", + "H_1 = 3858.4;\t\t\t#[kJ/kg] - initial enthalpy\n", + "S_1 = 7.0757;\t\t\t#[kJ/kg-K] - initial entropy\n", + "\n", + "\t\t\t#At 0.6 MPa and 200 C,\n", + "H_2 = 2850.1;\t\t\t#[kJ/kg]\n", + "S_2 = 6.9673;\t\t\t#[kJ/kg-K]\n", + "\n", + "\t\t\t#At 0.6 MPa and 250 C,\n", + "H_3 = 2957.2;\t\t\t#[kJ/kg]\n", + "S_3 = 7.1824;\t\t\t#[kJ/kg-K]\n", + "\n", + "\t\t\t#At 0.6 MPa and 300 C,\n", + "H_4 = 3061.6;\t\t\t#[kJ/kg]\n", + "S_4 = 7.3732;\t\t\t#[kJ/kg-K]\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#(1)\n", + "\t\t\t#In the case of ideal turbine the entropy change does not take place,therefore the exit conditions are\n", + "P_exit = P_2;\t\t\t#[MPa] - exit pressure\n", + "T_exit = ((S_1 - S_2)/(S_3 - S_2))*(250 - 200) + 200;\t\t\t#[C] - exit temperature\n", + "H_exit = ((S_1 - S_2)/(S_3 - S_2))*(H_3 - H_2) + H_2;\t\t\t#[kJ/kg] - exit enthalpy\n", + "\n", + "\t\t\t#Snce it is a flow pocess,therfore\n", + "\t\t\t#W_rev = H_1 - H_exit - T_0*(S_1 - S_2)\n", + "\t\t\t#As S_1 = S_2,the above equation becomes\n", + "W_rev_1 = H_1 - H_exit;\t\t\t#[kJ/kg] - reversible work done\n", + "\n", + "\t\t\t#From the first law the actual work done can be calculated using, delta_H = q - W\n", + "\t\t\t#Since the turbine does not exchange heat,therefore W = - delta_H.\n", + "W_1 = - (H_exit - H_1);\t\t\t#[kJ/kg]\n", + "\n", + "print \" 1).The reversible work done is %f kJ/kg\"%(W_1);\n", + "print \" And since the maximum work is same as the actual work ,therefore irreversibility is zero\"\n", + "\n", + "\t\t\t#(2)\n", + "\t\t\t# Variables\n", + "T_0 = 298.15;\t\t\t#[K] - Environment temperature\n", + "P_0 = 1;\t\t\t#[atm] - Environment pressure\n", + "adi_eff = 0.88;\t\t\t#adiabatc efficiency\n", + "\n", + "\t\t\t#(H_1 - H_exit_actual)/(H_1 - H_exit) = 0.88, therefore\n", + "H_exit_actual = H_1 - 0.88*(H_1 - H_exit);\t\t\t# - Actual exit enthalpy\n", + "\n", + "\t\t\t#Now two properties i.e pressure = 0.6 MPa and enthalpy = H_exit_actual is fixed at the exit. The exit temperature is given by,\n", + "T_exit_actual = ((H_exit_actual - H_3)/(H_4 - H_3))*(300 - 250) + 250;\t\t\t#[C]\n", + "S_exit_actual = ((H_exit_actual - H_3)/(H_4 - H_3))*(S_4 - S_3) + S_3;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t#Now reversible work done is given by,\n", + "W_rev_2 = H_1 - H_exit_actual - T_0*(S_1 - S_exit_actual);\t\t\t#[kJ/kg]\n", + "print \" 2).The reversible work done is %f kJ/kg\"%(W_rev_2);\n", + "\n", + "\t\t\t#The actual work is given by the first law,\n", + "W_2 = H_1 - H_exit_actual;\t\t\t#[kJ/kg] - Actual work done\n", + "i = W_rev_2 - W_2;\t\t\t#[kJ/kg] - irreversibility\n", + "print \" The value of irreversibility is %f kJ/kg\"%(i);\n", + "\n", + "\t\t\t#The irreversibility can also be determined using\n", + "\t\t\t# i = T_0*S_gen, and S_gen is given by\n", + "\t\t\t# S_gen = (q/T_R) - delta_S\n", + "\n", + "\t\t\t#The second law efficiency of the turbine is actual work done divided by reversible work,therefore\n", + "sec_eff = W_2/W_rev_2;\n", + "print \" The second law efficiency of the turbine is %f\"%(sec_eff);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The reversible work done is 954.326778 kJ/kg\n", + " And since the maximum work is same as the actual work ,therefore irreversibility is zero\n", + " 2).The reversible work done is 905.072590 kJ/kg\n", + " The value of irreversibility is 65.265025 kJ/kg\n", + " The second law efficiency of the turbine is 0.927890\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.6 Page Number : 198" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "P_1 = 8.;\t\t\t#[bar] - Initial pressure\n", + "T_1 = 93. + 273.15;\t\t\t#[C] - Initial temperature\n", + "V_1 = 100.;\t\t\t#[m/s] - Initial velocity\n", + "P_2 = 1.25;\t\t\t#[bar] - Exit pressure\n", + "T_2 = 27. + 273.15;\t\t\t#[C] - Exit temperature\n", + "V_2 = 60.;\t\t\t#[m/s] - Exit velocity \n", + "Y = 1.4;\t\t\t#Ratio of specific heat capacities\n", + "T_0 = 298.15;\t\t\t#[K] - surrounding temperature\n", + "P_0 = 1.;\t\t\t#[bar] - surrounding pressure\n", + "R = 8.314;\t\t\t#[J/mol*K] - Gas constant\n", + "Cp_0 = (R*Y)/(Y-1);\t\t\t#[J/mol-K] - Heat capacity at constant pressure\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#Since the amount of heat transfer is negligible,therefore from first law the actual work done is given by,\n", + "\t\t\t#W = delta_H + (delta_V_square)/2\n", + "delta_H = Cp_0*(T_2 - T_1);\t\t\t#[J/mol] - enthalpy change\n", + "delta_H = (delta_H/28.84);\t\t\t#[kJ/kg] - (1 mole = 28.84 g).\n", + "delta_V_square = V_2**(2) - V_1**(2);\n", + "\n", + "W = - delta_H - ((delta_V_square)/2)/1000;\t\t\t#[kJ/kg] - Actual work done\n", + "print \" The actual work done is %f kJ/kg\"%(W);\n", + "\n", + "\t\t\t#Now let us calculate the maximum work that can be obtained\n", + "\t\t\t#W_rev = (H_1 + (V_1**(2))/2) - (H_2 + (V_2**(2))/2) - T_0*(S_1 - S_2)\n", + "delta_S = Cp_0*math.log(T_2/T_1) - R*math.log(P_2/P_1);\t\t\t#[J/mol-K] - Entropy change\n", + "delta_S = delta_S/28.84;\t\t\t#kJ/kg-K]\n", + "W_rev = -delta_H - ((delta_V_square/2)/1000) + T_0*delta_S;\t\t\t#[kJ/kg]\n", + "print \" The maximum work obtainable per kg of air is %f kJ/kg\"%(W_rev);\n", + "\n", + "\t\t\t#The second law efficiency of the turbine is actual work done divided by reversible work,therefore\n", + "sec_eff = W/W_rev;\n", + "print \" The second law efficiency of the turbine is %f\"%(sec_eff);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The actual work done is 69.792718 kJ/kg\n", + " The maximum work obtainable per kg of air is 169.550182 kJ/kg\n", + " The second law efficiency of the turbine is 0.411635\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.7 Page Number : 200" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "m_cold_water = 60;\t\t\t#[kg/s] - mass flow rate of cold water\n", + "P_1 = 50;\t\t\t#[kPa]\n", + "T_2 = 250;\t\t\t#[C]\n", + "T_water_1 = 1000 + 273.15;\t\t\t#[K] - Entering temperature of water\n", + "T_water_2 = 450 +273.15;\t\t\t#[K] - Exit temperature of water\n", + "T_0 = 298.15;\t\t\t#[K] - surrounding temperature\n", + "P_0 = 1;\t\t\t#[atm] - surrounding pressure\n", + "Cp_0 = 1.005;\t\t\t#[kJ/kg-K]\n", + "\n", + "\t\t\t#For water at 50 kPa under saturated conditions,T_sat = 81.33 C, \n", + "H_liq_1 = 340.49;\t\t\t#[kJ/kg] - Enthalpy\n", + "S_liq_1 = 1.0910;\t\t\t#[kJ/kg-K] - Entropy\n", + "\n", + "\t\t\t#For steam at 50 kPa and 250 C,\n", + "H_2 = 2976.0;\t\t\t#[kJ/kg]\n", + "S_2 = 8.3556;\t\t\t#[kJ/kg-K]\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#The cold stream is water which enters as saturated liquid at 50 kPa and exits as superheated vapour at 50 kPa and 250 C,since pressure drop is neglected.\n", + "\t\t\t#The mass flow rate of hot stream can be obtained from energy balance\n", + "m_hot_water = (m_cold_water*(H_2 - H_liq_1))/(Cp_0*(T_water_1 - T_water_2));\t\t\t#[kg/s] - mass flow rate of hot water\n", + "\n", + "\t\t\t#Since there is no heat exchange with the surrounding therefore the total entropy generation is given by\n", + "\t\t\t#S_gen = delta_S_hot + delta_S_cold\n", + "delta_S_cold = S_2 - S_liq_1;\t\t\t#[kJ/kg-K] - change of entropy of cold water\n", + "\t\t\t#delta_S_hot = Cp_0*math.log(T_2/T_1)-R*math.log(P_2/P_1), But pressure drop is zero,therfore\n", + "delta_S_hot = Cp_0*math.log(T_water_2/T_water_1);\t\t\t#[kJ/kg-K] - change of entropy of hot water\n", + "\n", + "S_gen = m_cold_water*delta_S_cold + m_hot_water*delta_S_hot;\t\t\t#[kW/K] - Entropy generated\n", + "print \" The entropy generation rate is %f kW/K\"%(S_gen);\n", + "\n", + "\t\t\t#The irreversibility rete is given by\n", + "I = T_0*S_gen;\t\t\t#[kW]\n", + "print \" The irreversibility rate of the heat exchanger is %f kW\"%(I);\n", + "\n", + "\t\t\t#The irreversibility can also be determined using the exergy approach\n", + "\t\t\t#We know that, I = W_rev - , but since actual work done zero in heat exchangers,therefore I = W_rev = exergy change\n", + "\t\t\t#(si_1 - si_2)_cold = H_1 - H_2 - T_0*(S_1 - S_2)\n", + "\t\t\t#(si_1 - si_2)_hot = Cp_0*(T_1 - T_2)- T_0*(S_1 - S_2)\n", + "\t\t\t# I = (si_1 - si_2)_cold - (si_1 - si_2)_hot.\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The entropy generation rate is 273.250824 kW/K\n", + " The irreversibility rate of the heat exchanger is 81469.733193 kW\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.8 Page Number : 201" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "m_water = 10000.;\t\t\t#[kg/h] - Mass flow rate of cold water\n", + "m_water = m_water/3600;\t\t\t#[kg/s]\n", + "T_1_water = 30. + 273.15;\t\t\t#[K] - Cold water entering temperature\n", + "m_HC = 5000.;\t\t\t#[kg/h] - mass flow rate of hot hydrocarbon\n", + "m_HC = m_HC/3600;\t\t\t#[kg/s]\n", + "T_1_HC = 200. + 273.15;\t\t\t#[K] - Hot hydrocarbon entering temperature\n", + "T_2_HC = 100. + 273.15;\t\t\t#[K] - Hot hydrocarbon leaving temperature\n", + "Cp_0_water = 1.0;\t\t\t#[kcal/kg-K] - Mean heat capacity of cooling water\n", + "Cp_0_HC = 0.6;\t\t\t#[kcal/kg-K] - Mean heat capacity of hydrocarbon\n", + "\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#(1)\n", + "\t\t\t#Applying energy balance to the heat exchanger,we get\n", + "\t\t\t#m_water*Cp_0_water*(T - T_1_water) = m_HC*Cp_0_HC*(T_1_HC - T_2_HC)\n", + "T_2_water = ((m_HC*Cp_0_HC*(T_1_HC - T_2_HC))/(m_water*Cp_0_water)) + T_1_water;\t\t\t#[K]\n", + "T_2 = T_2_water - 273.15;\t\t\t#[C]\n", + "print \" 1).The exit temperature of the cooling water is %f C\"%(T_2);\n", + "\n", + "\t\t\t#(2)\n", + "\t\t\t#delta_S_hot_HC = Cp_0*math.log(T_2/T_1)-R*math.log(P_2/P_1), But pressure drop is zero,therfore\n", + "delta_S_hot_HC = (Cp_0_HC*4.184)*math.log(T_2_HC/T_1_HC);\t\t\t#[kW/K] - change of entropy of hot hydrocarbon\n", + "delta_S_HC = m_HC*delta_S_hot_HC;\t\t\t#[kW/K] - Entropy change for hudrocarbon liquid \n", + "print \" 2).Entropy change rate of hydrocarbon liquid is %f kW/K\"%(delta_S_HC);\n", + "\n", + "delta_S_cold_water = (Cp_0_water*4.184)*math.log(T_2_water/T_1_water);\t\t\t#[kW/K] - change of entropy of cooling water\n", + "delta_S_water = m_water*delta_S_cold_water;\t\t\t#[kW/K] - Entropy change for water\n", + "print \" And entropy change rate of water is %f kW/K\"%(delta_S_water);\n", + "\n", + "\t\t\t#(3)\n", + "T_0 = 298.15;\t\t\t#[K] - Surrounding temperature\n", + "\t\t\t#S_gen = delta_S_cold_water + delta_S_hot_HC = m_water*delta_S_cold_water + m_HC*delta_S_hot_HC;\t\t\t#[kW/K] - Entropy generated\n", + "S_gen = delta_S_water + delta_S_HC;\t\t\t#[kW/K]\n", + "I = T_0*S_gen;\t\t\t#[kW]\n", + "print \" 3).The irreversibility rate of the heat exchanger is %f kW\"%(I);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The exit temperature of the cooling water is 60.000000 C\n", + " 2).Entropy change rate of hydrocarbon liquid is -0.827846 kW/K\n", + " And entropy change rate of water is 1.096732 kW/K\n", + " 3).The irreversibility rate of the heat exchanger is 80.168382 kW\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.9 Page Number : 202" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T_1_hotgas = 800.;\t\t\t#[K]\n", + "P_1_hotgas = 1.;\t\t\t#[bar]\n", + "T_2_hotgas = 700.;\t\t\t#[K]\n", + "P_2_hotgas = 1.;\t\t\t#[bar]\n", + "T_1_air = 470.;\t\t\t#[K]\n", + "P_1_air = 1.;\t\t\t#[bar]\n", + "P_2_air = 1.;\t\t\t#[bar]\n", + "Cp_0_hotgas = 1.08;\t\t\t#[kJ/kg-K] - Mean heat capacity of hot gas\n", + "Cp_0_air = 1.05;\t\t\t#[kcal/kg-K] - Mean heat capacity of air\n", + "T_0 = 298.15;\t\t\t#[K] - surrounding temperature\n", + "P_0 = 1.;\t\t\t#[bar] - surrounding pressure\n", + "\t\t\t#m_air = 2*m_hotgas\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#(1)\n", + "\t\t\t#Assuming heat exchange only takes places in-between the streams,from energy balance we get,\n", + "\t\t\t#m_gas*Cp_0_hotgas*(T_2_hotgas - T_1_hotgas) + 2*m_gas*Cp_0_air*(T - T_1_air), \n", + "T_2_air = T_1_air - ((Cp_0_hotgas*(T_2_hotgas - T_1_hotgas))/(2*Cp_0_air));\t\t\t#[K] - Temp of emerging air\n", + "print \" 1).The temperature of emerging air is %f K\"%(T_2_air);\n", + "\n", + "\t\t\t#(2)\n", + "\t\t\t#Availability change of hot gas is given by,\n", + "\t\t\t#(si_1 - si_2)_hot = H_1 - H_2 - T_0*(S_1 - S_2)\n", + "delta_H_hotgas = (Cp_0_hotgas*(T_2_hotgas - T_1_hotgas));\t\t\t#[kJ/kg] - change in enthalpy of hotgas\n", + "\t\t\t#delta_S_hotgas = Cp_0_hotgas*math.log(T_2_hotgas/T_1_hotgas)- R*math.log(P_2/P_1), But pressure drop is zero (P_1 = P_2),therfore\n", + "delta_S_hotgas = Cp_0_hotgas*math.log(T_2_hotgas/T_1_hotgas);\t\t\t#[kJ/kg-K] - change of entropy of hot gas\n", + "delta_si_hotgas = (-delta_H_hotgas) - (-T_0*delta_S_hotgas);\t\t\t#[kJ/kg]\n", + "print \" 2).The availability change of hot gas is %f kJ/kg\"%(delta_si_hotgas);\n", + "\n", + "\t\t\t#(3)\n", + "\t\t\t#Availability change of air is given by,\n", + "\t\t\t#(si_1 - si_2)_air = H_1 - H_2 - T_0*(S_1 - S_2)\n", + "delta_H_air = (Cp_0_air*(T_2_air - T_1_air));\t\t\t#[kJ/kg] - change in enthalpy of air\n", + "\t\t\t#delta_S_air = Cp_0_air*math.log(T_2_air/T_1_air)- R*math.log(P_2/P_1), But pressure drop is zero (P_1 = P_2),therfore\n", + "delta_S_air = Cp_0_air*math.log(T_2_air/T_1_air);\t\t\t#[kJ/kg-K] - change of entropy of air\n", + "delta_si_air = (-delta_H_air) - (-T_0*delta_S_air);\t\t\t#[kJ/kg]\n", + "print \" 3).The availability change of air is %f kJ/kg\"%(delta_si_air);\n", + "\n", + "\t\t\t#(4)\n", + "\t\t\t#For the heat exchanger (Q = 0, W = 0)\n", + "\t\t\t#Basis : 1 kg of hot gas flowing through heat exchanger\n", + "S_gen = delta_S_hotgas + 2*delta_S_air;\t\t\t#[kJ/kg-K] - (as m_air = 2*m_hotgas)\n", + "I = T_0*S_gen;\t\t\t#[kJ/kg]\n", + "print \" 4).The irreversibility of thr exchanger per kg of hot gas flowing is %f kJ/kg\"%(I);\n", + "\n", + "\t\t\t#Irreversibility can also be obtained using\n", + "\t\t\t#I = 2*(si_1 - si_2)_air + (si_1 - si_2)_hotgas\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The temperature of emerging air is 521.428571 K\n", + " 2).The availability change of hot gas is 65.002625 kJ/kg\n", + " 3).The availability change of air is -21.492234 kJ/kg\n", + " 4).The irreversibility of thr exchanger per kg of hot gas flowing is 22.018157 kJ/kg\n" + ] + } + ], + "prompt_number": 9 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch6_2-checkpoint.ipynb b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch6_2-checkpoint.ipynb new file mode 100644 index 00000000..71808e15 --- /dev/null +++ b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch6_2-checkpoint.ipynb @@ -0,0 +1,851 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:5875fd58ba5a3eb4a34d80c6cbf01fc2219f223f8352a521a425e02950a18a26" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 6 :Chemical reactions" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.1 Page Number : 217" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math \n", + "from scipy.integrate import quad \n", + "\t\t\t\n", + "\n", + "# Variables\n", + "T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard temperature\n", + "T_2 = 880;\t\t\t#[K] - Reaction temperature\n", + "\n", + "a_SO2 = 6.157;\n", + "a_SO3 = 3.918;\n", + "a_O2 = 6.732;\n", + "b_SO2 = 1.384*10**(-2);\n", + "b_SO3 = 3.483*10**(-2);\n", + "b_O2 = 0.1505*10**(-2);\n", + "c_SO2 = -0.9103*10**(-5);\n", + "c_SO3 = -2.675*10**(-5);\n", + "c_O2 = -0.01791*10**(-5);\n", + "d_SO2 = 2.057*10**(-9);\n", + "d_SO3 = 7.744*10**(-9);\n", + "\n", + "delta_H_rkn_298 = -23.45*10**(3);\t\t\t#[cal] - Rkn enthalpy at 298.15 K\n", + "delta_H_SO2_for_298 = -70.94*10**(3);\t\t\t#[cal/mol] - Enthalpy of formation of S02 at 298.15 K\n", + "delta_H_SO3_for_298 = -94.39*10**(3);\t\t\t#[cal/mol] - Enthalpy of formation of SO3 at 298.15 K\n", + "delta_G_SO2_for_298 = -71.68*10**(3);\t\t\t#[cal/mol] - Gibbs free energy change for formation of SO2 at 298.15 K\n", + "delta_G_SO3_for_298 = -88.59*10**(3);\t\t\t#[cal/mol] - Gibbs free energy change for formation of SO3 at 298.15 K\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#(1)\n", + "\t\t\t#Smath.tan(math.radiansard enthalpy change of reaction at temperature T is given by,\n", + "\t\t\t#delta_H_rkn_T = delta_rkn_298 + delta_Cp_0*delta_T\n", + "delta_a = a_SO3 - a_SO2 - (a_O2/2);\n", + "delta_b = b_SO3 - b_SO2 - (b_O2/2);\n", + "delta_c = c_SO3 - c_SO2 - (c_O2/2);\n", + "delta_d = d_SO3 - d_SO2;\n", + "\n", + "\t\t\t#Cp_0 = delta_a + (delta_b*T) + (delta_c*T**(2)) + (delta_d*T**(3));\n", + "\t\t\t#Therefore we get,\n", + "\n", + "def f44(T): \n", + "\t return delta_a+(delta_b*T)+(delta_c*T**(2))+(delta_d*T**(3))\n", + "\n", + "delta_H_rkn_880 = delta_H_rkn_298 + quad(f44,T_1,T_2)[0]\n", + "\n", + "\n", + "\t\t\t#On manual simplification of the above expression,we will get the expression for 'delta_H_rkn_880' as a function of T,\n", + " \n", + "print \" 1.The expression for smath.tan(math.radiansard enthalpy change of reaction as a function of temperature is given by\";\n", + "print \" delta_H_rkn_880 = -22534.57 - 5.605*T + 1.012*10**-2*T**2 - 0.585*10**-5*T**3 + 1.422*10**-9*T**4\"\n", + "\n", + "print \" 2).Staandard enthalpy change of reaction at 880 K is %f cal\"%(delta_H_rkn_880);\n", + "\n", + "\t\t\t#(3)\n", + "\t\t\t#Let us determine the smath.tan(math.radiansard entropy change of reaction at 298.15 K\n", + "delta_S_SO2_298 = (delta_H_SO2_for_298 - delta_G_SO2_for_298)/298.15;\t\t\t#[cal/mol-K]\n", + "delta_S_SO3_298 = (delta_H_SO3_for_298 - delta_G_SO3_for_298)/298.15;\t\t\t#[cal/mol-K]\n", + "delta_S_O2_298 = 0;\t\t\t#[cal/mol-K]\n", + "\n", + "delta_S_rkn_298 = delta_S_SO3_298 - delta_S_SO2_298 - (delta_S_O2_298/2);\t\t\t#[cal/K]\n", + "\n", + "def f45(T): \n", + "\t return (delta_a+delta_b*T+delta_c*T**(2)+delta_d*T**(3))/T\n", + "\n", + "delta_S_rkn_880 = delta_S_rkn_298 + quad(f45,T_1,T_2)[0]\n", + "\n", + "\n", + "print \" 3).Standard entropy change of reaction at 880 K is %f cal/K\"%(delta_S_rkn_880);\n", + "\n", + "\t\t\t#(4)\n", + "delta_G_rkn_880 = delta_H_rkn_880 - 880*delta_S_rkn_880;\t\t\t#[cal]\n", + "\n", + "print \" 4).Standard Gibbs free energy change of reaction at 880 K is %f cal\"%(delta_G_rkn_880);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1.The expression for smath.tan(math.radiansard enthalpy change of reaction as a function of temperature is given by\n", + " delta_H_rkn_880 = -22534.57 - 5.605*T + 1.012*10**-2*T**2 - 0.585*10**-5*T**3 + 1.422*10**-9*T**4\n", + " 2).Staandard enthalpy change of reaction at 880 K is -22766.609215 cal\n", + " 3).Standard entropy change of reaction at 880 K is -21.002783 cal/K\n", + " 4).Standard Gibbs free energy change of reaction at 880 K is -4284.160417 cal\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.2 Page Number : 219" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard temperature\n", + "T_2 = 400;\t\t\t#[K] - Reaction temperature\n", + "\n", + "a_CH3OH = 4.55;\n", + "a_CO = 6.726;\n", + "a_H2 = 6.952;\n", + "b_CH3OH = 2.186*10**(-2);\n", + "b_CO = 0.04001*10**(-2);\n", + "b_H2 = -0.04576*10**(-2);\n", + "c_CH3OH = -0.291*10**(-5);\n", + "c_CO = 0.1283*10**(-5);\n", + "c_H2 = 0.09563*10**(-5);\n", + "d_CH3OH = -1.92*10**(-9);\n", + "d_CO = -0.5307*10**(-9);\n", + "d_H2 = -0.2079*10**(-9);\n", + "\n", + "delta_H_rkn_298 = -21.6643*10**(3);\t\t\t#[cal] - Reaction enthalpy at 298.15 K\n", + "delta_H_CO_for_298 = -26.4157*10**(3);\t\t\t#[cal/mol] - Enthalpy of formation of CO at 298.15 K\n", + "delta_H_CH3OH_for_298 = -48.08*10**(3);\t\t\t#[cal/mol] - Enthalpy of formation of CH3OH at 298.15 K\n", + "delta_G_CO_for_298 = -32.8079*10**(3);\t\t\t#[cal/mol] - Gibbs free energy change for formation of CO at 298.15 K\n", + "delta_G_CH3OH_for_298 = -38.69*10**(3);\t\t\t#[cal/mol] - Gibbs free energy change for formation of CH3OH at 298.15 K\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#Smath.tan(math.radiansard enthalpy change of reaction at temperature T is given by,\n", + "\t\t\t#delta_H_rkn_T = delta_rkn_298 + delta_Cp_0*delta_T\n", + "delta_a = a_CH3OH - a_CO - 2*(a_H2);\n", + "delta_b = b_CH3OH - b_CO - 2*(b_H2);\n", + "delta_c = c_CH3OH - c_CO - 2*(c_H2);\n", + "delta_d = d_CH3OH - d_CO - 2*(d_H2);\n", + "\n", + "\t\t\t#Cp_0 = delta_a + (delta_b*T) + (delta_c*T**(2)) + (delta_d*T**(3));\n", + "\t\t\t#Therefore we get,\n", + "\n", + "def f56(T): \n", + "\t return delta_a+(delta_b*T)+(delta_c*T**(2))+(delta_d*T**(3))\n", + "\n", + "delta_H_rkn_400 = delta_H_rkn_298 + quad(f56,T_1,T_2)[0]\n", + "\n", + "\n", + "print \" Standard enthalpy change of reaction at 400 K is %f cal\"%(delta_H_rkn_400);\n", + "\n", + "\t\t\t#Let us determine the smath.tan(math.radiansard Gibbs free energy change of reaction at 298.15 K\n", + "delta_G_rkn_298 = delta_G_CH3OH_for_298 - delta_G_CO_for_298;\t\t\t#[cal]\n", + "\n", + "\t\t\t#Now determining the smath.tan(math.radiansard entropy change of reaction at 298.15 K\n", + "delta_S_rkn_298 = (delta_H_rkn_298 - delta_G_rkn_298)/298.15;\t\t\t#[cal/mol-K]\n", + "\n", + "\n", + "def f57(T): \n", + "\t return (delta_a+delta_b*T+delta_c*T**(2)+delta_d*T**(3))/T\n", + "\n", + "delta_S_rkn_400 = delta_S_rkn_298 + quad(f57,T_1,T_2)[0]\n", + "\n", + "\t\t\t#Therefore,the smath.tan(math.radiansard Gibbs free energy change of the reaction is given by,\n", + "delta_G_rkn_400 = delta_H_rkn_400 - 400*delta_S_rkn_400;\t\t\t#[cal]\n", + "\n", + "print \" Standard Gibbs free energy change of reaction at 400 K is %f cal\"%(delta_G_rkn_400);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Standard enthalpy change of reaction at 400 K is -22587.159576 cal\n", + " Standard Gibbs free energy change of reaction at 400 K is -343.363287 cal\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.3 Page Number : 220" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard temperature\n", + "T_2 = 1200;\t\t\t#[K] - Reaction temperature\n", + "\n", + "\n", + "a_CO2 = 5.316;\n", + "a_H2 = 6.952;\n", + "a_CO = 6.726;\n", + "a_H2O = 7.700;\n", + "b_CO2 = 1.4285*10**(-2);\n", + "b_H2 = -0.04576*10**(-2);\n", + "b_CO = 0.04001*10**(-2);\n", + "b_H2O = 0.04594*10**(-2);\n", + "c_CO2 = -0.8362*10**(-5);\n", + "c_H2 = 0.09563*10**(-5);\n", + "c_CO = 0.1283*10**(-5);\n", + "c_H2O = 0.2521*10**(-5);\n", + "d_CO2 = 1.784*10**(-9);\n", + "d_H2 = -0.2079*10**(-9);\n", + "d_CO = -0.5307*10**(-9);\n", + "d_H2O = -0.8587*10**(-9);\n", + "\n", + "# Calculations and Results\n", + "delta_H_rkn_298 = -9.8382*10**(3);\t\t\t#[cal] - Reaction enthalpy at 298.15 K\n", + "delta_H_CO2_for_298 = -94.0518*10**(3);\t\t\t#[cal/mol-K] - Enthalpy of formation of CO2 at 298.15 K\n", + "delta_H_CO_for_298 = -26.4157*10**(3);\t\t\t#[cal/mol-K] - Enthalpy of formation of CO at 298.15 K\n", + "delta_H_H2O_for_298 = -57.7979*10**(3);\t\t\t#[cal/mol-K] - Enthalpy of formation of H2O at 298.15 K\n", + "delta_G_CO2_for_298 = -94.2598*10**(3);\t\t\t#[cal/mol] - Gibbs free energy change for formation of CO at 298.15 K\n", + "delta_G_CO_for_298 = -32.8079*10**(3);\t\t\t#[cal/mol] - Gibbs free energy change for formation of CH3OH at 298.15 K\n", + "delta_G_H2O_for_298 = -54.6357*10**(3);\t\t\t#[cal/mol] - Gibbs free energy change for formation of H2O at 298.15 K\n", + "\n", + "\t\t\t#Smath.tan(math.radiansard enthalpy change of reaction at temperature T is given by,\n", + "\t\t\t#delta_H_rkn_T = delta_rkn_298 + delta_Cp_0*delta_T\n", + "delta_a = a_CO2 + a_H2 - a_CO - a_H2O;\n", + "delta_b = b_CO2 + b_H2 - b_CO - b_H2O;\n", + "delta_c = c_CO2 + c_H2 - c_CO - c_H2O;\n", + "delta_d = d_CO2 + d_H2 - d_CO - d_H2O;\n", + "\n", + "\t\t\t#Cp_0 = delta_a + (delta_b*T) + (delta_c*T**(2)) + (delta_d*T**(3));\n", + "\t\t\t#Therefore we get,\n", + "\n", + "def f11(T): \n", + "\t return delta_a+(delta_b*T)+(delta_c*T**(2))+(delta_d*T**(3))\n", + "\n", + "delta_H_rkn_1200 = delta_H_rkn_298 + quad(f11,T_1,T_2)[0]\n", + "\n", + "\n", + "print \" Standard enthalpy change of reaction at 1200 K is %f cal\"%(delta_H_rkn_1200);\n", + "\n", + "\t\t\t#Let us determine the smath.tan(math.radiansard Gibbs free energy change of reaction at 298.15 K\n", + "delta_G_rkn_298 = delta_G_CO2_for_298 - delta_G_CO_for_298 - delta_G_H2O_for_298;\t\t\t#[cal]\n", + "\n", + "\t\t\t#Now determining the smath.tan(math.radiansard entropy change of reaction at 298.15 K\n", + "delta_S_rkn_298 = (delta_H_rkn_298 - delta_G_rkn_298)/298.15;\t\t\t#[cal/mol-K]\n", + "\n", + "\n", + "def f12(T): \n", + "\t return (delta_a+delta_b*T+delta_c*T**(2)+delta_d*T**(3))/T\n", + "\n", + "delta_S_rkn_1200 = delta_S_rkn_298 + quad(f12,T_1,T_2)[0]\n", + "\n", + "\t\t\t#Therefore,the smath.tan(math.radiansard Gibbs free energy change of the reaction is given by,\n", + "delta_G_rkn_1200 = delta_H_rkn_1200 - 1200*delta_S_rkn_1200;\t\t\t#[cal]\n", + "\n", + "print \" Standard Gibbs free energy change of reaction at 1200 K is %f cal\"%(delta_G_rkn_1200);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Standard enthalpy change of reaction at 1200 K is -7850.182811 cal\n", + " Standard Gibbs free energy change of reaction at 1200 K is 953.652749 cal\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.4 Page Number : 221" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard temperature\n", + "T_2 = 500;\t\t\t#[K] - Reaction temperature\n", + "\n", + "a_NH3 = 6.5846;\n", + "a_N2 = 6.903;\n", + "a_H2 = 6.952;\n", + "b_NH3 = 0.61251*10**(-2);\n", + "b_N2 = -0.03753*10**(-2);\n", + "b_H2 = -0.04576*10**(-2);\n", + "c_NH3 = 0.23663*10**(-5);\n", + "c_N2 = 0.1930*10**(-5);\n", + "c_H2 = 0.09563*10**(-5);\n", + "d_NH3 = -1.5981*10**(-9);\n", + "d_N2 = -0.6861*10**(-9);\n", + "d_H2 = -0.2079*10**(-9);\n", + "\n", + "delta_H_rkn_298 = -22.08*10**(3);\t\t\t#[cal] - Reaction enthalpy at 298.15 K\n", + "delta_H_NH3_for_298 = -11.04*10**(3);\t\t\t#[cal/mol] - Enthalpy of formation of NH3 at 298.15 K\n", + "delta_G_NH3_for_298 = -3.976*10**(3);\t\t\t#[cal/mol] - Gibbs free energy change for formation of NH3 at 298.15 K\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#Smath.tan(math.radiansard enthalpy change of reaction at temperature T is given by,\n", + "\t\t\t#delta_H_rkn_T = delta_rkn_298 + delta_Cp_0*delta_T\n", + "delta_a = 2*a_NH3 - a_N2 - 3*a_H2;\n", + "delta_b = 2*b_NH3 - b_N2 - 3*b_H2;\n", + "delta_c = 2*c_NH3 - c_N2 - 3*c_H2;\n", + "delta_d = 2*d_NH3 - d_N2 - 3*d_H2;\n", + "\n", + "\t\t\t#Cp_0 = delta_a + (delta_b*T) + (delta_c*T**(2)) + (delta_d*T**(3));\n", + "\t\t\t#Therefore we get,\n", + "\n", + "def f5(T): \n", + "\t return delta_a+(delta_b*T)+(delta_c*T**(2))+(delta_d*T**(3))\n", + "\n", + "delta_H_rkn_500 = delta_H_rkn_298 + quad(f5,T_1,T_2)[0]\n", + "\n", + "\n", + "print \" Standard enthalpy change of reaction at 500 K is %f cal\"%(delta_H_rkn_500);\n", + "\n", + "\t\t\t#Let us determine the smath.tan(math.radiansard Gibbs free energy change of reaction at 298.15 K\n", + "delta_G_rkn_298 = 2*delta_G_NH3_for_298;\t\t\t#[cal]\n", + "\n", + "\t\t\t#Now determining the smath.tan(math.radiansard entropy change of reaction at 298.15 K\n", + "delta_S_rkn_298 = (delta_H_rkn_298 - delta_G_rkn_298)/298.15;\t\t\t#[cal/mol-K]\n", + "\n", + "\n", + "def f6(T): \n", + "\t return (delta_a+delta_b*T+delta_c*T**(2)+delta_d*T**(3))/T\n", + "\n", + "delta_S_rkn_500 = delta_S_rkn_298 + quad(f6,T_1,T_2)[0]\n", + "\n", + "\t\t\t#Therefore,the smath.tan(math.radiansard Gibbs free energy change of the reaction is given by,\n", + "delta_G_rkn_500 = delta_H_rkn_500 - 500*delta_S_rkn_500;\t\t\t#[cal]\n", + "\n", + "print \" Standard Gibbs free energy change of reaction at 500 K is %f cal\"%(delta_G_rkn_500);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Standard enthalpy change of reaction at 500 K is -23925.267197 cal\n", + " Standard Gibbs free energy change of reaction at 500 K is 2159.910425 cal\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.5 Page Number : 222" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "delta_H_rkn_298 = -57.7979*10**(3);\t\t\t#[cal/mol] - Reaction enthalpy at 298.15 K\n", + "delta_G_rkn_298 = -54.6351*10**(3);\t\t\t#[cal/mol] - Gibbs free energy change for formation of H2O at 298.15 K\n", + "\n", + "\t\t\t#Smath.tan(math.radiansard enthalpy change of reaction at temperature T is given by,\n", + "\t\t\t#delta_H_rkn_T = delta_rkn_298 + delta_Cp_0*delta_T\n", + "T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard temperature\n", + "T_2_1 = 873.15;\t\t\t#[K] - Reaction temperature\n", + "T_2_2 = 1000;\t\t\t#[K] - Reaction temperature\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#Therefore we get,\n", + "\n", + "def f34(T): \n", + "\t return 7.7+0.04594*10**(-2)*T+0.2521*10**(-5)*T**(2)-0.8587*10**(-9)*T**(3)\n", + "\n", + "delta_H_rkn_873 = delta_H_rkn_298 + quad(f34,T_1,T_2_1)[0]\n", + "\n", + "\n", + "def f35(T): \n", + "\t return 7.7+0.04594*10**(-2)*T+0.2521*10**(-5)*T**(2)-0.8587*10**(-9)*T**(3)\n", + "\n", + "delta_H_rkn_1000 = delta_H_rkn_298 + quad(f35,T_1,T_2_2)[0]\n", + "\n", + "\n", + "print \" Standard enthalpy change of reaction at 873 K is %f cal/mol\"%(delta_H_rkn_873);\n", + "print \" Standard enthalpy change of reaction at 1000 K is %f cal/mol\"%(delta_H_rkn_1000);\n", + "\n", + "\t\t\t#Now determining the smath.tan(math.radiansard entropy change of reaction at 298.15 K\n", + "delta_S_rkn_298 = (delta_H_rkn_298 - delta_G_rkn_298)/298.15;\t\t\t#[cal/mol-K]\n", + "\n", + "\n", + "def f36(T): \n", + "\t return (7.7+0.04594*10**(-2)*T+0.2521*10**(-5)*T**(2)-0.8587*10**(-9)*T**(3))/T\n", + "\n", + "delta_S_rkn_873 = delta_S_rkn_298 + quad(f36,T_1,T_2_1)[0]\n", + "\n", + "\n", + "def f37(T): \n", + "\t return (7.7+0.04594*10**(-2)*T+0.2521*10**(-5)*T**(2)-0.8587*10**(-9)*T**(3))/T\n", + "\n", + "delta_S_rkn_1000 = delta_S_rkn_298 + quad(f37,T_1,T_2_2)[0]\n", + "\n", + "\t\t\t#Therefore,the smath.tan(math.radiansard Gibbs free energy change of the reaction is given by,\n", + "delta_G_rkn_873 = (delta_H_rkn_873 - 873.15*delta_S_rkn_873)*10**(-3);\t\t\t#[kcal/mol]\n", + "delta_G_rkn_1000 = (delta_H_rkn_1000 - 1000*delta_S_rkn_1000)*10**(-3);\t\t\t#[kcal/mol]\n", + "\n", + "print \" Standard Gibbs free energy change of reaction at 873 K is %f kcal/mol\"%(delta_G_rkn_873);\n", + "print \" Standard Gibbs free energy change of reaction at 1000 K is %f kcal/mol\"%(delta_G_rkn_1000);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Standard enthalpy change of reaction at 873 K is -52801.656303 cal/mol\n", + " Standard enthalpy change of reaction at 1000 K is -51579.290952 cal/mol\n", + " Standard Gibbs free energy change of reaction at 873 K is -51.575573 kcal/mol\n", + " Standard Gibbs free energy change of reaction at 1000 K is -51.481661 kcal/mol\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.6 Page Number : 223" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard temperature\n", + "T_2 = 500.;\t\t\t#[K] - Reaction temperature\n", + "\n", + "a_C2H6 = 1.648;\n", + "a_O2 = 6.085;\n", + "a_CO2 = 5.316;\n", + "a_H2O = 7.700;\n", + "b_C2H6 = 4.124*10**(-2);\n", + "b_O2 = 0.3631*10**(-2);\n", + "b_CO2 = 1.4285*10**(-2);\n", + "b_H2O = 0.04594*10**(-2);\n", + "c_C2H6 = -1.530*10**(-5);\n", + "c_O2 = -0.1709*10**(-5);\n", + "c_CO2 = -0.8362*10**(-5);\n", + "c_H2O = 0.2521*10**(-5);\n", + "d_C2H6 = 1.740*10**(-9);\n", + "d_O2 = 0.3133*10**(-9);\n", + "d_CO2 = 1.784*10**(-9);\n", + "d_H2O = -0.8587*10**(-9);\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#Since excess is entering and leaving at the same temperature,therefore it does not take or give any heat to the system.\n", + "\t\t\t#Therefore the heat exchange is only due to heat of raction at temperature T, or Q = delta_H_rkn_T\n", + "\n", + "delta_H_C2H6_for_298 = -20.236*10**(3);\t\t\t#[cal/mol] - Enthalpy of formation of C2H6 at 298.15 K\n", + "delta_H_CO2_for_298 = -94.0518*10**(3);\t\t\t#[cal/mol] - Enthalpy of formation of CO2 at 298.15 K\n", + "delta_H_H2O_for_298 = -57.7979*10**(3);\t\t\t#[cal/mol] - Enthalpy of formation of H2O at 298.15 K\n", + "\n", + "delta_H_rkn_298 = 2*delta_H_CO2_for_298 + 3*delta_H_H2O_for_298 - delta_H_C2H6_for_298;\t\t\t#[cal] - Reaction enthalpy at 298.15 K\n", + "\n", + "\t\t\t#Smath.tan(math.radiansard enthalpy change of reaction at temperature T is given by,\n", + "\t\t\t#delta_H_rkn_T = delta_rkn_298 + delta_Cp_0*delta_T\n", + "delta_a = 2*a_CO2 + 3*a_H2O - a_C2H6 - 7./2*(a_O2);\n", + "delta_b = 2*b_CO2 + 3*b_H2O - b_C2H6 - 7./2*(b_O2);\n", + "delta_c = 2*c_CO2 + 3*c_H2O - c_C2H6 - 7./2*(c_O2);\n", + "delta_d = 2*d_CO2 + 3*d_H2O - d_C2H6 - 7./2*(d_O2);\n", + "\n", + "\t\t\t#Cp_0 = delta_a + (delta_b*T) + (delta_c*T**(2)) + (delta_d*T**(3));\n", + "\t\t\t#Therefore we get,\n", + "\n", + "def f55(T): \n", + "\t return delta_a+(delta_b*T)+(delta_c*T**(2))+(delta_d*T**(3))\n", + "\n", + "delta_H_rkn_500 = delta_H_rkn_298 + quad(f55,T_1,T_2)[0]\n", + "\n", + "delta_H_rkn_500 = delta_H_rkn_500*10**(-3);\t\t\t#[kcal]\n", + "\n", + "print \" The heat exchange of the reaction at 500 K is %f kcal\"%(delta_H_rkn_500);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The heat exchange of the reaction at 500 K is -340.644585 kcal\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.7 Page Number : 224" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard temperature\n", + "T_2 = 600.;\t\t\t#[K] - Reaction temperature\n", + "\n", + "a_C2H6 = -8.65;\n", + "a_H2O = 7.700;\n", + "a_CH4 = 4.750;\n", + "a_O2 = 6.085;\n", + "b_C2H6 = 11.578*10**(-2);\n", + "b_H2O = 0.04594*10**(-2);\n", + "b_CH4 = 1.200*10**(-2);\n", + "b_O2 = 0.3631*10**(-2);\n", + "c_C2H6 = -7.540*10**(-5);\n", + "c_H2O = 0.2521*10**(-5);\n", + "c_CH4 = 0.3030*10**(-5);\n", + "c_O2 = -0.1709*10**(-5);\n", + "d_C2H6 = 18.54*10**(-9);\n", + "d_H2O = -0.8587*10**(-9);\n", + "d_CH4 = -2.630*10**(-9);\n", + "d_O2 = 0.3133*10**(-9);\n", + "\n", + "delta_S_CH4_for_298 = 44.50;\t\t\t#[cal/mol-K] - Entropy of formation of CH4 at 298.15 K\n", + "delta_S_O2_for_298 = 49.00;\t\t\t#[cal/mol-K] - Entropy of formation of O2 at 298.15 K\n", + "delta_S_C2H6_for_298 = 64.34;\t\t\t#[cal/mol-K] - Entropy of formation of C2H6 at 298.15 K\n", + "delta_S_H2O_for_298 = 45.11;\t\t\t#[cal/mol-K] - Entropy of formation of C2H6 at 298.15 K\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#Cp_0 = delta_a + (delta_b*T) + (delta_c*T**(2)) + (delta_d*T**(3));\n", + "\n", + "\t\t\t#Smath.tan(math.radiansard entropy change of reaction at temperature T is given by,\n", + "\t\t\t#delta_S_rkn_T = delta_rkn_298 + delta_Cp_0*delta_T\n", + "delta_a = 1./6*(a_C2H6) + 3./2*(a_H2O) - a_CH4 - 3./4*(a_O2);\n", + "delta_b = 1./6*(b_C2H6) + 3./2*(b_H2O) - b_CH4 - 3./4*(b_O2);\n", + "delta_c = 1./6*(c_C2H6) + 3./2*(c_H2O) - c_CH4 - 3./4*(c_O2);\n", + "delta_d = 1./6*(d_C2H6) + 3./2*(d_H2O) - d_CH4 - 3./4*(d_O2);\n", + "\n", + "delta_S_rkn_298 = 1./6*(delta_S_C2H6_for_298) + 3./2*(delta_S_H2O_for_298) - delta_S_CH4_for_298 - 3./4*(delta_S_O2_for_298);\t\t\t#[cal/K]\n", + "\n", + "def f27(T): \n", + "\t return (delta_a+delta_b*T+delta_c*T**(2)+delta_d*T**(3))/T\n", + "\n", + "delta_S_rkn_600 = delta_S_rkn_298 + quad(f27,T_1,T_2)[0]\n", + "\n", + "\n", + "print \" Change in entropy of the reaction at 298.15 K is %f cal/K\"%(delta_S_rkn_298);\n", + "print \" Standard entropy change of reaction at 600 K is %f cal/K\"%(delta_S_rkn_600);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Change in entropy of the reaction at 298.15 K is -2.861667 cal/K\n", + " Standard entropy change of reaction at 600 K is -1.880233 cal/K\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.8 Page Number : 225" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard temperature\n", + "T_2 = 973.15;\t\t\t#[K] - Reaction temperature\n", + "\n", + "\t\t\t#At 298.15 K\n", + "delta_H_CH4_for_298 = -17.889*10**(3);\t\t\t#[cal/mol] - Enthalpy of formation of CH4 at 298.15 K\n", + "delta_H_C_for_298 = 0.00;\t\t\t#[cal/mol] - Enthalpy of formation of C (s, graphite) at 298.15 K\n", + "delta_H_H2_for_298 = 0.00;\t\t\t#[cal/mol] - Enthalpy of formation of H2 at 298.15 K\n", + "delta_G_CH4_for_298 = -12.140*10**(3);\t\t\t#[cal/mol] - Gibbs free energy change for formation of H2 at 298.15 K\n", + "delta_G_C_for_298 = 0.00;\t\t\t#[cal/mol] - Gibbs free energy change for formation of C (s, graphite) at 298.15 K\n", + "delta_G_H2_for_298 = 0.00;\t\t\t#[cal/mol] - Gibbs free energy change for formation of H2 at 298.15 K\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#/Smath.tan(math.radiansaerd heat capacity data in cal/mol-K are given below, T is in K\n", + "\t\t\t#Cp_0_CH4 = 4.75 + 1.2*10**(-2)*T + 0.303*10**(-5)*T**(2) - 2.63*10**(-9)*T**(3)\n", + "\t\t\t#Cp_0_C = 3.519 + 1.532*10**(-3)*T - 1.723*10**(5)*T**(-2)\n", + "\t\t\t#Cp_0_H2 = 6.952 - 0.04576*10**(-2)*T + 0.09563*10**(-5)*T**(2) - 0.2079*10**(-9)*T**(3)\n", + "\n", + "\t\t\t#Therefore smath.tan(math.radiansard heat capacity of reaction is given by,\n", + "\t\t\t#Cp_0_rkn = 2*Cp_0_H2 + Cp_0_C - Cp_0_CH4\n", + "\t\t\t#On simplification,we get the relation\n", + "\t\t\t#Cp_0_rkn = 12.673 - 0.0113832*T - 1.1174*10**(-6)*T**(2) + 2.2142*10**(-9)*T**(3) - 1.723*10**(5)*T**(-2)\n", + "\n", + "delta_H_rkn_298 = -delta_H_CH4_for_298;\t\t\t#[cal] - Enthalpy of reaction at 298.15 K\n", + "delta_G_rkn_298 = -delta_G_CH4_for_298;\t\t\t#[cal] - Gibbs free energy of the reaction at 298.15 K\n", + "\n", + "\n", + "def f63(T): \n", + "\t return 12.673-0.0113832*T-1.1174*10**(-6)*T**(2)+2.2142*10**(-9)*T**(3)-1.723*10**(5)*T**(-2)\n", + "\n", + "delta_H_rkn_973 = delta_H_rkn_298 + quad(f63,T_1,T_2)[0]\n", + "\n", + "\n", + "print \" Standard enthalpy change of reaction at 973.15 K is %f cal\"%(delta_H_rkn_973);\n", + "\n", + "\t\t\t#Now determining the smath.tan(math.radiansard entropy change of reaction at 298.15 K\n", + "delta_S_rkn_298 = (delta_H_rkn_298 - delta_G_rkn_298)/298.15;\t\t\t#[cal/K]\n", + "\n", + "def f64(T): \n", + "\t return (12.673-0.0113832*T-1.1174*10**(-6)*T**(2)+2.2142*10**(-9)*T**(3)-1.723*10**(5)*T**(-2))/T\n", + "\n", + "delta_S_rkn_973 = delta_S_rkn_298 + quad(f64,T_1,T_2)[0]\n", + "\n", + "\n", + "\t\t\t#Therefore,the smath.tan(math.radiansard Gibbs free energy change of the reaction is given by,\n", + "delta_G_rkn_973 = delta_H_rkn_973 - 973.15*delta_S_rkn_973;\t\t\t#[cal]\n", + "\n", + "print \" Standard Gibbs free energy change of reaction at 973 K is %f cal\"%(delta_G_rkn_973);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Standard enthalpy change of reaction at 973.15 K is 21316.998642 cal\n", + " Standard Gibbs free energy change of reaction at 973 K is -3880.803382 cal\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.9 Page Number : 226" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard temperature\n", + "T_2 = 1000;\t\t\t#[K] - Reaction temperature\n", + "\n", + "\t\t\t#At 298.15 K\n", + "delta_H_C_for_298 = 0.00;\t\t\t#[cal/mol] - Enthalpy of formation of C(s,graphite) at 298.15 K\n", + "delta_H_H2O_for_298 = -57.7979*10**(3);\t\t\t#[cal/mol] - Enthalpy of formation of H2O at 298.15 K\n", + "delta_H_CO_for_298 = -26.4157*10**(3);\t\t\t#[cal/mol] - Enthalpy of formation of CO at 298.15 K\n", + "delta_H_H2_for_298 = 0.00;\t\t\t#[cal/mol] - Enthalpy of formation of H2 at 298.15 K\n", + "delta_G_C_for_298 = 0.00;\t\t\t#[cal/mol] - Gibbs free energy change for formation of C(s, graphite) at 298.15 K\n", + "delta_G_H2O_for_298 = -54.6357*10**(3);\t\t\t#[cal/mol] - Gibbs free energy change for formation of H2O at 298.15 K\n", + "delta_G_CO_for_298 = -32.8079*10**(3);\t\t\t#[cal/mol] - Gibbs free energy change for formation of CO at 298.15 K\n", + "delta_G_H2_for_298 = 0.00;\t\t\t#[cal/mol] - Gibbs free energy change for formation of H2 at 298.15 K\n", + "\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#/Smath.tan(math.radiansaerd heat capacity data in cal/mol-K are given below, T is in K\n", + "\t\t\t#Cp_0_C = 3.519 + 1.532*10**(-3)*T - 1.723*10**(5)*T**(-2)\n", + "\t\t\t#Cp_0_H2O = 7.7 + 0.04594*10**(-2)*T + 0.2521*10**(-5)*T**(2) - 0.8587*10**(-9)*T**(3)\n", + "\t\t\t#Cp_0_CO = 6.726 + 0.04001*10**(-2)*T + 0.1283*10**(-5)*T**(2) - 0.5307*10**(-9)*T**(3)\n", + "\t\t\t#Cp_0_H2 = 6.952 - 0.04576*10**(-2)*T + 0.09563*10**(-5)*T**(2) - 0.2079*10**(-9)*T**(3)\n", + "\n", + "\t\t\t#Therefore smath.tan(math.radiansard heat capacity of reaction is given by,\n", + "\t\t\t#Cp_0_rkn = Cp_0_H2 + Cp_0_CO - Cp_0_C - Cp_0_H2O\n", + "\t\t\t#On simplification,we get the relation\n", + "\t\t\t#Cp_0_rkn = 2.459 - 2.0489*10**(-3)*T - 2.817*10**(-7)*T**(2) + 1.201*10**(-10)*T**(3) + 1.723*10**(5)*T**(-2)\n", + "\n", + "delta_H_rkn_298 = delta_H_CO_for_298 + delta_H_H2_for_298 - delta_H_C_for_298 - delta_H_H2O_for_298;\t\t\t#[cal] - Enthalpy of reaction at 298.15 K\n", + "delta_G_rkn_298 = delta_G_CO_for_298 + delta_G_H2_for_298 - delta_G_C_for_298 - delta_G_H2O_for_298;\t\t\t#[cal] - Gibbs free energy of the reaction at 298.15 K\n", + "\n", + "\n", + "def f13(T): \n", + "\t return 2.459-2.0489*10**(-3)*T-2.817*10**(-7)*T**(2)+1.201*10**(-10)*T**(3)+1.723*10**(5)*T**(-2)\n", + "\n", + "delta_H_rkn_1000 = delta_H_rkn_298 + quad(f13,T_1,T_2)[0]\n", + "\n", + "\n", + "print \" Standard enthalpy change of reaction at 1000 K is %f cal\"%(delta_H_rkn_1000);\n", + "\n", + "\t\t\t#Now determining the smath.tan(math.radiansard entropy change of reaction at 298.15 K\n", + "delta_S_rkn_298 = (delta_H_rkn_298 - delta_G_rkn_298)/298.15;\t\t\t#[cal/K]\n", + "\n", + "def f14(T): \n", + "\t return (2.459-2.0489*10**(-3)*T-2.817*10**(-7)*T**(2)+1.201*10**(-10)*T**(3)+1.723*10**(5)*T**(-2))/T\n", + "\n", + "delta_S_rkn_1000 = delta_S_rkn_298 + quad(f14,T_1,T_2)[0]\n", + "\n", + "\n", + "\t\t\t#Therefore,the smath.tan(math.radiansard Gibbs free energy change of the reaction is given by,\n", + "delta_G_rkn_1000 = delta_H_rkn_1000 - 1000*delta_S_rkn_1000;\t\t\t#[cal]\n", + "\n", + "print \" Standard Gibbs free energy change of reaction at 1000 K is %f cal\"%(delta_G_rkn_1000);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Standard enthalpy change of reaction at 1000 K is 32518.639475 cal\n", + " Standard Gibbs free energy change of reaction at 1000 K is -1858.365607 cal\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.10 Page Number : 228" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard temperature\n", + "T_2 = 1042;\t\t\t#[K] - Reaction temperature\n", + "\n", + "\t\t\t#At 298.15 K\n", + "delta_H_CaCO3_for_298 = -289.5*10**(3);\t\t\t#[cal/mol] - Enthalpy of formation of CaCO3 at 298.15 K\n", + "delta_H_CaO_for_298 = -151.7*10**(3);\t\t\t#[cal/mol] - Enthalpy of formation of CaO at 298.15 K\n", + "delta_H_CO2_for_298 = -94.052*10**(3);\t\t\t#[cal/mol] - Enthalpy of formation of CO2 at 298.15 K\n", + "delta_G_CaCO3_for_298 = -270.8*10**(3);\t\t\t#[cal/mol] - Gibbs free energy change for formation of CaCO3 at 298.15 K\n", + "delta_G_CaO_for_298 = -144.3*10**(3);\t\t\t#[cal/mol] - Gibbs free energy change for formation of CaO at 298.15 K\n", + "delta_G_CO2_for_298 = -94.260*10**(3);\t\t\t#[cal/mol] - Gibbs free energy change for formation of CO2 at 298.15 K\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#/Smath.tan(math.radiansaerd heat capacity data in cal/mol-K are given below, T is in K\n", + "\t\t\t#Cp_0_CO2 = 5.316 + 1.4285*10**(-2)*T - 0.8362*10**(-5)*T**(2) + 1.784*10**(-9)*T**(3)\n", + "\t\t\t#Cp_0_CaO = 12.129 + 0.88*10**(-3)*T + 2.08*10**(5)*T**(-2)\n", + "\t\t\t#Cp_0_CaCO3 = 24.98 + 5.240*10**(-3)*T + 6.199*10**(5)*T**(-2)\n", + "\n", + "\t\t\t#Therefore smath.tan(math.radiansard heat capacity of reaction is given by,\n", + "\t\t\t#Cp_0_rkn = Cp_0_CO2 + Cp_0_CaO - Cp_0_CaCO3\n", + "\t\t\t#On simplification,we get the relation\n", + "\t\t\t#Cp_0_rkn = -7.535 + 9.925*10**(-3)*T - 0.8362*10**(-5)*T**(2) + 1.784*10**(-9)*T**(3) + 4.119*10**(5)*T**(-2)\n", + "\n", + "delta_H_rkn_298 = delta_H_CaO_for_298 + delta_H_CO2_for_298 - delta_H_CaCO3_for_298;\t\t\t#[cal] - Enthalpy of reaction at 298.15 K\n", + "delta_G_rkn_298 = delta_G_CaO_for_298 + delta_G_CO2_for_298 - delta_G_CaCO3_for_298;\t\t\t#[cal] - Gibbs free energy of the reaction at 298.15 K\n", + "\n", + "\n", + "def f38(T): \n", + "\t return -7.535+9.925*10**(-3)*T-0.8362*10**(-5)*T**(2)+1.784*10**(-9)*T**(3)+4.119*10**(5)*T**(-2)\n", + "\n", + "delta_H_rkn_1042 = delta_H_rkn_298 + quad(f38,T_1,T_2)[0]\n", + "\n", + "\n", + "print \" Standard enthalpy change of reaction at 1042 K is %f cal\"%(delta_H_rkn_1042);\n", + "\n", + "\t\t\t#Now determining the smath.tan(math.radiansard entropy change of reaction at 298.15 K\n", + "delta_S_rkn_298 = (delta_H_rkn_298 - delta_G_rkn_298)/298.15;\t\t\t#[cal/K]\n", + "\n", + "def f39(T): \n", + "\t return (-7.535+9.925*10**(-3)*T-0.8362*10**(-5)*T**(2)+1.784*10**(-9)*T**(3)+4.119*10**(5)*T**(-2))/T\n", + "\n", + "delta_S_rkn_1042 = delta_S_rkn_298 + quad(f39,T_1,T_2)[0]\n", + "\n", + "\n", + "\t\t\t#Therefore,the smath.tan(math.radiansard Gibbs free energy change of the reaction is given by,\n", + "delta_G_rkn_1042 = delta_H_rkn_1042 - 1042*delta_S_rkn_1042;\t\t\t#[cal]\n", + "\n", + "print \" Standard Gibbs free energy change of reaction at 1042 K is %f cal\"%(delta_G_rkn_1042);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Standard enthalpy change of reaction at 1042 K is 41518.919956 cal\n", + " Standard Gibbs free energy change of reaction at 1042 K is 4873.416608 cal\n" + ] + } + ], + "prompt_number": 11 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch7_2-checkpoint.ipynb b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch7_2-checkpoint.ipynb new file mode 100644 index 00000000..dae2b7f0 --- /dev/null +++ b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch7_2-checkpoint.ipynb @@ -0,0 +1,1553 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:1fc4ec5605309ff88ba6d75ddff6c3046fc8a8dc45dca2d12f7651c49812921e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 7 : Thermodynamic property relations of pure substance" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.6 Page Number : 241" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math \n", + "\n", + "\n", + "# Variables\n", + "P_1 = 1;\t\t\t#[MPa] - Initial pressure\n", + "P_2 = 1.4;\t\t\t#[MPa] - Final pressure\n", + "\n", + "# Calculations\n", + "\t\t\t#We know that\n", + "\t\t\t# dS = (Cp/T)*dT - (dV/dT)*dP\n", + "\t\t\t# Along an isothermal path,integration of above expression between states 1 and 2 yields\n", + "\t\t\t# S_2 - S_1 = - integral((dV/dT)*dP)_P\n", + "\t\t\t# An estimate can be made by assuming that (dV/dT)_P remains constant over the range of pressure from P_1 to P_2 and evaluating the derivative at average pressure of 1.2 MPa\n", + "P_avg = P_2;\n", + "\t\t\t# S_2 - S_1 = -integral((dV/dT)*dP)_Pavg*(P_2 - P_1)\n", + "\t\t\t# (dV/dT)_P=1.2MPa = ((V_350 - V_250)/(350 - 250))\n", + "dV_dT = (0.2345 - 0.19234)/100;\t\t\t#[m**(3)/kg-K]\n", + "\t\t\t#Therefore\n", + "delta_S = -dV_dT*(P_2 - P_1)*1000;\t\t\t#[kJ/kg-K] - Entropy change\n", + "\n", + "# Results\n", + "print \"The change in entropy is given by S_2-S_1 = %f kJ/kg-K\"%(delta_S);\n", + "\n", + "\t\t\t#Let us compare this tabulated values. At 1MPA and 300 C, S_1 = 7.1229 kJ/kg-K. At 1.4 MPa and 300 C, S_2 = 6.9534 kJ/kg-K. \n", + "\t\t\t#Therefore S_2 - S_1 = -0.1695 kJ/kg-K\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The change in entropy is given by S_2-S_1 = -0.168640 kJ/kg-K\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.7 Page Number : 241" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math \n", + "from scipy.integrate import quad \n", + "\t\t\t\n", + "# Variables\n", + "T = 25. + 273.15;\t\t\t#[K] - Temperature of the surrounding\n", + "P_1 = 1.;\t\t\t#[atm] - Initial pressure\n", + "P_2 = 1000.;\t\t\t#[atm] - Final pressure\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# V = 18.066 - 7.15*10**(-4)*P + 4.6*10**(-8)*P**(2) where, V is in 'cm**(3)/mol' and P is in 'atm\n", + "\t\t\t# (dV/dT)_P = 0.0045 + 1.4*10**(-6)*P ;\t\t\t#cm**(3)/mol-K\n", + "\n", + "\t\t\t# The work done by 1 mol is given by W = integral(P*dV)\n", + "\t\t\t# Differentiating both sides of the expression for V, we get\n", + "\t\t\t# dV = -7.15*10**(-4)*dP + 9.2*10**(-8)*(P*dP) \n", + "\t\t\t# P*dV = -7.15*10**(-4)*P*dP + 9.2*10**(-8)*(P**(2)*dP)\n", + "\n", + "\t\t\t# The work done is given by\n", + "\n", + "def f58(P): \n", + "\t return -7.15*10**(-4)*P + 9.2*10**(-8)*(P**(2))\n", + "\n", + "W = quad(f58,P_1,P_2)[0];\t\t\t#[atm-cm**(3)[0]\n", + "\n", + "W = W*101325*10**(-6);\t\t\t#[J/mol]\n", + "\n", + "print \"The necessary work to compress water from 1 atm to 1000 atm is %f J/mol\"%(W);\n", + "\n", + "\t\t\t#Let us calculate the amount of heat transfer\n", + "\t\t\t# q = integral(T*dS)\n", + "\t\t\t# dS = ((ds/dT)_P)*dT + ((dS/dP)_T)*dP\n", + "\t\t\t# Since the temperature is constant the first term is zero and\n", + "\t\t\t# dS = ((dS/dP)_T)*dP = -((dV/dT)_P)*dP\n", + "\t\t\t# Thus, q = integral(T*dS) = T*(integral(dS)) ( as temperature is constant )\n", + "\t\t\t# or, q = -T*(integral((dV/dT)_P)*dP)\n", + "\n", + "\t\t\t# Thus the heat transfer is given by\n", + "\n", + "def f59(P): \n", + "\t return 0.0045+1.4*10**(-6)*P\n", + "\n", + "q = -T* quad(f59,P_1,P_2)[0];\t\t\t#[atm-cm**(3)[0]\n", + "\n", + "q = q*101325*10**(-6);\t\t\t#[J/mol]\n", + "\n", + "\t\t\t# q - W = delta_U\n", + "\t\t\t# Thus delta_U is given by\n", + "delta_U = q - W;\t\t\t#[J/mol]\n", + "\n", + "print \"The change in internal energy is %f J/mol\"%(delta_U);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The necessary work to compress water from 1 atm to 1000 atm is -33.116351 J/mol\n", + "The change in internal energy is -123.839936 J/mol\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.12 Page Number : 247" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "from scipy.optimize import fsolve \n", + "\n", + "\n", + "# Variables\n", + "T = 25+273.15;\t\t\t#[K] - Temperature\n", + "P = 1;\t\t\t#[atm] - Pressure\n", + "P = P*101325;\t\t\t#[Pa]\n", + "Tc = 126.2;\t\t\t#[K] - Critical temperature\n", + "Pc = 34;\t\t\t#[bar] - Critical pressure\n", + "Pc = Pc*10**(5);\t\t\t#[Pa]\n", + "R=8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "a = (27*R**(2)*Tc**(2)/(64*Pc));\t\t\t#[Pa-m**(6)/mol**(2)]\n", + "b = (R*Tc)/(8*Pc);\t\t\t#[m**(3)/mol]\n", + "\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# the cubic form of van der Walls equation of state is\n", + "\t\t\t# V**(3)-(b+(R*T)/P)*V**(2)+(a/P)*V-(a*b)/P=0\n", + "\t\t\t#Solving the cubic equation\n", + "def f(V): \n", + "\t return V**(3)-(b+(R*T)/P)*V**(2)+(a/P)*V-(a*b)/P\n", + "V = fsolve(f,1)\n", + "\t\t\t#The above equation has 1 real and 2 imaginary roots. We consider only real root.\n", + "\n", + "Beta = R/((P*V)-(a/V)+((2*a*b)/V**(2)));\t\t\t#[K**(-1)]\n", + "\n", + "K_t = (V-b)/((P*V)-(a/V)+((2*a*b)/V**(2)));\t\t\t#[Pa**(-1)]\n", + "K_t = K_t*101325;\t\t\t#[atm**(-1)]\n", + "\n", + "print \" Beta\\t = \\t %f K**-1)\"%(Beta);\n", + "print \" K_t\\t = \\t %f atm**-1)\"%(K_t);\n", + "\n", + "\t\t\t#For ideal gas, Beta = 1/T = 0.0033354 K**(-1) and K_t = 1/P = 1 atm**(-1)\n", + "\t\t\t# So results obtained are convergent with those obtained assuming ideal gas.\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Beta\t = \t 0.003364 K**-1)\n", + " K_t\t = \t 1.000672 atm**-1)\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.13 Page Number : 248" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T = 45+273.15;\t\t\t#[K]\n", + "P_1 = 10;\t\t\t#[kPa] - Initial pressure\n", + "P_2 = 8600;\t\t\t#[kPa] - Final pressure\n", + "V = 1010;\t\t\t#[cm**(3)/kg] - Specific volume for saturated liquid water at 45 C\n", + "V = V*10**(-6);\t\t\t#[m**(3)/kg]\n", + "\t\t\t# Beta = (1/V)*(dV/dT)_P\n", + "Beta = 4.25*10**(-4);\t\t\t#[k**(-1)]\n", + "Cp = 4.178;\t\t\t#[kJ/kg-K] - Specific heat at constant pressure\n", + "eff = 0.75;\t\t\t# Efficiency of the pump\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#(1)\n", + "\t\t\t#when efficiency of the pump is 100% , W = -delta_Hs\n", + "\t\t\t# Now delta_H = T*dS + V*dP, therefore under isentropic conditions, dH = V*dP\n", + "\t\t\t# Since the fluid is liquid, therefore the specific volume can be taken to be constant and integrating the above equaton we get\n", + "\t\t\t# delta_Hs = V*dP\n", + "delta_Hs = V*(P_2 - P_1);\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t#Actual pumps are not isentropic and therefore not 100% efficient. Therefore actual work done by the pump is given by\n", + "W = -delta_Hs/eff;\t\t\t#[kJ/kg]\n", + "\n", + "print \" 1).The work done by the pump is %f kJ/kg\"%(W);\n", + "\n", + "\t\t\t#(2)\n", + "\t\t\t# We know that dH = Cp*dT + (1 - Beta*T)*V*dP\n", + "\t\t\t# Beta and V are weak functions of pressure in the case of liquids.\n", + "\t\t\t# Integrating the above equation we get\n", + "\t\t\t# delta_H = Cp*delta_T + (1 - Beta*T)*V*(delta_P)\n", + "\t\t\t# Now from energy balance delta_H = q - W . But q = 0. Therefore,\n", + "delta_H = -W;\t\t\t#[kJ/kg]\n", + "\t\t\t# Solving for delta_T\n", + "delta_T = (delta_H - (1 - Beta*T)*V*(P_2-P_1))/Cp;\n", + "\n", + "print \" 2).The temperature of water change by delta_T = %f K\"%(delta_T);\n", + "\n", + "\t\t\t#(3)\n", + "T_1 = T;\t\t\t#[K]\n", + "T_2 = T + delta_T;\t\t\t#[K]\n", + "\t\t\t# dS = (Cp/T)*dT - Beta*V*dP\n", + "\t\t\t# Beta and V are weak functions of pressure in the case of liquids. Integrating the above equation we get\n", + "delta_S = Cp*math.log(T_2/T_1) - Beta*V*(P_2-P_1);\t\t\t#[kJ/kg-K]\n", + "\n", + "print \" 3).The entropy change of water is given by delta_S = %f kJ/kg-K\"%(delta_S);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The work done by the pump is -11.567867 kJ/kg\n", + " 2).The temperature of water change by delta_T = 0.972970 K\n", + " 3).The entropy change of water is given by delta_S = 0.009070 kJ/kg-K\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.14 Page Number : 249" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T = 270;\t\t\t#[K]\n", + "P_1 = 381;\t\t\t#[kPa] - Initial pressure\n", + "P_2 = 1200;\t\t\t#[kPa] - Final pressure\n", + "V_liq = 1.55*10**(-3);\t\t\t#[m**(3)/kg] - Specific volume for saturated water in liquid phase at 270 C\n", + "Beta = 2.095*10**(-3);\t\t\t#[K**(-1)]\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#dH = Cp*dT + [V - T*(dV/dT)_P]*dP\n", + "\t\t\t# dS = (Cp/T)*dT - ((dV/dT)_P)*dP\n", + "\t\t\t# Since isothermal conditions are maintained we get\n", + "\t\t\t# dH = [V - T*(dV/dT)_P]*dP = V*(1 - Beta*T)*dP\n", + "\t\t\t# For the liquid assuming V and Beta to remain constant during pressure change, and since temperature is constant we get\n", + "delta_H = V_liq*(1 - Beta*T)*(P_2 - P_1);\t\t\t#[kJ/kg]\n", + "\n", + "print \"The enthalpy change is given by delta_H = %f kJ/kg\"%(delta_H);\n", + "\n", + "\t\t\t# Under isothermal conditions \n", + "\t\t\t# dS = -((dV/dT)_P)*dP = -Beta*V_liq*dP\n", + "\t\t\t# If Beta*V is assumed to remain constant during pressure change we get\n", + "delta_S = -Beta*V_liq*(P_2-P_1);\t\t\t#[kJ/kg-K]\n", + "\n", + "print \"The entropy change is given by delta_S = %e kJ/kg-K\"%(delta_S);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The enthalpy change is given by delta_H = 0.551386 kJ/kg\n", + "The entropy change is given by delta_S = -2.659498e-03 kJ/kg-K\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.15 Page Number : 249" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T_1 = 0;\t\t\t#[C] - Initial tempetaure\n", + "T_2 = 100;\t\t\t#[C] - Final temperature\n", + "\t\t\t# Beta = 1.0414*10**(-3) + 1.5672*10**(-6)*T + 5.148*10**(-8)*T**(2), where T is in C\n", + "\t\t\t# At constant pressure (1/V)*(dV/dT) = Beta\n", + "\t\t\t# or, d(math.log(V)) = Beta*dT\n", + "\t\t\t# Integrating we get math.log(V_2/V_1) = integral(Beta*dT) from limit T_1 to T_2\n", + "\n", + "# Calculations and Results\n", + "def f62(T): \n", + "\t return 1.0414*10**(-3)+1.5672*10**(-6)*T+5.148*10**(-8)*T**(2)\n", + "\n", + "integral = quad(f62,T_1,T_2)[0]\n", + "\n", + "\n", + "\t\t\t# math.log(V_2/V_1) = integral\n", + "\t\t\t# (V_2/V_1) = exp(integral)\n", + "\t\t\t# (V_2 - V_1)/V_1 = change = exp(integral) - 1;\n", + "change = math.exp(integral) - 1;\n", + "per_change = 100*change;\n", + "\n", + "print \"The percentage change in volume = %f %%\"%(per_change);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The percentage change in volume = 13.784486 %\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.16 Page Number : 250" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T_1 = 25 + 273.15;\t\t\t#[C] - Initial tempetaure\n", + "T_2 = 50 + 273.15;\t\t\t#[C] - Final temperature\n", + "P_1 = 1;\t\t\t#[bar] - Initial pressure\n", + "P_2 = 1000;\t\t\t#[bar] - Final pressure\n", + "\n", + "Cp_T1_P1 = 75.305;\t\t\t#[J/mol-K]\n", + "Cp_T2_P1 = 75.314;\t\t\t#[J/mol-K]\n", + "V_T1_P1 = 18.071;\t\t\t#[cm**(3)/mol]\n", + "V_T1_P2 = 18.012;\t\t\t#[cm**(3)/mol]\n", + "V_T2_P1 = 18.234;\t\t\t#[cm**(3)/mol]\n", + "V_T2_P2 = 18.174;\t\t\t#[cm**(3)/mol]\n", + "Beta_T1_P1 = 256*10**(-6);\t\t\t#[K**(-1)]\n", + "Beta_T1_P2 = 366*10**(-6);\t\t\t#[K**(-1)]\n", + "Beta_T2_P1 = 458*10**(-6);\t\t\t#[K**(-1)]\n", + "Beta_T2_P2 = 568*10**(-6);\t\t\t#[K**(-1)]\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# The entropy change is given by\n", + "\t\t\t# dS = (Cp/T)*dT - ((dV/dT)_P)*dP\n", + "\t\t\t# The mean Cp between 25 and 50 C is \n", + "Cp_mean = (Cp_T1_P1 + Cp_T1_P1)/2;\t\t\t#[J/mol-K]\n", + "\n", + "\n", + "\t\t\t# (dV/dT)_P=1bar = (V_T2_P1 - V_T1_P1)/(50 - 25)\n", + "dV_dT_P1 = ((V_T2_P1 - V_T1_P1)/(50 - 25))*10**(-6);\t\t\t#[m**(-3)/mol-K]\n", + "dV_dT_P2 = ((V_T2_P2 - V_T1_P2)/(50 - 25))*10**(-6);\t\t\t#[m**(-3)/mol-K]\n", + "\t\t\t# The mean value of (dV/dT)_P between 1 and 1000 bar is\n", + "dV_dT_mean = (dV_dT_P1 + dV_dT_P2)/2;\t\t\t#[m**(-3)/mol-K]\n", + "delta_S = Cp_mean*math.log(T_2/T_1) - dV_dT_mean*(P_2 - P_1)*10**(5);\t\t\t#[J/mol-K]\n", + "\n", + "print \" The value of entropy change is given by delta_S = %f J/mol-K\"%(delta_S);\n", + "\n", + "\t\t\t# Now let us determine the enthalpy change. We know that\n", + "\t\t\t# dH = Cp*dT + [V - T*(dV/dT)_P]*dP\n", + "\t\t\t# [V - T*(dV/dT)_P] = (V - T*V*Beta) = val (say)\n", + "\t\t\t# At state 1\n", + "val_1 = ((V_T1_P1)*10**(-6))*(1 - (T_1)*(Beta_T1_P1));\t\t\t#[m**(3)/mol]\n", + "\t\t\t# At state 2\n", + "val_2 = ((V_T2_P2)*10**(-6))*(1 - (T_2)*(Beta_T2_P2));\t\t\t#[m**(3)/mol]\n", + "val_mean = (val_1 + val_2)/2;\t\t\t#[m**(3)/mol]\n", + "\n", + "delta_H = Cp_mean*(T_2 - T_1) + val_mean*(P_2-P_1)*10**(5);\t\t\t#[J/mol]\n", + "\n", + "print \" The value of enthalpy change is given by delta_H = %f J/mol\"%(delta_H);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The value of entropy change is given by delta_S = 5.414201 J/mol-K\n", + " The value of enthalpy change is given by delta_H = 3457.542629 J/mol\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.22 Page Number : 256" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 100 + 273.15;\t\t\t#[K]\n", + "P = 10;\t\t\t#[MPa]\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# The volume expansivity is defined as \n", + "\t\t\t# Beta = (1/V)*(del V/del T)_P = (1/V)*(dV/dT)_P\n", + "\t\t\t# From compressed liquid water tables at 100 C and 10 MPa,\n", + "V = 0.0010385;\t\t\t#[m(3)/kg]\n", + "Beta = (1/V)*((0.0010549 - 0.0010245)/(120 - 80));\t\t\t#[K**(-1)] \t\t\t# The values are obtained from the steam table as reported in the book.\n", + "\n", + "print \"The value of volume expansivity is Beta = %e K**-1)\"%(Beta);\n", + "\n", + "\t\t\t#Isothermal compressibility is defined as\n", + "\t\t\t# K_t = -(1/V)*(del V/del T)_T = -(1/V)*(dV/dT)_T\n", + "K_t = -(1/V)*((0.0010361 - 0.0010410)/(15 - 5));\t\t\t#[MPa**(-1)] \t\t\t# The values are obtained from the steam table as reported in the book.\n", + "\n", + "K_t = K_t*10**(-3);\t\t\t#[kPa]\n", + "\n", + "print \"The value of isothermal compressibility is K_t = %e kPa**-1)\"%(K_t);\n", + "\n", + "\t\t\t# Cp - Cv = (T*V*(Beta**(2)))/K_t\n", + "R = (T*V*(Beta**(2)))/K_t;\t\t\t#[kJ/kg-K]\n", + "\n", + "print \"The value of the difference between Cp and Cv is Cp-Cv = %f kJ/kg-K\"%(R);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of volume expansivity is Beta = 7.318247e-04 K**-1)\n", + "The value of isothermal compressibility is K_t = 4.718344e-07 kPa**-1)\n", + "The value of the difference between Cp and Cv is Cp-Cv = 0.439860 kJ/kg-K\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.23 Page Number : 257" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 300 + 273.15;\t\t\t#[K]\n", + "P = 4;\t\t\t#[MPa] \n", + "\n", + "# Calculations and Results\n", + "Cp_0 = 7.7 + 0.04594*10**(-2)*T + 0.2521*10**(-5)*T**(2) - 0.8587*10**(-9)*T**(3);\t\t\t#[cal/mol-K]\n", + "Cp_0 = (Cp_0*4.186)/18.015;\t\t\t#[kJ/kg-K]\n", + "\n", + "\t\t\t# Cp(T,P) = Cp_0(T,P=0) - T*integral((del**2 V/del T**(2))_P)*dP from limit 0 to P\n", + "\t\t\t# Cp = Cp_0 - T*((del**2 V/del T**2)_Pavg)*(P_2 - P_1)\n", + "\n", + "P_avg = (0+4)/2;\t\t\t#[MPa]\n", + "\n", + "\t\t\t#Using finite difference we get (del**2 V/del T**(2)) = ((V_(T+delta T) - 2*V_T + V_(T-delta T))/(delta_T**(2))\n", + "\t\t\t#(del**2 V/del T**(2))_Pavg = (V_(350 C) + V_(250 C) - 2*V_(300 C))/(delta_T**(2)) = del_2 (say)\n", + "del_2 = (0.13857 + 0.11144 - 2*0.12547)/(50**(2));\t\t\t#[m**(3)/kg-K**2] \t\t\t# The values are obtained from the steam table as reported in the book.\n", + "\n", + "\n", + "Cp = Cp_0 - T*del_2*4000;\t\t\t#[kJ/kg-K]\n", + "\n", + "print \" The value of constant pressure specific heat capacity is Cp = %f kJ/kg-K\"%(Cp);\n", + "\n", + "\t\t\t# At P = 4 MPa\n", + "\t\t\t# Cp = (del H/del T)_P = (H_350 C - H_250 C)/(350 - 250.4)\n", + "\t\t\t# Cp = (3092.5 - 2801.4)/(350 - 250.4) = 2.923 [kJ/kg-K]\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The value of constant pressure specific heat capacity is Cp = 2.858079 kJ/kg-K\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.24 Page Number : 257" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T = 300 + 273.15;\t\t\t#[K]\n", + "P = 2.0;\t\t\t#[MPa]\n", + "\n", + "\t\t\t# At 2 MPa and 250 C \n", + "H_1 = 2902.5;\t\t\t#[kJ/kg]\n", + "\t\t\t# At 2 MPa and 350 C \n", + "H_2 = 3137.0;\t\t\t#[kJ/kg]\n", + "\n", + "# Calculations\n", + "Cp = (H_2 - H_1)/(350 - 250);\t\t\t#[kJ/kg-K]\n", + "\n", + "# Results\n", + "print \" The value of constant pressure specific heat capacity is Cp = %f kJ/kg-K\"%(Cp);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The value of constant pressure specific heat capacity is Cp = 2.345000 kJ/kg-K\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.25 Page Number : 258" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T = 80 + 273.15;\t\t\t#[K]\n", + "P = 10;\t\t\t#[MPa] \n", + "\n", + "V_1 = 0.0010245;\t\t\t#[m**(3)/kg]\n", + "\t\t\t# At 60 C and 10 MPa\n", + "V_2 = 0.0010127;\t\t\t#[m**(3)/kg]\n", + "\t\t\t# At 100 C and 10 MPa\n", + "V_3 = 0.0010385;\t\t\t#[m**(3)/kg]\n", + "\n", + "# Calculations and Results\n", + "Beta = (1/V_1)*((V_3 - V_2)/(100 - 60));\t\t\t#[K**(-1)]\n", + "\n", + "print \"The value of volume expansivity is Beta = %e K**-1)\"%(Beta);\n", + "\n", + "\t\t\t#Isothermal compressibility is given by\n", + "\t\t\t# K_t = -(1/V)*(del V/del P)_T\n", + "\n", + "\t\t\t# Temperature is kept fixed at 80 C and different pressures are taken to calculate (del V/del P)_T\n", + "\t\t\t# At 80 C and 5 MPa\n", + "V_4 = 0.0010268;\t\t\t#[m**(3)/kg]\n", + "\t\t\t# At 80 C and 10 MPa\n", + "V_5 = 0.0010245;\t\t\t#[m**(3)/kg]\n", + "\t\t\t# At 80 C and 15 MPa\n", + "V_6 = 0.0010222;\t\t\t#[m**(3)/kg]\n", + "\n", + "\t\t\t# K_t = -(1/V)*(del V/del T)_P\n", + "K_t = -(1/V_1)*((V_4 - V_6)/(5 - 15));\t\t\t#[MPa**(-1)]\n", + "K_t = K_t*10**(-6);\t\t\t#[Pa**(-1)]\n", + "\n", + "print \"The value of isothermal compressibility is K_t = %e Pa**-1)\"%(K_t);\n", + "\n", + "\t\t\t# Cp - Cv = (T*V*(Beta**(2)))/K_t\n", + "R = (T*V_1*(Beta**(2)))/K_t;\t\t\t#[J/kg-K]\n", + "\n", + "print \"The value of the difference between Cp and Cv is Cp-Cv = %f J/kg-K\"%(R);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of volume expansivity is Beta = 6.295754e-04 K**-1)\n", + "The value of isothermal compressibility is K_t = 4.489995e-10 Pa**-1)\n", + "The value of the difference between Cp and Cv is Cp-Cv = 319.389628 J/kg-K\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.26 Page Number : 260" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "P_1 = 150;\t\t\t#[bar]\n", + "P_2 = 1;\t\t\t#[bar]\n", + "\n", + "T_1 = 300;\t\t\t#[K]\n", + "T_2 = 260;\t\t\t#[K]\n", + "T_3 = 280;\t\t\t#[K]\n", + "T_4 = 200;\t\t\t#[K]\n", + "T_5 = 120;\t\t\t#[K]\n", + "T_6 = 140;\t\t\t#[K]\n", + "\n", + "H_P1_T1 = 271.8;\t\t\t#[kJ/kg]\n", + "H_P2_T2 = 260.0;\t\t\t#[kJ/kg] \n", + "H_P2_T3 = 280.2;\t\t\t#[kJ/kg]\n", + "H_P1_T4 = 129.2;\t\t\t#[kJ/kg]\n", + "H_P2_T5 = 118.8;\t\t\t#[kJ/kg]\n", + "H_P2_T6 = 139.1;\t\t\t#[kJ/kg]\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#(a)\n", + "\t\t\t# During the Joule-Thomson expansion the enthalpy should remain constant\n", + "\t\t\t# Therefore at 1 bar the exit temperature is such that enthalpy is 271.8 kJ/kg\n", + "\t\t\t# The temperature at which enthalpy is 271.8 kJ/kg is given by,\n", + "T_new = ((H_P1_T1 - H_P2_T2)/(H_P2_T3 - H_P2_T2))*(T_3 - T_2) + T_2;\t\t\t#[K]\n", + "\n", + "\t\t\t# Therefore Joule-Thomson coefficient is given by,\n", + "meu = (T_1 - T_new)/(P_1 - P_2);\t\t\t#[K/bar]\n", + "\n", + "print \" a).The value of Joule-Thomson coefficient for initial T = 300 K) is %f J/bar\"%(meu);\n", + "\n", + "\t\t\t#(b)\n", + "\t\t\t# During the Joule-Thomson expansion the enthalpy should remain constant\n", + "\t\t\t# Therefore at 1 bar the exit temperature is such that enthalpy is 129.2 kJ/kg\n", + "\t\t\t# The temperature at which enthalpy is 129.2 kJ/kg is given by,\n", + "T_new_prime = ((H_P1_T4 - H_P2_T5)/(H_P2_T6 - H_P2_T5))*(T_6 - T_5) + T_5;\t\t\t#[K]\n", + "\n", + "\t\t\t# Therefore Joule-Thomson coefficient is given by,\n", + "meu_prime = (T_4 - T_new_prime)/(P_1 - P_2);\t\t\t#[K/bar]\n", + "\n", + "print \" b).The value of Joule-Thomson coefficient for initial T = 200 K) is %f J/bar\"%(meu_prime);\n", + "\n", + "\t\t\t# Therefore the Joule-Thomson coefficient is higher for low initial temperatures and therefore the drop in temperature is more.\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a).The value of Joule-Thomson coefficient for initial T = 300 K) is 0.190046 J/bar\n", + " b).The value of Joule-Thomson coefficient for initial T = 200 K) is 0.468146 J/bar\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.27 Page Number : 261" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 300;\t\t\t#[K] - Temperature\n", + "P = 5;\t\t\t#[atm] - Pressure\n", + "P = P*101325;\t\t\t#[Pa]\n", + "Cp_0 = 35.78;\t\t\t#[J/mol-K] - Smath.tan(math.radiansard specific heat capacity at constant pressure\n", + "B = -50;\t\t\t#[cm**(3)/mol]\n", + "B = B*10**(-6);\t\t\t#[m**(3)/mol]\n", + "\n", + "# Calculations\n", + "\t\t\t# (dB/dT) = 1.0 = dB_dT (say)\n", + "dB_dT = 1.0;\t\t\t#[cm**(3)/mol-K]\n", + "dB_dT = dB_dT*10**(-6);\t\t\t#[m**(3)/mol-K]\n", + "\n", + "\t\t\t# (d**2 B/d T**2) = -0.01 = dB_dT_2 (say)\n", + "dB_dT_2 = -0.01;\t\t\t#[cm**(3)/mol-K**(2)]\n", + "dB_dT_2 = dB_dT_2*10**(-6);\t\t\t#[m**(3)/mol-K**(2)]\n", + "\n", + "Cp = Cp_0 - P*T*(dB_dT_2);\t\t\t#[[J/mol-K]] - Specific heat capacity at constant pressure\n", + "\n", + "\t\t\t#Therefore Joule-Thomson coefficient is given by,\n", + "meu = (1/Cp)*(-B + T*dB_dT);\t\t\t#[K/Pa]\n", + "meu = meu*10**(5);\t\t\t#[K/bar]\n", + "\n", + "# Results\n", + "print \" c).The value of Joule-Thomson coefficient is %f K/bar\"%(meu);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " c).The value of Joule-Thomson coefficient is 0.938341 K/bar\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.30 Page Number : 267" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "den_liq = 13690.;\t\t\t#[kg/m**(3)] - Density of liquid mercury\n", + "den_solid = 14190.;\t\t\t#[kg/m**(3)] - Density of solid mercury\n", + "mp = -38.87;\t\t\t#[C] - Melting point of mercury at pressure of 1 bar\n", + "mp = mp + 273.15;\t\t\t#[K]\n", + "T_req = 0.;\t\t\t#[C] - Required temperature to which the melting point is to be raised\n", + "T_req = T_req + 273.15;\t\t\t#[K]\n", + "H_fus = 11.62;\t\t\t#[kJ/kg] - Latent heat of fusion of mercury\n", + "\n", + "# Calculations\n", + "V_liq = (1/den_liq);\t\t\t#[m**(3)/kg] - Specific volume of liquid mercury\n", + "\n", + "V_solid = (1/den_solid);\t\t\t#[m**(3)/kg] - Specific volume of solid mercury\n", + "\n", + "\t\t\t# (delta P/delta T) = ((P - 1)*100)/(T_req - mp)\n", + "\t\t\t# delta H/(T*delta V) = (H_liq - H_solid)/(T*(V_liq - V_solid)) = del (say)\n", + "d = (H_fus)/(mp*(V_liq - V_solid));\t\t\t#[kPa/K] - delta H/(T*delta V)\n", + "\n", + "\t\t\t#Equating the two sides and then solving we get\n", + "P = (d*(T_req - mp))/100 + 1;\t\t\t#[bar]\n", + "\n", + "# Results\n", + "print \" The required pressure should be %f bar\"%(P);\n", + "\n", + "# answers are correct but vary from book because of rouding error. please calculate manually." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The required pressure should be 7491.335878 bar\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.31 Page Number : 268" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Calculations and Results\n", + "\t\t\t#(1)\n", + "\t\t\t# At 1 bar\n", + "\t\t\t# Considering the data given at pressure 1 and 1000 bar, we have\n", + "delta_H_fus_1 = ((1000-1)*10**(5)*(273.15-22.6)*3.97*10**(-6))/(14.8+22.6);\t\t\t#[J/mol]\n", + "delta_S_fus_1 = delta_H_fus_1/(273.15-22.6);\t\t\t#[J/mol-K]\n", + "\n", + "print \" 1).The delta_H_fus at 1 bar is %f J/mol\"%(delta_H_fus_1);\n", + "print \" The delta_S_fus at 1 bar is %f J/mol-K\"%(delta_S_fus_1);\n", + "\n", + "\t\t\t#(2)\n", + "\t\t\t# At 6000 bar\n", + "T_mean = (128.8+173.6)/2;\t\t\t#[C] - Mean temperature\n", + "T_mean = T_mean + 273.15;\t\t\t#[K]\n", + "delta_V_fus_mean = (1.12+1.55)/2;\t\t\t#[cm**(3)/mol]\n", + "\n", + "\t\t\t# Consider the data at pressure of 5000 and 7000 bar we get,\n", + "delta_H_fus_2 = ((7000-5000)*10**(5)*(T_mean*delta_V_fus_mean*10**(-6)))/(173.6-128.8);\t\t\t#[J/mol]\n", + "delta_S_fus_2 = delta_H_fus_2/T_mean;\t\t\t#[J/mol-K]\n", + "\n", + "print \" 2).The delta_H_fus at 6000 bar is %f J/mol\"%(delta_H_fus_2);\n", + "print \" The delta_S_fus at 6000 bar is %f J/mol-K\"%(delta_S_fus_2);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1).The delta_H_fus at 1 bar is 2656.921969 J/mol\n", + " The delta_S_fus at 1 bar is 10.604358 J/mol-K\n", + " 2).The delta_H_fus at 6000 bar is 2529.050223 J/mol\n", + " The delta_S_fus at 6000 bar is 5.959821 J/mol-K\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.32 Page Number : 268" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "H_fus = 80;\t\t\t#[cal/g] - Heat of fusion at 0 C and 1 atm pressure\n", + "T = 0+273.15;\t\t\t#[K] - Temperature\n", + "vol_ratio = 1.091;\t\t\t# Ratio of the specific volume of ice and water.\n", + "sp_vol = 0.001;\t\t\t#[m**(3)/kg] - Specific volume of saturated liquid water.\n", + "\n", + "# Calculations\n", + "\t\t\t# The clapeyron equation can be written as\n", + "\t\t\t# (dP/dT)_sat = T*delta V_LS/(delta H_LS) = (T*(V_ice - V_water))/(H_ice - H_water)\n", + "dP_dT = (T*(vol_ratio - 1)*10**(-3))/(-H_fus*4.186);\t\t\t#[K/kPa]\n", + "\n", + "# Results\n", + "print \"The value of dT/dP)_sat is %e K/kPa\"%(dP_dT);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of dT/dP)_sat is -7.422554e-05 K/kPa\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.33 Page Number : 268" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "# Variables\n", + "P = 2;\t\t\t#[atm] - Surrounding pressure\n", + "bp_water = 100 + 273.15;\t\t\t#[K] - Boiling point of water at 1 atm pressure\n", + "delta_H_vap = 2257;\t\t\t#[kJ/kg] - Enthalpy of vaporization\n", + "delta_H_vap = delta_H_vap*18.015;\t\t\t#[J/mol]\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "# Calculations\n", + "\t\t\t# The clapeyron equation is given by\n", + "\t\t\t# math.log(P_2_sat/P_1_sat) = (-delta H_vap/R)*(1/T_2 - 1/T_1)\n", + "P_1_sat = 1;\t\t\t#[atm]\n", + "P_2_sat = P;\n", + "T_1 = bp_water;\n", + "\n", + "\t\t\t# Solving the above equation\n", + "T_2 = 1/((math.log(P_2_sat/P_1_sat))/(-delta_H_vap/R) + (1/T_1));\t\t\t#[K]\n", + "T_2 = T_2 - 273.15;\t\t\t#[C]\n", + "\n", + "# Results\n", + "print \" The boiling point of water at a pressure of 2 atm is %f C\"%(T_2);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The boiling point of water at a pressure of 2 atm is 120.836990 C\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.34 Page Number : 269" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T_1 = 0.01 +273.15;\t\t\t#[K]\n", + "T_2 = 1 + 273.15;\t\t\t#[K]\n", + "P_sat_1 = 0.611;\t\t\t#[kPa] - P_sat at temperature T_1\n", + "P_sat_2 = 0.657;\t\t\t#[kPa] - P_sat at temperature T_2\n", + "Mol_wt = 18.015;\t\t\t#[g/mol] - Molecular weight of water\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "# Calculations and Results \n", + " # The clapeyron equation is given by\n", + "\t\t\t# math.log(P_sat_2/P_sat_1) = (-delta H_LV/R)*(1/T_2 - 1/T_1)\n", + "\n", + "\t\t\t# Solving the above equation\n", + "delta_H = -(math.log(P_sat_2/P_sat_1)/(1/T_2 - 1/T_1))*R;\t\t\t#[J/mol]\n", + "delta_H = delta_H/Mol_wt;\t\t\t#[kJ/kg]\n", + "\n", + "print \" The enthalpy of vaporization is %f kJ/kg\"%(delta_H);\n", + "\n", + "\t\t\t# Entropy of vaporization is given by\n", + "S_vap = delta_H/T_2;\t\t\t#[kJ/kg-K]\n", + "print \" The entropy of vaporization is %f kJ/kg-K\"%(S_vap);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The enthalpy of vaporization is 2533.991278 kJ/kg\n", + " The entropy of vaporization is 9.243083 kJ/kg-K\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.35 Page Number : 269" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "# Variables\n", + "T = 100. + 273.15;\t\t\t#[K]\n", + "\t\t\t# (dT/dP)_sat = (1/27.12) K/mm\n", + "dT_dP = (1/27.12);\t\t\t#[K/mm]\n", + "dT_dP = dT_dP*(760./101325);\t\t\t#[K/Pa]\n", + "\n", + "# Calculations\n", + "\t\t\t# The clapeyron equation is given by\n", + "\t\t\t# (dP/dT)_sat = (-delta H_LV)/(T*delta V_LV)\n", + "\t\t\t# delta H_LV = T*delta V_LV*(dP/dT)_sat\n", + "\n", + "\t\t\t# (dP/dT)_sat = 1/(dT/dP)_sat\n", + "dP_dT = 1/dT_dP;\t\t\t#[Pa/K]\n", + "\n", + "\t\t\t# From saturated steam table at 100 C\n", + "V_vap = 1.6729;\t\t\t#[m**(3)/kg]\n", + "V_liq = 0.001044;\t\t\t#[m**(3)/kg]\n", + "delta_V = V_vap - V_liq;\t\t\t#[m**(3)/kg]\n", + "\n", + "\t\t\t# Therefore delta_H_LV is given by\n", + "delta_H_LV = T*delta_V*(dP_dT);\t\t\t#[J/kg]\n", + "delta_H_LV = delta_H_LV*10**(-3);\t\t\t#[kJ/kg]\n", + "\n", + "# Results\n", + "print \" The heat of vaporization of water is %f kJ/kg\"%(delta_H_LV);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The heat of vaporization of water is 2255.667174 kJ/kg\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.36 Page Number : 270" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "# Variables\n", + "T_1 = 100 + 273.15;\t\t\t#[K]\n", + "P_1 = 1.01325;\t\t\t#[bar]\n", + "T_2 = 98 + 273.15;\t\t\t#[K]\n", + "P_2 = 0.943;\t\t\t#[bar]\n", + "V_vap = 1.789;\t\t\t#[m**(3)] - Volume in vapour phase\n", + "vessel_vol = 1.673;\t\t\t#[m**(3)] - Volume of the vessel\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# The total volume remains constant as the walls are rigid. At 98 C we get\n", + "\t\t\t# vessel_vol = V_liq*(1 - x) + V_vap*x\n", + "\t\t\t# Since V_liq is negligible as compared to V_vap, therefore\n", + "x = vessel_vol/V_vap;\n", + "\n", + "\t\t\t# The quantity is given by x = m_vap/(m_liq + m_vap)\n", + "\t\t\t# Since (m_liq + m_vap) = 1, therefore at 98 C saturated vapour is x and saturated liquid is (1 - x)\n", + "m_vap = x;\t\t\t#[kg] - Mass of saturated vapour\n", + "m_liq = (1 - x);\t\t\t#[kg] - Mass of saturated liquid\n", + "\n", + "print \" The amount of vapour condensed is %f kg\"%(m_liq);\n", + "\n", + "\t\t\t# The clapeyron equation is given by\n", + "\t\t\t# math.log(P_2_sat/P_1_sat) = (-delta H_LV/R)*(1/T_2 - 1/T_1)\n", + "\n", + "\t\t\t# Solving the above equation\n", + "delta_H = -(math.log(P_2/P_1)/(1/T_2 - 1/T_1))*R;\n", + "delta_H = delta_H/18.015;\t\t\t#[kJ/kg]\n", + "\n", + "print \" The latent heat of vaporization is %f kJ/kg\"%(delta_H);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The amount of vapour condensed is 0.064841 kg\n", + " The latent heat of vaporization is 2296.240786 kJ/kg\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.37 Page Number : 270" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "from scipy.integrate import quad \n", + "from scipy.optimize import *\n", + "\n", + "\n", + "# Variables\n", + "T_1 = 298.15;\t\t\t#[K] - Smath.tan(math.radiansard reaction temperature\n", + "delta_H_gas = -52.23;\t\t\t#[kcal/mol] - Enthalpy of formation of C2H5OH(gas)\n", + "delta_H_liq = -66.35;\t\t\t#[kcal/mol] - Enthalpy of formation of C2H5OH(liq)\n", + "\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# For ethanol(g) [T is in K and Cp_0 in cal/mol-K]\n", + "\t\t\t# Cp_0 = 4.75 + 5.006*10**(-2)*T - 2.479*10**(-5)*T**(2) + 4.79*10**(-9)*T**(3)\n", + "\n", + "\t\t\t# For ethanol(l) [T is in K and Cp_0 in cal/mol-K]\n", + "\t\t\t# Cp_0 = 67.29 - 0.343*T - 6.94*10**(-4)*T**(2)\n", + "\n", + "\t\t\t# The vaporization of a liquid can be written as C2H5OH(liq) - C2H5OH(gas)\n", + "\t\t\t# Since the pressure is 1 atm therefore the smath.tan(math.radiansard data can be used\n", + "delta_H_298 = delta_H_gas - delta_H_liq;\t\t\t#[kcal/mol]\n", + "delta_H_298 = delta_H_298*1000;\t\t\t#[cal/mol]\n", + "delta_a = 4.75 - 67.29;\n", + "delta_b = 5.006*10**(-2) - (-0.343);\n", + "delta_c = -2.479*10**(-5) - 6.94*10**(-4);\n", + "delta_d = 4.79*10**(-9);\n", + "\n", + "\t\t\t# The smath.tan(math.radiansard enthalpy of vaporization at a temperature T is given by\n", + "\n", + "def f31(T): \n", + "\t return delta_a + delta_b*T + delta_c*T**(2) + delta_d*T**(3)\n", + "\n", + "\t\t\t# delta_H_T = delta_H_298 + quad(f31,T_1,T)[0]\n", + "\n", + "\n", + "\t\t\t# Therefore the smath.tan(math.radiansard enthalpy of vaporization at a temperature T = 283 K is given by\n", + "T_2 = 283;\t\t\t#[K]\n", + "\n", + "def f32(T): \n", + "\t return delta_a+delta_b*T+delta_c*T**(2)+delta_d*T**(3)\n", + "\n", + "delta_H_283 = delta_H_298 + quad(f32,T_1,T_2)[0]\n", + "\n", + "\n", + "\t\t\t# Therefore the smath.tan(math.radiansard enthalpy of vaporization at a temperature T = 348 K is given by\n", + "T_3 = 348;\t\t\t#[K]\n", + "\n", + "def f33(T): \n", + "\t return delta_a+delta_b*T+delta_c*T**(2)+delta_d*T**(3)\n", + "\n", + "delta_H_348 = delta_H_298 + quad(f33,T_1,T_3)[0]\n", + "\n", + "\n", + "print \" The value of enthalpy of vaporization at 283 K is %f cal/mol\"%(delta_H_283);\n", + "print \" The value of enthalpy of vaporization at 298.15 K is %f cal/mol\"%(delta_H_298);\n", + "print \" The value of enthalpy of vaporization at 348 K is %f cal/mol\"%(delta_H_348);\n", + "print \" Therefore Standard enthalpy of vaporization decrease with the increase in temperature\";\n", + "\n", + "\t\t\t# Solving the above equatio manually we get,\n", + "\t\t\t# delta_H_vap = 1.1975*10**(-9)*T**(4) - 2.396*10**(-4)*T**(3) + 0.1965*T**(2) - 62.54*T + 21639.54 \n", + "\t\t\t# Solving for 'T' at which 'delta_H_vap' = 0\n", + "def f(T): \n", + "\t return 1.1975*10**(-9)*T**(4)-2.396*10**(-4)*T**(3)+0.1965*T**(2)-62.54*T + 21639.54\n", + "T_0 = fsolve(f,500)\n", + "\n", + "\t\t\t# We know that at critical point (critical temperature and critical pressure) the enthalpy of vaporization is zero.\n", + "\t\t\t# Here we have made the smath.tan(math.radiansard enthalpy of vaporization equal to zero which is at smath.tan(math.radiansard pressure of 1 atm.\n", + "\t\t\t# Therefore following conclusions can be drawn\n", + "print \" The temperature obtained by equating smath.tan(math.radiansard enthalpy of vaporization equal to zero is %f K\"%(T_0);\n", + "print \" But the critical temperature of ethanol is 513.9 K , which is far from the temperature obtained above\"\n", + "print \" Therefore the temperature obtained by equating smath.tan(math.radiansard enthalpy of vaporization equal to zero is not the critical temperature\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The value of enthalpy of vaporization at 283 K is 14255.030925 cal/mol\n", + " The value of enthalpy of vaporization at 298.15 K is 14120.000000 cal/mol\n", + " The value of enthalpy of vaporization at 348 K is 13593.385895 cal/mol\n", + " Therefore Standard enthalpy of vaporization decrease with the increase in temperature\n", + " The temperature obtained by equating smath.tan(math.radiansard enthalpy of vaporization equal to zero is 635.058887 K\n", + " But the critical temperature of ethanol is 513.9 K , which is far from the temperature obtained above\n", + " Therefore the temperature obtained by equating smath.tan(math.radiansard enthalpy of vaporization equal to zero is not the critical temperature\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.38 Page Number : 276" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "T = 300 + 273.15;\t\t\t#[K] - Temperature\n", + "P = 9000;\t\t\t#[kPa] - Pressure\n", + "P_sat = 8592.7;\t\t\t#[kPa] - Vapour pressure of saturated water at 300 C\n", + "f_sat = 6738.9;\t\t\t#[kPa] - Fugacity of saturated water at 300 C\n", + "V_liq = 25.28;\t\t\t#[cm**(3)/mol] - Molar volume of water in liquid phase\n", + "V_liq = V_liq*10**(-6);\t\t\t# [m**(3)/mol]\n", + "V_vap = 391.1;\t\t\t#[cm**(3)/mol] - Molar volume of water in vapour phase\n", + "V_vap = V_vap*10**(-6);\t\t\t# [m**(3)/mol]\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "# Calculations\n", + "\t\t\t# At 300 C and 9000 kPa water is a compressed liquid and its fugacity is given by\n", + "\t\t\t# f = f_sat*exp[V_liq*(P - P_sat)/R*T]\n", + "fugacity = f_sat*math.exp((V_liq*(P - P_sat)*1000)/(R*T));\n", + "\n", + "# Results\n", + "print \" The fugacity of water at 9000 kPa is %f kPa\"%(fugacity);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The fugacity of water at 9000 kPa is 6753.477111 kPa\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.39 Page Number : 276" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "# Variables\n", + "T = 200 + 273.15;\t\t\t#[K] - Temperature\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "\t\t\t# From steam table at 200 C as reported in the book\n", + "P_sat = 1.5538;\t\t\t#[MPa] - Vapour pressure of saturated steam\n", + "H_vap = 2793.2;\t\t\t#[kJ/kg] - Enthalpy of saturated steam in vapour phase\n", + "S_vap = 6.4323;\t\t\t#[kJ/kg-K] - Entropy of saturated steam in vapour phase\n", + "\n", + "# Calculations\n", + "G_sat = H_vap - T*S_vap;\t\t\t#[kJ/kg] - Gibbs free energy\n", + "G_sat = G_sat*18.015;\t\t\t#[J/mol]\n", + "\n", + "\t\t\t# Now let us calculate the Gibbs free energy at the lowest pressure available in superheated steam tables at 200 C\n", + "\t\t\t# At 200 C and 0.01 MPa as reported in the book\n", + "H = 2879.5;\t\t\t#[kJ/kg] - Enthalpy\n", + "S = 8.9038;\t\t\t#[kJ/kg-K] - Entropy\n", + "G_ig = H - T*S;\t\t\t#[kJ/kg] - Gibbs free energy\n", + "G_ig = G_ig*18.015;\t\t\t#[J/mol]\n", + "\n", + "\t\t\t# Integrating from ideal gas state at 200 C and 0.01 MPa to saturated vapour at 200 C we get\n", + "\t\t\t# G_sat - G_ig = R*T*math.log(f_sat/f_ig)\n", + "\n", + "\t\t\t# Under the ideal gas condition the pressure is small therefore f_ig = P = 0.01 MPa\n", + "f_ig = 0.01;\t\t\t#[MPa]\n", + "\n", + "\t\t\t# Solving the above equation\n", + "f_sat = f_ig*(math.exp((G_sat - G_ig)/(R*T)));\t\t\t#[MPa]\n", + "\n", + "# Results\n", + "print \" The fugacity of saturated steam at 200 C is %f MPa\"%(f_sat);\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The fugacity of saturated steam at 200 C is 1.426074 MPa\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.40 Page Number : 277" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "# Variables\n", + "T = 320 + 273.15;\t\t\t#[K]\n", + "P_1 = 70;\t\t\t#[bar]\n", + "P_2 = 170;\t\t\t#[bar]\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#(a)\n", + "\t\t\t# dG = R*T*dmath.log(f)\n", + "\t\t\t# G - G_ig = R*T*math.log(f/f_ig)\n", + "\n", + "\t\t\t# From steam table the low pressure that is available is 1 kPa.\n", + "f_ig = 1;\t\t\t#[kPa] - Assuming ideal gas behaviour at such low pressure\n", + "\n", + "\t\t\t# At 1 kPa (under saturated conditions)\n", + "P_sat = 112.891;\t\t\t#[bar]\n", + "\t\t\t# Therefore at both 1 kPa and 70 bar the stem is superheated and byond a pressure of 112.891 bar it is compressed liquid.\n", + "\n", + "\t\t\t# For superheated steam table at 1 kPa and 320 C, as repoted in the book\n", + "H_1 = 3117.08;\t\t\t#[kJ/kg] - Enthalpy\n", + "S_1 = 10.41232;\t\t\t#[kJ/kg-K] - Entropy\n", + "\n", + "\t\t\t# For superheated steam table at 70 bar and 320 C, as repoted in the book\n", + "H_2 = 2916.92;\t\t\t#[kJ/kg] - Enthalpy\n", + "S_2 = 6.0651;\t\t\t#[kJ/kg-K] - Entropy\n", + "\n", + "\t\t\t# At 70 bar and 320 C,\n", + "G = H_2 - T*S_2;\t\t\t#[kJ/kg] - Gibbs free energy\n", + "\t\t\t# At 1 kPa and 320 C\n", + "G_ig = H_1 - T*S_1;\t\t\t#[kJ/kg] - Gibbs free energy\n", + "\n", + "\t\t\t# math.log(f/f_ig) = (G - G_ig)/(R*T)\n", + "f = f_ig*(math.exp((G - G_ig)*18/(R*T)));\t\t\t#[kPa]\n", + "f = f*10**(-2);\t\t\t#[bar]\n", + "\n", + "\t\t\t# At 70 bar\n", + "phi = f/P_1;\n", + "\n", + "print \" a).The fugacity of steam at 320 C and 70 bar is %f bar\"%(f);\n", + "print \" The fugacity coefficient at 320 C and 70 bar is phi = %f\"%(phi);\n", + "\n", + "\t\t\t#(b)\n", + "\t\t\t# Now consider saturated steam at 320 C. We have\n", + "P_sat = 112.891;\t\t\t#[bar]\n", + "V_liquid = 1.5;\t\t\t#[cm**(3)/mol] - Molar vlume of saturated liquid\n", + "V_liquid = V_liquid*10**(-6);\t\t\t#[m**(3)/mol]\n", + "V_vapour = 15.48;\t\t\t#[cm**(3)/mol] - Molar vlume of saturated vapour\n", + "U_liqid = 1445.7;\t\t\t#[Kj/kg] - Internal energy of satuarted liquid\n", + "U_vapour = 2528.9;\t\t\t#[kJ/kg] - Internal energy of satuarted vapour\n", + "H_liquid = 1462.6;\t\t\t#[kJ/kg] - Enthalpy of saturated liquid\n", + "H_vapour = 2703.7;\t\t\t#[kJ/kg] - Enthalpy of saturated vapour\n", + "S_liquid = 3.45;\t\t\t#[kJ/kg-K] - Entropy of saturated liquid\n", + "S_vapour = 5.5423;\t\t\t#[kJ/kg-K] - Entropy of saturated vapour\n", + "\n", + "\t\t\t# Now let us calculate Gibbs free energy of saturated liquid and saturated vapour\n", + "G_liquid = H_liquid - T*S_liquid;\t\t\t#[kJ/kg]\n", + "G_vapour = H_vapour - T*S_vapour;\t\t\t#[kJ/kg]\n", + "\t\t\t# Note that under saturated conditions\n", + "\t\t\t# G_sat = G_liquid = G_vapour\n", + "G_sat = G_liquid;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t# math.log(f_sat/f_ig) = (G_sat - G_ig)/(R*T)\n", + "f_sat = f_ig*(math.exp((G_sat - G_ig)*18/(R*T)));\t\t\t#[kPa]\n", + "f_sat = f_sat*10**(-2);\t\t\t#[bar]\n", + "\n", + "phi_sat = f_sat/P_sat;\n", + "\n", + "\t\t\t# And now the fugacity is to be determined at 320 C and P = 170 bar. We know the following relation for compressed liquid.\n", + "\t\t\t# f_CL = f_sat*exp(V_liquid*(P-P_sat)/(R*T))\n", + "f_CL = f_sat*math.exp(V_liquid*18*(P_2-P_sat)*10**(5)/(R*T));\t\t\t#[bar]\n", + "\n", + "\t\t\t# Therefore the fugacity coefficient at 170 bar and 320 C is given by\n", + "phi_2 = f_CL/P_2;\n", + "\n", + "print \" b).The fugacity of steam at 320 C and 170 bar is %f bar\"%(f_CL);\n", + "print \" The fugacity coefficient at 320 C and 170 bar is phi = %f\"%(phi_2);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a).The fugacity of steam at 320 C and 70 bar is 58.913361 bar\n", + " The fugacity coefficient at 320 C and 70 bar is phi = 0.841619\n", + " b).The fugacity of steam at 320 C and 170 bar is 86.552966 bar\n", + " The fugacity coefficient at 320 C and 170 bar is phi = 0.509135\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.41 Page Number : 278" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "# Variables\n", + "T = 300 + 273.15;\t\t\t#[K]\n", + "P_1 = 12500*10**(3);\t\t\t#[Pa]\n", + "P_2 = 8581*10**(3);\t\t\t#[Pa]\n", + "P_3 = 300*10**(3);\t\t\t#[Pa]\n", + "V_liq = 1.404;\t\t\t#[cm**(3)/g] - Specific volume of liquid\n", + "V_liq = (V_liq/10**(6))*18.015;\t\t\t#[m**(3)/mol]\n", + "R = 8.314;\t\t\t#[J/mol*K] - Universal gas constant\n", + "\n", + "# Calculations and Results\n", + "\t\t\t# state 1: 300 C, 12500 kPa\n", + "\t\t\t# state 2: 300 C, 8581 kPa\n", + "\t\t\t# state 3: 300 C, 300 kPa\n", + "\n", + "\t\t\t# From state 1 to state 2 the system is liquid water and if the molar volume of liquid is assumed costant we can write\n", + "\t\t\t# G_2 - G_1 = V_liq*(P_2 - P_1)\n", + "\t\t\t# G_2 - G_1 = R*Tmath.log(f_2/f_1)\n", + "\t\t\t# Comparing the above two equations we get\n", + "\t\t\t# (f_2/f_1) = exp((V_liq*(P_2 - P_1)/(R*T))\n", + "f2_f1 = math.exp((V_liq*(P_2 - P_1)/(R*T))); \t\t\t# (f_2/f_1) = f2_f1 (say)\n", + "\n", + "\t\t\t# In state 2 the fugacity of liquid is same as that of saturated vapour and for the vapour phase change from state 2 to 3 the fugacity ratio is calculated using \n", + "\t\t\t# G_3 - G_2 = R*Tmath.log(f_3/f_2)\n", + "\n", + "\t\t\t# At 300 C, 8581 kPa \n", + "H_liq_2 = 2749.0;\t\t\t#[kJ/kg]\n", + "S_vap_2 = 5.7045;\t\t\t#[kJ/kg-K]\n", + "G_vap_2 = -520.53;\t\t\t#[kJ/kg]\n", + "G_vap_2 = G_vap_2*18.015;\t\t\t#[J/mol]\n", + "\n", + "\t\t\t# At 300 C, 300 kPa \n", + "H_3 = 3069.3;\t\t\t#[kJ/kg]\n", + "S_3 = 7.7022;\t\t\t#[kJ/kg-K]\n", + "G_3 = -1345.22;\t\t\t#[kJ/kg]\n", + "G_3 = G_3*18.015;\t\t\t#[J/mol]\n", + "\n", + "\t\t\t# Substituting and solving the equation G_3 - G_2 = R*Tmath.log(f_3/f_2)\n", + "f3_f2 = math.exp((G_3 - G_vap_2)/(R*T));\t\t\t# (f_3/f_2) = f3_f2 (say)\n", + "\n", + "\t\t\t# (f_3/f_1) = (f_3/f_2)*(f_2/f_1)\n", + "f3_f1 = f3_f2*f2_f1;\n", + "\n", + "print \" The ratio of fugacity in the final state to that in the initial state is given by f3/f2 = %f\"%(f3_f2);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The ratio of fugacity in the final state to that in the initial state is given by f3/f2 = 0.044255\n" + ] + } + ], + "prompt_number": 25 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch8_2-checkpoint.ipynb b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch8_2-checkpoint.ipynb new file mode 100644 index 00000000..6b83d68c --- /dev/null +++ b/Chemical_Engineering_Thermodynamics/.ipynb_checkpoints/ch8_2-checkpoint.ipynb @@ -0,0 +1,752 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:8df6804e24ffba947b26128cacd98ede56f82be4a3089c7567d672249f51ebda" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "\n", + "Chapter 8 : Thermodynamic Cycles" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.1 Page Number : 287" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "\n", + "# Variables\n", + "P_1 = 30;\t\t\t#[bar]\n", + "P_2 = 0.04;\t\t\t#[bar]\n", + "\n", + "\t\t\t#(1).Carnot cycle\n", + "\t\t\t#It has been reported in the book that at 30 bar pressure (saturated) :\n", + "H_liq_1 = 1008.42;\t\t\t#[kJ/kg]\n", + "H_vap_1 = 2804.2;\t\t\t#[kJ/kg]\n", + "S_liq_1 = 2.6457;\t\t\t#[kJ/kg-K]\n", + "S_vap_1 = 6.1869;\t\t\t#[kJ/kh-K]\n", + "\t\t\t#Therefore, H_1 = H_liq_1, H_2 = H_vap_1, S_1 = S_liq_1 and S_2 = S_vap_1\n", + "H_1 = H_liq_1;\n", + "H_2 = H_vap_1;\n", + "S_1 = S_liq_1;\n", + "S_2 = S_vap_1;\n", + "\n", + "#At 0.04 bar pressure (saturated) :\n", + "H_liq_2 = 121.46;\t\t\t#[kJ/kg]\n", + "H_vap_2 = 2554.4;\t\t\t#[kJ/kg]\n", + "S_liq_2 = 0.4226;\t\t\t#[kJ/kg-K]\n", + "S_vap_2 = 8.4746;\t\t\t#[kJ/kh-K]\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#Dryness fraction at state 3 can be found the fact that S_3 = S_2 \n", + "x_3 = (S_2 - S_liq_2)/(S_vap_2 - S_liq_2);\n", + "H_3 = H_liq_2*(1 - x_3) + x_3*H_vap_2;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t#Dryness fraction at state 4 can be found the fact that S_4 = S_1\n", + "x_4 = (S_1 - S_liq_2)/(S_vap_2 - S_liq_2);\n", + "H_4 = H_liq_2*(1 - x_4) + x_4*H_vap_2;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t#Work done by turbine W_tur = -delta_H = -(H_3 - H_2)\n", + "W_tur = H_2 - H_3;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t#Work supplied by boiler,\n", + "q_H = H_2 - H_1;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t#Work transfer in compressor is given by\n", + "W_com = -(H_1 - H_4);\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t#Efficiency can now be calculated as\n", + "\t\t\t#n = (Net work done/Work supplied by boiler)\n", + "n_carnot = (W_tur + W_com)/q_H;\n", + "\n", + "\t\t\t#Efficiency of the Carnot cycle can also be determined from the formula\n", + "\t\t\t# n = 1 - (T_L/T_H), Where T_L is saturated temperature at 0.04 bar and T_H is saturated temperature at 30 bar\n", + "\n", + "print \"1.Carnot cycle\";\n", + "print \"The work done by the turbine is %f kJ/kg\"%(W_tur);\n", + "print \"The heat transfer in the boiler is %f kJ/kg\"%(q_H);\n", + "print \"The cycle efficiency is %f\"%(n_carnot);\n", + "\n", + "\t\t\t#(2).Rankine cycle\n", + "\t\t\t#The enthalpies at state 2 and 3 remain as in the Carnot cycle\n", + "\t\t\t#Saturated liquid enthalpy at 0.04 bar is \n", + "H_4_prime = H_liq_2;\n", + "\n", + "\t\t\t#Saturated liquid volume at 0.04 bar as reported in the book is\n", + "V_liq = 0.001004;\t\t\t#[m**(3)/kg]\n", + "\t\t\t#Work transfer in pump can be calculated as\n", + "W_pump = -V_liq*(P_1 - P_2)*100;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t#Work transfer around pump gives, W_pump = -delta_H = -(H_1_prime - H_4_prime);\n", + "H_1_prime = H_4_prime - W_pump;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t#Heat supplied to boiler is\n", + "q_H_prime = H_2 - H_1_prime;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t#Work done by turbine is\n", + "W_tur_prime = H_2 - H_3;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t#Efficiency can now be calculated as\n", + "\t\t\t#n = (Net work done/Heat input)\n", + "n_rankine = (W_tur_prime + W_pump)/q_H_prime;\t\t\t#\n", + "\n", + "print \"2.Rankine cycle\";\n", + "print \"The work done by the turbine is %f kJ/kg\"%(W_tur_prime);\n", + "print \"The heat transfer in the boiler is %f kJ/kg\"%(q_H_prime);\n", + "print \"The cycle efficiency is %f\"%(n_rankine);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1.Carnot cycle\n", + "The work done by the turbine is 941.036567 kJ/kg\n", + "The heat transfer in the boiler is 1795.780000 kJ/kg\n", + "The cycle efficiency is 0.404166\n", + "2.Rankine cycle\n", + "The work done by the turbine is 941.036567 kJ/kg\n", + "The heat transfer in the boiler is 2679.732016 kJ/kg\n", + "The cycle efficiency is 0.350046\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.2 Page Number : 288" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T_max = 700+273.15;\t\t\t#[K] - Maximum temperature.\n", + "P_boiler = 10*10**(6);\t\t\t#[Pa] - Constant pressure in the boiler\n", + "P_condenser = 10*10**(3);\t\t\t#[Pa] - Constant pressure in the condenser\n", + "\n", + "\t\t\t#At state 2 i.e, at 700 C and 10 MPa,it has been reported in the book that from steam table\n", + "S_2 = 7.1687;\t\t\t#[kJ/kg-K] - Entropy\n", + "H_2 = 3870.5;\t\t\t#[kJ/kg] - Enthalpy\n", + "\n", + "\t\t\t#At state 3 i.e, at 700 C and 10 KPa,\n", + "S_3 = S_2;\t\t\t#[kJ/kg-K]- Entropy \n", + "\n", + "\t\t\t#For sturated steam at 10 kPa, it has been reported in the book that from steam table\n", + "S_liq = 0.6493;\t\t\t#[kJ/kg-K]- Entropy of saturated liquid\n", + "S_vap = 8.1502;\t\t\t#[kJ/kg-K] - Enthalpy of saturated liquid\n", + "\t\t\t#Therefore steam is saturated and its dryness factor can be calculated as\n", + "x = (S_2 - S_liq)/(S_vap - S_liq);\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#The enthalpy at state 3 is now calculated. For steam at 10 kPa,it has been reported in the book that from steam table\n", + "H_liq = 191.83;\t\t\t#[kJ/kg]\n", + "H_vap = 2584.7;\t\t\t#[kJ/kg]\n", + "\t\t\t#Therefore enthalpy at state 3 is\n", + "H_3 = H_liq*(1-x) + H_vap*x;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t#Work done by the turbine \n", + "W_tur = -(H_3 - H_2);\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t#Now we have to calculate work input to the pump\n", + "\t\t\t#State 4:Saturated liquid at 10 kPa\n", + "\t\t\t#State 4:Compressed liquid at 10 MPa\n", + "\t\t\t#Since volume of liquid does not get affected by pressure we take volume of saturated liquid at 10 kPa,\n", + "V_liq = 0.001010;\t\t\t#[m**(3)/kg]\n", + "\n", + "\t\t\t#Work transfer in the pump is\n", + "W_pump = -V_liq*(P_boiler - P_condenser)*10**(-3);\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t#Energy balance around pump gives, W_pump = -delta_H = -(H_1 - H_4)\n", + "H_4 = H_liq;\t\t\t# Enthalpy at state 4 (saturated liquid at 10 kPa)\n", + "H_1 = H_4 - W_pump;\t\t\t#[kJ/kg]\n", + " \n", + "\t\t\t#Heat supplied to boiler is\n", + "q_H = H_2 - H_1;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t#Efficiency can now be calculated as\n", + "\t\t\t#n = (Net work done/Heat input)\n", + "n_rankine = (W_tur + W_pump)/q_H;\n", + "\n", + "print \"The efficiency of the Rankine cycle is found to be %f\"%(n_rankine);\n", + "\n", + "\t\t\t#Now let us determine the efficiency of Carnot cycle. The maximun temperature is 700 C and minimum temperature is that of saturated steam at 10 kPa,\n", + "T_min = 45.81 + 273.15;\t\t\t#[K] - From steam table as reported in the book\n", + "n_carnot = 1-(T_min/T_max);\n", + "\t\t\t#Note that the efficiency of Rankine cycle is less than that of carnot cycle" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The efficiency of the Rankine cycle is found to be 0.433088\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.3 Page Number : 291" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "W = 1.1;\t\t\t#[kW] - Work done per ton of refrigeration \n", + "\t\t\t#1 ton refrigeration = 3.517 kW, therefore\n", + "H = 3.517;\t\t\t#[kW] - Heat absorbed\n", + "T_low = -30 + 273.15;\t\t\t#[K] - Low temperature maintained\n", + "\n", + "# Calculations\n", + "\t\t\t#COP can be calculated as\n", + "\t\t\t#COP = (Heat absorbed/Work done)\n", + "COP = H/W;\n", + "\n", + "\t\t\t#For reversed carnot cycle, COP = T_low/(T_high - T_low). Solving this we get\n", + "T_high = (T_low/COP) + T_low;\t\t\t#[K] - Higher temperature\n", + "\n", + "\t\t\t#Heat rejected is\n", + "H_rej = W + H;\t\t\t#[kW];\n", + "\n", + "# Results\n", + "print \"The COP is %f\"%(COP);\n", + "print \"The higher temperature of the cycle is %f K\"%(T_high);\n", + "print \"The heat rejected per ton of refrigeration is %f kW\"%(H_rej);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The COP is 3.197273\n", + "The higher temperature of the cycle is 319.199190 K\n", + "The heat rejected per ton of refrigeration is 4.617000 kW\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.4 Page Number : 292" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T_high = 20 + 273.15;\t\t\t#[K] - High temperature\n", + "T_low = 0 + 273.15;\t\t\t#[K] - Low temperature\n", + "Q_H = 10;\t\t\t#[kW] - Heat supplied\n", + "\n", + "# Calculations\n", + "\t\t\t#If 'Q_H' is the rate at which heat is taken from surrounding and 'W' is the rate at which work is done,then\n", + "\t\t\t# Q_H = W + Q_L\n", + "\t\t\t#(Q_H/Q_L) = (T_high/T_low)\n", + "\t\t\t#Also for a reversible cycle, (Q_H/Q_L) = 1 + (W/Q_L). Solving we get,\n", + "Q_L = (T_low/T_high)*Q_H;\t\t\t#[kW]\n", + "W = (Q_H - Q_L) ;\t\t\t#[kW]\n", + " \n", + "# Results\n", + "print \"The minimum power required is %f kW\"%(W);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The minimum power required is 0.682245 kW\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.5 Page Number : 292" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T_high = 40 + 273.15;\t\t\t#[K] - High temperature\n", + "T_low = -20 + 273.15;\t\t\t#[K] - Low temperature\n", + "C = 10;\t\t\t#[tons of refrigeration] - Capacity\n", + "\t\t\t#1 ton refrigeration = 3.517 kW, therefore\n", + "H = C*3.517;\t\t\t#[kW] - Heat absorbed\n", + "\n", + "# Calculations\n", + "\t\t\t#For reversed carnot cycle, COP = T_low/(T_high - T_low)\n", + "COP = T_low/(T_high - T_low);\n", + "\n", + "\t\t\t# COP = (Refrigerating effect)/(Work input), therefore power required is given by\n", + "P = (H/COP);\t\t\t#[kW]\n", + "\n", + "# Results\n", + "print \"The COP is %f\"%(COP);\n", + "print \"The power required is %f kW\"%(P);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The COP is 4.219167\n", + "The power required is 8.335769 kW\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.6 Page Number : 292" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "COP = 4;\t\t\t#Coefficient of performance\n", + "P = 10;\t\t\t#[kW] - Work done on the cycle\n", + "\n", + "# Calculations\n", + "\t\t\t#For reversed carnot cycle, COP = T_low/(T_high - T_low)\n", + "\t\t\t#ratio = (T_high/T_low),therefore\n", + "ratio = -1/(COP + 1);\n", + "\n", + "\t\t\t# Refrigerating effect = (COP)*Work input, therefore refrigeration is given by\n", + "H = COP*P;\t\t\t#[kW]\n", + "\n", + "\t\t\t#Maximum refrigearation in tons is given by\n", + "H_max = (H/3.517);\n", + "\n", + "# Results\n", + "print \"The maximum refrigeration value is %f ton\"%(H_max);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The maximum refrigeration value is 11.373330 ton\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.7 Page Number : 292" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "m = 0.6;\t\t\t#[kg/s] - mass flow rate\n", + "T_low = -20+273.15;\t\t\t#[K] - Temperature at which vapour enters the compressor\n", + "T_high = 30+273.15;\t\t\t#[K] - Temperature at which vapour leaves the condenser\n", + "\n", + "\t\t\t#From saturated refrigeration-12 tables we get,at -20 C\n", + "H_1 = 178.74;\t\t\t#[kJ/kg] - (H_1 = H_vap)\n", + "P_1 = 0.15093;\t\t\t#[MPa] - (P_1 = P_sat)\n", + "P_4 = P_1;\n", + "S_1 = 0.7087;\t\t\t#[kJ/kg-K] - (S_1 = S_vap)\n", + "S_2 = S_1;\n", + "\n", + "\t\t\t#At 30 C\n", + "P_2 = 0.7449;\t\t\t#[MPa] - (P_2 = P_sat)\n", + "P_3 = P_2;\n", + "H_3 = 64.59;\t\t\t#[kJ/kg] - (H_3 = H_liq)\n", + "H_4 = H_3;\n", + "S_3 = 0.24;\t\t\t#[kJ/kg-K] - (S_3 = S_liq)\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#It is assumed that presssure drop in the evaporator and condenser are negligible. The heat transfer rate in the evaporator is\n", + "Q_L = m*(H_1 - H_4);\n", + "\n", + "print \"The heat transfer rate in the evaporator is %f kW\"%(Q_L);\n", + "\n", + "\t\t\t#At state 2 (P = 0.7449 MPa and S = 0.7087 kJ/kg-K) and looking in the superheated tables we have to calculate the enthalpy at state 2\n", + "\n", + "\t\t\t#At P = 0.7 MPa and S = 0.6917 kJ/kg-K,\n", + "H_11 = 200.46;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t#At P = 0.7 MPa and S = 0.7153 kJ/kg-K,\n", + "H_12 = 207.73;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t#Thus at P = 0.7 MPa and S = 0.7087 kJ/kg-K, enthalpy is given by\n", + "H_13 = ((S_2 -0.6917)/(0.7153 - 0.6917))*(H_12 - H_11) + H_11;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t#At P = 0.8 MPa and S = 0.7021 kJ/kg-K,\n", + "H_21 = 206.07;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t#At P = 0.8 MPa and S = 0.7253 kJ/kg-K,\n", + "H_22 = 213.45;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t#Thus at P = 0.8 MPa and S = 0.7087 kJ/kg-K, enthalpy is given by\n", + "H_23 = ((S_2 -0.7021)/(0.7253 - 0.7021))*(H_22 - H_21) + H_21;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t#At P = 0.7449 MPa, S = 0.7087 kJ/kg-K, the enthalpy is\n", + "H_2 = ((0.7449 - 0.7)/(0.8 - 0.7))*(H_23 - H_13) + H_13;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t#Power consumed by the compressor is\n", + "W_comp = m*(H_2 - H_1);\t\t\t#[kW]\n", + "\n", + "print \"The power consumed by the compressor is %f kW\"%(W_comp);\n", + "\n", + "\t\t\t#Heat removed in evaporator/work done on compressor\n", + "COP_R = Q_L/W_comp;\n", + "\n", + "print \"The COP the refrigerator is %f kW\"%(COP_R);\n", + "\n", + "\n", + "\t\t\t#At -20 C,saturated conditions \n", + "H_liq = 17.82;\t\t\t#[kJ/kg]\n", + "H_vap = 178.74;\t\t\t#[kJ/kg]\n", + "x_4 = (H_4 - H_liq)/(H_vap - H_liq);\n", + "\n", + "print \"The dryness factor of refrigerant after the expansion valve is %f\"%(x_4);\n", + "\n", + "\t\t\t#The heat transfer rate in the condenser is\n", + "Q_H = m*(H_3 - H_2);\t\t\t#[kW]\n", + "\n", + "print \"The heat transfer rate in the condenser is %f kW\"%(Q_H);\n", + "\n", + "\t\t\t#If the cycle would have worked as a pump then,\n", + "\t\t\t#COP_HP = (Heat supplied from condenser/Work done on compressor)\n", + "COP_HP = (-Q_H)/W_comp;\n", + "\n", + "print \"The COP if cycle would work as a heat pump is %f kW\"%(COP_HP);\n", + "\n", + "\t\t\t#If the cycle would have been a reversed Carnot cycle then\n", + "COP_C = T_low/(T_high - T_low);\n", + "\n", + "print \"The COP if cycle would run as reversed Carnot cycle is %f kW\"%(COP_C);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The heat transfer rate in the evaporator is 68.490000 kW\n", + "The power consumed by the compressor is 16.840242 kW\n", + "The COP the refrigerator is 4.067044 kW\n", + "The dryness factor of refrigerant after the expansion valve is 0.290641\n", + "The heat transfer rate in the condenser is -85.330242 kW\n", + "The COP if cycle would work as a heat pump is 5.067044 kW\n", + "The COP if cycle would run as reversed Carnot cycle is 5.063000 kW\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.8 Page Number : 300" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\t\t\n", + "\n", + "# Variables\n", + "H_1 = 310.38;\t\t\t#[kJ/kg]\n", + "H_2 = 277.7;\t\t\t#[kJ/kg]\n", + "H_5 = -122.6;\t\t\t#[kJ/kg]\n", + "H_6 = 77.8;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t#The enthalpy at point 3 is same at point 4 as the expansion is isenthalpic\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#The mass condensed is 1 kg and therefore m_1 = m+6 + 1\n", + "\n", + "\t\t\t#Enthalpy balance around heat exchanger\n", + "\t\t\t#m_2*H_2 + m_2*H_6 = m_3*H_3 + m_7*H_7\n", + "\n", + "\t\t\t#Enthalpy balance around separator\n", + "\t\t\t#m_4*H_4 = m_5*H_5 + m_6*H_6\n", + "\t\t\t#It can be seen that m_1 = m_2 = m_3 = m_4\n", + "\t\t\t#and m_6 = m_7 = m_1 - 1\n", + "\n", + "\t\t\t#Substituting the values for enthalpy balance around heat exchanger we get,\n", + "\t\t\t#m_1*H_2 + (m_1 - 1)*(H_6) = m_1*H_3 + (m_1 - 1)*H_1\n", + "\t\t\t#and substituting the values for enthalpy balance around seperator we get\n", + "\t\t\t#m_1*H_3 = (1)*(-122.6) + (m_1 - 1)*77.8\n", + "\t\t\t#H_3 = ((1)*(-122.6) + (m_1 - 1)*77.8)/m_1\n", + "\t\t\t#Substituting the expression for 'H_3' in the above equation and then solving for m_1, we get\n", + "def f(m_1): \n", + "\t return m_1*H_2+(m_1-1)*(H_6)-m_1*(((1)*(-122.6) + (m_1 - 1)*77.8)/m_1)-(m_1-1)*H_1\n", + "m_1 = fsolve(f,4)\n", + "\t\t\t#Thus to liquify 1 kg of air compression of m_1 kg of air is carried out.\n", + "\n", + "\t\t\t#Now substituting this value of m_1 to get the value of H_3,\n", + "H_3 = ((1)*(-122.6) + (m_1 - 1)*77.8)/m_1;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t#From given compressed air table we see at 200 bar and 160 K,\n", + "H_3_1 = 40.2;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t#At 200 bar and 180 K,\n", + "H_3_2 = 79.8;\t\t\t#[kJ/kg]\n", + "\t\t\t#By interpolation we get,\n", + "T_3 = ((H_3 - H_3_1)*(180 - 160))/(H_3_2 - H_3_1) + 160;\t\t\t#[K]\n", + "\n", + "print \"Temperature before throttling is %f K\"%(T_3);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Temperature before throttling is 171.350719 K\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.9 Page Number : 304" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variables\n", + "\t\t\t#At 1 bar, 310 K \n", + "H_1 = 310.38;\t\t\t#[kJ/kg]\n", + "\t\t\t#At 200 bar, 310 K\n", + "H_2 = 277.7;\t\t\t#[kJ/kg]\n", + "\t\t\t#At 1 bar, Saturated liquid\n", + "H_7 = -122.6;\t\t\t#[kJ/kg]\n", + "\t\t\t#At 1 bar, Saturated vapour\n", + "H_8 = 77.8;\t\t\t#[kJ/kg]\n", + "\t\t\t#At 200 bar, 200 K\n", + "H_3 = 117.6;\t\t\t#[kJ/kg]\n", + "\t\t\t#At 1 bar, 100 K\n", + "H_11 = 98.3;\t\t\t#[kJ/kg]\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#For 1 kg of liquid air obtained,the overall enthalpy balance is\n", + "\t\t\t#m_2*H_2 = W - 122.6 + (m_2 - 1)*H_1\n", + "\t\t\t#W = - 0.8*m_2*(H_11 - H_3)\n", + "\t\t\t#Overall enthalpy balance equation becomes\n", + "\t\t\t#H_2*m_2 = 15.44*m_2 - H_7 + (m_2 - 1)*H_1, solving\n", + "m_2_prime = (H_7 - H_1)/(H_2 - 15.44 - H_1);\n", + "\n", + "print \"The number of kimath.lograms of air compressed per kg of liquid air produced is %f kg\"%(m_2_prime);\n", + "\n", + "\t\t\t#(2)\n", + "\t\t\t#Enthalpy balance around separator is \n", + "\t\t\t#0.2*m_2*H_5 = -H_7 + (0.2*m_2 - 1)*H_8, solving\n", + "m_2 = m_2_prime;\n", + "H_5_prime = ((0.2*m_2-1)*H_8 - H_7)/(0.2*m_2);\n", + "\n", + "\t\t\t#At point 5, P = 200 bar and enthalpy is\n", + "H_5_1 = -33.53;\t\t\t#[kJ/kg]\n", + "\t\t\t#From compressed air tables at 200 bar and 140 K,\n", + "H_5_2 = 0.2;\t\t\t#[kJ/kg]\n", + "\t\t\t#At 200 bar and 120 K,\n", + "H_5_3 = -38.0;\t\t\t#[kJ/kg]\n", + "\t\t\t#Solving by interpolation we get\n", + "T_5 = ((H_5_1 - H_5_3)*(140 - 120))/(H_5_2 - H_5_3) + 120;\t\t\t#[K]\n", + "\n", + "print \"The temperature of air before throttling is %f K\"%(T_5);\n", + "\n", + "\t\t\t#(3)\n", + "\t\t\t#During mixing of streams 8 and 11 to produce stream 9, the enthalpy balance is\n", + "\t\t\t# (0.2*m_2 - 1)*H_8 + 0.8*m_2*H_11 = (m_2 - 1)*H_9,Solving for H_9\n", + "\n", + "H_9_prime = ((0.2*m_2-1)*H_8+0.8*m_2*H_11)/(m_2 - 1);\n", + "\n", + "\t\t\t#From given compressed air tables at 1 bar and 100 K,\n", + "H_9_1 = H_11;\n", + "\t\t\t#At 1 bar and 90 K \n", + "H_9_2 = 87.9;\t\t\t#[kJ/kg]\n", + "\t\t\t#Solving by interpolation we get\n", + "T_9 = ((H_9_prime - H_9_2)*(100 - 90))/(H_9_1 - H_9_2) + 90;\t\t\t#[K]\n", + "\n", + "print \"The temperature of stream entering second heat exchanger is %f K\"%(T_9);\n", + "\n", + "\t\t\t#(4)\n", + "\t\t\t#Enthalpy balance around first heat exchanger is\n", + "\t\t\t#H_2*m_2 + (m_2 - 1)*H_10 = H_3*m-2 + (m-2 - 1)*H_1, solving for H_10\n", + "\n", + "H_10_prime = ((m_2 - 1)*H_1 + H_3*m_2 - H_2*m_2)/(m_2 - 1);\n", + "\n", + "\t\t\t#From given compressed air tables at 1 bar and 140 K,\n", + "H_10_1 = 139.1;\t\t\t#[kJ/kg]\n", + "\t\t\t#At 1 bar and 120 K \n", + "H_10_2 = 118.8;\t\t\t#[kJ/kg]\n", + "\t\t\t#Solving by interpolation we get\n", + "T_10 = ((H_10_prime - H_10_2)*(140 - 120))/(H_10_1 - H_10_2) + 120;\t\t\t#[K]\n", + "\n", + "print \"The temperature of stream exiting second heat exchanger is %f K\"%(T_10);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The number of kimath.lograms of air compressed per kg of liquid air produced is 8.997922 kg\n", + "The temperature of air before throttling is 122.340314 K\n", + "The temperature of stream entering second heat exchanger is 98.029358 K\n", + "The temperature of stream exiting second heat exchanger is 131.292906 K\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.10 Page Number : 307" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "P_high = 40;\t\t\t#[bar]\n", + "P_low = 5;\t\t\t#[bar]\n", + "m_1 = 0.5;\t\t\t#[kg/s] - Rate of mass moving through the expander\n", + "m_2 = 0.1;\t\t\t#[kg/s] - Rate of mass of vapour mixing with air\n", + "e = 0.7;\t\t\t#Efficiency\n", + "\n", + "\t\t\t#At state 3,(40 bar and 200 K),enthalpy and entropy is given by\n", + "H_3 = 179.7;\t\t\t#[kJ/kg]\n", + "S_3 = 5.330;\t\t\t#[kJ/kg-K]\n", + "\n", + "\t\t\t#If isentropic conditions exits in the turbine then state 11 is at 5 bar\n", + "S_11 = 5.330;\t\t\t#[kJ/kg-K]\n", + "\t\t\t#From given compressed air tables at 5 bar and 120 K,\n", + "H_11_1 = 113.6;\t\t\t#[kJ/kg]\n", + "S_11_1 = 5.455;\t\t\t#[kJ/kg-K]\n", + "\t\t\t#At 5 bar and 100 K \n", + "H_11_2 = 90.6;\t\t\t#[kJ/kg]\n", + "S_11_2 = 5.246;\t\t\t#[kJ/kg-K]\n", + "\t\t\t#The enthalpy has to be determined when S = S_3\n", + "\n", + "# Calculations and Results\n", + "\t\t\t#Solving by interpolation we get\n", + "H_11_s = ((H_11_1 - H_11_2)*(S_3 - S_11_2))/(S_11_1 - S_11_2) + H_11_2;\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t#The adiabatic efficiency of tyrbine is given by\n", + "\t\t\t#(H_3 - H_11_a)/(H_3 - H_11_s) = e\n", + "H_11_a = H_3 - e*(H_3 - H_11_s);\t\t\t#[kJ/kg] - Actual enthalpy\n", + "\n", + " \t\t\t#At 5 bar,the saturated enthalpy is given to be\n", + "H_8 = 88.7;\t\t\t#[kJ/kg]\n", + "\t\t\t#From enthalpy balance during mixing we get,\n", + "\t\t\t#0.1*H_8 + 0.5*H_11_a = 0.6*H_9\n", + "H_9 = (m_2*H_8 + m_1*H_11_a)/(m_1 + m_2);\t\t\t#[kJ/kg]\n", + "\n", + "\t\t\t#From given compressed air tables at 5 bar and 140 K,\n", + "H_9_1 = 135.3;\t\t\t#[kJ/kg]\n", + "\t\t\t#At 5 bar and 120 K \n", + "H_9_2 = 113.6;\t\t\t#[kJ/kg]\n", + "\t\t\t#By interpolation we get\n", + "T_9 = ((H_9 - H_11_1)*(140 - 120))/(H_9_1 - H_11_1) + 120;\t\t\t#[K]\n", + "\n", + "print \" The temperature of air entering the second heat exchanger is %f K\"%(T_9);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The temperature of air entering the second heat exchanger is 124.009841 K\n" + ] + } + ], + "prompt_number": 10 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch1-checkpoint.ipynb b/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch1-checkpoint.ipynb new file mode 100644 index 00000000..8973ccb0 --- /dev/null +++ b/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch1-checkpoint.ipynb @@ -0,0 +1,84 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:85fd10a5846b5256e76a45973450cd001c1aeb110532e77b6ab379820dba7274" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 1 : Overview" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.1 Page No : 17" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "class BankAccount:\n", + " def __init__(self,openingBalance): # constructor\n", + " self.balance = openingBalance\n", + "\n", + " def deposit(self,amount): # makes deposit\n", + " self.balance = self.balance + amount; \n", + " \n", + " def withdraw(self,amount): # makes withdrawal\n", + " self.balance = self.balance - amount; \n", + "\n", + " def display(self):\n", + " # displays balance \n", + " print 'balance=' , self.balance\n", + "\n", + "# end class BankAccount\n", + "\n", + "ba1 = BankAccount(100.00) # create acct\n", + "print 'Before transactions, ',\n", + "ba1.display()\n", + "# display balance\n", + "ba1.deposit(74.35)\n", + "ba1.withdraw(20.00)\n", + "print 'After transactions, ' ,\n", + "ba1.display()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Before transactions, balance= 100.0\n", + "After transactions, balance= 154.35\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch10-checkpoint.ipynb b/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch10-checkpoint.ipynb new file mode 100644 index 00000000..86853ad0 --- /dev/null +++ b/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch10-checkpoint.ipynb @@ -0,0 +1,238 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:8fd742e3911255005d5cc80d3e792a10aed91d6e12fc125e66cc3c416b974be7" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 10 : 2-3-4 Trees and External Storage" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.1 Page No : 478" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class DataItem:\n", + " def __init__(self,dd):\n", + " self.dData = dd\n", + "\n", + " def displayItem(self):\n", + " print '/' ,self.dData\n", + "\n", + "class Node:\n", + " def __init__(self):\n", + " self.ORDER = 4\n", + " self.numItems = 0\n", + " self.parent = None\n", + " self.childArray = [None,None,None,None]\n", + " self.itemArray = [None,None,None]\n", + "\n", + " def connectChild(self,childNum,child):\n", + " self.childArray[childNum] = child\n", + " if(child != None):\n", + " child.parent = self\n", + "\n", + " def disconnectChild(self,childNum):\n", + " tempNode = self.childArray[childNum]\n", + " self.childArray[childNum] = None\n", + " return tempNode\n", + "\n", + " def getChild(self,childNum):\n", + " return self.childArray[childNum]\n", + "\n", + " def getParent(self):\n", + " return self.parent\n", + "\n", + " def isLeaf(self):\n", + " if self.childArray[0]==None:\n", + " return True \n", + " return False \n", + "\n", + " def getNumItems(self):\n", + " return self.numItems\n", + "\n", + " def getItem(self,index): # get DataItem at index\n", + " return self.itemArray[index] \n", + "\n", + " def isFull(self):\n", + " if self.numItems==self.ORDER-1:\n", + " return True\n", + " return False\n", + "\n", + " def findItem(self,key): # return index of # item (within node)\n", + " for j in range(self.ORDER-1): \n", + " if(self.itemArray[j] == None):\n", + " break\n", + " elif(self.itemArray[j].dData == key):\n", + " return j\n", + " return -1\n", + "\n", + " def insertItem(self,newItem):\n", + " #assumes node is not full\n", + " self.numItems += 1 # will add new item\n", + " newKey = newItem.dData # key of new item\n", + " j = self.ORDER - 2\n", + " while j>=0:\n", + " if(self.itemArray[j] == None):\n", + " continue\n", + " else:\n", + " itsKey = self.itemArray[j].dData\n", + " if(newKey < itsKey):\n", + " self.itemArray[j+1] = self.itemArray[j]\n", + " else:\n", + " self.itemArray[j+1] = newItem\n", + " return j+1 # return index to\n", + " j -= 1\n", + "\n", + " self.itemArray[0] = newItem # insert new item\n", + " return 0\n", + "\n", + " def removeItem(self): # remove largest item\n", + " temp = self.itemArray[self.numItems-1] # save item\n", + " self.itemArray[self.numItems-1] = None # disconnect it\n", + " self.numItems -= 1 # one less item\n", + " return temp # return item\n", + "\n", + " def displayNode(self):\n", + " for j in range(self.numItems):\n", + " self.itemArray[j].displayItem()\n", + " print ''\n", + "\n", + "class Tree234:\n", + " def __init__(self):\n", + " self.root = Node() # make root node\n", + "\n", + " def find(self,key):\n", + " curNode = self.root\n", + " childNumber = 0\n", + " while(True):\n", + " childNumber=curNode.findItem(key) \n", + " if(childNumber != -1):\n", + " return childNumber # found it\n", + " elif( curNode.isLeaf() ):\n", + " return -1 # cant find it\n", + " else: # search deeper\n", + " curNode = getNextChild(curNode, key)\n", + "\n", + " def insert(self,dValue):\n", + " curNode = self.root\n", + " tempItem = DataItem(dValue)\n", + " while(True):\n", + " if( curNode.isFull() ):\n", + " split(curNode)\n", + " curNode = curNode.getParent()\n", + " curNode = getNextChild(curNode, dValue)\n", + " elif( curNode.isLeaf() ): # if node is leaf,\n", + " break\n", + " else:\n", + " curNode = getNextChild(curNode, dValue)\n", + " curNode.insertItem(tempItem)\n", + "\n", + " def split(self,thisNode): # split the node\n", + " # assumes node is full\n", + " itemC = thisNode.removeItem() # remove items from\n", + " itemB = thisNode.removeItem() # this node\n", + " child2 = thisNode.disconnectChild(2) # remove children\n", + " child3 = thisNode.disconnectChild(3) # from this nodeJava Code for a 2-3-4 Tree\n", + " newRight = Node() # make new node\n", + " if(thisNode==self.root):\n", + " self.root = Node()\n", + " parent = self.root\n", + " self.root.connectChild(0, thisNode)\n", + " else:\n", + " parent = thisNode.getParent()\n", + " itemIndex = parent.insertItem(itemB) # item B to parent\n", + " n = parent.getNumItems()\n", + " j = n-1\n", + " while j > itemIndex:\n", + " temp = parent.disconnectChild(j) # one child\n", + " parent.connectChild(j+1, temp)\n", + " j -= 1\n", + "\n", + " parent.connectChild(itemIndex+1, newRight) # deal with newRight\n", + " newRight.insertItem(itemC) # item C to newRight\n", + " newRight.connectChild(0, child2) # connect to 0 and 1\n", + " newRight.connectChild(1, child3) # on newRight\n", + "\n", + " def getNextChild(self,theNode,theValue):\n", + " # assumes node is not empty, not full, not a leaf\n", + " numItems = theNode.getNumItems() \n", + " for j in range(numItems): # for each item in node\n", + " if( theValue < theNode.getItem(j).dData ):\n", + " return theNode.getChild(j) # return left child\n", + " return theNode.getChild(j)\n", + "\n", + " def displayTree(self):\n", + " self.recDisplayTree(self.root, 0, 0)\n", + "\n", + " def recDisplayTree(self,thisNode,level, childNumber):\n", + " print 'level=' ,level ,' child=',childNumber , ' '\n", + " thisNode.displayNode()\n", + " numItems = thisNode.getNumItems()\n", + " for j in range(numItems+1):\n", + " nextNode = thisNode.getChild(j)\n", + " if(nextNode != None):\n", + " self.recDisplayTree(nextNode, level+1, j)\n", + " else:\n", + " return\n", + "theTree = Tree234()\n", + "theTree.insert(50)\n", + "theTree.insert(40)\n", + "theTree.insert(60)\n", + "theTree.insert(30)\n", + "theTree.insert(70)\n", + "while(True):\n", + " print 'Enter first letter of show, '\n", + " print 'insert, find, or display: ',\n", + " choice = raw_input()\n", + " if choice == 's':\n", + " theTree.displayTree()\n", + " elif choice == 'i':\n", + " print 'Enter value to insert: '\n", + " value = int(raw_input())\n", + " theTree.insert(value)\n", + " elif choice == 'f':\n", + " print 'Enter value to find: ',\n", + " value = int(raw_input())\n", + " found = theTree.find(value)\n", + " if(found != -1):\n", + " print 'Found: ', value\n", + " else:\n", + " print 'Could not find', value \n", + " else:\n", + " print 'Invalid entry'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch11-checkpoint.ipynb b/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch11-checkpoint.ipynb new file mode 100644 index 00000000..e6987927 --- /dev/null +++ b/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch11-checkpoint.ipynb @@ -0,0 +1,446 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:6a4fa21c4bdc9b7166cbf391b454b46b5641e5954b8f263a203e23c243e36647" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 11 : Hash Tables" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.1 Page No : 535" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class DataItem:\n", + " def __init__(self,ii):\n", + " self.iData = ii\n", + "\n", + " def getKey(self):\n", + " return self.iData\n", + "\n", + "class HashTable:\n", + " def __init__(self,size):\n", + " self.hashArray = [] # array is the hash table\n", + " for i in range(size):\n", + " self.hashArray.append(DataItem(0))\n", + " self.arraySize = size\n", + " self.nonItem = None # for deleted items\n", + "\n", + " def displayTable(self):\n", + " print 'Table: ',\n", + " for j in range(self.arraySize):\n", + " if(self.hashArray[j] != None):\n", + " print self.hashArray[j].getKey() ,\n", + " else:\n", + " print '** ' ,\n", + " print ''\n", + "\n", + "\n", + " def hashFunc(self,key):\n", + " return key % self.arraySize\n", + "\n", + " # insert a DataItem\n", + " def insert(self,item):\n", + " key = item.getKey() # extract key\n", + " hashVal = self.hashFunc(key) # hash the key\n", + " while(self.hashArray[hashVal] != None and self.hashArray[hashVal].getKey() != -1):\n", + " hashVal += 1\n", + " hashVal %= self.arraySize # wraparound if necessary\n", + " self.hashArray[hashVal] = item # insert item\n", + "\n", + " def delete(self,key): # delete a DataItem\n", + " hashVal = hashFunc(key) # hash the key\n", + " while(self.hashArray[hashVal] != None): # until empty cell,\n", + " # is correct hashVal?\n", + " if(self.hashArray[hashVal].getKey() == key):\n", + " temp = self.hashArray[hashVal] # save item\n", + " self.hashArray[hashVal] = nonItem # delete item\n", + " return temp # return item\n", + " hashVal += 1\n", + " hashVal %= self.arraySize # for wraparound\n", + " return None # cant find item\n", + "\n", + " def find(self,key): # find item with key\n", + " # (assumes table not full)\n", + " hashVal = hashFunc(key) # hash the key\n", + " while(self.hashArray[hashVal] != None): # until empty cell,\n", + " # is correct hashVal?\n", + " if(self.hashArray[hashVal].getKey() == key):\n", + " return self.hashArray[hashVal] # yes, return item\n", + " hashVal += 1 # add the step\n", + " hashVal %= self.arraySize\n", + " # for wraparound\n", + " return None # cant find item\n", + "\n", + "print 'Enter size of hash table: ',\n", + "size = int(raw_input())\n", + "print 'Enter initial number of items: ',\n", + "n = int(raw_input()) # make table\n", + "theHashTable = HashTable(size)\n", + "keysPerCell = 10\n", + "import random\n", + "for j in range(n): # insert data\n", + " aKey = int(random.random() * keysPerCell * size)\n", + " aDataItem = DataItem(aKey) \n", + " theHashTable.insert(aDataItem)\n", + "\n", + "while(True):\n", + " print 'Enter first letter of show, '\n", + " print 'insert, find, delete, or traverse: ',\n", + " choice = raw_input()\n", + " if choice == 's':\n", + " theHashTable.displayTable()\n", + " elif choice == 'i':\n", + " print 'Enter value to key to insert: '\n", + " value = int(raw_input())\n", + " aDataItem = DataItem(aKey)\n", + " theHashTable.insert(aDataItem)\n", + " elif choice == 'f':\n", + " print 'Enter key value to find: ',\n", + " value = int(raw_input())\n", + " aDataItem = theHashTable.find(aKey)\n", + " if(aDataItem != None):\n", + " print 'Found ' , aKey\n", + " else:\n", + " print 'Could not find ' , aKey\n", + "\n", + " elif choice=='d':\n", + " print 'Enter key value to delete: ',\n", + " value = int(raw_input())\n", + " theHashTable.delete(value)\n", + " else:\n", + " print 'Invalid entry'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter size of hash table: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "12\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter initial number of items: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8\n" + ] + } + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.2 Page no: 546" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class DataItem:\n", + " def __init__(self,ii):\n", + " self.iData = ii\n", + "\n", + " def getKey(self):\n", + " return self.iData\n", + "\n", + "class HashTable:\n", + " def __init__(self,size):\n", + " self.hashArray = [] # array is the hash table\n", + " for i in range(size):\n", + " self.hashArray.append(DataItem(0))\n", + " self.arraySize = size\n", + " self.nonItem = None # for deleted items\n", + "\n", + " def displayTable(self):\n", + " print 'Table: ',\n", + " for j in range(self.arraySize):\n", + " if(self.hashArray[j] != None):\n", + " print self.hashArray[j].getKey() ,\n", + " else:\n", + " print '** ' ,\n", + " print ''\n", + "\n", + " def hashFunc1(self,key):\n", + " return key % self.arraySize\n", + "\n", + " def hashFunc2(self,key):\n", + " # non-zero, less than array size, different from hF1\n", + " # array size must be relatively prime to 5, 4, 3, and 2\n", + " return 5 - key % 5\n", + " \n", + " # insert a DataItem\n", + " def insert(self,key,item):\n", + " # (assumes table not full)\n", + " hashVal = self.hashFunc1(key) # hash the key\n", + " stepSize = self.hashFunc2(key) # get step size\n", + " # until empty cell or -1\n", + " while(self.hashArray[hashVal] != None and self.hashArray[hashVal].getKey() != -1):\n", + " hashVal += stepSize # add the step\n", + " hashVal %= self.arraySize # for wraparound\n", + " self.hashArray[hashVal] = item # insert item\n", + "\n", + " def delete(self,key): # delete a DataItem\n", + " hashVal = hashFunc1(key) # hash the key\n", + " stepSize = hashFunc2(key) # get step size\n", + " while(self.hashArray[hashVal] != None): # until empty cell,\n", + " # is correct hashVal?\n", + " if(self.hashArray[hashVal].getKey() == key):\n", + " temp = self.hashArray[hashVal] # save item\n", + " self.hashArray[hashVal] = nonItem # delete item\n", + " return temp # return item\n", + " hashVal += stepSize # add the step\n", + " hashVal %= self.arraySize # for wraparound\n", + " return None # cant find item\n", + "\n", + " def find(self,key): # find item with key\n", + " # (assumes table not full)\n", + " hashVal = hashFunc1(key) # hash the key\n", + " stepSize = hashFunc2(key) # get step size\n", + " while(self.hashArray[hashVal] != None): # until empty cell,\n", + " # is correct hashVal?\n", + " if(self.hashArray[hashVal].getKey() == key):\n", + " return self.hashArray[hashVal] # yes, return item\n", + " hashVal += stepSize # add the step\n", + " hashVal %= self.arraySize\n", + " # for wraparound\n", + " return None # cant find item\n", + "\n", + "print 'Enter size of hash table: ',\n", + "size = int(raw_input())\n", + "print 'Enter initial number of items: ',\n", + "n = int(raw_input()) # make table\n", + "theHashTable = HashTable(size)\n", + "import random\n", + "for j in range(n): # insert data\n", + " aKey = int(random.random() * 2 * size)\n", + " aDataItem = DataItem(aKey) \n", + " theHashTable.insert(aKey, aDataItem)\n", + "\n", + "while(True):\n", + " print 'Enter first letter of show, '\n", + " print 'insert, find, delete, or traverse: ',\n", + " choice = raw_input()\n", + " if choice == 's':\n", + " theHashTable.displayTable()\n", + " elif choice == 'i':\n", + " print 'Enter value to key to insert: '\n", + " value = int(raw_input())\n", + " aDataItem = DataItem(aKey)\n", + " theHashTable.insert(aKey, aDataItem)\n", + " elif choice == 'f':\n", + " print 'Enter key value to find: ',\n", + " value = int(raw_input())\n", + " aDataItem = theHashTable.find(aKey)\n", + " if(aDataItem != None):\n", + " print 'Found ' , aKey\n", + " else:\n", + " print 'Could not find ' , aKey\n", + "\n", + " elif choice=='d':\n", + " print 'Enter key value to delete: ',\n", + " value = int(raw_input())\n", + " theHashTable.delete(value)\n", + " else:\n", + " print 'Invalid entry'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11.3 Page no : 555" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class Link:\n", + " def __init__(self,ii):\n", + " self.iData = ii\n", + "\n", + " def getKey(self):\n", + " return self.iData\n", + "\n", + " def displayLink(self):\n", + " print self.iData ,\n", + "\n", + "class SortedList:\n", + " def __init__(self):\n", + " self.first = None\n", + "\n", + " def insert(self,theLink): # insert link, in order\n", + " key = theLink.getKey()\n", + " self.previous = None # start at self.first\n", + " current = self.first # until end of list,\n", + " while( current != None and key > current.getKey() ): # or current > key,\n", + " self.previous = current \n", + " current = current.next # go to next item\n", + " if(self.previous==None): # if beginning of list,\n", + " self.first = theLink\n", + " else: # not at beginning,\n", + " self.previous.next = theLink\n", + " theLink.next = current # new link --> current\n", + "\n", + " def delete(self,key): # delete link\n", + " # (assumes non-empty list)\n", + " self.previous = None # start at self.first\n", + " current = self.first # until end of list,\n", + " while( current != None and key != current.getKey() ): # or key == current,\n", + " self.previous = current\n", + " current = current.next # go to next link\n", + " if(self.previous==None):\n", + " self.first = self.first.next\n", + " else:\n", + " self.previous.next = current.next \n", + "\n", + " def find(self,key): # find link\n", + " current = self.first # start at self.first\n", + " # until end of list,\n", + " while(current != None and current.getKey() <= key): # or key too small,\n", + " if(current.getKey() == key):# is this the link?\n", + " return current # found it, return link\n", + " current = current.next # go to next item\n", + " return None # didnt find it\n", + "\n", + " def displayList(self):\n", + " print 'List (self.first-->last): ',\n", + " current = self.first # start at beginning of list\n", + " while(current != None): # until end of list,\n", + " current.displayLink() # print data\n", + " current = current.next # move to next link\n", + " print ''\n", + "\n", + "class HashTable:\n", + " def __init__(self,size):\n", + " self.hashArray = [] # array is the hash table\n", + " for i in range(size):\n", + " self.hashArray.append(SortedList())\n", + " self.arraySize = size\n", + " self.nonItem = None # for deleted items\n", + "\n", + " def displayTable(self):\n", + " print 'Table: ',\n", + " for j in range(self.arraySize):\n", + " print j, \n", + " self.hashArray[j].displayList()\n", + "\n", + " def hashFunc(self,key):\n", + " return key % self.arraySize\n", + "\n", + " def insert(self,theLink):\n", + " key = theLink.getKey()\n", + " hashVal = self.hashFunc(key)\n", + " self.hashArray[hashVal].insert(theLink)\n", + "\n", + " def delete(self,key): # delete a DataItem\n", + " hashVal = self.hashFunc(key) # hash the key\n", + " self.hashArray[hashVal].delete(key) # delete link\n", + "\n", + " def find(self,key): # find link\n", + " hashVal = self.hashFunc(key)# hash the key\n", + " theLink = self.hashArray[hashVal].find(key) # get link\n", + " return theLink # return link\n", + "\n", + "keysPerCell = 100 \n", + "print 'Enter size of hash table: ',\n", + "size = int(raw_input())\n", + "print 'Enter initial number of items: ',\n", + "n = int(raw_input()) # make table\n", + "theHashTable = HashTable(size)\n", + "import random\n", + "for j in range(n): # insert data\n", + " aKey = int(random.random() * 2 * size)\n", + " aDataItem = Link(aKey) \n", + " theHashTable.insert(aDataItem)\n", + "\n", + "while(True):\n", + " print 'Enter self.first letter of show, '\n", + " print 'insert, find, delete, or show: ',\n", + " choice = raw_input()\n", + " if choice == 's':\n", + " theHashTable.displayTable()\n", + " elif choice == 'i':\n", + " print 'Enter value to key to insert: '\n", + " value = int(raw_input())\n", + " aDataItem = Link(aKey)\n", + " theHashTable.insert(aDataItem)\n", + " elif choice == 'f':\n", + " print 'Enter key value to find: ',\n", + " value = int(raw_input())\n", + " aDataItem = theHashTable.find(aKey)\n", + " if(aDataItem != None):\n", + " print 'Found ' , aKey\n", + " else:\n", + " print 'Could not find ' , aKey\n", + "\n", + " elif choice=='d':\n", + " print 'Enter key value to delete: ',\n", + " value = int(raw_input())\n", + " theHashTable.delete(value)\n", + " else:\n", + " print 'Invalid entry'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch12-checkpoint.ipynb b/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch12-checkpoint.ipynb new file mode 100644 index 00000000..1be785c9 --- /dev/null +++ b/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch12-checkpoint.ipynb @@ -0,0 +1,520 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:f213ff4fe3150e369b8ba77a058a36b9c6a812a3ac3196b559e262346daafa7b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 12 : Heaps " + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.1 Page no : 592" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class Node: \n", + " def __init__(self,key):\n", + " # constructorJava Code for Heaps\n", + " self.iData = key\n", + " \n", + " def getKey(self):\n", + " return self.iData\n", + "\n", + " def setKey(self,i):\n", + " self.iData = i\n", + "\n", + "class Heap:\n", + " def __init__(self,mx):\n", + " self.maxSize = mx\n", + " self.currentSize = 0\n", + " self.heapArray = []\n", + " for i in range(self.maxSize):\n", + " self.heapArray.append(Node(0))\n", + "\n", + " def isEmpty(self):\n", + " return self.currentSize==0\n", + "\n", + " def insert(self,key):\n", + " if(self.currentSize==self.maxSize):\n", + " return False\n", + " newNode = Node(key)\n", + " self.heapArray[self.currentSize] = newNode\n", + " self.trickleUp(self.currentSize)\n", + " self.currentSize += 1\n", + " return True\n", + "\n", + " def trickleUp(self,index):\n", + " parent = (index-1) / 2\n", + " bottom = self.heapArray[index]\n", + " while( index > 0 and self.heapArray[parent].getKey() < bottom.getKey() ):\n", + " self.heapArray[index] = self.heapArray[parent] # move it down\n", + " index = parent\n", + " parent = (parent-1) / 2\n", + " self.heapArray[index] = bottom\n", + "\n", + " def remove(self): # delete item with max key\n", + " # (assumes non-empty list)\n", + " root = self.heapArray[0]\n", + " self.currentSize -= 1\n", + " self.heapArray[0] = self.heapArray[self.currentSize]\n", + " self.trickleDown(0)\n", + " return root\n", + "\n", + " def trickleDown(self,index):\n", + " top = self.heapArray[index] # save root\n", + " while(index < self.currentSize/2): # while node has at\n", + " leftChild = 2*index+1\n", + " rightChild = leftChild+1 # find larger child\n", + " if(rightChild < self.currentSize and self.heapArray[leftChild].getKey() < self.heapArray[rightChild].getKey()):\n", + " largerChild = rightChild\n", + " else:\n", + " largerChild = leftChild\n", + " if( top.getKey() >= self.heapArray[largerChild].getKey() ):\n", + " break\n", + " # shift child up\n", + " self.heapArray[index] = self.heapArray[largerChild]\n", + " index = largerChild # go down\n", + "\n", + " self.heapArray[index] = top # root to indexJava Code for Heaps\n", + " \n", + " def change(self,index,newValue):\n", + " if(index<0 or index>=self.currentSize):\n", + " return False\n", + " oldValue = self.heapArray[index].getKey() # remember old\n", + " self.heapArray[index].setKey(newValue) # change to new\n", + " if(oldValue < newValue): # if raised,\n", + " trickleUp(index) # trickle it up\n", + " else: # if lowered,\n", + " trickleDown(index) # trickle it down\n", + " return True\n", + "\n", + " def displayHeap(self):\n", + " print 'self.heapArray: ', # array format\n", + " for m in range(self.currentSize):\n", + " if(self.heapArray[m] != None):\n", + " print self.heapArray[m].getKey(),\n", + " else:\n", + " print '-- ' ,\n", + " print ''\n", + " nBlanks = 32\n", + " itemsPerRow = 1\n", + " column = 0\n", + " j = 0\n", + " # current item\n", + " dots = '...............................'\n", + " print dots+dots\n", + " # dotted top line\n", + " while(self.currentSize > 0):\n", + " if(column == 0):\n", + " for k in range(nBlanks):\n", + " print ' ' ,\n", + " print self.heapArray[j].getKey() ,\n", + " j += 1 \n", + " if(j == self.currentSize):\n", + " break # done?\n", + " column += 1\n", + " if(column==itemsPerRow): # end of row?\n", + " nBlanks /= 2 # half the blanks\n", + " itemsPerRow *= 2 # twice the items\n", + " column = 0 # start over on\n", + " print ''\n", + " else: # next item on row\n", + " for k in range(nBlanks*2-2):\n", + " print ' ', # interim blanks\n", + " print '\\n' +dots+dots \n", + "\n", + "theHeap = Heap(31) # make a Heap max size 31\n", + "theHeap.insert(70)\n", + "theHeap.insert(40)\n", + "theHeap.insert(50)\n", + "theHeap.insert(20)\n", + "theHeap.insert(60)\n", + "theHeap.insert(100)\n", + "theHeap.insert(80)\n", + "theHeap.insert(30)\n", + "theHeap.insert(10)\n", + "theHeap.insert(90)\n", + "while(True):\n", + " print 'Enter first letter of show, insert, remove, change: ',\n", + " choice = raw_input()\n", + " if choice == 's':\n", + " theHeap.displayHeap()\n", + " elif choice == 'i':\n", + " print 'Enter value to key to insert: '\n", + " value = int(raw_input())\n", + " success = theHeap.insert(value)\n", + " if not success:\n", + " print \"Can't insert heap full\"\n", + " elif choice == 'f':\n", + " print 'Enter key value to find: ',\n", + " value = int(raw_input())\n", + " aDataItem = theHashTable.find(aKey)\n", + " if(aDataItem != None):\n", + " print 'Found ' , aKey\n", + " else:\n", + " print 'Could not find ' , aKey\n", + " elif choice=='r':\n", + " if not theHeap.isEmpty():\n", + " theHeap.remove()\n", + " else:\n", + " print \"Can't remove heap empty\"\n", + " elif choice=='c':\n", + " print 'Enter current index of item: ',\n", + " value = int(raw_input())\n", + " print \"Enter new key: \",\n", + " value2 = int(raw_input())\n", + " success = theHeap.change(value, value2)\n", + " if( not success ):\n", + " print 'Invalid index'\n", + " else:\n", + " print \"Invalid entry\"\n", + " break " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter first letter of show, insert, remove, change: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "s\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " self.heapArray: 100 90 80 30 60 50 70 20 10 40 \n", + "..............................................................\n", + " 100 \n", + " 90 80 \n", + " 30 60 50 70 \n", + " 20 10 40 \n", + "..............................................................\n", + "Enter first letter of show, insert, remove, change: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "i\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter value to key to insert: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "53\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter first letter of show, insert, remove, change: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "s\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " self.heapArray: 100 90 80 30 60 50 70 20 10 40 53 \n", + "..............................................................\n", + " 100 \n", + " 90 80 \n", + " 30 60 50 70 \n", + " 20 10 40 53 \n", + "..............................................................\n", + "Enter first letter of show, insert, remove, change: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "r\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter first letter of show, insert, remove, change: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "s\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " self.heapArray: 90 60 80 30 53 50 70 20 10 40 \n", + "..............................................................\n", + " 90 \n", + " 60 80 \n", + " 30 53 50 70 \n", + " 20 10 40 \n", + "..............................................................\n", + "Enter first letter of show, insert, remove, change: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Invalid entry\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.2 Page no : 605" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class Node: \n", + " def __init__(self,key):\n", + " # constructorJava Code for Heaps\n", + " self.iData = key\n", + " \n", + " def getKey(self):\n", + " return self.iData\n", + "\n", + " def setKey(self,i):\n", + " self.iData = i\n", + "\n", + "class Heap:\n", + " def __init__(self,mx):\n", + " self.maxSize = mx\n", + " self.currentSize = 0\n", + " self.heapArray = []\n", + " for i in range(self.maxSize):\n", + " self.heapArray.append(Node(0))\n", + "\n", + " def isEmpty(self):\n", + " return self.currentSize==0\n", + "\n", + " def insert(self,key):\n", + " if(self.currentSize==self.maxSize):\n", + " return False\n", + " newNode = Node(key)\n", + " self.heapArray[self.currentSize] = newNode\n", + " self.trickleUp(self.currentSize)\n", + " self.currentSize += 1\n", + " return True\n", + "\n", + " def remove(self): # delete item with max key\n", + " # (assumes non-empty list)\n", + " root = self.heapArray[0]\n", + " self.currentSize -= 1\n", + " self.heapArray[0] = self.heapArray[self.currentSize]\n", + " self.trickleDown(0)\n", + " return root\n", + "\n", + " def trickleDown(self,index):\n", + " top = self.heapArray[index] # save root\n", + " while(index < self.currentSize/2): # while node has at\n", + " leftChild = 2*index+1\n", + " rightChild = leftChild+1 # find larger child\n", + " if(rightChild < self.currentSize and self.heapArray[leftChild].getKey() < self.heapArray[rightChild].getKey()):\n", + " largerChild = rightChild\n", + " else:\n", + " largerChild = leftChild\n", + " if( top.getKey() >= self.heapArray[largerChild].getKey() ):\n", + " break\n", + " # shift child up\n", + " self.heapArray[index] = self.heapArray[largerChild]\n", + " index = largerChild # go down\n", + " self.heapArray[index] = top # root to indexJava Code for Heaps\n", + "\n", + " def displayHeap(self):\n", + " print 'self.heapArray: ', # array format\n", + " for m in range(self.currentSize):\n", + " if(self.heapArray[m] != None):\n", + " print self.heapArray[m].getKey(),\n", + " else:\n", + " print '-- ' ,\n", + " print ''\n", + " nBlanks = 32\n", + " itemsPerRow = 1\n", + " column = 0\n", + " j = 0\n", + " # current item\n", + " dots = '...............................'\n", + " print dots+dots\n", + " # dotted top line\n", + " while(self.currentSize > 0):\n", + " if(column == 0):\n", + " for k in range(nBlanks):\n", + " print ' ' ,\n", + " print self.heapArray[j].getKey() ,\n", + " j += 1 \n", + " if(j == self.currentSize):\n", + " break # done?\n", + " column += 1\n", + " if(column==itemsPerRow): # end of row?\n", + " nBlanks /= 2 # half the blanks\n", + " itemsPerRow *= 2 # twice the items\n", + " column = 0 # start over on\n", + " print ''\n", + " else: # next item on row\n", + " for k in range(nBlanks*2-2):\n", + " print ' ', # interim blanks\n", + " print '\\n' +dots+dots \n", + " \n", + " def displayArray(self):\n", + " for j in range(self.maxSize):\n", + " print self.heapArray[j].getKey() ,\n", + " print ''\n", + "\n", + " def insertAt(self,index,newNode):\n", + " self.heapArray[index] = newNode\n", + "\n", + " def incrementSize(self):\n", + " self.currentSize += 1\n", + "\n", + "\n", + "print 'Enter number of items: ',\n", + "size = int(raw_input())\n", + "theHeap = Heap(size)\n", + "import random\n", + "for j in range(size): # fill array with\n", + " r = int(random.random()*100)\n", + " newNode = Node(r)\n", + " theHeap.insertAt(j, newNode)\n", + " theHeap.incrementSize()\n", + "print 'Random: ',\n", + "theHeap.displayArray() # display random array\n", + "j = size/2 - 1\n", + "while j >= 0:\n", + " theHeap.trickleDown(j)\n", + " j -= 1\n", + "print 'Heap: ',\n", + "theHeap.displayArray()\n", + "theHeap.displayHeap()\n", + "j = size - 1\n", + "while j >= 0:\n", + " biggestNode = theHeap.remove()\n", + " theHeap.insertAt(j, biggestNode)\n", + " j -= 1\n", + " \n", + "print 'Sorted: ',\n", + "theHeap.displayArray()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter number of items: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Random: 21 55 43 65 70 16 47 22 51 73 \n", + "Heap: 73 70 47 65 55 16 43 22 51 21 \n", + "self.heapArray: 73 70 47 65 55 16 43 22 51 21 \n", + "..............................................................\n", + " 73 \n", + " 70 47 \n", + " 65 55 16 43 \n", + " 22 51 21 \n", + "..............................................................\n", + "Sorted: 16 21 22 43 47 51 55 65 70 73 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch13-checkpoint.ipynb b/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch13-checkpoint.ipynb new file mode 100644 index 00000000..ab8fea53 --- /dev/null +++ b/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch13-checkpoint.ipynb @@ -0,0 +1,512 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:e4ee94b1921cc19d6665af422d1e40ebb2336538caa9a0070a2828a133297159" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 13 : Graphs" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.1 Page no: 631" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class StackX:\n", + " def __init__(self):\n", + " self.st = [] # make array\n", + " self.top = -1\n", + "\n", + " def push(self,j): # put item on stack\n", + " self.top += 1\n", + " self.st.append(j)\n", + "\n", + " def pop(self): # take item off stack\n", + " self.top -= 1\n", + " return self.st.pop()\n", + "\n", + " def peek(self): # peek at top of stack\n", + " return self.st[self.top]\n", + " \n", + " def isEmpty(self): # true if nothing on stack-\n", + " return self.top == -1\n", + "\n", + "class Vertex:\n", + " def __init__(self,lab): # constructor\n", + " self.label = lab\n", + " self.wasVisited = False\n", + "\n", + "class Graph:\n", + " def __init__(self):\n", + " self.vertexList = [] # adjacency matrix\n", + " self.adjMat = []\n", + " self.nVerts = 0\n", + " for j in range(20): # set adjacency\n", + " l = []\n", + " for k in range(20):\n", + " l.append(0)\n", + " self.adjMat.append(l)\n", + " self.theStack = StackX()\n", + "\n", + " def addVertex(self,lab):\n", + " self.vertexList.append( Vertex(lab))\n", + " self.nVerts += 1\n", + "\n", + " def addEdge(self,start, end):\n", + " self.adjMat[start][end] = 1\n", + " self.adjMat[end][start] = 1\n", + "\n", + " def displayVertex(self,v):\n", + " print self.vertexList[v].label ,\n", + "\n", + " def dfs(self): # depth-first search # begin at vertex 0\n", + " self.vertexList[0].wasVisited = True # mark it\n", + " self.displayVertex(0) # display it\n", + " self.theStack.push(0) # push it\n", + " while( not self.theStack.isEmpty() ): # until stack empty,\n", + " # get an unvisited vertex adjacent to stack top\n", + " v = self.getAdjUnvisitedVertex( self.theStack.peek() )\n", + " if(v == -1): # if no such vertex,\n", + " self.theStack.pop()\n", + " else: # if it exists,\n", + " self.vertexList[v].wasVisited = True # mark it\n", + " self.displayVertex(v) # display it\n", + " self.theStack.push(v) # push it\n", + "\n", + " # stack is empty, so we're done\n", + " for j in range(self.nVerts): # reset flags\n", + " self.vertexList[j].wasVisited = False # end dfs\n", + "\n", + " def getAdjUnvisitedVertex(self,v):\n", + " for j in range(self.nVerts):\n", + " if(self.adjMat[v][j]==1 and self.vertexList[j].wasVisited==False):\n", + " return j\n", + " return -1\n", + "\n", + "theGraph = Graph()\n", + "theGraph.addVertex('A') # 0 (start for dfs)\n", + "theGraph.addVertex('B') # 1\n", + "theGraph.addVertex('C') # 2\n", + "theGraph.addVertex('D') # 3\n", + "theGraph.addVertex('E') # 4\n", + "theGraph.addEdge(0,1)\n", + "theGraph.addEdge(1,2)\n", + "theGraph.addEdge(0,3)\n", + "theGraph.addEdge(3,4)\n", + "print 'Visits: ',\n", + "theGraph.dfs() # depth-first search" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Visits: A B C D E\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.2 Page no : 639" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class Queue:\n", + " def __init__(self): # constructor\n", + " self.SIZE = 20\n", + " self.queArray = []\n", + " for i in range(20):\n", + " self.queArray.append(0)\n", + " self.front = 0\n", + " self.rear = -1\n", + "\n", + " def insert(self,j): # put item at self.rear of queue\n", + " if(self.rear == self.SIZE-1):\n", + " self.rear = -1\n", + " self.rear += 1\n", + " self.queArray[self.rear] = j\n", + "\n", + " def remove(self): # take item from front of queue\n", + " temp = self.queArray[self.front]\n", + " self.front += 1\n", + " if(self.front == self.SIZE):\n", + " self.front = 0\n", + " return temp\n", + "\n", + " def isEmpty(self): # true if queue is empty\n", + " return ( self.rear+1==self.front or (self.front+self.SIZE-1==self.rear) )\n", + "\n", + "class Vertex:\n", + " def __init__(self,lab): # constructor\n", + " self.label = lab\n", + " self.wasVisited = False\n", + "\n", + "class Graph:\n", + " def __init__(self):\n", + " self.vertexList = [] # adjacency matrix\n", + " self.adjMat = []\n", + " self.nVerts = 0\n", + " for j in range(20): # set adjacency\n", + " l = []\n", + " for k in range(20):\n", + " l.append(0)\n", + " self.adjMat.append(l)\n", + " self.theQueue = Queue()\n", + "\n", + " def addVertex(self,lab):\n", + " self.vertexList.append( Vertex(lab))\n", + " self.nVerts += 1\n", + "\n", + " def addEdge(self,start, end):\n", + " self.adjMat[start][end] = 1\n", + " self.adjMat[end][start] = 1\n", + "\n", + " def displayVertex(self,v):\n", + " print self.vertexList[v].label ,\n", + "\n", + " def bfs(self): # breadth-first search\n", + " # begin at vertex 0\n", + " self.vertexList[0].wasVisited = True # mark it\n", + " self.displayVertex(0) # display it\n", + " self.theQueue.insert(0) # insert at tail\n", + " while( not self.theQueue.isEmpty() ): # until queue empty,\n", + " v1 = self.theQueue.remove() # remove vertex at head\n", + " # until it has no unvisited neighbors\n", + " while( self.getAdjUnvisitedVertex(v1) != -1 ):\n", + " v2 = self.getAdjUnvisitedVertex(v1)\n", + " self.vertexList[v2].wasVisited = True # mark it\n", + " self.displayVertex(v2) # display it\n", + " self.theQueue.insert(v2) # insert it\n", + " for j in range(self.nVerts): # reset flags\n", + " self.vertexList[j].wasVisited = False\n", + "\n", + " def getAdjUnvisitedVertex(self,v):\n", + " for j in range(self.nVerts):\n", + " if(self.adjMat[v][j]==1 and self.vertexList[j].wasVisited==False):\n", + " return j\n", + " return -1\n", + "\n", + "\n", + "theGraph = Graph()\n", + "theGraph.addVertex('A') # 0 (start for dfs)\n", + "theGraph.addVertex('B') # 1\n", + "theGraph.addVertex('C') # 2\n", + "theGraph.addVertex('D') # 3\n", + "theGraph.addVertex('E') # 4\n", + "theGraph.addEdge(0,1)\n", + "theGraph.addEdge(1,2)\n", + "theGraph.addEdge(0,3)\n", + "theGraph.addEdge(3,4)\n", + "print 'Visits: ',\n", + "theGraph.bfs() # breadth-first search" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Visits: A B D C E\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.3 Page no : 645" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class StackX:\n", + " def __init__(self):\n", + " self.st = [] # make array\n", + " self.top = -1\n", + "\n", + " def push(self,j): # put item on stack\n", + " self.top += 1\n", + " self.st.append(j)\n", + "\n", + " def pop(self): # take item off stack\n", + " self.top -= 1\n", + " return self.st.pop()\n", + "\n", + " def peek(self): # peek at top of stack\n", + " return self.st[self.top]\n", + " \n", + " def isEmpty(self): # true if nothing on stack-\n", + " return self.top == -1\n", + "\n", + "class Vertex:\n", + " def __init__(self,lab): # constructor\n", + " self.label = lab\n", + " self.wasVisited = False\n", + "\n", + "class Graph:\n", + " def __init__(self):\n", + " self.vertexList = [] # adjacency matrix\n", + " self.adjMat = []\n", + " self.nVerts = 0\n", + " for j in range(20): # set adjacency\n", + " l = []\n", + " for k in range(20):\n", + " l.append(0)\n", + " self.adjMat.append(l)\n", + " self.theStack = StackX()\n", + "\n", + " def addVertex(self,lab):\n", + " self.vertexList.append( Vertex(lab))\n", + " self.nVerts += 1\n", + "\n", + " def addEdge(self,start, end):\n", + " self.adjMat[start][end] = 1\n", + " self.adjMat[end][start] = 1\n", + "\n", + " def displayVertex(self,v):\n", + " print self.vertexList[v].label ,\n", + "\n", + " def mst(self): # minimum spanning tree (depth first)\n", + " # start at 0\n", + " self.vertexList[0].wasVisited =True\n", + " # mark it\n", + " self.theStack.push(0)\n", + " # push it\n", + " while(not self.theStack.isEmpty() ):\n", + " # until stack empty\n", + " # get stack top\n", + " currentVertex = self.theStack.peek()\n", + " # get next unvisited neighbor \n", + " v = self.getAdjUnvisitedVertex(currentVertex)\n", + " if(v == -1):\n", + " # if no more neighbors\n", + " self.theStack.pop()\n", + " else:\n", + " # got a neighbor\n", + " self.vertexList[v].wasVisited = True # mark it\n", + " self.theStack.push(v)\n", + " # push it\n", + " # display edge\n", + " self.displayVertex(currentVertex)\n", + " # from currentV\n", + " self.displayVertex(v)\n", + " # to v\n", + " print ' ',\n", + " for j in range(self.nVerts):\n", + " # reset flags\n", + " self.vertexList[j].wasVisited = False\n", + "\n", + " def getAdjUnvisitedVertex(self, v):\n", + " for j in range(self.nVerts):\n", + " if(self.adjMat[v][j]==1 and self.vertexList[j].wasVisited==False):\n", + " return j\n", + " return -1\n", + "\n", + "theGraph = Graph()\n", + "theGraph.addVertex('A') # 0 (start for mst)\n", + "theGraph.addVertex('B') # 1\n", + "theGraph.addVertex('C') # 2\n", + "theGraph.addVertex('D') # 3Topological Sorting with Directed Graphs\n", + "theGraph.addVertex('E') # 4\n", + "theGraph.addEdge(0,1) \n", + "theGraph.addEdge(0,2)\n", + "theGraph.addEdge(0,3) \n", + "theGraph.addEdge(0,4) \n", + "theGraph.addEdge(1,2) \n", + "theGraph.addEdge(1,3)\n", + "theGraph.addEdge(1,4) \n", + "theGraph.addEdge(2,3) \n", + "theGraph.addEdge(2,4) \n", + "theGraph.addEdge(3,4) \n", + "print 'Minimum spanning tree: ',\n", + "theGraph.mst() # minimum spanning tree" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Minimum spanning tree: A B B C C D D E \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.4 page No : 657" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class Vertex:\n", + " def __init__(self,lab): # constructor\n", + " self.label = lab\n", + " self.wasVisited = False\n", + "\n", + "class Graph:\n", + " def __init__(self):\n", + " self.vertexList = [] # adjacency matrix\n", + " self.adjMat = []\n", + " self.nVerts = 0\n", + " for j in range(20): # set adjacency\n", + " l = []\n", + " for k in range(20):\n", + " l.append(0)\n", + " self.adjMat.append(l)\n", + "\n", + " def addVertex(self,lab):\n", + " self.vertexList.append( Vertex(lab))\n", + " self.nVerts += 1\n", + "\n", + " def addEdge(self,start, end):\n", + " self.adjMat[start][end] = 1\n", + " self.adjMat[end][start] = 1\n", + "\n", + " def displayVertex(self,v):\n", + " print self.vertexList[v].label ,\n", + "\n", + " def topo(self): # topological sort\n", + " orig_nVerts = self.nVerts # remember how many verts\n", + " while(self.nVerts > 0): # while vertices remain,\n", + " # get a vertex with no successors, or -1\n", + " currentVertex = self.noSuccessors()\n", + " if(currentVertex == -1):\n", + " # must be a cycleTopological Sorting with Directed Graphs\n", + " print 'ERROR: Graph has cycles'\n", + " return\n", + "\n", + " # insert vertex label in sorted array (start at end)\n", + " self.sortedArray[nVerts-1] = self.vertexList[currentVertex].label\n", + " self.deleteVertex(currentVertex)\n", + " print 'Topologically sorted order: '\n", + " for j in range(orig_nVerts):\n", + " print sortedArray[j] ,\n", + " print ''\n", + "\n", + " def noSuccessors(self): # returns vert with no successors\n", + " # (or -1 if no such verts)\n", + " isEdge = None\n", + " for row in range(self.nVerts): # for each vertex,\n", + " isEdge = False\n", + " # check edges\n", + " for col in range(self.nVerts):\n", + " if( self.adjMat[row][col] > 0 ): # if edge to\n", + " # another,\n", + " isEdge = True\n", + " break\n", + " if( not isEdge ):\n", + " # if no edges,\n", + " return row\n", + " return -1\n", + "\n", + " def deleteVertex(self,delVert):\n", + " if(delVert != self.nVerts-1):\n", + " # if not last vertex,\n", + " # delete from vertexList\n", + " for j in range(self.nVerts-1):\n", + " self.vertexList[j] = self.vertexList[j+1]\n", + " # delete row from adjMat\n", + " for row in range(self.nVerts-1):\n", + " self.moveRowUp(row, nVerts)\n", + " # delete col from adjMat\n", + " for col in range(self.nVerts-1):\n", + " self.moveColLeft(col, nVerts-1)\n", + " self.nVerts -= 1\n", + "\n", + " def moveRowUp(self,row,length):\n", + " for col in range(length):\n", + " self.adjMat[row][col] = self.adjMat[row+1][col]\n", + "\n", + " def moveColLeft(self,col, length):\n", + " for row in range(self.length):\n", + " self.adjMat[row][col] = self.adjMat[row][col+1]\n", + "\n", + "theGraph = Graph()\n", + "theGraph.addVertex('A') # 0\n", + "theGraph.addVertex('B') # 1\n", + "theGraph.addVertex('C') # 2\n", + "theGraph.addVertex('D') # 3\n", + "theGraph.addVertex('E') # 4\n", + "theGraph.addVertex('F') # 5\n", + "theGraph.addVertex('G') # 6\n", + "theGraph.addVertex('H') # 7Connectivity in Directed Graphs\n", + "theGraph.addEdge(0,3)\n", + "theGraph.addEdge(0,4)\n", + "theGraph.addEdge(1,4)\n", + "theGraph.addEdge(2,5)\n", + "theGraph.addEdge(3,6)\n", + "theGraph.addEdge(4,6)\n", + "theGraph.addEdge(5,7)\n", + "theGraph.addEdge(6,7)\n", + "theGraph.topo() # do the sort" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "ERROR: Graph has cycles\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch14-checkpoint.ipynb b/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch14-checkpoint.ipynb new file mode 100644 index 00000000..46aa59dc --- /dev/null +++ b/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch14-checkpoint.ipynb @@ -0,0 +1,361 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:2dd04a4aee1b7409691d218147433fe56bcbf7998733e71f7ca224eaa4cea307" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 14 : Weighted Graphs" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.1 Page no: 681" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class Edge:\n", + " def __init__(self,sv,dv,d): # constructor\n", + " self.srcVert = sv\n", + " self.destVert = dv\n", + " self.distance = d\n", + "\n", + "class PriorityQ:\n", + " def __init__(self):\n", + " # constructor\n", + " self.queArray = []\n", + " self.size = 0\n", + " def insert(self,item): # insert item in sorted order\n", + " self.queArray.append(item)\n", + " b = self.size\n", + " for j in range(self.size): # find place to insert\n", + " if( item.distance >= self.queArray[j].distance ):\n", + " b = j\n", + " break\n", + " for k in range(self.size-1,b-1,-1):#=self.size-1 k>=j k--) # move items up\n", + " self.queArray[k+1] = self.queArray[k]\n", + " self.queArray[b] = item\n", + " # insert item\n", + " self.size += 1\n", + "\n", + " def removeMin(self): # remove minimum item\n", + " self.size -= 1\n", + " return self.queArray[self.size] \n", + "\n", + " def removeN(self,n): # remove item at n\n", + " for j in range(n,self.size-1): # move items down\n", + " self.queArray[j] = self.queArray[j+1]\n", + " self.size -= 1\n", + "\n", + " def peekMin(self): # peek at minimum item\n", + " return self.self.queArray[self.size-1] \n", + "\n", + " def size(self): # return number of items\n", + " return self.size\n", + "\n", + " def isEmpty(self): # true if queue is empty\n", + " return (self.size==0) \n", + "\n", + " def peekN(self,n): # peek at item n\n", + " return self.queArray[n]\n", + "\n", + " def find(self,findDex): # find item with specified\n", + " # self.destVert value\n", + " for j in range(self.size-1):\n", + " if(self.queArray[j].destVert == findDex):\n", + " return j\n", + " return -1\n", + "\n", + "class Vertex:\n", + " def __init__(self,lab): # constructor\n", + " self.label = lab\n", + " self.isInTree = False\n", + "\n", + "class Graph:\n", + " def __init__(self):\n", + " self.vertexList = [] # adjacency matrix\n", + " self.adjMat = []\n", + " self.nVerts = 0\n", + " for j in range(20): # set adjacency\n", + " l = []\n", + " for k in range(20):\n", + " l.append(1000000)\n", + " self.adjMat.append(l)\n", + " self.thePQ = PriorityQ()\n", + " self.nTree = 0\n", + " self.currentVert = 0\n", + "\n", + " def addVertex(self,lab):\n", + " self.vertexList.append( Vertex(lab))\n", + " self.nVerts += 1\n", + "\n", + " def addEdge(self,start, end,weight):\n", + " self.adjMat[start][end] = weight\n", + " self.adjMat[end][start] = weight\n", + "\n", + "\n", + " def displayVertex(self,v):\n", + " print self.vertexList[v].label ,\n", + "\n", + " def mstw(self):\n", + " self.currentVert = 0 # minimum spanning tree\n", + " # start at 0\n", + " while(self.nTree < self.nVerts-1): # while not all verts in tree\n", + " # put self.currentVert in tree\n", + " self.vertexList[self.currentVert].isInTree = True\n", + " self.nTree += 1\n", + " # insert edges adjacent to self.currentVert into PQ\n", + " for j in range(self.nVerts): # for each vertex,\n", + " if(j==self.currentVert): # skip if its us\n", + " continue\n", + " if(self.vertexList[j].isInTree): # skip if in the tree\n", + " continue\n", + " self.distance = self.adjMat[self.currentVert][j]\n", + " if( self.distance == 1000000): # skip if no edge\n", + " continue\n", + " self.putInPQ(j, self.distance) # put it in PQ (maybe)\n", + " if(self.thePQ.size==0): # no vertices in PQ?\n", + " print 'GRAPH NOT CONNECTED',\n", + " return\n", + " # remove edge with minimum self.distance, from PQ\n", + " theEdge = self.thePQ.removeMin()\n", + " sourceVert = theEdge.srcVert\n", + " self.currentVert = theEdge.destVert\n", + " # display edge from source to current\n", + " print self.vertexList[sourceVert].label ,self.vertexList[self.currentVert].label, \" \",\n", + "\n", + " for j in range(self.nVerts): # unmark vertices\n", + " self.vertexList[j].isIsTree = False\n", + "\n", + " def putInPQ(self,newVert,newDist): # is there another edge with the same destination vertex?\n", + " queueIndex = self.thePQ.find(newVert)\n", + " if(queueIndex != -1): # got edges index\n", + " tempEdge = self.thePQ.peekN(queueIndex) # get edge\n", + " oldDist = tempEdge.distance\n", + " if(oldDist > newDist): # if new edge shorter,\n", + " self.thePQ.removeN(queueIndex) # remove old edge\n", + " theEdge = Edge(self.currentVert, newVert, newDist)\n", + " self.thePQ.insert(theEdge)# insert new edge\n", + " # else no action just leave the old vertex there\n", + " else: # no edge with same destination vertex\n", + " # so insert new one\n", + " theEdge = Edge(self.currentVert, newVert, newDist)\n", + " self.thePQ.insert(theEdge)\n", + "\n", + "\n", + "theGraph = Graph()\n", + "theGraph.addVertex('A') # 0 (start for mst)\n", + "theGraph.addVertex('B') # 1\n", + "theGraph.addVertex('C') # 2\n", + "theGraph.addVertex('D') # 3\n", + "theGraph.addVertex('E') # 4\n", + "theGraph.addVertex('F') # 5\n", + "theGraph.addEdge(0, 1, 16) # AB\n", + "theGraph.addEdge(0, 3, 24) # AD\n", + "\n", + "theGraph.addEdge(1,2,1)\n", + "theGraph.addEdge(1,3,5)\n", + "theGraph.addEdge(1,4,2)\n", + "theGraph.addEdge(2,3,6)\n", + "theGraph.addEdge(2,4,8)\n", + "theGraph.addEdge(2,5,26)\n", + "theGraph.addEdge(3,4,142)\n", + "theGraph.addEdge(4,5,17)\n", + "\n", + "print 'Minimum spanning tree: ',\n", + "theGraph.mstw() # minimum spanning tree" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.2 Page 703" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class DistPar:\n", + " def __init__(self,pv,d): # constructor\n", + " self.distance = d\n", + " self.parentVert = pv\n", + "\n", + "class Vertex:\n", + " def __init__(self,lab): # constructor\n", + " self.label = lab\n", + " self.isInTree = False\n", + "\n", + "class Graph:\n", + " def __init__(self): # constructor\n", + " self.vertexList = [] # adjacency matrix\n", + " self.adjMat = []\n", + " self.nVerts = 0\n", + " self.nTree = 0\n", + " for j in range(20): # set adjacency\n", + " l = []\n", + " for k in range(20):\n", + " l.append(1000000)\n", + " self.adjMat.append(l)\n", + " self.currentVert = 0\n", + " self.sPath = [] # shortest paths\n", + " self.startToCurrent = 0\n", + "\n", + " def addVertex(self,lab):\n", + " self.vertexList.append( Vertex(lab))\n", + " self.nVerts += 1\n", + "\n", + " def addEdge(self,start, end,weight):\n", + " self.adjMat[start][end] = weight\n", + "\n", + "\n", + " def displayVertex(self,v):\n", + " print self.vertexList[v].label ,\n", + "\n", + " def path(self): # find all shortest paths\n", + " startTree = 0 # start at vertex 0\n", + " self.vertexList[startTree].isInTree = True\n", + " self.nTree = 1 # put it in tree\n", + " # transfer row of distances from adjMat to sPath\n", + " for j in range(self.nVerts):\n", + " tempDist = self.adjMat[startTree][j]\n", + " try:\n", + " self.sPath[j] = DistPar(startTree, tempDist)\n", + " except:\n", + " self.sPath.append(DistPar(startTree, tempDist))\n", + " # until all vertices are in the tree\n", + " while(self.nTree < self.nVerts):\n", + " indexMin = self.getMin() # get minimum from sPath\n", + " minDist = self.sPath[indexMin].distance\n", + " if(minDist == 1000000): # if all infinite\n", + " # or in tree,\n", + " print 'There are unreachable vertices'\n", + " break # sPath is complete\n", + " else:\n", + " # reset self.currentVert\n", + " self.currentVert = indexMin # to closest vert\n", + " self.startToCurrent = self.sPath[indexMin].distance\n", + " # minimum distance from startTree is\n", + " # to self.currentVert, and is self.startToCurrent\n", + " # put current vertex in tree\n", + " self.vertexList[self.currentVert].isInTree = True\n", + " self.nTree += 1\n", + " self.adjust_sPath() # update sPath[] array\n", + "\n", + " self.displayPaths() # display sPath[] contents\n", + " self.nTree = 0 # clear tree\n", + " for j in range(self.nVerts):\n", + " self.vertexList[j].isInTree = False \n", + "\n", + " def getMin(self): # get entry from sPath\n", + " minDist = 1000000 # assume minimum\n", + " indexMin = 0\n", + " for j in range(self.nVerts): # for each vertex,\n", + " # if its in tree and\n", + " if( not self.vertexList[j].isInTree and self.sPath[j].distance < minDist ):\n", + " minDist = self.sPath[j].distance\n", + " indexMin = j # update minimum\n", + " return indexMin\n", + "\n", + " def adjust_sPath(self):\n", + " # adjust values in shortest-path array sPath\n", + " column = 1\n", + " # skip starting vertex\n", + " while(column < self.nVerts): # go across columns\n", + " # if this columns vertex already in tree, skip it\n", + " if( self.vertexList[column].isInTree ):\n", + " column += 1\n", + " continue\n", + " # calculate distance for one sPath entry get edge from self.currentVert to column\n", + " currentToFringe = self.adjMat[self.currentVert][column]\n", + " # add distance from start\n", + " startToFringe = self.startToCurrent + currentToFringe\n", + " # get distance of current sPath entry\n", + " sPathDist = self.sPath[column].distance\n", + " # compare distance from start with sPath entry\n", + " if(startToFringe < sPathDist): # if shorter,\n", + " # update sPath\n", + " self.sPath[column].parentVert = self.currentVert\n", + " self.sPath[column].distance = startToFringe\n", + " column += 1\n", + "\n", + " def displayPaths(self):\n", + " for j in range(self.nVerts): # display contents of sPath[]\n", + " print self.vertexList[j].label ,' =' \n", + " if(self.sPath[j].distance == 1000000):\n", + " print 'inf', # inf\n", + " else:\n", + " print self.sPath[j].distance , # 50\n", + " parent = self.vertexList[ self.sPath[j].parentVert ].label\n", + " print '(' , parent , ')' , # (A)\n", + " print ''\n", + " \n", + "theGraph = Graph()\n", + "theGraph.addVertex('A') # 0 (start)\n", + "theGraph.addVertex('C') # 2\n", + "theGraph.addVertex('B') # 1\n", + "theGraph.addVertex('D') # 3\n", + "theGraph.addVertex('E') # 4\n", + "theGraph.addEdge(0,1,50)\n", + "theGraph.addEdge(0,3,80)\n", + "theGraph.addEdge(1,2,60)\n", + "theGraph.addEdge(1,3,90)\n", + "theGraph.addEdge(2,4,40)\n", + "theGraph.addEdge(3,2,20)\n", + "theGraph.addEdge(3,4,70)\n", + "theGraph.addEdge(4,1,50)\n", + "print 'Shortest paths' ,\n", + "theGraph.path() # shortest paths" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Shortest paths A =\n", + "inf ( A ) C =\n", + "50 ( A ) B =\n", + "100 ( D ) D =\n", + "80 ( A ) E =\n", + "140 ( B ) \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch2-checkpoint.ipynb b/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch2-checkpoint.ipynb new file mode 100644 index 00000000..ffbe7f1a --- /dev/null +++ b/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch2-checkpoint.ipynb @@ -0,0 +1,471 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:aab97f08438f435b57ec8f21a4d063e7bb3805bfb2401a475b716ab779bcb766" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 2 : Arrays" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.1 Page no :41" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "nElems = 0\n", + "arr = [77,99,44,55,22,88,11,00,66,33]\n", + "\n", + "for j in range(len(arr)):\n", + " # display items\n", + " print arr[j] ,\n", + "print ''\n", + "\n", + "searchKey = 66\n", + "# find item with key 66\n", + "for j in range(len(arr)):\n", + " if(arr[j] == searchKey):\n", + " break\n", + "if(j == len(arr)):\n", + " print 'Cant find ', searchKey\n", + "else:\n", + " print 'Found ' ,searchKey\n", + "\n", + "searchKey = 55\n", + "for j in arr:\n", + " if(j == searchKey):\n", + " arr.remove(searchKey)\n", + "\n", + "\n", + "for j in range(len(arr)):\n", + " # display items\n", + " print arr[j] ,\n", + "print ''\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "77 99 44 55 22 88 11 0 66 33 \n", + "Found 66\n", + "77 99 44 22 88 11 0 66 33 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.2 Page No : 44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "class LowArray:\n", + " def __init__(self,size):\n", + " self.a = []\n", + " for i in range(size):\n", + " self.a.append(0.0)\n", + " \n", + " def setElem(self,index,value):\n", + " # set value\n", + " self.a[index] = value\n", + "\n", + " def getElem(self,index):\n", + " return self.a[index]\n", + "\n", + "arr = LowArray(100)\n", + "arr.setElem(0,77)\n", + "arr.setElem(1,99)\n", + "arr.setElem(2,44)\n", + "arr.setElem(3,55)\n", + "arr.setElem(4,22)\n", + "arr.setElem(5,88)\n", + "arr.setElem(6,11)\n", + "arr.setElem(7,00)\n", + "arr.setElem(8,66)\n", + "arr.setElem(9,33)\n", + "nElems = 10\n", + "\n", + "# now 10 items in array\n", + "for j in range(nElems):\n", + " # display items\n", + " print arr.getElem(j) ,\n", + "\n", + "print ''\n", + "\n", + "searchKey = 26\n", + "find = False\n", + "# search for data item\n", + "for j in range(nElems):\n", + " # for each element,\n", + " if(arr.getElem(j) == searchKey): # found item?\n", + " find = True\n", + " break\n", + "if(not find):\n", + " print \"Can't find \" , searchKey\n", + "else:\n", + " print \"Found \" , searchKey\n", + "\n", + "for j in range(nElems):\n", + " if(arr.getElem(j) == 55):\n", + " arr.a.remove(55)\n", + " nElems -= 1\n", + "\n", + "for j in range(nElems):\n", + " # display items\n", + " print arr.getElem(j) ,\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "77 99 44 55 22 88 11 0 66 33 \n", + "Can't find 26\n", + "77 99 44 22 88 11 0 66 33\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.3 Page No : 49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "class HighArray:\n", + " def __init__(self,size):\n", + " self.a = []\n", + " self.nElems = 0\n", + " for i in range(size):\n", + " self.a.append(0.0)\n", + " \n", + " def insert(self,value):\n", + " # set value\n", + " self.a[self.nElems] = value\n", + " self.nElems += 1\n", + "\n", + " def find(self,searchKey):\n", + " for j in range(self.nElems):\n", + " if(self.a[j] == searchKey):\n", + " return True\n", + " return False\n", + " \n", + " def delete(self,value):\n", + " for j in range(self.nElems):\n", + " # look for it\n", + " if (value == self.a[j]):\n", + " self.a.remove(value)\n", + " self.nElems -= 1\n", + " \n", + " def display(self):\n", + " for j in range(self.nElems+1):\n", + " print self.a[j] , \n", + " print ''\n", + "\n", + "arr = HighArray(100)\n", + "arr.insert(77)\n", + "arr.insert(99)\n", + "arr.insert(44)\n", + "arr.insert(55)\n", + "arr.insert(22)\n", + "arr.insert(88)\n", + "arr.insert(11)\n", + "arr.insert(00)\n", + "arr.insert(66)\n", + "arr.insert(33)\n", + "\n", + "arr.display()\n", + "\n", + "searchKey = 35\n", + "if( arr.find(searchKey) ):\n", + " print \"Found \" , searchKey\n", + "else:\n", + " print \"Can't find \" , searchKey\n", + "arr.delete(00)\n", + "arr.delete(55)\n", + "arr.delete(99)\n", + "arr.display()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "77 99 44 55 22 88 11 0 66 33 0.0 \n", + "Can't find 35\n", + "77 44 22 88 11 66 33 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.4 Page no : 59" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "class OrdArray:\n", + " def __init__(self,m):\n", + " self.a = []\n", + " self.nElems = 0\n", + " \n", + " def size(self):\n", + " return self.nElems\n", + "\n", + " def find(self,searchKey):\n", + " lowerBound = 0\n", + " upperBound = self.nElems-1\n", + " while True:\n", + " curIn = (lowerBound + upperBound ) / 2\n", + " if(self.a[curIn]==searchKey):\n", + " return curIn\n", + " elif(lowerBound > upperBound):\n", + " return self.nElems\n", + " else:\n", + " if(self.a[curIn] < searchKey):\n", + " lowerBound = curIn + 1\n", + " else:\n", + " upperBound = curIn - 1 \n", + "\n", + " def insert(self,value):\n", + " self.a.append(value)\n", + " self.a.sort()\n", + " self.nElems += 1\n", + "\n", + " def delete(self,value):\n", + " j = self.find(value)\n", + " if(j==self.nElems):\n", + " return False\n", + " else:\n", + " self.a.remove(value)\n", + " self.nElems -=1\n", + " \n", + " def display(self):\n", + " for i in self.a:\n", + " print i ,\n", + " print ''\n", + "\n", + "maxSize = 100\n", + "arr = OrdArray(maxSize)\n", + "arr.insert(77)\n", + "arr.insert(99) \n", + "arr.insert(44) \n", + "arr.insert(55) \n", + "arr.insert(22) \n", + "arr.insert(88) \n", + "arr.insert(11) \n", + "arr.insert(00) \n", + "arr.insert(66) \n", + "arr.insert(33) \n", + "searchKey = 55\n", + "if( arr.find(searchKey) != arr.size() ):\n", + " print 'Found ' , searchKey\n", + "else:\n", + " print \"Can't find \" , searchKey\n", + " \n", + "arr.display()\n", + "arr.delete(00)\n", + "arr.delete(55) \n", + "arr.delete(99) \n", + "arr.display()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Found 55\n", + "0 11 22 33 44 55 66 77 88 99 \n", + "11 22 33 44 66 77 88 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.5 Page no : 66" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class Person:\n", + " def __init__(self,last,first,a):\n", + " self.lastName = last\n", + " self.firstName = first\n", + " self.age = a\n", + "\n", + " def displayPerson(self):\n", + " print \"Last name: \" , self.lastName ,\", First name: \" , self.firstName ,\n", + " print \", Age: \" , self.age\n", + "\n", + " def getLast(self):\n", + " return self.lastName\n", + "\n", + "class ClassDataArray:\n", + " def __init__(self,m):\n", + " self.a = []\n", + " self.nElems = 0\n", + "\n", + " def find(self,searchName):\n", + " f = False\n", + " for j in range(self.nElems):\n", + " if( self.a[j].getLast() ==searchName ) :\n", + " f = True\n", + " break \n", + " if(not f):\n", + " return None\n", + " else:\n", + " return self.a[j]\n", + "\n", + " def insert(self,last,first,age):\n", + " self.a.append(Person(last, first, age))\n", + " self.nElems += 1\n", + "\n", + " def delete(self,searchName):\n", + " f = False\n", + " for j in range(self.nElems):\n", + " if( self.a[j].getLast() == searchName) :\n", + " self.a.remove(self.a[j])\n", + " f = True\n", + " self.nElems -= 1\n", + " break\n", + " if(not f):\n", + " return False\n", + " else:\n", + " return True\n", + " \n", + " def displayA(self):\n", + " for j in range(self.nElems):\n", + " self.a[j].displayPerson()\n", + "\n", + "maxSize = 100\n", + "arr = ClassDataArray(maxSize)\n", + "arr.insert(\"Evans\", \"Patty\", 24)\n", + "arr.insert(\"Smith\", \"Lorraine\", 37)\n", + "arr.insert(\"Yee\", \"Tom\", 43)\n", + "arr.insert(\"Adams\", \"Henry\", 63)\n", + "arr.insert(\"Hashimoto\", \"Sato\", 21)\n", + "arr.insert(\"Stimson\", \"Henry\", 29)\n", + "arr.insert(\"Velasquez\", \"Jose\", 72)\n", + "arr.insert(\"Lamarque\", \"Henry\", 54)\n", + "arr.insert(\"Vang\", \"Minh\", 22)\n", + "arr.insert(\"Creswell\", \"Lucinda\", 18)\n", + "arr.displayA()\n", + "searchKey = \"Stimson\"\n", + "found=arr.find(searchKey)\n", + "if(found != None ):\n", + " print \"Found \" ,\n", + " found.displayPerson()\n", + "else:\n", + " print \"Can't find \" , searchKey\n", + "print \"Deleting Smith, Yee, and Creswell\"\n", + "arr.delete(\"Smith\")\n", + "arr.delete(\"Yee\")\n", + "arr.delete(\"Creswell\")\n", + "arr.displayA()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Last name: Evans , First name: Patty , Age: 24\n", + "Last name: Smith , First name: Lorraine , Age: 37\n", + "Last name: Yee , First name: Tom , Age: 43\n", + "Last name: Adams , First name: Henry , Age: 63\n", + "Last name: Hashimoto , First name: Sato , Age: 21\n", + "Last name: Stimson , First name: Henry , Age: 29\n", + "Last name: Velasquez , First name: Jose , Age: 72\n", + "Last name: Lamarque , First name: Henry , Age: 54\n", + "Last name: Vang , First name: Minh , Age: 22\n", + "Last name: Creswell , First name: Lucinda , Age: 18\n", + "Found Last name: Stimson , First name: Henry , Age: 29\n", + "Deleting Smith, Yee, and Creswell\n", + "Last name: Evans , First name: Patty , Age: 24\n", + "Last name: Adams , First name: Henry , Age: 63\n", + "Last name: Hashimoto , First name: Sato , Age: 21\n", + "Last name: Stimson , First name: Henry , Age: 29\n", + "Last name: Velasquez , First name: Jose , Age: 72\n", + "Last name: Lamarque , First name: Henry , Age: 54\n", + "Last name: Vang , First name: Minh , Age: 22\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch3-checkpoint.ipynb b/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch3-checkpoint.ipynb new file mode 100644 index 00000000..9081eaf8 --- /dev/null +++ b/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch3-checkpoint.ipynb @@ -0,0 +1,324 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:3d75fa922b384c8005ae3c49ad4b92cedee585c19d876f3d1612e2a824146ea0" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 3 : Simple Sorting" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.1 Page No : 85" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "class ArrayBub:\n", + " def __init__(self,m):\n", + " self.a = []\n", + " self.nElems = 0\n", + " \n", + " def insert(self,value):\n", + " # put element into array\n", + " self.a.append(value)\n", + " self.nElems += 1\n", + "\n", + " def display(self):\n", + " # displays array contents\n", + " for j in range(self.nElems):\n", + " print self.a[j] ,\n", + " print ''\n", + "\n", + " def bubbleSort(self):\n", + " out = self.nElems - 1\n", + " while out > 1 :\n", + " for i in range(out): \n", + " if( self.a[i] > self.a[i+1] ):\n", + " self.a[i],self.a[i+1] = self.a[i+1],self.a[i] \n", + " out -= 1\n", + "\n", + "maxSize = 100 # array size\n", + "arr = ArrayBub(maxSize) # create the array\n", + "arr.insert(77) # insert 10 items\n", + "arr.insert(99) \n", + "arr.insert(44) \n", + "arr.insert(55) \n", + "arr.insert(22) \n", + "arr.insert(88) \n", + "arr.insert(11) \n", + "arr.insert(00) \n", + "arr.insert(66) \n", + "arr.insert(33) \n", + "arr.display() # display items\n", + "arr.bubbleSort() # bubble sort them\n", + "arr.display()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "77 99 44 55 22 88 11 0 66 33 \n", + "0 11 22 33 44 55 66 77 88 99 \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.2 Page No : 93" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class ArraySel:\n", + " def __init__(self,m):\n", + " self.a = []\n", + " self.nElems = 0\n", + " \n", + " def insert(self,value):\n", + " # put element into array\n", + " self.a.append(value)\n", + " self.nElems += 1\n", + "\n", + " def display(self):\n", + " # displays array contents\n", + " for j in range(self.nElems):\n", + " print self.a[j] ,\n", + " print ''\n", + "\n", + " def selectionSort(self):\n", + " for out in range(self.nElems-1):\n", + " for i in range(out,self.nElems): \n", + " if( self.a[i] < self.a[out] ):\n", + " self.a[i],self.a[out] = self.a[out],self.a[i] \n", + "\n", + "maxSize = 100 # array size\n", + "arr = ArraySel(maxSize) # create the array\n", + "arr.insert(77) # insert 10 items\n", + "arr.insert(99) \n", + "arr.insert(44) \n", + "arr.insert(55) \n", + "arr.insert(22) \n", + "arr.insert(88) \n", + "arr.insert(11) \n", + "arr.insert(00) \n", + "arr.insert(66) \n", + "arr.insert(33) \n", + "arr.display() # display items\n", + "arr.selectionSort() # bubble sort them\n", + "arr.display()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "77 99 44 55 22 88 11 0 66 33 \n", + "0 11 22 33 44 55 66 77 88 99 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.3 Page No : 101" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class ArrayIns:\n", + " def __init__(self,m):\n", + " self.a = [] # create the array\n", + " self.nElems = 0 # no items yet\n", + "\n", + " def insert(self,value): # put element into array\n", + " self.a.append(value) # insert it\n", + " self.nElems += 1 # increment size\n", + "\n", + " def display(self): # displays array contents\n", + " for j in range(self.nElems): # for each element,\n", + " print self.a[j] , # display it\n", + " print ''\n", + "\n", + " def insertionSort(self):\n", + " for out in range(self.nElems):\n", + " temp = self.a[out]\n", + " i = out\n", + " while (i>0 and self.a[i-1] >= temp):\n", + " self.a[i] = self.a[i-1]\n", + " i -= 1\n", + " self.a[i] = temp\n", + "\n", + "maxSize = 100 # array size\n", + "arr = ArrayIns(maxSize) # create the array\n", + "arr.insert(77) # insert 10 items\n", + "arr.insert(99) \n", + "arr.insert(44) \n", + "arr.insert(55) \n", + "arr.insert(22) \n", + "arr.insert(88) \n", + "arr.insert(11) \n", + "arr.insert(00) \n", + "arr.insert(66) \n", + "arr.insert(33) \n", + "arr.display() # display items\n", + "arr.insertionSort() # insertion-sort them\n", + "arr.display()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "77 99 44 55 22 88 11 0 66 33 \n", + "0 11 22 33 44 55 66 77 88 99 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.4 Page No : 104" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class Person:\n", + " def __init__(self,last,first,a):\n", + " # constructor\n", + " self.lastName = last\n", + " self.firstName = first\n", + " self.age = a\n", + "\n", + " def displayPerson(self):\n", + " print 'Last name: ', self.lastName , ', First name: ',self.firstName , ', Age: ' , self.age\n", + "\n", + " def getLast(self): # get last name\n", + " return self.lastName \n", + "\n", + "class ArrayInOb:\n", + " def __init__(self,m):\n", + " self.a = [] # create the array\n", + " self.nElems = 0 # no items yet\n", + " \n", + " def insert(self,last,first,age):\n", + " self.a.append(Person(last, first, age))\n", + " self.nElems += 1 # increment size\n", + "\n", + " def display(self): # displays array contents\n", + " for j in range(self.nElems): # for each element,\n", + " self.a[j].displayPerson() # display it\n", + " print ''\n", + "\n", + " def insertionSort(self):\n", + " for out in range(1,self.nElems):\n", + " temp = self.a[out]\n", + " i = out\n", + " while(i>0 and self.a[i-1].getLast() > temp.getLast()):\n", + " self.a[i] = self.a[i-1] # shift item to the right\n", + " i -= 1 # go left one position\n", + " self.a[i] = temp\n", + "maxSize = 100 # array size\n", + "arr = ArrayInOb(maxSize) # create the array\n", + "arr.insert('Evans', 'Patty', 24)\n", + "arr.insert('Smith', 'Doc', 59)\n", + "arr.insert('Smith', 'Lorraine', 37)\n", + "arr.insert('Smith', 'Paul', 37)\n", + "arr.insert('Yee', 'Tom', 43)\n", + "arr.insert('Hashimoto', 'Sato', 21)\n", + "arr.insert('Stimson', 'Henry', 29)\n", + "arr.insert('Velasquez', 'Jose', 72)\n", + "arr.insert('Vang', 'Minh', 22)\n", + "arr.insert('Creswell', 'Lucinda', 18)\n", + "print 'Before sorting:'\n", + "arr.display() # display items\n", + "arr.insertionSort() # insertion-sort them\n", + "print 'After sorting:'\n", + "arr.display() # display them again" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Before sorting:\n", + "Last name: Evans , First name: Patty , Age: 24\n", + "Last name: Smith , First name: Doc , Age: 59\n", + "Last name: Smith , First name: Lorraine , Age: 37\n", + "Last name: Smith , First name: Paul , Age: 37\n", + "Last name: Yee , First name: Tom , Age: 43\n", + "Last name: Hashimoto , First name: Sato , Age: 21\n", + "Last name: Stimson , First name: Henry , Age: 29\n", + "Last name: Velasquez , First name: Jose , Age: 72\n", + "Last name: Vang , First name: Minh , Age: 22\n", + "Last name: Creswell , First name: Lucinda , Age: 18\n", + "\n", + "After sorting:\n", + "Last name: Creswell , First name: Lucinda , Age: 18\n", + "Last name: Evans , First name: Patty , Age: 24\n", + "Last name: Hashimoto , First name: Sato , Age: 21\n", + "Last name: Smith , First name: Doc , Age: 59\n", + "Last name: Smith , First name: Lorraine , Age: 37\n", + "Last name: Smith , First name: Paul , Age: 37\n", + "Last name: Stimson , First name: Henry , Age: 29\n", + "Last name: Vang , First name: Minh , Age: 22\n", + "Last name: Velasquez , First name: Jose , Age: 72\n", + "Last name: Yee , First name: Tom , Age: 43\n", + "\n" + ] + } + ], + "prompt_number": 4 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch4-checkpoint.ipynb b/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch4-checkpoint.ipynb new file mode 100644 index 00000000..11002dc8 --- /dev/null +++ b/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch4-checkpoint.ipynb @@ -0,0 +1,902 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:0a83dcc11d890f96092d5395b0fb08b80fd72d940b0b48dc460b2e496128cd71" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 4 : Stacks and Queues" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Exmaple 4.1 Page no : 120" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class StackX:\n", + " def __init__(self,s):\n", + " self.maxSize = s\n", + " self.stackArray = []\n", + " self.top = -1\n", + "\n", + " def push(self,j):\n", + " self.top += 1\n", + " self.stackArray.append(j)\n", + " \n", + " def pop(self):\n", + " p = self.stackArray[self.top]\n", + " self.top -= 1\n", + " self.stackArray.remove(p)\n", + " return p\n", + " \n", + " def peek(self):\n", + " return self.stackArray[self.top]\n", + "\n", + " def isEmpty(self):\n", + " return (self.top == -1)\n", + "\n", + " def isFull(self):\n", + " return (self.top == self.maxSize-1);\n", + "\n", + "theStack = StackX(10) # make new stack\n", + "theStack.push(20)\n", + "theStack.push(40)\n", + "theStack.push(60)\n", + "theStack.push(80)\n", + "while( not theStack.isEmpty() ):\n", + " value = theStack.pop()\n", + " print value," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "80 60 40 20\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.2 Page No : 124" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class StackX:\n", + " def __init__(self,s):\n", + " self.maxSize = s\n", + " self.stackArray = []\n", + " self.top = -1\n", + "\n", + " def push(self,j):\n", + " self.top += 1\n", + " self.stackArray.append(j)\n", + " \n", + " def pop(self):\n", + " p = self.stackArray[self.top]\n", + " self.top -= 1\n", + " self.stackArray.remove(p)\n", + " return p\n", + " \n", + " def peek(self):\n", + " return self.stackArray[self.top]\n", + "\n", + " def isEmpty(self):\n", + " return (self.top == -1)\n", + "\n", + " def isFull(self):\n", + " return (self.top == self.maxSize-1);\n", + "\n", + "\n", + "class Reverser:\n", + " def __init__(self,i):\n", + " self.input = i\n", + " self.output = ''\n", + " self.theStack = None\n", + "\n", + " def doRev(self):\n", + " stackSize = len(self.input)\n", + " self.theStack = StackX(stackSize)\n", + " for j in range(stackSize):\n", + " ch = self.input[j]\n", + " self.theStack.push(ch)\n", + " while( not self.theStack.isEmpty() ):\n", + " ch = self.theStack.pop()\n", + " self.output = self.output + ch\n", + " return self.output\n", + "\n", + "\n", + "while(True):\n", + " print \"Enter a string: \" ,\n", + " i = raw_input() \n", + " if( i == \"\"):\n", + " break\n", + " theReverser = Reverser(i)\n", + " output = theReverser.doRev()\n", + " print \"Reversed: \" , output" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a string: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "part\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Reversed: trap\n", + "Enter a string: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.3 Page No : 128" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class StackX:\n", + " def __init__(self,s):\n", + " self.maxSize = s\n", + " self.stackArray = []\n", + " self.top = -1\n", + "\n", + " def push(self,j):\n", + " self.top += 1\n", + " self.stackArray.append(j)\n", + " \n", + " def pop(self):\n", + " p = self.stackArray[self.top]\n", + " self.top -= 1\n", + " self.stackArray.remove(p)\n", + " return p\n", + " \n", + " def peek(self):\n", + " return self.stackArray[self.top]\n", + "\n", + " def isEmpty(self):\n", + " return (self.top == -1)\n", + "\n", + " def isFull(self):\n", + " return (self.top == self.maxSize-1);\n", + "\n", + "class BracketChecker:\n", + " def __init__(self,i):\n", + " self.input = i \n", + " self.theStack = None\n", + "\n", + " def check(self):\n", + " stackSize = len(self.input)\n", + " self.theStack = StackX(stackSize)\n", + " for j in range(stackSize):\n", + " ch = self.input[j]\n", + " if (ch == '{' or ch == '[' or ch=='('):\n", + " self.theStack.push(ch)\n", + " elif (ch=='}' or ch==']' or ch==')'):\n", + " if( not self.theStack.isEmpty() ):\n", + " chx = self.theStack.pop()\n", + " if( (ch=='}' and chx!='{') or (ch==']' and chx!='[') or (ch==')' and chx!='(') ):\n", + " print \"Error: \" , ch , \" at \" , j \n", + " else:\n", + " print 'Error: ', ch , ' at ' ,j\n", + " else:\n", + " pass\n", + " if( not self.theStack.isEmpty() ):\n", + " print 'Error: missing right delimiter'\n", + "\n", + "while(True):\n", + " print 'Enter string containing delimiters: '\n", + " i = raw_input()\n", + " if( i == ''):\n", + " break\n", + " theChecker = BracketChecker(i)\n", + " theChecker.check()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter string containing delimiters: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "a{b(c]d}e\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Error: ] at 5\n", + "Enter string containing delimiters: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter string containing delimiters: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.4 Page No : 138" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class Queue:\n", + " def __init__(self,s):\n", + " self.maxSize = s\n", + " self.queArray = []\n", + " for i in range(s):\n", + " self.queArray.append(0)\n", + " self.front = 0\n", + " self.rear = -1\n", + " self.nItems = 0\n", + "\n", + " def insert(self,j):\n", + " if(self.rear == self.maxSize-1):\n", + " self.rear = -1\n", + " self.rear += 1\n", + " self.queArray[self.rear] = j\n", + " self.nItems += 1\n", + "\n", + " def remove(self):\n", + " temp = self.queArray[self.front]\n", + " #self.queArray.remove(temp)\n", + " self.front += 1\n", + " if(self.front == self.maxSize):\n", + " # deal with wraparound\n", + " self.front = 0\n", + " self.nItems-=1\n", + " return temp\n", + "\n", + " def peekFront(self):\n", + " return self.queArray[self.front]\n", + "\n", + " def isEmpty(self):\n", + " # true if queue is empty\n", + " return (self.nItems==0)\n", + "\n", + " def isFull(self):\n", + " # true if queue is full\n", + " return (self.nItems==self.maxSize)\n", + "\n", + " def size(self):\n", + " # number of items in queue\n", + " return self.nItems\n", + "\n", + "theQueue = Queue(5) # queue holds 5 items\n", + "theQueue.insert(10) # insert 4 items\n", + "theQueue.insert(20) \n", + "theQueue.insert(30) \n", + "theQueue.insert(40) \n", + "theQueue.remove() # remove 3 items\n", + "theQueue.remove() \n", + "theQueue.remove()\n", + "theQueue.insert(50) # insert 4 more items\n", + "theQueue.insert(60)\n", + "theQueue.insert(70)\n", + "theQueue.insert(80)\n", + "while( not theQueue.isEmpty() ): # // remove and display\n", + " n = theQueue.remove()\n", + " print n ," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "40 50 60 70 80\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.5 Page No : 141" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class Queue:\n", + " def __init__(self,s):\n", + " self.maxSize = s\n", + " self.queArray = []\n", + " for i in range(s):\n", + " self.queArray.append(0)\n", + " self.front = 0\n", + " self.rear = -1\n", + "\n", + " def insert(self,j):\n", + " if(self.rear == self.maxSize-1):\n", + " self.rear = -1\n", + " self.rear += 1\n", + " self.queArray[self.rear] = j\n", + "\n", + " def remove(self):\n", + " temp = self.queArray[self.front]\n", + " #self.queArray.remove(temp)\n", + " self.front += 1\n", + " if(self.front == self.maxSize):\n", + " # deal with wraparound\n", + " self.front = 0\n", + " return temp\n", + "\n", + " def peek(self):\n", + " return self.queArray[self.front]\n", + "\n", + " def isEmpty(self):\n", + " # true if queue is empty\n", + " return ( self.rear+1==self.front or (self.front+self.maxSize-1==self.rear) )\n", + "\n", + " def isFull(self):\n", + " # true if queue is full\n", + " return ( self.rear+2==self.front or (self.front+self.maxSize-2==self.rear) )\n", + "\n", + " def size(self):\n", + " # number of items in queue\n", + " if(self.rear >= self.front):\n", + " # contiguous sequence\n", + " return self.rear-self.front+1\n", + " else:\n", + " # broken sequence\n", + " return (self.maxSize-self.front) + (self.rear+1)" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.6 Page No : 147" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "class PriorityQ:\n", + " # array in sorted order, from max at 0 to min at size-1\n", + " def __init__(self,s):\n", + " self.maxSize = s\n", + " self.queArray = []\n", + " for i in range(s):\n", + " self.queArray.append(0)\n", + " self.nItems = 0\n", + "\n", + " def insert(self,item):\n", + " # insert item\n", + " if(self.nItems==0):\n", + " self.queArray[self.nItems] = item\n", + " self.nItems += 1\n", + " else:\n", + " # if items,\n", + " j = self.nItems\n", + " while j >= 0:\n", + " if( item > self.queArray[j] ):\n", + " self.queArray[j+1] = self.queArray[j] # shift upward\n", + " else:\n", + " break\n", + " j -= 1\n", + " self.queArray[j+1] = item\n", + " self.nItems += 1\n", + "\n", + " def remove(self):\n", + " # remove minimum item\n", + " self.nItems -= 1\n", + " return self.queArray[self.nItems]\n", + "\n", + " def peekMin(self):\n", + " # peek at minimum item\n", + " return self.queArray[self.nItems-1]\n", + "\n", + " def isEmpty(self):\n", + " # true if queue is empty\n", + " return (self.nItems==0)\n", + "\n", + " def isFull(self):\n", + " # true if queue is full\n", + " return (self.nItems == self.maxSize)\n", + "\n", + "thePQ = PriorityQ(6)\n", + "thePQ.insert(30)\n", + "thePQ.insert(50)\n", + "thePQ.insert(10)\n", + "thePQ.insert(40)\n", + "thePQ.insert(20)\n", + "while(not thePQ.isEmpty() ):\n", + " item = thePQ.remove()\n", + " print item ," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10 20 30 40 50\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.7 Page No : 161" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class StackX:\n", + " def __init__(self,s):\n", + " self.maxSize = s\n", + " self.stackArray = []\n", + " self.top = -1\n", + "\n", + " def push(self,j):\n", + " self.top += 1\n", + " self.stackArray.append(j)\n", + " \n", + " def pop(self):\n", + " p = self.stackArray[self.top]\n", + " self.top -= 1\n", + " self.stackArray.remove(p)\n", + " return p\n", + " \n", + " def peek(self):\n", + " return self.stackArray[self.top]\n", + "\n", + " def isEmpty(self):\n", + " return (self.top == -1)\n", + "\n", + " def isFull(self):\n", + " return (self.top == self.maxSize-1);\n", + "\n", + " def peekN(self,n): # return item at index n\n", + " return self.stackArray[n]\n", + " \n", + " def size(self): # return size\n", + " return self.top+1\n", + " \n", + " def displayStack(self,s):\n", + " print s\n", + " print 'Stack (bottom-->top): ',\n", + " for j in range(self.size()):\n", + " print self.peekN(j) ,\n", + " print ''\n", + "\n", + "class InToPost:\n", + " # infix to postfix conversion\n", + " def __init__(self,i):\n", + " self.input = i\n", + " self.stackSize = len(self.input)\n", + " self.theStack = StackX(self.stackSize)\n", + " self.output = ''\n", + "\n", + " def doTrans(self):\n", + " # do translation to postfix\n", + " for j in range(self.stackSize):\n", + " ch = self.input[j]\n", + " self.theStack.displayStack(\"For \"+ ch +\" \") # *diagnostic*\n", + " if ch=='+' or ch=='-':\n", + " self.gotOper(ch, 1)\n", + " elif ch=='*' or ch=='/':\n", + " self.gotOper(ch, 2)\n", + " elif ch=='(':\n", + " self.theStack.push(ch)\n", + " elif ch==')':\n", + " self.gotParen(ch)\n", + " else:\n", + " self.output = self.output + ch # write it to output\n", + " while( not self.theStack.isEmpty() ): # pop remaining opers\n", + " self.theStack.displayStack('While ') # *diagnostic*\n", + " self.output = self.output + self.theStack.pop() # write to output\n", + " self.theStack.displayStack(\"End\")\n", + " return self.output\n", + "\n", + " def gotOper(self,opThis, prec1):\n", + " # got operator from input\n", + " while( not self.theStack.isEmpty() ):\n", + " opTop = self.theStack.pop()\n", + " if( opTop == '(' ):\n", + " self.theStack.push(opTop)\n", + " break\n", + " else:\n", + " prec2 = 0\n", + " if(opTop=='+' or opTop=='-'): # find new op prec\n", + " prec2 = 1\n", + " else:\n", + " prec2 = 2\n", + " if(prec2 < prec1): # if prec of new op less\n", + " self.theStack.push(opTop)\n", + " break;\n", + " else:\n", + " self.output = self.output + opTop # than prec of old\n", + " self.theStack.push(opThis)\n", + "\n", + " def gotParen(self,ch):\n", + " # got right paren from input\n", + " while( not self.theStack.isEmpty() ):\n", + " chx = self.theStack.pop()\n", + " if( chx == '(' ):\n", + " # if popped '('\n", + " break\n", + " # we're done\n", + " else:\n", + " # if popped operator\n", + " self.output = self.output + chx # output it\n", + "\n", + "while(True):\n", + " print 'Enter infix: ',\n", + " i = raw_input()\n", + " # read a string from kbd\n", + " if( i == ''):\n", + " # quit if [Enter]\n", + " break\n", + " theTrans = InToPost(i)\n", + " output = theTrans.doTrans() # do the translation\n", + " print \"Postfix is \" , output" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter infix: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "A*(B+C)-D/(E+F)\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " For A \n", + "Stack (bottom-->top): \n", + "For * \n", + "Stack (bottom-->top): \n", + "For ( \n", + "Stack (bottom-->top): * \n", + "For B \n", + "Stack (bottom-->top): * ( \n", + "For + \n", + "Stack (bottom-->top): * ( \n", + "For C \n", + "Stack (bottom-->top): * ( + \n", + "For ) \n", + "Stack (bottom-->top): * ( + \n", + "For - \n", + "Stack (bottom-->top): * \n", + "For D \n", + "Stack (bottom-->top): - \n", + "For / \n", + "Stack (bottom-->top): - \n", + "For ( \n", + "Stack (bottom-->top): - / \n", + "For E \n", + "Stack (bottom-->top): - / ( \n", + "For + \n", + "Stack (bottom-->top): - / ( \n", + "For F \n", + "Stack (bottom-->top): - / ( + \n", + "For ) \n", + "Stack (bottom-->top): - / ( + \n", + "While \n", + "Stack (bottom-->top): - / \n", + "While \n", + "Stack (bottom-->top): - \n", + "End\n", + "Stack (bottom-->top): \n", + "Postfix is ABC+*DEF+/-\n", + "Enter infix: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.8 Page No : 168" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class StackX:\n", + " def __init__(self,s):\n", + " self.maxSize = s\n", + " self.stackArray = []\n", + " for i in range(s):\n", + " self.stackArray.append(0.0)\n", + " self.top = -1\n", + "\n", + " def push(self,j):\n", + " self.top += 1\n", + " self.stackArray[self.top] = j #.append(j)\n", + " \n", + " def pop(self):\n", + " p = self.stackArray[self.top]\n", + " self.top -= 1\n", + " self.stackArray.remove(p)\n", + " return p\n", + " \n", + " def peek(self):\n", + " return self.stackArray[self.top]\n", + "\n", + " def isEmpty(self):\n", + " return (self.top == -1)\n", + "\n", + " def isFull(self):\n", + " return (self.top == self.maxSize-1);\n", + "\n", + " def peekN(self,n): # return item at index n\n", + " return self.stackArray[n]\n", + " \n", + " def size(self): # return size\n", + " return self.top+1\n", + " \n", + " def displayStack(self,s):\n", + " print s ,\n", + " print 'Stack (bottom-->top): ',\n", + " for j in range(self.top+1):\n", + " print self.peekN(j) ,\n", + " print ''\n", + "\n", + "class ParsePost:\n", + " # infix to postfix conversion\n", + " def __init__(self,i):\n", + " self.input = i\n", + " self.theStack = None\n", + "\n", + " def doParse(self):\n", + " self.theStack = StackX(20)\n", + " interAns = 0\n", + " for j in range(len(self.input)):\n", + " ch = self.input[j]\n", + " self.theStack.displayStack(ch + ' ')\n", + " if(ch >= '0' and ch <= '9'):\n", + " self.theStack.push( ord(ch)-ord('0') )\n", + " else:\n", + " num2 = self.theStack.pop()\n", + " num1 = self.theStack.pop()\n", + " if ch=='+':\n", + " interAns = num1 + num2\n", + " elif ch=='-':\n", + " interAns = num1 - num2\n", + " elif ch=='*':\n", + " interAns = num1 * num2\n", + " elif ch=='/':\n", + " interAns = num1 / num2\n", + " else:\n", + " interAns = 0\n", + " self.theStack.push(interAns)\n", + " interAns = self.theStack.pop()\n", + " return interAns\n", + "\n", + "while(True):\n", + " print 'Enter postfix: ',\n", + " i = raw_input()\n", + " # read a string from kbd\n", + " if( i == ''):\n", + " # quit if [Enter]\n", + " break\n", + " aParser = ParsePost(i)\n", + " output = aParser.doParse() # do the evaluation\n", + " print \"Evaluates to \" , output" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter postfix: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "345+*612+/-\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 3 Stack (bottom-->top): \n", + "4 Stack (bottom-->top): 3 \n", + "5 Stack (bottom-->top): 3 4 \n", + "+ Stack (bottom-->top): 3 4 5 \n", + "* Stack (bottom-->top): 3 9 \n", + "6 Stack (bottom-->top): 27 \n", + "1 Stack (bottom-->top): 27 6 \n", + "2 Stack (bottom-->top): 27 6 1 \n", + "+ Stack (bottom-->top): 27 6 1 2 \n", + "/ Stack (bottom-->top): 27 6 3 \n", + "- Stack (bottom-->top): 27 2 \n", + "Evaluates to 25\n", + "Enter postfix: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch5-checkpoint.ipynb b/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch5-checkpoint.ipynb new file mode 100644 index 00000000..ecd02576 --- /dev/null +++ b/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch5-checkpoint.ipynb @@ -0,0 +1,1215 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:78657e06ea6117b67568778cbd053fe193ae0df563d1cdc0a431335e7e291192" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 5 : Linked Lists" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.1 Page No : 190" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class Link:\n", + " def __init__(self,i,dd):\n", + " self.iData = i\n", + " self.dData = dd\n", + " self.next = None\n", + "\n", + " def displayLink(self): # display ourself\n", + " print '{' , self.iData , ', ' , self.dData , '} ' ,\n", + "\n", + "class LinkList:\n", + " def __init__(self):\n", + " self.first = None\n", + "\n", + " def isEmpty(self): # true if list is empty\n", + " return (self.first==None)\n", + "\n", + " # insert at start of list\n", + " def insertFirst(self,i, dd):\n", + " # make new link\n", + " newLink = Link(i, dd)\n", + " newLink.next = self.first\n", + " # newLink --> old first\n", + " self.first = newLink\n", + "\n", + " def deleteFirst(self):\n", + " temp = self.first\n", + " self.first = self.first.next\n", + " return temp\n", + " \n", + " def displayList(self):\n", + " print 'List (first-->last): ' ,\n", + " current = self.first\n", + " while(current != None):\n", + " current.displayLink()\n", + " current = current.next\n", + " print ''\n", + "\n", + "theList = LinkList() # make new list\n", + "theList.insertFirst(22,2.99)\n", + "theList.insertFirst(44,4.99)\n", + "theList.insertFirst(66,6.99)\n", + "theList.insertFirst(88,8.99)\n", + "theList.displayList()\n", + "\n", + "while( not theList.isEmpty() ): # until it's empty,\n", + " aLink = theList.deleteFirst() # delete link\n", + " print 'Deleted ' , # display it\n", + " aLink.displayLink()\n", + " print ''\n", + " \n", + "theList.displayList()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "List (first-->last): { 88 , 8.99 } { 66 , 6.99 } { 44 , 4.99 } { 22 , 2.99 } \n", + "Deleted { 88 , 8.99 } \n", + "Deleted { 66 , 6.99 } \n", + "Deleted { 44 , 4.99 } \n", + "Deleted { 22 , 2.99 } \n", + "List (first-->last): \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.2 Page No : 193" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class Link:\n", + " def __init__(self,i,dd):\n", + " self.iData = i\n", + " self.dData = dd\n", + " self.next = None\n", + "\n", + " def displayLink(self): # display ourself\n", + " print '{' , self.iData , ', ' , self.dData , '} ' ,\n", + "\n", + "class LinkList:\n", + " def __init__(self):\n", + " self.first = None\n", + "\n", + " def isEmpty(self): # true if list is empty\n", + " return (self.first==None)\n", + "\n", + " # insert at start of list\n", + " def insertFirst(self,i, dd):\n", + " # make new link\n", + " newLink = Link(i, dd)\n", + " newLink.next = self.first\n", + " # newLink --> old first\n", + " self.first = newLink\n", + "\n", + " def deleteFirst(self):\n", + " temp = self.first\n", + " self.first = self.first.next\n", + " return temp\n", + " \n", + " def displayList(self):\n", + " print 'List (first-->last): ' ,\n", + " current = self.first\n", + " while(current != None):\n", + " current.displayLink()\n", + " current = current.next\n", + " print ''\n", + "\n", + " def find(self,key): # find link with given key\n", + " current = self.first #start at first\n", + " while(current.iData != key): # while no match,\n", + " if(current.next == None): # if end of list,\n", + " return None # didnt find it\n", + " else:\n", + " current = current.next # go to next link\n", + " return current\n", + " \n", + " def delete(self,key): # delete link with given key\n", + " current = self.first \n", + " previous = self.first\n", + " while(current.iData != key):\n", + " if(current.next == None):\n", + " return None # didnt find it\n", + " else:\n", + " previous = current\n", + " current = current.next\n", + " if(current == self.first): # if first link,\n", + " self.first = self.first.next\n", + " else:\n", + " previous.next = current.next\n", + " return current\n", + "\n", + "\n", + "theList = LinkList() # make list\n", + "theList.insertFirst(22,2.99)\n", + "theList.insertFirst(44,4.99)\n", + "theList.insertFirst(66,6.99)\n", + "theList.insertFirst(88,8.99)\n", + "theList.displayList() # display list\n", + "f = theList.find(44) # find item\n", + "if( f != None):\n", + " print 'Found link with key ' , f.iData\n", + "else:\n", + " print \"Can't find link\"\n", + "d = theList.delete(66) # delete item\n", + "if( d != None ):\n", + " print \"Deleted link with key \" , d.iData\n", + "else:\n", + " print \"Can't delete link\"\n", + "\n", + "theList.displayList()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "List (first-->last): { 88 , 8.99 } { 66 , 6.99 } { 44 , 4.99 } { 22 , 2.99 } \n", + "Found link with key 44\n", + "Deleted link with key 66\n", + "List (first-->last): { 88 , 8.99 } { 44 , 4.99 } { 22 , 2.99 } \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.3 Page NO :198" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class Link:\n", + " def __init__(self,d):\n", + " self.dData = d\n", + " self.next = None\n", + "\n", + " def displayLink(self): # display ourself\n", + " print self.dData , \n", + "\n", + "class FirstLastList:\n", + " def __init__(self):\n", + " self.first = None\n", + " self.last = None\n", + "\n", + " def isEmpty(self): # true if list is empty\n", + " return (self.first==None)\n", + "\n", + " # insert at start of list\n", + " def insertFirst(self, dd):\n", + " # make new link\n", + " newLink = Link(dd)\n", + " if (self.isEmpty()):\n", + " self.last = newLink\n", + " newLink.next = self.first\n", + " # newLink --> old first\n", + " self.first = newLink\n", + "\n", + " def deleteFirst(self):\n", + " temp = self.first\n", + " if self.first.next ==None:\n", + " self.last = None\n", + " self.first = self.first.next\n", + " return temp\n", + "\n", + " def insertLast(self,dd): # insert at end of list\n", + " newLink = Link(dd) # make new link\n", + " if( self.isEmpty() ): # if empty list,\n", + " self.first = newLink # first --> newLink\n", + " else:\n", + " self.last.next = newLink # old last --> newLink\n", + " self.last = newLink # newLink <-- last\n", + "\n", + " def displayList(self):\n", + " print 'List (first-->last): ' ,\n", + " current = self.first\n", + " while(current != None):\n", + " current.displayLink()\n", + " current = current.next\n", + " print ''\n", + "\n", + "\n", + "theList = FirstLastList()\n", + "theList.insertFirst(22) \n", + "theList.insertLast(11)\n", + "theList.insertFirst(44) \n", + "theList.insertLast(33) \n", + "theList.insertFirst(66) \n", + "theList.insertLast(55) \n", + "theList.displayList() # display the list\n", + "theList.deleteFirst() \n", + "theList.deleteFirst() \n", + "theList.displayList() # display again" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "List (first-->last): 66 44 22 11 33 55 \n", + "List (first-->last): 22 11 33 55 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.4 Page No : 204" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class Link:\n", + " def __init__(self,dd):\n", + " self.dData = dd\n", + " self.next = None\n", + "\n", + " def displayLink(self): # display ourself\n", + " print self.dData , \n", + "\n", + "class LinkList:\n", + " def __init__(self):\n", + " self.first = None\n", + "\n", + " def isEmpty(self): # true if list is empty\n", + " return (self.first==None)\n", + "\n", + " # insert at start of list\n", + " def insertFirst(self, dd):\n", + " # make new link\n", + " newLink = Link( dd)\n", + " newLink.next = self.first\n", + " # newLink --> old first\n", + " self.first = newLink\n", + "\n", + " def deleteFirst(self):\n", + " temp = self.first\n", + " self.first = self.first.next\n", + " return temp\n", + " \n", + " def displayList(self):\n", + " current = self.first\n", + " while(current != None):\n", + " current.displayLink()\n", + " current = current.next\n", + " print ''\n", + "\n", + "class LinkStack:\n", + " def __init__(self):\n", + " self.theList = LinkList()\n", + "\n", + " def push(self,j): # put item on top of stack\n", + " self.theList.insertFirst(j)\n", + "\n", + " def pop(self): # take item from top of stack\n", + " return self.theList.deleteFirst()\n", + "\n", + " def isEmpty(self):\n", + " return ( self.theList.isEmpty() )\n", + "\n", + " def displayStack(self):\n", + " print 'Stack (top-->bottom): ' ,\n", + " self.theList.displayList()\n", + "\n", + "theStack = LinkStack() # make stack\n", + "theStack.push(20)\n", + "theStack.push(40) \n", + "theStack.displayStack() # display stack\n", + "\n", + "theStack.push(60) # push items\n", + "theStack.push(80) \n", + "theStack.displayStack() # display stack\n", + "theStack.pop() \n", + "theStack.pop() \n", + "theStack.displayStack() # display stack" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Stack (top-->bottom): 40 20 \n", + "Stack (top-->bottom): 80 60 40 20 \n", + "Stack (top-->bottom): 40 20 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.5 Page No : 207" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class Link:\n", + " def __init__(self,d): # constructor\n", + " self.dData = d\n", + " self.next = None\n", + "\n", + " def displayLink(self): # display this link\n", + " print self.dData ,\n", + "\n", + "class FirstLastList:\n", + " def __init__(self):\n", + " self.first = None\n", + " self.last = None\n", + "\n", + " def isEmpty(self): # true if list is empty\n", + " return (self.first==None)\n", + "\n", + " # insert at start of list\n", + " def insertFirst(self, dd):\n", + " # make new link\n", + " newLink = Link(dd)\n", + " if (self.isEmpty()):\n", + " self.last = newLink\n", + " newLink.next = self.first\n", + " # newLink --> old first\n", + " self.first = newLink\n", + "\n", + " def deleteFirst(self):\n", + " temp = self.first\n", + " if self.first.next ==None:\n", + " self.last = None\n", + " self.first = self.first.next\n", + " return temp\n", + "\n", + " def insertLast(self,dd): # insert at end of list\n", + " newLink = Link(dd) # make new link\n", + " if( self.isEmpty() ): # if empty list,\n", + " self.first = newLink # first --> newLink\n", + " else:\n", + " self.last.next = newLink # old last --> newLink\n", + " self.last = newLink # newLink <-- last\n", + " \n", + " def displayList(self):\n", + " print 'List (first-->last): ' ,\n", + " current = self.first\n", + " while(current != None):\n", + " current.displayLink()\n", + " current = current.next\n", + " print ''\n", + "\n", + "\n", + "class LinkQueue:\n", + " def __init__(self):\n", + " self.theList = FirstLastList() # make a 2-ended list\n", + "\n", + " def isEmpty(self): # true if queue is empty\n", + " return self.theList.isEmpty()\n", + " \n", + " def insert(self,j): # insert, rear of queue\n", + " self.theList.insertLast(j)\n", + " \n", + " def remove(self): # remove, front of queue\n", + " return self.theList.deleteFirst()\n", + " \n", + " def displayQueue(self):\n", + " print 'Queue (front-->rear): ' , \n", + " self.theList.displayList()\n", + "\n", + "theQueue = LinkQueue()\n", + "theQueue.insert(20) # insert items\n", + "theQueue.insert(40) \n", + "theQueue.displayQueue() # display queue\n", + "theQueue.insert(60) # insert items\n", + "theQueue.insert(80) \n", + "theQueue.displayQueue() # display queue\n", + "theQueue.remove() # remove items\n", + "theQueue.remove() \n", + "theQueue.displayQueue() # display queue" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Queue (front-->rear): List (first-->last): 20 40 \n", + "Queue (front-->rear): List (first-->last): 20 40 60 80 \n", + "Queue (front-->rear): List (first-->last): 60 80 \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.6 Page No : 215" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "class Link:\n", + " def __init__(self,d): # constructor\n", + " self.dData = d\n", + " self.next = None\n", + "\n", + " def displayLink(self): # display this link\n", + " print self.dData ,\n", + "\n", + "class SortedList:\n", + " def __init__(self):\n", + " self.first = None\n", + "\n", + " def isEmpty(self): # true if no links\n", + " return (self.first==None)\n", + "\n", + " def insert(self,key): # insert, in order\n", + " newLink = Link(key) # make new link\n", + " previous = None\n", + " current = self.first # until end of list,\n", + " while(current != None and key > current.dData):\n", + " previous = current\n", + " current = current.next\n", + " if(previous==None): # at beginning of list\n", + " self.first = newLink\n", + " else: # not at beginning\n", + " previous.next = newLink\n", + " newLink.next = current\n", + "\n", + " def remove(self): # return & delete first link\n", + " temp = self.first # save first\n", + " self.first = self.first.next # delete first\n", + " return temp\n", + "\n", + " def displayList(self):\n", + " print \"List (first-->last): \" ,\n", + " current = self.first # start at beginning of listSorted Lists\n", + " while(current != None): # until end of list,\n", + " current.displayLink()\n", + " current = current.next # move to next link\n", + " print ''\n", + "\n", + "# create new list\n", + "theSortedList = SortedList()\n", + "theSortedList.insert(20) # insert 2 items\n", + "theSortedList.insert(40)\n", + "theSortedList.displayList() # display list\n", + "theSortedList.insert(10)\n", + "theSortedList.insert(30)\n", + "theSortedList.insert(50) # insert 3 more items\n", + "theSortedList.displayList() # display list\n", + "theSortedList.remove() # remove an item\n", + "theSortedList.displayList() # display list" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "List (first-->last): 20 40 \n", + "List (first-->last): 10 20 30 40 50 \n", + "List (first-->last): 20 30 40 50 \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.7 Page No : 218" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class Link:\n", + " def __init__(self,d): # constructor\n", + " self.dData = d\n", + " self.next = None\n", + "\n", + " def displayLink(self): # display this link\n", + " print self.dData ,\n", + "\n", + "class SortedList:\n", + " def __init__(self,linkArr = None):\n", + " if linkArr == None:\n", + " self.first = None\n", + " else:\n", + " self.first = None # initialize list\n", + " for j in range(len(linkArr)):\n", + " self.insert( linkArr[j] )\n", + "\n", + " def isEmpty(self): # true if no links\n", + " return (self.first==None)\n", + "\n", + " def insert(self,k): # insert, in order\n", + " previous = None\n", + " current = self.first # until end of list,\n", + " while(current != None and k.dData > current.dData):\n", + " previous = current\n", + " current = current.next\n", + " if(previous==None): # at beginning of list\n", + " self.first = k\n", + " else: # not at beginning\n", + " previous.next = k\n", + " k.next = current\n", + "\n", + " def remove(self): # return & delete first link\n", + " temp = self.first # save first\n", + " self.first = self.first.next # delete first\n", + " return temp\n", + "\n", + " def displayList(self):\n", + " print \"List (first-->last): \" ,\n", + " current = self.first # start at beginning of listSorted Lists\n", + " while(current != None): # until end of list,\n", + " current.displayLink()\n", + " current = current.next # move to next link\n", + " print ''\n", + "\n", + "\n", + "size = 10 # create array of links\n", + "linkArray = []\n", + "import random\n", + "for j in range(size): # fill array with links\n", + " # random number\n", + " n = int(random.random()*99)\n", + " newLink = Link(n) # make link\n", + " linkArray.append(newLink) # put in array\n", + "\n", + "# display array contents\n", + "print 'Unsorted array: ',\n", + "for j in range(size):\n", + " print linkArray[j].dData , \n", + "print ''\n", + "\n", + "# create new list\n", + "# initialized with array\n", + "theSortedList = SortedList(linkArray)\n", + "linkArray = []\n", + "for j in range(size): # links from list to array\n", + " linkArray.append( theSortedList.remove())\n", + "# display array contents\n", + "print 'Sorted Array: ',\n", + "for j in range(size):\n", + " print linkArray[j].dData ," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Unsorted array: 28 87 63 12 73 91 30 91 85 65 \n", + "Sorted Array: 12 28 30 63 65 73 85 87 91 91\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.8 Page no : 226" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class Link:\n", + " def __init__(self,d): # constructor\n", + " self.dData = d\n", + " self.next = None\n", + " self.previous = None\n", + "\n", + " def displayLink(self): # display this link\n", + " print self.dData ,\n", + "\n", + "class DoublyLinkedList:\n", + " def __init__(self):\n", + " self.first = None # no items on list yet\n", + " self.last = None\n", + "\n", + " def isEmpty(self): # true if no links\n", + " return self.first==None\n", + "\n", + " def insertFirst(self,dd): # insert at front of list\n", + " newLink = Link(dd) # make new link\n", + " if( self.isEmpty() ): # if empty list, \n", + " self.last = newLink # newLink <-- last\n", + " else:\n", + " self.first.previous = newLink # newLink <-- old first\n", + " newLink.next = self.first # newLink --> old first\n", + " self.first = newLink # first --> newLink\n", + "\n", + " def insertLast(self,dd): # insert at end of list\n", + " newLink = Link(dd) # make new link\n", + " if( self.isEmpty() ) : # if empty list,\n", + " self.first = newLink # first --> newLink\n", + " else:\n", + " self.last.next = newLink # old last --> newLink\n", + " newLink.previous = self.last # old last <-- newLink\n", + " self.last = newLink # newLink <-- last\n", + "\n", + " def deleteFirst(self): # delete first link\n", + " # (assumes non-empty list)\n", + " temp = self.first\n", + " if(self.first.next == None): # if only one item\n", + " self.last = None # None <-- last\n", + " else:\n", + " self.first.next.previous = None # None <-- old next\n", + " self.first = self.first.next # first --> old next\n", + " return temp\n", + "\n", + " def deleteLast(self): # delete last link\n", + " # (assumes non-empty list)\n", + " temp = self.last\n", + " if(self.first.next == None): # if only one item\n", + " self.first = None # first --> None\n", + " else:\n", + " self.last.previous.next = None # old previous --> None\n", + " self.last = self.last.previous # old previous <-- last\n", + " return temp\n", + "\n", + " # insert dd just after key\n", + " def insertAfter(self,key,dd):\n", + " # (assumes non-empty list)\n", + " current = self.first # start at beginning\n", + " while(current.dData != key): # until match is found,\n", + " current = current.next # move to next link\n", + " if(current == None):\n", + " return False # didnt find it\n", + " newLink = Link(dd) # make new link\n", + " if(current==self.last): # if last link,\n", + " newLink.next = None # newLink --> None\n", + " self.last = newLink# newLink <-- last\n", + " else: # not last link,\n", + " newLink.next = current.next # newLink --> old next # newLink <-- old next\n", + " current.next.previous = newLink\n", + " newLink.previous = current # old current <-- newLink\n", + " current.next = newLink # old current --> newLink\n", + " return True # found it, did insertion\n", + "\n", + " def deleteKey(self,key): # delete item w/ given key\n", + " # (assumes non-empty list)\n", + " current = self.first # start at beginningDoubly Linked Lists\n", + " while(current.dData != key):\n", + " current = current.next\n", + " if(current == None):\n", + " return None\n", + " if(current==self.first):\n", + " self.first = current.next\n", + " else: \n", + " # until match is found, move to next link didnt find it found it first item? first --> old next\n", + " # not first old previous --> old next\n", + " current.previous.next = current.next\n", + " if(current==self.last):\n", + " self.last = current.previous\n", + " else:\n", + " # last item? old previous <-- last not last old previous <-- old next \n", + " current.next.previous = current.previous\n", + " return current # return value\n", + "\n", + " def displayForward(self):\n", + " print 'List (first-->last): ',\n", + " current = self.first # start at beginning\n", + " while(current != None): # until end of list,\n", + " current.displayLink()# display data\n", + " current = current.next # move to next link\n", + " print ''\n", + "\n", + " def displayBackward(self):\n", + " print 'List (last-->first): ' ,\n", + " current = self.last # start at end\n", + " while(current != None): # until start of list,\n", + " current.displayLink() # display data\n", + " current = current.previous # move to previous link\n", + " print ''\n", + "\n", + "# make a new list\n", + "theList = DoublyLinkedList()\n", + "theList.insertFirst(22) # insert at front\n", + "theList.insertFirst(44) \n", + "theList.insertFirst(66) \n", + "theList.insertLast(11) # insert at rear\n", + "theList.insertLast(33) \n", + "theList.insertLast(55) \n", + "theList.displayForward() # display list forward\n", + "theList.displayBackward() # display list backward\n", + "theList.deleteFirst() # delete first item\n", + "theList.deleteLast() # delete last item\n", + "theList.deleteKey(11) # delete item with key 11\n", + "theList.displayForward() # display list forward\n", + "theList.insertAfter(22, 77) # insert 77 after 22\n", + "theList.insertAfter(33, 88) # insert 88 after 33\n", + "theList.displayForward() # display list forward" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "List (first-->last): 66 44 22 11 33 55 \n", + "List (last-->first): 55 33 11 22 44 66 \n", + "List (first-->last): 44 22 33 \n", + "List (first-->last): 44 22 77 33 88 \n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.9 Page No : 235" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class Link:\n", + " def __init__(self,d): # constructor\n", + " self.dData = d\n", + " self.next = None\n", + "\n", + " def displayLink(self): # display this link\n", + " print self.dData ,\n", + "\n", + "class LinkList:\n", + " def __init__(self):\n", + " self.first = None\n", + "\n", + " def isEmpty(self): # true if list is empty\n", + " return (self.first==None)\n", + "\n", + " # insert at start of list\n", + " def insertFirst(self,i, dd):\n", + " # make new link\n", + " newLink = Link(i, dd)\n", + " newLink.next = self.first\n", + " # newLink --> old first\n", + " self.first = newLink\n", + "\n", + " def deleteFirst(self):\n", + " temp = self.first\n", + " self.first = self.first.next\n", + " return temp\n", + " \n", + " def displayList(self):\n", + " print 'List (first-->last): ' ,\n", + " current = self.first\n", + " while(current != None):\n", + " current.displayLink()\n", + " current = current.next\n", + " print ''\n", + "\n", + " def find(self,key): # find link with given key\n", + " current = self.first #start at first\n", + " while(current.iData != key): # while no match,\n", + " if(current.next == None): # if end of list,\n", + " return None # didnt find it\n", + " else:\n", + " current = current.next # go to next link\n", + " return current\n", + " \n", + " def delete(self,key): # delete link with given key\n", + " current = self.first \n", + " previous = self.first\n", + " while(current.iData != key):\n", + " if(current.next == None):\n", + " return None # didnt find it\n", + " else:\n", + " previous = current\n", + " current = current.next\n", + " if(current == self.first): # if first link,\n", + " self.first = self.first.next\n", + " else:\n", + " previous.next = current.next\n", + " return current\n", + "\n", + " def getFirst(self): # get value of first\n", + " return self.first\n", + "\n", + " def setFirst(self,f): # set first to new link\n", + " self.first = f\n", + "\n", + " def getIterator(self): # return iterator\n", + " return ListIterator(self) # initialized with\n", + "\n", + "class ListIterator:\n", + " def __init__(self,l): # constructor\n", + " self.ourList = l\n", + " self.reset()\n", + " self.current = None\n", + " self.previous = None\n", + "\n", + " def reset(self): # start at first\n", + " self.current = self.ourList.getFirst()\n", + " self.previous = None\n", + "\n", + " def atEnd(self): # true if last link\n", + " return (self.current.next==None) \n", + " \n", + " def nextLink(self): # go to next link\n", + " self.previous = self.current\n", + " self.current = self.current.next\n", + "\n", + " def getCurrent(self): # get current link\n", + " return self.current \n", + "\n", + " def insertAfter(self,dd): # insert after\n", + " # current link\n", + " newLink = Link(dd)\n", + " if( self.ourList.isEmpty() ):# empty list\n", + " self.ourList.setFirst(newLink)\n", + " self.current = newLink\n", + " else: # not empty\n", + " newLink.next = self.current.next\n", + " self.current.next = newLink\n", + " self.nextLink() # point to new link\n", + "\n", + " def insertBefore(self,dd): # insert before\n", + " # current link\n", + " newLink = Link(dd)\n", + " if(self.previous == None): # beginning of list (or empty list)\n", + " newLink.next = self.ourList.getFirst()\n", + " self.ourList.setFirst(newLink)\n", + " self.reset()\n", + " else: # not beginning\n", + " newLink.next = self.previous.next\n", + " self.previous.next = newLink\n", + " self.current = newLink\n", + "\n", + " def deleteCurrent(self): # delete item at current\n", + " value = self.current.dData\n", + " if(self.previous == None): # beginning of list\n", + " self.ourList.setFirst(self.current.next)\n", + " self.reset()\n", + " else: # not beginning\n", + " self.previous.next = self.current.next\n", + " if( self.atEnd() ):\n", + " self.reset()\n", + " else:\n", + " current = current.next\n", + " return value\n", + "\n", + "theList = LinkList() # new list\n", + "iter1 = theList.getIterator() # new iter\n", + "iter1.insertAfter(20)\n", + "iter1.insertAfter(40)\n", + "iter1.insertAfter(80)\n", + "iter1.insertBefore(60) # insert items\n", + "while(True):\n", + " print 'Enter first letter of show, reset, ' , \n", + " print 'next, get, before, after, delete: ' ,\n", + " choice = raw_input() # get users option\n", + " if choice == 's': # show list\n", + " if( not theList.isEmpty() ):\n", + " theList.displayList()\n", + " else:\n", + " print 'List is empty'\n", + " elif choice == 'r': # reset (to first)\n", + " iter1.reset()\n", + " elif choice == 'n': # advance to next item\n", + " if( not theList.isEmpty() and not iter1.atEnd() ):\n", + " iter1.nextLink()\n", + " else:\n", + " print \"Cant go to next link\"\n", + " elif choice=='g': # get current item\n", + " if( not theList.isEmpty() ):\n", + " value = iter1.getCurrent().dData\n", + " print \"Returned \" , value\n", + " else:\n", + " print \"List is empty\"\n", + " elif choice == 'b': # insert before current\n", + " print \"Enter value to insert: \",\n", + " value = raw_input()\n", + " iter1.insertBefore(value)\n", + " elif choice=='a': # insert after current\n", + " print \"Enter value to insert: \",\n", + " value = raw_input()\n", + " iter1.insertAfter(value)\n", + " elif choice == 'd': # delete current item\n", + " if( not theList.isEmpty() ):\n", + " value = iter1.deleteCurrent()\n", + " print \"Deleted \" , value\n", + " else:\n", + " print \"Cant delete\"\n", + " else:\n", + " print \"Invalid entry\"\n", + " break" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter first letter of show, reset, next, get, before, after, delete: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "s\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " List (first-->last): 20 40 60 80 \n", + "Enter first letter of show, reset, next, get, before, after, delete: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "r\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter first letter of show, reset, next, get, before, after, delete: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "n\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter first letter of show, reset, next, get, before, after, delete: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "n\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter first letter of show, reset, next, get, before, after, delete: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "g\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Returned 60\n", + "Enter first letter of show, reset, next, get, before, after, delete: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "b\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter value to insert: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "100\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter first letter of show, reset, next, get, before, after, delete: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "a\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter value to insert: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter first letter of show, reset, next, get, before, after, delete: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "s\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " List (first-->last): 20 40 100 7 60 80 \n", + "Enter first letter of show, reset, next, get, before, after, delete: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Invalid entry\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch6-checkpoint.ipynb b/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch6-checkpoint.ipynb new file mode 100644 index 00000000..c95d1bf1 --- /dev/null +++ b/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch6-checkpoint.ipynb @@ -0,0 +1,675 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:de38e9569976fe6e7666e16fc87eae62ca1e6843703b45eeabd018f73553dc8b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 6 : Recursion" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.1 Page No : 255" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "def triangle(n):\n", + " if(n==1):\n", + " return 1\n", + " else:\n", + " return( n + triangle(n-1) )\n", + "\n", + "print 'Enter a number: ' ,\n", + "theNumber = int(raw_input())\n", + "theAnswer = triangle(theNumber)\n", + "print 'Triangle = ' , theAnswer\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter a number: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "50\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Triangle = 1275\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.2 Page No : 265" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "arrChar = []\n", + "size = 0\n", + "count = 0\n", + "def doAnagram(newSize):\n", + " if(newSize == 1): # if too small,\n", + " return\n", + " for j in range(newSize): # for each position,\n", + " doAnagram(newSize-1) # anagram remaining\n", + " if(newSize==2): # if innermost,\n", + " displayWord()\n", + " rotate(newSize);\n", + "\n", + "def rotate(newSize):\n", + " global size\n", + " global arrChar\n", + " position = size - newSize\n", + " temp = arrChar[position]\n", + " for j in range(position+1,size):\n", + " # shift others left\n", + " arrChar[j-1] = arrChar[j]\n", + " arrChar[size-1] = temp;\n", + "\n", + "def displayWord():\n", + " global count\n", + " global size\n", + " global arrChar\n", + " if(count < 99):\n", + " print ' ' ,\n", + " if(count < 9):\n", + " print ' ' ,\n", + " count += 1\n", + " print count ,\n", + " for j in range(size):\n", + " print arrChar[j] ,\n", + " print '' ,\n", + " if(count%6 == 0):\n", + " print ''\n", + "\n", + "print 'Enter a word: '\n", + "i = raw_input()\n", + "#global size\n", + "size = len(i)\n", + "for j in range(size):\n", + " arrChar.append(i[j])\n", + "doAnagram(size)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a word: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "cats\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1 c a t s 2 c a s t 3 c t s a 4 c t a s 5 c s a t 6 c s t a \n", + " 7 a t s c 8 a t c s 9 a s c t 10 a s t c 11 a c t s 12 a c s t \n", + " 13 t s c a 14 t s a c 15 t c a s 16 t c s a 17 t a s c 18 t a c s \n", + " 19 s c a t 20 s c t a 21 s a t c 22 s a c t 23 s t c a 24 s t a c \n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.3 Page No : 269" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class ordArray:\n", + " def __init__(self,m): # constructor\n", + " self.a = []\n", + " self.nElems = 0\n", + " def size(self):\n", + " return self.nElems\n", + "\n", + " def find(self,searchKey):\n", + " return self.recFind(searchKey, 0, self.nElems-1)\n", + "\n", + " def recFind(self,searchKey,lowerBound,upperBound):\n", + " curIn = (lowerBound + upperBound ) / 2\n", + " if(self.a[curIn]==searchKey):\n", + " return curIn # found it\n", + " elif(lowerBound > upperBound):\n", + " return self.nElems # cant find it\n", + " else: # divide range\n", + " if(self.a[curIn] < searchKey): # its in upper half\n", + " return self.recFind(searchKey, curIn+1, upperBound)\n", + " else: # its in lower half\n", + " return self.recFind(searchKey, lowerBound, curIn-1)\n", + "\n", + " def insert(self,value): # put element into array\n", + " self.a.append(value)\n", + " self.a.sort()\n", + " self.nElems += 1\n", + "\n", + " def display(self): # displays array contents\n", + " for j in range(self.nElems): # for each element,\n", + " print self.a[j] , \n", + " print ''\n", + "\n", + "maxSize = 100 # array size\n", + "arr = ordArray(maxSize) # create the array\n", + "arr.insert(72)\n", + "arr.insert(90)\n", + "arr.insert(45)\n", + "arr.insert(126)\n", + "arr.insert(54)\n", + "arr.insert(99)\n", + "arr.insert(144)\n", + "arr.insert(27)\n", + "arr.insert(135)\n", + "arr.insert(81)\n", + "arr.insert(18)\n", + "arr.insert(108)\n", + "arr.insert(9)\n", + "arr.insert(117)\n", + "arr.insert(63)\n", + "arr.insert(36)\n", + "arr.display() # display array\n", + "searchKey = 27 # search for item\n", + "if( arr.find(searchKey) != arr.size()):\n", + " print 'Found ' , searchKey\n", + "else:\n", + " print \"Can't find \" , searchKey" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "9 18 27 36 45 54 63 72 81 90 99 108 117 126 135 144 \n", + "Found 27\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.4 Page No : 278" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "def doTowers(topN,frm,inter,to):\n", + " if(topN==1):\n", + " print \"Disk 1 from \" , frm , \"to \" , to\n", + " else:\n", + " doTowers(topN-1, frm, to, inter) # from-->inter\n", + " print \"Disk \" , topN ,\" from \" , frm , \" to \" , to\n", + " doTowers(topN-1, inter, frm, to) # inter-->to\n", + "\n", + "\n", + "nDisks = 3\n", + "doTowers(nDisks, 'A', 'B', 'C')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Disk 1 from A to C\n", + "Disk 2 from A to B\n", + "Disk 1 from C to B\n", + "Disk 3 from A to C\n", + "Disk 1 from B to A\n", + "Disk 2 from B to C\n", + "Disk 1 from A to C\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.5 Page no : 281" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# merge A and B into C\n", + "def merge(arrayA,sizeA,arrayB,sizeB,arrayC ):\n", + " aDex=0\n", + " bDex=0\n", + " cDex=0\n", + " while(aDex < sizeA and bDex < sizeB): # neither array empty\n", + " if( arrayA[aDex] < arrayB[bDex] ):\n", + " arrayC.append(arrayA[aDex])\n", + " cDex += 1\n", + " aDex += 1\n", + " else:\n", + " arrayC.append(arrayB[bDex])\n", + " cDex += 1\n", + " bDex += 1\n", + " while(aDex < sizeA):\n", + " arrayC.append(arrayA[aDex])\n", + " cDex += 1\n", + " aDex += 1\n", + " while(bDex < sizeB):\n", + " arrayC.append(arrayB[bDex]) # but arrayB isnt\n", + " cDex +=1\n", + " bDex += 1\n", + "\n", + "def display(theArray,size):\n", + " for j in range(size):\n", + " print theArray[j],\n", + "\n", + "\n", + "\n", + "arrayA = [23, 47, 81, 95]\n", + "arrayB = [7, 14, 39, 55, 62, 74]\n", + "arrayC = []\n", + "merge(arrayA, 4, arrayB, 6, arrayC)\n", + "display(arrayC, 10)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "7 14 23 39 47 55 62 74 81 95\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.6 Page no : 288" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class DArray:\n", + " def __init__(self,m):\n", + " self.theArray = []\n", + " self.nElems = 0\n", + " \n", + " def insert(self,value):\n", + " self.theArray.append(value)\n", + " self.nElems += 1\n", + "\n", + " def display(self): # displays array contents\n", + " for j in range(self.nElems):\n", + " print self.theArray[j] ,\n", + " print ''\n", + "\n", + " def mergeSort(self):\n", + " workSpace = []\n", + " for i in range(self.nElems):\n", + " workSpace.append(0)\n", + " self.recMergeSort(workSpace, 0, self.nElems-1)\n", + "\n", + " def recMergeSort(self,workSpace, lowerBound,upperBound):\n", + " if(lowerBound == upperBound): # if range is 1,\n", + " return\n", + " else:\n", + " mid = (lowerBound+upperBound) / 2\n", + " self.recMergeSort(workSpace, lowerBound, mid)\n", + " self.recMergeSort(workSpace, mid+1, upperBound)\n", + " self.merge(workSpace, lowerBound, mid+1, upperBound)\n", + "\n", + " def merge(self,workSpace,lowPtr,highPtr,upperBound):\n", + " j = 0\n", + " lowerBound = lowPtr\n", + " mid = highPtr-1\n", + " n = upperBound-lowerBound+1\n", + " while(lowPtr <= mid and highPtr <= upperBound):\n", + " if( self.theArray[lowPtr] < self.theArray[highPtr] ):\n", + " workSpace[j] = self.theArray[lowPtr]\n", + " j += 1\n", + " lowPtr += 1\n", + " else:\n", + " workSpace[j] = self.theArray[highPtr]\n", + " j += 1\n", + " highPtr += 1\n", + " while(lowPtr <= mid):\n", + " workSpace[j] = self.theArray[lowPtr]\n", + " j += 1\n", + " lowPtr += 1\n", + " while(highPtr <= upperBound):\n", + " workSpace[j] = self.theArray[highPtr]\n", + " j += 1\n", + " highPtr += 1\n", + " for j in range(n):\n", + " self.theArray[lowerBound+j] = workSpace[j]\n", + "\n", + "maxSize = 100 # array size\n", + "arr = DArray(maxSize) # create the array\n", + "arr.insert(64) # insert items\n", + "arr.insert(21) \n", + "arr.insert(33) \n", + "arr.insert(70) \n", + "arr.insert(12) \n", + "arr.insert(85) \n", + "arr.insert(44) \n", + "arr.insert(3) \n", + "arr.insert(99) \n", + "arr.insert(0) \n", + "arr.insert(108) \n", + "arr.insert(36) \n", + "arr.display() # display items\n", + "arr.mergeSort() # merge sort the array\n", + "arr.display() # display items again" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "64 21 33 70 12 85 44 3 99 0 108 36 \n", + "0 3 12 21 33 36 44 64 70 85 99 108 \n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.7 Page No :295" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class Params: #parameters to save on stack\n", + " def __init__(self,nn, ra):\n", + " self.n=nn\n", + " self.returnAddress=ra\n", + "\n", + "class StackX:\n", + " def __init__(self,s):\n", + " self.maxSize = s\n", + " self.stackArray = []\n", + " self.top = -1\n", + "\n", + " def push(self,j):\n", + " self.top += 1\n", + " self.stackArray.append(j)\n", + " \n", + " def pop(self):\n", + " p = self.stackArray[self.top]\n", + " self.top -= 1\n", + " self.stackArray.remove(p)\n", + " return p\n", + " \n", + " def peek(self):\n", + " return self.stackArray[self.top]\n", + "\n", + " def isEmpty(self):\n", + " return (self.top == -1)\n", + "\n", + " def isFull(self):\n", + " return (self.top == self.maxSize-1);\n", + "\n", + "theNumber = 0\n", + "theAnswer = 0\n", + "theStack = None\n", + "codePart = 0\n", + "theseParams = None\n", + "def recTriangle():\n", + " global theStack,codePart\n", + " theStack = StackX(10000)\n", + " codePart = 1\n", + " while( step() == False): # call step() until it's true\n", + " pass\n", + "\n", + "def step():\n", + " global theStack,codePart,theseParams,theAnswer,theNumber\n", + " if codePart==1:\n", + " # initial call\n", + " theseParams = Params(theNumber, 6)\n", + " theStack.push(theseParams);\n", + " codePart = 2\n", + " elif codePart==2:\n", + " # method entry\n", + " theseParams = theStack.peek()\n", + " if(theseParams.n == 1):\n", + " theAnswer = 1\n", + " codePart = 5\n", + " else:\n", + " codePart = 3\n", + " elif codePart==3:\n", + " newParams = Params(theseParams.n - 1, 4)\n", + " theStack.push(newParams)\n", + " codePart = 2 # go enter method\n", + " elif codePart==4:\n", + " theseParams = theStack.peek()\n", + " theAnswer = theAnswer + theseParams.n\n", + " codePart = 5\n", + " elif codePart==5: # method exit\n", + " theseParams = theStack.peek()\n", + " codePart = theseParams.returnAddress # (4 or 6)\n", + " theStack.pop()\n", + " elif codePart==6: # return point\n", + " return True\n", + " else:\n", + " pass\n", + " return False\n", + "\n", + "print 'Enter a number: ' ,\n", + "theNumber = int(raw_input())\n", + "recTriangle()\n", + "print 'Triangle = ' ,theAnswer\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "100\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Triangle = 5050\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.8 Page no : 301" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "\n", + "class StackX:\n", + " def __init__(self,s):\n", + " self.maxSize = s\n", + " self.stackArray = []\n", + " self.top = -1\n", + "\n", + " def push(self,j):\n", + " self.top += 1\n", + " self.stackArray.append(j)\n", + " \n", + " def pop(self):\n", + " p = self.stackArray[self.top]\n", + " self.top -= 1\n", + " self.stackArray.remove(p)\n", + " return p\n", + " \n", + " def peek(self):\n", + " return self.stackArray[self.top]\n", + "\n", + " def isEmpty(self):\n", + " return (self.top == -1)\n", + "\n", + " def isFull(self):\n", + " return (self.top == self.maxSize-1);\n", + "theNumber = 0\n", + "theAnswer = 0\n", + "theStack = None\n", + "theseParams = None\n", + "\n", + "def stackTriangle():\n", + " global theNumber,theAnswer,theStack,theNumber\n", + " theStack = StackX(10000)\n", + " theAnswer = 0\n", + " while(theNumber > 0): # until n is 1,\n", + " theStack.push(theNumber) # push value\n", + " theNumber -= 1 # decrement value\n", + "\n", + " while( not theStack.isEmpty() ): # until stack empty,\n", + " newN = theStack.pop() # pop value,\n", + " theAnswer += newN\n", + "\n", + "print 'Enter a number: ' ,\n", + "theNumber = int(raw_input())\n", + "stackTriangle()\n", + "print 'Triangle = ' ,theAnswer\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number: " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "50\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Triangle = 1275\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch7-checkpoint.ipynb b/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch7-checkpoint.ipynb new file mode 100644 index 00000000..8b6e1954 --- /dev/null +++ b/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch7-checkpoint.ipynb @@ -0,0 +1,527 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:a1b30e83d81b2cbf128e785184057c842d4480c1f2796f1d1e7e78372f935c78" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 7 : Advanced Sorting " + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.1 Page no : 321" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "class ArraySh:\n", + " def __init__(self,m): # constructor\n", + " self.theArray = [] # create the array\n", + " self.nElems = 0 # no items yet\n", + "\n", + " def insert(self,value): # put element into array\n", + " self.theArray.append(value) # insert it\n", + " self.nElems+=1 # increment size\n", + "\n", + " def display(self): # displays array contents\n", + " print 'A=' , \n", + " for j in range(self.nElems): # for each element,\n", + " print self.theArray[j] , # display it\n", + " print ''\n", + "\n", + " def shellSort(self):\n", + " inner = 0\n", + " outer = 0\n", + " temp = 0\n", + " h = 1\n", + " while(h <= self.nElems/3):\n", + " h = h*3 + 1\n", + " while(h>0):\n", + " # find initial value of h\n", + " # (1, 4, 13, 40, 121, ...)\n", + " # decreasing h, until h=1\n", + " # h-sort the file\n", + " for outer in range(h,self.nElems):\n", + " temp = self.theArray[outer]\n", + " inner = outer\n", + " # one subpass (eg 0, 4, 8)\n", + " while(inner > h-1 and self.theArray[inner-h] >= temp):\n", + " self.theArray[inner] = self.theArray[inner-h]\n", + " inner -= h\n", + " self.theArray[inner] = temp\n", + " h = (h-1) / 3\n", + "\n", + "maxSize = 10 # array size\n", + "arr = ArraySh(maxSize) # create the array\n", + "import random\n", + "for j in range(maxSize): # fill array with\n", + " # random numbers\n", + " n = int(random.random()*99)\n", + " arr.insert(n)\n", + "\n", + "arr.display() # display unsorted array\n", + "arr.shellSort() # shell sort the array\n", + "arr.display() # display sorted array" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "A= 35 47 88 24 10 98 14 75 97 38 \n", + "A= 10 14 24 35 38 47 75 88 97 98 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.2 Page No 327" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class ArrayPar:\n", + " def __init__(self,m): # constructor\n", + " self.theArray = [] # create the array\n", + " self.nElems = 0 # no items yet\n", + "\n", + " def insert(self,value): # put element into array\n", + " self.theArray.append(value) # insert it\n", + " self.nElems += 1 # increment size\n", + "\n", + " def size(self): # return number of items\n", + " return self.nElems \n", + "\n", + " def display(self): # displays array contents\n", + " print 'A=' ,\n", + " for j in range(self.nElems): # for each element,\n", + " print self.theArray[j] , # display it\n", + " print ''\n", + "\n", + " def partitionIt(self,left,right,pivot):\n", + " leftPtr = left - 1 # right of first elem\n", + " rightPtr = right + 1 # left of pivot\n", + " while(True):\n", + " leftPtr += 1\n", + " while(leftPtr < right ):\n", + " leftPtr += 1\n", + " if self.theArray[leftPtr] < pivot:\n", + " break\n", + " while(rightPtr > left ):# find smaller item\n", + " rightPtr -= 1\n", + " if self.theArray[rightPtr] > pivot:\n", + " break;\n", + " if(leftPtr >= rightPtr): # if pointers cross,\n", + " break\n", + " else: # not crossed, so\n", + " self.swap(leftPtr, rightPtr)\n", + " return leftPtr\n", + "\n", + " def swap(self,dex1,dex2): # swap two elements\n", + " temp = self.theArray[dex1] # A into temp\n", + " self.theArray[dex1] = self.theArray[dex2] # B into A\n", + " self.theArray[dex2] = temp # temp into BPartitioning\n", + "\n", + "maxSize = 16 # array size\n", + "arr = ArrayPar(maxSize) # create the array\n", + "import random\n", + "for j in range(maxSize): # fill array with\n", + " # random numbers\n", + " n = int(random.random()*199)\n", + " arr.insert(n)\n", + "arr.display() # display unsorted array\n", + "pivot = 99 # pivot value\n", + "print \"Pivot is \", pivot ,\n", + "size = arr.size() # partition array\n", + "partDex = arr.partitionIt(0, size-1, pivot)\n", + "print \", Partition is at index \" , partDex \n", + "arr.display() # display partitioned array" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "A= 114 43 4 72 43 6 41 78 25 107 19 18 191 116 108 10 \n", + "Pivot is 99 , Partition is at index 9\n", + "A= 114 108 4 116 43 191 41 107 25 78 19 18 6 72 43 10 \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.3 Page no : 337" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class ArrayIns:\n", + " def __init__(self,m):\n", + " self.theArray = [] # create the array\n", + " self.nElems = 0 # no items yet\n", + "\n", + " def insert(self,value): # put element into array\n", + " self.theArray.append( value) # insert it\n", + " self.nElems += 1 # increment size\n", + "\n", + " def display(self): # displays array contents\n", + " print 'A=' ,\n", + " for j in range(self.nElems): # for each element,\n", + " print self.theArray[j] , # display it\n", + " print ''\n", + " def quickSort(self):\n", + " self.recQuickSort(0, self.nElems-1)\n", + "\n", + " def recQuickSort(self,left,right):\n", + " if(right-left <= 0): # if size <= 1,\n", + " return # already sorted\n", + " else: # size is 2 or larger\n", + " pivot = self.theArray[right] # rightmost item\n", + " # partition range\n", + " partition = self.partitionIt(left, right, pivot)\n", + " self.recQuickSort(left, partition-1) # sort left side\n", + " self.recQuickSort(partition+1, right) # sort right side\n", + "\n", + " def partitionIt(self,start, end,pivot):\n", + " bottom = start-1 # Start outside the area to be partitioned\n", + " top = end # Ditto\n", + " done = 0\n", + " while not done: # Until all elements are partitioned...\n", + " while not done: # Until we find an out of place element...\n", + " bottom = bottom+1 # ... move the bottom up.\n", + " if bottom == top: # If we hit the top...\n", + " done = 1 # ... we are done.\n", + " break\n", + " if self.theArray[bottom] > pivot: # Is the bottom out of place?\n", + " self.theArray[top] = self.theArray[bottom] # Then put it at the top...\n", + " break # ... and start searching from the top.\n", + " while not done: # Until we find an out of place element...\n", + " top = top-1 # ... move the top down.\n", + " \n", + " if top == bottom: # If we hit the bottom...\n", + " done = 1 # ... we are done.\n", + " break\n", + " \n", + " if self.theArray[top] < pivot: # Is the top out of place?\n", + " self.theArray[bottom] = self.theArray[top] # Then put it at the bottom...\n", + " break # ...and start searching from the bottom.\n", + "\n", + " self.theArray[top] = pivot # Put the pivot in its place.\n", + " return top # Return the split point\n", + "\n", + "maxSize = 16 # array size\n", + "arr = ArrayIns(maxSize) # create array\n", + "import random\n", + "for j in range(maxSize): # fill array with\n", + " # random numbers\n", + " n = int(random.random()*99)\n", + " arr.insert(n)\n", + "arr.display() # display items\n", + "arr.quickSort() # quicksort them\n", + "arr.display() # display them again" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "A= 63 42 31 37 74 79 6 76 0 5 7 6 82 48 26 70 \n", + "A= 0 5 6 6 7 26 31 37 42 48 63 70 74 76 79 82 \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.4 Page No : 347" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class ArrayIns:\n", + " def __init__(self,m):\n", + " self.theArray = [] # create the array\n", + " self.nElems = 0 # no items yet\n", + "\n", + " def insert(self,value): # put element into array\n", + " self.theArray.append(value) # insert it\n", + " self.nElems+=1 # increment size\n", + "\n", + " def display(self): # displays array contents\n", + " print 'A=' ,\n", + " for j in self.theArray:\n", + " print j , \n", + " print ''\n", + " \n", + " def quickSort(self):\n", + " self.recQuickSort(0, self.nElems-1)\n", + "\n", + " def recQuickSort(self,left,right):\n", + " size = right-left+1\n", + " if(size <= 3): # manual sort if small\n", + " self.manualSort(left, right)\n", + " else:\n", + " median = self.medianOf3(left, right)\n", + " partition = self.partitionIt(left, right, median)\n", + " self.recQuickSort(left, partition-1)\n", + " self.recQuickSort(partition+1, right)\n", + "\n", + " def partitionIt(self,start, end,pivot):\n", + " bottom = start-1 # Start outside the area to be partitioned\n", + " top = end # Ditto\n", + " done = 0\n", + " while not done: # Until all elements are partitioned...\n", + " while not done: # Until we find an out of place element...\n", + " bottom = bottom+1 # ... move the bottom up.\n", + " if bottom == top: # If we hit the top...\n", + " done = 1 # ... we are done.\n", + " break\n", + " if self.theArray[bottom] > pivot: # Is the bottom out of place?\n", + " self.theArray[top] = self.theArray[bottom] # Then put it at the top...\n", + " break # ... and start searching from the top.\n", + " while not done: # Until we find an out of place element...\n", + " top = top-1 # ... move the top down.\n", + " \n", + " if top == bottom: # If we hit the bottom...\n", + " done = 1 # ... we are done.\n", + " break\n", + " \n", + " if self.theArray[top] < pivot: # Is the top out of place?\n", + " self.theArray[bottom] = self.theArray[top] # Then put it at the bottom...\n", + " break # ...and start searching from the bottom.\n", + "\n", + " self.theArray[top] = pivot # Put the pivot in its place.\n", + " return top # Return the split point \n", + " \n", + " \n", + " \n", + " def medianOf3(self,left, right):\n", + " center = (left+right)/2 # order left & center\n", + " if( self.theArray[left] > self.theArray[center] ):\n", + " self.theArray[left],self.theArray[center] = self.theArray[center],self.theArray[left]\n", + " if( self.theArray[left] > self.theArray[right] ):\n", + " self.theArray[left],self.theArray[right] = self.theArray[right],self.theArray[left]\n", + " if( self.theArray[center] > self.theArray[right] ):\n", + " self.theArray[right],self.theArray[center] = self.theArray[center],self.theArray[right]\n", + " self.theArray[right-1],self.theArray[center] = self.theArray[center],self.theArray[right-1] # put pivot on right\n", + " return self.theArray[right-1] # return median value\n", + "\n", + " def manualSort(self,left,right):\n", + " size = right-left+1\n", + " if(size <= 1):\n", + " return # no sort necessary\n", + " if(size == 2): # 2-sort left and right\n", + " if( self.theArray[left] > self.theArray[right] ):\n", + " self.theArray[right],self.theArray[left] = self.theArray[left],self.theArray[right]\n", + " return\n", + " else: # size is 3\n", + " # 3-sort left, center, & right\n", + " if( self.theArray[left] > self.theArray[right-1] ):\n", + " self.theArray[right-1],self.theArray[left] = self.theArray[left],self.theArray[right-1] # left, center\n", + " if( self.theArray[left] > self.theArray[right] ):\n", + " self.theArray[right],self.theArray[left] = self.theArray[left],self.theArray[right] # left, right\n", + " if( self.theArray[right-1] > self.theArray[right] ):\n", + " self.theArray[right-1],self.theArray[right] = self.theArray[right],self.theArray[right-1] # center, right\n", + "\n", + "\n", + "maxSize = 16 # array size\n", + "arr = ArrayIns(maxSize) # create array\n", + "import random\n", + "for j in range(maxSize): # fill array with\n", + " # random numbers\n", + " n = int(random.random()*99)\n", + " arr.insert(n)\n", + "arr.display() # display items\n", + "arr.quickSort() # quicksort them\n", + "arr.display() # display them again" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "A= 93 28 45 24 83 16 56 62 26 13 62 49 29 89 63 18 \n", + "A= 13 16 18 18 24 26 28 28 29 45 45 62 62 63 83 83 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.5 Page No : 351" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "class ArrayIns:\n", + " def __init__(self,m):\n", + " self.theArray = [] # create the array\n", + " self.nElems = 0 # no items yet\n", + "\n", + " def insert(self,value): # put element into array\n", + " self.theArray.append(value) # insert it\n", + " self.nElems+=1 # increment size\n", + "\n", + " def display(self): # displays array contents\n", + " print 'A=' ,\n", + " for j in self.theArray:\n", + " print j , \n", + " print ''\n", + " \n", + " def quickSort(self):\n", + " self.recQuickSort(0, self.nElems-1)\n", + "\n", + " def recQuickSort(self,left,right):\n", + " size = right-left+1\n", + " if(size <= 10): \n", + " self.insertionSort(left, right)\n", + " else:\n", + " median = self.medianOf3(left, right)\n", + " partition = self.partitionIt(left, right, median)\n", + " self.recQuickSort(left, partition-1)\n", + " self.recQuickSort(partition+1, right)\n", + "\n", + " def partitionIt(self,start, end,pivot):\n", + " bottom = start-1 # Start outside the area to be partitioned\n", + " top = end # Ditto\n", + " done = 0\n", + " while not done: # Until all elements are partitioned...\n", + " while not done: # Until we find an out of place element...\n", + " bottom = bottom+1 # ... move the bottom up.\n", + " if bottom == top: # If we hit the top...\n", + " done = 1 # ... we are done.\n", + " break\n", + " if self.theArray[bottom] > pivot: # Is the bottom out of place?\n", + " self.theArray[top] = self.theArray[bottom] # Then put it at the top...\n", + " break # ... and start searching from the top.\n", + " while not done: # Until we find an out of place element...\n", + " top = top-1 # ... move the top down.\n", + " \n", + " if top == bottom: # If we hit the bottom...\n", + " done = 1 # ... we are done.\n", + " break\n", + " \n", + " if self.theArray[top] < pivot: # Is the top out of place?\n", + " self.theArray[bottom] = self.theArray[top] # Then put it at the bottom...\n", + " break # ...and start searching from the bottom.\n", + "\n", + " self.theArray[top] = pivot # Put the pivot in its place.\n", + " return top # Return the split point \n", + " \n", + " \n", + " \n", + " def medianOf3(self,left, right):\n", + " center = (left+right)/2 # order left & center\n", + " if( self.theArray[left] > self.theArray[center] ):\n", + " self.theArray[left],self.theArray[center] = self.theArray[center],self.theArray[left]\n", + " if( self.theArray[left] > self.theArray[right] ):\n", + " self.theArray[left],self.theArray[right] = self.theArray[right],self.theArray[left]\n", + " if( self.theArray[center] > self.theArray[right] ):\n", + " self.theArray[right],self.theArray[center] = self.theArray[center],self.theArray[right]\n", + " self.theArray[right-1],self.theArray[center] = self.theArray[center],self.theArray[right-1] # put pivot on right\n", + " return self.theArray[right-1] # return median value\n", + "\n", + " def insertionSort(self,left,right):\n", + " i = 0\n", + " out = 0 # sorted on left of out\n", + " for out in range(left+1,right+1):\n", + " temp = self.theArray[out] # remove marked item\n", + " i = out # start shifts at out\n", + " # until one is smaller,\n", + " while(i >left and self.theArray[i-1] >= temp):\n", + " self.theArray[i] = self.theArray[i-1] # shift item to right\n", + " i -= 1 # go left one position\n", + " self.theArray[i] = temp # insert marked item\n", + "\n", + "maxSize = 16 # array size\n", + "arr = ArrayIns(maxSize) # create array\n", + "import random\n", + "for j in range(maxSize): # fill array with\n", + " # random numbers\n", + " n = int(random.random()*99)\n", + " arr.insert(n)\n", + "arr.display() # display items\n", + "arr.quickSort() # quicksort them\n", + "arr.display() # display them again" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "A= 32 49 43 84 84 76 63 70 37 50 13 46 46 19 60 72 \n", + "A= 13 19 32 32 37 43 46 49 50 60 63 70 70 76 84 84 \n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch8-checkpoint.ipynb b/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch8-checkpoint.ipynb new file mode 100644 index 00000000..5f108760 --- /dev/null +++ b/Data_Structures_and_Algorithms_in_Java/.ipynb_checkpoints/ch8-checkpoint.ipynb @@ -0,0 +1,278 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:8af7b49cf811d590bd7b25dd4e6ee061b1b9e37ea11f5e8572f545bc4780f1b4" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 8 : Binary Trees" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Exmaple 8.1 Page No : 406" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# for Stack class\n", + "class Node:\n", + " def __init__(self):\n", + " self.iData = None # data item (key)\n", + " self.dData = None # data item\n", + " self.leftChild = None # this nodes left child\n", + " self.rightChild = None # this nodes right child\n", + "\n", + " def displayNode(self):\n", + " # display ourself\n", + " print '{' , self.iData , ',' ,self.dData , '}',\n", + "\n", + "class Tree:\n", + " def __init__(self):\n", + " # constructor\n", + " self.root = None # no nodes in tree \n", + "\n", + " def find(self,key): # find node with given key\n", + " # (assumes non-empty tree)\n", + " current = self.root # start at self.root\n", + " while(current.iData != key): # while no match,\n", + " if(key < current.iData): # go left?\n", + " current = current.leftChild\n", + " else: # or go right?\n", + " current = current.rightChild\n", + " if(current == None): # if no child,\n", + " return None # didnt find it\n", + " return current\n", + "\n", + " def insert(self,i,dd):\n", + " newNode = Node() # make new node\n", + " newNode.iData = i # insert data\n", + " newNode.dData = dd\n", + " if(self.root==None):# no node in self.root\n", + " self.root = newNode\n", + " else: # self.root occupied\n", + " current = self.root # start at self.root\n", + " while(True): # (exits internally)\n", + " parent = current\n", + " if(i < current.iData): # go left?\n", + " current = current.leftChild\n", + " if(current == None): # if end of the line,\n", + " # insert on left\n", + " parent.leftChild = newNode\n", + " return\n", + " else:# or go right?\n", + " current = current.rightChild\n", + " if(current == None): # if end of the line \n", + " # insert on right\n", + " parent.rightChild = newNode\n", + " return\n", + "\n", + " def delete(self,key): # delete node with given key\n", + " # (assumes non-empty list)\n", + " current = self.root\n", + " parent = self.root\n", + " isLeftChild = True\n", + " while(current.iData != key):\n", + " parent = current\n", + " if(key < current.iData):\n", + " isLeftChild = True\n", + " current = current.leftChild\n", + " else:\n", + " isLeftChild = False\n", + " current = current.rightChild\n", + " if(current == None):\n", + " return False\n", + " # if no children, simply delete it\n", + " if(current.leftChild==None and current.rightChild==None):\n", + " if(current == self.root): # if self.root,\n", + " self.root = None # tree is empty\n", + " elif(isLeftChild):\n", + " parent.leftChild = None\n", + " else:\n", + " parent.rightChild = None\n", + "\n", + " elif(current.rightChild==None):\n", + " if(current == self.root):\n", + " self.root = current.leftChild\n", + " elif(isLeftChild):\n", + " parent.leftChild = current.leftChild\n", + " else:\n", + " parent.rightChild = current.leftChild # if no left child, replace with right subtree\n", + " elif(current.leftChild==None):\n", + " if(current == self.root):\n", + " self.root = current.rightChild\n", + " elif(isLeftChild):\n", + " parent.leftChild = current.rightChild\n", + " else:\n", + " parent.rightChild = current.rightChild\n", + " else: # two children, so replace with inorder successor\n", + " # get successor of node to delete (current)\n", + " successor = self.getSuccessor(current)\n", + " # connect parent of current to successor instead\n", + " if(current == self.root):\n", + " self.root = successor\n", + " elif(isLeftChild):\n", + " parent.leftChild = successor\n", + " else:\n", + " parent.rightChild = successor\n", + " # connect successor to currents left child\n", + " successor.leftChild = current.leftChild\n", + " return True\n", + "\n", + " def getSuccessor(self,delNode):\n", + " successorParent = delNode\n", + " successor = delNode\n", + " current = delNode.rightChild # go to right child\n", + " while(current != None): # until no more\n", + " # left children,\n", + " successorParent = successor\n", + " successor = current\n", + " current = current.leftChild # go to left child\n", + " # if successor not\n", + " if(successor != delNode.rightChild): # right child,\n", + " # make connections\n", + " successorParent.leftChild = successor.rightChild\n", + " successor.rightChild = delNode.rightChild\n", + " return successor\n", + "\n", + " def traverse(self,traverseType):\n", + " if traverseType == 1:\n", + " print '\\nPreorder traversal: ',\n", + " self.preOrder(self.root)\n", + " elif traverseType == 2:\n", + " print '\\nInorder traversal: ',\n", + " self.inOrder(self.root)\n", + " else:\n", + " print '\\nPostorder traversal: ',\n", + " self.postOrder(self.root)\n", + " print ''\n", + "\n", + " def preOrder(self, localroot):\n", + " if(localroot != None):\n", + " print localroot.iData ,\n", + " self.preOrder(localroot.leftChild)\n", + " self.preOrder(localroot.rightChild)\n", + "\n", + " def inOrder(self, localroot):\n", + " if(localroot != None):\n", + " self.inOrder(localroot.leftChild)\n", + " print localroot.iData ,\n", + " self.inOrder(localroot.rightChild)\n", + " \n", + " def postOrder(self, localroot):\n", + " if(localroot != None):\n", + " self.postOrder(localroot.leftChild)\n", + " self.postOrder(localroot.rightChild)\n", + " print localroot.iData ,\n", + "\n", + " def displayTree(self):\n", + " globalStack = list()\n", + " globalStack.append(self.root)\n", + " nBlanks = 32\n", + " isRowEmpty = False\n", + " print '\\n......................................................'\n", + " while(isRowEmpty==False):\n", + " localStack = list()\n", + " isRowEmpty = True\n", + " for j in range(nBlanks):\n", + " print ' ',\n", + " while(globalStack is not None):\n", + " temp = globalStack.pop()\n", + " if(temp != None):\n", + " print temp.iData,\n", + " localStack.append(temp.leftChild)\n", + " localStack.append(temp.rightChild)\n", + " if(temp.leftChild != None or temp.rightChild != None):\n", + " isRowEmpty = False\n", + " else:\n", + " print '--' ,\n", + " localStack.push(None)\n", + " localStack.push(None)\n", + " for j in range(nBlanks*2-2):\n", + " print ' ', # end while globalStack not empty\n", + " \n", + " print ''\n", + " nBlanks /= 2\n", + " while(localStack is not None):\n", + " globalStack.append( localStack.pop() ) # end while isRowEmpty is false\n", + " \n", + " print '\\n......................................................'\n", + "\n", + "theTree = Tree()\n", + "theTree.insert(50,1.5)\n", + "theTree.insert(25,1.2)\n", + "theTree.insert(75,1.7)\n", + "theTree.insert(12,1.5)\n", + "theTree.insert(37,1.2)\n", + "theTree.insert(43,1.7)\n", + "theTree.insert(30,1.5)\n", + "theTree.insert(33,1.2)\n", + "theTree.insert(87,1.7)\n", + "theTree.insert(93,1.5)\n", + "theTree.insert(97,1.5)\n", + "while(True):\n", + " print 'Enter first letter of show, '\n", + " print 'insert, find, delete, or traverse: ',\n", + " choice = raw_input()\n", + " if choice == 's':\n", + " theTree.displayTree()\n", + " elif choice == 'i':\n", + " print 'Enter value to insert: '\n", + " value = int(raw_input())\n", + " theTree.insert(value, value + 0.9)\n", + " elif choice == 'f':\n", + " print 'Enter value to find: ',\n", + " value = int(raw_input())\n", + " found = theTree.find(value)\n", + " if(found != None):\n", + " print 'Found: ', \n", + " found.displayNode()\n", + " print ''\n", + " else:\n", + " print 'Could not find', value \n", + " elif choice=='d':\n", + " print 'Enter value to delete: ',\n", + " value = int(raw_input())\n", + " didDelete = theTree.delete(value)\n", + " if(didDelete):\n", + " print 'Deleted ' , value \n", + " else:\n", + " print 'Could not delete ',value\n", + " elif choice=='t':\n", + " print 'Enter type 1, 2 or 3: '\n", + " value = int(raw_input())\n", + " theTree.traverse(value)\n", + " else:\n", + " print 'Invalid entry'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Electronic_Devices_/.ipynb_checkpoints/Chapter10-checkpoint.ipynb b/Electronic_Devices_/.ipynb_checkpoints/Chapter10-checkpoint.ipynb new file mode 100644 index 00000000..ad380243 --- /dev/null +++ b/Electronic_Devices_/.ipynb_checkpoints/Chapter10-checkpoint.ipynb @@ -0,0 +1,740 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:46b495ee163997b315e5d2a4308b2429d2950dd9bb4f2a5562e7098cc144cbec" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 10: Amplifier Frequency Response

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.1, Page Number: 311

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "A_p=250.0\n", + "A_p_dB=10*math.log10(A_p)\n", + "print('Power gain(dB) when power gain is 250 = %d'% math.ceil(A_p_dB));\n", + "A_p=100.0\n", + "A_p_dB=10*math.log10(A_p)\n", + "print('Power gain(dB) when power gain is 100 = %d'%A_p_dB)\n", + "A_p=10.0\n", + "A_p_dB=20*math.log10(A_p)\n", + "print('Voltage gain(dB) when Voltage gain is 10 = %d'%A_p_dB)\n", + "A_p=0.50\n", + "A_p_dB=10*math.log10(A_p)\n", + "print('Power gain(dB) when voltage gain is 0.50 = %d'%A_p_dB)\n", + "A_p=0.707\n", + "A_p_dB=20*math.log10(A_p)\n", + "print('Power gain(dB) when power gain is 0.707 = %d'%A_p_dB)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Power gain(dB) when power gain is 250 = 24\n", + "Power gain(dB) when power gain is 100 = 20\n", + "Voltage gain(dB) when Voltage gain is 10 = 20\n", + "Power gain(dB) when voltage gain is 0.50 = -3\n", + "Power gain(dB) when power gain is 0.707 = -3" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.2, Page Number: 313

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "v_out=0.707*10;\n", + "print('output voltage in volts at -3dB gain = %.2f'%v_out)\n", + "#at -6dB voltage gain from table is 0.5\n", + "v_out=0.5*10;\n", + "print('output voltage in volts at -6dB gain = %d'%v_out)\n", + "#at -12dB voltage gain from table is 0.25\n", + "v_out=0.25*10;\n", + "print('output voltage in volts at -12dB gain = %.1f'%v_out)\n", + "#at -24dB voltage gain from table is 0.0625\n", + "v_out=0.0625*10;\n", + "print('output voltage in volts at -24dB gain = %.3f'%v_out)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "output voltage in volts at -3dB gain = 7.07\n", + "output voltage in volts at -6dB gain = 5\n", + "output voltage in volts at -12dB gain = 2.5\n", + "output voltage in volts at -24dB gain = 0.625" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.3, Page Number: 316

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "R_in=1.0*10**3;\n", + "C1=1.0*10**-6;\n", + "A_v_mid=100.0; #mid range voltage gain\n", + "f_c=1/(2*math.pi*R_in*C1);\n", + "#at f_c, capacitive reactance is equal to resistance(X_C1=R_in)\n", + "attenuation=0.707;\n", + "#A_v is gain at lower critical frequency\n", + "A_v=0.707*A_v_mid;\n", + "print('lower critical frequency = %f Hz'%f_c)\n", + "print('attenuation at lower critical frequency =%.3f'%attenuation)\n", + "print('gain at lower critical frequency = %.1f'%A_v)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "lower critical frequency = 159.154943 Hz\n", + "attenuation at lower critical frequency =0.707\n", + "gain at lower critical frequency = 70.7" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.4, Page Number: 317

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "A_v_mid=100.0;\n", + "#At 1Hz frequency,voltage gain is 3 dB less than at midrange. At -3dB, the voltage is reduced by a factor of 0.707\n", + "A_v=0.707*A_v_mid;\n", + "print('actual voltage gain at 1Hz frequency = %.1f'%A_v)\n", + "#At 100Hz frequency,voltage gain is 20 dB less than at critical frequency (f_c ). At -20dB, the voltage is reduced by a factor of 0.1\n", + "A_v=0.1*A_v_mid;\n", + "print('actual voltage gain at 100Hz frequency = %d'%A_v)\n", + "#At 10Hz frequency,voltage gain is 40 dB less than at critical frequency (f_c). At -40dB, the voltage is reduced by a factor of 0.01\n", + "A_v=0.01*A_v_mid;\n", + "print('actual voltage gain at 10Hz frequency = %d'%A_v)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "actual voltage gain at 1Hz frequency = 70.7\n", + "actual voltage gain at 100Hz frequency = 10\n", + "actual voltage gain at 10Hz frequency = 1" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.5, Page Number: 319

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "R_C=10.0*10**3;\n", + "C3=0.1*10**-6;\n", + "R_L=10*10**3;\n", + "A_v_mid=50;\n", + "f_c=1/(2*math.pi*(R_L+R_C)*C3);\n", + "print('lower critical frequency = %f Hz'%f_c)\n", + "#at midrange capacitive reactance is zero\n", + "X_C3=0;\n", + "attenuation=R_L/(R_L+R_C); \n", + "print('attenuation at midrange frequency = %.1f'%attenuation)\n", + "#at critical frequency, capacitive reactance equals total resistance\n", + "X_C3=R_L+R_C;\n", + "attenuation=R_L/(math.sqrt((R_C+R_L)**2+X_C3**2));\n", + "print('attenuation at critical frequency = %f'%attenuation)\n", + "A_v=0.707*A_v_mid;\n", + "print('gain at critical frequency = %.2f'%A_v)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "lower critical frequency = 79.577472 Hz\n", + "attenuation at midrange frequency = 0.5\n", + "attenuation at critical frequency = 0.353553\n", + "gain at critical frequency = 35.35" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.6, Page Number: 321

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "B_ac=100.0;\n", + "r_e=12.0;\n", + "R1=62.0*10**3;\n", + "R2=22.0*10**3;\n", + "R_S=1.0*10**3;\n", + "R_E=1.0*10**3;\n", + "C2=100.0*10**-6;\n", + "#Base circuit impedance= parallel combination of R1, R2, R_S\n", + "R_th=(R1*R2*R_S)/(R1*R2+R2*R_S+R_S*R1);\n", + "#Resistance looking at emitter\n", + "R_in_emitter=r_e+(R_th/B_ac);\n", + "#resistance of equivalent bypass RC is parallel combination of R_E,R_in_emitter\n", + "R=(R_in_emitter*R_E)/(R_E+R_in_emitter);\n", + "f_c=1/(2*math.pi*R*C2);\n", + "print('critical frequency of bypass RC circuit = %f Hz'%f_c)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "critical frequency of bypass RC circuit = 75.893960 Hz" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.7, Page Number:323

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "V_GS=-10.0;\n", + "I_GSS=25.0*10**-9;\n", + "R_G=10.0*10**6;\n", + "C1=0.001*10**-6;\n", + "R_in_gate=abs((V_GS/I_GSS));\n", + "R_in=(R_in_gate*R_G)/(R_G+R_in_gate);\n", + "f_c=1/(2*math.pi*R_in*C1);\n", + "print('critical frequency = %f Hz'%f_c)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "critical frequency = 16.313382 Hz" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.8, Page Number: 324

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "V_GS=-12.0;\n", + "I_GSS=100.0*10**-9;\n", + "R_G=10.0*10**6;\n", + "R_D=10.0*10**3;\n", + "C1=0.001*10**-6;\n", + "C2=0.001*10**-6;\n", + "R_in_gate=abs((V_GS/I_GSS));\n", + "R_in=(R_in_gate*R_G)/(R_G+R_in_gate);\n", + "R_L=R_in; #according to question\n", + "f_c_input=1/(2*math.pi*R_in*C1);\n", + "print('critical frequency of input RC circuit = %f Hz'%f_c_input)\n", + "f_c_output=1/(2*math.pi*(R_D+R_L)*C2)\n", + "print('critical frequency of output RC circuit = %f Hz'%f_c_output)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "critical frequency of input RC circuit = 17.241786 Hz\n", + "critical frequency of output RC circuit = 17.223127 Hz" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.9, Page Number: 327

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "B_ac=100.0;\n", + "r_e=16.0;\n", + "R1=62.0*10**3;\n", + "R2=22.0*10**3;\n", + "R_S=600.0;\n", + "R_E=1.0*10**3;\n", + "R_C=2.2*10**3;\n", + "R_L=10.0*10**3;\n", + "C1=0.1*10**-6;\n", + "C2=10.0*10**-6;\n", + "C3=0.1*10**-6;\n", + "#input RC circuit\n", + "R_in=(B_ac*r_e*R1*R2)/(B_ac*r_e*R1+B_ac*r_e*R2+R1*R2);\n", + "f_c_input=1/(2*math.pi*(R_S+R_in)*C1);\n", + "print('input frequency = %f Hz'%f_c_input)\n", + "#For bypass circuit; Base circuit impedance= parallel combination of R1, R2, R_S\n", + "R_th=(R1*R2*R_S)/(R1*R2+R2*R_S+R_S*R1);\n", + "#Resistance looking at emitter\n", + "R_in_emitter=r_e+(R_th/B_ac);\n", + "#resistance of equivalent bypass RC is parallel combination of R_E,R_in_emitter\n", + "R=(R_in_emitter*R_E)/(R_E+R_in_emitter);\n", + "f_c_bypass=1/(2*math.pi*R*C2);\n", + "print('critical frequency of bypass RC circuit = %f Hz'%f_c_bypass)\n", + "f_c_output=1/(2*math.pi*(R_C+R_L)*C3)\n", + "print('output frequency circuit = %f Hz'%f_c_output)\n", + "R_c=R_C*R_L/(R_C+R_L);\n", + "A_v_mid=R_c/r_e;\n", + "attenuation=R_in/(R_in+R_S);\n", + "A_v=attenuation*A_v_mid; #overall voltage gain\n", + "A_v_mid_dB=20*math.log10(A_v); \n", + "print('overall voltage gain in dB = %f'%A_v_mid_dB)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "input frequency = 773.916632 Hz\n", + "critical frequency of bypass RC circuit = 746.446517 Hz\n", + "output frequency circuit = 130.454871 Hz\n", + "overall voltage gain in dB = 38.042470" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.10, Page Number: 330

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "B_ac=125.0;\n", + "C_be=20.0*10**-12;\n", + "C_bc=2.4*10**-12;\n", + "R1=22.0*10**3;\n", + "R2=4.7*10**3;\n", + "R_E=470.0;\n", + "R_S=600.0;\n", + "R_L=2.2*10**3;\n", + "V_CC=10.0;\n", + "V_B=(R2/(R1+R2))*V_CC;\n", + "V_E=V_B-0.7;\n", + "I_E=V_E/R_E;\n", + "r_e=25.0*10**-3/I_E;\n", + "#total resistance of input circuit is parallel combination of R1,R2,R_s,B_ac*r_e\n", + "R_in_tot=B_ac*r_e*R1*R2*R_S/(B_ac*r_e*R1*R2+B_ac*r_e*R1*R_S+B_ac*r_e*R2*R_S+R1*R2*R_S);\n", + "R_c= 1100.0#R_C*R_L/(R_C+R_L)\n", + "A_v_mid=R_c/r_e;\n", + "C_in_Miller=C_bc*(A_v_mid+1)\n", + "C_in_tot=C_in_Miller+C_be;\n", + "C_in_tot=C_in_tot*10**10\n", + "f_c=1/(2*math.pi*R_in_tot*C_in_tot);\n", + "print('total resistance of circuit = %f Ohm'%R_in_tot)\n", + "print('total capacitance = %f * 10^-10 F'%C_in_tot)\n", + "print('critical frequency = %f Hz'%f_c)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "total resistance of circuit = 377.815676 Ohm\n", + "total capacitance = 2.606290 * 10^-10 F\n", + "critical frequency = 0.000162 Hz" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.11, Page Number: 333

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "C_bc=2.4*10**-12; #from previous question\n", + "A_v=99.0; #from previous question\n", + "R_C=2.2*10**3;\n", + "R_L=2.2*10**3;\n", + "R_c=R_C*R_L/(R_C+R_L);\n", + "C_out_Miller=C_bc*(A_v+1)/A_v;\n", + "f_c=1/(2*math.pi*R_c*C_bc); #C_bc is almost equal to C_in_Miller\n", + "C_out_Miller=C_out_Miller*10**12\n", + "print('equivalent resistance = %d Ohm'%R_c)\n", + "print('equivalent capacitance =%f *10^-12 F'%C_out_Miller)\n", + "print('critical frequency =%f Hz'%f_c)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "equivalent resistance = 1100 Ohm\n", + "equivalent capacitance =2.424242 *10^-12 F\n", + "critical frequency =60285963.292385 Hz" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.12, Page Number: 334

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "C_iss=6.0*10**-12;\n", + "C_rss=2.0*10**-12;\n", + "C_gd=C_rss;\n", + "C_gs=C_iss-C_rss;\n", + "C_gd=C_gd*10**12\n", + "C_gs=C_gs*10**12\n", + "print('gate to drain capacitance = %.1f * 10^-12 F'%C_gd)\n", + "print('gate to source capacitance = %.1f * 10^-12 F'%C_gs)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "gate to drain capacitance = 2.0 * 10^-12 F\n", + "gate to source capacitance = 4.0 * 10^-12 F" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.13, Page Number:335

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "C_iss=8.0*10**-12;\n", + "C_rss=3.0*10**-12;\n", + "g_m=6500.0*10**-6; #in Siemens\n", + "R_D=1.0*10**3;\n", + "R_L=10.0*10**6;\n", + "R_s=50.0;\n", + "C_gd=C_rss;\n", + "C_gs=C_iss-C_rss;\n", + "R_d=R_D*R_L/(R_D+R_L);\n", + "A_v=g_m*R_d;\n", + "C_in_Miller=C_gd*(A_v+1);\n", + "C_in_tot=C_in_Miller+C_gs;\n", + "f_c=1/(2*math.pi*C_in_tot*R_s);\n", + "print('critical frequency of input RC circuit =%.3f *10^8 Hz'%(f_c*10**-8))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "critical frequency of input RC circuit =1.158 *10^8 Hz" + ] + } + ], + "prompt_number": 31 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.14, Page Number: 336

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "C_gd=3.0*10**-12; #from previous question\n", + "A_v=6.5; #from previous question\n", + "R_d=1.0*10**3; #from previous question\n", + "C_out_Miller=C_gd*(A_v+1)/A_v;\n", + "f_c=1/(2*math.pi*R_d*C_out_Miller);\n", + "print('critical frequency of the output circuit = %d Hz'%f_c)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "critical frequency of the output circuit = 45978094 Hz" + ] + } + ], + "prompt_number": 32 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.15, Page Number: 339

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "f_cu=2000.0;\n", + "f_cl=200.0;\n", + "BW=f_cu-f_cl;\n", + "print('bandwidth = %d Hz'%BW)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "bandwidth = 1800 Hz" + ] + } + ], + "prompt_number": 33 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.16, Page Number: 340

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "f_T=175.0*10**6; #in hertz\n", + "A_v_mid=50.0;\n", + "BW=f_T/A_v_mid;\n", + "print('bandwidth = %d Hz'%BW)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "bandwidth = 3500000 Hz" + ] + } + ], + "prompt_number": 34 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.17, Page Number: 341

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "f_cl=1.0*10**3; #lower critical frequency of 2nd stage in hertz\n", + "f_cu=100.0*10**3; #upper critical frequency of 1st stage in hertz\n", + "BW=f_cu-f_cl;\n", + "print('bandwidth = %d Hz'%BW)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "bandwidth = 99000 Hz" + ] + } + ], + "prompt_number": 35 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.18, Page Number: 341

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "n=2.0; #n is the number of stages of amplifier\n", + "f_cl=500.0;\n", + "f_cu=80.0*10**3;\n", + "f_cl_new=f_cl/(math.sqrt(2**(1/n)-1));\n", + "f_cu_new=f_cu*(math.sqrt(2**(1/n)-1));\n", + "BW=f_cu_new-f_cl_new;\n", + "print('bandwidth = %f Hz'%BW)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "bandwidth = 50710.653245 Hz" + ] + } + ], + "prompt_number": 36 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Electronic_Devices_/.ipynb_checkpoints/Chapter17-checkpoint.ipynb b/Electronic_Devices_/.ipynb_checkpoints/Chapter17-checkpoint.ipynb new file mode 100644 index 00000000..a95b29db --- /dev/null +++ b/Electronic_Devices_/.ipynb_checkpoints/Chapter17-checkpoint.ipynb @@ -0,0 +1,336 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:dca2eb0dc5462992ceade27e53e297f6073a62b5b813c53a51758356342ce482" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 17: Voltage Regulators

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 17.1, Page Number:552

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "%pylab inline" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\n", + "For more information, type 'help(pylab)'." + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#variable declaration\n", + "Del_V_out=0.25;\n", + "V_out=15;\n", + "Del_V_in=5; #All voltages in Volts\n", + "\n", + "#Calculations\n", + "line_regulation=((Del_V_out/V_out)/Del_V_in)*100;\n", + "\n", + "#Result\n", + "print('line regulation in %%V is %f' %line_regulation)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "line regulation in %V is 0.333333" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 17.2, Page Number: 553

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable Declaration\n", + "V_NL=12.0; #No load output voltage in Volts\n", + "V_FL=11.9; #Full load output voltage in Volts\n", + "I_F=10.0; #Full load current in milli-Amperes\n", + "\n", + "#Calculations\n", + "load_regulation=((V_NL-V_FL)/V_FL)*100;\n", + "load_reg=load_regulation/I_F;\n", + "\n", + "#Result\n", + "print('load regulation as percentage change from no load to full load = %f'%load_regulation)\n", + "print('\\nload regulation as percentage change per milliampere = %f' %load_reg)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "load regulation as percentage change from no load to full load = 0.840336\n", + "\n", + "load regulation as percentage change per milliampere = 0.084034" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 17.3, Page Number: 556

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "V_REF=5.1 #Zener voltage in volts\n", + "R2=10*10**3;\n", + "R3=10*10**3; #resistances in ohm\n", + "V_out=(1+(R2/R3))*V_REF;\n", + "print('output voltage in volts = %.1f'%V_out)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "output voltage in volts = 10.2" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 17.4, Page Number: 557

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "R4=1; #Resistance in Ohms\n", + "I_L_max=0.7/R4;\n", + "print('maximum current provided to load(in amperes) = %.1f'%I_L_max)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "maximum current provided to load(in amperes) = 0.7" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 17.5, Page Number: 560

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "V_IN=12.5; #maximum input voltage in volts\n", + "R1=22; #In Ohms\n", + "\n", + "V_OUT=0;\n", + "V_R1=V_IN-V_OUT; #Voltage across R1\n", + "P_R1=(V_R1*V_R1)/R1; #maximum power dissipated by R1\n", + "print('maximum power dissipated by R1 in WATTS = %f'%P_R1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "maximum power dissipated by R1 in WATTS = 7.102273" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 17.6, Page Number: 569

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print('SAME AS EX-2.8 in CHAPTER-2')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "SAME AS EX-2.8 in CHAPTER-2" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 17.7, Page Number: 572

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "I_max=700*10**-3; #in Amperes\n", + "R_ext=0.7/I_max;\n", + "print('value of resistor in Ohms for which max current is 700mA = %f'%R_ext)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "value of resistor in Ohms for which max current is 700mA = 1.000000" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 17.8, Page Number: 572

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "V_OUT=24.0; #Output voltage in Volts\n", + "R_L=10.0; #Load resistance in Ohms\n", + "V_IN=30.0; #Input voltage in Volts\n", + "I_max=700.0*10**-3; #maximum interal current in Amperes\n", + "I_L=V_OUT/R_L; #load current in amperes\n", + "I_ext=I_L-I_max; #current through the external pass transistor in Amperes\n", + "P_ext_Qext=I_ext*(V_IN-V_OUT); #power dissipated\n", + "print('power dissiated(in WATTS) by the external pass transistor = %.1f'%P_ext_Qext)\n", + "print('\\nFor safety purpose, we choose a power transistor with rating more than this, say 15W')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "power dissiated(in WATTS) by the external pass transistor = 10.2\n", + "\n", + "For safety purpose, we choose a power transistor with rating more than this, say 15W" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 17.9, Page Number: 574

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "V_out=5.0; #7805 gives output voltage of 5V\n", + "I_L=1.0; #constant current of 1A\n", + "R1=V_out/I_L;\n", + "print('The value of current-setting resistor in ohms = %d'%R1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of current-setting resistor in ohms = 5" + ] + } + ], + "prompt_number": 10 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Electronic_Devices_/.ipynb_checkpoints/Chapter2-checkpoint.ipynb b/Electronic_Devices_/.ipynb_checkpoints/Chapter2-checkpoint.ipynb new file mode 100644 index 00000000..3934869f --- /dev/null +++ b/Electronic_Devices_/.ipynb_checkpoints/Chapter2-checkpoint.ipynb @@ -0,0 +1,629 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:d0aa9e80db4a8882af89cf646425004e4e19d2bf8cf22acae2943bf211cb0ab1" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 2: Diode Application

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.1, Page Number: 46

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "%pylab inline" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\n", + "For more information, type 'help(pylab)'." + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# variable declaration\n", + "V_p=50; #Peak value is 50V\n", + "\n", + "#calculation\n", + "V_avg=V_p/math.pi;\n", + "\n", + "#result\n", + "print \"average value of half wave rectifier = %.2f volts\" %V_avg" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "average value of half wave rectifier = 15.92 volts" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.2(a), Page Number: 46

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "\n", + "f=1; #frequency\n", + "V_p_in=5; #peak input\n", + "\n", + "#calculation\n", + "V_pout=V_p_in-0.7; #output voltage\n", + "t_d=(math.asin(0.7/V_p_in))/(2*math.pi*f);\n", + "\n", + "#result\n", + "print \"half wave rectifier output = %.2f volts\" %V_pout;" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "half wave rectifier output = 4.30 volts" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.2(b), Page Number: 46

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "\n", + "f=1; #frequency\n", + "T=1/f; #time period\n", + "V_p_in=100; #peak input voltage\n", + "\n", + "#calculation\n", + "V_pout=(V_p_in-0.7); #peak output \n", + "t_d=(math.asin(0.7/V_p_in))/(2*math.pi*f) \n", + "\n", + "#result\n", + "print \"output of half wave rectifier = %.2f volts\" %V_pout" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "output of half wave rectifier = 99.30 volts" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.3, Page Number: 48

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# variable declaration\n", + "V_p_in=156; #Peak input voltage\n", + "V_p_pri=156; #Peak voltage of primary of transformer\n", + "n=0.5; #Turn ratio is 2:1\n", + "\n", + "#calculation\n", + "V_p_sec=n*V_p_pri;\n", + "V_p_out=(V_p_sec-0.7); #Peak output voltage\n", + "\n", + "#result\n", + "print \"peak output voltage of half wave rectifier = %.1f volts\" %V_p_out" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "peak output voltage of half wave rectifier = 77.3 volts" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.4, Page Number: 49

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# variable declaration\n", + "V_p=15; #Peak voltage in volt\n", + "\n", + "#calculation\n", + "V_avg=(2*V_p)/math.pi;\n", + "\n", + "#result\n", + "print \"Average value of output of full wave rectifier = %.2f volts\" %V_avg" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Average value of output of full wave rectifier = 9.55 volts" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.5, Page Number: 52

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "V_p_pri=100.0; #Peak voltage across primary winding\n", + "n=1.0/2; #tun ratio is 2:1\n", + "V_p_sec=n*V_p_pri;\n", + "V_sec=V_p_sec/2; #voltage across each secondary is half the total voltage\n", + "V_pout=V_sec-0.7;\n", + "\n", + "print('full wave rectifier output voltage = %f V'%V_pout)\n", + "PIV=2*V_pout+0.7;\n", + "print('PIV = %fV'%PIV)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "full wave rectifier output voltage = 24.300000 V\n", + "PIV = 49.300000V" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.6, Page Number: 54

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# variable declaration\n", + "V_rms=12.0; #rms secondary voltage\n", + "\n", + "#calculation\n", + "V_p_sec=math.sqrt(2)*V_rms; #peak secondary voltage\n", + "V_th=0.7; #knee voltage of diode\n", + "V_p_out=V_p_sec-2*V_th; #in one cycle, 2 diodes conduct\n", + "PIV=V_p_out+V_th; #applying KVL\n", + "\n", + "#result\n", + "print \"Peak output voltage = %.2f volt\" %V_p_out\n", + "print \"PIV across each diode = %.2f volt\" %PIV" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Peak output voltage = 15.57 volt\n", + "PIV across each diode = 16.27 volt" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.7, Page Number: 58

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# variable declaration\n", + "R_l=2200; #load resistance in Ohm\n", + "C=50*10**-6; #capacitance in Farad\n", + "V_rms=115; #rms of primary\n", + "\n", + "#calculation\n", + "V_p_pri=math.sqrt(2)*V_rms; #peak voltage across primary\n", + "n=0.1; #turn ratio is 10:1\n", + "V_p_sec=n*V_p_pri; #primary voltage across secondary\n", + "V_p_rect=V_p_sec-1.4 #unfiltered peak rectified voltage\n", + "#we subtract 1.4 because in each cycle 2 diodes conduct & 2 do not\n", + "f=120; #frequency of full wave rectified voltage\n", + "V_r_pp=(1/(f*R_l*C))*V_p_rect; #peak to peak ripple voltage\n", + "V_DC=(1-(1/(2*f*R_l*C)))*V_p_rect;\n", + "r=V_r_pp/V_DC;\n", + "\n", + "#result\n", + "print \"Ripple factor = %.3f \" %r" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Ripple factor = 0.079 " + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.8, Page Number: 62

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# variable declaration\n", + "V_REF=1.25; #in volts\n", + "V_R1=V_REF; #voltage in volt\n", + "R1=220.0; #in ohms\n", + "I_ADJ=50*10**-6 #in amperes\n", + "\n", + "#calculation\n", + "# MAX VALUE OF R2=5000 Ohms\n", + "R2_min=0.0; #min resistance\n", + "V_out_min=V_REF*(1+(R2_min/R1))+I_ADJ*R2_min;\n", + "R2_max=5000.0; #max value of resistance\n", + "V_out_max=V_REF*(1+(R2_max/R1))+I_ADJ*R2_max;\n", + "\n", + "#result\n", + "print \"minimum output voltage = %.2f volt\" %V_out_min\n", + "print \"maximum output voltage = %.2f volt\" %V_out_max" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "minimum output voltage = 1.25 volt\n", + "maximum output voltage = 29.91 volt" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.9,Page Number: 64

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "V_NL=5.18 #No load output voltage\n", + "V_FL=5.15 #Full load output voltage\n", + "load_reg=((V_NL-V_FL)/V_FL)*100 #In percentage\n", + "print('load regulation percent = %.2f%% '%load_reg)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "load regulation percent = 0.58% " + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.10, Page Number: 66

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import pylab as py\n", + "import numpy as np\n", + "\n", + "#let input wave be V_in=V_p_in*sin(2*%pi*f*t) \n", + "f=1.0; #Frequency is 1Hz\n", + "T=1/f;\n", + "R_1=100.0; #Resistances in ohms\n", + "R_L=1000.0; #Load\n", + "V_p_in=10.0; #Peak input voltage\n", + "V_th=0.7; #knee voltage of diode\n", + "\n", + "V_p_out=V_p_in*(R_L/(R_L+R_1)); #peak output voltage\n", + "print('peak output voltage = %.2f V'%V_p_out)\n", + "\n", + "t = np.arange(0, 3.5 , 0.0005)\n", + "z=V_p_in*np.sin(2*np.pi*f*t)*(R_L/(R_L+R_1))\n", + "\n", + "subplot(211)\n", + "plot(t,z)\n", + "ylim(-9.09,9.09)\n", + "title('Input Voltage Waveform')\n", + "\n", + "subplot(212)\n", + "plot(t,z)\n", + "ylim(-0.07,9.09)\n", + "title('Output Voltage Waveform')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "peak output voltage = 9.09 V" + ] + }, + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 12, + "text": [ + "" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAXUAAAEICAYAAACgQWTXAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJztnXl4TNcbx78TiSWWiC1kIYgtliSEoEJCa21SlFoqYqvu\npTtKaavtT1vVhaou9tpVaZFaakpjJ4RErImEBIkQ2cgy5/fHa0YSk2Qy9965986cz/N4Hpm5c86b\nd06+973vOec9GsYYA4fD4XCsAju5DeBwOByOeHBR53A4HCuCizqHw+FYEVzUORwOx4rgos7hcDhW\nBBd1DofDsSK4qHMUj1arhYeHh9xmKIbc3FyEhISgdu3aGDFihNzmcBQGF3Urx9PTE3v37pW8nzlz\n5iAsLKzU9/v374/Zs2c/9vrWrVvRqFEj6HQ6k/vy9PTEP//8Y5adQli7di28vb2LvfbUU08ZfW3e\nvHmS2bFp0ybcunUL6enpWL9+vWT9cNQJF3UrR6PRQKPRyG0Gxo0bh9WrVz/2+qpVqzBmzBjY2Zk+\nFDUaDeTYM9ezZ0/ExcXh9u3bAICCggKcPn0a9+/fR1pamuG1w4cPo1evXpLZcfXqVbRs2bJCPtNT\nUFAggUUcRcE4Vo2npyfbu3cvY4yxZcuWsSeeeIK98847zNnZmTVt2pTt3LnTcG2vXr3YtGnTWJcu\nXVitWrXYM888w9LT0xljjO3bt4+5u7sXa7tJkyZsz549bOfOnaxy5crMwcGB1ahRg/n6+j5mR05O\nDnNycmL79+83vJaens6qVq3KoqOj2f3799mUKVOYq6src3V1ZVOnTmUPHjx4rO8xY8YwOzs7Vq1a\nNVajRg325ZdfMsYYGzZsGGvYsCFzcnJiPXv2ZDExMYZ+0tLS2NNPP81q1arFOnfuzD744APWo0cP\nw/vnzp1jTz75JKtTpw5r1aoV27BhQ6n+bN68Odu8eTNjjLEjR46w4OBgNm7cuGKvOTo6soKCAvbX\nX38xX19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ozw6lTp5CRkYF+/fpBq9U+tmtdyb4vz35z/C84\nUjdlE1LJa65duwY3NzehXYuCKfbXrFnT8Jg0YMAA5OfnI10lRWGU7HtTUIPv8/Pz8eyzz2LMmDEY\nPHjwY+8r+Tsoz3Y1+B8AnJycMGjQIBw/frzY60r2fVFKs98c/wsWdVM2IYWGhmLlypUAgMOHD6N2\n7dpwcXER2rUomGL/zZs3DXf7o0ePgjFmNPelRJTse1NQuu8ZY5g4cSK8vb0xdepUo9co9TswxXYl\n+z8tLQ13794FAOTm5mL37t3w8/Mrdo1SfQ+YZr85/hecfiltE9KSJUsAAC+++CIGDhyIHTt2wMvL\nC9WrV8eyZcuEdisapti/adMmLF68GPb29nB0dMS6detktvoRo0aNwr///ou0tDR4eHjgo48+Qv7D\nE7OV7nugfPuV7HsAiIyMxOrVq9GhQwfDH+Rnn32GxMREAMr+DkyxXcn+T0lJQXh4OHQ6HXQ6HcLC\nwtCnTx/VaI8p9pvjf775iMPhcKwIyY+z43A4HI7l4KLO4XA4VgQXdQ6Hw7EiuKhzOByOFcFFncPh\ncKwILuocDodjRfwfUaYhEUjyJ+wAAAAASUVORK5CYII=\n" + } + ], + "prompt_number": 12 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.11, Page Number: 67

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#from pylab import figure, show\n", + "#from numpy import arange, sin, pi,bool\n", + "#import numpy as np\n", + "import pylab as py\n", + "import numpy as np\n", + "#let input wave be V_in=V_p_in*sin(2*%pi*f*t) \n", + "f=1.0; #Frequency is 1Hz\n", + "T=1/f;\n", + "V_p_in=10; #Peak input voltage\n", + "V_th=0.7; #knee voltage of diode\n", + "print('max output voltage is 5.7V')\n", + "print('min output voltage is -5.7V')\n", + "\n", + "###############GRAPH Plotting#################################\n", + "t = arange(0.0,4.5,0.0005)\n", + "V_in=V_p_in*sin(2*pi*f*t);\n", + "\n", + "Vout=V_in;\n", + "#fig = figure(2)\n", + "subplot(211)\n", + "plot(t,V_in)\n", + "#ax2.grid(True)\n", + "ylim( (-10,10) )\n", + "title('Input to the +ve and -ve diode limiter ')\n", + "subplot(212)\n", + "plot(t,V_in)\n", + "#ax1.grid(True)\n", + "ylim( (-5.7,5.7) )\n", + "title('Output of +ve and -ve diode limiter')\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "max output voltage is 5.7V\n", + "min output voltage is -5.7V" + ] + }, + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 13, + "text": [ + "" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAXsAAAEICAYAAAC+iFRkAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzsnXlYldX2x7+HQQFBZJBZZlBBRcxEUxI0BxxKsxRNzbK5\nvJm3uln5E7uledUGs8G6XdHMuUFTwhGcUKkky1lGmcUEZZLhnP37Y3eODOfAyznvsN/j+3keHuWc\n9+y9zmLt9a537b3XVhFCCBQUFBQUzBoLqQVQUFBQUBAexdkrKCgo3AUozl5BQUHhLkBx9goKCgp3\nAYqzV1BQULgLUJy9goKCwl2A4uwVOJOamooePXpILQYTzJkzB4sWLZJaDMTExODrr78GAHz77bcY\nM2aMUe0kJCRg1qxZRn3W398fhw4dAgAsXboUTz/9tFHtmCK/Qvsozp5n/P39cfDgQcH74TI4mw5C\nY7CwsEB2drbRnzdnVCoVVCqV1GI0k+Oxxx7D3r17jW7HFBm0vPnmm/jqq6+Maqel/Ir98Yvi7HmG\nFScAUFlM3TMn1p47Cwv5maKyH1F4jNVxY2Mjz5LIH/mNMBmRmJiIYcOG4bXXXoOzszMCAwORnJys\nez8mJgYLFy5EVFQUHB0dMWnSJJSXlwPQnzLRPjUkJydj2bJl2Lp1KxwcHBAZGdmq71mzZuHq1auY\nOHEiHBwcsHLlSgDArl27EB4eDicnJ8TGxu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4+PigsLGz3moKCAkllUqlUSEtLQ0REBMaNG4fz588LJg8XxNYRV6TWU25u\nLjIyMhAVFdXsdSn1ZUgmKXSl0WjQv39/uLu7IzY2FmFhYc3el0JP7ckkhZ5eeeUVrFixAhYGTi+R\nQk/tyWSMnpg4g7blHUrITVdc2h4wYADy8/Nx5swZzJs3D5MmTRJMHq6IqSOuSKmnqqoqPPLII/j4\n449hb2/f6n0p9NWWTFLoysLCAr///jsKCgpw5MgRvbVexNZTezKJrafdu3fDzc0NkZGRbUbKYuqJ\ni0zG6ElQZ+/t7Y38/Hzd7/n5+fBpcdBjy2sKCgrg7e0tqUwODg66x824uDg0NDTgxo0bgsnUHmLr\niCtS6amhoQFTpkzBzJkz9Rq5FPpqTyYpbcrR0RHjx4/Hr7/+2ux1Ke3KkExi6yktLQ27du1CQEAA\npk+fjkOHDmH27NnNrhFbT1xkMkpPxk8ftE9DQwMJDAwkOTk5pK6urt0J2hMnTgg++cFFppKSEqLR\naAghhJw6dYr4+fkJKhMhhOTk5HCaoBVDR1zlkkJPGo2GzJo1i8yfP9/gNWLri4tMYuuqrKyMlJeX\nE0IIqampIdHR0eTAgQPNrhFbT1xkksKmtKSmppIJEya0el3K8WdIJmP0JGi5BCsrK6xZswZjxoyB\nWq3G3Llz0bt3b6xduxYA8Oyzz2LcuHFISkpCcHAwunTpgnXr1gkpEieZduzYgc8//xxWVlaws7PD\nli1bBJVp+vTpOHz4MK5fv44ePXpgyZIlaGho0Mkjto64yiW2ngDg+PHj2LhxI/r164fIyEgAwNKl\nS3H16lWdXGLri4tMYuuquLgYj/9/O3dsAkAMQgHU3ZwjZP8l5KqDlOGKs/C9CUSSXwi6d1RVVFWs\ntSIzW//eTU0db+r0jmc6+3RT05c+tRxCA+BfNmgBBhD2AAMIe4ABhD3AAMIeYABhDzDAAwJBIdo4\nx/PeAAAAAElFTkSuQmCC\n" + } + ], + "prompt_number": 13 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.12, Page Number: 76

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#variable declaration\n", + "V_p_in=18.0; #peak input voltage is 18V\n", + "V_supply=12.0;\n", + "R2=100.0;\n", + "R3=220.0; #resistances in ohms\n", + "#calculation\n", + "V_bias=V_supply*(R3/(R2+R3));\n", + "\n", + "#result\n", + "print('diode limiting the voltage at this voltage =%fV'%V_bias)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "diode limiting the voltage at this voltage =8.250000V" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.13, Page Number: 78

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "V_p_in=24.0;\n", + "V_DC=-(V_p_in-0.7); #DC level added to output\n", + "print('V_DC = %.1fV'%V_DC)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "V_DC = -23.3V" + ] + } + ], + "prompt_number": 15 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Elements_Of_Mass_Transfer_Part_1/.ipynb_checkpoints/ch2-checkpoint.ipynb b/Elements_Of_Mass_Transfer_Part_1/.ipynb_checkpoints/ch2-checkpoint.ipynb new file mode 100644 index 00000000..e773ceb5 --- /dev/null +++ b/Elements_Of_Mass_Transfer_Part_1/.ipynb_checkpoints/ch2-checkpoint.ipynb @@ -0,0 +1,1584 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:05dd7d031d8f8235fad8f9f829266696c5bc621c67edd6565f3609ff957ed749" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 2 : Diffusion" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.1.a,page no:20 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# variable declaration \n", + "rA=.3798;\n", + "rB=.3941;\n", + "\n", + "# Calculation\n", + "rAB=(rA+rB)/2; #molecular seperation at collision \n", + "ebyk_A=71.4;\n", + "ebyk_B=195.2;\n", + "ebyk_AB=(ebyk_A/ebyk_B)**.5; #energy of molecular attraction\n", + "pt=1.013*10**5; #absolute total pressure in pascal\n", + "T=298; #absolute temperature in kelvin\n", + "s=T/ebyk_AB; #collision function\n", + " #from chart f(T/ebyk_AB) = 0.5 let it be = x\n", + "x=.5; #collision function\n", + "MA=28; #molecular weight of nitrogen\n", + "MB=44; #molecular weight of carbondioxide\n", + "Mnew=((1./MA)+(1./MB))**.5;\n", + "Dab= 10**-4*(1.084-.249*(Mnew))*T**1.5*((Mnew))/(pt*x*rAB**2);\n", + "\n", + "# Result\n", + "print \" the diffisivity of nitrogen-carbondioxide is :%f *10**-5 m**2/s\"%(Dab/10**-5)\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " the diffisivity of nitrogen-carbondioxide is :1.678856 *10**-5 m**2/s\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.1.b,page no:21 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "#\"part(ii)\"\n", + "rA=.3339;\n", + "rB=.3711;\n", + "\n", + "# Calculation \n", + "\n", + "rAB=(rA+rB)/2; #molecular seperation at collision \n", + "ebyk_A=344.7;\n", + "ebyk_B=78.6;\n", + "ebyk_AB=(ebyk_A/ebyk_B)**.5; #energy of molecular attraction\n", + "pt=200.*10**3; #absolute total pressure in pascal\n", + "T=298.; #absolute temperature in kelvin\n", + "s=T/ebyk_AB; #collision function\n", + " #from chart f(T/ebyk_AB) = 0.62 let it be = x\n", + "x=0.62; #collision function\n", + "MA=36.5; #molecular weight of hydrogen chloride\n", + "MB=29; #molecular weight of air\n", + "Mnew=((1./MA)+(1./MB))**.5;\n", + "Dab=10.**-4*(1.084-.249*(Mnew))*T**1.5*((Mnew))/(pt*x*rAB**2);\n", + "\n", + " # Result\n", + "print \"\\n the diffisivity of hydrogen chloride-air is :%f *10**-6 m**2/s\"%(Dab/10**-6)\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the diffisivity of hydrogen chloride-air is :8.488596 *10**-6 m**2/s\n" + ] + } + ], + "prompt_number": 31 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.2 ,page no:23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "# variable declaration \n", + "\n", + "u=1.145*10**-3; #viscosity of water1.145cp\n", + "v_a=5*.0148+12*.0037+1*.0074; #by kopp's law\n", + "t=288; #temperature of water in kelvin\n", + "MB=18; #molecular weight of water\n", + "phi=2.26; #association parameter for solvent-water\n", + "\n", + "# Calculation\n", + "D_ab=(117.3*10**-18)*((phi*MB)**.5)*(t)/(u*(v_a)**.6);\n", + "\n", + " # Result\n", + "print \"\\n the diffusivity of isoamyl alcohol is :%f *10**-9 m**2/s\"%(D_ab/10**-9)\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the diffusivity of isoamyl alcohol is :0.652780 *10**-9 m**2/s\n" + ] + } + ], + "prompt_number": 32 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.3,page no:24 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "pa1=(33./760)*1.013*10**5; #vapour pressure of ccl4 at 273 in pascal\n", + "pa2=0;\n", + "d=1.59; \n", + "import math #density of liquid ccl4 in g/cm**3\n", + "#considering o2 to be non diffusing and with \n", + "T=273.; #temperature in kelvin\n", + "pt=(755./780)*1.013*10**5; #total pressure in pascal\n", + "z=.171; #thickness of film\n", + "a=.82*10**-4; #cross-sectional area of cell in m**2\n", + "v=.0208; #volume of ccl4 evaporated \n", + "t=10.; #time of evaporation\n", + "MB=154.; \n", + "\n", + "# Calculation\n", + "#molecular wght of ccl4\n", + "rate=v*d/(MB*t); #.0208cc of ccl4 is evaporating in 10hrs \n", + "Na=rate*10.**-3/(3600.*a); #flux in kmol/m**2*S\n", + "\n", + "D_ab=Na*z*8314*273./(pt*(math.log((pt-pa2)/(pt-pa1)))); #molecular diffusivity in m**2/s\n", + "\n", + " # Result\n", + "print \"the diffusivity of ccl4 through oxygen:%.2f *10**-6 m**2/s\"%(D_ab/10.**-6)\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the diffusivity of ccl4 through oxygen:6.27 *10**-6 m**2/s\n" + ] + } + ], + "prompt_number": 33 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.4 ,page no:25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "z=.0305*10**-3; #wall thickness sorrounding the crystal\n", + "x1=0.0229;\n", + "w1=160.; #molecular weight of copper sulphate\n", + "w2=18.; #molecular weight of water\n", + "Dab=7.29*10**-10; #diffusivity of copper sulphatein m**2/s\n", + " #av=d/m\n", + " \n", + "# Calculation \n", + "Mavg=x1*w1+(1-x1)*w2; #average molecular wght of solution\n", + "d1=1193; #density of copper sulphate solution\n", + "av1=d1/Mavg; #value of (d/m) of copper solution\n", + "\n", + " #for pure water\n", + "d2=1000.; #density of water\n", + "m2=18.; #molecular wght of water\n", + "av2=d2/m2; #value of (d/m) of water\n", + "allavg=(av1+av2)/2.; #average value of d/m\n", + "xa2=0;\n", + "import math\n", + "\n", + "# Result\n", + "Na=Dab*(allavg)*math.log((1-xa2)/(1-x1))/z; #flux of cuso4 from crystal surface to bulk solution\n", + "print \" the rate at which crystal dissolves :%f *10**-5 kmol/m**2*s\"%(Na/10**-5)\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " the rate at which crystal dissolves :3.092260 *10**-5 kmol/m**2*s\n" + ] + } + ], + "prompt_number": 34 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.5.a,page no:25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "ya1=0.8;\n", + "ya2=0.1;\n", + "T=(273+35); #temperature in kelvin\n", + "pt=1*1.013*10**5; #total pressure in pascal\n", + "z=0.3*10**-3; #gas film thickness in m\n", + "Dab=.18*10**-4; #diffusion coefficient in m**2/s\n", + "R=8314; #universal gas constant\n", + "\n", + "# Calculation\n", + "Na=Dab*pt*(ya1-ya2)/(z*R*T) #diffusion flux in kmol/m**2*s\n", + "rate=Na*100*10**-4*3600*46; #since molecular weight of mixture is 46\n", + "\n", + "# Result\n", + "print \"\\n rate of diffusion of alcohol-water vapour :%f kg/hr \"%rate\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " rate of diffusion of alcohol-water vapour :2.751429 kg/hr \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.5.b,page no:26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "ya1=0.8;\n", + "ya2=0.1;\n", + "T=(273+35); #temperature in kelvin\n", + "pt=1*1.013*10**5; #total pressure in pascal\n", + "z=0.3*10**-3; #gas film thickness in m\n", + "Dab=.18*10**-4; #diffusion coefficient in m**2/s\n", + "R=8314; #universal gas constant\n", + "import math\n", + "#diffusion through stagnant film \n", + "\n", + "# Calculation\n", + "Na=Dab*pt*math.log((1-ya2)/(1-ya1))/(z*R*T); #diffusion flux in kmol/m**2*s\n", + "rate=Na*100*10**-4*3600*46; #since molecular weight of mixture is 46\n", + "\n", + "# Result\n", + "print \"\\n rate of diffusion if water layer is stagnant :%f *10**-3 kg/s \"%(rate/(3600*10**-3))\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " rate of diffusion if water layer is stagnant :1.642207 *10**-3 kg/s \n" + ] + } + ], + "prompt_number": 35 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.6,page no:27 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T=298.; #temperature in kelvin\n", + "pt=1.*1.013*10**5; #total pressure in pascal\n", + "ID=25.*10**-3; #internal diameter in m of unvulcanised rubber in m\n", + "OD=50.*10**-3; #internal diameter in m of unvulcanised rubber in m\n", + "Ca1=2.37*10**-3; #conc. of hydrogen at the inner surface of the pipe in kmol/m**3\n", + "Ca2=0; #conc. of hydrogen at 2\n", + "Dab=1.8*10**-10; #diffusion coefficient in cm**2/s\n", + "l=2; #length of pipe in m\n", + "import math\n", + "\n", + "# Calculation \n", + "# Va=Da*Sa*(pa1-pa2)/z;\n", + "z=(50-25)*10**-3/2.; #wall thickness in m\n", + "Va=Dab*(Ca1-Ca2)/z; #diffusion through a flat slab of thickness z \n", + "Sa=2*3.14*l*(OD-ID)/(2*math.log(OD/ID)); #average mass transfer area of \n", + "rate=Va*Sa; #rate of loss of hydrogen by diffusion\n", + "\n", + "\n", + "# Result\n", + "\n", + "print \"\\n rate of loss hydrogen by diffusion through a pipe of 2m length :%f*10**-12kmol/s\"%(rate/10.**-12)\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " rate of loss hydrogen by diffusion through a pipe of 2m length :7.730099*10**-12kmol/s\n" + ] + } + ], + "prompt_number": 36 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.7 ,page no:28" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "pa1=(1.5)*10**4; #vapour pressure of ammonia at pt.1 \n", + "pa2=(0.5)*10**4; #vapour pressure of ammonia at pt.2\n", + "Dab=2.3*10**-5 #molecular diffusivity in m**2/s\n", + "z=0.15; #diffusion path in m\n", + "R=8314.; #universal gas constant \n", + " #ammonia diffuses through nitrogen under equimolar counter diffusion\n", + "T=298.; #temperature in kelvin\n", + "pt=1.013*10**5; #total pressure in pascal\n", + "\n", + "# Calculation\n", + "Na=Dab*(pa1-pa2)/(z*R*T); #flux in kmol/m**2*S\n", + "\n", + "# Result\n", + "print \"the ammonia diffusion through nitrogen under equimolar \\\n", + " counter diffusion:%f *10**-7 kmol/m**2*s\"%(Na/10**-7);\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the ammonia diffusion through nitrogen under equimolar counter diffusion:6.188855 *10**-7 kmol/m**2*s\n" + ] + } + ], + "prompt_number": 37 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.8,page no:29" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + " \n", + "\n", + "z=0.4*10**-2; #film thickness sorrounding the crystal\n", + "xa1=0.0453; #mole fraction of ethanol at pos.2\n", + "xa2=0.02775; #mole fraction of ethanol at pos.1\n", + "w1=46; #molecular weight of ethanol\n", + "w2=18; #molecular weight of water\n", + "Dab=74*10**-5*10**-4; #diffusivity of ethanol water sol.in m**2/s\n", + " #av=d/m\n", + " \n", + "# Calculation \n", + "Mavg1=xa2*w1+(1-xa2)*w2; #average molecular wght of solution at pos 1\n", + "d1=0.9881*10**3; # density of 6.8 wt% solution\n", + "av1=d1/Mavg1; #value of (d/m) of copper solution\n", + "\n", + " #for pure water\n", + "d2=972.8; # density of 10.8 wt% solution\n", + "Mavg2=xa1*w1+(1-xa1)*w2; #average molecular wght of solution at pos.2\n", + "av2=d2/Mavg2; #value of (d/m) of water\n", + "\n", + "allavg=(av1+av2)/2; #average value of d/m\n", + "Na=Dab*(allavg)*math.log((1-xa2)/(1-xa1))/z; #steady state flux in kmol/m**2*s of ethanol water sol.\n", + "\n", + " # Result\n", + "print \"\\n the rate at which crystal dissolves :%f *10**-5 kmol/m**2*s\"%(Na/10**-5)\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the rate at which crystal dissolves :1.737360 *10**-5 kmol/m**2*s\n" + ] + } + ], + "prompt_number": 39 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.9,page no:30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "# variable declaration \n", + "\n", + " #basis : 100kg of mixture\n", + "z=2*10**-3; #film thickness sorrounding the water\n", + "xa1=0.0323; #mole fraction of ethanol at pos.2\n", + "xa2=0.0124; #mole fraction of ethanol at pos.1\n", + "w1=60.; #molecular weight of acetic acid\n", + "w2=18.; #molecular weight of water\n", + "Dab=0.000095; #diffusivity of acetic water sol.in m**2/s\n", + " #av=d/m\n", + "# Calculation \n", + "Mavg1=xa1*w1+(1-xa1)*w2; #average molecular wght of solution at pos 1\n", + "d1=1013.; # density of 10 % acid\n", + "av1=d1/Mavg1; #value of (d/m) of copper solution\n", + "\n", + " #for pure water\n", + "d2=1004; #density of 4% acid\n", + "Mavg2=xa2*w1+(1-xa2)*w2; #average molecular wght of solution at pos.2\n", + "av2=d2/Mavg2; #value of (d/m) of water\n", + "\n", + "allavg=(av1+av2)/2.; #average value of d/m\n", + " #assuming water to be non diffusing\n", + "Na=Dab*(allavg)*math.log((1-xa2)/(1-xa1))/z; #diffusion rate of acetic acid aacross film of non diffusing water sol.\n", + "\n", + " # Result\n", + "print \"\\n diffusion rate of acetic acid aacross film of non diffusing water sol. :%f kmol/m**2*s\"%Na\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " diffusion rate of acetic acid aacross film of non diffusing water sol. :0.051508 kmol/m**2*s\n" + ] + } + ], + "prompt_number": 41 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.10.a,page no:31" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + " \n", + "r=(50./2)*10**-3; #radius pf circular tube\n", + "pa1=190; #vapour pressure of ammonia at pt.1 \n", + "pa2=95; #vapour pressure of ammonia at pt.2\n", + "Dab=2.1*10**-5 #molecular diffusivity in m**2/s\n", + "z=1;\n", + "R=760*22.414/273; #universal gas constant in mmHg*m**3*K*kmol \n", + " #carbondioxide and oxygen experiences equimolar counter diffusion \n", + "T=298.; #temperature in kelvin\n", + "\n", + "# Calculation \n", + "pt=(10.0/780)*1.013*10**5; #total pressure in pascal\n", + "Na=Dab*(pa1-pa2)/(z*R*T); #flux in kmol/m**2*S\n", + "rate=Na*(3.14*r**2); #rate of mass transfer..(3.14*r**2)-is the area\n", + "\n", + "# Result\n", + "print \"\\n the rate of mass transfer.:%f *10**-10 kmol/s\"%(rate/10**-10)\n", + " \n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the rate of mass transfer.:2.105552 *10**-10 kmol/s\n" + ] + } + ], + "prompt_number": 43 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.10.b,page no:32" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "r=(50./2)*10**-3; #radius pf circular tube\n", + "pa1=(190.); #vapour pressure of ammonia at pt.1 \n", + "pa2=(95.); #vapour pressure of ammonia at pt.2\n", + "Dab=2.1*10**-5 #molecular diffusivity in m**2/s\n", + "R=760.*22.414/273; #universal gas constant in mmHg*m**3*K*kmol \n", + " #carbondioxide and oxygen experiences equimolar counter diffusion \n", + "T=298.; #temperature in kelvin\n", + "\n", + "# Calculation\n", + "pt=(10./780)*1.013*10**5; #total pressure in pascal\n", + "\n", + " #part (ii)\n", + "#(ya-ya1)/(ya2-ya1)=(z-z1)/(z2-z1);\n", + "z2=1; #diffusion path in m at pos.2\n", + "z1=0; #diffusion path in m at pos.1\n", + "z=.75; #diffusion at general z\n", + "#pa=poly([0],'pa'); #calc. of conc. in gas phase\n", + "x= 118.750000 #roots((pa-pa1)/(pa2-pa1)-(z-z1)/(z2-z1));\n", + "\n", + "# Result\n", + "print \"\\n partial pressure of co2 at o.75m from the end where partial pressure is 190mmhg is:%f mmHg\"%x\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " partial pressure of co2 at o.75m from the end where partial pressure is 190mmhg is:118.750000 mmHg\n" + ] + } + ], + "prompt_number": 44 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.11.a,page no:33" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "ya1=0.2; #initial mole fraction\n", + "ya2=0.1; #final mole fraction\n", + "T=298 #temperature in kelvin\n", + "pt=1*1.013*10**5; #total pressure in pascal\n", + "z=0.2*10**-2; #gas film thickness in m\n", + "Dab=.215*10**-4; #diffusion coefficient in m**2/s\n", + "R=8314.; #universal gas constant\n", + "#part (i)when N2 is non diffusing \n", + "import math\n", + "\n", + "# Calculation\n", + "Na=Dab*pt*math.log((1-ya2)/(1-ya1))/(z*R*T); #diffusion flux in kmol/m**2*s\n", + "\n", + "\n", + "# Result\n", + "print \" diffusion flux if N2 is non diffusing :%f *10**-5 kmol/m**2*s \"%(Na/10**-5);\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " diffusion flux if N2 is non diffusing :5.176955 *10**-5 kmol/m**2*s \n" + ] + } + ], + "prompt_number": 45 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.11.b,page no:33" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "ya1=0.2;\n", + "ya2=0.1;\n", + "T=(298); #temperature in kelvin\n", + "pt=1*1.013*10**5; #total pressure in pascal\n", + "z=0.2*10**-2; #gas film thickness in m\n", + "Dab=.215*10**-4; #diffusion coefficient in m**2/s\n", + "R=8314; #universal gas constant\n", + "\n", + "#part (ii) equimolar counter diffusion\n", + "# Calculation\n", + "Na=Dab*pt*(ya1-ya2)/(z*R*T) #diffusion flux in kmol/m**2*s\n", + "\n", + " # Result\n", + "print \" diffusion flux of oxygen during equimolar counter-diffusion :%f *10**-5 kmol/m**2*s \"%(Na/10**-5)\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " diffusion flux of oxygen during equimolar counter-diffusion :4.395331 *10**-5 kmol/m**2*s \n" + ] + } + ], + "prompt_number": 46 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.12,page no:34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "ya1=0.1;\n", + "ya2=0;\n", + "T=293. #temperature in kelvin\n", + "pt=1*1.013*10**5; #total pressure in pascal\n", + "z=0.2*10**-2; #gas film thickness in m\n", + "Dab=.185*10**-4; #diffusion coefficient in m**2/s\n", + "R=8314.; #universal gas constant\n", + " #part (i)when air is assumed to be stagnant and non-diffusing \n", + "import math\n", + "\n", + "# Calculation\n", + "Na=Dab*pt*math.log((1-ya2)/(1-ya1))/(z*R*T); #diffusion flux in kmol/m**2*s\n", + "mw=17; #molecular weight of ammonia\n", + "massflux=Na*mw; #mass flux of given NH3\n", + "print \" diffusion flux when total presssure is 1atm and air \\\n", + " is non-diffusing :%f *10**-4 kg/m**2*s \"%(massflux/10**-4);\n", + " #part (ii) when pressure is increased to 10atm\n", + "\n", + "#Dab_1/Dab_2=pt_2/pt_1\n", + "pt_2=10; #final pressure in atm\n", + "pt_1=1; #initially pressure was 1atm\n", + "Dab_1=.185; #initially diffusion coefficient was.185\n", + "Dab_2=Dab_1*pt_1/pt_2; #for gases Dab is proportional to 1/pt\n", + "Dab=Dab_2*10**-4; #new diffusion coefficient \n", + "pt=pt_2*1.013*10**5; #new total pressure\n", + "Na=Dab*pt*math.log((1-ya2)/(1-ya1))/(z*R*T); #diffusion flux in kmol/m**2*s\n", + "\n", + "# Result\n", + "print \"diffusion flux when pressure is increased to 10atm :%f *10**-5 kmol/m**2*s \"%(Na/10**-5);\n", + "print \"so the rate of diffusion remains same on increasing the pressure\"\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " diffusion flux when total presssure is 1atm and air is non-diffusing :6.889701 *10**-4 kg/m**2*s \n", + "diffusion flux when pressure is increased to 10atm :4.052765 *10**-5 kmol/m**2*s \n", + "so the rate of diffusion remains same on increasing the pressure\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.13,page no:35" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# variable declaration \n", + "T=290.0; #temperature in kelvin\n", + "z=2*10**-3; #film thickness sorrounding the water\n", + "xa2=0.0092; #mole fraction of ethanol at pos.2\n", + "xa1=0.0288; #mole fraction of ethanol at pos.1\n", + "w1=60.0; #molecular weight of acetic acid\n", + "w2=18.0; #molecular weight of water\n", + "Dab=0.95*10**-9; #diffusivity of acetic water sol.in m**2/s\n", + " #av=d/m\n", + "# Calculation \n", + "Mavg1=xa1*w1+(1-xa1)*w2; #average molecular wght of solution at pos 1\n", + "d1=1012.0; # density of 10 % acid\n", + "av1=d1/Mavg1; #value of (d/m) of copper solution\n", + "\n", + " #for position 2\n", + "d2=1003.0; #density of 4% acid\n", + "Mavg2=xa2*w1+(1-xa2)*w2; #average molecular wght of solution at pos.2\n", + "av2=d2/Mavg2; #value of (d/m) of water\n", + "\n", + "allavg=(av1+av2)/2; #average value of d/m\n", + " \n", + " #assuming water to be non diffusing\n", + "import math \n", + "Na=Dab*(allavg)*math.log((1-xa2)/(1-xa1))/z; #diffusion rate of acetic acid aacross film of non diffusing water sol.\n", + "\n", + "# Result\n", + "print \"diffusion rate of acetic acid aacross film of non diffusing water sol. :%f *10**-7 kmol/m**2*s\"%(Na/10.0**-7)\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "diffusion rate of acetic acid aacross film of non diffusing water sol. :5.088553 *10**-7 kmol/m**2*s\n" + ] + } + ], + "prompt_number": 47 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.14,page no:36" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "ya1=0.2; #molefraction at pos.1\n", + "ya2=0.1; #molefraction at pos.2\n", + "T=(293); #temperature in kelvin\n", + "pt=1*1.013*10**5; #total pressure in pascal\n", + "z=0.2*10**-2; #gas film thickness in m\n", + "Dab=.206*10**-4; #diffusion coefficient in m**2/s\n", + "R=8314; #universal gas constant\n", + " #for ideal gases volume fraction =mole fraction\n", + "#part (i)when N2 is non diffusing \n", + "import math\n", + "\n", + "# Calculation\n", + "Na=Dab*pt*math.log((1-ya2)/(1-ya1))/(z*R*T); #diffusion flux in kmol/m**2*s\n", + "print \"\\n diffusion flux if N2 is non diffusing :%f *10**-5 kmol/m**2*s \"%(Na/10**-5);\n", + "#part (ii) equimolar counter diffusion\n", + "\n", + "Na=Dab*pt*(ya1-ya2)/(z*R*T) #diffusion flux in kmol/m**2*s\n", + "\n", + "# Result\n", + "print \"\\n diffusion flux of nitrogen during equimolar counter-diffusion :%f *10**-5 kmol/m**2*s \"%(Na/10**-5)\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " diffusion flux if N2 is non diffusing :5.044891 *10**-5 kmol/m**2*s \n", + "\n", + " diffusion flux of nitrogen during equimolar counter-diffusion :4.283207 *10**-5 kmol/m**2*s \n" + ] + } + ], + "prompt_number": 48 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.15,page no:37" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "pa1=0.2*10**5; #partial pressure at pos.1\n", + "pa2=0; #partial pressure at pos.2\n", + "r=10./2; #radius of tank in which benzene is stored\n", + "T=298.; #temperature in kelvin\n", + "pt=1*1.013*10**5; #total pressure in pascal\n", + "z=10*10**-3; #gas film thickness in m\n", + "Dab=.02/3600; #diffusion coefficient in m**2/s\n", + "R=8314.; #universal gas constant\n", + " #benzene is stored in atank of dia 10m\n", + "#part (i)when air is assumed to be stagnant\n", + "import math\n", + "\n", + "# Calculation\n", + "Na=Dab*pt*math.log((pt-pa2)/(pt-pa1))/(z*R*T); #diffusion flux in kmol/m**2*s\n", + "rate=Na*(3.14*r**2); #rate of loss of benzene if air is stagnant\n", + "\n", + " # Result\n", + "print \"diffusion rate of loss of benzene :%f *10**-4 kmol/s \"%(rate/10**-4);\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "diffusion rate of loss of benzene :3.921799 *10**-4 kmol/s \n" + ] + } + ], + "prompt_number": 49 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.16,page no:38" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "ya2=0.1; #molefraction at pos.2\n", + "ya1=0.8; #molefraction at pos.1\n", + "T=(370.); #temperature in kelvin\n", + "pt=1*1.013*10**5; #total pressure in pascal\n", + "z=0.1*10**-3; #gas film thickness in m\n", + "Dab=.15*10**-2; #diffusion coefficient in m**2/s\n", + "R=8314; #universal gas constant\n", + "Area=10; #area of the film is 10m**2\n", + "\n", + " #alcohol is being absorbed infrom amixture of alcohol vapour and water vapour by means of non-volatile solvent in which alcohol is soluble bt water is not \n", + " #for gase Dab=T**3/2\n", + " #Dab1/Dab2=(T1/T2)**3/2\n", + "import math\n", + "T2=370.; #final temperature in kelvin \n", + "T1=298.; #initial temperature in kelvin\n", + "\n", + "# Calculation\n", + "Dab1=.15*10**-2; #initial diffusion coefficient \n", + "Dab2=((T2/T1)**(3./2))*Dab1; #final diffusion coefficient\n", + "Na=Dab2*pt*math.log((1-ya2)/(1-ya1))/(z*R*T); #diffusion flux in kmol/m**2*s\n", + "rate=Na*3600*46*Area; #rate of diffusion of alcohol-water vapour in kg/hour\n", + "\n", + " # Result\n", + "print \" rate of diffusion of alcohol-water vapour :%f *10**6 kg/hour \"%(rate/10**6)\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " rate of diffusion of alcohol-water vapour :1.702149 *10**6 kg/hour \n" + ] + } + ], + "prompt_number": 50 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.17,page no:39" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "ya2=0; #molefraction at pos.2\n", + "ya1=0.1; #molefraction at pos.1\n", + "T=(273); #temperature in kelvin\n", + "pt=1*1.013*10**5; #total pressure in pascal\n", + "z=2*10**-3; #gas film thickness in m\n", + "Dab=.198*10**-4; #diffusion coefficient in m**2/s\n", + "R=8314; #universal gas constant\n", + " #ammonia is diffusing through an inert film 2mm thick \n", + "\n", + " #for gase Dab=T**3/2\n", + " #Dab1/Dab2=(T1/T2)**3/2\n", + "import math\n", + "T2=293; #final temperature in kelvin \n", + "T1=273; #initial temperature in kelvin\n", + "\n", + "\n", + "# Calculation\n", + "Dab1=0.198*10**-4; #initial diffusion coefficient \n", + "Dab2=((T2/T1)**(3.0/2))*Dab1; #final diffusion coefficient\n", + "Na=Dab2*pt*math.log((1-ya2)/(1-ya1))/(z*R*T2); #diffusion flux in kmol/m**2*s\n", + "print \" flux of diffusion of ammonia through inert film :%f *10**-5 kmol/m**2*s \"%(Na/10**-5)\n", + "\n", + "#if pressure is also incresed from 1 to 5 atm\n", + " #for gases Dab=(T**3/2)/pt;\n", + " #Dab1/Dab2=(T1/T2)**3/2*(p2/p1)\n", + "T2=293.; #final temperature in kelvin \n", + "T1=273.; #initial temperature in kelvin\n", + "pa2=5.; #final pressure in atm\n", + "pa1=1; #initial pressure in atm \n", + "p=pa2*1.013*10**5;\n", + "Dab1=.198*10**-4; #initial diffusion coefficient\n", + "Dab2=((T2/T1)**(3.0/2))*Dab1*(pa1/pa2); #final diffusion coefficient\n", + "Na=Dab2*p*math.log((1-ya2)/(1-ya1))/(z*R*T2); #diffusion flux in kmol/m**2*s\n", + "\n", + " # Result\n", + "print \"flux of diffusion of ammonia if temp. is 20 and pressure is 5 atm :%f*10**-5 kmol/m**2*s \"%(Na/10**-5)\n", + "print \"so there is no change in flux when pressure is changed\"\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " flux of diffusion of ammonia through inert film :4.337554 *10**-5 kmol/m**2*s \n", + "flux of diffusion of ammonia if temp. is 20 and pressure is 5 atm :4.822834*10**-5 kmol/m**2*s \n", + "so there is no change in flux when pressure is changed\n" + ] + } + ], + "prompt_number": 52 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.18,page no:40" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# variable declaration \n", + "pa1=0.418*10**5; #partial pressure initially\n", + "pa2=0; #partial pressure of pure air\n", + "r=10/2; #radius of tank in which benzene is stored\n", + "T=(350); #temperature in kelvin\n", + "pt=1*1.013*10**5; #total pressure in pascal\n", + "z=2*10**-3; #gas film thickness in m\n", + "Dab=.2*10**-4; #diffusion coefficient in m**2/s\n", + "R=8314; #universal gas constant\n", + "r=0.2/2; #radius of open bowl is 0.2\n", + "#when air layer is assumed to be stagnant of thickness 2mm\n", + "import math\n", + "\n", + "# Calculation\n", + "\n", + "Na=Dab*pt*math.log((pt-pa2)/(pt-pa1))/(z*R*T); #diffusion flux in kmol/m**2*s\n", + "rate=Na*(3.14*r**2)*18; #rate of loss of evaporation\n", + "\n", + "# Result\n", + "print \"\\n diffusion rate loss of evaporation :%f *10**-4 kg/s \"%(rate/10**-4)\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " diffusion rate loss of evaporation :1.046972 *10**-4 kg/s \n" + ] + } + ], + "prompt_number": 54 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.19,page no:41" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + " \n", + "# variable declaration \n", + "\n", + "#stefan tube experiment\n", + "import math\n", + "Ml=92.; #molecular weight of toluene\n", + "T=(312.4); #temperature in kelvin\n", + "pt=1*1.013*10**5; #total pressure in pascal\n", + "R=8314.; #universal gas constant\n", + "t=275.*3600; #after 275 hours the level dropped to 80mm from the top\n", + "zo=20.*10**-3; #intially liquid toluene is at 20mm from top\n", + "zt=80.*10**-3; #finally liquid toluene is at 80mm from top\n", + "#air is assumed to be satgnant \n", + "d=850.; #density in kg/m**3\n", + "pa=7.64*10**3; #vapour pressure of toluene in at 39.4degree celcius \n", + "\n", + "# Calculation \n", + "cal=d/Ml; #conc. at length at disxtance l\n", + "ca=pt/(R*T); #total conc. \n", + "xa1=pa/pt; #mole fraction of toluene at pt1 i.e before evaporation \n", + "xb1=1-xa1; #mole fraction of air before evaporation i.e at pt1 \n", + "xb2=1.; #mole fraction of air after evaporation i.e at pt.2\n", + "xa2=0.; #mole fraction of toluene at point 2\n", + "xbm=(xb2-xb1)/(math.log(xb2/xb1));\n", + "#t/(zt-zt0) = (xbm*cal*(zt+zo))/(2*c*(xa1-xa2)*t);\n", + "Dab=(xbm*cal*(zt**2-zo**2))/(2*ca*t*(xa1-xa2));\n", + "\n", + "# Result\n", + "print \"\\n the diffusivity of the mixture in stefan tube of toluene in air is :%f*10**-5 m**2/s\"%(Dab/10**-5)\n", + "#end" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.20,page no: 42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# variable declaration \n", + "\n", + "T=(360); #temperature in kelvin\n", + "pt=372.4/760; #total pressure in atm\n", + "R=82.06; #universal gas constant\n", + "Dab=0.0506; #diffusion coefficient in cm**2/s \n", + "z=0.254; #gas layer thickness in cm\n", + "vp=368.0/760; #vapour pressure of toluene in atm\n", + "xtol=.3; #mole fractoin of toluene in atm\n", + "pb1=xtol*vp; #partial pressure of toluene\n", + "#since pb1 is .045263 bt in book it is rounded to 0.145\n", + "\n", + "# Calculation \n", + "pb2=xtol*pt; #parial pressure of toluene in vapour phase\n", + "Na=Dab*(pb1-pb2)/(z*R*T); #diffusion flux \n", + "\n", + "# Result\n", + "print \"\\n the diffusion flux of a mixture of benzene and toluene %f*10**-8 gmol/cm**2*s\\n\"%(Na/10**-8)\n", + "print \"\\nthe negative sign indicates that the toluene is getting transferred from gas phase \\\n", + "to liquid phase(hence the transfer of benzene is from liquid to gas phase)\"\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the diffusion flux of a mixture of benzene and toluene -1.171233*10**-8 gmol/cm**2*s\n", + "\n", + "\n", + "the negative sign indicates that the toluene is getting transferred from gas phase to liquid phase(hence the transfer of benzene is from liquid to gas phase)\n" + ] + } + ], + "prompt_number": 56 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.21,page no:43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# variable declaration \n", + "\n", + "Ml=92.; #molecular weight of toluene\n", + "T=(303.); #temperature in kelvin\n", + "pt=1.*1.013*10**5; #total pressure in pascal\n", + "R=8314.; #universal gas constant\n", + "t=275.*3600; #after 275 hours the level dropped to 80mm from the top\n", + "zo=20.*10**-3; #intially liquid toluene is at 20mm from top\n", + "zt=77.5*10**-3; #finally liquid toluene is at 80mm from top\n", + " #air is assumed to be satgnant \n", + "import math\n", + "# Calculation \n", + "d=820.; #density in kg/m**3\n", + "pa=(57.0/760)*1.0135*10**5; #vapour pressure of toluene in at 39.4degree celcius \n", + "cal=d/Ml; #conc. at length at disxtance l\n", + "ca=pt/(R*T); #total conc. \n", + "xa1=pa/pt; #mole fraction of toluene at pt1 i.e before evaporation \n", + "xb1=1.-xa1; #mole fraction of air before evaporation i.e at pt1 \n", + "xb2=1.; #mole fraction of air after evaporation i.e at pt.2\n", + "xa2=0; #mole fraction of toluene at point 2\n", + "xbm=(xb2-xb1)/(math.log(xb2/xb1));\n", + "#t/(zt-zt0) = (xbm*cal*(zt+zo))/(2*c*(xa1-xa2)*t);\n", + "Dab=(xbm*cal*(zt**2-zo**2))/(2*ca*t*(xa1-xa2));\n", + "\n", + "# Result\n", + "print \"\\n the diffusivity of the mixture in stefan tube of toluene in air is :%f*10**-5 m**2/s\"%(Dab/10**-5)\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the diffusivity of the mixture in stefan tube of toluene in air is :0.804587*10**-5 m**2/s\n" + ] + } + ], + "prompt_number": 57 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.22,page no:45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#variation in liquid level with respect to time is given below\n", + "%pylab inline\n", + "t=[26,185,456,1336,1958,2810,3829,4822,6385]\n", + "# let Zt-Zo= x;\n", + "x=[.25,1.29,2.32,4.39,5.47,6.70,7.38,9.03,10.48]\n", + "i=0; \n", + "y = [0,0,0,0,0,0,0,0,0] #looping starts\n", + "\n", + "# Calculation \n", + "while(i<9):\n", + " y[i]=t[i]/x[i]; #for calculating the t/Zt-Zo value\n", + " i=i+1;\n", + "from matplotlib.pyplot import *\n", + "plot(x,y,\"o-\");\n", + "show()\n", + "#xtitle(\" Fig.2.2 Example 22 \",\"X--(zi-zo),cm --->\",\"Y-- vs (t/(zi-zo))min/cm ---->\");\n", + "slope=51.4385*60 *10**4; #slope of the curve in 1/sec*m**2\n", + "#slope = Cal *(xblm)/(2*Dab*C*(xa1-xa2))\n", + "d=1540.; #density in kg/m**3\n", + "Ml=154.; #molecular weight of toluene\n", + "Cal=d/Ml ; #conc. at length at disxtance l in mol/m**3\n", + "\n", + "T=(321.); #temperature in kelvin\n", + "pt=1.; #total pressure in atm\n", + "R=82.06; #universal gas constant\n", + "C=pt/(R*T) *10**3; #total conc. in kg mol/m**3\n", + "\n", + "pa=(282./760); #vapour pressure of toluene \n", + "xa1=pa/pt; #mole fraction of toluene at pt1 i.e before evaporation\n", + "xb1=1.-xa1; #mole fraction of air before evaporation i.e at pt1 \n", + "xb2=1.; #mole fraction of air after evaporation i.e at pt.2\n", + "xa2=0.; #mole fraction of toluene at point 2\n", + "xblm=(xb2-xb1)/(math.log(xb2/xb1)); #log mean temp. difference\n", + "Dab = Cal *(xblm)/(2*slope*C*(xa1-xa2)); #diffusivity coefficient\n", + "\n", + "# Result\n", + "print \"\\n the diffusivity of the mixture by winklemann method of toluene in air is :%f*10**-6 m**2/s\"%(Dab/10**-6)\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Populating the interactive namespace from numpy and matplotlib\n" + ] + }, + { + "output_type": "stream", + "stream": "stderr", + "text": [ + "WARNING: pylab import has clobbered these variables: ['rate', 'draw_if_interactive']\n", + "`%pylab --no-import-all` prevents importing * from pylab and numpy\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAXgAAAD9CAYAAAC2l2x5AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAA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vlO99957hsPhMK677jpjyJAhxpAhQ4y33nrL6rL8zuv1Grfd\ndpvVZfjd9u3bjWHDhrV7ClqwWbRokW+a5L333ms0NDRYXdIFueuuu4w+ffoYERERRmxsrLF8+XLj\n4MGDxpgxY2wxTfL068vOzjbi4+ONfv36+fLlgQceOOd7OAzDhgOqIiISHFv2iYhIxyngRURsSgEv\nImJTCngREZtSwIuI2JQCXkTEpv4/Y/eFADqmRiMAAAAASUVORK5CYII=\n", + "text": [ + "" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the diffusivity of the mixture by winklemann method of toluene in air is :9.202857*10**-6 m**2/s\n" + ] + } + ], + "prompt_number": 58 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.23,page no:46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "d=0.001;\n", + "area=3.14*(d/2)**2; #area of the bulb\n", + "T=298.; #temperature in kelvin \n", + "p=1.013*10**5; #total pressure of both the bulbs\n", + "R=8314.; #universal gas constant\n", + "\n", + "# Calculation \n", + "c=p/(R*T); #total concentration\n", + "Dab=.784*10**-4; #diffusion coefficient in m**2/s\n", + "xa1=0.8; #molefraction of nitrogen gas at the 1 end\n", + "xa2=0.25; #molefraction of nitrogen gas at the 2nd end\n", + "z=.15; #distance between the bulbs\n", + "\n", + " #rate=area*Na;\n", + "rate=area*Dab*c*(xa1-xa2)/z; #rate of transfer of hydrogen and hydrogen\n", + "\n", + "# Result\n", + "print \"\\n the rate of transfer from 1 to 2 of nitrogen and 2 to 1of hydrogen is :%f *10**-11kmol/s\"%(rate/10.0**-11)\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the rate of transfer from 1 to 2 of nitrogen and 2 to 1of hydrogen is :0.922657 *10**-11kmol/s\n" + ] + } + ], + "prompt_number": 59 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.24,page no:47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "T=288; #temperature in kelvin\n", + "Mb=32; #molecular weight of methanol\n", + "phi=1.9; #association factor for solvent\n", + "\n", + "# Calculation \n", + "va=(14.8+(4*24.6))*10**-3 #solute(CCl4) volume at normal BP in m**3/kmol\n", + "u=.6*10**-3; #viscosity of solution in kg/m*s\n", + "Dab=(117.3*10**-18)*(phi*Mb)**0.5*T/(u*va**0.6); #diffusion coefficient in m**2/s\n", + "\n", + "# Result\n", + "print \"\\ndiffusivity of methanol in carbon tetrachloride is :%f*10**-9 m**2/s\"%(Dab/10.0**-9)\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "diffusivity of methanol in carbon tetrachloride is :1.622494*10**-9 m**2/s\n" + ] + } + ], + "prompt_number": 60 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.25,page no:48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "T=288.0; #temperature in kelvin\n", + "Mb=18.0; #molecular weight of methanol\n", + "phi=2.26; #association factor for solvent\n", + "\n", + "# Calculation \n", + "va=(2*14.8+(6*3.7)+7.4)*10**-3 #solute(water) volume at normal BP in m**3/kmol\n", + "u=1*10**-3; #viscosity of solution in kg/m*s\n", + "Dab=(117.3*10**-18)*(phi*Mb)**0.5*T/(u*va**0.6); #diffusion coefficient in m**2/s\n", + "\n", + "# Result\n", + "print \"\\ndiffusivity of methanol in water is :%f*10**-9 m**2/s\"%(Dab/10**-9)\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "diffusivity of methanol in water is :1.174865*10**-9 m**2/s\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.26,page no:49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "u=20.*10**-6; #viscosity in Ns/m**2\n", + "pt=2666.; #total pressure in N/m**2\n", + "pa1=pt; #pressure at 1\n", + "pa2=0; #pressure at 2\n", + "mw=32.; #molecular weight of oxygen\n", + "R=8314.; #universal law constant\n", + "T=373.; #temp. in kelvin\n", + "gc=1.; \n", + "\n", + "# Calculation \n", + "l=(3.2*u/pt)*((R*T)/(2*3.14*gc*mw))**0.5;#mean free path\n", + "d=.2*10**-6; #pore diameter\n", + "s=d/l; #value of dia/l\n", + " #hence knudsen diffusion occurs\n", + "Na=0.093*20*273/(760*373*22414*10**-1); #diffusion coefficient in kmol/m**2*s\n", + "Dka=(d/3)*((8*gc*R*T)/(3.14*mw))**0.5;\n", + "l1=Dka*(pa1-pa2)/(R*T*Na); #length of the plate\n", + "\n", + "# Result\n", + "print \"\\n the length of the plate is :%f m \"%l1\n", + "\n", + "\n", + " #for diffusion with hydrogen\n", + "u=8.5*10**-6; #viscosity in Ns/m**2\n", + "pt=1333; #total pressure in N/m**2\n", + "pa1=pt; #pressure at 1\n", + "pa2=0; #pressure at 2\n", + "mw=2; #molecular weight of oxygen\n", + "R=8314; #universal law constant\n", + "T=298; #temp. in kelvin\n", + "gc=1; \n", + "l=(3.2*u/pt)*((R*T)/(2*3.14*gc*mw))**0.5;#mean free path\n", + "d=.2*10**-6; #pore diameter\n", + "s=d/l; #value of dia/l\n", + " #hence knudsen diffusion occurs\n", + "Dka=(d/3)*((8*gc*R*T)/(3.14*mw))**0.5;\n", + "Na=Dka*(pa1-pa2)/(R*T*l1); #diffusion coefficient in kmol/m**2*s\n", + "print \"\\n the diffusion coefficient is :%f *10**-4 kmol/m**2*s\"%(Na/10.0**-6)\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the length of the plate is :0.035635 m \n", + "\n", + " the diffusion coefficient is :1.788175 *10**-4 kmol/m**2*s\n" + ] + } + ], + "prompt_number": 61 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Elements_Of_Mass_Transfer_Part_1/.ipynb_checkpoints/ch3-checkpoint.ipynb b/Elements_Of_Mass_Transfer_Part_1/.ipynb_checkpoints/ch3-checkpoint.ipynb new file mode 100644 index 00000000..367b3d5a --- /dev/null +++ b/Elements_Of_Mass_Transfer_Part_1/.ipynb_checkpoints/ch3-checkpoint.ipynb @@ -0,0 +1,609 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:eb744b726bacf04c11f26196fa6e57862adb6fb8246bed105c1ddbe4b2f86f5c" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 3 : Mass transfer coefficient and interphase mass transfer" + ] + }, + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Example 3.1,page no:51" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable Declaration \n", + "v=6.; #velocity in m/s\n", + "l=6.; #length in m\n", + "pa1=10.; #pressure at 1 in atm\n", + "pa2=0; #pressure at 2 in atm\n", + "t=373.; # temperature in kelvin\n", + "p=1.; #pressure of naphthalene in atm at 373kelvin\n", + "D=5.15*10**-6; #diffusivity of naphthalene in C02 in m**2/s\n", + "d=0.946; #density of air in kg/m**3\n", + "u=.021*10**-3; #viscosity of air in Newton*s/m**2\n", + "ID=0.075; #diameter in m\n", + "\n", + "# Calculation\n", + "nre=(ID*v*d)/(u); #calc. of reynolds no.\n", + "cf=2*0.023*(nre)**(-0.2); #friction factor\n", + "nsc=(u)/(d*D); #calc of schmidt no.\n", + "kc=(cf*v)/(2*(nsc)**(2./3));\n", + "na=(kc*10**5*(pa1/760-0))/(8314*t); #difussion flux in kmol/m**2*s\n", + "sub=na*2*3.14*(ID/2)*l; #rate of sublimation\n", + "\n", + "# Result\n", + "print \"\\nrate of sublimation :%f *10**-6 kmol/s\\n\"%(sub/10**-6);\n", + "#End" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "rate of sublimation :4.298312 *10**-6 kmol/s\n", + "\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.2,page no:52" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variable Declaration \n", + "v=0.30; #velocity of parallelair in m/s\n", + "t=300; #temperature of air in kelvin\n", + "p=10.0**5/760; #pressure of air in pascal\n", + "Dab=5.9*10**-4; #diffusivity of naphthalene in in air in m**2/s \n", + "pa1=0.2*10**5/760; #pressure of air at 1 in pascal\n", + "pa2=0; #pressure of air at 2 in pascal\n", + "d=1.15; #density of air in kg/m**3\n", + "u=0.0185*10**-3; #viscosity of air in Newton*s/m**2\n", + "D=1.; #length in m\n", + "a=1.; #area of plate in m**2\n", + "\n", + "# Calculation \n", + "Nsc=u/(d*Dab); #schmidt no. calculation\n", + "Nre=(D*v*d)/u; #reynolds no. calculation\n", + " #flow is turbulent \n", + "f=0.072*(Nre)**-.25; #friction factor using \"chilton colburn\" analogy\n", + "k_c=(f*v)/(2*(Nsc)**.667); #mass transfer coefficient\n", + "NA=k_c*(pa1-pa2)/(8314*300); #mass flux calc.\n", + "sub=NA*a; #rate of sublimation in kmol/m**2*s\n", + "\n", + "# Result\n", + "print \"\\nrate of sublimation :%f *10**-7 kmol/s\\n\"%(sub/10**-7)\n", + "#End" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "rate of sublimation :1.077674 *10**-7 kmol/s\n", + "\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.3,page no:53" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "# a is CO2 and b is water\n", + "p=2.; #total pressure at 1 in atm \n", + "pa1=0.2*10**5; #pressure of CO2 at pt 1 in atm\n", + "pa2=0; #pressure of CO2 at pt 2 is 0 since air is pure\n", + "ya1=0.1; #mole fraction of CO2 at 1 is 0.2/2\n", + "ya2=0; #mole fraction of CO2 at 2 is 0 since air is pure\n", + "yb1=0.9; #mole fraction of water at 1 is (1-0.1)\n", + "yb2=1.0; #mole fraction of water at 2 is 1.0 since total pressure has to be constant.\n", + "k_y1=6.78*10**-5; #mass transfer coefficient in kmol/m**2*s*molefraction\n", + "import math\n", + "\n", + "# Calculation \n", + "yb_ln=(yb2-yb1)/(math.log(yb2/yb1)); #log mean is represented by yb_ln\n", + "\n", + "k_y=k_y1/yb_ln; \n", + "\n", + "# Result\n", + "print \"\\nvalue of mass transfer coefficient k_y is:%f *10**-5 kmol/m**2*s*(molefractin)\"%(k_y/10.0**-5)\n", + "k_g=k_y/p; #mass ttransfer coefficient in lmol/m**2*s*atm\n", + "print \"\\nvalue mass transfer coefficient k_g is:%f *10**-5 kmol/m**2*s*(atm)\"%(k_g/10**-5)\n", + "\n", + "NA=k_y*(ya1-ya2); #mass flux in kmol/m**2*s\n", + "print \"\\nvalue of rate of mass transfer :%f *10**-6 kmol/m**2*s\"%(NA/10.0**-6)\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "value of mass transfer coefficient k_y is:7.143443 *10**-5 kmol/m**2*s*(molefractin)\n", + "\n", + "value mass transfer coefficient k_g is:3.571721 *10**-5 kmol/m**2*s*(atm)\n", + "\n", + "value of rate of mass transfer :7.143443 *10**-6 kmol/m**2*s\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.4,page no:55" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "NA=7.5*10**-7; #mass flux in gmol/cm**2*s\n", + "Dab=1.7*10**-5; #diffusivity if SO2 in water in cm**2/s\n", + "c=1./18.02; #concentration is density/molecular weight in gmol/cm**2*s\n", + "#SO2 is absorbed from air into water\n", + "\n", + "xa1=0.0025; #liquid phase mole fraction at 1\n", + "xa2=0.0003; #liquid phase mole fraction at 2\n", + " #NA=kc(Ca1-Ca2)=Dab*(Ca1-Ca2)/d\n", + "\n", + "# Calculation \n", + "k_c=NA/(c*(xa1-xa2)); #k_c=Dab/d=NA/c(xa1-xa2)\n", + "\n", + "# Result \n", + "print \"\\nmass transfer coefficient k_c is:%f cm/s\"%k_c\n", + "\n", + "d=Dab/k_c;\n", + "print \"\\nfilm thickness d is :%f cm\"%d\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "mass transfer coefficient k_c is:0.006143 cm/s\n", + "\n", + "film thickness d is :0.002767 cm\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.5,page no:56 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Kg=2.72*10**-4; #overall gas phase mass transfer coefficient in kmol/m**2*S*atm\n", + "r_gas=0.85*(1/Kg); #given that gas phase resisitance is 0.85 times overall resistance\n", + "kg=1.0/r_gas; \n", + "m=9.35*10**-3; #henry's law constant in atm*m**3/kmol\n", + "kl=m/(1./Kg-1/kg); #liquid phase mass transfer coefficient in m/s\n", + "print \"\\nthe value of liquid film coefficient kl : %f*10**-5 m/s\"%(kl/10**-5)\n", + "print \"\\nthe value of gas film coefficient kg : %f*10**-5 m/s\"%(kg/10**-5);\n", + "p=1.; #overall pressure in atm\n", + "\n", + " #NA=Kg(pag-pa*)=kg(pag-pai)=kl(Cai-Cal)\n", + "# Calculation \n", + "Yag=0.1; #molefraction of ammonia\n", + "Cal=6.42*10**-2; #liquid phase concentration \n", + "Pag=Yag*p; #pressure of ammonia\n", + " #Pai and Cai indicates interfacial pressure and conc.\n", + " #Pal and Cal indicates bulk pressure and conc.\n", + "\n", + " #Pai=m*C_ai;\n", + " #NA=kg(pag-pai)=kl(Cai-Cal)\n", + " \n", + "#Cai=poly([0],'Cai'); #calc. of conc. in gas phase\n", + "x = 1.6588481 #x=roots((Pag-m*Cai)*(kg/kl)-(Cai-Cal));\n", + "\n", + "# Result \n", + "print \"\\nthe value of interphase conc.cai :%f kmol/m**3\"%x\n", + "Pai=m*x;\n", + "print \"\\nthe value of interphase pressure pai is:%f atm\"%Pai\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "the value of liquid film coefficient kl : 1.695467*10**-5 m/s\n", + "\n", + "the value of gas film coefficient kg : 32.000000*10**-5 m/s\n", + "\n", + "the value of interphase conc.cai :1.658848 kmol/m**3\n", + "\n", + "the value of interphase pressure pai is:0.015510 atm\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.6 ,page no:57" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "m=0.3672;\n", + "t=.9;\n", + " #Pai and Cai indicates interfacial pressure and conc.\n", + " #Pal and Cal indicates bulk pressure and conc.\n", + "Yag=0.15; #molefraction of ammonia\n", + "Cal=0.147; #liquid phase concentration in kmol/m**3\n", + "p=1; #overall pressure\n", + "\n", + "# Calculation \n", + "Pag=Yag*p; #pressure of ammonia\n", + "\n", + " #Pai=m*C_ai;\n", + " #kg/kl=(Cai-Cal)/(Pag-Pai);\n", + " \n", + "#Cai=poly([0],'Cai'); #calc. of conc. in gas phase\n", + "x = 0.211954 #x=roots((Pag-m*Cai)*(t)-(Cai-Cal));\n", + "\n", + "# Result\n", + "print \"\\nthe value of conc. of ammonia cai is :%f kmol/m**3\"%x\n", + "Pai=m*x;\n", + "print \"\\nthe value of interphase pressure Pai is :%f atm\"%Pai" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "the value of conc. of ammonia cai is :0.211954 kmol/m**3\n", + "\n", + "the value of interphase pressure Pai is :0.077830 atm\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.7,page no:58" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variable Declaration \n", + "D=.1;\n", + "l=3; # l is length of bubble in cm\n", + "a=3.14*D*l; # area in cm**2\n", + "Ca_o=0.0001; #pure conc. of gas in g*mol/cc*atm\n", + "Ca=0;\n", + "NA=.482*10**-5; # molar rate of absorption in g*moles/s\n", + " #Pa_o and Ca_o indicates pure pressure and conc.\n", + "# Calculation \n", + "kl=NA/(a*(Ca_o-Ca)); #mass transfer coefficient acc. to higbie's penetration theory\n", + "Q=4; #volumetric flow rate in cc/s\n", + "A=3.14*.1*.1/4; #area of flow\n", + "v=Q/A; #velocity of flow in cm/s\n", + "\n", + "#timt t=bubble length/linear velocity;\n", + "t=l/v;\n", + "DAB=(kl**2)*3.14*t/4; #diffusivity in cm**2/s\n", + "D_new=0.09; #revised diameter reduced to.09\n", + "a_new=3.14*l*D_new; #revised area\n", + "A_new=3.14*0.09*0.09/4; #revised flow area\n", + "v_new=Q/A_new; #revised velocity\n", + "\n", + "# Result \n", + "print \"\\nthe value of diffusivity of gas DAB is :%f cm/s\"%(DAB/10**-5)\n", + "\n", + "t_new=l/v_new; #revised time\n", + "kl_new=2*(DAB/(3.14*0.0047))**0.5; #revised mass transfer coefficient \n", + "NA_new=kl_new*a_new*(Ca_o-Ca); #revised molar rate absorption in g*moles/s\n", + "print \"\\nthe value of NA_new is :%f*10**-6 kmol/m**3\"%(NA_new/10**-6)\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "the value of diffusivity of gas DAB is :1.210021 cm/s\n", + "\n", + "the value of NA_new is :4.855188*10**-6 kmol/m**3\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.8,page no:59" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variable Declaration \n", + "Kg=7.36*10**-10;\n", + "p=1.013*10**5;\n", + "Ky=Kg*p;\n", + "#resistance in gas phase is 0.45 of total resistance & .55 in liquid phase\n", + "#(resistance in gas phase)r_gas=1/ky and (resistance in liq phase)r_liq=m'/kx\n", + "r_gas=0.45*(1./Ky);\n", + "ky=1./r_gas;\n", + "r_liq=0.55*(1./Ky);\n", + "print \"film based liq phase mass transfer coeff.ky is :%f \"%ky\n", + "#from equilibrium relantionship indicates linear behaviour thus the slope of equilibrium curve is 86.45\n", + "# Calculation\n", + "m1=86.45;\n", + "kx=m1/r_liq;\n", + "yag=.1;\n", + "xal=(.4/64)/((99.6/18)+(.4/64));\n", + "print \"\\n film based gas phase mass transfer coeff.ky is :%f \"%kx\n", + "#slope of the line gives -kx/ky=-70.61\n", + "m2=m1; # since equilibrium line a straigth line m'=m''\n", + "Kx=1/(1/kx+(1/(m2*ky))); #overall liquid phase mass transfer coefficient\n", + "print \"\\n overall liq phase mass transfer coefficient Kx is :%f \"%Kx\n", + "# equillibrium relation is given under\n", + "p = [0.2,0.3,0.5,0.7];\n", + "a = [29,46,83,119];\n", + "i=0;\n", + "x = [0,0,0,0]\n", + "y = [0,0,0,0]\n", + " #looping for calcullating mole fraction\n", + "while (i<4):\n", + " x[i]= (p[i]/64.)/(p[i]/64.+100/18);\n", + " y[i]= a[i]/760.; #mole fraction plotted on y-axis\n", + " i=i+1; \n", + " #mole fraction plotted on x-axis\n", + "%pylab inline\n", + "from matplotlib.pyplot import *\n", + "\n", + "# Result\n", + "plot(x,y);\n", + "title(\"Fig.3.17,Example 8\");\n", + "xlabel(\"X-- Concentration of SO2 in liquid phase, X(10**4)(molefraction)\");\n", + "ylabel(\"Y-- Concentration of SO2 in gas phase, Y(molefraction)\");\n", + "show()\n", + " #from the graph we get these values\n", + "yao=.083; #corresponding to the value of xao=0.001128\n", + "xao=.00132; #corresponding to the value of yag=.1\n", + "yai=.0925; #corresponding to the perpendicular dropped from the pt(.001128,0.1) \n", + "xai=.00123;\n", + " \n", + " # flux based on overall coefficient\n", + "NAo_gas=Ky*(yag-yao);\n", + "NAo_liq=Kx*(xao-xal);\n", + "print \"overall gas phase mass transfer flux -NAo_gas is :%f*10**-6 kmol/m**2*s \"%(NAo_gas/10**-6)\n", + "print \"overall liq phase mass transfer flux -NAo_liq is :%f*10**-6 kmol/m**2*s \"%(NAo_liq/10**-6);\n", + "\n", + " # flux based on film coefficient \n", + "NAf_gas=ky*(yag-yai);\n", + "NAf_liq=kx*(xai-xal);\n", + "print \"film based gas phase mass transfer flux-NAf_gas is :%f *10**-6 kmol/m**2*s\"%(NAf_gas/10**-6);\n", + "print \"film based liq phase mass transfer flux-NAf_liq is :%f *10**-6 kmol/m**2*s\"%(NAf_liq/10**-6);\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "film based liq phase mass transfer coeff.ky is :0.000166 \n", + "\n", + " film based gas phase mass transfer coeff.ky is :0.011719 \n", + "\n", + " overall liq phase mass transfer coefficient Kx is :0.006445 \n", + "Populating the interactive namespace from numpy and matplotlib" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + }, + { + "output_type": "stream", + "stream": "stderr", + "text": [ + "WARNING: pylab import has clobbered these variables: ['f']\n", + "`%pylab --no-import-all` prevents importing * from pylab and numpy\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAZYAAAEgCAYAAACXa1X+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzs3XdUFGe4BvBnKQYUEAs2QJEivYNEY8EWe0WvGFss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GK6urggJCcEH\nH3ww4znPpY8BzIM063f+QcAZoeTgmAMxMTEoKyvDypUr501ma2srysrKcOrUqXmTORtu3LiBqqoq\nlJaWzilea2sramtr73kv1XzwySefQK/XIysrC4B51qbT6ZCfn//A8vRPYf/+/ZDL5Wxw8iD4d/6N\n5+D4H8LZ6PN+EhQUNGelAgBr165Fd3e308+x95va2lrs2LGDuVNSUnD69On/e7NTBoMBGo1mzp8d\n5xtuxsLBwcHBMa9wMxYODg4OjnmFUywcHBwcHPMKp1g4ODg4OOYVTrFwcHBwcMwrnGLh4ODg4JhX\nOMXCwcHBwTGv/Aec+J/DRRI5KQAAAABJRU5ErkJggg==\n", + "text": [ + "" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "overall gas phase mass transfer flux -NAo_gas is :1.267466*10**-6 kmol/m**2*s \n", + "overall liq phase mass transfer flux -NAo_liq is :1.235953*10**-6 kmol/m**2*s \n", + "film based gas phase mass transfer flux-NAf_gas is :1.242613 *10**-6 kmol/m**2*s\n", + "film based liq phase mass transfer flux-NAf_liq is :1.192479 *10**-6 kmol/m**2*s\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.9,page no:60" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variable Declaration \n", + "Cas=1.521*10**-7;\n", + "v=1525; #velocity in m/s\n", + "D=0.0516; #diffusivity in cm**2/s\n", + "d=1.25*10**-3; #density of air in g/cm**3\n", + "u=1.786*10**-4; #viscosity of air in n*s/m**2\n", + "Dia=2.54; #diameter in cm\n", + "\n", + "# Calculation \n", + "nre=(Dia*v*d)/(u); #calc. of reynolds no.\n", + "cf=2*0.036*(nre)**(-0.25); #friction factor\n", + "nsc=(u)/(d*D); #calc of schmidt no.\n", + "kc=(cf*v)/(2*(nsc)**(2./3)); #cf/2=kc/uo*(sc)**2/3\n", + "\n", + "#consider an elelmental section of dx at a distance of x from the point of entry of air.\n", + "#let the conc. be c of diffusing component and c+dc at the point of leaving. mass balance across this elelmental gives\n", + " #rate of mass transfer=(cross sectional area)*(air velocity)*dc\n", + " # =(3.14*d**2/4)*v*dc -----1 eqn\n", + " \n", + "#flux for mass transfer from the surface=kc*(Cas-C)\n", + "# rate of mass transfer=(flux)*mass transfer\n", + "# =kc*(Cas-C)*3.14*dx*D------2 eqn\n", + "# solving ----1 & -----2 we get\n", + "# \n", + "# (3.14*d**2/4)*v*dc=kc*(Cas-C)*3.14*dx*d;\n", + "# dc/(Cas-C)=(kc*3.14*d*v)/(3.14*d**2/4)*dx\n", + "# solving this we get\n", + "# ln[(Cas-C)/(Cas-C_in)]=(kc*4*x)/(d*v)\n", + "import math\n", + "x=183; #upper limit of x\n", + "C_in=0; #C=C_in=0;\n", + "t=(kc*4*x)/(Dia*v); #variable to take out the exponential\n", + "z=math.e**t;\n", + "C_final=Cas-(z*(Cas-C_in)); #value of c_final in g*mol/cc;\n", + "\n", + "# Result\n", + "print \"\\t conc. of acid at outlet :%f *10**-8 g*mol/cc\\n\"%(abs(C_final/10**-8))\n", + "rate=(3.14*Dia**2/4)*v*(C_final-C_in);\n", + "print \"\\trate of mass transfer :%f *10**-4 g*mol/s\\n\"%(abs(rate/10**-4));\n", + "#End" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\t conc. of acid at outlet :7.709387 *10**-8 g*mol/cc\n", + "\n", + "\trate of mass transfer :5.954246 *10**-4 g*mol/s\n", + "\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Elements_Of_Mass_Transfer_Part_1/.ipynb_checkpoints/ch5-checkpoint.ipynb b/Elements_Of_Mass_Transfer_Part_1/.ipynb_checkpoints/ch5-checkpoint.ipynb new file mode 100644 index 00000000..d5ac1b11 --- /dev/null +++ b/Elements_Of_Mass_Transfer_Part_1/.ipynb_checkpoints/ch5-checkpoint.ipynb @@ -0,0 +1,957 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:b1fcea3b1af0833a04f8dbeea1fd73969d92b6f7184bdfbbc8fbd5b99b9f1ac6" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 5 : Humidification" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.1 ,page no:80" + ] + }, + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + " \n", + "\n", + "# Variable Declaration \n", + "#dry bulb temperature=50 and wet bulb temperature=35 \n", + "Tg=50.; #dry bulb temperature=50\n", + "To=0; #refrence temperature in degree celcius \n", + "Mb=28.84; #average molecular weight of air\n", + "Ma=18.; #average molecular weight of water\n", + "\n", + "#part(i)\n", + "ybar=.0483 #0.003 kg of water vapour/kg of dry air\n", + "print \"\\n the humidity(from chart) is \\t\\t:%f percent\"%ybar\n", + "\n", + "#part(ii)\n", + "humper=35.; #humidity percentage\n", + "print \"\\n the percentage humidity is(from chart) :%f percent\"%humper\n", + "\n", + "# Calculation and Result\n", + "#part(iii)\n", + "pt=1.013*10**5; #total pressure in pascal\n", + "molhum=0.0483; #molal humidity =pa/(pt-pa)\n", + "pa=molhum*pt/(1+molhum);\n", + "#the vopour pressure of water(steam tables)at 50degree = .1234*10**5 N/m**2\n", + "relhum=(pa/(.1234*10**5))*100; #percentage relative humidity =partial pressure/vapour pressure\n", + "print \"\\n the percentage relative humidity is \\t percent:%f \"%relhum\n", + "\n", + "#part(iv)\n", + "dewpoint=31.5; #dew point temperature in degree celcius\n", + "print \"\\n the dew point temperature \\t\\t :%f degree celcius\"%dewpoint\n", + "\n", + "#part(v)\n", + "Ca=1.005;\n", + "Cb=1.884;\n", + "ybar=.03; #saturation temperature inkg water vapour/kg dry air\n", + "Cs=Ca+Cb*ybar; #humid heat in kj/kg dry air degree celcius\n", + "print \"\\n we get humid heat as \\t\\t\\t :%f kj/kg dry air degree celcius \"%Cs\n", + "\n", + "#part(vi)\n", + "d=2502; #latent heat in kj/kg\n", + "H=Cs*(Tg-0)+ybar*d; #enthalpy for refrence temperature of 0 degree\n", + "print \"\\n we get H as \\t\\t\\t\\t :%f kj/kg\"%H\n", + "Hsat=274.; #enthalpy of sturated air\n", + "Hdry=50.; #enthalpy of dry air in kj/kg\n", + "Hwet=Hdry+(Hsat-Hdry)*0.35; #enthalpy of wet air in kj/kg\n", + "print \"\\n we get enthalpy of wet air as \\t:%f kj/kg\"%Hwet\n", + "\n", + "#part(vii)\n", + "VH=8315*((1./Mb)+(ybar/Ma))*((Tg+273.)/pt); #humid volume in m**3mixture/kg of dry air\n", + "print \"\\n we get VH as (a)\\t\\t\\t :%f m**3/kg of dry air\"%VH\n", + "spvol=1.055; #specific volume of saturated air in m**3*kg\n", + "vdry=0.91; #specific volume of dry air in m**3/kg\n", + "Vh=vdry+(spvol-vdry)*.35 #by interpolation we get Vh in m**3/kg of dry air \n", + "print \"\\n by interpolation we get specific volume Vh as(b) :%f m**3/kg of dry air\"%Vh\n", + "\n", + "#end" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.2 ,page no:81" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variable Declaration \n", + "\n", + "#dry bulb temperature=25 and wet bulb temperature=22\n", + "Tg=25.; #dry bulb temperature=50\n", + "To=0; #refrence temperature in degree celcius \n", + "Mb=28.84; #average molecular weight of air\n", + "Ma=18.; #average molecular weight of water\n", + "\n", + "\n", + "# Calculation and Result\n", + "#part(i)\n", + "hum=.0145 #0.0145 kg of water/kg of dry air\n", + "print \"\\n the saturation humidity(from chart) is :%f percent\"%hum\n", + "\n", + "#part(ii)\n", + "humper=57.; #humidity percentage\n", + "print \"\\n the percentage humidity is \\t\\t:%f percent\"%humper\n", + "\n", + "#part(iii)\n", + "pt=1.; #total pressure in atm\n", + "sathum=0.0255; #molal humidity =pa/(pt-pa)\n", + "pa1=sathum*pt*(28.84/18)/(1+(sathum*(28.84/18)));\n", + "#the vopour pressure of water(steam tables)at 25 = .0393*10**5 N/m**2\n", + "pt=1; #total pressure in atm\n", + "molhum=0.0145; #molal humidity =pa/(pt-pa)\n", + "pa2=molhum*pt*(28.84/18)/(1+(molhum*pt*(28.84/18)));\n", + "#the vopour pressure of water(steam tables)at 25 = .0393*10**5 N/m**2\n", + "relhum=(pa2/pa1)*100; #percentage relative humidity =partial pressure/vapour pressure\n", + "print \"\\n the percentage relative humidity is \\t :%f \"%relhum\n", + "\n", + "#part(iv)\n", + "dewpoint=19.5; #dew point temperature in degree celcius\n", + "print \"\\n the dew point temperature \\t :%f degree celcius\"%dewpoint\n", + "\n", + "#part(v)\n", + "Ca=1005.;\n", + "Cb=1884.;\n", + "ybar=.0145; # humidity inkg water /kg dry air\n", + "Cs=Ca+Cb*ybar; #humid heat in j/kg dry air degree celcius\n", + "d=2502300.; #latent heat in j/kg\n", + "H=Cs*(Tg-0)+ybar*d; #enthalpy for refrence temperature of 0 degree\n", + "print \"\\n we get Humid heat H as \\t :%f j/kg\"%H\n", + "#the actual answer is 62091.3 bt in book it is given 65188.25(calculation mistake in book)\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the saturation humidity(from chart) is :0.014500 percent\n", + "\n", + " the percentage humidity is \t\t:57.000000 percent\n", + "\n", + " the percentage relative humidity is \t :57.842165 \n", + "\n", + " the dew point temperature \t :19.500000 degree celcius\n", + "\n", + " we get Humid heat H as \t :62091.300000 j/kg\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.3,page no:82" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variable Declaration \n", + "\n", + "#part(i)\n", + "pt=800.; #total pressure in mmHg\n", + "pa=190.; #vapour pressure of acetone at 25 degree \n", + "ys_bar=pa*(58./28)/(pt-pa) #\n", + "#percentage saturation = y_bar/ys_bar *100\n", + "s=80; #percent saturation\n", + "\n", + "# Calculation and Result\n", + "y_bar=ys_bar*s/100.; #absolute humidity\n", + "print \"\\n the absolute humidity is \\t :%f kg acetone/kmol N2 \"%y_bar\n", + "\n", + "#part(ii)\n", + "#y_bar=pa*(58/28)/(pt-pa) \n", + "pa1=pt*y_bar*(28./58)/(1+(y_bar*(28./58)));\n", + "print \"\\n the partial pressure of acetone is:%f mmHg\"%pa1\n", + "\n", + "#part(iii)\n", + "y=pa1/(pt-pa1); #absolute molal humidity\n", + "print \"\\n absolute molal humidity \\t:%f kmol acetone/kmol N2\"%y\n", + "\n", + "#part(iv)\n", + "#volume of .249kmol acetone vapour at NTP =.249*22.14\n", + "#p1v1/T1 =p2v2/T2\n", + "p2=800.; #final pressure of acetone and nitrogen at 25 degree\n", + "p1=760.; #initial pressure of acetone and nitrogen at 25 degree\n", + "T2=298.; #final temperature of acetone and nitrogenat 25 degree\n", + "T1=273.; #initial temperature of acetone and nitrogen at 25 degree\n", + "vA1=5.581; #initial volume of acetone at 25 degree\n", + "vN1=22.414; #initial volume of nitrogen at 25 degree \n", + "vA2=T2*vA1*p1/(T1*p2); #final volume of acetone at 25 degree\n", + "vN2=T2*vN1*p1/(T1*p2); #final volume of nitrogen at 25 degree\n", + "vtotal=vA2+vN2; #total volume of the mixture\n", + "vper=vA2*100/vtotal; #percentage volume of acetone\n", + "print \"\\n the percentage volume of acetone is :%f m**3\"%vper\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the absolute humidity is \t :0.516159 kg acetone/kmol N2 \n", + "\n", + " the partial pressure of acetone is:159.580052 mmHg\n", + "\n", + " absolute molal humidity \t:0.249180 kmol acetone/kmol N2\n", + "\n", + " the percentage volume of acetone is :19.935703 m**3\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.4 ,page no:83" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "# Variable Declaration \n", + "\n", + "#part(i)\n", + "pa=13.3; #pressure in kpa\n", + "pa2=20.6; #vapour pressure at 60 degree\n", + "pt=106.6 #total pressure in kpa\n", + "y=pa/(pt-pa); #absolute molal humidity\n", + "\n", + "# Calculation and Result\n", + "y_bar=y*(18/28.84); #relative humidity\n", + "print \"\\n absolute humidity of mixture :%f kg water-vapour/kg dry air\"%y_bar\n", + "\n", + "\n", + "#part(ii)\n", + "mf=pa/pt; #mole fraction\n", + "print \"\\n the mole fraction is :%f\"%mf\n", + "\n", + "#part(iii)\n", + "vf=mf; #volume fraction\n", + "print \"\\n the volume fraction is :%f\"%vf\n", + "\n", + "#part(iv)\n", + "Ma=18.; #molecular weight\n", + "Mb=28.84; #molecular weight\n", + "Tg=60.; #temperature of mixture\n", + "rh=(pa/pa2)*100.; #relative humidity in pecentage \n", + "print \"\\n we get relative humidity as as :%f percent\"%rh\n", + "\n", + "#part(v)\n", + "VH=8315.*((1./Mb)+(y_bar/Ma))*((Tg+273)/pt)*10**-3; #humid volume in m**3mixture/kg of dry air\n", + "x=y_bar/VH; #g water/m**3 mixture \n", + "print \"\\n we get x i.e. gwater/m**3 mixture as :%f \"%(x*1000)\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " absolute humidity of mixture :0.088971 kg water-vapour/kg dry air\n", + "\n", + " the mole fraction is :0.124765\n", + "\n", + " the volume fraction is :0.124765\n", + "\n", + " we get relative humidity as as :64.563107 percent\n", + "\n", + " we get x i.e. gwater/m**3 mixture as :86.460483 \n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.5 ,page no:84" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "# Variable Declaration \n", + "\n", + "#part(i)\n", + "y_bar=.0183; #kg water vapour/kg dry air\n", + "print \"\\n we get humidity as(from chart) :%f kg of water/kg dry air\"%y_bar\n", + "print \"\\n we get saturation humidity as(from chart) :%d percent\"%67\n", + "Ma=18.; #molecular weight\n", + "Mb=28.84; #molecular weight\n", + "Tg=30.; \n", + "pa = 13.3\n", + "pa2 = 20.6 #temperature of mixture\n", + "rh=(pa/pa2)*100; #relative humidity in pecentage \n", + "pt=1.013*10**5; #total pressure in pascal\n", + "\n", + "# Calculation and Result\n", + "VH=8315*((1./Mb)+(y_bar/Ma))*((Tg+273)/pt); #humid volume in m**3mixture/kg of dry air\n", + "print \"\\n we get humid volume as \\t:%f m**3/kg dry air\"%VH\n", + "\n", + "#part(ii)\n", + "Ca=1005.;\n", + "Cb=1884.;\n", + "Cs=Ca+Cb*y_bar; #humid heat in j/kg dry air degree celcius\n", + "print \"\\n we get humid heat as \\t\\t :%f j/kg dry air degree celcius \"%Cs\n", + "\n", + "#part(iii)\n", + "d=2502300.; #latent heat in j/kg\n", + "H=Cs*(Tg-0)+y_bar*d; #enthalpy for refrence temperature of 0 degree\n", + "print \"\\n we get Enthalpy H as \\t\\t:%f j/kg dry air\"%H\n", + "\n", + "#part(iv)\n", + "dewpoint=23.5; #dew point temperature in degree celcius\n", + "print \"\\n the dew point temperature \\t :%f degree celcius\"%dewpoint\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " we get humidity as(from chart) :0.018300 kg of water/kg dry air\n", + "\n", + " we get saturation humidity as(from chart) :67 percent\n", + "\n", + " we get humid volume as \t:0.887669 m**3/kg dry air\n", + "\n", + " we get humid heat as \t\t :1039.477200 j/kg dry air degree celcius \n", + "\n", + " we get Enthalpy H as \t\t:76976.406000 j/kg dry air\n", + "\n", + " the dew point temperature \t :23.500000 degree celcius\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.6 ,page no:85" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variable Declaration \n", + "\n", + "#part(i)\n", + "y=.048; #humidity kmol water vapour/kmol dry air\n", + "y_bar=y*(18/28.84); #(from chart) absolute humidity\n", + "print \"we get absolute humidity as :%f kg of water/kg dry air\"%(y_bar)\n", + "print \"we get percentage humidity as(from chart) :%f percent\"%(25.5);\n", + "\n", + "# Calculation and Result\n", + "y_bar=y*(18/28.84); #relative humidity\n", + "Ma=18.; #molecular weight\n", + "Mb=28.84; #molecular weight\n", + "Tg=55.; #temperature of mixture\n", + "pt=1.013*10**5; #total pressure in pascal\n", + "VH=8315*((1./Mb)+(y_bar/Ma))*((Tg+273)/pt); #humid volume in m**3mixture/kg of dry air\n", + "print \"\\n we get VH as \\t :%f m**3/kg dry air\"%VH\n", + "\n", + "#part(ii)\n", + "Ca=1005.;\n", + "Cb=1884.;\n", + "Cs=Ca+Cb*y_bar; #humid heat in j/kg dry air degree celcius\n", + "print \"\\n we get humid heat as \\t :%f j/kg dry air degree celcius \"%Cs\n", + "\n", + "#part(iii)\n", + "d=2502300.; #latent heat in j/kg\n", + "H=Cs*(Tg-0)+y_bar*d; #enthalpy for refrence temperature of 0 degree\n", + "print \"\\n we get H as \\t :%f j/kg dry air\"%H\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "we get absolute humidity as :0.029958 kg of water/kg dry air\n", + "we get percentage humidity as(from chart) :25.500000 percent\n", + "\n", + " we get VH as \t :0.978346 m**3/kg dry air\n", + "\n", + " we get humid heat as \t :1061.441609 j/kg dry air degree celcius \n", + "\n", + " we get H as \t :133344.170596 j/kg dry air\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.7 ,page no:86" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "# Variable Declaration \n", + "\n", + " \n", + "ft=46; #final temperature in degree celcius\n", + "# Calculation and Result\n", + "print \"\\n final temperature is (from chart):%f degree celcius\"%ft\n", + "y_bar=.0475; # humidity of air\n", + "print \"\\n the humidity of air(from chart) :%f kg water vapour /kg dry air\"%y_bar\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " final temperature is (from chart):46.000000 degree celcius\n", + "\n", + " the humidity of air(from chart) :0.047500 kg water vapour /kg dry air\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.8,page no:87" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variable Declaration \n", + "\n", + "pa1=4.24 #data: vapour pressure of water at 30degree = 4.24 kpa\n", + "pa2=1.70 # vapour pressure of water at 30degree = 1.70 kpa\n", + "\n", + "#part(i)\n", + "pt=100.; #total pressure\n", + "\n", + "# Calculation \n", + "ys_bar=pa1/(pt-pa1); #kg water vapour/kg dry air\n", + "rh=.8; #relative humidity\n", + "pa3=rh*pa1; #partial pressure\n", + "y_bar=pa3*(18/28.84)/(pt-pa3); #molal humidity\n", + "print \"\\n the molal humidity:%f kg/kg dry air\"%y_bar\n", + "\n", + "#part(ii)\n", + "#under these conditions the air will be saturated at 15 degree as some water is condensed\n", + "pa=1.7; \n", + "pt=200.;\n", + "ys=pa/(pt-pa);\n", + "ys_bar=ys*(18/28.84);\n", + "\n", + "# Result\n", + "print \"\\n the molal humidity if pressure doubled and temp. is 15 :%f kg/kg dry air\"%ys_bar\n", + "\n", + "#part(iii) \n", + "Ma=18.; #molecular weight\n", + "Mb=28.84; #molecular weight\n", + "Tg=30.; #temperature of mixture\n", + "rh=(pa/pa2)*100; #relative humidity in pecentage \n", + "pt=10**5; #total pressure in pascal\n", + "VH=8315*((1./Mb)+(y_bar/Ma))*((Tg+273)/pt); #humid volume in m**3mixture/kg of dry air\n", + "print \"\\n we get humid volume VH as \\t :%f m**3/kg of dry air\"%VH\n", + "w=100/VH; #100 m**3 of original air \n", + "wo= w*y_bar; #water present in original air\n", + "wf= w*ys_bar; #water present finally\n", + "wc=wo-wf; #water condensed from 100m**3 of original sample\n", + "print \"\\n the weight water condensed from 100m**3 of original sample:%f kg\"%wc\n", + "\n", + "#part(iv)\n", + "Tg=15.; #temperature of mixture \n", + "pt=2*10**5; #total pressure in pascal\n", + "VH=8315*((1./Mb)+(ys_bar/Ma))*((Tg+273)/pt); #humid volume in m**3mixture/kg of dry air\n", + "vf=VH*110.6; #final volume of mixture\n", + "print \"\\n we get VH final volume of mixture as \\t :%f m**3\"%vf\n", + "\n", + "#end\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the molal humidity:0.021914 kg/kg dry air\n", + "\n", + " the molal humidity if pressure doubled and temp. is 15 :0.005351 kg/kg dry air\n", + "\n", + " we get humid volume VH as \t :0.904267 m**3/kg of dry air\n", + "\n", + " the weight water condensed from 100m**3 of original sample:1.831684 kg\n", + "\n", + " we get VH final volume of mixture as \t :46.311825 m**3\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.9,page no:88" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variable Declaration \n", + "\n", + "#part(i)\n", + "y_bar=.03; # humidity inkg water /kg dry air\n", + "pt=760.; #total pressure in pascal\n", + "pa2=118.; #final pressure\n", + "\n", + "# Calculation and Result\n", + "y=y_bar/(18/28.84); #humidity kmol water vapour/kmol dry air\n", + "pa=(y*pt)/(y+1); #partial pressure\n", + "rh=pa/pa2; #relative humidity\n", + "sh=pa2/(pt-pa2); #saturated humidity\n", + "ph=(y/sh)*100; #percentage humidity\n", + "print \"\\n percentage humidity is :%f\"%ph\n", + "\n", + "#/part(ii)\n", + "Ma=18.; #molecular weight\n", + "Mb=28.84; #molecular weight\n", + "Tg=55.; #temperature of mixture\n", + "pt=1.013*10**5; #total pressure in pascal\n", + "VH=8315*((1./Mb)+(y_bar/Ma))*((Tg+273)/pt); #humid volume in m**3mixture/kg of dry air\n", + "print \"\\n we get VH humid volume as :%f m**3/kg dry air\"%VH\n", + "\n", + "\n", + "#part(iii)\n", + "Ca=1005.;\n", + "Cb=1884.;\n", + "Cs=Ca+Cb*y_bar; #humid heat in j/kg dry air degree celcius\n", + "print \"\\n we get humid heat as \\t :%f j/kg dry air degree celcius \"%Cs\n", + "d=2502300; #latent heat in j/kg\n", + "H=Cs*(Tg-0)+y_bar*d; #enthalpy for refrence temperature of 0 degree\n", + "print \"\\n we get H enthalpy as \\t :%f j/kg\"%H\n", + "\n", + "#part(iv)\n", + "v=100.; #volume of air\n", + "mass=v/VH; #mass of dry air\n", + "Tg=110.; #temperature of mixture\n", + "d=2502300.; #latent heat in j\n", + "H_final=Cs*(Tg-0)+y_bar*d; #enthalpy for refrence temperature of 0 degree\n", + "H_added=(H_final-H)*102.25; #HEAT added in kj \n", + "print \"\\n we get heat added as \\t :%f kj\"%(H_added/1000)\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " percentage humidity is :26.151525\n", + "\n", + " we get VH humid volume as :0.978409 m**3/kg dry air\n", + "\n", + " we get humid heat as \t :1061.520000 j/kg dry air degree celcius \n", + "\n", + " we get H enthalpy as \t :133452.600000 j/kg\n", + "\n", + " we get heat added as \t :5969.723100 kj\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.10,page no:89" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variable Declaration \n", + "\n", + "%pylab inline\n", + "L=2000.; #flow rate of water to be cooled in kg/min\n", + "T1=50.; #temperature of inlet water\n", + "T2=30.; #temp. of outlet water\n", + "H1=.016; #humidity of incoming air\n", + "cp=4.18; #specific heat of water\n", + "cpair=1.005; #specific heat capcity of air\n", + "cpwater=1.884; #specific heat capcity of water\n", + "tg=20.; #temperature in degree\n", + "to=0;\n", + "ybar=0.016; #saturated humidity at 20 degree\n", + "d=2502.; #latent heat\n", + "Ky_a=2500.; #value of masstransfer coefficient in kg/hr*m**3*dybar\n", + "\n", + "# Calculation \n", + "E=cpair*(tg-to)+(cpwater*(tg-to)+d)*ybar; #enthalpy\n", + "#similarly for other temperatures\n", + "T=[20,30,40,50,55] #differnt temperature for different enthalpy calculation\n", + "i=0;\n", + "E= [0,0,0,0,0]\n", + "while(i<5): #looping for different enthalpy calculation of operating line\n", + " E[i]=cpair*(T[i]-to)+(cpwater*(T[i]-to)+d)*ybar;\n", + " print \"\\n the enhalpy at :%f is :%f\"%(T[i],E[i]);\n", + " i=i+1;\n", + "\n", + "ES=[60.735,101.79,166.49,278.72,354.92] #enthalpy of eqll condition\n", + "from matplotlib.pyplot import *\n", + "\n", + "# Result\n", + "plot(T,E);\n", + "plot(T,ES);\n", + "title(\"Fig.5.10(b),Temperature-Enthalpy plot\");\n", + "xlabel(\"X-- Temperature, degree celcius\");\n", + "ylabel(\"Y-- Enthalpy ,kj/kg\");\n", + "legend(\"operating line\",\"Enthalpy at saturated cond\")\n", + "show()\n", + "#locate (30,71.09) the operating conditions at the bottom of the tower and draw the tangent to the curve\n", + "Hg1=71.09; #point on the oper. line(incoming air)\n", + "Hg2=253.; #point after drawing the tangent\n", + "slope=(Hg2-Hg1)/(T1-T2); #we gt slope of the tangent\n", + " #slope = (L*Cl/G)_min\n", + "Cl=4.18;\n", + "G_min=L*60*Cl/slope; #tangent gives minimum value of the gas flow rate\n", + "G_actual=G_min*1.3; #since actual flow rate is 1.3 times the minimum\n", + "slope2=L*Cl*60/G_actual; #slope of operating line\n", + "Hg2_actual=slope2*(T1-T2)+Hg1; #actual humidityat pt 2\n", + "Ggas=10000.; #minimum gas rate in kg/hr*m**2\n", + "Area1=G_actual/Ggas; #maximum area of the tower(based on gas)\n", + "Gliq=12000.; #minimum liquid rate in kg/hr*m**2\n", + "Area2=60*L/Gliq; #maximum area of the tower(based on liquid)\n", + "print \"\\n \\n the maximum area of the tower(based on gas) is :%f m**2\"%Area1\n", + "print \"\\n the maximum area of the tower(based on liquid) is :%f m**2\"%Area2\n", + "dia=(Area1*4/3.14)**0.5; #diameter of the tower in m\n", + "\n", + "#let us assume the resistance to mass transfer lies basically in gas phase. hence the,interfacial conditions and the eqlb cond. are same.vertical line drawn between oper. and equl. line we get conditions of gas and equl. values are tabulated below as follows\n", + " \n", + " \n", + "#table\n", + "T=[20,30,40,50,55] #differnt temperature for different enthalpy calculation\n", + "#enthaly \n", + "H_bar=[101.79,133.0,166.49,210.0,278.72] #H_bar i.e. at equl.\n", + "Hg=[71.09,103.00,140.00,173.00,211.09] #Hg i.e. of operating line\n", + "i=0;\n", + "y = [0,0,0,0,0]\n", + "while(i<5): #looping for different enthalpy calculation of operating line\n", + " y[i]=1./(H_bar[i]-Hg[i]);\n", + " print \"\\n the enhalpy at :%f is :%f\"%(T[i],y[i]);\n", + " i=i+1;\n", + "\n", + "plot(Hg,y,\"o-\");\n", + "\n", + "#area under this curve gives Ntog =4.26\n", + "Ntog=4.26; #no. of transfer unit\n", + "Gs=10000.; #gas flow rate\n", + "Htog=Gs/Ky_a; # height of transfer unit\n", + "height=Ntog*Htog; #height of the tower\n", + "print \"\\n \\nthe tower height is :%f m\"%height\n", + "\n", + "\n", + "#make up water is based onevaporation loss(E),blow down loss(B),windage loss(W) M = E + B + W\n", + "W=.2/100 *L*60; #windage loss(W)\n", + "B=0; #blow down loss neglected\n", + "E=G_actual*(.064-.016); #assuming air leaves fully saturated\n", + "M = E + B + W; #make up water is based onevaporation loss(E),blow down loss(B),windage loss(W)\n", + "print \"\\n make up water is based onevaporation loss(E),blow down loss(B),windage loss(W) is :%f kg /hr\"%M\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Populating the interactive namespace from numpy and matplotlib\n", + "\n", + " the enhalpy at :20.000000 is :60.734880\n", + "\n", + " the enhalpy at :30.000000 is :71.086320\n", + "\n", + " the enhalpy at :40.000000 is :81.437760\n", + "\n", + " the enhalpy at :50.000000 is :91.789200\n", + "\n", + " the enhalpy at :55.000000 is :96.964920\n" + ] + }, + { + "output_type": "stream", + "stream": "stderr", + "text": [ + "/usr/lib/pymodules/python2.7/matplotlib/legend.py:336: UserWarning: Unrecognized location \"Enthalpy at saturated cond\". Falling back on \"best\"; valid locations are\n", + "\tright\n", + "\tcenter left\n", + "\tupper right\n", + "\tlower right\n", + "\tbest\n", + "\tcenter\n", + "\tlower left\n", + "\tcenter right\n", + "\tupper left\n", + "\tupper center\n", + "\tlower center\n", + "\n", + " % (loc, '\\n\\t'.join(self.codes.iterkeys())))\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYcAAAEXCAYAAABGeIg9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzs3XlYE+f6P/53WBSBsKiACmpwoQoioAjUuqAI1gVEaVFQ\nBPflqLUe12OrWFu1re23ouWc1lpFreKuiBtusVWrCOIGKlYRkM2FRVYhyfP7wx/zIULYJEwC9+u6\nuK5kkpm8M8a5Z5555hkBY4yBEEIIqUCD7wCEEEJUDxUHQgghlVBxIIQQUgkVB0IIIZVQcSCEEFIJ\nFQdCCCGVUHFQcUKhEE+fPuU7Ro3OnDmDsWPHcs81NDTw5MmTKt97/PhxTJgwobGikQYgFovRsWPH\nes379OlTaGhoQCaTNXCq6gUHByMgIKBRP7MpoeKgIkQiEXR1dSEUCiEUCmFgYIDMzEzk5+dDJBLV\neXnl/yHLlycUCvHNN98ofP+WLVvg6OgIHR0dTJkypdLr58+fR48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l5YXZbMb9/T0ej4f5\nfM5sNiObzXJ2dsZ4PP7pvcl6KDmIS6/XIxQKOaWkw8NDHh8fGQwGfx0zEolwfHxMJpPBsiwymYzT\ndH3/Jrq6v7qdTCbJ5XJYlkU+n8e27T+O6/f7qVQqmKbJzs6OU6qB5Sel1WrVaUi3221qtRpbW1t4\nvV4nzvuviy4vLxmNRliWRTQadZq90+n0w9LS3t4e4XAYwzAol8tsb28Dy5nT7e0tzWaTeDxOIpFg\nOBwCcH19TaVSIZFI8Pz8jM/n+/BaWq0Wi8WCWCyGaZq0220A9vf3MQwD27bZ2Njg4ODANRszDIOj\noyPS6TTxeJx6vf7L+1s998XFBf1+n1gsxubmplOG+nE8EAhQKBQwTZNisYht28CyRLW7u4tlWaRS\nKc7Pz13jJeulH+/Jt3Bzc8PDwwNXV1frvpTfajQalEolTNP851jz+dwpH3U6HZ6envQglS+hnoN8\nC5+1JuArnJ6eflqsu7s7Tk5OeH19JRQKrXWtiPxfNHMQEREX9RxERMRFyUFERFyUHERExEXJQURE\nXJQcRETERclBRERc3gD5uXssNmBL3wAAAABJRU5ErkJggg==\n", + "text": [ + "" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " \n", + " the maximum area of the tower(based on gas) is :7.169260 m**2\n", + "\n", + " the maximum area of the tower(based on liquid) is :10.000000 m**2\n", + "\n", + " the enhalpy at :20.000000 is :0.032573\n", + "\n", + " the enhalpy at :30.000000 is :0.033333\n", + "\n", + " the enhalpy at :40.000000 is :0.037750\n", + "\n", + " the enhalpy at :50.000000 is :0.027027\n", + "\n", + " the enhalpy at :55.000000 is :0.014786\n", + "\n", + " \n", + "the tower height is :17.040000 m\n", + "\n", + " make up water is based onevaporation loss(E),blow down loss(B),windage loss(W) is :3681.244571 kg /hr\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAD9CAYAAABTJWtQAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz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3TidToYNG9aofVZWFi6XixEjRjBixAiKiopaeRgiIsGvXz9riurixVZyCEY+k4LX62XOnDkUFRWx\ne/du1qxZw549exq1KSwsZN++fZSXl7Ny5UoyMjLsn82aNavJE77D4eD++++nrKyMsrIybr75Zj8d\njohIcLvqKuuKIT3dqmUINj6TQmlpKVFRUURERBASEkJqair5+fmN2hQUFJCWlgZAYmIitbW1HDx4\nEIAbbriBvn37NrlvDSCLSFd1ag3DqlXbSEn5CUlJWaSk/ISNG7cFNDafdQrV1dWEh4fbz10uFzt2\n7Dhnm+rqagYMGODzjZcvX05eXh4JCQk8/fTThIaGtiR+EZEOye2GTZu2kZHxMsePL7a379+/EICJ\nE8cEJC6fScHhcDRrJ6d/6z/X6zIyMnjssccAePTRR5k/fz6rVq1qsm1WVpb9OCkpiaSkpGbFJCIS\n7D74YHOjhACwf/9ili9/tNlJobi4mOLiYr/F5DMphIWF4fF47OcejweXy+WzTVVVFWFhYT7ftH//\n/vbje+65h0k+7np9alIQEelMjh1r+hRcV9e92fs4/cvyokWLWhWTzzGFhIQEysvLqayspL6+nrVr\n1+I+bck/t9tNXl4eACUlJYSGhuJ0On2+6YEDB+zH69evP2N2kohIV9Cz54kmt/fq5W3nSL7mMyn0\n6NGDFStWkJKSQmxsLLfffjuDBw8mJyeHnJwcACZMmMBVV11FVFQUs2fP5tlnn7VfP2PGDEaPHs3e\nvXsJDw9n9erVADz00EMMHz6cuLg4XnvtNZ555pk2PEQRkeCUmTmeyMiFjbZFRj7C3LnJAYpIy1yI\niATUxo3bWL58C3V13enVy8vcucmtGmTW2kciImLT2kciIuI3SgoiImJTUhAREZuSgoiI2JQURETE\npqQgIiI2JQUREbEpKYiIiE1JQUREbEoKIiJiU1IQERGbkoKIiNiUFERExKakICIiNiUFERGxKSmI\niIhNSUFERGxKCiIiYlNSEBERm5KCiIjYlBRERMSmpCAiIjYlBRERsSkpiIiITUlBRERsSgoiImJT\nUhAREds5k0JRURExMTFER0ezZMmSJttkZmYSHR1NXFw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\nGuK88847G03p98fnKCiSwoABAwgPD2fv3r0AvPLKKwwZMoRJkyYFVT1DTEwMJSUlHD16FGMMr7zy\nCrGxsUEXZ4Oz1YO43W5eeukl6uvrqaiooLy8nGuvvTZgcRYVFfHUU0+Rn59Pr1697O3BEuewYcOo\nqamhoqKCiooKXC4XO3fuxOl0Bk2MDSZPnszWrVsB2Lt3L/X19Vx22WVBF2dUVBSvvfYaAFu3bmXQ\noEFAYP/NjTGkp6cTGxvLvHnz7O3B9jk6W5x++xy17Th58+3atcskJCQ0mk716aefmrFjxwbVlNQl\nS5bYU1LvuusuU19fHxRxpqammm9+85smJCTEuFwu8/zzz/uMa/HixSYyMtJcffXV9iyQQMS5atUq\nExUVZa688koTHx9v4uPjTUZGRkDjbIjxggsusH+Xpxo4cGCjKamB/l2eGmd9fb258847zdChQ83I\nkSPNq6++GjRxnvp/8+233zbXXnutiYuLM9ddd53ZuXNnwON8/fXXjcPhMHFxcfb/xU2bNgXd56ip\nOAsLC/32OXIYo7UkRETEEhTdRyIiEhyUFERExKakICIiNiUFERGxKSmIiIhNSUFERGz/D9lv2CnP\n3JueAAAAAElFTkSuQmCC\n", + "text": [ + "" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.11,page no:90" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + " \n", + "T1=30.; #temperature at the inlet in degree celcius\n", + "T2=17.; #temperature at the exit in degree celcius\n", + "f=100000.; #flow rate of water in kg/hr\n", + "hi=.004; #humidity of incoming air in kg/kg of dry air\n", + "hl=.015; #humidity of leaving air in kg/kg of dry air\n", + "Hi=18.11; #enthalpy of incoming air in kg/kg of dry air\n", + "Hl=57.16; #enthalpy of leaving air in kg/kg of dry air\n", + "#w=mdry*(hl-hi) = mdry*0.011; -----equn 1st \n", + "#mass of water evaporated\n", + "\n", + "#making energy balance: total heat in = total heat out\n", + "#heat in entering water + heat in entering air = heat in leaving water + heat in leaving air\n", + "#100000*1*(30-0) + mdry*Hi = (100000-w)*1*(17-0) + mdry*Hl ----eqn 2nd\n", + "\n", + "#substituting eqn 1st in 2nd we get;\n", + "a=14.4; #cross sectional area of the tower in m**2\n", + "\n", + "# Calculation \n", + "mdry=(T1*f-T2*f)/(Hl-Hi-T2*.011); #mass of dry air\n", + "velocity=mdry/a; #air velocity in kg/m**2* hr\n", + "x=mdry*.011; #make up water needed in kg/hr\n", + "\n", + "# Result\n", + "print \"\\n the make up water needed is :%f kg /hr\"%x\n", + "print \"\\n the velocity of air is as :%f kg/hr\"%velocity\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the make up water needed is :367.959241 kg /hr\n", + "\n", + " the velocity of air is as :2322.975009 kg/hr\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.12 ,page no:91" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + " \n", + "\n", + "T1=65; #dry bulb temperature at the inlet in degree celcius\n", + "f=3.5; #flow rate of air in m**3/s\n", + "hi=1.017; #humidity of incoming air in kg/kg of dry air\n", + "hl=.03; #humidity of leaving air in kg/kg of dry air\n", + "k=1.12; #mass transfer coefficient in kg/m**3*s\n", + "y1=.017; #molefraction at recieving end\n", + "y2=.03; #molefraction at leaving end\n", + "\n", + "#substituting eqn 1st in 2nd we get;\n", + "a=2; #cross sectional area of the tower in m**2\n", + "d=1.113; #density o fair in kg/m**3\n", + "\n", + "# Calculation \n", + "m=(f*d) #mass flow rate of air\n", + "gs=m/hi; #air velocity in kg/m**2* hr\n", + "ys_bar=.032;\n", + "#for recirculation humidifier\n", + "# Result\n", + "z=math.log((ys_bar-y1)/(ys_bar-y2))*gs/k; #length of the chamber required\n", + "print \"\\n the length of the chamber required is :%f m\"%z\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the length of the chamber required is :6.890939 m\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Elements_Of_Mass_Transfer_Part_1/.ipynb_checkpoints/ch6-checkpoint.ipynb b/Elements_Of_Mass_Transfer_Part_1/.ipynb_checkpoints/ch6-checkpoint.ipynb new file mode 100644 index 00000000..0bb12c4f --- /dev/null +++ b/Elements_Of_Mass_Transfer_Part_1/.ipynb_checkpoints/ch6-checkpoint.ipynb @@ -0,0 +1,1255 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:908e06aad04692e83df6966ed7f965ac13bd8644318dfcc775c5b26cef8525a8" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 6 : Drying" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.1 ,page no:92" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "H1=.005; #humidity of incoming air per kg of dry air\n", + "T1=25.; #wet bulb temperature\n", + "#moisture is removed along constant wet bulb temp. till 60per R.H is reached\n", + "# from the chart ,humidity of ai rleaving first shelf =.016 kg water /kg dry air.\n", + "\n", + "#dry bulb temp. of exit air is at 27 degree aand is at humidity of .016 kg water/kg dry air.the air is again heated to 52 degree dry bulb temp. in 2nd heater .\n", + "\n", + "#so air leaves heater at 52 degree and humidity of .016 kg water/kg dry air. when it leaves the 2nd shelf the correspondin dry bulb temp. is 34 degree and humidity is .023 kg water/kg dry air. the air enters the 3rd shelf after preheating to 52 degree . \n", + " \n", + "#similarly fro 3rd shelf , exit air has a humidity of .028 kg water/kg dry air and adry bulb temp. is 39 degree. the air is leaving the 4rth shelf has a humidity of .016 kg water/kg dry air and adry bulb temp. of 42 degree(the figure is only indicative and doed not correspond toactual one)\n", + "\n", + "print \"\\n the solid temp. correspond to wbt and they are 23, 27,32 and 34 degree respectively\"\n", + "\n", + "#part(ii)\n", + "Ybar=.032; #kg water/kg dry air#final moist air condotions \n", + "T2=42.; #dry bulb temperature\n", + "Mair=28.84; #molecular weight of air \n", + "Mwater=18; #molecular weight of water\n", + "pt=1.013*10**5; #total pressure in pascal\n", + "Vh=8315*((1/Mair)+(Ybar/Mwater))*((T2+273)/pt);\n", + "r=300; #flow rate of moist air leaving the dryer\n", + "a=r*60/Vh; #amount of dry air leaving /hr\n", + "w=a*(Ybar-0.005); # water removed /hr\n", + "\n", + "# Result\n", + "print \"\\n the water removed /hr is :%fkg /hr\"%w\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the solid temp. correspond to wbt and they are 23, 27,32 and 34 degree respectively\n", + "\n", + " the water removed /hr is :515.648113kg /hr\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.2,page no:93 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "%pylab inline\n", + "#table X*100,(kgmoisture/kg dry solid) N*100 (kg moisture evaporated /hr*m**2)\n", + " \n", + "# 35 30\n", + "# 25 30\n", + "# 20 30\n", + "# 18 26.6\n", + "# 16 23.9\n", + "# 14 20.8\n", + "# 12 18\n", + "# 10 15\n", + "# 9 9.7\n", + "# 8 7\n", + "# 7 4.3\n", + "# 6.4 2.511111\n", + "\n", + "\n", + "Ls=262.5; #mass of bone dry solid ais the drying surface\n", + "A=262.5/8; #both upper surafce and lower surface are exposed\n", + "Nc=0.3; #in kg/m**2*hr\n", + "x2=.06; #moisture content on wet basis finally after drying\n", + "x1=.25; #moisture content on wet basis finally after drying\n", + "Xcr=0.20; #crtical moisture content\n", + "X1=x1/(1-x1); #moisture content on dry basis intially\n", + "X2=x2/(1-x2); #moisture content on dry basis finally after drying\n", + "Xbar=0.025; #equillibrium moisture \n", + "\n", + "# Calculation \n", + "t1=Ls/(A*Nc) *(X1-Xcr); #so for constant rate period \n", + "\n", + "#for falling rate period we find time graphically\n", + "p = [.20 ,.18, .16, .14, .12, .10, .09, .08, .07, .064];\n", + "a = [3.3, 5.56, 6.25, 7.14, 8.32, 10.00, 11.11, 12.5, 14.29, 15.625];\n", + "from matplotlib.pyplot import *\n", + "\n", + "# Result\n", + "plot(p,a);\n", + "title(\"Fig.6.18 Example2 1/N vs X for fallling rate period\");\n", + "xlabel(\"X-- Moisture content, X(kg/kg)\");\n", + "ylabel(\"Y-- 1/N, hr,m**2/kg\");\n", + "\n", + "Area=1.116; #area under the curve\n", + "t2=Area *Ls/A; #falling rate period we find time graphically\n", + "ttotal=t1+t2; #total time for drying\n", + "print \"\\n the total time for drying the wet slab on wet basis is :%f min\"%ttotal\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Populating the interactive namespace from numpy and matplotlib\n", + "\n", + " the total time for drying the wet slab on wet basis is :12.483556 min\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEXCAYAAABCjVgAAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl8TGcXB/DfRGLNbglZJGiRXSJIaBhiJ5aUEFtIUfRt\nay2109oppUWrJKmivHYqocJYmyoRsVaLIIklCFkksp33j/vmMkkmEsnMnUnO9/PxkZm59z5nljtn\nnuU+j4yICIwxxhgAPakDYIwxpj04KTDGGBNxUmCMMSbipMAYY0zESYExxpiIkwJjjDFRhU0KRkZG\niI2NlTqMckehUMDGxkbqMHTKnj17YGNjAyMjI1y6dKnUx3v06BHatm0LY2NjTJky5a3b6+np4fbt\n2wCA4cOHY9asWQAKvpdOTk44efJkqeMrj0r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WCTCbD2rVr0bVrV3h4eMDY2FhpBbdz586hbdu2hT4/pv14QjzGtNTVq1cRHByM5cuXl2g/hUKB\n7du3Y926dSq3yc3NRVZWFqpUqYJbt26hc+fOuHHjBnr06IHNmzfDwsKiyDLS0tLEZrpPPvkEjRs3\nxueff47c3Fy4u7vj/Pnz0NfXL1HcTDtwUmCsHOrYsSP27Nmj8lqFlJQUdOjQAVlZWSAiLF26FF26\ndCn28VetWoXQ0FBkZmbC3d0dGzZsQNWqVbF//37ExMRg5syZZfVUmIZxUmCMMSbiPgXGGGMiTgqM\nMcZEnBQYY4yJOCkwxhgTcVJgjDEm4qTAGGNM9D/a8te+YditMAAAAABJRU5ErkJggg==\n", + "text": [ + "" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.3.a ,page no:94" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#part(i)\n", + "#table wt of wet slab,kg -- 5.0 4.0 3.6 3.5 3.4 3.06 2.85\n", + "# drying rate,kg/m**2s-- 5.0 5.0 4.5 4.0 3.5 2.00 1.00\n", + "# X,Dry basis -- 1.0 0.6 .44 0.4 .36 .224 0.14\n", + "# equillibrium relation is given under\n", + "\n", + "# Variable Declaration \n", + "p = [1.0,0.6,.44,0.4,.36,.224, 0.14];\n", + "a = [5.0,5.0, 4.5, 4.0, 3.5, 2.00, 1.00];\n", + "\n", + "i=0; #looping for calc. of 1/N \n", + "t = [0,0,0,0,0,0,0]\n", + "\n", + "# Calculation \n", + "while(i<7): #looping begins\n", + " t[i]=1./(a[i]);\n", + " i=i+1;\n", + "\n", + "from matplotlib.pyplot import *\n", + "\n", + "# Result\n", + "plot(p,a);\n", + "title(\"Fig.6.19(a) Example3 Drying Rate curve\");\n", + "xlabel(\"X-- Moisture content, X(kg/kg) ---->\");\n", + "ylabel(\"Y-- Drying Rate, N(kg/hr.m**2 ---->\");\n", + "#xset('window',1);\n", + "plot(p,t,\"o-\");\n", + "title(\"Fig.6.19(b) Example3 1/N vs X\");\n", + "xlabel(\"X-- Moisture content, X(kg/kg) --->\");\n", + "ylabel(\"Y-- 1/N, hr,m**2/kg --->\");\n", + "show()\n", + "#from X=0.6 to 0.44 ,falling rate is non linear and from X=.44 to .14 falling rate is linear\n", + "\n", + "print \"\\n from the graph we get critical moisture content as 0.6 kg moisture/kg dry solid\"\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAEXCAYAAACu1P9TAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XdYFNf6B/DvLqBAqCqWCJESsdAR241lFQ0gYjcRc9Wg\nV43GWPLDq8YCakxiYmyoSUxUbFgSOypKjGsssSFFUdSgKBYUBaUpbc/vj71MWGFhgZ2dXfb9PI9P\n2JnZOe8s5J2z78w5I2KMMRBCCKn3xEIHQAghRDMo4RNCiJ6ghE8IIXqCEj4hhOgJSviEEKInKOET\nQoieoIRfj5ibmyMtLU3oMKp17NgxDB48mHstFotx586dSrc9dOgQRowYoanQeBMZGYnu3bsLHQbR\nc5TwdZC9vT1MTU1hbm4Oc3NzWFhYICMjA7m5ubC3t6/VPgsKCjB58mTY2NjAysoKPXv2VLrtmjVr\n4OPjA2NjY4SEhFRY/8svv6B169YwNzdHQEAAHj9+rLB+7ty5mDNnjkpxBQUFITk5GVevXlW6zZuf\nh7m5OaZOnarS/rXRihUr4OTkBAsLCzRr1gwhISHIzc1Vuv2ECRPQtm1bGBgYYPPmzZVu4+fnh9jY\nWISHh0MsFuPXX3/l1pWUlEAsFuP+/ftqP5YyERERcHNzQ3FxMbds5cqV8Pb2hkwm461doogSvg4S\niUSIjo5Gbm4ucnNzkZOTg+bNm9dpnxMmTMCLFy+QkpKC7OxsrFy5Uum2LVu2xPz58zF27NgK66RS\nKebOnYuDBw8iKysLDg4OCA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7cFyC80FhcXw93dHa6urggLC6sQt5+fHwYMGAAfHx94eXlxt5BWFeubxw0A\nvXr1wvXr17mLtsrafjPG8iZMmAB3d3eMGjUKjDGkpqZWmJI5OTkZBw4c4Kb/9fT0hJ+fH7799lsA\nQLdu3biTYVl7pqamiI6OxooVKxAdHY3JkycjMzMTLi4umD9/PlxcXGBhYYGjR49y5Zzy7x82bBjG\njx+PAQMGQCQSYd26dfD394ePjw8sLCy4J7sB8l55jx49Kj0+VTVp0gTR0dGIiYnBsGHDeH1aFVEd\nTZ5GCE+Sk5OxadMmLFu2rEbvk0ql2LVrF3744Qel28hkMhQXF6Nhw4ZITU3F+++/j5SUFAQGBmLr\n1q1o1qxZlW3k5+dzpbNPP/0Uzs7OmDZtGmQyGby9vXH58mVK0vUQJXxCtFCfPn2wb98+pffi5+bm\nonfv3iguLgZjDN9++y38/PxU3v/KlSuxefNmFBUVwdvbGz///DOMjY1x8OBBJCUlYd68eeo6FKJF\nKOETQoieoBo+IYToCUr4hBCiJyjhE0KInqCETwgheoISPiGE6AlK+IQQoif+HySjOfLSIHAXAAAA\nAElFTkSuQmCC\n", + "text": [ + "" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " from the graph we get critical moisture content as 0.6 kg moisture/kg dry solid\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.3.b,page no:95" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variable Declaration \n", + "#part(ii)\n", + "w1=5.; #wet of wet solid\n", + "c1=.5/(1-.5); #moisture content per kg wet solid\n", + "w2=5.*0.5; #moisture for 5kg wet solid\n", + "w3=w1-w2; #weight of dry solid\n", + "xbar=0.05; #equillibrium moisture content\n", + "Xbar=xbar/(1-xbar); #equillibrium moisture content\n", + "Ls=2.5; #mass of bone dry solid ais the drying surface\n", + "A=5.; #both upper surafce and lower surface are exposed\n", + "Nc=0.6; #in kg/m**2*hr\n", + "#from X=0.6 to 0.44 ,falling rate is non linear and from X=.44 to .14 falling rate is linear\n", + "X2=.15/(1-.15);\n", + "Xcr=.6; #kg moisture per kg dry solid\n", + "#so we can find time fro drying from 0.6 to .44 graphically and then for X=.44 to .1765\n", + "X1=1.; #moisture content on dry basis intially\n", + "\n", + "# Calculation \n", + "t1=Ls/(A*Nc) *(X1-Xcr); #time taken for constant drying rate(fromX=1 to .6) \n", + "X1=.44; #moisture content on dry basis\n", + "import math\n", + "t2=(Ls/(A*Nc))*((Xcr-Xbar)*math.log((X1-Xbar)/(X2-Xbar)));\n", + "t3=0.0336*Ls/Nc; #fro graph we get from X=.6 to .44\n", + "ttotal=t1+t2+t3; #total time for drying the wet slab\n", + "\n", + "# Result\n", + "print \"\\n the total time for drying the wet slab to 15 percent moisture on wet basis is :%f min\"%(ttotal*60)\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the total time for drying the wet slab to 15 percent moisture on wet basis is :59.610778 min\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.4,page no:96" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#let Ls/A=p\n", + "# Variable Declaration \n", + "p=48.; #mass of bone dry solid ais the drying surface\n", + "v=1.5*1.5*.5; #volume of material\n", + "Nc=1.22; #in kg/m**2*hr\n", + "Xcr=0.2; #crtical moisture content\n", + "X1=0.25; #moisture content on dry basis intially\n", + "X2=0.08; #moisture content on dry basis finally after drying\n", + "Xbar=0.025; #equillibrium moisture \n", + "\n", + "#tbar=(Ls/(A*Nc))*((Xcr-Xbar)*log((Xcr-Xbar)/(X2-Xbar)));\n", + "# Calculation \n", + "t1=p/(Nc) * (X1-Xcr); #time taken for constant drying rate period \n", + "#table X-- .18 .15 .14 .11 .07 .05\n", + "# 1/N-- .8772 1.11 1.25 1.7857 4.545 20\n", + "\n", + "# equillibrium relation is given under\n", + "p = [.18,.15,.14,.11,.07,.05];\n", + "a = [.8772,1.11,1.25,1.7857,4.545,20];\n", + "from matplotlib.pyplot import *\n", + "\n", + "# Result\n", + "plot(p,a);\n", + "title(\"Fig.6.20 Example4 1/N vs X for fallling rate period\");\n", + "xlabel(\"X-- Moisture content, X(kg/kg) ---->\");\n", + "ylabel(\"Y-- 1/N, hr,m**2/kg ---->\");\n", + "\n", + "a=14*.025*1; #area under the curve\n", + "t2=a*48; #time taken for varying drying period\n", + "ttotal=t1+t2; #total time taken \n", + "print \"\\n total time for drying the material from 25 to 8 percent moisture under same drying conditions is :%f hr\"%(ttotal)\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " total time for drying the material from 25 to 8 percent moisture under same drying conditions is :18.767213 hr\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEXCAYAAABCjVgAAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XdYFOfaBvB7KYr0oiAKgqKI9EXsDUVEj2IUjRETezTR\nmERzNBpLUGM3fhr1mGI4amzRBIwdW0QNCWJDY4uJCgKigtIFac/3xx5GFljasjssPL/r8pLdmZ33\nnm3PzjvzzkiIiMAYY4wB0BI7AGOMsbqDiwJjjDEBFwXGGGMCLgqMMcYEXBQYY4wJuCgwxhgTNNii\nYGRkhNjYWLFj1DsRERGwtbUVO4ZGOXDgAGxtbWFkZITr168rvbynT5+id+/eMDY2xpw5cyqdX0tL\nCw8ePAAATJgwAYsWLQJQ9rV0dXXF+fPnlc5XHynz3JR8/uuCel8U7O3toa+vDyMjIxgZGcHY2BhP\nnjxBZmYm7O3ta7TMly9fYvr06WjWrBlMTU3Rp0+fcufLy8vD5MmTYW9vD2NjY0ilUoSHh8vNc+bM\nGTg5OcHAwAD9+v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ScP36dVy/fh3Hjh0DAFy9elUoEKUVFBQgNzcXhYWF\nyM/PF36ZAsCxY8eEo47KExwcjG3btiEtLa3CdRszZgw2bNiACxcu4M033xTu37VrF5KTkwEAJiYm\nkEgkcls4xR4/foxPP/0UW7duha6uLt5//31YWFhg+fLlFbZbrGvXrtDX18eaNWuQn5+PiIgIHDly\nRHh+q/JalZ4nKysLRkZG0NfXx927d/H1119X+FhlfiwAQLdu3aCtrY3NmzejoKAABw8exKVLl6q1\njKysLBgYGMDY2BiJiYllDq21srLC/fv3hdvvvPMODh8+jJMnT6KwsBC5ubmIiIgoU5yKlfceLv7S\nnzJlCr755htER0eDiJCdnY2jR4+W2VpWJCgoCMuWLUNKSgpSUlKwdOlSvPPOOwCAUaNGYfv27bhz\n5w5evnyp8NBqMTXYolDyS3/z5s1IT09H8+bNMX78eAQFBaFRo0bCdFdXV+zduxcAoKOjg4MHD+LY\nsWMwNTXFe++9h507dwpf5CtWrMC//vUvALJfeN999x2uX7+O5s2bC2MLipfVtGlThIaGYsGCBTA3\nN8fly5fx448/Vph7xowZcuMUOnXqBEB2fP6wYcMwcOBAmJubIyQkBO+++y5SU1Mxbtw42NnZoWXL\nlnB1dUW3bt3k1r/0senlHateevqYMWMwYMAAODg4oF27dli4cGGZebW1tXHkyBHExMSgTZs2aNas\nGaZOnSp0mVlaWgr/mjZtColEAisrK+jq6pa77u+++y709fXx448/Yvny5dDX18euXbtARDh58iQG\nDhyocB3s7e0xbtw4vHz5ssLnNygoCOfPn4evry/Mzc2F+0+cOAFXV1cYGRlh1qxZ+PHHH8sUeQD4\n4IMPEBQUhB49egj3bd26FRs2bMCdO3fKbbNkTl1dXaGgN2vWDDNmzJB7f1U0jkDRun/55ZfYs2cP\njI2NMXXqVIwePbrM66nosYraqug90qhRI4SFhSEkJARmZmbYvXs3hgwZIveZqmxZwcHBuHr1KkxM\nTBAQEIARI0bIzfPZZ59h2bJlMDMzw//93//BxsYGBw8exIoVK2BpaYlWrVph3bp1CreIKno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fTTT/Hzzz9j\nyJAh+PLLL+Hh4aHwOWTqxVsK9dTWrVthb28v/LKfPn067ty5U+bXZUUkEonwZdKtWzfhrIwl79+x\nYwfmzJkDDw8P3LhxA59//rnc4zMzMxEQEAAPDw/06tUL69evBwCMHj0aa9euRceOHfHw4UPMnj0b\nX3/9Nby8vPD8+XNh+SXbAmQ7R/Pz8+Hu7g5XV1cEBweXye3v74+hQ4fC29sbUqlUOHy2oqyl1xsA\n+vbti9u3bws7mhW1XTpjSVOnToW7uzvGjh0LIsL9+/fluoIA2Rf3wYMHsWDBAgCAp6cn/P39sWbN\nGgBAz549cfnyZbl8+vr6OHLkCNavX48jR45g+vTpSE5OhouLCxYtWgQXFxcYGxvj+PHjQtdRyceP\nHDkSU6ZMwdChQyGRSLBlyxYMHDgQ3t7eMDY2lruyWHR0NHr37l3u+tVU3759cffuXWzcuJELQh3D\nJ8RjTE1u3bqFbdu24csvv6zW4yIiIrBv3z58/fXXCucpKipCfn4+GjdujPv372PAgAG4e/cuBg8e\njJ07d8LKyqrCNrKzs4Vuug8++ACOjo74+OOPUVRUBC8vL1y+fFnY2mH1GxcFxjRA//79ceDAAYVj\nFTIzM9GvXz/k5+eDiLBmzRr4+/tXefkbNmzAjh07kJeXBy8vL2zduhV6eno4dOgQbty4gYULF9bW\nqrA6josCY4wxAe9TYIwxJuCiwBhjTMBFgTHGmICLAmOMMQEXBcYYYwIuCowxxgT/D4G/ftCXVIQy\nAAAAAElFTkSuQmCC\n", + "text": [ + "" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.5.a,page no:97" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variable Declaration \n", + "w=[5.314,5.238,5.162,5.124,5.048,4.972,4.895,4.819,4.743,4.667,4.524,4.468,4.426,4.340,4.120]\n", + "t=[0.0,0.4,0.8,1.0,1.4,1.8,2.2,2.6,3.0,3.4,4.2,4.6,5.0,6.0]\n", + "#part(i)\n", + "x=4.120; #weight of the dried material\n", + "print \"\\n moisture content (dry basis) \"\n", + "i=0; \n", + "p = [] #looping starts\n", + "\n", + "# Calculation \n", + "while(i<15): #calculation of moisture content\n", + " p.append((w[i]-x)/x);\n", + " print \"\\n :%f\"%p[i]\n", + " i=i+1;\n", + "\n", + "print \"Drying rate kg/hr*m**2\"\n", + "i=1;\n", + "a = []\n", + "for i in range(15):\n", + " a.append(0)\n", + " \n", + "while(i<14):\n", + " a[i] =((p[i-1]-p[i])*4.12/(t[i]-t[i-1]))\n", + " print \" %f \"%a[i]\n", + " i=i+1;\n", + "from matplotlib.pyplot import *\n", + "a[0]=.19;\n", + "a[14]=0;\n", + "\n", + "# Result\n", + "print \"\\n\\n from the above data it is clear that critical moisture content Xcr=0.11\"\n", + "plot(p,a);\n", + "title(\"Fig.6.19(a) Example3 Drying Rate curve\");\n", + "xlabel(\"X-- Moisture content, X(kg/kg) ---->\");\n", + "ylabel(\"Y-- Drying Rate, N(kg/hr.m**2 ---->\");\n", + "show()\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " moisture content (dry basis) \n", + "\n", + " :0.289806\n", + "\n", + " :0.271359\n", + "\n", + " :0.252913\n", + "\n", + " :0.243689\n", + "\n", + " :0.225243\n", + "\n", + " :0.206796\n", + "\n", + " :0.188107\n", + "\n", + " :0.169660\n", + "\n", + " :0.151214\n", + "\n", + " :0.132767\n", + "\n", + " :0.098058\n", + "\n", + " :0.084466\n", + "\n", + " :0.074272\n", + "\n", + " :0.053398\n", + "\n", + " :0.000000\n", + "Drying rate kg/hr*m**2\n", + "\n", + "\n", + " from the above data it is clear that critical moisture content Xcr=0.11\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAY8AAAEXCAYAAABVr8jJAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAA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KywoEDB6RTVo+WHzVqFMLDwxESEgKZ\nTIbVq1djyJAh8Pf3h5WVlXS3PaCi59K/f/9q2/ekBg4ciJSUFHz++edMHHqICyMS6ZGzZ89iw4YN\nWLFihUbl4uPjsX37dnz55ZdK9ykvL0dJSQksLCxw5coVPPvss0hJScGwYcOwefNmtGrVqsZjFBYW\nSqcH33jjDXTo0AFvv/02ysvL0bVrV/z5559S74mMH5MHkZEYPHgwdu/erfRaj/z8fDzzzDMoKSmB\nEALLly9HUFCQ2vV/+umn+Pbbb1FcXIyuXbti7dq1aNy4Mfbu3Yvk5GTMnTu3rppCBoDJg4iINMYx\nDyIi0hiTBxERaYzJg4iINMbkQUREGmPyICIijTF5EBGRxv4/HZ7dGt96UjsAAAAASUVORK5CYII=\n", + "text": [ + "" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.5.b ,page no:98" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variable Declaration \n", + "#part(ii)\n", + "w1=4.934; #weight after two hours\n", + "w0=5.314; #initial weight \n", + "w2=w0-w1; # water evaporated in 2 hrs\n", + "H1=.01; #humidty of incoming air\n", + "H2=.03; #humidity of leaving air\n", + "yout=.03;\n", + "yin=.01;\n", + "\n", + "# Calculation \n", + "Gs=w2/(yout- yin); #water carried away\n", + "\n", + " # Result\n", + "print \"\\n the amount of air required in 2hours is :%f kg\"%Gs\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the amount of air required in 2hours is :19.000000 kg\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.5.c ,page no:99" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variable Declaration \n", + "#part(iii)\n", + "#let us choose the consistency of 11 and 13 readings\n", + "Xbar=0; #equillibrium moisture content\n", + "Ls=4.12; #mass of bone dry solid ais the drying surface\n", + "A=1.; #both upper surafce and lower surface are exposed\n", + "Nc=0.19; #in kg/m**2*hr\n", + "X1=.098; #moisture content on dry basis intially\n", + "Xcr=.11; #kg moisture per kg dry solid\n", + "X2=0.074; #moisture content on dry basis finally\n", + "# Calculation \n", + "import math\n", + "tfall=(Ls/(A*Nc))*((Xcr-Xbar)*math.log((X1-Xbar)/(X2-Xbar)));\n", + "\n", + "# Result\n", + "print \"\\n from this data we get time as :%f hour\"%tfall\n", + "print \"\\n the actual time is 0.8 hours\"\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " from this data we get time as :0.670026 hour\n", + "\n", + " the actual time is 0.8 hours\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.6,page no:100" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variable Declaration \n", + "Xcr=0.55; #crtical moisture content\n", + "X1=1; #moisture content on dry basis intially\n", + "X2=.1; #moisture content on dry basis finally after drying\n", + "Xbar=.06; #equillibrium moisture \n", + "#since eqn 1 is tobe divided by eqn 2 so let the value of Ls/A*Nc be = 1 as it will be cancelled \n", + "p=1; #let Ls/A*Nc be =p\n", + "#p=poly([0],'p'); #calc. of time 1\n", + "tbar=1; #since the eqns are independent of tbar\n", + "\n", + "# Calculation \n", + "import math\n", + "t1=0.5960514 #roots(tbar- p*((X1-Xcr)+(Xcr-Xbar)*math.log((Xcr-Xbar)/(X2-Xbar)))); #------eqn1\n", + "X2bar=.16; \n", + "#p=poly([0],'p'); #calc. of time 2\n", + "t2=0.8138516 #roots(tbar- p*((X1-Xcr)+(Xcr-Xbar)*math.log((Xcr-Xbar)/(X2bar-Xbar))));#------eqn2\n", + "\n", + "#let t1/t2 be = k\n", + "k=t1/t2;\n", + "ans=1./k-1; #reduction in time for drying \n", + "\n", + "# Result\n", + "print \"\\n the reduction in time for drying is :%f percent\"%(ans*100)\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the reduction in time for drying is :36.540506 percent\n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.7 ,page no:101" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#Ls/ A*Nc is unknown;\n", + "# Variable Declaration \n", + "Xcr=0.14; #crtical moisture content\n", + "X1=.3/(1-.3); #moisture content on dry basis intially\n", + "X2=0.1/(1-0.1); #moisture content on dry basis finally after drying\n", + "Xbar=.04; #equillibrium moisture \n", + "tbar=5; #time needed to dry from 30 to 6 percent on bone dry basis\n", + "\n", + "#let Ls / A*Nc be = p\n", + "#p=poly([0],'p'); #calc. of Ls / A*Nc be = p value\n", + "# Calculation and Result\n", + "x= 15.495992 #roots(tbar-p * ((X1-Xcr)+(Xcr-Xbar)*log((Xcr-Xbar)/(X2-Xbar))));\n", + "print \"\\n the value of Ls/ A*Nc is :%f\"%x\n", + "import math\n", + "#new X1 AND X2 are now given as follows\n", + "X1=0.3/(1-.3); #new moisture content on dry basis intially\n", + "X2=0.064; #new moisture content on dry basis finally after drying\n", + "tbar=x * ((X1-Xcr)+(Xcr-Xbar)*math.log((Xcr-Xbar)/(X2-Xbar)));\n", + "print \"\\n the time for drying the sheets from 30 to 6 percent moisture under same drying conditions is :%f hr\"%tbar\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the value of Ls/ A*Nc is :15.495992\n", + "\n", + " the time for drying the sheets from 30 to 6 percent moisture under same drying conditions is :6.683159 hr\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.8.a,page no:102" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variable Declaration \n", + "Ls=1000.; #mass of bone dry solid ais the drying surface\n", + "A=55.; #both upper surafce and lower surface are exposed\n", + "v=.75; #velocity of air\n", + "Nc=.3*10**-3; #in kg/m**2*s\n", + "x2=.2; #moisture content on wet basis finally after drying\n", + "Xcr=0.125; #crtical moisture content\n", + "X1=0.15; #moisture content on dry basis intially\n", + "X2=0.025; #moisture content on dry basis finally after drying\n", + "Xbar=0.0; #equillibrium moisture \n", + "import math\n", + "\n", + " # Calculation \n", + "tbar=(Ls/(A*Nc))*((X1-Xcr)+(Xcr-Xbar)*math.log((Xcr-Xbar)/(X2-Xbar)));\n", + "\n", + "# Result\n", + "print \"the time for drying the sheets from .15 to .025 kg water /kg of dyr solid moisture under same drying conditions is :%f hour\"%(tbar/3600);\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the time for drying the sheets from .15 to .025 kg water /kg of dyr solid moisture under same drying conditions is :3.807740 hour\n" + ] + } + ], + "prompt_number": 31 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.8.b ,page no:103" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variable Declaration \n", + "Ls=1000.; #mass of bone dry solid ais the drying surface\n", + "A=55.; #both upper surafce and lower surface are exposed\n", + "v=.75; #velocity of air\n", + "Nc=.3*10**-3; #in kg/m**2*s\n", + "x2=.2; #moisture content on wet basis finally after drying\n", + "Xcr=0.125; #crtical moisture content\n", + "X1=0.15; #moisture content on dry basis intially\n", + "X2=0.025; #moisture content on dry basis finally after drying\n", + "Xbar=0.0; #equillibrium moisture \n", + "tbar=3.8077; #time to dry material ,calculated from previous part\n", + "V1=.75; #old velocity\n", + "V2=4.; #new velocity\n", + "import math\n", + "\n", + "# Calculation \n", + "Nc2=Nc*(V2/V1)**.71; #in kg/m**2*s\n", + "t2=(Ls/(A*Nc2))*((X1-Xcr)+(Xcr-Xbar)*math.log((Xcr-Xbar)/(X2-Xbar))); #if air velocity is increased to 4\n", + "t=tbar-t2/3600; #time saved\n", + "\n", + "# Result\n", + "print \"\\n the time saved , if air velocity is increased to 4 m/s: %f\"%t\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the time saved , if air velocity is increased to 4 m/s: 2.647593\n" + ] + } + ], + "prompt_number": 32 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.9 ,page no:104" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "x1=.75; #moisture content on wet basis\n", + "xbar=0.1; #equilllibrium moisture on dry basis\n", + "xcr=0.6; #critical moisture content\n", + "Ls=0.90; #mass of bone dry solid ais the drying surface\n", + "A=0.3*0.3*2; #both upper surafce and lower surface are exposed\n", + "#A*Nc=10**-4;\n", + "x2=.2; #moisture content on wet basis finally after drying\n", + "\n", + "# Calculation \n", + "Xcr=0.6/0.4; #crtical moisture content\n", + "X1=3; #moisture content on dry basis intially\n", + "X2=0.25; #moisture content on dry basis finally after drying\n", + "Xbar=0.1/0.9; #equillibrium moisture \n", + "import math\n", + "tbar=Ls/(10**-4) * ((X1-Xcr)+(Xcr-Xbar)*math.log((Xcr-Xbar)/(X2-Xbar)));\n", + "\n", + "# Result \n", + "print \"\\n the time for drying the sheets from 75 to 25 percent moisture under same drying conditions is :%f hr\"%(tbar/3600);\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the time for drying the sheets from 75 to 25 percent moisture under same drying conditions is :11.745087 hr\n" + ] + } + ], + "prompt_number": 34 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.10 ,page no:105" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variable Declaration \n", + "Xcr=0.16; #crtical moisture content\n", + "X1=.33; #moisture content on dry basis intially\n", + "X2=0.09; #moisture content on dry basis finally after drying\n", + "Xbar=.05; #equillibrium moisture \n", + "tbar=7; #time needed to dry from 33 to 9 percent on bone dry basis\n", + "import math\n", + "#let Ls / A*Nc be = p\n", + "#p=poly([0],'p'); #calc. of Ls / A*Nc be = p value\n", + "# Calculation \n", + "x= 24.886579 #roots(tbar-p * ((X1-Xcr)+(Xcr-Xbar)*math.log((Xcr-Xbar)/(X2-Xbar))));\n", + "\n", + "#new X1 AND X2 are now given as follows\n", + "X1=0.37; #new moisture content on dry basis intially\n", + "X2=0.07; #new moisture content on dry basis finally after drying\n", + "tbar=x * ((X1-Xcr)+(Xcr-Xbar)*math.log((Xcr-Xbar)/(X2-Xbar)));\n", + "\n", + "# Result\n", + "print \"\\n the time for drying the sheets from 33 to 9 percent moisture under same drying conditions is :%f hr\"%tbar\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the time for drying the sheets from 33 to 9 percent moisture under same drying conditions is :9.892970 hr\n" + ] + } + ], + "prompt_number": 35 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.11 ,page no:106" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variable Declaration \n", + "d=.22; #density of dry pulp in g/cc;\n", + "x1=.65; #moisture content on wet basis\n", + "x2=.3; #moisture content on wet basis\n", + "Ls=2.5; #mass of bone dry solid ais the drying surface in kg\n", + "A=1.5*1.5*2; #both upper surafce and lower surface are exposed\n", + "v=1.5*1.5*.5; #volume of material\n", + "Nc=1.4; #in kg/m**2*hr\n", + "Xcr=1.67; #crtical moisture content\n", + "# Calculation \n", + "X1=x1/(1-x1); #moisture content on dry basis intially\n", + "X2=x2/(1-x2); #moisture content on dry basis finally after drying\n", + "Xbar=0.0; #equillibrium moisture \n", + "import math\n", + "#initial moisture is more than Xcr, so there is constant rate drying period and only falling rate peroid is observed\n", + "tbar=(Ls/(A*Nc))*((X1-Xcr)+(Xcr-Xbar)*math.log((Xcr-Xbar)/(X2-Xbar)));\n", + "\n", + "# Result\n", + "print \"\\n the time for drying the sheets from 65 to 30 percent moisture under same drying conditions is :%f hour\"%tbar\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the time for drying the sheets from 65 to 30 percent moisture under same drying conditions is :0.975613 hour\n" + ] + } + ], + "prompt_number": 36 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.12,page no:107" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable Declaration \n", + "d=.22; #density of dry pulp in g/cc;\n", + "\n", + "Ls=1.125*10**-2*.22*10**3; #mass of bone dry solid ais the drying surface\n", + "A=1.5*1.5*2; #both upper surafce and lower surface are exposed\n", + "v=1.5*1.5*.5; #volume of material\n", + "Nc=1.4; #in kg/m**2*hr\n", + "x2=.2; #moisture content on wet basis finally after drying\n", + "Xcr=0.46; #crtical moisture content\n", + "X1=0.15; #moisture content on dry basis intially\n", + "X2=0.085; #moisture content on dry basis finally after drying\n", + "Xbar=0.025; #equillibrium moisture \n", + "import math\n", + "#tbar=(Ls/(A*Nc))*((Xcr-Xbar)*log((Xcr-Xbar)/(X2-Xbar)));\n", + "# but initial moisture is more than Xcr, so there is constant rate drying period and only falling rate peroid is observed\n", + "\n", + "# Calculation \n", + "tbar=(Ls/(A*Nc))*((Xcr-Xbar)*math.log((X1-Xbar)/(X2-Xbar)));\n", + "\n", + "# Result\n", + "print \"\\n the time for drying the sheets from 15 to 8.5 percent moisture under same drying conditions is :%f min\"%(tbar*60)\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the time for drying the sheets from 15 to 8.5 percent moisture under same drying conditions is :7.525805 min\n" + ] + } + ], + "prompt_number": 37 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.13,page no:108" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variable Declaration \n", + "import math\n", + "Xcr=0.14; #crtical moisture content\n", + "x1=0.3; #moisture content on wet basis\n", + "x2=0.1; #moisture content on wet basis\n", + "X1=x1/(1-x1); #moisture content on dry basis intially\n", + "X2=x2/(1-x2); #moisture content on dry basis finally after drying\n", + "Xbar=0.04; #equillibrium moisture \n", + "tbar=5; #time needed to dry from 30 to 10 percent on bone dry basis\n", + "\n", + " #let Ls / A*Nc be = p\n", + "#p=poly([0],'p'); #calc. of Ls / A*Nc be = p value\n", + "x= 15.495992 #roots(tbar-p * ((X1-Xcr)+(Xcr-Xbar)*math.log((Xcr-Xbar)/(X2-Xbar))));\n", + "\n", + "#new X1 AND X2 are now given as follows\n", + "# Calculation \n", + "x1=.3; #new moisture content on wet basis\n", + "x2=0.06; #new moisture content on wet basis\n", + "X1=x1/(1-x1); #new moisture content on dry basis intially\n", + "X2=x2/(1-x2); #new moisture content on dry basis finally after drying\n", + "tbar=x * ((X1-Xcr)+(Xcr-Xbar)*math.log((Xcr-Xbar)/(X2-Xbar)));\n", + "\n", + "# Result\n", + "print \"\\n the time for drying the sheets from 30 to 10 percent moisture under same drying conditions is :%f hr\"%tbar\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the time for drying the sheets from 30 to 10 percent moisture under same drying conditions is :6.694188 hr\n" + ] + } + ], + "prompt_number": 38 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.14,page no:109" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "d=450.; #density of dry pulp in kg/m**3;\n", + "thickness=0.05; #thickness in m**2\n", + "Ls=d*thickness; #mass of bone dry solid ais the drying surface\n", + "A=1.; #area in m**2\n", + "v=1*5*10**-2; #volume of material\n", + "Nc=4.8; #in kg/m**2*hr\n", + "xcr=.2;\n", + "xbar=0.02;\n", + "x1=.45; #new moisture content on wet basis\n", + "x2=0.05; #new moisture content on wet basis\n", + "\n", + "# Calculation \n", + "X1=x1/(1-x1); #new moisture content on dry basis intially\n", + "X2=x2/(1-x2); #new moisture content on dry basis finally after drying\n", + "Xbar=xbar/(1-xbar); #crtical moisture content\n", + "Xcr=xcr/(1-xcr); #equillibrium moisture \n", + "import math\n", + "#tbar=(Ls/(A*Nc))*((Xcr-Xbar)*log((Xcr-Xbar)/(X2-Xbar)));\n", + "# but initial moisture is more than Xcr, so there is constant rate drying period and only falling rate peroid is observed\n", + "tbar=Ls/(A*Nc) * ((X1-Xcr)+(Xcr-Xbar)*math.log((Xcr-Xbar)/(X2-Xbar)));\n", + "\n", + "# Result\n", + "print \"\\n the time for drying the sheets from 45 to 5 percent moisture under same drying conditions is :%f min\"%tbar\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the time for drying the sheets from 45 to 5 percent moisture under same drying conditions is :4.776612 min\n" + ] + } + ], + "prompt_number": 39 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.15,page no:110" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "# Variable Declaration \n", + "t1=20.; #ambient air temperature \n", + "t2=70.; #exhaust air temperature \n", + "r1=150.; #evaporation of water \n", + "r2=.25; #outlet solid moisture content\n", + "t3=15.; #inlet solid temperature\n", + "t4=65.; #outlet solid temperature\n", + "p=5.; #power demand in KW\n", + "h=18.; #heat loss in kj\n", + "\n", + "h1=1.; #mean specific heat of dry air in kj/kg*K\n", + "h2=1.25; #mean specific heat of dry material in kj/kg*K\n", + "h3=4.18; #mean specific heat of moisture in kj/kg*K\n", + "e=2626.; #enthalpy of saturated water vapour in kj/kg\n", + "\n", + "# Calculation \n", + " #basis is 1hr\n", + "a1=r1*h3*(t4-t3); #heat required for heating 150 kg of water from 15 to 65\n", + "a2=r1*e; #heat required for 150 kg water evaporation\n", + "a3=2000*h1*(t2-t1); #heat required for heating air from 20 to 70 \n", + "a4=r2*h3*(t4-t3); #heat required for heating moisture from 15 to 65\n", + "a5=120*h2*(t4-t3); #heat required for heating dry solid from 15 to 65\n", + "hlost=h*3600; #heat lost in kj\n", + "total=(a2+a3+a4+a5+hlost)/3600.; #total heat lost \n", + "\n", + "# Result\n", + "print \"\\n :%f kW of heat required for 2000kg/hr of dry air\"%total\n", + "ans1=a2+a1; #heat needed for evaporation \n", + "print \"\\n heat needed fro evaporation is :%f\"%(ans1/3600)\n", + "ans2=(ans1/3600.)/total; #fraction of this heat needed for evaporation\n", + "print \"\\n fraction of this heat needed for evaporation:%f\"%(ans2)\n", + " \n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " :157.292292 kW of heat required for 2000kg/hr of dry air\n", + "\n", + " heat needed fro evaporation is :118.125000\n", + "\n", + " fraction of this heat needed for evaporation:0.750990\n" + ] + } + ], + "prompt_number": 40 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.16,page no:112" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "m1=.12; #initial moisture content\n", + "dT=85.; #product of 85 degree is used in design purpose\n", + "U=1700.; #overall heat transfer coefficient\n", + "m2=.4; #final moisture content\n", + "r=20.; #production rate\n", + " #4 kg of moisture is present in 100 kg product\n", + "# Calculation \n", + "t=4*20./100; # moisture content in 20 kg moisture\n", + "w=20-t; #dry solid weight\n", + "i=w*m1/(1-m1); #initial moisture content \n", + "j=i-t #water evaporated\n", + "ds=2296.1; #latent heat for vaporisation at 85 degree in kj/kg\n", + "h=j*ds; #heat required (assuming th esolid mix. enters at 85)\n", + "#U*A*dT = j*ds\n", + "A=h/(U*dT); #surface area of the roller required to produce aproduction rate of 20 kg product per hour\n", + "\n", + "# Result \n", + "print \"\\n surface area of the roller required to produce aproduction rate of 20 kg product per hour:%f m**2\"%(A/3.600);\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " surface area of the roller required to produce aproduction rate of 20 kg product per hour:0.008025 m**2\n" + ] + } + ], + "prompt_number": 41 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.17,page no:113" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "# Variable Declaration \n", + "r=7.5*10**-5; #constant drying rate in kg/s\n", + "A1=.3*.3**2; # area of the sppecimen\n", + "Nc=r/A1; #drying rate\n", + "# Calculation \n", + "Xcr=.15/0.85; #.15 is the critical moisture content\n", + "Xo=.25/.75; #.25 is the initial moisture content\n", + "Xfinal=.02/0.98; #.02 is the final moisture content\n", + "Xbar=0; #equillibrium moisture content\n", + "A=1.2*.6*2; #area of the new solid\n", + "Ls=28.8; #bone dry weight of new solid\n", + "v1=.3*.3*.006; #volume of the old solid;\n", + "v2=.6*1.2*.012; #volume of the new solid\n", + "w2=1.8; #weight of the old solid\n", + "w3=864*10**-5*1.8*10**-5/54; #weight of the bone dry solid\n", + "\n", + " #Nc is prporional to =(t-ts) = (G)**0.71---- whrere G is the mass flow rate\n", + "v1=3.; #old velocity\n", + "Tg=52.; #old dry bulb temperature\n", + "Tw=21.; #wet bulb temperature\n", + "H=.002; #humidity \n", + "SH=0.015; #saturated humidity \n", + "vnew=5. #new velocity\n", + "Tgnew=66.; #new DBT\n", + "Twnew=24.; #new WBT\n", + "Hnew=.004; #new humidity\n", + "SH=.020; #new satuurated humidity\n", + "import math \n", + "#hence drying rate of air under new condition\n", + "Nc=4.167*10**-4*((vnew/v1)*(273+Tg)/(273+Tgnew))**0.71 * ((.019-H)/(.015-H));#drying rate of air under new condition in kg/m**2*s \n", + "DT=Ls/(A*Nc) * ((Xo-Xcr)+(Xcr-Xbar)*math.log((Xcr-Xbar)/(Xfinal-Xbar)));\n", + "\n", + "# Result\n", + "print \"\\n the time for drying the sheets from 25 to 2 percent moisture under same drying conditions is :%f hours\"%(DT/3600)\n", + "\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the time for drying the sheets from 25 to 2 percent moisture under same drying conditions is :3.929236 hours\n" + ] + } + ], + "prompt_number": 42 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Elements_Of_Mass_Transfer_Part_1/.ipynb_checkpoints/ch7-checkpoint.ipynb b/Elements_Of_Mass_Transfer_Part_1/.ipynb_checkpoints/ch7-checkpoint.ipynb new file mode 100644 index 00000000..ca15d415 --- /dev/null +++ b/Elements_Of_Mass_Transfer_Part_1/.ipynb_checkpoints/ch7-checkpoint.ipynb @@ -0,0 +1,710 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:9ea2cdc5241823a115acd23fdb7d14283a1bb5201840b0c48f401f177b1de4bd" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 7 : Crystallisation" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.1 ,page no:115" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "c=.498; #solute content afetr crystallisation\n", + "W1=111.; #molecular weight of CaCl2\n", + "W2=219.; #molecular weight of CaCl2.6H2O\n", + "\n", + "# Calculation \n", + "M1=(108./W2)*100; #water present in 100kg of CaCl2.6H2O\n", + "M2=(W1/W2)*100; #CaCl2 present in 100kg of CaCl2.6H20\n", + "#t=M2+c*x; #total weight entering the solubility\n", + "#x+49.3; total water solubility used\n", + "#s*(x+49.3)/100 #total Cacl2 after solubility\n", + "#x=poly([0],'x'); #calc. x the weight of crystal\n", + "t= 32.112871 #roots((M2+c*x)-(x+49.3)*.819); \n", + "\n", + "# Result\n", + "print \"\\nthe weight of water in the quantity of solution needed :%f kg\"%t\n", + "\n", + "h=(c)*t; #weight of CaCl2 corresponding to weight water\n", + "tw=t+h; # total weight of the solution\n", + "print \"\\nthe total weight of the solution is :%f kg\"%tw\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "the weight of water in the quantity of solution needed :32.112871 kg\n", + "\n", + "the total weight of the solution is :48.105081 kg\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.2 ,page no:116" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "#part(i)\n", + "w1=1000.; #weight of solution to be cooled\n", + "s1=104.1; #solubility at 50 degree per 100 kg of water\n", + "s2=78.0; #solubility at 10 degree per 100 kg of water\n", + "a2=45.; #percentage of sodium nitrate in the solution per 100kg of solution \n", + "\n", + "# Calculation \n", + "x1=s1/(100+s1)*100; #percentage of saturated solution at 50 degree\n", + "tw=(a2/(100-a2))/(x1/(100-x1)); #the percentage saturation\n", + "print \"\\nthe percentage saturation is :%f percent\"%(tw*100)\n", + "\n", + "#part(ii)\n", + "#let x be the weight of NaNO3 crystal formed after crystallisation\n", + "#x=poly([0],'x'); #calc. x the weight of crystal\n", + "t=21.000000 #roots((w1*a2/100)-(x+(w1-x)*s2/(100+s2)));\n", + "\n", + "# Result\n", + "print \"\\n the weight of NaNO3 crystal formed after crystallisation :%f kg\"%t\n", + "\n", + "#part(iii)\n", + "y=t/(a2*w1/100); #yield = weight of NaNO3 crystal formed/weight of NaNO3\n", + "print \"\\n the percentage yield is:%f percent\"%(y*100)\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "the percentage saturation is :78.595756 percent\n", + "\n", + " the weight of NaNO3 crystal formed after crystallisation :21.000000 kg\n", + "\n", + " the percentage yield is:4.666667 percent\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.3,page no:117" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "s1=19.75; #solubility at 70 degree per 100 gm of water\n", + "s2=16.5; #solubility at 50 degree per 100 gm of water\n", + "s3=12.97; #solubility at 30 degree per 100 gm of water\n", + "s4=9.22; #solubility at 10 degree per 100 gm of water\n", + "s5=7.34; #solubility at 0 degree per 100 gm of water\n", + "\n", + "# Calculation \n", + " #basis is 1000kg of saturated solution\n", + "w1=1000.*(s1/(s1+100)); #weight of K2SO4 in the original solution\n", + "w2=1000.-w1; #weight of water in kg\n", + "w3=w1*.5; #weight of K2SO4 in the solution\n", + "wp=w3/(w3+w2); #weight percent of K2SO4 in the solution after crystallistion\n", + "\n", + "# Result\n", + "print \"\\n for the corresponding temperature to :%f percent of K2SO4 is 15 degree (by linear interpolation between 10 to 30 degree) \"%(wp*100)\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " for the corresponding temperature to :8.987486 percent of K2SO4 is 15 degree (by linear interpolation between 10 to 30 degree) \n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.4 ,page no:118" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "#part(i)\n", + "a1=146.; #solubility at 70 degree\n", + "a2=121.; #solubility at 10 degree\n", + "t1=58.; # percentage of solute content\n", + "t2=40.66;\n", + "\n", + "# Calculation and Result\n", + "x1=a1/(100+a1) *100; #percentage of saturated solution at 50 degree\n", + "tw=(t1/42.)/(x1/t2); #the percentage saturation\n", + "print \"\\nthe percentage saturation is :%f percent\"%(tw*100)\n", + "\n", + "#part(ii)\n", + "p1=2000*.58; #weight of solute in 200kg of solution 2000*.58\n", + "#let x be the weight of crystal formed after crystallisation\n", + "#x=poly([0],'x'); #calc. x the weight of crystal\n", + "t=231.743929 #roots((1160)-(x+(1055.02-.547*x))); \n", + "print \"\\n the weight of NaNO3 crystal formed after crystallisation :%f kg\"%t\n", + "\n", + "#part(iii)\n", + "y=t/p1; #yield = weight of NaNO3 crystal formed/weight of NaNO3\n", + "print \"\\n the percentage yield is:%f percent\"%(y*100)\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "the percentage saturation is :94.608102 percent\n", + "\n", + " the weight of NaNO3 crystal formed after crystallisation :231.743929 kg\n", + "\n", + " the percentage yield is:19.977925 percent\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.5,page no:119" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "p1=.3; #percentage of the solute in the solution\n", + "w1=1000.; #weight of the solution taken\n", + "w2=142.; #molecular weight of Na2SO4.\n", + "\n", + "# Calculation \n", + "M1=(w2/(180+w2)); #solute (Na2SO4) present in the Na2CO3.10H2O solution\n", + "s1=40.8; #solubility of Na2SO4 at 30 degree per 100 gm of water\n", + "s2=9.0; #solubility of Na2SO4 at 10 degree per 100 gm of water\n", + "#percent weight of solute in Na2SO4.10H2O= 144/322\n", + "#let x be the weight of crystal formed \n", + "#x=poly([0],'x'); #calc. x the weight of crystal\n", + "t= 576.477290 #roots((w1*40.8/140.8)-(.442*x+(w1-x)*(s2/(100+s2)))); \n", + "\n", + "# Result\n", + "print \"\\n the weight of crystal formed after crystallisation :%f kg\"%t\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the weight of crystal formed after crystallisation :576.477290 kg\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.6 ,page no:120" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "s1=12.5; #solubility of Na2CO3 at 10 degree per 100 gm of water\n", + "p1=.3; #percentage of the solute in the solution\n", + "w1=2000.; #weight of the solution taken\n", + "w2=106.; #molecular weight of Na2CO3.\n", + "\n", + "# Calculation \n", + "M1=(w2/(180+w2)); #solute (Na2CO3) present in the Na2CO3.10H2O solution\n", + "#let x be the quantity of Na2CO3.10H2O crystal formed\n", + "#x=poly([0],'x'); #calc. x the weight of crystal\n", + "t= 1455.688623 #roots(w1*p1-M1*x-(w1-x)*(s1/(100+s1))); \n", + "\n", + "# Result\n", + "print \"\\n the weight of quantity of Na2CO3.10H2O :%f kg\"%t\n", + "#in the book the ans is wrong, they have calculated 2000*0.3-2000*12.5/112.5 as =x(miscalculation)\n", + "\n", + "p=(286./106)*w1*p1; #weight of Na2CO3.10H2O crystal present in the original solution\n", + "y=t/p; #percentage yield \n", + "print \"\\n percentage yield :%f percent\"%(y*100)\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the weight of quantity of Na2CO3.10H2O :1455.688623 kg\n", + "\n", + " percentage yield :89.920160 percent\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.7 ,page no:121" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "s1=139.8; #solubility at 80 degree per 100 gm of water\n", + "s2=110.5; #solubility at 20 degree per 100 gm of water\n", + "w2=174.2; #molecular weight of K2CO3.10H2O\n", + "\n", + "# Calculation \n", + "M1=(138/w2)*100; #water present in 100kg of K2CO3.10H2O\n", + "#let x be the quantity of Na2CO3.10H2O\n", + "#x=poly([0],'x'); #calc. x the weight of crystal\n", + "t=108.634036 #roots(500*(139.8/239.8)-.7921*x-(500-x)*110.5/210.5); \n", + "\n", + "# Result\n", + "print \"\\n the weight of quantity of K2CO3.10H2O formed :%f kg\"%t\n", + "\n", + "p=(174./138)*500*(139.8/239.8); #weight of crystal present in the original solution\n", + "y=t/p; #percentage yield \n", + "print \"\\n percentage yield :%f percent\"%(y*100)\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the weight of quantity of K2CO3.10H2O formed :108.634036 kg\n", + "\n", + " percentage yield :29.557504 percent\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.8 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "s1=20.51; #solubility at 10 degree per 100 gm of water\n", + "w2=277.85; #molecular weight of FeSO4.7H2O\n", + "\n", + "# Calculation and Result\n", + "#let x be the quantity of Na2CO3.10H2O\n", + "#x=poly([0],'x'); #calc. x the weight of crystal\n", + "t= 549.684973 #roots(900*.4-.5465*x-(900-x)*20.5/120.5); \n", + "print \"\\n the weight of quantity of FeSO4.7H2O formed :%f kg\"%t\n", + "\n", + "p=(277.85/151.85)*900*(0.4); #weight of crystal present in the original solution\n", + "y=t/p; #percentage yield \n", + "print \"\\n percentage yield :%f percent\"%(y*100)\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the weight of quantity of FeSO4.7H2O formed :549.684973 kg\n", + "\n", + " percentage yield :83.447967 percent\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.9,page no:122" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#part(i)\n", + "a1=229.7; #solubility at 60 degree\n", + "a2=174.7; #solubility at 60 degree\n", + "t1=68; # percentage of sodium nitrate\n", + "t2=30.34;\n", + "\n", + "# Calculation and Result\n", + "x1=a1/329.7 *100; #percentage of saturated solution at 50 degree\n", + "tw=(t1/32.)/(x1/t2); #the percentage saturation\n", + "print \"\\nthe percentage saturation is :%f percent\"%(tw*100)\n", + "\n", + "#part(ii)\n", + "#let x be the weight of Cesium chloride crystal formed after crystallisation\n", + "#x=poly([0],'x'); #calc. x the weight of crystal\n", + "t=120.960000 #roots(1000*.68-(x+(1000-x)*174.7/274.7)); \n", + "print \"\\n the weight of CaCl2 crystal formed after crystallisation :%f kg\"%t\n", + "\n", + "#part(iii)\n", + "y=t/680.; #yield = weight of CaCl2 crystal formed/weight of CaCl2\n", + "print \"\\n the percentage yield of Cesium chloride is:%f percent\"%(y*100)\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "the percentage saturation is :92.540632 percent\n", + "\n", + " the weight of CaCl2 crystal formed after crystallisation :120.960000 kg\n", + "\n", + " the percentage yield of Cesium chloride is:17.788235 percent\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.10,page no:124" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "s1=38.8; #solubility at 30 degree per 100 gm of water\n", + "s2=12.5; #solubility at 10 degree per 100 gm of water\n", + "w2=296; #molecular weight of Na2CO3.10H2O\n", + "per=116./w2 *100; #percentage solute in Na2CO3.10H2O\n", + "\n", + "#let x be the quantity of Na2CO3.10H2O\n", + "w=200.; #original solotion weight\n", + "\n", + "# Calculation \n", + "m1=w*(s2/(s2+100)); #weight of Na2CO3.10H2O needed to dissolve Na2CO3 present in the original solotion \n", + "w3=w-m1; #weight of water \n", + "#w4=m1+per/100; weight of Na2CO3 after dissolution\n", + "x1=s1/(s1+100); #weight fraction of solute after dissolution \n", + "\n", + "# Result\n", + "print \"\\n the weight of quantity of Na2CO3.10H2O formed :%f kg\"%w3\n", + "\n", + "#for the total solution after dissolution\n", + "#x=poly([0],'x'); #calc. x the weight of crystal\n", + "t= 300.485784 #roots((m1+per*x/100)-((m1+per*x/100)+(w3+.609*x))*x1); \n", + "print \"\\nweight of Na2CO3.10H2O needed to dissolve Na2CO3 present in the original solution %f kg\"%t\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the weight of quantity of Na2CO3.10H2O formed :177.777778 kg\n", + "\n", + "weight of Na2CO3.10H2O needed to dissolve Na2CO3 present in the original solution 300.485784 kg\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.11,page no:125" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "s1=35.; #percentage of solution\n", + "x1=6000.; #weight of Na2CO3 solution\n", + "s2=21.5; #solubility at 20 degree per 100 gm of water\n", + "w2=296.; #molecular weight of Na2CO3.10H2O\n", + "\n", + "# Calculation \n", + "per=116./w2 *100; #percentage solute in Na2CO3.10H2O\n", + "w1=s1*x1; #weight of solute\n", + "w3=x1*0.04; #weight of solution lost by vaporisation\n", + "#let x be the quantity of Na2CO3.10H2O formed \n", + "#making material balance \n", + "#x=poly([0],'x'); #calc. x the weight of crystal\n", + "t= 5049.122335 #roots(2100-(.391*x)-(6000-240-x)*(21.5/121.5)); \n", + "\n", + "# Result\n", + "print \"\\n the weight of Na2CO3.10H2O crystal formed after crystallisation :%f kg\"%t\n", + "\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the weight of Na2CO3.10H2O crystal formed after crystallisation :5049.122335 kg\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.12,page no:126" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "C=1000.; #crystal formed in kg\n", + "hf=26.002; #enthalpy of the feed at 80 degree in cal/g\n", + "hl=-1.33; #enthalpy of the saturated sol at 30 degree in cal/g\n", + "hc=-50.56; #enthalpy of crystal\n", + "xf=40./(100+40);\n", + "xm=30./(100+30);\n", + "xc=151.84/277.85; #151.84 is the weight of FeSO4\n", + " #component balance\n", + "# F*xf = M*xm + C*xc ------eqn 1st\n", + "# F = M + 10000 + V ------eqn 2nd\n", + "# F*Hf = V*Hv + M*Hm +C*Hc-----eqn 3rd\n", + "Hf=26.002; #enthalpy of the feed at 80 degree in cal/g\n", + "Hv=612.; #\n", + "Hm=-1.33; #enthalpy of the saturated sol at 30 degree in cal/g\n", + "Hc=-50.56; #enthalpy of crystal leaving the crystalliser\n", + "from numpy import matrix\n", + "from numpy import linalg\n", + "#solving these we gt \n", + "\n", + "# Calculation \n", + "a=matrix([[1,-1,-1],[.286,-.231,0],[26.002,1.33,-612]])\n", + "b=matrix([[10000],[5470],[-505600]])\n", + "x=linalg.inv(a)*b; #solving out the values using matrices \n", + "t1=x[0]; #3 solution of the eqn\n", + "t2=x[1];\n", + "t3=x[2];\n", + "\n", + "# Result\n", + "print \"\\n the feed rate F= : %f kg/hr \\n value of M= : %f kg/hr\\n value of V=: %f kg/hr\"%(t1,t2,t3)\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " the feed rate F= : 45556.688340 kg/hr \n", + " value of M= : 32723.865218 kg/hr\n", + " value of V=: 2832.823122 kg/hr\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.13 ,page no:127" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "import math\n", + "C=800.; #crystal formed in kg/hr\n", + "t2=49.; #temp. of the entering fed\n", + "t1=27.; #temp. of the product\n", + "t3=21.; #temp. of the leaving cooling water\n", + "t4=15.; #temp. of the enetring cooling water\n", + "U=175.; #overall heat transfer coefficient\n", + "F=140*151.85/277.85; #feed concentration \n", + "xf=F/240; #concentration in feed solution\n", + "P=74*151.85/277.85; #product concentration \n", + "xm=P/174; #concentration of FeSO4 in product solution\n", + "xc=151.85/277.85; #\n", + " #mass balance F = M+C ----eqn 1st\n", + " #sloute balance F*xf = M*xm + C*xc ----eqn 2nd\n", + "\n", + "# Calculation \n", + "#solving these we get\n", + "F=800*.3141/0.0866; #feed conc.\n", + "M=F-C; #product concentration \n", + " #making energy balance\n", + " #heat to be removed by cooling water =heat to be removed from solution + heat of crystallization\n", + "cp=.7; #specific heat capacity\n", + "dt=(t2-t1); #change in temp.\n", + "dh=15.8; #heat of crystallization\n", + "Q=F*cp*dt+dh*C; #heat to be removed by cooling water\n", + "cp=1; #specific heat capacity of water\n", + "dt=(t3-t4); #change in temp.\n", + "mw=Q/(cp*dt); #cooling water needed\n", + "\n", + "# Result \n", + "print \"\\n cooling water requiement is :%f kg/hr\"%mw\n", + " #Q=U*A*(dtlm)\n", + "dtlm=((t2-t3)-(t1-t4))/(math.log((t2-t3)/(t1-t4)));#log mean temp. difference\n", + "A=Q/(U*dtlm); #area of the crystallizer section\n", + "l=A/1.3;\n", + "print \"\\n length of crystallliser sections needed is :%f m\"%l\n", + "\n", + "#end" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " cooling water requiement is :9554.149346 kg/hr\n", + "\n", + " length of crystallliser sections needed is :13.343753 m\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Elements_Of_Mass_Transfer_Part_1/ch2.ipynb b/Elements_Of_Mass_Transfer_Part_1/ch2.ipynb index db1c8564..e773ceb5 100644 --- a/Elements_Of_Mass_Transfer_Part_1/ch2.ipynb +++ b/Elements_Of_Mass_Transfer_Part_1/ch2.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:63ec039d8e0cb7cbcf7792965630fc54de76590123e48dd89f9e70d5575deae0" + "signature": "sha256:05dd7d031d8f8235fad8f9f829266696c5bc621c67edd6565f3609ff957ed749" }, "nbformat": 3, "nbformat_minor": 0, @@ -21,7 +21,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 2.1.a " + "Example 2.1.a,page no:20 " ] }, { @@ -71,7 +71,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 2.1.b " + "Example 2.1.b,page no:21 " ] }, { @@ -124,7 +124,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 2.2 " + "Example 2.2 ,page no:23" ] }, { @@ -167,7 +167,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 2.3 " + "Example 2.3,page no:24 " ] }, { @@ -218,7 +218,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 2.4 " + "Example 2.4 ,page no:25" ] }, { @@ -270,7 +270,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 2.5.a" + "Example 2.5.a,page no:25" ] }, { @@ -314,7 +314,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 2.5.b" + "Example 2.5.b,page no:26" ] }, { @@ -359,7 +359,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 2.6 " + "Example 2.6,page no:27 " ] }, { @@ -409,7 +409,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 2.7 " + "Example 2.7 ,page no:28" ] }, { @@ -452,7 +452,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 2.8" + "Example 2.8,page no:29" ] }, { @@ -507,7 +507,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 2.9" + "Example 2.9,page no:30" ] }, { @@ -563,7 +563,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 2.10.a" + "Example 2.10.a,page no:31" ] }, { @@ -611,7 +611,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 2.10.b" + "Example 2.10.b,page no:32" ] }, { @@ -662,7 +662,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 2.11.a" + "Example 2.11.a,page no:33" ] }, { @@ -707,7 +707,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 2.11.b" + "Example 2.11.b,page no:33" ] }, { @@ -750,7 +750,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 2.12" + "Example 2.12,page no:34" ] }, { @@ -810,7 +810,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 2.13" + "Example 2.13,page no:35" ] }, { @@ -865,7 +865,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 2.14" + "Example 2.14,page no:36" ] }, { @@ -918,7 +918,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 2.15" + "Example 2.15,page no:37" ] }, { @@ -965,7 +965,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 2.16" + "Example 2.16,page no:38" ] }, { @@ -1019,7 +1019,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 2.17" + "Example 2.17,page no:39" ] }, { @@ -1087,7 +1087,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 2.18" + "Example 2.18,page no:40" ] }, { @@ -1136,13 +1136,14 @@ "level": 3, "metadata": {}, "source": [ - "Example 2.19" + "Example 2.19,page no:41" ] }, { - "cell_type": "code", - "collapsed": false, - "input": [ + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ " \n", "# variable declaration \n", "\n", @@ -1173,27 +1174,14 @@ "# Result\n", "print \"\\n the diffusivity of the mixture in stefan tube of toluene in air is :%f*10**-5 m**2/s\"%(Dab/10**-5)\n", "#end" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " the diffusivity of the mixture in stefan tube of toluene in air is :0.915437*10**-5 m**2/s\n" - ] - } - ], - "prompt_number": 55 + ] }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ - "Example 2.20 " + "Example 2.20,page no: 42" ] }, { @@ -1245,7 +1233,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 2.21" + "Example 2.21,page no:43" ] }, { @@ -1300,7 +1288,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 2.22" + "Example 2.22,page no:45" ] }, { @@ -1389,7 +1377,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 2.23" + "Example 2.23,page no:46" ] }, { @@ -1436,7 +1424,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 2.24" + "Example 2.24,page no:47" ] }, { @@ -1477,7 +1465,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 2.25" + "Example 2.25,page no:48" ] }, { @@ -1517,7 +1505,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 2.26" + "Example 2.26,page no:49" ] }, { diff --git a/Elements_Of_Mass_Transfer_Part_1/ch3.ipynb b/Elements_Of_Mass_Transfer_Part_1/ch3.ipynb index 42c74db2..367b3d5a 100644 --- a/Elements_Of_Mass_Transfer_Part_1/ch3.ipynb +++ b/Elements_Of_Mass_Transfer_Part_1/ch3.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:3744cb249ffd9e10c950b9110990dfac9cd54ad63b8fe61f5671a88b4822fb4c" + "signature": "sha256:eb744b726bacf04c11f26196fa6e57862adb6fb8246bed105c1ddbe4b2f86f5c" }, "nbformat": 3, "nbformat_minor": 0, @@ -18,10 +18,10 @@ }, { "cell_type": "heading", - "level": 3, + "level": 1, "metadata": {}, "source": [ - "Example 3.1" + "Example 3.1,page no:51" ] }, { @@ -73,7 +73,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 3.2" + "Example 3.2,page no:52" ] }, { @@ -126,7 +126,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 3.3 " + "Example 3.3,page no:53" ] }, { @@ -183,7 +183,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 3.4" + "Example 3.4,page no:55" ] }, { @@ -231,7 +231,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 3.5 " + "Example 3.5,page no:56 " ] }, { @@ -293,7 +293,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 3.6 " + "Example 3.6 ,page no:57" ] }, { @@ -344,7 +344,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 3.7" + "Example 3.7,page no:58" ] }, { @@ -404,7 +404,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 3.8" + "Example 3.8,page no:59" ] }, { @@ -529,7 +529,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 3.9" + "Example 3.9,page no:60" ] }, { diff --git a/Elements_Of_Mass_Transfer_Part_1/ch5.ipynb b/Elements_Of_Mass_Transfer_Part_1/ch5.ipynb index 5acdca48..d5ac1b11 100644 --- a/Elements_Of_Mass_Transfer_Part_1/ch5.ipynb +++ b/Elements_Of_Mass_Transfer_Part_1/ch5.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:2ee4e5f8137c7268975819ca4a31ef66c4a59076a802f56667cecd1c3f67b2a9" + "signature": "sha256:b1fcea3b1af0833a04f8dbeea1fd73969d92b6f7184bdfbbc8fbd5b99b9f1ac6" }, "nbformat": 3, "nbformat_minor": 0, @@ -21,13 +21,14 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.1 " + "Example 5.1 ,page no:80" ] }, { - "cell_type": "code", - "collapsed": false, - "input": [ + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ " \n", "\n", "# Variable Declaration \n", @@ -83,43 +84,14 @@ "print \"\\n by interpolation we get specific volume Vh as(b) :%f m**3/kg of dry air\"%Vh\n", "\n", "#end" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - " the humidity(from chart) is \t\t:0.048300 percent\n", - "\n", - " the percentage humidity is(from chart) :35.000000 percent\n", - "\n", - " the percentage relative humidity is \t percent:37.822988 \n", - "\n", - " the dew point temperature \t\t :31.500000 degree celcius\n", - "\n", - " we get humid heat as \t\t\t :1.061520 kj/kg dry air degree celcius \n", - "\n", - " we get H as \t\t\t\t :128.136000 kj/kg\n", - "\n", - " we get enthalpy of wet air as \t:128.400000 kj/kg\n", - "\n", - " we get VH as (a)\t\t\t :0.963494 m**3/kg of dry air\n", - "\n", - " by interpolation we get specific volume Vh as(b) :0.960750 m**3/kg of dry air\n" - ] - } - ], - "prompt_number": 13 + ] }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ - "Example 5.2 " + "Example 5.2 ,page no:81" ] }, { @@ -199,7 +171,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.3" + "Example 5.3,page no:82" ] }, { @@ -270,7 +242,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.4 " + "Example 5.4 ,page no:83" ] }, { @@ -340,7 +312,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.5 " + "Example 5.5 ,page no:84" ] }, { @@ -413,7 +385,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.6 " + "Example 5.6 ,page no:85" ] }, { @@ -476,7 +448,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.7 " + "Example 5.7 ,page no:86" ] }, { @@ -517,7 +489,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.8" + "Example 5.8,page no:87" ] }, { @@ -600,7 +572,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.9" + "Example 5.9,page no:88" ] }, { @@ -678,7 +650,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.10" + "Example 5.10,page no:89" ] }, { @@ -865,7 +837,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.11" + "Example 5.11,page no:90" ] }, { @@ -922,7 +894,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 5.12 " + "Example 5.12 ,page no:91" ] }, { diff --git a/Elements_Of_Mass_Transfer_Part_1/ch6.ipynb b/Elements_Of_Mass_Transfer_Part_1/ch6.ipynb index d6c3df87..0bb12c4f 100644 --- a/Elements_Of_Mass_Transfer_Part_1/ch6.ipynb +++ b/Elements_Of_Mass_Transfer_Part_1/ch6.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:a29072d0985b8dbf41dbd6153642bf709b504655904069bc08292ea01d2d0ef9" + "signature": "sha256:908e06aad04692e83df6966ed7f965ac13bd8644318dfcc775c5b26cef8525a8" }, "nbformat": 3, "nbformat_minor": 0, @@ -21,7 +21,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.1 " + "Example 6.1 ,page no:92" ] }, { @@ -80,7 +80,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.2 " + "Example 6.2,page no:93 " ] }, { @@ -163,7 +163,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.3.a " + "Example 6.3.a ,page no:94" ] }, { @@ -235,7 +235,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.3.b" + "Example 6.3.b,page no:95" ] }, { @@ -292,7 +292,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.4" + "Example 6.4,page no:96" ] }, { @@ -361,7 +361,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.5.a" + "Example 6.5.a,page no:97" ] }, { @@ -468,7 +468,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.5.b " + "Example 6.5.b ,page no:98" ] }, { @@ -512,7 +512,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.5.c " + "Example 6.5.c ,page no:99" ] }, { @@ -560,7 +560,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.6" + "Example 6.6,page no:100" ] }, { @@ -612,7 +612,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.7 " + "Example 6.7 ,page no:101" ] }, { @@ -663,7 +663,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.8.a" + "Example 6.8.a,page no:102" ] }, { @@ -709,7 +709,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.8.b " + "Example 6.8.b ,page no:103" ] }, { @@ -761,7 +761,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.9 " + "Example 6.9 ,page no:104" ] }, { @@ -809,7 +809,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.10 " + "Example 6.10 ,page no:105" ] }, { @@ -858,7 +858,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.11 " + "Example 6.11 ,page no:106" ] }, { @@ -907,7 +907,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.12" + "Example 6.12,page no:107" ] }, { @@ -958,7 +958,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.13" + "Example 6.13,page no:108" ] }, { @@ -1012,7 +1012,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.14" + "Example 6.14,page no:109" ] }, { @@ -1065,7 +1065,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.15" + "Example 6.15,page no:110" ] }, { @@ -1131,7 +1131,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.16" + "Example 6.16,page no:112" ] }, { @@ -1179,7 +1179,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 6.17" + "Example 6.17,page no:113" ] }, { diff --git a/Elements_Of_Mass_Transfer_Part_1/ch7.ipynb b/Elements_Of_Mass_Transfer_Part_1/ch7.ipynb index 9dcbb1df..ca15d415 100644 --- a/Elements_Of_Mass_Transfer_Part_1/ch7.ipynb +++ b/Elements_Of_Mass_Transfer_Part_1/ch7.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:9c280dff7f4e1d5ae99e0fbadb3fa83466c67b9a415e20bbef76992fab6df294" + "signature": "sha256:9ea2cdc5241823a115acd23fdb7d14283a1bb5201840b0c48f401f177b1de4bd" }, "nbformat": 3, "nbformat_minor": 0, @@ -21,7 +21,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 7.1 " + "Example 7.1 ,page no:115" ] }, { @@ -71,7 +71,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 7.2 " + "Example 7.2 ,page no:116" ] }, { @@ -127,7 +127,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 7.3" + "Example 7.3,page no:117" ] }, { @@ -173,7 +173,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 7.4 " + "Example 7.4 ,page no:118" ] }, { @@ -228,7 +228,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 7.5" + "Example 7.5,page no:119" ] }, { @@ -274,7 +274,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 7.6 " + "Example 7.6 ,page no:120" ] }, { @@ -324,7 +324,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 7.7 " + "Example 7.7 ,page no:121" ] }, { @@ -415,7 +415,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 7.9" + "Example 7.9,page no:122" ] }, { @@ -468,7 +468,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 7.10" + "Example 7.10,page no:124" ] }, { @@ -522,7 +522,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 7.11" + "Example 7.11,page no:125" ] }, { @@ -570,7 +570,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 7.12" + "Example 7.12,page no:126" ] }, { @@ -631,7 +631,7 @@ "level": 3, "metadata": {}, "source": [ - "Example 7.13 " + "Example 7.13 ,page no:127" ] }, { diff --git a/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_1-checkpoint.ipynb b/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_1-checkpoint.ipynb new file mode 100644 index 00000000..d44c3a90 --- /dev/null +++ b/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_1-checkpoint.ipynb @@ -0,0 +1,381 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:eb36bd65b4a83ec123fa29550d3c2d667495d3d3383848faa667d8b6a5548ac3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 1: Vector Analysis

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 1.1, Page number: 8

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "import scipy\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "A=array([10,-4,6]) \n", + "B=array([2,1,0])\n", + "ax=array([1,0,0]) #Unit vector along x direction\n", + "ay=array([0,1,0]) #Unit vector along y direction\n", + "az=array([0,0,1]) #Unit vector along z direction\n", + "\n", + "#Calculations\n", + "\n", + "Ay=dot(A,ay) #Component of A along y direction\n", + "l=scipy.sqrt(dot(3*A-B,3*A-B)) #Magnitude of the vector 3A-B\n", + "\n", + " #Defining the x,y and z components of the unit vector along A+2B\n", + " \n", + "ux=round(dot(A+2*B,ax)/scipy.sqrt(dot(A+2*B,A+2*B)),4)\n", + "uy=round(dot(A+2*B,ay)/scipy.sqrt(dot(A+2*B,A+2*B)),4)\n", + "uz=round(dot(A+2*B,az)/scipy.sqrt(dot(A+2*B,A+2*B)),4)\n", + "\n", + "u=array([ux,uy,uz])\n", + "\n", + "#Results\n", + "\n", + "print 'The component of A along y direction is',Ay\n", + "print 'Magnitude of 3A-B =',round(l,2)\n", + "print 'Unit vector along A+2B is',u" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The component of A along y direction is -4\n", + "Magnitude of 3A-B = 35.74\n", + "Unit vector along A+2B is [ 0.9113 -0.1302 0.3906]\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 1.2, Page number: 9

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "P=array([0,2,4]) \n", + "Q=array([-3,1,5])\n", + "ax=array([1,0,0]) #Unit vector along x direction\n", + "ay=array([0,1,0]) #Unit vector along y direction\n", + "az=array([0,0,1]) #Unit vector along z direction\n", + "origin=array([0,0,0]) #Defining the origin\n", + "\n", + "#Calculations\n", + "\n", + "PosP=P-origin #The position vector P\n", + "Dpq=Q-P #The distance vector from P to Q\n", + "l=scipy.sqrt(dot(Dpq,Dpq)) #Magnitude of the distance vector from P to Q\n", + "\n", + " #Defining the x,y and z components of the unit vector along Dpq\n", + " \n", + "ux=round(dot(Dpq,ax)/l,4)\n", + "uy=round(dot(Dpq,ay)/l,4)\n", + "uz=round(dot(Dpq,az)/l,4)\n", + "\n", + "vect=array([ux*10,uy*10,uz*10]) #Vector parallel to PQ with magntude of 10\n", + "\n", + "#Results\n", + "\n", + "print 'The position vector P is',PosP\n", + "print 'The distance vector from P to Q is',Dpq\n", + "print 'The distance between P and Q is',round(l,3)\n", + "print 'Vector parallel to PQ with magntude of 10 is',vect" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The position vector P is [0 2 4]\n", + "The distance vector from P to Q is [-3 -1 1]\n", + "The distance between P and Q is 3.317\n", + "Vector parallel to PQ with magntude of 10 is [-9.045 -3.015 3.015]\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 1.3, Page number: 10

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "vriver=10 #Speed of river in km/hr\n", + "vman=2 #Speed of man relative to boat in km/hr\n", + "ax=array([1,0,0]) #Unit vector along x direction\n", + "ay=array([0,1,0]) #Unit vector along y direction\n", + "az=array([0,0,1]) #Unit vector along z direction\n", + "\n", + "#Calculations\n", + "\n", + " #Velocity of boat\n", + "\n", + "Vboat=vriver*(scipy.cos(scipy.pi/4)*ax- \n", + " scipy.sin(scipy.pi/4)*ay) \n", + " \n", + " #Relative velocity of man with respect to boat\n", + "\n", + "Vrelman=vman*(-scipy.cos(scipy.pi/4)*ax- \n", + " scipy.sin(scipy.pi/4)*ay) \n", + " \n", + " #Absolute velocity of man\n", + " \n", + "Vabs=Vboat+Vrelman\n", + " \n", + "mag=scipy.sqrt(dot(Vabs,Vabs)) #Magnitude of the velocity of man\n", + "Vabsx=dot(Vabs,ax) #X component of absolute velocity\n", + "Vabsy=dot(Vabs,ay) #Y component of absolute velocity\n", + "angle=scipy.arctan(Vabsy/Vabsx)*180/scipy.pi #Angle made with east in degrees\n", + "\n", + "#Result\n", + "\n", + "print 'The velocity of the man is',round(mag,1),'km/hr at an angle of'\n", + "print -round(angle,1),'degrees south of east'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The velocity of the man is 10.2 km/hr at an angle of\n", + "56.3 degrees south of east\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 1.4, Page number: 17

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "import scipy\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "A=array([3,4,1])\n", + "B=array([0,2,-5])\n", + "ax=array([1,0,0]) #Unit vector along x direction\n", + "ay=array([0,1,0]) #Unit vector along y direction\n", + "az=array([0,0,1]) #Unit vector along z direction\n", + "\n", + "#Calculations\n", + "\n", + "magA=scipy.sqrt(dot(A,A)) #Magnitude of A\n", + "magB=scipy.sqrt(dot(B,B)) #Magnitude of B\n", + "angle=scipy.arccos(dot(A,B)/(magA*magB)) #Angle between A and B in radians\n", + "angled=angle*180/scipy.pi #Angle between A and B in degrees\n", + "\n", + "\n", + "#Result\n", + "\n", + "print 'The angle between A and B =',round(angled,2),'degrees'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The angle between A and B = 83.73 degrees\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 1.5, Page number: 17

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "import scipy\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "P=array([2,0,-1])\n", + "Q=array([2,-1,2])\n", + "R=array([2,-3,1])\n", + "ax=array([1,0,0]) #Unit vector along x direction\n", + "ay=array([0,1,0]) #Unit vector along y direction\n", + "az=array([0,0,1]) #Unit vector along z direction\n", + "\n", + "#Calculations\n", + "\n", + "ansa=cross((P+Q),(P-Q))\n", + "ansb=dot(Q,cross(R,P))\n", + "ansc=dot(P,cross(Q,R))\n", + "lqxr=scipy.sqrt(dot(cross(Q,R),cross(Q,R))) #Magnitude of QXR\n", + "lq=scipy.sqrt(dot(Q,Q)) #Magnitude of Q\n", + "lr=scipy.sqrt(dot(R,R)) #Magnitude of R\n", + "ansd=lqxr/(lq*lr)\n", + "anse=cross(P,cross(Q,R))\n", + "\n", + "#Finding unit vector perpendicular to Q and R\n", + "\n", + "ux=dot(cross(Q,R),ax)/lqxr #X component of the unit vector\n", + "uy=dot(cross(Q,R),ay)/lqxr #Y component of the unit vector\n", + "uz=dot(cross(Q,R),az)/lqxr #Z component of the unit vector\n", + "\n", + "ansf=array([round(ux,3),round(uy,3),round(uz,3)])\n", + "\n", + "ansg=round((float(dot(P,Q))/dot(Q,Q)),4)*Q\n", + "\n", + "\n", + "#Results\n", + "\n", + "print '(P+Q)X(P-Q) =',ansa\n", + "print 'Q.(R X P) =',ansb\n", + "print 'P.(Q X R) =',ansc\n", + "print 'Sin(theta_QR) =',round(ansd,4)\n", + "print 'P X (Q X R) =',anse\n", + "print 'A unit vector perpendicular to both Q and R =',ansf\n", + "print 'The component of P along Q =',ansg\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(P+Q)X(P-Q) = [ 2 12 4]\n", + "Q.(R X P) = 14\n", + "P.(Q X R) = 14\n", + "Sin(theta_QR) = 0.5976\n", + "P X (Q X R) = [2 3 4]\n", + "A unit vector perpendicular to both Q and R = [ 0.745 0.298 -0.596]\n", + "The component of P along Q = [ 0.4444 -0.2222 0.4444]\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 1.7, Page number: 21

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "P1=array([5,2,-4])\n", + "P2=array([1,1,2])\n", + "P3=array([-3,0,8])\n", + "P4=array([3,-1,0])\n", + "\n", + "#Calculations\n", + "\n", + "R12=P2-P1; #Distance vector from P1 to P2\n", + "R13=P3-P1; #Distance vector from P1 to P3\n", + "R14=P4-P1; #Distance vector from P1 to P4\n", + "s=cross(R12,R13)\n", + "x=cross(R14,R12)\n", + "d=scipy.sqrt(dot(x,x))/scipy.sqrt(dot(R12,R12)) #Distance from line to P4 \n", + "\n", + "#Results\n", + "\n", + "print 'The cross product of the distance vectors R12 and R14 =',s\n", + "print 'So they are along same direction and hence P1, P2 and P3 are collinear.'\n", + "print 'The shortest distance from the line to point P4 =',round(d,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The cross product of the distance vectors R12 and R14 = [0 0 0]\n", + "So they are along same direction and hence P1, P2 and P3 are collinear.\n", + "The shortest distance from the line to point P4 = 2.426\n" + ] + } + ], + "prompt_number": 6 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_10-checkpoint.ipynb b/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_10-checkpoint.ipynb new file mode 100644 index 00000000..86a61c5f --- /dev/null +++ b/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_10-checkpoint.ipynb @@ -0,0 +1,521 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:cdf18287acc82150753d10351b24abe70a503e3715e5a7f68621619ab02a6a02" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 10: Electromagnetic Wave Propagation

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.1, Page number: 416

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "import scipy\n", + "from pylab import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "w=10**8 \n", + "c=3.0*10**8\n", + "\n", + "#Calculations\n", + "\n", + "T=2*scipy.pi/w #timeperiod of the wave in sec\n", + "B=(w/c) #in rad/m\n", + "lam=2*scipy.pi/B #wavelength in m\n", + "t1=lam*10**9/(2*c) #time taken to travel half the wavelength in ns \n", + "\n", + "x=arange(-6*scipy.pi,6*scipy.pi,0.1)\n", + "\n", + "t=0\n", + "E=50*scipy.cos(10**8*t+x*w/c)\n", + "\n", + "subplot(3,1,1)\n", + "xlabel(\"x\")\n", + "ylabel(\"E for t=0\")\n", + "plot(x,E,'r')\n", + "\n", + "subplot(3,1,2)\n", + "t=T/4\n", + "E=50*scipy.cos(10**8*t+x*w/c)\n", + "xlabel(\"x\")\n", + "ylabel(\"E for t=T/4\")\n", + "plot(x,E)\n", + "\n", + "subplot(3,1,3)\n", + "t=T/2\n", + "E=50*scipy.cos(10**8*t+x*w/c)\n", + "xlabel(\"x\")\n", + "ylabel(\"E for t=T/2\")\n", + "plot(x,E,'g')\n", + "show()\n", + "\n", + "#Results\n", + "\n", + "print 'Since the argument of cosine function is positive, '\n", + "print 'the wave is propagating in the negative x direction.'\n", + "print' B =',round(B,4),'rad/m'\n", + "print 'Time taken to travel a distance of lambda/2 =',round(t1,2),'n sec'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEICAYAAABF82P+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzsnXlcVNX7xz+DG5bmhjurggyLMqgsmho7pCIq+hVzK7EU\nNVyyfmYlZmXhjpZroqlZmaXigoIimyaoWCjhlii448aObM/vj5MTKOswM/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d+LZvEhGioqLg6emJefPmaZfr1Z7GqV+GJRKJyNHRUedtogkJCeTi4kLu7u5UVFTE\nYUqi1NRUsre3px49epCNjQ2FhIQQEdHevXvJw8ODvL29KSwsjAoLC3mZk4hf7dlaZGQkeXl50dCh\nQ2n+/Pm8uxOnoKCAxGIxubi40Nq1a7mOo9OFCxfI29ubvL29KSAggLZs2cJ1JK2IiAiys7Ojbt26\nkb29PSUnJ/PyNtf/5ezatSvZ29vTli1beLdvFhcXk0AgIG9v7za33urTnmY1YRDDMAxjOmZxiYlh\nGIYxPVYgGIZhGJ1YgWAYhmF0YgWCYRiG0YkVCIbppLKyMnh7e+Pu3bu4c+cOPD09cfr0aa5jMUyn\nsbuYGMYAFi9ejObmZqhUKjg4OGDhwoVcR2KYTmMFgmEMoKWlBcOGDYOFhQWOHDnC5k9nngjsEhPD\nGMCNGzdw584d3L59GyqVius4DGMQ7AyCYQxg0qRJmD59Oi5cuIArV64gMTGR60gM02m8Gc2VYczV\n9u3b0b17d0RERECj0WDUqFEoKCiAv78/19EYplPYGQTDMAyjE+uDYBiGYXRiBYJhGIbRiRUIhmEY\nRidWIBiGYRidWIFgGIZhdGIFgmEYhtHp/wBv2SibrE7lggAAAABJRU5ErkJggg==\n", + "text": [ + "" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Since the argument of cosine function is positive, \n", + "the wave is propagating in the negative x direction.\n", + " B = 0.3333 rad/m\n", + "Time taken to travel a distance of lambda/2 = 31.42 n sec\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.2, Page number: 428

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import cmath\n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "Ho=10 \n", + "n=200*scipy.exp(1)**(1j*scipy.pi/6) \n", + "b=0.5\n", + "\n", + "#Calclations\n", + "\n", + "Eo=n*Ho #amplitude of electric field in kV/m\n", + "P=scipy.arctan(scipy.sqrt(3)) \n", + "a=b*((scipy.sqrt(((1+(scipy.tan(P))**2)**0.5)-1))/(scipy.sqrt(((1+(scipy.tan(P)\n", + ")**2)**0.5)+1)))\n", + "delta=1/a\n", + "\n", + "#Results\n", + "\n", + "print 'E has the same form as H except for amplitude and phase.'\n", + "print 'The amplitude and phase of E =',Eo,'kV/m'\n", + "print '= magnitude of 2000 and angle of pi/6'\n", + "print 'a =',round(a,4),'Np/m'\n", + "print 'Skin depth =',round(delta,3),'m'\n", + "print 'The polarization of wave is in z direction since it has an z component.'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "E has the same form as H except for amplitude and phase.\n", + "The amplitude and phase of E = (1732.05080757+1000j) kV/m\n", + "= magnitude of 2000 and angle of pi/6\n", + "a = 0.2887 Np/m\n", + "Skin depth = 3.464 m\n", + "The polarization of wave is in z direction since it has an z component.\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.3, Page number: 430

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "B=1\n", + "n=60*scipy.pi \n", + "Ur=1 #relative permeability\n", + "Eo=10**-9/(36*scipy.pi) #permittivity of free space\n", + "Uo=4*scipy.pi*10**-7 #permeability of free space\n", + "\n", + "#Calculations\n", + "\n", + "Er=Uo*Ur/(n**2*Eo) #relative permittivity\n", + "w=B/scipy.sqrt(Eo*Er*Uo*Ur) #in rad/sec\n", + "eps=Eo*Er #permittivity of the medium in Farad/m\n", + "H1o=-0.1\n", + "H2o=0.5\n", + "Ex=H2o/(eps*w) #amplitude of x component of E in V/m\n", + "Ey=H1o/(eps*w) #amplitude of y component of E in V/m\n", + "\n", + "\n", + "#Results\n", + "\n", + "print 'er =',Er\n", + "print 'w =',w,'rad/sec'\n", + "print 'E =',round(Ex,2),'sin(wt-z)ax +',round(-Ey,2),'cos(wt-z)ay V/m'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "er = 4.0\n", + "w = 150000000.0 rad/sec\n", + "E = 94.25 sin(wt-z)ax + 18.85 cos(wt-z)ay V/m\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.4, Page number: 432

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "E=2 #amplitude of E in V/m\n", + "sigma=3 #in mhos/m\n", + "w=10**8 #in rad/sec\n", + "Ur=20 #relative permeability\n", + "Eo=10**-9/(36*scipy.pi) #permittivity of free space in Farad/m\n", + "Er=1 #relative permittivity\n", + "Uo=4*scipy.pi*10**-7 #permeability of free space\n", + "\n", + "#Calculations\n", + "\n", + "a=round(scipy.sqrt(Uo*Ur*w*sigma/2),1) #in Np/m\n", + "B=a #rad/m\n", + "theta=scipy.arctan(sigma/(w*Eo*Er))*0.5 #in radians\n", + "thetad=round(theta*180/scipy.pi,0) #in degrees\n", + "H=E/(scipy.sqrt(Uo*Ur*w/sigma))*10**3 #amplitude of H in mA/m\n", + "\n", + "#Results\n", + "\n", + "print 'alpha =',a,'Np/m'\n", + "print 'beta =',B,'rad/m'\n", + "print 'H =',round(H,1),'e^ (',a,'z ) sin(wt - Bz -',thetad,') mA/m'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "alpha = 61.4 Np/m\n", + "beta = 61.4 rad/m\n", + "H = 69.1 e^ ( 61.4 z ) sin(wt - Bz - 45.0 ) mA/m\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.6, Page number: 434

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + " \n", + "a=2*10**-3 #in m\n", + "b=6*10**-3 #in m \n", + "t=10**-3 #in m\n", + "l=2 #in m\n", + "c=5.8*10**7 #conductivity in seimens\n", + "f=100*10**6 #frequency in Hz\n", + "mu=4*scipy.pi*10**-7 #permeability of free space\n", + "\n", + "#Calculations\n", + "\n", + "Ri=l/(c*scipy.pi*a*a) #dc resistance of inner cable in ohms\n", + "Ro=l/(c*scipy.pi*((b+t)**2-b**2)) #dc resistance of outer cable in ohms\n", + "Rdc=Ro+Ri #total dc resistance in ohms\n", + "\n", + "Ria=round(l/(2*scipy.pi*a)*scipy.sqrt(scipy.pi*f*mu/c),1)\n", + "Roa=round(l/(2*scipy.pi*b)*scipy.sqrt(scipy.pi*f*mu/c),4)\n", + "Rac=Ria+Roa #ac resistance in ohms\n", + "\n", + "#Results\n", + "\n", + "print 'Rdc =',round(Rdc*10**3,3),'m ohms'\n", + "print 'Rac =',round(Rac,4),'ohms'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Rdc = 3.588 m ohms\n", + "Rac = 0.5384 ohms\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.7, Page number: 439

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "import scipy\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "ax=array([1,0,0]) #Unit vector along x direction\n", + "ay=array([0,1,0]) #Unit vector along y direction\n", + "az=array([0,0,1]) #Unit vector along z direction\n", + "a=0 #alpha in m^-1\n", + "b=0.8 #beta in m^-1\n", + "Eo=10**-9/(36*scipy.pi) #permittivity of free space in farad/m\n", + "Uo=4*scipy.pi*10**-7 #permeability of free space\n", + "Ur=1 #relative permeability of medium\n", + "w=2*scipy.pi*10**7 #omega in rad/s\n", + "Eamp=4 #amplitude of the field in V/m\n", + "\n", + "#Calculations\n", + "\n", + "Er=b**2/(Uo*Eo*w*w) #relative permittivity of the medium\n", + "n=scipy.sqrt(Uo/(Eo*Er)) #eta in ohms\n", + "Pav=Eamp**2/(2*n)*ax #average power in W/m^2\n", + "an=(2*ax+ay)/scipy.sqrt(5) #normal to the plane\n", + "S=100*10**-4*an #area in m^2\n", + "P=dot(Pav,S)*10**6 #power through the plane in micro W\n", + "\n", + "#Results\n", + "\n", + "print 'Er=',round(Er,2)\n", + "print 'eta= ',round(n,1),'ohms'\n", + "print 'The time-average power =',round(dot(Pav,ax)*10**3,0),'ax mW/m^2'\n", + "print 'The total power crossing 100 cm^2 of the plane =',round(P,2),'micro W'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Er= 14.59\n", + "eta= 98.7 ohms\n", + "The time-average power = 81.0 ax mW/m^2\n", + "The total power crossing 100 cm^2 of the plane = 725.0 micro W\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.10, Page number: 458

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy \n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "ax=array([1,0,0]) #Unit vector along x direction\n", + "ay=array([0,1,0]) #Unit vector along y direction\n", + "az=array([0,0,1]) #Unit vector along z direction\n", + "kx=0 #in m^-1\n", + "ky=0.866 #in m^-1\n", + "kz=0.5 #in m^-1\n", + "Eo=10**-9/(36*scipy.pi) #permittivity of free space in farad/m\n", + "Uo=4*scipy.pi*10**-7 #permeability of free space\n", + "c=1/(scipy.sqrt(Uo*Eo)) #speed of light in m/s\n", + "kvect=kx*ax+ky*ay+kz*az #propogation vector in m^-1\n", + "Eo=100 #amplitude of electric field\n", + "\n", + "#Calculations\n", + "\n", + "k=round(scipy.sqrt(kx*kx+ky*ky+kz*kz),0) #magnitude of k in m^-1\n", + "w=k*c #omega in rad/sec\n", + "lam=2*scipy.pi/k #wavelength in m\n", + "Ho=cross(kvect,Eo*ax*10)/(Uo*w) #amplitude of magnetic field in mA/m\n", + "Hoy=round(dot(Ho,ay),2) #y component of Ho\n", + "Hoz=round(dot(Ho,az),1) #z component of Ho\n", + "Hr=array([0,Hoy,Hoz]) #Ho with components rounded off\n", + "P=Eo**2/(2*120*scipy.pi)*kvect #average power in W/m^2\n", + "Py=round(dot(P,ay),2) #y component of P\n", + "Pz=round(dot(P,az),3) #z component of P\n", + "Pr=array([0,Py,Pz]) #P with components rounded off\n", + "\n", + "#Results\n", + "\n", + "print 'w =',w,'rad/sec'\n", + "print 'lambda =',round(lam,3),'m'\n", + "print 'The magnetic field component =',Hr,'e^j(0.866x-0.5z) mA/m'\n", + "print 'The time average power in the wave =',Pr,'W/m^2'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "w = 300000000.0 rad/sec\n", + "lambda = 6.283 m\n", + "The magnetic field component = [ 0. 1.33 -2.3 ] e^j(0.866x-0.5z) mA/m\n", + "The time average power in the wave = [ 0. 11.49 6.631] W/m^2\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.11, Page number: 459" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "ax=array([1,0,0]) #Unit vector along x direction\n", + "ay=array([0,1,0]) #Unit vector along y direction\n", + "az=array([0,0,1]) #Unit vector along z direction\n", + "Ei=8 #incident wave amplitude\n", + "k=5 #propogation constant\n", + "Eo=10**-9/36*scipy.pi #permittivity of free space\n", + "Erel=2.5 #relative permittivity\n", + "muo=4*scipy.pi*10**-7 #permeability of free space\n", + "mur=1 #relative permeability\n", + "c=3*10**8 #speed of light\n", + "etao=377\n", + "\n", + "#Calculations\n", + "\n", + "w=k*c #frequency in rad\n", + "theta=scipy.arctan(4/3.0) #angle of incidence in rad\n", + "eta1=etao\n", + "eta2=377/scipy.sqrt(2.5)\n", + "thetai=scipy.arcsin(sin(theta)/scipy.sqrt(2.5))\n", + "gamm=(eta2*cos(theta)-eta1*cos(thetai))/(eta2*cos(theta)+eta1*cos(thetai))\n", + "Er=Ei*gamm #reflected E field amplitude in V/m\n", + "kt=w*scipy.sqrt(mur*Erel)/c\n", + "tao=2*eta2*cos(theta)/((eta2*cos(theta)+eta1*cos(thetai)))\n", + "Et=tao*Ei*ay\n", + "Ht=cross((4*ax+6.819*az)/(eta2*kt),Et)*10**3\n", + "Htx=round(dot(Ht,ax),2)\n", + "Hty=round(dot(Ht,ay),2)\n", + "Htz=round(dot(Ht,az),2)\n", + "Htc=array([Htx,Hty,Htz]) #transmitted H field amplitude\n", + "\n", + "#Results\n", + "\n", + "print 'Polarisation is perpendicular polarization'\n", + "print 'Angle of incidence is ',round(180*theta/scipy.pi,2),'degrees'\n", + "print 'Er =',round(Er,3),'cos(',w,'t - 4x + 3z) V/m'\n", + "print 'Ht =',Htc,'cos(',w,'t - 4x - 6.819z) mA/m'\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Polarisation is perpendicular polarization\n", + "Angle of incidence is 53.13 degrees\n", + "Er = -3.112 cos( 1500000000 t - 4x + 3z) V/m\n", + "Ht = [-17.68 0. 10.37] cos( 1500000000 t - 4x - 6.819z) mA/m\n" + ] + } + ], + "prompt_number": 25 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_11-checkpoint.ipynb b/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_11-checkpoint.ipynb new file mode 100644 index 00000000..dede4d2e --- /dev/null +++ b/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_11-checkpoint.ipynb @@ -0,0 +1,613 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:b3709cc764fd68911c53d14fdc3847f8e66fbdd5fcd89885b01f065610802430" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 11: Transmission Lines

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.1, Page number: 482

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "R=0\n", + "G=0\n", + "a=0\n", + "Ro=70 #characteristic impedence in ohms\n", + "B=3 #phase constant in rad/sec\n", + "f=100*10**6 #frequency in Hz\n", + "w=2*scipy.pi*f #omega in rad/sec\n", + "\n", + "#Calculations\n", + "\n", + "C=B/(w*Ro) #capacitance in F/m\n", + "L=Ro*Ro*C #inductance in H/m\n", + "\n", + "#Results\n", + "\n", + "print 'inductance per meter =',round(L*10**9,1),'nH/m'\n", + "print 'capacitance per meter =',round(C*10**12,1),'pF/m'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "inductance per meter = 334.2 nH/m\n", + "capacitance per meter = 68.2 pF/m\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.2, Page number: 483

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#Variable Declaration\n", + "\n", + "Zo=60 #in ohms\n", + "a=20*10**-3 #in Np/m\n", + "u=0.6*3*10**8 #in m/sec\n", + "f=100*10**6 #in Hz\n", + "\n", + "#Calculations\n", + "\n", + "R=a*Zo #resistance in ohms/m\n", + "L=Zo/u #inductance in H/m\n", + "G=a*a/R #conductivity in S/m\n", + "C=1/(u*Zo) #capacitance in F/m\n", + "lam=u/f #wavelentgh in m\n", + "\n", + "#Results\n", + "\n", + "print 'R =',R,'ohm/m'\n", + "print 'L =',round(L*10**9,0),'nH/m'\n", + "print 'G =',round(G*10**6,0),'micro S/m'\n", + "print 'C =',round(C*10**12,2),'pF/m'\n", + "print 'lambda =',lam,'m'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "R = 1.2 ohm/m\n", + "L = 333.0 nH/m\n", + "G = 333.0 micro S/m\n", + "C = 92.59 pF/m\n", + "lambda = 1.8 m\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.3, Page number: 490

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "import cmath\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "w=10**6 #omega in rad/sec\n", + "B=1 #phase factor in rad/m\n", + "a=8.0/8.686 #alpha in Np/m\n", + "Y=a+1j #in m^-1\n", + "l=2 #length in m\n", + "Vg=10 #source voltage in volts\n", + "Zo=60+40j #in ohms\n", + "Zg=40 #in ohms\n", + "Zl=20+50j #load impedance in ohms\n", + "\n", + "#Calculations\n", + "\n", + "s=scipy.tanh(Y*l)\n", + "Zin=Zo*(Zl+Zo*s)/(Zo+Zl*s) #input impedance in ohms\n", + "Zinr=round(Zin.real,2) #real part of Zin rounded to 2 decimal places\n", + "Zini=round(Zin.imag,2) #imaginary part of Zin rounded to 2 decimal places\n", + "Io=Vg/(Zin+Zg) #in A\n", + "absIo=round(abs(Io),6) #absolute value of Io rounded to 6 decimal place\n", + "Ior=Io.real #real part of Io\n", + "Ioi=Io.imag #imaginary part of Io\n", + "angIo=scipy.arctan(Ioi/Ior)*180/scipy.pi \n", + " #in degrees\n", + "Vo=Zin*Io\n", + "Vop=(Vo+Zo*Io)/2\n", + "Vom =(Vo-Zo*Io)/2\n", + "Im=((Vop*scipy.e**(-Y)/Zo))-((Vom*scipy.e**Y)/Zo)\n", + " #current at the middle in A\n", + "absIm=round(abs(Im),5) #absolute value of Im rounded to 6 decimal place\n", + "Imr=Im.real #real part of Im \n", + "Imi=Im.imag #imaginary part of Im\n", + "angIm=360+scipy.arctan(Imi/Imr)*180/scipy.pi \n", + " #in degrees\n", + "\n", + "#Results\n", + "\n", + "print 'The input impedance =',Zinr,'+',Zini,'j ohms'\n", + "print 'The sending-end current is'\n", + "print 'mod =',absIo*10**3,'mA, angle =',round(angIo,2),'degrees'\n", + "print 'The current at the middle is'\n", + "print 'mod =',absIm*10**3,'mA, angle =',round(angIm,0),'degrees'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The input impedance = 60.25 + 38.79 j ohms\n", + "The sending-end current is\n", + "mod = 93.03 mA, angle = -21.15 degrees\n", + "The current at the middle is\n", + "mod = 34.92 mA, angle = 281.0 degrees\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.4, Page number: 499

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "import cmath\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "l=30 #length in m\n", + "Zo=50 #in ohms\n", + "f=2*10**6 #frequency in Hz\n", + "Zl=60+40j #load impedence in ohms\n", + "u=0.6*3*10**8 #in m/s\n", + "w=2*scipy.pi*f #omega in rad/sec\n", + "\n", + "#Calculations\n", + "\n", + "T=(Zl-Zo)/(Zl+Zo) #reflection coefficient\n", + "ang=scipy.arctan(T.imag/T.real)*180/scipy.pi #argument of T is degrees\n", + "s=(1+abs(T))/(1-abs(T)) #standing wave ratio \n", + "B=w/u #propogation vector in m^-1\n", + "Zin=Zo*(Zl+Zo*scipy.tan(B*l)*1j)/(Zo+Zl*scipy.tan(B*l)*1j)\n", + "Zinr=round(Zin.real,2) #real part of Zin rounded to 2 decimal places\n", + "Zini=round(Zin.imag,2) #imaginary part of Zin rounded to 2 decimal places\n", + "\n", + "#Results\n", + "\n", + "print 'The reflection coefficient is'\n", + "print 'mod =',round(abs(T),4),'angle =',round(ang,0),'degrees'\n", + "print 'The standing wave ratio s =',round(s,3)\n", + "print 'The input impedance =',Zinr,'+',Zini,'j ohms'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The reflection coefficient is\n", + "mod = 0.3523 angle = 56.0 degrees\n", + "The standing wave ratio s = 2.088\n", + "The input impedance = 23.97 + 1.35 j ohms\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.5, Page number: 501

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "import scipy\n", + "import cmath\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "Zl=100+150j #load impedance in ohms\n", + "Zo=75 #impedance of line in ohms\n", + "B=2*scipy.pi \n", + "\n", + "#Calculations\n", + "\n", + "T=(Zl-Zo)/(Zl+Zo)\n", + "angT=scipy.arctan(T.imag/T.real)*180/scipy.pi \n", + "s=(1+abs(T))/(1-abs(T))\n", + "Yl=(1/Zl)*10**3 #admittance in mS\n", + "Ylr=round(Yl.real,2) #real part of Yl rounded to 2 decimal places\n", + "Yli=round(Yl.imag,2) #imaginary part of Yl rounded to 2 decimal places\n", + "l1=0.4\n", + "Zin=Zo*(Zl+Zo*scipy.tan(B*l1)*1j)/(Zo+Zl*scipy.tan(B*l1)*1j)\n", + "Zinr=round(Zin.real,2) #real part of Zin rounded to 2 decimal places\n", + "Zini=round(Zin.imag,2) #imaginary part of Zin rounded to 2 decimal places\n", + "\n", + "\n", + "#Results\n", + "\n", + "print 'r is mod =',round(abs(T),3),',angle =',round(angT,0),'degrees'\n", + "print 's =',round(s,2)\n", + "print 'The load admittance Yl =',Ylr,'+',Yli,'j mS'\n", + "print 'Zin at O.4 lambda from the load =',Zinr,'+',Zini,'j ohms'\n", + "#part (e) and (f) don't require computations" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "r is mod = 0.66 ,angle = 40.0 degrees\n", + "s = 4.88\n", + "The load admittance Yl = 3.08 + -4.62 j mS\n", + "Zin at O.4 lambda from the load = 21.96 + 47.61 j ohms\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.6, Page number: 509

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "import cmath\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "s=2\n", + "l1=11 \n", + "l2=19\n", + "ma=24 \n", + "mi=16\n", + "u=3*10**8 #speed of wave in m/s\n", + "Zo=50 #in ohms\n", + "\n", + "#Calculations\n", + "\n", + "l=(l2-l1)*2 #lambda in cm\n", + "f=(u/l)*10**-7 #frequency in GHz\n", + "L=(24-19)/l #Let us assume load is at 24cm\n", + "zl=1.4+0.75j # by smith chart\n", + "Zl=Zo*zl #ZL in ohms\n", + "\n", + "#Results\n", + "\n", + "print 'lambda =',l,'cm'\n", + "print 'f =',f,'GHz'\n", + "print 'ZL =',Zl,'ohms'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "lambda = 16 cm\n", + "f = 1.875 GHz\n", + "ZL = (70+37.5j) ohms\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.7, Page number: 510

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "import cmath\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "Zo=100 #in ohms\n", + "Zl=40+30j #in ohms\n", + "\n", + "#Calculations\n", + "\n", + "Yo=1.0/Zo #in S\n", + "yl=Zo/Zl\n", + "ys1=1.04j #By smith chart\n", + "ys2=-1.04j #By smith chart\n", + "Ys1=Yo*ys1 #in S\n", + "Ys2=Yo*ys2 #in S\n", + "la=round(0.5-(62-(-39))/720.0,2) #in units of lambda\n", + "lb=round((62-39)/720.0,3) #in units of lambda\n", + "da=round(88/720.0,4) #in units of lambda\n", + "db=round(272/720.0,4) #in units of lambda\n", + "\n", + "#Results\n", + "\n", + "print 'The required stub admittance values in mS are',Ys1*1000,'and',Ys2*1000\n", + "print 'The distance between stub and antenna at A =',la,'in units of lambda'\n", + "print 'The distance between stub and antenna at B =',lb,'in units of lambda'\n", + "print 'The stub lengths =',da,'and',db,'in units of lambda'\n", + "print 'Part (d) is done using smith chart'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The required stub admittance values in mS are 10.4j and -10.4j\n", + "The distance between stub and antenna at A = 0.36 in units of lambda\n", + "The distance between stub and antenna at B = 0.032 in units of lambda\n", + "The stub lengths = 0.1222 and 0.3778 in units of lambda\n", + "Part (d) is done using smith chart\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.9, Page number: 521" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "import matplotlib.pyplot as plt\n", + "\n", + "#Variable Declarataion\n", + "\n", + "zo=75 #in ohms\n", + "zg=25 #in ohms\n", + "zl=100 #in ohms\n", + "vg=4 #in volts\n", + "l=60 #in m\n", + "c=3*10**8 #speed of light in m/s\n", + "u=0.1*c #in m/s\n", + "\n", + "#Calculations\n", + "\n", + "gammag=(zg-zo)/(zg+zo)\n", + "gammal=(zl-zo)/(zl+zo)\n", + "Vo=zo*vg/(zo+zg) #in V\n", + "t1=l/u #in micro sec\n", + "Io=vg/(zo+zg) #in mA\n", + "\n", + "#Results\n", + "\n", + "t1=[0,4,5,8,9,12,13,15]\n", + "I1=[40,31.43,-8.571,-7.959,0.6123,0.5685,-0.0438,-0.438]\n", + "fig = plt.figure()\n", + "ax = fig.add_subplot(111)\n", + "ax.step(t1,I1,where='post')\n", + "ax.set_xlabel('Time (micro s)')\n", + "ax.set_ylabel(r'I(0,t) in mA')\n", + "plt.show()\n", + "\n", + "t2=[0,2,6,7,10,11,14]\n", + "I2=[0,34.3,31.9,-2.46,-2.28,0.176,0.176]\n", + "fig = plt.figure()\n", + "ax = fig.add_subplot(111)\n", + "ax.step(t2,I2,where='post')\n", + "ax.set_xlabel('Time (micro s)')\n", + "ax.set_ylabel(r'I(l,t) in mA')\n", + "plt.show()\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEMCAYAAADeYiHoAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAGzFJREFUeJzt3X1wVNXhxvFn0SZgQUQtIMaQFCibgJAFQhIYwqqAVYxh\nFEaiQEdCRaryoradsdRGfzO0Gq1CLQlVY0dRUaqOjIIg6vJSQjaY2CImApUIqMibms0kwRDP7w+G\nLSEnDeTt3pDvZ2ZnsjfZex83sk/OuWfveowxRgAAnKaT0wEAAO5EQQAArCgIAIAVBQEAsKIgAABW\nFAQAwMrRgqitrZXP51NaWpokKRQKKT09XdHR0Zo0aZIqKiqcjAcAHZqjBbF48WLFx8fL4/FIknJy\nchQdHa1du3YpKipKubm5TsYDgA7NsYLYv3+/Vq9erVmzZunke/WCwaAyMzMVGRmpmTNnqqCgwKl4\nANDhne/UgRcsWKDs7GyVl5eHtxUWFsrr9UqSvF6vgsFgvcedHG0AAM7O2V44w5ERxFtvvaWePXvK\n5/PVCXym4Y0xrr/94Q9/cDzDmdyk9pGzvTyf5Ox4OdtDRmOadkUlR0YQW7Zs0apVq7R69WpVV1er\nvLxc06dPV2JiokpKSuTz+VRSUqLExEQn4gEA5NAIYtGiRdq3b5/27NmjFStW6Oqrr9YLL7ygpKQk\n5eXlqaqqSnl5eUpOTnYiHgBALnkfxMnzCnPmzNHevXs1cOBAffHFF7rzzjsdTtZ0fr/f6QhnyO90\ngDPSXp5Pcras9pCzPWRsKo9p6uSUQzweT5Pn01CfxyPxdALnvqa8drpiBAEAcB8KAgBgRUEAAKwo\nCACAFQ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rr1VU\nVKT/+7//08iRI1VYWKhevXopPj5es2fPlsfjCf81X1ZWpj/96U9avXq1+vTpo2+//Ta8nz179mjL\nli2KiIjQ8OHDtXTpUg0ZMkQZGRmKj4/XddddVyfLww8/rKKiIl1wwQUqLy8Pb4+Li1NRUZGr380N\n92MEgQ7B4/HoxhtvVLdu3ZSSkqJjx45p6tSp8ng8SkpKUn5+vg4dOqRNmzbpxhtvlM/nU25urv75\nz3/W29fu3bsVExNTZ1tGRoY6deqklJQUDRo0SP369VPXrl11xRVX1Ltq5sqVKzV16lT16dNHknTR\nRReFv3frrbcqIiJCX375pWpqapSUlKQuXbrotttu06pVq+plGTFihDIyMvSPf/yjzgUh+/Xrp08/\n/bQ5TxnACAIdx8nreUVERCgyMlKRkZHh+99//71qa2t1ySWXqLi4uNF9nX7q7uSLfERERJ0X/IiI\nCB07dqzRx590sjRO/35DP798+XJt2bJFy5cvV3Z2dvhzHX744QfOP6DZGEGgQ2hsLYYxRr1791Zs\nbKxee+01GWNUU1NjvWb+gAEDVFZW1uQskydP1ooVK/TFF19Ikr755pt6OS+//HJFRkYqGAyqqqpK\nK1asqHdVYGOMysrKNGrUKP35z3/WV199FS6jzz77TAMHDmxyRkCiIHAOOvmX86nz/qd+ferPnH5/\n6dKl+uCDD8InnPPz8+vtPyEhoc6l50/fT0N/uZ/cHhsbqwceeEDTpk1TQkKCHn/8cWuu3NxcZWdn\nKzU1VaNHj653Fdva2lpNnz5dQ4YM0TXXXKOsrKzwqKi0tFQ+n8+aAzhTLHMFmiAlJUVr167VhRde\n6HSUeo4dO6ZRo0Zp27ZtTDOhWRhBAE3wy1/+Ui+++KLTMazefPNNZWRkUA5oNkYQAAArRhAAACsK\nAgBgRUEAAKwoCACAFQUBALCiIAAAVv8PIrVuLX2NSRcAAAAASUVORK5CYII=\n", + "text": [ + "" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEMCAYAAADJQLEhAAAABHNCS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UceeUR33323oqOjtXz58hZzrVmzRtnZ2UpISNC0adMumS21sbFR99xzjyZNmqQf//jHysrK\natrK2b9/vxwOR4s5gM7g9FGgFfHx8dqyZYsGDBhgdJRL1NfXa+rUqSoqKmL3ELqNLQKgFffdd59e\ne+01o2O0aMOGDUpJSaEEcFmwRQAAFscWAQBYHEUAABZHEQCAxVEEAGBxFAEAWBxFAAAW9/8AjjI6\n8BSLXDoAAAAASUVORK5CYII=\n", + "text": [ + "" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.10, Page number: 527

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "Er=3.8 #relative permittivity\n", + "c=3*10**8 #speed of wave in m/s\n", + "r=4.5 #ratio of line width to substrate thickness\n", + "\n", + "#Calculations\n", + "\n", + "Eeff=((Er+1)/2)+((Er-1)/(2*(1+12/r)**0.5))\n", + "Zo=(120*scipy.pi)/((r+1.393+(0.667*scipy.log(r+1.444)))*((Eeff)**0.5))\n", + "f=10**10\n", + "l=c/(f*scipy.sqrt(Eeff))\n", + "\n", + "#Results\n", + "\n", + "print 'The effective relative permittivity of the substrate =',round(Eeff,3)\n", + "print 'The characteristic impedance of the line =',round(Zo,2),'ohms'\n", + "print 'The wavelength of the line at 10 GHz =',round(l*1000,2),'mm'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The effective relative permittivity of the substrate = 3.131\n", + "The characteristic impedance of the line = 30.08 ohms\n", + "The wavelength of the line at 10 GHz = 16.95 mm\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.11, Page number: 527

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "h=1 #in mm\n", + "w=0.8 #in mm\n", + "Er=6.6 #relative permittivity\n", + "P=scipy.arctan(0.0001) \n", + "c=5.8*10**7 #conductivity in S/m\n", + "f=10**10 #frequency in Hz\n", + "mu=4*scipy.pi*10**-7 #permeability of free space\n", + "C=3*10**8 #speed of wave in m/s\n", + "r=w/h\n", + "\n", + "#Calculations\n", + "\n", + "Ee=((Er+1)/2.0)+((Er-1)/(2.0*(1+12/r)**0.5))\n", + "Zo=(120.0*scipy.pi)/((r+1.393+(0.667*scipy.log(r+1.444)))*((Ee)**0.5))\n", + "Rs=scipy.sqrt((scipy.pi*f*mu)/c)\n", + "ac=8.686*Rs/(w*(10**-3)*Zo)\n", + "l=C/(f*(Ee)**0.5)\n", + "ad=27.3*(Ee-1)*Er*scipy.tan(P)/((Er-1)*Ee*l)\n", + "\n", + "#Results\n", + "\n", + "print 'attenuation due to conduction loss =',round(ac,2),'dB/m'\n", + "print 'attenuation due to dielectric loss =',round(ad,3),'dB/m'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "attenuation due to conduction loss = 4.35 dB/m\n", + "attenuation due to dielectric loss = 0.177 dB/m\n" + ] + } + ], + "prompt_number": 9 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_12-checkpoint.ipynb b/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_12-checkpoint.ipynb new file mode 100644 index 00000000..e098f292 --- /dev/null +++ b/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_12-checkpoint.ipynb @@ -0,0 +1,419 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:7e2f43e6e0f517c2aac74f69be1d132b3ab84b5c247c20e556eb69dbe9aedae5" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 12: Waveguides

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.1, Page number: 557

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + " \n", + "\n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "a=2.5*10**-2 #in m\n", + "b=1*10**-2 #in m\n", + "c=0\n", + "Ur=1 #relative permeability\n", + "Er=4 #relative permittivity\n", + "C=3*10**8 #speed of wave in m/s\n", + "fc=0\n", + "m=0\n", + "n=0\n", + "\n", + "#Calculations\n", + "\n", + "while (fc*10**-9 < 15.1) :\n", + " fc = (C/(4*a))*scipy.sqrt(m**2+(a*n/b)**2)\n", + " if (( fc*10**-9) < 15.1) :\n", + " n=n+1\n", + " else:\n", + " print 'Maximum value of n is ',n-1\n", + "\n", + "nmax=n-1 \n", + "fc=0\n", + "m=0\n", + "n=0\n", + "while(fc*10**-9 < 15.1):\n", + " fc =(C/(4*a))*scipy.sqrt(m**2+(a*n/b)**2)\n", + " if((fc*10**-9) < 15.1):\n", + " m=m+1\n", + " else:\n", + " print 'Maximum value of m is ',m-1 \n", + "\n", + "mmax=m-1\n", + "m=0\n", + "while(mExample 12.3, Page number: 561

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "import cmath\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "a=1.5*10**-2 #in m\n", + "b=0.8*10**-2 #in m\n", + "c=0\n", + "Uo=4*scipy.pi*10**-7 #permeability of free space\n", + "Ur=1 #relative permeability\n", + "Eo=10**-9/(36*scipy.pi) #permittivity of free space\n", + "Er=4 #relative permittivity\n", + "C=3*10**8 #speed of light in m/s\n", + "w=scipy.pi*10**11 #omega in rad/s\n", + "m=1\n", + "n=3\n", + "u=C/2 #speed of wave in m/s\n", + "\n", + "#Calculations\n", + "\n", + "f=w/(2*scipy.pi) #frequency of wave in Hz\n", + "fc=u*((m*m)/(a*a)+(n*n)/(b*b))**0.5/2 #cutoff frequency in Hz\n", + "B=w*scipy.sqrt(1-(fc/f)**2)/u #phase constant in rad/m\n", + "eta=377/scipy.sqrt(Er)*scipy.sqrt(1-(fc/f)**2) #intrinsic wave impedance in ohm\n", + "\n", + "#Results\n", + "\n", + "print 'The cutoff frequency =',round(fc*10**-9,2),'GHz'\n", + "print 'The phase constant =',round(B,2),'rad/m'\n", + "print 'The propagation constant =',round(B,2),'j /m'\n", + "print 'The intrinsic wave impedance =',round(eta,1),'ohms'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The cutoff frequency = 28.57 GHz\n", + "The phase constant = 1718.93 rad/m\n", + "The propagation constant = 1718.93 j /m\n", + "The intrinsic wave impedance = 154.7 ohms\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.4, Page number: 565

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "a=8.636*10**-2 #in m\n", + "b=4.318*10**-2 #in m\n", + "f=4*10**9 #in Hz\n", + "u=3*10**8 #speed of wave in m/s\n", + "\n", + "#Calculations\n", + "\n", + "fc=u/(2*a)\n", + "if(f>fc):\n", + " print 'As f>fc, TE10 mode will propogate'\n", + "else:\n", + " print 'It will not propogate'\n", + "\n", + "Up=u/scipy.sqrt(1-(fc/f)**2) #phase velocity in m/s\n", + "Ug=u*u/Up #group velocity in m/s\n", + "\n", + "#Results\n", + "\n", + "print 'Phase velocity =',round(Up*10**-6,0),'Mm/s'\n", + "print 'Group velocity =',round(Ug*10**-6,1),'Mm/s'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "As f>fc, TE10 mode will propogate\n", + "Phase velocity = 333.0 Mm/s\n", + "Group velocity = 270.2 Mm/s\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.5, Page number: 570

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "f=10*10**9 #frequency of operation in Hz\n", + "a=4*10**-2 #in m\n", + "b=2*10**-2 #in m\n", + "u=3*10**8 #velocity in m/s\n", + "Pavg=2*10**-3 #average power in W\n", + "\n", + "#Calculations\n", + "\n", + "fc=u/(2*a) #cutoff frequency in Hz\n", + "n=377/scipy.sqrt(1-(fc/f)**2) #intrinsic wave impedance in ohms\n", + "E=scipy.sqrt(4*n*Pavg/(a*b)) #peak value of electric field in V/m\n", + "\n", + "#Result\n", + "\n", + "print 'Peak value of electric field =',round(E,2),'V/m'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Peak value of electric field = 63.77 V/m\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.6, Page number: 571

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "import scipy\n", + "\n", + "#Variable declaration\n", + "\n", + "cc=5.8*10**7 #in S/m\n", + "f=4.8*10**9 #in Hz\n", + "c=10**-17 #in S/m\n", + "Uo=4*scipy.pi*10**-7 #permeability of free space\n", + "Eo=10**-9/(36*scipy.pi) #permittivity of free space\n", + "Er=2.55 #relative permittivity\n", + "z=60*10**-2 #in m\n", + "l=4.2*10**-2 #in m\n", + "b=2.6*10**-2 #in m\n", + "P=1.2*10**3 #in W\n", + "\n", + "#Calculations\n", + "\n", + "n=377/scipy.sqrt(Er)\n", + "u=3*10**8/scipy.sqrt(Er)\n", + "fc=u/(2*l)\n", + "ad=c*n/(2*scipy.sqrt(1-(fc/f)**2))\n", + "Rs=scipy.sqrt(scipy.pi*f*Uo/cc)\n", + "ac=2*Rs*(0.5+(b/l)*(fc/f)**2)/(b*n*scipy.sqrt(1-(fc/f)**2))\n", + "a=ac\n", + "Pd=P*(scipy.e**(2*a*z)-1)\n", + "\n", + "#Result\n", + "\n", + "print 'power dissipated =',round(Pd,3),'W'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "power dissipated = 6.096 W\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.8, Page number: 579

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + " \n", + "a=5*10**-2 #in m\n", + "b=4*10**-2 #in m\n", + "c=10*10**-2 #in m\n", + "C=5.8*10**7 #in mhos/m\n", + "Uo=4*scipy.pi*10**-7 #permeability of free space\n", + "u=3*10**8 #speed of wave in m/s\n", + "\n", + "#Calculations\n", + "\n", + "def f(m,n,p):\n", + " fr=scipy.sqrt((m/a)**2+(n/b)**2+(p/c)**2)*u/2 #resonant frequency in Hz\n", + " print round(fr*10**-9,3)\n", + " \n", + "\n", + "f101=3.35*10**9\n", + "d=scipy.sqrt(1/(scipy.pi*f101*Uo*C))\n", + "Q=(a*a+c*c)*a*b*c/(d*(2*b*(a**3+c**3)+a*c*(a*a+c*c))) #quality factor\n", + "\n", + "#Results\n", + "\n", + "print 'Thus the five lowest order modes in ascending order are '\n", + "print 'TE101, frequency in GHz ='\n", + "f(1,0,1)\n", + "print 'TE011, frequency in GHz ='\n", + "f(0,1,1)\n", + "print 'TE102, frequency in GHz ='\n", + "f(1,0,2)\n", + "print 'TE110, frequency in GHz ='\n", + "f(1,1,0)\n", + "print 'TE111 or TM111, frequency in GHz ='\n", + "f(1,1,1)\n", + "print 'Quality factor =',round(Q,0)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus the five lowest order modes in ascending order are \n", + "TE101, frequency in GHz =\n", + "3.354\n", + "TE011, frequency in GHz =\n", + "4.039\n", + "TE102, frequency in GHz =\n", + "4.243\n", + "TE110, frequency in GHz =\n", + "4.802\n", + "TE111 or TM111, frequency in GHz =\n", + "5.031\n", + "Quality factor = 14358.0\n" + ] + } + ], + "prompt_number": 6 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_13-checkpoint.ipynb b/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_13-checkpoint.ipynb new file mode 100644 index 00000000..8e4967c6 --- /dev/null +++ b/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_13-checkpoint.ipynb @@ -0,0 +1,390 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:5168da214feed4bdafc5432918593870d207c98c8ad5626a85639886ab07fdcb" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 13: Antennas

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 13.1, Page number: 601

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "H=5*10**-6 #magnetic field strentgh in A/m\n", + "theta=scipy.pi/2 \n", + "r=2*10**3 #distance in m\n", + "Bdl=2*scipy.pi/25\n", + "N=10 #number of turns\n", + "\n", + "#Calculations\n", + "\n", + "Ia=4*scipy.pi*r*H/(Bdl*scipy.sin(theta)) #current for part (a) in A\n", + "Pa=40*scipy.pi**2*(1/25.0)**2*Ia**2 #power for part (a) in W\n", + "def pow(Io,Rrad):\n", + " P=0.5*Io**2*Rrad\n", + " print round(P*10**3,0),'mW'\n", + "\n", + "denom=scipy.cos(scipy.pi*scipy.cos(theta)/2) \n", + "Ib=H*2*scipy.pi*r*scipy.sin(theta)/denom #current for part (b) in A\n", + "Rradb=73 #wave impedance in ohms for (b)\n", + "Ic=Ib #current for part (c) in A\n", + "Rradc=36.56 #wave impedance in ohms for (c)\n", + "Id=H*r*400/(10*scipy.pi**2) #current for part (d) in A\n", + "Rradd=320*scipy.pi**6*N**2/20**4 #wave impedance in ohms for (d)\n", + "\n", + "#Results\n", + "\n", + "print 'The power transmitted in mW if antenna is ;'\n", + "print '(a) A Hertzian dipole of length lambda/25 =','\\n',round(Pa*10**3,0),'mW'\n", + "print '(b) A half-wave dipole ='\n", + "pow(Ib,Rradb)\n", + "print '(c) A quarter-wave monopole ='\n", + "pow(Ic,Rradc)\n", + "print '(d) A 10-turn loop antenna of radius Po = lambda/20 ='\n", + "pow(Id,Rradd)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The power transmitted in mW if antenna is ;\n", + "(a) A Hertzian dipole of length lambda/25 = \n", + "158.0 mW\n", + "(b) A half-wave dipole =\n", + "144.0 mW\n", + "(c) A quarter-wave monopole =\n", + "72.0 mW\n", + "(d) A 10-turn loop antenna of radius Po = lambda/20 =\n", + "158.0 mW\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 13.2, Page number: 603

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import scipy\n", + "import cmath\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "c=3*10**8 #speed of wave in m/s\n", + "f=50*10**6 #frequency in Hz\n", + "E=10*10**-6 #field strength in V/m\n", + "theta=scipy.pi/2\n", + "r=500*10**3 #distance in m\n", + "eta=120*scipy.pi #wave impedance in ohms\n", + "Rrad=73 #in ohms\n", + "Zo=75 #in ohms\n", + "Zl=73+42.5j\n", + "\n", + "#Calculations\n", + "\n", + "l=c/(2*f)\n", + "I=E*2*r*scipy.pi*sin(theta)/(eta*(cos((scipy.pi/2)*cos(theta))))\n", + "P=0.5*I**2*Rrad\n", + "T=(Zl-Zo)/(Zl+Zo)\n", + "s=(1+abs(T))/(1-abs(T))\n", + "\n", + "#Results\n", + "\n", + "print 'The length of the dipole =',l,'m'\n", + "print 'The current that must be fed to the antenna =',round(I*10**3,2),'mA'\n", + "print 'The average power radiated by the antenna =',round(P*10**3,1),'mW'\n", + "print 'The standing wave ratio =',round(s,4)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The length of the dipole = 3 m\n", + "The current that must be fed to the antenna = 83.33 mA\n", + "The average power radiated by the antenna = 253.5 mW\n", + "The standing wave ratio = 1.7636\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 13.4, Page number: 610

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "G=5\n", + "r=10*10**3 #in m\n", + "P=20*10**3 #power in W\n", + "n=120*scipy.pi #wave impedance in ohms\n", + "\n", + "#Calculations\n", + "\n", + "Gd=10**(G/10.0)\n", + "E=scipy.sqrt(n*Gd*P/(2*scipy.pi*r*r)) #field intensity in V/m\n", + "\n", + "#Result\n", + "\n", + "print 'electric field intensity =',round(E,4),'V/m'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "electric field intensity = 0.1948 V/m\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 13.5, Page number: 611

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "import scipy.integrate\n", + "\n", + "#Variable Declaration\n", + "\n", + "Umax=2.0\n", + "\n", + "def U(phi,theta):\n", + " s=2*scipy.sin(theta)*(scipy.sin(phi))**3/(4.0*scipy.pi)\n", + " return s\n", + " \n", + "#Calculations\n", + "\n", + "if __name__ == '__main__':\n", + " \n", + " Uav,er=scipy.integrate.dblquad(lambda theta,phi:U(phi,theta)*scipy.sin(theta), \n", + " 0, scipy.pi, lambda theta: 0, lambda theta: scipy.pi)\n", + "\n", + "D=Umax/Uav #Directivity\n", + "\n", + "#Result\n", + "\n", + "print 'directivity of the antenna =',D" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "directivity of the antenna = 6.0\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 13.8, Page number: 624

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "c=3*10**8 #speed of wave in m/s\n", + "f=30*10**6 #frequency in Hz\n", + "E=2*10**-3 #field strength in V/m\n", + "n=120*scipy.pi\n", + "R=73 \n", + "\n", + "#Calculations\n", + "\n", + "l=c/f #wavelength in m\n", + "Gdmax=round(n/(scipy.pi*R),2) \n", + "Amax=(l**2/(4*scipy.pi))*Gdmax #maximum effective area in m^2\n", + "Pr=(E*E*Amax)/(2*n) #power received in W\n", + "\n", + "#Results\n", + "\n", + "print 'maximum effective area =',round(Amax,2),'m^2'\n", + "print 'power received =',round(Pr*10**9,2),'nW'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "maximum effective area = 13.05 m^2\n", + "power received = 69.24 nW\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 13.9, Page number: 624

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "Gt=25 #in dB\n", + "Gr=18 #in dB\n", + "r=200 #in units of lambda\n", + "Pr=5*10**-3 #power received in W\n", + "\n", + "#Calculations\n", + "\n", + "Gdt=10**(Gt/10.0) \n", + "Gdr=10**(Gr/10.0)\n", + "Pt=Pr*(4*scipy.pi*r)**2/(Gdr*Gdt)\n", + "\n", + "#Result\n", + "\n", + "print 'minimum transmitted power =',round(Pt,3),'W'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "minimum transmitted power = 1.583 W\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 13.10, Page number: 627

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "c=3*(10)**8 #speed of wave in m/s\n", + "f=3.0*(10)**9 #frequency in Hz\n", + "Aet=9 #effective area in m^2\n", + "r1=1.852*(10)**5 #distance in m\n", + "r2=4*r1 #distance in m\n", + "r3=5.556*10**5 #distance in m\n", + "Pr=200*(10)**3 #in W\n", + "a=20 #target area in m^2\n", + "\n", + "#Calculations\n", + "\n", + "l=c/f #wavelength in m\n", + "Gdt=4*scipy.pi*Aet/(l*l)\n", + "P1=Gdt*Pr/(4*scipy.pi*r1*r1) #power at 100 nmiles in W/m^2\n", + "P2=Gdt*Pr/(4*scipy.pi*r2*r2) #power at 400 nmiles in W/m^2\n", + "Pr=Aet*a*Gdt*Pr/(4*scipy.pi*r3*r3)**2 #power of reflected signal in W\n", + "\n", + "#Results\n", + "\n", + "print 'Signal power density at 100 nautical miles =',round(P1*1000,3),'mW/m^2'\n", + "print 'Signal power density at 400 nautical miles =',round(P2*1000,3),'mW/m^2'\n", + "print 'Power of reflected signal =',round(Pr*10**12,5),'pico W'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Signal power density at 100 nautical miles = 5.248 mW/m^2\n", + "Signal power density at 400 nautical miles = 0.328 mW/m^2\n", + "Power of reflected signal = 0.02706 pico W\n" + ] + } + ], + "prompt_number": 8 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_14-checkpoint.ipynb b/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_14-checkpoint.ipynb new file mode 100644 index 00000000..fcb4fac5 --- /dev/null +++ b/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_14-checkpoint.ipynb @@ -0,0 +1,160 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:8b3ccd88c7aadd311b6269c4809d3b632a222a912e8231c54428ad90a16f0d12" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 14: Modern Topics

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.1, Page number: 643

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "import cmath\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "S11=0.85*scipy.e**(-30j*scipy.pi/180)\n", + "S12=0.07*scipy.e**(56j*scipy.pi/180)\n", + "S21=1.68*scipy.e**(120j*scipy.pi/180)\n", + "S22=0.85*scipy.e**(-40j*scipy.pi/180)\n", + "Zl=75 \n", + "Zo=75\n", + "\n", + "#Calculations\n", + "\n", + "Tl=(Zl-Zo)/(Zl+Zo)\n", + "Ti=S11+(S12*S21*Tl)/(1-S22*Tl) #reflection coefficient\n", + "Timod=abs(Ti) #mod of Ti\n", + "Tiang=scipy.arctan(Ti.imag/Ti.real)*180/scipy.pi #argument of Ti in degrees\n", + "\n", + "#Results\n", + "\n", + "print 'input reflection coefficient =',Timod,'/',Tiang,'degrees'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "input reflection coefficient = 0.85 / -30.0 degrees\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.2, Page number: 654

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "d=80*(10)**-6 #diameter in m\n", + "n1=1.62 #core refractive index\n", + "NA=0.21 #numerical aperture\n", + "L=8*(10)**-7 #wavelength in m\n", + "\n", + "#Calculations\n", + "\n", + "P=scipy.arcsin(NA)*180/scipy.pi #acceptance angle\n", + "n2=scipy.sqrt(n1**2-NA**2) #refractive index\n", + "V=(scipy.pi*d/L)*scipy.sqrt(n1**2-n2**2)\n", + "N=V**2/2 #number of modes\n", + "\n", + "#Results\n", + "\n", + "print 'Acceptance angle =',round(P,2),'degrees'\n", + "print 'Refractive index =',round(n2,3)\n", + "print 'No. of modes =',round(N,0)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Acceptance angle = 12.12 degrees\n", + "Refractive index = 1.606\n", + "No. of modes = 2176.0\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.3, Page number: 655

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "a=0.25 #in dB/km\n", + "P=1-0.4 #strength of pulse im %\n", + "\n", + "#Calculation\n", + "\n", + "l=(10/a)*scipy.log(1/P)/scipy.log(10) #distance in km\n", + "\n", + "#Result\n", + "\n", + "print 'distance through which the power is reduced by 40% =',round(l,3),'km'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "distance through which the power is reduced by 40% = 8.874 km\n" + ] + } + ], + "prompt_number": 3 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_2-checkpoint.ipynb b/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_2-checkpoint.ipynb new file mode 100644 index 00000000..9c2ffc15 --- /dev/null +++ b/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_2-checkpoint.ipynb @@ -0,0 +1,299 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:d78c85d754b20d2817dcaff01d1e4d9adbe09676da8e1b1ab97dcc0ae047a88a" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 2: Coordinate Systems and Transformation

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.1, Page number: 36

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "x=-2\n", + "y=6\n", + "z=3 \n", + "\n", + "#Calculations\n", + "\n", + "r=scipy.sqrt(x**2+y**2)\n", + "phi=scipy.arctan(-y/x) #phi in radians in 1st quadrant\n", + "phid=180-(phi*180/scipy.pi) #phi in degrees in second quadrant\n", + "phic=scipy.pi*phid/180.0 #phi in radians in second quadrant\n", + "R=scipy.sqrt(x**2+y**2+z**2) \n", + "theta=scipy.arctan(r/z) \n", + "\n", + " #P in cylindrical coordinates\n", + " \n", + "Pcyl=array([round(r,2),round(phid,2),z]) \n", + "\n", + " #P in spherical coordinates\n", + " \n", + "Psph=array([round(R,2),round(theta*180/scipy.pi,2),\n", + " round(phid,2)]) \n", + "\n", + " #Vector A in cylindrical coordinate system\n", + "\n", + "Xc=r*scipy.cos(phic)\n", + "Yc=r*scipy.sin(phic)\n", + "Zc=z \n", + "Ar=Yc*scipy.cos(phic)+(Xc+Zc)*scipy.sin(phic)\n", + "Aphi=-Yc*scipy.sin(phic)+(Xc+Zc)*scipy.cos(phic)\n", + "Az=0\n", + "Acyl=array([round(Ar,4),round(Aphi,3),Az])\n", + "\n", + " #Vector A in spherical coordinate system\n", + "\n", + "Xs=R*scipy.cos(phic)*scipy.sin(theta)\n", + "Ys=R*scipy.sin(phic)*scipy.sin(theta)\n", + "Zs=R*scipy.cos(theta)\n", + "AR=Ys*scipy.sin(theta)*scipy.cos(phic)+(Xs+Zs)*scipy.sin(theta)*scipy.sin(phic) \n", + "Ath=Ys*scipy.cos(theta)*scipy.cos(phic)+(Xs+Zs)*scipy.cos(theta)*scipy.sin(phic) \n", + "Aph=-Ys*scipy.sin(phic)+(Xs+Zs)*scipy.cos(phic)\n", + "Asph=array([round(AR,4),round(Ath,4),round(Aph,3)])\n", + "\n", + "#Results\n", + "\n", + "print 'P in cylindrical coordinates =',Pcyl\n", + "print 'P in spherical coordinates =',Psph\n", + "print 'A in cylindrical coordinates =',Acyl\n", + "print 'A in spherical coordinates =',Asph" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "P in cylindrical coordinates = [ 6.32 108.43 3. ]\n", + "P in spherical coordinates = [ 7. 64.62 108.43]\n", + "A in cylindrical coordinates = [-0.9487 -6.008 0. ]\n", + "A in spherical coordinates = [-0.8571 -0.4066 -6.008 ]\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.2, Page number: 39

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "from numpy import *\n", + " \n", + "#Variable Declaration\n", + "\n", + "x=-3\n", + "y=4\n", + "z=0\n", + "p=5\n", + "phi=scipy.pi/2 \n", + "Zc=-2\n", + "\n", + "#Calculations\n", + "\n", + " #B in cartesian coordinates\n", + "\n", + "R=scipy.sqrt(x**2+y**2+z**2)\n", + "r=scipy.sqrt(x**2+y**2) \n", + "P=scipy.arcsin(r/R) #in radians\n", + "Q=scipy.arccos(x/r) #in radians \n", + "f=10/R \n", + "Bx=f*scipy.sin(P)*scipy.cos(Q)+R*(scipy.cos(P))**2*scipy.cos(Q)-scipy.sin(Q) \n", + "By=f*scipy.sin(P)*scipy.sin(Q)+R*(scipy.cos(P))**2*scipy.sin(Q)+scipy.cos(Q) \n", + "Bz=f*scipy.cos(P)-R*scipy.cos(P)*scipy.sin(P) \n", + "Bcart=array([round(Bx,0),round(By,0),round(-Bz,0)])\n", + "\n", + " #B in cylindrical coordinates\n", + " \n", + "Rc=sqrt(p**2+Zc**2) \n", + "Pc=scipy.arccos(Zc/Rc) #in radians\n", + "Br=(10/Rc)*scipy.sin(Pc)+Rc*(scipy.cos(Pc))**2 \n", + "Bp=1 \n", + "Bzc=(10/Rc)*scipy.cos(Pc)-Rc*scipy.cos(Pc)*scipy.sin(Pc) \n", + "Bcyl=array([round(Br,3),Bp,round(Bzc,3)])\n", + "\n", + "#Results\n", + "\n", + "print 'B(-3,4,0) in cartesian coordinates is',Bcart\n", + "print 'B(5,pi/2,-2) in cylindrical coordinates is',Bcyl" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "B(-3,4,0) in cartesian coordinates is [-2. 1. 0.]\n", + "B(5,pi/2,-2) in cylindrical coordinates is [ 2.467 1. 1.167]\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.3, Page number: 44

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "E=array([-5,10,3]) #in cylindrical coordinates\n", + "F=array([1,2,-6]) #in cylindrical coordinates\n", + "P=array([5,scipy.pi/2,3]) #in cylindrical coordinates\n", + "\n", + "#Calculations\n", + "\n", + "exf=cross(E,F)\n", + "ansa=scipy.sqrt(dot(exf,exf)) #|EXF|\n", + "ay=array([round(scipy.sin(scipy.pi/2),0),\n", + " round(scipy.cos(scipy.pi/2),0),0])\n", + "ansb=dot(E,ay)*ay\n", + "modE=scipy.sqrt(dot(E,E))\n", + "az=array([0,0,1])\n", + "thetaEz=(180/scipy.pi)*arccos(dot(E,az)/modE) #in degrees\n", + "ansc=90-thetaEz #in degrees\n", + "\n", + "#Results\n", + "\n", + "print '|EXF| =',round(ansa,2)\n", + "print 'The vector component of E at P parallel to the line x=2,z=3 =',ansb,','\n", + "print 'in spherical coordinates'\n", + "print 'The angle E makes with the surface z = 3 at P =',round(ansc,2),'degrees'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "|EXF| = 74.06\n", + "The vector component of E at P parallel to the line x=2,z=3 = [-5. -0. -0.] ,\n", + "in spherical coordinates\n", + "The angle E makes with the surface z = 3 at P = 15.02 degrees\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.4, Page number: 45

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "aR=array([1,0,0]) #Unit vector along radial direction\n", + "ath=array([0,1,0]) #Unit vector along theta direction\n", + "aph=array([0,0,1]) #Unit vector along phi direction\n", + "P=array([10,scipy.pi*150/180,scipy.pi*330/180])\n", + "\n", + "#Calculations\n", + "\n", + "r=dot(P,aR)\n", + "q=dot(P,aph)\n", + "p=dot(P,ath)\n", + "R=r*scipy.sin(q)\n", + "Ph=-scipy.sin(p)*scipy.cos(q)/r\n", + "Q=r*r\n", + "D=array([R,Ph,Q]) #D at P(10,150\u00b0,330\u00b0)\n", + "rDr=round(dot(aR,D),0) #radial component of D\n", + "rDth=round(dot(-ath,D),3) #theta component of D\n", + "rDph=round(dot(aph,D),0) #phi component of D\n", + "\n", + "Dn=array([r*scipy.sin(q),0,0]) #Component of D normal to surface r=10\n", + "Dt=D-Dn #Component of D tangential to surface r=10\n", + "Dtr=round(dot(aR,Dt),0) #radial component of Dt\n", + "Dtth=round(dot(-ath,Dt),3) #theta component of Dt\n", + "Dtph=round(dot(aph,Dt),0) #phi component of Dt\n", + "rDt=array([Dtr,Dtth,Dtph])\n", + "\n", + " #Unit vector normal to D and tangential to cone theta=45 degrees\n", + "\n", + "U=cross(D,ath)\n", + "u=U/scipy.sqrt(dot(U,U)) \n", + "ru=array([round(dot(aR,u),4),round(dot(ath,u),4),round(dot(aph,u),4)])\n", + "\n", + "#Results\n", + "\n", + "print 'D at P(10,150\u00b0,330\u00b0) = [',rDr,' ',rDth,' ',rDph,']'\n", + "print 'The component of D tangential to the spherical surface r = 10 at P ='\n", + "print '[',Dtr,' ',Dtth,' ',Dtph,']'\n", + "print 'A unit vector at P perpendicular to D and tangential to cone 0 = 150\u00b0 ='\n", + "print ru" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "D at P(10,150\u00b0,330\u00b0) = [ -5.0 0.043 100.0 ]\n", + "The component of D tangential to the spherical surface r = 10 at P =\n", + "[ 0.0 0.043 100.0 ]\n", + "A unit vector at P perpendicular to D and tangential to cone 0 = 150\u00b0 =\n", + "[-0.9988 0. -0.0499]\n" + ] + } + ], + "prompt_number": 10 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_3-checkpoint.ipynb b/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_3-checkpoint.ipynb new file mode 100644 index 00000000..c8dcfb12 --- /dev/null +++ b/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_3-checkpoint.ipynb @@ -0,0 +1,370 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:02fdf3d71909ffefa3365717544dbd108f534a28cb15d60e71866e85ef9ac76f" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 3: Vector Calculus

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.1, Page number: 58

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "import scipy\n", + "from numpy import *\n", + "import scipy.integrate\n", + "\n", + "#Variable Declaration\n", + "\n", + "A=array([5,0,0])\n", + "B=array([0,5,0])\n", + "C=array([0,5,10])\n", + "D=array([5,0,10])\n", + "\n", + "#Calculations\n", + "\n", + " #A,B,C,D in cylindrical coordinates\n", + " \n", + "A=array([5,0,0])\n", + "B=array([5,scipy.pi,0])\n", + "C=array([5,scipy.pi,10])\n", + "D=array([5,0,10])\n", + "\n", + "p=5\n", + "\n", + "def BC(z): \n", + " return 1\n", + "ansa, erra = scipy.integrate.quad(BC, 0, 10)\n", + " \n", + "def CD(phi): \n", + " return p\n", + "ansb, errb = scipy.integrate.quad(CD, 0, scipy.pi/2)\n", + "ansbb=ansb/scipy.pi #answer in multiples of pi\n", + "\n", + "def ABCD(phi,z): \n", + " return p\n", + "ansc, errc = scipy.integrate.dblquad(lambda z , phi: ABCD(phi,z), \n", + " 0, scipy.pi/2, lambda z: 0, lambda z: 10) \n", + "anscc=ansc/scipy.pi #answer in multiples of pi\n", + " \n", + "def ABO(phi,rho): \n", + " return rho\n", + "ansd, errd = scipy.integrate.dblquad(lambda rho , phi: ABO(phi,rho), \n", + " 0, scipy.pi/2, lambda rho: 0, lambda rho: 5)\n", + "ansdd=ansd/scipy.pi #answer in multiples of pi\n", + "\n", + "def AOFD(rho,z): \n", + " return 1\n", + "anse, erre = scipy.integrate.dblquad(lambda z , rho: AOFD(rho,z), \n", + " 0, 10, lambda z: 0, lambda z: 5)\n", + " \n", + "def ABDCFO(z,phi,rho):\n", + " return rho\n", + "ansf, errf=scipy.integrate.tplquad(ABDCFO,0,5,lambda rho:0,\n", + " lambda rho:scipy.pi/2,lambda rho,phi:0,lambda rho,phi:10)\n", + "ansff=ansf/scipy.pi #answer in multiples of pi\n", + "\n", + "#Results\n", + "\n", + "print 'The distance BC =',ansa\n", + "print 'The distance CD =',ansbb,'pi'\n", + "print 'The surface area ABCD =',anscc,'pi'\n", + "print 'The surface area ABO =',ansdd,'pi'\n", + "print 'The surface area AOFD =',anse\n", + "print 'The volume ABDCFO =',ansff,'pi'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The distance BC = 10.0\n", + "The distance CD = 2.5 pi\n", + "The surface area ABCD = 25.0 pi\n", + "The surface area ABO = 6.25 pi\n", + "The surface area AOFD = 50.0\n", + "The volume ABDCFO = 62.5 pi\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.2, Page number: 61

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "from numpy import *\n", + "import scipy.integrate\n", + "from fractions import Fraction\n", + "\n", + "#Variable Declaration\n", + "\n", + "ax=array([1,0,0]) #Unit vector along x direction\n", + "ay=array([0,1,0]) #Unit vector along y direction\n", + "az=array([0,0,1]) #Unit vector along z direction\n", + "\n", + "#Calculations\n", + "\n", + "def C1(x): \n", + " return x**2\n", + "seg1, err1 = scipy.integrate.quad(C1, 1, 0) #segment 1\n", + "Seg1=Fraction(seg1).limit_denominator(100) #converting to fraction\n", + "\n", + "def C2(y): \n", + " return 0\n", + "seg2, err2 = scipy.integrate.quad(C2, 0, 1) #segment 2\n", + "\n", + "def C3(x): \n", + " return (x**2-1)\n", + "seg3, err3 = scipy.integrate.quad(C3, 0, 1) #segment 3\n", + "Seg3=Fraction(seg3).limit_denominator(100) #converting to fraction\n", + "\n", + "def C4(y): \n", + " return (-y-y**2)\n", + "seg4, err4 = scipy.integrate.quad(C4, 1, 0) #segment 4\n", + "Seg4=Fraction(seg4).limit_denominator(100) #converting to fraction\n", + "\n", + "seg=Seg1+seg2+Seg3+Seg4 #total circulation around path\n", + "Seg=Fraction(seg).limit_denominator(100) #converting to fraction\n", + "\n", + "#Results\n", + "\n", + "print 'F along segment 1 is',Seg1\n", + "print 'F along segment 2 is',seg2\n", + "print 'F along segment 3 is',Seg3\n", + "print 'F along segment 4 is',Seg4\n", + "print 'Circulation of F around the path is',Seg" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "F along segment 1 is -1/3\n", + "F along segment 2 is 0.0\n", + "F along segment 3 is -2/3\n", + "F along segment 4 is 5/6\n", + "Circulation of F around the path is -1/6\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.4, Page number: 68" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "from fractions import Fraction\n", + "\n", + "#Variable Declaration\n", + "\n", + "ax=array([1,0,0]) #Unit vector along x direction\n", + "ay=array([0,1,0]) #Unit vector along y direction\n", + "az=array([0,0,1]) #Unit vector along z direction\n", + "Al=array([3,4,12])\n", + "x=2\n", + "y=-1\n", + "z=0\n", + "\n", + "#Calculations\n", + "\n", + "gradW=(2*x*y**2+y*z)*ax+(2*x**2*y+x*z)*ay+(x*y)*az\n", + "gradWl=Fraction(dot(gradW,Al)/scipy.sqrt(dot(Al,Al))).limit_denominator(1000)\n", + "\n", + "#Result\n", + "\n", + "print 'dW/dl =',gradWl\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "dW/dl = -44/13\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.7, Page number: 74" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "import scipy.integrate\n", + "\n", + "#Variable Declaration\n", + "\n", + "ap=array([1,0,0]) #Unit vector along radial direction\n", + "az=array([0,0,1]) #Unit vector along z direction\n", + "\n", + "#Calculations\n", + "\n", + "def psi1(phi,p): \n", + " return 10*scipy.e**(-2)*p\n", + "psit, errt = scipy.integrate.dblquad(lambda p , phi: psi1(phi,p), #flux through top\n", + " 0, 2*scipy.pi, lambda p: 0, lambda p: 1) \n", + "\n", + "def psi2(phi,p): \n", + " return -10*p\n", + "psib, errb = scipy.integrate.dblquad(lambda p , phi: psi2(phi,p), #flux through bottom\n", + " 0, 2*scipy.pi, lambda p: 0, lambda p: 1) \n", + "\n", + "def psi3(phi,z): \n", + " return 10*scipy.exp(-2*z)\n", + "psis, errs = scipy.integrate.dblquad(lambda z , phi: psi3(phi,z), #flux through side\n", + " 0, scipy.pi*2, lambda z: 0, lambda z: 1) \n", + "\n", + "psi=psit+psib+psis #total flux through cylinder\n", + "\n", + "#Results\n", + "\n", + "print 'The total flux through the cylinder is',psi\n", + "print 'The total flux through cylinder using divergence theorem is also 0'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The total flux through the cylinder is 0.0\n", + "The total flux through cylinder using divergence theorem is also 0\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.9, Page number: 81

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "from numpy import *\n", + "import scipy.integrate\n", + "\n", + "#Variable Declaration\n", + "\n", + "ap=array([1,0,0]) #Unit vector along radial direction\n", + "ath=array([0,1,0]) #Unit vector along theta direction\n", + "aph=array([0,0,1]) #Unit vector along phi direction\n", + "\n", + "#Calculations\n", + "\n", + " #segment 1\n", + "def ab(phi): \n", + " return 2*scipy.sin(phi)\n", + "seg1,err1 = scipy.integrate.quad(ab,scipy.pi*60/180,scipy.pi*30/180) \n", + "\n", + " #segment 2\n", + "def bc(p): \n", + " return p*scipy.cos(scipy.pi*30/180)\n", + "seg2,err2 = scipy.integrate.quad(bc,2,5) \n", + "\n", + " #segment 3\n", + "def cd(phi): \n", + " return 5*scipy.sin(phi)\n", + "seg3,err3 = scipy.integrate.quad(cd,-scipy.pi*30/180,scipy.pi*60/180)\n", + "\n", + " #segment 4\n", + "def da(p): \n", + " return p*scipy.cos(scipy.pi*60/180)\n", + "seg4,err4 = scipy.integrate.quad(da,5,2)\n", + "\n", + "I1=seg1+seg2+seg3+seg4\n", + "\n", + " #using stoke's theorem\n", + "\n", + "def curlA(phi,p): \n", + " return ((1+p)*scipy.sin(phi))\n", + "I2, err = scipy.integrate.dblquad(lambda p , phi: curlA(phi,p), \n", + " scipy.pi*30/180, scipy.pi*60/180, lambda p: 2, lambda p: 5)\n", + "\n", + "#Results\n", + "\n", + "print 'The integral calculated segment wise =',round(I1,3)\n", + "print 'The integral calculated using Stokes Theorem =',round(I2,3)\n", + "print 'Since I1 = I2, Stokes theorem is verified'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The integral calculated segment wise = 4.941\n", + "The integral calculated using Stokes Theorem = 4.941\n", + "Since I1 = I2, Stokes theorem is verified\n" + ] + } + ], + "prompt_number": 3 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_4-checkpoint.ipynb b/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_4-checkpoint.ipynb new file mode 100644 index 00000000..d64b61ce --- /dev/null +++ b/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_4-checkpoint.ipynb @@ -0,0 +1,652 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:891c986a46f113e35878dc6d6a0b8d702286ad7b4ea91bae03f716286f9bdeaa" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 4: Electrostatic Fields

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.1, Page number: 107

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "ax=array([1,0,0]) #Unit vector along x direction\n", + "ay=array([0,1,0]) #Unit vector along y direction\n", + "az=array([0,0,1]) #Unit vector along z direction\n", + "Q1=1*10**-3 #charge 1 at (-1,-1,4) in C\n", + "Q2=-2*10**-3 #charge 2 at (3,2,-1) in C\n", + "Q=10*10**-9 #charge 3 at (0,3,1) in C\n", + "P1=array([0,3,1])-array([3,2,-1]) #distance vector from charge 3 to 1\n", + "P2=array([0,3,1])-array([-1,-1,4]) #distance vector from charge 3 to 2\n", + "e=10**-9/(36*scipy.pi) #permittivity in Farad/m \n", + "\n", + "#Calculations\n", + "\n", + "modP1=scipy.sqrt(dot(P1,P1))\n", + "modP2=scipy.sqrt(dot(P2,P2))\n", + "F1=(Q*Q1)*P1*10**3/(4*scipy.pi*e*modP1**3) #force on charge 3 by 1 in mN\n", + "F2=(Q*Q2)*P2*10**3/(4*scipy.pi*e*modP2**3) #force on charge 3 by 2 in mN\n", + "\n", + " #Total force on charge 3\n", + " \n", + "Fx=round(dot(F1+F2,ax),3)\n", + "Fy=round(dot(F1+F2,ay),3)\n", + "Fz=round(dot(F1+F2,az),3)\n", + "F=array([Fx,Fy,Fz]) #Total force in mN\n", + "E=(10**-6)*(F/Q) #Electric field in kV/m\n", + "\n", + "#Results \n", + "\n", + "print 'Total force on charge at (0,3,1) =',F,'in mN'\n", + "print 'Electric field at (0,3,1) =',E,'kV/m'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total force on charge at (0,3,1) = [-6.512 -3.713 7.509] in mN\n", + "Electric field at (0,3,1) = [-651.2 -371.3 750.9] kV/m\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.3, Page number: 109" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "#Variable Declaration\n", + "\n", + "E=500*10**3 #electric field in V/m\n", + "Qm=9*10**-6 #Q/m in C/kg\n", + "y=0.8 #distance fallen in m\n", + "g=9.8 #acceleration due to gravity in m/s^2\n", + "\n", + "#Calculations\n", + "\n", + "t=scipy.sqrt(2*y/g) #time taken to fall in seconds\n", + "x=Qm*E*t**2/2 #half the separation between particles in m\n", + "sep=2*x #separation between particles in m\n", + "\n", + "#Result\n", + "\n", + "print 'The separation between particles is',round(sep*100,2),'cm'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The separation between particles is 73.47 cm\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.5, Page number: 120" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "import scipy.integrate\n", + "\n", + "#Variable Declaration\n", + "\n", + "Eo=10**-9/(36*scipy.pi) #permittivity of free space\n", + "ax=array([1,0,0]) #Unit vector along x direction\n", + "ay=array([0,1,0]) #Unit vector along y direction\n", + "az=array([0,0,1]) #Unit vector along z direction\n", + "q=-1 #charge in mC\n", + "\n", + "#Calculations\n", + "\n", + "def charge(x,y): \n", + " return x*y*(x**2+y**2+25)**(1.5)\n", + "Q, errq = scipy.integrate.dblquad(lambda y , x: charge(x,y), #total charge in nC\n", + " 0, 1, lambda y: 0, lambda y: 1) \n", + "\n", + "d=(4*scipy.pi*Eo*(x**2+y**2+25)**(1.5))\n", + "\n", + "def elecx(x,y): \n", + " return 10**-9*x*y*(x**2+y**2+25)**(1.5)*(-x)/d #x component of electric field\n", + "Ex, errx = scipy.integrate.dblquad(lambda y , x: elecx(x,y), \n", + " 0, 1, lambda y: 0, lambda y: 1) \n", + "\n", + "def elecy(x,y): \n", + " return 10**-9*x*y*(x**2+y**2+25)**(1.5)*(-y)/d #y component of electric field\n", + "Ey, erry = scipy.integrate.dblquad(lambda y , x: elecy(x,y), \n", + " 0, 1, lambda y: 0, lambda y: 1) \n", + "\n", + "def elecz(x,y): \n", + " return 10**-9*x*y*(5)/(4*scipy.pi*Eo) #z component of electric field\n", + "Ez, errz = scipy.integrate.dblquad(lambda y , x: elecz(x,y), \n", + " 0, 1, lambda y: 0, lambda y: 1) \n", + "\n", + "E=array([round(Ex,1),round(Ey,1),round(Ez,2)]) #electric field in V/m\n", + "\n", + "F=q*E #force in mN \n", + "\n", + "#Results\n", + "\n", + "print 'Total charge =',round(Q,2),'nC'\n", + "print 'Electric field at (0,0,5) =',E,'V/m'\n", + "print 'Force experienced by -1mC =',F,'mN'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total charge = 33.15 nC\n", + "Electric field at (0,0,5) = [ -1.5 -1.5 11.25] V/m\n", + "Force experienced by -1mC = [ 1.5 1.5 -11.25] mN\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.6, Page number: 121

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "ax=array([1,0,0]) #Unit vector along x direction\n", + "ay=array([0,1,0]) #Unit vector along y direction\n", + "az=array([0,0,1]) #Unit vector along z direction\n", + "ps1=10*10**-9 #Surface charge density of plane 1\n", + "ps2=15*10**-9 #Surface charge density of plane 2\n", + "pl=10*scipy.pi*10**-9 #charge density of line\n", + "e=(10**-9)/(36*scipy.pi) #permittivity of free space in Farad/m\n", + "\n", + "#Calculations\n", + "\n", + "E1=(ps1/(2*e))*-ax/scipy.pi #field due to plane 1 in multiples of pi in V/m\n", + "E2=(ps2/(2*e))*ay/scipy.pi #field due to plane 2 in multiples of pi in V/m\n", + "\n", + " #field due to line charge in multiples of pi in V/m\n", + " \n", + "a=(ax-3*az) \n", + "moda=scipy.sqrt(dot((ax-3*az),(ax-3*az)))\n", + "e3=(pl/(2*scipy.pi*e*moda**2))*a\n", + "E3=array([dot(e3,ax)/scipy.pi,0,dot(e3,az)/scipy.pi])\n", + "\n", + " #total field in multiples of pi in V/m\n", + " \n", + "E=E1+E2+E3 \n", + "\n", + "#Result\n", + "\n", + "print 'The total electric field at (1,1,-1) =',E,'Pi V/m'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The total electric field at (1,1,-1) = [-162. 270. -54.] Pi V/m\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.7, Page number: 123

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "ax=array([1,0,0]) #Unit vector along x direction\n", + "ay=array([0,1,0]) #Unit vector along y direction\n", + "az=array([0,0,1]) #Unit vector along z direction\n", + "Q=-5*scipy.pi*10**-3 #charge at (4,0,0) in C\n", + "pl=3*scipy.pi*10**-3 #charge density of line charge in C/m\n", + "r=array([4,0,3]) #point where D is to be found \n", + "rp=array([4,0,0]) #position of point charge\n", + "\n", + "#Calculations \n", + "\n", + "R=r-rp \n", + "modR=scipy.sqrt(dot(R,R)) \n", + "Dq=(Q*R)/(4*scipy.pi*modR**3) #flux density due to point charge in C/m^2\n", + "p=scipy.sqrt(dot(r,r))\n", + "ap=r/p \n", + "Dl=(pl/(2*scipy.pi*p))*ap #flux density due to line charge in C/m^2\n", + "D=(Dq+Dl)*10**6 #total flux density in micro C/m^2\n", + "Dz=round(dot(D,az),0)\n", + "Dx=round(dot(D,ax),0)\n", + "Dy=round(dot(D,ay),0)\n", + "Dround=array([Dx,Dy,Dz]) #value of D rounded to 0 decimal points\n", + "\n", + "#Result\n", + "\n", + "print 'D at (4,0,0) due to point charge and line charge =',Dround,'micro C/m^2'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "D at (4,0,0) due to point charge and line charge = [ 240. 0. 41.] micro C/m^2\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.8, Page number: 130

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "import scipy\n", + "from numpy import *\n", + "import scipy.integrate\n", + "from fractions import Fraction\n", + "\n", + "#Variable Declaration\n", + "\n", + "ap=array([1,0,0]) #Unit vector along rho direction\n", + "aph=array([0,1,0]) #Unit vector along phi direction\n", + "az=array([0,0,1]) #Unit vector along z direction\n", + "point=array([1,scipy.pi/4,3])\n", + "p1=0\n", + "p2=1\n", + "ph1=0\n", + "ph2=2*scipy.pi\n", + "\n", + "#Calculations\n", + "\n", + "pointp=dot(point,ap)\n", + "pointph=dot(point,aph)\n", + "pv=pointp*scipy.cos(pointph)**2 #charge density at (1,pi/4,3) in C/m^3\n", + "\n", + "def ctop(phi,p): \n", + " return 2*p**2*(scipy.cos(phi)**2)\n", + "psya, erra = scipy.integrate.dblquad(lambda p , phi: ctop(phi,p), \n", + " ph1, ph2, lambda p: p1, lambda p: p2)\n", + "\n", + "def cbot(phi,p): \n", + " return 2*p**2*(scipy.cos(phi)**2)\n", + "psyb, errb = scipy.integrate.dblquad(lambda p , phi: cbot(phi,p), \n", + " ph1, ph2, lambda p: p1, lambda p: p2)\n", + " \n", + "psy=psya+psyb #Charge in C\n", + "psyp=psy/scipy.pi #Charge in multiples of Pi in C\n", + "psyf=Fraction(psyp).limit_denominator(100) #converting to fraction\n", + "\n", + "\n", + "#Results\n", + "\n", + "print 'Charge density at (1,pi/4,3) =',pv,'C/m^3'\n", + "print 'Total charge enclosed by the cylinder =',psyf,'Pi C'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Charge density at (1,pi/4,3) = 0.5 C/m^3\n", + "Total charge enclosed by the cylinder = 4/3 Pi C\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.10, Page number: 136

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "import scipy\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "Q1=-4 #charge 1 in micro C\n", + "Q2=5 #charge 2 in micro C\n", + "e=10**-9/(36*scipy.pi) #permittivity of free space in Farad/m \n", + "\n", + "#Calculations\n", + "\n", + "R1=array([1,0,1])-array([2,-1,3]) #distance vector from (1,0,1) to charge 1\n", + "R2=array([1,0,1])-array([0,4,-2]) #distance vector from (1,0,1) to charge 2\n", + "modR1=scipy.sqrt(dot(R1,R1))\n", + "modR2=scipy.sqrt(dot(R2,R2)) \n", + "V=10**-9*((Q1/modR1)+(Q2/modR2))/(4*scipy.pi*e) #potential in kV\n", + "\n", + "#Result\n", + "\n", + "print 'The potential at (1, 0, 1) =',round(V,3),'kV'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The potential at (1, 0, 1) = -5.872 kV\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.11, Page number: 136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "Eo=10**-9/(36*scipy.pi) #permittivity of free space\n", + "Vo=0 #potential at O in V\n", + "Vb=100 #potential at B in V\n", + "po=scipy.sqrt(2)\n", + "ro=5\n", + "pa=1\n", + "ra=9\n", + "pb=1\n", + "rb=scipy.sqrt(21)\n", + "pc=scipy.sqrt(20)\n", + "rc=scipy.sqrt(11)\n", + "pl=2*10**-9 #charge density of the line in C/m\n", + "Q=5*10**-9 #point charge at (-3,4,0) in C\n", + "\n", + "#Calculations\n", + "\n", + "Va=Vo-(-pl*scipy.log(po/pa)/(2*scipy.pi*Eo)+Q*(ra-ro)/(4*scipy.pi*Eo*ra*ro))\n", + "Vc=Vb+(-pl*scipy.log(pc/pb)/(2*scipy.pi*Eo)+Q*(rb-rc)/(4*scipy.pi*Eo*rb*rc))\n", + "Vbc=Vc-Vb\n", + "\n", + "#Results\n", + "\n", + "print 'Va =',round(Va,3),'V'\n", + "print 'Vc =',round(Vc,3),'V'\n", + "print 'Vbc =',round(Vbc,3),'V'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Va = 8.477 V\n", + "Vc = 49.825 V\n", + "Vbc = -50.175 V\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.12, Page number: 140

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "import scipy\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "ar=array([1,0,0]) #Unit vector along radial direction\n", + "ath=array([0,1,0]) #Unit vector along theta direction\n", + "aph=array([0,0,1]) #Unit vector along phi direction\n", + "e=(10**-9)/(36*scipy.pi) #permittivity of free space in Farad/m\n", + "\n", + " #The point (2, pi/2, 0)\n", + "r=2\n", + "th=scipy.pi/2\n", + "ph=0\n", + " #Point A\n", + "ra=1\n", + "tha=scipy.pi*30/180\n", + "pha=scipy.pi*120/180\n", + " #Point B\n", + "rb=4\n", + "thb=scipy.pi/2\n", + "phb=scipy.pi*60/180\n", + "\n", + "q=10*10**-6 \n", + "\n", + "#Calculations\n", + "\n", + "Er=(20.0/r**3)*scipy.sin(th)*scipy.cos(ph) #Radial component of E in V/m\n", + "Eth=-(10/r**3)*scipy.cos(th)*scipy.cos(ph) #Theta component of E in V/m\n", + "Eph=(10/r**3)*scipy.sin(ph) #Phi component of E in V/m\n", + "E=array([Er,Eth,Eph])\n", + "D=E*e*10**12 #Electric flux density D in pC/m^2\n", + "Dr=round(dot(D,ar),1) #Radial component of D in V/m rounded to 1 decimal\n", + "Dth=round(dot(D,ath),0) #Theta component of D in pC/m^2 rounded to 0 decimal\n", + "Dph=round(dot(D,aph),0) #Phi component of D in pC/m^2 rounded to 0 decimal\n", + "Dc=array([Dr,Dth,Dph]) #Rounded D in pC/m^2\n", + "\n", + "Va=10*scipy.sin(tha)*cos(pha)/ra**2 #potential at point A in V\n", + "Vb=10*scipy.sin(thb)*cos(phb)/rb**2 #potential at point B in V\n", + "W=q*(Vb-Va)*10**6 #work done in micro J\n", + "\n", + "#Results\n", + "\n", + "print 'The electric flux density D at (2, pi/2, 0) =',Dc,'pC/m^2'\n", + "print 'Work done in moving the charge =',W,'micro J'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The electric flux density D at (2, pi/2, 0) = [ 22.1 -0. 0. ] pC/m^2\n", + "Work done in moving the charge = 28.125 micro J\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.13, Page number: 145

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "import scipy\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "p1=-5*10**-9 #dipole moment of dipole 1 in C/m\n", + "p2=9*10**-9 #dipole moment of dipole 2 in C/m\n", + "z1=2 #z component of position vector of dipole 1\n", + "z2=-3 #z component of position vector of dipole 2\n", + "e=10**-9/(36*scipy.pi) #permittivity of free space in Farad/m\n", + "\n", + "#Calculation\n", + "\n", + "V=(1/(4*scipy.pi*e))*((p1*abs(z1)/z1**3)+(p2*abs(z2)/z2**3))\n", + "\n", + "#Result\n", + "\n", + "print 'Potential at origin =',V, 'V'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Potential at origin = -20.25 V\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.14, Page number: 148

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "Q1=-1*10**-9 #Charge 1 in C\n", + "Q2=4*10**-9 #Charge 2 in C\n", + "Q3=3*10**-9 #Charge 3 in C\n", + "e=10**-9/(36*scipy.pi) #permittivity of free space in farad/m\n", + "\n", + "#Calculations\n", + "\n", + "V1=(1/(4*scipy.pi*e)*(Q2+Q3))\n", + "V2=(1/(4*scipy.pi*e)*(Q1+Q3/(2**.5)))\n", + "V3=(1/(4*scipy.pi*e)*(Q1+Q2/(2**.5)))\n", + "W=0.5*((V1*Q1)+(V2*Q2)+(V3*Q3))*10**9 #Energy in nJ\n", + "\n", + "#Result\n", + "\n", + "print 'Energy in the system =',round(W,2),'nJ'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Energy in the system = 13.37 nJ\n" + ] + } + ], + "prompt_number": 8 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_5-checkpoint.ipynb b/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_5-checkpoint.ipynb new file mode 100644 index 00000000..db757859 --- /dev/null +++ b/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_5-checkpoint.ipynb @@ -0,0 +1,468 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:08d693988f55ded7946a3910c4b750b4a1419d79f72e5b56719c0d924a66fd5a" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 5: Electric Fields in Material Space

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.1, Page number: 167

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "import scipy.integrate\n", + "\n", + "#Variable Declaration\n", + "\n", + "r1= 0.2 # radius of hemispherical shell in metres\n", + "r2= 0.1 # radius of spherical shell in metres\n", + "\n", + "#Calculations\n", + "\n", + "#Calculation of current through hemispherical shell \n", + "\n", + "def J1(phi,theta):\n", + "\ts1=(1/r1)*(2* scipy.cos(theta)* scipy.sin(theta))\n", + "\treturn s1\n", + "\n", + "if __name__ == '__main__':\n", + "\n", + " I1, error = scipy.integrate.dblquad(lambda theta , phi: J1(phi,theta), \n", + " 0, 2*scipy.pi, lambda theta: 0, lambda theta: scipy.pi/2) \n", + "\t \n", + "#Calculation of current through spherical shell \n", + "\n", + "def J2(phi,theta):\n", + "\ts2=(1/r2)*(2* scipy.cos(theta)* scipy.sin(theta))\n", + "\treturn s2\n", + "\n", + "if __name__ == '__main__':\n", + "\n", + " I2, error = scipy.integrate.dblquad(lambda theta , phi: J1(phi,theta), \n", + " 0, 2*scipy.pi, lambda theta: 0, lambda theta: scipy.pi) \n", + "\t \n", + "#Results\n", + "\n", + "print 'Current through hemispherical shell=',round(I1,1),'A' \n", + "print 'Current through spherical shell=',round(I2,0),'A'\n", + "\t" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Current through hemispherical shell= 31.4 A\n", + "Current through spherical shell= 0.0 A\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.2, Page number: 168

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#Variable Declaration\n", + "\n", + "ps=10**-7 #Surface charge density of the belt in Couloumb/metre^2\n", + "u=2 #Speed of the belt in metres/sec\n", + "w=0.1 #Width of the belt in metres\n", + "t=5 #Time taken in seconds \n", + "\n", + "#Calculations\n", + "\n", + "I=ps*u*w #Current in amperes\n", + "Q=I*t*10**9 #Charge collected in 5 seconds in nano Coloumbs\n", + "\n", + "#Result\n", + "\n", + "print \"The charge collected in 5 seconds is \",Q,\"nC\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The charge collected in 5 seconds is 100.0 nC\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.3, Page number: 169

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#Variable Declaration\n", + "\n", + "n=10**29 #Number density of electrons in m^-3\n", + "e=-1.6*10**-19 #Electronic charge in Coloumbs\n", + "sigma=5*10**7 #Current density in S/m\n", + "E=10**-2 #Electric Field in V/m\n", + "S=(3.14*10**-6)/4 #Cross sectional area of the wire in m^2\n", + "\n", + "#Calculations\n", + "\n", + "pv=n*e #Charge density of free electrons in C/m^3\n", + "J=sigma*E*10**-3 #Current density in kA/m^2\n", + "I=J*S*10**3 #Current in amperes\n", + "u=J*10**3/pv #Drift velocity in m/s\n", + "\n", + "#Results\n", + "\n", + "print \"The charge density is \",pv,\"C/m^3\" \n", + "print \"The current density is \",J,\"kA/m^2\" \n", + "print \"The current is \",round(I,3), \"A\"\n", + "print \"The drift velocity is \",-u,\"m/s\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The charge density is -16000000000.0 C/m^3\n", + "The current density is 500.0 kA/m^2\n", + "The current is 0.393 A\n", + "The drift velocity is 3.125e-05 m/s\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.4, Page number: 170

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "l=4 #Length of the lead bar in m\n", + "d=3 #Width of the lead bar in cm\n", + "r=0.5 #Radius of the hole drilled in cm\n", + "sigma=5*10**6 #Conductivity of the bar in S/m\n", + "\n", + "#Calculation\n", + "\n", + "S=(d**2-(scipy.pi*r**2)) #Cross sectional area in cm^2\n", + "R=l/(S*sigma*10**-4) #Resistance in ohms\n", + "\n", + "#Result\n", + "\n", + "print 'The resistance between the square ends is',round(R*10**6),'micro ohms'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The resistance between the square ends is 974.0 micro ohms\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.6, Page number: 177

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "e0=10**-9/(36*scipy.pi) #permittivity of free space in Farad/m\n", + "er=2.55 #relative permittivity (dimensionless)\n", + "E=10*10**3 #Electric field in V/m\n", + "chi=er-1.0 #Electric susceptibility (dimensionless)\n", + "d=1.5 #Distance between plates in mm\n", + "\n", + "#Calculations\n", + "\n", + "D=e0*er*E*10**9 #D in nC/m^2\n", + "\n", + "P=chi*e0*E*10**9 #P in nC/m^2\n", + "\n", + "ps=D #The surface charge density of \n", + " #free charge in nC/m^2\n", + " \n", + "pps =P #The surface charge density of\n", + " #polarization charge in nC/m^2\n", + " \n", + "V=E*d*10**-3 #The potential difference between \n", + " #the plates in volts\n", + "\n", + "#Results\n", + "\n", + "print 'D =',round(D,2),'nC/m^2'\n", + "print 'P =',round(P,0),'nC/m^2'\n", + "print 'Surface charge density of free charge =',round(ps,2),'nC/m^2'\n", + "print 'Surface charge density of polarization charge =',round(pps,0),'nC/m^2'\n", + "print 'The potential difference between the plates =',V,'V'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "D = 225.47 nC/m^2\n", + "P = 137.0 nC/m^2\n", + "Surface charge density of free charge = 225.47 nC/m^2\n", + "Surface charge density of polarization charge = 137.0 nC/m^2\n", + "The potential difference between the plates = 15.0 V\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.7, Page number: 178

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "e0=10**-9/(36*scipy.pi) #permittivity of free space\n", + " #in Farad/m\n", + " \n", + "er=5.7 #relative permittivity\n", + " #(dimensionless)\n", + " \n", + "chi=er-1 #Electric susceptibility\n", + " #(dimensionless)\n", + " \n", + "r=0.1 #radius of sphere in m\n", + "\n", + "q1=2 #charge on sphere in pC\n", + "\n", + "q2=-4 #value of point charge in pC\n", + "\n", + "#Calculations\n", + "\n", + "E=q1/(4*scipy.pi*e0*er*r**2) #Electric field on the\n", + " #sphere in pV/m\n", + " \n", + "P=chi*e0*E #Polarisation in pC/m^2\n", + "\n", + "pps=P #The surface density of polarization \n", + " #charge in pC/m^2\n", + " \n", + "F=(q1*q2*10**-12)/(4*scipy.pi*e0*er*r**2) #Force exerted on point charge in pN\n", + "\n", + "#Results\n", + "\n", + "print 'The surface density of polarization'\n", + "print 'charge on the surface of the sphere =',round(pps,2),'pC/m^2'\n", + "print 'Force exerted on -4 pC charge =',round(F,3),'pN in the radial direction'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The surface density of polarization\n", + "charge on the surface of the sphere = 13.12 pC/m^2\n", + "Force exerted on -4 pC charge = -1.263 pN in the radial direction\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.9, Page number: 188

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#Variable Declarartion\n", + "\n", + "import scipy\n", + "from numpy import *\n", + "\n", + "an=array([0,0,1]) #Unit vector normal to the interface\n", + "E1=array([5,-2,3]) #Electric field for z >=0 in kV/m\n", + "e_r1=4 #Relative permittivity for z >=0 (dimensionless)\n", + "e_r2=3 #Relative permittivity for z <=0 (dimensionless)\n", + "e0=(10**-9)/(36*scipy.pi) #Permittivity of free space in Farad/m\n", + "V=2*2*2 #Volume of cube placed in region 2 in m^3\n", + "\n", + "#Calculations\n", + "\n", + "E1n=array([0,0,dot(E1,an)]) #The normal component of E1 in kV/m\n", + "E1t=E1-E1n #Transverse component of E1 in kV/m\n", + "E2t=E1t #Transverse component of E2 in kV/m\n", + "E2n=e_r1*E1n/e_r2 #Normal Component of E2 in kV/m\n", + "E2=E2n+E2t #The total field E2 in kV/m\n", + "\n", + "theta1= 90- 180*scipy.arccos(dot(E1,an)/ #Angle between E1 and \n", + " scipy.sqrt(dot(E1,E1)))/scipy.pi #interface in degrees\n", + " \n", + "theta2= 90- 180*scipy.arccos(dot(E2,an)/ #Angle between E2 and \n", + " scipy.sqrt(dot(E2,E2)))/scipy.pi #interface in degrees\n", + "\n", + "\n", + "We1= 0.5*e0*e_r1*dot(E1,E1)*10**6 # The energy density of E1 in J/m^3\n", + "We2= 0.5*e0*e_r2*dot(E2,E2)*10**6 # The energy density of E2 in J/m^3\n", + "W= We2*V # The energy within the cube in J\n", + "\n", + "#Results\n", + "\n", + "print 'The electric field for the region z <=0 is',E2,'kV/m'\n", + "print 'The angle E1 makes with the boundary is',round(theta1,1),'degrees'\n", + "print 'The angle E2 makes with the boundary is',round(theta2,1),'degrees'\n", + "print 'The energy density in dielectric 1 is',round(We1*10**6,0),'J/m^3'\n", + "print 'The energy density in dielectric 2 is',round(We2*10**6,0),'J/m^3'\n", + "print 'The energy within the cube is',round(W*1000,3),'mJ'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The electric field for the region z <=0 is [ 5 -2 4] kV/m\n", + "The angle E1 makes with the boundary is 29.1 degrees\n", + "The angle E2 makes with the boundary is 36.6 degrees\n", + "The energy density in dielectric 1 is 672.0 J/m^3\n", + "The energy density in dielectric 2 is 597.0 J/m^3\n", + "The energy within the cube is 4.775 mJ\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.10, Page number: 190

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "e=(10**-9)/(36*scipy.pi) #Permittivity of free space in Farad/m\n", + "er=2 #Relative permittivity (dimensionless)\n", + "ps=2 #Surface charge in nC/m^2\n", + "\n", + "#Calculations\n", + "\n", + "#Point A is in the region y <=0. Hence E=D=0\n", + "#For point B which is in the region y >=0,\n", + "\n", + "Dn=ps #Displacement current in nC/m^2\n", + "En=Dn*10**-9/(e*er) #Electric Field\n", + "\n", + "#Result\n", + "\n", + "print 'E at point A= 0'\n", + "print 'D at point A= 0'\n", + "print 'E at point B=',round(En,2),'V/m along positive y direction'\n", + "print 'D at point B=',Dn,'nC/m^2 along positive y direction'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "E at point A= 0\n", + "D at point A= 0\n", + "E at point B= 113.1 V/m along positive y direction\n", + "D at point B= 2 nC/m^2 along positive y direction\n" + ] + } + ], + "prompt_number": 8 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_6-checkpoint.ipynb b/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_6-checkpoint.ipynb new file mode 100644 index 00000000..2e3b83ef --- /dev/null +++ b/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_6-checkpoint.ipynb @@ -0,0 +1,78 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:0404b66522ba62c52bb8d112f6cb8c3bcc64527b3152c58a7bd723197eac9b68" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 6: Electrostatic Boundary Value Problems

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.12, Page number: 238

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "e0=10**-9/(36*scipy.pi) #Permittivity of free space in Farad/m\n", + "er1=4 #Relative permittivity of material 1 (dimensionless)\n", + "er2=6 #Relative permittivity of material 2 (dimensionless)\n", + "d=5*10** -3 #The spacing between the capacitor plates in m\n", + "S=30*10** -4 #The surface area of the plates\n", + "\n", + "#Calculations\n", + "\n", + "#Calculation for Capacitor 1\n", + "\n", + "C1=e0*er1*S*2/d #Capacitance in Farads\n", + "C2=e0*er2*S*2/d #Capacitance in Farads\n", + "Ca=C1*C2/(C1+C2) #Total capacitance in Farads\n", + "\n", + "#Calculation for Capacitor 2\n", + "\n", + "C1= e0*er1*S/(2*d) #Capacitance in Farads\n", + "C2= e0*er2*S/(2*d) #Capacitance in Farads\n", + "Cb= C1+C2 #Total capacitance in Farads\n", + "\n", + "\n", + "#Results\n", + "\n", + "print 'The capacitance of capacitor 1 =',round(Ca*10**12,2),'pF'\n", + "print 'The capacitance of capacitor 2 =',round(Cb*10**12,2),'pF'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The capacitance of capacitor 1 = 25.46 pF\n", + "The capacitance of capacitor 2 = 26.53 pF\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_7-checkpoint.ipynb b/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_7-checkpoint.ipynb new file mode 100644 index 00000000..d7af4c23 --- /dev/null +++ b/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_7-checkpoint.ipynb @@ -0,0 +1,212 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:07eafc200928a1fc85942d637323ac709731a49898cf69ec16ea9de55515ee47" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 7: Magnetostatic Fields

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.1, Page number: 266

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "p=5 #Distance from side 1 of loop to (0,0,5) in m\n", + "l=2 #Length of the side in m\n", + "I=10 #Current through loop in A\n", + "\n", + "#Calculation\n", + "\n", + "a1=scipy.arccos(l/(scipy.sqrt(l**2+p**2))) #Angle in radians\n", + "a2=scipy.pi/2 #Angle in radians\n", + "H=I*(scipy.cos(a1)-scipy.cos(a2))/(4*scipy.pi*p) #Field Intensity in A/m\n", + "\n", + "#Result\n", + "\n", + "print 'H=',round(H*1000,1),'mA/m in the negative y direction'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "H= 59.1 mA/m in the negative y direction\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.2, Page number: 268

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "ax=array([1,0,0]) #Unit vector along x direction\n", + "ay=array([0,1,0]) #Unit vector along y direction\n", + "az=array([0,0,1]) #Unit vector along z direction\n", + "a1=scipy.arccos(0)\n", + "a2=scipy.arccos(1)\n", + "b1=scipy.arccos(0.6)\n", + "b2=scipy.arccos(1)\n", + "p1=5\n", + "p2=4\n", + "I1=3 #current in A\n", + "I2=3 #current in A\n", + "\n", + "#Calculations\n", + "\n", + "Hz=I1/(4*scipy.pi*p1)*(cos(a2)-cos(a1))*array([0.8,0.6,0])\n", + "Hx=I2/(4*scipy.pi*p2)*(cos(b2)-cos(b1))*array([0,0,1])\n", + "Hzcyl=-I1/(4*scipy.pi*p1)*array([0,1,0])\n", + "Hzx=round(dot(Hz,ax),4)\n", + "Hzy=round(dot(Hz,ay),5)\n", + "Hxz=round(dot(Hx,az),5)\n", + "Hxr=array([0,0,Hxz])\n", + "Hzr=array([Hzx,Hzy,0])\n", + "Hzcyly=round(dot(Hzcyl,ay),5)\n", + "Hzcylr=array([0,Hzcyly,0])\n", + "Hcart=(Hxr+Hzr)*10**3 #H in cartesian coordinates in mA \n", + "Hcyl=(Hxr+Hzcylr)*10**3 #H in cylindrical coordinates in mA\n", + "\n", + "#Result\n", + "\n", + "print 'H at (-3, 4, 0) in cartesian coordnates =',Hcart,'mA/m'\n", + "print 'H at (-3, 4, 0) in cylindrical coordnates =',Hcyl,'mA/m'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "H at (-3, 4, 0) in cartesian coordnates = [ 38.2 28.65 23.87] mA/m\n", + "H at (-3, 4, 0) in cylindrical coordnates = [ 0. -47.75 23.87] mA/m\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.5, Page number: 279

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#Variable Declaration\n", + "\n", + "i0=-10 #current through plane z=0 in A/m\n", + "i4=10 #current through plane z=4 in A/m\n", + "\n", + "#Calculations\n", + "\n", + "H0a=0.5*i0*-1 #H in positive Y direction in A/m\n", + "H4a=0.5*i4*-1*-1 #H in positive Y direction in A/m\n", + "Ha=H0a+H4a #H at (1,1,1) in A/m \n", + "H0b=0.5*i0*-1 #H in positive Y direction in A/m\n", + "H4b=0.5*i4*-1 #H in negative Y direction in A/m\n", + "Hb=H0b+H4b #H at (0,-3,10) in A/m\n", + "\n", + "#Results\n", + "\n", + "print 'H at (1,1,1) =',Ha,'A/m'\n", + "print 'H at (0,-3,10) =',Hb,'A/m'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "H at (1,1,1) = 10.0 A/m\n", + "H at (0,-3,10) = 0.0 A/m\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.7, Page number: 287

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "import scipy.integrate\n", + "\n", + "#Calculation\n", + "\n", + "def B(z,p): \n", + " return 0.5*p\n", + "psy, err = scipy.integrate.dblquad(lambda p , z: B(z,p), \n", + " 0, 5, lambda p: 1, lambda p: 2)\n", + "\n", + "#Result\n", + "\n", + "print 'Total magnetic flux crossing the surface phi=pi/2 is',psy,'Wb'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total magnetic flux crossing the surface phi=pi/2 is 3.75 Wb\n" + ] + } + ], + "prompt_number": 4 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_8-checkpoint.ipynb b/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_8-checkpoint.ipynb new file mode 100644 index 00000000..b1d61d92 --- /dev/null +++ b/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_8-checkpoint.ipynb @@ -0,0 +1,421 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:3a0360df3c22e5e4c6f88ae6f9ab32945c496822bb8898446d53149d9f1116ec" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 8: Magnetic Forces, Materials and Devices

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.1, Page number: 308

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import scipy\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "m=2 #mass in kg\n", + "q=3 #charge in C\n", + "v=array([4,0,3]) #initial velocity in m/s\n", + "E=array([12,10,0]) #electric field in V/m\n", + "t=1 #time in sec\n", + "\n", + "#Calculations\n", + "\n", + "a=q*E/m #acceleration in m/s^2 after 1 sec\n", + "u=array([18*t+4,15*t,3]) #velocity in m/s after 1 sec\n", + "modofu=scipy.sqrt(dot(u,u))\n", + "KE=0.5*m*(modofu)**2 #kinetic energy in J at t=1 sec\n", + "s=array([9*t**2+4*t+1,7.5*t**2-2,3*t]) #position after 1 sec in m\n", + "\n", + "#Results\n", + "\n", + "print 'At time t=1 sec,'\n", + "print' The acceleration of the particle =',a,'m/s^2'\n", + "print 'Its velocity =',u,'m/s' \n", + "print 'Its kinetic energy =',KE,'J'\n", + "print 'Its position =',s,'m'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "At time t=1 sec,\n", + " The acceleration of the particle = [18 15 0] m/s^2\n", + "Its velocity = [22 15 3] m/s\n", + "Its kinetic energy = 718.0 J\n", + "Its position = [ 14. 5.5 3. ] m\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.6, Page number: 322" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "ar=array([1,0,0]) #Unit vector along radial direction\n", + "ath=array([0,1,0]) #Unit vector along theta direction\n", + "aph=array([0,0,1]) #Unit vector along phi direction \n", + "x=4\n", + "y=-3\n", + "z=10\n", + "muo=4*scipy.pi*10**-7 #permeability of free space\n", + "m1=5 #magnetic moment in A/m^2\n", + "\n", + "#Calculations\n", + "\n", + "r=scipy.sqrt(x**2+y**2+z**2)\n", + "p=scipy.sqrt(x**2+y**2)\n", + "sinphi=y/p\n", + "cosphi=x/p\n", + "sintheta=1/scipy.sqrt(5)\n", + "costheta=2/scipy.sqrt(5)\n", + "B1=muo*m1*(2*costheta*ar+sintheta*ath)/(4*scipy.pi*r**3)\n", + "m2=3*(sintheta*sinphi*ar+costheta*sinphi*ath+cosphi*aph)\n", + "T2=cross(m2,B1)*10**9\n", + "T2x=round(dot(T2,ar),3)\n", + "T2y=round(dot(T2,ath),3)\n", + "T2z=round(dot(T2,aph),3)\n", + "T2r=array([T2x,T2y,T2z]) #torque in nNm\n", + "\n", + "#Result\n", + "\n", + "print 'Torque T2 =',T2r,'nNm'\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Torque T2 = [-0.384 1.536 0.902]\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.7, Page number: 330" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "muo=4*scipy.pi*10**-7 #permeability of free space\n", + "mur=2 #relative permeability\n", + "ax=array([1,0,0]) #Unit vector along x direction\n", + "ay=array([0,1,0]) #Unit vector along y direction\n", + "az=array([0,0,1]) #Unit vector along z direction\n", + "\n", + "\n", + "#Calculations\n", + "\n", + "J=(-5-10)*10**-6/(4*scipy.pi*10**-7*2.5) #in kA/m^2\n", + "Jb=1.5*J #in kA/m^2\n", + "MbyB=(1.5)*10**4/(4*scipy.pi*2.5) \n", + "Mv=MbyB*10*10**-3*ax+MbyB*5*10**-3*ay\n", + "Kb=cross(az,Mv)\n", + "\n", + "#Results\n", + "\n", + "print 'J =',round(J,3),'kA/m^2'\n", + "print 'Jb =',round(Jb,3),'kA/m^2'\n", + "print 'M =(',round(dot(Mv,ax),3),'y,',round(dot(Mv,ay),3),'x, 0) kA/m'\n", + "print 'Kb =(',round(dot(Kb,ax),3),'x,',round(dot(Kb,ay),3),'y, 0) kA/m' \n", + " \n", + "\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "J = -4.775 kA/m^2\n", + "Jb = -7.162 kA/m^2\n", + "M =( 4.775 y, 2.387 x, 0) kA/m\n", + "Kb =( -2.387 x, 4.775 y, 0) kA/m\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.8, Page number: 332

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "ax=array([1,0,0]) #Unit vector along x direction\n", + "ay=array([0,1,0]) #Unit vector along y direction\n", + "az=array([0,0,1]) #Unit vector along z direction \n", + "H1=array([-2,6,4]) #in A/m\n", + "mu0=4*scipy.pi*10**-7 #permeability of free space\n", + "mur1=5 #relative permeabililty in region 1\n", + "mur2=2 #relative permeabililty in region 2\n", + "an=array([-1,1,0])/scipy.sqrt(2)\n", + "\n", + "#Calculatios\n", + "\n", + "mu1=mu0*mur1\n", + "mu2=mu0*mur2\n", + "M1=(mur1-1)*H1 # magnetisation in region 1 in A/m\n", + "B1=mu1*H1*10**6 # field in micro Wb/m^2\n", + "B1x=round(dot(B1,ax),2) # x component of B1\n", + "B1y=round(dot(B1,ay),1) # y component of B1\n", + "B1z=round(dot(B1,az),2) # z component of B1\n", + "B1r=array([B1x,B1y,B1z]) # B1 rounded to 2 decimal places\n", + "H1n=dot(H1,an)*an \n", + "H1t=H1-H1n\n", + "H2t=H1t # using transverse boundary condition\n", + "H2n=(mu1/mu2)*H1n # using normal boundary condition\n", + "H2=H2t+H2n # in A/m\n", + "B2=mu2*H2*10**6 # field in micro Wb/m^2\n", + "B2x=round(dot(B2,ax),2) # x component of B2\n", + "B2y=round(dot(B2,ay),2) # y component of B2\n", + "B2z=round(dot(B2,az),2) # z component of B2\n", + "B2r=array([B2x,B2y,B2z]) # B2 rounded to 2 decimal places\n", + "\n", + "#Results\n", + "\n", + "print 'M1= ',M1,'A/m'\n", + "print 'B1= ',B1r,'micro Wb/m^2'\n", + "print 'H2= ',H2,'A/m'\n", + "print 'B2= ',B2r,'micro Wb/m^2'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "M1= [-8 24 16] A/m\n", + "B1= [-12.57 37.7 25.13] micro Wb/m^2\n", + "H2= [ -8. 12. 4.] A/m\n", + "B2= [-20.11 30.16 10.05] micro Wb/m^2\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.14, Page number: 350

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "from numpy import *\n", + "\n", + "#Variable declaration\n", + "\n", + "p=10*10**-2 #in m\n", + "a=1*10**-2 #in m\n", + "Ur=1000 #relative permeability\n", + "Uo=4*scipy.pi*10**-7 #permeability of free space\n", + "n=200 #number of turns\n", + "phi=0.5*10**-3 #flux in the core in Wb\n", + "U=Uo*Ur #permeability of steel core\n", + "\n", + "#Calculation\n", + "\n", + "I=phi*2*scipy.pi*p/(U*n*scipy.pi*a*a) #current in A\n", + "\n", + "#Result\n", + "\n", + "print 'The current that will produce a flux of 0.5 mWb =',round(I,3),'A'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The current that will produce a flux of 0.5 mWb = 3.979 A\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.15, Page number: 351

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "import scipy\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "Uo=4*scipy.pi*10**-7 #permeability of free space\n", + "Ur=50 #relative permeability of coil\n", + "l1=30*10**-2\n", + "s=10*10**-4 \n", + "l3=9*10**-2\n", + "la=1*10**-2 \n", + "B=1.5 #flux density in Wb/m^2\n", + "N=400 #number of turns\n", + "\n", + "#Calculations\n", + "\n", + "R1=l1/(Uo*Ur*s)\n", + "R2=R1\n", + "R3=l3/(Uo*Ur*s)\n", + "Ra=la/(Uo*s)\n", + "R=R1*R2/(R1+R2)\n", + "Req=R3+Ra+R\n", + "I=B*s*Req/N #current in A\n", + "\n", + "#Result\n", + "\n", + "print 'The current required =',round(I,3),'A'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The current required = 44.165 A\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.16, Page number: 353

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "import scipy\n", + "from numpy import *\n", + "\n", + "#Variable Declaration\n", + "\n", + "m=400 #mass in kg\n", + "g=9.8 #acceleration due to gravity in m/s^2\n", + "Ur=3000 #relative permeability of the iron yoke\n", + "Uo=4*scipy.pi*10**-7 #permeability of free space\n", + "S=40*10**-4 #cross sectional area of iron yoke in m^2\n", + "la=1*10**-4 #air gaps in m\n", + "li=50*10**-2 #mean length of yoke in m\n", + "I=1 #excitation current in A \n", + "\n", + "#Calculations\n", + "\n", + "B=scipy.sqrt(m*g*Uo/S) #field in Wb/m^2\n", + "Ra=2*la/(Uo*S) \n", + "Ri=li/(Uo*Ur*S) \n", + "N=(Ra+Ri)/(Ra*Uo)*B*la #number of turns\n", + "\n", + "#Result\n", + "\n", + "print 'The nmber of turns in the coil when the excitation current is 1 A ='\n", + "print round(N,0)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The nmber of turns in the coil when the excitation current is 1 A =\n", + "162.0\n" + ] + } + ], + "prompt_number": 5 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_9-checkpoint.ipynb b/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_9-checkpoint.ipynb new file mode 100644 index 00000000..3bdc4e61 --- /dev/null +++ b/Elements_of_Electromagnetics/.ipynb_checkpoints/chapter_9-checkpoint.ipynb @@ -0,0 +1,186 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:25d377db4166fc7d1439fb19889672d7cd5de596e5478e8198d3671878cf5493" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 9: Maxwells Equations

" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.1, Page number: 375" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "import scipy.integrate\n", + "\n", + "#Variable Declaration\n", + "\n", + "u2=20\n", + "B2=4\n", + "l=0.06\n", + "#Calculations\n", + "\n", + "def ansa(x,y): \n", + " return 4*10**3\n", + "Va, erra = scipy.integrate.dblquad(lambda y , x: ansa(x,y), #in V \n", + " 0, 0.06, lambda y: 0, lambda y: 0.08)\n", + "\n", + "Vb=-u2*B2*l #in mV\n", + "\n", + "def ansc(x,y): \n", + " return 4\n", + "psic, errc = scipy.integrate.dblquad(lambda y , x: ansc(x,y), #in mWb \n", + " 0, 0.06, lambda y: 0, lambda y: 1)\n", + "\n", + "#Results\n", + "\n", + "print 'Va =',Va,'sin(10^6t) V'\n", + "print 'Vb =',Vb,'mV'\n", + "print 'Vc= ',psic*10**3,'cos(10^6t-y) -',psic*10**3,'cos(10^6t) V'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Va = 19.2 sin(10^6t) V\n", + "Vb = -4.8 mV\n", + "Vc= 240.0 cos(10^6t-y) - 240.0 cos(10^6t) V\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.3, Page number: 379" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "\n", + "#Variable Declaration\n", + "\n", + "n1=200\n", + "n2=100 \n", + "S=10**-3 #cross section in m^2\n", + "muo=4*scipy.pi*10**-7 #permeabiility of free space\n", + "mur=500 #relative permeability\n", + "r=10*10**-3 #radius in m\n", + "\n", + "#Calculations\n", + "\n", + "psiI=n1*muo*mur*S/(2*scipy.pi*r)\n", + "\n", + "#Result\n", + "\n", + "print 'V2 =',psiI*n2*300*scipy.pi,'cos(100pi t) V'\n", + "print '= 6Pi cos(100pi t) V'\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "V2 = 188.495559215 cos(100pi t) V\n", + "= 6Pi cos(100pi t) V\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.5, Page number: 393

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import scipy\n", + "import cmath\n", + "from numpy import *\n", + "\n", + "\n", + "#Variable Declaration\n", + "\n", + "z3=1j\n", + "z4=3+4j \n", + "z5=-1+6j \n", + "z6=3+4j\n", + "z7=1+1j\n", + "z8=4-8j\n", + "\n", + "#Calculations\n", + "\n", + "z1=(z3*z4/(z5*z6))\n", + "z2=scipy.sqrt(z7/z8)\n", + "z1r=round(z1.real,4) #real part of z1 rounded to 4 decimal places\n", + "z1i=round(z1.imag,4) #imaginary part of z1 rounded to 4 decimal places\n", + "z2r=round(z2.real,4) #real part of z2 rounded to 4 decimal places\n", + "z2i=round(z2.imag,4) #imaginary part of z2 rounded to 4 decimal places\n", + "\n", + "absz2=round(abs(z2),4) #absolute value of z2 rounded to 4 decimal places\n", + "\n", + "ang=scipy.arctan(z2i/z2r)*180/scipy.pi #in degrees\n", + "\n", + "#Results\n", + "\n", + "print 'z1 =',z1r,'+',z1i,'j'\n", + "print 'z2 ='\n", + "print 'mod =',absz2,'and angle=',round(ang,1),'degrees'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "z1 = 0.1622 + -0.027 j\n", + "z2 =\n", + "mod = 0.3976 and angle= 54.2 degrees\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch10-checkpoint.ipynb b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch10-checkpoint.ipynb new file mode 100644 index 00000000..5fe24819 --- /dev/null +++ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch10-checkpoint.ipynb @@ -0,0 +1,886 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:4bd71e2ab98c0a521e91d96198885bb27706ae6b8dac798e4a3c45fec0a13869" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 10" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.1:page no:101" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Ratio:\n", + " def __init__(self):\n", + " self.num = 0\n", + " self.den = 0\n", + " def assign(self,n,d):\n", + " self.num = n\n", + " self.den = d\n", + " def convert(self):\n", + " return float(self.num)/self.den\n", + " def invert(self):\n", + " self.num,self.den = self.den,self.num\n", + " def print_(self):\n", + " print self.num , '/' , self.den ,\n", + " \n", + "x = Ratio()\n", + "x.assign(22,7)\n", + "print \"x = \",\n", + "x.print_()\n", + "print \" = \" , x.convert() \n", + "x.invert()\n", + "print \"1/x = \",\n", + "x.print_()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = 22 / 7 = 3.14285714286\n", + "1/x = 7 / 22\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.2:page no:102" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Ratio:\n", + " def __init__(self):\n", + " self.num = 0\n", + " self.den = 0\n", + " def assign(self,n,d):\n", + " self.num = n\n", + " self.den = d\n", + " def convert(self):\n", + " return float(self.num)/self.den\n", + " def invert(self):\n", + " self.num,self.den = self.den,self.num\n", + " def print_(self):\n", + " print self.num , '/' , self.den ,\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.3:page no:103" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Ratio:\n", + " def __init__(self,n,d):\n", + " self.num = n\n", + " self.den = d\n", + " def print_(self):\n", + " print self.num , '/' , self.den ,\n", + "\n", + "x = Ratio(-1,3)\n", + "y = Ratio(22,7)\n", + "print \"x = \",\n", + "x.print_()\n", + "print \" and y = \",\n", + "y.print_()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = -1 / 3 and y = 22 / 7\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.4:page no:105" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Ratio:\n", + " def __init__(self,n=None,d=None):\n", + " if n==None:\n", + " self.num = 0\n", + " self.den = 1\n", + " elif d==None:\n", + " self.num = n\n", + " self.den = 1\n", + " else:\n", + " self.num = n\n", + " self.den = d\n", + " def print_(self):\n", + " print self.num , '/' , self.den ,\n", + "\n", + "x = Ratio()\n", + "y = Ratio(4)\n", + "z = Ratio(22,7)\n", + "print \"x = \",\n", + "x.print_()\n", + "print \"\\ny = \",\n", + "y.print_()\n", + "print \"\\nz = \",\n", + "z.print_()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = 0 / 1 \n", + "y = 4 / 1 \n", + "z = 22 / 7\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.5:page no:105" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Ratio:\n", + " def __init__(self,n=None,d=None):\n", + " if n==None:\n", + " self.num = 0\n", + " self.den = 1\n", + " elif d==None:\n", + " self.num = n\n", + " self.den = 1\n", + " else:\n", + " self.num = n\n", + " self.den = d\n", + " def print_(self):\n", + " print self.num , '/' , self.den ,\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.6:page no:106" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Ratio:\n", + " def __init__(self,n=0,d=1):\n", + " self.num = n\n", + " self.den = d\n", + " def print_(self):\n", + " print self.num , '/' , self.den ,\n", + "\n", + "\n", + "x = Ratio()\n", + "y = Ratio(4)\n", + "z = Ratio(22,7)" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.7:page no:106" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Ratio:\n", + " def __init__(self,n=0,d=1):\n", + " self.num = n\n", + " self.den = d\n", + " def numerator(self):\n", + " return self.num\n", + " def denominator(self):\n", + " return self.den\n", + " def print_(self):\n", + " print self.num , '/' , self.den ,\n", + "\n", + "\n", + "x = Ratio(22,7)\n", + "print x.numerator() , '/' , x.denominator() " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "22 / 7\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.8:page no:106" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def gcd(m,n):\n", + " # returns the greatest common divisor of m and n:\n", + " if (m0):\n", + " r = m % n\n", + " m = n\n", + " n = r\n", + " return m\n", + "\n", + "class Ratio:\n", + " def __init__(self,n=0,d=1):\n", + " self.num = n\n", + " self.den = d\n", + " self.reduce()\n", + " def numerator(self):\n", + " return self.num\n", + " def denominator(self):\n", + " return self.den\n", + " def print_(self):\n", + " print self.num , '/' , self.den ,\n", + "\n", + " def reduce(self):\n", + " # enforce invariant(den > 0):\n", + " if (self.num == 0 or self.den == 0):\n", + " self.num = 0\n", + " self.den = 1\n", + " return\n", + " if (self.den < 0):\n", + " self.den *= -1\n", + " self.num *= -1\n", + " # enforce invariant(gcd(num,den) == 1):\n", + " if (self.den == 1):\n", + " return\n", + " # it's already reduced\n", + " sgn = 0\n", + " if self.num < 0:\n", + " sgn = -1\n", + " else:\n", + " sgn = 1\n", + " g = gcd(sgn*self.num,self.den)\n", + " self.num /= g\n", + " self.den /= g\n", + "\n", + "x = Ratio(100,-360)\n", + "x.print_()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "-5 / 18\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.9:page no:107" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def gcd(m,n):\n", + " # returns the greatest common divisor of m and n:\n", + " if (m0):\n", + " r = m % n\n", + " m = n\n", + " n = r\n", + " return m\n", + "\n", + "class Ratio:\n", + " def __init__(self,n=0,d=None):\n", + " if d == None:\n", + " self.num = n.num\n", + " self.den = n.den\n", + " else: \n", + " self.num = n\n", + " self.den = d\n", + " self.reduce()\n", + " def numerator(self):\n", + " return self.num\n", + " def denominator(self):\n", + " return self.den\n", + " def print_(self):\n", + " print self.num , '/' , self.den ,\n", + "\n", + " def reduce(self):\n", + " # enforce invariant(den > 0):\n", + " if (self.num == 0 or self.den == 0):\n", + " self.num = 0\n", + " self.den = 1\n", + " return\n", + " if (self.den < 0):\n", + " self.den *= -1\n", + " self.num *= -1\n", + " # enforce invariant(gcd(num,den) == 1):\n", + " if (self.den == 1):\n", + " return\n", + " # it's already reduced\n", + " sgn = 0\n", + " if self.num < 0:\n", + " sgn = -1\n", + " else:\n", + " sgn = 1\n", + " g = gcd(sgn*self.num,self.den)\n", + " self.num /= g\n", + " self.den /= g\n", + "\n", + "x = Ratio(100,360)\n", + "y = Ratio(x)\n", + "print \"x = \",\n", + "x.print_()\n", + "print \"y = \",\n", + "y.print_()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = 5 / 18 y = 5 / 18\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.10:page no:107" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def gcd(m,n):\n", + " # returns the greatest common divisor of m and n:\n", + " if (m0):\n", + " r = m % n\n", + " m = n\n", + " n = r\n", + " return m\n", + "\n", + "class Ratio:\n", + " def __init__(self,n=0,d=None):\n", + " if d == None:\n", + " print \"COPY CONSTRUCTOR CALLED\"\n", + " self.num = n.num\n", + " self.den = n.den\n", + " else: \n", + " self.num = n\n", + " self.den = d\n", + " self.reduce()\n", + " def numerator(self):\n", + " return self.num\n", + " def denominator(self):\n", + " return self.den\n", + " def print_(self):\n", + " print self.num , '/' , self.den ,\n", + "\n", + " def reduce(self):\n", + " # enforce invariant(den > 0):\n", + " if (self.num == 0 or self.den == 0):\n", + " self.num = 0\n", + " self.den = 1\n", + " return\n", + " if (self.den < 0):\n", + " self.den *= -1\n", + " self.num *= -1\n", + " # enforce invariant(gcd(num,den) == 1):\n", + " if (self.den == 1):\n", + " return\n", + " # it's already reduced\n", + " sgn = 0\n", + " if self.num < 0:\n", + " sgn = -1\n", + " else:\n", + " sgn = 1\n", + " g = gcd(sgn*self.num,self.den)\n", + " self.num /= g\n", + " self.den /= g\n", + "\n", + "def f(r):\n", + " s = Ratio(r)\n", + "\n", + "x = Ratio(22,7)\n", + "y = Ratio(x) #calls the copy constructor, copying x to y\n", + "f(y)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "COPY CONSTRUCTOR CALLED\n", + "COPY CONSTRUCTOR CALLED\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.11:page no:107" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Ratio:\n", + " def __init__(self):\n", + " print \"OBJECT IS BORN.\"\n", + " def __del__(self):\n", + " print \"OBJECT DIES.\"\n", + "\n", + "x = Ratio()\n", + "print \"Now x is alive.\"\n", + "print \"Now between blocks.\"\n", + "y = Ratio()\n", + "print \"Now y is alive.\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "OBJECT IS BORN.\n", + "Now x is alive.\n", + "Now between blocks.\n", + "OBJECT IS BORN.\n", + "Now y is alive.\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.12:page no:108" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class X:\n", + " def __init(self):\n", + " data = 0\n", + "\n", + "p = X()\n", + "p.data = 22\n", + "print \"p.data = \" , p.data , \" = \" , p.data\n", + "p.data = 44\n", + "print \" p.data = \" , p.data , \" = \" , p.data " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "p.data = 22 = 22\n", + " p.data = 44 = 44\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.13:page no:108" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Node:\n", + " def __init__(self,d,q=None):\n", + " self.data = d\n", + " self.next = q\n", + "\n", + "n = int(raw_input())\n", + "q = Node(n)\n", + "while True:\n", + " n = int(raw_input())\n", + " if n<=0:\n", + " break\n", + " p = Node(n, q)\n", + " q = p\n", + "k = p\n", + "while k != None:\n", + " print k.data , '->' , \n", + " k = k.next\n", + "print '*'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "22\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "33\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "44\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "66\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "77\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "77 -> 66 -> 55 -> 44 -> 33 -> 22 -> *\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.14:page no:108" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "count = 0\n", + "class Widget:\n", + " def __init__(self):\n", + " global count\n", + " count += 1\n", + " \n", + "w = Widget()\n", + "x = Widget()\n", + "print \"Now there are \" , count , 'widgets'\n", + "if True:\n", + " w = Widget()\n", + " x = Widget()\n", + " y = Widget()\n", + " z = Widget()\n", + " print \"Now there are\" , count , 'widgets' \n", + "print \"Now there are \" , count , 'widgets'\n", + "y = Widget()\n", + "print \"Now there are \" , count , 'widgets'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "OBJECT DIES.\n", + "Now there are 2 widgets\n", + "OBJECT DIES.\n", + "Now there are 6 widgets\n", + "Now there are 6 widgets\n", + "Now there are 7 widgets\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.15:page no:109" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "count = 0\n", + "class Widget:\n", + " def __init__(self):\n", + " global count\n", + " count += 1\n", + " def numWidgets(self):\n", + " global count\n", + " return count\n", + " \n", + "w = Widget()\n", + "x = Widget()\n", + "print \"Now there are \" , w.numWidgets() , 'widgets'\n", + "if True:\n", + " w = Widget()\n", + " x = Widget()\n", + " y = Widget()\n", + " z = Widget()\n", + " print \"Now there are\" , w.numWidgets() , 'widgets' \n", + "print \"Now there are \" , w.numWidgets() , 'widgets'\n", + "y = Widget()\n", + "print \"Now there are \" , w.numWidgets() , 'widgets'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Now there are 2 widgets\n", + "Now there are 6 widgets\n", + "Now there are 6 widgets\n", + "Now there are 7 widgets\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.16:page no:109" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "count = 0\n", + "class Widget:\n", + " def __init__(self):\n", + " global count\n", + " count += 1\n", + " def numWidgets(self):\n", + " global count\n", + " return count\n", + " \n", + "w = Widget()\n", + "x = Widget()\n", + "print \"Now there are \" , w.numWidgets() , 'widgets'\n", + "if True:\n", + " w = Widget()\n", + " x = Widget()\n", + " y = Widget()\n", + " z = Widget()\n", + " print \"Now there are\" , w.numWidgets() , 'widgets' \n", + "print \"Now there are \" , w.numWidgets() , 'widgets'\n", + "y = Widget()\n", + "print \"Now there are \" , w.numWidgets() , 'widgets'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Now there are 2 widgets\n", + "Now there are 6 widgets\n", + "Now there are 6 widgets\n", + "Now there are 7 widgets\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch11-checkpoint.ipynb b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch11-checkpoint.ipynb new file mode 100644 index 00000000..316c5977 --- /dev/null +++ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch11-checkpoint.ipynb @@ -0,0 +1,798 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:2e5aa5b3434352a0b9d6ebcbf16a1ff4cc5f7498207ae522537459300ba1cc0b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 11" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.1,page no:111" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Ratio:\n", + " def __init__(self,n=None,d=None):\n", + " if d==None:\n", + " self.num = n.num\n", + " self.den = n.den\n", + " elif n==None:\n", + " self.num = 0\n", + " self.den = 1\n", + " else:\n", + " self.num = n\n", + " self.den = d\n", + " \n", + " def equals(self):\n", + " return self # retuns calling object." + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.2,page no:112" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Ratio:\n", + " def __init__(self,n=None,d=None):\n", + " pass\n", + " \n", + " def equals(self):\n", + " pass\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.3,page no:113" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Ratio:\n", + " def __init__(self,n=None,d=None):\n", + " if d==None:\n", + " self.num = n.num\n", + " self.den = n.den\n", + " elif n==None:\n", + " self.num = 0\n", + " self.den = 1\n", + " else:\n", + " self.num = n\n", + " self.den = d\n", + " \n", + "\n", + "z = Ratio(22,7)\n", + "y = z\n", + "x = z\n", + "\n", + "x = Ratio(22,7)\n", + "y = Ratio(x)\n", + "z = x\n", + "w = x" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.4,page no:114" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Ratio:\n", + " def __init__(self,n=None,d=None):\n", + " self.num = n\n", + " self.den = d\n", + " def __mul__(self,y):\n", + " pass\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.5,page no:115" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def gcd(m,n):\n", + " # returns the greatest common divisor of m and n:\n", + " if (m0):\n", + " r = m % n\n", + " m = n\n", + " n = r\n", + " return m\n", + "\n", + "\n", + "class Ratio:\n", + " def __init__(self,n=None,d=None):\n", + " self.num = n\n", + " self.den = d\n", + " self.reduce()\n", + " def __mul__(self,y):\n", + " z = Ratio(self.num * y.num, self.den * y.den)\n", + " return z\n", + " def print_(self):\n", + " print self.num , '/', self.den\n", + " \n", + " def reduce(self):\n", + " # enforce invariant(den > 0):\n", + " if (self.num == 0 or self.den == 0):\n", + " self.num = 0\n", + " self.den = 1\n", + " return\n", + " if (self.den < 0):\n", + " self.den *= -1\n", + " self.num *= -1\n", + " # enforce invariant(gcd(num,den) == 1):\n", + " if (self.den == 1):\n", + " return\n", + " # it's already reduced\n", + " sgn = 0\n", + " if self.num < 0:\n", + " sgn = -1\n", + " else:\n", + " sgn = 1\n", + " g = gcd(sgn*self.num,self.den)\n", + " self.num /= g\n", + " self.den /= g\n", + "x = Ratio(22,7)\n", + "y = Ratio(-3,8)\n", + "z = x\n", + "z.print_()\n", + "x = y*z\n", + "x.print_()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "22 / 7\n", + "-33 / 28\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.6,page no:115" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def gcd(m,n):\n", + " # returns the greatest common divisor of m and n:\n", + " if (m0):\n", + " r = m % n\n", + " m = n\n", + " n = r\n", + " return m\n", + "\n", + "\n", + "class Ratio:\n", + " def __init__(self,n=None,d=None):\n", + " self.num = n\n", + " self.den = d\n", + " self.reduce()\n", + " def __imul__(self,y):\n", + " self.num = self.num * y.num\n", + " self.den = self.den * y.den\n", + " def print_(self):\n", + " print self.num , '/', self.den" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.7,page no:115" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Ratio:\n", + " def __init__(self,n=None,d=None):\n", + " self.num = n\n", + " self.den = d\n", + " self.reduce()\n", + " def __imul__(self,y):\n", + " self.num = self.num * y.num\n", + " self.den = self.den * y.den\n", + " def __eq__(self,y):\n", + " return (x.num * y.den == y.num * x.den)\n", + " def print_(self):\n", + " print self.num , '/', self.den\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.8,page no:116" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Ratio:\n", + " def __init__(self,n=None,d=None):\n", + " self.num = n\n", + " self.den = d\n", + " def __imul__(self,y):\n", + " self.num = self.num * y.num\n", + " self.den = self.den * y.den\n", + " def __eq__(self,y):\n", + " return (x.num * y.den == y.num * x.den)\n", + " def print_(self):\n", + " print self.num , '/', self.den\n", + "\n", + "\n", + "x = Ratio(22,7)\n", + "y = Ratio(-3,8)\n", + "x.print_() , y.print_()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "22 / 7\n", + "-3 / 8\n" + ] + }, + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 8, + "text": [ + "(None, None)" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.9,page no:116" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def gcd(m,n):\n", + " # returns the greatest common divisor of m and n:\n", + " if (m0):\n", + " r = m % n\n", + " m = n\n", + " n = r\n", + " return m\n", + "class Ratio:\n", + " def __init__(self,n=0,d=1):\n", + " self.num = n\n", + " self.den = d\n", + " self.reduce()\n", + " def __mul__(self,y):\n", + " z = Ratio(self.num * y.num, self.den * y.den)\n", + " return z\n", + " def print_(self):\n", + " print self.num , '/', self.den\n", + " \n", + " def input(self):\n", + " self.num = int(raw_input('Numerator : '))\n", + " self.den = int(raw_input('Denominator : '))\n", + " self.reduce()\n", + " def reduce(self):\n", + " # enforce invariant(den > 0):\n", + " if (self.num == 0 or self.den == 0):\n", + " self.num = 0\n", + " self.den = 1\n", + " return\n", + " if (self.den < 0):\n", + " self.den *= -1\n", + " self.num *= -1\n", + " # enforce invariant(gcd(num,den) == 1):\n", + " if (self.den == 1):\n", + " return\n", + " # it's already reduced\n", + " sgn = 0\n", + " if self.num < 0:\n", + " sgn = -1\n", + " else:\n", + " sgn = 1\n", + " g = gcd(sgn*self.num,self.den)\n", + " self.num /= g\n", + " self.den /= g\n", + "\n", + "\n", + "x = Ratio()\n", + "y = Ratio()\n", + "x.input()\n", + "y.input()\n", + "x.print_()\n", + "y.print_()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Numerator : -10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Denominator : -24\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Numerator : 36\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Denominator : -20\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "5 / 12\n", + "-9 / 5\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.10,page no:116" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def gcd(m,n):\n", + " # returns the greatest common divisor of m and n:\n", + " if (m0):\n", + " r = m % n\n", + " m = n\n", + " n = r\n", + " return m\n", + "class Ratio:\n", + " def __init__(self,n=0,d=1):\n", + " self.num = n\n", + " self.den = d\n", + " self.reduce()\n", + " def __mul__(self,y):\n", + " z = Ratio(self.num * y.num, self.den * y.den)\n", + " return z\n", + " def print_(self):\n", + " print self.num , '/', self.den\n", + " \n", + " def input(self):\n", + " self.num = int(raw_input('Numerator : '))\n", + " self.den = int(raw_input('Denominator : '))\n", + " self.reduce()\n", + " def __float__(self):\n", + " return float(self.num)/self.den\n", + " def reduce(self):\n", + " # enforce invariant(den > 0):\n", + " if (self.num == 0 or self.den == 0):\n", + " self.num = 0\n", + " self.den = 1\n", + " return\n", + " if (self.den < 0):\n", + " self.den *= -1\n", + " self.num *= -1\n", + " # enforce invariant(gcd(num,den) == 1):\n", + " if (self.den == 1):\n", + " return\n", + " # it's already reduced\n", + " sgn = 0\n", + " if self.num < 0:\n", + " sgn = -1\n", + " else:\n", + " sgn = 15.py\n", + " g = gcd(sgn*self.num,self.den)\n", + " self.num /= g\n", + " self.den /= g\n", + "\n", + "x = Ratio(-5,8)\n", + "print \"x = \" , \n", + "x.print_() \n", + "print \", float(x) = \" , float(x) \n", + "P = Ratio(22,7)\n", + "PI = float(P)\n", + "print \"P = \" ,\n", + "P.print_() \n", + "print \", PI = \" , PI\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = -5 / 8\n", + ", float(x) = -0.625\n", + "P = 22 / 7\n", + ", PI = 3.14285714286\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.11,page no:117" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def gcd(m,n):\n", + " # returns the greatest common divisor of m and n:\n", + " if (m0):\n", + " r = m % n\n", + " m = n\n", + " n = r\n", + " return m\n", + "class Ratio:\n", + " def __init__(self,n=0,d=1):\n", + " self.num = n\n", + " self.den = d\n", + " self.reduce()\n", + " def __mul__(self,y):\n", + " z = Ratio(self.num * y.num, self.den * y.den)\n", + " return z\n", + " def print_(self):\n", + " print self.num , '/', self.den\n", + " \n", + " def __iadd__(self,n):\n", + " self.num += self.den\n", + " return self\n", + " def reduce(self):\n", + " # enforce invariant(den > 0):\n", + " if (self.num == 0 or self.den == 0):\n", + " self.num = 0\n", + " self.den = 1\n", + " return\n", + " if (self.den < 0):\n", + " self.den *= -1\n", + " self.num *= -1\n", + " # enforce invariant(gcd(num,den) == 1):\n", + " if (self.den == 1):\n", + " return\n", + " # it's already reduced\n", + " sgn = 0\n", + " if self.num < 0:\n", + " sgn = -1\n", + " else:\n", + " sgn = 1\n", + " g = gcd(sgn*self.num,self.den)\n", + " self.num /= g\n", + " self.den /= g\n", + "\n", + "x = Ratio(22,7)\n", + "x += 1\n", + "y = x\n", + "print \"y = \" ,\n", + "y.print_()\n", + "print \", x = \",\n", + "x.print_()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "y = 29 / 7\n", + ", x = 29 / 7\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.12,page no:117" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def gcd(m,n):\n", + " # returns the greatest common divisor of m and n:\n", + " if (m0):\n", + " r = m % n\n", + " m = n\n", + " n = r\n", + " return m\n", + "class Ratio:\n", + " def __init__(self,n=0,d=1):\n", + " self.num = n\n", + " self.den = d\n", + " self.reduce()\n", + " def __mul__(self,y):\n", + " z = Ratio(self.num * y.num, self.den * y.den)\n", + " return z\n", + " def print_(self):\n", + " print self.num , '/', self.den\n", + " \n", + " def __iadd__(self,n):\n", + " self.num += self.den\n", + " return self\n", + " def reduce(self):\n", + " # enforce invariant(den > 0):\n", + " if (self.num == 0 or self.den == 0):\n", + " self.num = 0\n", + " self.den = 1\n", + " return\n", + " if (self.den < 0):\n", + " self.den *= -1\n", + " self.num *= -1\n", + " # enforce invariant(gcd(num,den) == 1):\n", + " if (self.den == 1):\n", + " return\n", + " # it's already reduced\n", + " sgn = 0\n", + " if self.num < 0:\n", + " sgn = -1\n", + " else:\n", + " sgn = 1\n", + " g = gcd(sgn*self.num,self.den)\n", + " self.num /= g\n", + " self.den /= g\n", + "\n", + "x = Ratio(22,7)\n", + "y = Ratio(x.num,x.den)\n", + "x += 1\n", + "print \"y = \" ,\n", + "y.print_()\n", + "print \", x = \",\n", + "x.print_()\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "y = 22 / 7\n", + ", x = 29 / 7\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.13,page no:118" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def gcd(m,n):\n", + " # returns the greatest common divisor of m and n:\n", + " if (m0):\n", + " r = m % n\n", + " m = n\n", + " n = r\n", + " return m\n", + "class Ratio:\n", + " def __init__(self,n=0,d=1):\n", + " self.num = n\n", + " self.den = d\n", + " self.reduce()\n", + " def __mul__(self,y):\n", + " z = Ratio(self.num * y.num, self.den * y.den)\n", + " return z\n", + " def print_(self):\n", + " print self.num , '/', self.den\n", + " \n", + " def __getitem__(self,k):\n", + " if k == 1:\n", + " return self.num\n", + " else:\n", + " return self.den\n", + " def reduce(self):\n", + " # enforce invariant(den > 0):\n", + " if (self.num == 0 or self.den == 0):\n", + " self.num = 0\n", + " self.den = 1\n", + " return\n", + " if (self.den < 0):\n", + " self.den *= -1\n", + " self.num *= -1\n", + " # enforce invariant(gcd(num,den) == 1):\n", + " if (self.den == 1):\n", + " return\n", + " # it's already reduced\n", + " sgn = 0\n", + " if self.num < 0:\n", + " sgn = -1\n", + " else:\n", + " sgn = 1\n", + " g = gcd(sgn*self.num,self.den)\n", + " self.num /= g\n", + " self.den /= g\n", + "\n", + "x = Ratio(22,7)\n", + "print \"x = \" ,\n", + "x.print_()\n", + "print \"x[1] = \" , x[1] , \", x[2] = \" , x[2]\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = 22 / 7\n", + "x[1] = 22 , x[2] = 7\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch12-checkpoint.ipynb b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch12-checkpoint.ipynb new file mode 100644 index 00000000..ed6f662d --- /dev/null +++ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch12-checkpoint.ipynb @@ -0,0 +1,869 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:032ae59642dc41d08f8a2152ed2bc49f4d25ecde730526f089f073d2c1d499a2" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 12" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.1,page no:121" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Person:\n", + " def __init__(self,n=\"\",nat=\"U.S.A.\",s=1):\n", + " self.name = n\n", + " self.nationality = nat\n", + " self.sex = s\n", + "\n", + " def printName(self):\n", + " print self.name,\n", + " \n", + " def printNationality(self):\n", + " print self.nationality,\n", + "\n", + "creator = Person(\"Bjarne Stroustrup\", \"Denmark\")\n", + "print \"The creator of C++ was \" ,\n", + "creator.printName() \n", + "print \", who was born in \" ,\n", + "creator.printNationality() \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The creator of C++ was Bjarne Stroustrup , who was born in Denmark\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.2,page no:121" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Date:\n", + " def __init__(self,m=0,d=0,y=0):\n", + " self.month = m\n", + " self.day = d\n", + " self.year = y\n", + " \n", + " def setDate(self,m,d,y):\n", + " self.month = m\n", + " self.day = d\n", + " self.year = y\n", + " # Python doesn't have >> operator for input so we are just using input function\n", + " def input(self):\n", + " self.month = int(raw_input()) \n", + " self.day = int(raw_input())\n", + " self.year = int(raw_input()) \n", + " \n", + " # Python doesn't have << operator for output so we are just using print function\n", + " def print_(self):\n", + " monthName = [\"\", \"January\",\"February\",\"March\", \"April\", \"May\", \"June\",\\\n", + " \"July\", \"August\",\"September\", \"October\", \"November\",\\\n", + " \"December\"]\n", + " print monthName[self.month] , self.day , \",\" , self.year\n", + "\n", + "peace = Date(11,11,1918)\n", + "print \"World War I ended on \" ,\n", + "peace.print_()\n", + "peace.setDate(8,14,1945)\n", + "print \"World War II ended on \" ,\n", + "peace.print_()\n", + "print \"Enter month, day, and year: \"\n", + "date = Date()\n", + "date.input()\n", + "print \"The date is \" , \n", + "date.print_()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "World War I ended on November 11 , 1918\n", + "World War II ended on August 14 , 1945\n", + "Enter month, day, and year: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1976\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The date is July 4 , 1976\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.3,page no:122" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Date:\n", + " def __init__(self,m=0,d=0,y=0):\n", + " self.month = m\n", + " self.day = d\n", + " self.year = y\n", + " \n", + " def setDate(self,m,d,y):\n", + " self.month = m\n", + " self.day = d\n", + " self.year = y\n", + " # Python doesn't have >> operator for input so we are just using input function\n", + " def input(self):\n", + " self.month = int(raw_input()) \n", + " self.day = int(raw_input())\n", + " self.year = int(raw_input()) \n", + " \n", + " # Python doesn't have << operator for output so we are just using print function\n", + " def print_(self):\n", + " monthName = [\"\", \"January\",\"February\",\"March\", \"April\", \"May\", \"June\",\\\n", + " \"July\", \"August\",\"September\", \"October\", \"November\",\\\n", + " \"December\"]\n", + " print monthName[self.month] , self.day , \",\" , self.year\n", + "\n", + "class Person:\n", + " def __init__(self,n=\"\",s=0,nat=\"U.S.A.\"):\n", + " self.name = n\n", + " self.nationality = nat\n", + " self.sex = s\n", + " self.dob = Date()\n", + " self.dod = Date()\n", + " def setDOB(self,m,d,y):\n", + " self.dob.setDate(m,d,y)\n", + " def setDOD(self,m,d,y):\n", + " self.dod.setDate(m,d,y)\n", + " def printName(self):\n", + " print self.name,\n", + " def printNationality(self):\n", + " print self.nationality,\n", + " def printDOB(self):\n", + " self.dob.print_()\n", + " def printDOD(self):\n", + " self.dod.print_()\n", + "\n", + "author = Person(\"Thomas Jefferson\", 1)\n", + "author.setDOB(4,13,1743)\n", + "author.setDOD(7,4,1826)\n", + "print \"The author of the Declaration of Independence was \",\n", + "author.printName()\n", + "print \".\\nHe was born on \",\n", + "author.printDOB()\n", + "print \" and died on \",\n", + "author.printDOD()\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The author of the Declaration of Independence was Thomas Jefferson .\n", + "He was born on April 13 , 1743\n", + " and died on July 4 , 1826\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.4,page no:123" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Date:\n", + " def __init__(self,m=0,d=0,y=0):\n", + " self.month = m\n", + " self.day = d\n", + " self.year = y\n", + " \n", + " def setDate(self,m,d,y):\n", + " self.month = m\n", + " self.day = d\n", + " self.year = y\n", + " # Python doesn't have >> operator for input so we are just using input function\n", + " def input(self):\n", + " self.month = int(raw_input()) \n", + " self.day = int(raw_input())\n", + " self.year = int(raw_input()) \n", + " \n", + " # Python doesn't have << operator for output so we are just using print function\n", + " def print_(self):\n", + " monthName = [\"\", \"January\",\"February\",\"March\", \"April\", \"May\", \"June\",\\\n", + " \"July\", \"August\",\"September\", \"October\", \"November\",\\\n", + " \"December\"]\n", + " print monthName[self.month] , self.day , \",\" , self.year\n", + "\n", + "class Person:\n", + " def __init__(self,n=\"\",s=0,nat=\"U.S.A.\"):\n", + " self.name = n\n", + " self.nationality = nat\n", + " self.sex = s\n", + " self.dob = Date()\n", + " self.dod = Date()\n", + " def setDOB(self,m,d,y):\n", + " self.dob.setDate(m,d,y)\n", + " def setDOD(self,m,d,y):\n", + " self.dod.setDate(m,d,y)\n", + " def printName(self):\n", + " print self.name,\n", + " def printNationality(self):\n", + " print self.nationality,\n", + " def printDOB(self):\n", + " self.dob.print_()\n", + " def printDOD(self):\n", + " self.dod.print_()\n", + "\n", + "class Student(Person):\n", + " def __init__(self,n,s=0,i=\"\"):\n", + " Person.__init__(self,n,s)\n", + " self.id = i\n", + " self.credits = 0\n", + " self.gpa = 0\n", + " self.dom = Date()\n", + "\n", + " def setDOM(self,m,d,y):\n", + " self.dom.setDate(m, d, y)\n", + " def printDOM(self):\n", + " self.dom.print_()\n", + "\n", + "x = Student(\"Ann Jones\", 0, \"219360061\")\n", + "x.setDOB(5, 13, 1977)\n", + "x.setDOM(8, 29, 1995)\n", + "x.printName()\n", + "print \"\\n\\t Born: \" ,\n", + "x.printDOB()\n", + "print \"\\n\\tMatriculated: \",\n", + "x.printDOM()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Ann Jones \n", + "\t Born: May 13 , 1977\n", + "\n", + "\tMatriculated: August 29 , 1995\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.5,page no:124" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Date:\n", + " def __init__(self,m=0,d=0,y=0):\n", + " self.month = m\n", + " self.day = d\n", + " self.year = y\n", + " \n", + " def setDate(self,m,d,y):\n", + " self.month = m\n", + " self.day = d\n", + " self.year = y\n", + " # Python doesn't have >> operator for input so we are just using input function\n", + " def input(self):\n", + " self.month = int(raw_input()) \n", + " self.day = int(raw_input())\n", + " self.year = int(raw_input()) \n", + " \n", + " # Python doesn't have << operator for output so we are just using print function\n", + " def print_(self):\n", + " monthName = [\"\", \"January\",\"February\",\"March\", \"April\", \"May\", \"June\",\\\n", + " \"July\", \"August\",\"September\", \"October\", \"November\",\\\n", + " \"December\"]\n", + " print monthName[self.month] , self.day , \",\" , self.year\n", + "\n", + "class Person:\n", + " def __init__(self,n=\"\",s=0,nat=\"U.S.A.\"):\n", + " self.name = n\n", + " self.nationality = nat\n", + " self.sex = s\n", + " self.dob = Date()\n", + " self.dod = Date()\n", + " def setDOB(self,m,d,y):\n", + " self.dob.setDate(m,d,y)\n", + " def setDOD(self,m,d,y):\n", + " self.dod.setDate(m,d,y)\n", + " def printName(self):\n", + " print self.name,\n", + " def printNationality(self):\n", + " print self.nationality,\n", + " def printDOB(self):\n", + " self.dob.print_()\n", + " def printDOD(self):\n", + " self.dod.print_()\n", + "\n", + "class Student(Person):\n", + " def __init__(self,n,s=0,i=\"\"):\n", + " Person.__init__(self,n,s)\n", + " self.id = i\n", + " self.credits = 0\n", + " self.gpa = 0\n", + " self.dom = Date()\n", + "\n", + " def setDOM(self,m,d,y):\n", + " self.dom.setDate(m, d, y)\n", + " def printDOM(self):\n", + " self.dom.print_()\n", + " def printSex(self):\n", + " if self.sex == 1:\n", + " print \"male\"\n", + " else:\n", + " print 'female'\n", + "\n", + "x = Student(\"Ann Jones\", 0, \"219360061\")\n", + "x.setDOB(5, 13, 1977)\n", + "x.setDOM(8, 29, 1995)\n", + "x.setDOD(7,4,1826)\n", + "x.printName()\n", + "print \"\\n\\t Born: \" , \n", + "x.printDOB()\n", + "print \"\\n\\t Sex: \" ,\n", + "x.printSex()\n", + "print \"\\n\\tMatriculated: \",\n", + "x.printDOM()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Ann Jones \n", + "\t Born: May 13 , 1977\n", + "\n", + "\t Sex: female\n", + "\n", + "\tMatriculated: August 29 , 1995\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.6,page no:126" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class X:\n", + " def __init__(self):\n", + " self.a = 0\n", + " def f(self):\n", + " print \"X::f() executing\"\n", + "class Y(X):\n", + " def __init__(self):\n", + " self.a = 0\n", + " def f(self):\n", + " print \"Y::f() executing\"\n", + "x = X()\n", + "x.a = 22\n", + "x.f()\n", + "print \"x.a = \" , x.a\n", + "y = Y()\n", + "y.a = 44\n", + "# assigns 44 to the a defined in Y\n", + "y._X__a = 66\n", + "# assigns 66 to the a defined in X\n", + "y.f()\n", + "# invokes the f() defined in Y\n", + "X.f(x)\n", + "# invokes the f() defined in X\n", + "print \"y.a = \" , y.a \n", + "print \"y._X__a = \" , y._X__a \n", + "z = y\n", + "print \"z.a = \" , z._X__a \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "X::f() executing\n", + "x.a = 22\n", + "Y::f() executing\n", + "X::f() executing\n", + "y.a = 44\n", + "y._X__a = 66\n", + "z.a = 66\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.7,page no:126" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class X:\n", + " def __init__(self):\n", + " print \"X::X() constructor executing \"\n", + " def __del__(self):\n", + " print \"X::X() destructor executing \"\n", + "\n", + "class Y(X):\n", + " def __init__(self):\n", + " X.__init__(self)\n", + " print \"Y::Y() constructor executing \"\n", + " def __del__(self):\n", + " print \"Y::Y() destructor executing \"\n", + "\n", + "class Z(Y):\n", + " def __init__(self,i):\n", + " Y.__init__(self)\n", + " print \"Z::Z(\" , i , \") constructor executing \"\n", + " def __del__(self):\n", + " print \"Z::Z() destructor executing \"\n", + " \n", + "\n", + "Z = Z(44)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "X::X() constructor executing \n", + "Y::Y() constructor executing \n", + "Z::Z( 44 ) constructor executing \n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.8,page no:126" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Person:\n", + " def __init__(self,s):\n", + " self.name = s\n", + " def __del__(self):\n", + " pass\n", + "\n", + "class Student(Person):\n", + " def __init__(self,s,m):\n", + " Person.__init__(self,s)\n", + " self.major = m\n", + " def __del__(self):\n", + " pass\n", + "x = Person(\"Bob\")\n", + "y = Student(\"Sarah\", \"Biology\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.9,page no:127" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "class Person:\n", + " def __init__(self,n=\"\",s=0,nat=\"U.S.A.\"):\n", + " self.name = n\n", + " self.nationality = nat\n", + " self.sex = s\n", + " self.dob = Date()\n", + " self.dod = Date()\n", + " def setDOB(self,m,d,y):\n", + " self.dob.setDate(m,d,y)\n", + " def setDOD(self,m,d,y):\n", + " self.dod.setDate(m,d,y)\n", + " def printName(self):\n", + " print self.name,\n", + " def printNationality(self):\n", + " print self.nationality,\n", + " def printDOB(self):\n", + " self.dob.print_()\n", + " def printDOD(self):\n", + " self.dod.print_()\n", + " def setHSgraduate(self,g):\n", + " self.hs = g\n", + " def isHSgraduate(self):\n", + " return hs\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.10,page no:128" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class X:\n", + " def f(self):\n", + " print \"X::f() executing\"\n", + "class Y(X):\n", + " def f(self):\n", + " print \"Y::f() executing\"\n", + "x = X()\n", + "y = Y()\n", + "p = x\n", + "p.f()\n", + "p = y\n", + "p.f()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "X::f() executing\n", + "Y::f() executing\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.11,page no:128" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Person:\n", + " def __init__(self,n):\n", + " self.name = n\n", + " def print_(self):\n", + " print 'My name is' , self.name\n", + "\n", + "class Student(Person):\n", + " def __init__(self,s,g):\n", + " Person.__init__(self,s)\n", + " self.gpa = g\n", + " def print_(self):\n", + " print 'My name is ',self.name, ' and my G.P.A. is', self.gpa\n", + "\n", + "class Professor(Person):\n", + " def __init__(self,s,n):\n", + " Person.__init__(self,s)\n", + " self.publs = n\n", + " def print_(self):\n", + " print 'My name is ', self.name,' and i have ' , self.publs,' publications.'\n", + "\n", + "x = Person(\"Bob\")\n", + "p = x\n", + "p.print_()\n", + "y = Student(\"Tom\", 3.47)\n", + "p = y\n", + "p.print_()\n", + "z = Professor(\"Ann\", 7)\n", + "p = z\n", + "p.print_()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "My name is Bob\n", + "My name is Tom and my G.P.A. is 3.47\n", + "My name is Ann and i have 7 publications.\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.12,page no:129" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class X:\n", + " def __init__(self):\n", + " self.p = [0,0]\n", + " print 'X().',\n", + " def __del__(self):\n", + " print '~X().'\n", + "\n", + "class Y(X):\n", + " def __init__(self):\n", + " X.__init__(self)\n", + " self.q = []\n", + " for i in range(1023):\n", + " self.q.append(0)\n", + " print 'Y() : Y::q = ', hex(id(self.q)) ,'.',\n", + " def __del__(self):\n", + " print '~Y().'\n", + "\n", + "for i in range(8):\n", + " r = Y()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "X(). Y() : Y::q = 0x90d91cc . ~Y().\n", + "X(). Y() : Y::q = 0x90c944c . ~Y().\n", + "X(). Y() : Y::q = 0x90d91cc . ~Y().\n", + "X(). Y() : Y::q = 0x90c944c . ~Y().\n", + "X(). Y() : Y::q = 0x90d91cc . ~Y().\n", + "X(). Y() : Y::q = 0x90c944c . ~Y().\n", + "X(). Y() : Y::q = 0x90d91cc . ~Y().\n", + "X(). Y() : Y::q = 0x90c944c . ~Y().\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.13,page no:129" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Media:\n", + " def __init__(self):\n", + " self.title = ''\n", + " def print_(self):\n", + " pass\n", + " def id(self):\n", + " pass\n", + "\n", + "class Book(Media):\n", + " def __init__(self,a='',t=\"\",p=\"\",i=\"\"):\n", + " self.author = a\n", + " self.publisher = p\n", + " self.isbn = i\n", + " self.title = t\n", + " def print_(self):\n", + " print self.title , \" by \" , self.author\n", + " def id(self):\n", + " return self.isbn\n", + "\n", + "class CD(Media):\n", + " def __init__(self,t=\"\",c=\"\",m=\"\",n=\"\"):\n", + " self.composer = c\n", + " self.make = m\n", + " self.number = n\n", + " self.title = t\n", + " def print_(self):\n", + " print self.title , \", \" , self.composer\n", + " def id(self):\n", + " s = str(self.make) + ' ' + str(self.number)\n", + " return s\n", + "\n", + "class Magazine(Media):\n", + " def __init__(self,t=\"\",i=\"\",v=0, n=0):\n", + " self.issn = i\n", + " self.volume = v\n", + " self.number = n\n", + " self.title = t\n", + " def print_(self):\n", + " print self.title , \" Magazine, Vol. \", self.volume , \", No.\" , self.number\n", + " def id(self):\n", + " return self.issn\n", + "\n", + "book = Book(\"Bjarne Stroustrup\", \"The C++ Programming Language\",\"Addison-Wesley\", \"0-201-53992-6\")\n", + "magazine = Magazine(\"TIME\", \"0040-781X\", 145, 23)\n", + "cd = CD(\"BACH CANTATAS\", \"Johann Sebastian Bach\",\"ARCHIV\", \"D120541\")\n", + "book.print_()\n", + "print \"\\tid: \" , book.id() \n", + "magazine.print_()\n", + "print \"\\tid: \" , magazine.id() \n", + "cd.print_()\n", + "print \"\\tid: \" , cd.id()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The C++ Programming Language by Bjarne Stroustrup\n", + "\tid: 0-201-53992-6\n", + "TIME Magazine, Vol. 145 , No. 23\n", + "\tid: 0040-781X\n", + "BACH CANTATAS , Johann Sebastian Bach\n", + "\tid: ARCHIV D120541\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch13-checkpoint.ipynb b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch13-checkpoint.ipynb new file mode 100644 index 00000000..e8b7922b --- /dev/null +++ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch13-checkpoint.ipynb @@ -0,0 +1,433 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:9cabae4713ff25d4bdda7fcdc6441caa3ccbdea296fd6ae77ade3fbf96acb5a5" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 13" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.1,page no:131" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def swap(x,y):\n", + " x[0],y[0] = y[0],x[0]\n", + "\n", + "m = [22]\n", + "n = [66]\n", + "swap(m, n)\n", + "s1 = [\"John Adams\"]\n", + "s2 = [\"James Madison\"]\n", + "swap(s1, s2)\n", + "x = [22/7]\n", + "y = [-3]\n", + "swap(x, y)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.2,page no:132" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def sort(v,n):\n", + " for i in range(1,n):\n", + " for j in range(n-i):\n", + " if v[j] > v[j+1]:\n", + " v[j],v[j+1] = v[j+1],v[j]\n", + "\n", + "def print_( v,n):\n", + " for i in range(n):\n", + " print v[i],\n", + " print \"\"\n", + " \n", + "a = [55, 33, 88, 11, 44, 99, 77, 22, 66]\n", + "print_(a,9);\n", + "sort(a,9)\n", + "print_(a,9)\n", + "s = [\"Tom\", \"Hal\", \"Dan\", \"Bob\", \"Sue\", \"Ann\", \"Gus\"]\n", + "print_(s,7)\n", + "sort(s,7)\n", + "print_(s,7)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "55 33 88 11 44 99 77 22 66 \n", + "11 22 33 44 55 66 77 88 99 \n", + "Tom Hal Dan Bob Sue Ann Gus \n", + "Ann Bob Dan Gus Hal Sue Tom \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.3,page no:133" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Stack:\n", + " def __init__(self,s=100):\n", + " self.size = s\n", + " self.top = -1\n", + " self.data = []\n", + " def push(self,x):\n", + " self.data.append( x)\n", + " self.top += 1\n", + " def pop(self):\n", + " d = self.data[self.top]\n", + " self.data.pop(self.top)\n", + " self.top -= 1\n", + " return d \n", + " def isEmpty(self):\n", + " return self.top == -1\n", + " def isFull(self):\n", + " return self.top==self.size-1\n", + " \n", + "intStack1 = Stack(5)\n", + "intStack2 = Stack(10)\n", + "charStack = Stack(8)\n", + "intStack1.push(77)\n", + "charStack.push('A')\n", + "intStack2.push(22)\n", + "charStack.push('E')\n", + "charStack.push('K')\n", + "intStack2.push(44)\n", + "print intStack2.pop() \n", + "print intStack2.pop() \n", + "if (intStack2.isEmpty()):\n", + " print \"intStack2 is empty.\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "44\n", + "22\n", + "intStack2 is empty.\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.4,page no:134" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Vector:\n", + " def __init__(self,n=None):\n", + " if type(n) == int :\n", + " self.size = n\n", + " self.data = []\n", + " else:\n", + " self.size = 8\n", + " self.data = []\n", + " for i in range(self.size):\n", + " self.data.append(0)\n", + "v = Vector()\n", + "v.data[5] = 127\n", + "w = v\n", + "x = Vector(3)\n", + "print w.size\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "8\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.5,page no:135" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Vector:\n", + " def __init__(self,n=None):\n", + " if type(n) == int :\n", + " self.size = n\n", + " self.data = []\n", + " else:\n", + " self.size = 8\n", + " self.data = []\n", + " for i in range(self.size):\n", + " self.data.append(0)\n", + "\n", + "class Array(Vector):\n", + " def __init__(self,i,j):\n", + " Vector.__init__(self,j-i+1)\n", + " self.i0= i\n", + " def __setitem__(self,k,v):\n", + " self.data[k-self.i0] = v\n", + " def __getitem__(self,i):\n", + " return self.data[self.i0-i]\n", + " def firstSubscript(self):\n", + " return self.i0\n", + " def lastSubscript(self):\n", + " return self.i0+self.size-1\n", + "\n", + "x = Array(1,3)\n", + "x.data[0] = 3.14159\n", + "x.data[1] = 0.08516\n", + "x.data[2] = 5041.92\n", + "print \"x.size() = \" , x.size \n", + "print \"x.firstSubscript() = \" , x.firstSubscript() \n", + "print \"x.lastSubscript() = \" , x.lastSubscript()\n", + "for i in range(0,3):\n", + " print \"x[\" , i + 1 , \"] = \" , x.data[i]\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x.size() = 3\n", + "x.firstSubscript() = 1\n", + "x.lastSubscript() = 3\n", + "x[ 1 ] = 3.14159\n", + "x[ 2 ] = 0.08516\n", + "x[ 3 ] = 5041.92\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.6,page no:136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Matrix:\n", + " def __init__(self,r=1,c=1):\n", + " self.rows = r\n", + " self.columns = c\n", + " self.vector = []\n", + " for i in range(r):\n", + " a = []\n", + " for j in range(c):\n", + " a.append(0)\n", + " self.vector.append(a)\n", + "\n", + "a = Matrix(2,3)\n", + "a.vector[0][0] = 0.0\n", + "a.vector[0][1] = 0.1\n", + "a.vector[0][2] = 0.2\n", + "a.vector[1][0] = 1.0\n", + "a.vector[1][1] = 1.1\n", + "a.vector[1][2] = 1.2\n", + "\n", + "print \"The matrix a has \" , a.rows , \" rows and \", a.columns , \" columns:\"\n", + "for i in range(2):\n", + " for j in range(3):\n", + " print a.vector[i][j] ,\n", + " print \"\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The matrix a has 2 rows and 3 columns:\n", + "0.0 0.1 0.2 \n", + "1.0 1.1 1.2 \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.7,page no:137" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "friends = []\n", + "\n", + "\n", + "friends.insert(0,\"Bowen, Van\")\n", + "friends.insert(0,\"Dixon, Tom\")\n", + "friends.insert(0,\"Mason, Joe\")\n", + "friends.insert(0,\"White, Ann\")\n", + "\n", + "for i in range(len(friends)):\n", + " print friends[i], '->' ,\n", + "print '*'\n", + "friends.remove('White, Ann')\n", + "print \"Removed: \" , 'White, Ann'\n", + "for i in range(len(friends)):\n", + " print friends[i], '->' ,\n", + "print '*'\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "White, Ann -> Mason, Joe -> Dixon, Tom -> Bowen, Van -> *\n", + "Removed: White, Ann\n", + "Mason, Joe -> Dixon, Tom -> Bowen, Van -> *\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.8,page no:138" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "friends = []\n", + "friends.append(\"Bowen, Van\")\n", + "friends.append(\"Dixon, Tom\")\n", + "friends.append(\"Mason, Joe\")\n", + "friends.append(\"White, Ann\")\n", + "for i in range(len(friends)):\n", + " print friends[i], '->' ,\n", + "print '*'\n", + "\n", + "friends.remove(\"Mason, Joe\")\n", + "friends[1] = \"Davis, Jim\"\n", + "for i in range(len(friends)):\n", + " print friends[i], '->' ,\n", + "print '*'\n", + "\n", + "friends.insert(2,\"Morse, Sam\")\n", + "for i in range(len(friends)):\n", + " print friends[i], '->' ,\n", + "print '*'\n", + "\n", + "for i in range(len(friends)):\n", + " print \"[\" ,friends[i] , \"]\" , '->' ,\n", + "print '*'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Bowen, Van -> Dixon, Tom -> Mason, Joe -> White, Ann -> *\n", + "Bowen, Van -> Davis, Jim -> White, Ann -> *\n", + "Bowen, Van -> Davis, Jim -> Morse, Sam -> White, Ann -> *\n", + "[ Bowen, Van ] -> [ Davis, Jim ] -> [ Morse, Sam ] -> [ White, Ann ] -> *\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch14-checkpoint.ipynb b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch14-checkpoint.ipynb new file mode 100644 index 00000000..84861804 --- /dev/null +++ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch14-checkpoint.ipynb @@ -0,0 +1,626 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:56bc0876dbfc540836629377189659f34df0d07125ac0d4220e04d96bf53cc42" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 14" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 14.1,page no:141" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def load(v):\n", + " v.append(\"Japan\")\n", + " v.append(\"Italy\")\n", + " v.append(\"Spain\")\n", + " v.append(\"Egypt\")\n", + " v.append(\"Chile\")\n", + " v.append(\"Zaire\")\n", + " v.append(\"Nepal\")\n", + " v.append(\"Kenya\")\n", + "\n", + "def print_(v):\n", + " for i in v:\n", + " print i\n", + "\n", + "v = []\n", + "load(v)\n", + "print_(v)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Japan\n", + "Italy\n", + "Spain\n", + "Egypt\n", + "Chile\n", + "Zaire\n", + "Nepal\n", + "Kenya\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 14.2,page no:142" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def load(v):\n", + " v.append(\"Japan\")\n", + " v.append(\"Italy\")\n", + " v.append(\"Spain\")\n", + " v.append(\"Egypt\")\n", + " v.append(\"Chile\")\n", + " v.append(\"Zaire\")\n", + " v.append(\"Nepal\")\n", + " v.append(\"Kenya\")\n", + "\n", + "def print_(v):\n", + " for i in v:\n", + " print i\n", + "\n", + "v = []\n", + "load(v)\n", + "print_(v)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Japan\n", + "Italy\n", + "Spain\n", + "Egypt\n", + "Chile\n", + "Zaire\n", + "Nepal\n", + "Kenya\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 14.3,page no:143" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def load(v):\n", + " v.append(\"Japan\")\n", + " v.append(\"Italy\")\n", + " v.append(\"Spain\")\n", + " v.append(\"Egypt\")\n", + " v.append(\"Chile\")\n", + " v.append(\"Zaire\")\n", + " v.append(\"Nepal\")\n", + " v.append(\"Kenya\")\n", + "\n", + "def print_(v):\n", + " for i in range(len(v)):\n", + " print v[i]\n", + "\n", + "v = []\n", + "load(v)\n", + "print_(v)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Japan\n", + "Italy\n", + "Spain\n", + "Egypt\n", + "Chile\n", + "Zaire\n", + "Nepal\n", + "Kenya\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 14.4,page no:144" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def load(v):\n", + " v.append(\"Japan\")\n", + " v.append(\"Italy\")\n", + " v.append(\"Spain\")\n", + " v.append(\"Egypt\")\n", + " v.append(\"Chile\")\n", + " v.append(\"Zaire\")\n", + " v.append(\"Nepal\")\n", + " v.append(\"Kenya\")\n", + "\n", + "def print_(v):\n", + " for i in v:\n", + " print i\n", + "\n", + "v = []\n", + "load(v)\n", + "v.sort()\n", + "print_(v)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Chile\n", + "Egypt\n", + "Italy\n", + "Japan\n", + "Kenya\n", + "Nepal\n", + "Spain\n", + "Zaire\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 14.5,page no:145" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def load(v):\n", + " v.append(\"Japan\")\n", + " v.append(\"Italy\")\n", + " v.append(\"Spain\")\n", + " v.append(\"Egypt\")\n", + " v.append(\"Chile\")\n", + " v.append(\"Zaire\")\n", + " v.append(\"Nepal\")\n", + " v.append(\"Kenya\")\n", + "\n", + "def print_(v):\n", + " for i in v:\n", + " print i\n", + "\n", + "v = []\n", + "load(v)\n", + "w = v\n", + "print_(v)\n", + "print_(w)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Japan\n", + "Italy\n", + "Spain\n", + "Egypt\n", + "Chile\n", + "Zaire\n", + "Nepal\n", + "Kenya\n", + "Japan\n", + "Italy\n", + "Spain\n", + "Egypt\n", + "Chile\n", + "Zaire\n", + "Nepal\n", + "Kenya\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 14.6,page no:146" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def load(v):\n", + " v.append(\"Japan\")\n", + " v.append(\"Italy\")\n", + " v.append(\"Spain\")\n", + " v.append(\"Egypt\")\n", + " v.append(\"Chile\")\n", + " v.append(\"Zaire\")\n", + " v.append(\"Nepal\")\n", + " v.append(\"Kenya\")\n", + "\n", + "def print_(v):\n", + " for i in v:\n", + " print i\n", + "\n", + "v = []\n", + "load(v)\n", + "v.sort()\n", + "print_(v)\n", + "print \"v.front() = \" + v[0]\n", + "print \"v.back() = \" + v.pop(-1) \n", + "print \"v.back() = \" + v.pop(-1) \n", + "print \"v.back() = \" + v[-1] \n", + "print_(v)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Chile\n", + "Egypt\n", + "Italy\n", + "Japan\n", + "Kenya\n", + "Nepal\n", + "Spain\n", + "Zaire\n", + "v.front() = Chile\n", + "v.back() = Zaire\n", + "v.back() = Spain\n", + "v.back() = Nepal\n", + "Chile\n", + "Egypt\n", + "Italy\n", + "Japan\n", + "Kenya\n", + "Nepal\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 14.7,page no:147" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def load(v):\n", + " v.append(\"Japan\")\n", + " v.append(\"Italy\")\n", + " v.append(\"Spain\")\n", + " v.append(\"Egypt\")\n", + " v.append(\"Chile\")\n", + " v.append(\"Zaire\")\n", + " v.append(\"Nepal\")\n", + " v.append(\"Kenya\")\n", + "\n", + "def print_(v):\n", + " for i in v:\n", + " print i\n", + "\n", + "v = []\n", + "load(v)\n", + "v.sort()\n", + "print_(v)\n", + "v.pop(2) # removes Italy\n", + "v.pop(-2) # removes Spain\n", + "print_(v)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Chile\n", + "Egypt\n", + "Italy\n", + "Japan\n", + "Kenya\n", + "Nepal\n", + "Spain\n", + "Zaire\n", + "Chile\n", + "Egypt\n", + "Japan\n", + "Kenya\n", + "Nepal\n", + "Zaire\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 14.8,page no:148" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def load(v):\n", + " v.append(\"Japan\")\n", + " v.append(\"Italy\")\n", + " v.append(\"Spain\")\n", + " v.append(\"Egypt\")\n", + " v.append(\"Chile\")\n", + " v.append(\"Zaire\")\n", + " v.append(\"Nepal\")\n", + " v.append(\"Kenya\")\n", + "\n", + "def print_(v):\n", + " for i in v:\n", + " print i\n", + "v = []\n", + "load(v)\n", + "v.sort()\n", + "print_(v)\n", + "r = []\n", + "for i in range(2,len(v)-2):\n", + " r.append(v[i]) #removes the segment Italy..Nepal\n", + " \n", + "for i in r:\n", + " v.remove(i)\n", + "print_(v)\n", + "v.insert(2,\"India\")\n", + "print_(v)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Chile\n", + "Egypt\n", + "Italy\n", + "Japan\n", + "Kenya\n", + "Nepal\n", + "Spain\n", + "Zaire\n", + "Chile\n", + "Egypt\n", + "Spain\n", + "Zaire\n", + "Chile\n", + "Egypt\n", + "India\n", + "Spain\n", + "Zaire\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 14.9,page no:149" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def load(v):\n", + " v.append(\"Japan\")\n", + " v.append(\"Italy\")\n", + " v.append(\"Spain\")\n", + " v.append(\"Egypt\")\n", + " v.append(\"Chile\")\n", + " v.append(\"Zaire\")\n", + " v.append(\"Nepal\")\n", + " v.append(\"Kenya\")\n", + " v.append(\"India\")\n", + " v.append(\"China\")\n", + " v.append(\"Malta\")\n", + " v.append(\"Syria\")\n", + "\n", + "def print_(v):\n", + " for i in v:\n", + " print i\n", + "\n", + "v = []\n", + "load(v)\n", + "print_(v)\n", + "egypt = v.index('Egypt')\n", + "malta = v.index('Malta')\n", + "w = v[egypt:malta+1]\n", + "w.sort()\n", + "print_(w)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Japan\n", + "Italy\n", + "Spain\n", + "Egypt\n", + "Chile\n", + "Zaire\n", + "Nepal\n", + "Kenya\n", + "India\n", + "China\n", + "Malta\n", + "Syria\n", + "Chile\n", + "China\n", + "Egypt\n", + "India\n", + "Kenya\n", + "Malta\n", + "Nepal\n", + "Zaire\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 14.10,page no:150" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def copy(v,x,n):\n", + " for i in x:\n", + " v.append(i)\n", + "\n", + "def projection(v,b):\n", + " v_size = len(v)\n", + " w = []\n", + " for i in range(0,v_size):\n", + " if b[i]:\n", + " w.append(v[i])\n", + " return w\n", + "\n", + "def print_(v):\n", + " for i in v:\n", + " print i,\n", + " print ''\n", + "\n", + "x = [ 22.2, 33.3, 44.4, 55.5, 66.6, 77.7, 88.8, 99.9 ]\n", + "v = []\n", + "copy(v, x, 8)\n", + "y = [ False, True, False, True, True, True, False, True ]\n", + "b = []\n", + "copy(b, y, 8)\n", + "w = projection(v, b)\n", + "print_(v)\n", + "print_(w)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "22.2 33.3 44.4 55.5 66.6 77.7 88.8 99.9 \n", + "33.3 55.5 66.6 77.7 99.9 \n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch2-checkpoint.ipynb b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch2-checkpoint.ipynb new file mode 100644 index 00000000..d47f4b5b --- /dev/null +++ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch2-checkpoint.ipynb @@ -0,0 +1,775 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:0edad02485746c86f7a6286bbd0371f16175bcf7f2941a8a68c0cd459191e9f2" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 2" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.1,page no:121" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# prints the value of a boolean variable:\n", + "flag=False\n", + "print \"flag = %r\" % flag\n", + "flag = True\n", + "print \"flag = %r\" % flag" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "flag = False\n", + "flag = True\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.2,page no:122" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# prints the character and its internally stored\n", + "c='A'\n", + "print \"c = \" + c + \", int(c) = %d\" % ord(c)\n", + "c='t'\n", + "print \"c = \" + c + \", int(c) = %d\" % ord(c)\n", + "c='\\t' # the tab character\n", + "print \"c = \" + c + \", int(c) = %d\" % ord(c)\n", + "c='!'\n", + "print \"c = \" + c + \", int(c) = %d\" % ord(c)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "c = A, int(c) = 65\n", + "c = t, int(c) = 116\n", + "c = \t, int(c) = 9\n", + "c = !, int(c) = 33\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.3,page no:123" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import sys\n", + "# defines the constants SHRT_MIN, etc.\n", + "print 'maximum limit int : ',\n", + "print sys.maxint\n", + "print 'float info'\n", + "print sys.float_info" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "maximum limit int : 2147483647\n", + "float info\n", + "sys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.220446049250313e-16, radix=2, rounds=1)\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.4,page no:124" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# tests operators +, -, *, /, and %:\n", + "m=54\n", + "n=20\n", + "print \"m = %d and n = %d\" %(m,n)\n", + "print \"m+n = %d\" % (m+n) # 54+20 = 74\n", + "print \"m-n = %d\" % (m-n) # 54-20 = 34\n", + "print \"m*n = %d\" % (m*n)# 54*20 = 1080\n", + "print \"m/n = %d\" % (m/n) # 54/20 = 2\n", + "print \"m modulo by n = %d\" % (m%n) # 54%20 = 14" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "m = 54 and n = 20\n", + "m+n = 74\n", + "m-n = 34\n", + "m*n = 1080\n", + "m/n = 2\n", + "m modulo by n = 14\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.5,page no:125" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# shows the difference between m++ and ++m:\n", + "m = 44\n", + "m += 1\n", + "n = m\n", + "print \"m = %d , n = %d\" %(m,n)\n", + "m = 44\n", + "n = m # the post-increment operator is applied to m\n", + "m += 1\n", + "print \"m = %d , n = %d\" %(m,n)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "m = 45 , n = 45\n", + "m = 45 , n = 44\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.6,page no:126" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# tests arithmetic assignment operators:\n", + "n=22\n", + "print \"n = %d\" % n\n", + "n += 9 # adds 9 to n\n", + "print \"After n += 9, n = %d\" % n\n", + "n -= 5 # subtracts 5 from n\n", + "print \"After n -= 5, n = %d\" % n\n", + "n *= 2 # multiplies n by 3\n", + "print \"After n *= 2, n = %d\" % n \n", + "n /= 3 # divides n by 9\n", + "print \"After n /= 3, n = %d\" % n \n", + "n %= 7 # reduces n to the remainder from dividing by 4\n", + "print 'After n modulo by 7 n = %d' %n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = 22\n", + "After n += 9, n = 31\n", + "After n -= 5, n = 26\n", + "After n *= 2, n = 52\n", + "After n /= 3, n = 17\n", + "After n modulo by 7 n = 3\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.7,page no:127" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# tests the floating-point operators +, -, *, and /:\n", + "x=54.0\n", + "y=20.0\n", + "print \"x = %f and y = %f\" %(x,y)\n", + "print \"x+y = %f\" %(x+y) # 54.0+20.0 = 74.0\n", + "print \"x-y = %f\" % (x-y) # 54.0-20.0 = 34.0\n", + "print \"x*y = %f\" %( x*y) # 54.0*20.0 = 1080.0\n", + "print \"x/y = %f\" % (x/y) # 54.0/20.0 = 2.7\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = 54.000000 and y = 20.000000\n", + "x+y = 74.000000\n", + "x-y = 34.000000\n", + "x*y = 1080.000000\n", + "x/y = 2.700000\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.8,page no:128" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import sys\n", + "# prints the storage sizes of the fundamental types:\n", + "print \"Number of bytes used:\\n\"\n", + "\n", + "print \" char: %d \" % sys.getsizeof('a')\n", + "print \" int : %d \" % sys.getsizeof(int(1))\n", + "print \" string : %d \" % sys.getsizeof(str('hellololdei'))\n", + "print \"float : %d\" % sys.getsizeof(float(1.1))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of bytes used:\n", + "\n", + " char: 22 \n", + " int : 12 \n", + " string : 32 \n", + "float : 16\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.9,page no:128" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import sys\n", + "# prints the storage sizes of the fundamental types:\n", + "fbits = 8*sys.getsizeof(float(123))\n", + "\n", + "# each byte contains 8 bits\n", + "print \"float uses : %d bits:\\n\\t\" % fbits \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "float uses : 128 bits:\n", + "\t\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.10,page no:128" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# casts a double value as an int:\n", + "v = 1234.56789\n", + "n = int(v);\n", + "print \"v = %f, n = %d\" %(v,n)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "v = 1234.567890, n = 1234\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.11,page no:128" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# prints promoted vales of 65 from char to double:\n", + "c='A'\n", + "print \"char c = \" + c\n", + "k=c;\n", + "print \"k = \" + k \n", + "m=k;\n", + "print \"m = \" + m \n", + "n=m\n", + "print \"n = \" + n\n", + "x=m\n", + "print \"x = \" + x \n", + "y=x\n", + "print \"y = \" + y" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "char c = A\n", + "k = A\n", + "m = A\n", + "n = A\n", + "x = A\n", + "y = A\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.12,page no:128" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# prints n until it overflows:\n", + "n=1000\n", + "print \"n = %d\" % n\n", + "n *= 1000 # multiplies n by 1000\n", + "print \"n = %d\" % n\n", + "n *= 1000 # multiplies n by 1000\n", + "print \"n = %d\" % n\n", + "n *= 1000 # multiplies n by 1000\n", + "print \"n = %d\" % n\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = 1000\n", + "n = 1000000\n", + "n = 1000000000\n", + "n = 1000000000000\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.13,page no:128" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# prints x until it overflows:\n", + "x=1000.0\n", + "print \"x = %f\" % x\n", + "x *= x # multiplies n by itself; i.e., it squares x\n", + "print \"x = %f\" % x\n", + "x *= x # multiplies n by itself; i.e., it squares x\n", + "print \"x = %f\" % x\n", + "x *= x # multiplies n by itself; i.e., it squares x\n", + "print \"x = %f\" % x\n", + "x *= x # multiplies n by itself; i.e., it squares x\n", + "print \"x = %f\" % x\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = 1000.000000\n", + "x = 1000000.000000\n", + "x = 1000000000000.000000\n", + "x = 999999999999999983222784.000000\n", + "x = 1000000000000000043845843045076197354634047651840.000000\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.14,page no:129" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# illustrates round-off error::\n", + "x = 1000/3.0\n", + "print \"x = %f\" %x # x = 1000/3\n", + "y = x - 333.0\n", + "print \"y = %f\" % y # y = 1/3\n", + "z = 3*y - 1.0\n", + "print \"z = %f\" %z # z = 3(1/3) - 1\n", + "if (z == 0):\n", + " print \"z == 0.\\n\"\n", + "else:\n", + " print \"z does not equal 0.\\n\" # z != 0\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = 333.333333\n", + "y = 0.333333\n", + "z = -0.000000\n", + "z does not equal 0.\n", + "\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.15,page no:129" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# implements the quadratic formula\n", + "a = float(raw_input(\"Enter the coefficients of a quadratic equation:\\n a : \"))\n", + "b = float(raw_input('b : '))\n", + "c = float(raw_input('c : '))\n", + "\n", + "print \"The equation is: \",\n", + "print a,\n", + "print \"*x*x + \",\n", + "print b,\n", + "print \"*x + \" ,\n", + "print c,\n", + "print \" = 0\" \n", + "\n", + "d = b*b - 4*a*c # discriminant\n", + "sqrtd = math.sqrt(d)\n", + "x1 = (-b + sqrtd)/(2*a)\n", + "x2 = (-b - sqrtd)/(2*a)\n", + "print \"The solutions are:\"\n", + "print \"\\tx1 = %f\" % x1\n", + "print \"\\tx2 = %f\" % x2\n", + "print \"Check:\" \n", + "print \"\\ta*x1*x1 + b*x1 + c = %f\" %( a*x1*x1 + b*x1 + c)\n", + "print \"\\ta*x2*x2 + b*x2 + c = %f\" %( a*x2*x2 + b*x2 + c)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the coefficients of a quadratic equation:\n", + " a : 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "b : 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "c : -3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The equation is: 2.0 *x*x + 1.0 *x + -3.0 = 0\n", + "The solutions are:\n", + "\tx1 = 1.000000\n", + "\tx2 = -1.500000\n", + "Check:\n", + "\ta*x1*x1 + b*x1 + c = 0.000000\n", + "\ta*x2*x2 + b*x2 + c = 0.000000\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.16,page no:130" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# prints double values in scientific e-format:\n", + "x = float(raw_input(\"Enter float: \"))\n", + "print \"Its reciprocal is: \",\n", + "print 1/x " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter float: 234.567e89\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Its reciprocal is: 4.2631742743e-92\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.17,page no:130" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# illustrates the scope of variables:\n", + "x = 11\n", + "# ERROR: this is not in the scope of x\n", + "if True:\n", + " x = 22 # OK: this is in the scope of x\n", + " y = 33 # ERROR: this is not in the scope of y\n", + " x = 44 # OK: this is in the scope of x\n", + " y = 55 # OK: this is in the scope of y\n", + "x = 66 # OK: this is in the scope of x\n", + "y = 77 # ERROR: this is not in the scope of y\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.18,page no:131" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# this x is global\n", + "x = 11\n", + "\n", + "if True:\n", + " # illustrates the nested and parallel scopes:\n", + " x = 22\n", + " # begin scope of internal block\n", + " if True:\n", + " x = 33\n", + " print \"In block inside main(): x = %d \" % x\n", + " # end scope of internal block\n", + "print \"In main(): x = %d\" %x \n", + "print \"In main(): x = %d \"% x" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "In block inside main(): x = 33 \n", + "In main(): x = 33\n", + "In main(): x = 33 \n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch3-checkpoint.ipynb b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch3-checkpoint.ipynb new file mode 100644 index 00000000..fbc5e177 --- /dev/null +++ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch3-checkpoint.ipynb @@ -0,0 +1,1163 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:775362cdb9ee75ef7772fdb79151cc60e1c3ca6a5fec01c98ea568351626980e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 3" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.1,page no:131" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter two positive integers: \";\n", + "n = int(raw_input())\n", + "d = int(raw_input())\n", + "if (n%d):\n", + " print \"%d is not divisible by %d\" %(n,d)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two positive integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "66\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "66 is not divisible by 7\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.2,page no:132" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter two positive integers: \";\n", + "n = int(raw_input())\n", + "d = int(raw_input())\n", + "if (n%d):\n", + " print \"%d is not divisible by %d\" %(n,d)\n", + "else:\n", + " print \"%d is divisible by %d\" %(n,d)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two positive integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "56\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "56 is divisible by 7\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.3,page no:133" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter two integers: \"\n", + "m = int(raw_input())\n", + "n = int(raw_input())\n", + "\n", + "if (m < n):\n", + " print \"%d is the minimum.\" %m\n", + "else:\n", + " print \"%d is the minimum.\" %n\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "77\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "55 is the minimum.\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.4,page no:134" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter an integer: \"\n", + "n = int(raw_input())\n", + "if (n = 22):\n", + " print \"%d = 22\" %n\n", + "else: \n", + " print \"%d != 22\" %n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "SyntaxError", + "evalue": "invalid syntax (, line 7)", + "output_type": "pyerr", + "traceback": [ + "\u001b[1;36m File \u001b[1;32m\"\"\u001b[1;36m, line \u001b[1;32m7\u001b[0m\n\u001b[1;33m if (n = 22):\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.5,page no:134" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter three integers: \"\n", + "n1 = int(raw_input())\n", + "n2 = int(raw_input())\n", + "n3 = int(raw_input())\n", + "\n", + "m=n1\n", + "# now min <= n1\n", + "if (n2 < m):\n", + " m = n2 # now min <= n1 and min <= n2\n", + "if (n3 < m):\n", + " m = n3 # now min <= n1, min <= n2, and min <= n3\n", + "print \"Their minimum is %d\" % m" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter three integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "77\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "33\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Their minimum is 33\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.6,page no:134" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter two integers: \"\n", + "x = int(raw_input())\n", + "y = int(raw_input())\n", + "\n", + "if (x > y):\n", + " temp=x\n", + " x = y\n", + " y = temp\n", + " \n", + "\n", + "print \"%d <= %d\" %(x,y)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "66\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "44\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "44 <= 66\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.7,page no:135" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "n=44\n", + "print \"n = %d\" % n \n", + "if True:\n", + " # scope extends over 4 lines\n", + " print \"Enter an integer: \"\n", + " n = int(raw_input())\n", + " print \"n = %d\" % n \n", + "\n", + "if True:\n", + " print \"n = %d\" % n \n", + " # the n that was declared first\n", + "if True:\n", + " print \"n = %d\" % n \n", + "\n", + "print \"n = %d\" % n " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = 44\n", + "Enter an integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "77\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = 77\n", + "n = 77\n", + "n = 77\n", + "n = 77\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.8,page no:135" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter three integers: \"\n", + "n1 = int(raw_input())\n", + "n2 = int(raw_input())\n", + "n3 = int(raw_input())\n", + "if (n1 <= n2 and n1 <= n3):\n", + " print \"Their minimum is %d\" % n1\n", + " \n", + "if (n2 <= n1 and n2 <= n3):\n", + " print \"Their minimum is %d \" % n2 \n", + "if (n3 <= n1 and n3 <= n2):\n", + " print \"Their minimum is %d\" % n3 \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter three integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "77\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "33\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Their minimum is 33 \n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.9,page no:136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Are you enrolled (y/n): \"\n", + "ans = raw_input()\n", + "if (ans == 'Y' or ans == 'y'):\n", + " print \"You are enrolled.\\n\"\n", + "else: \n", + " print \"You are not enrolled.\\n\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Are you enrolled (y/n): \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "You are enrolled.\n", + "\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.10,page no:136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter two positive integers: \";\n", + "n = int(raw_input())\n", + "d = int(raw_input())\n", + "\n", + "if (d != 0 and n%d == 0): \n", + " print \"%d divides %d\" %(d,n)\n", + "else:\n", + " print \"%d does not divide %d\"% (d,n)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two positive integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "33\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "6 does not divide 33\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.11,page no:136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter three integers: \"\n", + "n1 = int(raw_input())\n", + "n2 = int(raw_input())\n", + "n3 = int(raw_input())\n", + "\n", + "if (n1 >= n2 >= n3):\n", + " print \"max = x\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter three integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.12,page no:137" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter two positive integers: \"\n", + "n = int(raw_input())\n", + "d = int(raw_input())\n", + "\n", + "if (d != 0):\n", + " if (n%d == 0):\n", + " print d,\n", + " print \" divides %d\" % n \n", + " else:\n", + " print \"%d does not divide %d\" %(d,n)\n", + "else:\n", + " print '%d does not divide %d '%(d,n)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two positive integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "44\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "44 does not divide 55\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.13,page no:137" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter three integers: \"\n", + "n1 = int(raw_input())\n", + "n2 = int(raw_input())\n", + "n3 = int(raw_input())\n", + "if (n1 < n2):\n", + " if (n1 < n3):\n", + " print \"Their minimum is : %d\" % n1\n", + " else:\n", + " print \"Their minimum is : %d\" % n3\n", + "else: # n1 >= n2\n", + " if (n2 < n3):\n", + " print \"Their minimum is : %d\" % n2\n", + " else:\n", + " print \"Their minimum is %d\" % n3" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter three integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "77\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "33\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Their minimum is : 33\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.14,page no:137" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Pick a number from 1 to 8.\" \n", + "answer = int(raw_input())\n", + "print \"Is it less than 5? (y|n): \"\n", + "answer = raw_input()\n", + "if (answer == 'y'): # 1 <= n <= 4\n", + " print \"Is it less than 3? (y|n): \"\n", + " answer = raw_input() \n", + " if (answer == 'y'): # 1 <= n <= 2\n", + " print \"Is it less than 2? (y|n): \"\n", + " answer = raw_input()\n", + " if (answer == 'y'):\n", + " print \"Your number is 1.\"\n", + " else:\n", + " print \"Your number is 2.\"\n", + " else: # 3 <= n <= 4\n", + " print \"Is it less than 4? (y|n): \"\n", + " answer = raw_input()\n", + " if (answer == 'y'):\n", + " print \"Your number is 3.\"\n", + " else:\n", + " print \"Your number is 4.\"\n", + "else: # 5 <= n <= 8\n", + " print \"Is it less than 7? (y|n): \"\n", + " answer = raw_input()\n", + " if (answer == 'y'): # 5 <= n <= 6\n", + " print \"Is it less than 6? (y|n): \"\n", + " answer = raw_input()\n", + " if (answer == 'y'):\n", + " print \"Your number is 5.\"\n", + " else:\n", + " print \"Your number is 6.\" \n", + " else: # 7 <= n <= 8\n", + " print \"Is it less than 8? (y|n): \"\n", + " answer = raw_input()\n", + " if (answer == 'y'):\n", + " print \"Your number is 7.\" \n", + " else:\n", + " print \"Your number is 8.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Pick a number from 1 to 8.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Is it less than 5? (y|n): \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "n\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Is it less than 7? (y|n): \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Is it less than 6? (y|n): \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "n\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Your number is 6.\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.15,page no:138" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "language = raw_input(\"Engl., Fren., Ger., Ital., or Rus.? (e|f|g|i|r): \")\n", + "\n", + "if (language == 'e'): \n", + " print \"Welcome to ProjectEuclid.\"\n", + "elif (language == 'f'):\n", + " print \"Bon jour, ProjectEuclid.\"\n", + "elif (language == 'g'):\n", + " print \"Guten tag, ProjectEuclid.\"\n", + "elif (language == 'i'):\n", + " print \"Bon giorno, ProjectEuclid.\"\n", + "elif (language == 'r'):\n", + " print \"Dobre utre, ProjectEuclid.\"\n", + "else:\n", + " print \"Sorry; we don't speak your language.\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Engl., Fren., Ger., Ital., or Rus.? (e|f|g|i|r): i\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Bon giorno, ProjectEuclid.\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.16,page no:138" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "score = int(raw_input(\"Enter your test score: \"))\n", + "a = int(score/10)\n", + "if a == 10 or a == 9:\n", + " print \"Your grade is an A.\"\n", + "elif a == 8:\n", + " print \"Your grade is a B.\" \n", + "elif a == 7:\n", + " print \"Your grade is a C.\" \n", + "elif a == 6:\n", + " print \"Your grade is a D.\"\n", + "elif a==5 or a==4 or a==3 or a==2 or a==1 or a==0:\n", + " print \"Your grade is an F.\" \n", + "else:\n", + " print \"Error: score is out of range.\\n\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your test score: 83\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Your grade is a B.\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.17,page no:139" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "score = int(raw_input(\"Enter your test score: \"))\n", + "a = int(score/10)\n", + "if a == 10 or a == 9:\n", + " print \"Your grade is an A.\"\n", + "elif a == 8:\n", + " print \"Your grade is a B.\" \n", + "elif a == 7:\n", + " print \"Your grade is a C.\" \n", + "elif a == 6:\n", + " print \"Your grade is a D.\"\n", + "elif a==5 or a==4 or a==3 or a==2 or a==1 or a==0:\n", + " print \"Your grade is an F.\" \n", + "else:\n", + " print \"Error: score is out of range.\\n\"\n", + "\n", + "print \"Goodbye.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your test score: 83\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Your grade is a B.\n", + "Goodbye.\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.18,page no:140" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "score = int(raw_input(\"Enter your test score: \"))\n", + "a = int(score/10)\n", + "if a == 10 or a == 9:\n", + " print \"Your grade is an A.\"\n", + "elif a == 8:\n", + " print \"Your grade is a B.\" \n", + "elif a == 7:\n", + " print \"Your grade is a C.\" \n", + "elif a == 6:\n", + " print \"Your grade is a D.\"\n", + "elif a==5 or a==4 or a==3 or a==2 or a==1 or a==0:\n", + " print \"Your grade is an F.\" \n", + "else:\n", + " print \"Error: score is out of range.\\n\"\n", + "\n", + "print \"Goodbye.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.19,page no:140" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter two integers: \"\n", + "m = int(raw_input())\n", + "n = int(raw_input())\n", + "print min(m,n),\n", + "print 'is the minimum'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "33\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "33 is the minimum\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch4-checkpoint.ipynb b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch4-checkpoint.ipynb new file mode 100644 index 00000000..99d45e2f --- /dev/null +++ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch4-checkpoint.ipynb @@ -0,0 +1,1734 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:a827b39a1484e07a3be872b4233ca2d8270682f9fa713863be73c01b7ee3c12b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 4" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.1,page no:41" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "i=1\n", + "print \"Enter a positive integer: \"\n", + "n = int(raw_input())\n", + "s=0\n", + "while (i <= n):\n", + " s += i\n", + " i += 1\n", + "print \"The sum of the first %d integers is %d\" %(i,s)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The sum of the first 6 integers is 15\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.2,page no:42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter a positive integer: \"\n", + "bound = int(raw_input())\n", + "s=0.0\n", + "i=0\n", + "while (s < bound):\n", + " i += 1\n", + " s += 1.0/i\n", + "\n", + "print \"The sum of the first %d reciprocals is %f\" %(i,s)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The sum of the first 83 reciprocals is 5.002068\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.3,page no:43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "print \"Enter a positive number: \"\n", + "x = float(raw_input())\n", + "while (x > 0):\n", + " print \"sqrt(%d) = %f \"%(x,math.sqrt(x))\n", + " print \"Enter another positive number (or 0 to quit): \"\n", + " x = float(raw_input())\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive number: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "sqrt(5) = 2.236068 \n", + "Enter another positive number (or 0 to quit): \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "sqrt(3) = 1.732051 \n", + "Enter another positive number (or 0 to quit): \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.4,page no:44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "i=1\n", + "print \"Enter a positive integer: \";\n", + "n = int(raw_input())\n", + "s=0\n", + "while(True):\n", + " if (i > n):\n", + " break # terminates the loop immediately\n", + " s += i\n", + " i += 1\n", + "print \"The sum of the first %d integers is %d\" %(n,s)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The sum of the first 5 integers is 15\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.5,page no:44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter a positive integer: \"\n", + "bound = int(raw_input())\n", + "print \"Fibonacci numbers < %d:\\n0, 1\" % bound ,\n", + "f0=0\n", + "f1=1\n", + "while (True):\n", + " f2 = f0 + f1\n", + " if (f2 > bound):\n", + " break\n", + " print \", %d\" % f2,\n", + " f0 = f1\n", + " f1 = f2\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Fibonacci numbers < 10:\n", + "0, 1 , 1 , 2 , 3 , 5 , 8\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.6,page no:44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import sys\n", + "print \"Enter a positive integer: \"\n", + "bound = int(raw_input())\n", + "print \"Fibonacci numbers < %d:\\n0, 1\" % bound ,\n", + "f0=0\n", + "f1=1\n", + "while (True):\n", + " f2 = f0 + f1\n", + " if (f2 > bound):\n", + " sys.exit(0)\n", + " print \", %d\" % f2,\n", + " f0 = f1\n", + " f1 = f2\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "ename": "SystemExit", + "evalue": "0", + "output_type": "pyerr", + "traceback": [ + "An exception has occurred, use %tb to see the full traceback.\n", + "\u001b[1;31mSystemExit\u001b[0m\u001b[1;31m:\u001b[0m 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Fibonacci numbers < 10:\n", + "0, 1 , 1 , 2 , 3 , 5 , 8" + ] + }, + { + "output_type": "stream", + "stream": "stderr", + "text": [ + "To exit: use 'exit', 'quit', or Ctrl-D.\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.7,page no:44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter a positive integer: \"\n", + "bound = int(raw_input())\n", + "print \"Fibonacci numbers < %d:\\n0, 1\" % bound ,\n", + "f0=0\n", + "f1=1\n", + "# Error : infinite loop !\n", + "while (True):\n", + " f2 = f0 + f1\n", + " # By commenting the below if statement, it goes to infinite.\n", + " if (f2 > bound):\n", + " break\n", + " print \", %d\" % f2,\n", + " f0 = f1\n", + " f1 = f2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Fibonacci numbers < 10:\n", + "0, 1 , 1 , 2 , 3 , 5 , 8\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.8,page no:45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter a positive integer: \"\n", + "bound = int(raw_input())\n", + "print \"Fibonacci numbers < %d:\\n0, 1\" % bound ,\n", + "f0=0\n", + "f1=1\n", + "# Error : infinite loop !\n", + "while (True):\n", + " f2 = f0 + f1\n", + " # By commenting the below if statement, it goes to infinite.\n", + " if (f2 > bound):\n", + " break\n", + " print \", %d\" % f2,\n", + " f0 = f1\n", + " f1 = f2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive integer: \n", + "Fibonacci numbers < 10:\n", + "0, 1 , 1 , 2 , 3 , 5 , 8\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.9,page no:45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "i=0\n", + "print \"Enter a positive integer: \"\n", + "n = int(raw_input())\n", + "s=0\n", + "while i<=n:\n", + " s += i\n", + " i += 1\n", + "print \"The sum of the first %d integers is %d\" %(n,s)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The sum of the first 10 integers is 55\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.10,page no:46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter a positive integer: \"\n", + "bound = int(raw_input())\n", + "print \"Factorial numbers < %d:\\n1, 1\" %bound,\n", + "f=1\n", + "i=1\n", + "while f < bound:\n", + " i += 1\n", + " f *= i\n", + " print \", %d\" %f,\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Factorial numbers < 10:\n", + "1, 1 , 2 , 6 , 24\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.11,page no:46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter a positive integer: \"\n", + "n = int(raw_input())\n", + "s=0;\n", + "for i in range(0,n+1):\n", + " s += i\n", + "print \"The sum of the first %d integers is %d\" %(n,s)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The sum of the first 10 integers is 55\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.12,page no:46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter a positive integer: \"\n", + "n = int(raw_input())\n", + "s=0\n", + "for i in range(1,n/2): # the scope of this i is this loop\n", + " s += i\n", + "\n", + "for i in range(n/2,n+1): # the scope of this i is this loop\n", + " s += i\n", + "print \"The sum of the first %d integers is %d\" % (n,s)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The sum of the first 10 integers is 55\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.13,page no:46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter a positive integer: \"\n", + "bound = int(raw_input())\n", + "\n", + "print \"Factorial numbers that are <= %d:\\n1, 1\" %bound,\n", + "f=1\n", + "for i in range(2,bound+1):\n", + " f *= i\n", + " print \", %d\" % f,\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Factorial numbers that are <= 10:\n", + "1, 1 , 2 , 6 , 24 , 120 , 720 , 5040 , 40320 , 362880 , 3628800\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.14,page no:46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "for i in range(10,0,-1):\n", + " print i,\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10 9 8 7 6 5 4 3 2 1\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.15,page no:46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "prime = True\n", + "print \"Enter a positive integer: \"\n", + "n = int(raw_input())\n", + "if (n < 2):\n", + " print \"%d is not prime.\" %n\n", + " prime = False\n", + "elif (n < 4):\n", + " print \"%d is prime.\" %n\n", + " prime = False\n", + "elif (n%2 == 0):\n", + " print \"%d = 2* %d\" %(n,n/2)\n", + " prime = False\n", + "else:\n", + " for d in range(3,n/2+1):\n", + " if (n%d == 0):\n", + " print \"%d = %d * %d\" %(n,d,n/d)\n", + " prime = False\n", + "if prime: \n", + " print \"%d is prime.\"%n\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "11\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "11 is prime.\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.11,page no:46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter positive integers (0 to quit): \";\n", + "n = int(raw_input())\n", + "m = n\n", + "while n > 0:\n", + " n = int(raw_input())\n", + " if n > m :\n", + " m = n\n", + "\n", + "print \"max = %d\" % m" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter positive integers (0 to quit): \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "19\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "42\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "max = 42\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.12,page no:46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter positive integers (0 to quit): \";\n", + "n = int(raw_input())\n", + "m = n\n", + "while n > 0: \n", + " if n < m :\n", + " m = n\n", + " n = int(raw_input())\n", + "\n", + "print \"min = %d\" % m\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter positive integers (0 to quit): \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "19\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "42\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "min = 1\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.13,page no:46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "m = 95\n", + "n = 11\n", + "while m%n > 0:\n", + " print \"%d modulo %d = %d\" %(m,n,m%n)\n", + " m -= 3\n", + " n += 1\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "95 modulo 11 = 7\n", + "92 modulo 12 = 8\n", + "89 modulo 13 = 11\n", + "86 modulo 14 = 2\n", + "83 modulo 15 = 8\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.14,page no:46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "for x in range(1,13):\n", + " for y in range(1,13):\n", + " print \"%4d\" % (x*y),\n", + " print \"\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1 2 3 4 5 6 7 8 9 10 11 12 \n", + " 2 4 6 8 10 12 14 16 18 20 22 24 \n", + " 3 6 9 12 15 18 21 24 27 30 33 36 \n", + " 4 8 12 16 20 24 28 32 36 40 44 48 \n", + " 5 10 15 20 25 30 35 40 45 50 55 60 \n", + " 6 12 18 24 30 36 42 48 54 60 66 72 \n", + " 7 14 21 28 35 42 49 56 63 70 77 84 \n", + " 8 16 24 32 40 48 56 64 72 80 88 96 \n", + " 9 18 27 36 45 54 63 72 81 90 99 108 \n", + " 10 20 30 40 50 60 70 80 90 100 110 120 \n", + " 11 22 33 44 55 66 77 88 99 110 121 132 \n", + " 12 24 36 48 60 72 84 96 108 120 132 144 \n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.15,page no:47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "# defines pow() and log()\n", + "\n", + "print \"Enter a positive integer: \"\n", + "n = int(raw_input())\n", + "d=0 # the discrete binary logarithm of n\n", + "p2d=1 # = 2^d\n", + "i = n\n", + "while i > 1:\n", + " # INVARIANT: 2^d <= n/i < 2*2^d\n", + " p2d=math.pow(2,d) # = 2^d\n", + " print \"%2d <= %2d\" %(p2d,2*p2d)\n", + " i /= 2\n", + " d += 1\n", + "\n", + "p2d=math.pow(2,d) # = 2^d\n", + "print \"%2d <= %2d < %2d\" %(p2d,n,2*p2d)\n", + "print \" The discrete binary logarithm of is %d\" % d \n", + "lgn = math.log(n)/math.log(2) # base 2 logarithm\n", + "print \"The continuous binary logarithm of is %f\" % lgn" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "17\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1 <= 2\n", + " 2 <= 4\n", + " 4 <= 8\n", + " 8 <= 16\n", + "16 <= 17 < 32\n", + " The discrete binary logarithm of is 4\n", + "The continuous binary logarithm of is 4.087463\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.16,page no:47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "i=1\n", + "print \"Enter a positive integer: \"\n", + "n = int(raw_input())\n", + "s=0\n", + "while (True):\n", + " if (i > n):\n", + " break\n", + " s += i\n", + " i += 1\n", + "\n", + "print \"The sum of the first %d integers is %d\" %(i,s)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The sum of the first 11 integers is 55\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.17,page no:48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "count=0\n", + "s=0\n", + "print \"Enter positive integers (0 to quit):\" \n", + "while True: # \"forever\"\n", + " print \"\\t %d :\" %(count + 1),\n", + " n = int(raw_input())\n", + " if (n <= 0):\n", + " break\n", + " count += 1\n", + " s += n\n", + "\n", + "print \"The average of those %d positive numbers is \" %count,\n", + "print float(s)/count\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter positive integers (0 to quit):\n", + "\t 1 :" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "12\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \t 2 :" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "32\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \t 3 :" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "11\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \t 4 :" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The average of those 3 positive numbers is 18.3333333333\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.18,page no:48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "for x in range(1,13):\n", + " for y in range(1,13):\n", + " if y>x:\n", + " break\n", + " else:\n", + " print '%4d' %(x*y),\n", + " print ''\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1 \n", + " 2 4 \n", + " 3 6 9 \n", + " 4 8 12 16 \n", + " 5 10 15 20 25 \n", + " 6 12 18 24 30 36 \n", + " 7 14 21 28 35 42 49 \n", + " 8 16 24 32 40 48 56 64 \n", + " 9 18 27 36 45 54 63 72 81 \n", + " 10 20 30 40 50 60 70 80 90 100 \n", + " 11 22 33 44 55 66 77 88 99 110 121 \n", + " 12 24 36 48 60 72 84 96 108 120 132 144 \n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.19,page no:48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "while True:\n", + " n = int(raw_input('Enter int : '))\n", + " if (n%2 == 0):\n", + " continue\n", + " if (n%3 == 0):\n", + " break\n", + " print \"\\tBottom of loop.\\n\"\n", + "print \"\\tOutside of loop.\\n\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter int : 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tBottom of loop.\n", + "\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter int : 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter int : 6\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter int : 9\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tOutside of loop.\n", + "\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.20,page no:49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "N=5\n", + "done=False\n", + "for i in range(N):\n", + " for j in range(N):\n", + " if done:\n", + " break\n", + " for k in range(N):\n", + " if done:\n", + " break\n", + " if (i+j+k>N):\n", + " done = True\n", + " else:\n", + " print i+j+k,\n", + " print \" \",\n", + " print \"* \"\n", + " print \".\" \n", + " done = False\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 1 2 3 4 * \n", + "1 2 3 4 5 * \n", + "2 3 4 5 * \n", + ".\n", + "1 2 3 4 5 * \n", + "2 3 4 5 * \n", + ".\n", + "2 3 4 5 * \n", + ".\n", + "3 4 5 * \n", + ".\n", + "4 5 * \n", + ".\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.21,page no:49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "N=5\n", + "done=False\n", + "for i in range(N):\n", + " for j in range(N):\n", + " if done:\n", + " break\n", + " for k in range(N):\n", + " if done:\n", + " break\n", + " if (i+j+k>N):\n", + " done = True\n", + " else:\n", + " print i+j+k,\n", + " print \" \",\n", + " print \"* \"\n", + " print \".\" \n", + " done = False\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 1 2 3 4 * \n", + "1 2 3 4 5 * \n", + "2 3 4 5 * \n", + ".\n", + "1 2 3 4 5 * \n", + "2 3 4 5 * \n", + ".\n", + "2 3 4 5 * \n", + ".\n", + "3 4 5 * \n", + ".\n", + "4 5 * \n", + ".\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.22,page no:50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import random\n", + "\n", + "# prints pseudo-random numbers:\n", + "\n", + "for i in range(0,8):\n", + " print random.random()\n", + "\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0.702115758628\n", + "0.969460447904\n", + "0.409934401112\n", + "0.700339443791\n", + "0.093528851602\n", + "0.132172955687\n", + "0.0162887279366\n", + "0.943010713478\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.23,page no:50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import random\n", + "# prints pseudo-random numbers:\n", + "print \"Enter seed: \"\n", + "seed = int(raw_input())\n", + "random.seed(seed);\n", + "for i in range(0,8):\n", + " print random.random()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter seed: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0.62290169489\n", + "0.741786989261\n", + "0.795193565566\n", + "0.942450283777\n", + "0.73989857474\n", + "0.922324996665\n", + "0.0290052282836\n", + "0.465622654378\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.24,page no:50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import random\n", + "for i in range(0,8):\n", + " print random.random()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0.943356716998\n", + "0.648974553137\n", + "0.900900491751\n", + "0.113205964653\n", + "0.469069047782\n", + "0.24657283262\n", + "0.543760859236\n", + "0.573941187928\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.25,page no:50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import random\n", + "print \"Enter minimum and maximum: \"\n", + "m = int(raw_input())\n", + "n = int(raw_input())\n", + "# lowest and highest numbers\n", + "r = n - m + 1\n", + "# number of numbers in range\n", + "for i in range(0,20):\n", + " j = int(random.random()*100 % r + m)\n", + " print j,\n", + " print \" \",\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter minimum and maximum: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "15\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "6 15 10 8 15 9 7 7 11 6 5 15 14 15 15 15 11 13 14 6 \n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch5-checkpoint.ipynb b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch5-checkpoint.ipynb new file mode 100644 index 00000000..b8c44538 --- /dev/null +++ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch5-checkpoint.ipynb @@ -0,0 +1,1741 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:77123054c419088f52a8a1edc4793072bd7aa51ddfc99d0a6390559c1c536392" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 5" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.1,page no:51" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# tests the sqrt() function:\n", + "for i in range(0,6):\n", + " print \"\\t %d \\t %f\" %(i,math.sqrt(i))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\t 0 \t 0.000000\n", + "\t 1 \t 1.000000\n", + "\t 2 \t 1.414214\n", + "\t 3 \t 1.732051\n", + "\t 4 \t 2.000000\n", + "\t 5 \t 2.236068\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.2,page no:52" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "# tests the identity sin 2x = 2 sin x cos x:\n", + "x = 0\n", + "while x < 2:\n", + " print \"%f \\t\\t %f \\t %f\" %(x,math.sin(2*x),2*math.sin(x)*math.cos(x))\n", + " x += 0.2\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0.000000 \t\t 0.000000 \t 0.000000\n", + "0.200000 \t\t 0.389418 \t 0.389418\n", + "0.400000 \t\t 0.717356 \t 0.717356\n", + "0.600000 \t\t 0.932039 \t 0.932039\n", + "0.800000 \t\t 0.999574 \t 0.999574\n", + "1.000000 \t\t 0.909297 \t 0.909297\n", + "1.200000 \t\t 0.675463 \t 0.675463\n", + "1.400000 \t\t 0.334988 \t 0.334988\n", + "1.600000 \t\t -0.058374 \t -0.058374\n", + "1.800000 \t\t -0.442520 \t -0.442520\n", + "2.000000 \t\t -0.756802 \t -0.756802\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.3,page no:52" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def cube(x):\n", + " # returns cube of x:\n", + " return x*x*x\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.4,page no:52" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def cube(x):\n", + " # returns cube of x:\n", + " return x*x*x\n", + "\n", + "# tests the cube() function:\n", + "n=1\n", + "while (n != 0):\n", + " n = int(raw_input())\n", + " print \"\\tcube( %d ) = %d\" %(n,cube(n))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tcube( 4 ) = 64\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tcube( 2 ) = 8\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tcube( 9 ) = 729\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tcube( 0 ) = 0\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.5,page no:53" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def maximum(x,y):\n", + " # returns larger of the two given integers:\n", + " if (x < y):\n", + " return y\n", + " else:\n", + " return x\n", + "\n", + "# tests the max() function:\n", + "m = 1\n", + "n = 1\n", + "while m != 0: \n", + " m = int(raw_input())\n", + " n = int(raw_input())\n", + " print \"\\tmax( %d , %d ) = %d\" %(m,n,maximum(m,n))\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tmax( 5 , 2 ) = 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tmax( 0 , 3 ) = 3\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.6,page no:53" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def maximum(x,y):\n", + " # returns larger of the two given integers:\n", + " if (x < y):\n", + " return y\n", + " else:\n", + " return x\n", + "\n", + "# tests the max() function:\n", + "m = 1\n", + "n = 1\n", + "while m != 0: \n", + " m = int(raw_input())\n", + " n = int(raw_input())\n", + " print \"\\tmax( %d , %d ) = %d\" %(m,n,maximum(m,n))\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tmax( 5 , 2 ) = 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tmax( 0 , 3 ) = 3\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.7,page no:53" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# returns larger of the two given integers:\n", + "\n", + "m = 1\n", + "n = 1\n", + "while m!=0:\n", + " m = int(raw_input())\n", + " n = int(raw_input())\n", + " print \"\\tmax(%d,%d) = %d\" %(m,n, max(m,n))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tmax(5,4) = 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tmax(4,3) = 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tmax(8,0) = 8\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tmax(0,5) = 5\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.8,page no:54" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def fact(n):\n", + " if (n < 0):\n", + " return 0\n", + " f = 1\n", + " while (n > 1):\n", + " f *= n\n", + " n -= 1\n", + " return f\n", + "\n", + "for i in range(-1,6):\n", + " print fact(i),\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 1 1 2 6 24 120\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.9,page no:54" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def fact(n):\n", + " if (n < 0):\n", + " return 0\n", + " f = 1\n", + " while (n > 1):\n", + " f *= n\n", + " n -= 1\n", + " return f\n", + "\n", + "\n", + "def perm(n,k):\n", + " # returns P(n,k), the number of permutations of k from n:\n", + " if (n < 0 or k < 0 or k > n):\n", + " return 0\n", + " return fact(n)/fact(n-k)\n", + "\n", + "for i in range(-1,8):\n", + " for j in range(-1,i+2):\n", + " print perm(i,j),\n", + " print ''\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 0 \n", + "0 1 0 \n", + "0 1 1 0 \n", + "0 1 2 2 0 \n", + "0 1 3 6 6 0 \n", + "0 1 4 12 24 24 0 \n", + "0 1 5 20 60 120 120 0 \n", + "0 1 6 30 120 360 720 720 0 \n", + "0 1 7 42 210 840 2520 5040 5040 0 \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.10,page no:54" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def printDate(m,d,y):\n", + " # prints the given date in literal form:\n", + " if (m < 1 or m > 12 or d < 1 or d > 31 or y < 0):\n", + " print \"Error: parameter out of range.\\n\"\n", + " return\n", + " if m == 1:\n", + " print \"January \",\n", + " elif m ==2:\n", + " print \"February \",\n", + " elif m==3 :\n", + " print \"March \",\n", + " elif m==4:\n", + " print \"April \",\n", + " elif m==5:\n", + " print \"May \",\n", + " elif m==6:\n", + " print \"June \",\n", + " elif m==7:\n", + " print \"July \",\n", + " elif m==8:\n", + " print \"August \",\n", + " elif m==9:\n", + " print \"September \",\n", + " elif m==10:\n", + " print \"October \",\n", + " elif m==1:\n", + " print \"November \",\n", + " else:\n", + " print \"December \",\n", + " print d , \", \", y \n", + "\n", + "# tests the printDate() function:\n", + "month = 1\n", + "while month > 0:\n", + " month = int(raw_input())\n", + " day = int(raw_input())\n", + " year = int(raw_input())\n", + " printDate(month,day,year)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "12\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1989\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "September 12 , 1989\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2001\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Error: parameter out of range.\n", + "\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.11,page no:55" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import string\n", + "def ispunct(s):\n", + " return all(c in string.punctuation for c in s)\n", + "def printCharCategory(c):\n", + " # prints the category to which the given character belongs:\n", + " print \"The character [\" + c + \"] is a \",\n", + " if(c.isdigit()):\n", + " print \"digit.\\n\"\n", + " elif (c.islower()):\n", + " print \"lower-case letter.\\n\"\n", + " elif (c.isupper()): \n", + " print \"capital letter.\\n\"\n", + " elif (c.isspace()):\n", + " print \"white space character.\\n\"\n", + " elif (ord(c) >= 10 and ord(c) <= 15 or ord(c) == 0):\n", + " print \"control character.\\n\"\n", + " elif (ispunct(c)):\n", + " print \"punctuation mark.\\n\"\n", + " else:\n", + " print \"Error.\\n\"\n", + "\n", + "# prints the category to which the given character belongs;\n", + "# tests the printCharCategory() function:\n", + "for c in range(128):\n", + " printCharCategory(chr(c))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The character [\u0000] is a control character.\n", + "\n", + "The character [\u0001] is a Error.\n", + "\n", + "The character [\u0002] is a Error.\n", + "\n", + "The character [\u0003] is a Error.\n", + "\n", + "The character [\u0004] is a Error.\n", + "\n", + "The character [\u0005] is a Error.\n", + "\n", + "The character [\u0006] is a Error.\n", + "\n", + "The character [\u0007] is a Error.\n", + "\n", + "The character [\b] is a Error.\n", + "\n", + "The character [\t] is a white space character.\n", + "\n", + "The character [\n", + "] is a white space character.\n", + "\n", + "The character [\u000b", + "] is a white space character.\n", + "\n", + "The character [\f", + "] is a white space character.\n", + "\n", + "The character [\r", + "] is a white space character.\n", + "\n", + "The character [\u000e] is a control character.\n", + "\n", + "The character [\u000f] is a control character.\n", + "\n", + "The character [\u0010] is a Error.\n", + "\n", + "The character [\u0011] is a Error.\n", + "\n", + "The character [\u0012] is a Error.\n", + "\n", + "The character [\u0013] is a Error.\n", + "\n", + "The character [\u0014] is a Error.\n", + "\n", + "The character [\u0015] is a Error.\n", + "\n", + "The character [\u0016] is a Error.\n", + "\n", + "The character [\u0017] is a Error.\n", + "\n", + "The character [\u0018] is a Error.\n", + "\n", + "The character [\u0019] is a Error.\n", + "\n", + "The character [\u001a] is a Error.\n", + "\n", + "The character [\u001b] is a Error.\n", + "\n", + "The character [\u001c", + "] is a Error.\n", + "\n", + "The character [\u001d", + "] is a Error.\n", + "\n", + "The character [\u001e", + "] is a Error.\n", + "\n", + "The character [\u001f] is a Error.\n", + "\n", + "The character [ ] is a white space character.\n", + "\n", + "The character [!] is a punctuation mark.\n", + "\n", + "The character [\"] is a punctuation mark.\n", + "\n", + "The character [#] is a punctuation mark.\n", + "\n", + "The character [$] is a punctuation mark.\n", + "\n", + "The character [%] is a punctuation mark.\n", + "\n", + "The character [&] is a punctuation mark.\n", + "\n", + "The character ['] is a punctuation mark.\n", + "\n", + "The character [(] is a punctuation mark.\n", + "\n", + "The character [)] is a punctuation mark.\n", + "\n", + "The character [*] is a punctuation mark.\n", + "\n", + "The character [+] is a punctuation mark.\n", + "\n", + "The character [,] is a punctuation mark.\n", + "\n", + "The character [-] is a punctuation mark.\n", + "\n", + "The character [.] is a punctuation mark.\n", + "\n", + "The character [/] is a punctuation mark.\n", + "\n", + "The character [0] is a digit.\n", + "\n", + "The character [1] is a digit.\n", + "\n", + "The character [2] is a digit.\n", + "\n", + "The character [3] is a digit.\n", + "\n", + "The character [4] is a digit.\n", + "\n", + "The character [5] is a digit.\n", + "\n", + "The character [6] is a digit.\n", + "\n", + "The character [7] is a digit.\n", + "\n", + "The character [8] is a digit.\n", + "\n", + "The character [9] is a digit.\n", + "\n", + "The character [:] is a punctuation mark.\n", + "\n", + "The character [;] is a punctuation mark.\n", + "\n", + "The character [<] is a punctuation mark.\n", + "\n", + "The character [=] is a punctuation mark.\n", + "\n", + "The character [>] is a punctuation mark.\n", + "\n", + "The character [?] is a punctuation mark.\n", + "\n", + "The character [@] is a punctuation mark.\n", + "\n", + "The character [A] is a capital letter.\n", + "\n", + "The character [B] is a capital letter.\n", + "\n", + "The character [C] is a capital letter.\n", + "\n", + "The character [D] is a capital letter.\n", + "\n", + "The character [E] is a capital letter.\n", + "\n", + "The character [F] is a capital letter.\n", + "\n", + "The character [G] is a capital letter.\n", + "\n", + "The character [H] is a capital letter.\n", + "\n", + "The character [I] is a capital letter.\n", + "\n", + "The character [J] is a capital letter.\n", + "\n", + "The character [K] is a capital letter.\n", + "\n", + "The character [L] is a capital letter.\n", + "\n", + "The character [M] is a capital letter.\n", + "\n", + "The character [N] is a capital letter.\n", + "\n", + "The character [O] is a capital letter.\n", + "\n", + "The character [P] is a capital letter.\n", + "\n", + "The character [Q] is a capital letter.\n", + "\n", + "The character [R] is a capital letter.\n", + "\n", + "The character [S] is a capital letter.\n", + "\n", + "The character [T] is a capital letter.\n", + "\n", + "The character [U] is a capital letter.\n", + "\n", + "The character [V] is a capital letter.\n", + "\n", + "The character [W] is a capital letter.\n", + "\n", + "The character [X] is a capital letter.\n", + "\n", + "The character [Y] is a capital letter.\n", + "\n", + "The character [Z] is a capital letter.\n", + "\n", + "The character [[] is a punctuation mark.\n", + "\n", + "The character [\\] is a punctuation mark.\n", + "\n", + "The character []] is a punctuation mark.\n", + "\n", + "The character [^] is a punctuation mark.\n", + "\n", + "The character [_] is a punctuation mark.\n", + "\n", + "The character [`] is a punctuation mark.\n", + "\n", + "The character [a] is a lower-case letter.\n", + "\n", + "The character [b] is a lower-case letter.\n", + "\n", + "The character [c] is a lower-case letter.\n", + "\n", + "The character [d] is a lower-case letter.\n", + "\n", + "The character [e] is a lower-case letter.\n", + "\n", + "The character [f] is a lower-case letter.\n", + "\n", + "The character [g] is a lower-case letter.\n", + "\n", + "The character [h] is a lower-case letter.\n", + "\n", + "The character [i] is a lower-case letter.\n", + "\n", + "The character [j] is a lower-case letter.\n", + "\n", + "The character [k] is a lower-case letter.\n", + "\n", + "The character [l] is a lower-case letter.\n", + "\n", + "The character [m] is a lower-case letter.\n", + "\n", + "The character [n] is a lower-case letter.\n", + "\n", + "The character [o] is a lower-case letter.\n", + "\n", + "The character [p] is a lower-case letter.\n", + "\n", + "The character [q] is a lower-case letter.\n", + "\n", + "The character [r] is a lower-case letter.\n", + "\n", + "The character [s] is a lower-case letter.\n", + "\n", + "The character [t] is a lower-case letter.\n", + "\n", + "The character [u] is a lower-case letter.\n", + "\n", + "The character [v] is a lower-case letter.\n", + "\n", + "The character [w] is a lower-case letter.\n", + "\n", + "The character [x] is a lower-case letter.\n", + "\n", + "The character [y] is a lower-case letter.\n", + "\n", + "The character [z] is a lower-case letter.\n", + "\n", + "The character [{] is a punctuation mark.\n", + "\n", + "The character [|] is a punctuation mark.\n", + "\n", + "The character [}] is a punctuation mark.\n", + "\n", + "The character [~] is a punctuation mark.\n", + "\n", + "The character [\u007f] is a Error.\n", + "\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.12,page no:56" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "def isPrime(n):\n", + " # returns True if n is prime, False otherwise:\n", + " sqrtn = math.sqrt(n)\n", + " if (n < 2):\n", + " return False\n", + " # 0 and 1 are not primes\n", + " if (n < 4):\n", + " return True\n", + " # 2 and 3 are the first primes\n", + " if (n%2 == 0):\n", + " return False\n", + " # 2 is the only even prime\n", + " for d in range(3,int(sqrtn+1),2):\n", + " if (n%d == 0):\n", + " return False\n", + " # n has a nontrivial divisor\n", + " return True;\n", + "\n", + "for n in range(0,80):\n", + " if (isPrime(n)):\n", + " print n,\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.13,page no:57" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def isLeapYear(y):\n", + " # returns true iff y is a leap year:\n", + " return (y % 4 == 0 and y % 100 != 0 or y % 400 == 0)\n", + "\n", + "# tests the isLeapYear() function:\n", + "n = 2\n", + "while n > 1:\n", + " n = int(raw_input())\n", + " if (isLeapYear(n)):\n", + " print \"%d is a leap year.\" % n\n", + " else:\n", + " print \"%d is not a leap year.\" %n\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2004\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "2004 is a leap year.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2006\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "2006 is not a leap year.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2013\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "2013 is not a leap year.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 is a leap year.\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.13,page no:57" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def age():\n", + " # prompts the user to input his/her age, and returns that value:\n", + " while (True):\n", + " print \"How old are you: \"\n", + " n = int(raw_input())\n", + " if (n < 0):\n", + " print \"\\a\\tYour age could not be negative.\"\n", + " elif (n > 120):\n", + " print \"\\a\\tYou could not be over 120.\"\n", + " else:\n", + " return n\n", + " print \"\\n\\tTry again.\\n\"\n", + "\n", + "a = age();\n", + "print \"\\nYou are %d years old.\" %a\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "How old are you: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "-12\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\u0007\tYour age could not be negative.\n", + "\n", + "\tTry again.\n", + "\n", + "How old are you: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "125\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\u0007\tYou could not be over 120.\n", + "\n", + "\tTry again.\n", + "\n", + "How old are you: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "24\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "You are 24 years old.\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.14,page no:58" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def swap(x,y):\n", + " # exchanges the values of x and y:\n", + " x[0],y[0] = y[0],x[0]\n", + "\n", + "a = [22.2]\n", + "b = [44.4]\n", + "print \"a = %.2f , b = %.2f \" %(a[0],b[0])\n", + "swap(a,b)\n", + "print \"a = %.2f , b = %.2f \" %(a[0],b[0])\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a = 22.20 , b = 44.40 \n", + "a = 44.40 , b = 22.20 \n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.15,page no:58" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def f(x,y):\n", + " x[0]= 88\n", + " y[0] = 99\n", + "\n", + "# tests the f() function:\n", + "a = [22]\n", + "b = [44]\n", + "print \"a = %.2f , b = %.2f \" %(a[0],b[0])\n", + "f(a,b)\n", + "print \"a = %.2f , b = %.2f \" %(a[0],b[0])\n", + "f(2*a,b)\n", + "print \"a = %.2f , b = %.2f \" %(a[0],b[0])\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a = 22.00 , b = 44.00 \n", + "a = 88.00 , b = 99.00 \n", + "a = 88.00 , b = 99.00 \n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.16,page no:59" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def computeCircle(r):\n", + " # returns the area and circumference of a circle with radius r:\n", + " PI = 3.141592653589793\n", + " area = PI*r*r\n", + " circumference = 2*PI*r\n", + " return area,circumference\n", + "\n", + "# tests the computeCircle() function:\n", + "print \"Enter radius: \"\n", + "r = int(raw_input())\n", + "a,c = computeCircle(r)\n", + "print \"area = %.2f , circumference = %.2f\" %(a,c)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter radius: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "area = 78.54 , circumference = 31.42\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.17,page no:59" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def f(x,y,z):\n", + " x[0] += z[0]\n", + " y[0] += z[0]\n", + " print \"x = %d , y = %d , z = %d\" %(x[0],y[0],z[0])\n", + "\n", + "x = [22]\n", + "y = [33]\n", + "z = [44]\n", + "\n", + "print \"x = %d , y = %d , z = %d\" %(x[0],y[0],z[0])\n", + "f(x,y,z)\n", + "print \"x = %d , y = %d , z = %d\" %(x[0],y[0],z[0])\n", + "x[0] = 2*x[0] - 3\n", + "f(x,y,z)\n", + "print \"x = %d , y = %d , z = %d\" %(x[0],y[0],z[0])\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = 22 , y = 33 , z = 44\n", + "x = 66 , y = 77 , z = 44\n", + "x = 66 , y = 77 , z = 44\n", + "x = 173 , y = 121 , z = 44\n", + "x = 173 , y = 121 , z = 44\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.18,page no:60" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def cube(x):\n", + " # returns cube of x:\n", + " return x*x*x\n", + "\n", + "# tests the cube() function:\n", + "print cube(4)\n", + "x = int(raw_input())\n", + "y = cube(2*x-3)\n", + "print y\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "64\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "343\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.19,page no:60" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "x = 11\n", + "\n", + "def f():\n", + " x = 44\n", + " print \"In f(): x = %d\" % x \n", + "\n", + "def g():\n", + " print \"In g(): x = %d\" % x \n", + "\n", + "x = 22\n", + "x = 33\n", + "print \"In block inside main(): x = %d\" % x\n", + "\n", + "\n", + "print \"In main(): x = %d\" % x \n", + "print \"In main(): ::x = %d\" % x \n", + "f()\n", + "g()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "In block inside main(): x = 33\n", + "In main(): x = 33\n", + "In main(): ::x = 33\n", + "In f(): x = 44\n", + "In g(): x = 33\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.20,page no:60" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def max_(x, y,z=0):\n", + " if x > y and x > y:\n", + " return x\n", + " elif y > x and y > z:\n", + " return y\n", + " else:\n", + " return z\n", + " \n", + " \n", + "print max(99,77), \" \" , max(55,66,33)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "99 66\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.21,page no:60" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter two integers: \"\n", + "n = int(raw_input())\n", + "d = int(raw_input())\n", + "if (d == 0):\n", + " import sys\n", + " sys.exit(0)\n", + "print n , \"/\" , d , \" = \" , n/d \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "8 / 2 = 4\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 5.22,page no:60" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def reciprocal(x):\n", + " #returns the reciprocal of x:\n", + " if (x == 0):\n", + " import sys\n", + " sys.exit(1); # terminate the program\n", + " return 1.0/x\n", + "\n", + "x = float(raw_input())\n", + "print reciprocal(x)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "25\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0.04\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.23,page no:60" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def p(x,a0,a1=0,a2=0,a3=0):\n", + " # returns a0 + a1*x + a2*x^2 + a3*x^3:\n", + " return (a0 + (a1 + (a2 + a3*x)*x)*x)\n", + "\n", + "\n", + "# tests the p() function:\n", + "x = 2.0003\n", + "print \"p(x,7) = %f\" % p(x,7)\n", + "print \"p(x,7,6) = %f\" % p(x,7,6)\n", + "print \"p(x,7,6,5) = %f\" % p(x,7,6,5)\n", + "print \"p(x,7,6,5,4) = %f\" % p(x,7,6,5,4)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "p(x,7) = 7.000000\n", + "p(x,7,6) = 19.001800\n", + "p(x,7,6,5) = 39.007800\n", + "p(x,7,6,5,4) = 71.022203\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch6-checkpoint.ipynb b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch6-checkpoint.ipynb new file mode 100644 index 00000000..c6a37ec7 --- /dev/null +++ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch6-checkpoint.ipynb @@ -0,0 +1,1305 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:86ba2090942c723ca01d7e01347ceafcb574aeb96d2587e1200836a9be752566" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 6" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.1,page no:61" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "a = [0, 0, 0]\n", + "a[2] = 55.55\n", + "a[0] = 11.11\n", + "a[1] = 33.33\n", + "print \"a[0] = \" , a[0] \n", + "print \"a[1] = \" , a[1] \n", + "print \"a[2] = \" , a[2] \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a[0] = 11.11\n", + "a[1] = 33.33\n", + "a[2] = 55.55\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.2,page no:61" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "SIZE=5 # defines the size N for 5 elements\n", + "a = []\n", + "# declares the array's elements as type double\n", + "print \"Enter \" , SIZE , \" numbers:\\t\"\n", + "for i in range(SIZE):\n", + " a.append(float(raw_input()))\n", + " \n", + "print \"In reverse order: \"\n", + "for i in range(SIZE-1,-1,-1):\n", + " print \"\\t\" , a[i]\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter 5 numbers:\t\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3.3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4.4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "In reverse order: \n", + "\t5.5\n", + "\t4.4\n", + "\t3.3\n", + "\t2.0\n", + "\t1.0\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.3,page no:62" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "a = [ 22.2, 44.4, 66.6 ]\n", + "\n", + "size = len(a)\n", + "for i in range(size):\n", + " print \"\\ta[\" , i , \"] = \" , a[i]\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\ta[ 0 ] = 22.2\n", + "\ta[ 1 ] = 44.4\n", + "\ta[ 2 ] = 66.6\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.4,page no:62" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "a = [ 22.2, 44.4, 66.6 , 0 ,0,0,0]\n", + "size = len(a)\n", + "for i in range(size):\n", + " print \"\\ta[\" , i , \"] = \" , a[i] \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\ta[ 0 ] = 22.2\n", + "\ta[ 1 ] = 44.4\n", + "\ta[ 2 ] = 66.6\n", + "\ta[ 3 ] = 0\n", + "\ta[ 4 ] = 0\n", + "\ta[ 5 ] = 0\n", + "\ta[ 6 ] = 0\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.5,page no:63" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import numpy\n", + "SIZE = 4\n", + "a = numpy.zeros(4)\n", + "# declares the array's elements as type float\n", + "for i in range(SIZE):\n", + " print \"\\ta[\" , i , \"] = \" , a[i]\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\ta[ 0 ] = 0.0\n", + "\ta[ 1 ] = 0.0\n", + "\ta[ 2 ] = 0.0\n", + "\ta[ 3 ] = 0.0\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.6,page no:63" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "SIZE=4\n", + "a = [ 33.3, 44.4, 55.5, 66.6 ]\n", + "for i in range(7): # ERROR: index is out of bounds!\n", + " print \"\\ta[\" , i , \"] = \" , a[i] \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "IndexError", + "evalue": "list index out of range", + "output_type": "pyerr", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mIndexError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 6\u001b[0m \u001b[0ma\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m[\u001b[0m \u001b[1;36m33.3\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m44.4\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m55.5\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m66.6\u001b[0m \u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 7\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mi\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m7\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m \u001b[1;31m# ERROR: index is out of bounds!\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 8\u001b[1;33m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"\\ta[\"\u001b[0m \u001b[1;33m,\u001b[0m \u001b[0mi\u001b[0m \u001b[1;33m,\u001b[0m \u001b[1;34m\"] = \"\u001b[0m \u001b[1;33m,\u001b[0m \u001b[0ma\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mi\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 9\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mIndexError\u001b[0m: list index out of range" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\ta[ 0 ] = 33.3\n", + "\ta[ 1 ] = 44.4\n", + "\ta[ 2 ] = 55.5\n", + "\ta[ 3 ] = 66.6\n", + "\ta[ 4 ] = " + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.7,page no:63" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "a = [ 22.2, 44.4, 66.6 ]\n", + "x=11.1\n", + "print \"x = \" , x \n", + "a.append(88.8) # ERROR: index is out of bounds!\n", + "print \"x = \" , x \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " x = 11.1\n", + "x = 11.1\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.8,page no:64" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "a = [ 22.2, 44.4, 66.6 ]\n", + "x=11.1\n", + "print \"x = \" , x \n", + "a[3333] = 88.8 # ERROR: index is out of bounds!\n", + "print \"x = \" , x \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "IndexError", + "evalue": "list assignment index out of range", + "output_type": "pyerr", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mIndexError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 6\u001b[0m \u001b[0mx\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m11.1\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 7\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"x = \"\u001b[0m \u001b[1;33m,\u001b[0m \u001b[0mx\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 8\u001b[1;33m \u001b[0ma\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m3333\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;36m88.8\u001b[0m \u001b[1;31m# ERROR: index is out of bounds!\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 9\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"x = \"\u001b[0m \u001b[1;33m,\u001b[0m \u001b[0mx\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mIndexError\u001b[0m: list assignment index out of range" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = 11.1\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.9,page no:64" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def sum_(a):\n", + " s = 0\n", + " for i in a:\n", + " s += i\n", + " return s\n", + " \n", + "a = [ 11, 33, 55, 77 ]\n", + "print \"sum(a) = \" , sum_(a) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "sum(a) = 176\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.10,page no:64" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def read(a):\n", + " print \"Enter integers. Terminate with 0:\\n\"\n", + " n = 1\n", + " while True:\n", + " n = int(raw_input(\"a[\" + str(len(a)) + \"]: \"))\n", + " if n == 0:\n", + " break\n", + " a.append(n)\n", + " \n", + "\n", + "def print_(a):\n", + " for i in a:\n", + " print i ,\n", + "\n", + "\n", + "a = []\n", + "read(a)\n", + "print \"The array has \" , len(a) , \" elements: \"\n", + "print_(a)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter integers. Terminate with 0:\n", + "\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "a[0]: 11\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "a[1]: 22\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "a[2]: 33\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "a[3]: 44\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "a[4]: 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The array has 4 elements: \n", + "11 22 33 44\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.11,page no:65" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import sys\n", + "a = [ 22, 44, 66, 88 ]\n", + "print \"a = \" , id(a) # the address of a[0]\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a = 169156908\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.12,page no:65" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def index(x,a,n):\n", + " for i in range(len(a)):\n", + " if (a[i] == x):\n", + " return i\n", + " return n # x not found\n", + "\n", + "a = [ 22, 44, 66, 88, 44, 66, 55 ]\n", + "print \"index(44,a,7) = \" , index(44,a,7)\n", + "print \"index(50,a,7) = \" , index(50,a,7) \n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "index(44,a,7) = 1\n", + "index(50,a,7) = 7\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.13,page no:65" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def sort(a,n):\n", + " # bubble sort:\n", + " n = len(a)\n", + " for i in range(n):\n", + " # bubble up max{a[0..n-i]}:\n", + " for j in range(n-i-1):\n", + " if (a[j] > a[j+1]):\n", + " a[j],a[j+1] = a[j+1],a[j]\n", + "\n", + "def print_(a):\n", + " for i in range(len(a)):\n", + " print a[i],\n", + " print ''\n", + " \n", + "a = [55.5, 22.5, 99.9, 66.6, 44.4, 88.8, 33.3, 77.7]\n", + "\n", + "print_(a)\n", + "sort(a,8)\n", + "print_(a)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "55.5 22.5 99.9 66.6 44.4 88.8 33.3 77.7 \n", + "22.5 33.3 44.4 55.5 66.6 77.7 88.8 99.9 \n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.14,page no:66" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def index(x,a,n):\n", + " # PRECONDITION: a[0] <= a[1] <= ... <= a[n-1];\n", + " # binary search:\n", + " lo=0\n", + " hi=n-1\n", + " while (lo <= hi):\n", + " i = (lo + hi)/2 # the average of lo and hi\n", + " if (a[i] == x):\n", + " return i\n", + " if (a[i] < x):\n", + " lo = i+1 # continue search in a[i+1..hi]\n", + " else:\n", + " hi = i-1 # continue search in a[lo..i-1]\n", + " return n # x was not found in a[0..n-1]\n", + "\n", + "a = [ 22, 33, 44, 55, 66, 77, 88 ]\n", + "print \"index(44,a,7) = \" , index(44,a,7)\n", + "print \"index(60,a,7) = \" , index(60,a,7) \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "index(44,a,7) = 2\n", + "index(60,a,7) = 7\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.15,page no:66" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def isNondecreasing(a,n):\n", + " # returns true iff a[0] <= a[1] <= ... <= a[n-1]:\n", + " for i in range(1,n):\n", + " if (a[i]\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 34\u001b[0m \u001b[0ma\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m[\u001b[0m \u001b[1;36m22\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m33\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m44\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m55\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m66\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m77\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m88\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m60\u001b[0m \u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 35\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"index(44,a,7) = \"\u001b[0m \u001b[1;33m,\u001b[0m \u001b[0mindex\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m44\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0ma\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m7\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 36\u001b[1;33m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"index(44,a,7) = \"\u001b[0m \u001b[1;33m,\u001b[0m \u001b[0mindex\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m44\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0ma\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m8\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 37\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"index(60,a,7) = \"\u001b[0m \u001b[1;33m,\u001b[0m \u001b[0mindex\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m60\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0ma\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m8\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;32m\u001b[0m in \u001b[0;36mindex\u001b[1;34m(x, a, n)\u001b[0m\n\u001b[0;32m 18\u001b[0m \u001b[1;31m# PRECONDITION: a[0] <= a[1] <= ... <= a[n-1];\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 19\u001b[0m \u001b[1;31m# binary search:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 20\u001b[1;33m \u001b[1;32massert\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0misNondecreasing\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0ma\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mn\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 21\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 22\u001b[0m \u001b[0mlo\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mAssertionError\u001b[0m: " + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "index(44,a,7) = 2\n", + "index(44,a,7) = " + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.17,page no:67" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Day = [ 0, 1, 2, 3, 4, 5, 6 ]\n", + "high = [ 88.3, 95.0, 91.2, 89.9, 91.4, 92.5, 86.7]\n", + "\n", + "for i in Day:\n", + " print \"The high temperature for day \" , i , \" was \" , high[i] \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The high temperature for day 0 was 88.3\n", + "The high temperature for day 1 was 95.0\n", + "The high temperature for day 2 was 91.2\n", + "The high temperature for day 3 was 89.9\n", + "The high temperature for day 4 was 91.4\n", + "The high temperature for day 5 was 92.5\n", + "The high temperature for day 6 was 86.7\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.18,page no:68" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def sort(a,n):\n", + " a.sort()\n", + "\n", + "def print_(a,n):\n", + " for i in a:\n", + " print i,\n", + " print ''\n", + "a = [55.5, 22.5, 99.9, 66.6, 44.4, 88.8, 33.3, 77.7]\n", + "print_(a,8);\n", + "sort(a,8)\n", + "print_(a,8)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.19,page no:68" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def read(a):\n", + " print \"Enter 15 integers, 5 per row:\\n\"\n", + " for i in range(3):\n", + " ar = []\n", + " print \"Row \" , i , \": \",\n", + " for j in range(5):\n", + " ar.append(int(raw_input()))\n", + " a.append(ar)\n", + "\n", + "def print_(a):\n", + " for i in range(3):\n", + " for j in range(5):\n", + " print a[i][j],\n", + " print ''\n", + "a = []\n", + "read(a)\n", + "print_(a)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter 15 integers, 5 per row:\n", + "\n", + "Row 0 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "44\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "77\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "33\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "11\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "44\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Row 1 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "60\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "50\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "30\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "90\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "70\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Row 2 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "85\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "25\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "45\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "45\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 44 77 33 11 44 \n", + "60 50 30 90 70 \n", + "85 25 45 45 55 \n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.20,page no:69" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def read(score):\n", + " for s in range(3):\n", + " print \"Student \" , s , \": \",\n", + " st = []\n", + " for q in range(5):\n", + " st.append(int(raw_input()))\n", + " score.append(st)\n", + "\n", + "def printQuizAverages(score):\n", + " for s in range(3):\n", + " sm = 0\n", + " for q in range(5):\n", + " sm += score[s][q]\n", + " print \"\\tStudent \" , s , \": \" , sm/5.0\n", + "\n", + "def printClassAverages(score):\n", + " for q in range(5):\n", + " sm = 0\n", + " for s in range(3):\n", + " sm += score[s][q]\n", + " print \"\\tQuiz \" , q , \": \" , sm/3.0\n", + "\n", + "\n", + "\n", + "NUM_STUDENTS = 3\n", + "NUM_QUIZZES = 5\n", + "\n", + "\n", + "score = []\n", + "print \"Enter \" , NUM_QUIZZES , \" scores for each student: \"\n", + "read(score)\n", + "print \"The quiz averages are:\"\n", + "printQuizAverages(score)\n", + "print \"The class averages are: \"\n", + "printClassAverages(score)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter 5 scores for each student: \n", + "Student 0 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Student 1 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Student 2 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The quiz averages are:\n", + "\tStudent 0 : 8.2\n", + "\tStudent 1 : 8.8\n", + "\tStudent 2 : 7.0\n", + "The class averages are: \n", + "\tQuiz 0 : 7.33333333333\n", + "\tQuiz 1 : 7.33333333333\n", + "\tQuiz 2 : 8.33333333333\n", + "\tQuiz 3 : 8.33333333333\n", + "\tQuiz 4 : 8.66666666667\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.21,page no:70" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def numZeros(a,n1,n2,n3):\n", + " count = 0\n", + " for i in range(n1):\n", + " for j in range(n2):\n", + " for k in range(n3):\n", + " if (a[i][j][k] == 0):\n", + " count += 1\n", + " return count\n", + "\n", + "\n", + "a = [ [ [5,0,2], [0,0,9], [4,1,0], [7,7,7] ],[ [3,0,0], [8,5,0], [0,0,0], [2,0,9] ]]\n", + "print \"This array has \" , numZeros(a,2,4,3) , \" zeros\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "This array has 11 zeros\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch7-checkpoint.ipynb b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch7-checkpoint.ipynb new file mode 100644 index 00000000..e6190713 --- /dev/null +++ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch7-checkpoint.ipynb @@ -0,0 +1,757 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:6699bf736ed72aedd025ae33d176cd6c4322cc2ded5a842b50655fd4e4828256" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 7" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.1,page no:71" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "n=44\n", + "print \"n = \" , n \n", + "# prints the value of n\n", + "print \"&n = \" , hex(id(n)) # prints the address of n\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = 44\n", + "&n = 0x8fc0eec\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.2,page no:72" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "n = [44]\n", + "rn=n # r is a synonym for n\n", + "print \"n = \" , n , \", rn = \" , rn \n", + "n[0] -= 1\n", + "print \"n = \" , n , \", rn = \" , rn \n", + "rn[0] *= 2\n", + "print \"n = \" , n , \", rn = \" , rn \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = [44] , rn = [44]\n", + "n = [43] , rn = [43]\n", + "n = [86] , rn = [86]\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.3,page no:73" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "n = [44]\n", + "rn=n # r is a synonym for n\n", + "print \"&n = \" , hex(id(n)) , \", rn = \" , hex(id(rn ))\n", + "rn2 = n\n", + "rn3 = rn\n", + "print \"&rn2 = \" , hex(id(rn2)) , \", rn = \" , hex(id(rn ))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "&n = 0x9c6228c , rn = 0x9c6228c\n", + "&rn2 = 0x9c6228c , rn = 0x9c6228c\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.4,page no:74" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "n = [44]\n", + "print \"n = \" , n , \", &n = \" , hex(id(n))\n", + "pn = n\n", + "print \"pn = \" , hex(id(pn)) , \", &pn = \" , hex(id(hex(id(pn))))\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = [44] , &n = 0x9c624ec\n", + "pn = 0x9c624ec , &pn = 0x9c6aa60\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.5,page no:74" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "n = [44]\n", + "print \"n = \" , n , \", &n = \" , hex(id(n))\n", + "pn = n\n", + "print \"\\tpn = \" , hex(id(pn)) , \",\\n &pn = \" , hex(id(hex(id(pn))))\n", + "print \"*pn = \" , pn\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = [44] , &n = 0x9c58d6c\n", + "\tpn = 0x9c58d6c ,\n", + " &pn = 0x9c6ab20\n", + "*pn = [44]\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.6,page no:75" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "n = [44]\n", + "print \"n = \" , n , \", &n = \" , hex(id(n))\n", + "pn = n\n", + "print \"\\tpn = \" , hex(id(pn)) , \",\\n &pn = \" , hex(id(hex(id(pn))))\n", + "print \"*pn = \" , pn\n", + "ppn = pn\n", + "\n", + "print \" ppn = \" , hex(id(hex(id(ppn)))) \n", + "print \" &ppn = \" , hex(id(hex(id(hex(id(ppn))))))\n", + "print \" *ppn = \" , hex(id(ppn)) \n", + "print \"**ppn = \" , ppn \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = [44] , &n = 0x9bf05ac\n", + "\tpn = 0x9bf05ac ,\n", + " &pn = 0x9c58160\n", + "*pn = [44]\n", + " ppn = 0x9c58680\n", + " &ppn = 0x9c58160\n", + " *ppn = 0x9bf05ac\n", + "**ppn = [44]\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.7,page no:75" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "n = [44]\n", + "print \"n = \" , n , \"\\n &n = \" , hex(id(n))\n", + "pn = n\n", + "print \"\\tpn = \" , hex(id(pn)) , \",\\n &pn = \" , hex(id(hex(id(pn))))\n", + "print \"*pn = \" , pn\n", + "nn = pn\n", + "print \" ppn = \" , hex(id(nn))\n", + "print \" &ppn = \" , hex(id(hex(id(nn))))\n", + "rpn = pn\n", + "print \" ppn = \" , hex(id(rpn))\n", + "print \" &ppn = \" , hex(id(hex(id(rpn))))\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = [44] \n", + " &n = 0x9bf60ec\n", + "\tpn = 0x9bf60ec ,\n", + " &pn = 0x9bf0e40\n", + "*pn = [44]\n", + " ppn = 0x9bf60ec\n", + " &ppn = 0x9bf0e40\n", + " ppn = 0x9bf60ec\n", + " &ppn = 0x9bf0f20\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.8,page no:76" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def max_(m,n):\n", + " if m>n:\n", + " return m\n", + " else:\n", + " return n\n", + "\n", + "m = 44\n", + "n = 22\n", + "print m , \", \" , n , \", \" , max_(m,n)\n", + "m = max_(m,n) \n", + "m = 55\n", + "# changes the value of m from 44 to 55\n", + "print m , \", \" , n , \", \" , max_(m,n) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "44 , 22 , 44\n", + "55 , 22 , 55\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.9,page no:77" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "v = []\n", + "for k in range(1,5):\n", + " v.append(1.0/k)\n", + "\n", + "for i in range(4):\n", + " print \"v[\" , i , \"] = \" , v[i]\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "v[ 0 ] = 1.0\n", + "v[ 1 ] = 0.5\n", + "v[ 2 ] = 0.333333333333\n", + "v[ 3 ] = 0.25\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.10,page no:77" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import sys\n", + "a = [22, 33, 44]\n", + "\n", + "print \"a = \" , hex(id(a))\n", + "print \"sizeof(int) = \" , sys.getsizeof(1) \n", + "s = 0\n", + "for i in a:\n", + " s += i\n", + " print \"\\t i = \" , hex(id(i)),\n", + " print \"\\t *i = \" , i,\n", + " print \"\\t sum = \" , s\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a = 0x9bf688c\n", + "sizeof(int) = 12\n", + "\t i = 0x8fc0ff4 \t *i = 22 \t sum = 22\n", + "\t i = 0x8fc0f70 \t *i = 33 \t sum = 55\n", + "\t i = 0x8fc0eec \t *i = 44 \t sum = 99\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.11,page no:78" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "a = [22, 33, 44, 55, 66]\n", + "print \"a = \" , hex(id(a)) , \", *a = \" , a[0] \n", + "for p in a:\n", + " print \"p = \" , hex(id(p)) , \", *p = \" , p \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a = 0x9c6526c , *a = 22\n", + "p = 0x8fc0ff4 , *p = 22\n", + "p = 0x8fc0f70 , *p = 33\n", + "p = 0x8fc0eec , *p = 44\n", + "p = 0x8fc0e68 , *p = 55\n", + "p = 0x8fc0de4 , *p = 66\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.12,page no:78" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "def loc(a1,a2,n1,n2):\n", + " p = []\n", + " for element in a2:\n", + " if element in a1:\n", + " p.append(element)\n", + " return p\n", + "\n", + "a1 = [11, 11, 11, 11, 11, 22, 33, 44, 55]\n", + "a2 = [11, 11, 11, 22, 33]\n", + "print \"Array a1 begins at location\\t\" , hex(id(a1 ))\n", + "print \"Array a2 begins at location\\t\" , hex(id(a2)) \n", + "p = loc(a1, a2, 9, 5)\n", + "if (p):\n", + " print \"Array a2 found at location\\t\" , hex(id(p))\n", + " for i in range(len(p)):\n", + " print \"\\t\" , hex(id(p[i])) , \": \" , p[i], \"\\t\" , hex(id(a2[i])) , \": \" , a2[i] \n", + "else:\n", + " print \"Not found.\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Array a1 begins at location\t0x9bea56c\n", + "Array a2 begins at location\t0x9bea62c\n", + "Array a2 found at location\t0x9bea6cc\n", + "\t0x8fc1078 : 11 \t0x8fc1078 : 11\n", + "\t0x8fc1078 : 11 \t0x8fc1078 : 11\n", + "\t0x8fc1078 : 11 \t0x8fc1078 : 11\n", + "\t0x8fc0ff4 : 22 \t0x8fc0ff4 : 22\n", + "\t0x8fc0f70 : 33 \t0x8fc0f70 : 33\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.13,page no:79" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "def get(a):\n", + " print \"Enter number of items: \"\n", + " n = int(raw_input())\n", + " print \"Enter \" , n , \" items, one per line:\"\n", + " for i in range(n):\n", + " print \"\\t\" , i+1 , \": \",\n", + " a.append(float(raw_input()))\n", + "\n", + "def print_(a):\n", + " for i in range(len(a)):\n", + " print a[i] ,\n", + " print ''\n", + "\n", + "a = []\n", + "get(a)\n", + "print_(a)\n", + "a = []\n", + "get(a)\n", + "print_(a)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter number of items: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter 4 items, one per line:\n", + "\t1 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "44.4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \t2 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "77.7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \t3 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "22.2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \t4 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "88.8\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 44.4 77.7 22.2 88.8 \n", + "Enter number of items: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter 2 items, one per line:\n", + "\t1 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3.33\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \t2 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9.99\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 3.33 9.99 \n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.14,page no:79" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "def sort(p, n):\n", + " for i in range(1,n):\n", + " for j in range(n-i):\n", + " if (p[j] > p[j+1]):\n", + " p[j],p[j+1] = p[j+1],p[j]\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.15,page no:80" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "def sum_(k,n):\n", + " # returns the sum f(0) + f(1) + f(2) + . . . + f(n-1):\n", + " s = 0\n", + " for i in range(1,n+1):\n", + " s += k(i)\n", + " return s\n", + "\n", + "def square(k):\n", + " return k*k\n", + "\n", + "def cube(k):\n", + " return k*k*k\n", + "\n", + "\n", + "print sum_(square,4) # 1 + 4 + 9 + 16\n", + "print sum_(cube,4) # 1 + 8 + 27 + 64\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "30\n", + "100\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch8-checkpoint.ipynb b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch8-checkpoint.ipynb new file mode 100644 index 00000000..237cbb1c --- /dev/null +++ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch8-checkpoint.ipynb @@ -0,0 +1,1107 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:62fa005b0530efaca0bc120e55a83439d9ca1c65b41086243699e148e802b6c4" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 8" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.1,page no:81" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "n= [44] # n holds the int 44\n", + "print \"int n=44; // n holds the int 44:\\n\";\n", + "print \"\\t\\t n = \" , n \n", + "print \"\\t\\t &n = \" , hex(id(n))\n", + "pn = n \n", + "print \"int* pn=&n; // pn holds the address of n:\\n\";\n", + "print \"\\t\\t n = \" , n \n", + "print \"\\t\\t &n = \" , hex(id(n))\n", + "print \"\\t\\t pn = \" , hex(id(pn)) \n", + "print \"\\t\\t &pn = \" , hex(id(hex(id(pn))))\n", + "print \"\\t\\t *pn = \" , pn\n", + "\n", + "pn[0] = 77 # changes the value of n to 77\n", + "print \"*pn = 77; // changes the value of n to 77:\\n\";\n", + "print \"\\t\\t n = \" , n \n", + "print \"\\t\\t &n = \" , hex(id(n))\n", + "print \"\\t\\t pn = \" , hex(id(pn)) \n", + "print \"\\t\\t &pn = \" , hex(id(hex(id(pn))))\n", + "print \"\\t\\t *pn = \" , pn\n", + "\n", + "q = n \n", + "print \"int* q=&n; // q also holds the address of n:\\n\";\n", + "print \"\\t\\t n = \" , n \n", + "print \"\\t\\t &n = \" , hex(id(n))\n", + "print \"\\t\\t pn = \" , hex(id(pn)) \n", + "print \"\\t\\t &pn = \" , hex(id(hex(id(pn))))\n", + "print \"\\t\\t *pn = \" , pn\n", + "print \"\\t\\t q = \" , hex(id(q))\n", + "print \"\\t\\t &q = \" , hex(id(hex(id(hex(id(pn))))))\n", + "print \"\\t\\t *q = \" , q \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "int n=44; // n holds the int 44:\n", + "\n", + "\t\t n = [44]\n", + "\t\t &n = 0x9bfb92c\n", + "int* pn=&n; // pn holds the address of n:\n", + "\n", + "\t\t n = [44]\n", + "\t\t &n = 0x9bfb92c\n", + "\t\t pn = 0x9bfb92c\n", + "\t\t &pn = 0x9bf5aa0\n", + "\t\t *pn = [44]\n", + "*pn = 77; // changes the value of n to 77:\n", + "\n", + "\t\t n = [77]\n", + "\t\t &n = 0x9bfb92c\n", + "\t\t pn = 0x9bfb92c\n", + "\t\t &pn = 0x9c6a760\n", + "\t\t *pn = [77]\n", + "int* q=&n; // q also holds the address of n:\n", + "\n", + "\t\t n = [77]\n", + "\t\t &n = 0x9bfb92c\n", + "\t\t pn = 0x9bfb92c\n", + "\t\t &pn = 0x9bf5c80\n", + "\t\t *pn = [77]\n", + "\t\t q = 0x9bfb92c\n", + "\t\t &q = 0x9c6a760\n", + "\t\t *q = [77]\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.2,page no:82" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "s = \"ABCD\"\n", + "for i in range(4):\n", + " print \"s[\" , i , \"] = '\" , s[i] , \"'\\n\";\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "s[ 0 ] = ' A '\n", + "\n", + "s[ 1 ] = ' B '\n", + "\n", + "s[ 2 ] = ' C '\n", + "\n", + "s[ 3 ] = ' D '\n", + "\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.3,page no:83" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "while True:\n", + " word = raw_input()\n", + " if len(word) < 2:\n", + " break\n", + " l = word.split(' ')\n", + " for i in l:\n", + " print '\\t\"' , i , '\"'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Today's date is March 12, 2000.\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\t\" Today's \"\n", + "\t\" date \"\n", + "\t\" is \"\n", + "\t\" March \"\n", + "\t\" 12, \"\n", + "\t\" 2000. \"\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Tomorrow is Monday.\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\t\" Tomorrow \"\n", + "\t\" is \"\n", + "\t\" Monday. \"\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.4,page no:84" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "while True:\n", + " line = raw_input()\n", + " if len(line) < 2:\n", + " break\n", + " print \"\\t[\" , line , \"]\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Once upon a midnight dreary, while I pondered, weak and weary,\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\t[ Once upon a midnight dreary, while I pondered, weak and weary, ]\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Over a many quaint and curious volume of forgotten lore,\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\t[ Over a many quaint and curious volume of forgotten lore, ]\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.5,page no:84" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "\n", + "while True:\n", + " word = raw_input()\n", + " if len(word) < 2:\n", + " break\n", + " l = word.split(',')\n", + " for i in range(len(l)-1):\n", + " print '\\t[' , l[i] , ']'\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Once upon a midnight dreary, while I pondered, weak and weary,\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\t[ Once upon a midnight dreary ]\n", + "\t[ while I pondered ]\n", + "\t[ weak and weary ]\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Over a many quaint and curious volume of forgotten lore,\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\t[ Over a many quaint and curious volume of forgotten lore ]\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.6,page no:85" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "count = 0\n", + "while True:\n", + " a = raw_input()\n", + " if len(a) < 1:\n", + " break\n", + " for ch in a:\n", + " if (ch == 'e'): count+=1\n", + " \n", + "print count , \" e's were counted.\\n\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Once upon a midnight dreary, while I pondered, weak and weary,\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Over many a quaint and curious volume of forgotten lore,\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "11 e's were counted.\n", + "\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.7,page no:85" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "while True:\n", + " a = raw_input()\n", + " if len(a) < 1:\n", + " break\n", + " print a.title()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Fourscore and seven years ago our fathers\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Fourscore And Seven Years Ago Our Fathers\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "brought forth upon this continent a new nation,\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Brought Forth Upon This Continent A New Nation,\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.8,page no:85" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "a = raw_input()\n", + "l = a.split(' ')\n", + "nos = []\n", + "for i in l:\n", + " try:\n", + " i = int(i)\n", + " nos.append(i)\n", + " except:\n", + " continue\n", + "m = nos[0]\n", + "n = nos[1] \n", + "print m , \" + \" , n , \" = \" , m+n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "what is 305 plus 9416 ?\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "305 + 9416 = 9721\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.9,page no:86" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "name = []\n", + "count=0\n", + "\n", + "print \"Enter at most 4 names with at most 19 characters:\\n\";\n", + "while (True):\n", + " n = raw_input()\n", + " if len(n) < 1:\n", + " break\n", + " name.append(n)\n", + " count += 1\n", + " \n", + "print \"The names are:\\n\"\n", + "for i in range(count):\n", + " print \"\\t\" , i , \". [\" , name[i] , \"]\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter at most 4 names with at most 19 characters:\n", + "\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "George Washington\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "John Adams\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thomas Jefferson\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The names are:\n", + "\n", + "\t0 . [ George Washington ]\n", + "\t1 . [ John Adams ]\n", + "\t2 . [ Thomas Jefferson ]\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.10,page no:86" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "name = []\n", + "count=0\n", + "\n", + "print \"Enter at most 4 names with at most 19 characters:\\n\";\n", + "while (True):\n", + " n = raw_input()\n", + " if len(n) < 1:\n", + " break\n", + " name.append(n)\n", + " count += 1\n", + " \n", + "print \"The names are:\\n\"\n", + "for i in range(count):\n", + " print \"\\t\" , i , \". [\" , name[i] , \"]\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter at most 4 names with at most 19 characters:\n", + "\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "George Washington\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "John Adams\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thomas Jefferson\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The names are:\n", + "\n", + "\t0 . [ George Washington ]\n", + "\t1 . [ John Adams ]\n", + "\t2 . [ Thomas Jefferson ]\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.11,page no:87" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "name = [ \"George Washington\", \"John Adams\", \"Thomas Jefferson\"]\n", + "print \"The names are:\\n\"\n", + "for i in range(3):\n", + " print \"\\t\" , i , \". [\" , name[i] , \"]\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The names are:\n", + "\n", + "\t0 . [ George Washington ]\n", + "\t1 . [ John Adams ]\n", + "\t2 . [ Thomas Jefferson ]\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.12,page no:87" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "s = \"ABCDEFG\"\n", + "print \"len(\" , s , \") = \" , len(s) \n", + "print \"len(\\\"\\\") = \" , len(\"\")\n", + "print \"Enter string: \"\n", + "b = raw_input()\n", + "print \"len(\" , b , \") = \" , len(b)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "len( ABCDEFG ) = 7\n", + "len(\"\") = 0\n", + "Enter string: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "hello how are you !!!\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "len( hello how are you !!! ) = 21\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.13,page no:87" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "s = \"The Mississippi is a long river.\"\n", + "print 's = \"' , s , '\"'\n", + "p = s.find(' ')\n", + "print \"find(s, ' ') points to s[\" , p , \"].\"\n", + "p = s.find('s')\n", + "print \"find(s, 's') points to s[\" , p , \"].\"\n", + "p = s.rfind('s')\n", + "print \"reverse find(s, 's') points to s[\" , p , \"].\"\n", + "p = s.find(\"is\")\n", + "print \"strstr(s, \\\"is\\\") points to s[\" , p , \"].\"\n", + "p = s.find(\"isi\")\n", + "if p== -1:\n", + " print 's.find(\"isi\") returns NULL'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "s = \" The Mississippi is a long river. \"\n", + "find(s, ' ') points to s[ 3 ].\n", + "find(s, 's') points to s[ 6 ].\n", + "reverse find(s, 's') points to s[ 17 ].\n", + "strstr(s, \"is\") points to s[ 5 ].\n", + "s.find(\"isi\") returns NULL\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.14,page no:88" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "s1 = \"ABCDEFG\"\n", + "s2 = \"XYZ\" \n", + "print \"Before strcpy(s1,s2):\\n\" \n", + "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n", + "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \n", + "s1 = s2\n", + "print \"After strcpy(s1,s2):\\n\" \n", + "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n", + "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Before strcpy(s1,s2):\n", + "\n", + "\ts1 = [ ABCDEFG ], length = 7\n", + "\ts2 = [ XYZ ], length = 3\n", + "After strcpy(s1,s2):\n", + "\n", + "\ts1 = [ XYZ ], length = 3\n", + "\ts2 = [ XYZ ], length = 3\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.15,page no:88" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "s1 = \"ABCDEFG\"\n", + "s2 = \"XYZ\" \n", + "print \"Before strcpy(s1,s2,2):\\n\" \n", + "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n", + "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \n", + "s1 = s2[:2] + s1[2:]\n", + "print \"After strcpy(s1,s2,2):\\n\" \n", + "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n", + "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Before strcpy(s1,s2,2):\n", + "\n", + "\ts1 = [ ABCDEFG ], length = 7\n", + "\ts2 = [ XYZ ], length = 3\n", + "After strcpy(s1,s2,2):\n", + "\n", + "\ts1 = [ XYCDEFG ], length = 7\n", + "\ts2 = [ XYZ ], length = 3\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.16,page no:89" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "s1 = \"ABCDEFG\"\n", + "s2 = \"XYZ\" \n", + "print \"Before string concatination :\\n\" \n", + "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n", + "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \n", + "s1 += s2\n", + "print \"After string concatination :\" \n", + "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n", + "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Before string concatination :\n", + "\n", + "\ts1 = [ ABCDEFG ], length = 7\n", + "\ts2 = [ XYZ ], length = 3\n", + "After string concatination :\n", + "\ts1 = [ ABCDEFGXYZ ], length = 10\n", + "\ts2 = [ XYZ ], length = 3\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.17,page no:89" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "s1 = \"ABCDEFG\"\n", + "s2 = \"XYZ\" \n", + "print \"Before string concatination :\\n\" \n", + "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n", + "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \n", + "s1 += s2[:2]\n", + "print \"After string concatination :\" \n", + "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n", + "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Before string concatination :\n", + "\n", + "\ts1 = [ ABCDEFG ], length = 7\n", + "\ts2 = [ XYZ ], length = 3\n", + "After string concatination :\n", + "\ts1 = [ ABCDEFGXY ], length = 9\n", + "\ts2 = [ XYZ ], length = 3\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.18,page no:89" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "s = \"Today's date is March 12, 2000.\"\n", + "\n", + "print \"The string is: [\" , s , \"] \\nIts tokens are: \"\n", + "p = s.split(\" \")\n", + "\n", + "for i in p:\n", + " print \"\\t[\" , i , \"] \"\n", + "\n", + "print \"Now the string is: [\" , p[0] , \"] \";\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The string is: [ Today's date is March 12, 2000. ] \n", + "Its tokens are: \n", + "\t[ Today's ] \n", + "\t[ date ] \n", + "\t[ is ] \n", + "\t[ March ] \n", + "\t[ 12, ] \n", + "\t[ 2000. ] \n", + "Now the string is: [ Today's ] \n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.19,page no:90" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "def strpbrk(s,s1):\n", + " found = []\n", + " for i in range(len(s1)):\n", + " if s1[i] in s:\n", + " index = s.find(s1[i])\n", + " found.append(index)\n", + " if found:\n", + " return min(found)\n", + " return None\n", + " \n", + "\n", + "s = \"The Mississippi is a long river.\"\n", + "print 's = \"' , s , '\"'\n", + "p = strpbrk(s, \"nopqr\")\n", + "print 'strpbrk(s, \"nopqr\") points to s[' , p , \"].\"\n", + "p = strpbrk(s, \"NOPQR\")\n", + "if (p == None):\n", + " print 'strpbrk(s, \"NOPQR\") returns NULL.\\n'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "s = \" The Mississippi is a long river. \"\n", + "strpbrk(s, \"nopqr\") points to s[ 12 ].\n", + "strpbrk(s, \"NOPQR\") returns NULL.\n", + "\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch9-checkpoint.ipynb b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch9-checkpoint.ipynb new file mode 100644 index 00000000..1cd941a7 --- /dev/null +++ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/.ipynb_checkpoints/ch9-checkpoint.ipynb @@ -0,0 +1,442 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:b465729456848e8d32471e4641e4867caf52a122691eda5b2eb2bc49d2d70056" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 9" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 9.1page no:91" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "while True:\n", + " try:\n", + " n = int(raw_input())\n", + " print \"n = \" , n \n", + " except:\n", + " break" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "46\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = 46\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "22\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = 22\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "44\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = 44\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "66\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = 66\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "88\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = 88\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "33,\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 9.2,page no:92" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "king = [] # defines king to be an array \n", + "n=0\n", + "while True:\n", + " name = raw_input()\n", + " if len(name) < 1:\n", + " break\n", + " king.append(name)\n", + " n += 1\n", + "# now n == the number of names read\n", + "for i in range(n):\n", + " print '\\t' , i+1 , \". \" , king[i] " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Kenneth II (971-995)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Constantine III (995-997)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Kenneth III (997-1005)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Malcolm II (1005-1034)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Duncan I (1034-1040)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Macbeth (1040-1057)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Lulach (1057-1058)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Malcolm III (1058-1093)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\t1 . Kenneth II (971-995)\n", + "\t2 . Constantine III (995-997)\n", + "\t3 . Kenneth III (997-1005)\n", + "\t4 . Malcolm II (1005-1034)\n", + "\t5 . Duncan I (1034-1040)\n", + "\t6 . Macbeth (1040-1057)\n", + "\t7 . Lulach (1057-1058)\n", + "\t8 . Malcolm III (1058-1093)\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 9.3,page no:93" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "infile = open(\"input.txt\",\"r\")\n", + "outfile = open(\"output.txt\",\"w\")\n", + "\n", + "for i in infile:\n", + " s = i.title()\n", + " outfile.write(s)\n", + "\n", + "infile.close()\n", + "outfile.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "IOError", + "evalue": "[Errno 2] No such file or directory: 'input.txt'", + "output_type": "pyerr", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mIOError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 5\u001b[0m '''\n\u001b[0;32m 6\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 7\u001b[1;33m \u001b[0minfile\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mopen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"input.txt\"\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m\"r\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 8\u001b[0m \u001b[0moutfile\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mopen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"output.txt\"\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m\"w\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 9\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mIOError\u001b[0m: [Errno 2] No such file or directory: 'input.txt'" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 9.4,page no:94" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "fin1 = open(\"north.dat\",\"r\")\n", + "fin2 = open(\"south.dat\",\"r\")\n", + "fout = open(\"combined.dat\",\"w\")\n", + "\n", + "file1 = []\n", + "file2 = []\n", + "for i in fin1:\n", + " try:\n", + " s = i.split(\" \")\n", + " for j in s:\n", + " file1.append(int(j))\n", + " except:\n", + " continue\n", + " \n", + "for i in fin2:\n", + " try:\n", + " s = i.split(\" \")\n", + " for j in s:\n", + " file2.append(int(j))\n", + " except:\n", + " continue\n", + "\n", + "\n", + "for i in sorted(file1 + file2):\n", + " fout.write(str(i) + \" \")\n", + "\n", + "fin1.close()\n", + "fin2.close()\n", + "fout.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "IOError", + "evalue": "[Errno 2] No such file or directory: 'north.dat'", + "output_type": "pyerr", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mIOError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 3\u001b[0m '''\n\u001b[0;32m 4\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 5\u001b[1;33m \u001b[0mfin1\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mopen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"north.dat\"\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m\"r\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 6\u001b[0m \u001b[0mfin2\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mopen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"south.dat\"\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m\"r\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 7\u001b[0m \u001b[0mfout\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mopen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"combined.dat\"\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m\"w\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mIOError\u001b[0m: [Errno 2] No such file or directory: 'north.dat'" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 9.5,page no:95" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "def print_(oss):\n", + " print 'oss.str() = \"' , str(oss) , '\"'\n", + "\n", + "s=\"ABCDEFG\"\n", + "n=33\n", + "x=2.718\n", + "l = ''\n", + "print_(l)\n", + "l += s\n", + "print_(l)\n", + "l += ( \" \" + str(n) )\n", + "print_(l)\n", + "l += ( \" \" + str(x) )\n", + "print_(l)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "oss.str() = \" \"\n", + "oss.str() = \" ABCDEFG \"\n", + "oss.str() = \" ABCDEFG 33 \"\n", + "oss.str() = \" ABCDEFG 33 2.718 \"\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "def print_(iss,s='',n=0,x=0.0):\n", + " print 's = \"' , s , '\", n = ' , n , \", x = \" , x, ', iss.str() = \"' \\\n", + " , iss , '\"' \n", + "\n", + "s=\"\"\n", + "n=0\n", + "x=0.0\n", + "l = ''\n", + "iss = \"ABCDEFG 44 3.14\"\n", + "print_(iss)\n", + "s = \"ABCDEFG\"\n", + "print_(iss,s)\n", + "n = 44\n", + "print_(iss,s,n)\n", + "x = 3.14\n", + "print_(iss,s,n,x)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "s = \" \", n = 0 , x = 0.0 , iss.str() = \" ABCDEFG 44 3.14 \"\n", + "s = \" ABCDEFG \", n = 0 , x = 0.0 , iss.str() = \" ABCDEFG 44 3.14 \"\n", + "s = \" ABCDEFG \", n = 44 , x = 0.0 , iss.str() = \" ABCDEFG 44 3.14 \"\n", + "s = \" ABCDEFG \", n = 44 , x = 3.14 , iss.str() = \" ABCDEFG 44 3.14 \"\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch10.ipynb b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch10.ipynb similarity index 88% rename from Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch10.ipynb rename to Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch10.ipynb index 11bfc69a..5fe24819 100644 --- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch10.ipynb +++ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch10.ipynb @@ -1,13 +1,29 @@ { "metadata": { "name": "", - "signature": "sha256:80ec9afde7f244065f945a9a64c1b3fb1bcbaba0a8461385eab8b48cd3e4fc70" + "signature": "sha256:4bd71e2ab98c0a521e91d96198885bb27706ae6b8dac798e4a3c45fec0a13869" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 10" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.1:page no:101" + ] + }, { "cell_type": "code", "collapsed": false, @@ -50,6 +66,14 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.2:page no:102" + ] + }, { "cell_type": "code", "collapsed": false, @@ -73,6 +97,14 @@ "outputs": [], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.3:page no:103" + ] + }, { "cell_type": "code", "collapsed": false, @@ -105,6 +137,14 @@ ], "prompt_number": 3 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.4:page no:105" + ] + }, { "cell_type": "code", "collapsed": false, @@ -149,6 +189,14 @@ ], "prompt_number": 4 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.5:page no:105" + ] + }, { "cell_type": "code", "collapsed": false, @@ -174,6 +222,14 @@ "outputs": [], "prompt_number": 5 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.6:page no:106" + ] + }, { "cell_type": "code", "collapsed": false, @@ -197,6 +253,14 @@ "outputs": [], "prompt_number": 6 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.7:page no:106" + ] + }, { "cell_type": "code", "collapsed": false, @@ -230,6 +294,14 @@ ], "prompt_number": 7 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.8:page no:106" + ] + }, { "cell_type": "code", "collapsed": false, @@ -295,6 +367,14 @@ ], "prompt_number": 8 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.9:page no:107" + ] + }, { "cell_type": "code", "collapsed": false, @@ -368,6 +448,14 @@ ], "prompt_number": 9 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.10:page no:107" + ] + }, { "cell_type": "code", "collapsed": false, @@ -443,6 +531,14 @@ ], "prompt_number": 12 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.11:page no:107" + ] + }, { "cell_type": "code", "collapsed": false, @@ -477,6 +573,14 @@ ], "prompt_number": 13 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.12:page no:108" + ] + }, { "cell_type": "code", "collapsed": false, @@ -506,6 +610,14 @@ ], "prompt_number": 14 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.13:page no:108" + ] + }, { "cell_type": "code", "collapsed": false, @@ -599,6 +711,14 @@ ], "prompt_number": 15 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.14:page no:108" + ] + }, { "cell_type": "code", "collapsed": false, @@ -641,6 +761,14 @@ ], "prompt_number": 16 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.15:page no:109" + ] + }, { "cell_type": "code", "collapsed": false, @@ -684,6 +812,14 @@ ], "prompt_number": 17 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.16:page no:109" + ] + }, { "cell_type": "code", "collapsed": false, @@ -727,6 +863,14 @@ ], "prompt_number": 18 }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + }, { "cell_type": "code", "collapsed": false, diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch11.ipynb b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch11.ipynb similarity index 90% rename from Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch11.ipynb rename to Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch11.ipynb index 34fb61dc..316c5977 100644 --- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch11.ipynb +++ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch11.ipynb @@ -1,13 +1,29 @@ { "metadata": { "name": "", - "signature": "sha256:bdd5f9e441ccb7e3a87f4d8c5492d0aa1d228caba299fc1b0c667abb12780a1e" + "signature": "sha256:2e5aa5b3434352a0b9d6ebcbf16a1ff4cc5f7498207ae522537459300ba1cc0b" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 11" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.1,page no:111" + ] + }, { "cell_type": "code", "collapsed": false, @@ -33,6 +49,14 @@ "outputs": [], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.2,page no:112" + ] + }, { "cell_type": "code", "collapsed": false, @@ -50,6 +74,14 @@ "outputs": [], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.3,page no:113" + ] + }, { "cell_type": "code", "collapsed": false, @@ -82,6 +114,14 @@ "outputs": [], "prompt_number": 3 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.4,page no:114" + ] + }, { "cell_type": "code", "collapsed": false, @@ -100,6 +140,14 @@ "outputs": [], "prompt_number": 4 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.5,page no:115" + ] + }, { "cell_type": "code", "collapsed": false, @@ -169,6 +217,14 @@ ], "prompt_number": 5 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.6,page no:115" + ] + }, { "cell_type": "code", "collapsed": false, @@ -201,6 +257,14 @@ "outputs": [], "prompt_number": 6 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.7,page no:115" + ] + }, { "cell_type": "code", "collapsed": false, @@ -226,6 +290,14 @@ "outputs": [], "prompt_number": 7 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.8,page no:116" + ] + }, { "cell_type": "code", "collapsed": false, @@ -271,6 +343,14 @@ ], "prompt_number": 8 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.9,page no:116" + ] + }, { "cell_type": "code", "collapsed": false, @@ -376,6 +456,14 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.10,page no:116" + ] + }, { "cell_type": "code", "collapsed": false, @@ -455,6 +543,14 @@ ], "prompt_number": 3 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.11,page no:117" + ] + }, { "cell_type": "code", "collapsed": false, @@ -527,6 +623,14 @@ ], "prompt_number": 5 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.12,page no:117" + ] + }, { "cell_type": "code", "collapsed": false, @@ -600,6 +704,14 @@ ], "prompt_number": 9 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.13,page no:118" + ] + }, { "cell_type": "code", "collapsed": false, diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch12.ipynb b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch12.ipynb similarity index 91% rename from Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch12.ipynb rename to Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch12.ipynb index 2fc62abb..ed6f662d 100644 --- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch12.ipynb +++ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch12.ipynb @@ -1,13 +1,29 @@ { "metadata": { "name": "", - "signature": "sha256:f377691760a60edd5db7fbe78ee867c7be9afd9802ecd81bd9e073874d13c99c" + "signature": "sha256:032ae59642dc41d08f8a2152ed2bc49f4d25ecde730526f089f073d2c1d499a2" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 12" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.1,page no:121" + ] + }, { "cell_type": "code", "collapsed": false, @@ -44,6 +60,14 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.2,page no:121" + ] + }, { "cell_type": "code", "collapsed": false, @@ -131,6 +155,14 @@ ], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.3,page no:122" + ] + }, { "cell_type": "code", "collapsed": false, @@ -205,6 +237,14 @@ ], "prompt_number": 3 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.4,page no:123" + ] + }, { "cell_type": "code", "collapsed": false, @@ -291,6 +331,14 @@ ], "prompt_number": 4 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.5,page no:124" + ] + }, { "cell_type": "code", "collapsed": false, @@ -387,6 +435,14 @@ ], "prompt_number": 5 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.6,page no:126" + ] + }, { "cell_type": "code", "collapsed": false, @@ -439,6 +495,14 @@ ], "prompt_number": 6 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.7,page no:126" + ] + }, { "cell_type": "code", "collapsed": false, @@ -482,6 +546,14 @@ ], "prompt_number": 7 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.8,page no:126" + ] + }, { "cell_type": "code", "collapsed": false, @@ -507,6 +579,14 @@ "outputs": [], "prompt_number": 8 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.9,page no:127" + ] + }, { "cell_type": "code", "collapsed": false, @@ -540,6 +620,14 @@ "outputs": [], "prompt_number": 9 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.10,page no:128" + ] + }, { "cell_type": "code", "collapsed": false, @@ -572,6 +660,14 @@ ], "prompt_number": 10 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.11,page no:128" + ] + }, { "cell_type": "code", "collapsed": false, @@ -622,6 +718,14 @@ ], "prompt_number": 11 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.12,page no:129" + ] + }, { "cell_type": "code", "collapsed": false, @@ -667,6 +771,14 @@ ], "prompt_number": 13 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.13,page no:129" + ] + }, { "cell_type": "code", "collapsed": false, diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch13.ipynb b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch13.ipynb similarity index 87% rename from Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch13.ipynb rename to Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch13.ipynb index 5261a124..e8b7922b 100644 --- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch13.ipynb +++ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch13.ipynb @@ -1,13 +1,29 @@ { "metadata": { "name": "", - "signature": "sha256:ca23888d127466a3b56ff597f51112b17faee9e92f25f41708b3d49e2ac19a08" + "signature": "sha256:9cabae4713ff25d4bdda7fcdc6441caa3ccbdea296fd6ae77ade3fbf96acb5a5" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 13" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.1,page no:131" + ] + }, { "cell_type": "code", "collapsed": false, @@ -31,6 +47,14 @@ "outputs": [], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.2,page no:132" + ] + }, { "cell_type": "code", "collapsed": false, @@ -73,6 +97,14 @@ ], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.3,page no:133" + ] + }, { "cell_type": "code", "collapsed": false, @@ -125,6 +157,14 @@ ], "prompt_number": 3 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.4,page no:134" + ] + }, { "cell_type": "code", "collapsed": false, @@ -159,6 +199,14 @@ ], "prompt_number": 4 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.5,page no:135" + ] + }, { "cell_type": "code", "collapsed": false, @@ -216,6 +264,14 @@ ], "prompt_number": 5 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.6,page no:136" + ] + }, { "cell_type": "code", "collapsed": false, @@ -262,6 +318,14 @@ ], "prompt_number": 6 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.7,page no:137" + ] + }, { "cell_type": "code", "collapsed": false, @@ -301,6 +365,14 @@ ], "prompt_number": 7 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.8,page no:138" + ] + }, { "cell_type": "code", "collapsed": false, diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch14.ipynb b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch14.ipynb similarity index 87% rename from Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch14.ipynb rename to Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch14.ipynb index 6d15626d..84861804 100644 --- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch14.ipynb +++ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch14.ipynb @@ -1,13 +1,29 @@ { "metadata": { "name": "", - "signature": "sha256:81aae5e06fff42b82bf693bbb18c1546fd839925af34574cc2f25fff08c2a482" + "signature": "sha256:56bc0876dbfc540836629377189659f34df0d07125ac0d4220e04d96bf53cc42" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 14" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 14.1,page no:141" + ] + }, { "cell_type": "code", "collapsed": false, @@ -52,6 +68,14 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 14.2,page no:142" + ] + }, { "cell_type": "code", "collapsed": false, @@ -95,6 +119,14 @@ ], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 14.3,page no:143" + ] + }, { "cell_type": "code", "collapsed": false, @@ -139,6 +171,14 @@ ], "prompt_number": 3 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 14.4,page no:144" + ] + }, { "cell_type": "code", "collapsed": false, @@ -184,6 +224,14 @@ ], "prompt_number": 4 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 14.5,page no:145" + ] + }, { "cell_type": "code", "collapsed": false, @@ -238,6 +286,14 @@ ], "prompt_number": 5 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 14.6,page no:146" + ] + }, { "cell_type": "code", "collapsed": false, @@ -298,6 +354,14 @@ ], "prompt_number": 6 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 14.7,page no:147" + ] + }, { "cell_type": "code", "collapsed": false, @@ -351,6 +415,14 @@ ], "prompt_number": 7 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 14.8,page no:148" + ] + }, { "cell_type": "code", "collapsed": false, @@ -412,6 +484,14 @@ ], "prompt_number": 8 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 14.9,page no:149" + ] + }, { "cell_type": "code", "collapsed": false, @@ -477,6 +557,14 @@ ], "prompt_number": 9 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 14.10,page no:150" + ] + }, { "cell_type": "code", "collapsed": false, diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch15.ipynb b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch15.ipynb similarity index 100% rename from Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch15.ipynb rename to Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch15.ipynb diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch16.ipynb b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch16.ipynb similarity index 100% rename from Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch16.ipynb rename to Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch16.ipynb diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch2.ipynb b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch2.ipynb similarity index 85% rename from Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch2.ipynb rename to Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch2.ipynb index 7167565e..670046c3 100644 --- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch2.ipynb +++ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch2.ipynb @@ -1,13 +1,29 @@ { "metadata": { "name": "", - "signature": "sha256:6dd70c1f71cf7fe5898008fd909312cd4643245d1663bc204223830088a91083" + "signature": "sha256:0edad02485746c86f7a6286bbd0371f16175bcf7f2941a8a68c0cd459191e9f2" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 2" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.1,page no:121" + ] + }, { "cell_type": "code", "collapsed": false, @@ -34,6 +50,14 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.2,page no:122" + ] + }, { "cell_type": "code", "collapsed": false, @@ -66,6 +90,14 @@ ], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.3,page no:123" + ] + }, { "cell_type": "code", "collapsed": false, @@ -93,6 +125,14 @@ ], "prompt_number": 3 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.4,page no:124" + ] + }, { "cell_type": "code", "collapsed": false, @@ -127,6 +167,14 @@ ], "prompt_number": 4 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.5,page no:125" + ] + }, { "cell_type": "code", "collapsed": false, @@ -157,6 +205,14 @@ ], "prompt_number": 5 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.6,page no:126" + ] + }, { "cell_type": "code", "collapsed": false, @@ -195,6 +251,14 @@ ], "prompt_number": 6 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.7,page no:127" + ] + }, { "cell_type": "code", "collapsed": false, @@ -227,6 +291,14 @@ ], "prompt_number": 7 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.8,page no:128" + ] + }, { "cell_type": "code", "collapsed": false, @@ -259,6 +331,14 @@ ], "prompt_number": 8 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.9,page no:128" + ] + }, { "cell_type": "code", "collapsed": false, @@ -285,6 +365,14 @@ ], "prompt_number": 9 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.10,page no:128" + ] + }, { "cell_type": "code", "collapsed": false, @@ -309,6 +397,14 @@ ], "prompt_number": 10 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.11,page no:128" + ] + }, { "cell_type": "code", "collapsed": false, @@ -346,6 +442,14 @@ ], "prompt_number": 11 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.12,page no:128" + ] + }, { "cell_type": "code", "collapsed": false, @@ -377,6 +481,14 @@ ], "prompt_number": 12 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.13,page no:128" + ] + }, { "cell_type": "code", "collapsed": false, @@ -411,6 +523,14 @@ ], "prompt_number": 13 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.14,page no:129" + ] + }, { "cell_type": "code", "collapsed": false, @@ -446,6 +566,14 @@ ], "prompt_number": 14 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.15,page no:129" + ] + }, { "cell_type": "code", "collapsed": false, @@ -521,6 +649,14 @@ ], "prompt_number": 15 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.16,page no:130" + ] + }, { "cell_type": "code", "collapsed": false, @@ -553,6 +689,14 @@ ], "prompt_number": 16 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.17,page no:130" + ] + }, { "cell_type": "code", "collapsed": false, @@ -574,6 +718,14 @@ "outputs": [], "prompt_number": 17 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.18,page no:131" + ] + }, { "cell_type": "code", "collapsed": false, @@ -620,4 +772,4 @@ "metadata": {} } ] -} \ No newline at end of file +} diff --git a/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch2.ipynb~ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch2.ipynb~ new file mode 100644 index 00000000..670046c3 --- /dev/null +++ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch2.ipynb~ @@ -0,0 +1,775 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:0edad02485746c86f7a6286bbd0371f16175bcf7f2941a8a68c0cd459191e9f2" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 2" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.1,page no:121" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# prints the value of a boolean variable:\n", + "flag=False\n", + "print \"flag = %r\" % flag\n", + "flag = True\n", + "print \"flag = %r\" % flag" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "flag = False\n", + "flag = True\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.2,page no:122" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# prints the character and its internally stored\n", + "c='A'\n", + "print \"c = \" + c + \", int(c) = %d\" % ord(c)\n", + "c='t'\n", + "print \"c = \" + c + \", int(c) = %d\" % ord(c)\n", + "c='\\t' # the tab character\n", + "print \"c = \" + c + \", int(c) = %d\" % ord(c)\n", + "c='!'\n", + "print \"c = \" + c + \", int(c) = %d\" % ord(c)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "c = A, int(c) = 65\n", + "c = t, int(c) = 116\n", + "c = \t, int(c) = 9\n", + "c = !, int(c) = 33\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.3,page no:123" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import sys\n", + "# defines the constants SHRT_MIN, etc.\n", + "print 'maximum limit int : ',\n", + "print sys.maxint\n", + "print 'float info'\n", + "print sys.float_info" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "maximum limit int : 2147483647\n", + "float info\n", + "sys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.220446049250313e-16, radix=2, rounds=1)\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.4,page no:124" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# tests operators +, -, *, /, and %:\n", + "m=54\n", + "n=20\n", + "print \"m = %d and n = %d\" %(m,n)\n", + "print \"m+n = %d\" % (m+n) # 54+20 = 74\n", + "print \"m-n = %d\" % (m-n) # 54-20 = 34\n", + "print \"m*n = %d\" % (m*n)# 54*20 = 1080\n", + "print \"m/n = %d\" % (m/n) # 54/20 = 2\n", + "print \"m modulo by n = %d\" % (m%n) # 54%20 = 14" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "m = 54 and n = 20\n", + "m+n = 74\n", + "m-n = 34\n", + "m*n = 1080\n", + "m/n = 2\n", + "m modulo by n = 14\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.5,page no:125" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# shows the difference between m++ and ++m:\n", + "m = 44\n", + "m += 1\n", + "n = m\n", + "print \"m = %d , n = %d\" %(m,n)\n", + "m = 44\n", + "n = m # the post-increment operator is applied to m\n", + "m += 1\n", + "print \"m = %d , n = %d\" %(m,n)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "m = 45 , n = 45\n", + "m = 45 , n = 44\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.6,page no:126" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# tests arithmetic assignment operators:\n", + "n=22\n", + "print \"n = %d\" % n\n", + "n += 9 # adds 9 to n\n", + "print \"After n += 9, n = %d\" % n\n", + "n -= 5 # subtracts 5 from n\n", + "print \"After n -= 5, n = %d\" % n\n", + "n *= 2 # multiplies n by 3\n", + "print \"After n *= 2, n = %d\" % n \n", + "n /= 3 # divides n by 9\n", + "print \"After n /= 3, n = %d\" % n \n", + "n %= 7 # reduces n to the remainder from dividing by 4\n", + "print 'After n modulo by 7 n = %d' %n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = 22\n", + "After n += 9, n = 31\n", + "After n -= 5, n = 26\n", + "After n *= 2, n = 52\n", + "After n /= 3, n = 17\n", + "After n modulo by 7 n = 3\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.7,page no:127" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# tests the floating-point operators +, -, *, and /:\n", + "x=54.0\n", + "y=20.0\n", + "print \"x = %f and y = %f\" %(x,y)\n", + "print \"x+y = %f\" %(x+y) # 54.0+20.0 = 74.0\n", + "print \"x-y = %f\" % (x-y) # 54.0-20.0 = 34.0\n", + "print \"x*y = %f\" %( x*y) # 54.0*20.0 = 1080.0\n", + "print \"x/y = %f\" % (x/y) # 54.0/20.0 = 2.7\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = 54.000000 and y = 20.000000\n", + "x+y = 74.000000\n", + "x-y = 34.000000\n", + "x*y = 1080.000000\n", + "x/y = 2.700000\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.8,page no:128" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import sys\n", + "# prints the storage sizes of the fundamental types:\n", + "print \"Number of bytes used:\\n\"\n", + "\n", + "print \" char: %d \" % sys.getsizeof('a')\n", + "print \" int : %d \" % sys.getsizeof(int(1))\n", + "print \" string : %d \" % sys.getsizeof(str('hellololdei'))\n", + "print \"float : %d\" % sys.getsizeof(float(1.1))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of bytes used:\n", + "\n", + " char: 22 \n", + " int : 12 \n", + " string : 32 \n", + "float : 16\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.9,page no:128" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import sys\n", + "# prints the storage sizes of the fundamental types:\n", + "fbits = 8*sys.getsizeof(float(123))\n", + "\n", + "# each byte contains 8 bits\n", + "print \"float uses : %d bits:\\n\\t\" % fbits \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "float uses : 128 bits:\n", + "\t\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.10,page no:128" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# casts a double value as an int:\n", + "v = 1234.56789\n", + "n = int(v);\n", + "print \"v = %f, n = %d\" %(v,n)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "v = 1234.567890, n = 1234\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.11,page no:128" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# prints promoted vales of 65 from char to double:\n", + "c='A'\n", + "print \"char c = \" + c\n", + "k=c;\n", + "print \"k = \" + k \n", + "m=k;\n", + "print \"m = \" + m \n", + "n=m\n", + "print \"n = \" + n\n", + "x=m\n", + "print \"x = \" + x \n", + "y=x\n", + "print \"y = \" + y" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "char c = A\n", + "k = A\n", + "m = A\n", + "n = A\n", + "x = A\n", + "y = A\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.12,page no:128" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# prints n until it overflows:\n", + "n=1000\n", + "print \"n = %d\" % n\n", + "n *= 1000 # multiplies n by 1000\n", + "print \"n = %d\" % n\n", + "n *= 1000 # multiplies n by 1000\n", + "print \"n = %d\" % n\n", + "n *= 1000 # multiplies n by 1000\n", + "print \"n = %d\" % n\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = 1000\n", + "n = 1000000\n", + "n = 1000000000\n", + "n = 1000000000000\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.13,page no:128" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# prints x until it overflows:\n", + "x=1000.0\n", + "print \"x = %f\" % x\n", + "x *= x # multiplies n by itself; i.e., it squares x\n", + "print \"x = %f\" % x\n", + "x *= x # multiplies n by itself; i.e., it squares x\n", + "print \"x = %f\" % x\n", + "x *= x # multiplies n by itself; i.e., it squares x\n", + "print \"x = %f\" % x\n", + "x *= x # multiplies n by itself; i.e., it squares x\n", + "print \"x = %f\" % x\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = 1000.000000\n", + "x = 1000000.000000\n", + "x = 1000000000000.000000\n", + "x = 999999999999999983222784.000000\n", + "x = 1000000000000000043845843045076197354634047651840.000000\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.14,page no:129" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# illustrates round-off error::\n", + "x = 1000/3.0\n", + "print \"x = %f\" %x # x = 1000/3\n", + "y = x - 333.0\n", + "print \"y = %f\" % y # y = 1/3\n", + "z = 3*y - 1.0\n", + "print \"z = %f\" %z # z = 3(1/3) - 1\n", + "if (z == 0):\n", + " print \"z == 0.\\n\"\n", + "else:\n", + " print \"z does not equal 0.\\n\" # z != 0\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = 333.333333\n", + "y = 0.333333\n", + "z = -0.000000\n", + "z does not equal 0.\n", + "\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.15,page no:129" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# implements the quadratic formula\n", + "a = float(raw_input(\"Enter the coefficients of a quadratic equation:\\n a : \"))\n", + "b = float(raw_input('b : '))\n", + "c = float(raw_input('c : '))\n", + "\n", + "print \"The equation is: \",\n", + "print a,\n", + "print \"*x*x + \",\n", + "print b,\n", + "print \"*x + \" ,\n", + "print c,\n", + "print \" = 0\" \n", + "\n", + "d = b*b - 4*a*c # discriminant\n", + "sqrtd = math.sqrt(d)\n", + "x1 = (-b + sqrtd)/(2*a)\n", + "x2 = (-b - sqrtd)/(2*a)\n", + "print \"The solutions are:\"\n", + "print \"\\tx1 = %f\" % x1\n", + "print \"\\tx2 = %f\" % x2\n", + "print \"Check:\" \n", + "print \"\\ta*x1*x1 + b*x1 + c = %f\" %( a*x1*x1 + b*x1 + c)\n", + "print \"\\ta*x2*x2 + b*x2 + c = %f\" %( a*x2*x2 + b*x2 + c)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the coefficients of a quadratic equation:\n", + " a : 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "b : 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "c : -3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The equation is: 2.0 *x*x + 1.0 *x + -3.0 = 0\n", + "The solutions are:\n", + "\tx1 = 1.000000\n", + "\tx2 = -1.500000\n", + "Check:\n", + "\ta*x1*x1 + b*x1 + c = 0.000000\n", + "\ta*x2*x2 + b*x2 + c = 0.000000\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.16,page no:130" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# prints double values in scientific e-format:\n", + "x = float(raw_input(\"Enter float: \"))\n", + "print \"Its reciprocal is: \",\n", + "print 1/x " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter float: 234.567e89\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Its reciprocal is: 4.2631742743e-92\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.17,page no:130" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# illustrates the scope of variables:\n", + "x = 11\n", + "# ERROR: this is not in the scope of x\n", + "if True:\n", + " x = 22 # OK: this is in the scope of x\n", + " y = 33 # ERROR: this is not in the scope of y\n", + " x = 44 # OK: this is in the scope of x\n", + " y = 55 # OK: this is in the scope of y\n", + "x = 66 # OK: this is in the scope of x\n", + "y = 77 # ERROR: this is not in the scope of y\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.18,page no:131" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# this x is global\n", + "x = 11\n", + "\n", + "if True:\n", + " # illustrates the nested and parallel scopes:\n", + " x = 22\n", + " # begin scope of internal block\n", + " if True:\n", + " x = 33\n", + " print \"In block inside main(): x = %d \" % x\n", + " # end scope of internal block\n", + "print \"In main(): x = %d\" %x \n", + "print \"In main(): x = %d \"% x" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "In block inside main(): x = 33 \n", + "In main(): x = 33\n", + "In main(): x = 33 \n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch3.ipynb b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch3.ipynb similarity index 88% rename from Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch3.ipynb rename to Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch3.ipynb index 577b8d76..880a863d 100644 --- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch3.ipynb +++ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch3.ipynb @@ -1,13 +1,29 @@ { "metadata": { "name": "", - "signature": "sha256:0e3c85fb42769559f9f8805f3e4d4314b9161e1f9e7c2177b9fdd0a81efd83fb" + "signature": "sha256:775362cdb9ee75ef7772fdb79151cc60e1c3ca6a5fec01c98ea568351626980e" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 3" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 3.1,page no:31" + ] + }, { "cell_type": "code", "collapsed": false, @@ -56,6 +72,14 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 3.2,page no:32" + ] + }, { "cell_type": "code", "collapsed": false, @@ -105,6 +129,14 @@ ], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 3.3,page no:33" + ] + }, { "cell_type": "code", "collapsed": false, @@ -156,6 +188,14 @@ ], "prompt_number": 3 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 3.4,page no:34" + ] + }, { "cell_type": "code", "collapsed": false, @@ -182,6 +222,14 @@ ], "prompt_number": 4 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 3.5,page no:34" + ] + }, { "cell_type": "code", "collapsed": false, @@ -244,6 +292,14 @@ ], "prompt_number": 5 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 3.6,page no:34" + ] + }, { "cell_type": "code", "collapsed": false, @@ -298,6 +354,14 @@ ], "prompt_number": 6 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 3.7,page no:35" + ] + }, { "cell_type": "code", "collapsed": false, @@ -351,6 +415,14 @@ ], "prompt_number": 7 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 3.8,page no:35" + ] + }, { "cell_type": "code", "collapsed": false, @@ -412,6 +484,14 @@ ], "prompt_number": 8 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 3.9,page no:36" + ] + }, { "cell_type": "code", "collapsed": false, @@ -453,6 +533,14 @@ ], "prompt_number": 9 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 3.10,page no:36" + ] + }, { "cell_type": "code", "collapsed": false, @@ -504,6 +592,14 @@ ], "prompt_number": 10 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 3.11,page no:36" + ] + }, { "cell_type": "code", "collapsed": false, @@ -554,6 +650,14 @@ ], "prompt_number": 11 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 3.12,page no:37" + ] + }, { "cell_type": "code", "collapsed": false, @@ -608,6 +712,14 @@ ], "prompt_number": 12 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 3.13,page no:37" + ] + }, { "cell_type": "code", "collapsed": false, @@ -672,6 +784,14 @@ ], "prompt_number": 13 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 3.14,page no:37" + ] + }, { "cell_type": "code", "collapsed": false, @@ -789,6 +909,14 @@ ], "prompt_number": 14 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 3.15,page no:38" + ] + }, { "cell_type": "code", "collapsed": false, @@ -830,6 +958,14 @@ ], "prompt_number": 15 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 3.16,page no:38" + ] + }, { "cell_type": "code", "collapsed": false, @@ -871,6 +1007,14 @@ ], "prompt_number": 16 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 3.17,page no:39" + ] + }, { "cell_type": "code", "collapsed": false, @@ -915,6 +1059,14 @@ ], "prompt_number": 17 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 3.18,page no:40" + ] + }, { "cell_type": "code", "collapsed": false, @@ -939,25 +1091,15 @@ ], "language": "python", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter your test score: 83\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Your grade is a B.\n", - "Goodbye.\n" - ] - } - ], - "prompt_number": 18 + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 3.19,page no:40" + ] }, { "cell_type": "code", @@ -1018,4 +1160,4 @@ "metadata": {} } ] -} \ No newline at end of file +} diff --git a/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch3.ipynb~ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch3.ipynb~ new file mode 100644 index 00000000..fbc5e177 --- /dev/null +++ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch3.ipynb~ @@ -0,0 +1,1163 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:775362cdb9ee75ef7772fdb79151cc60e1c3ca6a5fec01c98ea568351626980e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 3" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.1,page no:131" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter two positive integers: \";\n", + "n = int(raw_input())\n", + "d = int(raw_input())\n", + "if (n%d):\n", + " print \"%d is not divisible by %d\" %(n,d)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two positive integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "66\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "66 is not divisible by 7\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.2,page no:132" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter two positive integers: \";\n", + "n = int(raw_input())\n", + "d = int(raw_input())\n", + "if (n%d):\n", + " print \"%d is not divisible by %d\" %(n,d)\n", + "else:\n", + " print \"%d is divisible by %d\" %(n,d)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two positive integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "56\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "56 is divisible by 7\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.3,page no:133" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter two integers: \"\n", + "m = int(raw_input())\n", + "n = int(raw_input())\n", + "\n", + "if (m < n):\n", + " print \"%d is the minimum.\" %m\n", + "else:\n", + " print \"%d is the minimum.\" %n\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "77\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "55 is the minimum.\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.4,page no:134" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter an integer: \"\n", + "n = int(raw_input())\n", + "if (n = 22):\n", + " print \"%d = 22\" %n\n", + "else: \n", + " print \"%d != 22\" %n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "SyntaxError", + "evalue": "invalid syntax (, line 7)", + "output_type": "pyerr", + "traceback": [ + "\u001b[1;36m File \u001b[1;32m\"\"\u001b[1;36m, line \u001b[1;32m7\u001b[0m\n\u001b[1;33m if (n = 22):\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.5,page no:134" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter three integers: \"\n", + "n1 = int(raw_input())\n", + "n2 = int(raw_input())\n", + "n3 = int(raw_input())\n", + "\n", + "m=n1\n", + "# now min <= n1\n", + "if (n2 < m):\n", + " m = n2 # now min <= n1 and min <= n2\n", + "if (n3 < m):\n", + " m = n3 # now min <= n1, min <= n2, and min <= n3\n", + "print \"Their minimum is %d\" % m" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter three integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "77\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "33\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Their minimum is 33\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.6,page no:134" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter two integers: \"\n", + "x = int(raw_input())\n", + "y = int(raw_input())\n", + "\n", + "if (x > y):\n", + " temp=x\n", + " x = y\n", + " y = temp\n", + " \n", + "\n", + "print \"%d <= %d\" %(x,y)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "66\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "44\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "44 <= 66\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.7,page no:135" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "n=44\n", + "print \"n = %d\" % n \n", + "if True:\n", + " # scope extends over 4 lines\n", + " print \"Enter an integer: \"\n", + " n = int(raw_input())\n", + " print \"n = %d\" % n \n", + "\n", + "if True:\n", + " print \"n = %d\" % n \n", + " # the n that was declared first\n", + "if True:\n", + " print \"n = %d\" % n \n", + "\n", + "print \"n = %d\" % n " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = 44\n", + "Enter an integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "77\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = 77\n", + "n = 77\n", + "n = 77\n", + "n = 77\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.8,page no:135" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter three integers: \"\n", + "n1 = int(raw_input())\n", + "n2 = int(raw_input())\n", + "n3 = int(raw_input())\n", + "if (n1 <= n2 and n1 <= n3):\n", + " print \"Their minimum is %d\" % n1\n", + " \n", + "if (n2 <= n1 and n2 <= n3):\n", + " print \"Their minimum is %d \" % n2 \n", + "if (n3 <= n1 and n3 <= n2):\n", + " print \"Their minimum is %d\" % n3 \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter three integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "77\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "33\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Their minimum is 33 \n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.9,page no:136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Are you enrolled (y/n): \"\n", + "ans = raw_input()\n", + "if (ans == 'Y' or ans == 'y'):\n", + " print \"You are enrolled.\\n\"\n", + "else: \n", + " print \"You are not enrolled.\\n\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Are you enrolled (y/n): \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "You are enrolled.\n", + "\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.10,page no:136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter two positive integers: \";\n", + "n = int(raw_input())\n", + "d = int(raw_input())\n", + "\n", + "if (d != 0 and n%d == 0): \n", + " print \"%d divides %d\" %(d,n)\n", + "else:\n", + " print \"%d does not divide %d\"% (d,n)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two positive integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "33\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "6 does not divide 33\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.11,page no:136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter three integers: \"\n", + "n1 = int(raw_input())\n", + "n2 = int(raw_input())\n", + "n3 = int(raw_input())\n", + "\n", + "if (n1 >= n2 >= n3):\n", + " print \"max = x\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter three integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.12,page no:137" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter two positive integers: \"\n", + "n = int(raw_input())\n", + "d = int(raw_input())\n", + "\n", + "if (d != 0):\n", + " if (n%d == 0):\n", + " print d,\n", + " print \" divides %d\" % n \n", + " else:\n", + " print \"%d does not divide %d\" %(d,n)\n", + "else:\n", + " print '%d does not divide %d '%(d,n)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two positive integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "44\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "44 does not divide 55\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.13,page no:137" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter three integers: \"\n", + "n1 = int(raw_input())\n", + "n2 = int(raw_input())\n", + "n3 = int(raw_input())\n", + "if (n1 < n2):\n", + " if (n1 < n3):\n", + " print \"Their minimum is : %d\" % n1\n", + " else:\n", + " print \"Their minimum is : %d\" % n3\n", + "else: # n1 >= n2\n", + " if (n2 < n3):\n", + " print \"Their minimum is : %d\" % n2\n", + " else:\n", + " print \"Their minimum is %d\" % n3" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter three integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "77\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "33\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Their minimum is : 33\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.14,page no:137" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Pick a number from 1 to 8.\" \n", + "answer = int(raw_input())\n", + "print \"Is it less than 5? (y|n): \"\n", + "answer = raw_input()\n", + "if (answer == 'y'): # 1 <= n <= 4\n", + " print \"Is it less than 3? (y|n): \"\n", + " answer = raw_input() \n", + " if (answer == 'y'): # 1 <= n <= 2\n", + " print \"Is it less than 2? (y|n): \"\n", + " answer = raw_input()\n", + " if (answer == 'y'):\n", + " print \"Your number is 1.\"\n", + " else:\n", + " print \"Your number is 2.\"\n", + " else: # 3 <= n <= 4\n", + " print \"Is it less than 4? (y|n): \"\n", + " answer = raw_input()\n", + " if (answer == 'y'):\n", + " print \"Your number is 3.\"\n", + " else:\n", + " print \"Your number is 4.\"\n", + "else: # 5 <= n <= 8\n", + " print \"Is it less than 7? (y|n): \"\n", + " answer = raw_input()\n", + " if (answer == 'y'): # 5 <= n <= 6\n", + " print \"Is it less than 6? (y|n): \"\n", + " answer = raw_input()\n", + " if (answer == 'y'):\n", + " print \"Your number is 5.\"\n", + " else:\n", + " print \"Your number is 6.\" \n", + " else: # 7 <= n <= 8\n", + " print \"Is it less than 8? (y|n): \"\n", + " answer = raw_input()\n", + " if (answer == 'y'):\n", + " print \"Your number is 7.\" \n", + " else:\n", + " print \"Your number is 8.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Pick a number from 1 to 8.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Is it less than 5? (y|n): \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "n\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Is it less than 7? (y|n): \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Is it less than 6? (y|n): \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "n\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Your number is 6.\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.15,page no:138" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "language = raw_input(\"Engl., Fren., Ger., Ital., or Rus.? (e|f|g|i|r): \")\n", + "\n", + "if (language == 'e'): \n", + " print \"Welcome to ProjectEuclid.\"\n", + "elif (language == 'f'):\n", + " print \"Bon jour, ProjectEuclid.\"\n", + "elif (language == 'g'):\n", + " print \"Guten tag, ProjectEuclid.\"\n", + "elif (language == 'i'):\n", + " print \"Bon giorno, ProjectEuclid.\"\n", + "elif (language == 'r'):\n", + " print \"Dobre utre, ProjectEuclid.\"\n", + "else:\n", + " print \"Sorry; we don't speak your language.\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Engl., Fren., Ger., Ital., or Rus.? (e|f|g|i|r): i\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Bon giorno, ProjectEuclid.\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.16,page no:138" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "score = int(raw_input(\"Enter your test score: \"))\n", + "a = int(score/10)\n", + "if a == 10 or a == 9:\n", + " print \"Your grade is an A.\"\n", + "elif a == 8:\n", + " print \"Your grade is a B.\" \n", + "elif a == 7:\n", + " print \"Your grade is a C.\" \n", + "elif a == 6:\n", + " print \"Your grade is a D.\"\n", + "elif a==5 or a==4 or a==3 or a==2 or a==1 or a==0:\n", + " print \"Your grade is an F.\" \n", + "else:\n", + " print \"Error: score is out of range.\\n\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your test score: 83\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Your grade is a B.\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.17,page no:139" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "score = int(raw_input(\"Enter your test score: \"))\n", + "a = int(score/10)\n", + "if a == 10 or a == 9:\n", + " print \"Your grade is an A.\"\n", + "elif a == 8:\n", + " print \"Your grade is a B.\" \n", + "elif a == 7:\n", + " print \"Your grade is a C.\" \n", + "elif a == 6:\n", + " print \"Your grade is a D.\"\n", + "elif a==5 or a==4 or a==3 or a==2 or a==1 or a==0:\n", + " print \"Your grade is an F.\" \n", + "else:\n", + " print \"Error: score is out of range.\\n\"\n", + "\n", + "print \"Goodbye.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your test score: 83\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Your grade is a B.\n", + "Goodbye.\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.18,page no:140" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "score = int(raw_input(\"Enter your test score: \"))\n", + "a = int(score/10)\n", + "if a == 10 or a == 9:\n", + " print \"Your grade is an A.\"\n", + "elif a == 8:\n", + " print \"Your grade is a B.\" \n", + "elif a == 7:\n", + " print \"Your grade is a C.\" \n", + "elif a == 6:\n", + " print \"Your grade is a D.\"\n", + "elif a==5 or a==4 or a==3 or a==2 or a==1 or a==0:\n", + " print \"Your grade is an F.\" \n", + "else:\n", + " print \"Error: score is out of range.\\n\"\n", + "\n", + "print \"Goodbye.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.19,page no:140" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter two integers: \"\n", + "m = int(raw_input())\n", + "n = int(raw_input())\n", + "print min(m,n),\n", + "print 'is the minimum'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "33\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "33 is the minimum\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch4.ipynb b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch4.ipynb similarity index 88% rename from Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch4.ipynb rename to Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch4.ipynb index 80faf7b0..99d45e2f 100644 --- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch4.ipynb +++ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch4.ipynb @@ -1,13 +1,29 @@ { "metadata": { "name": "", - "signature": "sha256:151156e7bea70740a97337b774930eddac369834b8935c55926007a1955d4c91" + "signature": "sha256:a827b39a1484e07a3be872b4233ca2d8270682f9fa713863be73c01b7ee3c12b" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 4" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.1,page no:41" + ] + }, { "cell_type": "code", "collapsed": false, @@ -50,6 +66,14 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.2,page no:42" + ] + }, { "cell_type": "code", "collapsed": false, @@ -93,6 +117,14 @@ ], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.3,page no:43" + ] + }, { "cell_type": "code", "collapsed": false, @@ -159,6 +191,14 @@ ], "prompt_number": 3 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.4,page no:44" + ] + }, { "cell_type": "code", "collapsed": false, @@ -203,6 +243,14 @@ ], "prompt_number": 5 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.5,page no:44" + ] + }, { "cell_type": "code", "collapsed": false, @@ -252,6 +300,14 @@ ], "prompt_number": 6 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.6,page no:44" + ] + }, { "cell_type": "code", "collapsed": false, @@ -317,6 +373,14 @@ ], "prompt_number": 7 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.7,page no:44" + ] + }, { "cell_type": "code", "collapsed": false, @@ -366,6 +430,14 @@ ], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.8,page no:45" + ] + }, { "cell_type": "code", "collapsed": false, @@ -402,6 +474,14 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.9,page no:45" + ] + }, { "cell_type": "code", "collapsed": false, @@ -444,6 +524,14 @@ ], "prompt_number": 3 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.10,page no:46" + ] + }, { "cell_type": "code", "collapsed": false, @@ -489,6 +577,14 @@ ], "prompt_number": 4 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.11,page no:46" + ] + }, { "cell_type": "code", "collapsed": false, @@ -530,6 +626,14 @@ ], "prompt_number": 5 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.12,page no:46" + ] + }, { "cell_type": "code", "collapsed": false, @@ -573,6 +677,14 @@ ], "prompt_number": 6 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.13,page no:46" + ] + }, { "cell_type": "code", "collapsed": false, @@ -616,6 +728,14 @@ ], "prompt_number": 7 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.14,page no:46" + ] + }, { "cell_type": "code", "collapsed": false, @@ -638,6 +758,14 @@ ], "prompt_number": 8 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.15,page no:46" + ] + }, { "cell_type": "code", "collapsed": false, @@ -691,6 +819,14 @@ ], "prompt_number": 9 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.11,page no:46" + ] + }, { "cell_type": "code", "collapsed": false, @@ -766,6 +902,14 @@ ], "prompt_number": 10 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.12,page no:46" + ] + }, { "cell_type": "code", "collapsed": false, @@ -843,6 +987,14 @@ ], "prompt_number": 11 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.13,page no:46" + ] + }, { "cell_type": "code", "collapsed": false, @@ -872,6 +1024,14 @@ ], "prompt_number": 12 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.14,page no:46" + ] + }, { "cell_type": "code", "collapsed": false, @@ -907,6 +1067,14 @@ ], "prompt_number": 13 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.15,page no:47" + ] + }, { "cell_type": "code", "collapsed": false, @@ -967,6 +1135,14 @@ ], "prompt_number": 14 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.16,page no:47" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1012,6 +1188,14 @@ ], "prompt_number": 15 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.17,page no:48" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1105,6 +1289,14 @@ ], "prompt_number": 16 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.18,page no:48" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1143,6 +1335,14 @@ ], "prompt_number": 17 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.19,page no:48" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1211,6 +1411,14 @@ ], "prompt_number": 18 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.20,page no:49" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1259,6 +1467,14 @@ ], "prompt_number": 19 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.21,page no:49" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1307,6 +1523,14 @@ ], "prompt_number": 20 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.22,page no:50" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1341,6 +1565,14 @@ ], "prompt_number": 21 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.23,page no:50" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1389,6 +1621,14 @@ ], "prompt_number": 22 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.24,page no:50" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1418,6 +1658,14 @@ ], "prompt_number": 23 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.25,page no:50" + ] + }, { "cell_type": "code", "collapsed": false, diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch5.ipynb b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch5.ipynb similarity index 91% rename from Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch5.ipynb rename to Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch5.ipynb index a10c8e6e..b8c44538 100644 --- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch5.ipynb +++ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch5.ipynb @@ -1,13 +1,29 @@ { "metadata": { "name": "", - "signature": "sha256:507ed1502286b7e07eb64a51dd0502249f2763079a23aefef815ad5e65c327ad" + "signature": "sha256:77123054c419088f52a8a1edc4793072bd7aa51ddfc99d0a6390559c1c536392" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 5" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.1,page no:51" + ] + }, { "cell_type": "code", "collapsed": false, @@ -37,6 +53,14 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.2,page no:52" + ] + }, { "cell_type": "code", "collapsed": false, @@ -73,6 +97,14 @@ ], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.3,page no:52" + ] + }, { "cell_type": "code", "collapsed": false, @@ -89,6 +121,14 @@ "outputs": [], "prompt_number": 3 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.4,page no:52" + ] + }, { "cell_type": "code", "collapsed": false, @@ -171,6 +211,14 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.5,page no:53" + ] + }, { "cell_type": "code", "collapsed": false, @@ -244,6 +292,14 @@ ], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.6,page no:53" + ] + }, { "cell_type": "code", "collapsed": false, @@ -318,6 +374,14 @@ ], "prompt_number": 3 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.7,page no:53" + ] + }, { "cell_type": "code", "collapsed": false, @@ -431,6 +495,14 @@ ], "prompt_number": 4 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.8,page no:54" + ] + }, { "cell_type": "code", "collapsed": false, @@ -462,6 +534,14 @@ ], "prompt_number": 5 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.9,page no:54" + ] + }, { "cell_type": "code", "collapsed": false, @@ -509,6 +589,14 @@ ], "prompt_number": 6 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.10,page no:54" + ] + }, { "cell_type": "code", "collapsed": false, @@ -622,6 +710,14 @@ ], "prompt_number": 8 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.11,page no:55" + ] + }, { "cell_type": "code", "collapsed": false, @@ -928,6 +1024,14 @@ ], "prompt_number": 4 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.12,page no:56" + ] + }, { "cell_type": "code", "collapsed": false, @@ -969,6 +1073,14 @@ ], "prompt_number": 10 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.13,page no:57" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1053,6 +1165,14 @@ ], "prompt_number": 11 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.13,page no:57" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1142,6 +1262,14 @@ ], "prompt_number": 14 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.14,page no:58" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1172,6 +1300,14 @@ ], "prompt_number": 15 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.15,page no:58" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1206,6 +1342,14 @@ ], "prompt_number": 16 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.16,page no:59" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1253,6 +1397,14 @@ ], "prompt_number": 17 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.17,page no:59" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1292,6 +1444,14 @@ ], "prompt_number": 5 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.18,page no:60" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1335,6 +1495,14 @@ ], "prompt_number": 19 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.19,page no:60" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1376,6 +1544,14 @@ ], "prompt_number": 20 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.20,page no:60" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1406,13 +1582,20 @@ ], "prompt_number": 21 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.21,page no:60" + ] + }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", - "# prints the quotient of two input integers:\n", "print \"Enter two integers: \"\n", "n = int(raw_input())\n", "d = int(raw_input())\n", @@ -1458,6 +1641,14 @@ ], "prompt_number": 22 }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "example 5.22,page no:60" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1494,6 +1685,14 @@ ], "prompt_number": 23 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.23,page no:60" + ] + }, { "cell_type": "code", "collapsed": false, diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch6.ipynb b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch6.ipynb similarity index 90% rename from Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch6.ipynb rename to Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch6.ipynb index e1a26f6e..c6a37ec7 100644 --- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch6.ipynb +++ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch6.ipynb @@ -1,13 +1,29 @@ { "metadata": { "name": "", - "signature": "sha256:a7aedcfda01e5e2719af0a5e76da43c6e7b01797bb61e0483e48a2e68eb0941d" + "signature": "sha256:86ba2090942c723ca01d7e01347ceafcb574aeb96d2587e1200836a9be752566" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 6" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.1,page no:61" + ] + }, { "cell_type": "code", "collapsed": false, @@ -37,6 +53,14 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.2,page no:61" + ] + }, { "cell_type": "code", "collapsed": false, @@ -120,6 +144,14 @@ ], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.3,page no:62" + ] + }, { "cell_type": "code", "collapsed": false, @@ -148,6 +180,14 @@ ], "prompt_number": 3 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.4,page no:62" + ] + }, { "cell_type": "code", "collapsed": false, @@ -178,6 +218,14 @@ ], "prompt_number": 4 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.5,page no:63" + ] + }, { "cell_type": "code", "collapsed": false, @@ -206,6 +254,14 @@ ], "prompt_number": 5 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.6,page no:63" + ] + }, { "cell_type": "code", "collapsed": false, @@ -244,6 +300,14 @@ ], "prompt_number": 6 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.7,page no:63" + ] + }, { "cell_type": "code", "collapsed": false, @@ -269,6 +333,14 @@ ], "prompt_number": 7 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.8,page no:64" + ] + }, { "cell_type": "code", "collapsed": false, @@ -303,6 +375,14 @@ ], "prompt_number": 8 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.9,page no:64" + ] + }, { "cell_type": "code", "collapsed": false, @@ -330,6 +410,14 @@ ], "prompt_number": 10 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.10,page no:64" + ] + }, { "cell_type": "code", "collapsed": false, @@ -417,6 +505,14 @@ ], "prompt_number": 12 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.11,page no:65" + ] + }, { "cell_type": "code", "collapsed": false, @@ -440,6 +536,14 @@ ], "prompt_number": 13 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.12,page no:65" + ] + }, { "cell_type": "code", "collapsed": false, @@ -471,6 +575,14 @@ ], "prompt_number": 14 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.13,page no:65" + ] + }, { "cell_type": "code", "collapsed": false, @@ -510,6 +622,14 @@ ], "prompt_number": 15 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.14,page no:66" + ] + }, { "cell_type": "code", "collapsed": false, @@ -549,6 +669,14 @@ ], "prompt_number": 16 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.15,page no:66" + ] + }, { "cell_type": "code", "collapsed": false, @@ -580,6 +708,14 @@ ], "prompt_number": 17 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.16,page no:67" + ] + }, { "cell_type": "code", "collapsed": false, @@ -641,6 +777,14 @@ ], "prompt_number": 18 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.17,page no:67" + ] + }, { "cell_type": "code", "collapsed": false, @@ -672,6 +816,14 @@ ], "prompt_number": 19 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.18,page no:68" + ] + }, { "cell_type": "code", "collapsed": false, @@ -692,17 +844,15 @@ ], "language": "python", "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "55.5 22.5 99.9 66.6 44.4 88.8 33.3 77.7 \n", - "22.5 33.3 44.4 55.5 66.6 77.7 88.8 99.9 \n" - ] - } - ], - "prompt_number": 20 + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.19,page no:68" + ] }, { "cell_type": "code", @@ -886,6 +1036,14 @@ ], "prompt_number": 21 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.20,page no:69" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1091,6 +1249,14 @@ ], "prompt_number": 24 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.21,page no:70" + ] + }, { "cell_type": "code", "collapsed": false, diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch7.ipynb b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch7.ipynb similarity index 86% rename from Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch7.ipynb rename to Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch7.ipynb index ad8cdac0..e6190713 100644 --- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch7.ipynb +++ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch7.ipynb @@ -1,13 +1,29 @@ { "metadata": { "name": "", - "signature": "sha256:653231542b6fdffa18c8d3af4f8fe1f2545223a4300162071901adcb77895ba7" + "signature": "sha256:6699bf736ed72aedd025ae33d176cd6c4322cc2ded5a842b50655fd4e4828256" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 7" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.1,page no:71" + ] + }, { "cell_type": "code", "collapsed": false, @@ -33,6 +49,14 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.2,page no:72" + ] + }, { "cell_type": "code", "collapsed": false, @@ -64,6 +88,14 @@ ], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.3,page no:73" + ] + }, { "cell_type": "code", "collapsed": false, @@ -92,6 +124,14 @@ ], "prompt_number": 3 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.4,page no:74" + ] + }, { "cell_type": "code", "collapsed": false, @@ -119,6 +159,14 @@ ], "prompt_number": 4 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.5,page no:74" + ] + }, { "cell_type": "code", "collapsed": false, @@ -148,6 +196,14 @@ ], "prompt_number": 5 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.6,page no:75" + ] + }, { "cell_type": "code", "collapsed": false, @@ -185,6 +241,14 @@ ], "prompt_number": 6 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.7,page no:75" + ] + }, { "cell_type": "code", "collapsed": false, @@ -226,6 +290,14 @@ ], "prompt_number": 7 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.8,page no:76" + ] + }, { "cell_type": "code", "collapsed": false, @@ -259,6 +331,14 @@ ], "prompt_number": 8 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.9,page no:77" + ] + }, { "cell_type": "code", "collapsed": false, @@ -287,6 +367,14 @@ ], "prompt_number": 9 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.10,page no:77" + ] + }, { "cell_type": "code", "collapsed": false, @@ -322,6 +410,14 @@ ], "prompt_number": 10 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.11,page no:78" + ] + }, { "cell_type": "code", "collapsed": false, @@ -352,6 +448,14 @@ ], "prompt_number": 11 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.12,page no:78" + ] + }, { "cell_type": "code", "collapsed": false, @@ -397,6 +501,14 @@ ], "prompt_number": 12 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.13,page no:79" + ] + }, { "cell_type": "code", "collapsed": false, @@ -559,6 +671,14 @@ ], "prompt_number": 13 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.14,page no:79" + ] + }, { "cell_type": "code", "collapsed": false, @@ -576,6 +696,14 @@ "outputs": [], "prompt_number": 14 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.15,page no:80" + ] + }, { "cell_type": "code", "collapsed": false, diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch8.ipynb b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch8.ipynb similarity index 89% rename from Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch8.ipynb rename to Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch8.ipynb index a4d4d774..237cbb1c 100644 --- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch8.ipynb +++ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch8.ipynb @@ -1,13 +1,29 @@ { "metadata": { "name": "", - "signature": "sha256:79346296b970ba1771cf99da135ed51f1d98b24ac99e0b8758fa3cab63c95d45" + "signature": "sha256:62fa005b0530efaca0bc120e55a83439d9ca1c65b41086243699e148e802b6c4" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 8" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.1,page no:81" + ] + }, { "cell_type": "code", "collapsed": false, @@ -86,6 +102,14 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.2,page no:82" + ] + }, { "cell_type": "code", "collapsed": false, @@ -116,6 +140,14 @@ ], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.3,page no:83" + ] + }, { "cell_type": "code", "collapsed": false, @@ -180,6 +212,14 @@ ], "prompt_number": 6 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.4,page no:84" + ] + }, { "cell_type": "code", "collapsed": false, @@ -236,6 +276,14 @@ ], "prompt_number": 7 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.5,page no:84" + ] + }, { "cell_type": "code", "collapsed": false, @@ -298,6 +346,14 @@ ], "prompt_number": 8 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.6,page no:85" + ] + }, { "cell_type": "code", "collapsed": false, @@ -352,6 +408,14 @@ ], "prompt_number": 9 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.7,page no:85" + ] + }, { "cell_type": "code", "collapsed": false, @@ -407,6 +471,14 @@ ], "prompt_number": 10 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.8,page no:85" + ] + }, { "cell_type": "code", "collapsed": false, @@ -447,6 +519,14 @@ ], "prompt_number": 11 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.9,page no:86" + ] + }, { "cell_type": "code", "collapsed": false, @@ -525,6 +605,14 @@ ], "prompt_number": 12 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.10,page no:86" + ] + }, { "cell_type": "code", "collapsed": false, @@ -603,6 +691,14 @@ ], "prompt_number": 13 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.11,page no:87" + ] + }, { "cell_type": "code", "collapsed": false, @@ -632,6 +728,14 @@ ], "prompt_number": 14 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.12,page no:87" + ] + }, { "cell_type": "code", "collapsed": false, @@ -675,6 +779,14 @@ ], "prompt_number": 15 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.13,page no:87" + ] + }, { "cell_type": "code", "collapsed": false, @@ -712,6 +824,14 @@ ], "prompt_number": 16 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.14,page no:88" + ] + }, { "cell_type": "code", "collapsed": false, @@ -747,6 +867,14 @@ ], "prompt_number": 17 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.15,page no:88" + ] + }, { "cell_type": "code", "collapsed": false, @@ -785,6 +913,14 @@ ], "prompt_number": 18 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.16,page no:89" + ] + }, { "cell_type": "code", "collapsed": false, @@ -820,6 +956,14 @@ ], "prompt_number": 19 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.17,page no:89" + ] + }, { "cell_type": "code", "collapsed": false, @@ -855,6 +999,14 @@ ], "prompt_number": 20 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.18,page no:89" + ] + }, { "cell_type": "code", "collapsed": false, @@ -891,6 +1043,14 @@ ], "prompt_number": 21 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.19,page no:90" + ] + }, { "cell_type": "code", "collapsed": false, diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch9.ipynb b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch9.ipynb similarity index 92% rename from Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch9.ipynb rename to Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch9.ipynb index d38faaa6..1cd941a7 100644 --- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch9.ipynb +++ b/Engineering Thermodynamics: A Computer Approach (SI Units Version)/ch9.ipynb @@ -1,13 +1,29 @@ { "metadata": { "name": "", - "signature": "sha256:636fa14bc9bbc0edbdee2b8486af1239be5ff3d58b955831baa9b4ccd512a82c" + "signature": "sha256:b465729456848e8d32471e4641e4867caf52a122691eda5b2eb2bc49d2d70056" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 9" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 9.1page no:91" + ] + }, { "cell_type": "code", "collapsed": false, @@ -110,6 +126,14 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 9.2,page no:92" + ] + }, { "cell_type": "code", "collapsed": false, @@ -220,6 +244,14 @@ ], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 9.3,page no:93" + ] + }, { "cell_type": "code", "collapsed": false, @@ -252,6 +284,14 @@ ], "prompt_number": 3 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 9.4,page no:94" + ] + }, { "cell_type": "code", "collapsed": false, @@ -303,6 +343,14 @@ ], "prompt_number": 4 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 9.5,page no:95" + ] + }, { "cell_type": "code", "collapsed": false, diff --git a/Engineering_Physics/.ipynb_checkpoints/Chapter10_1-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/Chapter10_1-checkpoint.ipynb new file mode 100644 index 00000000..b2bd25cb --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/Chapter10_1-checkpoint.ipynb @@ -0,0 +1,297 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:4b61028c3be5c168cde4c3aa75ae23500168dbc119942b73de7c79e4a037fd53" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "10: Statistical Mechanics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 10.1, Page number 222" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "k = 1.38*10**-23; #Boltzmann constant(J/K)\n", + "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n", + "g1 = 2; #The degeneracy of ground state\n", + "g2 = 8; #The degeneracy of excited state\n", + "delta_E = 10.2; #Energy of excited state above the ground state(eV)\n", + "T = 6000; #Temperature of the state(K)\n", + "\n", + "#Calculation\n", + "D_ratio = g2/g1; #Ratio of degeneracy of states\n", + "x = k*T/e;\n", + "N_ratio = D_ratio*math.exp(-delta_E/x); #Ratio of occupancy of the excited to the ground state\n", + "\n", + "#Result\n", + "print \"The ratio of occupancy of the excited to the ground state is\",N_ratio" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The ratio of occupancy of the excited to the ground state is 1.10167326887e-08\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 10.2, Page number 222" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "a = 10/2;\n", + "#enegy of 10 bosons is E = (10*pi**2*h**2)/(2*m*a**2) = (5*pi**2*h**2)/(m*a**2)\n", + "\n", + "#Result\n", + "print \"enegy of 10 bosons is E = \",int(a),\"(pi**2*h**2)/(m*a**2)\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "enegy of 10 bosons is E = 5 (pi**2*h**2)/(m*a**2)\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 10.3, Page number 223" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "n1=1; #1st level\n", + "n2=2; #2nd level\n", + "n3=3; #3rd level\n", + "n4=4; #4th level\n", + "n5=5; #5th level\n", + "\n", + "#Calculation\n", + "#an energy level can accomodate only 2 fermions. hence there will be 2 fermions in each level\n", + "#thus total ground state energy will be E = (2*E1)+(2*E2)+(2*E3)+(2*E4)+E5\n", + "#let X = ((pi**2)*(h**2)/(2*m*a**2)). E = X*((2*n1**2)+(2*n2**2)+(2*n3**2)+(2*n4**2)+(n5**2))\n", + "A = (2*n1**2)+(2*n2**2)+(2*n3**2)+(2*n4**2)+(n5**2);\n", + "#thus E = A*X\n", + "\n", + "#Result\n", + "print \"the ground state energy of the system is\",A,\"(pi**2)*(h**2)/(2*m*a**2)\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the ground state energy of the system is 85 (pi**2)*(h**2)/(2*m*a**2)\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 10.4, Page number 223" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n", + "N_A = 6.02*10**23; #Avogadro's number\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "me = 9.1*10**-31; #Mass of electron(kg)\n", + "rho = 10.5; #Density of silver(g/cm)\n", + "m = 108; #Molecular mass of silver(g/mol)\n", + "\n", + "#Calculation\n", + "N_D = rho*N_A/m; #Number density of conduction electrons(per cm**3)\n", + "N_D = N_D*10**6; #Number density of conduction electrons(per m**3)\n", + "E_F = ((h**2)/(8*me))*(3/math.pi*N_D)**(2/3); #fermi energy(J)\n", + "E_F = E_F/e; #fermi energy(eV)\n", + "E_F = math.ceil(E_F*10**2)/10**2; #rounding off the value of E_F to 2 decimals\n", + "\n", + "#Result\n", + "print \"The number density of conduction electrons is\",N_D, \"per metre cube\"\n", + "print \"The Fermi energy of silver is\",E_F, \"eV\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The number density of conduction electrons is 5.85277777778e+28 per metre cube\n", + "The Fermi energy of silver is 5.51 eV\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 10.5, Page number 224" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "N_A = 6.02*10**23; #Avogadro's number\n", + "k = 1.38*10**-23; #Boltzmann constant(J/K)\n", + "T = 293; #Temperature of sodium(K)\n", + "E_F = 3.24; #Fermi energy of sodium(eV)\n", + "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n", + "\n", + "#Calculation\n", + "C_v = math.pi**2*N_A*k**2*T/(2*E_F*e); #Molar specific heat of sodium(per mole)\n", + "C_v = math.ceil(C_v*10**2)/10**2; #rounding off the value of C_v to 2 decimals\n", + "\n", + "#Result\n", + "print \"The electronic contribution to molar specific heat of sodium is\",C_v, \"per mole\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The electronic contribution to molar specific heat of sodium is 0.32 per mole\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 10.6, Page number 224" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "m = 9.1*10**-31; #Mass of the electron(kg)\n", + "N_D = 18.1*10**28; #Number density of conduction electrons in Al(per metre cube)\n", + "\n", + "#Calculation\n", + "E_F = h**2/(8*m)*(3/math.pi*N_D)**(2/3); #N_D = N/V. Fermi energy of aluminium(J)\n", + "E_F = E_F/e; #Fermi energy of aluminium(eV)\n", + "E_F = math.ceil(E_F*10**3)/10**3; #rounding off the value of E_F to 3 decimals\n", + "Em_0 = 3/5*E_F; #Mean energy of the electron at 0K(eV)\n", + "Em_0 = math.ceil(Em_0*10**3)/10**3; #rounding off the value of Em_0 to 3 decimals\n", + "\n", + "#Result\n", + "print \"The Fermi energy of aluminium is\",E_F, \"eV\"\n", + "print \"The mean energy of the electron is\",Em_0, \"eV\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Fermi energy of aluminium is 11.696 eV\n", + "The mean energy of the electron is 7.018 eV\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/Chapter11_1-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/Chapter11_1-checkpoint.ipynb new file mode 100644 index 00000000..d9dc8a6d --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/Chapter11_1-checkpoint.ipynb @@ -0,0 +1,322 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:9d08f8379ee15c99ce5ad85c8c37d7ad2a3a702f52e1db068a113b3963c85435" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "11: Lasers" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 11.1, Page number 249" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "c = 3*10**8; #Speed of light in free space(m/s)\n", + "k = 1.38*10**-23; #Boltzmann constant(J/K)\n", + "T = 300; #Temperature at absolute scale(K)\n", + "lamda1 = 5500; #Wavelength of visible light(A)\n", + "lamda2 = 10**-2; #Wavelength of microwave(m)\n", + "\n", + "#Calculation\n", + "lamda1 = lamda1*10**-10; #Wavelength of visible light(m)\n", + "rate_ratio = math.exp(h*c/(lamda1*k*T))-1; #Ratio of spontaneous emission to stimulated emission\n", + "rate_ratio1 = math.exp(h*c/(lamda2*k*T))-1; #Ratio of spontaneous emission to stimulated emission\n", + "rate_ratio1 = math.ceil(rate_ratio1*10**5)/10**5; #rounding off the value of rate_ratio1 to 5 decimals\n", + "\n", + "#Result\n", + "print \"The ratio of spontaneous emission to stimulated emission for visible region is\",rate_ratio\n", + "print \"The ratio of spontaneous emission to stimulated emission for microwave region is\", rate_ratio1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The ratio of spontaneous emission to stimulated emission for visible region is 8.19422217477e+37\n", + "The ratio of spontaneous emission to stimulated emission for microwave region is 0.00482\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 11.2, Page number 250" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "c = 3*10**8; #Speed of light in free space(m/s)\n", + "lamda = 690; #Wavelength of laser light(nm)\n", + "E_lower = 30.5; #Energy of lower state(eV)\n", + "\n", + "#Calculation\n", + "lamda = lamda*10**-9; #Wavelength of laser light(m)\n", + "E = h*c/lamda; #Energy of the laser light(J)\n", + "E = E/e; #Energy of the laser light(eV)\n", + "E_ex = E_lower + E; #Energy of excited state of laser system(eV)\n", + "E_ex = math.ceil(E_ex*10**2)/10**2; #rounding off the value of E_ex to 2 decimals\n", + "\n", + "#Result\n", + "print \"The energy of excited state of laser system is\",E_ex, \"eV\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The energy of excited state of laser system is 32.31 eV\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 11.3, Page number 250" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "import numpy as np\n", + "\n", + "#Variable declaration\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "k = 1.38*10**-23; #Boltzmann constant(J/K)\n", + "\n", + "#Calculation\n", + "#Stimulated Emission = Spontaneous Emission <=> exp(h*f/(k*T))-1 = 1 i.e.\n", + "#f/T = log(2)*k/h = A\n", + "A = np.log(2)*k/h; #Frequency per unit temperature(Hz/K)\n", + "A = A/10**10;\n", + "A = math.ceil(A*10**3)/10**3; #rounding off the value of A to 3 decimals\n", + "\n", + "#Result\n", + "print \"The stimulated emission equals spontaneous emission iff f/T =\",A,\"*10**10 Hz/k\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The stimulated emission equals spontaneous emission iff f/T = 1.444 *10**10 Hz/k\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 11.4, Page number 250" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "lamda = 500; #Wavelength of laser light(nm)\n", + "f = 15; #Focal length of the lens(cm)\n", + "d = 2; #Diameter of the aperture of source(cm)\n", + "P = 5; #Power of the laser(mW)\n", + "\n", + "#Calculation\n", + "P = P*10**-3; #Power of the laser(W)\n", + "lamda = lamda*10**-9; #Wavelength of laser light(m)\n", + "d = d*10**-2; #Diameter of the aperture of source(m)\n", + "f = f*10**-2; #Focal length of the lens(m)\n", + "a = d/2; #Radius of the aperture of source(m)\n", + "A = math.pi*lamda**2*f**2/a**2; #Area of the spot at the focal plane, metre square\n", + "I = P/A; #Intensity at the focus(W/m**2)\n", + "I = I/10**7;\n", + "I = math.ceil(I*10**4)/10**4; #rounding off the value of I to 1 decimal\n", + "\n", + "#Result\n", + "print \"The area of the spot at the focal plane is\",A, \"m**2\"\n", + "print \"The intensity at the focus is\",I,\"*10**7 W/m**2\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The area of the spot at the focal plane is 1.76714586764e-10 m**2\n", + "The intensity at the focus is 2.8295 *10**7 W/m**2\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 11.5, Page number 251" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "c = 3*10**8; #Speed of light in free space(m/s)\n", + "lamda = 1064; #Wavelength of laser light(nm)\n", + "P = 0.8; #Average power output per laser pulse(W)\n", + "dt = 25; #Pulse width of laser(ms)\n", + "\n", + "#Calculation\n", + "dt = dt*10**-3; #Pulse width of laser(s)\n", + "lamda = lamda*10**-9; #Wavelength of laser light(m)\n", + "E = P*dt; #Energy released per pulse(J)\n", + "E1 = E*10**3;\n", + "N = E/(h*c/lamda); #Number of photons in a pulse\n", + "\n", + "#Result\n", + "print \"The energy released per pulse is\",E1,\"*10**-3 J\"\n", + "print \"The number of photons in a pulse is\", N\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The energy released per pulse is 20.0 *10**-3 J\n", + "The number of photons in a pulse is 1.07053023443e+17\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 11.6, Page number 251" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "lamda = 693; #Wavelength of laser beam(nm)\n", + "D = 3; #Diameter of laser beam(mm)\n", + "d = 300; #Height of a satellite above the surface of earth(km)\n", + "\n", + "#Calculation\n", + "D = D*10**-3; #Diameter of laser beam(m)\n", + "lamda = lamda*10**-9; #Wavelength of laser beam(m)\n", + "d = d*10**3; #Height of a satellite above the surface of earth(m)\n", + "d_theta = 1.22*lamda/D; #Angular spread of laser beam(rad)\n", + "dtheta = d_theta*10**4;\n", + "dtheta = math.ceil(dtheta*10**2)/10**2; #rounding off the value of dtheta to 2 decimals\n", + "a = d_theta*d; #Diameter of the beam on the satellite(m)\n", + "a = math.ceil(a*10)/10; #rounding off the value of a to 1 decimal\n", + "\n", + "#Result\n", + "print \"The height of a satellite above the surface of earth is\",dtheta,\"*10**-4 rad\"\n", + "print \"The diameter of the beam on the satellite is\",a, \"m\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The height of a satellite above the surface of earth is 2.82 *10**-4 rad\n", + "The diameter of the beam on the satellite is 84.6 m\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/Chapter12_1-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/Chapter12_1-checkpoint.ipynb new file mode 100644 index 00000000..c394fc3a --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/Chapter12_1-checkpoint.ipynb @@ -0,0 +1,234 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:435dc2503f7ab5f5c4bb167df36c6ef12f8211207bc52e60997787c4d2bd8d5c" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "12: Holography and Fibre Optics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 12.1, Page number 271" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "n1 = 1.43; #Refractive index of fibre core\n", + "n2 = 1.4; #Refractive index of fibre cladding\n", + "\n", + "#Calculation\n", + "#As sin (alpha_c) = n2/n1, solving for alpha_c\n", + "alpha_c = math.asin(n2/n1); #Critical angle for optical fibre(rad)\n", + "alpha_c = alpha_c*57.2957795; #Critical angle for optical fibre(degrees)\n", + "alpha_c = math.ceil(alpha_c*10**3)/10**3; #rounding off the value of alpha_c to 3 decimals\n", + "#AS cos(theta_c) = n2/n1, solving for theta_c\n", + "theta_c = math.acos(n2/n1); #Critical propagation angle for optical fibre(rad)\n", + "theta_c = theta_c*57.2957795; #Critical propagation angle for optical fibre(degrees)\n", + "theta_c = math.ceil(theta_c*10**2)/10**2; #rounding off the value of theta_c to 2 decimals\n", + "NA = math.sqrt(n1**2 - n2**2); #Numerical aperture for optical fibre\n", + "NA = math.ceil(NA*10**3)/10**3; #rounding off the value of NA to 3 decimals\n", + "\n", + "#Result\n", + "print \"The critical angle for optical fibre is\",alpha_c, \"degrees\"\n", + "print \"The critical propagation angle for optical fibre is\",theta_c, \"degrees\"\n", + "print \"Numerical aperture for optical fibre is\",NA\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The critical angle for optical fibre is 78.244 degrees\n", + "The critical propagation angle for optical fibre is 11.76 degrees\n", + "Numerical aperture for optical fibre is 0.292\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 12.2, Page number 271" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "n1 = 1.45; #Refractive index of fibre core\n", + "n2 = 1.4; #Refractive index of fibre cladding\n", + "\n", + "#Calculation\n", + "NA = math.sqrt(n1**2 - n2**2); #Numerical aperture for optical fibre\n", + "NA = math.ceil(NA*10**4)/10**4; #rounding off the value of NA to 4 decimals\n", + "#As sin(theta_a) = sqrt(n1^2 - n2^2), solving for theta_a\n", + "theta_a = math.asin(math.sqrt(n1**2 - n2**2)); #Half of acceptance angle of optical fibre(rad)\n", + "theta_a = theta_a*57.2957795; #Half of acceptance angle of optical fibre(degrees)\n", + "theta_accp = 2*theta_a; #Acceptance angle of optical fibre(degrees)\n", + "theta_accp = math.ceil(theta_accp*10**2)/10**2; #rounding off the value of theta_accp to 2 decimals\n", + "Delta = (n1 - n2)/n1; #Relative refractive index difference\n", + "Delta = math.ceil(Delta*10**4)/10**4; #rounding off the value of Delta to 4 decimals\n", + "\n", + "#Result\n", + "print \"Numerical aperture for optical fibre is\", NA\n", + "print \"The acceptance angle of optical fibre is\",theta_accp, \"degrees\"\n", + "print \"Relative refractive index difference is\", Delta\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Numerical aperture for optical fibre is 0.3775\n", + "The acceptance angle of optical fibre is 44.36 degrees\n", + "Relative refractive index difference is 0.0345\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 12.3, Page number 271" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "n1 = 1.55; #Refractive index of fibre core\n", + "n2 = 1.53; #Refractive index of fibre cladding\n", + "n0 = 1.3; #Refractive index of medium\n", + "\n", + "#Calculation\n", + "NA = math.sqrt(n1**2 - n2**2); #Numerical aperture for optical fibre\n", + "NA = math.ceil(NA*10**4)/10**4; #rounding off the value of NA to 4 decimals\n", + "#n0*sin(theta_a) = sqrt(n1^2 - n2^2) = NA, solving for theta_a\n", + "theta_a = math.asin(math.sqrt(n1**2 - n2**2)/n0); #Half of acceptance angle of optical fibre(rad)\n", + "theta_a = theta_a*57.2957795; #Half of acceptance angle of optical fibre(degrees)\n", + "theta_accp = 2*theta_a; #Acceptance angle of optical fibre(degrees)\n", + "\n", + "#Result\n", + "print \"Numerical aperture for step index fibre is\",NA\n", + "print \"The acceptance angle of step index fibre is\",int(theta_accp), \"degrees\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Numerical aperture for step index fibre is 0.2482\n", + "The acceptance angle of step index fibre is 22 degrees\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 12.4, Page number 271 Theoritical proof" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 12.5, Page number 272" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "alpha = 2; #Power loss through optical fibre(dB/km)\n", + "P_in = 500; #Poer input of optical fibre(micro-watt)\n", + "z = 10; #Length of the optical fibre(km)\n", + "\n", + "#Calculation\n", + "#As alpha = 10/z*log10(P_in/P_out), solving for P_out\n", + "P_out = P_in/10**(alpha*z/10); #Output power in fibre optic communication(micro-Watt)\n", + "\n", + "#Result\n", + "print \"The output power in fibre optic communication is\",P_out, \"micro-Watt\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The output power in fibre optic communication is 5.0 micro-Watt\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/Chapter13_1-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/Chapter13_1-checkpoint.ipynb new file mode 100644 index 00000000..75d0d1f7 --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/Chapter13_1-checkpoint.ipynb @@ -0,0 +1,340 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:be254bf95838dd01a87a63582117a886c3167a80cf387f9901b2e2de7a990b8e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "13: Dielectric Properties of Materials" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 13.1, Page number 287" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "epsilon_0 = 8.85*10**-12; #Absolute electrical permittivity of free space(F/m)\n", + "R = 0.52; #Radius of hydrogen atom(A)\n", + "n = 9.7*10**26; #Number density of hydrogen(per metre cube)\n", + "\n", + "#Calculation\n", + "R = R*10**-10; #Radius of hydrogen atom(m)\n", + "alpha_e = 4*math.pi*epsilon_0*R**3; #Electronic polarizability of hydrogen atom(Fm**2)\n", + "\n", + "#Result\n", + "print \"The electronic polarizability of hydrogen atom is\", alpha_e, \"Fm**2\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The electronic polarizability of hydrogen atom is 1.56373503182e-41 Fm**2\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 13.2, Page number 287" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "epsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\n", + "A = 100; #Area of a plate of parallel plate capacitor(cm**2)\n", + "d = 1; #Distance between the plates of the capacitor(cm)\n", + "V = 100; #Potential applied to the plates of the capacitor(V)\n", + "\n", + "#Calculation\n", + "A= A*10**-4; #Area of a plate of parallel plate capacitor(m**2)\n", + "d = d*10**-2; #Distance between the plates of the capacitor(m)\n", + "C = epsilon_0*A/d; #Capacitance of parallel plate capacitor(F)\n", + "Q = C*V; #Charge on the plates of the capacitor(C)\n", + "\n", + "#Result\n", + "print \"The capacitance of parallel plate capacitor is\",C, \"F\"\n", + "print \"The charge on the plates of the capacitor is\",Q, \"C\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The capacitance of parallel plate capacitor is 8.854e-12 F\n", + "The charge on the plates of the capacitor is 8.854e-10 C\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 13.3, Page number 288" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "epsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\n", + "epsilon_r = 5.0; #Dielectric constant of the material between the plates of capacitor\n", + "V = 15; #Potential difference applied between the plates of the capacitor(V)\n", + "d = 1.5; #Separation between the plates of the capacitor(mm)\n", + "\n", + "#Calculation\n", + "d = d*10**-3; #Separation between the plates of the capacitor(m)\n", + "#Electric displacement, D = epsilon_0*epsilon_r*E, as E = V/d, so \n", + "D = epsilon_0*epsilon_r*V/d; #Dielectric displacement(C/m**2)\n", + "\n", + "#Result\n", + "print \"The dielectric displacement is\",D, \"C/m**2\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The dielectric displacement is 4.427e-07 C/m**2\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 13.4, Page number 288" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "epsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\n", + "N = 3*10**28; #Number density of solid elemental dielectric(atoms/metre cube)\n", + "alpha_e = 10**-40; #Electronic polarizability(Fm**2)\n", + "\n", + "#Calculation\n", + "epsilon_r = 1 + (N*alpha_e/epsilon_0); #Relative dielectric constant of the material\n", + "epsilon_r = math.ceil(epsilon_r*10**3)/10**3; #rounding off the value of epsilon_r to 3 decimals\n", + "\n", + "#Result\n", + "print \"The Relative dielectric constant of the material is\",epsilon_r\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Relative dielectric constant of the material is 1.339\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 13.5, Page number 288" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "N_A = 6.02*10**23; #Avogadro's number(per mole)\n", + "epsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\n", + "epsilon_r = 3.75; #Relative dielectric constant\n", + "d = 2050; #Density of sulphur(kg/metre cube)\n", + "y = 1/3; #Internal field constant\n", + "M = 32; #Atomic weight of sulphur(g/mol)\n", + "\n", + "#Calculation\n", + "N = N_A*10**3*d/M; #Number density of atoms of sulphur(per metre cube)\n", + "#Lorentz relation for local fields give E_local = E + P/(3*epsilon_0) which gives\n", + "#(epsilon_r - 1)/(epsilon_r + 2) = N*alpha_e/(3*epsilon_0), solving for alpha_e\n", + "alpha_e = (epsilon_r - 1)/(epsilon_r + 2)*3*epsilon_0/N; #Electronic polarizability of sulphur(Fm**2)\n", + "\n", + "#Result\n", + "print \"The electronic polarizability of sulphur is\",alpha_e, \"Fm**2\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The electronic polarizability of sulphur is 3.2940125351e-40 Fm**2\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 13.6, Page number 289" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "N = 3*10**28; #Number density of atoms of dielectric material(per metre cube)\n", + "epsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\n", + "n = 1.6; #Refractive index of dielectric material\n", + "\n", + "#Calculation\n", + "#As (n^2 - 1)/(n^2 + 2) = N*alpha_e/(3*epsilon_0), solving for alpha_e\n", + "alpha_e = (n**2 - 1)/(n**2 + 2)*3*epsilon_0/N; #Electronic polarizability of dielectric material(Fm**2)\n", + "\n", + "#Result\n", + "print \"The electronic polarizability of dielectric material is\",alpha_e, \"Fm**2\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The electronic polarizability of dielectric material is 3.029e-40 Fm**2\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 13.7, Page number 289" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "epsilon_r = 4.9; #Absolute relative dielectric constant of material(F/m)\n", + "n = 1.6; #Refractive index of dielectric material\n", + "\n", + "#Calculation\n", + "#As (n^2 - 1)/(n^2 + 2)*(alpha_e + alpha_i)/alpha_e = N*(alpha_e + alpha_i)/(3*epsilon_0) = (epsilon_r - 1)/(epsilon_r + 2)\n", + "#let alpha_ratio = alpha_i/alpha_e\n", + "alpha_ratio = ((epsilon_r - 1)/(epsilon_r + 2)*(n**2 + 2)/(n**2 - 1) - 1)**(-1); #Ratio of electronic polarizability to ionic polarizability\n", + "alpha_ratio = math.ceil(alpha_ratio*10**3)/10**3; #rounding off the value of alpha_ratio to 3 decimals\n", + "\n", + "#Result\n", + "print \"The ratio of electronic polarizability to ionic polarizability is\",alpha_ratio" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The ratio of electronic polarizability to ionic polarizability is 1.534\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/Chapter14_1-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/Chapter14_1-checkpoint.ipynb new file mode 100644 index 00000000..1191c56f --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/Chapter14_1-checkpoint.ipynb @@ -0,0 +1,359 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:03a15735237144f42a49956ccb15694e3ce619fee35260180caccfe8f848e036" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "14: Magnetic Properties of Materials" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 14.1, Page number 306" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "N = 6.02*10**23; #Avogadro's number(per mole)\n", + "A = 56; #Atomic weight of the substance(g/mole)\n", + "d = 7.9; #Density of the substance(g/cm**3)\n", + "m_B = 9.27*10**-24; #Bohr's Magneton(J/T)\n", + "\n", + "#Calculation\n", + "m = 2.2*m_B; #Magnetic moment of substance(J/T)\n", + "n = d*N/A ; #Number of atoms per unit volume of the substance(per cm**3)\n", + "n = n*10**6; #Number of atoms per unit volume of the substance(per m**3)\n", + "M = n*m; #Spontaneous magnetisation of the substance(A/m)\n", + "M = M/10**6;\n", + "M = math.ceil(M*10**3)/10**3; #rounding off the value of M to 3 decimals\n", + "\n", + "#Result\n", + "print \"The spontaneous magnetisation of the substance is\",M,\"*10**6 A/m\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The spontaneous magnetisation of the substance is 1.732 *10**6 A/m\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 14.2, Page number 307" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "H = 200; #Field strength to which the ferromagnetic material is subjected(A/m)\n", + "M = 3100; #Magnetisation of the ferromagnetic material(A/m)\n", + "\n", + "#Calculation\n", + "chi = M/H; #Magnetic susceptibility\n", + "mew_r = 1 + chi; #Relative permeability of ferromagnetic material\n", + "\n", + "#Result\n", + "print \"The relative permeability of ferromagnetic material is\",mew_r" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The relative permeability of ferromagnetic material is 16.5\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 14.3, Page number 307" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "H = 300; #Field strength to which the ferromagnetic material is subjected(A/m)\n", + "M = 4400; #Magnetisation of the ferromagnetic material(A/m)\n", + "\n", + "#Calculation\n", + "chi = M/H; #Magnetic susceptibility\n", + "mew_r = 1 + chi; #Relative permeability of ferromagnetic material\n", + "mew_r = math.ceil(mew_r*100)/100; #rounding off the value of mew_r to 2 decimals\n", + "\n", + "#Result\n", + "print \"The relative permeability of ferromagnetic material is\",mew_r\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The relative permeability of ferromagnetic material is 15.67\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 14.4, Page number 307" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "mew_0 = 4*math.pi*10**-7; #Magnetic permeability of free space(Tm/A)\n", + "H = 10000; #Field strength to which the diamagnetic material is subjected(A/m)\n", + "chi = -0.4*10**-5; #Magnetic susceptibility\n", + "\n", + "#Calculation\n", + "M = chi*H; #Magnetisation of the diamagnetic material(A/m)\n", + "B = mew_0*(H + M); #Magnetic flux density of diamagnetic material(T)\n", + "B = math.ceil(B*10**4)/10**4; #rounding off the value of B to 4 decimals\n", + "\n", + "#Result\n", + "print \"The magnetisation of diamagnetic material is\",M, \"A/m\"\n", + "print \"The magnetic flux density of diamagnetic material is\",B, \"T\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The magnetisation of diamagnetic material is -0.04 A/m\n", + "The magnetic flux density of diamagnetic material is 0.0126 T\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 14.5, Page number 307" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "mew_0 = 4*math.pi*10**-7; #Magnetic permeability of free space(Tm/A)\n", + "H = 1.2*10**5; #Field strength to which the diamagnetic material is subjected(A/m)\n", + "chi = -4.2*10**-6; #Magnetic susceptibility\n", + "\n", + "#Calculation\n", + "M = chi*H; #Magnetisation of the diamagnetic material(A/m)\n", + "B = mew_0*(H + M); #Magnetic flux density of diamagnetic material(T)\n", + "B = math.ceil(B*10**3)/10**3; #rounding off the value of B to 3 decimals\n", + "mew_r = M/H + 1; #The relative permeability of diamagnetic material\n", + "mew_r = math.ceil(mew_r*10**6)/10**6; #rounding off the value of mew_r to 6 decimals\n", + "\n", + "#Result\n", + "print \"The magnetisation of diamagnetic material is\",M, \"A/m\"\n", + "print \"The magnetic flux density of diamagnetic material is\",B, \"T\"\n", + "print \"The relative permeability of diamagnetic material is\",mew_r\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The magnetisation of diamagnetic material is -0.504 A/m\n", + "The magnetic flux density of diamagnetic material is 0.151 T\n", + "The relative permeability of diamagnetic material is 0.999996\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 14.6, Page number 308" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "chi = 5.6*10**-6; #Magnetic susceptibility of diamagnetic material\n", + "m = 9.1*10**-31; #Mass of an electron(kg)\n", + "mew_0 = 4*math.pi*10**-7; #Magnetic permeability of free space(Tm/A)\n", + "Z = 1; #Atomic number\n", + "e = 1.6*10**-19; #Electronic charge(C)\n", + "a = 2.53; #Lattice parameter of bcc structure(A)\n", + "\n", + "#Calculation\n", + "a = a*10**-10; #Lattice parameter of bcc structure(m)\n", + "N = 2/a**3; #The number of electrons per unit volume(per metre cube)\n", + "r = math.sqrt(chi*6*m/(mew_0*Z*e**2*N)); #Mean radius of body centered cubic structure(m)\n", + "r = r*10**10; #Mean radius of body centered cubic structure(A)\n", + "r = math.ceil(r*100)/100; #rounding off the value of r to 2 decimals\n", + "\n", + "#Result\n", + "print \"The mean radius of body centered cubic structure is\",r, \"A\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The mean radius of body centered cubic structure is 0.88 A\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 14.7, Page number 308" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "mew_0 = 4*math.pi*10**-7; #Magnetic permeability of free space(Tm/A)\n", + "N_A = 6.02*10**26; #Avogadro's number(per kmol)\n", + "rho = 4370; #Density of paramegnetic salt(kg/metre cube)\n", + "M = 168.5; #Molecular weight of paramagnetic salt(g/mol)\n", + "T = 27; #Temperature of paramagnetic salt(C)\n", + "H = 2*10**5; #Field strength to which the paramagnetic salt is subjected(A/m)\n", + "mew_B = 9.27*10**-24; #Bohr's magneton(Am**2)\n", + "p = 2; #Number of Bohr magnetons per molecule\n", + "k = 1.38*10**-23; #Boltzmann constant(J/K)\n", + "\n", + "#Calculation\n", + "T = T+273; #Temperature of paramagnetic salt(K)\n", + "N = rho*N_A/M; #Total density of atoms in the paramagnetic salt(per meter cube)\n", + "chi_para = mew_0*N*p**2*mew_B**2/(3*k*T); #Magnetic susceptibility of paramagnetic salt\n", + "chi_para = chi_para*10**4;\n", + "chi_para = math.ceil(chi_para*10**2)/10**2; #rounding off the value of chi_para to 2 decimals\n", + "M = chi*H; #Magnetisation of paramagnetic salt(A/m)\n", + "M = math.ceil(M*10)/10; #rounding off the value of M to 1 decimal\n", + "\n", + "#Result\n", + "print \"The magnetic susceptibility of paramagnetic salt is\",chi_para,\"*10**-4\"\n", + "print \"The magnetisation of paramagnetic salt is\",M, \"A/m\"\n", + "\n", + "#answer for magnetisation is not given in the textbook" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The magnetic susceptibility of paramagnetic salt is 5.43 *10**-4\n", + "The magnetisation of paramagnetic salt is 1.2 A/m\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/Chapter15_1-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/Chapter15_1-checkpoint.ipynb new file mode 100644 index 00000000..feff19f4 --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/Chapter15_1-checkpoint.ipynb @@ -0,0 +1,303 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:16c7c597c3247782caaceb2ade68420e223aff8e960ccd80320d3e5521140cc3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "15: Thermal Properties " + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 15.1, Page number 323" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "k = 1.38*10**-23; #Boltzmann constant(J/K)\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "f_D = 64*10**11; #Debye frequency for Al(Hz)\n", + "\n", + "#Calculation\n", + "theta_D = h*f_D/k; #Debye temperature(K)\n", + "theta_D = math.ceil(theta_D*10)/10; #rounding off the value of theta_D to 1 decimal\n", + "\n", + "#Result\n", + "print \"The Debye temperature of aluminium is\",theta_D, \"K\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Debye temperature of aluminium is 307.3 K\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 15.2, Page number 323" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "N = 6.02*10**26; #Avogadro's number(per kmol)\n", + "k = 1.38*10**-23; #Boltzmann constant(J/K)\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "f_D = 40.5*10**12; #Debye frequency for Al(Hz)\n", + "T = 30; #Temperature of carbon(Ks)\n", + "\n", + "#Calculation\n", + "theta_D = h*f_D/k; #Debye temperature(K)\n", + "C_l = 12/5*math.pi**4*N*k*(T/theta_D)**3; #Lattice specific heat of carbon(J/k-mol/K)\n", + "C_l = math.ceil(C_l*10**3)/10**3; #rounding off the value of C_l to 3 decimals\n", + "\n", + "#Result\n", + "print \"The lattice specific heat of carbon is\",C_l, \"J/k-mol/K\"\n", + "\n", + "#answer given in the book is wrong in the 2nd decimal" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The lattice specific heat of carbon is 7.132 J/k-mol/K\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 15.3, Page number 323" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "k = 1.38*10**-23; #Boltzmann constant(J/K)\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "theta_E = 1990; #Einstein temperature of Cu(K)\n", + "\n", + "#Calculation\n", + "f_E = k*theta_E/h; #Einstein frequency for Cu(K)\n", + "\n", + "#Result\n", + "print \"The Einstein frequency for Cu is\",f_E, \"Hz\"\n", + "print \"The frequency falls in the near infrared region\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Einstein frequency for Cu is 4.14458194989e+13 Hz\n", + "The frequency falls in the near infrared region\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 15.4, Page number 323" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n", + "N = 6.02*10**23; #Avogadro's number(per mol)\n", + "T = 0.05; #Temperature of Cu(K)\n", + "E_F = 7; #Fermi energy of Cu(eV)\n", + "k = 1.38*10**-23; #Boltzmann constant(J/K)\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "theta_D = 348; #Debye temperature of Cu(K)\n", + "\n", + "#Calculation\n", + "C_e = math.pi**2*N*k**2*T/(2*E_F*e); #Electronic heat capacity of Cu(J/mol/K)\n", + "C_V = (12/5)*math.pi**4*(N*k)*(T/theta_D)**3; #Lattice heat capacity of Cu(J/mol/K)\n", + "\n", + "#Result\n", + "print \"The electronic heat capacity of Cu is\",C_e, \"J/mol/K\"\n", + "print \"The lattice heat capacity of Cu is\",C_V, \"J/mol/K\"\n", + "\n", + "#answer for lattice heat capacity given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The electronic heat capacity of Cu is 2.52566877726e-05 J/mol/K\n", + "The lattice heat capacity of Cu is 5.76047891492e-09 J/mol/K\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 15.5, Page number 324" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "T = 1; #For simplicity assume temperature to be unity(K)\n", + "R = 1; #For simplicity assume molar gas constant to be unity(J/mol/K)\n", + "theta_E = T; #Einstein temperature(K)\n", + "\n", + "#Calculation\n", + "C_V = 3*R*(theta_E/T)**2*math.exp(theta_E/T)/(math.exp(theta_E/T)-1)**2; #Einstein lattice specific heat(J/mol/K)\n", + "C_V = C_V/3;\n", + "C_V = math.ceil(C_V*10**3)/10**3; #rounding off the value of C_V to 3 decimals\n", + "\n", + "#Result\n", + "print \"The Einstein lattice specific heat is\",C_V, \"X 3R\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Einstein lattice specific heat is 0.921 X 3R\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 15.6, Page number 324" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n", + "v = 2; #Valency of Zn atom\n", + "N = v*6.02*10**23; #Avogadro's number(per mol)\n", + "T = 300; #Temperature of Zn(K)\n", + "E_F = 9.38; #Fermi energy of Zn(eV)\n", + "k = 1.38*10**-23; #Boltzmann constant(J/K)\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "\n", + "#Calculation\n", + "N = v*6.02*10**23; #Avogadro's number(per mol)\n", + "C_e = math.pi**2*N*k**2*T/(2*E_F*e); #Electronic heat capacity of Zn(J/mol/K)\n", + "C_e = math.ceil(C_e*10**4)/10**4; #rounding off the value of C_e to 4 decimals\n", + "\n", + "#Result\n", + "print \"The molar electronic heat capacity of zinc is\",C_e, \"J/mol/K\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The molar electronic heat capacity of zinc is 0.2262 J/mol/K\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/Chapter17_1-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/Chapter17_1-checkpoint.ipynb new file mode 100644 index 00000000..38e069ca --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/Chapter17_1-checkpoint.ipynb @@ -0,0 +1,75 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:8879a312d81dca096153a38216868ea90a0e18845d7af1e07069b08fc5353d2b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "17: Ultrasonics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 17.1, Page number 352" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "f = 3; #Fundamental vibrational frequency of quartz crystal(MHz)\n", + "Y = 7.9*10**10; #Young's modulus of quartz(N/m**2)\n", + "rho = 2650; #Density of quartz(kg/m**3)\n", + "\n", + "#Calculation\n", + "f = f*10**6; #Fundamental vibrational frequency of quartz crystal(Hz)\n", + "l = 1/(2*f)*math.sqrt(Y/rho); #Thickness of vibrating quartz at resonance(m)\n", + "l = l*10**3; #Thickness of vibrating quartz at resonance(mm)\n", + "l = math.ceil(l*100)/100; #rounding off the value of l to 2 decimals\n", + "\n", + "#Result\n", + "print \"The thickness of vibrating quartz at resonance is\",l, \"mm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The thickness of vibrating quartz at resonance is 0.91 mm\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/Chapter18_1-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/Chapter18_1-checkpoint.ipynb new file mode 100644 index 00000000..0a7b2021 --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/Chapter18_1-checkpoint.ipynb @@ -0,0 +1,294 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:3bec68600cdf231538bf44a09963d76f89f72c71634091075e5c4136c75bb4a6" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "18: Acoustics of Buildings" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 18.1, Page number 361" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "r = 200; #Distance of the point of reduction from the source(m)\n", + "I_0 = 10**-12; #Final intensity of sound(W/m**2)\n", + "I_f = 60; #Intensity gain of sound at the point of reduction(dB)\n", + "\n", + "#Calculation\n", + "#As A_I = 10*log10(I/I_0), solving for I\n", + "I = I_0*10**(I_f/10); #Initial Intensity of sound(W/m**2)\n", + "P = 4*math.pi*r**2*I; #Output power of the sound source(W)\n", + "P = math.ceil(P*100)/100; #rounding off the value of P to 2 decimals\n", + "\n", + "#Result\n", + "print \"The output power of the sound source is\",P, \"W\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The output power of the sound source is 0.51 W\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 18.2, Page number 361" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "import numpy as np\n", + "\n", + "#Variable declaration\n", + "I1 = 1; #For simplicity assume first intensity level to be unity(W/m**2)\n", + "\n", + "#Calculation\n", + "I2 = 2*I1; #Intensity level after doubling(W/m**2)\n", + "dA_I = 10*np.log10(I2/I1); #Difference in gain level(dB)\n", + "\n", + "#Result\n", + "print \"The sound intensity level is increased by\",int(dA_I), \"dB\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The sound intensity level is increased by 3 dB\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 18.3, Page number 361" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "V = 8000; #Volume of the hall(m**3)\n", + "T = 1.5; #Reverbration time of the hall(s)\n", + "\n", + "#Calculation\n", + "alpha_s = 0.167*V/T; #Sabine Formula giving total absorption of sound in the hall(OWU)\n", + "alpha_s = math.ceil(alpha_s*10)/10; #rounding off the value of alpha_s to 1 decimal\n", + "\n", + "#Result\n", + "print \"The total absorption of sound in the hall is\",alpha_s, \"OWU\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The total absorption of sound in the hall is 890.7 OWU\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 18.4, Page number 362" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "V = 25*20*8; #Volume of the hall(m**3)\n", + "T = 4; #Reverbration time of the hall(s)\n", + "\n", + "#Calculation\n", + "S = 2*(25*20+25*8+20*8); #Total surface area of the hall(m**2)\n", + "alpha = 0.167*V/(T*S); #Sabine Formule giving total absorption in the hall(OWU)\n", + "alpha = math.ceil(alpha*10**4)/10**4; #rounding off the value of alpha to 4 decimals\n", + "\n", + "#Result\n", + "print \"The average absorption coefficient of the surfaces is\",alpha, \"OWU/m**2\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The average absorption coefficient of the surfaces is 0.0971 OWU/m**2\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 18.5, Page number 362" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "V = 475; #Volume of the hall(m**3)\n", + "A_f = 100; #Area of the floor(m**2)\n", + "A_c = 100; #Area of the ceiling(m**2)\n", + "A_w = 200; #Area of the wall(m**2)\n", + "alpha_w = 0.025; #Absorption coefficients of the wall(OWU/m**2)\n", + "alpha_c = 0.02; #Absorption coefficients of the ceiling(OWU/m**2)\n", + "alpha_f = 0.55; #Absorption coefficients of the floor(OWU/m**2)\n", + "\n", + "#Calculation\n", + "alpha_s = (A_w*alpha_w)+(A_c*alpha_c)+(A_f*alpha_f); \n", + "T = 0.167*V/alpha_s; #Sabine Formula for reverbration time(s)\n", + "T = math.ceil(T*100)/100; #rounding off the value of T to 2 decimals\n", + "\n", + "#Result\n", + "print \"The reverbration time for the hall is\",T, \"s\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The reverbration time for the hall is 1.28 s\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 18.6, Page number 362" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "I0 = 1; #For simplicity assume initial sound intensity to be unity(W/m**2)\n", + "A_I1 = 80; #First intensity gain of sound(dB)\n", + "A_I2 = 70; #Second intensity gain of sound(dB)\n", + "\n", + "#Calculation\n", + "#As A_I = 10*log10(I/I_0), solving for I1 and I2\n", + "I1 = 10**(A_I1/10)*I0; #First intensity of sound(W/m**2)\n", + "I2 = 10**(A_I2/10)*I0; #Second intensity of sound(W/m**2)\n", + "I = I1 + I2; #Resultant intensity level of sound(W/m**2)\n", + "A_I = 10*np.log10(I/I0); #Intensity gain of resultant sound(dB)\n", + "A_I = math.ceil(A_I*10**3)/10**3; #rounding off the value of A_I to 3 decimals\n", + "\n", + "#Result\n", + "print \"The intensity gain of resultant sound is\",A_I, \"dB\"\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The intensity gain of resultant sound is 80.414 dB\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/Chapter1_1-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/Chapter1_1-checkpoint.ipynb new file mode 100644 index 00000000..9c835441 --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/Chapter1_1-checkpoint.ipynb @@ -0,0 +1,470 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:078983e30b4c728fb3bac2d9363145a8f1fffb1522bc3df76d2595e630af4298" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "1: Oscillations and Waves" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.1, Page number 23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "S=4; #SHM described by a particle(cm)\n", + "x=0; #mean position\n", + "v=12; #velocity at mean position(cm/s)\n", + "\n", + "#Calculation\n", + "A=S/2; #amplitude of motion(cm)\n", + "omega=v/A; #angular frequency(sec-1)\n", + "T=(2*math.pi)/omega; #time period(sec)\n", + "T=math.ceil(T*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print \"time period of motion is\",T, \"sec\"\n", + "print \"time period of motion is pi/3 sec\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "time period of motion is 1.048 sec\n", + "time period of motion is pi/3 sec\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.2, Page number 23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "T=0.1; #time period(sec)\n", + "A=4; #amplitude of motion(cm)\n", + "x=0.2; #distance from mean position(cm)\n", + "\n", + "#Calculation\n", + "omega=(2*math.pi)/T; #angular frequency(sec-1)\n", + "a=(omega**2)*x; #acceleration(cm/sec^2)\n", + "a=math.ceil(a*10**2)/10**2; #rounding off to 2 decimals\n", + "#maximum velocity is when particle is in the mean position\n", + "v_max=omega*A; #maximum velocity(cm/sec)\n", + "v_max=math.ceil(v_max*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print \"acceleration is\",a, \"cm/sec^2\"\n", + "print \"maximum velocity is\",v_max, \"cm/sec\"\n", + "\n", + "#answers given in the book are wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "acceleration is 789.57 cm/sec^2\n", + "maximum velocity is 251.33 cm/sec\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.3, Page number 24" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import modules\n", + "import math\n", + "import numpy as np\n", + "\n", + "#Variable declaration\n", + "A1 = 40; #First amplitude of oscillation(cm)\n", + "An_plus_1 = 4; #Amplitude after 100 oscillations(cm)\n", + "n = 100; #Number of oscillations\n", + "T = 2.5; #Time period of oscillations(s)\n", + "\n", + "#Calculation\n", + "t = T/4; #Time taken to reach the first amplitude from the mean position(s)\n", + "#Now A1 = x0*math.exp(-lambda*t) and An_plus_1 = x0*math.exp(-lambda*(t+nT))\n", + "#A1/An_plus_1 = math.exp(n*lambda*T)\n", + "x=A1/An_plus_1;\n", + "lamda=np.log(x)/(n*T); #Damping constant(per sec)\n", + "lamda=lamda*10**2;\n", + "lamda=math.ceil(lamda*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print \"Damping constant is\",lamda,\"*10**-2 per sec\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Damping constant is 0.922 *10**-2 per sec\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.4, Page number 24" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "x1 = 3; #First position of the particle(cm)\n", + "x2 = 4; #Second position of the particle(cm)\n", + "v1 = 16; #Velocity of particle executing SHM at 1st position(cm/s)\n", + "v2 = 12; #Velocity of particle executing SHM at 2nd position (cm/s)\n", + "\n", + "#Calculation\n", + "#As v = omega*sqrt(A**2 - x**2) so\n", + "#(v1/v2)**2=(A**2 - x1**2)/(A**2 - x2**2)\n", + "#RHS gives (A**2-9)/(A**2-16)\n", + "#(v2**2)*(A**2 - x1**2)=(v1**2)*(A**2 - x2**2), on solving we get\n", + "A=math.sqrt((((v1**2)*(x2**2))-((v2**2)*(x1**2)))/((v1**2)-(v2**2))); #amplitude in cm\n", + "omega=v1/math.sqrt(A**2-x1**2); #Angular speed of the particle(per sec)\n", + "T=2*math.pi/omega; #Time period of oscillation(sec)\n", + "T=math.ceil(T*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print \"The amplitude of SHM is\",A, \"cm\"\n", + "print \"The time period of oscillation is\",T, \"sec\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The amplitude of SHM is 5.0 cm\n", + "The time period of oscillation is 1.571 sec\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.5, Page number 25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "m = 0.3; #Mass attached to the string(kg)\n", + "g = 9.8; #Acceleration due to gravity(m/sec**2)\n", + "x = 0.15; #Stretchness produced in the spring(m)\n", + "s = 0.1; #spring is stretched and released(m)\n", + "\n", + "#Calculation\n", + "F = m*g; #Restoring force acting on the mass(N)\n", + "k = F/x; #Spring constant(N/m)\n", + "A = s; #amplitude equals to the spring stretched and released\n", + "omega = math.sqrt(k/m); #Angular frequency of oscillation(rad per sec)\n", + "v0 = omega*A; #Maximum velocity during the oscillations(m/s)\n", + "v0=math.ceil(v0*100)/100; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print \"The spring constant is\",k, \"N/m\"\n", + "print \"The amplitude of oscillation is\",A, \"m\"\n", + "print \"The maximum velocity during oscillations is\",v0, \"m/s\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The spring constant is 19.6 N/m\n", + "The amplitude of oscillation is 0.1 m\n", + "The maximum velocity during oscillations is 0.81 m/s\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.6, Page number 25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "lambda1 = 400; #Lower limit of wavelength of visible region(nm)\n", + "lambda2 = 700; #Upper limit of wavelength of visible region(nm)\n", + "c = 3*10**8; #Speed of light in vacuum(m/s)\n", + "\n", + "#Calculation\n", + "lambda1 = lambda1*10**-9 #Lower limit of wavelength(m) \n", + "lambda2 = lambda2*10**-9 #upper limit of wavelength(m) \n", + "new_1 = c/lambda1; #Upper limit of frequency of visible region(m)\n", + "new_2 = c/lambda2; #Lower limit of frequency of visible region(m)\n", + "\n", + "#Result\n", + "print \"The frequency equivalent of 400 nm is\",new_1, \"Hz\"\n", + "print \"The frequency equivalent of 700 nm is\",new_2, \"Hz\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The frequency equivalent of 400 nm is 7.5e+14 Hz\n", + "The frequency equivalent of 700 nm is 4.28571428571e+14 Hz\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.7, Page number 26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "#Comparing the standard equation u(x,t) = A*sin(2*%pi(x/lambda-t/T)) with the given equation, we get\n", + "A = 1.5*10**-3; #Amplitude of the sound wave(m)\n", + "lamda = 8; #Wavelength of the sound wave(m)\n", + "T = 1/40; #Time period of the sound wave(s)\n", + "\n", + "#Calculation\n", + "A = A*10**3;\n", + "new = 1/T; #Frequency of the sound wave(Hz)\n", + "v = new*lamda; #Velocity of the sound wave(m/s)\n", + "T=math.ceil(T*100)/100; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print \"The amplitude of the sound wave is\",A,\"*10**-3 m\"\n", + "print \"The wavelength of the sound wave is\",lamda, \"m\"\n", + "print \"The time period of the sound wave is\",T, \"s\"\n", + "print \"The frequency of the sound wave is\",new, \"Hz\"\n", + "print \"The velocity of the sound wave is\",v, \"m/s\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The amplitude of the sound wave is 1.5 *10**-3 m\n", + "The wavelength of the sound wave is 8 m\n", + "The time period of the sound wave is 0.03 s\n", + "The frequency of the sound wave is 40.0 Hz\n", + "The velocity of the sound wave is 320.0 m/s\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.8, Page number 26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#import modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "A = 2; #Amplitude of the wave(cm)\n", + "T = 0.5; #Time period of the wave(sec)\n", + "v = 200; #Wave velocity(cm/s)\n", + "\n", + "#Calculation\n", + "f = 1/T; #Frequency of the wave(Hz)\n", + "lamda = v/f; #Wavelength of the wave(cm)\n", + "\n", + "#Result\n", + "print \"frequency of wave is\",f, \"Hz\"\n", + "print \"wavelength of wave is\",lamda, \"cm\"\n", + "print \"The Equation of the wave moving along X-axis :\"\n", + "print \"u = \",A,\"*sin*2*math.pi*(x/\",lamda,\"- t/\",T,\")\" #x and y are in cm and t is in sec" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "frequency of wave is 2.0 Hz\n", + "wavelength of wave is 100.0 cm\n", + "The Equation of the wave moving along X-axis :\n", + "u = 2 *sin*2*math.pi*(x/ 100.0 - t/ 0.5 )\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.9, Page number 27" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "T = 1000; #Tension in the wire(N)\n", + "M=15; #mass of the wire(kg)\n", + "l=300; #length of the wire(m)\n", + "lamda = 0.30; #Wavelength of wave along wire(m)\n", + "\n", + "#Calculation\n", + "m = M/l; #Mass per unit length of the wire(kg/m)\n", + "v = math.sqrt(T/m); #Velocity of wave through wire(m/s)\n", + "v=math.ceil(v*100)/100; #rounding off to 2 decimals\n", + "new = v/lamda; #Frequency of wave through string(Hz)\n", + "new=math.ceil(new*100)/100; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print \"The velocity of the wave through wire is\",v, \"m/s\"\n", + "print \"The frequency of the wave through wire is\",new, \"Hz\"\n", + "\n", + "#answer for frequency of the wave is wrong in the textbook" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The velocity of the wave through wire is 141.43 m/s\n", + "The frequency of the wave through wire is 471.44 Hz\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/Chapter2_1-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/Chapter2_1-checkpoint.ipynb new file mode 100644 index 00000000..3d6c503f --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/Chapter2_1-checkpoint.ipynb @@ -0,0 +1,245 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:2693d83b10c8e62fc8d3ef78c9959c4d8327c36ed1f7884372585d33796bcbc3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "2: Electromagnetic Theory" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.1, Page number 46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "from __future__ import division\n", + "from sympy import *\n", + "import math\n", + "\n", + "#Variable declaration\n", + "C = 10; #Capacitance of the capacitor(pF)\n", + "#given V=0.2*sin(120*math.pi*t) in volts\n", + "\n", + "#Calculation\n", + "C=C*10**-12; #Capacitance of the capacitor(F)\n", + "x, y, z, t = symbols('x y z t')\n", + "k, m, n = symbols('k m n', integer=True)\n", + "f, g, h = symbols('f g h', cls=Function)\n", + "#I = C*dV/dt\n", + "#let dV/dt be a\n", + "a=diff(0.2*sin(120*math.pi*t),t) #dV/dt\n", + "#value of dV/dt is 75.398223686155*cos(376.991118430775*t)\n", + "#for cosine function peak value occurs when 120*math.pi*t = 0\n", + "#therefore value of dV/dt becomes d = 75.398223686155\n", + "d = 75.398223686155; #value of dV/dt \n", + "I=C*d; #displacement current(A)\n", + "\n", + "#Result\n", + "print \"value of dV/dt is\",a\n", + "print \"displacement current is\",I, \"A\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "value of dV/dt is 75.398223686155*cos(376.991118430775*t)\n", + "displacement current is 7.53982236862e-10 A\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.2, Page number 46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "from __future__ import division\n", + "from sympy import *\n", + "import math\n", + "\n", + "#Variable declaration\n", + "epsilon_r = 1; #Relative electrical permittivity of free space\n", + "epsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\n", + "#given E=sin(120*math.pi*t) in volts\n", + "\n", + "#Calculation\n", + "x, y, z, t = symbols('x y z t')\n", + "k, m, n = symbols('k m n', integer=True)\n", + "f, g, h = symbols('f g h', cls=Function)\n", + "#J2 = epsilon*dE/dt\n", + "epsilon=epsilon_0*epsilon_r;\n", + "#let dE/dt be a\n", + "a=diff(sin(120*math.pi*t),t) #dE/dt\n", + "#value of dE/dt is 376.991118430775*cos(376.991118430775*t)\n", + "#for cosine function peak value occurs when 120*math.pi*t = 0\n", + "#therefore value of dE/dt becomes d = 376.991118430775\n", + "d = 376.991118430775; #value of dE/dt\n", + "J2=epsilon*d; #displacement current density(A/m**2)\n", + "\n", + "#Result\n", + "print \"value of dE/dt is\",a\n", + "print \"The peak value of displacement current density is\",J2, \"A/m**2\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "value of dE/dt is 376.991118430775*cos(376.991118430775*t)\n", + "The peak value of displacement current density is 3.33787936259e-09 A/m**2\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.3, Page number 47 (Theoritical proof)" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.4, Page number 47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "p = 60; #Power rating of bulb(W)\n", + "d = 0.5; #Distance from the bulb(m)\n", + "\n", + "#Calculation\n", + "A=4*math.pi*d**2; #area(m**2)\n", + "P = p/A; #Value of Poynting vector(W/m**2)\n", + "P = math.ceil(P*100)/100; #rounding off value of P to 1 decimal\n", + "\n", + "#Result\n", + "print \"The value of Poynting vector is\",P, \"W/m**2\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of Poynting vector is 19.1 W/m**2\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.5, Page number 47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "E_peak = 6; #Peak value of electric field intensity(V/m)\n", + "c = 3*10**8; #Speed of electromagnetic wave in free space(m/s)\n", + "mew_0 = 4*math.pi*10**-7; #Absolute permeability of free space(Tm/A)\n", + "epsilon_0 = 8.854*10**-12; #Absolute permittivity of free space(F/m)\n", + "mew_r = 1; #Relative permeability of medium\n", + "epsilon_r = 3; #Relative permittivity of the medium\n", + "\n", + "#Calculation\n", + "v = c/math.sqrt(mew_r*epsilon_r); #Wave velocity(m/s)\n", + "v = v/10**8;\n", + "v = math.ceil(v*10**4)/10**4; #rounding off the value of v to 4 decimals\n", + "eta = math.sqrt((mew_0/epsilon_0)*(mew_r/epsilon_r)); #Intrinsic impedance of the medium(ohm)\n", + "eta = math.ceil(eta*10)/10; #rounding off the value of v to 1 decimal\n", + "H_P = E_peak/eta; #Peak value of the magnetic intensity(A/m)\n", + "H_P = H_P*10**2;\n", + "H_P = math.ceil(H_P*10**2)/10**2; #rounding off the value of v to 2 decimals\n", + "\n", + "#Result\n", + "print \"The wave velocity is\",v,\"*10**8 m/s\"\n", + "print \"The intrinsic impedance of the medium is\",eta, \"ohm\"\n", + "print \"The peak value of the magnetic intensity is\",H_P,\"*10**-2 A/m\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The wave velocity is 1.7321 *10**8 m/s\n", + "The intrinsic impedance of the medium is 217.6 ohm\n", + "The peak value of the magnetic intensity is 2.76 *10**-2 A/m\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/Chapter3_1-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/Chapter3_1-checkpoint.ipynb new file mode 100644 index 00000000..7f02f8be --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/Chapter3_1-checkpoint.ipynb @@ -0,0 +1,466 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:366ab969956cd234404db0091b17960805856ec3ff44007e36b0efdbe1414f5e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "3: Interference" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.1, Page number 71" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "beta = 0.51; #Fringe width(mm)\n", + "d = 2.2; #Distance between the slits(mm)\n", + "D = 2; #Distance between the slits and the screen(m)\n", + "\n", + "#Calculation\n", + "beta = beta*10**-1; #Fringe width(cm)\n", + "d = d*10**-1; #Distance between the slits(cm)\n", + "D=D*10**2; #Distance between the slits and the screen(cm)\n", + "lamda = beta*d/D; #Wavelength of light(cm)\n", + "lamda = lamda*10**8; #Wavelength of light(A)\n", + "\n", + "#Result\n", + "print \"The wavelength of light is\",lamda, \"angstrom\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The wavelength of light is 5610.0 angstrom\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.2, Page number 71" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "lambda1 = 4250; #First wavelength emitted by source of light(A)\n", + "lambda2 = 5050; #Second wavelength emitted by source of light(A)\n", + "D = 1.5; #Distance between the source and the screen(m)\n", + "d = 0.025; #Distance between the slits(mm)\n", + "n = 3; #Number of fringe from the centre\n", + "\n", + "#Calculation\n", + "lambda1 = lambda1*10**-10; #First wavelength emitted(m)\n", + "lambda2 = lambda2*10**-10; #Second wavelength emitted(m)\n", + "d = d*10**-3; #Distance between the slits(m)\n", + "x3 = n*lambda1*D/d; #Position of third bright fringe due to lambda1(m)\n", + "x3_prime = n*lambda2*D/d; #Position of third bright fringe due to lambda2(m)\n", + "x = x3_prime-x3; #separation between the third bright fringe(m)\n", + "x = x*10**2; #separation between the third bright fringe(cm)\n", + "\n", + "#Result\n", + "print \"The separation between the third bright fringe due to the two wavelengths is\",x, \"cm\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The separation between the third bright fringe due to the two wavelengths is 1.44 cm\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.3, Page number 71" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "lamda = 5.5*10**-5; #Wavelength emitted by source of light(cm)\n", + "n = 4; #Number of fringes shifted\n", + "t = 3.9*10**-4; #Thickness of the thin glass sheet(cm)\n", + "\n", + "#Calculation\n", + "mew = (n*lamda/t)+1; #Refractive index of the sheet of glass\n", + "mew = math.ceil(mew*10**4)/10**4; #rounding off the value of v to 4 decimals\n", + "\n", + "#Result\n", + "print \"The refractive index of the sheet of glass is\",mew" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The refractive index of the sheet of glass is 1.5642\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.4, Page number 72" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "lamda = 5893; #Wavelength of monochromatic lihgt used(A)\n", + "n = 1; #Number of fringe for the least thickness of the film\n", + "cosr = 1; #for normal incidence\n", + "mew = 1.42; #refractive index of the soap film\n", + "\n", + "#Calculation\n", + "#As for constructive interference, \n", + "#2*mew*t*cos(r) = (2*n-1)*lambda/2, solving for t\n", + "t = (2*n-1)*lamda/(4*mew*cosr); #Thickness of the film that appears bright(A)\n", + "#As for destructive interference, \n", + "#2*mu*t*cos(r) = n*lambda, solving for t\n", + "t1 = n*lamda/(2*mew*cosr); #Thickness of the film that appears bright(A)\n", + "\n", + "#Result\n", + "print \"The thickness of the film that appears bright is\",t, \"angstrom\"\n", + "print \"The thickness of the film that appears dark is\",t1, \"angstrom\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The thickness of the film that appears bright is 1037.5 angstrom\n", + "The thickness of the film that appears dark is 2075.0 angstrom\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.5, Page number 72" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "lamda = 5893; #Wavelength of monochromatic lihgt used(A)\n", + "n = 10; #Number of fringe that are found \n", + "d = 1; #Distance of 10 fringes(cm)\n", + "\n", + "#Calculation\n", + "beta = d/n; #Fringe width(cm)\n", + "lamda = lamda*10**-8; #Wavelength of monochromatic lihgt used(cm)\n", + "theta = lamda/(2*beta); #Angle of the wedge(rad)\n", + "theta = theta*10**4;\n", + "theta = math.ceil(theta*10**4)/10**4; #rounding off the value of theta to 4 decimals\n", + "\n", + "#Result\n", + "print \"The angle of the wedge is\",theta,\"*10**-4 rad\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The angle of the wedge is 2.9465 *10**-4 rad\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.6, Page number 72" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "lamda = 5900; #Wavelength of monochromatic lihgt used(A)\n", + "t = 0.010; #Spacer thickness(mm)\n", + "l = 10; #Wedge length(cm)\n", + "\n", + "#Calculation\n", + "t = t*10**-1; #Spacer thickness(cm)\n", + "theta = t/l; #Angle of the wedge(rad)\n", + "lamda = lamda*10**-8; #Wavelength of monochromatic lihgt used(cm)\n", + "beta = lamda/(2*theta); #Fringe width(cm)\n", + "\n", + "#Result\n", + "print \"The separation between consecutive bright fringes is\",beta, \"cm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The separation between consecutive bright fringes is 0.295 cm\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.7, Page number 72" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "\n", + "#Variable declaration\n", + "D4 = 0.4; #Diameter of 4th dark ring(cm)\n", + "D12 = 0.7; #Diameter of 12th dark ring(cm)\n", + "\n", + "#Calculation\n", + "#We have (dn_plus_k**2)-Dn**2 = 4*k*R*lamda\n", + "#D12**2-D4**2 = 32*R*lamda and D20**2-D12**2 = 32*R*lamda for k = 8\n", + "#since RHS are equal, by equating the LHS we get D12**2-D4**2 = D20**2-D12**2\n", + "D20 = math.sqrt((2*D12**2)-D4**2); #Diameter of 20th dark ring(cm)\n", + "D20 = math.ceil(D20*10**4)/10**4; #rounding off the value of D20 to 4 decimals\n", + "\n", + "#Result\n", + "print \"The diameter of 20th dark ring is\",D20, \"cm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The diameter of 20th dark ring is 0.9056 cm\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.8, Page number 73" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "Dn = 0.30; #Diameter of nth dark ring with air film(cm)\n", + "dn = 0.25; #Diameter of nth dark ring with liquid film(cm)\n", + "\n", + "#Calculation\n", + "mew = (Dn/dn)**2; #Refractive index of the liquid\n", + "\n", + "#Result\n", + "print \"The refractive index of the liquid is\", mew\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The refractive index of the liquid is 1.44\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.9, Page number 73" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "x = 0.002945; #Distance through which movable mirror is shifted(cm)\n", + "N = 100; #Number of fringes shifted\n", + "\n", + "#Calculation\n", + "x = x*10**-2; #Distance through which movable mirror is shifted(m)\n", + "lamda = 2*x/N; #Wavelength of light(m)\n", + "lamda = lamda*10**10; #Wavelength of light(A)\n", + "\n", + "#Result\n", + "print \"The wavelength of light is\",lamda, \"angstrom\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The wavelength of light is 5890.0 angstrom\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.10, Page number 73" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "\n", + "#Variable declaration\n", + "lambda1 = 5896; #Wavelength of D1 line of sodium(A)\n", + "lambda2 = 5890; #Wavelength of D2 line of sodium(A)\n", + "\n", + "#Calculation\n", + "lamda = (lambda1+lambda2)/2;\n", + "x = (lamda**2)/(2*(lambda1-lambda2)); #Shift in movable mirror of Michelson Interferometer(A)\n", + "x = x*10**-7; #Shift in movable mirror of Michelson Interferometer(mm)\n", + "x = math.ceil(x*10**4)/10**4; #rounding off the value of D20 to 4 decimals\n", + "\n", + "#Result\n", + "print \"The shift in movable mirror is\",x, \"mm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The shift in movable mirror is 0.2894 mm\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/Chapter4_1-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/Chapter4_1-checkpoint.ipynb new file mode 100644 index 00000000..c2e7944f --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/Chapter4_1-checkpoint.ipynb @@ -0,0 +1,482 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:bd975238ecc341317a545ed613e73ea0b105f0af115e6d7857237510924e96a0" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "4: Diffraction" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.1, Page number 91" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "D = 50; #Distance between source and the screen(cm)\n", + "lamda = 6563; #Wavelength of light of parallel rays(A)\n", + "d = 0.385; #Width of the slit(mm)\n", + "n1 = 1; #Order of diffraction for first minimum\n", + "n2 = 5; #Order of diffraction for fifth minimum\n", + "\n", + "#Calculation\n", + "lamda = lamda*10**-8; #Wavelength of light of parallel rays(cm)\n", + "d = d*10**-1; #Width of the slit(cm)\n", + "#As sin(theta1) = n*lambda/d = x1/D, solving for x1\n", + "x1 = n1*lamda*D/d; #Distance from the centre of the principal maximum to the first minimum(cm)\n", + "x1 = x1*10; #Distance from the centre of the principal maximum to the first minimum(mm)\n", + "x1 = math.ceil(x1*10**3)/10**3; #rounding off the value of x1 to 3 decimals\n", + "x2 = n2*lamda*D/d; #Distance from the centre of the principal maximum to the fifth minimum(cm)\n", + "x2 = x2*10; #Distance from the centre of the principal maximum to the fifth minimum(mm)\n", + "x2 = math.ceil(x2*10**3)/10**3; #rounding off the value of x2 to 3 decimals\n", + "\n", + "#Result\n", + "print \"The Distance from the centre of the principal maximum to the first minimum is\",x1, \"mm\"\n", + "print \"The Distance from the centre of the principal maximum to the fifth minimum is\",x2, \"mm\"\n", + "\n", + "#answer for x2 given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Distance from the centre of the principal maximum to the first minimum is 0.853 mm\n", + "The Distance from the centre of the principal maximum to the fifth minimum is 4.262 mm\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.2, Page number 91" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "D = 0.04; #Diameter of circular aperture(cm)\n", + "f = 20; #Focal length of convex lens(cm)\n", + "lamda = 6000; #Wavelength of light used(A)\n", + "\n", + "#Calculation\n", + "lamda = lamda*10**-8; #Wavelength of light used(cm)\n", + "#We have sin(theta) = 1.22*lambda/D = theta, for small theta\n", + "#For first dark ring\n", + "theta = 1.22*lamda/D; #The half angular width at central maximum(rad)\n", + "r1 = theta*f; #The half width of central maximum for first dark ring(cm)\n", + "r1 = r1*10**2;\n", + "#We have sin(theta) = 5.136*lambda/(%pi*D) = theta, for small theta\n", + "#For second dark ring\n", + "theta = 5.136*lamda/(math.pi*D); #The half angular width at central maximum(rad)\n", + "r2 = theta*f; #The half width of central maximum for second dark ring(cm)\n", + "r2 = r2*10**2;\n", + "r2 = math.ceil(r2*100)/100; #rounding off the value of r2 to 2 decimals\n", + "\n", + "#Result\n", + "print \"The radius of first dark ring is\",r1,\"*10**-2 cm\"\n", + "print \"The radius of second dark ring is\",r2,\"*10**-2 cm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The radius of first dark ring is 3.66 *10**-2 cm\n", + "The radius of second dark ring is 4.91 *10**-2 cm\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.3, Page number 92" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "n = 2; #Order of diffraction\n", + "lamda = 650; #Wavelength of light used(nm)\n", + "d = 1.2*10**-3; #Distance between two consecutive slits of grating(cm)\n", + "\n", + "#Calculation\n", + "#We have sin(theta) = n*N*lambda = n*lambda/d, solving for theta\n", + "lamda = lamda*10**-9; #Wavelength of light used(m)\n", + "d = d*10**-2; #Distance between two consecutive slits of grating(m)\n", + "a=n*lamda/d;\n", + "theta = math.asin(a); #Angle at which the 650 nm light produces a second order maximum(rad)\n", + "theta = theta*57.2957795; #angle in degrees\n", + "theta = math.ceil(theta*10**2)/10**2; #rounding off the value of theta to 2 decimals\n", + "\n", + "#Result\n", + "print \"The angle at which the light produces a second order maximum is\",theta, \"degrees\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The angle at which the light produces a second order maximum is 6.22 degrees\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.4, Page number 92" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "lamda = 650; #Wavelength of light used(nm)\n", + "N = 6000; #Number of lines per cm on grating\n", + "theta = 90; #Angle at which the highest spectral order is obtained(degrees)\n", + "\n", + "#Calculation\n", + "theta = theta*0.0174532925; #Angle at which the highest spectral order is obtained(rad)\n", + "#We have sin(theta) = n*N*lambda, solving for n\n", + "lamda = lamda*10**-9; #Wavelength of light used(m)\n", + "N = N*10**2; #Number of lines per m on grating\n", + "n = math.sin(theta)/(N*lamda); #The highest order of spectra with diffraction grating\n", + "n = math.ceil(n*10**3)/10**3; #rounding off the value of theta to 3 decimals\n", + "i,d = divmod(n, 1); #divides the value of n into integer and decimal parts where i is integer\n", + "\n", + "#Result\n", + "print \"value of n is\",n\n", + "print \"The highest order of spectra obtained with diffraction grating is\",i\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "value of n is 2.565\n", + "The highest order of spectra obtained with diffraction grating is 2.0\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.5, Page number 92" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "N = 4000; #Number of lines per cm on grating\n", + "#For Blue Line\n", + "lamda1 = 450; #Wavelength of blue light(nm)\n", + "n1 = 3; #Order of diffraction spectrum\n", + "#For Red Line\n", + "lamda2 = 700; #Wavelength of red light(nm)\n", + "n2 = 2; #Order of diffraction spectrum\n", + "\n", + "#Calculation\n", + "N = N*10**2; #Number of lines per m on grating\n", + "lamda1 = lamda1*10**-9; #Wavelength of blue light(m)\n", + "lamda2 = lamda2*10**-9; #Wavelength of red light(m)\n", + "#We have sin(theta) = n*N*lambda, solving for sin(theta)\n", + "sin_theta_3 = n1*N*lamda1; #Sine of angle at third order diffraction \n", + "sin_theta_2 = n2*N*lamda2; #Sine of angle at second order diffraction\n", + "\n", + "#Result\n", + "print \"Sine of angle at third order diffraction is\",sin_theta_3\n", + "print \"Sine of angle at second order diffraction is\",sin_theta_2 \n", + "#Check for overlapping\n", + "if (sin_theta_2-sin_theta_3)<0.05:\n", + " print \"The two orders overlap\"\n", + "else:\n", + " print \"The two orders do not overlap\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sine of angle at third order diffraction is 0.54\n", + "Sine of angle at second order diffraction is 0.56\n", + "The two orders overlap\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.6, Page number 93" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "n = 1; #Order of diffraction spectrum\n", + "N = 6000; #Number of lines per cm on diffraction grating\n", + "D = 2; #Distance of screen from the source(m)\n", + "lamda1 = 400; #Wavelength of blue light(nm)\n", + "lamda2 = 750; #Wavelength of blue light(nm)\n", + "\n", + "#Calculation\n", + "N = N*10**2; #Number of lines per m on grating\n", + "lamda1 = lamda1*10**-9; #Wavelength of blue light(m)\n", + "lamda2 = lamda2*10**-9; #Wavelength of blue light(m)\n", + "#We have sin(theta1) = n*N*lamda1, solving for theta1\n", + "theta1 = math.asin(n*N*lamda1); #Angle at first order diffraction for Blue light(rad)\n", + "theta1_d = theta1*57.2957795; #Angle at first order diffraction for Blue light(degrees)\n", + "theta2 = math.asin(n*N*lamda2); #Angle at first order diffraction for Red light(rad)\n", + "theta2_d = theta2*57.2957795; #Angle at first order diffraction for Red light(degrees)\n", + "x1 = D*math.tan(theta1); #Half width position at central maximum for blue color(m)\n", + "x2 = D*math.tan(theta2); #Half width position at central maximum for red color(m)\n", + "x = x2-x1; #width of first order spectrum on the screen(m)\n", + "x = x*10**2; #width of first order spectrum on the screen(cm)\n", + "x = math.ceil(x*10**2)/10**2; #rounding off the value of x to 2 decimals\n", + "\n", + "#Result\n", + "print \"The width of first order spectrum on the screen is\",x, \"cm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The width of first order spectrum on the screen is 51.34 cm\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.7, Page number 93" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "w = 5; #Width of the grating(cm)\n", + "N = 32; #Number of lines per mm on grating\n", + "lamda = 640; #Wavelength of light(nm)\n", + "n = 2; #Order of diffraction\n", + "\n", + "#Calculation\n", + "N= N*10; #Number of lines per cm on grating\n", + "N0 = w*N; #Total number of lines on the grating\n", + "d_lambda = lamda/(n*N0); #Separation between wavelengths(nm)\n", + "\n", + "#Result\n", + "print \"The separation between wavelengths which the grating can just resolve is\",d_lambda, \"nm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The separation between wavelengths which the grating can just resolve is 0.2 nm\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.8, Page number 93" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "lamda = 550; #Wavelength of light(nm)\n", + "D = 3.2; #Diameter of circular lens(cm)\n", + "f = 24; #Focal length of the lens(cm) \n", + "\n", + "#Calculation\n", + "lamda = lamda*10**-9; #Wavelength of light(m)\n", + "D = D*10**-2; #Diameter of circular lens(m)\n", + "theta_min = 1.22*lamda/D; #Minimum angle of resolution provided by the lens(rad)\n", + "#As delta_x/f = theta_min, solving for delta_x\n", + "f = f*10**-2; #Focal length of the lens(m) \n", + "delta_x = theta_min*f; #Separation of the centres of the images in the focal plane of lens(m)\n", + "delta_x = delta_x*10**6; #Separation of the centres of the images in the focal plane of lens(micro m)\n", + " \n", + "#Result\n", + "print \"The separation of the centres of the images in the focal plane is\",round(delta_x), \"micro-metre\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The separation of the centres of the images in the focal plane is 5.0 micro-metre\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.9, Page number 94" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "lamda = 550; #Wavelength of light(nm)\n", + "D = 20; #Diameter of objective of telescope(cm)\n", + "d = 6; #Distance of two points from the objective of telescope(km)\n", + "\n", + "#Calculation\n", + "lamda = lamda*10**-9; #Wavelength of light(m)\n", + "D = D*10**-2; #Diameter of objective of telescope(m)\n", + "d = d*10**3; #Distance of two points from the objective of telescope(m)\n", + "theta = 1.22*lamda/D; #Angular separation between two points(rad)\n", + "x = theta*d; #Linear separation between two points(m)\n", + "x = x*10**3; #Linear separation between two points(mm)\n", + "\n", + "#Result\n", + "print \"The linear separation between two points is\",x, \"mm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The linear separation between two points is 20.13 mm\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/Chapter5_1-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/Chapter5_1-checkpoint.ipynb new file mode 100644 index 00000000..86db7d36 --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/Chapter5_1-checkpoint.ipynb @@ -0,0 +1,295 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:7539e2f35ea93dc5f143cbd45df18f4d6a1bee4d35a1729fab5d759b4b27d8ff" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "5: Polarization" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 5.1, Page number 113" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "mew_g = 1.72; #Refractive index of glass\n", + "mew_w = 4/3; #Refractive index of water\n", + "\n", + "#Calculation\n", + "#For polarization to occur on flint glass, tan(i) = mew_g/mew_w\n", + "#Solving for i\n", + "i_g = math.atan(mew_g/mew_w); #angle of incidence for complete polarization for flint glass(rad)\n", + "a = 180/math.pi; #conversion factor from radians to degrees\n", + "i_g = i_g*a; #angle of incidence(degrees)\n", + "i_g = math.ceil(i_g*10**2)/10**2; #rounding off the value of i_g to 2 decimals\n", + "#For polarization to occur on water, tan(i) = mew_w/mew_g\n", + "#Solving for i\n", + "i_w = math.atan(mew_w/mew_g); #angle of incidence for complete polarization for water(rad)\n", + "i_w = i_w*a; #angle of incidence(degrees)\n", + "i_w = math.ceil(i_w*10**3)/10**3; #rounding off the value of i_w to 3 decimals\n", + "\n", + "#Result\n", + "print \"The angle of incidence for complete polarization to occur on flint glass is\",i_g, \"degrees\"\n", + "print \"The angle of incidence for complete polarization to occur on water is\",i_w, \"degrees\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The angle of incidence for complete polarization to occur on flint glass is 52.22 degrees\n", + "The angle of incidence for complete polarization to occur on water is 37.783 degrees\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 5.2, Page number 113" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "I0 = 1; #For simplicity, we assume the intensity of light falling on the second Nicol prism to be unity(W/m**2)\n", + "theta = 30; #Angle through which the crossed Nicol is rotated(degrees)\n", + "\n", + "#Calculation\n", + "theeta = 90-theta; #angle between the planes of transmission after rotating through 30 degrees\n", + "a = math.pi/180; #conversion factor from degrees to radians\n", + "theeta = theeta*a; ##angle between the planes of transmission(rad)\n", + "I = I0*math.cos(theeta)**2; #Intensity of the emerging light from second Nicol(W/m**2)\n", + "T = (I/(2*I0))*100; #Percentage transmission of incident light\n", + "T = math.ceil(T*100)/100; #rounding off the value of T to 2 decimals\n", + "\n", + "#Result\n", + "print \"The percentage transmission of incident light after emerging through the Nicol prism is\",T, \"%\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The percentage transmission of incident light after emerging through the Nicol prism is 12.51 %\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 5.3, Page number 113" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "lamda = 6000; #Wavelength of incident light(A)\n", + "mew_e = 1.55; #Refractive index of extraordinary ray\n", + "mew_o = 1.54; #Refractive index of ordinary ray\n", + "\n", + "#Calculation\n", + "lamda = lamda*10**-8; #Wavelength of incident light(cm)\n", + "t = lamda/(4*(mew_e-mew_o)); #Thickness of Quarter Wave plate of positive crystal(cm)\n", + "\n", + "#Result\n", + "print \"The thickness of Quarter Wave plate is\",t, \"cm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The thickness of Quarter Wave plate is 0.0015 cm\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 5.4, Page number 114" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#Calculation\n", + "#the thickness of a half wave plate of calcite for wavelength lamda is\n", + "#t = lamda/(2*(mew_e - mew_o)) = (2*lamda)/(4*(mew_e - mew_o))\n", + "\n", + "#Result\n", + "print \"The half wave plate for lamda will behave as a quarter wave plate for 2*lamda for negligible variation of refractive index with wavelength\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The half wave plate for lamda will behave as a quarter wave plate for 2*lamda for negligible variation of refractive index with wavelength\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 5.5, Page number 114" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "lamda = 500; #Wavelength of incident light(nm)\n", + "mew_e = 1.5508; #Refractive index of extraordinary ray\n", + "mew_o = 1.5418; #Refractive index of ordinary ray\n", + "t = 0.032; #Thickness of quartz plate(mm)\n", + "\n", + "#Calculation\n", + "lamda = lamda*10**-9; #Wavelength of incident light(m)\n", + "t = t*10**-3; #Thickness of quartz plate(m)\n", + "dx = (mew_e - mew_o)*t; #Path difference between E-ray and O-ray(m)\n", + "dphi = (2*math.pi)/lamda*dx; #Phase retardation for quartz for given wavelength(rad)\n", + "dphi = dphi/math.pi;\n", + "\n", + "#Result\n", + "print \"The phase retardation for quartz for given wavelength is\",dphi, \"pi rad\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The phase retardation for quartz for given wavelength is 1.152 pi rad\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 5.6, Page number 114" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "C = 52; #Critical angle for total internal reflection(degrees)\n", + "\n", + "#Calculation\n", + "a = math.pi/180; #conversion factor from degrees to radians\n", + "C = C*a; #Critical angle for total internal reflection(rad)\n", + "#From Brewster's law, math.tan(i_B) = 1_mew_2\n", + "#Also math.sin(C) = 1_mew_2, so that math.tan(i_B) = math.sin(C), solving for i_B\n", + "i_B = math.atan(math.sin(C)); #Brewster angle at the boundary(rad)\n", + "b = 180/math.pi; #conversion factor from radians to degrees\n", + "i_B = i_B*b; #Brewster angle at the boundary(degrees)\n", + "\n", + "#Result\n", + "print \"The Brewster angle at the boundary between two materials is\",int(i_B), \"degrees\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Brewster angle at the boundary between two materials is 38 degrees\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 10 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/Chapter6_1-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/Chapter6_1-checkpoint.ipynb new file mode 100644 index 00000000..63de6fa0 --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/Chapter6_1-checkpoint.ipynb @@ -0,0 +1,656 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:761cc333c24ab0bff41cc769407ab239595ed8749ad7bd7c5ee14e4e733b1604" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "6: Crystallography" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.1, Page number 134" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "M = 23+35.5; #Molecular weight of NaCl(kg/k-mole)\n", + "d = 2.18*10**3; #Density of rock salt(kg/m**3)\n", + "n = 4; #Number of atoms per unit cell for an fcc lattice of NaCl crystal\n", + "N = 6.02*10**26; #Avogadro's No., atoms/k-mol\n", + "\n", + "#Calculation\n", + "a = (n*M/(d*N))**(1/3); #Lattice constant of unit cell of NaCl(m)\n", + "a = a*10**9; ##Lattice constant of unit cell of NaCl(nm)\n", + "a = math.ceil(a*10**3)/10**3; #rounding off the value of a to 3 decimals\n", + "\n", + "#Result\n", + "print \"Lattice parameter for the NaCl crystal is\",a, \"nm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Lattice parameter for the NaCl crystal is 0.563 nm\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.2, Page number 134" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "m = 3;\n", + "n = 2; \n", + "p = 1; #Coefficients of intercepts along three axes\n", + "\n", + "#Calculation\n", + "#reciprocals of the intercepts are 1/m, 1/n, 1/p i.e 1/3, 1/2, 1\n", + "#multiplying by LCM the reciprocals become 2, 3, 6\n", + "\n", + "#Result\n", + "print \"The required miller indices are : (2, 3, 6)\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The required miller indices are : (2, 3, 6)\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.3, Page number 135" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "\n", + "#Variable declaration\n", + "m = 2; #Coefficient of intercept along x-axis\n", + "#n = infinite Coefficient of intercept along y-axis\n", + "p = 3/2; #Coefficient of intercept along z-axis\n", + "\n", + "#Calculation\n", + "#reciprocals of the intercepts are 1/m, 1/n, 1/p i.e 1/2, 0, 2/3\n", + "#multiplying by LCM the reciprocals become 3, 0, 4\n", + "\n", + "#Result\n", + "print \"The required miller indices are : (3, 0, 4)\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The required miller indices are : (3, 0, 4)\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.4, Sketching not possible" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.5, Page number 136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "#For (110) planes\n", + "h1 = 1;\n", + "k1 = 1;\n", + "l1 = 0; #Miller Indices for planes in a cubic crystal\n", + "a1 = 0.43; #Interatomic spacing(nm)\n", + "#For (212) planes\n", + "h2 = 2; \n", + "k2 = 1;\n", + "l2 = 2; #Miller Indices for planes in a cubic crystal\n", + "a2 = 0.43; #Interatomic spacing(nm)\n", + "\n", + "#Calculation\n", + "d1 = a1/(h1**2+k1**2+l1**2)**(1/2); #The interplanar spacing for cubic crystals(nm)\n", + "d1 = math.ceil(d1*10**4)/10**4; #rounding off the value of d1 to 4 decimals\n", + "d2 = a2/(h2**2+k2**2+l2**2)**(1/2); #The interplanar spacing for cubic crystals(nm)\n", + "d2 = math.ceil(d2*10**4)/10**4; #rounding off the value of d2 to 4 decimals\n", + "\n", + "#Result\n", + "print \"The interplanar spacing between consecutive (110) planes is\",d1, \"nm\";\n", + "print \"The interplanar spacing between consecutive (212) planes is\",d2, \"nm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The interplanar spacing between consecutive (110) planes is 0.3041 nm\n", + "The interplanar spacing between consecutive (212) planes is 0.1434 nm\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.6, Page number 136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "h = 2;\n", + "k = 3;\n", + "l = 1; #Miller Indices for planes in a cubic crystal\n", + "r = 0.175; #Atomic radius of fcc lattice(nm)\n", + "\n", + "#Calculation\n", + "a = 2*math.sqrt(2)*r; #Interatomic spacing of fcc lattice(nm)\n", + "d = a/(h**2+k**2+l**2)**(1/2); #The interplanar spacing for cubic crystals(nm)\n", + "d = math.ceil(d*10**4)/10**4; #rounding off the value of d to 4 decimals\n", + "\n", + "#Result\n", + "print \"The interplanar spacing between consecutive (231) planes is\",d, \"nm\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The interplanar spacing between consecutive (231) planes is 0.1323 nm\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.7, Page number 136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "lamda = 1.44; #Wavelength of X-rays(A)\n", + "d = 2.8; #Interplanar spacing of rocksalt crystal(A)\n", + "n1 = 1; #For 1st Order diffraction\n", + "n2 = 2; #For 2nd Order diffraction\n", + "\n", + "#Calculation\n", + "theta1 = math.asin(n1*lamda/(2*d)); #Angle of diffraction(radians)\n", + "theeta1 = theta1*57.2957795; #Angle of diffraction(degrees)\n", + "theeta1 = math.ceil(theeta1*10**2)/10**2; #rounding off the value of theeta1 to 2 decimals\n", + "theta2 = math.asin(n2*lamda/(2*d)); #Angle of diffraction(radians)\n", + "theeta2 = theta2*57.2957795; #Angle of diffraction(degrees)\n", + "theeta2 = math.ceil(theeta2*10**2)/10**2; #rounding off the value of theeta2 to 2 decimals\n", + "\n", + "#Result\n", + "print \"The angle of diffraction for first order maxima is\",theeta1, \"degrees\"\n", + "print \"The angle of diffraction for second order maxima is\",theeta2, \"degrees\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The angle of diffraction for first order maxima is 14.91 degrees\n", + "The angle of diffraction for second order maxima is 30.95 degrees\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.8, Page number 136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "a = 1; #For convenience, assume interatomic spacing to be unity(m)\n", + "\n", + "#Calculation\n", + "N = 8*(1/8) + 6*(1/2); #total number of spheres in a unit cell\n", + "r = a/(2*math.sqrt(2)); #The atomic radius(m)\n", + "V_atom = N*(4/3)*math.pi*r**3; #Volume of atoms(m**3)\n", + "V_uc = a**3; #Volume of unit cell(m**3)\n", + "PV = (V_atom/V_uc)*100; #percentage of actual volume\n", + "PV = math.ceil(PV*10)/10; #rounding off the value of PV to 1 decimal\n", + "\n", + "#Result\n", + "print \"The percentage of actual volume occupied by the spheres in fcc structure is\",PV, \"percent\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The percentage of actual volume occupied by the spheres in fcc structure is 74.1 percent\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.9, Page number 137" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "#For (221) planes\n", + "h = 2; \n", + "k = 2; \n", + "l = 1; #Miller Indices for planes in a cubic crystal\n", + "a = 2.68; #Interatomic spacing(A)\n", + "n1 = 1; #First Order of diffraction \n", + "n2 = 2; #Second order of diffraction\n", + "theta1 = 8.5; #Glancing angle at which Bragg's reflection occurs(degrees)\n", + "\n", + "#Calculation\n", + "theta1 = theta1*0.0174532925; #Glancing angle at which Bragg's reflection occurs(radians)\n", + "a = a*10**-10; #Interatomic spacing(m)\n", + "d = a/(h**2+k**2+l**2)**(1/2); #The interplanar spacing for cubic crystal(m)\n", + "lamda = 2*d*math.sin(theta1)/n1; #Bragg's Law for wavelength of X-rays(m)\n", + "lamda_A = lamda*10**10; #Bragg's Law for wavelength of X-rays(A)\n", + "lamda_A = math.ceil(lamda_A*10**4)/10**4; #rounding off the value of lamda_A to 4 decimals\n", + "theta2 = math.asin(n2*lamda/(2*d)); #Angle at which second order Bragg reflection occurs(radians)\n", + "theta2 = theta2*57.2957795; #Angle at which second order Bragg reflection occurs(degrees)\n", + "theta2 = math.ceil(theta2*10)/10; #rounding off the value of theta2 to 1 decimal\n", + "\n", + "#Result\n", + "print \"The interplanar spacing between consecutive (221) planes is\",d, \"m\"\n", + "print \"The wavelength of X-rays is\",lamda_A, \"angstrom\"\n", + "print \"The angle at which second order Bragg reflection occurs is\",theta2, \"degrees\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The interplanar spacing between consecutive (221) planes is 8.93333333333e-11 m\n", + "The wavelength of X-rays is 0.2641 angstrom\n", + "The angle at which second order Bragg reflection occurs is 17.2 degrees\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.10, Page number 137" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "h = 1; \n", + "k = 1;\n", + "l = 0; #Miller Indices for planes in a cubic crystal\n", + "n = 1; #First Order of diffraction \n", + "theta = 25; #Glancing angle at which Bragg's reflection occurs(degrees)\n", + "lamda = 0.7; #Wavelength of X-rays(A)\n", + "\n", + "#Calculation\n", + "theta = theta*0.0174532925; #Glancing angle at which Bragg's reflection occurs(radians)\n", + "d = n*lamda/(2*math.sin(theta)); #Interplanar spacing of cubic crystal(A)\n", + "a = d*(h**2+k**2+l**2)**(1/2); #The lattice parameter for cubic crystal(A)\n", + "a = math.ceil(a*10**3)/10**3; #rounding off the value of a to 3 decimals\n", + "\n", + "#Result\n", + "print \"The lattice parameter for cubic crystal is\",a, \"angstrom\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The lattice parameter for cubic crystal is 1.172 angstrom\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.11, Page number 138" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "d = 0.31; #Interplanar spacing(nm)\n", + "n = 1; #First Order of diffraction \n", + "theta = 9.25; #Glancing angle at which Bragg's reflection occurs(degrees)\n", + "theta_max = 90; #Maximum possible angle at which reflection can occur(degrees)\n", + "theta_max = theta_max*0.0174532925; #Maximum possible angle at which reflection can occur(radians)\n", + "\n", + "#Calculation\n", + "theta = theta*0.0174532925; #Glancing angle at which Bragg's reflection occurs(radians)\n", + "lamda = 2*d*math.sin(theta)/n; #Wavelength of X-rays(nm) (Bragg's Law)\n", + "lamda = math.ceil(lamda*10**5)/10**5; #rounding off the value of lamda to 5 decimals\n", + "n = 2*d*math.sin(theta_max)/lamda; #Maximum possible order of diffraction\n", + "\n", + "#Result\n", + "print \"The wavelength of X-rays is\",lamda, \"nm\"\n", + "print \"The Maximum possible order of diffraction is\",round(n)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The wavelength of X-rays is 0.09967 nm\n", + "The Maximum possible order of diffraction is 6.0\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.12, Page number 138" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "#For (110) planes\n", + "h1 = 1;\n", + "k1 = 1;\n", + "l1 = 0; #Miller indices for (110) planes\n", + "d_110 = 0.195; #Interplanar spacing between (110) planes(nm)\n", + "#For (210) planes\n", + "h2 = 2;\n", + "k2 = 1; \n", + "l2 = 0; #Miller indices for (110) planes\n", + "n = 2; #Second Order of diffraction \n", + "lamda = 0.071; #Wavelength of X-rays(nm)\n", + "\n", + "#Calculation\n", + "a = d_110*(h1**2 + k1**2 + l1**2)**(1/2); #Lattice parameter for bcc crystal(nm)\n", + "d_210 = a/(h2**2 + k2**2 + l2**2)**(1/2); #Interplanar spacing between (210) planes(nm)\n", + "theta = math.asin(n*lamda/(2*d_210)); #Bragg reflection angle for the second order diffraction(radians)\n", + "theeta = theta*57.2957795; #Bragg reflection angle for the second order diffraction(degrees)\n", + "theeta = math.ceil(theeta*10**3)/10**3; #rounding off the value of theeta to 3 decimals\n", + "\n", + "#Result\n", + "print \"Bragg reflection angle for the second order diffraction is\",theeta, \"degrees\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Bragg reflection angle for the second order diffraction is 35.149 degrees\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.13, Page number 138" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "d = 2182; #Density of rock salt(kg/m**3)\n", + "n = 4; #Number of atoms per unit cell for an fcc lattice of NaCl crystal\n", + "N = 6.02*10**26; #Avogadro's number(atoms/k-mol)\n", + "\n", + "#Calculation\n", + "M = 23+35.5; #Molecular weight of NaCl(kg/k-mole)\n", + "#V = a^3 = M*n/(N*d)\n", + "a = (n*M/(d*N))**(1/3); #Lattice constant of unit cell of NaCl(m)\n", + "D = a/2; #distance between nearest neighbours(m)\n", + "D = D*10**9; #distance between nearest neighbours(nm)\n", + "D = math.ceil(D*10**4)/10**4; #rounding off the value of D to 4 decimals\n", + "\n", + "#Result\n", + "print \"The distance between nearest neighbours of NaCl structure is\",D, \"nm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The distance between nearest neighbours of NaCl structure is 0.2814 nm\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.14, Page number 139" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "r1 = 1.258; #Atomic radius of bcc structure of iron(A)\n", + "N1 = 2; #Number of atoms per unit cell in bcc structure\n", + "#For fcc structure\n", + "r2 = 1.292; #Atomic radius of fcc structure of iron(A)\n", + "N2 = 4; #Number of atoms per unit cell in fcc structure\n", + "\n", + "#Calculation\n", + "a1 = 4*r1/math.sqrt(3); #Lattice parameter of bcc structure of iron(A)\n", + "V1 = a1**3; #Volume of bcc unit cell(A)\n", + "V_atom_bcc = V1/N1; #Volume occupied by one atom(A)\n", + "a2 = 2*math.sqrt(2)*r2; #Lattice parameter of fcc structure of iron(A)\n", + "V2 = a2**3; #Volume of fcc unit cell(A)\n", + "V_atom_fcc = V2/N2; #Volume occupied by one atom(A)\n", + "delta_V = (V_atom_bcc-V_atom_fcc)/V_atom_bcc*100; #Percentage change in volume due to structural change of iron\n", + "delta_V = math.ceil(delta_V*10**3)/10**3; #rounding off the value of delta_V to 3 decimals\n", + "\n", + "#Result\n", + "print \"The percentage change in volume of iron is\",delta_V, \"percent\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The percentage change in volume of iron is 0.494 percent\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/Chapter7_1-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/Chapter7_1-checkpoint.ipynb new file mode 100644 index 00000000..cd558c19 --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/Chapter7_1-checkpoint.ipynb @@ -0,0 +1,289 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:7187247d22d4e816cffb8e16cb739591c46b8ff453a1af7a76514de7cc4fae35" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "7: Superconductivity" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.1, Page number 152" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "Tc=3.722; #critical temperature(K)\n", + "T=2; #temperature(K)\n", + "Bc_0=0.0305; #critical field(T)\n", + "\n", + "#Calculation\n", + "Bc_T=Bc_0*(1-(T/Tc)**2); #critical field at 2K(T)\n", + "Bc_T = math.ceil(Bc_T*10**4)/10**4; #rounding off the value of Bc_T to 4 decimals\n", + "\n", + "#Result\n", + "print \"The critical field at 2K is\",Bc_T, \"T\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The critical field at 2K is 0.0217 T\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.2, Page number 152" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "V = 1; #DC voltage applied across the Josephson junction(micro-volt)\n", + "e = 1.6*10**-19; #Charge on an electron(C)\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "\n", + "#Calculation\n", + "V = V*10**-6; #DC voltage applied across the Josephson junction(V)\n", + "f = 2*e*V/h; #Frequency of Josephson current(Hz)\n", + "f = f*10**-6; #Frequency of Josephson current(MHz)\n", + "f = math.ceil(f*10**2)/10**2; #rounding off the value of f to 2 decimals\n", + "\n", + "#Result\n", + "print \"The frequency of Josephson current is\",f, \"MHz\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The frequency of Josephson current is 482.95 MHz\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.3, Page number 152" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "T_c = 0.517; #Critical temperature for cadmium(K)\n", + "k = 1.38*10**-23; #Boltzmann constant(J/K)\n", + "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n", + "\n", + "#Calculation\n", + "E_g = 3.5*k*T_c/e; #Superconducting energy gap at absolute zero(eV)\n", + "E_g = E_g*10**4;\n", + "E_g = math.ceil(E_g*10**3)/10**3; #rounding off the value of E_g to 3 decimals\n", + "\n", + "#Result\n", + "print \"The superconducting energy gap for Cd at absolute zero is\",E_g,\"*10**-4 eV\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The superconducting energy gap for Cd at absolute zero is 1.561 *10**-4 eV\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.4, Page number 152" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n", + "c = 3*10**8; #Speed of light in free space(m/s)\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "E_g = 1.5*10**-4; #Superconducting energy gap for a material(eV)\n", + "\n", + "#Calculation\n", + "#As E_g = h*new = h*c/lamda, solving for lambda\n", + "lamda = h*c/(E_g*e); #Wavelength of photon to break up a Cooper-pair(m)\n", + "lamda = lamda*10**3;\n", + "lamda = math.ceil(lamda*10**3)/10**3; #rounding off the value of lamda to 3 decimals\n", + "\n", + "#Result\n", + "print \"The wavelength of photon to break up a Cooper-pair is\",lamda,\"*10**-3 m\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The wavelength of photon to break up a Cooper-pair is 8.283 *10**-3 m\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.5, Page number 153" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "lambda_0 = 37; #Penetration depth of lead at 0 kelvin(nm)\n", + "T_c = 7.193; #Critical temperature of superconducting transition for lead(kelvin)\n", + "T = 5.2; #Temperature at which penetration depth for lead becomes lambda_T(kelvin) \n", + "\n", + "#Calculation\n", + "lambda_T = lambda_0*(1-(T/T_c)**4)**(-1/2); #Penetration depth of lead at 5.2 kelvin(nm)\n", + "lambda_T = math.ceil(lambda_T*10)/10; #rounding off the value of lamda_T to 1 decimal\n", + "\n", + "#Result\n", + "print \"The penetration depth of lead is\",lambda_T, \"nm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The penetration depth of lead is 43.4 nm\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.6, Page number 153" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "M1 = 199; #Mass of an isotope of mercury(amu)\n", + "T_C1 = 4.185; #Transition temperature of the isoptope of Hg(K)\n", + "T_C2 = 4.153; #Transition temperature of another isoptope of Hg(K)\n", + "alpha = 0.5; #Isotope coefficient\n", + "\n", + "#Calculation\n", + "M2 = M1*(T_C1/T_C2)**(1/alpha); #Mass of another isotope of mercury(amu)\n", + "M2 = math.ceil(M2*100)/100; #rounding off the value of M2 to 2 decimals\n", + "\n", + "#Result\n", + "print \"The mass of another isotope of mercury is\",M2, \"amu\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The mass of another isotope of mercury is 202.08 amu\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/Chapter8_1-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/Chapter8_1-checkpoint.ipynb new file mode 100644 index 00000000..809f0bc8 --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/Chapter8_1-checkpoint.ipynb @@ -0,0 +1,655 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:6cf74f56ec30435213713191af54de81cab98f4f30811b6d81fe0fb6a9021553" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "8: Special Theory of Relativity" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.1, Page number 171" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "L_0 = 1; #For simplicity, we assume classical length to be unity(m)\n", + "c = 1; #For simplicity assume speed of light to be unity(m/s)\n", + "\n", + "#Calculation\n", + "L = (1-1/100)*L_0; #Relativistic length(m)\n", + "#Relativistic length contraction gives L = L_0*sqrt(1-v^2/c^2), solving for v\n", + "v = math.sqrt(1-(L/L_0)**2)*c; #Speed at which relativistic length is 1 percent of the classical length(m/s)\n", + "v = math.ceil(v*10**4)/10**4; #rounding off the value of v to 4 decimals\n", + "\n", + "#Result\n", + "print \"The speed at which relativistic length is 1 percent of the classical length is\",v, \"c\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The speed at which relativistic length is 1 percent of the classical length is 0.1411 c\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.2, Page number 171" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c = 1; #For simplicity assume speed of light to be unity(m/s)\n", + "delta_t = 5*10**-6; #Mean lifetime of particles as observed in the lab frame(s)\n", + "\n", + "#Calculation\n", + "v = 0.9*c; #Speed at which beam of particles travel(m/s)\n", + "delta_tau = delta_t*math.sqrt(1-(v/c)**2); #Proper lifetime of particle as per Time Dilation rule(s)\n", + "\n", + "#Result\n", + "print \"The proper lifetime of particle is\",delta_tau, \"s\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The proper lifetime of particle is 2.17944947177e-06 s\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.3, Page number 171. theoritical proof" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.4, Page number 172" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c = 1; #For simplicity assume speed of light to be unity(m/s)\n", + "\n", + "#Calculation\n", + "v = 0.6*c; #Speed with which the rocket leaves the earth(m/s)\n", + "u_prime = 0.9*c; #Relative speed of second rocket w.r.t. the first rocket(m/s)\n", + "u1 = (u_prime+v)/(1+(u_prime*v)/c**2); #Speed of second rocket for same direction of firing as per Velocity Addition Rule(m/s)\n", + "u1 = math.ceil(u1*10**4)/10**4; #rounding off the value of u1 to 4 decimals\n", + "u2 = (-u_prime+v)/(1-(u_prime*v)/c**2); #Speed of second rocket for opposite direction of firing as per Velocity Addition Rule(m/s)\n", + "u2 = math.ceil(u2*10**4)/10**4; #rounding off the value of u2 to 4 decimals\n", + "\n", + "#Result\n", + "print \"The speed of second rocket for same direction of firing is\",u1,\"c\"\n", + "print \"The speed of second rocket for opposite direction of firing is\",u2,\"c\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The speed of second rocket for same direction of firing is 0.9741 c\n", + "The speed of second rocket for opposite direction of firing is -0.6521 c\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.5, Page number 172" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c = 1; #For simplicity assume speed of light to be unity(m/s)\n", + "L0 = 1; #For simplicity assume length in spaceship's frame to be unity(m)\n", + "tau = 1; #Unit time in the spaceship's frame(s)\n", + "\n", + "#Calculation\n", + "L = 1/2*L0; #Length as observed on earth(m)\n", + "#Relativistic length contraction gives L = L_0*sqrt(1-v^2/c^2), solving for v\n", + "v = math.sqrt(1-(L/L0)**2)*c; #Speed at which length of spaceship is observed as half from the earth frame(m/s)\n", + "t = tau/math.sqrt(1-(v/c)**2); #Time dilation of the spaceship's unit time(s)\n", + "v = math.ceil(v*10**4)/10**4; #rounding off the value of v to 4 decimals\n", + "\n", + "#Result\n", + "print \"The speed at which length of spaceship is observed as half from the earth frame is\",v, \"c\"\n", + "print \"The time dilation of the spaceship unit time is\",t,\"delta_tau\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The speed at which length of spaceship is observed as half from the earth frame is 0.8661 c\n", + "The time dilation of the spaceship unit time is 2.0 delta_tau\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.6, Page number 172" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c = 3*10**8; #Speed of light in vacuum(m/s)\n", + "t1 = 2*10**-7; #Time for which first event occurs(s)\n", + "t2 = 3*10**-7; #Time for which second event occurs(s)\n", + "x1 = 10; #Position at which first event occurs(m)\n", + "x2 = 40; #Position at which second event occurs(m)\n", + "\n", + "#Calculation\n", + "v = 0.6*c; #Velocity with which S2 frame moves relative to S1 frame(m/s)\n", + "L_factor = 1/math.sqrt(1-(v/c)**2); #Lorentz factor\n", + "delta_t = L_factor*(t2 - t1)+L_factor*v/c**2*(x1 - x2); #Time difference between the events(s)\n", + "delta_x = L_factor*(x2 - x1)-L_factor*v*(t2 - t1); #Distance between the events(m)\n", + "\n", + "#Result\n", + "print \"The time difference between the events is\",delta_t, \"s\" \n", + "print \"The distance between the events is\",delta_x, \"m\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The time difference between the events is 5e-08 s\n", + "The distance between the events is 15.0 m\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.7, Page number 173" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c = 3*10**8; #Speed of light in vacuum(m/s)\n", + "tau = 2.6*10**-8; #Mean lifetime the particle in its own frame(s)\n", + "d = 20; #Distance which the unstable particle travels before decaying(m)\n", + "\n", + "#Calculation\n", + "#As t = d/v and also t = tau/sqrt(1-(v/c)^2), so that\n", + "#d/v = tau/sqrt(1-(v/c)^2), solving for v\n", + "v = math.sqrt(d**2/(tau**2+(d/c)**2)); #Speed of the unstable particle in lab frame(m/s)\n", + "v = v/10**8;\n", + "v = math.ceil(v*10)/10; #rounding off the value of v to 1 decimal\n", + "\n", + "#Result\n", + "print \"The speed of the unstable particle in lab frame is\",v,\"*10**8 m/s\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The speed of the unstable particle in lab frame is 2.8 *10**8 m/s\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.8, Page number 174" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c = 1; #For simplicity assume speed of light to be unity(m/s)\n", + "me = 1; #For simplicity assume mass of electron to be unity(kg)\n", + "tau = 2.3*10**-6; #Average lifetime of mu-meson in rest frame(s)\n", + "t = 6.9*10**-6; #Average lifetime of mu-meson in laboratory frame(s)\n", + "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n", + "C = 3*10**8; #Speed of light in vacuum(m/s)\n", + "m_e = 9.1*10**-31; #Mass of an electron(kg)\n", + "\n", + "#Calculation\n", + "#Fromm Time Dilation Rule, tau = t*sqrt(1-(v/c)^2), solving for v\n", + "v = c*math.sqrt(1-(tau/t)**2); #Speed of mu-meson in the laboratory frame(m/s)\n", + "v = math.ceil(v*10**5)/10**5; #rounding off the value of v to 5 decimals\n", + "m0 = 207*me; #Rest mass of mu-meson(kg)\n", + "m = m0/math.sqrt(1-(v/c)**2); #Relativistic variation of mass with velocity(kg)\n", + "m = math.ceil(m*10)/10; #rounding off the value of m to 1 decimal\n", + "T = (m*m_e*C**2 - m0*m_e*C**2)/e; #Kinetic energy of mu-meson(eV)\n", + "T = T*10**-6; #Kinetic energy of mu-meson(MeV)\n", + "T = math.ceil(T*100)/100; #rounding off the value of T to 2 decimals\n", + " \n", + "#Result\n", + "print \"The speed of mu-meson in the laboratory frame is\",v, \"c\"\n", + "print \"The effective mass of mu-meson is\",m, \"me\"\n", + "print \"The kinetic energy of mu-meson is\",T, \"MeV\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The speed of mu-meson in the laboratory frame is 0.94281 c\n", + "The effective mass of mu-meson is 621.1 me\n", + "The kinetic energy of mu-meson is 211.97 MeV\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.9, Page number 174" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c = 1; #For simplicity assume speed of light to be unity(m/s)\n", + "m0 = 1; #For simplicity assume rest mass to be unity(kg)\n", + "\n", + "#Calculation\n", + "m = (20/100+1)*m0; #Mass in motion(kg)\n", + "#As m = m0/sqrt(1-(u/c)^2), solving for u\n", + "u = math.sqrt(1-(m0/m)**2)*c; #Speed of moving mass(m/s) \n", + "u = math.ceil(u*10**3)/10**3; #rounding off the value of u to 3 decimals\n", + "\n", + "#Result\n", + "print \"The speed of moving body is\",u, \"c\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The speed of moving body is 0.553 c\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.10, Page number 175" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c = 3*10**8; #Speed of light in vacuum(m/s)\n", + "dE = 4*10**26; #Energy radiated per second my the sun(J/s)\n", + "\n", + "#Calculation\n", + "dm = dE/c**2; #Rate of decrease of mass of sun(kg/s)\n", + "dm = dm/10**9;\n", + "dm = math.ceil(dm*10**3)/10**3; #rounding off the value of dm to 3 decimals\n", + "\n", + "#Result\n", + "print \"The rate of decrease of mass of sun is\",dm,\"*10**9 kg/s\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The rate of decrease of mass of sun is 4.445 *10**9 kg/s\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.11, Page number 175" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c = 1; #For simplicity assume speed of light to be unity(m/s)\n", + "m0 = 9.1*10**-31; #Mass of the electron(kg)\n", + "E0 = 0.512; #Rest energy of electron(MeV)\n", + "T = 10; #Kinetic energy of electron(MeV)\n", + "\n", + "#Calculation\n", + "E = T + E0; #Total energy of electron(MeV)\n", + "# From Relativistic mass-energy relation E^2 = c^2*p^2 + m0^2*c^4, solving for p\n", + "p = math.sqrt(E**2-m0**2*c**4)/c; #Momentum of the electron(MeV)\n", + "p = math.ceil(p*100)/100; #rounding off the value of p to 2 decimals\n", + "#As E = E0/sqrt(1-(u/c)^2), solving for u\n", + "u = math.sqrt(1-(E0/E)**2)*c; #Velocity of the electron(m/s)\n", + "u = math.ceil(u*10**4)/10**4; #rounding off the value of u to 4 decimals\n", + "\n", + "#Result\n", + "print \"The momentum of the electron is\",p,\"/c MeV\"\n", + "print \"The velocity of the electron is\",u, \"c\"\n", + "\n", + "#answer for velocity given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The momentum of the electron is 10.52 /c MeV\n", + "The velocity of the electron is 0.9989 c\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.12, Page number 175. theoritical proof" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.13, Page number 176" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c = 3*10**8; #Speed of light in vacuum(m/s)\n", + "E = 4.5*10**17; #Total energy of object(J)\n", + "px = 3.8*10**8; #X-component of momentum(kg-m/s)\n", + "py = 3*10**8; #Y-component of momentum(kg-m/s)\n", + "pz = 3*10**8; #Z-component of momentum(kg-m/s)\n", + "\n", + "#Calculation\n", + "p = math.sqrt(px**2+py**2+pz**2); #Total momentum of the object(kg-m/s)\n", + "#From Relativistic mass-energy relation E^2 = c^2*p^2 + m0^2*c^4, solving for m0\n", + "m0 = math.sqrt(E**2/c**4 - p**2/c**2); #Rest mass of the body(kg)\n", + "m0 = math.ceil(m0*100)/100; #rounding off the value of m0 to 2 decimals\n", + "\n", + "#Result\n", + "print \"The rest mass of the body is\",m0, \"kg\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The rest mass of the body is 4.63 kg\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.14, Page number 176" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c = 3*10**8; #Speed of light in vacuum(m/s)\n", + "m = 50000; #Mass of high speed probe(kg)\n", + "\n", + "#Calculation\n", + "u = 0.8*c; #Speed of the probe(m/s)\n", + "p = m*u/math.sqrt(1-(u/c)**2); #Momentum of the probe(kg-m/s)\n", + "\n", + "#Result\n", + "print \"The momentum of the high speed probe is\",p, \"kg-m/s\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The momentum of the high speed probe is 2e+13 kg-m/s\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.15, Page number 177" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "e = 1.6*10**-19; #Electronic charge, C = Energy equivalent of 1 eV(J/eV)\n", + "m0 = 9.11*10**-31; #Rest mass of electron(kg)\n", + "c = 3*10**8; #Speed of light in vacuum(m/s)\n", + "\n", + "#Calculation\n", + "u1 = 0.98*c; #Inital speed of electron(m/s)\n", + "u2 = 0.99*c; #Final speed of electron(m/s)\n", + "m1 = m0/math.sqrt(1-(u1/c)**2); #Initial relativistic mass of electron(kg)\n", + "m2 = m0/math.sqrt(1-(u2/c)**2); #Final relativistic mass of electron(kg)\n", + "dm = m2 - m1; #Change in relativistic mass of the electron(kg)\n", + "W = dm*c**2/e; #Work done on the electron to change its velocity(eV)\n", + "W = W*10**-6; #Work done on the electron to change its velocity(MeV)\n", + "W = math.ceil(W*100)/100; #rounding off the value of W to 2 decimals\n", + "#As W = eV, V = accelerating potential, solving for V\n", + "V = W*10**6; #Accelerating potential(volt)\n", + "V = V/10**6;\n", + "\n", + "#Result\n", + "print \"The change in relativistic mass of the electron is\",dm, \"kg\"\n", + "print \"The work done on the electron to change its velocity is\",W, \"MeV\"\n", + "print \"The accelerating potential is\",V, \"*10**6 volt\"\n", + "\n", + "#answers given in the book are wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The change in relativistic mass of the electron is 1.87996052912e-30 kg\n", + "The work done on the electron to change its velocity is 1.06 MeV\n", + "The accelerating potential is 1.06 *10**6 volt\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/Chapter9_1-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/Chapter9_1-checkpoint.ipynb new file mode 100644 index 00000000..bea06702 --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/Chapter9_1-checkpoint.ipynb @@ -0,0 +1,357 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:1c769d85a6ecede1e3083e9252f10446216c71537365688b1cba3c5693bdfee6" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "9: Quantum Mechanics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.1, Page number 202" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "V = 100; #Accelerating potential for electron(volt)\n", + "\n", + "#Calculation\n", + "lamda = math.sqrt(150/V)*10**-10; #de-Broglie wavelength of electron(m)\n", + "\n", + "#Result\n", + "print \"The De-Broglie wavelength of electron is\",lamda, \"m\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The De-Broglie wavelength of electron is 1.22474487139e-10 m\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.2, Page number 203" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "m = 9.11*10**-31; #Mass of the electron(kg)\n", + "Ek = 10; #Kinetic energy of electron(eV)\n", + "\n", + "#Calculation\n", + "p = math.sqrt(2*m*Ek*e); #Momentum of the electron(kg-m/s)\n", + "lamda = h/p ; #de-Broglie wavelength of electron from De-Broglie relation(m)\n", + "lamda = lamda*10**9; #de-Broglie wavelength of electron from De-Broglie relation(nm)\n", + "lamda = math.ceil(lamda*10**2)/10**2; #rounding off the value of lamda to 2 decimals\n", + "\n", + "#Result\n", + "print \"The de-Broglie wavelength of electron is\",lamda, \"nm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The de-Broglie wavelength of electron is 0.39 nm\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.3, Page number 203. theoritical proof" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.4, Page number 203" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "m = 9.11*10**-31; #Mass of the electron(kg)\n", + "v = 1.1*10**6; #Speed of the electron(m/s)\n", + "pr = 0.1; #precision in percent\n", + "\n", + "#Calculation\n", + "p = m*v; #Momentum of the electron(kg-m/s)\n", + "dp = pr/100*p; #Uncertainty in momentum(kg-m/s)\n", + "h_bar = h/(2*math.pi); #Reduced Planck's constant(Js)\n", + "dx = h_bar/(2*dp); #Uncertainty in position(m)\n", + "\n", + "#Result\n", + "print \"The uncertainty in position of electron is\",dx, \"m\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The uncertainty in position of electron is 5.26175358211e-08 m\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.5, Page number 203" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "dt = 10**-8; #Uncertainty in time(s)\n", + "\n", + "#Calculation\n", + "h_bar = h/(2*math.pi); #Reduced Planck's constant(Js)\n", + "dE = h_bar/(2*dt*e); #Uncertainty in energy of the excited state(m)\n", + "\n", + "#Result\n", + "print \"The uncertainty in energy of the excited state is\",dE, \"eV\"\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The uncertainty in energy of the excited state is 3.2955020404e-08 eV\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.6, Page number 204" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c = 3*10**8; #Speed of light(m/s)\n", + "dt = 10**-8; #Average lifetime(s)\n", + "lamda = 400; #Wavelength of spectral line(nm)\n", + "\n", + "#Calculation\n", + "lamda = lamda*10**-9; #Wavelength of spectral line(m)\n", + "#From Heisenberg uncertainty principle,\n", + "#dE = h_bar/(2*dt) and also dE = h*c/lambda^2*d_lambda, which give\n", + "#h_bar/(2*dt) = h*c/lambda^2*d_lambda, solving for d_lambda\n", + "d_lamda = (lamda**2)/(4*math.pi*c*dt); #Width of spectral line(m)\n", + "\n", + "#Result\n", + "print \"The width of spectral line is\",d_lamda, \"m\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The width of spectral line is 4.24413181578e-15 m\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.7, Page number 204. theoritical proof" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.8, Page number 204. theoritical proof" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.9, Page number 205. theoritical proof" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.10, Page number 205. theoritical proof" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.11, Page number 205. theoritical proof" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.12, Page number 206. theoritical proof" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.13, Page number 206. theoritical proof " + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.14, Page number 207" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "from scipy.integrate import quad\n", + "\n", + "#Variable declaration\n", + "a = 2*10**-10; # Width of 1D box(m)\n", + "x1=0; # Position of first extreme of the box(m)\n", + "x2=1*10**-10; # Position of second extreme of the box(m)\n", + "\n", + "#Calculation\n", + "def intg(x):\n", + " return ((2/a)*(math.sin(2*math.pi*x/a))**2)\n", + "S=quad(intg,x1,x2)[0]\n", + "\n", + "#Result\n", + "print \"The probability of finding the electron between x = 0 and x = 10**-10 is\",S" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The probability of finding the electron between x = 0 and x = 10**-10 is 0.5\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/Chapter_1-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/Chapter_1-checkpoint.ipynb new file mode 100644 index 00000000..080a49e2 --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/Chapter_1-checkpoint.ipynb @@ -0,0 +1,263 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:f155f4255421e223741f26abb6caa1287b63505ee5f432c40968d5b5ff6fb505" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Ultrasonics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.1, Page number 28 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "t=0.15*10**-2; #thickness of the quartz crystal in m\n", + "Y=7.9*10**10; #young's modulus of quartz in N/m^2\n", + "rho=2650; #density of quartz in kg/m^3\n", + "\n", + "#Calculation\n", + "x=math.sqrt(Y/rho);\n", + "f=x/(2*t);\n", + "f=f*10**-6; #converting f from Hz to MHz\n", + "f=math.ceil(f*10**6)/10**6; #rounding off to 6 decimals\n", + "\n", + "#Result\n", + "print(\"fundamental frequency of vibration in MHz is\",f);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('fundamental frequency of vibration in MHz is', 1.819992)\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.2, Page number 28 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "t=1e-03; #thickness of the quartz crystal in m\n", + "Y=7.9*10**10; #young's modulus of quartz in N/m^2\n", + "rho=2650; #density of quartz in kg/m^3\n", + "\n", + "#Calculation\n", + "x=math.sqrt(Y/rho);\n", + "p1=1; #for fundamental frequency p=1\n", + "f1=(p1*x)/(2*t);\n", + "F1=f1/10**6;\n", + "F1=math.ceil(F1*10**5)/10**5; #rounding off to 5 decimals\n", + "f_1=f1*10**-6; #converting f1 from Hz to MHz\n", + "f_1=math.ceil(f_1*10**5)/10**5; #rounding off to 5 decimals\n", + "p2=2; #for first overtone p=2\n", + "f2=(p2*x)/(2*t);\n", + "F2=f2/10**6;\n", + "F2=math.ceil(F2*10**5)/10**5; #rounding off to 5 decimals\n", + "f_2=f2*10**-6; #converting f2 from Hz to MHz\n", + "f_2=math.ceil(f_2*10**5)/10**5; #rounding off to 5 decimals\n", + "\n", + "#Result\n", + "print(\"fundamental frequency in Hz is\",F1,\"*10**6\");\n", + "print(\"fundamental frequency in MHz is\",f_1);\n", + "print(\"frequency of the first overtone in Hz is\",F2,\"*10**6\");\n", + "print(\"frequency of the first overtone in MHz is\",f_2);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('fundamental frequency in Hz is', 2.72999, '*10**6')\n", + "('fundamental frequency in MHz is', 2.72999)\n", + "('frequency of the first overtone in Hz is', 5.45998, '*10**6')\n", + "('frequency of the first overtone in MHz is', 5.45998)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.3, Page number 29 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "lamda=589.3*10**-9; #wavelength of light in m\n", + "f=100*10**6; #frequency of ultrasonic transducer in Hz\n", + "n=1; #order of diffraction\n", + "theta=2.25; #angle of diffraction in degrees\n", + "theta=theta*0.0174532925; #converting degrees to radians\n", + "\n", + "#Calculation\n", + "d=(n*lamda)/(2*math.sin(theta));\n", + "d1=d*10**6; #converting d from m to micro m\n", + "lamda1=2*d;\n", + "v=f*lamda1;\n", + "v=math.ceil(v*100)/100; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"wavelength of ultrasonic wave in m is\",lamda1);\n", + "print(\"velocity of ultrasonic wave in m/sec\",int(v));" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('wavelength of ultrasonic wave in m is', 1.5010258944908707e-05)\n", + "('velocity of ultrasonic wave in m/sec', 1501)\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.4, Page number 29 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "f=2*10**6; #frequency of transducer in MHz\n", + "v=3; #speed of blood in m/s\n", + "c=800; #velocity of ultrasonic wave in m/s\n", + "theta=30; #angle of inclination in degrees\n", + "theta=theta*0.0174532925; #converting degrees to radians\n", + "\n", + "#Calculation\n", + "deltaf=(2*f*v*math.cos(theta))/c;\n", + "deltaf=deltaf*10**-6; #converting deltaf from Hz to MHz\n", + "deltaf=math.ceil(deltaf*10**6)/10**6; #rounding off to 6 decimals\n", + "\n", + "#Result\n", + "print(\"doppler shifted frequency in MHz is\",deltaf);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('doppler shifted frequency in MHz is', 0.012991)\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.5, Page number 30 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "\n", + "#Variable declaration\n", + "Y=7.9*10**10; #young's modulus of quartz in N/m^2\n", + "rho=2650; #density of quartz in kg/m^3\n", + "\n", + "#Calculation\n", + "v=math.sqrt(Y/rho);\n", + "v=math.ceil(v*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"velocity of ultrasonic waves in m/s is\",v);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('velocity of ultrasonic waves in m/s is', 5459.975)\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/Chapter_10-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/Chapter_10-checkpoint.ipynb new file mode 100644 index 00000000..22ab6eae --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/Chapter_10-checkpoint.ipynb @@ -0,0 +1,301 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:d58d66ad9738120c070e76177ecbb4c809f35b6cd83a911351fcdee8be9798f2" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Magnetic materials" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 10.1, Page number 305" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "H=10**6; #magnetic field strength in A/m\n", + "chi=0.5*10**-5; #magnetic susceptibility\n", + "\n", + "#Calculation\n", + "mew0=4*math.pi*10**-7;\n", + "M=chi*H;\n", + "B=mew0*(M+H);\n", + "B=math.ceil(B*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"intensity of magnetisation in A/m is\",M);\n", + "print(\"flux density in Wb/m^2 is\",B);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('intensity of magnetisation in A/m is', 5.0)\n", + "('flux density in Wb/m^2 is', 1.257)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 10.2, Page number 306" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "A=6.022*10**23; #avagadro number\n", + "mew0=4*math.pi*10**-7;\n", + "w=58.7; #atomic weight of Ni\n", + "B=0.65; #saturation magnetic induction in Wb/m^2\n", + "rho=8906; #density in kg/m^3\n", + "\n", + "#Calculation\n", + "rho=rho*10**3; #converting into gm/m^3\n", + "N=(rho*A)/w;\n", + "mew_m=B/(N*mew0);\n", + "#mew_m/(9.27*10^-24) gives mew_m in mewB\n", + "mew_m=mew_m/(9.27*10**-24);\n", + "mew_m=math.ceil(mew_m*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"magnetic moment of Ni is\",mew_m,\"mew_b\");\n", + "#that is mew_m=0.61 mew_b" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('magnetic moment of Ni is', 0.611, 'mew_b')\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 10.3, Page number 306" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "mew_0=4*math.pi*10**-7;\n", + "H=1800; #magnetic field in A/m\n", + "phi=3*10**-5; #magnetic flux in Wb\n", + "A=0.2; #area of cross section in cm^2\n", + "\n", + "#Calculation\n", + "A=A*10**-4; #area in m^2\n", + "B=phi/A;\n", + "mew_r=B/(mew_0*H);\n", + "mew_r=math.ceil(mew_r*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"permeability of material is\",mew_r);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('permeability of material is', 663.146)\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 10.4, Page number 307" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "mew=18.4; #magnetic moment in mew_b\n", + "a=0.835; #lattice parameter in nm\n", + "\n", + "#Calculation\n", + "mew=mew*9.27*10**-24;\n", + "a=a*10**-9; #converting nm to m\n", + "V=a**3;\n", + "M=mew/V;\n", + "M=M/10**5;\n", + "M=math.ceil(M*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"saturation magnetisation in A/m is\",M,\"*10**5\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('saturation magnetisation in A/m is', 2.9299, '*10**5')\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 10.5, Page number 307" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "mew_0=4*math.pi*10**-7;\n", + "H=2*10**5; #magnetic field strength in A/m\n", + "mew_r=1.01; #relative permeability\n", + "\n", + "#Calculation\n", + "B=mew_0*mew_r*H;\n", + "B=math.ceil(B*10**5)/10**5; #rounding off to 3 decimals\n", + "M=(B/mew_0)-H;\n", + "M=math.ceil(M*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"magnetic flux density in Wb/m^2 is\",B);\n", + "print(\"magnetisation in A/m is\",M);\n", + "\n", + "#answer for magnetisation given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('magnetic flux density in Wb/m^2 is', 0.25385)\n", + "('magnetisation in A/m is', 2007.42)\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 10.6, Page number 307" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "mew_0=4*math.pi*10**-7;\n", + "H=500; #magnetic field strength in A/m\n", + "chi=1.2; #susceptibility\n", + "\n", + "#Calculation\n", + "M=chi*H;\n", + "B=mew_0*(M+H);\n", + "B=B*10**3;\n", + "B=math.ceil(B*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"magnetic flux density in Wb/m^2 is\",B,\"*10**-3\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('magnetic flux density in Wb/m^2 is', 1.3824, '*10**-3')\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/Chapter_11-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/Chapter_11-checkpoint.ipynb new file mode 100644 index 00000000..d8455a9b --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/Chapter_11-checkpoint.ipynb @@ -0,0 +1,319 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:3ff449f1ffe03bd2c9931a55b263d24ea75427a65a897e285709531b99dfed25" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Dielectric materials" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 11.1, Page number 335" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "epsilon_0=8.854*10**-12;\n", + "A=10*10*10**-6; #area of capacitor in m^2\n", + "d=2*10**-3; #distance of seperation in m\n", + "C=10**-9; #capacitance in F\n", + "\n", + "#Calculation\n", + "epsilon_r=(C*d)/(epsilon_0*A);\n", + "epsilon_r=math.ceil(epsilon_r*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"dielectric constant of material is\",epsilon_r);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('dielectric constant of material is', 2258.87)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 11.2, Page number 335" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#Variable declaration\n", + "epsilon_0=8.854*10**-12;\n", + "epsilon_r=1.0000684; #dielectric constant of He gas\n", + "N=2.7*10**25; #concentration of dipoles per m^3\n", + "\n", + "#Calculation\n", + "#alpha_e=P/(N*E) and P=epsilon_0(epsilon_r-1)*E\n", + "#therefore alpha_e=epsilon_0(epsilon_r-1)/N\n", + "alpha_e=(epsilon_0*(epsilon_r-1))/N;\n", + "\n", + "#Result\n", + "print(\"electronic polarizability of He gas in Fm^2 is\",alpha_e);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('electronic polarizability of He gas in Fm^2 is', 2.2430133333322991e-41)\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 11.3, Page number 336" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#Variable declaration\n", + "epsilon_0=8.854*10**-12;\n", + "epsilon_r=6; #dielectric constant\n", + "E=100; #electric field intensity in V/m\n", + "\n", + "#Calculation\n", + "P=epsilon_0*(epsilon_r-1)*E;\n", + "\n", + "#Result\n", + "print(\"polarization in C/m^2 is\",P);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('polarization in C/m^2 is', 4.426999999999999e-09)\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 11.4, Page number 336" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "epsilon_0=8.854*10**-12;\n", + "R=0.158; #radius of Ne in nm\n", + "\n", + "#Calculation\n", + "R=R*10**-9; #converting nm to m\n", + "alpha_e=4*math.pi*epsilon_0*R**3;\n", + "\n", + "#Result\n", + "print(\"electronic polarizability in Fm^2 is\",alpha_e);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('electronic polarizability in Fm^2 is', 4.3885458748002144e-40)\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 11.5, Page number 336" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "epsilon_0=8.854*10**-12;\n", + "C=0.02; #capacitance in micro farad\n", + "epsilon_r=6; #dielectric constant\n", + "t=0.002; #thickness of mica in cm\n", + "d=0.002; #thickness of metal sheet in cm\n", + "\n", + "#Calculation\n", + "C=C*10**-6; #converting micro farad to farad\n", + "d=d*10**-2; #converting cm to m\n", + "A=(C*d)/(epsilon_0*epsilon_r);\n", + "A=A*10**3;\n", + "A=math.ceil(A*10**4)/10**4; #rounding off to 4 decimals\n", + "A1=A*10; #converting m**2 to cm**2\n", + "A1=math.ceil(A1*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"area of metal sheet in m^2 is\",A,\"*10**-3\");\n", + "print(\"area of metal sheet in cm^2 is\",A1);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('area of metal sheet in m^2 is', 7.5296, '*10**-3')\n", + "('area of metal sheet in cm^2 is', 75.296)\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 11.6, Page number 336" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "epsilon_0=8.854*10**-12;\n", + "E=1000; #electric field in V/m\n", + "P=4.3*10**-8; #polarization in C/m^2\n", + "\n", + "#Calculation\n", + "epsilon_r=(P/(E*epsilon_0)+1);\n", + "epsilon_r=math.ceil(epsilon_r*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"dielectric constant is\",epsilon_r);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('dielectric constant is', 5.8566)\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 11.7, Page number 337" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#Variable declaration\n", + "epsilon_0=8.854*10**-12;\n", + "chi=4.94; #relative susceptibility\n", + "N=10**28; #number of dipoles per m^3\n", + "\n", + "#Calculation\n", + "#polarisation P=N*alpha*E and P=epsilon_0*chi*E. equate the two equations\n", + "#epsilon_0*chi*E=N*alpha*E\n", + "alpha=(epsilon_0*chi)/N;\n", + "\n", + "#Result\n", + "print(\"polarisability of material in F/m^2 is\",alpha);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('polarisability of material in F/m^2 is', 4.373876e-39)\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/Chapter_12-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/Chapter_12-checkpoint.ipynb new file mode 100644 index 00000000..4fdbd6c5 --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/Chapter_12-checkpoint.ipynb @@ -0,0 +1,294 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:50b83ee4e84906dcabb2d002b372255d1153b0b8a78afbf0a4be018e0c342780" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Superconducting Materials" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 12.1, Page number 356" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "Tc=3.7; #critical temperature in K\n", + "H0=0.0306; #magnetic field in T\n", + "T=2; #temperature in K\n", + "\n", + "#Calculation\n", + "Hc=H0*(1-(T**2/Tc**2));\n", + "Hc=math.ceil(Hc*10**5)/10**5; #rounding off to 5 decimals\n", + "\n", + "#Result\n", + "print(\"critical field in T is\",Hc);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('critical field in T is', 0.02166)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 12.2, Page number 356" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "Tc=7.26; #critical temperature in K\n", + "H0=6.4*10**3; #magnetic field in T\n", + "T=5; #temperature in K\n", + "\n", + "#Calculation\n", + "Hc=H0*(1-(T**2/Tc**2));\n", + "Hc=math.ceil(Hc*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"critical field in T is\",Hc);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('critical field in T is', 3364.385)\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 12.3, Page number 357" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "Tc1=4.185; #critical temperature in K\n", + "M1=199.5; #atomic mass\n", + "M2=203.4; #atomic mass after changing\n", + "\n", + "#Calculation\n", + "#according to maxwell equation Tc*M^0.5=constant\n", + "#Tc1*M1^0.5=Tc2*M2^0.5\n", + "Tc2=(Tc1*M1**0.5)/M2**0.5;\n", + "Tc2=math.ceil(Tc2*10**6)/10**6; #rounding off to 6 decimals\n", + "\n", + "#Result\n", + "print(\"critical temperature of Hg in K is\",Tc2);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('critical temperature of Hg in K is', 4.144685)\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 12.4, Page number 357" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "d=1; #diameter of wire in mm\n", + "T=4.2; #temperature in K\n", + "Tc=7.18; #critical temperature in K\n", + "H0=6.5*10**4; #magnetic field\n", + "\n", + "#Calculation\n", + "d=d*10**-3; #diameter in m\n", + "R=d/2;\n", + "Hc=H0*(1-(T**2/Tc**2));\n", + "HC=Hc/10**4;\n", + "HC=math.ceil(HC*10**3)/10**3; #rounding off to 2 decimals\n", + "Ic=2*math.pi*R*Hc;\n", + "Ic=math.ceil(Ic*10**2)/10**2; #rounding off to 2 decimals\n", + "A=math.pi*R**2;\n", + "J=Ic/A;\n", + "J=J/10**8;\n", + "J=math.ceil(J*10**5)/10**5; #rounding off to 5 decimals\n", + "\n", + "#Result\n", + "print(\"critical magnetic field at 4.2K in A/m is\",HC,\"*10**4\");\n", + "print(\"critical current in A is\",Ic);\n", + "print(\"critical current density in A/m^2 is\",J,\"*10**8\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('critical magnetic field at 4.2K in A/m is', 4.276, '*10**4')\n", + "('critical current in A is', 134.33)\n", + "('critical current density in A/m^2 is', 1.71035, '*10**8')\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 12.5, Page number 358" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "\n", + "#Variable declaration\n", + "e=1.6*10**-19;\n", + "h=6.626*10**-34;\n", + "V=6; #voltage applied in micro volts\n", + "\n", + "#Calculation\n", + "V=V*10**-6; #converting micro volts to volts\n", + "new=(2*e*V)/h;\n", + "new=new/10**9;\n", + "new=math.ceil(new*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"frequency of ac signal in Hz is\",new,\"*10**9\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('frequency of ac signal in Hz is', 2.8977, '*10**9')\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 12.6, Page number 358" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "\n", + "#Variable declaration\n", + "Kb=1.38*10**-23;\n", + "Tc=7.19; #critical temperature in K\n", + "\n", + "#Calculation\n", + "Eg=3.5*Kb*Tc;\n", + "Eg=Eg/(1.6*10**-19); #converting J to eV\n", + "Eg=Eg*10**3; #converting eV into milli eV\n", + "Eg=math.ceil(Eg*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"band gap of superconducting lead in meV is\",Eg);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('band gap of superconducting lead in meV is', 2.171)\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/Chapter_2-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/Chapter_2-checkpoint.ipynb new file mode 100644 index 00000000..82d0d7af --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/Chapter_2-checkpoint.ipynb @@ -0,0 +1,467 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:3d73f6bba1b33a0bbd48c706ad53709f1f38f4b901966e1c9494931ace163899" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Laser" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.1, Page number 59 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "h=6.626*10**-34;\n", + "c=3*10**8;\n", + "lamda=632.8*10**-9; #wavelength in m\n", + "P=5*10**-3; #output power in W\n", + "\n", + "#Calculation\n", + "E=(h*c)/lamda; #energy of one photon\n", + "E_eV=E/(1.6*10**-19); #converting J to eV\n", + "E_eV=math.ceil(E_eV*1000)/1000; #rounding off to 3 decimals\n", + "N=P/E; #number of photons emitted\n", + "\n", + "\n", + "#Result\n", + "print(\"energy of one photon in eV is\",E_eV);\n", + "print(\"number of photons emitted per second is\",N);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('energy of one photon in eV is', 1.964)\n", + "('number of photons emitted per second is', 1.5917094275077976e+16)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.2, Page number 60" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "h=6.626*10**-34;\n", + "c=3*10**8;\n", + "lamda=632.8*10**-9; #wavelength in m\n", + "\n", + "#Calculation\n", + "E=(h*c)/lamda; #energy of one photon\n", + "E_eV=E/(1.6*10**-19); #converting J to eV\n", + "E_eV=math.ceil(E_eV*1000)/1000; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"energy of one photon in eV is\",E_eV);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('energy of one photon in eV is', 1.964)\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.3, Page number 60" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "E1=0; #value of 1st energy level in eV\n", + "E2=1.4; #value of 2nd energy level in eV\n", + "lamda=1.15*10**-6;\n", + "h=6.626*10**-34;\n", + "c=3*10**8;\n", + "\n", + "#Calculation\n", + "E=(h*c)/lamda; #energy of one photon\n", + "E_eV=E/(1.6*10**-19); #converting J to eV\n", + "E3=E2+E_eV;\n", + "E3=math.ceil(E3*100)/100; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"value of E3 in eV is\",E3);\n", + "\n", + "#answer given in the book for E3 is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('value of E3 in eV is', 2.49)\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.4, Page number 60" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#Variable declaration\n", + "h=6.626*10**-34;\n", + "c=3*10**8;\n", + "E2=3.2; #value of higher energy level in eV\n", + "E1=1.6; #value of lower energy level in eV\n", + "\n", + "#Calculation\n", + "E=E2-E1; #energy difference in eV\n", + "E_J=E*1.6*10**-19; #converting E from eV to J\n", + "lamda=(h*c)/E_J; #wavelength of photon\n", + "\n", + "#Result\n", + "print(\"energy difference in eV\",E);\n", + "print(\"wavelength of photon in m\",lamda);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('energy difference in eV', 1.6)\n", + "('wavelength of photon in m', 7.76484375e-07)\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.5, Page number 60" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#Variable declaration\n", + "h=6.626*10**-34;\n", + "c=3*10**8;\n", + "E=1.42*1.6*10**-19; #band gap of GaAs in J\n", + "\n", + "#Calculation\n", + "lamda=(h*c)/E; #wavelength of laser\n", + "\n", + "#Result\n", + "print(\"wavelength of laser emitted by GaAs in m\",lamda);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('wavelength of laser emitted by GaAs in m', 8.74911971830986e-07)\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.6, Page number 61" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "T=300; #temperature in K\n", + "lamda=500*10**-9; #wavelength in m\n", + "h=6.626*10**-34;\n", + "c=3*10**8;\n", + "k=1.38*10**-23;\n", + "\n", + "#Calculation\n", + "#from maxwell and boltzmann law, relative population is given by\n", + "#N1/N2=exp(-E1/kT)/exp(-E2/kT)\n", + "#hence N1/N2=exp(-(E1-E2)/kT)=exp((h*new)/(k*T));\n", + "#new=c/lambda\n", + "R=(h*c)/(lamda*k*T);\n", + "RP=math.exp(R);\n", + "\n", + "#Result\n", + "print(\"relative population between N1 and N2 is\",RP);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('relative population between N1 and N2 is', 5.068255595981255e+41)\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.7, Page number 61" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "T=300; #temperature in K\n", + "h=6.626*10**-34;\n", + "c=3*10**8;\n", + "k=1.38*10**-23;\n", + "lamda=600*10**-9; #wavelength in m\n", + "\n", + "#Calculation\n", + "R=(h*c)/(lamda*k*T);\n", + "Rs=1/(math.exp(R)-1);\n", + "\n", + "#Result\n", + "print(\"the ratio between stimulated emission to spontaneous emission is\",Rs);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('the ratio between stimulated emission to spontaneous emission is', 1.7617782449453023e-35)\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.8, Page number 62" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "P=5*10**-3; #output power in W\n", + "I=10*10**-3; #current in A\n", + "V=3*10**3; #voltage in V\n", + "\n", + "#Calculation\n", + "e=(P*100)/(I*V);\n", + "e=math.ceil(e*10**6)/10**6; #rounding off to 6 decimals\n", + "\n", + "#Result\n", + "print(\"efficiency of laser in % is\",e);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('efficiency of laser in % is', 0.016667)\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.9, Page number 62" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "P=1e-03; #output power in W\n", + "d=1e-06; #diameter in m\n", + "\n", + "#Calculation\n", + "r=d/2; #radius in m\n", + "I=P/(math.pi*r**2); #intensity\n", + "I=I/10**9;\n", + "I=math.ceil(I*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"intensity of laser in W/m^2 is\",I,\"*10**9\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('intensity of laser in W/m^2 is', 1.2733, '*10**9')\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.10, Page number 62" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "lamda=632.8*10**-9; #wavelength in m\n", + "D=5; #distance in m\n", + "d=1*10**-3; #diameter in m\n", + "\n", + "#Calculation\n", + "deltatheta=lamda/d; #angular speed\n", + "delta_theta=deltatheta*10**4;\n", + "r=D*deltatheta;\n", + "r1=r*10**3; #converting r from m to mm\n", + "A=math.pi*r**2; #area of the spread\n", + "\n", + "#Result \n", + "print(\"angular speed in radian is\",delta_theta,\"*10**-4\");\n", + "print(\"radius of the spread in mm is\",r1);\n", + "print(\"area of the spread in m^2 is\",A);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('angular speed in radian is', 6.328, '*10**-4')\n", + "('radius of the spread in mm is', 3.164)\n", + "('area of the spread in m^2 is', 3.1450157329451454e-05)\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/Chapter_3-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/Chapter_3-checkpoint.ipynb new file mode 100644 index 00000000..eaf6dcb1 --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/Chapter_3-checkpoint.ipynb @@ -0,0 +1,325 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:638145e2db582b1570b31e3d891635b15bb11943d1ff2ba0aa0dc17ebaf02200" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Fibre Optics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.1, Page number 98 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "n1=1.6; #refractive index of core\n", + "n2=1.5; #refractive index of cladding\n", + "\n", + "#Calculation\n", + "NA=math.sqrt((n1**2)-(n2**2));\n", + "NA=math.ceil(NA*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"the numerical aperture of the fibre is\",NA);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('the numerical aperture of the fibre is', 0.5568)\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.2, Page number 98 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "n1=1.54; #refractive index of core\n", + "n2=1.5; #refractive index of cladding\n", + "n0=1;\n", + "\n", + "#Calculation\n", + "NA=math.sqrt((n1**2)-(n2**2)); #numerical aperture of fibre\n", + "NA=math.ceil(NA*10**5)/10**5; #rounding off to 5 decimals\n", + "alpha=math.asin(NA/n0); #acceptance angle in radians\n", + "alpha=alpha*57.2957795; #converting radians to degrees\n", + "alpha=math.ceil(alpha*10**5)/10**5; #rounding off to 5 decimals\n", + "deg=int(alpha); #converting to degrees\n", + "t=60*(alpha-deg); \n", + "mi=int(t); #converting to minutes\n", + "sec=60*(t-mi); #converting to seconds\n", + "sec=math.ceil(sec*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"the numerical aperture of the fibre is\",NA);\n", + "print(\"the acceptance angle of the fibre in degrees is\",alpha);\n", + "print(\"acceptance angle of the fibre is\",deg,\"degrees\",mi,\"minutes\",sec,\"seconds\");\n", + "\n", + "#answer for the angle given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('the numerical aperture of the fibre is', 0.34872)\n", + "('the acceptance angle of the fibre in degrees is', 20.40905)\n", + "('acceptance angle of the fibre is', 20, 'degrees', 24, 'minutes', 32.581, 'seconds')\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.3, Page number 99" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "n1=1.6; #refractive index of core\n", + "n2=1.49; #refractive index of cladding\n", + "\n", + "#Calculation\n", + "thetac=math.asin(n2/n1); #critical angle in radians\n", + "thetac=thetac*57.2957795; #converting radians to degrees\n", + "theta_c=math.ceil(thetac*10**3)/10**3; #rounding off to 3 decimals\n", + "deg=int(thetac); #converting to degrees\n", + "t=60*(thetac-deg); \n", + "mi=int(t); #converting to minutes\n", + "sec=60*(t-mi); #converting to seconds\n", + "sec=math.ceil(sec*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"the critical angle of the fibre in degrees is\",theta_c);\n", + "print(\"critical angle of the fibre is\",deg,\"degrees\",mi,\"minutes\",sec,\"seconds\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('the critical angle of the fibre in degrees is', 68.631)\n", + "('critical angle of the fibre is', 68, 'degrees', 37, 'minutes', 49.85, 'seconds')\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.4, Page number 99" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "NA=0.15; #numerical aperture\n", + "n2=1.55; #refractive index of cladding\n", + "n0=1.33; #refractive index of water\n", + "\n", + "#Calculation\n", + "n1=math.sqrt((NA**2)+(n2**2)); #refractive index\n", + "n_1=math.ceil(n1*10**5)/10**5; #rounding off to 5 decimals\n", + "alpha=math.asin(math.sqrt(n1**2-n2**2)/n0); #acceptance angle in radians\n", + "alpha=alpha*57.2957795; #converting radians to degrees\n", + "alphaa=math.ceil(alpha*10**3)/10**3; #rounding off to 3 decimals\n", + "deg=int(alpha); #converting to degrees\n", + "t=60*(alpha-deg); \n", + "mi=int(t); #converting to minutes\n", + "sec=60*(t-mi); #converting to seconds\n", + "sec=math.ceil(sec*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"refractive index of the core is\",n_1);\n", + "print(\"the acceptance angle of the fibre in degrees is\",alphaa);\n", + "print(\"acceptance angle of the fibre is\",deg,\"degrees\",mi,\"minutes\",sec,\"seconds\");\n", + "\n", + "#answer for acceptance angle given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('refractive index of the core is', 1.55725)\n", + "('the acceptance angle of the fibre in degrees is', 6.476)\n", + "('acceptance angle of the fibre is', 6, 'degrees', 28, 'minutes', 32.55, 'seconds')\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.5, Page number 100" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "NA=0.26; #numerical aperture\n", + "n1=1.5; #refractive index of core\n", + "d=100; #core diameter in micro meter\n", + "\n", + "#Calculation\n", + "d=100*(10**-6); #core diameter in metre\n", + "n2=math.sqrt((n1**2)-(NA**2));\n", + "n2=math.ceil(n2*10**5)/10**5; #rounding off to 5 decimals\n", + "\n", + "#Result\n", + "print(\"refractive index of the cladding is\",n2);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('refractive index of the cladding is', 1.4773)\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.6, Page number 100" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "NA=0.26; #numerical aperture\n", + "delta=0.015; #refractive index difference\n", + "\n", + "#Calculation\n", + "#NA=math.sqrt(n1**2-n2**2)\n", + "#let A=n1**2-n2**2\n", + "#therefore A=NA**2\n", + "A=NA**2;\n", + "#delta=(n1**2-n2**2)/2*(n1**2)\n", + "#let 2*(n1**2) be B\n", + "#therefore B=A/delta\n", + "B=A/delta;\n", + "n1=math.sqrt(B/2);\n", + "n1=math.ceil(n1*100)/100; #rounding off to 2 decimals\n", + "n2=math.sqrt(n1**2-NA**2);\n", + "n2=math.ceil(n2*10**3)/10**3; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"refractive index of the core is\",n1);\n", + "print(\"refractive index of the cladding is\",n2);\n", + "\n", + "#answer for refractive index of cladding given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('refractive index of the core is', 1.51)\n", + "('refractive index of the cladding is', 1.488)\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/Chapter_4-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/Chapter_4-checkpoint.ipynb new file mode 100644 index 00000000..d93ccbff --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/Chapter_4-checkpoint.ipynb @@ -0,0 +1,743 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:2a55c0c681215b0dc959ddeda0187458e8ed07320f22e00a7385acd5044d2ee9" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Quantum Physics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.1, Page number 133 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#Variable declaration\n", + "h=6.63*10**-34; #plancks constant in Js\n", + "m0=9.1*10**-31; #mass of the electron in kg\n", + "c=3*10**8; #velocity of light in m/s\n", + "phi=135; #angle of scattering in degrees\n", + "phi=phi*0.0174532925 #converting degrees to radians \n", + "\n", + "#Calculation\n", + "delta_lamda=(h*(1-math.cos(phi)))/(m0*c);\n", + "\n", + "#Result\n", + "print(\"change in wavelength in metres is\",delta_lamda);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('change in wavelength in metres is', 4.1458307496867315e-12)\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.2, Page number 134 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "\n", + "#Variable declaration\n", + "h=6.63*10**-34; #plancks constant in Js\n", + "m0=9.1*10**-31; #mass of the electron in kg\n", + "c=3*10**8; #velocity of light in m/s\n", + "lamda=2; #wavelength in angstrom\n", + "lamdaA=lamda*10**-10; #converting lamda from Angstrom to m\n", + "phi=90; #angle of scattering in degrees\n", + "phi=phi*0.0174532925 #converting degrees to radians \n", + "\n", + "#Calculation\n", + "delta_lamda=(h*(1-math.cos(phi)))/(m0*c);\n", + "delta_lamda=delta_lamda*10**10; #converting delta_lamda from m to Angstrom\n", + "delta_lamda=math.ceil(delta_lamda*10**5)/10**5; #rounding off to 5 decimals\n", + "lamda_dash=delta_lamda+lamda;\n", + "lamdaA_dash=lamda_dash*10**-10; #converting lamda_dash from Angstrom to m\n", + "#energy E=h*new-h*new_dash\n", + "E=h*c*((1/lamdaA)-(1/lamdaA_dash));\n", + "EeV=E/(1.602176565*10**-19); #converting J to eV\n", + "EeV=math.ceil(EeV*10**3)/10**3; #rounding off to 3 decimals\n", + "new=c/lamda;\n", + "new_dash=c/lamda_dash;\n", + "theta=math.atan((h*new*math.sin(phi))/((h*new)-(h*new_dash*math.cos(phi))));\n", + "theta=theta*57.2957795; #converting radians to degrees\n", + "\n", + "#Result\n", + "print(\"change in compton shift in Angstrom is\",delta_lamda);\n", + "print(\"wavelength of scattered photons in Angstrom is\",lamda_dash);\n", + "print(\"energy of recoiling electron in J is\",E);\n", + "print(\"energy of recoiling electron in eV is\",EeV);\n", + "print(\"angle at which recoiling electron appears in degrees is\",int(theta));\n", + "\n", + "#answers given in the book are wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('change in compton shift in Angstrom is', 0.02429)\n", + "('wavelength of scattered photons in Angstrom is', 2.02429)\n", + "('energy of recoiling electron in J is', 1.1933272900621974e-17)\n", + "('energy of recoiling electron in eV is', 74.482)\n", + "('angle at which recoiling electron appears in degrees is', 45)\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.3, Page number 135" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "\n", + "#Variable declaration\n", + "h=6.626*10**-34; #plancks constant in Js\n", + "m0=9.1*10**-31; #mass of the electron in kg\n", + "c=3*10**8; #velocity of light in m/s\n", + "phi=60; #angle of scattering in degrees\n", + "phi=phi*0.0174532925; #converting degrees to radians\n", + "E=10**6; #energy of photon in eV\n", + "E=E*1.6*10**-19; #converting eV into J\n", + "\n", + "#Calculation\n", + "delta_lamda=(h*(1-math.cos(phi)))/(m0*c);\n", + "delta_lamda=delta_lamda*10**10; #converting metre to angstrom\n", + "delta_lamda=math.ceil(delta_lamda*10**4)/10**4; #rounding off to 4 decimals\n", + "lamda=(h*c)/E;\n", + "lamdaA=lamda*10**10; #converting metre to angstrom\n", + "lamda_dash=delta_lamda+lamdaA;\n", + "lamda_dash=math.ceil(lamda_dash*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"compton shift in angstrom is\",delta_lamda);\n", + "print(\"energy of incident photon in m\",lamda);\n", + "print(\"wavelength of scattered photons in angstrom is\",lamda_dash);\n", + "\n", + "#answer for wavelength of scattered photon given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('compton shift in angstrom is', 0.0122)\n", + "('energy of incident photon in m', 1.242375e-12)\n", + "('wavelength of scattered photons in angstrom is', 0.025)\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.4, Page number 135" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "\n", + "#Variable declaration\n", + "h=6.626*10**-34; #plancks constant in Js\n", + "c=3*10**8; #velocity of light in m/s\n", + "lamda=5893; #wavelength in angstrom\n", + "P=60; #output power in Watt\n", + "\n", + "#Calculation\n", + "lamda=lamda*10**-10; #wavelength in metre\n", + "E=(h*c)/lamda;\n", + "EeV=E/(1.602176565*10**-19); #converting J to eV\n", + "EeV=math.ceil(EeV*10**4)/10**4; #rounding off to 4 decimals\n", + "N=P/E;\n", + "\n", + "#Result\n", + "print(\"energy of photon in J is\",E);\n", + "print(\"energy of photon in eV is\",EeV);\n", + "print(\"number of photons emitted per se cond is\",N);\n", + "\n", + "#answer for energy in eV given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('energy of photon in J is', 3.373154590191753e-19)\n", + "('energy of photon in eV is', 2.1054)\n", + "('number of photons emitted per se cond is', 1.7787503773015396e+20)\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.5, Page number 136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "\n", + "#Variable declaration\n", + "h=6.626*10**-34; #plancks constant in Js\n", + "c=3*10**8; #velocity of light in m/s\n", + "lamda=10; #wavelength in angstrom\n", + "\n", + "#Calculation\n", + "lamda=lamda*10**-10; #wavelength in metre\n", + "E=(h*c)/lamda;\n", + "EeV=E/(1.602176565*10**-19); #converting J to eV\n", + "EeV=EeV*10**-3; #converting eV to keV\n", + "EeV=math.ceil(EeV*10**3)/10**3; #rounding off to 3 decimals\n", + "P=h/lamda;\n", + "M=h/(lamda*c);\n", + "\n", + "#Result\n", + "print(\"energy of photon in J is\",E);\n", + "print(\"energy of photon in keV is\",EeV);\n", + "print(\"momentum in kg m/sec is\",P);\n", + "print(\"mass of photon in kg is\",M);\n", + "\n", + "#answer for energy of photon in keV given in the book is wrong by 1 decimal" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('energy of photon in J is', 1.9878e-16)\n", + "('energy of photon in keV is', 1.241)\n", + "('momentum in kg m/sec is', 6.626e-25)\n", + "('mass of photon in kg is', 2.2086666666666664e-33)\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.6, Page number 136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "\n", + "#Variable declaration\n", + "h=6.626*10**-34; #plancks constant in Js\n", + "m=9.1*10**-31; #mass of the electron in kg\n", + "e=1.602*10**-19;\n", + "V=1.25; #potential difference in kV\n", + "\n", + "#Calculation\n", + "V=V*10**3; #converting kV to V\n", + "lamda=h/math.sqrt(2*m*e*V);\n", + "lamda=lamda*10**10; #converting metre to angstrom\n", + "lamda=math.ceil(lamda*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"de Broglie wavelength in angstrom is\",lamda);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('de Broglie wavelength in angstrom is', 0.3471)\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.7, Page number 136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "\n", + "#Variable declaration\n", + "E=45; #energy of electron in eV\n", + "E=E*1.6*10**-19; #energy in J\n", + "h=6.626*10**-34; #plancks constant in Js\n", + "m=9.1*10**-31; #mass of the electron in kg\n", + "\n", + "#Calculation\n", + "lamda=h/math.sqrt(2*m*E);\n", + "lamda=lamda*10**10; #converting metres to angstrom\n", + "lamda=math.ceil(lamda*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"de Broglie wavelength in angstrom is\",lamda);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('de Broglie wavelength in angstrom is', 1.8305)\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.8, Page number 137" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "\n", + "#Variable declaration\n", + "v=10**7; #velocity of electron in m/sec\n", + "h=6.626*10**-34; #plancks constant in Js\n", + "m=9.1*10**-31; #mass of the electron in kg\n", + "\n", + "#Calculation\n", + "lamda=h/(m*v);\n", + "lamda=lamda*10**10; #converting metres to angstrom\n", + "lamda=math.ceil(lamda*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"de Broglie wavelength in angstrom is\",lamda);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('de Broglie wavelength in angstrom is', 0.7282)\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.9, Page number 137" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "\n", + "#Variable declaration\n", + "V=1000; #potential difference in V\n", + "h=6.626*10**-34; #plancks constant in Js\n", + "m=1.67*10**-27; #mass of proton in kg\n", + "e=1.6*10**-19; #charge of electron in J\n", + "\n", + "#Calculation\n", + "lamda=h/math.sqrt(2*m*e*V);\n", + "\n", + "#Result\n", + "print(\"de Broglie wavelength of alpha particle in metre is\",lamda);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('de Broglie wavelength of alpha particle in metre is', 9.063964727801313e-13)\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.10, Page number 138" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "\n", + "#Variable declaration\n", + "L=25; #width of potential in armstrong\n", + "delta_x=0.05; #interval in armstrong\n", + "n=1; #particle is in its least energy\n", + "x=L/2; #particle is at the centre\n", + "pi=180; #angle in degrees\n", + "\n", + "#Calculation\n", + "pi=pi*0.0174532925; #angle in radians\n", + "L=L*10**-10; #width in m\n", + "delta_x=delta_x*10**-10; #interval in m\n", + "#probability P = integration of (A**2)*(math.sin(n*pi*x/L))**2*delta_x\n", + "#but A=math.sqrt(2/L)\n", + "#since the particle is in a small interval integration need not be applied\n", + "#therefore P=2*(L**(-1))*(math.sin(n*pi*x/L))**2*delta_x\n", + "P=2*(L**(-1))*((math.sin(n*pi*x/L))**2)*delta_x;\n", + "P=math.ceil(P*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"probability of finding the particle is\",P);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('probability of finding the particle is', 0.004)\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.11, Page number 138" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "\n", + "#Variable declaration\n", + "n=1;\n", + "h=6.626*10**-34; #plancks constant in Js\n", + "m=9.1*10**-31; #mass of the electron in kg\n", + "L=1; #width of potential well in angstrom\n", + "\n", + "#Calculation\n", + "L=L*10**-10; #converting angstrom into metre\n", + "E=((n**2)*h**2)/(8*m*L**2);\n", + "EeV=E/(1.6*10**-19); #converting J to eV\n", + "EeV=math.ceil(EeV*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"lowest energy of electron in J is\",E);\n", + "print(\"lowest energy of electron in eV is\",EeV);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('lowest energy of electron in J is', 6.030752197802197e-18)\n", + "('lowest energy of electron in eV is', 37.693)\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.12, Page number 139" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "\n", + "#Variable declaration\n", + "n=1;\n", + "h=6.626*10**-34; #plancks constant in Js\n", + "m=9.1*10**-31; #mass of the electron in kg\n", + "L=1; #width of potential well in angstrom\n", + "\n", + "#Calculation\n", + "L=L*10**-10; #converting angstrom into metre\n", + "E=(2*(n**2)*h**2)/(8*m*L**2);\n", + "E=E/(1.6*10**-19); #converting J to eV\n", + "E=math.ceil(E*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"lowest energy of system in eV is\",E);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('lowest energy of system in eV is', 75.385)\n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.13, Page number 139" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "h=6.626*10**-34; #plancks constant in Js\n", + "m=9.1*10**-31; #mass of the electron in kg\n", + "L=1; #width of potential well in angstrom\n", + "\n", + "#Calculation\n", + "L=L*10**-10; #converting angstrom into metre\n", + "#according to pauli's exclusion principle, 1st electron occupies n1=1 and second electron occupies n2=2\n", + "n1=1;\n", + "n2=2;\n", + "E=((2*(n1**2)*h**2)/(8*m*L**2))+(((n2**2)*h**2)/(8*m*L**2));\n", + "E=E/(1.6*10**-19); #converting J to eV\n", + "E=math.ceil(E*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"lowest energy of system in eV is\",E);\n", + "print(\"quantum numbers are\");\n", + "print(\"n=1,l=0,mL=0,mS=+1/2\");\n", + "print(\"n=1,l=0,mL=0,mS=-1/2\");\n", + "print(\"n=2,l=0,mL=0,mS=+1/2\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('lowest energy of system in eV is', 226.154)\n", + "quantum numbers are\n", + "n=1,l=0,mL=0,mS=+1/2\n", + "n=1,l=0,mL=0,mS=-1/2\n", + "n=2,l=0,mL=0,mS=+1/2\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.14, Page number 140" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#Variable declaration\n", + "n=1;\n", + "h=6.626*10**-34; #plancks constant in Js\n", + "L=100; #width of potential well in angstrom\n", + "\n", + "#Calculation\n", + "L=L*10**-10; #converting angstrom into metre\n", + "E=0.025; #lowest energy in eV\n", + "E=E*(1.6*10**-19); #converting eV to J\n", + "m=((n**2)*h**2)/(8*E*L**2);\n", + "\n", + "#Result\n", + "print(\"mass of the particle in kg is\",m);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('mass of the particle in kg is', 1.3719961249999998e-31)\n" + ] + } + ], + "prompt_number": 31 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.15, Page number 141" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "k=1.38*10**-23;\n", + "T=6000; #temperature in K\n", + "h=6.626*10**-34; #plancks constant in Js\n", + "c=3*10**8; #velocity of light in m/s\n", + "lamda1=450; #wavelength in nm\n", + "lamda2=460; #wavelength in nm\n", + "\n", + "#Calculation\n", + "lamda1=lamda1*10**-9; #converting nm to metre\n", + "lamda2=lamda2*10**-9; #converting nm to metre\n", + "new1=c/lamda1;\n", + "new2=c/lamda2;\n", + "new=(new1+new2)/2;\n", + "A=math.exp((h*new)/(k*T));\n", + "rho_v=(8*math.pi*h*new**3)/(A*c**3);\n", + "\n", + "#Result\n", + "print(\"energy density of the black body in J/m^3 is\",rho_v);\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('energy density of the black body in J/m^3 is', 9.033622836188887e-16)\n" + ] + } + ], + "prompt_number": 32 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/Chapter_6-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/Chapter_6-checkpoint.ipynb new file mode 100644 index 00000000..df63cdce --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/Chapter_6-checkpoint.ipynb @@ -0,0 +1,899 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:95589aa74fb7b8b919d364696d403ce9619ba363e3435f491e57c82d78d5e42c" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Crystallography" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.1, Page number 185" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "r=0.071; #radius in nm\n", + "N=6.022*10**26; \n", + "\n", + "#Calculation\n", + "r=r*10**-9; #converting r from nm to m\n", + "#mass of carbon atom m = 12/N\n", + "m=12/N;\n", + "#mass of diamond M = 8*mass of one carbon atom\n", + "M=8*m;\n", + "#volume of diamond V = (8*r/sqrt(3))^3\n", + "V=(8*r/math.sqrt(3))**3;\n", + "d=M/V; #density in kg/m^3\n", + "d=math.ceil(d*100)/100; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"density of diamond in kg/m^3 is\",d);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('density of diamond in kg/m^3 is', 4520.31)\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.2, Page number 185" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "aBCC=0.332; #lattice constant in nm\n", + "aHCP=0.296; #lattice constant in nm\n", + "c=0.468; #c in nm\n", + "\n", + "#Calculation\n", + "aBCC=aBCC*10**-9; #converting nm to m\n", + "Vbcc=aBCC**3;\n", + "aHCP=aHCP*10**-9; #converting nm to m\n", + "c=c*10**-9; #converting nm to m\n", + "Vhcp=6*(math.sqrt(3)/4)*aHCP**2*c;\n", + "V=Vhcp-Vbcc;\n", + "Vch=(V*100)/Vbcc;\n", + "Vch=math.ceil(Vch*100)/100; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"percentage change in volume is\",Vch);\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('percentage change in volume is', 191.12)\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.3, Page number 186" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "r=1.278; #atomic radius of Cu in Angstrom\n", + "A=63.54; #atomic weight of Cu\n", + "n=4; #for FCC n=4\n", + "Na=6.022*10**26;\n", + "\n", + "#Calculation\n", + "r=r*10**-10; #converting atomic radius from Angstrom to m\n", + "a=2*math.sqrt(2)*r; \n", + "rho=(n*A)/(Na*a**3);\n", + "rho=math.ceil(rho*100)/100; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"density of Cu in kg/m^3 is\",rho);\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('density of Cu in kg/m^3 is', 8935.92)\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.4, Page number 186" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "import numpy as np\n", + "\n", + "#Variable declaration\n", + "rho=2180; #density of NaCl in kg/m^3\n", + "wNa=23; #atomic weight of Na\n", + "wCl=35.5; #atomic weight of Cl\n", + "n=4; #for FCC n=4\n", + "Na=6.022*10**26;\n", + "\n", + "#Calculation\n", + "A=wNa+wCl; #molecular weight of NaCl\n", + "x=np.reciprocal(3.);\n", + "a=((n*A)/(Na*rho))**x;\n", + "\n", + "#Result\n", + "print(\"interatomic distance in NaCl in m is\",a); \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('interatomic distance in NaCl in m is', 5.6278114346454509e-10)\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.5, Page number 187" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable declaration\n", + "a=0.42; #lattice constant in nm\n", + "h1=1;\n", + "k1=0;\n", + "l1=1; #indices of the plane (101)\n", + "h2=2;\n", + "k2=2;\n", + "l2=1; #indices of the plane (221)\n", + "\n", + "#Calculation\n", + "a=a*10**-9; #converting from nm to m\n", + "d1=a/math.sqrt((h1**2)+(k1**2)+(l1**2)); #interplanar spacing for plane (101)\n", + "d1=d1*10**9; #converting from m to nm\n", + "d1=math.ceil(d1*10**5)/10**5; #rounding off to 5 decimals\n", + "d2=a/math.sqrt((h2**2)+(k2**2)+(l2**2)); #interplanar spacing for plane (221)\n", + "d2=d2*10**9; #converting from m to nm\n", + "\n", + "#Result\n", + "print(\"interplanar spacing for (101) in nm is\",d1);\n", + "print(\"interplanar spacing for (221) in nm is\",d2);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('interplanar spacing for (101) in nm is', 0.29699)\n", + "('interplanar spacing for (221) in nm is', 0.14)\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.6, Page number 187" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#Variable declaration\n", + "h1=1;\n", + "k1=0;\n", + "l1=2; #indices for plane (102)\n", + "h2=2;\n", + "k2=3;\n", + "l2=1; #indices for plane (231)\n", + "h3=3;\n", + "k3=-1;\n", + "l3=2; #indices for plane (31'2)\n", + "\n", + "#Calculation\n", + "#intercepts made by the plane is a/h, b/k, c/l\n", + "#for plane (102) intercepts are a/1=a, b/0=infinite, c/2\n", + "#for plane (231) intercepts are a/2, b/3, c/1=c\n", + "#for plane (31'2) intercepts are a/3=a, b/-1=-b, c/2\n", + "\n", + "#Result\n", + "print(\"for plane (102) intercepts are a/1=a, b/0=infinite, c/2\");\n", + "print(\"for plane (231) intercepts are a/2, b/3, c/1=c\");\n", + "print(\"for plane (312) intercepts are a/3=a, b/-1=-b, c/2\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "for plane (102) intercepts are a/1=a, b/0=infinite, c/2\n", + "for plane (231) intercepts are a/2, b/3, c/1=c\n", + "for plane (312) intercepts are a/3=a, b/-1=-b, c/2\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.7, Page number 188" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "u1=1;\n", + "v1=1;\n", + "w1=1; #indices for plane (111)\n", + "u2=2;\n", + "v2=1;\n", + "w2=2; #indices for plane (212)\n", + "\n", + "#Calculation\n", + "A=u1*u2+v1*v2+w1*w2; \n", + "B1=math.sqrt((u1**2)+(v1**2)+(w1**2));\n", + "B2=math.sqrt((u2**2)+(v2**2)+(w2**2));\n", + "B=A/(B1*B2);\n", + "B=math.ceil(B*10**4)/10**4; #rounding off to 4 decimals\n", + "theta=math.acos(B); #angle in radian\n", + "theta=theta*57.2957795; #converting radian to degrees\n", + "theeta=math.ceil(theta*10**3)/10**3; #rounding off to 3 decimals\n", + "deg=int(theta); #converting to degrees\n", + "t=60*(theta-deg);\n", + "mi=int(t); #converting to minutes\n", + "sec=60*(t-mi); #converting to seconds\n", + "sec=math.ceil(sec*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"angle between the planes in degrees is\",theeta);\n", + "print(\"angle between the planes is\",deg,\"degrees\",mi,\"minutes\",sec,\"seconds\");\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('angle between the planes in degrees is', 15.783)\n", + "('angle between the planes is', 15, 'degrees', 46, 'minutes', 57.85, 'seconds')\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.8, Page number 188" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#sketching the crystallographic planes" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.9, Page number 189" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "d=0.2338; #interplanar distance in nm\n", + "h=-1;\n", + "k=1;\n", + "l=1; #indices of the plane (1'11)\n", + "\n", + "#Calculation\n", + "d=d*10**-9; #converting from nm to m\n", + "a=d*math.sqrt((h**2)+(k**2)+(l**2));\n", + "a=a*10**9; #converting lattice constant from m to nm\n", + "a=math.ceil(a*10**5)/10**5; #rounding off to 5 decimals\n", + "\n", + "#Result\n", + "print(\"lattice constant in nm is\",a);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('lattice constant in nm is', 0.40496)\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.10, Page number 189" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#variable declaration\n", + "h1=1;\n", + "k1=0;\n", + "l1=0; #indices for plane (100)\n", + "h2=1;\n", + "k2=1;\n", + "l2=0; #indices for plane (110)\n", + "h3=1;\n", + "k3=1;\n", + "l3=1; #indices for plane (111)\n", + "\n", + "#Calculation\n", + "#d=a/math.sqrt((h**2)+(k**2)+(l**2))\n", + "#d100=a/math.sqrt((h1**2)+(k1**2)+(l1**2))\n", + "x1=math.sqrt((h1**2)+(k1**2)+(l1**2));\n", + "#d100=a/x1 = a/1 = a\n", + "#d110=a/math.sqrt((h2**2)+(k2**2)+(l2**2))\n", + "x2=math.sqrt((h2**2)+(k2**2)+(l2**2));\n", + "x2=math.ceil(x2*10**4)/10**4; #rounding off to 4 decimals\n", + "#d110=a/x2 = a/sqrt(2)\n", + "#d111=a/math.sqrt((h3**2)+(k3**2)+(l3**2))\n", + "x3=math.sqrt((h3**2)+(k3**2)+(l3**2));\n", + "x3=math.ceil(x3*10**4)/10**4; #rounding off to 4 decimals\n", + "#d111=a/x3 = a/sqrt(3)\n", + "#hence d100:d110:d111=a:a/sqrt(2):a/sqrt(3)\n", + "#multiplying RHS by sqrt(6) we get d100:d110:d111=sqrt(6):sqrt(3):sqrt(2)\n", + "\n", + "#Result\n", + "print(\"value of x1 is\",x1);\n", + "print(\"value of x2 is\",x2);\n", + "print(\"value of x3 is\",x3);\n", + "print(\"d100:d110:d111=sqrt(6):sqrt(3):sqrt(2)\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('value of x1 is', 1.0)\n", + "('value of x2 is', 1.4143)\n", + "('value of x3 is', 1.7321)\n", + "d100:d110:d111=sqrt(6):sqrt(3):sqrt(2)\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.11, Page number 190" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#variable declaration\n", + "h=2;\n", + "k=3;\n", + "l=1; #indices for plane (231)\n", + "\n", + "#Calculation\n", + "#intercepts made by the plane is a/h, b/k, c/l\n", + "#for a cubic unit cell, a=b=c\n", + "#for plane (231) intercepts are a/2, a/3, a/1 = a\n", + "#ratio of the intercepts is 1/2:1/3:1\n", + "#LCM is 6. multiplying by LCM, we get ratio l1:l2:l3 = 3:2:6\n", + "\n", + "#Result\n", + "print(\"l1:l2:l3 = 3:2:6\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "l1:l2:l3 = 3:2:6\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.12, Page number 190" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#variable declaration\n", + "h=1;\n", + "k=2;\n", + "l=3; #indices for plane (123)\n", + "l1=0.8; #l1 in armstrong\n", + "a=0.8; #a in armstrong\n", + "b=1.2; #b in armstrong\n", + "c=1.5; #c in armstrong\n", + "\n", + "#Calculation\n", + "#intercepts made by the plane is a/h, b/k, c/l\n", + "#for plane (123) intercepts are a/1 = a, b/2, c/3\n", + "#ratio of the intercepts l1:l2:l3 = a:b/2:c/3\n", + "#thus 0.8:l2:l3 = 0.8:1.2/2:1.5/3\n", + "l2=1.2/2; #l2 in armstrong\n", + "l3=1.5/3; #l3 in armstrong\n", + "\n", + "#Result\n", + "print(\"value of l2 in armstrong is\",l2);\n", + "print(\"value of l3 in armstrong is\",l3);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('value of l2 in armstrong is', 0.6)\n", + "('value of l3 in armstrong is', 0.5)\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.13, Page number 191" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#Calculation\n", + "#in simple cubic unit cell, corner atom is the nearest neighbour to another corner atom. \n", + "#Hence nearest neighbour distance is a.\n", + "#in BCC the body centered atom is the nearest neighbour to a corner atom.\n", + "#the distance between body centered atom and corner atom is 2r\n", + "#but r=sqrt(3)*a/4\n", + "#distance = 2*sqrt(3)*a/4 = sqrt(3)*a/2\n", + "#in FCC the face centered atom is the nearest neighbour to a corner atom.\n", + "#the distance between face centered atom and corner atom is 2r\n", + "#but r = a/sqrt(8)\n", + "#distance = 2*a/sqrt(8) = a/sqrt(2)\n", + "\n", + "#Result\n", + "print(\"in simple cubic unit cell nearest neighbour distance is a\");\n", + "print(\"in body centered cubic unit cell nearest neighbour distance is sqrt(3)*a/2\");\n", + "print(\"in face centered cubic unit cell nearest neighbour distance is a/sqrt(2)\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "in simple cubic unit cell nearest neighbour distance is a\n", + "in body centered cubic unit cell nearest neighbour distance is sqrt(3)*a/2\n", + "in face centered cubic unit cell nearest neighbour distance is a/sqrt(2)\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.14, Page number 191" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#variable declaration\n", + "a=2.04; #lattice parameter in armstrong\n", + "h=2;\n", + "k=1;\n", + "l=2; #indices for plane (212)\n", + "\n", + "#Calculation\n", + "a=a*10**-10; #converting from armstrong to m\n", + "d=a/math.sqrt((h**2)+(k**2)+(l**2));\n", + "d=d*10**10; #converting from m to armstrong\n", + "d=math.ceil(d*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"interplanar distance in armstrong is\",d);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('interplanar distance in armstrong is', 0.681)\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.15, Page number 191" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#variable declaration\n", + "r=1.278; #radius of Cu in armstrong\n", + "M=63.54; #atomic weight of Cu\n", + "rho=8980; #density in kg/m^3\n", + "Na=6.022*10**26;\n", + "\n", + "#Calculation\n", + "r=r*10**-10; #radius in m\n", + "a=math.sqrt(8)*r;\n", + "n=(rho*Na*a**3)/M;\n", + "\n", + "#Result\n", + "print(\"interatomic distance in m is\",a);\n", + "print(\"number of atoms per Cu unit cell is\",int(n));" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('interatomic distance in m is', 3.6147298654256317e-10)\n", + "('number of atoms per Cu unit cell is', 4)\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.16, Page number 192" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#variable declaration\n", + "a=0.429;\n", + "b=1;\n", + "c=0.379; #intercepts of an orthorhombic crystal\n", + "\n", + "#Calculation\n", + "#ratio of intercepts are 0.214:1:0.188 = (a/0.429)*0.214:1:(c/0.379)*0.188 = a/2:b:c/2\n", + "#thus the coefficients are 1/2:1:1/2. inverses are 2,1,2.\n", + "#thus miller indices for the first plane are (212)\n", + "#ratio of intercepts are 0.858:1:0.754 = (a/0.429)*0.0.858:1:(c/0.379)*0.754 = 2a:b:2c\n", + "#thus the coefficients are 2:1:2. inverses are 1/2,1,1/2. LCM is 2. multiplying with LCM we get 1,2,1\n", + "#thus miller indices for the second plane are (121)\n", + "#ratio of intercepts are 0.429:infinite:0.126 = (a/0.429)*0.429:infinite:(c/0.379)*0.126 = a:infiniteb:c/3\n", + "#thus the coefficients are 1:infinte:1/3. inverses are 1,0,3.\n", + "#thus miller indices for the third plane are (103)\n", + "\n", + "#Result\n", + "print(\"miller indices for the first plane are (212)\");\n", + "print(\"miller indices for the second plane are (121)\");\n", + "print(\"miller indices for the third plane are (103)\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "miller indices for the first plane are (212)\n", + "miller indices for the second plane are (121)\n", + "miller indices for the third plane are (103)\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.17, Page number 193" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "import numpy as np\n", + "\n", + "#variable declaration\n", + "h1=1;\n", + "k1=0;\n", + "l1=0; #indices of the first plane (100)\n", + "h2=1;\n", + "k2=1;\n", + "l2=0; #indices of the second plane (110)\n", + "h3=1;\n", + "k3=1;\n", + "l3=1; #indices of the third plane (111)\n", + "\n", + "#Calculation\n", + "n_1=np.reciprocal(4.);\n", + "n_2=np.reciprocal(2.);\n", + "n_3=np.reciprocal(6.);\n", + "n1=(n_1*4)+1; #number of atoms per unit cell in (100)\n", + "#number of atoms per m^2 is 2/a**2. but a=sqrt(8)*r.\n", + "#hence number of atoms per m^2 is 1/(4*r**2)\n", + "n2=(n_1*4)+(2*n_2); #number of atoms per unit cell in (110)\n", + "#number of atoms per m^2 is 1/a*sqrt(2)*a. but a=sqrt(8)*r.\n", + "#hence number of atoms per m^2 is 1/(8*sqrt(2)*r**2)\n", + "n3=(n_3*3)+(3*n_2); #number of atoms per unit cell in (111)\n", + "#number of atoms per m^2 is 2/(sqrt(3)/4)*a**2. but a=4*r.\n", + "#hence number of atoms per m^2 is 1/(2*sqrt(3)*r**2)\n", + "\n", + "#Result\n", + "print(\"number of atoms per unit cell in (100)\",n1);\n", + "print(\"number of atoms per m^2 is 1/(4*r**2)\");\n", + "print(\"number of atoms per unit cell in (110)\",n2);\n", + "print(\"number of atoms per m^2 is 1/(8*sqrt(2)*r**2)\");\n", + "print(\"number of atoms per unit cell in (111)\",n3);\n", + "print(\"number of atoms per m^2 is 1/(2*sqrt(3)*r**2)\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('number of atoms per unit cell in (100)', 2.0)\n", + "number of atoms per m^2 is 1/(4*r**2)\n", + "('number of atoms per unit cell in (110)', 2.0)\n", + "number of atoms per m^2 is 1/(8*sqrt(2)*r**2)\n", + "('number of atoms per unit cell in (111)', 2.0)\n", + "number of atoms per m^2 is 1/(2*sqrt(3)*r**2)\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.18, Page number 194" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#variable declaration\n", + "r=0.97; #radius of Na+ ion in armstrong\n", + "R=1.81; #radius of Cl- ion in armstrong\n", + "\n", + "#Calculation\n", + "#atomic packing factor=packing density PD\n", + "#PD=Volume of atoms/Volume of unit cell\n", + "#volume of unit cell=a**3\n", + "#volume of atoms=number of atoms*volume of 1 atom = 4*(4/3)*math.pi*r**3\n", + "#but r=a/sqrt(8). hence PD = 4*(4/3)*math.pi*(a/(2*sqrt(2)))**3*(1/a**3) = 0.74\n", + "#atomic packing factor = 0.74\n", + "r=r*10**-10; #radius of Na+ ion in m\n", + "R=R*10**-10; #radius of Cl- ion in m\n", + "Vna = (4*4*math.pi*r**3)/3; #volume of Na atoms\n", + "Vcl = (4*4*math.pi*R**3)/3; #volume of Cl atoms \n", + "V=(2*(r+R))**3; #volume of unit cell\n", + "IPF=(Vna+Vcl)/V; #ionic packing factor\n", + "IPF=math.ceil(IPF*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"atomic packing factor = 0.74\");\n", + "print(\"ionic packing factor of NaCl crystal is\",IPF);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "atomic packing factor = 0.74\n", + "('ionic packing factor of NaCl crystal is', 0.6671)\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/Chapter_7-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/Chapter_7-checkpoint.ipynb new file mode 100644 index 00000000..acb1144d --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/Chapter_7-checkpoint.ipynb @@ -0,0 +1,185 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:0a8ebb52dee60395969030b1d2962543e204a93314e21a66724d3bafb10b7ddf" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Crystal Imperfections" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.1, Page number 207 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "k=1.38*10**-23;\n", + "Ev=0.98; #energy in eV/atom\n", + "T1=900; #temperature in C\n", + "T2=1000;\n", + "A=6.022*10**26; #avagadro's constant\n", + "w=196.9; #atomic weight in g/mol\n", + "d=18.63; #density in g/cm^3\n", + "\n", + "#Calculation\n", + "Ev=Ev*1.6*10**-19; #converting eV to J\n", + "d=d*10**3; #converting g/cm^3 into kg/m^3\n", + "N=(A*d)/w;\n", + "n=N*math.exp(-Ev/(k*T1));\n", + "#let valency fraction n/N be V\n", + "V=math.exp(-Ev/(k*T2));\n", + "\n", + "#Result\n", + "print(\"concentration of atoms per m^3 is\",N);\n", + "print(\"number of vacancies per m^3 is\",n);\n", + "print(\"valency fraction is\",V);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('concentration of atoms per m^3 is', 5.69780904012189e+28)\n", + "('number of vacancies per m^3 is', 1.8742498047705634e+23)\n", + "('valency fraction is', 1.1625392535344139e-05)\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.2, Page number 208 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "k=1.38*10**-23;\n", + "A=6.022*10**26; #avagadro's constant\n", + "T=1073; #temperature in K\n", + "n=3.6*10**23; #number of vacancies\n", + "d=9.5; #density in g/cm^3\n", + "w=107.9; #atomic weight in g/mol\n", + "\n", + "#Calculation\n", + "d=d*10**3; #converting g/cm^3 into kg/m^3\n", + "N=(A*d)/w; #concentration of atoms\n", + "E=k*T*math.log((N/n), ); #energy in J\n", + "EeV=E/(1.602176565*10**-19); #energy in eV\n", + "EeV=math.ceil(EeV*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"concentration of atoms per m^3 is\",N);\n", + "print(\"energy for vacancy formation in J\",E);\n", + "print(\"energy for vacancy formation in eV\",EeV);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('concentration of atoms per m^3 is', 5.3020389249304915e+28)\n", + "('energy for vacancy formation in J', 1.762092900344914e-19)\n", + "('energy for vacancy formation in eV', 1.1)\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.3, Page number 209 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "A=6.022*10**26; #avagadro's constant\n", + "k=1.38*10**-23;\n", + "w1=39.1; #atomic weight of K\n", + "w2=35.45; #atomic weight of Cl\n", + "Es=2.6; #energy formation in eV\n", + "T=500; #temperature in C\n", + "d=1.955; #density in g/cm^3\n", + "\n", + "#Calculation\n", + "Es=Es*1.6*10**-19; #converting eV to J\n", + "T=T+273; #temperature in K\n", + "d=d*10**3; #converting g/cm^3 into kg/m^3\n", + "N=(A*d)/(w1+w2);\n", + "n=N*math.exp(-Es/(2*k*T));\n", + "\n", + "#Result\n", + "print(\"number of Schotky defect per m^3 is\",n);\n", + "\n", + "#answer given in the book is wrong by 3rd decimal point" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('number of Schotky defect per m^3 is', 5.373777171020081e+19)\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/Chapter_8-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/Chapter_8-checkpoint.ipynb new file mode 100644 index 00000000..be4820c5 --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/Chapter_8-checkpoint.ipynb @@ -0,0 +1,519 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:a97623c1294ef4fbd99f1423addadcfc2341e13ca402c26d0b2a69dd71e1782a" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Conducting materials" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.1, Page number 231" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#Variable declaration\n", + "m=9.1*10**-31; #mass of the electron in kg\n", + "n=2.533*10**28; #concentration of electrons per m^3\n", + "e=1.6*10**-19;\n", + "tow_r=3.1*10**-14; #relaxation time in sec\n", + "\n", + "#Calculation\n", + "rho=m/(n*(e**2*tow_r));\n", + "\n", + "#Result\n", + "print(\"electrical resistivity in ohm metre is\",rho);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('electrical resistivity in ohm metre is', 4.526937967219795e-08)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.2, Page number 231" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "s=3.75*10**3; #slope\n", + "k=1.38*10**-23;\n", + "\n", + "#Calculation\n", + "Eg=2*k*s;\n", + "Eg=Eg/(1.6*10**-19); #converting J to eV\n", + "Eg=math.ceil(Eg*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"band gap of semiconductor in eV is\",Eg);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('band gap of semiconductor in eV is', 0.647)\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.3, Page number 231" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "T=989; #temperature in C\n", + "k=1.38*10**-23;\n", + "#let E-EF be E\n", + "E=0.5; #occupied level of electron in eV\n", + "\n", + "#Calculation\n", + "T=T+273; #temperature in K\n", + "E=E*1.6*10**-19; #converting eV to J\n", + "#let fermi=dirac distribution function f(E) be f\n", + "f=1/(1+math.exp(E/(k*T)));\n", + "f=math.ceil(f*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"probability of occupation of electrons is\",f);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('probability of occupation of electrons is', 0.011)\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.4, Page number 232" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "mew_e=0.0035; #mobility of electrons in m^2/Vs\n", + "E=0.5; #electric field strength in V/m\n", + "\n", + "#Calculation\n", + "vd=mew_e*E;\n", + "vd=vd*10**3;\n", + "\n", + "#Result\n", + "print(\"drift velocity of free electrons in m/sec is\",vd,\"*10**-3\");\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('drift velocity of free electrons in m/sec is', 1.75, '*10**-3')\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.5, Page number 232" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "A=6.022*10**23; #avagadro number\n", + "e=1.6*10**-19;\n", + "rho=1.73*10**-8; #resistivity of Cu in ohm metre\n", + "w=63.5; #atomic weight \n", + "d=8.92*10**3; #density in kg/m^3\n", + "\n", + "#Calculation\n", + "d=d*10**3;\n", + "sigma=1/rho;\n", + "sigmaa=sigma/10**7;\n", + "sigmaa=math.ceil(sigmaa*10**3)/10**3; #rounding off to 3 decimals\n", + "n=(d*A)/w;\n", + "mew=sigma/(n*e); #mobility of electrons\n", + "mew=mew*10**3;\n", + "mew=math.ceil(mew*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"electrical conductivity in ohm-1 m-1\",sigmaa,\"*10**7\");\n", + "print(\"concentration of carriers per m^3\",n);\n", + "print(\"mobility of electrons in m^2/Vsec is\",mew,\"*10**-3\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('electrical conductivity in ohm-1 m-1', 5.781, '*10**7')\n", + "('concentration of carriers per m^3', 8.459250393700786e+28)\n", + "('mobility of electrons in m^2/Vsec is', 4.2708, '*10**-3')\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.6, Page number 232" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "n=18.1*10**28; #concentration of electrons per m^3\n", + "h=6.62*10**-34; #planck constant in Js\n", + "me=9.1*10**-31; #mass of electron in kg\n", + "\n", + "#Calculation\n", + "X=h**2/(8*me);\n", + "E_F0=X*(((3*n)/math.pi)**(2/3));\n", + "E_F0=E_F0/(1.6*10**-19); #converting J to eV\n", + "\n", + "#Result\n", + "print(\"Fermi energy in eV is\",E_F0);\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('Fermi energy in eV is', 3.762396978021977e-19)\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.7, Page number 233" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "E_F0=5.5; #fermi energy in eV\n", + "h=6.63*10**-34; #planck constant in Js\n", + "me=9.1*10**-31; #mass of electron in kg\n", + "\n", + "#Calculation\n", + "E_F0=E_F0*1.6*10**-19; #converting eV to J\n", + "n=((2*me*E_F0)**(3/2))*((8*math.pi)/(3*h**3));\n", + "\n", + "#Result\n", + "print(\"concentration of free electrons per unit volume of silver per m^3 is\",n);\n", + "\n", + "#answer given in the book is wrong\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('concentration of free electrons per unit volume of silver per m^3 is', 4.603965704817037e+52)\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.8, Page number 233" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "Eg=1.07; #energy gap of silicon in eV\n", + "k=1.38*10**-23;\n", + "T=298; #temperature in K\n", + "\n", + "#Calculation\n", + "Eg=Eg*1.6*10**-19; #converting eV to J\n", + "#let the probability of electron f(E) be X\n", + "#X=1/(1+exp((E-Ef)/(k*T)))\n", + "#but E=Ec and Ec-Ef=Eg/2\n", + "X=1/(1+math.exp(Eg/(2*k*T)))\n", + "\n", + "#Result\n", + "print(\"probability of an electron thermally excited is\",X);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('probability of an electron thermally excited is', 9.122602463573379e-10)\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.9, Page number 234" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "k=1.38*10**-23;\n", + "m=9.1*10**-31; #mass of the electron in kg\n", + "vf=0.86*10**6; #fermi velocity in m/sec\n", + "\n", + "#Calculation\n", + "Efj=(m*vf**2)/2;\n", + "Ef=Efj/(1.6*10**-19); #converting J to eV\n", + "Ef=math.ceil(Ef*10**3)/10**3; #rounding off to 3 decimals\n", + "Tf=Efj/k;\n", + "Tf=Tf/10**4;\n", + "Tf=math.ceil(Tf*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"fermi energy of metal in J is\",Efj);\n", + "print(\"fermi energy of metal in eV is\",Ef);\n", + "print(\"fermi temperature in K is\",Tf,\"*10**4\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('fermi energy of metal in J is', 3.3651800000000002e-19)\n", + "('fermi energy of metal in eV is', 2.104)\n", + "('fermi temperature in K is', 2.4386, '*10**4')\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.10, Page number 234" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#Variable declaration\n", + "sigma=5.82*10**7; #electrical conductivity in ohm^-1m^-1\n", + "K=387; #thermal conductivity of Cu in W/mK\n", + "T=27; #temperature in C\n", + "\n", + "#Calculation\n", + "T=T+273; #temperature in K\n", + "L=K/(sigma*T);\n", + "\n", + "#Result\n", + "print(\"lorentz number in W ohm/K^2 is\",L);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('lorentz number in W ohm/K^2 is', 2.2164948453608246e-08)\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.11, Page number 235" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "m=9.1*10**-31; #mass of the electron in kg\n", + "e=1.6*10**-19;\n", + "k=1.38*10**-23;\n", + "n=8.49*10**28; #concentration of electrons in Cu per m^3\n", + "tow_r=2.44*10**-14; #relaxation time in sec\n", + "T=20; #temperature in C\n", + "\n", + "#Calculation\n", + "T=T+273; #temperature in K\n", + "sigma=(n*(e**2)*tow_r)/m;\n", + "sigmaa=sigma/10**7;\n", + "sigmaa=math.ceil(sigmaa*10**4)/10**4; #rounding off to 4 decimals\n", + "K=(n*(math.pi**2)*(k**2)*T*tow_r)/(3*m);\n", + "K=math.ceil(K*100)/100; #rounding off to 2 decimals\n", + "L=K/(sigma*T);\n", + "\n", + "#Result\n", + "print(\"electrical conductivity in ohm^-1 m^-1 is\",sigmaa,\"*10**7\");\n", + "print(\"thermal conductivity in W/mK is\",K);\n", + "print(\"Lorentz number in W ohm/K^2 is\",L);\n", + "\n", + "#answer for lorentz number given in the book is wrong\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('electrical conductivity in ohm^-1 m^-1 is', 5.8277, '*10**7')\n", + "('thermal conductivity in W/mK is', 417.89)\n", + "('Lorentz number in W ohm/K^2 is', 2.4473623172034308e-08)\n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/Chapter_9-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/Chapter_9-checkpoint.ipynb new file mode 100644 index 00000000..f85c8366 --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/Chapter_9-checkpoint.ipynb @@ -0,0 +1,582 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:5fb520695164101d75312a7c320e0464f4d51d8732e4ed917802ba694545ac3e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Semiconducting materials" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.1, Page number 266" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#Variable declaration\n", + "mew_e=0.36; #mobility of electrons in m^2/Vs\n", + "mew_h=0.14; #mobility of holes in m^2/Vs\n", + "sigma=2.2; #conductivity in ohm-1 m-1\n", + "T=300; #temperature in K\n", + "e=1.6*10**-19; #electron charge in C\n", + "\n", + "#Calculation\n", + "ni=sigma/(e*(mew_e+mew_h)); #carrier concentration per m^3\n", + "\n", + "#Result\n", + "print(\"carrier concentration of an intrinsic semiconductor per m^3 is\",ni);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('carrier concentration of an intrinsic semiconductor per m^3 is', 2.75e+19)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.2, Page number 266" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "import numpy as np\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "T1=20; #temperature in C\n", + "T2=100; #temperature in C\n", + "sigma_i20=250; #conductivity in ohm-1 m-1\n", + "sigma_i100=1100; #conductivity in ohm-1 m-1\n", + "k=1.38*10**-23;\n", + "\n", + "#Calculation\n", + "T1K=T1+273; #temperature in K\n", + "T2K=T2+273; #temperature in K\n", + "T_1K=T1K**(-1);\n", + "T_2K=T2K**(-1);\n", + "T_1=T_2K-T_1K;\n", + "T_2=T2K/T1K;\n", + "Tk=T_1**(-1);\n", + "T_k=(T_2)**(3/2);\n", + "#intrinsic carrier concentration at T1K is ni20 = 2*((2*math.pi*k*m*293)/h**2)**(3/2)*((me*mh)/m**2)**(3/4)*math.exp(-Eg/(2*k*293))\n", + "#intrinsic carrier concentration at T2K is ni100 = 2*((2*math.pi*k*m*373)/h**2)**(3/2)*((me*mh)/m**2)**(3/4)*math.exp(-Eg/(2*k*373))\n", + "#dividing ni20/ni100 = (293/373)**(3/2)*(math.exp(-Eg/(2*k*293))/math.exp(-Eg/(2*k*373)))\n", + "#ni20/ni100 = (293/373)**(3/2)*math.exp((-Eg/(2*k))((1/293)-(1/373)))\n", + "#sigma_i20/sigma_i100 = (ni20*e*(mew_e+mew_h))/(ni100*e*(mew_e+mew_h)) = ni20/ni100\n", + "#therefore sigma_i20/sigma_i100 = ni20/ni100 = (293/373)**(3/2)*math.exp((-Eg/(2*k))((1/293)-(1/373)))\n", + "#math.exp((-Eg/(2*k))*((1/293)-(1/373))) = (sigma_i20/sigma_i100)*(373/293)**(3/2)\n", + "#by taking log on both sides we get (-Eg/(2*k))*((1/293)-(1/373)) = np.log((sigma_i20/sigma_i100)*(373/293)**(3/2))\n", + "#Eg=2*k*(((1/373)-(1/293))**(-1))*np.log((sigma_i20/sigma_i100)*(373/293)**(3/2))\n", + "Eg=2*k*Tk*np.log((sigma_i20/sigma_i100)*T_k); #band gap in J\n", + "EgeV=Eg*6.241*10**18; #converting J to eV\n", + "EgeV=math.ceil(EgeV*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"band gap of the semiconductor in J is\",Eg);\n", + "print(\"band gap of the semiconductor in eV is\",EgeV);\n", + "\n", + "#answer for band gap in eV given in the book is wrong in the 4th decimal point" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('band gap of the semiconductor in J is', 4.2210259829756855e-20)\n", + "('band gap of the semiconductor in eV is', 0.2635)\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.3, Page number 267" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#Variable declaration\n", + "I=10**-2; #current in Ampere\n", + "l=100; #length in mm\n", + "d=1; #thickness in mm\n", + "w=10; #breadth in mm\n", + "B=0.5; #magnetic field in Wb/m^2\n", + "RH=3.66*10**-4; #hall coefficient in m^3/C\n", + "\n", + "#Calculation\n", + "w=w*10**-3; #width in m\n", + "VH=(B*I*RH)/w; #hall voltage\n", + "VH=VH*10**4;\n", + "\n", + "#Result\n", + "print(\"Hall voltage in V is\",VH,\"*10**-4\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('Hall voltage in V is', 1.83, '*10**-4')\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.4, Page number 268" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "sigma=300; #conductivity in S/cm\n", + "T=300; #temperature in K\n", + "ni=1.5*10**10 #carrier concentration per cm^3\n", + "mew_e=1300; #mobility of electrons in cm^2/Vs\n", + "mew_h=500; #mobility of holes in cm^2/Vs\n", + "e=1.6*10**-19; #electron charge in C\n", + "\n", + "#Calculation\n", + "sigma=sigma*10**2; #sigma in S/m\n", + "mew_e=mew_e*10**-4; #mobility of electrons in m^2/Vs\n", + "ND=sigma/(e*mew_e); #concentration of electron per m^3\n", + "ni=ni*10**6; #carrier concentration per m^3\n", + "p=ni**2/ND; #hole concentration per m^3\n", + "p=p/10**8;\n", + "p=math.ceil(p*10**3)/10**3; #rounding off to 3 decimals\n", + "mew_h=mew_h*10**-4; #mobility of holes in m^2/Vs\n", + "NA=sigma/(e*mew_h); #concentration of hole per m^3\n", + "n=ni**2/NA; #electron concentration per m^3\n", + "n=n/10**7;\n", + "\n", + "#Result\n", + "print(\"concentration of electron for N-type semiconductor per m^3\",ND);\n", + "print(\"hole concentration per m^3\",p,\"*10**8\");\n", + "print(\"concentration of hole for P-type semiconductor per m^3\",NA);\n", + "print(\"electron concentration per m^3\",int(n),\"*10**7\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('concentration of electron for N-type semiconductor per m^3', 1.4423076923076921e+24)\n", + "('hole concentration per m^3', 1.561, '*10**8')\n", + "('concentration of hole for P-type semiconductor per m^3', 3.7499999999999995e+24)\n", + "('electron concentration per m^3', 6, '*10**7')\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.5, Page number 269" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "RH=-3.68*10**-5; #hall coefficient in m^3/C\n", + "e=1.6*10**-19; #electron charge in C\n", + "\n", + "#Calculation\n", + "#hall coefficient is negative implies charge carriers are electrons\n", + "n=(3*math.pi)/(8*(-RH)*e); #carrier concentration\n", + "\n", + "#Result\n", + "print(\"charge carriers are electrons\");\n", + "print(\"carrier concentration per m^3 is\",n);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "charge carriers are electrons\n", + "('carrier concentration per m^3 is', 2.000844505937792e+23)\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.6, Page number 269" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "Eg1=0.36; #energy gap of 1st material in eV\n", + "Eg2=0.72; #energy gap of 2nd material in eV\n", + "T=300; #temperature in K\n", + "mh=9*10**-31;\n", + "me=9*10**-31; \n", + "#given that 2*k*T=0.052; \n", + "#consider X=2*k*T\n", + "X=0.052;\n", + "\n", + "#Calculation\n", + "#intrinsic carrier concentration for A niA = 2*((2*math.pi*k*T*m)/h**2)**(3/2)*((me*mh)/m**2)**(3/4)*math.exp(-0.36/(2*k*T))\n", + "#intrinsic carrier concentration for B niB = 2*((2*math.pi*k*T*m)/h**2)**(3/2)*((me*mh)/m**2)**(3/4)*math.exp(-0.72/(2*k*T))\n", + "#dividing niA/niB = math.exp(-0.36/(2*k*T))*math.exp(0.72/(2*k*T))\n", + "#let niA/niB be A\n", + "A = math.exp(-0.36/X)*math.exp(0.72/X);\n", + "A=A/10**3;\n", + "A=math.ceil(A*10**5)/10**5; #rounding off to 5 decimals\n", + "\n", + "#Result\n", + "print(\"ratio of intrinsic carrier densities of A and B is\",A,\"*10**3\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('ratio of intrinsic carrier densities of A and B is', 1.01544, '*10**3')\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.7, Page number 270" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "ND=2*10**22; #concentration of electron per m^3\n", + "sigma=112; #conductivity in ohm-1 m-1\n", + "e=1.6*10**-19; #electron charge in C\n", + "\n", + "#Calculation\n", + "mew=sigma/(ND*e); #mobility of electrons \n", + "mew=math.ceil(mew*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"mobility of electrons in m^2/Vs is\",mew);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('mobility of electrons in m^2/Vs is', 0.035)\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.8, Page number 270" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "w=500; #thickness in micrometre\n", + "A=2.5*10**-3; #area of cross section in cm^-2\n", + "Ix=1; #current in ampere\n", + "Bz=10; #magnetic field in Wb/cm^2\n", + "n=10**16; #donor concentration in m^-3\n", + "e=1.6*10**-19; #electron charge in C\n", + "\n", + "#Calculation\n", + "Bz=Bz*10**-4; #magnetic field in Wb/m^2\n", + "w=w*10**-6; #thickness in m\n", + "RH=(3*math.pi)/(8*n*e); #hall coefficient\n", + "VH=(Bz*Ix*RH)/w; #hall voltage\n", + "VH=VH/10**3;\n", + "VH=math.ceil(VH*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"hall voltage in V is\",VH,\"*10**3\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('hall voltage in V is', 1.4727, '*10**3')\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.9, Page number 271" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "from __future__ import division\n", + "import numpy as np\n", + "\n", + "#Variable declaration\n", + "Eg=1.2; #energy gap in eV\n", + "T1=300; #temperature in K\n", + "T2=600; #temperature in K\n", + "k=1.38*10**-23;\n", + "\n", + "#Calculation\n", + "T_1=T1**(-1);\n", + "T_2=T2**(-1);\n", + "T=T_1-T_2;\n", + "Eg=Eg*1.602*10**-19; #Eg in J\n", + "#sigma_300=ni300*e*(mew_e+mew_h)\n", + "#sigma_600=ni600*e*(mew_e+mew_h)\n", + "#sigma_600/sigma_300 = ni600/ni300\n", + "#ni600/ni300 =((T2/T1)**(3/2))*math.exp(-Eg/(2*k*T2))*math.exp(Eg/(2*k*T1));\n", + "#ni600/ni300 =((T2/T1)**(3/2))*math.exp((Eg/(2*k))*T;\n", + "#let ni600/ni300 be X\n", + "X=((T2/T1)**(3/2))*math.exp((Eg/(2*k))*T);\n", + "\n", + "\n", + "#Result\n", + "print(\"ratio between the conductivity of material is\",int(X));\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('ratio between the conductivity of material is', 311270)\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.10, Page number 272" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "sigma=10**-6; #electrical conductivity in ohm-1 m-1\n", + "mew_e=0.85; #electron mobility in m^2/Vs\n", + "mew_h=0.04; #hole mobility in m^2/Vs\n", + "e=1.6*10**-19; #electron charge in C\n", + "\n", + "#Calculation\n", + "ni=sigma/(e*(mew_e+mew_h)); #intrinsic carrier concentration\n", + "ni=ni/10**12;\n", + "ni=math.ceil(ni*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"intrinsic carrier concentration per m^3 is\",ni,\"*10**12\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('intrinsic carrier concentration per m^3 is', 7.0225, '*10**12')\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.11, Page number 272" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "rho_p=10; #resistivity of p-type Si in ohm cm\n", + "rho_n=10; #resistivity of n-type Si in ohm cm\n", + "mew_e=1350; #electron mobility in cm^2/Vs\n", + "mew_h=480; #hole mobility in cm^2/Vs\n", + "ni=1.5*10**10; #carrier concentration in cm^-3\n", + "e=1.6*10**-19; #electron charge in C\n", + "\n", + "#Calculation\n", + "rho_p=rho_p*10**-2;#resistivity of p-type Si in ohm m\n", + "sigma_p=1/rho_p; #electrical conductivity\n", + "mew_h=mew_h*10**-3;\n", + "NA=sigma_p/(e*mew_h); #acceptor concentration\n", + "ni=ni*10**6; #carrier concentration in m^-3\n", + "n=ni**2/NA; #concentration of minority carriers in m^-3\n", + "n=n/10**12;\n", + "n=math.ceil(n*10**4)/10**4; #rounding off to 4 decimals\n", + "rho_n=rho_n*10**-2; #resistivity of n-type Si in ohm m\n", + "sigma_n=1/rho_n; #electrical conductivity\n", + "mew_e=mew_e*10**-3;\n", + "ND=sigma_n/(e*mew_e); #donor concentration\n", + "p=(ni**2)/ND; #concentration of minority carriers in m^-3\n", + "p=p/10**12;\n", + "p=math.ceil(p*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"donor concentration per m^3 is\",ND);\n", + "print(\"concentration of minority carriers per m^3\",p,\"*10**12\");\n", + "print(\"acceptor concentration per m^3 is\",NA);\n", + "print(\"concentration of minority carriers per m^3 is\",n,\"*10**12\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('donor concentration per m^3 is', 4.6296296296296284e+19)\n", + "('concentration of minority carriers per m^3', 4.861, '*10**12')\n", + "('acceptor concentration per m^3 is', 1.3020833333333331e+20)\n", + "('concentration of minority carriers per m^3 is', 1.7281, '*10**12')\n" + ] + } + ], + "prompt_number": 33 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/chapter1_2-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/chapter1_2-checkpoint.ipynb new file mode 100644 index 00000000..bd2e1aac --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/chapter1_2-checkpoint.ipynb @@ -0,0 +1,1232 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:18ac31f959977ef2080ed3a1b1a6990ce93e604dcfb0f72ab45c0c28a2428e0e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Quantum Mechanics and Quantum Computing" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.1, Page number 41" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "c=3*10**8 #velocity of light in m/s\n", + "h=6.626*10**-34 #planks constant \n", + "m=1.67*10**-27 #mass of proton\n", + "\n", + "#Calculation\n", + "v=c/10 #velocity of proton\n", + "lamda=h/(m*v) #de Broglie wave length\n", + "\n", + "#Result\n", + "print(\"the de Broglie wavelength in m is \",lamda);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('the de Broglie wavelength in m is ', 1.3225548902195607e-14)\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.2, Page number 42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "V=400; #potential in Volts\n", + "\n", + "#Calculation\n", + "lamda=12.56/math.sqrt(V); #de Broglie wavelength\n", + "\n", + "#Result\n", + "print(\"The de Broglie wavelength in Armstrong is\",lamda);\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('The de Broglie wavelength in Armstrong is', 0.628)\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.3, Page number 42\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "m=1.674*10**(-27); #mass of neutron in kg\n", + "h=6.626*10**(-34);\n", + "E=0.025; #kinetic energy in eV\n", + "\n", + "#Calculation\n", + "Ej=E*1.6*10**-19; #kinetic energy in J\n", + "lamda=h/math.sqrt(2*m*Ej); #de Broglie wavelength\n", + "lamdaA=lamda*10**10; #converting wavelength from m to Armstrong\n", + "lamdaA=math.ceil(lamdaA*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"The de Broglie wavelength in metres is\",lamda);\n", + "print(\"The de Broglie wavelength in Armstrong is\",lamdaA);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('The de Broglie wavelength in metres is', 1.81062582829353e-10)\n", + "('The de Broglie wavelength in Armstrong is', 1.811)\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.4, Page number 42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "V=1600; #potential in Volts\n", + "\n", + "#Calculation\n", + "lamda=12.56/math.sqrt(V); #de Broglie wavelength\n", + "lamda=math.ceil(lamda*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"The de Broglie wavelength in Armstrong is\",lamda);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('The de Broglie wavelength in Armstrong is', 0.32)\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.5, Page number 42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "deltax=0.2; #distance in armstrong\n", + "h=6.626*10**(-34);\n", + "\n", + "#Calculation\n", + "delta_xm=deltax*10**-10; #distance in m\n", + "delta_p=h/(2*math.pi*delta_xm);\n", + "\n", + "#Result\n", + "print(\"The uncertainity in momentum of electron in kg m/sec is\",delta_p);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('The uncertainity in momentum of electron in kg m/sec is', 5.2728032646344916e-24)\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.6, Page number 43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "n1=1;\n", + "n2=1;\n", + "n3=1; #values in lowest energy\n", + "h=6.62*10**(-34);\n", + "M=9.1*10**-31; #mass in kg\n", + "L=0.1; #side in nm\n", + "\n", + "#Calculation\n", + "L=L*10**-9; #side in m\n", + "n=(n1**2)+(n2**2)+(n3**2);\n", + "E1=(n*h**2)/(8*M*L**2); #energy in j\n", + "E1eV=E1/(1.6*10**-19); #energy in eV\n", + "E1eV=math.ceil(E1eV*10)/10; #rounding off to 1 decimals\n", + "\n", + "#Result\n", + "print(\"lowest energy of electron in Joule is\",E1);\n", + "print(\"lowest energy of electron is eV\",E1eV);\n", + "\n", + "#answer for lowest energy in eV given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('lowest energy of electron in Joule is', 1.8059505494505486e-17)\n", + "('lowest energy of electron is eV', 112.9)\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.7, Page number 43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "M=9.1*10**(-31); #mass of electron in kg\n", + "h=6.66*10**(-34);\n", + "E=2000; #kinetic energy in eV\n", + "\n", + "#Calculation\n", + "Ej=E*1.6*10**-19; #kinetic energy in J\n", + "lamda=h/math.sqrt(2*M*Ej); #de Broglie wavelength\n", + "lamdaA=lamda*10**9; #converting wavelength from m to nm\n", + "lamdaA=math.ceil(lamdaA*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"The de Broglie wavelength in nm is\",lamdaA);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('The de Broglie wavelength in nm is', 0.028)\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.8, Page number 43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "n=1; #for minimum energy\n", + "h=6.626*10**(-34);\n", + "m=9.1*10**-31; #mass in kg\n", + "L=4*10**-10; #size in m\n", + "\n", + "#Calculation\n", + "E1=(n*h**2)/(8*m*L**2); #energy in j\n", + "\n", + "#Result\n", + "print(\"lowest energy of electron in Joule is\",E1);\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('lowest energy of electron in Joule is', 3.7692201236263733e-19)\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.9, Page number 44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "h=6.626*10**(-34);\n", + "m=9.1*10**-31; #mass in kg\n", + "lamda=1.66*10**-10; #wavelength in m\n", + "\n", + "#Calculation\n", + "v=h/(m*lamda); #velocity in m/sec\n", + "v_km=v*10**-3; #velocity in km/sec\n", + "E=(1/2)*m*v**2; #kinetic energy in joule\n", + "EeV=E/(1.6*10**-19); #energy in eV\n", + "EeV=math.ceil(EeV*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"velocity of electron in m/sec is\",round(v));\n", + "print(\"velocity of electron in km/sec is\",round(v_km));\n", + "print(\"kinetic energy of electron in Joule is\",E);\n", + "print(\"kinetic energy of electron in eV is\",EeV);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('velocity of electron in m/sec is', 4386337.0)\n", + "('velocity of electron in km/sec is', 4386.0)\n", + "('kinetic energy of electron in Joule is', 8.754176510091736e-18)\n", + "('kinetic energy of electron in eV is', 54.714)\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.10, Page number 44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable decleration\n", + "V=15; #potential in kV\n", + "\n", + "#Calculation\n", + "v=V*10**3; #potential in V\n", + "lamda=12.26/math.sqrt(v); #de Broglie wavelength\n", + "lamda=math.ceil(lamda*10**2)/10**2 #rounding off to 2 decimals\n", + "\n", + "#result\n", + "print(\"The de Broglie wavelength in Armstrong is\",lamda);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('The de Broglie wavelength in Armstrong is', 0.11)\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.11, Page number 44\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Calculation\n", + "m=1.675*10**-27; #mass of neutron in kg\n", + "h=6.626*10**-34;\n", + "E=10; #kinetic energy in keV\n", + "\n", + "#Calculation\n", + "EeV=E*10**3; #Energy in eV\n", + "Ej=EeV*1.6*10**-19; #kinetic energy in J\n", + "v=math.sqrt(2*Ej/m); #velocity in m/s\n", + "lamda=h/(m*v); #de broglie wavelength in m\n", + "lamda_A=lamda*10**10; #de broglie wavelength in armstrong\n", + "lamda_A=math.ceil(lamda_A*10**4)/10**4 #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"The velocity in m/sec is\",round(v));\n", + "print(\"The de Broglie wavelength in metres is\",lamda);\n", + "print(\"The de Broglie wavelength in Armstrong is\",lamda_A);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('The velocity in m/sec is', 1382189.0)\n", + "('The de Broglie wavelength in metres is', 2.861996093951046e-13)\n", + "('The de Broglie wavelength in Armstrong is', 0.0029)\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.12, Page number 45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable decleration\n", + "m=9.1*10**-31; #mass of electron in kg\n", + "h=6.6*10**-34;\n", + "E=2; #kinetic energy in keV\n", + "\n", + "#Calculation\n", + "EeV=E*10**3; #Energy in eV\n", + "Ej=EeV*1.6*10**-19; #kinetic energy in J\n", + "p=math.sqrt(2*m*Ej); #momentum\n", + "lamda=h/p; #de broglie wavelength in m\n", + "lamda_A=lamda*10**10; #de broglie wavelength in armstrong\n", + "lamda_A=math.ceil(lamda_A*10**4)/10**4 #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"The de Broglie wavelength in metres is\",lamda);\n", + "print(\"The de Broglie wavelength in Armstrong is\",lamda_A);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('The de Broglie wavelength in metres is', 2.7348483695436575e-11)\n", + "('The de Broglie wavelength in Armstrong is', 0.2735)\n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.13, Page number 45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "\n", + "#Variable decleration\n", + "m=1.676*10**-27; #mass of neutron in kg\n", + "h=6.62*10**-34;\n", + "E=0.025; #kinetic energy in eV\n", + "\n", + "#Calculation\n", + "Ej=E*1.6*10**-19; #kinetic energy in J\n", + "v=math.sqrt(2*Ej/m); #velocity in m/s\n", + "lamda=h/(m*v); #wavelength in m\n", + "lamda_A=lamda*10**10; #de broglie wavelength in armstrong\n", + "lamda_A=math.ceil(lamda_A*10**5)/10**5 #rounding off to 5 decimals\n", + "\n", + "#Result\n", + "print(\"The neutrons wavelength in metres is\",lamda);\n", + "print(\"The wavelength in Armstrong is\",lamda_A);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('The neutrons wavelength in metres is', 1.8079065940980725e-10)\n", + "('The wavelength in Armstrong is', 1.80791)\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.14, Page number 45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "\n", + "#Variable decleration\n", + "V=10; #potential in kV\n", + "\n", + "#Calculation\n", + "V=V*10**3; #potential in V\n", + "lamda=12.26/math.sqrt(V); #wavelength\n", + "\n", + "#Result\n", + "print(\"The wavelength in Armstrong is\",lamda);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('The wavelength in Armstrong is', 0.1226)\n" + ] + } + ], + "prompt_number": 31 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.15, Page number 45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "\n", + "#Varialble decleration\n", + "h=6.626*10**-34;\n", + "m=9.1*10**-31; #mass in kg\n", + "l=1; #width in armstrong\n", + "\n", + "#Calculation\n", + "L=l*10**-10; #width in m\n", + "#permitted electron energies En=(n**2*h**2)/(8*m*L**2)\n", + "#let X = h**2/(8*m*L**2)\n", + "X = h**2/(8*m*L**2); #energy in J\n", + "XeV=X/(1.6*10**-19); #energy in eV\n", + "#in the 1st level n1=1\n", + "n1=1;\n", + "E1=(n1**2)*XeV; #energy in eV\n", + "\n", + "#in second level n2=2\n", + "n2=2;\n", + "E2=(n2**2)*XeV; #energy in eV\n", + "#in third level n3=\n", + "n3=3;\n", + "E3=(n3**2)*XeV; #energy in eV\n", + "\n", + "#Result\n", + "print(\"minimum energy the electron can have in eV is\",round(E1));\n", + "print(\"other values of energy are in eV and in eV\",round(E2),round(E3));\n", + "\n", + "#answers given in the book are wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('minimum energy the electron can have in eV is', 38.0)\n", + "('other values of energy are in eV and in eV', 151.0, 339.0)\n" + ] + } + ], + "prompt_number": 32 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.16, Page number 46\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "\n", + "#Variable decleration\n", + "n=1; #lowest state\n", + "L=10; #width in armstrong\n", + "\n", + "#Calculation\n", + "L=L*10**-10; #width in m\n", + "x=L/2;\n", + "delta_x=1; #interval in armstrong\n", + "delta_x=delta_x*10**-10; #interval in m\n", + "psi1=(math.sqrt(2/L))*math.sin(math.pi*x/L);\n", + "A=psi1**2;\n", + "p=A*delta_x;\n", + "p=math.ceil(p*10)/10; #de broglie wavelength in armstrong\n", + "\n", + "#Result\n", + "print(\"probability of finding the particle is \",p);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('probability of finding the particle is ', 0.2)\n" + ] + } + ], + "prompt_number": 33 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.17, Page number 46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "d=970; #density of Na in kg/m^3\n", + "n=6.02*10**26;\n", + "h=6.62*10**(-34);\n", + "m=9.1*10**-31; #mass in kg\n", + "w=23; #atomic weight\n", + "\n", + "#Calculation\n", + "N=(d*n)/w; #number of atoms per m^3\n", + "A=(h**2)/(8*m);\n", + "B=(3*N)/math.pi;\n", + "Ef=A*B**(2/3);\n", + "EfeV=Ef/(1.6*10**-19);\n", + "EfeV=math.ceil(EfeV*10**2)/10**2 #rounding of to 2 decimals\n", + "\n", + "#Result\n", + "print(\"fermi energy of Na in eV is\",EfeV);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('fermi energy of Na in eV is', 3.16)\n" + ] + } + ], + "prompt_number": 34 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.18, Page number 46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "n1=1;\n", + "n2=1;\n", + "n3=1; #values in lowest energy\n", + "h=6.62*10**(-34);\n", + "m=9.1*10**-31; #mass in kg\n", + "L=0.1; #side in nm\n", + "\n", + "#Calculation\n", + "L=L*10**-9; #side in m\n", + "n=(n1**2)+(n2**2)+(n3**2);\n", + "E1=(n*h**2)/(8*m*L**2); #energy in j\n", + "E1eV=E1/(1.6*10**-19); #energy in eV\n", + "E1eV=math.ceil(E1eV*10**1)/10**1 #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"lowest energy of electron in Joule is\",E1);\n", + "print(\"lowest energy of electron in eV is\",E1eV);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('lowest energy of electron in Joule is', 1.8059505494505486e-17)\n", + "('lowest energy of electron in eV is', 112.9)\n" + ] + } + ], + "prompt_number": 35 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.19, Page number 47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "mn=1.676*10**-27; #mass of neutron in kg\n", + "me=9.1*10**-31; #mass of electron in kg\n", + "h=6.62*10**-34;\n", + "c=3*10**8; #velocity of light in m/sec\n", + "\n", + "#Calculation\n", + "En=2*me*c**2;\n", + "lamda=h/math.sqrt(2*mn*En); #wavelength in m\n", + "lamda_A=lamda*10**10; #converting lamda from m to A\n", + "lamda_A=math.ceil(lamda_A*10**6)/10**6 #rounding off to 6 decimals\n", + "\n", + "#Result\n", + "print(\"The de broglie wavelength in Angstrom is\",lamda_A);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('The de broglie wavelength in Angstrom is', 0.000283)\n" + ] + } + ], + "prompt_number": 36 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.20, Page number 47 ***************************************************************************" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "n2=2; #second quantum state\n", + "n4=4; #fourth quantum state\n", + "h=6.626*10**-34;\n", + "m=9.1*10**-31; #mass in kg\n", + "a=2; #potential box length in armstrong\n", + "\n", + "#Calculation\n", + "a=a*10**-10; #length in m\n", + "A=n2**2*h**2;\n", + "B=8*m*a**2;\n", + "E2=A/B; #energy in j\n", + "E2eV=E2/(1.6*10**-19); #energy in eV\n", + "C=n4**2*h**2;\n", + "E4=C/B; #energy in j\n", + "E4eV=E4/(1.6*10**-19); #energy in eV\n", + "\n", + "#Result\n", + "print(\"energy corresponding to second quantum state in Joule is\",E2);\n", + "print(\"energy corresponding to second quantum state in eV is\",E2eV);\n", + "print(\"energy corresponding to fourth quantum state in Joule is\",E4);\n", + "print(\"energy corresponding to fourth quantum state in eV is\",E4eV);\n", + "\n", + "\n", + "#answers given in the book are wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('energy corresponding to second quantum state in Joule is', 6.030752197802197e-18)\n", + "('energy corresponding to second quantum state in eV is', 37.69220123626373)\n", + "('energy corresponding to fourth quantum state in Joule is', 2.412300879120879e-17)\n", + "('energy corresponding to fourth quantum state in eV is', 150.7688049450549)\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.21, Page number 48 ***********" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "V=344; #accelerated voltage in V\n", + "n=1; #first reflection\n", + "theta=60; #glancing angle in degrees\n", + "\n", + "#Calculation\n", + "lamda=12.27/math.sqrt(V);\n", + "d=(n*lamda)/(2*math.sin(theta));\n", + "\n", + "#Result\n", + "print(\"The spacing of the crystal in Angstrom is\",lamda);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('The spacing of the crystal in Angstrom is', 0.6615540636030947)\n" + ] + } + ], + "prompt_number": 38 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.22, Page number 49 *************" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "n2=2; #second quantum state\n", + "n3=3; #fourth quantum state\n", + "h=6.626*10**-34;\n", + "m=9.1*10**-31; #mass in kg\n", + "a=1*10**-10; #width of potential well in m\n", + "\n", + "#Calculation\n", + "B=8*m*a**2;\n", + "E1=h**2/B; #ground state energy\n", + "E1eV=E1/(1.6*10**-19); #energy in eV\n", + "A=n2**2*h**2;\n", + "E2=A/B; #energy in j\n", + "E2eV=E2/(1.6*10**-19); #energy in eV\n", + "C=n3**2*h**2;\n", + "E3=C/B; #energy in j\n", + "E3eV=E3/(1.6*10**-19); #energy in eV\n", + "E1=math.ceil(E1*10**3)/10**3 #rounding off to 3 decimals\n", + "E1eV=math.ceil(E1eV*10**3)/10**3 #rounding off to 3 decimals\n", + "E2eV=math.ceil(E2eV*10**3)/10**3 #rounding off to 3 decimals\n", + "E3eV=math.ceil(E3eV*10**3)/10**3 #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"ground state energy in Joule is\",E1);\n", + "print(\"ground state energy in eV is\",E1eV);\n", + "print(\"first energy state in eV is\",E2eV);\n", + "print(\"second energy state in eV is\",E3eV);\n", + "\n", + "#answers given in the book are wrong by one decimal" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('ground state energy in Joule is', 0.001)\n", + "('ground state energy in eV is', 37.693)\n", + "('first energy state in eV is', 150.769)\n", + "('second energy state in eV is', 339.23)\n" + ] + } + ], + "prompt_number": 39 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.23, Page number 49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "\n", + "#Variable decleration\n", + "n3=3; #fourth quantum state\n", + "h=6.626*10**-34;\n", + "m=9.1*10**-31; #mass in kg\n", + "\n", + "\n", + "#ground state energy E1 = h**2/(8*m*a**2)\n", + "#second excited state E3 = (9*h**2)/(8*m*a**2)\n", + "#required energy E = E3-E1\n", + "#E = (9*h**2)/(8*m*a**2) - h**2/(8*m*a**2)\n", + "#E = (h**2/(8*m*a**2))*(9-1)\n", + "#therefore E = (8*h**2)/(8*m*a**2)\n", + "#hence E = (h**2)/(m*a**2)\n", + "\n", + "#Result \n", + "# the required energy is E = (h**2)/(m*a**2)" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.24, Page number 50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "delta_x=10**-8; #length of box in m\n", + "h=6.626*10**-34;\n", + "m=9.1*10**-31; #mass in kg\n", + "\n", + "#Calculation\n", + "delta_v=h/(m*delta_x); #uncertainity in m/sec\n", + "delta_vk=delta_v*10**-3; #uncertainity in km/sec\n", + "delta_vk=math.ceil(delta_vk*10**2)/10**2 #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"minimum uncertainity in velocity in m/sec is\",round(delta_v));\n", + "print(\"minimum uncertainity in velocity in km/sec is\",delta_vk);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('minimum uncertainity in velocity in m/sec is', 72813.0)\n", + "('minimum uncertainity in velocity in km/sec is', 72.82)\n" + ] + } + ], + "prompt_number": 40 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.25, Page number 50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "mp=1.6*10**-27; #mass of proton in kg\n", + "me=9.1*10**-31; #mass of electron in kg\n", + "h=6.626*10**(-34);\n", + "c=3*10**10; #velocity of light in m/sec\n", + "\n", + "#Calculation\n", + "Ep=me*c**2;\n", + "lamda=h/math.sqrt(2*mp*Ep); #wavelength in m\n", + "lamda_A=lamda*10**10; #converting lamda from m to A\n", + "\n", + "#Result\n", + "print(\"The de broglie wavelength in Angstrom is\",lamda_A);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('The de broglie wavelength in Angstrom is', 4.092931643497047e-06)\n" + ] + } + ], + "prompt_number": 41 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.26, Page number 51 *************************************************" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "m=1.675*10**(-27); #mass of neutron in kg\n", + "h=6.626*10**(-34);\n", + "n=1; #diffractive order\n", + "d=0.314; #spacing in nm\n", + "E=0.04; #kinetic energy in eV\n", + "\n", + "#Calculation\n", + "d=d*10**-9; #spacing in m\n", + "Ej=E*1.6*10**-19; #kinetic energy in J\n", + "lamda=h/math.sqrt(2*m*Ej); #de Broglie wavelength\n", + "lamdaA=lamda*10**9; #converting wavelength from m to nm\n", + "theta=math.asin((n*lamda)/(2*d));\n", + "print(\"The de Broglie wavelength in metres is\",lamda);\n", + "print(\"The de Broglie wavelength in nm is\",lamdaA);\n", + "print(\"glancing angle in degrees is\",theta);\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('The de Broglie wavelength in metres is', 1.4309980469755228e-10)\n", + "('The de Broglie wavelength in nm is', 0.1430998046975523)\n", + "('glancing angle in degrees is', 0.2298853909391574)\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/chapter2_2-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/chapter2_2-checkpoint.ipynb new file mode 100644 index 00000000..a118db3c --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/chapter2_2-checkpoint.ipynb @@ -0,0 +1,813 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:04561aafd347865fa8c83acfb9b60eb84db275f85862655b442f546023cadd1e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Electron Theory of Metals" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.1, Page number 69" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#import module\n", + "import math\n", + "\n", + "#Calculation\n", + "# given that E-Ef = kT\n", + "# fermi function FE = 1/(1+exp((E-Ef)/kT)\n", + "# therefore FE = 1/(1+exp(kT/kT));\n", + "# FE = 1/(1+exp(1))\n", + "FE=1/(1+math.exp(1));\n", + "FE=math.ceil(FE*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"fermi function is\",FE);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('fermi function is', 0.27)\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.2, Page number 69" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "\n", + "#Calculation\n", + "# given that E-Ef = kT\n", + "# fermi function FE = 1/(1+exp((E-Ef)/kT)\n", + "# therefore FE = 1/(1+exp(kT/kT));\n", + "# FE = 1/(1+exp(1))\n", + "FE=1/(1+math.exp(1));\n", + "FE=math.ceil(FE*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"fermi function is\",FE);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('fermi function is', 0.269)\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.3, Page number 69" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "FE=10/100; #fermi function is 10%\n", + "Ef=5.5; #fermi energy of silver in eV\n", + "k=1.38*10**-23;\n", + "\n", + "#Calculation\n", + "E=Ef+(Ef/100);\n", + "#FE=1/(1+math.exp((E-Ef)/(k*T)))\n", + "#therefore 1/FE = 1+math.exp((E-Ef)/(k*T))\n", + "#therefore (1/FE)-1 = math.exp((E-Ef)/(k*T))\n", + "#therefore log((1/FE)-1) = (E-Ef)/(k*T)\n", + "#therefore T = (E-Ef)/(k*math.log((1/FE)-1))\n", + "#let X=E-Ef; \n", + "X=E-Ef; #energy in eV\n", + "X=X*1.6*10**-19; #energy in J\n", + "T = (X/(k*math.log((1/FE)-1)));\n", + "T=math.ceil(T*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"temperature in K is\",T);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('temperature in K is', 290.23)\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.4, Page number 70 **************************************" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "#let X=E-Ef\n", + "X=0.5; #E-Ef=0.5 in eV\n", + "\n", + "#Calculation\n", + "X=X*1.6*10**-19; #X in J\n", + "FE=1/100; #fermi function is 1% \n", + "k=1.38*10**-23;\n", + "#FE=1/(1+exp(X/(k*T)))\n", + "#therefore 1/FE = 1+math.exp(X/(k*T))\n", + "#therefore (1/FE)-1 = math.exp(X/(k*T))\n", + "#therefore log((1/FE)-1) = X/(k*T)\n", + "#but log(x) = 2.303*math.log10(x)\n", + "#therefore T = X/(k*math.log((1/FE)-1))\n", + "#but log(x)=2.303*math.log10(x)\n", + "#therefore T = X/(k*2.303*math.log10((1/FE)-1))\n", + "T = X/(k*2.303*math.log10((1/FE)-1));\n", + "\n", + "#Result\n", + "print(\"temperature in K is\",T);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('temperature in K is', 1261.3505710887953)\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.5, Page number 71 *******" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "rho_s=10.5*10**3; #density in kg/m^3\n", + "NA=6.02*10**26; #avagadro number per kmol\n", + "MA=107.9; \n", + "\n", + "#Calculation\n", + "n=(rho_s*NA)/MA;\n", + "sigma=6.8*10**7;\n", + "e=1.6*10**-19; #charge in coulomb\n", + "mew=sigma/(n*e);\n", + "mew=math.ceil(mew*10**6)/10**6; #rounding off to 6 decimals\n", + "\n", + "#Result\n", + "print(\"density of electrons is\",n);\n", + "print(\"mobility of electrons in silver in m^2/Vs is\",mew);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('density of electrons is', 5.85820203892493e+28)\n", + "('mobility of electrons in silver in m^2/Vs is', 0.007255)\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.6, Page number 71 ***" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "d=8.92*10**3; #density in kg/m^3\n", + "rho=1.73*10**-8; #resistivity in ohm-m\n", + "m=9.1*10**-31; #mass in kg\n", + "w=63.5; #atomic weight\n", + "e=1.6*10**-19; #charge in coulomb\n", + "A=6.02*10**26; #avagadro number\n", + "\n", + "#Calculation\n", + "n=(d*A)/w;\n", + "mew=1/(rho*n*e);\n", + "tow=m/(n*(e**2)*rho);\n", + "mew=math.ceil(mew*10**6)/10**6; #rounding off to 6 decimals\n", + "\n", + "#Result\n", + "print(\"mobility of electrons in Copper in m/Vs is\",mew);\n", + "print(\"average time of collision of electrons in copper in sec is\",tow);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('mobility of electrons in Copper in m/Vs is', 0.004273)\n", + "('average time of collision of electrons in copper in sec is', 2.4297841992299697e-14)\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.7, Page number 72" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "rho=1.54*10**-8; #resistivity in ohm-m\n", + "n=5.8*10**28; #electron/m^3\n", + "m=9.108*10**-31; #mass in kg\n", + "e=1.602*10**-19; #charge in coulomb\n", + "\n", + "#Calculation\n", + "tow=m/(n*(e**2)*rho);\n", + "\n", + "#Result\n", + "print(\"relaxation time of conduction electrons in sec is\",tow);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('relaxation time of conduction electrons in sec is', 3.973281032516849e-14)\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.8, Page number 73" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "FE=10/100; #fermi function is 10%\n", + "Ef=5.5; #fermi energy of silver in eV\n", + "k=1.38*10**-23;\n", + "\n", + "#Calculation\n", + "E=Ef+(Ef/100);\n", + "#FE=1/(1+math.exp((E-Ef)/(k*T)))\n", + "#therefore 1/FE = 1+math.exp((E-Ef)/(k*T))\n", + "#therefore (1/FE)-1 = math.exp((E-Ef)/(k*T))\n", + "#therefore log((1/FE)-1) = (E-Ef)/(k*T)\n", + "#therefore T = (E-Ef)/(k*math.log((1/FE)-1))\n", + "#let X=E-Ef; \n", + "X=E-Ef; #energy in eV\n", + "X=X*1.6*10**-19; #energy in J\n", + "T = (X/(k*math.log((1/FE)-1)));\n", + "T=math.ceil(T*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"temperature in K is\",T);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('temperature in K is', 290.23)\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.9, Page number 73" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "\n", + "#Calculation\n", + "# given that E-Ef = kT\n", + "# fermi function FpE = 1/(1+exp((E-Ef)/kT)\n", + "# therefore FpE = 1/(1+exp(kT/kT));\n", + "# FpE = 1/(1+exp(1))\n", + "FpE=1/(1+math.exp(1));\n", + "FpE=math.ceil(FpE*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"fermi function is\",FpE);\n", + "#the presence of electron at that energy level is not certain" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('fermi function is', 0.27)\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.10, Page number 74 ****************************" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "m=9.1*10**-31; #mass in kg\n", + "h=6.626*10**-34;\n", + "A=(8*m)**(3/2);\n", + "\n", + "#Calculation\n", + "B=math.pi/(2*h**3);\n", + "EfeV=3.10; #fermi energy in eV\n", + "Ef=EfeV*1.6*10**-19; #fermi energy in J\n", + "EFeV=EfeV+0.02; #energy after interval in eV\n", + "EF=EFeV*1.6*10**-19; #energy after interval in J\n", + "function Q=f(E),Q=A*B*math.sqrt(E),endfunction\n", + "I=intg(Ef,EF,f)\n", + "\n", + "#Result\n", + "print(\"number of energy states per unit volume is\",I);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "SyntaxError", + "evalue": "invalid syntax (, line 18)", + "output_type": "pyerr", + "traceback": [ + "\u001b[1;36m File \u001b[1;32m\"\"\u001b[1;36m, line \u001b[1;32m18\u001b[0m\n\u001b[1;33m function Q=f(E),Q=A*B*math.sqrt(E),endfunction\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.11, Page number 74" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "T=300; #temperature in K\n", + "n=8.5*10**28; #density per m^3\n", + "rho=1.69*10**-8; #resistivity in ohm/m^3\n", + "me=9.11*10**-31; #mass of electron in kg\n", + "e=1.6*10**-19; #charge in coulomb\n", + "KB=1.38*10**-23; #boltzmann constant in J/k\n", + "\n", + "#Calculation\n", + "lamda=math.sqrt(3*KB*me*T)/(n*(e**2)*rho);\n", + "\n", + "#Result\n", + "print(\"mean free path of electron in m is\",lamda);\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('mean free path of electron in m is', 2.892506814374228e-09)\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.12, Page number 75" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "rho=1.43*10**-8; #resistivity in ohm-m\n", + "n=6.5*10**28; #electron/m^3\n", + "m=9.11*10**-34; #mass in kg\n", + "e=1.6*10**-19; #charge in coulomb\n", + "\n", + "#Calculation\n", + "tow=m/(n*(e**2)*rho);\n", + "\n", + "#Result\n", + "print(\"relaxation time of conduction electrons in sec is\",tow);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('relaxation time of conduction electrons in sec is', 3.8285032275416887e-17)\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.13, Page number 75 ******" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "d=8.92*10**3; #density in kg/m^3\n", + "rho=1.73*10**-8; #resistivity in ohm-m\n", + "m=9.1*10**-31; #mass in kg\n", + "M=63.5; #atomic weight\n", + "e=1.6*10**-19; #charge in coulomb\n", + "A=6.02*10**26; #avagadro number\n", + "\n", + "#Calculation\n", + "n=(d*A)/M;\n", + "mew=1/(rho*n*e);\n", + "tow=m/(n*(e**2)*rho);\n", + "mew=math.ceil(mew*10**6)/10**6; #rounding off to 6 decimals\n", + "\n", + "#Result\n", + "print(\"mobility of electrons in Copper in m/Vs is\",mew);\n", + "print(\"average time of collision of electrons in copper in sec is\",tow);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('mobility of electrons in Copper in m/Vs is', 0.004273)\n", + "('average time of collision of electrons in copper in sec is', 2.4297841992299697e-14)\n" + ] + } + ], + "prompt_number": 31 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.14, Page number 76" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "MH=1.008*2*1.67*10**-27; #mass in kg\n", + "T=30; #temperature in C\n", + "\n", + "#Calculation\n", + "T=T+273; #temperature in K\n", + "KB=1.38*10**-23; #boltzmann constant in J/k\n", + "KE=(3/2)*KB*T; #kinetic energy in J\n", + "KEeV=KE*6.24*10**18; #kinetic energy in eV\n", + "cbar=math.sqrt((3*KB*T)/MH);\n", + "\n", + "#Result\n", + "print(\"average kinetic energy in J is\",KE);\n", + "print(\"average kinetic energy in eV is\",KEeV);\n", + "print(\"velocity of molecules in m/s is\",cbar);\n", + "\n", + "#answers for average kinetic energy in eV and velocity of electrons given in the book are wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('average kinetic energy in J is', 6.2720999999999986e-21)\n", + "('average kinetic energy in eV is', 0.039137903999999994)\n", + "('velocity of molecules in m/s is', 1930.269663853336)\n" + ] + } + ], + "prompt_number": 33 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.15, Page number 77 ****" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "Ee=10; #electron kinetic energy in eV\n", + "Ep=10; #proton kinetic energy in eV\n", + "me=9.1*10**-31; #mass of electron in kg\n", + "mp=1.67*10**-27; #mass of proton in kg\n", + "\n", + "#Calculation\n", + "EeeV=Ee*1.6*10**-19; #electron kinetic energy in J\n", + "EpeV=Ep*1.6*10**-19; #proton kinetic energy in J\n", + "cebar=math.sqrt((2*EeeV)/me);\n", + "cpbar=math.sqrt((2*EpeV)/mp);\n", + "\n", + "#Result\n", + "print(\"velocity of electron in m/s is\",cebar);\n", + "print(\"velocity of proton in m/s is\",cpbar);\n", + "\n", + "#answers given in the book are wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('velocity of electron in m/s is', 1875228.9237539817)\n", + "('velocity of proton in m/s is', 43774.05241316662)\n" + ] + } + ], + "prompt_number": 35 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.16, Page number 77" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "A=10; #area of cross section in mm^2\n", + "A=A*10**-6; #area of cross section in m^2\n", + "i=100; #current in amp\n", + "n=8.5*10**28; #number of electrons per mm^3\n", + "e=1.6*10**-19; #electron charge in coulumb\n", + "\n", + "#Calculation\n", + "vd=1/(n*A*e);\n", + "\n", + "#Result\n", + "print(\"drift velocity in m/s is\",vd);\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('drift velocity in m/s is', 7.3529411764705884e-06)\n" + ] + } + ], + "prompt_number": 36 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.17, Page number 78" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "tow=3*10**-14; #relaxation time in sec\n", + "n=8*10**28; #density of electrons per m^3\n", + "KB=1.38*10**-23; #boltzmann constant in J/k\n", + "T=0; #temperature in C\n", + "\n", + "#Calculation\n", + "T=T+273; #temperature in K\n", + "m=9.1*10**-31; #mass of electron in kg\n", + "sigma_T=((3*n*tow*(KB**2)*T)/(2*m));\n", + "sigma_T=math.ceil(sigma_T*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"thermal conductivity of copper in ohm-1 is\",sigma_T);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('thermal conductivity of copper in ohm-1 is', 205.68)\n" + ] + } + ], + "prompt_number": 38 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/chapter4_2-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/chapter4_2-checkpoint.ipynb new file mode 100644 index 00000000..80203b2d --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/chapter4_2-checkpoint.ipynb @@ -0,0 +1,756 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:544912fca601384def1f6da3b02bc7431b47e0d8f9efa5f2e7d2a367448daaa6" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Magnetic Properties" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.1, Page number 119" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "H=6.5*10**-4; #magnetic field in T\n", + "M=1.4; #field with iron\n", + "\n", + "#Calculation\n", + "chi=M/H;\n", + "mew_r=1+chi;\n", + "mew_r=math.ceil(mew_r*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"relative permeability of iron is\",mew_r);\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('relative permeability of iron is', 2154.85)\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.2, Page number 119" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "H=220; #field in amp/m\n", + "M=3300; #magnetisation in amp/m\n", + "\n", + "#Calculation\n", + "chi=M/H;\n", + "mew_r=1+chi;\n", + "\n", + "#Result\n", + "print(\"relative permeability is\",mew_r);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('relative permeability is', 16.0)\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.3, Page number 120 *****" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "r=5.29*10**-11; #radius of orbit in m\n", + "B=2; #applied field in Tesla\n", + "e=1.602*10**-19; #charge of electron in coulomb\n", + "m=9.108*10**-31; #mass of electron in kg\n", + "\n", + "#Calculation\n", + "mew=(e**2)*(r**2)*B/(4*m);\n", + "\n", + "#Result\n", + "print(\"magnetic moment in Am^2 is\",mew);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('magnetic moment in Am^2 is', 3.94260574090909e-29)\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.4, Page number 120" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "\n", + "#Variable decleration\n", + "chi=0.5*10**-5; #susceptibility \n", + "H=10**6; #field strength in amp/m\n", + "\n", + "#Calculation\n", + "mew_0=4*math.pi*10**-7;\n", + "I=chi*H;\n", + "B=mew_0*(I+H);\n", + "B=math.ceil(B*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"intensity of magnetisation in Amp/m is\",I);\n", + "print(\"flux density in Weber/m^2 is\",B);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('intensity of magnetisation in Amp/m is', 5.0)\n", + "('flux density in Weber/m^2 is', 1.257)\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.5, Page number 120" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "e=2.86; #edge in armstrong\n", + "e=e*10**-10; #edge in m\n", + "Is=1.76*10**6; #magnetisation in amp/m\n", + "mewB=9.27*10**-24; #1 bohr magneton in amp m^2\n", + "\n", + "#Calculation\n", + "N=2/(e**3); #density per m^3\n", + "mewbar=Is/N;\n", + "mew_bar=mewbar/mewB;\n", + "mew_bar=math.ceil(mew_bar*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"average dipole moment in mewB is\",mew_bar);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('average dipole moment in mewB is', 2.221)\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.6, Page number 121 ***" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "H=10**6; #magnetic field in amp/m\n", + "chi=1.5*10**-3; #susceptibility\n", + "\n", + "#Calculation\n", + "mew_0=4*math.pi*10**-7;\n", + "M=chi*H;\n", + "B=mew_0*(M+H);\n", + "\n", + "#Result\n", + "print(\"magnetisation in Amp/m is\",M);\n", + "print(\"flux density in Tesla is\",B);\n", + "\n", + "#answer for flux density given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('magnetisation in Amp/m is', 1500.0)\n", + "('flux density in Tesla is', 1.258522017028071)\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.7, Page number 121" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "chi=3.7*10**-3; #susceptibility \n", + "H=10**4; #field strength in amp/m\n", + "\n", + "#Calculation\n", + "mew_0=4*math.pi*10**-7;\n", + "M=chi*H;\n", + "B=mew_0*(M+H);\n", + "B=math.ceil(B*10**5)/10**5; #rounding off to 5 decimals\n", + "\n", + "#Result\n", + "print(\"magnetisation in Amp/m is\",M);\n", + "print(\"flux density in Weber/m^2 is\",B);\n", + "\n", + "#answer for flux density given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('magnetisation in Amp/m is', 37.0)\n", + "('flux density in Weber/m^2 is', 0.01262)\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.8, Page number 121" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "r=0.052*10**-9; #radius of orbit in m\n", + "B=1; #magnetic field in Wb/m^2\n", + "e=1.6*10**-19; #charge of electron in coulomb\n", + "m=9.1*10**-31; #mass of electron in kg\n", + "\n", + "#Calculation\n", + "dmew=(e**2)*(r**2)*B/(4*m);\n", + "\n", + "#Result\n", + "print(\"magnetic moment in Am^2 is\",dmew);\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('magnetic moment in Am^2 is', 1.901714285714286e-29)\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.9, Page number 122" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "\n", + "#Variable decleration\n", + "chi=-0.5*10**-5; #susceptibility \n", + "H=9.9*10**4; #field strength in amp/m\n", + "\n", + "#Calculation\n", + "mew_0=4*math.pi*10**-7;\n", + "I=chi*H;\n", + "B=mew_0*H*(1+chi);\n", + "I=math.ceil(I*10**4)/10**4; #rounding off to 4 decimals\n", + "B=math.ceil(B*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"intensity of magnetisation in Amp/m is\",I);\n", + "print(\"flux density in Weber/m^2 is\",B);\n", + "\n", + "#answer for flux density given in the book is wrong " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('intensity of magnetisation in Amp/m is', -0.495)\n", + "('flux density in Weber/m^2 is', 0.1245)\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.10, Page number 122" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "r=6.1*10**-11; #radius of H atom in m\n", + "new=8.8*10**15; #frequency in rev/sec\n", + "e=1.6*10**-19;\n", + "\n", + "#Calculation\n", + "mew0=4*math.pi*10**-7;\n", + "i=e*new;\n", + "B=(mew0*i)/(2*r);\n", + "mew=i*math.pi*(r**2);\n", + "i=math.ceil(i*10**7)/10**7; #rounding off to 7 decimals\n", + "B=math.ceil(B*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"current in amp is\",i);\n", + "print(\"magnetic induction in weber/m^2 is\",B);\n", + "print(\"dipole moment in amp m^2 is\",mew);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('current in amp is', 0.0014081)\n", + "('magnetic induction in weber/m^2 is', 14.503)\n", + "('dipole moment in amp m^2 is', 1.645933169972273e-23)\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.11, Page number 123" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "Is=1.96*10**6; #saturation magnetisation in amp/m\n", + "a=3; #cube edge of iron in armstrong\n", + "a=a*10**-10; #cube edge of iron in m\n", + "mew_b=9.27*10**-24; #bohr magneton in amp/m^2\n", + "n=2; #number of atoms per unit cell\n", + "\n", + "#Calculation\n", + "N=n/(a**3);\n", + "mewbar=Is/N;\n", + "mew_ab=mewbar/mew_b;\n", + "mew_ab=math.ceil(mew_ab*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"average number of Bohr magnetons in bohr magneton per atom is\",mew_ab);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('average number of Bohr magnetons in bohr magneton per atom is', 2.8544)\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.12, Page number 123" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "I=3000; #magnetisation in amp/m\n", + "B=0.005; #flux density in weber/m^2\n", + "\n", + "#Calculation\n", + "mew0=4*math.pi*10**-7;\n", + "H=(B/mew0)-I;\n", + "mew_r=(I/H)+1;\n", + "H=math.ceil(H*10**3)/10**3; #rounding off to 3 decimals\n", + "mew_r=math.ceil(mew_r*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"magnetic force in amp/m is\",H);\n", + "print(\"relative permeability is\",mew_r);\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('magnetic force in amp/m is', 978.874)\n", + "('relative permeability is', 4.065)\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.13, Page number 124" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "H=1800; #magnetising field in amp/m\n", + "phi=3*10**-5; #magnetic flux in weber\n", + "A=0.2; #cross sectional area in cm^2\n", + "\n", + "#Calculation\n", + "A=A*10**-4; #cross sectional area in m^2\n", + "B=phi/A;\n", + "mew=B/H;\n", + "mew=math.ceil(mew*10**8)/10**8 #rounding off to 8 decimals\n", + "\n", + "#Result\n", + "print(\"the permeability in Henry/m is\",mew);\n", + "\n", + "#answer given in the book is wron" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('the permeability in Henry/m is', 0.00083334)\n" + ] + } + ], + "prompt_number": 31 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.14, Page number 124 ********************" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "r=0.04; #radius of circular loop in m\n", + "i=1000; #current in mA\n", + "i=i*10**-3; #current in amp\n", + "B=10**-3; #magnetic flux density in Wb/m^2\n", + "theta=45; #angle in degrees\n", + "\n", + "#Calculation\n", + "A=math.pi*(r**2);\n", + "mew=i*A;\n", + "tow=i*B*math.cos(theta);\n", + "mew=math.ceil(mew*10**6)/10**6 #rounding off to 6 decimals\n", + "\n", + "#Result\n", + "print(\"the magnetic dipole moment in amp m^2 is\",mew);\n", + "print(\"the torque in Nm is\",tow);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('the magnetic dipole moment in amp m^2 is', 0.005027)\n", + "('the torque in Nm is', 0.0005253219888177298)\n" + ] + } + ], + "prompt_number": 36 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.15, Page number 125" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "\n", + "#Variable decleration\n", + "A=100; #area of hysteris loop in m^2\n", + "B=0.01; #flux density in wb/m^2\n", + "H=40; #magnetic field in amp/m\n", + "M=7650; #atomic weight in kg/m^3\n", + "\n", + "#Calculation\n", + "hl=A*B*H;\n", + "\n", + "#Result\n", + "print(\"the hysterisis loss per cycle in J/m^3 is\",hl);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('the hysterisis loss per cycle in J/m^3 is', 40.0)\n" + ] + } + ], + "prompt_number": 38 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.17, Page number 125" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "hl=200; #hysterisis loss per cycle in J/m^3\n", + "M=7650; #atomic weight in kg/m^3\n", + "m=100; #magnetisation cycles per second\n", + "\n", + "#Calculation\n", + "hpl=hl*m;\n", + "pl=hpl/M;\n", + "pl=math.ceil(pl*10**4)/10**4 #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"hysterisis power loss per second in watt/m^3 is\",hpl);\n", + "print(\"the power loss in watt/kg is\",pl); \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('hysterisis power loss per second in watt/m^3 is', 20000)\n", + "('the power loss in watt/kg is', 2.6144)\n" + ] + } + ], + "prompt_number": 40 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/chapter5_2-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/chapter5_2-checkpoint.ipynb new file mode 100644 index 00000000..14018aea --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/chapter5_2-checkpoint.ipynb @@ -0,0 +1,639 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:19dabe1afe46093105a84b4746899bd5b483ca26e3b557510765740ff72179af" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Superconductivity" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 5.1, Page number 148" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "Tc=3.7; #in kelvin\n", + "Hc_0=0.0306; \n", + "T=2\n", + "\n", + "#Calculation\n", + "Hc_2k=Hc_0*(1-((T/Tc)**2));\n", + "Hc_2k=math.ceil(Hc_2k*10**5)/10**5; #rounding off to 5 decimals\n", + "\n", + "#Result\n", + "print(\"the critical feild at 2K in tesla is\",Hc_2k);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('the critical feild at 2K in tesla is', 0.02166)\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 5.2, Page number 149\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "T=4.2; #in kelvin\n", + "Tc=7.18; #in kelvin\n", + "Hc_0=6.5*10**4; #in amp per meter\n", + "D=10**-3\n", + "\n", + "#Calculation\n", + "R=D/2; #radius is equal to half of diameter\n", + "Hc_T=Hc_0*(1-((T/Tc)**2));\n", + "Hc_T=math.ceil(Hc_T*10)/10; #rounding off to 1 decimals\n", + "Ic=2*math.pi*R*Hc_T #critical current is calculated by 2*pi*r*Hc(T)\n", + "Ic=math.ceil(Ic*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"the critical feild in Tesla is\",round(Hc_T));\n", + "print(\"the critical current in Amp is\",Ic);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('the critical feild in Tesla is', 42759.0)\n", + "('the critical current in Amp is', 134.34)\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 5.3, Page number 149\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "lamda_T=75 #in nm\n", + "T=3.5 \n", + "HgTc=4.12 #in K\n", + "\n", + "#Calculation\n", + "lamda_o=lamda_T*math.sqrt(1-((T/HgTc)**4));\n", + "lamda_o=math.ceil(lamda_o*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"the pentration depth at 0k is\",lamda_o);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('the pentration depth at 0k is', 51.92)\n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 5.4, Page number 150" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "lamda_T1=396 #pentration depth in armstrong\n", + "lamda_T2=1730 #pentration depth in armstrong\n", + "T1=3 #temperature in K\n", + "T2=7.1 #temperature in K\n", + "\n", + "#Calculation\n", + "#lamda_T2**2=lamda_0**2*(((Tc**4-T2**4)/Tc**4)**-1)\n", + "#lamda_T1**2=lamda_0**2*(((Tc**4-T1**4)/Tc**4)**-1)\n", + "#dividing lamda_T2**2 by lamda_T1**2 = (Tc**4-T1**4)/(Tc**4-T2**4)\n", + "#let A=lamda_T2**2 and B=lamda_T1**2\n", + "A=lamda_T2**2\n", + "B=lamda_T1**2\n", + "C=A/B\n", + "C=math.ceil(C*10**4)/10**4; #rounding off to 4 decimals\n", + "X=T1**4\n", + "Y=T2**4\n", + "Y=math.ceil(Y*10**2)/10**2; #rounding off to 2 decimals\n", + "#C*((TC**4)-Y)=(Tc**4)-X\n", + "#C*(Tc**4)-(Tc**4)=C*Y-X\n", + "#(Tc**4)*(C-1)=(C*Y)-X\n", + "#let Tc**4 be D\n", + "#D*(C-1)=(C*Y)-X\n", + "D=((C*Y)-X)/(C-1)\n", + "D=math.ceil(D*10)/10; #rounding off to 1 decimals\n", + "Tc=D**(1/4)\n", + "Tc=math.ceil(Tc*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"the pentration depth at 0k is\",Tc);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('the pentration depth at 0k is', 7.1932)\n" + ] + } + ], + "prompt_number": 44 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 5.5, Page number 150" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "Tc=7.2 #in K\n", + "Ho=6.5*10**3 #in amp per m\n", + "T=5 #in K\n", + "\n", + "#Calculation\n", + "Hc=Ho*(1-((T/Tc)**2))\n", + "Hc=math.ceil(Hc*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"the critical magnetic feild at 5K in amp per m is\",Hc)\n", + "\n", + "# answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('the critical magnetic feild at 5K in amp per m is', 3365.36)\n" + ] + } + ], + "prompt_number": 33 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 5.6, Page number 151" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "Tc=3.5 #in K\n", + "Ho=3.2*10**3 #in amp per m\n", + "T=2.5 #in K\n", + "\n", + "#Calculation\n", + "Hc=Ho*(1-((T/Tc)**2))\n", + "Hc=math.ceil(Hc*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"the critical magnetic feild at 5K in amp per m is\",Hc)\n", + "\n", + "#answer in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('the critical magnetic feild at 5K in amp per m is', 1567.35)\n" + ] + } + ], + "prompt_number": 45 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 5.7, Page number 151" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "Hc=5*10**3 #in amp per m\n", + "Ho=2*10**4 #in amp per m\n", + "T=6 #in K\n", + "\n", + "#Calculation\n", + "Tc=T/math.sqrt(1-(Hc/Ho))\n", + "Tc=math.ceil(Tc*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"the critical magnetic feild at 5K in amp per m is\",Tc)\n", + "\n", + "#answer in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('the critical magnetic feild at 5K in amp per m is', 6.93)\n" + ] + } + ], + "prompt_number": 66 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 5.8, Page number 152" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "Hc=2*10**3 #in amp per m\n", + "R=0.02 #in m\n", + "\n", + "#Calculation\n", + "Ic=2*math.pi*R*Hc\n", + "Ic=math.ceil(Ic*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"the critical current is\",Ic)\n", + "\n", + "#answer in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('the critical magnetic feild at 5K in amp per m is', 251.33)\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 5.9, Page number 152" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "M1=199.5 #in a.m.u\n", + "T1=5 #in K\n", + "T2=5.1 #in K\n", + "\n", + "#Calculation\n", + "M2=((T1/T2)**2)*M1\n", + "M2=math.ceil(M2*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"the isotopic mass of M2 is\",M2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('the isotopic mass of M2 is', 191.754)\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 5.10, Page number 152" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "D=3*10**-3 #in meters\n", + "Tc=8 #in K \n", + "T=5 #in K \n", + "Ho=5*10**4\n", + "\n", + "#Calculation\n", + "R=D/2\n", + "Hc=Ho*(1-((T/Tc)**2))\n", + "Ic=2*math.pi*R*Hc\n", + "Ic=math.ceil(Ic*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"critical magnetic feild in amp per m is\",round(Hc));\n", + "print(\"critical current in amp is\",Ic);\n", + "\n", + "#answer in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('critical magnetic feild in amp per m is', 30469.0)\n", + "('critical current in amp is', 287.162)\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 5.11, Page number 153" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "M1=199.5 \n", + "M2=203.4 \n", + "Tc1=4.185 #in K\n", + "\n", + "#Calculation\n", + "Tc2=Tc1*math.sqrt(M1/M2)\n", + "Tc2=math.ceil(Tc2*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"the critical temperature is\",Tc2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('the critical temperature is', 4.145)\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 5.12, Page number 154" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "V=8.5*10**-6 #in volts\n", + "e=1.6*10**-19 #in C\n", + "h=6.626*10**-24\n", + "\n", + "#Calculation\n", + "new=2*e*V/h\n", + "new=math.ceil(new*10**5)/10**5; #rounding off to 5 decimals\n", + "\n", + "#Result\n", + "print(\"EM wave generated frequency in Hz is\",new)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('EM wave generated frequency in Hz is', 0.41051)\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 5.13, Page number 154" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#Variable declaration\n", + "p1=1 #in mm\n", + "p2=6 #in mm\n", + "Tc1=5 #in K\n", + "\n", + "#Calculation\n", + "Tc2=Tc1*(p2/p1);\n", + "\n", + "#Result\n", + "print(\"the critical temperature in K is\",round(Tc2))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('the critical temperature in K is', 30.0)\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 5.14, Page number 154\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#Variable declaration\n", + "Tc=8.7 #in K\n", + "Hc=6*10**5 #in A per m\n", + "Ho=3*10**6 #in A per m\n", + "\n", + "#Calculation\n", + "T=Tc*(math.sqrt(1-(Hc/Ho)))\n", + "\n", + "#Result\n", + "print(\" maximum critical temperature in K is\",T)\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(' maximum critical temperature in K is', 7.781516561699267)\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/chapter7_2-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/chapter7_2-checkpoint.ipynb new file mode 100644 index 00000000..d4161b18 --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/chapter7_2-checkpoint.ipynb @@ -0,0 +1,1514 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:b26f0e8151a54ecdc596868a34547e181ac6dce2c5aea4a02c15b80e1401fd4f" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Semiconductors" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.1, Page number 251" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "T1=300; #temp in K\n", + "T2=310; #temp in K\n", + "ni1=2.5*10**19; #per cubic metre\n", + "EgeV1=0.72; #value of Eg in eV\n", + "EgeV2=1.12; #value of Eg in eV\n", + "\n", + "#Calculation\n", + "Eg1=EgeV1*1.6*10**-19; #Eg in J\n", + "Eg2=EgeV2*1.6*10**-19; #Eg in J\n", + "KB=1.38*10**-23; #boltzmann constant in J/k\n", + "#density of electron hole pair is ni = A*(T**(3/2))*exp(-Eg/(2*KB*T))\n", + "#let (T**(3/2))*exp(-Eg/(2*KB*T)) be X\n", + "X1=(T1**(3/2))*math.exp(-Eg1/(2*KB*T1));\n", + "X2=(T2**(3/2))*math.exp(-Eg2/(2*KB*T2));\n", + "#therefore ni1=A*X1 and ni2=A*X2. dividing ni2/ni1 we get X2/X1\n", + "ni2=ni1*(X2/X1);\n", + "\n", + "#Result\n", + "print(\"the number of electron hole pairs per cubic metre is\",ni2);\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('the number of electron hole pairs per cubic metre is', 2.3207901206362184e+16)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.2, Page number 251" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "RH=3.66*10**-4; #hall coefficient in m^3/coulomb\n", + "sigma=112; #conductivity in ohm-1 m-1\n", + "e=1.6*10**-19;\n", + "\n", + "#Calculation\n", + "ne=1/(RH*e);\n", + "#sigma = e*ne*(mew_e+mew_h)\n", + "#assuming mew_h = 0\n", + "mew_e=sigma/(e*ne);\n", + "\n", + "#Result\n", + "print(\"the charge carrier density per m^3 is\",ne);\n", + "print(\"electron mobility in m^2/Vs is\",mew_e);\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('the charge carrier density per m^3 is', 1.7076502732240434e+22)\n", + "('electron mobility in m^2/Vs is', 0.040992)\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.3, Page number 252" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "ni=1.5*10**16; #intrinsic concentration per m^3\n", + "e=1.6*10**-19;\n", + "mew_e=0.13; #mobility of electrons in m^2/Vs\n", + "mew_h=0.05; #mobility of holes in m^2/Vs\n", + "ND=5*10**20; #conductivity in atoms/m^3\n", + "\n", + "#Calculation\n", + "sigma1=ni*e*(mew_e+mew_h);\n", + "nd=(ni**2)/ND;\n", + "sigma2=ND*e*mew_e;\n", + "NA=5*10**20;\n", + "na=(ni**2)/NA;\n", + "sigma3=NA*e*mew_h;\n", + "sigma1=math.ceil(sigma1*10**7)/10**7; #rounding off to 7 decimals\n", + "sigma2=math.ceil(sigma2*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"intrinsic conductivity of Si in ohm-1 m-1 is\",sigma1);\n", + "print(\"conductivity of Si during donor impurity in ohm-1 m-1 is\",sigma2);\n", + "print(\"conductivity of Si during acceptor impurity in ohm-1 m-1 is\",round(sigma3));" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('intrinsic conductivity of Si in ohm-1 m-1 is', 0.000432)\n", + "('conductivity of Si during donor impurity in ohm-1 m-1 is', 10.41)\n", + "('conductivity of Si during acceptor impurity in ohm-1 m-1 is', 4.0)\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.4, Page number 253" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "sigma1=2; #conductivity in ohm-1 m-1\n", + "EgeV=0.72; #band gap in eV\n", + "KB=1.38*10**-23; #boltzmann constant\n", + "T1=20; #temp in C\n", + "T2=40; #temp in C\n", + "\n", + "#Calculation\n", + "Eg=EgeV*1.6*10**-19; #in J\n", + "T1=T1+273; #temp in K\n", + "T2=T2+273; #temp in K\n", + "#sigma2/sigma1 = exp((-Eg/(2*KB))*((1/T2)-(1/T1)))\n", + "#by taking log on both sides we get 2.303*log10(sigma2/sigma1) = (Eg/(2*KB))*((1/T1)-(1/T2))\n", + "#let (Eg/(2*KB))*((1/T1)-(1/T2)) be X\n", + "X=(Eg/(2*KB))*((1/T1)-(1/T2));\n", + "#let log10(sigma2/sigma1) be Y\n", + "Y=X/2.303;\n", + "#log10(sigma2/sigma1) = log10(sigma2)-log10(sigma1)\n", + "#let log10(sigma2) be A\n", + "A=Y+math.log10(sigma1);\n", + "sigma2=10**A;\n", + "sigma2=math.ceil(sigma2*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"the conductivity in mho m-1 is\",sigma2);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('the conductivity in mho m-1 is', 4.97)\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.5, Page number 253" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "mew_n=1300*10**-4; #in m^2/Vs\n", + "mew_p=500*10**-4; #in m^2/Vs\n", + "sigma=3*10**4; #conductivity in ohm-1 m-1\n", + "e=1.6*10**-19;\n", + "\n", + "#Calculation\n", + "N=sigma/(e*mew_n);\n", + "ni=1.5*10**16; #per m^3\n", + "p=(ni**2)/N;\n", + "P=sigma/(e*mew_p);\n", + "n=(ni**2)/P;\n", + "N=math.ceil(N*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"concentration of electrons in n-type per cubic metre are\",N);\n", + "print(\"concentration of holes in n-type per cubic metre are\",round(p));\n", + "print(\"concentration of electrons in p-type per cubic metre are\",round(n));\n", + "print(\"concentration of holes in p-type per cubic metre are\",P);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('concentration of electrons in n-type per cubic metre are', 1.4423076923076921e+24)\n", + "('concentration of holes in n-type per cubic metre are', 156000000.0)\n", + "('concentration of electrons in p-type per cubic metre are', 60000000.0)\n", + "('concentration of holes in p-type per cubic metre are', 3.7499999999999995e+24)\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.6, Page number 254" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "ni=2.37*10**19; #intrinsic carrier density per m^3\n", + "mew_e=0.38; #in m**2/Vs\n", + "mew_n=0.18; #in m**2/Vs\n", + "\n", + "#Calculation\n", + "e=1.6*10**-19;\n", + "sigmai=ni*e*(mew_e+mew_n);\n", + "rho=1/sigmai;\n", + "rho=math.ceil(rho*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"resistivity in ohm m is\",rho);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('resistivity in ohm m is', 0.471)\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.7, Page number 254" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "Eg=1.12; #band gap in eV\n", + "K=1.38*10**-23;\n", + "T=300; #temp in K\n", + "\n", + "#Calculation\n", + "#EF = (Eg/2)+(3*K*T/4)*log(mh/me)\n", + "#given me=0.12m0 and mh=0.28m0. therefore mh/me = 0.28/0.12 \n", + "#let mh/me be X. therefore X=0.28/0.12 \n", + "X=0.28/0.12;\n", + "EF=(Eg/2)+((3*K*T/4)*math.log(X));\n", + "\n", + "#Result\n", + "print(\"the position of fermi level in eV is\",EF);\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('the position of fermi level in eV is', 0.56)\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.8, Page number 254" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "KB=1.38*10**-23;\n", + "T=300; #temp in K\n", + "h=6.626*10**-34;\n", + "m0=9.11*10**-31;\n", + "mh=m0;\n", + "me=m0;\n", + "EgeV=0.7; #energy gap in eV\n", + "\n", + "#Calculation\n", + "Eg=EgeV*1.6*10**-19; #in J\n", + "A=((2*math.pi*KB/(h**2))**(3/2))*(me*mh)**(3/4);\n", + "B=T**(3/2);\n", + "C=math.exp(-Eg/(2*KB*T));\n", + "ni=2*A*B*C;\n", + "\n", + "#Result\n", + "print(\"concentration of intrinsic charge carriers per cubic metre is\",ni);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('concentration of intrinsic charge carriers per cubic metre is', 3.3481803992458756e+19)\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.9, Page number 255" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "ni=2.4*10**19;\n", + "mew_e=0.39;\n", + "mew_h=0.19;\n", + "e=1.6*10**-19;\n", + "\n", + "#Result\n", + "sigmai=ni*e*(mew_e+mew_h);\n", + "rhoi=1/sigmai;\n", + "rhoi=math.ceil(rhoi*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"resistivity in ohm m is\",rhoi);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('resistivity in ohm m is', 0.45)\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.10, Page number 255" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "l=1; #length in cm\n", + "l=l*10**-2; #length in m\n", + "e=1.6*10**-19;\n", + "w=1; #width in mm\n", + "t=1; #thickness in mm\n", + "\n", + "#Calculation\n", + "w=w*10**-3; #width in m\n", + "t=t*10**-3; #thickness in m\n", + "A=w*t;\n", + "ni=2.5*10**19;\n", + "mew_e=0.39;\n", + "mew_p=0.19;\n", + "sigma=ni*e*(mew_p+mew_e);\n", + "R=l/(sigma*A);\n", + "\n", + "#Result\n", + "print(\"resistance of intrinsic Ge rod in ohm is\",R);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('resistance of intrinsic Ge rod in ohm is', 4310.3448275862065)\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.11, Page number 255" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "Eg=1.1; #energy gap in eV\n", + "m=9.109*10**-31;\n", + "k=1.38*10**-23;\n", + "T=300;\n", + "e=1.6*10**-19;\n", + "h=6.626*10**-34;\n", + "mew_e=0.48; #electron mobility\n", + "mew_h=0.013; #hole mobility\n", + "\n", + "#Calculation\n", + "C=2*(2*math.pi*m*k/(h**2))**(3/2);\n", + "X=2*k*T/e;\n", + "Y=-Eg/X;\n", + "A=math.exp(Y);\n", + "ni=C*(T**(3/2))*A;\n", + "sigma=ni*e*(mew_e+mew_h);\n", + "sigma=math.ceil(sigma*10**6)/10**6 #rounding off to 6 decimals\n", + "\n", + "#Result\n", + "print(\"conductivity in ohm-1 m-1 is\",sigma);\n", + "\n", + "# answer given in the book is wrong, Page number 255" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('conductivity in ohm-1 m-1 is', 0.001162)\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.12, Page number 256" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "m=9.109*10**-31;\n", + "k=1.38*10**-23;\n", + "T=300;\n", + "e=1.6*10**-19;\n", + "h=6.626*10**-34;\n", + "Eg=0.7;\n", + "mew_e=0.4; #electron mobility\n", + "mew_h=0.2; #hole mobility\n", + "\n", + "#Calculation\n", + "C=2*(2*math.pi*m*k/((h**2)))**(3/2);\n", + "X=2*k*T/e;\n", + "ni=C*(T**(3/2))*math.exp(-Eg/X);\n", + "sigma=ni*e*(mew_e+mew_h);\n", + "sigma=math.ceil(sigma*10**3)/10**3 #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"conductivity in ohm-1 m-1\",sigma);\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('conductivity in ohm-1 m-1', 3.214)\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.13, Page number 256" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "k=8.616*10**-5;\n", + "T1=20; #temp in C\n", + "T1=T1+273; #temp in K\n", + "T2=32; #temp in C\n", + "rho2=4.5; #resistivity in ohm m\n", + "rho1=2; #resistivity in ohm m\n", + "\n", + "#Calculation\n", + "T2=T2+273; #temp in K\n", + "dy=math.log10(rho2)-math.log10(rho1);\n", + "dx=(1/T1)-(1/T2);\n", + "Eg=2*k*dy/dx;\n", + "Eg=math.ceil(Eg*10**3)/10**3 #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"energy band gap in eV is\",Eg);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('energy band gap in eV is', 0.452)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.13, Page number 256" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "k=8.616*10**-5;\n", + "T1=20; #temp in C\n", + "T2=32; ##temp in C\n", + "rho2=4.5; #resistivity in ohm m\n", + "rho1=2; #resistivity in ohm m\n", + "\n", + "#Calculation\n", + "T1=T1+273; #temp in K\n", + "T2=T2+273; #temp in K\n", + "dy=math.log10(rho2)-math.log10(rho1);\n", + "dx=(1/T1)-(1/T2);\n", + "Eg=2*k*dy/dx;\n", + "Eg=math.ceil(Eg*10**3)/10**3 #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"energy band gap in eV is\",Eg);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('energy band gap in eV is', 0.452)\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.14, Page number 257" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "EgeV=1; #energy in eV\n", + "k=1.38*10**-23;\n", + "Eg=EgeV*1.602*10**-19; #in J\n", + "#EF can be taken as (Ev+0.5)eV\n", + "#therefore (Ev+0.5)eV = (Ec+Ev)/2--------(1)\n", + "#let fermi level shift by 10% then (Ev+0.6)eV = ((Ec+Ev)/2)+((3*k*T/4)*log(4))-----(2)\n", + "#subtracting (1) from (2)\n", + "#0.1 eV = (3*k*T/4)*math.log(4)\n", + "E=0.1; #energy in eV\n", + "E=E*1.602*10**-19; #energy in J\n", + "T=(4*E)/(3*k*math.log(4));\n", + "\n", + "#Result\n", + "print(\"temperature in K is\",T);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('temperature in K is', 1116.520509905372)\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.15, Page number 257" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "ni=1.5*10**16;\n", + "e=1.6*10**-19;\n", + "mew_e=0.13;\n", + "mew_h=0.05;\n", + "\n", + "#Calculation\n", + "sigma=ni*e*(mew_e+mew_h);\n", + "M=28.1; #atomic weight of Si\n", + "d=2.33*10**3; #density in kg/m^3\n", + "v=M/d;\n", + "N=6.02*10**26;\n", + "N1=N/v;\n", + "#1 donor type impurity is added to 1 impurity atom\n", + "ND=N1/(10**8);\n", + "p=(ni**2)/ND;\n", + "sigma_exd=ND*e*mew_e;\n", + "#1 acceptor type impurity is added to 1 impurity atom\n", + "Na=N1/(10**8);\n", + "n=(ni**2)/Na;\n", + "sigma_exa=Na*e*mew_h;\n", + "sigma=math.ceil(sigma*10**7)/10**7 #rounding off to 7 decimals\n", + "sigma_exd=math.ceil(sigma_exd*10**3)/10**3 #rounding off to 3 decimals\n", + "sigma_exa=math.ceil(sigma_exa*10**3)/10**3 #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"conductivity in ohm-1 m-1 is\",sigma);\n", + "print(\"number of Si atoms per m^3 is\",N1);\n", + "print(\"conductivity for donor type impurity in ohm-1 m-1 is\",sigma_exd);\n", + "print(\"conductivity for acceptor type impurity in ohm-1 m-1 is\",sigma_exa);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('conductivity in ohm-1 m-1 is', 0.000432)\n", + "('number of Si atoms per m^3 is', 4.991672597864769e+28)\n", + "('conductivity for donor type impurity in ohm-1 m-1 is', 10.383)\n", + "('conductivity for acceptor type impurity in ohm-1 m-1 is', 3.994)\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.16, Page number 258" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "T=300; #temperature in K\n", + "KB=1.38*10**-23;\n", + "e=1.6*10**-19;\n", + "mew_e=0.19; #mobility of electrons in m^2/Vs\n", + "\n", + "#Calculation\n", + "Dn=mew_e*KB*T/e;\n", + "Dn=math.ceil(Dn*10**6)/10**6 #rounding off to 6 decimals\n", + "\n", + "#Result\n", + "print(\"diffusion coefficient of electrons in m^2/s is\",Dn);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('diffusion coefficient of electrons in m^2/s is', 0.004917)\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.17, Page number 259" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "RH=3.66*10**-4; #hall coefficient in m^3/coulomb\n", + "I=10**-2; #current in amp\n", + "B=0.5; #magnetic field in wb/m^2\n", + "t=1; #thickness in mm\n", + "\n", + "#Calculation\n", + "t=t*10**-3; #thickness in m\n", + "VH=(RH*I*B)/t;\n", + "VH=VH*10**3; #converting from Volts to mV\n", + "\n", + "#Result\n", + "print(\"Hall voltage in mV is\",VH);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('Hall voltage in mV is', 1.83)\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.18, Page number 259" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "RH=-7.35*10**-5; #hall coefficient\n", + "e=1.6*10**-19;\n", + "sigma=200;\n", + "\n", + "#Calculation\n", + "n=(-1/(RH*e));\n", + "mew=sigma/(n*e);\n", + "\n", + "#Result\n", + "print(\"density of charge carriers in m^3 is\",n);\n", + "print(\"mobility of charge carriers in m^2/Vs is\",mew);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('density of charge carriers in m^3 is', 8.503401360544217e+22)\n", + "('mobility of charge carriers in m^2/Vs is', 0.0147)\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.19, Page number 259" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "I=50; #current in amp\n", + "B=1.5; #magnetic field in T\n", + "n=8.4*10**28; #free electron concentration in electron/m^3\n", + "t=0.5; #thickness in cm\n", + "e=1.6*10**-19;\n", + "\n", + "#Calculation\n", + "t=t*10**-2; #thickness in m\n", + "VH=(I*B)/(n*e*t);\n", + "VH=VH*10**6; #converting VH from V to micro V\n", + "VH=math.ceil(VH*10**4)/10**4 #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"magnitude of Hall voltage in microVolt is\",VH);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('magnitude of Hall voltage in microVolt is', 1.1161)\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.20, Page number 260" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "\n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "RH=3.66*10**-4;\n", + "e=1.6*10**-19;\n", + "rho_n=8.93*10**-3;\n", + "\n", + "#Calculation\n", + "n=1/(RH*e);\n", + "mew_e=RH/rho_n;\n", + "mew_e=math.ceil(mew_e*10**5)/10**5 #rounding off to 5 decimals\n", + "\n", + "#Result\n", + "print(\"n per m^3 is\",n);\n", + "print(\"mew_e in m^2/V is\",mew_e);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('n per m^3 is', 1.7076502732240434e+22)\n", + "('mew_e in m^2/V is', 0.04099)\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.21, Page number 260" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "mew_e=0.13; #electron mobility in m^2/Vs\n", + "mew_h=0.048; #hole mobility in m^2/Vs\n", + "ni=1.5*10**16;\n", + "e=1.6*10**-19;\n", + "T=300; #temp in K\n", + "ND=10**23; #density per m^3\n", + "\n", + "#Calculation\n", + "sigmai=ni*e*(mew_e+mew_h);\n", + "sigma=ND*mew_e*e;\n", + "p=(ni**2)/ND;\n", + "sigmai=math.ceil(sigmai*10**5)/10**5 #rounding off to 5 decimals\n", + "\n", + "#Result\n", + "print(\"conductivity of intrinsic Si in s is\",sigmai);\n", + "print(\"conductivity in s is\",sigma);\n", + "print(\"equilibrium hole concentration per m^3 is\",round(p));\n", + "\n", + "#answers for sigmai and sigma given in the book are wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('conductivity of intrinsic Si in s is', 0.00043)\n", + "('conductivity in s is', 2080.0)\n", + "('equilibrium hole concentration per m^3 is', 2250000000.0)\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.22, Page number 261" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "T=300; #temp in K\n", + "kB=1.38*10**-23;\n", + "mew_e=0.36; #mobility of electrons in m^2/Vs\n", + "e=1.6*10**-19;\n", + "mew_h=0.7; #mobility of electrons in m^2/Vs\n", + "sigma=2.12; #conductivity in ohm-1 m-1\n", + "C=4.83*10**21; #proportional constant\n", + "\n", + "#Calculation\n", + "ni=sigma/(e*(mew_e+mew_h));\n", + "#exp(-Eg/(2*kB*T)) = (C*(T^(3/2)))/ni\n", + "#let X be (C*(T^(3/2)))/ni\n", + "X=(C*(T**(3/2)))/ni;\n", + "#exp(-Eg/(2*kB*T)) = X \n", + "#applyinf log on both sides\n", + "#Eg/(2*kB*T) = log(X)\n", + "Eg=2*kB*T*math.log(X);\n", + "\n", + "#Result\n", + "print(\"forbidden energy gap in eV is\",Eg);\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('forbidden energy gap in eV is', 1.2016388762259164e-19)\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.23, Page number 261" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "Eg=0.4; #energy gap in eV\n", + "Eg=Eg*1.6*10**-19; #Eg in J\n", + "KB=1.38*10**-23;\n", + "T1=0; #temp 1 in C\n", + "T2=50; #temp 2 in C\n", + "T3=100; #temp 3 in C\n", + "\n", + "#Calculation\n", + "T1k=T1+273; #temp 1 in K\n", + "T2k=T2+273; #temp 2 in K\n", + "T3k=T3+273; #temp 3 in K\n", + "#F(E) = 1/(1+(exp((E-Ep)/(KB*T))))\n", + "#but E-Ep = (1/2)*Eg\n", + "#therefore F(E) = 1/(1+(exp(Eg/(2*KB*T))))\n", + "FE1=1/(1+(math.exp(Eg/(2*KB*T1k))));\n", + "FE2=1/(1+(math.exp(Eg/(2*KB*T2k))));\n", + "FE3=1/(1+(math.exp(Eg/(2*KB*T3k))));\n", + "FE1=math.ceil(FE1*10**6)/10**6 #rounding off to 6 decimals\n", + "FE2=math.ceil(FE2*10**6)/10**6 #rounding off to 6 decimals\n", + "FE3=math.ceil(FE3*10**6)/10**6 #rounding off to 6 decimals\n", + "\n", + "#Result\n", + "print(\"probability of occupation at 0 C in eV is\",FE1);\n", + "print(\"probability of occupation at 50 C in eV is\",FE2);\n", + "print(\"probability of occupation at 100 C in eV is\",FE3);\n", + "\n", + "#answers given in the book are wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('probability of occupation at 0 C in eV is', 0.000205)\n", + "('probability of occupation at 50 C in eV is', 0.000762)\n", + "('probability of occupation at 100 C in eV is', 0.001992)\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.24, Page number 262" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "Eg=1.2; #energy in eV\n", + "Eg=Eg*1.6*10**-19; #in J\n", + "KB=1.38*10**-23;\n", + "T1=600; #temp in K\n", + "T2=300; #temp in K\n", + "\n", + "#Calculation\n", + "#sigma is proportional to exp(-Eg/(2*KB*T))\n", + "#let sigma1/sigma2 be R\n", + "R=math.exp((Eg/(2*KB))*((1/T2)-(1/T1)));\n", + "\n", + "#Result\n", + "print(\"the ratio between conductivity is\",round(R));\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('the ratio between conductivity is', 108467.0)\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.25, Page number 263" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "ni=2.5*10**19; #density of charge carriers in m^3\n", + "r=1/(10**6); #ratio\n", + "e=1.6*10**-19;\n", + "mew_e=0.36; #mobility of electrons in m^2/Vs\n", + "mew_h=0.18; #mobility of holes in m^2/Vs\n", + "N=4.2*10**28; #number of Si atoms per m^3\n", + "\n", + "#Calculation\n", + "Ne=r*N;\n", + "Nh=(ni**2)/Ne;\n", + "sigma=(Ne*e*mew_e)+(Nh*e*mew_h);\n", + "rho=1/sigma;\n", + "rho=math.ceil(rho*10**8)/10**8 #rounding off to 8 decimals\n", + "\n", + "#Result\n", + "print(\"number of impurity atoms per m^3 is\",Ne);\n", + "print(\"the resistivity of doped Ge in ohm m is\",rho);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('number of impurity atoms per m^3 is', 4.2e+22)\n", + "('the resistivity of doped Ge in ohm m is', 0.00041336)\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.26, Page number 264" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "n=5*10**17; #concentration in m^3\n", + "vd=350; #drift velocity in m/s\n", + "E=1000; #electric field in V/m\n", + "e=1.6*10**-19;\n", + "\n", + "#Calculation\n", + "mew=vd/E;\n", + "sigma=n*e*mew;\n", + "sigma=math.ceil(sigma*10**4)/10**4 #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"the conductivity of material in ohm m is\",sigma);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('the conductivity of material in ohm m is', 0.028)\n" + ] + } + ], + "prompt_number": 32 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.27, Page number 264" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "sigma_e=2.2*10**-4; #conductivity\n", + "mew_e=125*10**-3; #mobility of electrons in m^2/Vs\n", + "e=1.602*10**-19;\n", + "\n", + "#Calculation\n", + "ne=sigma_e/(e*mew_e);\n", + "\n", + "#Result\n", + "print(\"concentration in m^3 is\",ne);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('concentration in m^3 is', 1.0986267166042448e+16)\n" + ] + } + ], + "prompt_number": 33 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.28, Page number 265" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "RH=3.66*10**-4; #hall coefficient in m^3/c\n", + "rho_i=8.93*10**-3; #resistivity in ohm m\n", + "e=1.6*10**-19;\n", + "\n", + "#Calculation\n", + "nh=1/(RH*e);\n", + "mew_h=1/(rho_i*nh*e);\n", + "mew_h=math.ceil(mew_h*10**4)/10**4 #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"density of charge carriers in m^3 is\",nh);\n", + "print(\"mobility of charge carriers is %f m^2/Vs\",mew_h);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('density of charge carriers in m^3 is', 1.7076502732240434e+22)\n", + "('mobility of charge carriers is %f m^2/Vs', 0.041)\n" + ] + } + ], + "prompt_number": 35 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.29, Page number 265" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import module\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "I=3; #current in mA\n", + "I=I*10**-3; #current in amp\n", + "e=1.6*10**-19;\n", + "RH=3.66*10**-4; #hall coefficient in m^3/C\n", + "B=1; #flux density in w/m^2\n", + "d=2; #dimension along Y in cm\n", + "z=1; #dimension along z in mm\n", + "\n", + "#Calculation\n", + "d=d*10**-2; #dimension along Y in m\n", + "z=z*10**-3; #dimension along z in m\n", + "A=d*z; #area in m^2\n", + "EH=RH*I*B/A;\n", + "VH=EH*d;\n", + "VH=VH*10**3; #converting from V to mV\n", + "n=1/(RH*e);\n", + "VH=math.ceil(VH*10**2)/10**2 #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"Hall voltage in mV is\",VH);\n", + "print(\"charge carrier concentration in m^3 is\",n);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('Hall voltage in mV is', 1.1)\n", + "('charge carrier concentration in m^3 is', 1.7076502732240434e+22)\n" + ] + } + ], + "prompt_number": 37 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics/.ipynb_checkpoints/chapter8_2-checkpoint.ipynb b/Engineering_Physics/.ipynb_checkpoints/chapter8_2-checkpoint.ipynb new file mode 100644 index 00000000..2dc13b1f --- /dev/null +++ b/Engineering_Physics/.ipynb_checkpoints/chapter8_2-checkpoint.ipynb @@ -0,0 +1,253 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:064d55405a5d05f007b28f32cf39a9f99d10f303fc4084e2d14d99aaeb87858c" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Physics of Nano Materials" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.1, Page number 320" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "r=5; #radius in m\n", + "pi=3.14;\n", + "\n", + "#Calculation \n", + "SA=4*pi*r**2; #surface area of sphere in m^2\n", + "V=(4/3)*pi*r**3; #volume of sphere in m^3\n", + "R=SA/V; #ratio\n", + "#surface area to volume ratio can also be given by 3/radius\n", + "\n", + "#Result\n", + "print(\"surface area to volume ratio of sphere in m-1 is\",R);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('surface area to volume ratio of sphere in m-1 is', 0.6)\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.2, Page number 321" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "d=26; #distance in m\n", + "r=d/2; #radius in m\n", + "pi=3.14;\n", + "\n", + "#Calculation\n", + "SA=4*pi*r**2; #surface area of sphere in m^2\n", + "V=(4/3)*pi*r**3; #volume of sphere in m^3\n", + "R=SA/V; #ratio\n", + "R=math.ceil(R*10**3)/10**3; #rounding off to 3 decimals\n", + "#surface area to volume ratio can also be given by 3/radius\n", + "\n", + "#Result\n", + "print(\"surface area to volume ratio of sphere in m-1 is\",R);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('surface area to volume ratio of sphere in m-1 is', 0.231)\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.3, Page number 321" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "r=1; #radius in m\n", + "h=1; #height in m\n", + "pi=3.14\n", + "\n", + "#Calculation\n", + "V=(1/3)*pi*(r**2)*h;\n", + "V=math.ceil(V*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"volume of cone in m^3 is\",V); " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('volume of cone in m^3 is', 1.05)\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.4, Page number 321" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "r=3; # radius in m\n", + "h=4; # height in m\n", + "pi=3.14\n", + "\n", + "#Calculation\n", + "SA=pi*r*math.sqrt((r**2)+(h**2));\n", + "TSA=SA+(pi*r**2);\n", + "\n", + "#Result\n", + "print(\"total surface area of cone in m^2 is\",TSA);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('total surface area of cone in m^2 is', 75.36)\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.5, Page number 322" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "#import modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable decleration\n", + "V=100; #volume of cone in cubic inches\n", + "r=5; #radius of cone in inches\n", + "pi=3.14;\n", + "\n", + "#Calculation\n", + "r_m=r*0.0254; #radius of cone in m\n", + "#volume V=(1/3)*pi*(r**2)*h\n", + "#therefore h = (3*V)/(pi*r**2)\n", + "h=(3*V)/(pi*r**2); #height in inches\n", + "R=3/r_m;\n", + "h=math.ceil(h*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"height of the cone in inches is\",h);\n", + "print(\"surface area to volume ratio in m-1 is\",R);\n", + "\n", + "#answer for the surface area to volume ratio given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('height of the cone in inches is', 3.822)\n", + "('surface area to volume ratio in m-1 is', 23.62204724409449)\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter10_1-checkpoint.ipynb b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter10_1-checkpoint.ipynb new file mode 100644 index 00000000..a64ad6b4 --- /dev/null +++ b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter10_1-checkpoint.ipynb @@ -0,0 +1,300 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:78b8d610d2cc37c12bbe36fc70ba217f440b3e2b1b7e7cbb3aa498d471c77bb0" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "10: Statistical Mechanics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 10.1, Page number 222" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "k = 1.38*10**-23; #Boltzmann constant(J/K)\n", + "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n", + "g1 = 2; #The degeneracy of ground state\n", + "g2 = 8; #The degeneracy of excited state\n", + "delta_E = 10.2; #Energy of excited state above the ground state(eV)\n", + "T = 6000; #Temperature of the state(K)\n", + "\n", + "#Calculation\n", + "D_ratio = g2/g1; #Ratio of degeneracy of states\n", + "x = k*T/e;\n", + "N_ratio = D_ratio*math.exp(-delta_E/x); #Ratio of occupancy of the excited to the ground state\n", + "\n", + "#Result\n", + "print \"The ratio of occupancy of the excited to the ground state is\",N_ratio" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The ratio of occupancy of the excited to the ground state is 1.10167326887e-08\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 10.2, Page number 222" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "a = 10/2;\n", + "#enegy of 10 bosons is E = (10*pi**2*h**2)/(2*m*a**2) = (5*pi**2*h**2)/(m*a**2)\n", + "\n", + "#Result\n", + "print \"enegy of 10 bosons is E = \",int(a),\"(pi**2*h**2)/(m*a**2)\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "enegy of 10 bosons is E = 5 (pi**2*h**2)/(m*a**2)\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 10.3, Page number 223" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "n1=1; #1st level\n", + "n2=2; #2nd level\n", + "n3=3; #3rd level\n", + "n4=4; #4th level\n", + "n5=5; #5th level\n", + "\n", + "#Calculation\n", + "#an energy level can accomodate only 2 fermions. hence there will be 2 fermions in each level\n", + "#thus total ground state energy will be E = (2*E1)+(2*E2)+(2*E3)+(2*E4)+E5\n", + "#let X = ((pi**2)*(h**2)/(2*m*a**2)). E = X*((2*n1**2)+(2*n2**2)+(2*n3**2)+(2*n4**2)+(n5**2))\n", + "A = (2*n1**2)+(2*n2**2)+(2*n3**2)+(2*n4**2)+(n5**2);\n", + "#thus E = A*X\n", + "\n", + "#Result\n", + "print \"the ground state energy of the system is\",A,\"(pi**2)*(h**2)/(2*m*a**2)\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the ground state energy of the system is 85 (pi**2)*(h**2)/(2*m*a**2)\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 10.4, Page number 223" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n", + "N_A = 6.02*10**23; #Avogadro's number\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "me = 9.1*10**-31; #Mass of electron(kg)\n", + "rho = 10.5; #Density of silver(g/cm)\n", + "m = 108; #Molecular mass of silver(g/mol)\n", + "\n", + "#Calculation\n", + "N_D = rho*N_A/m; #Number density of conduction electrons(per cm**3)\n", + "N_D = N_D*10**6; #Number density of conduction electrons(per m**3)\n", + "E_F = ((h**2)/(8*me))*(3/math.pi*N_D)**(2/3); #fermi energy(J)\n", + "E_F = E_F/e; #fermi energy(eV)\n", + "E_F = math.ceil(E_F*10**2)/10**2; #rounding off the value of E_F to 2 decimals\n", + "\n", + "#Result\n", + "print \"The number density of conduction electrons is\",N_D, \"per metre cube\"\n", + "print \"The Fermi energy of silver is\",E_F, \"eV\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The number density of conduction electrons is 5.85277777778e+28 per metre cube\n", + "The Fermi energy of silver is 5.51 eV\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 10.5, Page number 224" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "N_A = 6.02*10**23; #Avogadro's number\n", + "k = 1.38*10**-23; #Boltzmann constant(J/K)\n", + "T = 293; #Temperature of sodium(K)\n", + "E_F = 3.24; #Fermi energy of sodium(eV)\n", + "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n", + "\n", + "#Calculation\n", + "C_v = math.pi**2*N_A*k**2*T/(2*E_F*e); #Molar specific heat of sodium(per mole)\n", + "C_v = math.ceil(C_v*10**2)/10**2; #rounding off the value of C_v to 2 decimals\n", + "\n", + "#Result\n", + "print \"The electronic contribution to molar specific heat of sodium is\",C_v, \"per mole\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The electronic contribution to molar specific heat of sodium is 0.32 per mole\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 10.6, Page number 224" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "m = 9.1*10**-31; #Mass of the electron(kg)\n", + "N_D = 18.1*10**28; #Number density of conduction electrons in Al(per metre cube)\n", + "\n", + "#Calculation\n", + "E_F = h**2/(8*m)*(3/math.pi*N_D)**(2/3); #N_D = N/V. Fermi energy of aluminium(J)\n", + "E_F = E_F/e; #Fermi energy of aluminium(eV)\n", + "E_F = math.ceil(E_F*10**3)/10**3; #rounding off the value of E_F to 3 decimals\n", + "Em_0 = 3/5*E_F; #Mean energy of the electron at 0K(eV)\n", + "Em_0 = math.ceil(Em_0*10**3)/10**3; #rounding off the value of Em_0 to 3 decimals\n", + "\n", + "#Result\n", + "print \"The Fermi energy of aluminium is\",E_F, \"eV\"\n", + "print \"The mean energy of the electron is\",Em_0, \"eV\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Fermi energy of aluminium is 11.696 eV\n", + "The mean energy of the electron is 7.018 eV\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter11_1-checkpoint.ipynb b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter11_1-checkpoint.ipynb new file mode 100644 index 00000000..d5495309 --- /dev/null +++ b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter11_1-checkpoint.ipynb @@ -0,0 +1,326 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:ecf05dc207884a73f4d33d07fdee310eee827214d9664476e0cf941cf4d4f512" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "11: Lasers" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 11.1, Page number 249" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "c = 3*10**8; #Speed of light in free space(m/s)\n", + "k = 1.38*10**-23; #Boltzmann constant(J/K)\n", + "T = 300; #Temperature at absolute scale(K)\n", + "lamda1 = 5500; #Wavelength of visible light(A)\n", + "lamda2 = 10**-2; #Wavelength of microwave(m)\n", + "\n", + "#Calculation\n", + "lamda1 = lamda1*10**-10; #Wavelength of visible light(m)\n", + "rate_ratio = math.exp(h*c/(lamda1*k*T))-1; #Ratio of spontaneous emission to stimulated emission\n", + "rate_ratio1 = math.exp(h*c/(lamda2*k*T))-1; #Ratio of spontaneous emission to stimulated emission\n", + "rate_ratio1 = math.ceil(rate_ratio1*10**5)/10**5; #rounding off the value of rate_ratio1 to 5 decimals\n", + "\n", + "#Result\n", + "print \"The ratio of spontaneous emission to stimulated emission for visible region is\",rate_ratio\n", + "print \"The ratio of spontaneous emission to stimulated emission for microwave region is\", rate_ratio1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The ratio of spontaneous emission to stimulated emission for visible region is 8.19422217477e+37\n", + "The ratio of spontaneous emission to stimulated emission for microwave region is 0.00482\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 11.2, Page number 250" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "c = 3*10**8; #Speed of light in free space(m/s)\n", + "lamda = 690; #Wavelength of laser light(nm)\n", + "E_lower = 30.5; #Energy of lower state(eV)\n", + "\n", + "#Calculation\n", + "lamda = lamda*10**-9; #Wavelength of laser light(m)\n", + "E = h*c/lamda; #Energy of the laser light(J)\n", + "E = E/e; #Energy of the laser light(eV)\n", + "E_ex = E_lower + E; #Energy of excited state of laser system(eV)\n", + "E_ex = math.ceil(E_ex*10**2)/10**2; #rounding off the value of E_ex to 2 decimals\n", + "\n", + "#Result\n", + "print \"The energy of excited state of laser system is\",E_ex, \"eV\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The energy of excited state of laser system is 32.31 eV\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 11.3, Page number 250" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "import numpy as np\n", + "\n", + "#Variable declaration\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "k = 1.38*10**-23; #Boltzmann constant(J/K)\n", + "\n", + "#Calculation\n", + "#Stimulated Emission = Spontaneous Emission <=> exp(h*f/(k*T))-1 = 1 i.e.\n", + "#f/T = log(2)*k/h = A\n", + "A = np.log(2)*k/h; #Frequency per unit temperature(Hz/K)\n", + "A = A/10**10;\n", + "A = math.ceil(A*10**3)/10**3; #rounding off the value of A to 3 decimals\n", + "\n", + "#Result\n", + "print \"The stimulated emission equals spontaneous emission iff f/T =\",A,\"*10**10 Hz/k\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The stimulated emission equals spontaneous emission iff f/T = 1.444 *10**10 Hz/k\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 11.4, Page number 250" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "lamda = 500; #Wavelength of laser light(nm)\n", + "f = 15; #Focal length of the lens(cm)\n", + "d = 2; #Diameter of the aperture of source(cm)\n", + "P = 5; #Power of the laser(mW)\n", + "\n", + "#Calculation\n", + "P = P*10**-3; #Power of the laser(W)\n", + "lamda = lamda*10**-9; #Wavelength of laser light(m)\n", + "d = d*10**-2; #Diameter of the aperture of source(m)\n", + "f = f*10**-2; #Focal length of the lens(m)\n", + "a = d/2; #Radius of the aperture of source(m)\n", + "A = math.pi*lamda**2*f**2/a**2; #Area of the spot at the focal plane, metre square\n", + "I = P/A; #Intensity at the focus(W/m**2)\n", + "I = I/10**7;\n", + "I = math.ceil(I*10**4)/10**4; #rounding off the value of I to 1 decimal\n", + "\n", + "#Result\n", + "print \"The area of the spot at the focal plane is\",A, \"m**2\"\n", + "print \"The intensity at the focus is\",I,\"*10**7 W/m**2\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The area of the spot at the focal plane is 1.76714586764e-10 m**2\n", + "The intensity at the focus is 2.8295 *10**7 W/m**2\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 11.5, Page number 251" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "c = 3*10**8; #Speed of light in free space(m/s)\n", + "lamda = 1064; #Wavelength of laser light(nm)\n", + "P = 0.8; #Average power output per laser pulse(W)\n", + "dt = 25; #Pulse width of laser(ms)\n", + "\n", + "#Calculation\n", + "dt = dt*10**-3; #Pulse width of laser(s)\n", + "lamda = lamda*10**-9; #Wavelength of laser light(m)\n", + "E = P*dt; #Energy released per pulse(J)\n", + "E1 = E*10**3;\n", + "N = E/(h*c/lamda); #Number of photons in a pulse\n", + "\n", + "#Result\n", + "print \"The energy released per pulse is\",E1,\"*10**-3 J\"\n", + "print \"The number of photons in a pulse is\", N\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The energy released per pulse is 20.0 *10**-3 J\n", + "The number of photons in a pulse is 1.07053023443e+17\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 11.6, Page number 251" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "lamda = 693; #Wavelength of laser beam(nm)\n", + "D = 3; #Diameter of laser beam(mm)\n", + "d = 300; #Height of a satellite above the surface of earth(km)\n", + "\n", + "#Calculation\n", + "D = D*10**-3; #Diameter of laser beam(m)\n", + "lamda = lamda*10**-9; #Wavelength of laser beam(m)\n", + "d = d*10**3; #Height of a satellite above the surface of earth(m)\n", + "d_theta = 1.22*lamda/D; #Angular spread of laser beam(rad)\n", + "dtheta = d_theta*10**4;\n", + "dtheta = math.ceil(dtheta*10**2)/10**2; #rounding off the value of dtheta to 2 decimals\n", + "a = d_theta*d; #Diameter of the beam on the satellite(m)\n", + "a = math.ceil(a*10)/10; #rounding off the value of a to 1 decimal\n", + "\n", + "#Result\n", + "print \"The height of a satellite above the surface of earth is\",dtheta,\"*10**-4 rad\"\n", + "print \"The diameter of the beam on the satellite is\",a, \"m\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The height of a satellite above the surface of earth is 2.82 *10**-4 rad\n", + "The diameter of the beam on the satellite is 84.6 m\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter12_1-checkpoint.ipynb b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter12_1-checkpoint.ipynb new file mode 100644 index 00000000..7fa73024 --- /dev/null +++ b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter12_1-checkpoint.ipynb @@ -0,0 +1,237 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:aab26783619c45961eca2004893b5ed3a4fe23aa4a44df9efa3d63c5d1ff3388" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "12: Holography and Fibre Optics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 12.1, Page number 271" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "n1 = 1.43; #Refractive index of fibre core\n", + "n2 = 1.4; #Refractive index of fibre cladding\n", + "\n", + "#Calculation\n", + "#As sin (alpha_c) = n2/n1, solving for alpha_c\n", + "alpha_c = math.asin(n2/n1); #Critical angle for optical fibre(rad)\n", + "alpha_c = alpha_c*57.2957795; #Critical angle for optical fibre(degrees)\n", + "alpha_c = math.ceil(alpha_c*10**3)/10**3; #rounding off the value of alpha_c to 3 decimals\n", + "#AS cos(theta_c) = n2/n1, solving for theta_c\n", + "theta_c = math.acos(n2/n1); #Critical propagation angle for optical fibre(rad)\n", + "theta_c = theta_c*57.2957795; #Critical propagation angle for optical fibre(degrees)\n", + "theta_c = math.ceil(theta_c*10**2)/10**2; #rounding off the value of theta_c to 2 decimals\n", + "NA = math.sqrt(n1**2 - n2**2); #Numerical aperture for optical fibre\n", + "NA = math.ceil(NA*10**3)/10**3; #rounding off the value of NA to 3 decimals\n", + "\n", + "#Result\n", + "print \"The critical angle for optical fibre is\",alpha_c, \"degrees\"\n", + "print \"The critical propagation angle for optical fibre is\",theta_c, \"degrees\"\n", + "print \"Numerical aperture for optical fibre is\",NA\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The critical angle for optical fibre is 78.244 degrees\n", + "The critical propagation angle for optical fibre is 11.76 degrees\n", + "Numerical aperture for optical fibre is 0.292\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 12.2, Page number 271" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "n1 = 1.45; #Refractive index of fibre core\n", + "n2 = 1.4; #Refractive index of fibre cladding\n", + "\n", + "#Calculation\n", + "NA = math.sqrt(n1**2 - n2**2); #Numerical aperture for optical fibre\n", + "NA = math.ceil(NA*10**4)/10**4; #rounding off the value of NA to 4 decimals\n", + "#As sin(theta_a) = sqrt(n1^2 - n2^2), solving for theta_a\n", + "theta_a = math.asin(math.sqrt(n1**2 - n2**2)); #Half of acceptance angle of optical fibre(rad)\n", + "theta_a = theta_a*57.2957795; #Half of acceptance angle of optical fibre(degrees)\n", + "theta_accp = 2*theta_a; #Acceptance angle of optical fibre(degrees)\n", + "theta_accp = math.ceil(theta_accp*10**2)/10**2; #rounding off the value of theta_accp to 2 decimals\n", + "Delta = (n1 - n2)/n1; #Relative refractive index difference\n", + "Delta = math.ceil(Delta*10**4)/10**4; #rounding off the value of Delta to 4 decimals\n", + "\n", + "#Result\n", + "print \"Numerical aperture for optical fibre is\", NA\n", + "print \"The acceptance angle of optical fibre is\",theta_accp, \"degrees\"\n", + "print \"Relative refractive index difference is\", Delta\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Numerical aperture for optical fibre is 0.3775\n", + "The acceptance angle of optical fibre is 44.36 degrees\n", + "Relative refractive index difference is 0.0345\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 12.3, Page number 271" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "n1 = 1.55; #Refractive index of fibre core\n", + "n2 = 1.53; #Refractive index of fibre cladding\n", + "n0 = 1.3; #Refractive index of medium\n", + "\n", + "#Calculation\n", + "NA = math.sqrt(n1**2 - n2**2); #Numerical aperture for optical fibre\n", + "NA = math.ceil(NA*10**4)/10**4; #rounding off the value of NA to 4 decimals\n", + "#n0*sin(theta_a) = sqrt(n1^2 - n2^2) = NA, solving for theta_a\n", + "theta_a = math.asin(math.sqrt(n1**2 - n2**2)/n0); #Half of acceptance angle of optical fibre(rad)\n", + "theta_a = theta_a*57.2957795; #Half of acceptance angle of optical fibre(degrees)\n", + "theta_accp = 2*theta_a; #Acceptance angle of optical fibre(degrees)\n", + "\n", + "#Result\n", + "print \"Numerical aperture for step index fibre is\",NA\n", + "print \"The acceptance angle of step index fibre is\",int(theta_accp), \"degrees\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Numerical aperture for step index fibre is 0.2482\n", + "The acceptance angle of step index fibre is 22 degrees\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 12.4, Page number 271 Theoritical proof" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 12.5, Page number 272" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "alpha = 2; #Power loss through optical fibre(dB/km)\n", + "P_in = 500; #Poer input of optical fibre(micro-watt)\n", + "z = 10; #Length of the optical fibre(km)\n", + "\n", + "#Calculation\n", + "#As alpha = 10/z*log10(P_in/P_out), solving for P_out\n", + "P_out = P_in/10**(alpha*z/10); #Output power in fibre optic communication(micro-Watt)\n", + "\n", + "#Result\n", + "print \"The output power in fibre optic communication is\",P_out, \"micro-Watt\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The output power in fibre optic communication is 5.0 micro-Watt\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter13_1-checkpoint.ipynb b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter13_1-checkpoint.ipynb new file mode 100644 index 00000000..06b2e844 --- /dev/null +++ b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter13_1-checkpoint.ipynb @@ -0,0 +1,341 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:23fe0a698ddd73a9b73b082e06aebc62f797877523bf19c5324fc5a8330a2aa8" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "13: Dielectric Properties of Materials" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 13.1, Page number 287" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "epsilon_0 = 8.85*10**-12; #Absolute electrical permittivity of free space(F/m)\n", + "R = 0.52; #Radius of hydrogen atom(A)\n", + "n = 9.7*10**26; #Number density of hydrogen(per metre cube)\n", + "\n", + "#Calculation\n", + "R = R*10**-10; #Radius of hydrogen atom(m)\n", + "alpha_e = 4*math.pi*epsilon_0*R**3; #Electronic polarizability of hydrogen atom(Fm**2)\n", + "\n", + "#Result\n", + "print \"The electronic polarizability of hydrogen atom is\", alpha_e, \"Fm**2\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The electronic polarizability of hydrogen atom is 1.56373503182e-41 Fm**2\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 13.2, Page number 287" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "epsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\n", + "A = 100; #Area of a plate of parallel plate capacitor(cm**2)\n", + "d = 1; #Distance between the plates of the capacitor(cm)\n", + "V = 100; #Potential applied to the plates of the capacitor(V)\n", + "\n", + "#Calculation\n", + "A= A*10**-4; #Area of a plate of parallel plate capacitor(m**2)\n", + "d = d*10**-2; #Distance between the plates of the capacitor(m)\n", + "C = epsilon_0*A/d; #Capacitance of parallel plate capacitor(F)\n", + "Q = C*V; #Charge on the plates of the capacitor(C)\n", + "\n", + "#Result\n", + "print \"The capacitance of parallel plate capacitor is\",C, \"F\"\n", + "print \"The charge on the plates of the capacitor is\",Q, \"C\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The capacitance of parallel plate capacitor is 8.854e-12 F\n", + "The charge on the plates of the capacitor is 8.854e-10 C\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 13.3, Page number 288" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "epsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\n", + "epsilon_r = 5.0; #Dielectric constant of the material between the plates of capacitor\n", + "V = 15; #Potential difference applied between the plates of the capacitor(V)\n", + "d = 1.5; #Separation between the plates of the capacitor(mm)\n", + "\n", + "#Calculation\n", + "d = d*10**-3; #Separation between the plates of the capacitor(m)\n", + "#Electric displacement, D = epsilon_0*epsilon_r*E, as E = V/d, so \n", + "D = epsilon_0*epsilon_r*V/d; #Dielectric displacement(C/m**2)\n", + "\n", + "#Result\n", + "print \"The dielectric displacement is\",D, \"C/m**2\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The dielectric displacement is 4.427e-07 C/m**2\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 13.4, Page number 288" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "epsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\n", + "N = 3*10**28; #Number density of solid elemental dielectric(atoms/metre cube)\n", + "alpha_e = 10**-40; #Electronic polarizability(Fm**2)\n", + "\n", + "#Calculation\n", + "epsilon_r = 1 + (N*alpha_e/epsilon_0); #Relative dielectric constant of the material\n", + "epsilon_r = math.ceil(epsilon_r*10**3)/10**3; #rounding off the value of epsilon_r to 3 decimals\n", + "\n", + "#Result\n", + "print \"The Relative dielectric constant of the material is\",epsilon_r\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Relative dielectric constant of the material is 1.339\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 13.5, Page number 288" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "N_A = 6.02*10**23; #Avogadro's number(per mole)\n", + "epsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\n", + "epsilon_r = 3.75; #Relative dielectric constant\n", + "d = 2050; #Density of sulphur(kg/metre cube)\n", + "y = 1/3; #Internal field constant\n", + "M = 32; #Atomic weight of sulphur(g/mol)\n", + "\n", + "#Calculation\n", + "N = N_A*10**3*d/M; #Number density of atoms of sulphur(per metre cube)\n", + "#Lorentz relation for local fields give E_local = E + P/(3*epsilon_0) which gives\n", + "#(epsilon_r - 1)/(epsilon_r + 2) = N*alpha_e/(3*epsilon_0), solving for alpha_e\n", + "alpha_e = (epsilon_r - 1)/(epsilon_r + 2)*3*epsilon_0/N; #Electronic polarizability of sulphur(Fm**2)\n", + "\n", + "#Result\n", + "print \"The electronic polarizability of sulphur is\",alpha_e, \"Fm**2\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The electronic polarizability of sulphur is 3.2940125351e-40 Fm**2\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 13.6, Page number 289" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "N = 3*10**28; #Number density of atoms of dielectric material(per metre cube)\n", + "epsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\n", + "n = 1.6; #Refractive index of dielectric material\n", + "\n", + "#Calculation\n", + "#As (n^2 - 1)/(n^2 + 2) = N*alpha_e/(3*epsilon_0), solving for alpha_e\n", + "alpha_e = (n**2 - 1)/(n**2 + 2)*3*epsilon_0/N; #Electronic polarizability of dielectric material(Fm**2)\n", + "\n", + "#Result\n", + "print \"The electronic polarizability of dielectric material is\",alpha_e, \"Fm**2\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The electronic polarizability of dielectric material is 3.029e-40 Fm**2\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 13.7, Page number 289" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "epsilon_r = 4.9; #Absolute relative dielectric constant of material(F/m)\n", + "n = 1.6; #Refractive index of dielectric material\n", + "\n", + "#Calculation\n", + "#As (n^2 - 1)/(n^2 + 2)*(alpha_e + alpha_i)/alpha_e = N*(alpha_e + alpha_i)/(3*epsilon_0) = (epsilon_r - 1)/(epsilon_r + 2)\n", + "#let alpha_ratio = alpha_i/alpha_e\n", + "alpha_ratio = ((epsilon_r - 1)/(epsilon_r + 2)*(n**2 + 2)/(n**2 - 1) - 1)**(-1); #Ratio of electronic polarizability to ionic polarizability\n", + "alpha_ratio = math.ceil(alpha_ratio*10**3)/10**3; #rounding off the value of alpha_ratio to 3 decimals\n", + "\n", + "#Result\n", + "print \"The ratio of electronic polarizability to ionic polarizability is\",alpha_ratio" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The ratio of electronic polarizability to ionic polarizability is 1.534\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter14_1-checkpoint.ipynb b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter14_1-checkpoint.ipynb new file mode 100644 index 00000000..63e03042 --- /dev/null +++ b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter14_1-checkpoint.ipynb @@ -0,0 +1,365 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:396480b86092e159711151589922125e5821f00167a65ea8819e3cd4725bf191" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "14: Magnetic Properties of Materials" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 14.1, Page number 306" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "N = 6.02*10**23; #Avogadro's number(per mole)\n", + "A = 56; #Atomic weight of the substance(g/mole)\n", + "d = 7.9; #Density of the substance(g/cm**3)\n", + "m_B = 9.27*10**-24; #Bohr's Magneton(J/T)\n", + "\n", + "#Calculation\n", + "m = 2.2*m_B; #Magnetic moment of substance(J/T)\n", + "n = d*N/A ; #Number of atoms per unit volume of the substance(per cm**3)\n", + "n = n*10**6; #Number of atoms per unit volume of the substance(per m**3)\n", + "M = n*m; #Spontaneous magnetisation of the substance(A/m)\n", + "M = M/10**6;\n", + "M = math.ceil(M*10**3)/10**3; #rounding off the value of M to 3 decimals\n", + "\n", + "#Result\n", + "print \"The spontaneous magnetisation of the substance is\",M,\"*10**6 A/m\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The spontaneous magnetisation of the substance is 1.732 *10**6 A/m\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 14.2, Page number 307" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "H = 200; #Field strength to which the ferromagnetic material is subjected(A/m)\n", + "M = 3100; #Magnetisation of the ferromagnetic material(A/m)\n", + "\n", + "#Calculation\n", + "chi = M/H; #Magnetic susceptibility\n", + "mew_r = 1 + chi; #Relative permeability of ferromagnetic material\n", + "\n", + "#Result\n", + "print \"The relative permeability of ferromagnetic material is\",mew_r" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The relative permeability of ferromagnetic material is 16.5\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 14.3, Page number 307" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "H = 300; #Field strength to which the ferromagnetic material is subjected(A/m)\n", + "M = 4400; #Magnetisation of the ferromagnetic material(A/m)\n", + "\n", + "#Calculation\n", + "chi = M/H; #Magnetic susceptibility\n", + "mew_r = 1 + chi; #Relative permeability of ferromagnetic material\n", + "mew_r = math.ceil(mew_r*100)/100; #rounding off the value of mew_r to 2 decimals\n", + "\n", + "#Result\n", + "print \"The relative permeability of ferromagnetic material is\",mew_r\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The relative permeability of ferromagnetic material is 15.67\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 14.4, Page number 307" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "mew_0 = 4*math.pi*10**-7; #Magnetic permeability of free space(Tm/A)\n", + "H = 10000; #Field strength to which the diamagnetic material is subjected(A/m)\n", + "chi = -0.4*10**-5; #Magnetic susceptibility\n", + "\n", + "#Calculation\n", + "M = chi*H; #Magnetisation of the diamagnetic material(A/m)\n", + "B = mew_0*(H + M); #Magnetic flux density of diamagnetic material(T)\n", + "B = math.ceil(B*10**4)/10**4; #rounding off the value of B to 4 decimals\n", + "\n", + "#Result\n", + "print \"The magnetisation of diamagnetic material is\",M, \"A/m\"\n", + "print \"The magnetic flux density of diamagnetic material is\",B, \"T\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The magnetisation of diamagnetic material is -0.04 A/m\n", + "The magnetic flux density of diamagnetic material is 0.0126 T\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 14.5, Page number 307" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "mew_0 = 4*math.pi*10**-7; #Magnetic permeability of free space(Tm/A)\n", + "H = 1.2*10**5; #Field strength to which the diamagnetic material is subjected(A/m)\n", + "chi = -4.2*10**-6; #Magnetic susceptibility\n", + "\n", + "#Calculation\n", + "M = chi*H; #Magnetisation of the diamagnetic material(A/m)\n", + "B = mew_0*(H + M); #Magnetic flux density of diamagnetic material(T)\n", + "B = math.ceil(B*10**3)/10**3; #rounding off the value of B to 3 decimals\n", + "mew_r = M/H + 1; #The relative permeability of diamagnetic material\n", + "mew_r = math.ceil(mew_r*10**6)/10**6; #rounding off the value of mew_r to 6 decimals\n", + "\n", + "#Result\n", + "print \"The magnetisation of diamagnetic material is\",M, \"A/m\"\n", + "print \"The magnetic flux density of diamagnetic material is\",B, \"T\"\n", + "print \"The relative permeability of diamagnetic material is\",mew_r\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The magnetisation of diamagnetic material is -0.504 A/m\n", + "The magnetic flux density of diamagnetic material is 0.151 T\n", + "The relative permeability of diamagnetic material is 0.999996\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 14.6, Page number 308" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "chi = 5.6*10**-6; #Magnetic susceptibility of diamagnetic material\n", + "m = 9.1*10**-31; #Mass of an electron(kg)\n", + "mew_0 = 4*math.pi*10**-7; #Magnetic permeability of free space(Tm/A)\n", + "Z = 1; #Atomic number\n", + "e = 1.6*10**-19; #Electronic charge(C)\n", + "a = 2.53; #Lattice parameter of bcc structure(A)\n", + "\n", + "#Calculation\n", + "a = a*10**-10; #Lattice parameter of bcc structure(m)\n", + "N = 2/a**3; #The number of electrons per unit volume(per metre cube)\n", + "r = math.sqrt(chi*6*m/(mew_0*Z*e**2*N)); #Mean radius of body centered cubic structure(m)\n", + "r = r*10**10; #Mean radius of body centered cubic structure(A)\n", + "r = math.ceil(r*100)/100; #rounding off the value of r to 2 decimals\n", + "\n", + "#Result\n", + "print \"The mean radius of body centered cubic structure is\",r, \"A\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The mean radius of body centered cubic structure is 0.88 A\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 14.7, Page number 308" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "mew_0 = 4*math.pi*10**-7; #Magnetic permeability of free space(Tm/A)\n", + "N_A = 6.02*10**26; #Avogadro's number(per kmol)\n", + "rho = 4370; #Density of paramegnetic salt(kg/metre cube)\n", + "M = 168.5; #Molecular weight of paramagnetic salt(g/mol)\n", + "T = 27; #Temperature of paramagnetic salt(C)\n", + "H = 2*10**5; #Field strength to which the paramagnetic salt is subjected(A/m)\n", + "mew_B = 9.27*10**-24; #Bohr's magneton(Am**2)\n", + "p = 2; #Number of Bohr magnetons per molecule\n", + "k = 1.38*10**-23; #Boltzmann constant(J/K)\n", + "\n", + "#Calculation\n", + "T = T+273; #Temperature of paramagnetic salt(K)\n", + "N = rho*N_A/M; #Total density of atoms in the paramagnetic salt(per meter cube)\n", + "chi_para = mew_0*N*p**2*mew_B**2/(3*k*T); #Magnetic susceptibility of paramagnetic salt\n", + "chi_para = chi_para*10**4;\n", + "chi_para = math.ceil(chi_para*10**2)/10**2; #rounding off the value of chi_para to 2 decimals\n", + "M = chi*H; #Magnetisation of paramagnetic salt(A/m)\n", + "M = math.ceil(M*10)/10; #rounding off the value of M to 1 decimal\n", + "\n", + "#Result\n", + "print \"The magnetic susceptibility of paramagnetic salt is\",chi_para,\"*10**-4\"\n", + "print \"The magnetisation of paramagnetic salt is\",M, \"A/m\"\n", + "\n", + "#answer for magnetisation is not given in the textbook" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The magnetic susceptibility of paramagnetic salt is 5.43 *10**-4\n", + "The magnetisation of paramagnetic salt is 1.2 A/m\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter15_1-checkpoint.ipynb b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter15_1-checkpoint.ipynb new file mode 100644 index 00000000..7bc435f1 --- /dev/null +++ b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter15_1-checkpoint.ipynb @@ -0,0 +1,309 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:2292e5def6e87e01b63e6b748e8fe3955bb5676e5121c51dac319cd9531c4833" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "15: Thermal Properties " + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 15.1, Page number 323" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "k = 1.38*10**-23; #Boltzmann constant(J/K)\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "f_D = 64*10**11; #Debye frequency for Al(Hz)\n", + "\n", + "#Calculation\n", + "theta_D = h*f_D/k; #Debye temperature(K)\n", + "theta_D = math.ceil(theta_D*10)/10; #rounding off the value of theta_D to 1 decimal\n", + "\n", + "#Result\n", + "print \"The Debye temperature of aluminium is\",theta_D, \"K\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Debye temperature of aluminium is 307.3 K\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 15.2, Page number 323" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "N = 6.02*10**26; #Avogadro's number(per kmol)\n", + "k = 1.38*10**-23; #Boltzmann constant(J/K)\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "f_D = 40.5*10**12; #Debye frequency for Al(Hz)\n", + "T = 30; #Temperature of carbon(Ks)\n", + "\n", + "#Calculation\n", + "theta_D = h*f_D/k; #Debye temperature(K)\n", + "C_l = 12/5*math.pi**4*N*k*(T/theta_D)**3; #Lattice specific heat of carbon(J/k-mol/K)\n", + "C_l = math.ceil(C_l*10**3)/10**3; #rounding off the value of C_l to 3 decimals\n", + "\n", + "#Result\n", + "print \"The lattice specific heat of carbon is\",C_l, \"J/k-mol/K\"\n", + "\n", + "#answer given in the book is wrong in the 2nd decimal" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The lattice specific heat of carbon is 7.132 J/k-mol/K\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 15.3, Page number 323" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "k = 1.38*10**-23; #Boltzmann constant(J/K)\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "theta_E = 1990; #Einstein temperature of Cu(K)\n", + "\n", + "#Calculation\n", + "f_E = k*theta_E/h; #Einstein frequency for Cu(K)\n", + "\n", + "#Result\n", + "print \"The Einstein frequency for Cu is\",f_E, \"Hz\"\n", + "print \"The frequency falls in the near infrared region\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Einstein frequency for Cu is 4.14458194989e+13 Hz\n", + "The frequency falls in the near infrared region\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 15.4, Page number 323" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n", + "N = 6.02*10**23; #Avogadro's number(per mol)\n", + "T = 0.05; #Temperature of Cu(K)\n", + "E_F = 7; #Fermi energy of Cu(eV)\n", + "k = 1.38*10**-23; #Boltzmann constant(J/K)\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "theta_D = 348; #Debye temperature of Cu(K)\n", + "\n", + "#Calculation\n", + "C_e = math.pi**2*N*k**2*T/(2*E_F*e); #Electronic heat capacity of Cu(J/mol/K)\n", + "C_V = (12/5)*math.pi**4*(N*k)*(T/theta_D)**3; #Lattice heat capacity of Cu(J/mol/K)\n", + "\n", + "#Result\n", + "print \"The electronic heat capacity of Cu is\",C_e, \"J/mol/K\"\n", + "print \"The lattice heat capacity of Cu is\",C_V, \"J/mol/K\"\n", + "\n", + "#answer for lattice heat capacity given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The electronic heat capacity of Cu is 2.52566877726e-05 J/mol/K\n", + "The lattice heat capacity of Cu is 5.76047891492e-09 J/mol/K\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 15.5, Page number 324" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "T = 1; #For simplicity assume temperature to be unity(K)\n", + "R = 1; #For simplicity assume molar gas constant to be unity(J/mol/K)\n", + "theta_E = T; #Einstein temperature(K)\n", + "\n", + "#Calculation\n", + "C_V = 3*R*(theta_E/T)**2*math.exp(theta_E/T)/(math.exp(theta_E/T)-1)**2; #Einstein lattice specific heat(J/mol/K)\n", + "C_V = C_V/3;\n", + "C_V = math.ceil(C_V*10**3)/10**3; #rounding off the value of C_V to 3 decimals\n", + "\n", + "#Result\n", + "print \"The Einstein lattice specific heat is\",C_V, \"X 3R\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Einstein lattice specific heat is 0.921 X 3R\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 15.6, Page number 324" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n", + "v = 2; #Valency of Zn atom\n", + "N = v*6.02*10**23; #Avogadro's number(per mol)\n", + "T = 300; #Temperature of Zn(K)\n", + "E_F = 9.38; #Fermi energy of Zn(eV)\n", + "k = 1.38*10**-23; #Boltzmann constant(J/K)\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "\n", + "#Calculation\n", + "N = v*6.02*10**23; #Avogadro's number(per mol)\n", + "C_e = math.pi**2*N*k**2*T/(2*E_F*e); #Electronic heat capacity of Zn(J/mol/K)\n", + "C_e = math.ceil(C_e*10**4)/10**4; #rounding off the value of C_e to 4 decimals\n", + "\n", + "#Result\n", + "print \"The molar electronic heat capacity of zinc is\",C_e, \"J/mol/K\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The molar electronic heat capacity of zinc is 0.2262 J/mol/K\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter17_1-checkpoint.ipynb b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter17_1-checkpoint.ipynb new file mode 100644 index 00000000..891f2d43 --- /dev/null +++ b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter17_1-checkpoint.ipynb @@ -0,0 +1,76 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:d4400dbe9ddae05e5ab81173c9df50e2e9dde25edf961941bd9c8dc15f5a6fe1" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "17: Ultrasonics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 17.1, Page number 352" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "f = 3; #Fundamental vibrational frequency of quartz crystal(MHz)\n", + "Y = 7.9*10**10; #Young's modulus of quartz(N/m**2)\n", + "rho = 2650; #Density of quartz(kg/m**3)\n", + "\n", + "#Calculation\n", + "f = f*10**6; #Fundamental vibrational frequency of quartz crystal(Hz)\n", + "l = 1/(2*f)*math.sqrt(Y/rho); #Thickness of vibrating quartz at resonance(m)\n", + "l = l*10**3; #Thickness of vibrating quartz at resonance(mm)\n", + "l = math.ceil(l*100)/100; #rounding off the value of l to 2 decimals\n", + "\n", + "#Result\n", + "print \"The thickness of vibrating quartz at resonance is\",l, \"mm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The thickness of vibrating quartz at resonance is 0.91 mm\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter18_1-checkpoint.ipynb b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter18_1-checkpoint.ipynb new file mode 100644 index 00000000..553fe50f --- /dev/null +++ b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter18_1-checkpoint.ipynb @@ -0,0 +1,300 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:c2afbaf4a700c8f5f48d1946053d882d86bb1b0270a68b2bbedc639668ea43be" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "18: Acoustics of Buildings" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 18.1, Page number 361" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "r = 200; #Distance of the point of reduction from the source(m)\n", + "I_0 = 10**-12; #Final intensity of sound(W/m**2)\n", + "I_f = 60; #Intensity gain of sound at the point of reduction(dB)\n", + "\n", + "#Calculation\n", + "#As A_I = 10*log10(I/I_0), solving for I\n", + "I = I_0*10**(I_f/10); #Initial Intensity of sound(W/m**2)\n", + "P = 4*math.pi*r**2*I; #Output power of the sound source(W)\n", + "P = math.ceil(P*100)/100; #rounding off the value of P to 2 decimals\n", + "\n", + "#Result\n", + "print \"The output power of the sound source is\",P, \"W\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The output power of the sound source is 0.51 W\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 18.2, Page number 361" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "import numpy as np\n", + "\n", + "#Variable declaration\n", + "I1 = 1; #For simplicity assume first intensity level to be unity(W/m**2)\n", + "\n", + "#Calculation\n", + "I2 = 2*I1; #Intensity level after doubling(W/m**2)\n", + "dA_I = 10*np.log10(I2/I1); #Difference in gain level(dB)\n", + "\n", + "#Result\n", + "print \"The sound intensity level is increased by\",int(dA_I), \"dB\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The sound intensity level is increased by 3 dB\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 18.3, Page number 361" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "V = 8000; #Volume of the hall(m**3)\n", + "T = 1.5; #Reverbration time of the hall(s)\n", + "\n", + "#Calculation\n", + "alpha_s = 0.167*V/T; #Sabine Formula giving total absorption of sound in the hall(OWU)\n", + "alpha_s = math.ceil(alpha_s*10)/10; #rounding off the value of alpha_s to 1 decimal\n", + "\n", + "#Result\n", + "print \"The total absorption of sound in the hall is\",alpha_s, \"OWU\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The total absorption of sound in the hall is 890.7 OWU\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 18.4, Page number 362" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "V = 25*20*8; #Volume of the hall(m**3)\n", + "T = 4; #Reverbration time of the hall(s)\n", + "\n", + "#Calculation\n", + "S = 2*(25*20+25*8+20*8); #Total surface area of the hall(m**2)\n", + "alpha = 0.167*V/(T*S); #Sabine Formule giving total absorption in the hall(OWU)\n", + "alpha = math.ceil(alpha*10**4)/10**4; #rounding off the value of alpha to 4 decimals\n", + "\n", + "#Result\n", + "print \"The average absorption coefficient of the surfaces is\",alpha, \"OWU/m**2\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The average absorption coefficient of the surfaces is 0.0971 OWU/m**2\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 18.5, Page number 362" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "V = 475; #Volume of the hall(m**3)\n", + "A_f = 100; #Area of the floor(m**2)\n", + "A_c = 100; #Area of the ceiling(m**2)\n", + "A_w = 200; #Area of the wall(m**2)\n", + "alpha_w = 0.025; #Absorption coefficients of the wall(OWU/m**2)\n", + "alpha_c = 0.02; #Absorption coefficients of the ceiling(OWU/m**2)\n", + "alpha_f = 0.55; #Absorption coefficients of the floor(OWU/m**2)\n", + "\n", + "#Calculation\n", + "alpha_s = (A_w*alpha_w)+(A_c*alpha_c)+(A_f*alpha_f); \n", + "T = 0.167*V/alpha_s; #Sabine Formula for reverbration time(s)\n", + "T = math.ceil(T*100)/100; #rounding off the value of T to 2 decimals\n", + "\n", + "#Result\n", + "print \"The reverbration time for the hall is\",T, \"s\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The reverbration time for the hall is 1.28 s\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 18.6, Page number 362" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "I0 = 1; #For simplicity assume initial sound intensity to be unity(W/m**2)\n", + "A_I1 = 80; #First intensity gain of sound(dB)\n", + "A_I2 = 70; #Second intensity gain of sound(dB)\n", + "\n", + "#Calculation\n", + "#As A_I = 10*log10(I/I_0), solving for I1 and I2\n", + "I1 = 10**(A_I1/10)*I0; #First intensity of sound(W/m**2)\n", + "I2 = 10**(A_I2/10)*I0; #Second intensity of sound(W/m**2)\n", + "I = I1 + I2; #Resultant intensity level of sound(W/m**2)\n", + "A_I = 10*np.log10(I/I0); #Intensity gain of resultant sound(dB)\n", + "A_I = math.ceil(A_I*10**3)/10**3; #rounding off the value of A_I to 3 decimals\n", + "\n", + "#Result\n", + "print \"The intensity gain of resultant sound is\",A_I, \"dB\"\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The intensity gain of resultant sound is 80.414 dB\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter1_1-checkpoint.ipynb b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter1_1-checkpoint.ipynb new file mode 100644 index 00000000..7872d7ab --- /dev/null +++ b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter1_1-checkpoint.ipynb @@ -0,0 +1,475 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:381979e560591138195a6149a5aa889c9c7e2cfe41c7a482a0ea4bbe4c24f150" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "1: Oscillations and Waves" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.1, Page number 23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#import modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "S=4; #SHM described by a particle(cm)\n", + "x=0; #mean position\n", + "v=12; #velocity at mean position(cm/s)\n", + "\n", + "#Calculation\n", + "A=S/2; #amplitude of motion(cm)\n", + "omega=v/A; #angular frequency(sec-1)\n", + "T=(2*math.pi)/omega; #time period(sec)\n", + "T=math.ceil(T*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print \"time period of motion is\",T, \"sec\"\n", + "print \"time period of motion is pi/3 sec\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "time period of motion is 1.048 sec\n", + "time period of motion is pi/3 sec\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.2, Page number 23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#import modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "T=0.1; #time period(sec)\n", + "A=4; #amplitude of motion(cm)\n", + "x=0.2; #distance from mean position(cm)\n", + "\n", + "#Calculation\n", + "omega=(2*math.pi)/T; #angular frequency(sec-1)\n", + "a=(omega**2)*x; #acceleration(cm/sec^2)\n", + "a=math.ceil(a*10**2)/10**2; #rounding off to 2 decimals\n", + "#maximum velocity is when particle is in the mean position\n", + "v_max=omega*A; #maximum velocity(cm/sec)\n", + "v_max=math.ceil(v_max*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print \"acceleration is\",a, \"cm/sec^2\"\n", + "print \"maximum velocity is\",v_max, \"cm/sec\"\n", + "\n", + "#answers given in the book are wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "acceleration is 789.57 cm/sec^2\n", + "maximum velocity is 251.33 cm/sec\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.3, Page number 24" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#import modules\n", + "import math\n", + "import numpy as np\n", + "\n", + "#Variable declaration\n", + "A1 = 40; #First amplitude of oscillation(cm)\n", + "An_plus_1 = 4; #Amplitude after 100 oscillations(cm)\n", + "n = 100; #Number of oscillations\n", + "T = 2.5; #Time period of oscillations(s)\n", + "\n", + "#Calculation\n", + "t = T/4; #Time taken to reach the first amplitude from the mean position(s)\n", + "#Now A1 = x0*math.exp(-lambda*t) and An_plus_1 = x0*math.exp(-lambda*(t+nT))\n", + "#A1/An_plus_1 = math.exp(n*lambda*T)\n", + "x=A1/An_plus_1;\n", + "lamda=np.log(x)/(n*T); #Damping constant(per sec)\n", + "lamda=lamda*10**2;\n", + "lamda=math.ceil(lamda*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print \"Damping constant is\",lamda,\"*10**-2 per sec\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Damping constant is 0.922 *10**-2 per sec\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.4, Page number 24" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#import modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "x1 = 3; #First position of the particle(cm)\n", + "x2 = 4; #Second position of the particle(cm)\n", + "v1 = 16; #Velocity of particle executing SHM at 1st position(cm/s)\n", + "v2 = 12; #Velocity of particle executing SHM at 2nd position (cm/s)\n", + "\n", + "#Calculation\n", + "#As v = omega*sqrt(A**2 - x**2) so\n", + "#(v1/v2)**2=(A**2 - x1**2)/(A**2 - x2**2)\n", + "#RHS gives (A**2-9)/(A**2-16)\n", + "#(v2**2)*(A**2 - x1**2)=(v1**2)*(A**2 - x2**2), on solving we get\n", + "A=math.sqrt((((v1**2)*(x2**2))-((v2**2)*(x1**2)))/((v1**2)-(v2**2))); #amplitude in cm\n", + "omega=v1/math.sqrt(A**2-x1**2); #Angular speed of the particle(per sec)\n", + "T=2*math.pi/omega; #Time period of oscillation(sec)\n", + "T=math.ceil(T*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print \"The amplitude of SHM is\",A, \"cm\"\n", + "print \"The time period of oscillation is\",T, \"sec\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The amplitude of SHM is 5.0 cm\n", + "The time period of oscillation is 1.571 sec\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.5, Page number 25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#import modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "m = 0.3; #Mass attached to the string(kg)\n", + "g = 9.8; #Acceleration due to gravity(m/sec**2)\n", + "x = 0.15; #Stretchness produced in the spring(m)\n", + "s = 0.1; #spring is stretched and released(m)\n", + "\n", + "#Calculation\n", + "F = m*g; #Restoring force acting on the mass(N)\n", + "k = F/x; #Spring constant(N/m)\n", + "A = s; #amplitude equals to the spring stretched and released\n", + "omega = math.sqrt(k/m); #Angular frequency of oscillation(rad per sec)\n", + "v0 = omega*A; #Maximum velocity during the oscillations(m/s)\n", + "v0=math.ceil(v0*100)/100; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print \"The spring constant is\",k, \"N/m\"\n", + "print \"The amplitude of oscillation is\",A, \"m\"\n", + "print \"The maximum velocity during oscillations is\",v0, \"m/s\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The spring constant is 19.6 N/m\n", + "The amplitude of oscillation is 0.1 m\n", + "The maximum velocity during oscillations is 0.81 m/s\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.6, Page number 25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#import modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "lambda1 = 400; #Lower limit of wavelength of visible region(nm)\n", + "lambda2 = 700; #Upper limit of wavelength of visible region(nm)\n", + "c = 3*10**8; #Speed of light in vacuum(m/s)\n", + "\n", + "#Calculation\n", + "lambda1 = lambda1*10**-9 #Lower limit of wavelength(m) \n", + "lambda2 = lambda2*10**-9 #upper limit of wavelength(m) \n", + "new_1 = c/lambda1; #Upper limit of frequency of visible region(m)\n", + "new_2 = c/lambda2; #Lower limit of frequency of visible region(m)\n", + "\n", + "#Result\n", + "print \"The frequency equivalent of 400 nm is\",new_1, \"Hz\"\n", + "print \"The frequency equivalent of 700 nm is\",new_2, \"Hz\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The frequency equivalent of 400 nm is 7.5e+14 Hz\n", + "The frequency equivalent of 700 nm is 4.28571428571e+14 Hz\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.7, Page number 26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#import modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "#Comparing the standard equation u(x,t) = A*sin(2*%pi(x/lambda-t/T)) with the given equation, we get\n", + "A = 1.5*10**-3; #Amplitude of the sound wave(m)\n", + "lamda = 8; #Wavelength of the sound wave(m)\n", + "T = 1/40; #Time period of the sound wave(s)\n", + "\n", + "#Calculation\n", + "A = A*10**3;\n", + "new = 1/T; #Frequency of the sound wave(Hz)\n", + "v = new*lamda; #Velocity of the sound wave(m/s)\n", + "T=math.ceil(T*100)/100; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print \"The amplitude of the sound wave is\",A,\"*10**-3 m\"\n", + "print \"The wavelength of the sound wave is\",lamda, \"m\"\n", + "print \"The time period of the sound wave is\",T, \"s\"\n", + "print \"The frequency of the sound wave is\",new, \"Hz\"\n", + "print \"The velocity of the sound wave is\",v, \"m/s\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The amplitude of the sound wave is 1.5 *10**-3 m\n", + "The wavelength of the sound wave is 8 m\n", + "The time period of the sound wave is 0.03 s\n", + "The frequency of the sound wave is 40.0 Hz\n", + "The velocity of the sound wave is 320.0 m/s\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.8, Page number 26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#import modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "A = 2; #Amplitude of the wave(cm)\n", + "T = 0.5; #Time period of the wave(sec)\n", + "v = 200; #Wave velocity(cm/s)\n", + "\n", + "#Calculation\n", + "f = 1/T; #Frequency of the wave(Hz)\n", + "lamda = v/f; #Wavelength of the wave(cm)\n", + "\n", + "#Result\n", + "print \"frequency of wave is\",f, \"Hz\"\n", + "print \"wavelength of wave is\",lamda, \"cm\"\n", + "print \"The Equation of the wave moving along X-axis :\"\n", + "print \"u = \",A,\"*sin*2*math.pi*(x/\",lamda,\"- t/\",T,\")\" #x and y are in cm and t is in sec" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "frequency of wave is 2.0 Hz\n", + "wavelength of wave is 100.0 cm\n", + "The Equation of the wave moving along X-axis :\n", + "u = 2 *sin*2*math.pi*(x/ 100.0 - t/ 0.5 )\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.9, Page number 27" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#import modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "T = 1000; #Tension in the wire(N)\n", + "M=15; #mass of the wire(kg)\n", + "l=300; #length of the wire(m)\n", + "lamda = 0.30; #Wavelength of wave along wire(m)\n", + "\n", + "#Calculation\n", + "m = M/l; #Mass per unit length of the wire(kg/m)\n", + "v = math.sqrt(T/m); #Velocity of wave through wire(m/s)\n", + "v=math.ceil(v*100)/100; #rounding off to 2 decimals\n", + "new = v/lamda; #Frequency of wave through string(Hz)\n", + "new=math.ceil(new*100)/100; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print \"The velocity of the wave through wire is\",v, \"m/s\"\n", + "print \"The frequency of the wave through wire is\",new, \"Hz\"\n", + "\n", + "#answer for frequency of the wave is wrong in the textbook" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The velocity of the wave through wire is 141.43 m/s\n", + "The frequency of the wave through wire is 471.44 Hz\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter2_1-checkpoint.ipynb b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter2_1-checkpoint.ipynb new file mode 100644 index 00000000..fdbf44b5 --- /dev/null +++ b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter2_1-checkpoint.ipynb @@ -0,0 +1,248 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:de195a4faed398c9714bc27769421926f24c448f7ad7f1d4cb04dd3cfbb18334" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "2: Electromagnetic Theory" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.1, Page number 46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "from __future__ import division\n", + "from sympy import *\n", + "import math\n", + "\n", + "#Variable declaration\n", + "C = 10; #Capacitance of the capacitor(pF)\n", + "#given V=0.2*sin(120*math.pi*t) in volts\n", + "\n", + "#Calculation\n", + "C=C*10**-12; #Capacitance of the capacitor(F)\n", + "x, y, z, t = symbols('x y z t')\n", + "k, m, n = symbols('k m n', integer=True)\n", + "f, g, h = symbols('f g h', cls=Function)\n", + "#I = C*dV/dt\n", + "#let dV/dt be a\n", + "a=diff(0.2*sin(120*math.pi*t),t) #dV/dt\n", + "#value of dV/dt is 75.398223686155*cos(376.991118430775*t)\n", + "#for cosine function peak value occurs when 120*math.pi*t = 0\n", + "#therefore value of dV/dt becomes d = 75.398223686155\n", + "d = 75.398223686155; #value of dV/dt \n", + "I=C*d; #displacement current(A)\n", + "\n", + "#Result\n", + "print \"value of dV/dt is\",a\n", + "print \"displacement current is\",I, \"A\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "value of dV/dt is 75.398223686155*cos(376.991118430775*t)\n", + "displacement current is 7.53982236862e-10 A\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.2, Page number 46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "from __future__ import division\n", + "from sympy import *\n", + "import math\n", + "\n", + "#Variable declaration\n", + "epsilon_r = 1; #Relative electrical permittivity of free space\n", + "epsilon_0 = 8.854*10**-12; #Absolute electrical permittivity of free space(F/m)\n", + "#given E=sin(120*math.pi*t) in volts\n", + "\n", + "#Calculation\n", + "x, y, z, t = symbols('x y z t')\n", + "k, m, n = symbols('k m n', integer=True)\n", + "f, g, h = symbols('f g h', cls=Function)\n", + "#J2 = epsilon*dE/dt\n", + "epsilon=epsilon_0*epsilon_r;\n", + "#let dE/dt be a\n", + "a=diff(sin(120*math.pi*t),t) #dE/dt\n", + "#value of dE/dt is 376.991118430775*cos(376.991118430775*t)\n", + "#for cosine function peak value occurs when 120*math.pi*t = 0\n", + "#therefore value of dE/dt becomes d = 376.991118430775\n", + "d = 376.991118430775; #value of dE/dt\n", + "J2=epsilon*d; #displacement current density(A/m**2)\n", + "\n", + "#Result\n", + "print \"value of dE/dt is\",a\n", + "print \"The peak value of displacement current density is\",J2, \"A/m**2\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "value of dE/dt is 376.991118430775*cos(376.991118430775*t)\n", + "The peak value of displacement current density is 3.33787936259e-09 A/m**2\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.3, Page number 47 (Theoritical proof)" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.4, Page number 47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "p = 60; #Power rating of bulb(W)\n", + "d = 0.5; #Distance from the bulb(m)\n", + "\n", + "#Calculation\n", + "A=4*math.pi*d**2; #area(m**2)\n", + "P = p/A; #Value of Poynting vector(W/m**2)\n", + "P = math.ceil(P*100)/100; #rounding off value of P to 1 decimal\n", + "\n", + "#Result\n", + "print \"The value of Poynting vector is\",P, \"W/m**2\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of Poynting vector is 19.1 W/m**2\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.5, Page number 47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "E_peak = 6; #Peak value of electric field intensity(V/m)\n", + "c = 3*10**8; #Speed of electromagnetic wave in free space(m/s)\n", + "mew_0 = 4*math.pi*10**-7; #Absolute permeability of free space(Tm/A)\n", + "epsilon_0 = 8.854*10**-12; #Absolute permittivity of free space(F/m)\n", + "mew_r = 1; #Relative permeability of medium\n", + "epsilon_r = 3; #Relative permittivity of the medium\n", + "\n", + "#Calculation\n", + "v = c/math.sqrt(mew_r*epsilon_r); #Wave velocity(m/s)\n", + "v = v/10**8;\n", + "v = math.ceil(v*10**4)/10**4; #rounding off the value of v to 4 decimals\n", + "eta = math.sqrt((mew_0/epsilon_0)*(mew_r/epsilon_r)); #Intrinsic impedance of the medium(ohm)\n", + "eta = math.ceil(eta*10)/10; #rounding off the value of v to 1 decimal\n", + "H_P = E_peak/eta; #Peak value of the magnetic intensity(A/m)\n", + "H_P = H_P*10**2;\n", + "H_P = math.ceil(H_P*10**2)/10**2; #rounding off the value of v to 2 decimals\n", + "\n", + "#Result\n", + "print \"The wave velocity is\",v,\"*10**8 m/s\"\n", + "print \"The intrinsic impedance of the medium is\",eta, \"ohm\"\n", + "print \"The peak value of the magnetic intensity is\",H_P,\"*10**-2 A/m\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The wave velocity is 1.7321 *10**8 m/s\n", + "The intrinsic impedance of the medium is 217.6 ohm\n", + "The peak value of the magnetic intensity is 2.76 *10**-2 A/m\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter3_1-checkpoint.ipynb b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter3_1-checkpoint.ipynb new file mode 100644 index 00000000..645d7595 --- /dev/null +++ b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter3_1-checkpoint.ipynb @@ -0,0 +1,476 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:bdc5e7b39dc3529751aa6372cd3db8b0870c9abab4c9b51855fb3bce7de6dc73" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "3: Interference" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.1, Page number 71" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "beta = 0.51; #Fringe width(mm)\n", + "d = 2.2; #Distance between the slits(mm)\n", + "D = 2; #Distance between the slits and the screen(m)\n", + "\n", + "#Calculation\n", + "beta = beta*10**-1; #Fringe width(cm)\n", + "d = d*10**-1; #Distance between the slits(cm)\n", + "D=D*10**2; #Distance between the slits and the screen(cm)\n", + "lamda = beta*d/D; #Wavelength of light(cm)\n", + "lamda = lamda*10**8; #Wavelength of light(A)\n", + "\n", + "#Result\n", + "print \"The wavelength of light is\",lamda, \"angstrom\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The wavelength of light is 5610.0 angstrom\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.2, Page number 71" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "lambda1 = 4250; #First wavelength emitted by source of light(A)\n", + "lambda2 = 5050; #Second wavelength emitted by source of light(A)\n", + "D = 1.5; #Distance between the source and the screen(m)\n", + "d = 0.025; #Distance between the slits(mm)\n", + "n = 3; #Number of fringe from the centre\n", + "\n", + "#Calculation\n", + "lambda1 = lambda1*10**-10; #First wavelength emitted(m)\n", + "lambda2 = lambda2*10**-10; #Second wavelength emitted(m)\n", + "d = d*10**-3; #Distance between the slits(m)\n", + "x3 = n*lambda1*D/d; #Position of third bright fringe due to lambda1(m)\n", + "x3_prime = n*lambda2*D/d; #Position of third bright fringe due to lambda2(m)\n", + "x = x3_prime-x3; #separation between the third bright fringe(m)\n", + "x = x*10**2; #separation between the third bright fringe(cm)\n", + "\n", + "#Result\n", + "print \"The separation between the third bright fringe due to the two wavelengths is\",x, \"cm\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The separation between the third bright fringe due to the two wavelengths is 1.44 cm\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.3, Page number 71" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "lamda = 5.5*10**-5; #Wavelength emitted by source of light(cm)\n", + "n = 4; #Number of fringes shifted\n", + "t = 3.9*10**-4; #Thickness of the thin glass sheet(cm)\n", + "\n", + "#Calculation\n", + "mew = (n*lamda/t)+1; #Refractive index of the sheet of glass\n", + "mew = math.ceil(mew*10**4)/10**4; #rounding off the value of v to 4 decimals\n", + "\n", + "#Result\n", + "print \"The refractive index of the sheet of glass is\",mew" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The refractive index of the sheet of glass is 1.5642\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.4, Page number 72" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "lamda = 5893; #Wavelength of monochromatic lihgt used(A)\n", + "n = 1; #Number of fringe for the least thickness of the film\n", + "cosr = 1; #for normal incidence\n", + "mew = 1.42; #refractive index of the soap film\n", + "\n", + "#Calculation\n", + "#As for constructive interference, \n", + "#2*mew*t*cos(r) = (2*n-1)*lambda/2, solving for t\n", + "t = (2*n-1)*lamda/(4*mew*cosr); #Thickness of the film that appears bright(A)\n", + "#As for destructive interference, \n", + "#2*mu*t*cos(r) = n*lambda, solving for t\n", + "t1 = n*lamda/(2*mew*cosr); #Thickness of the film that appears bright(A)\n", + "\n", + "#Result\n", + "print \"The thickness of the film that appears bright is\",t, \"angstrom\"\n", + "print \"The thickness of the film that appears dark is\",t1, \"angstrom\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The thickness of the film that appears bright is 1037.5 angstrom\n", + "The thickness of the film that appears dark is 2075.0 angstrom\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.5, Page number 72" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "lamda = 5893; #Wavelength of monochromatic lihgt used(A)\n", + "n = 10; #Number of fringe that are found \n", + "d = 1; #Distance of 10 fringes(cm)\n", + "\n", + "#Calculation\n", + "beta = d/n; #Fringe width(cm)\n", + "lamda = lamda*10**-8; #Wavelength of monochromatic lihgt used(cm)\n", + "theta = lamda/(2*beta); #Angle of the wedge(rad)\n", + "theta = theta*10**4;\n", + "theta = math.ceil(theta*10**4)/10**4; #rounding off the value of theta to 4 decimals\n", + "\n", + "#Result\n", + "print \"The angle of the wedge is\",theta,\"*10**-4 rad\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The angle of the wedge is 2.9465 *10**-4 rad\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.6, Page number 72" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "lamda = 5900; #Wavelength of monochromatic lihgt used(A)\n", + "t = 0.010; #Spacer thickness(mm)\n", + "l = 10; #Wedge length(cm)\n", + "\n", + "#Calculation\n", + "t = t*10**-1; #Spacer thickness(cm)\n", + "theta = t/l; #Angle of the wedge(rad)\n", + "lamda = lamda*10**-8; #Wavelength of monochromatic lihgt used(cm)\n", + "beta = lamda/(2*theta); #Fringe width(cm)\n", + "\n", + "#Result\n", + "print \"The separation between consecutive bright fringes is\",beta, \"cm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The separation between consecutive bright fringes is 0.295 cm\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.7, Page number 72" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "D4 = 0.4; #Diameter of 4th dark ring(cm)\n", + "D12 = 0.7; #Diameter of 12th dark ring(cm)\n", + "\n", + "#Calculation\n", + "#We have (dn_plus_k**2)-Dn**2 = 4*k*R*lamda\n", + "#D12**2-D4**2 = 32*R*lamda and D20**2-D12**2 = 32*R*lamda for k = 8\n", + "#since RHS are equal, by equating the LHS we get D12**2-D4**2 = D20**2-D12**2\n", + "D20 = math.sqrt((2*D12**2)-D4**2); #Diameter of 20th dark ring(cm)\n", + "D20 = math.ceil(D20*10**4)/10**4; #rounding off the value of D20 to 4 decimals\n", + "\n", + "#Result\n", + "print \"The diameter of 20th dark ring is\",D20, \"cm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The diameter of 20th dark ring is 0.9056 cm\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.8, Page number 73" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "Dn = 0.30; #Diameter of nth dark ring with air film(cm)\n", + "dn = 0.25; #Diameter of nth dark ring with liquid film(cm)\n", + "\n", + "#Calculation\n", + "mew = (Dn/dn)**2; #Refractive index of the liquid\n", + "\n", + "#Result\n", + "print \"The refractive index of the liquid is\", mew\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The refractive index of the liquid is 1.44\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.9, Page number 73" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "x = 0.002945; #Distance through which movable mirror is shifted(cm)\n", + "N = 100; #Number of fringes shifted\n", + "\n", + "#Calculation\n", + "x = x*10**-2; #Distance through which movable mirror is shifted(m)\n", + "lamda = 2*x/N; #Wavelength of light(m)\n", + "lamda = lamda*10**10; #Wavelength of light(A)\n", + "\n", + "#Result\n", + "print \"The wavelength of light is\",lamda, \"angstrom\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The wavelength of light is 5890.0 angstrom\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.10, Page number 73" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "lambda1 = 5896; #Wavelength of D1 line of sodium(A)\n", + "lambda2 = 5890; #Wavelength of D2 line of sodium(A)\n", + "\n", + "#Calculation\n", + "lamda = (lambda1+lambda2)/2;\n", + "x = (lamda**2)/(2*(lambda1-lambda2)); #Shift in movable mirror of Michelson Interferometer(A)\n", + "x = x*10**-7; #Shift in movable mirror of Michelson Interferometer(mm)\n", + "x = math.ceil(x*10**4)/10**4; #rounding off the value of D20 to 4 decimals\n", + "\n", + "#Result\n", + "print \"The shift in movable mirror is\",x, \"mm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The shift in movable mirror is 0.2894 mm\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter4_1-checkpoint.ipynb b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter4_1-checkpoint.ipynb new file mode 100644 index 00000000..cc3fca78 --- /dev/null +++ b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter4_1-checkpoint.ipynb @@ -0,0 +1,490 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:3ba769656e990801d788b85df0bb013daae3fbdec7e19bc6ba653a53dfdabcb2" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "4: Diffraction" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.1, Page number 91" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "D = 50; #Distance between source and the screen(cm)\n", + "lamda = 6563; #Wavelength of light of parallel rays(A)\n", + "d = 0.385; #Width of the slit(mm)\n", + "n1 = 1; #Order of diffraction for first minimum\n", + "n2 = 5; #Order of diffraction for fifth minimum\n", + "\n", + "#Calculation\n", + "lamda = lamda*10**-8; #Wavelength of light of parallel rays(cm)\n", + "d = d*10**-1; #Width of the slit(cm)\n", + "#As sin(theta1) = n*lambda/d = x1/D, solving for x1\n", + "x1 = n1*lamda*D/d; #Distance from the centre of the principal maximum to the first minimum(cm)\n", + "x1 = x1*10; #Distance from the centre of the principal maximum to the first minimum(mm)\n", + "x1 = math.ceil(x1*10**3)/10**3; #rounding off the value of x1 to 3 decimals\n", + "x2 = n2*lamda*D/d; #Distance from the centre of the principal maximum to the fifth minimum(cm)\n", + "x2 = x2*10; #Distance from the centre of the principal maximum to the fifth minimum(mm)\n", + "x2 = math.ceil(x2*10**3)/10**3; #rounding off the value of x2 to 3 decimals\n", + "\n", + "#Result\n", + "print \"The Distance from the centre of the principal maximum to the first minimum is\",x1, \"mm\"\n", + "print \"The Distance from the centre of the principal maximum to the fifth minimum is\",x2, \"mm\"\n", + "\n", + "#answer for x2 given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Distance from the centre of the principal maximum to the first minimum is 0.853 mm\n", + "The Distance from the centre of the principal maximum to the fifth minimum is 4.262 mm\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.2, Page number 91" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "D = 0.04; #Diameter of circular aperture(cm)\n", + "f = 20; #Focal length of convex lens(cm)\n", + "lamda = 6000; #Wavelength of light used(A)\n", + "\n", + "#Calculation\n", + "lamda = lamda*10**-8; #Wavelength of light used(cm)\n", + "#We have sin(theta) = 1.22*lambda/D = theta, for small theta\n", + "#For first dark ring\n", + "theta = 1.22*lamda/D; #The half angular width at central maximum(rad)\n", + "r1 = theta*f; #The half width of central maximum for first dark ring(cm)\n", + "r1 = r1*10**2;\n", + "#We have sin(theta) = 5.136*lambda/(%pi*D) = theta, for small theta\n", + "#For second dark ring\n", + "theta = 5.136*lamda/(math.pi*D); #The half angular width at central maximum(rad)\n", + "r2 = theta*f; #The half width of central maximum for second dark ring(cm)\n", + "r2 = r2*10**2;\n", + "r2 = math.ceil(r2*100)/100; #rounding off the value of r2 to 2 decimals\n", + "\n", + "#Result\n", + "print \"The radius of first dark ring is\",r1,\"*10**-2 cm\"\n", + "print \"The radius of second dark ring is\",r2,\"*10**-2 cm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The radius of first dark ring is 3.66 *10**-2 cm\n", + "The radius of second dark ring is 4.91 *10**-2 cm\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.3, Page number 92" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "n = 2; #Order of diffraction\n", + "lamda = 650; #Wavelength of light used(nm)\n", + "d = 1.2*10**-3; #Distance between two consecutive slits of grating(cm)\n", + "\n", + "#Calculation\n", + "#We have sin(theta) = n*N*lambda = n*lambda/d, solving for theta\n", + "lamda = lamda*10**-9; #Wavelength of light used(m)\n", + "d = d*10**-2; #Distance between two consecutive slits of grating(m)\n", + "a=n*lamda/d;\n", + "theta = math.asin(a); #Angle at which the 650 nm light produces a second order maximum(rad)\n", + "theta = theta*57.2957795; #angle in degrees\n", + "theta = math.ceil(theta*10**2)/10**2; #rounding off the value of theta to 2 decimals\n", + "\n", + "#Result\n", + "print \"The angle at which the light produces a second order maximum is\",theta, \"degrees\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The angle at which the light produces a second order maximum is 6.22 degrees\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.4, Page number 92" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "lamda = 650; #Wavelength of light used(nm)\n", + "N = 6000; #Number of lines per cm on grating\n", + "theta = 90; #Angle at which the highest spectral order is obtained(degrees)\n", + "\n", + "#Calculation\n", + "theta = theta*0.0174532925; #Angle at which the highest spectral order is obtained(rad)\n", + "#We have sin(theta) = n*N*lambda, solving for n\n", + "lamda = lamda*10**-9; #Wavelength of light used(m)\n", + "N = N*10**2; #Number of lines per m on grating\n", + "n = math.sin(theta)/(N*lamda); #The highest order of spectra with diffraction grating\n", + "n = math.ceil(n*10**3)/10**3; #rounding off the value of theta to 3 decimals\n", + "i,d = divmod(n, 1); #divides the value of n into integer and decimal parts where i is integer\n", + "\n", + "#Result\n", + "print \"value of n is\",n\n", + "print \"The highest order of spectra obtained with diffraction grating is\",i\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "value of n is 2.565\n", + "The highest order of spectra obtained with diffraction grating is 2.0\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.5, Page number 92" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "N = 4000; #Number of lines per cm on grating\n", + "#For Blue Line\n", + "lamda1 = 450; #Wavelength of blue light(nm)\n", + "n1 = 3; #Order of diffraction spectrum\n", + "#For Red Line\n", + "lamda2 = 700; #Wavelength of red light(nm)\n", + "n2 = 2; #Order of diffraction spectrum\n", + "\n", + "#Calculation\n", + "N = N*10**2; #Number of lines per m on grating\n", + "lamda1 = lamda1*10**-9; #Wavelength of blue light(m)\n", + "lamda2 = lamda2*10**-9; #Wavelength of red light(m)\n", + "#We have sin(theta) = n*N*lambda, solving for sin(theta)\n", + "sin_theta_3 = n1*N*lamda1; #Sine of angle at third order diffraction \n", + "sin_theta_2 = n2*N*lamda2; #Sine of angle at second order diffraction\n", + "\n", + "#Result\n", + "print \"Sine of angle at third order diffraction is\",sin_theta_3\n", + "print \"Sine of angle at second order diffraction is\",sin_theta_2 \n", + "#Check for overlapping\n", + "if (sin_theta_2-sin_theta_3)<0.05:\n", + " print \"The two orders overlap\"\n", + "else:\n", + " print \"The two orders do not overlap\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sine of angle at third order diffraction is 0.54\n", + "Sine of angle at second order diffraction is 0.56\n", + "The two orders overlap\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.6, Page number 93" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "n = 1; #Order of diffraction spectrum\n", + "N = 6000; #Number of lines per cm on diffraction grating\n", + "D = 2; #Distance of screen from the source(m)\n", + "lamda1 = 400; #Wavelength of blue light(nm)\n", + "lamda2 = 750; #Wavelength of blue light(nm)\n", + "\n", + "#Calculation\n", + "N = N*10**2; #Number of lines per m on grating\n", + "lamda1 = lamda1*10**-9; #Wavelength of blue light(m)\n", + "lamda2 = lamda2*10**-9; #Wavelength of blue light(m)\n", + "#We have sin(theta1) = n*N*lamda1, solving for theta1\n", + "theta1 = math.asin(n*N*lamda1); #Angle at first order diffraction for Blue light(rad)\n", + "theta1_d = theta1*57.2957795; #Angle at first order diffraction for Blue light(degrees)\n", + "theta2 = math.asin(n*N*lamda2); #Angle at first order diffraction for Red light(rad)\n", + "theta2_d = theta2*57.2957795; #Angle at first order diffraction for Red light(degrees)\n", + "x1 = D*math.tan(theta1); #Half width position at central maximum for blue color(m)\n", + "x2 = D*math.tan(theta2); #Half width position at central maximum for red color(m)\n", + "x = x2-x1; #width of first order spectrum on the screen(m)\n", + "x = x*10**2; #width of first order spectrum on the screen(cm)\n", + "x = math.ceil(x*10**2)/10**2; #rounding off the value of x to 2 decimals\n", + "\n", + "#Result\n", + "print \"The width of first order spectrum on the screen is\",x, \"cm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The width of first order spectrum on the screen is 51.34 cm\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.7, Page number 93" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "w = 5; #Width of the grating(cm)\n", + "N = 32; #Number of lines per mm on grating\n", + "lamda = 640; #Wavelength of light(nm)\n", + "n = 2; #Order of diffraction\n", + "\n", + "#Calculation\n", + "N= N*10; #Number of lines per cm on grating\n", + "N0 = w*N; #Total number of lines on the grating\n", + "d_lambda = lamda/(n*N0); #Separation between wavelengths(nm)\n", + "\n", + "#Result\n", + "print \"The separation between wavelengths which the grating can just resolve is\",d_lambda, \"nm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The separation between wavelengths which the grating can just resolve is 0.2 nm\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.8, Page number 93" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "lamda = 550; #Wavelength of light(nm)\n", + "D = 3.2; #Diameter of circular lens(cm)\n", + "f = 24; #Focal length of the lens(cm) \n", + "\n", + "#Calculation\n", + "lamda = lamda*10**-9; #Wavelength of light(m)\n", + "D = D*10**-2; #Diameter of circular lens(m)\n", + "theta_min = 1.22*lamda/D; #Minimum angle of resolution provided by the lens(rad)\n", + "#As delta_x/f = theta_min, solving for delta_x\n", + "f = f*10**-2; #Focal length of the lens(m) \n", + "delta_x = theta_min*f; #Separation of the centres of the images in the focal plane of lens(m)\n", + "delta_x = delta_x*10**6; #Separation of the centres of the images in the focal plane of lens(micro m)\n", + " \n", + "#Result\n", + "print \"The separation of the centres of the images in the focal plane is\",round(delta_x), \"micro-metre\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The separation of the centres of the images in the focal plane is 5.0 micro-metre\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.9, Page number 94" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "lamda = 550; #Wavelength of light(nm)\n", + "D = 20; #Diameter of objective of telescope(cm)\n", + "d = 6; #Distance of two points from the objective of telescope(km)\n", + "\n", + "#Calculation\n", + "lamda = lamda*10**-9; #Wavelength of light(m)\n", + "D = D*10**-2; #Diameter of objective of telescope(m)\n", + "d = d*10**3; #Distance of two points from the objective of telescope(m)\n", + "theta = 1.22*lamda/D; #Angular separation between two points(rad)\n", + "x = theta*d; #Linear separation between two points(m)\n", + "x = x*10**3; #Linear separation between two points(mm)\n", + "\n", + "#Result\n", + "print \"The linear separation between two points is\",x, \"mm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The linear separation between two points is 20.13 mm\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter5_1-checkpoint.ipynb b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter5_1-checkpoint.ipynb new file mode 100644 index 00000000..8b5822ee --- /dev/null +++ b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter5_1-checkpoint.ipynb @@ -0,0 +1,299 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:d6b4557b658267af4573aff55394c33f7ae58a19c1bc5291838cb933f306de2e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "5: Polarization" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 5.1, Page number 113" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "mew_g = 1.72; #Refractive index of glass\n", + "mew_w = 4/3; #Refractive index of water\n", + "\n", + "#Calculation\n", + "#For polarization to occur on flint glass, tan(i) = mew_g/mew_w\n", + "#Solving for i\n", + "i_g = math.atan(mew_g/mew_w); #angle of incidence for complete polarization for flint glass(rad)\n", + "a = 180/math.pi; #conversion factor from radians to degrees\n", + "i_g = i_g*a; #angle of incidence(degrees)\n", + "i_g = math.ceil(i_g*10**2)/10**2; #rounding off the value of i_g to 2 decimals\n", + "#For polarization to occur on water, tan(i) = mew_w/mew_g\n", + "#Solving for i\n", + "i_w = math.atan(mew_w/mew_g); #angle of incidence for complete polarization for water(rad)\n", + "i_w = i_w*a; #angle of incidence(degrees)\n", + "i_w = math.ceil(i_w*10**3)/10**3; #rounding off the value of i_w to 3 decimals\n", + "\n", + "#Result\n", + "print \"The angle of incidence for complete polarization to occur on flint glass is\",i_g, \"degrees\"\n", + "print \"The angle of incidence for complete polarization to occur on water is\",i_w, \"degrees\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The angle of incidence for complete polarization to occur on flint glass is 52.22 degrees\n", + "The angle of incidence for complete polarization to occur on water is 37.783 degrees\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 5.2, Page number 113" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "I0 = 1; #For simplicity, we assume the intensity of light falling on the second Nicol prism to be unity(W/m**2)\n", + "theta = 30; #Angle through which the crossed Nicol is rotated(degrees)\n", + "\n", + "#Calculation\n", + "theeta = 90-theta; #angle between the planes of transmission after rotating through 30 degrees\n", + "a = math.pi/180; #conversion factor from degrees to radians\n", + "theeta = theeta*a; ##angle between the planes of transmission(rad)\n", + "I = I0*math.cos(theeta)**2; #Intensity of the emerging light from second Nicol(W/m**2)\n", + "T = (I/(2*I0))*100; #Percentage transmission of incident light\n", + "T = math.ceil(T*100)/100; #rounding off the value of T to 2 decimals\n", + "\n", + "#Result\n", + "print \"The percentage transmission of incident light after emerging through the Nicol prism is\",T, \"%\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The percentage transmission of incident light after emerging through the Nicol prism is 12.51 %\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 5.3, Page number 113" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "lamda = 6000; #Wavelength of incident light(A)\n", + "mew_e = 1.55; #Refractive index of extraordinary ray\n", + "mew_o = 1.54; #Refractive index of ordinary ray\n", + "\n", + "#Calculation\n", + "lamda = lamda*10**-8; #Wavelength of incident light(cm)\n", + "t = lamda/(4*(mew_e-mew_o)); #Thickness of Quarter Wave plate of positive crystal(cm)\n", + "\n", + "#Result\n", + "print \"The thickness of Quarter Wave plate is\",t, \"cm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The thickness of Quarter Wave plate is 0.0015 cm\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 5.4, Page number 114" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Calculation\n", + "#the thickness of a half wave plate of calcite for wavelength lamda is\n", + "#t = lamda/(2*(mew_e - mew_o)) = (2*lamda)/(4*(mew_e - mew_o))\n", + "\n", + "#Result\n", + "print \"The half wave plate for lamda will behave as a quarter wave plate for 2*lamda for negligible variation of refractive index with wavelength\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The half wave plate for lamda will behave as a quarter wave plate for 2*lamda for negligible variation of refractive index with wavelength\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 5.5, Page number 114" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "lamda = 500; #Wavelength of incident light(nm)\n", + "mew_e = 1.5508; #Refractive index of extraordinary ray\n", + "mew_o = 1.5418; #Refractive index of ordinary ray\n", + "t = 0.032; #Thickness of quartz plate(mm)\n", + "\n", + "#Calculation\n", + "lamda = lamda*10**-9; #Wavelength of incident light(m)\n", + "t = t*10**-3; #Thickness of quartz plate(m)\n", + "dx = (mew_e - mew_o)*t; #Path difference between E-ray and O-ray(m)\n", + "dphi = (2*math.pi)/lamda*dx; #Phase retardation for quartz for given wavelength(rad)\n", + "dphi = dphi/math.pi;\n", + "\n", + "#Result\n", + "print \"The phase retardation for quartz for given wavelength is\",dphi, \"pi rad\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The phase retardation for quartz for given wavelength is 1.152 pi rad\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 5.6, Page number 114" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "C = 52; #Critical angle for total internal reflection(degrees)\n", + "\n", + "#Calculation\n", + "a = math.pi/180; #conversion factor from degrees to radians\n", + "C = C*a; #Critical angle for total internal reflection(rad)\n", + "#From Brewster's law, math.tan(i_B) = 1_mew_2\n", + "#Also math.sin(C) = 1_mew_2, so that math.tan(i_B) = math.sin(C), solving for i_B\n", + "i_B = math.atan(math.sin(C)); #Brewster angle at the boundary(rad)\n", + "b = 180/math.pi; #conversion factor from radians to degrees\n", + "i_B = i_B*b; #Brewster angle at the boundary(degrees)\n", + "\n", + "#Result\n", + "print \"The Brewster angle at the boundary between two materials is\",int(i_B), \"degrees\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Brewster angle at the boundary between two materials is 38 degrees\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 10 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter6_1-checkpoint.ipynb b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter6_1-checkpoint.ipynb new file mode 100644 index 00000000..0de10069 --- /dev/null +++ b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter6_1-checkpoint.ipynb @@ -0,0 +1,666 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:1812f754f8541ce5ac6b5aaa71f7eac9ff30ca728d742f618ea7c5d3873d8a96" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "6: Crystallography" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.1, Page number 134" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "M = 23+35.5; #Molecular weight of NaCl(kg/k-mole)\n", + "d = 2.18*10**3; #Density of rock salt(kg/m**3)\n", + "n = 4; #Number of atoms per unit cell for an fcc lattice of NaCl crystal\n", + "N = 6.02*10**26; #Avogadro's No., atoms/k-mol\n", + "\n", + "#Calculation\n", + "a = (n*M/(d*N))**(1/3); #Lattice constant of unit cell of NaCl(m)\n", + "a = a*10**9; ##Lattice constant of unit cell of NaCl(nm)\n", + "a = math.ceil(a*10**3)/10**3; #rounding off the value of a to 3 decimals\n", + "\n", + "#Result\n", + "print \"Lattice parameter for the NaCl crystal is\",a, \"nm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Lattice parameter for the NaCl crystal is 0.563 nm\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.2, Page number 134" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "m = 3;\n", + "n = 2; \n", + "p = 1; #Coefficients of intercepts along three axes\n", + "\n", + "#Calculation\n", + "#reciprocals of the intercepts are 1/m, 1/n, 1/p i.e 1/3, 1/2, 1\n", + "#multiplying by LCM the reciprocals become 2, 3, 6\n", + "\n", + "#Result\n", + "print \"The required miller indices are : (2, 3, 6)\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The required miller indices are : (2, 3, 6)\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.3, Page number 135" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "m = 2; #Coefficient of intercept along x-axis\n", + "#n = infinite Coefficient of intercept along y-axis\n", + "p = 3/2; #Coefficient of intercept along z-axis\n", + "\n", + "#Calculation\n", + "#reciprocals of the intercepts are 1/m, 1/n, 1/p i.e 1/2, 0, 2/3\n", + "#multiplying by LCM the reciprocals become 3, 0, 4\n", + "\n", + "#Result\n", + "print \"The required miller indices are : (3, 0, 4)\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The required miller indices are : (3, 0, 4)\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.4, Sketching not possible" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.5, Page number 136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "#For (110) planes\n", + "h1 = 1;\n", + "k1 = 1;\n", + "l1 = 0; #Miller Indices for planes in a cubic crystal\n", + "a1 = 0.43; #Interatomic spacing(nm)\n", + "#For (212) planes\n", + "h2 = 2; \n", + "k2 = 1;\n", + "l2 = 2; #Miller Indices for planes in a cubic crystal\n", + "a2 = 0.43; #Interatomic spacing(nm)\n", + "\n", + "#Calculation\n", + "d1 = a1/(h1**2+k1**2+l1**2)**(1/2); #The interplanar spacing for cubic crystals(nm)\n", + "d1 = math.ceil(d1*10**4)/10**4; #rounding off the value of d1 to 4 decimals\n", + "d2 = a2/(h2**2+k2**2+l2**2)**(1/2); #The interplanar spacing for cubic crystals(nm)\n", + "d2 = math.ceil(d2*10**4)/10**4; #rounding off the value of d2 to 4 decimals\n", + "\n", + "#Result\n", + "print \"The interplanar spacing between consecutive (110) planes is\",d1, \"nm\";\n", + "print \"The interplanar spacing between consecutive (212) planes is\",d2, \"nm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The interplanar spacing between consecutive (110) planes is 0.3041 nm\n", + "The interplanar spacing between consecutive (212) planes is 0.1434 nm\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.6, Page number 136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "h = 2;\n", + "k = 3;\n", + "l = 1; #Miller Indices for planes in a cubic crystal\n", + "r = 0.175; #Atomic radius of fcc lattice(nm)\n", + "\n", + "#Calculation\n", + "a = 2*math.sqrt(2)*r; #Interatomic spacing of fcc lattice(nm)\n", + "d = a/(h**2+k**2+l**2)**(1/2); #The interplanar spacing for cubic crystals(nm)\n", + "d = math.ceil(d*10**4)/10**4; #rounding off the value of d to 4 decimals\n", + "\n", + "#Result\n", + "print \"The interplanar spacing between consecutive (231) planes is\",d, \"nm\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The interplanar spacing between consecutive (231) planes is 0.1323 nm\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.7, Page number 136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "lamda = 1.44; #Wavelength of X-rays(A)\n", + "d = 2.8; #Interplanar spacing of rocksalt crystal(A)\n", + "n1 = 1; #For 1st Order diffraction\n", + "n2 = 2; #For 2nd Order diffraction\n", + "\n", + "#Calculation\n", + "theta1 = math.asin(n1*lamda/(2*d)); #Angle of diffraction(radians)\n", + "theeta1 = theta1*57.2957795; #Angle of diffraction(degrees)\n", + "theeta1 = math.ceil(theeta1*10**2)/10**2; #rounding off the value of theeta1 to 2 decimals\n", + "theta2 = math.asin(n2*lamda/(2*d)); #Angle of diffraction(radians)\n", + "theeta2 = theta2*57.2957795; #Angle of diffraction(degrees)\n", + "theeta2 = math.ceil(theeta2*10**2)/10**2; #rounding off the value of theeta2 to 2 decimals\n", + "\n", + "#Result\n", + "print \"The angle of diffraction for first order maxima is\",theeta1, \"degrees\"\n", + "print \"The angle of diffraction for second order maxima is\",theeta2, \"degrees\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The angle of diffraction for first order maxima is 14.91 degrees\n", + "The angle of diffraction for second order maxima is 30.95 degrees\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.8, Page number 136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "a = 1; #For convenience, assume interatomic spacing to be unity(m)\n", + "\n", + "#Calculation\n", + "N = 8*(1/8) + 6*(1/2); #total number of spheres in a unit cell\n", + "r = a/(2*math.sqrt(2)); #The atomic radius(m)\n", + "V_atom = N*(4/3)*math.pi*r**3; #Volume of atoms(m**3)\n", + "V_uc = a**3; #Volume of unit cell(m**3)\n", + "PV = (V_atom/V_uc)*100; #percentage of actual volume\n", + "PV = math.ceil(PV*10)/10; #rounding off the value of PV to 1 decimal\n", + "\n", + "#Result\n", + "print \"The percentage of actual volume occupied by the spheres in fcc structure is\",PV, \"percent\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The percentage of actual volume occupied by the spheres in fcc structure is 74.1 percent\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.9, Page number 137" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "#For (221) planes\n", + "h = 2; \n", + "k = 2; \n", + "l = 1; #Miller Indices for planes in a cubic crystal\n", + "a = 2.68; #Interatomic spacing(A)\n", + "n1 = 1; #First Order of diffraction \n", + "n2 = 2; #Second order of diffraction\n", + "theta1 = 8.5; #Glancing angle at which Bragg's reflection occurs(degrees)\n", + "\n", + "#Calculation\n", + "theta1 = theta1*0.0174532925; #Glancing angle at which Bragg's reflection occurs(radians)\n", + "a = a*10**-10; #Interatomic spacing(m)\n", + "d = a/(h**2+k**2+l**2)**(1/2); #The interplanar spacing for cubic crystal(m)\n", + "lamda = 2*d*math.sin(theta1)/n1; #Bragg's Law for wavelength of X-rays(m)\n", + "lamda_A = lamda*10**10; #Bragg's Law for wavelength of X-rays(A)\n", + "lamda_A = math.ceil(lamda_A*10**4)/10**4; #rounding off the value of lamda_A to 4 decimals\n", + "theta2 = math.asin(n2*lamda/(2*d)); #Angle at which second order Bragg reflection occurs(radians)\n", + "theta2 = theta2*57.2957795; #Angle at which second order Bragg reflection occurs(degrees)\n", + "theta2 = math.ceil(theta2*10)/10; #rounding off the value of theta2 to 1 decimal\n", + "\n", + "#Result\n", + "print \"The interplanar spacing between consecutive (221) planes is\",d, \"m\"\n", + "print \"The wavelength of X-rays is\",lamda_A, \"angstrom\"\n", + "print \"The angle at which second order Bragg reflection occurs is\",theta2, \"degrees\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The interplanar spacing between consecutive (221) planes is 8.93333333333e-11 m\n", + "The wavelength of X-rays is 0.2641 angstrom\n", + "The angle at which second order Bragg reflection occurs is 17.2 degrees\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.10, Page number 137" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "h = 1; \n", + "k = 1;\n", + "l = 0; #Miller Indices for planes in a cubic crystal\n", + "n = 1; #First Order of diffraction \n", + "theta = 25; #Glancing angle at which Bragg's reflection occurs(degrees)\n", + "lamda = 0.7; #Wavelength of X-rays(A)\n", + "\n", + "#Calculation\n", + "theta = theta*0.0174532925; #Glancing angle at which Bragg's reflection occurs(radians)\n", + "d = n*lamda/(2*math.sin(theta)); #Interplanar spacing of cubic crystal(A)\n", + "a = d*(h**2+k**2+l**2)**(1/2); #The lattice parameter for cubic crystal(A)\n", + "a = math.ceil(a*10**3)/10**3; #rounding off the value of a to 3 decimals\n", + "\n", + "#Result\n", + "print \"The lattice parameter for cubic crystal is\",a, \"angstrom\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The lattice parameter for cubic crystal is 1.172 angstrom\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.11, Page number 138" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "d = 0.31; #Interplanar spacing(nm)\n", + "n = 1; #First Order of diffraction \n", + "theta = 9.25; #Glancing angle at which Bragg's reflection occurs(degrees)\n", + "theta_max = 90; #Maximum possible angle at which reflection can occur(degrees)\n", + "theta_max = theta_max*0.0174532925; #Maximum possible angle at which reflection can occur(radians)\n", + "\n", + "#Calculation\n", + "theta = theta*0.0174532925; #Glancing angle at which Bragg's reflection occurs(radians)\n", + "lamda = 2*d*math.sin(theta)/n; #Wavelength of X-rays(nm) (Bragg's Law)\n", + "lamda = math.ceil(lamda*10**5)/10**5; #rounding off the value of lamda to 5 decimals\n", + "n = 2*d*math.sin(theta_max)/lamda; #Maximum possible order of diffraction\n", + "\n", + "#Result\n", + "print \"The wavelength of X-rays is\",lamda, \"nm\"\n", + "print \"The Maximum possible order of diffraction is\",round(n)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The wavelength of X-rays is 0.09967 nm\n", + "The Maximum possible order of diffraction is 6.0\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.12, Page number 138" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "#For (110) planes\n", + "h1 = 1;\n", + "k1 = 1;\n", + "l1 = 0; #Miller indices for (110) planes\n", + "d_110 = 0.195; #Interplanar spacing between (110) planes(nm)\n", + "#For (210) planes\n", + "h2 = 2;\n", + "k2 = 1; \n", + "l2 = 0; #Miller indices for (110) planes\n", + "n = 2; #Second Order of diffraction \n", + "lamda = 0.071; #Wavelength of X-rays(nm)\n", + "\n", + "#Calculation\n", + "a = d_110*(h1**2 + k1**2 + l1**2)**(1/2); #Lattice parameter for bcc crystal(nm)\n", + "d_210 = a/(h2**2 + k2**2 + l2**2)**(1/2); #Interplanar spacing between (210) planes(nm)\n", + "theta = math.asin(n*lamda/(2*d_210)); #Bragg reflection angle for the second order diffraction(radians)\n", + "theeta = theta*57.2957795; #Bragg reflection angle for the second order diffraction(degrees)\n", + "theeta = math.ceil(theeta*10**3)/10**3; #rounding off the value of theeta to 3 decimals\n", + "\n", + "#Result\n", + "print \"Bragg reflection angle for the second order diffraction is\",theeta, \"degrees\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Bragg reflection angle for the second order diffraction is 35.149 degrees\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.13, Page number 138" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "d = 2182; #Density of rock salt(kg/m**3)\n", + "n = 4; #Number of atoms per unit cell for an fcc lattice of NaCl crystal\n", + "N = 6.02*10**26; #Avogadro's number(atoms/k-mol)\n", + "\n", + "#Calculation\n", + "M = 23+35.5; #Molecular weight of NaCl(kg/k-mole)\n", + "#V = a^3 = M*n/(N*d)\n", + "a = (n*M/(d*N))**(1/3); #Lattice constant of unit cell of NaCl(m)\n", + "D = a/2; #distance between nearest neighbours(m)\n", + "D = D*10**9; #distance between nearest neighbours(nm)\n", + "D = math.ceil(D*10**4)/10**4; #rounding off the value of D to 4 decimals\n", + "\n", + "#Result\n", + "print \"The distance between nearest neighbours of NaCl structure is\",D, \"nm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The distance between nearest neighbours of NaCl structure is 0.2814 nm\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.14, Page number 139" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "r1 = 1.258; #Atomic radius of bcc structure of iron(A)\n", + "N1 = 2; #Number of atoms per unit cell in bcc structure\n", + "#For fcc structure\n", + "r2 = 1.292; #Atomic radius of fcc structure of iron(A)\n", + "N2 = 4; #Number of atoms per unit cell in fcc structure\n", + "\n", + "#Calculation\n", + "a1 = 4*r1/math.sqrt(3); #Lattice parameter of bcc structure of iron(A)\n", + "V1 = a1**3; #Volume of bcc unit cell(A)\n", + "V_atom_bcc = V1/N1; #Volume occupied by one atom(A)\n", + "a2 = 2*math.sqrt(2)*r2; #Lattice parameter of fcc structure of iron(A)\n", + "V2 = a2**3; #Volume of fcc unit cell(A)\n", + "V_atom_fcc = V2/N2; #Volume occupied by one atom(A)\n", + "delta_V = (V_atom_bcc-V_atom_fcc)/V_atom_bcc*100; #Percentage change in volume due to structural change of iron\n", + "delta_V = math.ceil(delta_V*10**3)/10**3; #rounding off the value of delta_V to 3 decimals\n", + "\n", + "#Result\n", + "print \"The percentage change in volume of iron is\",delta_V, \"percent\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The percentage change in volume of iron is 0.494 percent\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter7_1-checkpoint.ipynb b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter7_1-checkpoint.ipynb new file mode 100644 index 00000000..750a9700 --- /dev/null +++ b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter7_1-checkpoint.ipynb @@ -0,0 +1,295 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:7388a73b9b3de996a0d87179cb12d51f5ad7f3cb764b14aa844019e8d2cdb4ea" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "7: Superconductivity" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.1, Page number 152" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "Tc=3.722; #critical temperature(K)\n", + "T=2; #temperature(K)\n", + "Bc_0=0.0305; #critical field(T)\n", + "\n", + "#Calculation\n", + "Bc_T=Bc_0*(1-(T/Tc)**2); #critical field at 2K(T)\n", + "Bc_T = math.ceil(Bc_T*10**4)/10**4; #rounding off the value of Bc_T to 4 decimals\n", + "\n", + "#Result\n", + "print \"The critical field at 2K is\",Bc_T, \"T\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The critical field at 2K is 0.0217 T\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.2, Page number 152" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "V = 1; #DC voltage applied across the Josephson junction(micro-volt)\n", + "e = 1.6*10**-19; #Charge on an electron(C)\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "\n", + "#Calculation\n", + "V = V*10**-6; #DC voltage applied across the Josephson junction(V)\n", + "f = 2*e*V/h; #Frequency of Josephson current(Hz)\n", + "f = f*10**-6; #Frequency of Josephson current(MHz)\n", + "f = math.ceil(f*10**2)/10**2; #rounding off the value of f to 2 decimals\n", + "\n", + "#Result\n", + "print \"The frequency of Josephson current is\",f, \"MHz\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The frequency of Josephson current is 482.95 MHz\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.3, Page number 152" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "`\n", + "\n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "T_c = 0.517; #Critical temperature for cadmium(K)\n", + "k = 1.38*10**-23; #Boltzmann constant(J/K)\n", + "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n", + "\n", + "#Calculation\n", + "E_g = 3.5*k*T_c/e; #Superconducting energy gap at absolute zero(eV)\n", + "E_g = E_g*10**4;\n", + "E_g = math.ceil(E_g*10**3)/10**3; #rounding off the value of E_g to 3 decimals\n", + "\n", + "#Result\n", + "print \"The superconducting energy gap for Cd at absolute zero is\",E_g,\"*10**-4 eV\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The superconducting energy gap for Cd at absolute zero is 1.561 *10**-4 eV\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.4, Page number 152" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n", + "c = 3*10**8; #Speed of light in free space(m/s)\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "E_g = 1.5*10**-4; #Superconducting energy gap for a material(eV)\n", + "\n", + "#Calculation\n", + "#As E_g = h*new = h*c/lamda, solving for lambda\n", + "lamda = h*c/(E_g*e); #Wavelength of photon to break up a Cooper-pair(m)\n", + "lamda = lamda*10**3;\n", + "lamda = math.ceil(lamda*10**3)/10**3; #rounding off the value of lamda to 3 decimals\n", + "\n", + "#Result\n", + "print \"The wavelength of photon to break up a Cooper-pair is\",lamda,\"*10**-3 m\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The wavelength of photon to break up a Cooper-pair is 8.283 *10**-3 m\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.5, Page number 153" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "lambda_0 = 37; #Penetration depth of lead at 0 kelvin(nm)\n", + "T_c = 7.193; #Critical temperature of superconducting transition for lead(kelvin)\n", + "T = 5.2; #Temperature at which penetration depth for lead becomes lambda_T(kelvin) \n", + "\n", + "#Calculation\n", + "lambda_T = lambda_0*(1-(T/T_c)**4)**(-1/2); #Penetration depth of lead at 5.2 kelvin(nm)\n", + "lambda_T = math.ceil(lambda_T*10)/10; #rounding off the value of lamda_T to 1 decimal\n", + "\n", + "#Result\n", + "print \"The penetration depth of lead is\",lambda_T, \"nm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The penetration depth of lead is 43.4 nm\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.6, Page number 153" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "from __future__ import division\n", + "import math\n", + "\n", + "#Variable declaration\n", + "M1 = 199; #Mass of an isotope of mercury(amu)\n", + "T_C1 = 4.185; #Transition temperature of the isoptope of Hg(K)\n", + "T_C2 = 4.153; #Transition temperature of another isoptope of Hg(K)\n", + "alpha = 0.5; #Isotope coefficient\n", + "\n", + "#Calculation\n", + "M2 = M1*(T_C1/T_C2)**(1/alpha); #Mass of another isotope of mercury(amu)\n", + "M2 = math.ceil(M2*100)/100; #rounding off the value of M2 to 2 decimals\n", + "\n", + "#Result\n", + "print \"The mass of another isotope of mercury is\",M2, \"amu\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The mass of another isotope of mercury is 202.08 amu\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter8_1-checkpoint.ipynb b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter8_1-checkpoint.ipynb new file mode 100644 index 00000000..af1e48b4 --- /dev/null +++ b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter8_1-checkpoint.ipynb @@ -0,0 +1,664 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:1888e774039c89bc21625752ef2171fa6b8e8f5f67497ebbdba82729676e8946" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "8: Special Theory of Relativity" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.1, Page number 171" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "L_0 = 1; #For simplicity, we assume classical length to be unity(m)\n", + "c = 1; #For simplicity assume speed of light to be unity(m/s)\n", + "\n", + "#Calculation\n", + "L = (1-1/100)*L_0; #Relativistic length(m)\n", + "#Relativistic length contraction gives L = L_0*sqrt(1-v^2/c^2), solving for v\n", + "v = math.sqrt(1-(L/L_0)**2)*c; #Speed at which relativistic length is 1 percent of the classical length(m/s)\n", + "v = math.ceil(v*10**4)/10**4; #rounding off the value of v to 4 decimals\n", + "\n", + "#Result\n", + "print \"The speed at which relativistic length is 1 percent of the classical length is\",v, \"c\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The speed at which relativistic length is 1 percent of the classical length is 0.1411 c\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.2, Page number 171" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c = 1; #For simplicity assume speed of light to be unity(m/s)\n", + "delta_t = 5*10**-6; #Mean lifetime of particles as observed in the lab frame(s)\n", + "\n", + "#Calculation\n", + "v = 0.9*c; #Speed at which beam of particles travel(m/s)\n", + "delta_tau = delta_t*math.sqrt(1-(v/c)**2); #Proper lifetime of particle as per Time Dilation rule(s)\n", + "\n", + "#Result\n", + "print \"The proper lifetime of particle is\",delta_tau, \"s\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The proper lifetime of particle is 2.17944947177e-06 s\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.3, Page number 171. theoritical proof" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.4, Page number 172" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c = 1; #For simplicity assume speed of light to be unity(m/s)\n", + "\n", + "#Calculation\n", + "v = 0.6*c; #Speed with which the rocket leaves the earth(m/s)\n", + "u_prime = 0.9*c; #Relative speed of second rocket w.r.t. the first rocket(m/s)\n", + "u1 = (u_prime+v)/(1+(u_prime*v)/c**2); #Speed of second rocket for same direction of firing as per Velocity Addition Rule(m/s)\n", + "u1 = math.ceil(u1*10**4)/10**4; #rounding off the value of u1 to 4 decimals\n", + "u2 = (-u_prime+v)/(1-(u_prime*v)/c**2); #Speed of second rocket for opposite direction of firing as per Velocity Addition Rule(m/s)\n", + "u2 = math.ceil(u2*10**4)/10**4; #rounding off the value of u2 to 4 decimals\n", + "\n", + "#Result\n", + "print \"The speed of second rocket for same direction of firing is\",u1,\"c\"\n", + "print \"The speed of second rocket for opposite direction of firing is\",u2,\"c\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The speed of second rocket for same direction of firing is 0.9741 c\n", + "The speed of second rocket for opposite direction of firing is -0.6521 c\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.5, Page number 172" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c = 1; #For simplicity assume speed of light to be unity(m/s)\n", + "L0 = 1; #For simplicity assume length in spaceship's frame to be unity(m)\n", + "tau = 1; #Unit time in the spaceship's frame(s)\n", + "\n", + "#Calculation\n", + "L = 1/2*L0; #Length as observed on earth(m)\n", + "#Relativistic length contraction gives L = L_0*sqrt(1-v^2/c^2), solving for v\n", + "v = math.sqrt(1-(L/L0)**2)*c; #Speed at which length of spaceship is observed as half from the earth frame(m/s)\n", + "t = tau/math.sqrt(1-(v/c)**2); #Time dilation of the spaceship's unit time(s)\n", + "v = math.ceil(v*10**4)/10**4; #rounding off the value of v to 4 decimals\n", + "\n", + "#Result\n", + "print \"The speed at which length of spaceship is observed as half from the earth frame is\",v, \"c\"\n", + "print \"The time dilation of the spaceship unit time is\",t,\"delta_tau\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The speed at which length of spaceship is observed as half from the earth frame is 0.8661 c\n", + "The time dilation of the spaceship unit time is 2.0 delta_tau\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.6, Page number 172" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c = 3*10**8; #Speed of light in vacuum(m/s)\n", + "t1 = 2*10**-7; #Time for which first event occurs(s)\n", + "t2 = 3*10**-7; #Time for which second event occurs(s)\n", + "x1 = 10; #Position at which first event occurs(m)\n", + "x2 = 40; #Position at which second event occurs(m)\n", + "\n", + "#Calculation\n", + "v = 0.6*c; #Velocity with which S2 frame moves relative to S1 frame(m/s)\n", + "L_factor = 1/math.sqrt(1-(v/c)**2); #Lorentz factor\n", + "delta_t = L_factor*(t2 - t1)+L_factor*v/c**2*(x1 - x2); #Time difference between the events(s)\n", + "delta_x = L_factor*(x2 - x1)-L_factor*v*(t2 - t1); #Distance between the events(m)\n", + "\n", + "#Result\n", + "print \"The time difference between the events is\",delta_t, \"s\" \n", + "print \"The distance between the events is\",delta_x, \"m\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The time difference between the events is 5e-08 s\n", + "The distance between the events is 15.0 m\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.7, Page number 173" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c = 3*10**8; #Speed of light in vacuum(m/s)\n", + "tau = 2.6*10**-8; #Mean lifetime the particle in its own frame(s)\n", + "d = 20; #Distance which the unstable particle travels before decaying(m)\n", + "\n", + "#Calculation\n", + "#As t = d/v and also t = tau/sqrt(1-(v/c)^2), so that\n", + "#d/v = tau/sqrt(1-(v/c)^2), solving for v\n", + "v = math.sqrt(d**2/(tau**2+(d/c)**2)); #Speed of the unstable particle in lab frame(m/s)\n", + "v = v/10**8;\n", + "v = math.ceil(v*10)/10; #rounding off the value of v to 1 decimal\n", + "\n", + "#Result\n", + "print \"The speed of the unstable particle in lab frame is\",v,\"*10**8 m/s\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The speed of the unstable particle in lab frame is 2.8 *10**8 m/s\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.8, Page number 174" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c = 1; #For simplicity assume speed of light to be unity(m/s)\n", + "me = 1; #For simplicity assume mass of electron to be unity(kg)\n", + "tau = 2.3*10**-6; #Average lifetime of mu-meson in rest frame(s)\n", + "t = 6.9*10**-6; #Average lifetime of mu-meson in laboratory frame(s)\n", + "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n", + "C = 3*10**8; #Speed of light in vacuum(m/s)\n", + "m_e = 9.1*10**-31; #Mass of an electron(kg)\n", + "\n", + "#Calculation\n", + "#Fromm Time Dilation Rule, tau = t*sqrt(1-(v/c)^2), solving for v\n", + "v = c*math.sqrt(1-(tau/t)**2); #Speed of mu-meson in the laboratory frame(m/s)\n", + "v = math.ceil(v*10**5)/10**5; #rounding off the value of v to 5 decimals\n", + "m0 = 207*me; #Rest mass of mu-meson(kg)\n", + "m = m0/math.sqrt(1-(v/c)**2); #Relativistic variation of mass with velocity(kg)\n", + "m = math.ceil(m*10)/10; #rounding off the value of m to 1 decimal\n", + "T = (m*m_e*C**2 - m0*m_e*C**2)/e; #Kinetic energy of mu-meson(eV)\n", + "T = T*10**-6; #Kinetic energy of mu-meson(MeV)\n", + "T = math.ceil(T*100)/100; #rounding off the value of T to 2 decimals\n", + " \n", + "#Result\n", + "print \"The speed of mu-meson in the laboratory frame is\",v, \"c\"\n", + "print \"The effective mass of mu-meson is\",m, \"me\"\n", + "print \"The kinetic energy of mu-meson is\",T, \"MeV\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The speed of mu-meson in the laboratory frame is 0.94281 c\n", + "The effective mass of mu-meson is 621.1 me\n", + "The kinetic energy of mu-meson is 211.97 MeV\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.9, Page number 174" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c = 1; #For simplicity assume speed of light to be unity(m/s)\n", + "m0 = 1; #For simplicity assume rest mass to be unity(kg)\n", + "\n", + "#Calculation\n", + "m = (20/100+1)*m0; #Mass in motion(kg)\n", + "#As m = m0/sqrt(1-(u/c)^2), solving for u\n", + "u = math.sqrt(1-(m0/m)**2)*c; #Speed of moving mass(m/s) \n", + "u = math.ceil(u*10**3)/10**3; #rounding off the value of u to 3 decimals\n", + "\n", + "#Result\n", + "print \"The speed of moving body is\",u, \"c\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The speed of moving body is 0.553 c\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.10, Page number 175" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c = 3*10**8; #Speed of light in vacuum(m/s)\n", + "dE = 4*10**26; #Energy radiated per second my the sun(J/s)\n", + "\n", + "#Calculation\n", + "dm = dE/c**2; #Rate of decrease of mass of sun(kg/s)\n", + "dm = dm/10**9;\n", + "dm = math.ceil(dm*10**3)/10**3; #rounding off the value of dm to 3 decimals\n", + "\n", + "#Result\n", + "print \"The rate of decrease of mass of sun is\",dm,\"*10**9 kg/s\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The rate of decrease of mass of sun is 4.445 *10**9 kg/s\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.11, Page number 175" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c = 1; #For simplicity assume speed of light to be unity(m/s)\n", + "m0 = 9.1*10**-31; #Mass of the electron(kg)\n", + "E0 = 0.512; #Rest energy of electron(MeV)\n", + "T = 10; #Kinetic energy of electron(MeV)\n", + "\n", + "#Calculation\n", + "E = T + E0; #Total energy of electron(MeV)\n", + "# From Relativistic mass-energy relation E^2 = c^2*p^2 + m0^2*c^4, solving for p\n", + "p = math.sqrt(E**2-m0**2*c**4)/c; #Momentum of the electron(MeV)\n", + "p = math.ceil(p*100)/100; #rounding off the value of p to 2 decimals\n", + "#As E = E0/sqrt(1-(u/c)^2), solving for u\n", + "u = math.sqrt(1-(E0/E)**2)*c; #Velocity of the electron(m/s)\n", + "u = math.ceil(u*10**4)/10**4; #rounding off the value of u to 4 decimals\n", + "\n", + "#Result\n", + "print \"The momentum of the electron is\",p,\"/c MeV\"\n", + "print \"The velocity of the electron is\",u, \"c\"\n", + "\n", + "#answer for velocity given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The momentum of the electron is 10.52 /c MeV\n", + "The velocity of the electron is 0.9989 c\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.12, Page number 175. theoritical proof" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.13, Page number 176" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c = 3*10**8; #Speed of light in vacuum(m/s)\n", + "E = 4.5*10**17; #Total energy of object(J)\n", + "px = 3.8*10**8; #X-component of momentum(kg-m/s)\n", + "py = 3*10**8; #Y-component of momentum(kg-m/s)\n", + "pz = 3*10**8; #Z-component of momentum(kg-m/s)\n", + "\n", + "#Calculation\n", + "p = math.sqrt(px**2+py**2+pz**2); #Total momentum of the object(kg-m/s)\n", + "#From Relativistic mass-energy relation E^2 = c^2*p^2 + m0^2*c^4, solving for m0\n", + "m0 = math.sqrt(E**2/c**4 - p**2/c**2); #Rest mass of the body(kg)\n", + "m0 = math.ceil(m0*100)/100; #rounding off the value of m0 to 2 decimals\n", + "\n", + "#Result\n", + "print \"The rest mass of the body is\",m0, \"kg\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The rest mass of the body is 4.63 kg\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.14, Page number 176" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c = 3*10**8; #Speed of light in vacuum(m/s)\n", + "m = 50000; #Mass of high speed probe(kg)\n", + "\n", + "#Calculation\n", + "u = 0.8*c; #Speed of the probe(m/s)\n", + "p = m*u/math.sqrt(1-(u/c)**2); #Momentum of the probe(kg-m/s)\n", + "\n", + "#Result\n", + "print \"The momentum of the high speed probe is\",p, \"kg-m/s\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The momentum of the high speed probe is 2e+13 kg-m/s\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.15, Page number 177" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "e = 1.6*10**-19; #Electronic charge, C = Energy equivalent of 1 eV(J/eV)\n", + "m0 = 9.11*10**-31; #Rest mass of electron(kg)\n", + "c = 3*10**8; #Speed of light in vacuum(m/s)\n", + "\n", + "#Calculation\n", + "u1 = 0.98*c; #Inital speed of electron(m/s)\n", + "u2 = 0.99*c; #Final speed of electron(m/s)\n", + "m1 = m0/math.sqrt(1-(u1/c)**2); #Initial relativistic mass of electron(kg)\n", + "m2 = m0/math.sqrt(1-(u2/c)**2); #Final relativistic mass of electron(kg)\n", + "dm = m2 - m1; #Change in relativistic mass of the electron(kg)\n", + "W = dm*c**2/e; #Work done on the electron to change its velocity(eV)\n", + "W = W*10**-6; #Work done on the electron to change its velocity(MeV)\n", + "W = math.ceil(W*100)/100; #rounding off the value of W to 2 decimals\n", + "#As W = eV, V = accelerating potential, solving for V\n", + "V = W*10**6; #Accelerating potential(volt)\n", + "V = V/10**6;\n", + "\n", + "#Result\n", + "print \"The change in relativistic mass of the electron is\",dm, \"kg\"\n", + "print \"The work done on the electron to change its velocity is\",W, \"MeV\"\n", + "print \"The accelerating potential is\",V, \"*10**6 volt\"\n", + "\n", + "#answers given in the book are wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The change in relativistic mass of the electron is 1.87996052912e-30 kg\n", + "The work done on the electron to change its velocity is 1.06 MeV\n", + "The accelerating potential is 1.06 *10**6 volt\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter9_1-checkpoint.ipynb b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter9_1-checkpoint.ipynb new file mode 100644 index 00000000..af5adbcc --- /dev/null +++ b/Engineering_Physics_Aruldhas/.ipynb_checkpoints/Chapter9_1-checkpoint.ipynb @@ -0,0 +1,363 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:d58e11c98e937b7ff914fc9567035f99fc6ab344053f332f140829887d0ef6cc" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "9: Quantum Mechanics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.1, Page number 202" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "V = 100; #Accelerating potential for electron(volt)\n", + "\n", + "#Calculation\n", + "lamda = math.sqrt(150/V)*10**-10; #de-Broglie wavelength of electron(m)\n", + "\n", + "#Result\n", + "print \"The De-Broglie wavelength of electron is\",lamda, \"m\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The De-Broglie wavelength of electron is 1.22474487139e-10 m\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.2, Page number 203" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "m = 9.11*10**-31; #Mass of the electron(kg)\n", + "Ek = 10; #Kinetic energy of electron(eV)\n", + "\n", + "#Calculation\n", + "p = math.sqrt(2*m*Ek*e); #Momentum of the electron(kg-m/s)\n", + "lamda = h/p ; #de-Broglie wavelength of electron from De-Broglie relation(m)\n", + "lamda = lamda*10**9; #de-Broglie wavelength of electron from De-Broglie relation(nm)\n", + "lamda = math.ceil(lamda*10**2)/10**2; #rounding off the value of lamda to 2 decimals\n", + "\n", + "#Result\n", + "print \"The de-Broglie wavelength of electron is\",lamda, \"nm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The de-Broglie wavelength of electron is 0.39 nm\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.3, Page number 203. theoritical proof" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.4, Page number 203" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "m = 9.11*10**-31; #Mass of the electron(kg)\n", + "v = 1.1*10**6; #Speed of the electron(m/s)\n", + "pr = 0.1; #precision in percent\n", + "\n", + "#Calculation\n", + "p = m*v; #Momentum of the electron(kg-m/s)\n", + "dp = pr/100*p; #Uncertainty in momentum(kg-m/s)\n", + "h_bar = h/(2*math.pi); #Reduced Planck's constant(Js)\n", + "dx = h_bar/(2*dp); #Uncertainty in position(m)\n", + "\n", + "#Result\n", + "print \"The uncertainty in position of electron is\",dx, \"m\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The uncertainty in position of electron is 5.26175358211e-08 m\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.5, Page number 203" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "e = 1.6*10**-19; #Energy equivalent of 1 eV(J/eV)\n", + "h = 6.626*10**-34; #Planck's constant(Js)\n", + "dt = 10**-8; #Uncertainty in time(s)\n", + "\n", + "#Calculation\n", + "h_bar = h/(2*math.pi); #Reduced Planck's constant(Js)\n", + "dE = h_bar/(2*dt*e); #Uncertainty in energy of the excited state(m)\n", + "\n", + "#Result\n", + "print \"The uncertainty in energy of the excited state is\",dE, \"eV\"\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The uncertainty in energy of the excited state is 3.2955020404e-08 eV\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.6, Page number 204" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "c = 3*10**8; #Speed of light(m/s)\n", + "dt = 10**-8; #Average lifetime(s)\n", + "lamda = 400; #Wavelength of spectral line(nm)\n", + "\n", + "#Calculation\n", + "lamda = lamda*10**-9; #Wavelength of spectral line(m)\n", + "#From Heisenberg uncertainty principle,\n", + "#dE = h_bar/(2*dt) and also dE = h*c/lambda^2*d_lambda, which give\n", + "#h_bar/(2*dt) = h*c/lambda^2*d_lambda, solving for d_lambda\n", + "d_lamda = (lamda**2)/(4*math.pi*c*dt); #Width of spectral line(m)\n", + "\n", + "#Result\n", + "print \"The width of spectral line is\",d_lamda, \"m\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The width of spectral line is 4.24413181578e-15 m\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.7, Page number 204. theoritical proof" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.8, Page number 204. theoritical proof" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.9, Page number 205. theoritical proof" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.10, Page number 205. theoritical proof" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.11, Page number 205. theoritical proof" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.12, Page number 206. theoritical proof" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.13, Page number 206. theoritical proof " + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.14, Page number 207" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "from scipy.integrate import quad\n", + "\n", + "#Variable declaration\n", + "a = 2*10**-10; # Width of 1D box(m)\n", + "x1=0; # Position of first extreme of the box(m)\n", + "x2=1*10**-10; # Position of second extreme of the box(m)\n", + "\n", + "#Calculation\n", + "def intg(x):\n", + " return ((2/a)*(math.sin(2*math.pi*x/a))**2)\n", + "S=quad(intg,x1,x2)[0]\n", + "\n", + "#Result\n", + "print \"The probability of finding the electron between x = 0 and x = 10**-10 is\",S" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The probability of finding the electron between x = 0 and x = 10**-10 is 0.5\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_1-checkpoint.ipynb b/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_1-checkpoint.ipynb new file mode 100644 index 00000000..7a32a75c --- /dev/null +++ b/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_1-checkpoint.ipynb @@ -0,0 +1,267 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:f0147baa6539dde2e5e40854d7e8ae89584d608f2c37adec57bbfd3463f15381" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 1 :Ultrasonics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.1, Page number 28 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "t=0.15*10**-2; #thickness of the quartz crystal in m\n", + "Y=7.9*10**10; #young's modulus of quartz in N/m^2\n", + "rho=2650; #density of quartz in kg/m^3\n", + "\n", + "#Calculation\n", + "x=math.sqrt(Y/rho);\n", + "f=x/(2*t);\n", + "f=f*10**-6; #converting f from Hz to MHz\n", + "f=math.ceil(f*10**6)/10**6; #rounding off to 6 decimals\n", + "\n", + "#Result\n", + "print(\"fundamental frequency of vibration in MHz is\",f);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('fundamental frequency of vibration in MHz is', 1.819992)\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.2, Page number 28 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "t=1e-03; #thickness of the quartz crystal in m\n", + "Y=7.9*10**10; #young's modulus of quartz in N/m^2\n", + "rho=2650; #density of quartz in kg/m^3\n", + "\n", + "#Calculation\n", + "x=math.sqrt(Y/rho);\n", + "p1=1; #for fundamental frequency p=1\n", + "f1=(p1*x)/(2*t);\n", + "F1=f1/10**6;\n", + "F1=math.ceil(F1*10**5)/10**5; #rounding off to 5 decimals\n", + "f_1=f1*10**-6; #converting f1 from Hz to MHz\n", + "f_1=math.ceil(f_1*10**5)/10**5; #rounding off to 5 decimals\n", + "p2=2; #for first overtone p=2\n", + "f2=(p2*x)/(2*t);\n", + "F2=f2/10**6;\n", + "F2=math.ceil(F2*10**5)/10**5; #rounding off to 5 decimals\n", + "f_2=f2*10**-6; #converting f2 from Hz to MHz\n", + "f_2=math.ceil(f_2*10**5)/10**5; #rounding off to 5 decimals\n", + "\n", + "#Result\n", + "print(\"fundamental frequency in Hz is\",F1,\"*10**6\");\n", + "print(\"fundamental frequency in MHz is\",f_1);\n", + "print(\"frequency of the first overtone in Hz is\",F2,\"*10**6\");\n", + "print(\"frequency of the first overtone in MHz is\",f_2);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('fundamental frequency in Hz is', 2.72999, '*10**6')\n", + "('fundamental frequency in MHz is', 2.72999)\n", + "('frequency of the first overtone in Hz is', 5.45998, '*10**6')\n", + "('frequency of the first overtone in MHz is', 5.45998)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.3, Page number 29 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "lamda=589.3*10**-9; #wavelength of light in m\n", + "f=100*10**6; #frequency of ultrasonic transducer in Hz\n", + "n=1; #order of diffraction\n", + "theta=2.25; #angle of diffraction in degrees\n", + "theta=theta*0.0174532925; #converting degrees to radians\n", + "\n", + "#Calculation\n", + "d=(n*lamda)/(2*math.sin(theta));\n", + "d1=d*10**6; #converting d from m to micro m\n", + "lamda1=2*d;\n", + "v=f*lamda1;\n", + "v=math.ceil(v*100)/100; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"wavelength of ultrasonic wave in m is\",lamda1);\n", + "print(\"velocity of ultrasonic wave in m/sec\",int(v));" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('wavelength of ultrasonic wave in m is', 1.5010258944908707e-05)\n", + "('velocity of ultrasonic wave in m/sec', 1501)\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.4, Page number 29 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "f=2*10**6; #frequency of transducer in MHz\n", + "v=3; #speed of blood in m/s\n", + "c=800; #velocity of ultrasonic wave in m/s\n", + "theta=30; #angle of inclination in degrees\n", + "theta=theta*0.0174532925; #converting degrees to radians\n", + "\n", + "#Calculation\n", + "deltaf=(2*f*v*math.cos(theta))/c;\n", + "deltaf=deltaf*10**-6; #converting deltaf from Hz to MHz\n", + "deltaf=math.ceil(deltaf*10**6)/10**6; #rounding off to 6 decimals\n", + "\n", + "#Result\n", + "print(\"doppler shifted frequency in MHz is\",deltaf);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('doppler shifted frequency in MHz is', 0.012991)\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 1.5, Page number 30 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "Y=7.9*10**10; #young's modulus of quartz in N/m^2\n", + "rho=2650; #density of quartz in kg/m^3\n", + "\n", + "#Calculation\n", + "v=math.sqrt(Y/rho);\n", + "v=math.ceil(v*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"velocity of ultrasonic waves in m/s is\",v);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('velocity of ultrasonic waves in m/s is', 5459.975)\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_10-checkpoint.ipynb b/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_10-checkpoint.ipynb new file mode 100644 index 00000000..618b7220 --- /dev/null +++ b/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_10-checkpoint.ipynb @@ -0,0 +1,304 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:a68b800341d76942fca474468b85c38e8f1fda41ad54f08b7e2e15491366631f" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 10 :Magnetic materials" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 10.1, Page number 305" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "H=10**6; #magnetic field strength in A/m\n", + "chi=0.5*10**-5; #magnetic susceptibility\n", + "\n", + "#Calculation\n", + "mew0=4*math.pi*10**-7;\n", + "M=chi*H;\n", + "B=mew0*(M+H);\n", + "B=math.ceil(B*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"intensity of magnetisation in A/m is\",M);\n", + "print(\"flux density in Wb/m^2 is\",B);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('intensity of magnetisation in A/m is', 5.0)\n", + "('flux density in Wb/m^2 is', 1.257)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 10.2, Page number 306" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "A=6.022*10**23; #avagadro number\n", + "mew0=4*math.pi*10**-7;\n", + "w=58.7; #atomic weight of Ni\n", + "B=0.65; #saturation magnetic induction in Wb/m^2\n", + "rho=8906; #density in kg/m^3\n", + "\n", + "#Calculation\n", + "rho=rho*10**3; #converting into gm/m^3\n", + "N=(rho*A)/w;\n", + "mew_m=B/(N*mew0);\n", + "#mew_m/(9.27*10^-24) gives mew_m in mewB\n", + "mew_m=mew_m/(9.27*10**-24);\n", + "mew_m=math.ceil(mew_m*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"magnetic moment of Ni is\",mew_m,\"mew_b\");\n", + "#that is mew_m=0.61 mew_b" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('magnetic moment of Ni is', 0.611, 'mew_b')\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 10.3, Page number 306" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "mew_0=4*math.pi*10**-7;\n", + "H=1800; #magnetic field in A/m\n", + "phi=3*10**-5; #magnetic flux in Wb\n", + "A=0.2; #area of cross section in cm^2\n", + "\n", + "#Calculation\n", + "A=A*10**-4; #area in m^2\n", + "B=phi/A;\n", + "mew_r=B/(mew_0*H);\n", + "mew_r=math.ceil(mew_r*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"permeability of material is\",mew_r);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('permeability of material is', 663.146)\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 10.4, Page number 307" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "mew=18.4; #magnetic moment in mew_b\n", + "a=0.835; #lattice parameter in nm\n", + "\n", + "#Calculation\n", + "mew=mew*9.27*10**-24;\n", + "a=a*10**-9; #converting nm to m\n", + "V=a**3;\n", + "M=mew/V;\n", + "M=M/10**5;\n", + "M=math.ceil(M*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"saturation magnetisation in A/m is\",M,\"*10**5\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('saturation magnetisation in A/m is', 2.9299, '*10**5')\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 10.5, Page number 307" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "mew_0=4*math.pi*10**-7;\n", + "H=2*10**5; #magnetic field strength in A/m\n", + "mew_r=1.01; #relative permeability\n", + "\n", + "#Calculation\n", + "B=mew_0*mew_r*H;\n", + "B=math.ceil(B*10**5)/10**5; #rounding off to 3 decimals\n", + "M=(B/mew_0)-H;\n", + "M=math.ceil(M*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"magnetic flux density in Wb/m^2 is\",B);\n", + "print(\"magnetisation in A/m is\",M);\n", + "\n", + "#answer for magnetisation given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('magnetic flux density in Wb/m^2 is', 0.25385)\n", + "('magnetisation in A/m is', 2007.42)\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 10.6, Page number 307" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "mew_0=4*math.pi*10**-7;\n", + "H=500; #magnetic field strength in A/m\n", + "chi=1.2; #susceptibility\n", + "\n", + "#Calculation\n", + "M=chi*H;\n", + "B=mew_0*(M+H);\n", + "B=B*10**3;\n", + "B=math.ceil(B*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"magnetic flux density in Wb/m^2 is\",B,\"*10**-3\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('magnetic flux density in Wb/m^2 is', 1.3824, '*10**-3')\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_11-checkpoint.ipynb b/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_11-checkpoint.ipynb new file mode 100644 index 00000000..f109e616 --- /dev/null +++ b/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_11-checkpoint.ipynb @@ -0,0 +1,320 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:29a37b96820b0c567836cbf3c967420f2a26c61ad740e02e53681e54403a65e6" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 11:Dielectric materials" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 11.1, Page number 335" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "epsilon_0=8.854*10**-12;\n", + "A=10*10*10**-6; #area of capacitor in m^2\n", + "d=2*10**-3; #distance of seperation in m\n", + "C=10**-9; #capacitance in F\n", + "\n", + "#Calculation\n", + "epsilon_r=(C*d)/(epsilon_0*A);\n", + "epsilon_r=math.ceil(epsilon_r*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"dielectric constant of material is\",epsilon_r);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('dielectric constant of material is', 2258.87)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 11.2, Page number 335" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "epsilon_0=8.854*10**-12;\n", + "epsilon_r=1.0000684; #dielectric constant of He gas\n", + "N=2.7*10**25; #concentration of dipoles per m^3\n", + "\n", + "#Calculation\n", + "#alpha_e=P/(N*E) and P=epsilon_0(epsilon_r-1)*E\n", + "#therefore alpha_e=epsilon_0(epsilon_r-1)/N\n", + "alpha_e=(epsilon_0*(epsilon_r-1))/N;\n", + "\n", + "#Result\n", + "print(\"electronic polarizability of He gas in Fm^2 is\",alpha_e);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('electronic polarizability of He gas in Fm^2 is', 2.2430133333322991e-41)\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 11.3, Page number 336" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "epsilon_0=8.854*10**-12;\n", + "epsilon_r=6; #dielectric constant\n", + "E=100; #electric field intensity in V/m\n", + "\n", + "#Calculation\n", + "P=epsilon_0*(epsilon_r-1)*E;\n", + "\n", + "#Result\n", + "print(\"polarization in C/m^2 is\",P);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('polarization in C/m^2 is', 4.426999999999999e-09)\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 11.4, Page number 336" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "epsilon_0=8.854*10**-12;\n", + "R=0.158; #radius of Ne in nm\n", + "\n", + "#Calculation\n", + "R=R*10**-9; #converting nm to m\n", + "alpha_e=4*math.pi*epsilon_0*R**3;\n", + "\n", + "#Result\n", + "print(\"electronic polarizability in Fm^2 is\",alpha_e);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('electronic polarizability in Fm^2 is', 4.3885458748002144e-40)\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 11.5, Page number 336" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "epsilon_0=8.854*10**-12;\n", + "C=0.02; #capacitance in micro farad\n", + "epsilon_r=6; #dielectric constant\n", + "t=0.002; #thickness of mica in cm\n", + "d=0.002; #thickness of metal sheet in cm\n", + "\n", + "#Calculation\n", + "C=C*10**-6; #converting micro farad to farad\n", + "d=d*10**-2; #converting cm to m\n", + "A=(C*d)/(epsilon_0*epsilon_r);\n", + "A=A*10**3;\n", + "A=math.ceil(A*10**4)/10**4; #rounding off to 4 decimals\n", + "A1=A*10; #converting m**2 to cm**2\n", + "A1=math.ceil(A1*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"area of metal sheet in m^2 is\",A,\"*10**-3\");\n", + "print(\"area of metal sheet in cm^2 is\",A1);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('area of metal sheet in m^2 is', 7.5296, '*10**-3')\n", + "('area of metal sheet in cm^2 is', 75.296)\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 11.6, Page number 336" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "epsilon_0=8.854*10**-12;\n", + "E=1000; #electric field in V/m\n", + "P=4.3*10**-8; #polarization in C/m^2\n", + "\n", + "#Calculation\n", + "epsilon_r=(P/(E*epsilon_0)+1);\n", + "epsilon_r=math.ceil(epsilon_r*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"dielectric constant is\",epsilon_r);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('dielectric constant is', 5.8566)\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 11.7, Page number 337" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "epsilon_0=8.854*10**-12;\n", + "chi=4.94; #relative susceptibility\n", + "N=10**28; #number of dipoles per m^3\n", + "\n", + "#Calculation\n", + "#polarisation P=N*alpha*E and P=epsilon_0*chi*E. equate the two equations\n", + "#epsilon_0*chi*E=N*alpha*E\n", + "alpha=(epsilon_0*chi)/N;\n", + "\n", + "#Result\n", + "print(\"polarisability of material in F/m^2 is\",alpha);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('polarisability of material in F/m^2 is', 4.373876e-39)\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_12-checkpoint.ipynb b/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_12-checkpoint.ipynb new file mode 100644 index 00000000..a5eef828 --- /dev/null +++ b/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_12-checkpoint.ipynb @@ -0,0 +1,300 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:aaad955b88887698ca822516a176e0f135631494b60fc93691930e22559b08da" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 12 :Superconducting Materials" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 12.1, Page number 356" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "Tc=3.7; #critical temperature in K\n", + "H0=0.0306; #magnetic field in T\n", + "T=2; #temperature in K\n", + "\n", + "#Calculation\n", + "Hc=H0*(1-(T**2/Tc**2));\n", + "Hc=math.ceil(Hc*10**5)/10**5; #rounding off to 5 decimals\n", + "\n", + "#Result\n", + "print(\"critical field in T is\",Hc);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('critical field in T is', 0.02166)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 12.2, Page number 356" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "Tc=7.26; #critical temperature in K\n", + "H0=6.4*10**3; #magnetic field in T\n", + "T=5; #temperature in K\n", + "\n", + "#Calculation\n", + "Hc=H0*(1-(T**2/Tc**2));\n", + "Hc=math.ceil(Hc*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"critical field in T is\",Hc);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('critical field in T is', 3364.385)\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 12.3, Page number 357" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "Tc1=4.185; #critical temperature in K\n", + "M1=199.5; #atomic mass\n", + "M2=203.4; #atomic mass after changing\n", + "\n", + "#Calculation\n", + "#according to maxwell equation Tc*M^0.5=constant\n", + "#Tc1*M1^0.5=Tc2*M2^0.5\n", + "Tc2=(Tc1*M1**0.5)/M2**0.5;\n", + "Tc2=math.ceil(Tc2*10**6)/10**6; #rounding off to 6 decimals\n", + "\n", + "#Result\n", + "print(\"critical temperature of Hg in K is\",Tc2);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('critical temperature of Hg in K is', 4.144685)\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 12.4, Page number 357" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "d=1; #diameter of wire in mm\n", + "T=4.2; #temperature in K\n", + "Tc=7.18; #critical temperature in K\n", + "H0=6.5*10**4; #magnetic field\n", + "\n", + "#Calculation\n", + "d=d*10**-3; #diameter in m\n", + "R=d/2;\n", + "Hc=H0*(1-(T**2/Tc**2));\n", + "HC=Hc/10**4;\n", + "HC=math.ceil(HC*10**3)/10**3; #rounding off to 2 decimals\n", + "Ic=2*math.pi*R*Hc;\n", + "Ic=math.ceil(Ic*10**2)/10**2; #rounding off to 2 decimals\n", + "A=math.pi*R**2;\n", + "J=Ic/A;\n", + "J=J/10**8;\n", + "J=math.ceil(J*10**5)/10**5; #rounding off to 5 decimals\n", + "\n", + "#Result\n", + "print(\"critical magnetic field at 4.2K in A/m is\",HC,\"*10**4\");\n", + "print(\"critical current in A is\",Ic);\n", + "print(\"critical current density in A/m^2 is\",J,\"*10**8\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('critical magnetic field at 4.2K in A/m is', 4.276, '*10**4')\n", + "('critical current in A is', 134.33)\n", + "('critical current density in A/m^2 is', 1.71035, '*10**8')\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 12.5, Page number 358" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "e=1.6*10**-19;\n", + "h=6.626*10**-34;\n", + "V=6; #voltage applied in micro volts\n", + "\n", + "#Calculation\n", + "V=V*10**-6; #converting micro volts to volts\n", + "new=(2*e*V)/h;\n", + "new=new/10**9;\n", + "new=math.ceil(new*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"frequency of ac signal in Hz is\",new,\"*10**9\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('frequency of ac signal in Hz is', 2.8977, '*10**9')\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 12.6, Page number 358" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "Kb=1.38*10**-23;\n", + "Tc=7.19; #critical temperature in K\n", + "\n", + "#Calculation\n", + "Eg=3.5*Kb*Tc;\n", + "Eg=Eg/(1.6*10**-19); #converting J to eV\n", + "Eg=Eg*10**3; #converting eV into milli eV\n", + "Eg=math.ceil(Eg*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"band gap of superconducting lead in meV is\",Eg);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('band gap of superconducting lead in meV is', 2.171)\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_2-checkpoint.ipynb b/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_2-checkpoint.ipynb new file mode 100644 index 00000000..08340d6b --- /dev/null +++ b/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_2-checkpoint.ipynb @@ -0,0 +1,476 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:2d233920f46d8faa184807b46855786207cc4bf2ef3d7d948f12d38b4c41e9ee" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 2:Laser" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.1, Page number 59 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "h=6.626*10**-34;\n", + "c=3*10**8;\n", + "lamda=632.8*10**-9; #wavelength in m\n", + "P=5*10**-3; #output power in W\n", + "\n", + "#Calculation\n", + "E=(h*c)/lamda; #energy of one photon\n", + "E_eV=E/(1.6*10**-19); #converting J to eV\n", + "E_eV=math.ceil(E_eV*1000)/1000; #rounding off to 3 decimals\n", + "N=P/E; #number of photons emitted\n", + "\n", + "\n", + "#Result\n", + "print(\"energy of one photon in eV is\",E_eV);\n", + "print(\"number of photons emitted per second is\",N);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('energy of one photon in eV is', 1.964)\n", + "('number of photons emitted per second is', 1.5917094275077976e+16)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.2, Page number 60" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "h=6.626*10**-34;\n", + "c=3*10**8;\n", + "lamda=632.8*10**-9; #wavelength in m\n", + "\n", + "#Calculation\n", + "E=(h*c)/lamda; #energy of one photon\n", + "E_eV=E/(1.6*10**-19); #converting J to eV\n", + "E_eV=math.ceil(E_eV*1000)/1000; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"energy of one photon in eV is\",E_eV);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('energy of one photon in eV is', 1.964)\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.3, Page number 60" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "E1=0; #value of 1st energy level in eV\n", + "E2=1.4; #value of 2nd energy level in eV\n", + "lamda=1.15*10**-6;\n", + "h=6.626*10**-34;\n", + "c=3*10**8;\n", + "\n", + "#Calculation\n", + "E=(h*c)/lamda; #energy of one photon\n", + "E_eV=E/(1.6*10**-19); #converting J to eV\n", + "E3=E2+E_eV;\n", + "E3=math.ceil(E3*100)/100; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"value of E3 in eV is\",E3);\n", + "\n", + "#answer given in the book for E3 is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('value of E3 in eV is', 2.49)\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.4, Page number 60" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "h=6.626*10**-34;\n", + "c=3*10**8;\n", + "E2=3.2; #value of higher energy level in eV\n", + "E1=1.6; #value of lower energy level in eV\n", + "\n", + "#Calculation\n", + "E=E2-E1; #energy difference in eV\n", + "E_J=E*1.6*10**-19; #converting E from eV to J\n", + "lamda=(h*c)/E_J; #wavelength of photon\n", + "\n", + "#Result\n", + "print(\"energy difference in eV\",E);\n", + "print(\"wavelength of photon in m\",lamda);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('energy difference in eV', 1.6)\n", + "('wavelength of photon in m', 7.76484375e-07)\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.5, Page number 60" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "h=6.626*10**-34;\n", + "c=3*10**8;\n", + "E=1.42*1.6*10**-19; #band gap of GaAs in J\n", + "\n", + "#Calculation\n", + "lamda=(h*c)/E; #wavelength of laser\n", + "\n", + "#Result\n", + "print(\"wavelength of laser emitted by GaAs in m\",lamda);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('wavelength of laser emitted by GaAs in m', 8.74911971830986e-07)\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.6, Page number 61" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "T=300; #temperature in K\n", + "lamda=500*10**-9; #wavelength in m\n", + "h=6.626*10**-34;\n", + "c=3*10**8;\n", + "k=1.38*10**-23;\n", + "\n", + "#Calculation\n", + "#from maxwell and boltzmann law, relative population is given by\n", + "#N1/N2=exp(-E1/kT)/exp(-E2/kT)\n", + "#hence N1/N2=exp(-(E1-E2)/kT)=exp((h*new)/(k*T));\n", + "#new=c/lambda\n", + "R=(h*c)/(lamda*k*T);\n", + "RP=math.exp(R);\n", + "\n", + "#Result\n", + "print(\"relative population between N1 and N2 is\",RP);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('relative population between N1 and N2 is', 5.068255595981255e+41)\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.7, Page number 61" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "T=300; #temperature in K\n", + "h=6.626*10**-34;\n", + "c=3*10**8;\n", + "k=1.38*10**-23;\n", + "lamda=600*10**-9; #wavelength in m\n", + "\n", + "#Calculation\n", + "R=(h*c)/(lamda*k*T);\n", + "Rs=1/(math.exp(R)-1);\n", + "\n", + "#Result\n", + "print(\"the ratio between stimulated emission to spontaneous emission is\",Rs);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('the ratio between stimulated emission to spontaneous emission is', 1.7617782449453023e-35)\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.8, Page number 62" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "P=5*10**-3; #output power in W\n", + "I=10*10**-3; #current in A\n", + "V=3*10**3; #voltage in V\n", + "\n", + "#Calculation\n", + "e=(P*100)/(I*V);\n", + "e=math.ceil(e*10**6)/10**6; #rounding off to 6 decimals\n", + "\n", + "#Result\n", + "print(\"efficiency of laser in % is\",e);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('efficiency of laser in % is', 0.016667)\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.9, Page number 62" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "P=1e-03; #output power in W\n", + "d=1e-06; #diameter in m\n", + "\n", + "#Calculation\n", + "r=d/2; #radius in m\n", + "I=P/(math.pi*r**2); #intensity\n", + "I=I/10**9;\n", + "I=math.ceil(I*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"intensity of laser in W/m^2 is\",I,\"*10**9\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('intensity of laser in W/m^2 is', 1.2733, '*10**9')\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 2.10, Page number 62" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "lamda=632.8*10**-9; #wavelength in m\n", + "D=5; #distance in m\n", + "d=1*10**-3; #diameter in m\n", + "\n", + "#Calculation\n", + "deltatheta=lamda/d; #angular speed\n", + "delta_theta=deltatheta*10**4;\n", + "r=D*deltatheta;\n", + "r1=r*10**3; #converting r from m to mm\n", + "A=math.pi*r**2; #area of the spread\n", + "\n", + "#Result \n", + "print(\"angular speed in radian is\",delta_theta,\"*10**-4\");\n", + "print(\"radius of the spread in mm is\",r1);\n", + "print(\"area of the spread in m^2 is\",A);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('angular speed in radian is', 6.328, '*10**-4')\n", + "('radius of the spread in mm is', 3.164)\n", + "('area of the spread in m^2 is', 3.1450157329451454e-05)\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_3-checkpoint.ipynb b/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_3-checkpoint.ipynb new file mode 100644 index 00000000..7f945f36 --- /dev/null +++ b/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_3-checkpoint.ipynb @@ -0,0 +1,331 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:35467350b4863e7f6cc10f1050833b31369f245d82605e396be30db7df04f739" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 3 :Fibre Optics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.1, Page number 98 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "n1=1.6; #refractive index of core\n", + "n2=1.5; #refractive index of cladding\n", + "\n", + "#Calculation\n", + "NA=math.sqrt((n1**2)-(n2**2));\n", + "NA=math.ceil(NA*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"the numerical aperture of the fibre is\",NA);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('the numerical aperture of the fibre is', 0.5568)\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.2, Page number 98 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "n1=1.54; #refractive index of core\n", + "n2=1.5; #refractive index of cladding\n", + "n0=1;\n", + "\n", + "#Calculation\n", + "NA=math.sqrt((n1**2)-(n2**2)); #numerical aperture of fibre\n", + "NA=math.ceil(NA*10**5)/10**5; #rounding off to 5 decimals\n", + "alpha=math.asin(NA/n0); #acceptance angle in radians\n", + "alpha=alpha*57.2957795; #converting radians to degrees\n", + "alpha=math.ceil(alpha*10**5)/10**5; #rounding off to 5 decimals\n", + "deg=int(alpha); #converting to degrees\n", + "t=60*(alpha-deg); \n", + "mi=int(t); #converting to minutes\n", + "sec=60*(t-mi); #converting to seconds\n", + "sec=math.ceil(sec*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"the numerical aperture of the fibre is\",NA);\n", + "print(\"the acceptance angle of the fibre in degrees is\",alpha);\n", + "print(\"acceptance angle of the fibre is\",deg,\"degrees\",mi,\"minutes\",sec,\"seconds\");\n", + "\n", + "#answer for the angle given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('the numerical aperture of the fibre is', 0.34872)\n", + "('the acceptance angle of the fibre in degrees is', 20.40905)\n", + "('acceptance angle of the fibre is', 20, 'degrees', 24, 'minutes', 32.581, 'seconds')\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.3, Page number 99" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "n1=1.6; #refractive index of core\n", + "n2=1.49; #refractive index of cladding\n", + "\n", + "#Calculation\n", + "thetac=math.asin(n2/n1); #critical angle in radians\n", + "thetac=thetac*57.2957795; #converting radians to degrees\n", + "theta_c=math.ceil(thetac*10**3)/10**3; #rounding off to 3 decimals\n", + "deg=int(thetac); #converting to degrees\n", + "t=60*(thetac-deg); \n", + "mi=int(t); #converting to minutes\n", + "sec=60*(t-mi); #converting to seconds\n", + "sec=math.ceil(sec*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"the critical angle of the fibre in degrees is\",theta_c);\n", + "print(\"critical angle of the fibre is\",deg,\"degrees\",mi,\"minutes\",sec,\"seconds\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('the critical angle of the fibre in degrees is', 68.631)\n", + "('critical angle of the fibre is', 68, 'degrees', 37, 'minutes', 49.85, 'seconds')\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.4, Page number 99" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "NA=0.15; #numerical aperture\n", + "n2=1.55; #refractive index of cladding\n", + "n0=1.33; #refractive index of water\n", + "\n", + "#Calculation\n", + "n1=math.sqrt((NA**2)+(n2**2)); #refractive index\n", + "n_1=math.ceil(n1*10**5)/10**5; #rounding off to 5 decimals\n", + "alpha=math.asin(math.sqrt(n1**2-n2**2)/n0); #acceptance angle in radians\n", + "alpha=alpha*57.2957795; #converting radians to degrees\n", + "alphaa=math.ceil(alpha*10**3)/10**3; #rounding off to 3 decimals\n", + "deg=int(alpha); #converting to degrees\n", + "t=60*(alpha-deg); \n", + "mi=int(t); #converting to minutes\n", + "sec=60*(t-mi); #converting to seconds\n", + "sec=math.ceil(sec*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"refractive index of the core is\",n_1);\n", + "print(\"the acceptance angle of the fibre in degrees is\",alphaa);\n", + "print(\"acceptance angle of the fibre is\",deg,\"degrees\",mi,\"minutes\",sec,\"seconds\");\n", + "\n", + "#answer for acceptance angle given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('refractive index of the core is', 1.55725)\n", + "('the acceptance angle of the fibre in degrees is', 6.476)\n", + "('acceptance angle of the fibre is', 6, 'degrees', 28, 'minutes', 32.55, 'seconds')\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.5, Page number 100" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "NA=0.26; #numerical aperture\n", + "n1=1.5; #refractive index of core\n", + "d=100; #core diameter in micro meter\n", + "\n", + "#Calculation\n", + "d=100*(10**-6); #core diameter in metre\n", + "n2=math.sqrt((n1**2)-(NA**2));\n", + "n2=math.ceil(n2*10**5)/10**5; #rounding off to 5 decimals\n", + "\n", + "#Result\n", + "print(\"refractive index of the cladding is\",n2);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('refractive index of the cladding is', 1.4773)\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.6, Page number 100" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "NA=0.26; #numerical aperture\n", + "delta=0.015; #refractive index difference\n", + "\n", + "#Calculation\n", + "#NA=math.sqrt(n1**2-n2**2)\n", + "#let A=n1**2-n2**2\n", + "#therefore A=NA**2\n", + "A=NA**2;\n", + "#delta=(n1**2-n2**2)/2*(n1**2)\n", + "#let 2*(n1**2) be B\n", + "#therefore B=A/delta\n", + "B=A/delta;\n", + "n1=math.sqrt(B/2);\n", + "n1=math.ceil(n1*100)/100; #rounding off to 2 decimals\n", + "n2=math.sqrt(n1**2-NA**2);\n", + "n2=math.ceil(n2*10**3)/10**3; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"refractive index of the core is\",n1);\n", + "print(\"refractive index of the cladding is\",n2);\n", + "\n", + "#answer for refractive index of cladding given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('refractive index of the core is', 1.51)\n", + "('refractive index of the cladding is', 1.488)\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_4-checkpoint.ipynb b/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_4-checkpoint.ipynb new file mode 100644 index 00000000..5c898d41 --- /dev/null +++ b/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_4-checkpoint.ipynb @@ -0,0 +1,765 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:e23147666fa50bbe76f447b3ec3e5fb01c2732ae073bde8ca773b976876285b0" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 4:Quantum Physics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.1, Page number 133 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "h=6.63*10**-34; #plancks constant in Js\n", + "m0=9.1*10**-31; #mass of the electron in kg\n", + "c=3*10**8; #velocity of light in m/s\n", + "phi=135; #angle of scattering in degrees\n", + "phi=phi*0.0174532925 #converting degrees to radians \n", + "\n", + "#Calculation\n", + "delta_lamda=(h*(1-math.cos(phi)))/(m0*c);\n", + "\n", + "#Result\n", + "print(\"change in wavelength in metres is\",delta_lamda);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('change in wavelength in metres is', 4.1458307496867315e-12)\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.2, Page number 134 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "h=6.63*10**-34; #plancks constant in Js\n", + "m0=9.1*10**-31; #mass of the electron in kg\n", + "c=3*10**8; #velocity of light in m/s\n", + "lamda=2; #wavelength in angstrom\n", + "lamdaA=lamda*10**-10; #converting lamda from Angstrom to m\n", + "phi=90; #angle of scattering in degrees\n", + "phi=phi*0.0174532925 #converting degrees to radians \n", + "\n", + "#Calculation\n", + "delta_lamda=(h*(1-math.cos(phi)))/(m0*c);\n", + "delta_lamda=delta_lamda*10**10; #converting delta_lamda from m to Angstrom\n", + "delta_lamda=math.ceil(delta_lamda*10**5)/10**5; #rounding off to 5 decimals\n", + "lamda_dash=delta_lamda+lamda;\n", + "lamdaA_dash=lamda_dash*10**-10; #converting lamda_dash from Angstrom to m\n", + "#energy E=h*new-h*new_dash\n", + "E=h*c*((1/lamdaA)-(1/lamdaA_dash));\n", + "EeV=E/(1.602176565*10**-19); #converting J to eV\n", + "EeV=math.ceil(EeV*10**3)/10**3; #rounding off to 3 decimals\n", + "new=c/lamda;\n", + "new_dash=c/lamda_dash;\n", + "theta=math.atan((h*new*math.sin(phi))/((h*new)-(h*new_dash*math.cos(phi))));\n", + "theta=theta*57.2957795; #converting radians to degrees\n", + "\n", + "#Result\n", + "print(\"change in compton shift in Angstrom is\",delta_lamda);\n", + "print(\"wavelength of scattered photons in Angstrom is\",lamda_dash);\n", + "print(\"energy of recoiling electron in J is\",E);\n", + "print(\"energy of recoiling electron in eV is\",EeV);\n", + "print(\"angle at which recoiling electron appears in degrees is\",int(theta));\n", + "\n", + "#answers given in the book are wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('change in compton shift in Angstrom is', 0.02429)\n", + "('wavelength of scattered photons in Angstrom is', 2.02429)\n", + "('energy of recoiling electron in J is', 1.1933272900621974e-17)\n", + "('energy of recoiling electron in eV is', 74.482)\n", + "('angle at which recoiling electron appears in degrees is', 45)\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.3, Page number 135" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "h=6.626*10**-34; #plancks constant in Js\n", + "m0=9.1*10**-31; #mass of the electron in kg\n", + "c=3*10**8; #velocity of light in m/s\n", + "phi=60; #angle of scattering in degrees\n", + "phi=phi*0.0174532925; #converting degrees to radians\n", + "E=10**6; #energy of photon in eV\n", + "E=E*1.6*10**-19; #converting eV into J\n", + "\n", + "#Calculation\n", + "delta_lamda=(h*(1-math.cos(phi)))/(m0*c);\n", + "delta_lamda=delta_lamda*10**10; #converting metre to angstrom\n", + "delta_lamda=math.ceil(delta_lamda*10**4)/10**4; #rounding off to 4 decimals\n", + "lamda=(h*c)/E;\n", + "lamdaA=lamda*10**10; #converting metre to angstrom\n", + "lamda_dash=delta_lamda+lamdaA;\n", + "lamda_dash=math.ceil(lamda_dash*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"compton shift in angstrom is\",delta_lamda);\n", + "print(\"energy of incident photon in m\",lamda);\n", + "print(\"wavelength of scattered photons in angstrom is\",lamda_dash);\n", + "\n", + "#answer for wavelength of scattered photon given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('compton shift in angstrom is', 0.0122)\n", + "('energy of incident photon in m', 1.242375e-12)\n", + "('wavelength of scattered photons in angstrom is', 0.025)\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.4, Page number 135" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "h=6.626*10**-34; #plancks constant in Js\n", + "c=3*10**8; #velocity of light in m/s\n", + "lamda=5893; #wavelength in angstrom\n", + "P=60; #output power in Watt\n", + "\n", + "#Calculation\n", + "lamda=lamda*10**-10; #wavelength in metre\n", + "E=(h*c)/lamda;\n", + "EeV=E/(1.602176565*10**-19); #converting J to eV\n", + "EeV=math.ceil(EeV*10**4)/10**4; #rounding off to 4 decimals\n", + "N=P/E;\n", + "\n", + "#Result\n", + "print(\"energy of photon in J is\",E);\n", + "print(\"energy of photon in eV is\",EeV);\n", + "print(\"number of photons emitted per se cond is\",N);\n", + "\n", + "#answer for energy in eV given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('energy of photon in J is', 3.373154590191753e-19)\n", + "('energy of photon in eV is', 2.1054)\n", + "('number of photons emitted per se cond is', 1.7787503773015396e+20)\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.5, Page number 136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "h=6.626*10**-34; #plancks constant in Js\n", + "c=3*10**8; #velocity of light in m/s\n", + "lamda=10; #wavelength in angstrom\n", + "\n", + "#Calculation\n", + "lamda=lamda*10**-10; #wavelength in metre\n", + "E=(h*c)/lamda;\n", + "EeV=E/(1.602176565*10**-19); #converting J to eV\n", + "EeV=EeV*10**-3; #converting eV to keV\n", + "EeV=math.ceil(EeV*10**3)/10**3; #rounding off to 3 decimals\n", + "P=h/lamda;\n", + "M=h/(lamda*c);\n", + "\n", + "#Result\n", + "print(\"energy of photon in J is\",E);\n", + "print(\"energy of photon in keV is\",EeV);\n", + "print(\"momentum in kg m/sec is\",P);\n", + "print(\"mass of photon in kg is\",M);\n", + "\n", + "#answer for energy of photon in keV given in the book is wrong by 1 decimal" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('energy of photon in J is', 1.9878e-16)\n", + "('energy of photon in keV is', 1.241)\n", + "('momentum in kg m/sec is', 6.626e-25)\n", + "('mass of photon in kg is', 2.2086666666666664e-33)\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.6, Page number 136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "h=6.626*10**-34; #plancks constant in Js\n", + "m=9.1*10**-31; #mass of the electron in kg\n", + "e=1.602*10**-19;\n", + "V=1.25; #potential difference in kV\n", + "\n", + "#Calculation\n", + "V=V*10**3; #converting kV to V\n", + "lamda=h/math.sqrt(2*m*e*V);\n", + "lamda=lamda*10**10; #converting metre to angstrom\n", + "lamda=math.ceil(lamda*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"de Broglie wavelength in angstrom is\",lamda);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('de Broglie wavelength in angstrom is', 0.3471)\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.7, Page number 136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#Variable declaration\n", + "E=45; #energy of electron in eV\n", + "E=E*1.6*10**-19; #energy in J\n", + "h=6.626*10**-34; #plancks constant in Js\n", + "m=9.1*10**-31; #mass of the electron in kg\n", + "\n", + "#Calculation\n", + "lamda=h/math.sqrt(2*m*E);\n", + "lamda=lamda*10**10; #converting metres to angstrom\n", + "lamda=math.ceil(lamda*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"de Broglie wavelength in angstrom is\",lamda);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('de Broglie wavelength in angstrom is', 1.8305)\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.8, Page number 137" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "v=10**7; #velocity of electron in m/sec\n", + "h=6.626*10**-34; #plancks constant in Js\n", + "m=9.1*10**-31; #mass of the electron in kg\n", + "\n", + "#Calculation\n", + "lamda=h/(m*v);\n", + "lamda=lamda*10**10; #converting metres to angstrom\n", + "lamda=math.ceil(lamda*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"de Broglie wavelength in angstrom is\",lamda);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('de Broglie wavelength in angstrom is', 0.7282)\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.9, Page number 137" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "V=1000; #potential difference in V\n", + "h=6.626*10**-34; #plancks constant in Js\n", + "m=1.67*10**-27; #mass of proton in kg\n", + "e=1.6*10**-19; #charge of electron in J\n", + "\n", + "#Calculation\n", + "lamda=h/math.sqrt(2*m*e*V);\n", + "\n", + "#Result\n", + "print(\"de Broglie wavelength of alpha particle in metre is\",lamda);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('de Broglie wavelength of alpha particle in metre is', 9.063964727801313e-13)\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.10, Page number 138" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "L=25; #width of potential in armstrong\n", + "delta_x=0.05; #interval in armstrong\n", + "n=1; #particle is in its least energy\n", + "x=L/2; #particle is at the centre\n", + "pi=180; #angle in degrees\n", + "\n", + "#Calculation\n", + "pi=pi*0.0174532925; #angle in radians\n", + "L=L*10**-10; #width in m\n", + "delta_x=delta_x*10**-10; #interval in m\n", + "#probability P = integration of (A**2)*(math.sin(n*pi*x/L))**2*delta_x\n", + "#but A=math.sqrt(2/L)\n", + "#since the particle is in a small interval integration need not be applied\n", + "#therefore P=2*(L**(-1))*(math.sin(n*pi*x/L))**2*delta_x\n", + "P=2*(L**(-1))*((math.sin(n*pi*x/L))**2)*delta_x;\n", + "P=math.ceil(P*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"probability of finding the particle is\",P);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('probability of finding the particle is', 0.004)\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.11, Page number 138" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "n=1;\n", + "h=6.626*10**-34; #plancks constant in Js\n", + "m=9.1*10**-31; #mass of the electron in kg\n", + "L=1; #width of potential well in angstrom\n", + "\n", + "#Calculation\n", + "L=L*10**-10; #converting angstrom into metre\n", + "E=((n**2)*h**2)/(8*m*L**2);\n", + "EeV=E/(1.6*10**-19); #converting J to eV\n", + "EeV=math.ceil(EeV*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"lowest energy of electron in J is\",E);\n", + "print(\"lowest energy of electron in eV is\",EeV);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('lowest energy of electron in J is', 6.030752197802197e-18)\n", + "('lowest energy of electron in eV is', 37.693)\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.12, Page number 139" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "n=1;\n", + "h=6.626*10**-34; #plancks constant in Js\n", + "m=9.1*10**-31; #mass of the electron in kg\n", + "L=1; #width of potential well in angstrom\n", + "\n", + "#Calculation\n", + "L=L*10**-10; #converting angstrom into metre\n", + "E=(2*(n**2)*h**2)/(8*m*L**2);\n", + "E=E/(1.6*10**-19); #converting J to eV\n", + "E=math.ceil(E*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"lowest energy of system in eV is\",E);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('lowest energy of system in eV is', 75.385)\n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.13, Page number 139" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "h=6.626*10**-34; #plancks constant in Js\n", + "m=9.1*10**-31; #mass of the electron in kg\n", + "L=1; #width of potential well in angstrom\n", + "\n", + "#Calculation\n", + "L=L*10**-10; #converting angstrom into metre\n", + "#according to pauli's exclusion principle, 1st electron occupies n1=1 and second electron occupies n2=2\n", + "n1=1;\n", + "n2=2;\n", + "E=((2*(n1**2)*h**2)/(8*m*L**2))+(((n2**2)*h**2)/(8*m*L**2));\n", + "E=E/(1.6*10**-19); #converting J to eV\n", + "E=math.ceil(E*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"lowest energy of system in eV is\",E);\n", + "print(\"quantum numbers are\");\n", + "print(\"n=1,l=0,mL=0,mS=+1/2\");\n", + "print(\"n=1,l=0,mL=0,mS=-1/2\");\n", + "print(\"n=2,l=0,mL=0,mS=+1/2\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('lowest energy of system in eV is', 226.154)\n", + "quantum numbers are\n", + "n=1,l=0,mL=0,mS=+1/2\n", + "n=1,l=0,mL=0,mS=-1/2\n", + "n=2,l=0,mL=0,mS=+1/2\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.14, Page number 140" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "n=1;\n", + "h=6.626*10**-34; #plancks constant in Js\n", + "L=100; #width of potential well in angstrom\n", + "\n", + "#Calculation\n", + "L=L*10**-10; #converting angstrom into metre\n", + "E=0.025; #lowest energy in eV\n", + "E=E*(1.6*10**-19); #converting eV to J\n", + "m=((n**2)*h**2)/(8*E*L**2);\n", + "\n", + "#Result\n", + "print(\"mass of the particle in kg is\",m);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('mass of the particle in kg is', 1.3719961249999998e-31)\n" + ] + } + ], + "prompt_number": 31 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 4.15, Page number 141" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "k=1.38*10**-23;\n", + "T=6000; #temperature in K\n", + "h=6.626*10**-34; #plancks constant in Js\n", + "c=3*10**8; #velocity of light in m/s\n", + "lamda1=450; #wavelength in nm\n", + "lamda2=460; #wavelength in nm\n", + "\n", + "#Calculation\n", + "lamda1=lamda1*10**-9; #converting nm to metre\n", + "lamda2=lamda2*10**-9; #converting nm to metre\n", + "new1=c/lamda1;\n", + "new2=c/lamda2;\n", + "new=(new1+new2)/2;\n", + "A=math.exp((h*new)/(k*T));\n", + "rho_v=(8*math.pi*h*new**3)/(A*c**3);\n", + "\n", + "#Result\n", + "print(\"energy density of the black body in J/m^3 is\",rho_v);\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('energy density of the black body in J/m^3 is', 9.033622836188887e-16)\n" + ] + } + ], + "prompt_number": 32 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_6-checkpoint.ipynb b/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_6-checkpoint.ipynb new file mode 100644 index 00000000..ed87272f --- /dev/null +++ b/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_6-checkpoint.ipynb @@ -0,0 +1,900 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:35feb7911503610a1a19ef2ec03875bdff92ac67a47547d78b073137822b7f5e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 6:Crystallography" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.1, Page number 185" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "r=0.071; #radius in nm\n", + "N=6.022*10**26; \n", + "\n", + "#Calculation\n", + "r=r*10**-9; #converting r from nm to m\n", + "#mass of carbon atom m = 12/N\n", + "m=12/N;\n", + "#mass of diamond M = 8*mass of one carbon atom\n", + "M=8*m;\n", + "#volume of diamond V = (8*r/sqrt(3))^3\n", + "V=(8*r/math.sqrt(3))**3;\n", + "d=M/V; #density in kg/m^3\n", + "d=math.ceil(d*100)/100; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"density of diamond in kg/m^3 is\",d);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('density of diamond in kg/m^3 is', 4520.31)\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.2, Page number 185" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "aBCC=0.332; #lattice constant in nm\n", + "aHCP=0.296; #lattice constant in nm\n", + "c=0.468; #c in nm\n", + "\n", + "#Calculation\n", + "aBCC=aBCC*10**-9; #converting nm to m\n", + "Vbcc=aBCC**3;\n", + "aHCP=aHCP*10**-9; #converting nm to m\n", + "c=c*10**-9; #converting nm to m\n", + "Vhcp=6*(math.sqrt(3)/4)*aHCP**2*c;\n", + "V=Vhcp-Vbcc;\n", + "Vch=(V*100)/Vbcc;\n", + "Vch=math.ceil(Vch*100)/100; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"percentage change in volume is\",Vch);\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('percentage change in volume is', 191.12)\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.3, Page number 186" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "r=1.278; #atomic radius of Cu in Angstrom\n", + "A=63.54; #atomic weight of Cu\n", + "n=4; #for FCC n=4\n", + "Na=6.022*10**26;\n", + "\n", + "#Calculation\n", + "r=r*10**-10; #converting atomic radius from Angstrom to m\n", + "a=2*math.sqrt(2)*r; \n", + "rho=(n*A)/(Na*a**3);\n", + "rho=math.ceil(rho*100)/100; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"density of Cu in kg/m^3 is\",rho);\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('density of Cu in kg/m^3 is', 8935.92)\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.4, Page number 186" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "import numpy as np\n", + "\n", + "#Variable declaration\n", + "rho=2180; #density of NaCl in kg/m^3\n", + "wNa=23; #atomic weight of Na\n", + "wCl=35.5; #atomic weight of Cl\n", + "n=4; #for FCC n=4\n", + "Na=6.022*10**26;\n", + "\n", + "#Calculation\n", + "A=wNa+wCl; #molecular weight of NaCl\n", + "x=np.reciprocal(3.);\n", + "a=((n*A)/(Na*rho))**x;\n", + "\n", + "#Result\n", + "print(\"interatomic distance in NaCl in m is\",a); \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('interatomic distance in NaCl in m is', 5.6278114346454509e-10)\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.5, Page number 187" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "a=0.42; #lattice constant in nm\n", + "h1=1;\n", + "k1=0;\n", + "l1=1; #indices of the plane (101)\n", + "h2=2;\n", + "k2=2;\n", + "l2=1; #indices of the plane (221)\n", + "\n", + "#Calculation\n", + "a=a*10**-9; #converting from nm to m\n", + "d1=a/math.sqrt((h1**2)+(k1**2)+(l1**2)); #interplanar spacing for plane (101)\n", + "d1=d1*10**9; #converting from m to nm\n", + "d1=math.ceil(d1*10**5)/10**5; #rounding off to 5 decimals\n", + "d2=a/math.sqrt((h2**2)+(k2**2)+(l2**2)); #interplanar spacing for plane (221)\n", + "d2=d2*10**9; #converting from m to nm\n", + "\n", + "#Result\n", + "print(\"interplanar spacing for (101) in nm is\",d1);\n", + "print(\"interplanar spacing for (221) in nm is\",d2);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('interplanar spacing for (101) in nm is', 0.29699)\n", + "('interplanar spacing for (221) in nm is', 0.14)\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.6, Page number 187" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "h1=1;\n", + "k1=0;\n", + "l1=2; #indices for plane (102)\n", + "h2=2;\n", + "k2=3;\n", + "l2=1; #indices for plane (231)\n", + "h3=3;\n", + "k3=-1;\n", + "l3=2; #indices for plane (31'2)\n", + "\n", + "#Calculation\n", + "#intercepts made by the plane is a/h, b/k, c/l\n", + "#for plane (102) intercepts are a/1=a, b/0=infinite, c/2\n", + "#for plane (231) intercepts are a/2, b/3, c/1=c\n", + "#for plane (31'2) intercepts are a/3=a, b/-1=-b, c/2\n", + "\n", + "#Result\n", + "print(\"for plane (102) intercepts are a/1=a, b/0=infinite, c/2\");\n", + "print(\"for plane (231) intercepts are a/2, b/3, c/1=c\");\n", + "print(\"for plane (312) intercepts are a/3=a, b/-1=-b, c/2\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "for plane (102) intercepts are a/1=a, b/0=infinite, c/2\n", + "for plane (231) intercepts are a/2, b/3, c/1=c\n", + "for plane (312) intercepts are a/3=a, b/-1=-b, c/2\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.7, Page number 188" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "u1=1;\n", + "v1=1;\n", + "w1=1; #indices for plane (111)\n", + "u2=2;\n", + "v2=1;\n", + "w2=2; #indices for plane (212)\n", + "\n", + "#Calculation\n", + "A=u1*u2+v1*v2+w1*w2; \n", + "B1=math.sqrt((u1**2)+(v1**2)+(w1**2));\n", + "B2=math.sqrt((u2**2)+(v2**2)+(w2**2));\n", + "B=A/(B1*B2);\n", + "B=math.ceil(B*10**4)/10**4; #rounding off to 4 decimals\n", + "theta=math.acos(B); #angle in radian\n", + "theta=theta*57.2957795; #converting radian to degrees\n", + "theeta=math.ceil(theta*10**3)/10**3; #rounding off to 3 decimals\n", + "deg=int(theta); #converting to degrees\n", + "t=60*(theta-deg);\n", + "mi=int(t); #converting to minutes\n", + "sec=60*(t-mi); #converting to seconds\n", + "sec=math.ceil(sec*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"angle between the planes in degrees is\",theeta);\n", + "print(\"angle between the planes is\",deg,\"degrees\",mi,\"minutes\",sec,\"seconds\");\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('angle between the planes in degrees is', 15.783)\n", + "('angle between the planes is', 15, 'degrees', 46, 'minutes', 57.85, 'seconds')\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.8, Page number 188" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.9, Page number 189" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "d=0.2338; #interplanar distance in nm\n", + "h=-1;\n", + "k=1;\n", + "l=1; #indices of the plane (1'11)\n", + "\n", + "#Calculation\n", + "d=d*10**-9; #converting from nm to m\n", + "a=d*math.sqrt((h**2)+(k**2)+(l**2));\n", + "a=a*10**9; #converting lattice constant from m to nm\n", + "a=math.ceil(a*10**5)/10**5; #rounding off to 5 decimals\n", + "\n", + "#Result\n", + "print(\"lattice constant in nm is\",a);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('lattice constant in nm is', 0.40496)\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.10, Page number 189" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#variable declaration\n", + "h1=1;\n", + "k1=0;\n", + "l1=0; #indices for plane (100)\n", + "h2=1;\n", + "k2=1;\n", + "l2=0; #indices for plane (110)\n", + "h3=1;\n", + "k3=1;\n", + "l3=1; #indices for plane (111)\n", + "\n", + "#Calculation\n", + "#d=a/math.sqrt((h**2)+(k**2)+(l**2))\n", + "#d100=a/math.sqrt((h1**2)+(k1**2)+(l1**2))\n", + "x1=math.sqrt((h1**2)+(k1**2)+(l1**2));\n", + "#d100=a/x1 = a/1 = a\n", + "#d110=a/math.sqrt((h2**2)+(k2**2)+(l2**2))\n", + "x2=math.sqrt((h2**2)+(k2**2)+(l2**2));\n", + "x2=math.ceil(x2*10**4)/10**4; #rounding off to 4 decimals\n", + "#d110=a/x2 = a/sqrt(2)\n", + "#d111=a/math.sqrt((h3**2)+(k3**2)+(l3**2))\n", + "x3=math.sqrt((h3**2)+(k3**2)+(l3**2));\n", + "x3=math.ceil(x3*10**4)/10**4; #rounding off to 4 decimals\n", + "#d111=a/x3 = a/sqrt(3)\n", + "#hence d100:d110:d111=a:a/sqrt(2):a/sqrt(3)\n", + "#multiplying RHS by sqrt(6) we get d100:d110:d111=sqrt(6):sqrt(3):sqrt(2)\n", + "\n", + "#Result\n", + "print(\"value of x1 is\",x1);\n", + "print(\"value of x2 is\",x2);\n", + "print(\"value of x3 is\",x3);\n", + "print(\"d100:d110:d111=sqrt(6):sqrt(3):sqrt(2)\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('value of x1 is', 1.0)\n", + "('value of x2 is', 1.4143)\n", + "('value of x3 is', 1.7321)\n", + "d100:d110:d111=sqrt(6):sqrt(3):sqrt(2)\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.11, Page number 190" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "h=2;\n", + "k=3;\n", + "l=1; #indices for plane (231)\n", + "\n", + "#Calculation\n", + "#intercepts made by the plane is a/h, b/k, c/l\n", + "#for a cubic unit cell, a=b=c\n", + "#for plane (231) intercepts are a/2, a/3, a/1 = a\n", + "#ratio of the intercepts is 1/2:1/3:1\n", + "#LCM is 6. multiplying by LCM, we get ratio l1:l2:l3 = 3:2:6\n", + "\n", + "#Result\n", + "print(\"l1:l2:l3 = 3:2:6\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "l1:l2:l3 = 3:2:6\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.12, Page number 190" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "h=1;\n", + "k=2;\n", + "l=3; #indices for plane (123)\n", + "l1=0.8; #l1 in armstrong\n", + "a=0.8; #a in armstrong\n", + "b=1.2; #b in armstrong\n", + "c=1.5; #c in armstrong\n", + "\n", + "#Calculation\n", + "#intercepts made by the plane is a/h, b/k, c/l\n", + "#for plane (123) intercepts are a/1 = a, b/2, c/3\n", + "#ratio of the intercepts l1:l2:l3 = a:b/2:c/3\n", + "#thus 0.8:l2:l3 = 0.8:1.2/2:1.5/3\n", + "l2=1.2/2; #l2 in armstrong\n", + "l3=1.5/3; #l3 in armstrong\n", + "\n", + "#Result\n", + "print(\"value of l2 in armstrong is\",l2);\n", + "print(\"value of l3 in armstrong is\",l3);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('value of l2 in armstrong is', 0.6)\n", + "('value of l3 in armstrong is', 0.5)\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.13, Page number 191" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Result\n", + "print(\"in simple cubic unit cell nearest neighbour distance is a\");\n", + "print(\"in body centered cubic unit cell nearest neighbour distance is sqrt(3)*a/2\");\n", + "print(\"in face centered cubic unit cell nearest neighbour distance is a/sqrt(2)\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "in simple cubic unit cell nearest neighbour distance is a\n", + "in body centered cubic unit cell nearest neighbour distance is sqrt(3)*a/2\n", + "in face centered cubic unit cell nearest neighbour distance is a/sqrt(2)\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.14, Page number 191" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#variable declaration\n", + "a=2.04; #lattice parameter in armstrong\n", + "h=2;\n", + "k=1;\n", + "l=2; #indices for plane (212)\n", + "\n", + "#Calculation\n", + "a=a*10**-10; #converting from armstrong to m\n", + "d=a/math.sqrt((h**2)+(k**2)+(l**2));\n", + "d=d*10**10; #converting from m to armstrong\n", + "d=math.ceil(d*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"interplanar distance in armstrong is\",d);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('interplanar distance in armstrong is', 0.681)\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.15, Page number 191" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#variable declaration\n", + "r=1.278; #radius of Cu in armstrong\n", + "M=63.54; #atomic weight of Cu\n", + "rho=8980; #density in kg/m^3\n", + "Na=6.022*10**26;\n", + "\n", + "#Calculation\n", + "r=r*10**-10; #radius in m\n", + "a=math.sqrt(8)*r;\n", + "n=(rho*Na*a**3)/M;\n", + "\n", + "#Result\n", + "print(\"interatomic distance in m is\",a);\n", + "print(\"number of atoms per Cu unit cell is\",int(n));" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('interatomic distance in m is', 3.6147298654256317e-10)\n", + "('number of atoms per Cu unit cell is', 4)\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.16, Page number 192" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "a=0.429;\n", + "b=1;\n", + "c=0.379; #intercepts of an orthorhombic crystal\n", + "\n", + "#Calculation\n", + "#ratio of intercepts are 0.214:1:0.188 = (a/0.429)*0.214:1:(c/0.379)*0.188 = a/2:b:c/2\n", + "#thus the coefficients are 1/2:1:1/2. inverses are 2,1,2.\n", + "#thus miller indices for the first plane are (212)\n", + "#ratio of intercepts are 0.858:1:0.754 = (a/0.429)*0.0.858:1:(c/0.379)*0.754 = 2a:b:2c\n", + "#thus the coefficients are 2:1:2. inverses are 1/2,1,1/2. LCM is 2. multiplying with LCM we get 1,2,1\n", + "#thus miller indices for the second plane are (121)\n", + "#ratio of intercepts are 0.429:infinite:0.126 = (a/0.429)*0.429:infinite:(c/0.379)*0.126 = a:infiniteb:c/3\n", + "#thus the coefficients are 1:infinte:1/3. inverses are 1,0,3.\n", + "#thus miller indices for the third plane are (103)\n", + "\n", + "#Result\n", + "print(\"miller indices for the first plane are (212)\");\n", + "print(\"miller indices for the second plane are (121)\");\n", + "print(\"miller indices for the third plane are (103)\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "miller indices for the first plane are (212)\n", + "miller indices for the second plane are (121)\n", + "miller indices for the third plane are (103)\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.17, Page number 193" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "import numpy as np\n", + "\n", + "#variable declaration\n", + "h1=1;\n", + "k1=0;\n", + "l1=0; #indices of the first plane (100)\n", + "h2=1;\n", + "k2=1;\n", + "l2=0; #indices of the second plane (110)\n", + "h3=1;\n", + "k3=1;\n", + "l3=1; #indices of the third plane (111)\n", + "\n", + "#Calculation\n", + "n_1=np.reciprocal(4.);\n", + "n_2=np.reciprocal(2.);\n", + "n_3=np.reciprocal(6.);\n", + "n1=(n_1*4)+1; #number of atoms per unit cell in (100)\n", + "#number of atoms per m^2 is 2/a**2. but a=sqrt(8)*r.\n", + "#hence number of atoms per m^2 is 1/(4*r**2)\n", + "n2=(n_1*4)+(2*n_2); #number of atoms per unit cell in (110)\n", + "#number of atoms per m^2 is 1/a*sqrt(2)*a. but a=sqrt(8)*r.\n", + "#hence number of atoms per m^2 is 1/(8*sqrt(2)*r**2)\n", + "n3=(n_3*3)+(3*n_2); #number of atoms per unit cell in (111)\n", + "#number of atoms per m^2 is 2/(sqrt(3)/4)*a**2. but a=4*r.\n", + "#hence number of atoms per m^2 is 1/(2*sqrt(3)*r**2)\n", + "\n", + "#Result\n", + "print(\"number of atoms per unit cell in (100)\",n1);\n", + "print(\"number of atoms per m^2 is 1/(4*r**2)\");\n", + "print(\"number of atoms per unit cell in (110)\",n2);\n", + "print(\"number of atoms per m^2 is 1/(8*sqrt(2)*r**2)\");\n", + "print(\"number of atoms per unit cell in (111)\",n3);\n", + "print(\"number of atoms per m^2 is 1/(2*sqrt(3)*r**2)\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('number of atoms per unit cell in (100)', 2.0)\n", + "number of atoms per m^2 is 1/(4*r**2)\n", + "('number of atoms per unit cell in (110)', 2.0)\n", + "number of atoms per m^2 is 1/(8*sqrt(2)*r**2)\n", + "('number of atoms per unit cell in (111)', 2.0)\n", + "number of atoms per m^2 is 1/(2*sqrt(3)*r**2)\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 6.18, Page number 194" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#variable declaration\n", + "r=0.97; #radius of Na+ ion in armstrong\n", + "R=1.81; #radius of Cl- ion in armstrong\n", + "\n", + "#Calculation\n", + "#atomic packing factor=packing density PD\n", + "#PD=Volume of atoms/Volume of unit cell\n", + "#volume of unit cell=a**3\n", + "#volume of atoms=number of atoms*volume of 1 atom = 4*(4/3)*math.pi*r**3\n", + "#but r=a/sqrt(8). hence PD = 4*(4/3)*math.pi*(a/(2*sqrt(2)))**3*(1/a**3) = 0.74\n", + "#atomic packing factor = 0.74\n", + "r=r*10**-10; #radius of Na+ ion in m\n", + "R=R*10**-10; #radius of Cl- ion in m\n", + "Vna = (4*4*math.pi*r**3)/3; #volume of Na atoms\n", + "Vcl = (4*4*math.pi*R**3)/3; #volume of Cl atoms \n", + "V=(2*(r+R))**3; #volume of unit cell\n", + "IPF=(Vna+Vcl)/V; #ionic packing factor\n", + "IPF=math.ceil(IPF*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"atomic packing factor = 0.74\");\n", + "print(\"ionic packing factor of NaCl crystal is\",IPF);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "atomic packing factor = 0.74\n", + "('ionic packing factor of NaCl crystal is', 0.6671)\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_7-checkpoint.ipynb b/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_7-checkpoint.ipynb new file mode 100644 index 00000000..66d47038 --- /dev/null +++ b/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_7-checkpoint.ipynb @@ -0,0 +1,187 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:5c43a25c95f2d38dcba2c96190ddc992684530d01ab1e8a2e25860b8bf302d5b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 7:Crystal Imperfections" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.1, Page number 207 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "k=1.38*10**-23;\n", + "Ev=0.98; #energy in eV/atom\n", + "T1=900; #temperature in C\n", + "T2=1000;\n", + "A=6.022*10**26; #avagadro's constant\n", + "w=196.9; #atomic weight in g/mol\n", + "d=18.63; #density in g/cm^3\n", + "\n", + "#Calculation\n", + "Ev=Ev*1.6*10**-19; #converting eV to J\n", + "d=d*10**3; #converting g/cm^3 into kg/m^3\n", + "N=(A*d)/w;\n", + "n=N*math.exp(-Ev/(k*T1));\n", + "#let valency fraction n/N be V\n", + "V=math.exp(-Ev/(k*T2));\n", + "\n", + "#Result\n", + "print(\"concentration of atoms per m^3 is\",N);\n", + "print(\"number of vacancies per m^3 is\",n);\n", + "print(\"valency fraction is\",V);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('concentration of atoms per m^3 is', 5.69780904012189e+28)\n", + "('number of vacancies per m^3 is', 1.8742498047705634e+23)\n", + "('valency fraction is', 1.1625392535344139e-05)\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.2, Page number 208 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "k=1.38*10**-23;\n", + "A=6.022*10**26; #avagadro's constant\n", + "T=1073; #temperature in K\n", + "n=3.6*10**23; #number of vacancies\n", + "d=9.5; #density in g/cm^3\n", + "w=107.9; #atomic weight in g/mol\n", + "\n", + "#Calculation\n", + "d=d*10**3; #converting g/cm^3 into kg/m^3\n", + "N=(A*d)/w; #concentration of atoms\n", + "E=k*T*math.log((N/n), ); #energy in J\n", + "EeV=E/(1.602176565*10**-19); #energy in eV\n", + "EeV=math.ceil(EeV*10**2)/10**2; #rounding off to 2 decimals\n", + "\n", + "#Result\n", + "print(\"concentration of atoms per m^3 is\",N);\n", + "print(\"energy for vacancy formation in J\",E);\n", + "print(\"energy for vacancy formation in eV\",EeV);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('concentration of atoms per m^3 is', 5.3020389249304915e+28)\n", + "('energy for vacancy formation in J', 1.762092900344914e-19)\n", + "('energy for vacancy formation in eV', 1.1)\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 7.3, Page number 209 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "A=6.022*10**26; #avagadro's constant\n", + "k=1.38*10**-23;\n", + "w1=39.1; #atomic weight of K\n", + "w2=35.45; #atomic weight of Cl\n", + "Es=2.6; #energy formation in eV\n", + "T=500; #temperature in C\n", + "d=1.955; #density in g/cm^3\n", + "\n", + "#Calculation\n", + "Es=Es*1.6*10**-19; #converting eV to J\n", + "T=T+273; #temperature in K\n", + "d=d*10**3; #converting g/cm^3 into kg/m^3\n", + "N=(A*d)/(w1+w2);\n", + "n=N*math.exp(-Es/(2*k*T));\n", + "\n", + "#Result\n", + "print(\"number of Schotky defect per m^3 is\",n);\n", + "\n", + "#answer given in the book is wrong by 3rd decimal point" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('number of Schotky defect per m^3 is', 5.373777171020081e+19)\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_8-checkpoint.ipynb b/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_8-checkpoint.ipynb new file mode 100644 index 00000000..f623e51d --- /dev/null +++ b/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_8-checkpoint.ipynb @@ -0,0 +1,525 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:d6731122effef7e9230b6bfa598804c6ee1a10d92c79e1ae784678d16b396704" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 8:Conducting materials" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.1, Page number 231" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "m=9.1*10**-31; #mass of the electron in kg\n", + "n=2.533*10**28; #concentration of electrons per m^3\n", + "e=1.6*10**-19;\n", + "tow_r=3.1*10**-14; #relaxation time in sec\n", + "\n", + "#Calculation\n", + "rho=m/(n*(e**2*tow_r));\n", + "\n", + "#Result\n", + "print(\"electrical resistivity in ohm metre is\",rho);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('electrical resistivity in ohm metre is', 4.526937967219795e-08)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.2, Page number 231" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "s=3.75*10**3; #slope\n", + "k=1.38*10**-23;\n", + "\n", + "#Calculation\n", + "Eg=2*k*s;\n", + "Eg=Eg/(1.6*10**-19); #converting J to eV\n", + "Eg=math.ceil(Eg*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"band gap of semiconductor in eV is\",Eg);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('band gap of semiconductor in eV is', 0.647)\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.3, Page number 231" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "T=989; #temperature in C\n", + "k=1.38*10**-23;\n", + "#let E-EF be E\n", + "E=0.5; #occupied level of electron in eV\n", + "\n", + "#Calculation\n", + "T=T+273; #temperature in K\n", + "E=E*1.6*10**-19; #converting eV to J\n", + "#let fermi=dirac distribution function f(E) be f\n", + "f=1/(1+math.exp(E/(k*T)));\n", + "f=math.ceil(f*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"probability of occupation of electrons is\",f);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('probability of occupation of electrons is', 0.011)\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.4, Page number 232" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "mew_e=0.0035; #mobility of electrons in m^2/Vs\n", + "E=0.5; #electric field strength in V/m\n", + "\n", + "#Calculation\n", + "vd=mew_e*E;\n", + "vd=vd*10**3;\n", + "\n", + "#Result\n", + "print(\"drift velocity of free electrons in m/sec is\",vd,\"*10**-3\");\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('drift velocity of free electrons in m/sec is', 1.75, '*10**-3')\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.5, Page number 232" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "A=6.022*10**23; #avagadro number\n", + "e=1.6*10**-19;\n", + "rho=1.73*10**-8; #resistivity of Cu in ohm metre\n", + "w=63.5; #atomic weight \n", + "d=8.92*10**3; #density in kg/m^3\n", + "\n", + "#Calculation\n", + "d=d*10**3;\n", + "sigma=1/rho;\n", + "sigmaa=sigma/10**7;\n", + "sigmaa=math.ceil(sigmaa*10**3)/10**3; #rounding off to 3 decimals\n", + "n=(d*A)/w;\n", + "mew=sigma/(n*e); #mobility of electrons\n", + "mew=mew*10**3;\n", + "mew=math.ceil(mew*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"electrical conductivity in ohm-1 m-1\",sigmaa,\"*10**7\");\n", + "print(\"concentration of carriers per m^3\",n);\n", + "print(\"mobility of electrons in m^2/Vsec is\",mew,\"*10**-3\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('electrical conductivity in ohm-1 m-1', 5.781, '*10**7')\n", + "('concentration of carriers per m^3', 8.459250393700786e+28)\n", + "('mobility of electrons in m^2/Vsec is', 4.2708, '*10**-3')\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.6, Page number 232" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "n=18.1*10**28; #concentration of electrons per m^3\n", + "h=6.62*10**-34; #planck constant in Js\n", + "me=9.1*10**-31; #mass of electron in kg\n", + "\n", + "#Calculation\n", + "X=h**2/(8*me);\n", + "E_F0=X*(((3*n)/math.pi)**(2/3));\n", + "E_F0=E_F0/(1.6*10**-19); #converting J to eV\n", + "\n", + "#Result\n", + "print(\"Fermi energy in eV is\",E_F0);\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('Fermi energy in eV is', 3.762396978021977e-19)\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.7, Page number 233" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#Variable declaration\n", + "E_F0=5.5; #fermi energy in eV\n", + "h=6.63*10**-34; #planck constant in Js\n", + "me=9.1*10**-31; #mass of electron in kg\n", + "\n", + "#Calculation\n", + "E_F0=E_F0*1.6*10**-19; #converting eV to J\n", + "n=((2*me*E_F0)**(3/2))*((8*math.pi)/(3*h**3));\n", + "\n", + "#Result\n", + "print(\"concentration of free electrons per unit volume of silver per m^3 is\",n);\n", + "\n", + "#answer given in the book is wrong\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('concentration of free electrons per unit volume of silver per m^3 is', 4.603965704817037e+52)\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.8, Page number 233" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "Eg=1.07; #energy gap of silicon in eV\n", + "k=1.38*10**-23;\n", + "T=298; #temperature in K\n", + "\n", + "#Calculation\n", + "Eg=Eg*1.6*10**-19; #converting eV to J\n", + "#let the probability of electron f(E) be X\n", + "#X=1/(1+exp((E-Ef)/(k*T)))\n", + "#but E=Ec and Ec-Ef=Eg/2\n", + "X=1/(1+math.exp(Eg/(2*k*T)))\n", + "\n", + "#Result\n", + "print(\"probability of an electron thermally excited is\",X);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('probability of an electron thermally excited is', 9.122602463573379e-10)\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.9, Page number 234" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "k=1.38*10**-23;\n", + "m=9.1*10**-31; #mass of the electron in kg\n", + "vf=0.86*10**6; #fermi velocity in m/sec\n", + "\n", + "#Calculation\n", + "Efj=(m*vf**2)/2;\n", + "Ef=Efj/(1.6*10**-19); #converting J to eV\n", + "Ef=math.ceil(Ef*10**3)/10**3; #rounding off to 3 decimals\n", + "Tf=Efj/k;\n", + "Tf=Tf/10**4;\n", + "Tf=math.ceil(Tf*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"fermi energy of metal in J is\",Efj);\n", + "print(\"fermi energy of metal in eV is\",Ef);\n", + "print(\"fermi temperature in K is\",Tf,\"*10**4\");\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('fermi energy of metal in J is', 3.3651800000000002e-19)\n", + "('fermi energy of metal in eV is', 2.104)\n", + "('fermi temperature in K is', 2.4386, '*10**4')\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.10, Page number 234" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "sigma=5.82*10**7; #electrical conductivity in ohm^-1m^-1\n", + "K=387; #thermal conductivity of Cu in W/mK\n", + "T=27; #temperature in C\n", + "\n", + "#Calculation\n", + "T=T+273; #temperature in K\n", + "L=K/(sigma*T);\n", + "\n", + "#Result\n", + "print(\"lorentz number in W ohm/K^2 is\",L);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('lorentz number in W ohm/K^2 is', 2.2164948453608246e-08)\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 8.11, Page number 235" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#Variable declaration\n", + "m=9.1*10**-31; #mass of the electron in kg\n", + "e=1.6*10**-19;\n", + "k=1.38*10**-23;\n", + "n=8.49*10**28; #concentration of electrons in Cu per m^3\n", + "tow_r=2.44*10**-14; #relaxation time in sec\n", + "T=20; #temperature in C\n", + "\n", + "#Calculation\n", + "T=T+273; #temperature in K\n", + "sigma=(n*(e**2)*tow_r)/m;\n", + "sigmaa=sigma/10**7;\n", + "sigmaa=math.ceil(sigmaa*10**4)/10**4; #rounding off to 4 decimals\n", + "K=(n*(math.pi**2)*(k**2)*T*tow_r)/(3*m);\n", + "K=math.ceil(K*100)/100; #rounding off to 2 decimals\n", + "L=K/(sigma*T);\n", + "\n", + "#Result\n", + "print(\"electrical conductivity in ohm^-1 m^-1 is\",sigmaa,\"*10**7\");\n", + "print(\"thermal conductivity in W/mK is\",K);\n", + "print(\"Lorentz number in W ohm/K^2 is\",L);\n", + "\n", + "#answer for lorentz number given in the book is wrong\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('electrical conductivity in ohm^-1 m^-1 is', 5.8277, '*10**7')\n", + "('thermal conductivity in W/mK is', 417.89)\n", + "('Lorentz number in W ohm/K^2 is', 2.4473623172034308e-08)\n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_9-checkpoint.ipynb b/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_9-checkpoint.ipynb new file mode 100644 index 00000000..ac0ce94d --- /dev/null +++ b/Engineering_Physics_Marikani/.ipynb_checkpoints/Chapter_9-checkpoint.ipynb @@ -0,0 +1,593 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:270b268b347286b1305065ff05370a40771adf37dc336ac90b72021ab81e971f" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 9:Semiconducting materials" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.1, Page number 266" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "mew_e=0.36; #mobility of electrons in m^2/Vs\n", + "mew_h=0.14; #mobility of holes in m^2/Vs\n", + "sigma=2.2; #conductivity in ohm-1 m-1\n", + "T=300; #temperature in K\n", + "e=1.6*10**-19; #electron charge in C\n", + "\n", + "#Calculation\n", + "ni=sigma/(e*(mew_e+mew_h)); #carrier concentration per m^3\n", + "\n", + "#Result\n", + "print(\"carrier concentration of an intrinsic semiconductor per m^3 is\",ni);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('carrier concentration of an intrinsic semiconductor per m^3 is', 2.75e+19)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.2, Page number 266" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#importing modules\n", + "import math\n", + "import numpy as np\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "T1=20; #temperature in C\n", + "T2=100; #temperature in C\n", + "sigma_i20=250; #conductivity in ohm-1 m-1\n", + "sigma_i100=1100; #conductivity in ohm-1 m-1\n", + "k=1.38*10**-23;\n", + "\n", + "#Calculation\n", + "T1K=T1+273; #temperature in K\n", + "T2K=T2+273; #temperature in K\n", + "T_1K=T1K**(-1);\n", + "T_2K=T2K**(-1);\n", + "T_1=T_2K-T_1K;\n", + "T_2=T2K/T1K;\n", + "Tk=T_1**(-1);\n", + "T_k=(T_2)**(3/2);\n", + "#intrinsic carrier concentration at T1K is ni20 = 2*((2*math.pi*k*m*293)/h**2)**(3/2)*((me*mh)/m**2)**(3/4)*math.exp(-Eg/(2*k*293))\n", + "#intrinsic carrier concentration at T2K is ni100 = 2*((2*math.pi*k*m*373)/h**2)**(3/2)*((me*mh)/m**2)**(3/4)*math.exp(-Eg/(2*k*373))\n", + "#dividing ni20/ni100 = (293/373)**(3/2)*(math.exp(-Eg/(2*k*293))/math.exp(-Eg/(2*k*373)))\n", + "#ni20/ni100 = (293/373)**(3/2)*math.exp((-Eg/(2*k))((1/293)-(1/373)))\n", + "#sigma_i20/sigma_i100 = (ni20*e*(mew_e+mew_h))/(ni100*e*(mew_e+mew_h)) = ni20/ni100\n", + "#therefore sigma_i20/sigma_i100 = ni20/ni100 = (293/373)**(3/2)*math.exp((-Eg/(2*k))((1/293)-(1/373)))\n", + "#math.exp((-Eg/(2*k))*((1/293)-(1/373))) = (sigma_i20/sigma_i100)*(373/293)**(3/2)\n", + "#by taking log on both sides we get (-Eg/(2*k))*((1/293)-(1/373)) = np.log((sigma_i20/sigma_i100)*(373/293)**(3/2))\n", + "#Eg=2*k*(((1/373)-(1/293))**(-1))*np.log((sigma_i20/sigma_i100)*(373/293)**(3/2))\n", + "Eg=2*k*Tk*np.log((sigma_i20/sigma_i100)*T_k); #band gap in J\n", + "EgeV=Eg*6.241*10**18; #converting J to eV\n", + "EgeV=math.ceil(EgeV*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"band gap of the semiconductor in J is\",Eg);\n", + "print(\"band gap of the semiconductor in eV is\",EgeV);\n", + "\n", + "#answer for band gap in eV given in the book is wrong in the 4th decimal point" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('band gap of the semiconductor in J is', 4.2210259829756855e-20)\n", + "('band gap of the semiconductor in eV is', 0.2635)\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.3, Page number 267" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "I=10**-2; #current in Ampere\n", + "l=100; #length in mm\n", + "d=1; #thickness in mm\n", + "w=10; #breadth in mm\n", + "B=0.5; #magnetic field in Wb/m^2\n", + "RH=3.66*10**-4; #hall coefficient in m^3/C\n", + "\n", + "#Calculation\n", + "w=w*10**-3; #width in m\n", + "VH=(B*I*RH)/w; #hall voltage\n", + "VH=VH*10**4;\n", + "\n", + "#Result\n", + "print(\"Hall voltage in V is\",VH,\"*10**-4\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('Hall voltage in V is', 1.83, '*10**-4')\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.4, Page number 268" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "sigma=300; #conductivity in S/cm\n", + "T=300; #temperature in K\n", + "ni=1.5*10**10 #carrier concentration per cm^3\n", + "mew_e=1300; #mobility of electrons in cm^2/Vs\n", + "mew_h=500; #mobility of holes in cm^2/Vs\n", + "e=1.6*10**-19; #electron charge in C\n", + "\n", + "#Calculation\n", + "sigma=sigma*10**2; #sigma in S/m\n", + "mew_e=mew_e*10**-4; #mobility of electrons in m^2/Vs\n", + "ND=sigma/(e*mew_e); #concentration of electron per m^3\n", + "ni=ni*10**6; #carrier concentration per m^3\n", + "p=ni**2/ND; #hole concentration per m^3\n", + "p=p/10**8;\n", + "p=math.ceil(p*10**3)/10**3; #rounding off to 3 decimals\n", + "mew_h=mew_h*10**-4; #mobility of holes in m^2/Vs\n", + "NA=sigma/(e*mew_h); #concentration of hole per m^3\n", + "n=ni**2/NA; #electron concentration per m^3\n", + "n=n/10**7;\n", + "\n", + "#Result\n", + "print(\"concentration of electron for N-type semiconductor per m^3\",ND);\n", + "print(\"hole concentration per m^3\",p,\"*10**8\");\n", + "print(\"concentration of hole for P-type semiconductor per m^3\",NA);\n", + "print(\"electron concentration per m^3\",int(n),\"*10**7\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('concentration of electron for N-type semiconductor per m^3', 1.4423076923076921e+24)\n", + "('hole concentration per m^3', 1.561, '*10**8')\n", + "('concentration of hole for P-type semiconductor per m^3', 3.7499999999999995e+24)\n", + "('electron concentration per m^3', 6, '*10**7')\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.5, Page number 269" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "RH=-3.68*10**-5; #hall coefficient in m^3/C\n", + "e=1.6*10**-19; #electron charge in C\n", + "\n", + "#Calculation\n", + "#hall coefficient is negative implies charge carriers are electrons\n", + "n=(3*math.pi)/(8*(-RH)*e); #carrier concentration\n", + "\n", + "#Result\n", + "print(\"charge carriers are electrons\");\n", + "print(\"carrier concentration per m^3 is\",n);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "charge carriers are electrons\n", + "('carrier concentration per m^3 is', 2.000844505937792e+23)\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.6, Page number 269" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "\n", + "#Variable declaration\n", + "Eg1=0.36; #energy gap of 1st material in eV\n", + "Eg2=0.72; #energy gap of 2nd material in eV\n", + "T=300; #temperature in K\n", + "mh=9*10**-31;\n", + "me=9*10**-31; \n", + "#given that 2*k*T=0.052; \n", + "#consider X=2*k*T\n", + "X=0.052;\n", + "\n", + "#Calculation\n", + "#intrinsic carrier concentration for A niA = 2*((2*math.pi*k*T*m)/h**2)**(3/2)*((me*mh)/m**2)**(3/4)*math.exp(-0.36/(2*k*T))\n", + "#intrinsic carrier concentration for B niB = 2*((2*math.pi*k*T*m)/h**2)**(3/2)*((me*mh)/m**2)**(3/4)*math.exp(-0.72/(2*k*T))\n", + "#dividing niA/niB = math.exp(-0.36/(2*k*T))*math.exp(0.72/(2*k*T))\n", + "#let niA/niB be A\n", + "A = math.exp(-0.36/X)*math.exp(0.72/X);\n", + "A=A/10**3;\n", + "A=math.ceil(A*10**5)/10**5; #rounding off to 5 decimals\n", + "\n", + "#Result\n", + "print(\"ratio of intrinsic carrier densities of A and B is\",A,\"*10**3\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('ratio of intrinsic carrier densities of A and B is', 1.01544, '*10**3')\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.7, Page number 270" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "ND=2*10**22; #concentration of electron per m^3\n", + "sigma=112; #conductivity in ohm-1 m-1\n", + "e=1.6*10**-19; #electron charge in C\n", + "\n", + "#Calculation\n", + "mew=sigma/(ND*e); #mobility of electrons \n", + "mew=math.ceil(mew*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"mobility of electrons in m^2/Vs is\",mew);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('mobility of electrons in m^2/Vs is', 0.035)\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.8, Page number 270" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "w=500; #thickness in micrometre\n", + "A=2.5*10**-3; #area of cross section in cm^-2\n", + "Ix=1; #current in ampere\n", + "Bz=10; #magnetic field in Wb/cm^2\n", + "n=10**16; #donor concentration in m^-3\n", + "e=1.6*10**-19; #electron charge in C\n", + "\n", + "#Calculation\n", + "Bz=Bz*10**-4; #magnetic field in Wb/m^2\n", + "w=w*10**-6; #thickness in m\n", + "RH=(3*math.pi)/(8*n*e); #hall coefficient\n", + "VH=(Bz*Ix*RH)/w; #hall voltage\n", + "VH=VH/10**3;\n", + "VH=math.ceil(VH*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"hall voltage in V is\",VH,\"*10**3\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('hall voltage in V is', 1.4727, '*10**3')\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.9, Page number 271" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "from __future__ import division\n", + "import numpy as np\n", + "\n", + "#Variable declaration\n", + "Eg=1.2; #energy gap in eV\n", + "T1=300; #temperature in K\n", + "T2=600; #temperature in K\n", + "k=1.38*10**-23;\n", + "\n", + "#Calculation\n", + "T_1=T1**(-1);\n", + "T_2=T2**(-1);\n", + "T=T_1-T_2;\n", + "Eg=Eg*1.602*10**-19; #Eg in J\n", + "#sigma_300=ni300*e*(mew_e+mew_h)\n", + "#sigma_600=ni600*e*(mew_e+mew_h)\n", + "#sigma_600/sigma_300 = ni600/ni300\n", + "#ni600/ni300 =((T2/T1)**(3/2))*math.exp(-Eg/(2*k*T2))*math.exp(Eg/(2*k*T1));\n", + "#ni600/ni300 =((T2/T1)**(3/2))*math.exp((Eg/(2*k))*T;\n", + "#let ni600/ni300 be X\n", + "X=((T2/T1)**(3/2))*math.exp((Eg/(2*k))*T);\n", + "\n", + "\n", + "#Result\n", + "print(\"ratio between the conductivity of material is\",int(X));\n", + "\n", + "#answer given in the book is wrong" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('ratio between the conductivity of material is', 311270)\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.10, Page number 272" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "sigma=10**-6; #electrical conductivity in ohm-1 m-1\n", + "mew_e=0.85; #electron mobility in m^2/Vs\n", + "mew_h=0.04; #hole mobility in m^2/Vs\n", + "e=1.6*10**-19; #electron charge in C\n", + "\n", + "#Calculation\n", + "ni=sigma/(e*(mew_e+mew_h)); #intrinsic carrier concentration\n", + "ni=ni/10**12;\n", + "ni=math.ceil(ni*10**4)/10**4; #rounding off to 4 decimals\n", + "\n", + "#Result\n", + "print(\"intrinsic carrier concentration per m^3 is\",ni,\"*10**12\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('intrinsic carrier concentration per m^3 is', 7.0225, '*10**12')\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 9.11, Page number 272" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#importing modules\n", + "import math\n", + "\n", + "#Variable declaration\n", + "rho_p=10; #resistivity of p-type Si in ohm cm\n", + "rho_n=10; #resistivity of n-type Si in ohm cm\n", + "mew_e=1350; #electron mobility in cm^2/Vs\n", + "mew_h=480; #hole mobility in cm^2/Vs\n", + "ni=1.5*10**10; #carrier concentration in cm^-3\n", + "e=1.6*10**-19; #electron charge in C\n", + "\n", + "#Calculation\n", + "rho_p=rho_p*10**-2;#resistivity of p-type Si in ohm m\n", + "sigma_p=1/rho_p; #electrical conductivity\n", + "mew_h=mew_h*10**-3;\n", + "NA=sigma_p/(e*mew_h); #acceptor concentration\n", + "ni=ni*10**6; #carrier concentration in m^-3\n", + "n=ni**2/NA; #concentration of minority carriers in m^-3\n", + "n=n/10**12;\n", + "n=math.ceil(n*10**4)/10**4; #rounding off to 4 decimals\n", + "rho_n=rho_n*10**-2; #resistivity of n-type Si in ohm m\n", + "sigma_n=1/rho_n; #electrical conductivity\n", + "mew_e=mew_e*10**-3;\n", + "ND=sigma_n/(e*mew_e); #donor concentration\n", + "p=(ni**2)/ND; #concentration of minority carriers in m^-3\n", + "p=p/10**12;\n", + "p=math.ceil(p*10**3)/10**3; #rounding off to 3 decimals\n", + "\n", + "#Result\n", + "print(\"donor concentration per m^3 is\",ND);\n", + "print(\"concentration of minority carriers per m^3\",p,\"*10**12\");\n", + "print(\"acceptor concentration per m^3 is\",NA);\n", + "print(\"concentration of minority carriers per m^3 is\",n,\"*10**12\");" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('donor concentration per m^3 is', 4.6296296296296284e+19)\n", + "('concentration of minority carriers per m^3', 4.861, '*10**12')\n", + "('acceptor concentration per m^3 is', 1.3020833333333331e+20)\n", + "('concentration of minority carriers per m^3 is', 1.7281, '*10**12')\n" + ] + } + ], + "prompt_number": 33 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Physics_Marikani/Chapter_1.ipynb b/Engineering_Physics_Marikani/Chapter_1.ipynb index a6934dcd..7a32a75c 100644 --- a/Engineering_Physics_Marikani/Chapter_1.ipynb +++ b/Engineering_Physics_Marikani/Chapter_1.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:dbcb8c7a4d852e94c64ae36b37434de99bb1000ca8d8a481769813b464811eeb" + "signature": "sha256:f0147baa6539dde2e5e40854d7e8ae89584d608f2c37adec57bbfd3463f15381" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Ultrasonics" + "chapter 1 :Ultrasonics" ] }, { diff --git a/Engineering_Physics_Marikani/Chapter_10.ipynb b/Engineering_Physics_Marikani/Chapter_10.ipynb index cad8c3fc..618b7220 100644 --- a/Engineering_Physics_Marikani/Chapter_10.ipynb +++ b/Engineering_Physics_Marikani/Chapter_10.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:e2ed8f14e9384f32112bf8b476c63d65b4316d749e72b2c8fa7bc92794bf7f8a" + "signature": "sha256:a68b800341d76942fca474468b85c38e8f1fda41ad54f08b7e2e15491366631f" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Magnetic materials" + "chapter 10 :Magnetic materials" ] }, { diff --git a/Engineering_Physics_Marikani/Chapter_11.ipynb b/Engineering_Physics_Marikani/Chapter_11.ipynb index 781b51dc..f109e616 100644 --- a/Engineering_Physics_Marikani/Chapter_11.ipynb +++ b/Engineering_Physics_Marikani/Chapter_11.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:6c9d1e462fb51d212d5e8b8f597a34ef40452b9332c91d54e15e6a4dccd85074" + "signature": "sha256:29a37b96820b0c567836cbf3c967420f2a26c61ad740e02e53681e54403a65e6" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Dielectric materials" + "chapter 11:Dielectric materials" ] }, { diff --git a/Engineering_Physics_Marikani/Chapter_12.ipynb b/Engineering_Physics_Marikani/Chapter_12.ipynb index dba2b7b8..a5eef828 100644 --- a/Engineering_Physics_Marikani/Chapter_12.ipynb +++ b/Engineering_Physics_Marikani/Chapter_12.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:40ea4bb009666aeba2b07d31c3573a833c155d9ac8e902b20b5967865ae89dbb" + "signature": "sha256:aaad955b88887698ca822516a176e0f135631494b60fc93691930e22559b08da" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Superconducting Materials" + "chapter 12 :Superconducting Materials" ] }, { diff --git a/Engineering_Physics_Marikani/Chapter_2.ipynb b/Engineering_Physics_Marikani/Chapter_2.ipynb index b54dc631..08340d6b 100644 --- a/Engineering_Physics_Marikani/Chapter_2.ipynb +++ b/Engineering_Physics_Marikani/Chapter_2.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:86128ebcddc1aace30166722ef06d4489b2c11f53b2c59c5d439d37f83881533" + "signature": "sha256:2d233920f46d8faa184807b46855786207cc4bf2ef3d7d948f12d38b4c41e9ee" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Laser" + "chapter 2:Laser" ] }, { diff --git a/Engineering_Physics_Marikani/Chapter_3.ipynb b/Engineering_Physics_Marikani/Chapter_3.ipynb index 7496a57a..7f945f36 100644 --- a/Engineering_Physics_Marikani/Chapter_3.ipynb +++ b/Engineering_Physics_Marikani/Chapter_3.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:3f2462cfb429298e26fc6bf563d665947cd211731889b95d7dd1a2db3452c286" + "signature": "sha256:35467350b4863e7f6cc10f1050833b31369f245d82605e396be30db7df04f739" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Fibre Optics" + "chapter 3 :Fibre Optics" ] }, { diff --git a/Engineering_Physics_Marikani/Chapter_4.ipynb b/Engineering_Physics_Marikani/Chapter_4.ipynb index d2b8123c..5c898d41 100644 --- a/Engineering_Physics_Marikani/Chapter_4.ipynb +++ b/Engineering_Physics_Marikani/Chapter_4.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:e581747b76e15afc0096179446c0fbd68c3566f21f4931be3d8fc722fc1225b8" + "signature": "sha256:e23147666fa50bbe76f447b3ec3e5fb01c2732ae073bde8ca773b976876285b0" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Quantum Physics" + "chapter 4:Quantum Physics" ] }, { diff --git a/Engineering_Physics_Marikani/Chapter_6.ipynb b/Engineering_Physics_Marikani/Chapter_6.ipynb index f66bf1b2..ed87272f 100644 --- a/Engineering_Physics_Marikani/Chapter_6.ipynb +++ b/Engineering_Physics_Marikani/Chapter_6.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:be1bff093c78fabbeb6fefe6e4abb0ea03e38b876fbc4829ed2c2e8b1df1e947" + "signature": "sha256:35feb7911503610a1a19ef2ec03875bdff92ac67a47547d78b073137822b7f5e" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Crystallography" + "chapter 6:Crystallography" ] }, { diff --git a/Engineering_Physics_Marikani/Chapter_7.ipynb b/Engineering_Physics_Marikani/Chapter_7.ipynb index 706a4598..66d47038 100644 --- a/Engineering_Physics_Marikani/Chapter_7.ipynb +++ b/Engineering_Physics_Marikani/Chapter_7.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:f1c728f94d30127360e83c10a55164d3b256772685ed9e2e28ae6d78b3f4a0ae" + "signature": "sha256:5c43a25c95f2d38dcba2c96190ddc992684530d01ab1e8a2e25860b8bf302d5b" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Crystal Imperfections" + "chapter 7:Crystal Imperfections" ] }, { diff --git a/Engineering_Physics_Marikani/Chapter_8.ipynb b/Engineering_Physics_Marikani/Chapter_8.ipynb index 1db414de..f623e51d 100644 --- a/Engineering_Physics_Marikani/Chapter_8.ipynb +++ b/Engineering_Physics_Marikani/Chapter_8.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:1a361e48153d58a5820c879429a5bbafe3e6e3df7d99a198492b082874550ac1" + "signature": "sha256:d6731122effef7e9230b6bfa598804c6ee1a10d92c79e1ae784678d16b396704" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Conducting materials" + "chapter 8:Conducting materials" ] }, { diff --git a/Engineering_Physics_Marikani/Chapter_9.ipynb b/Engineering_Physics_Marikani/Chapter_9.ipynb index bcdb04e8..ac0ce94d 100644 --- a/Engineering_Physics_Marikani/Chapter_9.ipynb +++ b/Engineering_Physics_Marikani/Chapter_9.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:0873412d6a4e98969b64a50f25d022cd9e4d104c8635e0bc9bd27817ed58d4b4" + "signature": "sha256:270b268b347286b1305065ff05370a40771adf37dc336ac90b72021ab81e971f" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Semiconducting materials" + "chapter 9:Semiconducting materials" ] }, { diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/README.txt b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/README.txt deleted file mode 100644 index 3d9a2b47..00000000 --- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/README.txt +++ /dev/null @@ -1,10 +0,0 @@ -Contributed By: Ashutosh Kumar -Course: btech -College/Institute/Organization: Indian Institute of Technology - Bombay, CHAR Lab 2 -Department/Designation: Electrical Department -Book Title: Engineering Thermodynamics: A Computer Approach (SI Units Version) -Author: R. K. Rajput -Publisher: Laxmi Pulications (P) Ltd., New Delhi -Year of publication: 2007 -Isbn: 9780763782726 -Edition: 3rd \ No newline at end of file diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/screenshots/ashu1.png b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/screenshots/ashu1.png deleted file mode 100644 index 13e13f29..00000000 Binary files a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/screenshots/ashu1.png and /dev/null differ diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/screenshots/ashu2.png b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/screenshots/ashu2.png deleted file mode 100644 index e1bc353c..00000000 Binary files a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/screenshots/ashu2.png and /dev/null differ diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/screenshots/ashu3.png b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/screenshots/ashu3.png deleted file mode 100644 index 60dd1e4b..00000000 Binary files a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/screenshots/ashu3.png and /dev/null differ diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/screenshots/ashutosh-3-1_1.png b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/screenshots/ashutosh-3-1_1.png deleted file mode 100644 index 13e13f29..00000000 Binary files a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/screenshots/ashutosh-3-1_1.png and /dev/null differ diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/screenshots/ashutosh-3-2_1.png b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/screenshots/ashutosh-3-2_1.png deleted file mode 100644 index e1bc353c..00000000 Binary files a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/screenshots/ashutosh-3-2_1.png and /dev/null differ diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/screenshots/ashutosh-3-3_1.png b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/screenshots/ashutosh-3-3_1.png deleted file mode 100644 index 60dd1e4b..00000000 Binary files a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/screenshots/ashutosh-3-3_1.png and /dev/null differ diff --git a/Fluid_Mechanics_-_Worked_Examples_For_Engineers/.ipynb_checkpoints/Chapter_1_1-checkpoint.ipynb b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/.ipynb_checkpoints/Chapter_1_1-checkpoint.ipynb new file mode 100644 index 00000000..c3d00505 --- /dev/null +++ b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/.ipynb_checkpoints/Chapter_1_1-checkpoint.ipynb @@ -0,0 +1,620 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:f74ebb3df14e61a18adced8ec1d013b274b4ed30f643d40b946b0969c2ba80e2" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter1: Fluid Statics" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.1,Page 3" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable Decleration\n", + "rho=924; #density\n", + "g=9.81; #grivity\n", + "H=2; #height\n", + "d=2; # depth \n", + "\n", + "#Calculation\n", + "p=rho*g*H;\n", + "a=d*H;\n", + "F=p*a/2;\n", + "\n", + "#result\n", + "print\" Total force exerted over the wall in(N) =\",round(F,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total force exerted over the wall in(N) = 36257.76\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.2,Page 5" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#Variable declaration\n", + "p_v =50*1000; #pressure\n", + "r =1; #m\n", + "p_atm =101.3*1000; #atmospheric pressure\n", + "rho =1000; #density\n", + "H =2.5; #m\n", + "g =9.81; #m/s^2\n", + "\n", + "\n", + "#Calculation\n", + "F= p_v*math.pi*r*r;\n", + "p= p_atm + p_v + rho *g*H;\n", + "Fd =( p_v+ rho *g*H)*math.pi*r*r+rho*g*2*math.pi*r*r/3;\n", + "\n", + "#result\n", + "print \" Total vertical force tending to lift the dome (N)\", round(F,3)\n", + "print \" Absolute pressure at the bottom o f the vessel (Pa)\",round(p,3)\n", + "print \"Downward force imposed by the gas and liquid (N)\", round(Fd,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total vertical force tending to lift the dome (N) 157079.633\n", + " Absolute pressure at the bottom o f the vessel (Pa) 175825.0\n", + "Downward force imposed by the gas and liquid (N) 254673.208\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.3,Page 7" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable Decleration\n", + "a1 =0.3; #m^2\n", + "m =1000; # kg\n", + "a2 =0.003; #m^2\n", + "rho_oil =750; #kg /m^3\n", + "H =2; #m\n", + "g =9.81; #m/ s ^2\n", + "\n", + "# Calcualtion\n", + "F1=m*g;\n", + "F2=a2 *( F1/a1 - rho_oil *g*H);\n", + "\n", + "#result\n", + "print \"The force on the plunger(N)\",round(F2,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The force on the plunger(N) 53.955\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.4,Page 8" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#variable Decleration\n", + "rho_0 =800; # kg /m^3\n", + "rho_aq =1100; # density of aqueous solution\n", + "\n", + "#calculation\n", + "H =0.5* rho_aq /( rho_aq - rho_0 );\n", + "# For a fixed length of chamber o f 3 m, the\n", + "#interface between the two phases is determined\n", + "#from the p r e s s u r e i n the chamber and d i s c h a r g e\n", + "#p o i n t .\n", + "#r h o 0 \u0003g\u0003H1+rho a q \u0003g\u0003H2=rho a q \u0003g \u0003(H\udbc0\udc000.5) ;\n", + "#H=H1+H2\n", + "rho_0 =600; #kg /m^3\n", + "H1 =0.5* rho_aq /( rho_aq - rho_0 );\n", + "\n", + "#result\n", + "print \"H(m)\",round(H,3)\n", + "print \"The lowest possible position of the interface in the chamber below the overflow (m)\",round(H1,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "H(m) 1.833\n", + "The lowest possible position of the interface in the chamber below the overflow (m) 1.1\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.5, Page11" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable decleration\n", + "rho_o =900; #kg /m^3\n", + "rho_n =1070; #kg /m^3\n", + "H =1; #m\n", + "g =9.81; #m/ s ^2\n", + "dp =10*10**3; #change in pressure\n", + "\n", + "#H=H1+H2\n", + "#calculation\n", + "H1 =(dp - rho_n *g*H)/( rho_o - rho_n )/g;\n", + "\n", + "#result\n", + "print \"The position of the interface between the legs (m)\", round(H1,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The position of the interface between the legs (m) 0.3\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.6,Page 13" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Variable defining\n", + "dp =22*10**3; #N/m^2\n", + "g =9.81;#m/ s ^2\n", + "H =1.5;#m\n", + "rho =1495.00;#kg /m^3\n", + "rho_s =1270;#kg /m^3\n", + "rho_c =2698;#kg /m^3\n", + "\n", + "# Calculation\n", + "p=dp/g/H;\n", + "#rho=f 1 \u0003 r h o s+f 2 \u0003 r h o c\n", + "#f 1+f 2=1\n", + "f2 =( rho - rho_s )/( rho_c - rho_s );\n", + "\n", + "#result\n", + "print \" the density of the solution with crystals (kg/m^3)\",round(p,3)\n", + "print \"The fraction of crystals \", round(f2,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " the density of the solution with crystals (kg/m^3) 1495.073\n", + "The fraction of crystals 0.158\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.7, Page 15" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable defining\n", + "p_atm =101.3*10**3; #N/m^2\n", + "rho =1000; #kg /m^3\n", + "g =9.81; #m/ s ^2\n", + "H1 =3; #m\n", + "a =0.073; #N/m\n", + "r1 =5*10**( -4) ; #m\n", + "p1= p_atm + rho *g*H1 +2* a/r1;\n", + "\n", + "#calculation\n", + "# p2=p atm+rho \u0003g\u0003H2+2\u0003a / r2 ;\n", + "# p1 \u00034/3\u0003%pi\u0003 r1 ^3=p2 \u00034/3\u0003%pi\u0003 r2 ^3\n", + "# Solving above two equations we get\n", + "r2 =0.053; #//mm\n", + "\n", + "#result\n", + "print\"Radius of the bubble(mm)\",round(r2,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Radius of the bubble(mm) 0.053\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.8,Page 17" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable defining\n", + "H =0.2; #m\n", + "rho =1000; #kg /m^3\n", + "rho_Hg =13600; #kg /m^3\n", + "g =9.81; #m/ s ^2\n", + "\n", + "#calculation\n", + "dp =( rho_Hg -rho)*g*H;\n", + "\n", + "#result\n", + "print \" Differential pressure(Pa)\",round(dp,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Differential pressure(Pa) 24721.2\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.9,Page 19" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable defining\n", + "rho =1000;\n", + "g =9.81; # m/ s ^2\n", + "H =0.4; #m\n", + "\n", + "#calculation\n", + "dp=rho*g*H;\n", + "\n", + "#result\n", + "print\" Pressure drop in the pipe(Pa)\",round(dp)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Pressure drop in the pipe(Pa) 3924.0\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.10,Page 21" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#variable defining\n", + "dp =20*10**3; #N/m^2\n", + "rho_Hg =13600; # kg /m^3\n", + "rho =700; #kg /m^3\n", + "g =9.81; #m/ s ^2\n", + "d =0.02; #m\n", + "\n", + "\n", + "#calculation\n", + "H=dp*(rho_Hg - rho)**-1/g;\n", + "V= math.pi /4*d*d*H;\n", + "\n", + "#result\n", + "print\"Quantity of mercury to be removed (m^3)\",round(V,9)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Quantity of mercury to be removed (m^3) 4.965e-05\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.11,Page 23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable defining\n", + "import math\n", + "from math import sin\n", + "rho =800; #kg /m^3\n", + "g =9.81; #m/ s ^2\n", + "L =0.12;\n", + "\n", + "\n", + "#calculations\n", + "theta = math.pi /180*20; #radians\n", + "dp=rho*g*L*(sin(theta));\n", + "\n", + "#result\n", + "print \"The gauge pressure across the filter(Pa)\",round(dp,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The gauge pressure across the filter(Pa) 322.100890178\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.12,Page 25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable defining\n", + "mc =100; #kg\n", + "g =9.81; #m/ s ^2\n", + "rho =1000; #kg /m^3\n", + "rho_c =7930; #kg /m^3\n", + "\n", + "#calculation\n", + "m=mc*rho/ rho_c ;\n", + "F=mc*g-m*g; #tension\n", + "\n", + "#result\n", + "print(\"The tension in the cable(N)\",round(F,2))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "('The tension in the cable(N)', 863.28)\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.13,Page 27" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variale defining\n", + "rho =1000.0;\n", + "x =0.06;\n", + "rho_0 =800.0;\n", + "x_0 =0.04;\n", + "rho_L =900.0;\n", + "\n", + "#calculation\n", + "L=( rho*x- rho_0 *x_0)/( rho - rho_0 );\n", + "x_L =L-rho/ rho_L *(L-x);\n", + "\n", + "#result\n", + "print \" Length of the stem above the liquid of SG 0.9 is (m)\",round(x_L,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Length of the stem above the liquid of SG 0.9 is (m) 0.05\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.14,Page 29\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable defining\n", + "m_s =5*10**6; #kg\n", + "T2 =4.5; #m\n", + "T1 =3; #m\n", + "rho_hc =950; #kg /m^3\n", + "Q =125; #m^3/h\n", + "\n", + "#calculation\n", + "m_hc =m_s *( T2/T1 -1);\n", + "t= m_hc / rho_hc /Q;\n", + "\n", + "#result\n", + "print\"Quantity delivered(kg)\",round(m_hc,2)\n", + "print \"Time taken(hours)\",round(t,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Quantity delivered(kg) 2500000.0\n", + "Time taken(hours) 21.053\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fluid_Mechanics_-_Worked_Examples_For_Engineers/.ipynb_checkpoints/Chapter_2_1-checkpoint.ipynb b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/.ipynb_checkpoints/Chapter_2_1-checkpoint.ipynb new file mode 100644 index 00000000..72318a60 --- /dev/null +++ b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/.ipynb_checkpoints/Chapter_2_1-checkpoint.ipynb @@ -0,0 +1,380 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:785f37cfaf9aeabbac4169c1fd95bd67ae8666fc83631f2d394e32747e65fd3b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 2,Continuity Momentum and Energy" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.1,Page 36" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from math import pi\n", + "\n", + "\n", + "#variable decleration\n", + "Q1 =0.02; #m^3/ s\n", + "d1 =0.15; #m\n", + "d2 =0.05; #m\n", + "d3 =0.1; #m\n", + "v2 =3; #m/ s\n", + "\n", + "\n", + "#calculation\n", + "Q2=pi*d2 **2/4* v2;\n", + "v3 =(4* Q1/pi -d2 **2* v2)/d3 **2;\n", + "Q3=pi*d3 **2/4* v3;\n", + "v1 =4*( Q2+Q3)/pi/d1 **2;\n", + "\n", + "\n", + "#result\n", + "print\" Flow rate at pipe 3(m^3/s) =\",round(Q3,4)\n", + "print\" Flow rate at pipe 2(m^3/s)= \",round(Q2,4)\n", + "print\" Flow rate at pipe 1(m^3/s)= \",round(Q1,4)\n", + "print\" Velocity at pipe 1(m/s) =\",round(v1,3)\n", + "print\" Velocity at pipe 2(m/s) =\",round(v2,3)\n", + "print\" Velocity at pipe 3(m/s) =\",round(v3,3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Flow rate at pipe 3(m^3/s) = 0.0141\n", + " Flow rate at pipe 2(m^3/s)= 0.0059\n", + " Flow rate at pipe 1(m^3/s)= 0.02\n", + " Velocity at pipe 1(m/s) = 1.132\n", + " Velocity at pipe 2(m/s) = 3.0\n", + " Velocity at pipe 3(m/s) = 1.796\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.2,Page 38" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#variable decleration\n", + "import math\n", + "from math import pi\n", + "d1 =0.2; #m\n", + "d2=d1;\n", + "p1 =1*10**5; #N/m^2\n", + "p2 =80*10**3; #N/m^2\n", + "Q =150.0; #m^3/h\n", + "rho =900; #kg /m^3\n", + "theta1 =0; # r a d i a n s\n", + "theta2 =pi; # r a d i a n s\n", + "\n", + "#calculation\n", + "a1=pi*d1 **2/4;\n", + "a2=pi*d2 **2/4;\n", + "F1=p1*a1; # Upstream f o r c e\n", + "F2=p2*a2; # Downstream f o r c e\n", + "v1 =4*Q /3600/ pi/d1 **2;\n", + "v2=v1;\n", + "flux =rho*Q /3600* v2; #Momentum f l u x\n", + "Fx=F1* math.cos ( theta1 )-F2* math.cos ( theta2 )+ flux *( math.cos ( theta2 ) -\n", + "math.cos ( theta1 ));\n", + "Fy=F1* math.sin ( theta1 )-F2* math.sin ( theta2 )-flux *( math.sin ( theta2 )-\n", + "math.sin ( theta1 ));\n", + "F= math.sqrt (Fx **2+ Fy **2);\n", + "\n", + "#result\n", + "print\" Force exerted by liquid (kN) =\",round(F,2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Force exerted by liquid (kN) = 5552.47608322\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.3,Page 40" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from math import pi\n", + "\n", + "#variable decleration\n", + "rho =1000; # kg /m^3\n", + "d =0.05; #m\n", + "L =500; #m\n", + "v =1.7; #m/ s\n", + "\n", + "#calculation\n", + "a= pi *d **2/4;\n", + "F= rho *a*L*v;\n", + "P=F/a /10**3;\n", + " \n", + "#result \n", + "print\"Average pressure(kN/m^2) =\",round(P)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Average pressure(kN/m^2) = 850.0\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.4,Page 42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable decleration\n", + "import math\n", + "g =9.8; #m/ s ^2\n", + "dz =0.2; #m ; dz1=z1-z2=z1-z2\n", + "rho =1000; # kg /m^3\n", + "dz1 =2; #m ; dz1=z1-z A\n", + "dz2 =0; #m ; dz2=z1-z B\n", + "dz3 = -1.5; #m ; dz3=z1-z C\n", + "\n", + "#calculation\n", + "v2= math.sqrt (2* g*dz);\n", + "v_A =v2;\n", + "v_B =v2;\n", + "v_C =v2;\n", + "p_A = rho *g*( dz1 - v_A **2/2/ g);\n", + "p_B = rho *g*( dz2 - v_B **2/2/ g);\n", + "p_C = rho *g*( dz3 - v_C **2/2/ g);\n", + "\n", + "#result\n", + "print\" Velocity at pt . A(m/s) =\",round(v_A,2);\n", + "print\" Velocity at pt . B(m/s) =\",round(v_B,2);\n", + "print\" Velocity at pt . C(m/s) =\",round(v_C,2);\n", + "print\" Pressure at pt . A(kN/m^2) =\",round(p_A)\n", + "print\" Pressure at pt . B (kN/m^2)=\",round(p_B)\n", + "print\" Pressure at pt . C (kN/m^2)=\",round(p_C)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Velocity at pt . A(m/s) = 1.98\n", + " Velocity at pt . B(m/s) = 1.98\n", + " Velocity at pt . C(m/s) = 1.98\n", + " Pressure at pt . A(kN/m^2) = 17640.0\n", + " Pressure at pt . B (kN/m^2)= -1960.0\n", + " Pressure at pt . C (kN/m^2)= -16660.0\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.5,Page 44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from math import pi\n", + "\n", + "#variable decleration\n", + "Q =10.0; # m^3/ hr\n", + "d1 =0.05; #m\n", + "d2 =0.1; #m\n", + "rho =1000.0; #kg /m^3\n", + "g=9.81;\n", + "\n", + "\n", + "#calculation\n", + "a1=pi*d1 **2/4;\n", + "a2=pi*d2 **2/4;\n", + "v1=Q /3600/ a1;\n", + "v2 =( d1/d2) **2* v1;\n", + "PD=rho*0.057*g;\n", + "\n", + "#results\n", + "print\" Presure drop (N/m^2)=\",round(PD,3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Presure drop (N/m^2)= 375.26364312\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7,Page 48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable decleration\n", + "Q =100; #m^3/ hr\n", + "d1 =0.2; #m\n", + "d2 =0.15; #m\n", + "p1 =80*10**3; #N/m^2\n", + "rho =1000; # kg /m^3\n", + "g =9.8; #m/ s ^2\n", + "pi=3.14;\n", + "\n", + "#calculation\n", + "a1=pi*d1 **2/4;\n", + "a2=pi*d2 **2/4;\n", + "v1=Q /3600/ a1;\n", + "v2=Q /3600/ a2;\n", + "H_L =0.2* v2 **2/2/ g;\n", + "p2=p1+ rho /2*( v1 **2- v2 **2) -rho*g* H_L ;\n", + "F_u =p1*a1; # Upstream f o r c e\n", + "F_d =p2*a2; # Downstream f o r c e\n", + "F_x = rho *Q /3600*( v2 -v1)-F_u +F_d;\n", + "\n", + "#results\n", + "print\" Force required (N) =\",round(F_x)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Force required (N) = -1099.0\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.9,Page 53" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#variable decleration\n", + "N =60; #rpm\n", + "r2 =0.25; #m\n", + "g =9.8; #m/ s ^2\n", + "pi=3.14;\n", + "\n", + "w =2* pi*N /60;\n", + "dz_12 =(w*r2) **2/2/ g; # dz 1 2=z2-z1\n", + "c=w*r2 **2;\n", + "dz_23 =c **2/2/ g/r2 **2; # dz 2 3=z3-z2\n", + "dz_13 = dz_23 + dz_12 ;\n", + "\n", + "#results\n", + "print\" Total depression(m) =\",round(dz_13,3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total depression(m) = 0.252\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fluid_Mechanics_-_Worked_Examples_For_Engineers/.ipynb_checkpoints/Chapter_3_1-checkpoint.ipynb b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/.ipynb_checkpoints/Chapter_3_1-checkpoint.ipynb new file mode 100644 index 00000000..047caec2 --- /dev/null +++ b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/.ipynb_checkpoints/Chapter_3_1-checkpoint.ipynb @@ -0,0 +1,551 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:f2eaea1b025b2ddec764d2fab1514700e255b4e2c5860b0d8b1ba9dafae0ccc9" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 3,Laminar Flow and Lubrication" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.2,Page 63" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#variable decleration\n", + "Re =2000.0;\n", + "d =0.008; #m\n", + "\n", + "#calculation\n", + "L1 =0.058* Re*d;\n", + "\n", + "#result\n", + "print\"The furtherest distance the fluid can flow into the 8 mm inside diameter pipe (m)=\",round(L1,3);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The furtherest distance the fluid can flow into the 8 mm inside diameter pipe (m)= 0.928\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.4,Page 67" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from math import pi\n", + "\n", + "#variable decleration\n", + "del_p =90*10**3; # N/m^2\n", + "d =0.126; # m\n", + "R =0.126/2; # m\n", + "u =1.2;\n", + "L =60; # m\n", + "Rho =1260;\n", + "\n", + "\n", + "#calculation\n", + "Q= pi * del_p * R**4 / (8*u*L);\n", + "Re =4* Rho *Q/(u*pi*d);\n", + "\n", + "#result\n", + "print \"The glycerol delivery rate is (m^3/s) \",round(Q,4);\n", + "print\"The Reynolds number is \",round(Re,3);\n", + "print\"As Re is below 2000 , so, laminar flow\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The glycerol delivery rate is (m^3/s) 0.0077\n", + "The Reynolds number is 82.047\n", + "As Re is below 2000 , so, laminar flow\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.5,Page 69" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from math import pi\n", + "\n", + "#variable decleration\n", + "u =0.015; #Ns/m^2\n", + "Q =0.004/60; #m^3/ s\n", + "dp =100;\n", + "rho =1100.0; #kg /m^3\n", + "\n", + "\n", + "#calculation\n", + "R =(8* u*Q/( pi *dp)) **(0.25) ;\n", + "Re =(4* rho *Q/( pi*u *(2* R)));\n", + "\n", + "#result\n", + "print\"Diameter of the pipe(m) =\",round(R,3);\n", + "print\"Reynolds number =\",round(Re,2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Diameter of the pipe(m) = 0.013\n", + "Reynolds number = 246.38\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.6,Page 71" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from math import pi\n", + "\n", + "#variable decleration\n", + "mu =0.03; #Ns/m^2\n", + "Q =10.0**( -7) ; #m^3/ s\n", + "u=(7.0);\n", + "\n", + "#calculation\n", + "dp= 8*mu*Q*u/3/pi/0.005**4;\n", + "\n", + "#result\n", + "print\" pressure difference (N/m^2)=\",round(dp,2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " pressure difference (N/m^2)= 28.52\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.8,Page 75" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from math import pi\n", + "\n", + "#variable decleration\n", + "u =0.1; #Ns/m^2\n", + "d =0.1; #m\n", + "R =0.05; # m\n", + "Rho =900; #kg /m^3\n", + "v_max =2; # m/ s\n", + "v= v_max /2; # m/ s\n", + "\n", + "#calculation\n", + "Tw = 2*u* v_max /R;\n", + "del_p =4* u* v_max /R **2;\n", + "\n", + "#result\n", + "print \"At the pipe wa l l ( r =R) , shear stress (N/m^2)= \",Tw;\n", + "print\" pressure drop per metre lengthh of pipe is (N/m^2)\",del_p;\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "At the pipe wa l l ( r =R) , shear stress (N/m^2)= 8.0\n", + " pressure drop per metre lengthh of pipe is (N/m^2) 320.0\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.9,Page 77" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#variable decleration\n", + "import math\n", + "u =0.032; #Ns/m^2\n", + "Re =2000.0; #maximum v a l u e\n", + "Rho =854.0;\n", + "del_p =150.0; #N/m^2\n", + "\n", + "#calculation\n", + "d =(32* u **2* Re /( Rho* del_p ))**(0.33) ;\n", + "\n", + "print \"The maximum inside diameter is found to be (m) \",round(d,3);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The maximum inside diameter is found to be (m) 0.082\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.10,Page 79" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from math import pi\n", + "#variable decleration\n", + "rho =1000; #kg /m^3\n", + "u =0.1; #Ns/m^2\n", + "g =9.81; #m/ s ^2\n", + "L =10; #m\n", + "H =2; #m\n", + "Q =14.0/3600; #m^3/ s\n", + "d =0.05; #m\n", + "\n", + "#calculation\n", + "dp=rho*g*(L+H) - (128* Q*u*L/pi /d**4) ;\n", + "\n", + "#result\n", + "print\" Pressure drop across the valve (N/m^2)=\",round(dp,2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Pressure drop across the valve (N/m^2)= 92368.39\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.12,Page 83" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable decleration\n", + "from math import pi\n", + "import math\n", + "Q =3*10**( -6) ; #m^3/ s\n", + "u =0.001; #Ns/m^2\n", + "W =1;\n", + "rho =1000; #kg /m^3\n", + "g =9.81; #m/ s ^2\n", + "d =1.016*10**( -4) ; #m\n", + "d1 =1.25*10**( -4) ; # m\n", + "\n", + "\n", + "#calculation\n", + "theta = math.asin (3*Q*u/W/rho/g/d **3) ;\n", + "u1=W*rho *g* math.sin ( theta )*( d1 **3) /(3* Q);\n", + "\n", + "#result\n", + "print\"Exact angle of inclination (radians) =\",round(theta,3)\n", + "print\" Viscosity of the second liquid (Ns/m^2)=\",round(u1,4)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Exact angle of inclination (radians) = 1.065\n", + " Viscosity of the second liquid (Ns/m^2)= 0.0019\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.17,Page 93" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable decleration\n", + "u =1.5; #Ns/m^2\n", + "v =0.5; # m/ s\n", + "H =0.02/2; # m\n", + "\n", + "#calculation\n", + "t=-u*3*v/H;\n", + "\n", + "#result\n", + "print \"The shear stress (N/m^2)=\",t\n", + "print\"acting on opp. direction of flow\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The shear stress (N/m^2)= -225.0\n", + "acting on opp. direction of flow\n" + ] + } + ], + "prompt_number": 34 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.18,Page 95" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from math import pi\n", + "from scipy import integrate\n", + "\n", + "#variable decleration\n", + "N =600.0/60; #r e v o l u t i o n s pe r s e c\n", + "r =0.025; #m\n", + "t =400; # N/m^2\n", + "l =0.002; # m\n", + "time=2.0/1000; #s\n", + "\n", + "#calculation\n", + "w =2* pi*N;\n", + "u=t*l/w/r;\n", + "def integrand (R,w,u,time):\n", + " return 2*pi*u*w/time*R**3\n", + "\n", + "#a=lambda r:2*pi*0.509*62.8/2*r**3*1000;\n", + "T=integrate.quad(integrand, 0,0.025,args=(w,u,time));\n", + "\n", + "#result\n", + "print\" Viscosity,(Ns/m^2)=\",round(u,3)\n", + "print\"Torque(Nm) =\",round(T[0],4)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Viscosity,(Ns/m^2)= 0.509\n", + "Torque(Nm) = 0.0098\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.19,Page 97" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from math import pi\n", + "\n", + "#variable decleration\n", + "u =0.153; #Ns/m^2\n", + "r =0.05; # m\n", + "N =30; # rps\n", + "t =2.0/10**5; # s\n", + "L =0.2; #m\n", + "\n", + "\n", + "#calculation\n", + "tau =u *(2* pi *N*r/t);\n", + "F= tau *2* pi *r*L;\n", + "T=F*r;\n", + "w =2* pi*N;\n", + "P=T*w;\n", + "\n", + "#result\n", + "print \"The torque on the bearing is found to be (Nm)= \",round(T,3);\n", + "print \" and the power required to overcome the resistance is (W)=\",round(P,3);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The torque on the bearing is found to be (Nm)= 226.507\n", + " and the power required to overcome the resistance is (W)= 42695.643\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.20,Page 99" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#variable decleration\n", + "t =0.0005;#s\n", + "P =22; \n", + "r =300.0/60; \n", + "R_1 =0.1; \n", + "R_2 =0.0625; \n", + "pi=3.14;\n", + "\n", + "#calculation\n", + "w =2* pi*r;\n", + "u =2* t*P/( pi *w **2*(( R_1 )**4 -( R_2) **4) );\n", + "\n", + "#result\n", + "print\"The viscosity of the oil is (Ns/m^2)= \",round(u,4);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The viscosity of the oil is (Ns/m^2)= 0.0839\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fluid_Mechanics_-_Worked_Examples_For_Engineers/.ipynb_checkpoints/Chapter_4_1-checkpoint.ipynb b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/.ipynb_checkpoints/Chapter_4_1-checkpoint.ipynb new file mode 100644 index 00000000..7c5078a5 --- /dev/null +++ b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/.ipynb_checkpoints/Chapter_4_1-checkpoint.ipynb @@ -0,0 +1,75 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:3e9255609d7264d7167f865de1dbf27ba92b4a62cb35c2df65b3f59b0ee5b06e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 4, Dimensional Analysis" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.5,Page 108" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable Declaration\n", + "Rho_full =800.0; # kg /m^3\n", + "v_full =1.8; # m/ s\n", + "u_full =9.0/10000 ; # Nm/ s ^2\n", + "Rho_model =1000.0; # kg /m^3\n", + "u_model =1.0/1000 ; # Ns/m^2\n", + "d_full = 2.0;\n", + "d_model =1.0;\n", + "del_p_fmodel =4000.0; # N/m^2\n", + "\n", + "#Calculation\n", + "v_model = (( Rho_full * v_full / u_full )/( Rho_model /u_model ))*( d_full / d_model );\n", + "#del_p_f = del_p_fmodel * Rho_full *( v_full )**2/ Rho_model /(v_model )**2;\n", + "\n", + "#result\n", + "print \"The velocity in the full scale pipe is expected to be(m/s)\",round(v_model,2);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The velocity in the full scale pipe is expected to be(m/s) 3.2\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fluid_Mechanics_-_Worked_Examples_For_Engineers/.ipynb_checkpoints/Chapter_5_1-checkpoint.ipynb b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/.ipynb_checkpoints/Chapter_5_1-checkpoint.ipynb new file mode 100644 index 00000000..19f3f7be --- /dev/null +++ b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/.ipynb_checkpoints/Chapter_5_1-checkpoint.ipynb @@ -0,0 +1,465 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:3560754f85c552adcb8e17db6d394e5a7c27026cea8efa4cac19d77a4813e8fe" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 5,Flow Measurement by Differential Head" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.1,Page 115" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable Iniialisation\n", + "import math\n", + "rho_m =840; # kg /m^3\n", + "g =9.8; #m/ s ^2\n", + "H =0.03; #m\n", + "rho =1.2; #kg //m^3\n", + "\n", + "#calculation\n", + "dp= rho_m *g*H;\n", + "v1= math.sqrt (2* dp/rho);\n", + "\n", + "#result\n", + "print\" Velocity(m/s) =\",round(v1,2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Velocity(m/s) = 20.2879274447\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.2,Page 117" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "%pylab inline\n", + "#variable initialisation\n", + "from math import pi\n", + "import numpy as np\n", + "from pylab import *\n", + "r =[0, 0.05, 0.10, 0.15, 0.20, 0.225, 0.25];\n", + "v =[19, 18.6, 17.7, 16.3, 14.2, 12.9, 0];\n", + "\n", + "# We define a new variable dQ=v \u00032\u0003*pi\u0003*r . Accordingto the given values of r , v , we get dQ as follows\n", + "dQ =[0, 5.8, 11.1, 15.4, 17.8, 18.2, 0];\n", + "\n", + "#calculation\n", + "figure()\n", + "plot (r,dQ,'r')\n", + "xlabel('radius (m)')\n", + "ylabel('2piVxr (m^2/s)')\n", + "show()\n", + "# From the graph area under the cur ve comes out to be 2 . 7 4\n", + "Q =2.74; #m^3/ s\n", + "d =0.5; # m\n", + "v =4* Q/pi /d**2;\n", + "\n", + "#result\n", + "print \" Rate of flow (m^3/s) =\",round(Q,2);\n", + "print \"Average velocity(m/s) =\",round(v,2);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\n", + "For more information, type 'help(pylab)'.\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEMCAYAAAArnKpYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlcVeW+x/EPzh41h6OoqYVTIaJIDqWJUg5p5nTtWpZe\np6zTYK/mrE5ldSrr6umU1TXN0jLHyqFMtExQyXJOy8xSETVwCEHRFIF1/3hiKwky7L3X2sP3/Xrx\nCjZ77fVjtV2//Ty/ZwixLMtCREQEKON0ACIi4juUFERExEVJQUREXJQURETERUlBRERclBRERMTF\na0lh//79XHfddbRs2ZLIyEjeeOMNANLS0ujRowdXXHEFPXv2JD093VshiIhICYV4a55Camoqqamp\ntGnThszMTNq2bcuiRYt4//33qV27No899hivvPIKx44dY8KECd4IQURESshrLYV69erRpk0bAKpW\nrUqLFi04ePAgS5YsYfjw4QAMHz6cRYsWeSsEEREpIa+1FM6XlJRE165d+eGHH7jssss4duwYAJZl\nUatWLdfPIiLirHLePkFmZiaDBg3i9ddfp1q1avl+FxISQkhIyAXHFPSYiIgUzd3P+V4dfXT27FkG\nDRrEsGHDGDBgAAB169YlNTUVgJSUFEJDQws81rIsfVkWzz77rOMx+MqXroWuha7Fxb88wWtJwbIs\nRo8eTUREBA888IDr8X79+jFz5kwAZs6c6UoWIiLiPK91HyUmJjJr1ixat25NdHQ0AC+//DLjxo1j\n8ODBTJ8+nbCwMObPn++tEEREpIS8lhQ6d+5Mbm5ugb/76quvvHXagBMbG+t0CD5D1+IcXYtzdC08\ny5bRRyUVEhLisf4xEZFg4Yl7p5a5EBERFyUFERFxUVIQEREXJQUREXFRUhARERclBRERcVFSEBER\nFyUFERFxUVIQEREXJQUREXFRUhARERclBRERcVFSEBERF69vxykiEjBycuDgQdiz59zX7t2QnAzv\nvAORkU5H6DYlBRGR8504kf+mn3fj37PH3Pxr14YmTc599ekD8+fD2rVKCiIifqegT/vn3/hPncp/\n0w8PhxtvNN+HhUHlyhe+5pEj8OOPtv8p3qCkICKBp6BP++d39fz979C06bkbf95Nv0kTqFsXQkJK\ndr6WLeHzz73zt9hMO6+JiP9KTYVly859ys/778mT527y59/8L/Zp3x0HDkD79pCS4tnXLSFP3DuV\nFETEv+TmwldfwdSpsHIl9OplunjOv/mX5tO+OywLqleHpCSoVcu+8/6FJ+6d6j4SEf+Qmgrvvw/T\nppkb8F13wXvvwSWXOB2ZSUAREfDTT3DttU5H4xbNUxAR35WbCytWwM03Q4sWpmto3jzYvBn+8Q/f\nSAh5IiICotisloKI+B5fbhUUpmVL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QtAcnIyderU4Y477uCOO+7It01qnssvv5yUlJQSx5ySksLll19e4uNE\nPEXdRxJQzv+UHRUVRXR0NOHh4TRq1IjOnTsDULFiRaZOnUqfPn3429/+RkxMDCdPnnQdn/caY8aM\noX///rRp04ZevXq5Cs2rVq1i4sSJlC9fnmrVqvHBBx9cEEfnzp3ZuHEjbdu2vSCuv/58/vfr16+n\nS5cunrgUIqWiBfFEvGDPnj2MHTuWpUuXlui42NhY5s+fryGp4hh1H4l4QZMmTahWrVqJJ681a9ZM\nCUEcpZaCiIi4qKUgIiIuSgoiIuKipCAiIi5KCiIi4qKkICIiLkoKIiLi8v8vJedrtH6NpQAAAABJ\nRU5ErkJggg==\n" + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Rate of flow (m^3/s) = 2.74\n", + "Average velocity(m/s) = 13.95\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.3,Page 117" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#variable declaration\n", + "from math import pi\n", + "d1 =0.1; #m\n", + "rho_Hg =13600; #kg /m^3\n", + "rho =1000; #kg /m^3\n", + "g =9.81; #m/ s ^2\n", + "H =0.8; #m\n", + "Cd =0.96;\n", + "Q =0.025; #m^3/ s\n", + "\n", + "\n", + "#calculation\n", + "a= pi *d1**2/4;\n", + "dp =( rho_Hg - rho )*g*H;\n", + "B =((2* dp /( rho *((Q/Cd/a)**2))) +1) **(0.25) ;\n", + "d2=d1/B;\n", + "# The shortest possible overall length of venturi is therefore an entrance cone of 7.1 cm length( 20 degrees) , a throat of 2.5 cm(0.25pipe diameter s ) and an e x i t cone o f 1 9 . 7 cm ( 7 . 5\n", + "#degrees) giving an overall length of 29.3 cm.\n", + "L =29.3; #cm\n", + "\n", + "#result\n", + "print\"Throat diameter (m)=\",round(d2,3);\n", + "print\" Overall Length(m) =\",round(L,2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Throat diameter (m)= 0.048\n", + " Overall Length(m) = 29.3\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.4,Page 119" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable Decleration\n", + "Cd_o =0.65;\n", + "d =0.05;\n", + "d_o =0.025;\n", + "Cd_v =0.95;\n", + "d_v =0.038;\n", + "\n", + "#calculation\n", + "# (Q o /Cd o ) ^ 2 \u0003 ( ( d/ d o ) ^4 -1)=(Q v/Cd v ) ^ 2 \u0003 ( ( d/ d v)^4 - 1)\n", + "#Q v=4\u0003Q o\n", + "# Q = Q v + Q o\n", + "# Q = 5\u0003Qv\n", + "Q1 =20;\n", + "Q2 =100 - Q1;\n", + "print\"Flow through orifice(%)=\",round(Q1)\n", + "print\"Flow through venturi(%)=\",round(Q2)\n", + "\n", + "print\"Thus 20 % of the flow passes through the orifice meter while 80% of the flow passes through the venturi.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Flow through orifice(%)= 20.0\n", + "Flow through venturi(%)= 80.0\n", + "Thus 20 % of the flow passes through the orifice meter while 80% of the flow passes through the venturi.\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.5,Page 121" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "from math import pi\n", + "import math\n", + "Qa =0.003/60; # m^3/ s\n", + "Ca =20; # g / l\n", + "Co =0.126; # g / l\n", + "dp =3700; #N/m^2\n", + "p =1000; # N/m^2\n", + "d =0.1; # m\n", + "B =10/6;\n", + "\n", + "#calculation\n", + "a= pi *d **2/4;\n", + "Qi=Qa *(( Ca -Co)/Co);\n", + "Q=Qi+Qa;\n", + "c= math.sqrt(2*dp/p/(1.65**4 -1**4))\n", + "Cd=Q/a/ c;\n", + "\n", + "#results\n", + "print\" Coefficient of discharge =\",round(Cd,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Coefficient of discharge = 0.967\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.6,Page 126" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#variable declaration\n", + "from math import pi\n", + "rho =850; # kg /m^3\n", + "Q =0.056; # m^3/ s\n", + "Cd =0.98;\n", + "d1 =0.2; # m\n", + "d2 =0.1; # m\n", + "g =9.81; # m/ s ^2\n", + "dz =0.3; # m\n", + "\n", + "\n", + "#calculation\n", + "a= pi *( d1) **2/4;\n", + "dp=rho /2*(( Q/Cd/a) **2*(( d1/d2)**4 - 1) + 2*g*( dz));\n", + "\n", + "#result\n", + "print\"The differential pressure (N/m^2)=\",round(dp,3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The differential pressure (N/m^2)= 23592.898\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.7,Page 128" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "from math import pi\n", + "import math\n", + "g =9.81; # m/ s ^2\n", + "H =0.5; #m\n", + "rho_m =1075; #kg /m^3\n", + "rho =860; #kg /m^3\n", + "B =0.225/0.075;\n", + "Cd =0.659;\n", + "\n", + "#calculation\n", + "a1=pi /4*(0.225) **2;\n", + "v_t =math.sqrt(2*g*H*( rho_m - rho )/(rho )/(3**4 -1));\n", + "Q=Cd*a1* v_t ;\n", + "\n", + "#result\n", + "print\"Rate of flow(m^3/s) =\",round(Q,5)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Rate of flow(m^3/s) = 0.00459\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.8,Page 130" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable decleration\n", + "from math import pi\n", + "import math\n", + "m_f =0.03; # kg\n", + "rho_f =5100; # kg /m^3\n", + "d_l =0.3; # m\n", + "d_b =0.22; # m\n", + "H_tube =0.2; # m\n", + "Cd =0.6;\n", + "H =0.1; # m\n", + "g =9.81; # m/ s ^2\n", + "rho =1000; # kg /m^3\n", + "\n", + "\n", + "#calculation\n", + "V_f = m_f / rho_f ;\n", + "theta =2* math.atan (( d_l - d_b )/2/ H_tube );\n", + "m=Cd*H* math.tan ( theta /2)* math.sqrt (8* V_f*g* rho *( rho_f - rho )* pi);\n", + "\n", + "#result\n", + "print\"Mass flow rate(kg/s) =\",round(m/10,4)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass flow rate(kg/s) = 0.0925\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.9,Page 130" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable decleration\n", + "from math import pi\n", + "import math\n", + "d1 =0.05; # m\n", + "d2 =0.025; # m\n", + "Cd =0.97;\n", + "dp =1200; # N/m^2\n", + "rho =1000; #kg /m^3\n", + "H =0.15; # m\n", + "theta =2; # d e g r e e s\n", + "V_f =10**( -4) ;# m^3\n", + "g =9.81; # m/ s ^2\n", + "rho_f =8000; # kg /m^3\n", + "\n", + "#calculation\n", + "B=d1/d2;\n", + "a= pi /4* d1 **2;\n", + "Q=Cd*a* (2* dp/ (rho *(B**4 -1)))**(0.5);\n", + "Cd=Q/(H/ rho * math.tan( theta*pi/180 /2)* math.sqrt (8* V_f*g* rho *( rho_f -rho )*pi))\n", + "\n", + "#result\n", + "print\"Flow rate of water(m^3/s) =\",round(Q,5)\n", + "print\" Coeff. of discharge of the rotameter =\",round(Cd,3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Flow rate of water(m^3/s) = 0.00076\n", + " Coeff. of discharge of the rotameter = 0.7\n" + ] + } + ], + "prompt_number": 8 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fluid_Mechanics_-_Worked_Examples_For_Engineers/.ipynb_checkpoints/Chapter_6_1-checkpoint.ipynb b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/.ipynb_checkpoints/Chapter_6_1-checkpoint.ipynb new file mode 100644 index 00000000..28a995b9 --- /dev/null +++ b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/.ipynb_checkpoints/Chapter_6_1-checkpoint.ipynb @@ -0,0 +1,400 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:935baa5cece6ad60c6e41bbc750e73048ac600a6bffe3888ab4bb403a9f445e6" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 6:Tank drainage and variable head flow" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.1,Page 143" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable decleration\n", + "from math import pi\n", + "import math\n", + "Q =5000.0/3600/24; #m^3 per second\n", + "C_d =0.6;\n", + "r =0.01/2; # m\n", + "g =9.8; #m/ s ^2\n", + "H =0.2; # m\n", + "\n", + "\n", + "#calculation\n", + "a_o = pi *r**2;\n", + "n=Q/C_d/ a_o / math.sqrt (2*g*H);\n", + "\n", + "#result\n", + "print\"The number of orifices required are \",round (n)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The number of orifices required are 621.0\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.2,Page 145" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable decleration\n", + "from math import pi\n", + "import math\n", + "x =0.86; # m\n", + "g =9.8; # m/ s\n", + "y =0.96; # m\n", + "H =0.2; # m\n", + "\n", + "#calculation\n", + "v_act =x* math.sqrt (g /2/ y);\n", + "v= math.sqrt (2* g*H);\n", + "Cv= v_act /v;\n", + "\n", + "#result\n", + "print \"The coeff. of velocity for the orifices found to be \",round(Cv,3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The coeff. of velocity for the orifices found to be 0.981\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.3,Page 147" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "from math import pi\n", + "import math\n", + "Vt =1; # m^3\n", + "d_t =1; # m\n", + "C_d =0.6;\n", + "d_o =0.02; # m\n", + "g =9.8; # m/ s ^2\n", + "\n", + "\n", + "#calculation\n", + "a_o = pi *( d_o ) **2/4;\n", + "A= pi *( d_t ) **2/4;\n", + "H1 =4* Vt/ pi /( d_t) **2;\n", + "t=A/C_d/ a_o * math.sqrt (2* H1/g);\n", + "\n", + "#results\n", + "print\" Total drainage is found to take (s) \",round(t,2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total drainage is found to take (s) 2124.49586383\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.4,Page 149" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "from math import pi\n", + "import math\n", + "C_d =0.6;\n", + "d_o =0.05; #m\n", + "g =9.81; # m/ s ^ 2 ;\n", + "R =2; \n", + "H1 =1.5; \n", + "\n", + "#calculation\n", + "a_o = pi *d_o **2/4;\n", + "t= pi /C_d/ a_o*(1.333* R*H1 **(1.5) -0.4* H1 **(2.5))/math.sqrt(2*g);\n", + "\n", + "#results\n", + "print\"The time to drain the tank is found to be (s)\",round(t,3);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The time to drain the tank is found to be (s) 2285.001\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.6,Page 153" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "import math\n", + "Cd =0.62;\n", + "a =0.01;# m^2\n", + "g =9.81; # m/ s ^2\n", + "H =0.3; #m\n", + "A1 =4*2; # m^2\n", + "H1 =0.300; # m\n", + "H2 =0.100; # m\n", + "A2 =2*2; # m^2\n", + "\n", + "#calculation\n", + "Q=Cd*a* math.sqrt (2* g*H);\n", + "t =2* A1 *( math.sqrt(H1) -math.sqrt(H2) )/( Cd*a* math.sqrt (2*g) *(1+ A1/A2));\n", + "\n", + "#results\n", + "print \"The rate of flow(m^3/s) =\",round(Q,3)\n", + "print \"The time taken to reduce the difference in levels to 10 cm is (s) \", round(t,3)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The rate of flow(m^3/s) = 0.01504\n", + "The time taken to reduce the difference in levels to 10 cm is (s) 44.957\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.8,Page 157" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#variable declaration\n", + "import math\n", + "Qs =0.4; #m^3/ s\n", + "H1 =1.5; # m\n", + "Q =0.2; #m^3/ s\n", + "H2 =0.5; # m\n", + "l =15; # m\n", + "b =10; #m\n", + "e=2.69;\n", + "\n", + "#calculation\n", + "A=l*b;\n", + "k=Qs*H1 **( -0.5) ;\n", + "t=-2*A/k**2*(Q*math.log((Q-k*math.sqrt( H2))/(Q-k*math.sqrt(H1)),e)+k*(math.sqrt(H2)-math.sqrt(H1)));\n", + "#result\n", + "print \"The time reqd. for the level in the tank to fall to 1 m is(s) \",round(t,3)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The time reqd. for the level in the tank to fall to 1 m is(s) 1536.35\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.9,Page 159" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#variable declaration\n", + "from math import pi\n", + "import numpy as np\n", + "import numpy \n", + "import math\n", + "Cd =0.62;\n", + "d =0.05;\n", + "a_o = pi *d **2/4;\n", + "g =9.81; #m/ s ^2\n", + "\n", + "#calculation\n", + "k=Cd*a_o* math.sqrt (2*g);\n", + "# We have g o t two s imultaneous equations\n", + "#Q_k \u0003 0 . 6 5 ^ ( 1 / 2 ) =0.1/90\u0003A\n", + "# Q_k \u0003 1 . 2 2 5 ^ ( 1 / 2 ) =0.05/120\u0003A\n", + "\n", + "M=np.array([[1,-0.1/90],[1,-0.05/120]]);\n", + "N=np.array([[k *math.sqrt(0.65)] ,[k *math.sqrt(1.225)]]);\n", + "X=np.linalg.solve(M,N)\n", + "Q=X[0][0];\n", + "A=X[1][0];\n", + "print \"The Area of the tank(m^2) =\",round(A,3)\n", + "print \" Flow rate(m^3/s) =\",round(Q,3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Area of the tank(m^2) = 2.334\n", + " Flow rate(m^3/s) = 0.007\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.10,Page 161" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from math import pi\n", + "from numpy import matrix\n", + "from numpy import linalg\n", + "import math\n", + "H1 =1.5; # m\n", + "V =0.75; # m^3\n", + "d1 =1.2; # m\n", + "u =0.08; # Ns/m^2\n", + "L =3; # m\n", + "rho =1100; # kg /m^3\n", + "g =9.81; # m/ s ^2\n", + "d =0.025; # m\n", + "e=2.71;\n", + "\n", + "#calculation\n", + "a= pi*d **2/4;\n", + "A= pi*d1 **2/4;\n", + "H2=H1 -(V/A);\n", + "round(H2,2);\n", + "t= -32*u*L*A/(a*rho*g*d **2) *math.log(H2/H1,e);\n", + "\n", + "#result\n", + "print\"Time taken(s) =\",round(t,3);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Time taken(s) = 1535.7565254\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fluid_Mechanics_-_Worked_Examples_For_Engineers/.ipynb_checkpoints/Chapter_7_1-checkpoint.ipynb b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/.ipynb_checkpoints/Chapter_7_1-checkpoint.ipynb new file mode 100644 index 00000000..eff449e4 --- /dev/null +++ b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/.ipynb_checkpoints/Chapter_7_1-checkpoint.ipynb @@ -0,0 +1,491 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:9d2bc1b337823a33d27dffeb338a599749ddc3b72fed4860934dfca72c26b017" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 7,Open channels notches and Weirs" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.2,Page 171" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#variable decleration\n", + "import math\n", + "l =1; # m\n", + "b =0.3; # m\n", + "n =0.014; # s /m^ ( 1 / 3 )\n", + "i =1.0/1000;\n", + "\n", + "#calculations\n", + "A=l*b;\n", + "P =2* b+l;\n", + "m=A/P;\n", + "Q=A/n*m **(0.67) * math.sqrt (i);\n", + "\n", + "#results\n", + "print\"The delivery of water through the channel is found to be (m^3/s)= \",round(Q,3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The delivery of water through the channel is found to be (m^3/s)= 0.221\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.3 Page 173" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "%pylab inline\n", + "#variable decleration\n", + "import math\n", + "import numpy as np\n", + "from pylab import *\n", + "n =0.015; #m^(-1/3) s\n", + "i =1;\n", + "H =[4.0, 4.1, 4.2, 4.13];\n", + "\n", + "#calculation\n", + "A =12* H[0];\n", + "P =12+2* H[0];\n", + "m=A/P;\n", + "C=m **(0.167) /n;\n", + "Q=C*A* math.sqrt (m*i);\n", + "#An analytical soln for depth H is not possible.It is so necessary to use a graphical soution\n", + "#The corresponding values of A, P, MHD (m) , Q are given below as taken from values of H\n", + "\n", + "A =[48, 49.2, 50.4, 49.56];\n", + "P =[20, 20.2, 20.4, 20.26];\n", + "m =[2.4, 2.44, 2.47, 2.45];\n", + "Q =[57.36, 59.38, 61.39, 59.98];\n", + "figure()\n", + "plot (H,Q,'g')\n", + "r =[4.13, 4.13];\n", + "s =[57, 60];\n", + "plot (r,s, ' r ' )\n", + "t =[4, 4.13];\n", + "u =[60, 60];\n", + "plot (t,u, ' y ' )\n", + "xlabel('Depth (H)')\n", + "ylabel('Flow Rate')\n", + "title('Depth vs Flow Rate')\n", + "show()\n", + "# So, the depth is found to be approx. 4.13\n", + "depth =4.13; #m\n", + "C1 =(2.45) **(0.167) /n;\n", + "\n", + "#results\n", + "print\"Depth(m) = \",round(depth,3)\n", + "print\"Chezy Coeff. =\",round(C1,3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\n", + "For more information, type 'help(pylab)'.\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAY0AAAEXCAYAAABRWhj0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3X9czXf/x/HHUTE/+oVUKorQDyGKGXF2EebXhAubuWxT\nzApt2Nj13SXsh8xsLLvGrs1crjHGjI1ojUN+nqHlV5tQpJT8SCmk+nz/6HIuVIrO6fTjdb/dut3O\nj8/783mdj+PzPO/355dKURQFIYQQohzqGLsAIYQQ1YeEhhBCiHKT0BBCCFFuEhpCCCHKTUJDCCFE\nuUloCCGEKDcJDVGjOTs78+uvvxq7DAA0Gg1OTk7GLkOICpHQEJXG2dmZBg0aYGFhgbW1NT169GD5\n8uXo61Shl19+mXffffeB11QqFSqVSi/zL686derQqFEjzM3NMTc3p3HjxpW27Hvr2NzcHDs7O8aN\nG0dWVla52n7zzTf4+fkZuEJR3UloiEqjUqn4+eefycrK4sKFC8yaNYvw8HAmTJhg7NL07tixY2Rn\nZ5Odnc21a9cqbbn31nF2djZxcXEcP36c9957r9KWL2o+CQ1hFObm5gwZMoR169axatUqTp48CcCd\nO3eYMWMGLVu2xM7OjsmTJ3P79m2gaHjH0dGRDz/8EBsbG1xcXFizZg0AK1asYM2aNSxcuBBzc3Oe\nf/553bJiY2Pp2LEjVlZWjBkzhjt37hSr586dO1hZWenqAMjIyKBBgwZcuXKFK1euMHjwYKytrWnS\npAm9evWqcA8pPj4etVqNtbU17du356effgIgMTERa2tr3XRBQUHY2tr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Gg0Gnr1\n6sXgwYNxc3Nj8uTJKIrCrFmzuHXrFt7e3owbNw6VSkVBQQETJ06kffv29O/fn9u3bxdb7r59+3Bz\nc8PU9H+nSj2qtzN06FDWrl2r508vxOOT0BC1nouLCwUFBVy+fJmvvvoKKysrtFotWq2WL7/8kqSk\nJAB+++03IiIiOHXqFGfPnuWHH35gwYIF1K9fn9jYWFavXo2iKCQkJBASEsKJEyewsrIqNuwERdf2\n8vX11T1XFIWZM2fi7e2t+7u/59G1a1f27Nlj8HUhRFmq7BnhQhhDVFQUx48fZ8OGDQBkZWVx5swZ\nTE1N6dq1K87OzgC88MIL7N27lxEjRhSbh4uLCx06dACgS5cuutC534ULF+jZs6fuuUqlYtGiRboz\nnQHMzc11j+3t7UucjxCVTUJD1Hrnzp3DxMSEZs2aAUU7qP39/R+YRqPRPPDLX1GUUi9DXa9ePd1j\nExMTbt26VeJ0Dw9HPWp4SlEUuVquqBJkeErUahkZGbz22mtMmTIFgP79+/P555+Tn58PwOnTp8nN\nzQWKbliTlJREYWEh69at0/UUzMzMdNOXV8uWLUlLSyv39JcuXaJly5aPtQwhDEFCQ9Q693Zct2/f\nHn9/fwYMGMA//vEPAAIDA/Hw8KBz5854eXkxefJkXSD4+voSEhKCh4cHrVu3JiAgAICJEyfSoUMH\n3Y7w0o6Cul/Pnj05fPjwI6e7/7lWq6VXr14V//BCVJBcsFCIctBoNHz88cf89NNPepmfoih07tyZ\nQ4cOUbdu3TKnHzt2LDNmzMDb21svyxfiSUlPQ4hyKKkHUdH5BQUF8e2335Y57eXLl8nMzJTAEFWC\n9DSEEEKUm/Q0hBBClJuEhhBCiHKT0BBCCFFuEhpCCCHKTUJDCCFEuUloCCGEKLf/B4ccDtv7g/WY\nAAAAAElFTkSuQmCC\n" + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Depth(m) = 4.13\n", + "Chezy Coeff. = 77.428\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.4,Page 175" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#variable decleration\n", + "import math\n", + "Q =300.0/60; # m^3/ s\n", + "i =1.0/1600;\n", + "\n", + "#calculation\n", + "H=(Q /140* math.sqrt (2/ i)) **(0.67) ;\n", + "A =2* H**2;\n", + "\n", + "#result\n", + "print \"The minimum flow area is found to be(m^2)= \",round(A,3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The minimum flow area is found to be(m^2)= 5.132\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.5,Page 177" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "%pylab inline\n", + "#variable decleration\n", + "from math import pi\n", + "import math\n", + "import numpy as np\n", + "from pylab import *\n", + "d =0.9144; # m\n", + "C =100; # m^ ( 1 / 2 ) s ^(-1)\n", + "R=d/2;\n", + "H =[0.1, 0.15, 0.2, 0.25, 0.201];\n", + "\n", + "\n", + "#calculations\n", + "theta = math.acos ((R-H[0])/R);\n", + "A=R **2*( theta -math.sin (2* theta )/2);\n", + "P =2* R* theta ;\n", + "m=A/P;\n", + "#An analytical soln for depth H is not possible.It is so necessary to use a graphical soution\n", + "#The corresponding values of A, P, MHD (m) , Q are given below as taken from values of H\n", + "\n", + "\n", + "theta =[0.674, 0.834, 0.973, 1.101, 0.975];\n", + "A =[0.039, 0.070, 0.106, 0.146, 0.107];\n", + "P =[0.616, 0.763, 0.890, 1.006, 0.891];\n", + "m =[0.063, 0.092, 0.119,0.145,0.120];\n", + "Q =[248.7, 543.2, 932.2 ,1412.9, 940.0];\n", + "figure()\n", + "plot (H,Q,)\n", + "xlabel('Depth H')\n", + "ylabel('Flow Rate')\n", + "title('Depth Vs Flow Rate');\n", + "i =[0.201, 0.201];\n", + "j =[0 ,940];\n", + "plot (i,j)\n", + "k =[0, 0.201];\n", + "l =[940, 940];\n", + "plot (k,l)\n", + "show()\n", + "# So, the depth is found to be approx. 0.201\n", + "Depth =0.201; # m\n", + "\n", + "#result\n", + "print\"The depth in the channel(m) =\",round(Depth,3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\n", + "For more information, type 'help(pylab)'.\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAZAAAAEXCAYAAACDChKsAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XtcVHX+x/HXKFhWopgKOYONCS6OopmJVlrTBStbybRY\nqZS85GN13bTLbla7P7Ub2K7VVrJdVo3cLTF/JW4Za1ZYaaKWRYr7gwyUm3hBAq8knN8fE6OoCAzD\nzADv5+Phw8OZc/nMcZw33+8533NMhmEYiIiINFAbbxcgIiLNkwJERERcogARERGXKEBERMQlChAR\nEXGJAkRERFyiAJFWw2q18sknn3i7DKfc3FzatGlDVVWVt0sRcYkCRLzCarVywQUXEBAQQGBgINdc\ncw2vvfYa7hqWdN999/HnP/+5xjyTyYTJZKpz3Y0bN3LRRRdx+PDhM14bOHAgiYmJDaql+r126NCB\nDh06EBAQwJ49exq0DVfZ7Xbat29Phw4d6NKlC7fffjv5+fn1WjctLY2QkJAmrlCaMwWIeIXJZOKD\nDz6grKyM3bt3M3v2bObPn8/kyZO9XRpDhw7FYrGwYsWKGvO3bdvGjh07iI2NbdD2qt9reXk55eXl\nlJWVERwc7M6Sz7nvhQsXUl5ezs6dOzl27BgPPfSQR/YtLZ8CRLyuQ4cOjBo1iuTkZJKSkti+fTsA\nx48f55FHHuHSSy8lODiYadOmcezYMcDx27HFYiE+Pp6uXbvSs2dP3n77bQBef/113n77bZ577jk6\ndOjA7bff7tzX1q1bGTBgAJ06dWLcuHEcP378rDXFxcXx1ltv1Zj31ltvcdtttxEYGMixY8e49957\n6dKlC4GBgURGRrJ3795GHYfCwkKio6O5+OKLCQsL4x//+AcAx44do3379pSUlADwzDPP4O/vz6FD\nhwD485//zIMPPljn9jt27Mjtt9/uPL4AS5YswWazERAQQK9evXj99dcBOHz4MLfeeiuFhYU1Wk2G\nYZCQkEBoaChdunThN7/5DQcPHmzU+5bmSwEiPmPw4MFYLBa+/PJLAGbPns0PP/zAd999xw8//EBB\nQQFPPvmkc/ni4mIOHDhAYWEhSUlJTJ06lezsbKZOnco999zDo48+Snl5OSkpKQAYhsG7777Lf/7z\nH3JycsjIyODNN988ay333nsvn3/+ubO7p6qqinfeeYe4uDgAkpKSKCsrIz8/n5KSEl577TXat29f\n63urT9fcuHHj6NGjB0VFRaxYsYLHH3+czz77jPPPP5/IyEjS0tIAWLduHVar1Xmc1q1bh91ur3Pf\nBw4c4L333mPIkCHO14KCgvjwww8pKytjyZIlPPjgg2zdupULL7yQ1NRUunfvXqPV9NJLL7Fq1So+\n//xzioqKCAwM5He/+12d701aJgWI+JTu3btTUlKCYRi88cYbPP/883Tq1ImLLrqIxx57jGXLltVY\n/qmnnsLf359rr72W2267jeTkZMDxpXn6l7bJZOKBBx4gODiYwMBARo0axbfffnvWOkJCQrDb7Sxd\nuhSATz75hOPHj3PbbbcB0K5dOw4cOEB2djYmk4mBAwfSoUOHs27LMAxGjx5NYGAggYGBjBkz5oxl\n8vLy2LBhA/Pnz6ddu3YMGDCAKVOmOFtB1113HevWraOyspLvv/+eBx54gHXr1nHs2DG2bNnCtdde\nW+u+H3jgATp16kTXrl05dOgQCxcudL4+cuRIevbsCcC1117LiBEj+OKLL5zrnu61117j6aefpnv3\n7vj7+zNnzhxWrFihCwFaKQWI+JT8/Hw6d+7M/v37OXLkCIMGDXJ+8d56663s37/fuWxgYGCN3/ov\nvfRSioqKAGo9WX7quYf27ds7u4HOJi4uzhkgS5cuJTY2lrZt2wIwfvx4br75ZsaNG4fZbObRRx/l\nxIkTZ92OyWQiJSWFgwcPcvDgQd57770zliksLKRz585ceOGFznk9evSgoKAAcARIWloa33zzDRER\nEdx0002sW7eO9PR0QkNDCQwMrHXfL7/8MqWlpWRkZLBr1y5Wr17tfP2jjz5i6NChXHzxxQQGBrJ6\n9WoOHDhQ6zHJzc3ljjvucP6b2Gw2/Pz8KC4urnUdabkUIOIzNm/eTGFhIcOGDePiiy+mffv2ZGZm\nOr94S0tLKSsrcy5/8OBBjhw54vx5165ddO/eHag9QE5V1zJ33HEH+fn5fPbZZ7z//vvO7isAPz8/\n/ud//oft27ezYcMGPvjggzPOmTREdcvr1EDbvXs3FosFgKuuuor/+7//4/3338dut9OnTx92797N\n6tWrz9l9BSdbEv369eOpp55i9uzZGIbB8ePHGTt2LH/84x/Zu3cvBw8eZOTIkc7lz3Z8evToQWpq\nqvPfpPrf4JJLLnH5vUvzpQARr6n+oiorK+ODDz4gNjaW8ePH07dvX9q0acP999/PrFmz2LdvHwAF\nBQWsWbOmxjbmzJnDzz//zBdffMGHH37IXXfdBTj69n/88cd67b82F154IXfeeScTJ07EarVyxRVX\nOF9LS0vj+++/p7Kykg4dOuDv7+9snbgiJCSEq6++mscee4zjx4+TkZHB4sWLuffeewG44IILGDRo\nEAsXLuS6664D4Oqrr+bVV191/lwfcXFxHDlyhOXLl1NRUUFFRQVdunShTZs2fPTRRzWOb1BQEAcO\nHKgR2r/97W95/PHH2b17NwD79u1j1apVLr9vad4UIOI1o0aNIiAggB49ehAfH8/DDz/MkiVLnK/P\nnz+f0NBQhg4dSseOHYmKiiIrK8v5evW5jO7duzN+/Hhee+01evfuDcDkyZPJzMys9ZwD1G9cSFxc\nHLt372bChAk15u/Zs4e77rqLjh07YrPZsNvtjB8/vsHH4NT9v/POO+Tm5tK9e3fGjBnDk08+yQ03\n3OB8/brrruPEiRNERkY6fz506FCt5z/Otg9/f39mzpzpvELtpZdeIiYmhs6dO/POO+/UuGItPDyc\n2NhYLrvsMjp37syePXuYOXMm0dHRjBgxgoCAAK666io2bdrU4PctLYNJD5SS5igtLY3x48eTl5fn\n7VJEWi23t0AmTZpEUFAQERERNea//PLL9OnTh379+vHoo48658fHxxMWFkZ4eHiN5vPXX39NREQE\nYWFhzJw5091liohII7k9QCZOnEhqamqNeZ999hmrVq0iIyODbdu28cgjjwCQmZlJcnIymZmZpKam\nMn36dGe/9LRp01i0aBHZ2dlkZ2efsU2R+pwoF5Gm4/YAGT58+BmXFP7973/nsccew9/fH4CuXbsC\nkJKSQmxsLP7+/litVkJDQ0lPT6eoqIjy8nJnX++ECRNYuXKlu0uVZsxutztP5IqId3jkJHp2djaf\nf/45Q4cOxW63s2XLFsBx7Xv1ZYoAFouFgoKCM+abzWbn9fAiIuIb/DyxkxMnTnDw4EE2btzI5s2b\niYmJqfMSy/pSN4aIiGsaew2VR1ogFovFeSnl4MGDadOmDfv378dsNte4iiY/Px+LxYLZbK5xy+n8\n/HzMZnOt26++bUVr/zNnzhyv1+Arf3QsdCx0LM79xx08EiCjR4/m008/BSArK8s5eCk6Opply5ZR\nUVFBTk4O2dnZREZGEhwcTEBAAOnp6RiGwdKlSxk9erQnShURkXpyexdWbGws69at48CBA4SEhPDk\nk08yadIkJk2aREREBO3atXPe8sFmsxETE+O8n05iYqKzSyoxMZH77ruPo0ePMnLkSG655RZ3lyoi\nIo3Q7AcSmkwmtzXHmru0tLQ674vUWuhYnKRjcZKOxUnu+O5UgIiItELu+O7UvbBERMQlChAREXGJ\nAkRERFyiABEREZcoQERExCUKEBERcYkCREREXKIAERERlyhARETEJQoQERFxiQJERERcogARERGX\nKEBERMQlChAREXGJAkRERFyiABEREZcoQERExCUKEBERcYnbA2TSpEkEBQURERFxxmsLFiygTZs2\nlJSUOOfFx8cTFhZGeHg4a9ascc7/+uuviYiIICwsjJkzZ7q7TBERaSS3B8jEiRNJTU09Y35eXh4f\nf/wxl156qXNeZmYmycnJZGZmkpqayvTp053P6J02bRqLFi0iOzub7Ozss25TREQaJisLTCb3bMvt\n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EBERcYkCREREXKIA\nERERlyhARETEJQoQERFxiQJERERcogARERGXKEBERMQlChAREXGJAkRERFyiABEREZcoQERExCUK\nEBERcYkCREREXOLzAZKamkp4eDhhYWHMnz/f2+X4tLS0NG+X4DN0LE7SsThJx8K9fDpAKisrmTFj\nBqmpqWRmZvLOO++wY8cOb5fls/Sf4yQdi5N0LE7SsXAvnw6QTZs2ERoaitVqxd/fn3HjxpGSkuLt\nskREBB8PkIKCAkJCQpw/WywWCgoKvFiRiIhU8/N2AediMpnculxrMG/ePG+X4DN0LE7SsajJNFff\nGe7g0wFiNpvJy8tz/pyXl4fFYqmxjGEYni5LRETw8S6sK6+8kuzsbHJzc6moqCA5OZno6GhvlyUi\nIvh4C8TPz49XXnmFm2++mcrKSiZPnkyfPn28XZaIiODDLZDq8R8PPPAAkyZN4ocffuCxxx6rscwD\nDzxAWFgYAwYMYOvWrWes21LGjtTn/dR2LKxWK/3792fgwIFERkZ6quQmU9ex+O9//8tVV13F+eef\nz4IFCxq0bnPTmGPR2j4X//rXvxgwYAD9+/fnmmuuISMjo97rNjeNORYN/lwYPujEiRNGr169jJyc\nHKOiosIYMGCAkZmZWWOZDz/80Lj11lsNwzCMjRs3GkOGDKn3us1JY46FYRiG1Wo1Dhw44NGam0p9\njsXevXuNzZs3G0888YTx17/+tUHrNieNORaG0fo+Fxs2bDBKS0sNwzCMjz76qFV/X9R2LAyj4Z8L\nn2yB1Gf8x6pVq4iLiwNgyJAhlJaWsmfPnhY3dsTVY1FcXOx83WghFxrU51h07dqVK6+8En9//wav\n25w05lhUa02fi6uuuoqOHTsCjv8j+fn59V63OWnMsajWkM+FTwZIfcZ/1LZMYWFhixo70phjAY5L\nnG+66SauvPJK3njjDc8U3UQaMy6opY0pauz7ac2fi0WLFjFy5EiX1vV1jTkW0PDPhU+eRK/vuI6W\n8hvUuTT2WHz55Zd0796dffv2ERUVRXh4OMOHD3dniR7TmPE+LW2sUGPfz/r167nkkkta3efis88+\nY/Hixaxfv77B6zYHj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Zt23L06NGzLqcuLGkO1IUlUot9\n+/bx29/+lt///vcA3HzzzSQmJnLixAkAsrKyOHLkCOB4kE9ubi5VVVUkJyczbNgwAPz9/Z3Li7Q0\naoGInKL6pPfPP/+Mn58fEyZM4MEHHwRgypQp5ObmcsUVV2AYBt26deP9998HYPDgwcyYMYMffviB\nG264gTvuuAOAqVOn0r9/fwYNGsTTTz9d76urdBWWNAe6maJII6WlpbFgwQL+/e9/e7sUEY9SF5ZI\nI51t3IZIa6AWiIiIuEQtEBERcYkCREREXKIAERERlyhARETEJQoQERFxiQJERERc8v+luW+FdxpL\nDQAAAABJRU5ErkJggg==\n" + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The depth in the channel(m) = 0.201\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.7,Page 180" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#variable decleration\n", + "import math\n", + "Cd =0.56;\n", + "B =1.2; # m\n", + "g =9.8; # m/ s ^2\n", + "H =0.018; # m\n", + "\n", + "\n", + "#calcualtion\n", + "Q =2.0/3* Cd*B* math.sqrt (2*g)*H **(1.5) ;\n", + "\n", + "#results\n", + "print \"The rate of flow of liquid over the weir is (m^3/s)=\",round(Q,4)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The rate of flow of liquid over the weir is (m^3/s)= 0.0048\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.8,Page 182" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable decleration\n", + "from math import pi\n", + "import math\n", + "H2 =5.5;\n", + "Q1 =217.0;\n", + "Q2 =34.0;\n", + "H1 =8.5;\n", + "\n", + "#calculation\n", + "H0 =( H2 *( Q1/Q2) **(0.67) -H1)/(( Q1/Q2) **(0.67) -1);\n", + "\n", + "#result\n", + "print\"The height of the weir crest above the surface of the river is found to be(m)\",round(H0,2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The height of the weir crest above the surface of the river is found to be(m) 4.28\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.9,Page 184" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable decleration\n", + "from math import pi\n", + "from scipy import integrate\n", + "import math\n", + "H =0.07; # a v e r a g e head\n", + "rate = -0.02/600; # (dH/ dt )\n", + "H1 =0.08; # m\n", + "H2 =0.01; # m\n", + "\n", + "\n", + "#calculation\n", + "k=- rate /H **(1.5) ;\n", + "def integrand(H,k):\n", + " return -1/k*H**(-1.5);\n", + "\n", + "t=integrate.quad(integrand,H1,H2,args=(k))\n", + "\n", + "#result\n", + "print \"Time taken (s) =\",round(t[0],2);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Time taken (s) = 7183415.25\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.10,Page 186" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable decleration\n", + "import math\n", + "Cd =0.62;\n", + "g =9.81; # m/ s ^2\n", + "H =0.03; # m\n", + "\n", + "#calculations\n", + "Q =8.0/15* Cd* math.sqrt (2*g)*H **(2.5) ;\n", + "\n", + "#results\n", + "print\"Rate of flow (m^3/s) =\",round(Q,6)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Rate of flow (m^3/s) = 0.000228\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.11,Page 188" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from scipy import integrate\n", + "#variable decleration\n", + "import math\n", + "l =4; # m\n", + "b =2; # m\n", + "H1 =0.15; # m\n", + "H2 =0.05; # m\n", + "A=8;\n", + "\n", + "#calculation\n", + "k=3*1.5/A;\n", + "def integrand (H,A):\n", + " return -A/1.5*H**(-2.5)\n", + " \n", + "t=integrate.quad(integrand,H1,H2,args=(A))\n", + "\n", + "#results\n", + "print \"Time taken to reduce the head in the the tank (s)=\",round(t[0])\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Time taken to reduce the head in the the tank (s)= 257.0\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fluid_Mechanics_-_Worked_Examples_For_Engineers/.ipynb_checkpoints/Chapter_8_1-checkpoint.ipynb b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/.ipynb_checkpoints/Chapter_8_1-checkpoint.ipynb new file mode 100644 index 00000000..3d67d746 --- /dev/null +++ b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/.ipynb_checkpoints/Chapter_8_1-checkpoint.ipynb @@ -0,0 +1,659 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:b23dbd5a6884d4ea13e28c9cb79f4fe4cdf3c73f39b3e9719031299037425f06" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 8,Pipe Friction and Turbulent Flow" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 8.4,Page 199" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "from math import pi\n", + "import math\n", + "rho =867.0; #kg /m^3\n", + "Q =12.0/3600; #m^3/ s\n", + "u =7.5*10**( -4) ; # Ns/m^2\n", + "L =200.0; # m\n", + "H =10.0; # m\n", + "g =9.81; # m/ s ^2\n", + "e=2.718;\n", + "\n", + "#calculation\n", + "d=(H*2*g /(4*0.079*(4* rho *Q/pi/u)**( -0.25) *L *(4* Q/pi)**2) )**( -0.2105);\n", + "d=round(d,4);\n", + "Re =4* rho *Q/ pi /d/u;\n", + "\n", + "#result\n", + "print\" Internal diameter of the pipe line (m)=\",round(d,5)\n", + "print\"Re =\",round(Re,2)\n", + "print(\"The value o f Reynolds number l i e s between 4000 and 10^5 , confirming the validity of using the Blasius equationfor smooth walled pipes\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Internal diameter of the pipe line (m)= 0.0505\n", + "Re = 97152.8\n", + "The value o f Reynolds number l i e s between 4000 and 10^5 , confirming the validity of using the Blasius equationfor smooth walled pipes\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 8.5,Page 202" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "from math import pi\n", + "import math\n", + "m =40.0/60; # kg / s\n", + "rho =873; #kg /m^3\n", + "d =0.025; #m\n", + "u =8.8*10** -4; # Ns/m^2\n", + "dp =55.0*10**3; #N/m^2\n", + "L =18; #m\n", + "g =9.81; # m/ s ^2\n", + "\n", + "#calculation\n", + "v2 =4*m/ rho / pi /d **2;\n", + "Re=rho*v2*d/u;\n", + "#using MOODY's Chart\n", + "f =0.0055;\n", + "H=dp/rho/g + v2 **2/2/ g + v2 **2/2/ g *(4* f*L/d +1.5) ;\n", + "\n", + "#result\n", + "print \"The minimum allowable height (m) =\",round(H,3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The minimum allowable height (m) = 8.684\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 8.6,Page 204" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "from math import pi\n", + "import math\n", + "Q =15.0/3600; # m^3/ s\n", + "d =0.05; #m\n", + "Rho =780.0;\n", + "u =1.7*10**( -3) ; #Ns/m^2\n", + "f =0.0065;\n", + "L =100; #m\n", + "g =9.8; #m^2/ s\n", + "\n", + "#calculation\n", + "v =4* Q/ pi /d **2;\n", + "del_pf =2*f* Rho *v**2*L/d;\n", + "H_f =4* f*L*v **2/( d*2*g);\n", + "H_exit =v **2/2/ g;\n", + "H_entrance =v **2/4/ g;\n", + "H= H_f+ H_exit + H_entrance ;\n", + "\n", + "#result\n", + "print \"The pressure drop due to friction is (kN/m^2)\",round(del_pf,2)\n", + "print \" and the difference in levels is (m)\",round(H,3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The pressure drop due to friction is (kN/m^2) 91324.16\n", + " and the difference in levels is (m) 12.292\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 8.7,Page 206" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "import math\n", + "f =0.005;\n", + "L =10; # m\n", + "d =0.025; # m\n", + "g =9.81; # m/ s ^2\n", + "\n", + "#Calculations\n", + "# H L=4\u0003 f \u0003L/d\u0003v ^2/2/ g+0.5\u0003 v ^2/2/ g\n", + "# H L=8.5\u0003 v ^2/2/ g\n", + "# By Be r n o u l l i e q u a t i o n we g e t\n", + "#H=2.62+9.5\u0003 v2 ^2/2/ g\n", + "# Applying the Be r n o u l l i e q u a t i o n between the liquid surface and discharge point\n", + "# H L=33.5\u0003 v2 ^2/2/ g\n", + "#Solving above two we g e t\n", + "H =2.62+9.5* v2 **2/2/ g;\n", + "v2 =1.9; # m/ s\n", + "Q= pi*d **2/4* v2;\n", + "\n", + "#result\n", + "print\"Rate of flow (m^3/s)=\",round(Q,5)\n", + "print\"The minimum allowable height(m) =\",round(H,3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Rate of flow (m^3/s)= 0.0009321875\n", + "The minimum allowable height(m) = 4.36796126402\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 8.8,Page 208" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "import math\n", + "d_A =0.025; # m\n", + "v_A =1.21; # m/ s\n", + "d_B =0.05; # m\n", + "v_B =1.71; # m/ s\n", + "\n", + "#calculation\n", + "Q_A = pi *d_A **2* v_A /4;\n", + "Q_B = pi *d_B **2* v_B /4;\n", + "\n", + "#result\n", + "print \"The rate of flow through parallel pipes A is \",round(Q_A,5)\n", + "print\"The rate of flow through parallel pipes B is (m^3/s)=\",round(Q_B,5);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The rate of flow through parallel pipes A is 0.00059\n", + "The rate of flow through parallel pipes B is (m^3/s)= 0.00336\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 8.9,Page 210" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "from math import pi\n", + "import math\n", + "d2 =0.06; # m\n", + "d1 =0.12; # m\n", + "k =0.44;\n", + "f =0.05;\n", + "L1 =500; # m\n", + "g =9.81; # m/ s ^2\n", + "\n", + "#Calcualtion\n", + "# v1=d2 ^2/ d1 ^2\u0003 v2\n", + "# H f=4\u0003 f \u0003L1 /16/ d\u0003 v2 ^2/2/ g\n", + "# H c=k\u0003 v2 ^2/2/ g\n", + "# H f=4\u0003 f \u0003L2/d\u0003 v2 ^2/2/ g\n", + "# H_exit=v2 ^2/2/ g\n", + "v2= math.sqrt (30*2* g /173.4);\n", + "Q= pi*d2 **2/4* v2;\n", + "\n", + "#result\n", + "print\"The rate of flow (m^3/s) =\",round(Q,5)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The rate of flow (m^3/s) = 0.00521\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 8.10,Page 212" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "import math\n", + "m =12.0*10**3/3600; #kg / s\n", + "Rho =815; #kg /m^3\n", + "d =0.05; #m\n", + "e =0.02;\n", + "d1 =50; # m\n", + "d2 =0.038; # m\n", + "g =9.8; #m\n", + "\n", + "#calculation\n", + "v =4* m/ Rho / pi /d**2;\n", + "f1 =1/(2* math.log (d1/e,10) +2.28) **2;\n", + "L_eq =d1 +2* d1*d;\n", + "H_50mm =4* f1* L_eq *v **2/( d *2* g);\n", + "v =4* m/( Rho * pi *d2 **2) ;\n", + "f2 =1/(2* math.log (38/ e,10) +2.28) **2;\n", + "L_eq =d1 +2* d1*d2;\n", + "H_38mm =4* f2* L_eq *v **2/( d2 *2* g);\n", + "Hr =0.2* v **2/(2* g);\n", + "H_L = H_50mm + H_38mm +Hr;\n", + "del_p_f =Rho*g* H_L ;\n", + "\n", + "#result\n", + "print \"The total pressure drop due to friction through the pipe system is (N/m^2) =\",round(del_p_f,3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The total pressure drop due to friction through the pipe system is (N/m^2) = 479792.576\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 8.11,Page 214" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#variable declaration\n", + "import math\n", + "#H L=1.2\u0003 v ^2/2/ g\n", + "# H L=4\u0003 f \u0003 L eq /d\u0003V^2/2/ g\n", + "# L eq=60\u0003d\n", + "# H L=240\u0003 f \u0003v ^2/2/ g\n", + "# Combining the two e q u a t i o n s f o r head l o s s\n", + "# 1.2\u0003v^2/2/ g=240\u0003 f_\u0003v^2/2/ g\n", + "\n", + "f =1.2/240;\n", + "print \" Friction factor =\",round(f,3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Friction factor = 0.005\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 8.12,Page 216" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#variable declaration\n", + "import math\n", + "# dp AB+dp BC=dp AD+dp DC\n", + "# dp AD=2\u0003 f \u0003 rho \u0003v ^2\u0003L/d\n", + "# dp AD=16600\u0003(3_Q) ^2\n", + "# Li k ewi s e\n", + "# dp AB=16600\u0003Q^2\n", + "# dp BC=16600\u0003(Q+0.5) ^2\n", + "# dp DC=16600\u0003(2.1_Q) ^2\n", + "#By s o l v i n g above 5 e qu a t i o ns , we g e t\n", + "Q =1.175; # litres per second\n", + "\n", + "#Calculation\n", + "dp_AD =16600*(3 - Q) **2;\n", + "dp_AB =16600* Q**2;\n", + "dp_BC =16600*( Q +0.5) **2;\n", + "dp_DC =16600*(2.1 - Q) **2;\n", + "\n", + "print\"The rate of flow from B to C (l/s)=\",round(Q+0.5,3)\n", + "print \"dp_AD(kN/m^2 =\",round(dp_AD/1000,3);\n", + "print\"dp AB (kN/m^2)=\",round(dp_AB/1000,3);\n", + "print\"dp BC(kN/m^2) =\",round(dp_BC/1000,3);\n", + "print\"dp DC (kN/m^2)=\",round(dp_DC/1000,3);\n", + "print\"The lowest pressure is in the pipe coneecting C and D\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The rate of flow from B to C (l/s)= 1.675\n", + "dp_AD(kN/m^2 = 55.288\n", + "dp AB (kN/m^2)= 22.918\n", + "dp BC(kN/m^2) = 46.573\n", + "dp DC (kN/m^2)= 14.203\n", + "The lowest pressure is in the pipe coneecting C and D\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 8.13,Page 221" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "from math import pi\n", + "import math\n", + "from scipy import integrate\n", + "H2 =0.5; #m\n", + "H1 =2.0; #m\n", + "A =4.0; #m^2\n", + "f =0.005;\n", + "L =20.0; #m\n", + "d =0.025; #m\n", + "g =9.81; # m/ s ^2\n", + "\n", + "#calculation\n", + "a= pi *d **2/4;\n", + "c=A*math.sqrt( 4*f*L/d +2.5)/a/math.sqrt(2*g); # constant term of integration\n", + "def integrand(H,c):\n", + " return -c*(H)**(-0.5)\n", + "#integrate function '-A\u0003*sqrt ( ( 4*f \u0003L/d ) +2.5) / a /( sqrt(2\u0003*g ) )* \u0003(H) ^(-1/2)\n", + "#f=lambda H:-4*1978.18*H**(-0.5);\n", + "\n", + "\n", + "t=integrate.quad(integrand,H1,H2,args=(c))\n", + " \n", + "#result\n", + "print \"Time taken (s)=\",round(t[0],2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Time taken (s)= 11190.29\n" + ] + } + ], + "prompt_number": 39 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 8.14,Page 223" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#variable decleration\n", + "from math import pi\n", + "d0 =0.15; # m\n", + "d1 =0.1; #m\n", + "Q =50.0/3600; # m^3/ s\n", + "f =0.0052;\n", + "Rho =972;\n", + "\n", + "\n", + "#calculation\n", + "a= pi /4*(( d0)**2 -( d1) **2) ;\n", + "P= pi *(( d0)+( d1));\n", + "d_eq =4*a/P;\n", + "v=Q/a;\n", + "del_p_f =2*f* Rho *v**2/ d_eq ;\n", + "\n", + "#result\n", + "print\" the pressure drop due to friction per metre lenfth of tube is found to be(Nm^2/m)\",round(del_p_f,3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " the pressure drop due to friction per metre lenfth of tube is found to be(Nm^2/m) 404.636\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 8.15,Page 225" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable decleration\n", + "from math import pi\n", + "from scipy import integrate\n", + "f =0.005;\n", + "Q =0.07; #m^3/ s\n", + "g =9.81; #m/ s ^2\n", + "L=3;\n", + "\n", + "#calculation\n", + "u=0.3-0.0666*L;\n", + "def integrand(l,f,Q,g,u):\n", + " return 32*f*Q**2/pi**2/g*(0.3-0.0666*l)**-5 \n", + "\n", + "H_f=integrate.quad(integrand,0,3,args=(f,Q,g,u));\n", + "H_f=round(H_f[0],1)\n", + "\n", + "#result\n", + "print\" Fractional head loss(m) =\",H_f\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Fractional head loss(m) = 0.3\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 8.16,Page 228" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from math import pi\n", + "import math\n", + "g =9.81; # m/ s ^2\n", + "H =4; # m\n", + "f =0.006;\n", + "L =50; # m\n", + "d =0.1; # m\n", + "e=2.718;\n", + "\n", + "\n", + "#calculation\n", + "v1= math.sqrt (2* g*H /(4* f*L/d + 13) );\n", + "v2=0.99*v1;\n", + "t=2/v1*math.log((v1+v2)/(v1-v2),e)\n", + "\n", + "#result\n", + "print\"Time taken (s)=\",round(t,2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Time taken (s)= 5.98\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fluid_Mechanics_-_Worked_Examples_For_Engineers/.ipynb_checkpoints/Chapter_9_1-checkpoint.ipynb b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/.ipynb_checkpoints/Chapter_9_1-checkpoint.ipynb new file mode 100644 index 00000000..3a6f5367 --- /dev/null +++ b/Fluid_Mechanics_-_Worked_Examples_For_Engineers/.ipynb_checkpoints/Chapter_9_1-checkpoint.ipynb @@ -0,0 +1,447 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:8db0dc01c526205f6578e94b8a174e884a60249a5154cf023d12bae195b0ba58" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 9,Pumps" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.2 (part1 and part2), Page 239" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#Variable Declaration\n", + "d =0.1; # m\n", + "v_r =2; # m/ s\n", + "f =0.005;\n", + "g =9.81; #m/ s ^2\n", + "pi=3.14;\n", + "L_s =2; #m\n", + "L_r =10; # m\n", + "Q1 =1.1*10**( -2) ; #m^3/ s\n", + "z_t =12; #m\n", + "z_s=5 #m\n", + "L1 =20; #m\n", + "\n", + "#Calculation\n", + "Q= math.pi*d**2/4*v_r ;\n", + "H =12-70*Q-4300*Q*Q ;\n", + "k =2*g*H/ v_r/v_r-(4*f*( L_s +L_r)/d)-1;\n", + "\n", + "#result\n", + "print\"The head loss across the restriction orifice (in terms of velocity head)\",round(k,3) \n", + "\n", + "#Part2\n", + "#Finding System Head and Delivered Head\n", + "# For the case of the valve being fully open\n", + "\n", + "#calculation\n", + "v_t =4*Q1/math.pi/d**2;\n", + "v_r =((2*g*( z_t-z_s )+(4*f*L1/d+1)*v_t**2) /(4*f*L_r/d+k+1))**(0.5) ;\n", + "H1 =4*f* L_r /d*v_r**2/2/ g + 4*f* L_s /d*( v_r**2+ v_t**2) /2/g+k* v_r**2/2/ g + v_r**2/2/ g;\n", + "Q= math.pi*d**2/4*( v_t+ v_r );\n", + "H2 =12 -70*Q -4300* Q**2;\n", + "\n", + "#result\n", + "print\" System head(m)=\",round(H1,3)\n", + "print\" Delivered head(m)=\",round(H2,3)\n", + "print\"The delivered head therefore closely matches the system head at the flow rate of 1.1*\u000310^( -2) m^3/ s\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The head loss across the restriction orifice (in terms of velocity head) 44.863\n", + " System head(m)= 7.603\n", + " Delivered head(m)= 7.628\n", + "The delivered head therefore closely matches the system head at the flow rate of 1.1*\u000310^( -2) m^3/ s\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.6, Page 247" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from math import pi\n", + "#Variable Declaration\n", + "NPSH =5; # m\n", + "p_v =18*10**3; # N/m^2\n", + "p_l =0.94*101.3*10**3; # N/m^2\n", + "rho =970;#kg /m^3\n", + "g =9.81; # m/ s ^2\n", + "z_s =3; # m\n", + "H_L =0.5; # m\n", + "d =3; # m\n", + "h =2.5; # m\n", + "Q =5; #m^3/h\n", + "\n", + "#calculation\n", + "z1= NPSH +( p_v -p_l)/ rho /g + z_s + H_L ;\n", + "V= pi /4*d**2*(h-z1);\n", + "t=V/Q;\n", + "\n", + "#result\n", + "print\"Quantity of liquid delivered (m^3)=\",round(V,2)\n", + "print\"Time taken (h)=\",round(t,2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Quantity of liquid delivered (m^3)= 14.95\n", + "Time taken (h)= 2.99\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.8,Page 251" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable Declaration\n", + "N_s =0.14; #m^ ( 3 / 4 ) s ^(-3/2)\n", + "H =30; #m\n", + "p_v =7.38*10**3; #N/m^2\n", + "p_l =50*10**3; #N/m^2\n", + "rho =992; #kg /m^3\n", + "g =9.81; #m/ s ^2\n", + "H_L =0.2; #m\n", + "\n", + "#calculation\n", + "NPSH =2.8* N_s **(1.33) *H;\n", + "z1= NPSH +( p_v -p_l)/ rho /g+H_L;\n", + "\n", + "#result\n", + "print\"The minimum level of the alarm (m)=\",round(z1,3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The minimum level of the alarm (m)= 1.967\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.10,Page 255" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "%pylab inline\n", + "#Vabiable Declaration\n", + "import numpy as np\n", + "from pylab import *\n", + "dz =10; #z2-z1\n", + "g =9.81; #m/ s ^2\n", + "d =0.05; #m\n", + "f =0.005;\n", + "L =100; #m\n", + "N1 =1200; #rpm\n", + "\n", + "# H=z2-z1+16\u0003Q^2/2/ g /%pi ^2/d ^4\u0003(4\u0003 f \u0003L/d+1)\n", + "# H=10+5.42\u000310^5\u0003Q^2\n", + "\n", + "#Calculation\n", + "Q =[0.000, 0.002, 0.004, 0.006, 0.008, 0.010];\n", + "H_p =[40.0, 39.5, 38.0, 35.0, 30.0, 20.0];\n", + "H_s =[10.0, 12.2, 18.7, 29.5, 44.7, 64.2];\n", + "figure()\n", + "plot (Q,H_p , 'b')\n", + "plot (Q,H_s , 'r')\n", + "xlabel('FLOW (m^3/s)')\n", + "ylabel('HEAD (m)')\n", + "title('system and pump')\n", + "#xtitle (\" \" , \"Flow\" , \"Head\")\n", + "#legend (\"pump\" , \" system\")\n", + "a =[0.0066, 0.0066];\n", + "b =[0, 33.8];\n", + "\n", + "plot (a,b)\n", + "e =[0, 0.0066];\n", + "f =[33.8, 33.8];\n", + "plot (e,f)\n", + "i =[0.0049, 0.0049];\n", + "h =[0, 23];\n", + "\n", + "plot (i,h)\n", + "l =[0, 0.00495];\n", + "m =[23, 23];\n", + "plot (l,m)\n", + "show()\n", + "\n", + "#From graph\n", + "H1 =34.0; #m\n", + "H2 =23.0; # m\n", + "Q1 =0.0066; #m^3/ s\n", + "Q2 =0.00495; #m^3/ s\n", + "N2=N1 *( H2/H1)**(0.5) ;\n", + "\n", + "#result\n", + "print \"Duty point(m^3/s) =\",round(Q1,4)\n", + "print \"The speed of the pump to reduce the flow by 25% =\",round(N2,3)\n", + "\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\n", + "For more information, type 'help(pylab)'.\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYkAAAEXCAYAAABYsbiOAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlcVNX/P/DX4K6ggsKgoJILoZCIO4o5iWj2DSQzUz8q\nqdlifcv8/Nz6pGGWYpaW7ZkLbZb1ScU1l8TdUCE1FVcURcB0QAURBM7vj/NllGUQhrkzzNzX8/GY\nR8zMnTvvc8P75p5zz/tohBACREREZXCwdgBERFR9MUkQEZFRTBJERGQUkwQRER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EckyAi\nIqOYJIiIyCgmCSIiMopJgoiIjGKSICIio5gkiIjIqP8PGWNRyvJ14HwAAAAASUVORK5CYII=\n" + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Duty point(m^3/s) = 0.0066\n", + "The speed of the pump to reduce the flow by 25% = 986.974\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.11,Page 257" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Varable Declaration\n", + "Q =0.05; # m^3/ s\n", + "v =2; # m/ s\n", + "f =0.005;\n", + "L_s =5; # m\n", + "d =0.178; #m\n", + "g =9.81; # m/ s ^2\n", + "L_d =20; # m\n", + "p2 =1.5*10**5; # N/m^2\n", + "p1 =0.5*10**5; # N/m^2\n", + "rho =1000; # kg /m^3\n", + "z2 =15; # m\n", + "z1 =5; # m\n", + "N1 =1500.0/60; # rps\n", + "pi=3.14;\n", + "Q =[0, 5, 10, 15, 20, 25];\n", + "H =[9.25, 8.81, 7.85, 6.48, 4.81, 2.96];\n", + "P=[- 0.96, 1.03, 1.19, 1.26, 1.45];\n", + "n1 =[0, 45, 75, 800, 75, 50];\n", + "H =27.96; #m\n", + "H1 =6.48; #m\n", + "Q1 =0.015; #m^3/ s\n", + "Q =0.05; #m^3/ s\n", + "D1 =0.15; #m\n", + "n =0.80;\n", + "\n", + "#calculation\n", + "d =(4* Q/ pi /v)**(0.5) ;\n", + "H_f_s =4* f* L_s /d*v **2/2/ g;\n", + "H_f_d =4* f* L_d /d*v **2/2/ g;\n", + "H =1/(1 -0.25) *(( p2 -p1)/ rho /g + v **2/2/ g + z2 - z1 +H_f_s + H_f_d );\n", + "# n=rho \u0003g\u0003Q\u0003H/P\n", + "N=N1 *(H/H1) **(0.75) *( Q1/Q) **(0.5) ;\n", + "D=D1 *(Q*N1/Q1/N)**(0.2) ;\n", + "P= rho *g*Q*H/n;\n", + "\n", + "#result\n", + "print \" Differential Head (m) =\",round(H,3);\n", + "print \"impeller diameter (m)=\",round(D,3)\n", + "print \"The rotational speed at maximum efficiency (rps)=\",round(N,3)\n", + "print \"Power input to the pump (W)=\",round(P,3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Differential Head (m) = 27.958\n", + "impeller diameter (m)= 0.173\n", + "The rotational speed at maximum efficiency (rps)= 40.992\n", + "Power input to the pump (W)= 17141.964\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.12,Page 259" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable Declaration\n", + "N =2000.0/60; #rps\n", + "Q =50.0/3600; #m^3/ s\n", + "g =9.81; #m/ s ^2\n", + "H =5.0; #m\n", + "\n", + "#Calculation\n", + "S_n =N*Q **(0.5) /(g)**(0.75)/(H) **(0.75) ;\n", + "\n", + "#result\n", + "print \" Suction specific speed =\",round(S_n,3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Suction specific speed = 0.212\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.14,Page 264" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable Declaration\n", + "A =0.01; #m^2\n", + "L =0.3; # m\n", + "N =60/60; # rps\n", + "V_act =10.6/3600; # m^3/ s\n", + "rho =1000; # kg /m^3\n", + "g =9.81; # m/ s ^2\n", + "Q =10.6/3600; # m^3/ s\n", + "H =15; # m\n", + "\n", + "#calculation\n", + "V=A*L*N;\n", + "Cd= V_act /V;\n", + "P= rho *g*Q*H;\n", + "\n", + "#result\n", + "print \" Coeff. of Discharge =\",round(Cd,2)\n", + "print \"The power required (W)=\",round(P,3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Coeff. of Discharge = 0.98\n", + "The power required (W)= 433.275\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fluidization_Engineering/.ipynb_checkpoints/ch10-checkpoint.ipynb b/Fluidization_Engineering/.ipynb_checkpoints/ch10-checkpoint.ipynb new file mode 100644 index 00000000..40d88cd4 --- /dev/null +++ b/Fluidization_Engineering/.ipynb_checkpoints/ch10-checkpoint.ipynb @@ -0,0 +1,304 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:89c91579d721ed0f833b399593203d4eb19421ab1695bc830f1be612e46bd826" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 10 : Gas Dispersion and Gas Interchange in Bubbling Beds" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "%pylab inline" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\n", + "For more information, type 'help(pylab)'.\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1, Page 253\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from numpy import *\n", + "%pylab inline\n", + "#Variable declaration\n", + "umf=[0.01,0.045]; #Velocity at minimum fluidization condition in m/s\n", + "ephsilonmf=[0.5,0.5]; #Void fraction at minimum fluidization condition\n", + "D=[2E-5,7E-5]; #Diffusion coefficient of gas in m**2/s\n", + "g=9.81; #Acceleration due to gravity in m/s**2\n", + "\n", + "#CALCULATION\n", + "db=[5.,10.,15.,20.];\n", + "n=len(umf);\n", + "m=len(db)\n", + "Kbc = zeros((n,m))\n", + "Kce = zeros((n,m))\n", + "Kbe = zeros((n,m))\n", + " \n", + "for i in range(n):\n", + " for j in range(m):\n", + " Kbc[i][j]=4.5*(umf[i]/db[j])+5.85*((D[i]**0.5*g**0.25)/db[j]**(5.0/4));#Gas interchange coefficient between bubble and cloud from Eqn.(27)\n", + " Kce[i][j]=6.77*((D[i]*ephsilonmf[i]*0.711*(g*db[j])**0.5)/db[j]**3)**0.5;#Gas interchange coefficient between emulsion and cloud from Eqn.(34)\n", + " Kbe[i][j]=(Kbc[i][j]*Kce[i][j])/(Kbc[i][j]+Kce[i][j]);#Gas interchange coefficient between bubble and emulsion from Eqn.(14)\n", + "\n", + "#OUTPUT\n", + "i=0;\n", + "j=0;\n", + "k=0;\n", + "while k" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2, Page 267" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "#INPUT\n", + "umf=0.12 #Velocity at minimum fluidization condition in cm/s\n", + "uo=40.; #Superficial gas velocity in cm/s\n", + "ub=120; #Velocity of the bubble in cm/s\n", + "D=0.7; #Diffusion coefficient of gas in cm**2/s\n", + "abkbe1=1.; #Bubble-emuslion interchange coefficient for non absorbing particles(m=0)\n", + "abkbe2=18.; #Bubble-emuslion interchange coefficient for highly absorbing particles(m=infinity)\n", + "g=980.; #Acceleration due to gravity in square cm/s**2\n", + "\n", + "#CALCULATION\n", + "#For non absorbing particles m=0,etad=0\n", + "Kbc=(ub/uo)*(abkbe1);\n", + "dbguess=2;#Guess value of db\n", + "def solver_func(db): #Function defined for solving the system\n", + " return abkbe1-(uo/ub)*(4.5*(umf/db)+5.85*(D**0.5*g**0.25)/(db**(5/4.)));#Eqn.(10.27)\n", + "\n", + "d=fsolve(solver_func,dbguess)\n", + "#For highly absorbing particles m=infinity, etad=1\n", + "M=abkbe2-(uo/ub)*Kbc;\n", + "#For intermediate condition\n", + "alpha=100.;\n", + "m=10.;\n", + "etad=1./(1+(alpha/m));#Fitted adsorption efficiency factor from Eqn.(23)\n", + "abkbe3=M*etad+(uo/ub)*Kbc;\n", + "\n", + "#OUTPUT\n", + "print 'For non absorbing particles:\\tDiameter of bubble=%fcm\\tBubble-cloud interchange coefficient=%fs**-1'%(d,Kbc);\n", + "print 'For highly absorbing partilces:\\tM=%f'%(M);\n", + "print 'For intermediate condition:\\tFitted adsorption efficiency factor:%f\\tBubble-emuslion interchange coefficient:%fs**-1'%(etad,abkbe3);\n", + "\n", + "#====================================END OF PROGRAM ======================================================" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "For non absorbing particles:\tDiameter of bubble=6.010032cm\tBubble-cloud interchange coefficient=3.000000s**-1\n", + "For highly absorbing partilces:\tM=17.000000\n", + "For intermediate condition:\tFitted adsorption efficiency factor:0.090909\tBubble-emuslion interchange coefficient:2.545455s**-1\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3, Page 273\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "rhos=1.3; #Density of solids in g/cc\n", + "phis=0.806; #Sphericity of solids\n", + "gammab=0.001; #Ratio of volume of dispersed solids to that of bubble phase\n", + "rhog=1.18E-3; #Density of air in g/cc\n", + "Pr=0.69; #Prandtl number\n", + "myu=1.8E-4; #Viscosity of gas in g/cm s\n", + "Cpg=1.00; #Specific heat capacity of gas in J/g K\n", + "ephsilonmf=0.45; #Void fraction at minimum fluidization condition\n", + "kg=2.61E-4; #Thermal concuctivity of gas in W/cm k\n", + "dp=0.036; #Particle size in cm\n", + "umf=6.5; #Velocity at minimum fluidization condition in cm/s\n", + "ut=150.; #Terminal velocity in cm/s\n", + "db=0.4; #Equilibrium bubble size in cm\n", + "etah=1; #Efficiency of heat transfer\n", + "uo=[10.,20.,30.,40.,50.];#Superficial gas velocity in cm/s\n", + "g=980.; #Acceleration due to gravity in square cm/s**2\n", + "\n", + "#CALCULATION\n", + "Nustar=2+(((dp*ut*rhog)/myu)**0.5*Pr**(1./3));#Nusselt no. from Eqn.(25)\n", + "Hbc=4.5*(umf*rhog*Cpg/db)+5.85*((kg*rhog*Cpg)**0.5*g**0.25/db**(5./4));#Total heat interchange across the bubble-cloud boundary from Eqn.(32)\n", + "ubr=0.711*(g*db)**0.5;#Rise velocity of the bubble from Eqn.(6.7)\n", + "n=len(uo);\n", + "i=0;\n", + "x = [0,0,0,0,0]\n", + "Nubed = [0,0,0,0,0]\n", + "Rep = [0,0,0,0,0]\n", + "\n", + "while i" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4, Page 274\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable declaration\n", + "rhog=1.2; #Density of air in kg/m**3\n", + "myu=1.8E-5; #Viscosity of gas in kg/m s\n", + "kg=2.6E-2; #Thermal concuctivity of gas in W/m k\n", + "dp=1E-4; #Particle size in m\n", + "rhos=8920; #Density of solids in kg/m**3\n", + "Cps=390; #Specific heat capacity of the solid in J/kg K\n", + "ephsilonf=0.5; #Void fraction of the fluidized bed\n", + "umf=0.1; #Velocity at minimum fluidization condition in m/s\n", + "uo=0.1; #Superficial gas velocity in m/s\n", + "pi=3.14\n", + "\n", + "#CALCULATION\n", + "to=0; #Initial temperature of the bed\n", + "T=100; #Temperature of the bed\n", + "t=0.99*T; #Particle temperature i.e. when it approaches 1% of the bed temperature\n", + "mp=(pi/6)*dp**3*rhos; #Mass of the particle\n", + "A=pi*dp**2; #Surface area of the particle\n", + "Rep=(dp*uo*rhog)/myu; #Reynold's no. of the particle\n", + "Nubed=0.0178; #Nusselt no. from Fig.(6)\n", + "hbed1=(Nubed*kg)/dp; #Heat transfer coefficient of the bed\n", + "t1=(mp*Cps/(hbed1*A))*math.log((T-to)/(T-t));#Time needed for the particle approach 1 percentage of the bed temperature in case(a)\n", + "hbed2=140*hbed1;#Since from Fig.(6) Nup is 140 times Nubed\n", + "t2=(mp*Cps/(hbed2*A))*math.log((T-to)/(T-t));#Time needed for the particle approach 1 percentage of the bed temperature in case(b)\n", + "\n", + "#OUTPUT\n", + "print 'Case(a):Using the whole bed coefficient from Fig.(6)'\n", + "print '\\tTime needed for the particle approach 1 percentage of the bed temperature is %.0fs'%t1\n", + "print 'Case(b):Uisng the single-particle coefficient of Eqn.(25),also shown in Fig.(6)'\n", + "print '\\tTime needed for the particle approach 1 percentage of the bed temperature is %.2fs'%t2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Case(a):Using the whole bed coefficient from Fig.(6)\n", + "\tTime needed for the particle approach 1 percentage of the bed temperature is 58s\n", + "Case(b):Uisng the single-particle coefficient of Eqn.(25),also shown in Fig.(6)\n", + "\tTime needed for the particle approach 1 percentage of the bed temperature is 0.41s\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fluidization_Engineering/.ipynb_checkpoints/ch12-checkpoint.ipynb b/Fluidization_Engineering/.ipynb_checkpoints/ch12-checkpoint.ipynb new file mode 100644 index 00000000..1fc80a09 --- /dev/null +++ b/Fluidization_Engineering/.ipynb_checkpoints/ch12-checkpoint.ipynb @@ -0,0 +1,396 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:3cabb972e9b40cc3c2621280c95233b4046eb8d671e52d74d499a7e149a3d9aa" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 12 : Conversion of Gas in Catalytic Reactions" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1, Page 293\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable declaration\n", + "Kr=10.; #rate constant in m**3 gas/m**3 cat s\n", + "D=2E-5; #Diffusion coefficient of gas in m**2/s\n", + "dpbar=68.; #Average partilce size in micrometers\n", + "ephsilonm=0.5; #Void fraction of fixed bed\n", + "gammab=0.005; #Ratio of volume of dispersed solids to that of bubble phase\n", + "ephsilonmf=0.55; #Void fraction at minimum fluidization condition\n", + "umf=0.006; #Velocity at minimum fluidization condition in m/s\n", + "db=0.04; #Equilibrium bubble size in m\n", + "Lm=0.7; #Length of the bed in m\n", + "uo=0.1; #Superficial gas velocity in m/s\n", + "dbed=0.26; #Diameter of the bed in m\n", + "g=9.81; #Acceleration due to gravity in square m/s**2\n", + "\n", + "#CALCULATION\n", + "ubr=0.711*(g*db)**0.5;#Rise velocity of bubble from Eqn.(6.7)\n", + "ub=uo-umf+ubr;#Velocity of bubbles in bubbling beds in Eqn.(6.8)\n", + "Kbc=4.5*(umf/db)+5.85*((D**0.5*g**0.25)/db**(5./4));#Gas interchange coefficient between bubble and cloud from Eqn.(10.27)\n", + "Kce=6.77*((D*ephsilonmf*0.711*(g*db)**0.5)/db**3)**0.5;#Gas interchange coefficient between emulsion and cloud from Eqn.(10.34)\n", + "delta=uo/ub;#Fraction of bed in bubbles from Eqn.(6.29)\n", + "fw=0.6;#Wake volume to bubble volume from Fig.(5.8)\n", + "gammac=(1-ephsilonmf)*((3/(ubr*ephsilonmf/umf-1))+fw);#Volume of solids in cloud to that of the bubble from Eqn.(6.36)\n", + "gammae=((1-ephsilonmf)*((1-delta)/delta))-gammab-gammac;#Volume of solids in emulsion to that of the bubble from Eqn.(6.35)\n", + "ephsilonf=1-(1-delta)*(1-ephsilonmf);#Void fraction of fixed bed from Eqn.(6.20)\n", + "Lf=(1-ephsilonm)*Lm/(1-ephsilonf);#Length of fixed bed from Eqn.(6.19)\n", + "Krtou=Kr*Lm*(1-ephsilonm)/uo;#Dimensionless reaction rate group from Eqn.(5)\n", + "Kf=gammab*Kr+1/((1/Kbc)+(1/(gammac*Kr+1/((1/Kce)+(1/(gammae*Kr))))));#Raction rate for fluidized bed from Eqn.(14)\n", + "XA=math.exp(-1*Kf*Lf/ub);#Conversion from Eqn.(16)\n", + "\n", + "#OUTPUT\n", + "print 'The dimnesionless reaction rate group: %f'%Krtou\n", + "print 'The reaction rate for fluidized bed: %fs**-1'%Kf\n", + "print 'Conversion: %f'%XA\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The dimnesionless reaction rate group: 35.000000\n", + "The reaction rate for fluidized bed: 1.979872s**-1\n", + "Conversion: 0.030056\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2, Page 298\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#Variable declaration\n", + "umf=0.005; #Velocity at minimum fluidization condition in m/s\n", + "ephsilonm=0.52; #Void fraction of fixed bed\n", + "ephsilonmf=0.57; #Void fraction at minimum fluidization condition\n", + "DA=8.1E-6; #Diffusion coefficient of gas in m**2/s\n", + "DR=8.4E-6; #Diffusion coefficient of gas in m**2/s\n", + "Lm=5; #Length of the bed in m\n", + "dte=1; #Diameter of tube in m\n", + "Kr1=1.5; #rate constant in m**3 gas/m**3 cat s\n", + "Kr3=0.01; #rate constant in m**3 gas/m**3 cat s\n", + "gammab=0.005; #Ratio of volume of dispersed solids to that of bubble phase\n", + "uo=0.45; #Superficial gas velocity in m/s\n", + "db=0.05; #Equilibrium bubble size in m from Fig.(6.8)\n", + "ub=1.5; #Velocity of bubbles in bubbling bed in m/s from Fig.(6.11(a))\n", + "g=9.81; #Acceleration due to gravity in square m/s**2\n", + "\n", + "#CALCULATION\n", + "ubr=0.711*(g*db)**0.5;#Rise velocity of bubble from Eqn.(6.7)\n", + "KbcA=4.5*(umf/db)+5.85*((DA**0.5*g**0.25)/db**(5.0/4));#Gas interchange coefficient between bubble and cloud from Eqn.(10.27)\n", + "KceA=6.77*((DA*ephsilonmf*0.711*(g*db)**0.5)/db**3)**0.5;#Gas interchange coefficient between emulsion and cloud from Eqn.(10.34)\n", + "KbcR=4.5*(umf/db)+5.85*((DR**0.5*g**0.25)/db**(5./4));#Gas interchange coefficient between bubble and cloud from Eqn.(10.27)\n", + "KceR=6.77*((DR*ephsilonmf*0.711*(g*db)**0.5)/db**3)**0.5;#Gas interchange coefficient between emulsion and cloud from Eqn.(10.34)\n", + "delta=uo/ub;#Fraction of bed in bubbles from Eqn.(6.29)\n", + "fw=0.6;#Wake volume to bubble volume from Fig.(5.8)\n", + "gammac=(1-ephsilonmf)*((3/(ubr*ephsilonmf/umf-1))+fw);#Volume of solids in cloud to that of the bubble from Eqn.(6.36)\n", + "gammae=((1-ephsilonmf)*((1-delta)/delta))-gammab-gammac;#Volume of solids in emulsion to that of the bubble from Eqn.(6.35)\n", + "ephsilonf=1-(1-delta)*(1-ephsilonmf);#Void fraction of fixed bed from Eqn.(6.20)\n", + "Lf=(1-ephsilonm)*Lm/(1-ephsilonf);#Length of fixed bed from Eqn.(6.19)\n", + "Krtou=Kr1*Lm*(1-ephsilonm)/uo;#Dimensionless reaction rate group from Eqn.(5)\n", + "Kr12=Kr1;#Since the reactions are a special case of Denbigh scheme\n", + "Kr34=Kr3;\n", + "Kf1=(gammab*Kr12+1/((1/KbcA)+(1/(gammac*Kr12+1/((1/KceA)+(1/(gammae*Kr12)))))))*(delta/(1-ephsilonf));#Rate of reaction 1 for fluidized bed from Eqn.(14)\n", + "Kf3=(gammab*Kr34+1/((1/KbcR)+(1/(gammac*Kr34+1/((1/KceR)+(1/(gammae*Kr34)))))))*(delta/(1-ephsilonf));#Rate of reaction 2 for fluidized bed from Eqn.(14)\n", + "Kf12=Kf1;\n", + "Kf34=Kf3;\n", + "KfA=((KbcR*KceA/gammac**2+(Kr12+KceA/gammac+KceA/gammae)* \\\n", + " (Kr34+KceR/gammac+KceR/gammae))*delta*KbcA*Kr12*Kr34/ \\\n", + " (1-ephsilonf))/(((Kr12+KbcA/gammac)*(Kr12+KceA/gammae)+Kr12*KceA/gammac) \\\n", + " *((Kr34+KbcR/gammac)*(Kr34+KceR/gammae)+Kr34*KceR/gammac));\n", + " #Rate of raection with respect to A from Eqn.(35)\n", + "KfAR=Kr1/Kr12*Kf12-KfA;#Rate of reaction from Eqn.(34)\n", + "tou=Lf*(1-ephsilonf)/uo;#Residence time from Eqn.(5)\n", + "XA=1-math.exp(-Kf1*tou);#Conversion of A from Eqn.(26)\n", + "XR=1-((KfAR/(Kf12-Kf34))*(math.exp(-Kf34*tou)-math.exp(-Kf12*tou)));#Conversion of R from Eqn.(27)\n", + "SR=(1-XR)/XA;#Selectivity of R\n", + "\n", + "#OUTPUT\n", + "\n", + "print 'Rate of reaction 1 for fluidized bed:%.4f'%Kf1\n", + "print 'Rate of reaction 2 for fluidized bed:%.4f'%Kf3\n", + "print 'Rate of reaction 1 with respect to A:%.4f'%KfA\n", + "print 'The Conversion of Napthalene:%.0f percentage'%(XA*100);\n", + "print 'The selectivity of Phthalic anhydride:%.0f percentage'%(SR*100);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Rate of reaction 1 for fluidized bed:0.6007\n", + "Rate of reaction 2 for fluidized bed:0.0099\n", + "Rate of reaction 1 with respect to A:0.0058\n", + "The Conversion of Napthalene:96 percentage\n", + "The selectivity of Phthalic anhydride:95 percentage\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3, Page 302\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#Variable declaration\n", + "Kr=3.; #rate constant in m**3 gas/m**3 cat s\n", + "db=0.12; #Equilibrium bubble size in m\n", + "D=9E-5; #Diffusion coefficient of gas in m**2/s\n", + "dpbar=68; #Average partilce size in micrometers\n", + "ephsilonm=0.42; #Void fraction of fixed bed\n", + "uo=0.4; #Superficial gas velocity in m/s\n", + "Lm=0.8; #Length of the bed in m\n", + "ephsilonmf=0.45; #Void fraction at minimum fluidization condition\n", + "umf=0.21; #Velocity at minimum fluidization condition in m/s\n", + "gammab=0; #Ratio of volume of dispersed solids to that of bubble phase\n", + "g=9.81; #Acceleration due to gravity in square m/s**2\n", + "\n", + "#CALCULATION\n", + "ubr=0.711*(g*db)**0.5; #Rise velocity of bubble from Eqn.(6.7)\n", + "ub=uo-umf+ubr; #Velocity of bubbles in bubbling beds in Eqn.(6.8)\n", + "ubstar=ub+3*umf; #Rise velocity of the bubble gas from Eqn.(45)\n", + "delta=(uo-umf)/(ub+umf);#Fraction of bed in bubbles from Eqn.(6.46)\n", + "Kbe=4.5*(umf/db); #Interchange coefficient between bubble and emulsion from Eqn.(47)\n", + "Lf=Lm*(1-ephsilonm)/((1-delta)*(1-ephsilonmf));#Length of fixed bed\n", + "phi=((Kr/Kbe)**2*((1-ephsilonmf)-gammab*(umf/ubstar))**2+ \\\n", + " ((delta/(1-delta))+umf/ubstar)**2+2*(Kr/Kbe)*((1-ephsilonmf) \\\n", + " -gammab*(umf/ubstar))*((delta/(1-delta))-umf/ubstar))**0.5;\n", + " #From Eqn.(52)\n", + " \n", + "q1=0.5*Kr/umf*((1-ephsilonmf)+gammab*(umf/ubstar))+0.5*Kbe/umf* \\\n", + " (((delta/(1-delta))+umf/ubstar)-phi);#From Eqn.(50)\n", + "q2=0.5*Kr/umf*((1-ephsilonmf)+gammab*(umf/ubstar))+0.5*Kbe/umf* \\\n", + " (((delta/(1-delta))+umf/ubstar)+phi);#From Eqn.(50)\n", + " \n", + "si1=0.5-0.5*((1-delta)/delta)*(umf/ubstar-Kr/Kbe*((1-ephsilonmf)- \\\n", + " gammab*(umf/ubstar))-phi);#From Eqn.(51)\n", + "si2=0.5-0.5*((1-delta)/delta)*(umf/ubstar-Kr/Kbe*((1-ephsilonmf)- \\\n", + " gammab*(umf/ubstar))+phi);#From Eqn.(51)\n", + "XA=1-(delta/(1-delta))*(1/(uo*phi))*((1-si2)*(si1*delta*ubstar+ \\\n", + " (1-delta)*umf)*math.exp(-q1*Lf)+(si1-1)* \\\n", + " (si2*delta*ubstar+(1-delta)*umf)*math.exp(-q2*Lf));\n", + " #Conversion from Eqn.(49)\n", + " \n", + "Krtou=Kr*Lm*(1-ephsilonm)/uo;#Dimensionless reaction rate group from Eqn.(5)\n", + "\n", + "#OUTPUT\n", + "print 'COmparing the values of 1-XA = %f and Krtou = %f with Fig.(6), \\\n", + "we can conlcude that this operating condition is shown as point \\\n", + "A in Fig.(3)'%(1-XA,Krtou);\n", + "print 'Line 2 gives the locus of conversions for different values of the \\\n", + "reaction rate group for this fluidized contacting'\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "COmparing the values of 1-XA = 0.113843 and Krtou = 3.480000 with Fig.(6), we can conlcude that this operating condition is shown as point A in Fig.(3)\n", + "Line 2 gives the locus of conversions for different values of the reaction rate group for this fluidized contacting\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4, Page 305\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable declaration\n", + "uo=0.25; #Superficial gas velocity in m/s\n", + "db=0.025; #Equilibrium bubble size in m\n", + "Kr=1.5; #rate constant in m**3 gas/m**3 cat s\n", + "umf=0.21; #Velocity at minimum fluidization condition in m/s\n", + "Lm=0.8; #Length of the bed in m\n", + "ephsilonm=0.42; #Void fraction of fixed bed\n", + "g=9.81; #Acceleration due to gravity in square m/s**2\n", + "\n", + "#CALCULATION\n", + "ubr=0.711*(g*db)**0.5;#Rise velocity of bubble from Eqn.(6.7)\n", + "ub=uo-umf+ubr;#Velocity of bubbles in bubbling beds in Eqn.(6.8)\n", + "delta=(uo-umf)/(ub+2*umf);#Fraction of bed in bubbles from Eqn.(55) since ub/umf<<1 \n", + "XA=1-math.exp(-Kr*Lm*((1-ephsilonm)/uo)*(umf/uo)*(1-delta));#Conversion from Eqn.(57)\n", + "Krtou=Kr*Lm*(1-ephsilonm)/uo;#Dimensionless reaction rate group from Eqn.(5)\n", + "\n", + "\n", + "#OUTPUT\n", + "print 'Comparing the values of 1-XA = %f and Krtou = %f with Fig.(6), \\\n", + "we can conlcude that this operating condition is shown \\\n", + "as point B in Fig.(3)'%(1-XA,Krtou);\n", + "print 'Line 3 gives the locus of conversions for different values \\\n", + "of the reaction rate group for this fluidized contacting'\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Comparing the values of 1-XA = 0.108243 and Krtou = 2.784000 with Fig.(6), we can conlcude that this operating condition is shown as point B in Fig.(3)\n", + "Line 3 gives the locus of conversions for different values of the reaction rate group for this fluidized contacting\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5, Page 307\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable declaration\n", + "uo=0.3; #Superficial gas velocity in m/s\n", + "Lf=1.1; #Length of fixed bed in m\n", + "Hf=1.2; #Length of freeboard in m\n", + "db=0.04; #Equilibrium bubble size in m\n", + "umf=0.006; #Velocity at minimum fluidization condition in m/s\n", + "ephsilonmf=0.55; #Void fraction at minimum fluidization condition\n", + "gammab=0.005; #Ratio of volume of dispersed solids to that of bubble phase\n", + "Kr=10.; #rate constant in m**3 gas/m**3 cat s\n", + "D=2E-5; #Diffusion coefficient of gas in m**2/s\n", + "g=9.81; #Acceleration due to gravity in square m/s**2\n", + "\n", + "#CALCULATION\n", + "ubr=0.711*(g*db)**0.5;#Rise velocity of bubble from Eqn.(6.7)\n", + "ub=uo-umf+ubr;#Velocity of bubbles in bubbling beds in Eqn.(6.8)\n", + "Kbc=4.5*(umf/db)+5.85*((D**0.5*g**0.25)/db**(5./4));\n", + "#Gas interchange coefficient between bubble and cloud from Eqn.(10.27)\n", + "\n", + "Kce=6.77*((D*ephsilonmf*0.711*(g*db)**0.5)/db**3)**0.5;\n", + "#Gas interchange coefficient between emulsion and cloud from Eqn.(10.34)\n", + "\n", + "delta=uo/ub;#Fraction of bed in bubbles from Eqn.(6.29)\n", + "ephsilonf=1-(1-delta)*(1-ephsilonmf);#Void fraction of fixed bed from Eqn.(6.20)\n", + "fw=0.6;#Wake volume to bubble volume from Fig.(5.8)\n", + "gammac=(1-ephsilonmf)*((3.0/(ubr*ephsilonmf/umf-1))+fw);\n", + "#Volume of solids in cloud to that of the bubble from Eqn.(6.36)\n", + "\n", + "gammae=((1-ephsilonmf)*((1-delta)/delta))-gammab-gammac;\n", + "#Volume of solids in emulsion to that of the bubble from Eqn.(6.35)\n", + "\n", + "Kf=(gammab*Kr)+1.0/((1.0/Kbc)+(1.0/(gammac*Kr+1.0/((1.0/Kce)+(1.0/(gammae*Kr))))));\n", + "#Raction rate for fluidized bed from Eqn.(14)\n", + "\n", + "XA=1-math.exp(-1*Kf*Lf/ub);#Conversion at the top of dense bed from Eqn.(16)\n", + "etabed=(Kf*delta)/(Kr*(1-ephsilonf));#Reactor efficiency from Eqn.(22)\n", + "a=0.6/uo #Since uoa = 0.6s**-1 from Fig.(5)\n", + "adash=6.62; #From Fig.(5)\n", + "XA1=1-1.0/(math.exp(((1-ephsilonf)*Kr/(uo*a))*((1-math.exp(-a*Hf))- \\\n", + " ((1-etabed)/(1+(adash/a)))*(1-math.exp(-(a+adash)*Hf)))));#Conversion from Eqn.(64)\n", + "XA2=1-(1.0-XA1)*(1.0-XA);#Conversion at the exit from Eqn.(64)\n", + "\n", + "#OUTPUT\n", + "print 'The conversion:'\n", + "print '\\tAt the top pf the dense bed: %d percentage'%(XA1*100)\n", + "print '\\tAt the reactor exit: %d percentage'%(XA2*100);\n", + "\n", + "#Disclaimer: The value of kf deviate from the one given in textbook, where as it is close to the value obtained by manual calculation. \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The conversion:\n", + "\tAt the top pf the dense bed: 96 percentage\n", + "\tAt the reactor exit: 99 percentage\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fluidization_Engineering/.ipynb_checkpoints/ch13-checkpoint.ipynb b/Fluidization_Engineering/.ipynb_checkpoints/ch13-checkpoint.ipynb new file mode 100644 index 00000000..18536015 --- /dev/null +++ b/Fluidization_Engineering/.ipynb_checkpoints/ch13-checkpoint.ipynb @@ -0,0 +1,308 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:a97460b196d7b42e945dcfefc11684cc1c39c5847f8b0bdc9e3f6cdcd94bfcc3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Chapter 13 : Heat Transfer between Fluidized Beds and Surfaces" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1, Page 331\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "dp=57.0; #Particle size in micrometer\n", + "rhos=940.0; #Density of solids in kg/m**3\n", + "Cps=828.0; #Specific heat capacity of the solid in J/kg K\n", + "ks=0.20; #Thermal conductivity of solids in W/m k\n", + "kg=0.035; #Thermal concuctivity of gas in W/m k\n", + "umf=0.006; #Velocity at minimum fluidization condition in m/s\n", + "ephsilonmf=0.476;#Void fraction at minimum fluidization condition\n", + "do1=0.0254; #Outside diameter of tube in m\n", + "L=1;\n", + "uo=[0.05,0.1,0.2,0.35];#Superficial gas velocity in m/s\n", + "nw=[2.,3.1,3.4,3.5]; #Bubble frequency in s**-1\n", + "g=9.81; #Acceleration due to gravity in square m/s**2\n", + "\n", + "\n", + "#CALCULATION\n", + "dte=4.*do1*L/2.*L; #Hydraulic diameter from Eqn.(6.13)\n", + "db=(1+1.5)*0.5*dte; #Rise velocity of the bubble\n", + "ubr=0.711*(g*db)**0.5; #Rise velocity of bubble from Eqn.(6.7)\n", + "phib=0.19;#From Fig.(15) for ks/kg=5.7\n", + "ke=ephsilonmf*kg+(1-ephsilonmf)*ks*(1/((phib*(ks/kg))+(2/3.0)))\n", + " #Effective thermal conductivity of bed from Eqn.(3) \n", + " \n", + "n=len(uo);\n", + "i=0;\n", + "ub = [0,0,0,0]\n", + "delta = [0,0,0,0]\n", + "h = [0,0,0,0]\n", + "while ix2min:\n", + " excess_air[i]=(x2[i]-x2min)/x2min; #Excess air used\n", + " else:\n", + " excess_air[i]=0;\n", + " i=i+1;\n", + "\n", + "#OUTPUT \n", + "print 'T4(degree celcius)',\n", + "print '\\tFs/F1',\n", + "print '\\t\\tF2/F1',\n", + "print '\\t\\tExcess air(percentage)'\n", + "i=0;\n", + "while idte:\n", + " li=(pi/4*dte*do1+pi/4*do1**2)**0.5;#Pitch if we add dummy tubes\n", + "import math\n", + "f=li**2-pi/4*do1**2;#Fraction of bed cross section taken up by tubes\n", + "dt1=math.sqrt(4/pi*At/(1-f));#Reactor diameter including all its tubes\n", + "\n", + "#OUTPUT\n", + "print 'Superficial gas velocity=%fm/s'%uo\n", + "print 'No. of %1.0fm tubes required=%1.0f'%(L,Nt);\n", + "print 'Reactor diameter=%fm'%dt1\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Superficial gas velocity=0.460000m/s\n", + "No. of 7m tubes required=295\n", + "Reactor diameter=7.173176m\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3, Page 444\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "db=0.08; #Estimated bubble size in m\n", + "dte=2; #Equivalent diameter in m\n", + "F1=55.6; #Feed rate of oil in kg/s\n", + "XA=0.63; #Conversion\n", + "uo=0.6; #Superficial gas velocity in m/s\n", + "T1=500.0; #Temperature of reactor in degree C\n", + "T2=580.0; #Temperature of regenerator in degree C\n", + "Fs=F1*23.3; #Solid circulation rate from Ex.(15.2)\n", + "rhos=1200.0; #Density of catalyst in kg/m**3\n", + "dpbar=60.0; #Average particle size in micrometer\n", + "ephsilonm=0.50;#Void fraction of fixed bed\n", + "ephsilonmf=0.55;#Void fraction at minimum fluidized condition\n", + "umf=0.006; #Velocity at minimum fluidization condition in m/s\n", + "dt=8.0; #Diameter of reactor in m\n", + "D=2E-5; #Diffusion coefficient of gas in m**2/s\n", + "Kr=8.6; #Rate constant for reaction at 500 degree C in s**-1\n", + "Ka1=0.06; #Rate constant for deactivatiion at 500 degree C in s**-1\n", + "Ka2=0.012; #Rate constant for regeneration at 580 degree C in s**-1\n", + "gammab=0.005; #Ratio of volume of dispersed solids to that of bubble phase\n", + "g=9.81; #Acceleration due to gravity in square m/s**2\n", + "pi=3.14;\n", + "\n", + "#CALCULATION\n", + "#Parameters for the fluidized reactor\n", + "ubr=0.711*(g*db)**0.5;#Rise velocity of bubble from Eqn.(6.7)\n", + "ub=1.55*((uo-umf)+14.1*(db+0.005))*dte**0.32+ubr;#Bubble velocity for Geldart A particles from Equation from Eqn.(6.11)\n", + "delta=uo/ub;#Fraction of bed in bubbles from Eqn.(6.29)\n", + "ephsilonf=1-(1-delta)*(1-ephsilonmf);#Void fraction of fixed bed from Eqn.(6.20)\n", + "fw=0.6;#Wake volume to bubble volume from Fig.(5.8)\n", + "gammac=(1-ephsilonmf)*((3/(ubr*ephsilonmf/umf-1))+fw);#Volume of solids in cloud to that of the bubble from Eqn.(6.36)\n", + "gammae=((1-ephsilonmf)*((1-delta)/delta))-gammab-gammac;#Volume of solids in emulsion to that of the bubble from Eqn.(6.35)\n", + "Kbc=4.5*(umf/db)+5.85*((D**0.5*g**0.25)/db**(5.0/4));#Gas interchange coefficient between bubble and cloud from Eqn.(10.27)\n", + "Kce=6.77*((D*ephsilonmf*0.711*(g*db)**0.5)/db**3)**0.5;#Gas interchange coefficient between emulsion and cloud from Eqn.(10.34)\n", + "import math\n", + "#Bed height versus catalyst activity in reactor\n", + "a1bar=0.07;#Guess value for average activity in reactor\n", + "x=Kr*a1bar;#Value of Kra1 to be used in the following equation\n", + "Kf=(gammab*x+1/((1/Kbc)+(1/(gammac*x+1/((1/Kce)+(1/(gammae*x)))))))*(delta/(1-ephsilonf));#Effective rate constant from Eqn.(12.14)\n", + "tou=-math.log(1-XA)/Kf;#Space time from Eqn.(12.16)\n", + "Lm=tou*uo/(1-ephsilonm);#Length of fixed bed for guess value of a1bar\n", + "a1bar1=[0.0233,0.0465,0.0698,0.0930,0.116,0.140];#Various activity values to find Lm\n", + "x1 = [0,0,0,0,0,0]\n", + "Kf1 = [0,0,0,0,0,0]\n", + "tou1 = [0,0,0,0,0,0]\n", + "Lm1 = [0,0,0,0,0,0]\n", + "\n", + "n=len(a1bar1);\n", + "i=0;\n", + "while i=3000:\n", + " Cd=0.60;\n", + "elif Ret>=2000:\n", + " Cd=0.61;\n", + "elif Ret>=1000:\n", + " Cd=0.64;\n", + "elif Ret>=500:\n", + " Cd=0.68;\n", + "elif Ret>=300:\n", + " Cd=0.70;\n", + "elif Ret>=100:\n", + " Cd=0.68;\n", + "\n", + "#Computation of gas velocity through orifice\n", + "uor=Cd*((2*deltapd)/rhog)**0.5; #Calculation of gas velocity through orifice by using Eqn.(12)\n", + "f=(uo/uor)*100; #Calculation of fraction of open area in the perforated plate \n", + "\n", + "\n", + "#Computation of number of orifices per unit area of distributor\n", + "dor=[0.001,0.002,0.004]; #Different orifice diameters in m\n", + "n=len(dor);\n", + "i=0;\n", + "Nor = [0.,0.,0.]\n", + "while iuf:\n", + " Dshc.append((3/16.0)*(delta[k]/(1-delta[k]))*((alpha**2*db[j]*ubr[k]*((((ubr[k]+2*uf)/(ubr[k]-uf))**(1.0/3))-1))));\n", + " #Horizontal Distribution coeff. from Eqn.(14)\n", + " else:\n", + " Dsh.append((3.0/16)*(delta/(1-delta))*(alpha**2*umf*db/ephsilonmf))\n", + " #Horizontal Distribution coeff. from Eqn.(15)\n", + " Dshc.append((3/16.0)*(delta[k]/(1-delta[k]))*((alpha**2*db[j]*ubr[k]*((((ubr[k]+2*uf)/(ubr[k]-uf))**(1/3.0))-1))));#Horizontal Distribution coeff. from Eqn.(14)\n", + " k=k+1;\n", + "i=0;\n", + "j=0;\n", + "k=0;\n", + "while k>uf=%fm/s we use Eqn.(14).'%(ub[k],uf)\n", + " print 'Gas Velocity(m/s)'\n", + " print '\\tHorizontal Drift Coefficient Calculated(m**2/s)'\n", + " print '\\tHorizontal Drift Coefficient from Experiment(m**2/s)'\n", + " while j>uf=0.404762m/s we use Eqn.(14).\n", + "Gas Velocity(m/s)\n", + "\tHorizontal Drift Coefficient Calculated(m**2/s)\n", + "\tHorizontal Drift Coefficient from Experiment(m**2/s)\n", + "db=0.100000m\n", + "0.370000 \t\t0.001283 \t\t\t\t\t0.001200\n", + "0.470000 \t\t0.001283 \t\t\t\t\t0.001800\n", + "0.570000 \t\t0.001924 \t\t\t\t\t0.002100\n", + "0.670000 \t\t0.001924 \t\t\t\t\t0.002500\n", + "db=0.140000m\n", + "0.370000 \t\t0.002566 \t\t\t\t\t0.001200\n", + "0.470000 \t\t0.002566 \t\t\t\t\t0.001800\n", + "0.570000 \t\t0.003207 \t\t\t\t\t0.002100\n", + "0.670000 \t\t0.003207 \t\t\t\t\t0.002500\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3, Page 232\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable declaration\n", + "Gsup=1.5; #Solid interchange rate in kg/m**2plate s\n", + "dor=19.1; #Orifice diameter in mm\n", + "dp=210; #Particle size in micrometer\n", + "uo=0.4; #Superficial gas velocity in m/s\n", + "fopen=[0.12,0.17,0.26]; #Open area fraction \n", + "pi=3.14;\n", + "\n", + "#CALCULATION\n", + "n=len(fopen);\n", + "uor = []\n", + "ls1 = []\n", + "i=0\n", + "while i" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.3 Page no.49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Given \n", + "T=10 #degree C, Temprature\n", + "dmax=40 #m, maximum diameter\n", + "p=598 #mm Hg, pressure\n", + "\n", + "#Calculate\n", + "#pressure in lake at any depth h is given by p=gamma*h + local barometric pressure 'pbar'\n", + "#pbar/(gamma Hg)=598 mm= .598 m (gamma Hg) = 133kN/m**3\n", + "pbar=0.598*133 #kN/m**2\n", + "#(gamma water)=9.804 kN/m**3 at 10 dergree C\n", + "p=(9.804*40)+pbar #kN/m**2\n", + "\n", + "#Result\n", + "\n", + "print \"The absolute pressure at a depth of 40 m in the lake=\",round(p,0),\"kPa(psi)\"\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The absolute pressure at a depth of 40 m in the lake= 472.0 kPa(psi)\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.4 Page no.52" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "sg1=0.90 #specific gravity of oil\n", + "sg2=13.6 #specific gravity of Hg\n", + "#height of column at different section\n", + "h1=36.0 #inches, \n", + "h2=6.0 #inches\n", + "h3=9.0 #inches\n", + "\n", + "#Calculation\n", + "#pressure equation: airp+h1*sg1*(gamma water)+h2*sg1*(gamma water)-h3*sg2*(gamma water)=0\n", + "airp=-(sg1*62.4*((h1/12)+(h2/12)))+(sg2*62.4*(h3/12)) #lb/ft**2\n", + "#gage pressure = airp\n", + "pgage=airp/144\n", + "\n", + "#Result\n", + "\n", + "print \"Gage pressure=\",pgage,\"psi\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Gage pressure= 3.055 psi\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.5 Page no.53" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "gamma1=9.8 #kN/m**3, specific wt of gage \n", + "gamma2=15.6 #kN/m**3\n", + "h1=1 #m, height\n", + "h2=0.5 #m\n", + "#pA-(gamma1)*h1-h2*(gamma2)+(gamma1)*(h1+h2)=pB\n", + "#pA-pB=diffp\n", + "diffp=((gamma1)*h1+h2*(gamma2)-(gamma1)*(h1+h2))\n", + "\n", + "#Result\n", + "print \"The difference in pressures at A and B =\",diffp,\"kpa\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The difference in pressures at A and B = 2.9 kpa\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.6 Page no.61" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "dia=4 #m, diameter\n", + "sw=9.8 #kN/m**3 specific weight of water\n", + "hc=10 #m, height\n", + "ang=60 #degrees, amgle\n", + "\n", + "#Calculation\n", + "import math\n", + "A=math.pi*(dia**2)/4\n", + "fres=sw*hc*A\n", + "#for the coordinate system shown xc=xres=0\n", + "Ixc=math.pi*((dia/2)**4)/4\n", + "yc=hc/(math.sin (ang*math.pi/180))\n", + "yres= (Ixc/(yc*A))+yc\n", + "ydist=yres-yc\n", + "\n", + "#Result\n", + "print \"The resultant force acting on the gate of the reservoir =\",round(fres*10**-3,2,),\"kN\"\n", + "print \"The resultant force acts through a point along the diameter of the gate at a distance of \",round(ydist,2),\"m\"\n", + "y=[2,5,10,30]\n", + "hc=[0.44,0.18,0.0886,0.04]\n", + "a1=plot(y,hc)\n", + "xlabel(\"(hc) m\") \n", + "ylabel(\"(Yr-Ym) m\") \n", + "show(a1)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The resultant force acting on the gate of the reservoir = 1.23 kN\n", + "The resultant force acts through a point along the diameter of the gate at a distance of 0.09 m\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYoAAAEMCAYAAADal/HVAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XtwVHWa//F3A+EixEAIlwiYBMiQBCWJkAQcjG3YSlJm\nw21wFWed2sHSxgtRwFnHYSzDuFOrTLkbJuNqcMXFAafYWQaJM+7E4NhpQXIBsvKTi5RAdESiAYaA\nRDAJ5/dHm5aYdCeddOd0dz6vKsq+nO/hOXWsfjjf53ueYzEMw0BERMSNAWYHICIigU2JQkREPFKi\nEBERj5QoRETEIyUKERHxSIlCREQ88muicDgcJCYmEh8fT3FxsdvtampqGDRoENu2bXN9Fhsby4wZ\nM0hNTSU9Pd2fYYqIiAeD/LnzRx55hJKSEmJiYsjJyWHp0qVERUW126a1tZXHH3+c3Nzcdp9bLBbs\ndjuRkZH+DFFERLrgtyuKxsZGADIzM4mJiSE7O5uqqqoO2xUXF7NkyRLGjBnT4TvdCygiYj6/JYqa\nmhoSEhJc75OSkqisrGy3zcmTJ9mxYwcPPPAA4LyKaGOxWMjKymLhwoWUlpb6K0wREemCX6eeuvLo\no4/yzDPPYLFYMAyj3RXE7t27iY6O5vDhw+Tn55Oens748ePbjb86sYiISPd5NWNj+Mm5c+eMlJQU\n1/uHH37Y+OMf/9hum7i4OCM2NtaIjY01RowYYYwdO9bYsWNHh32tXLnS2LBhQ4fP/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++GTLn78CBA0ZqaqoxY8YMIzs729i0aZNhGN4vj7UYRohNNoqIiE8F3dSTiIj0\nLSUKERHxSIlCREQ8UqIQERGPlChE3GhtbWXu3LkYhoHdbic/P7/bY6urq3nooYf8GJ1I31GiEHGj\ntLQUq9Xao6copqens2/fvqBu/SDSRolCxI2XXnqJu+++2/X+q6++4q677iIpKYk1a9a4Pj906BD3\n338/ycnJZGRkcPHiRQDy8/P53e9+12G///Vf/8Wdd95JdnY2kydPZtOmTbzwwgvMmDGDpUuXKrlI\nwFGiEHHjwIEDTJs2zfXe4XCwdu1aamtrKS0t5dNPPwXgwQcfZP78+bz//vu8/fbbDB06FHC2YNm/\nf3+n+3Y4HGzevJl33nmHBx54gLNnz3LgwAGGDRvGW2+95f+DE/GCEoVIJ86fP8/AgQMZOHCg67P0\n9HSmTZvGkCFDuPnmm9m9ezf19fV88cUX/P3f/z0AI0aMcI2ZPHkyH374Yaf7/7u/+zvGjh1LTEwM\no0aNYunSpQDMmTOHPXv2+PnoRLyjRCHSCYvF0qHD5tXPnBg8eDCXL1/udLs2hmF0Wt+wWCyu58K3\n7avtfdt+RQKJEoVIJ8LDw2ltbaWlpcXjduPGjWPs2LGuDr8XLlygtbUVgOPHj/O9732vwxhPXXPU\nUUcCkRKFiBszZsxwTR1ZLBa3q59efPFFduzYwY033khOTo7riuDw4cPcdNNNHbb/7r6++7onq6xE\n/ElNAUXc2L59O3v37uWXv/xlj8bPnj2b8vJywsPDfRyZSN/SFYWIGwsWLMBut/doOqi6uppZs2Yp\nSUhI0BWFiIh4pCsKERHxSIlCREQ8UqIQERGPlChERMQjJQoREfFIiUJERDz6/3mzRdiLDrGcAAAA\nAElFTkSuQmCC\n" + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.7 Page no.62" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "sw=64 #lb/ft**3 specific weight of water\n", + "h=10 #ft, depth\n", + "a=3 #ft, distance from horizontal axis\n", + "b=3 #ft distance from vertical axis\n", + "\n", + "#Calculation\n", + "#shape is triangular, hence hc=h-(a/3)\n", + "hc=h-(a/3)\n", + "A=(0.5*a*b) #ft**3 area of the right angled triangle\n", + "fres=sw*hc*A #lb\n", + "Ixc=b*(a**3)/36\n", + "Ixyc=b*(a**2)*(b)/72\n", + "#according to the coordinate system taken yc=hc and xc=0\n", + "yres=(Ixc/(hc*A))+hc\n", + "xres=(Ixyc/(hc*A))\n", + "ydist=yres-hc\n", + "\n", + "#Result\n", + "print \"The resultant force on the area shown is=\",round(fres,3),\"lb\"\n", + "print \"yR=\",round(yres,1),\"ft\"\n", + "print \"xR=\",round(xres,3),\"ft\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The resultant force on the area shown is= 2592.0 lb\n", + "yR= 9.0 ft\n", + "xR= 0.025 ft\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.8 Page no.66" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "sg=0.9 # specific gravity of oil\n", + "a=0.6 #m, length of square\n", + "pgage=50 #kPa, gage pressure\n", + "h1=2 #m; height 1\n", + "h2=2.6 #m height 2\n", + "\n", + "#the force on the trapezoid is the sum of the force on the rectangle f1 and force on triangle f2\n", + "f1=((pgage*1000)+(sg*1000*9.81*h1))*(a**2) #N\n", + "f2=sg*1000*9.81*(h2-h1)*(a**2)/2 #N\n", + "fres=f1+f2 #N\n", + "#to find vertical location of fres fres*yres=(f1*(a/2))+(f2*(h1-h2))\n", + "yres=((f1*(a/2))+(f2*(a/3)))/fres #m\n", + "\n", + "#Result\n", + "print \"The resultant force on the plate is=\",round((fres/1000),3),\"kN\"\n", + "print \"The force acts at a distance of \",round(yres,3), \"m \" \"\\n above the bottom plate alond the vertical line of symmetry\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The resultant force on the plate is= 25.31 kN\n", + "The force acts at a distance of 0.296 m \n", + " above the bottom plate alond the vertical line of symmetry\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.9 Page no.68" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Given\n", + "dia=6.0 #ft, diameter\n", + "l=1 #ft, length\n", + "#horizontal force f1=sw*hc*A\n", + "hc=dia/4 #ft\n", + "sw=62.4 #lb/ft**3, specific wt\n", + "A=(dia/2.0)*l #ft**2, area\n", + "f1=sw*hc*A #lb\n", + "\n", + "#Calculation\n", + "#this force f1 acts at a height of radius/3 ft above the bottom\n", + "ht=(dia/2)/3 #ft\n", + "#weight w = sw*volume\n", + "import math\n", + "w=sw*((dia/2)**2)*math.pi/4*l #lb\n", + "#this force acts through centre of gravity which is 4*radius/(3*%pi) right of the centre of conduit\n", + "dist=(4*dia/2)/(3*math.pi) #ft\n", + "#horizontal force that tank exerts on fluid = f1\n", + "#vertical force that tank exerts on fluid = w\n", + "#resultant force fres =((f1)**2+(w)**2)**0.5\n", + "fres =((f1)**2+(w)**2)**0.5 #lb\n", + "\n", + "#Result\n", + "print \"The resultant force exerted by the tank on the fluid=\",round(fres,1),\"lb\"\n", + "print \"The force acts at a distance of\",round(dist,3),\"ft\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The resultant force exerted by the tank on the fluid= 522.9 lb\n", + "The force acts at a distance of 1.273 ft\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.10 Page no.71" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "dia=1.5 #m\n", + "wt=8.5 #kN\n", + "#tension in cable T=bouyant force(Fb)-wt\n", + "#fluid is water\n", + "import math\n", + "sw=10.1 #kN/m**3\n", + "\n", + "#Calculaton\n", + "vol=math.pi*dia**3/6 #m**3\n", + "Fb=sw*vol #kN\n", + "T=Fb-wt #kN\n", + "\n", + "#Result\n", + "print \"The tension in the cable =\",round(T,2),\"kN\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The tension in the cable = 9.35 kN\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.11 Page no.75" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "sg=0.65 #specific gravity of fuel\n", + "l1=0.75 #ft, horizontal distance\n", + "l2=0.5 #ft verticle distance\n", + "#0.5 ft =z1(max)\n", + "#0.5=0.75*(ay(max)/g)\n", + "aymax=(0.5*32.2)/0.75 #ft/s**2\n", + "\n", + "#Result\n", + "print \"The max acceleration that can occur before the fuel level drops \\n below the transducer=\",round(aymax,1),\"ft/s**2\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The max acceleration that can occur before the fuel level drops \n", + " below the transducer= 21.5 ft/s**2\n" + ] + } + ], + "prompt_number": 10 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fundamentals_of_Fluid_Mechanics/.ipynb_checkpoints/Ch_4-checkpoint.ipynb b/Fundamentals_of_Fluid_Mechanics/.ipynb_checkpoints/Ch_4-checkpoint.ipynb new file mode 100644 index 00000000..0f2922c6 --- /dev/null +++ b/Fundamentals_of_Fluid_Mechanics/.ipynb_checkpoints/Ch_4-checkpoint.ipynb @@ -0,0 +1,57 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:05d71697cf7aa87db46aad4ab8742d4e783bd3d0a3dd26958cddc18debaf818a" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 4:fluid kinematics" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.6 Page no.165" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "pratet=-8 #dollars/hr\n", + "pratex=0.2 #dollars/mi\n", + "\n", + "u=(-pratet)/pratex\n", + "\n", + "#Result\n", + "print \"The delivery speed=\",round(u,1),\"mi/hr\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The delivery speed= 40.0 mi/hr\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fundamentals_of_Fluid_Mechanics/.ipynb_checkpoints/Ch_5-checkpoint.ipynb b/Fundamentals_of_Fluid_Mechanics/.ipynb_checkpoints/Ch_5-checkpoint.ipynb new file mode 100644 index 00000000..2f61f756 --- /dev/null +++ b/Fundamentals_of_Fluid_Mechanics/.ipynb_checkpoints/Ch_5-checkpoint.ipynb @@ -0,0 +1,1119 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:c7c5940af2f0332e0055a73277f3e96c5338031f3b285c9ca2e11f04c995d4f4" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 5:Fluid control volume analysis" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.1 Page no.195" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "v2=20.0 #m/s, nozzle velocity\n", + "dia2= 40.0 #mm, nozzle diameter\n", + "\n", + "#m1=m2\n", + "#d1*Q1=D2*Q2 where d1=d2 is density of seawater\n", + "#hence Q1=Q2\n", + "#calculation\n", + "import math\n", + "Q=v2*(math.pi*((dia2/1000)**2)/4) #m**3/sec\n", + "\n", + "#result\n", + "print \"Flowrate=\",round(Q,3),\"m**3/s\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Flowrate= 0.025 m**3/s\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.2 Page no.196" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "v2=1000 #ft/sec, velocity\n", + "p1=100 #psia pressure inlet\n", + "p2=18.4 #psia pressure outlet\n", + "T1=540 #degree R, Temprature inlet\n", + "T2=453 #degree R Temprature outlet\n", + "dia=4 #inches, inside dia of pipe\n", + "#m1=m2\n", + "#d1*A1*v1=d2*A2*v2\n", + "#A1=A2 and d=p/(R*T) since air at pressures and temperatures involved behaves as an ideal gas\n", + "\n", + "#calculation\n", + "v1=p2*T1*v2/(p1*T2)\n", + "\n", + "#result\n", + "print \"Velocity at section 1 =\",round(v1,1),\"ft/s\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Velocity at section 1 = 219.3 ft/s\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example5.3Page no.197" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "m1=22 #slugs/hr\n", + "m3=0.5 #slugs/hr\n", + "#-m1+m2+m3=0\n", + "m2=m1-m3\n", + "\n", + "#result\n", + "print \"Mass flowrate of the dry air and water \\n vapour leaving the dehumidifier=\",m2,\"slugs/hr\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass flowrate of the dry air and water \n", + " vapour leaving the dehumidifier= 21.5 slugs/hr\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.5 Page no.198" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "%pylab inline" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\n", + "For more information, type 'help(pylab)'.\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Q=9.0 #gal/min, Q=m/d ,flow rate\n", + "l=5.0 #ft, length\n", + "b=2.0 #ft breadth\n", + "H=1.5 #ft, height\n", + "#continuity equation to water: integral of m= d*((h*b*l)+(H-h)*A) where A is cross-sectional area of faucet\n", + "#m=d*(b*l-A)*dh/dt, where dh/dt= hrate\n", + "#m=d*Q\n", + "#since A<" + ] + } + ], + "prompt_number": 44 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.6 Page no.201" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "v=971 #km/hr, aeroplane speed\n", + "v2=1050 #km/hr velocity of exhaust gases\n", + "A1=0.80 #m**2 intake area of jet engine\n", + "d1=0.736 #Kg/m**3 density\n", + "A2=0.558 #m**2 area of engine\n", + "d2=0.515 #Kg/m**3, density\n", + "\n", + "#w1=v=intake velocity\n", + "#mass flow rate of fuel intake = d2*A2*w2 - d1*A1*w1\n", + "w2=v2+v\n", + "m=(d2*A2*w2 - d1*A1*v)*1000 #in book ,calculation mistake\n", + "\n", + "#Result\n", + "print \"The mass flow rate of fuel intake = \",round(m,1),\"kg/h\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The mass flow rate of fuel intake = 9050.0 kg/h\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.7 Page no.202" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Q=1000 #ml/s, flow rate\n", + "A2=30 #mm**2 area\n", + "rotv=600 #rpm, revolutionary speed\n", + "\n", + "#mass in = mass out\n", + "w2=(Q*0.001*1000000)/(2*A2*1000)\n", + "\n", + "#result\n", + "print \"Average speed of water leaving each nozzle \\nwhen sprinkle head is stationary and when it rotates with a constant speed of 600rpm =\",round(w2,1),\"m/s\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Average speed of water leaving each nozzle \n", + "when sprinkle head is stationary and when it rotates with a constant speed of 600rpm = 16.67 m/s\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.8 Page no.203" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Ap=500 #mm**2\n", + "Q2=300 #cm**3/min\n", + "Qleak=0.1*Q2 #cm**3/min\n", + "#A1=Ap\n", + "#mass conservation in control volume\n", + "#-d*A1*V + m2 + d*Qleak =0 m2=d*Q2\n", + "#V=(Q2+Qleak)/Ap\n", + "V=(Q2+Qleak)*1000/Ap\n", + "print \"The speed at which the plunger should be advanced=\",round(V,2),\"mm/min\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The speed at which the plunger should be advanced= 660.0 mm/min\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.9 Page no.204" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Given\n", + "Q=9 #gal/min\n", + "l=5 #ft\n", + "b=2 #ft\n", + "H=1.5 #ft\n", + "#deforming control volume\n", + "#hrate=Q/(l*b-A)\n", + "#A< hp=hL=f*(l/D)*((V**2)/(2*g))\n", + "f=0.0125\n", + "hp=f*(l*5280/D)*((V**2)/(2*32.2)) #ft, in book ,calculation mistake\n", + "Pa=sw*Q*round(hp,2)/550 #hp\n", + "\n", + "#Result\n", + "print \"The horsepower required to drive the system=\",round(Pa,3),\"hp\"\n", + "\n", + "#Plot\n", + "import matplotlib.pyplot as plt\n", + "fig = plt.figure()\n", + "ax = fig.add_subplot(111)\n", + "\n", + "D=[2,3,4,5,6]\n", + "P=[3.2*10**6,0.8*10**6,0.202*10**6,0.15*10**6,0.1*10**6]\n", + "xlabel(\"D ft\") \n", + "ylabel(\"P hP\") \n", + "plt.xlim((0,6))\n", + "plt.ylim((0,4*10**6))\n", + "ax.plot([4], [0.202*10**6], 'o')\n", + "ax.annotate('(4ft,2.02*10**5 hp)', xy=(4,0.25*10**6))\n", + "a=plot(D,P)\n", + "show(a)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The horsepower required to drive the system= 202694.35 hp\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAZwAAAEKCAYAAAAmfuNnAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3X1UVOe9L/DvIERjVUaIgpmhB2FmfAGEUXnJ6U0LEqAm\nV9QAAkmU+tJzRWtMlk1MmpMWs2rUJOY0MWjuTTWCPacYTaO2FYQYidYcMSBpTjWNNI4KA9oIM0iM\nMMD87h+UXXlTVGaGl+9nLdcanr2fZ357N92/efY8+zcqEREQERE5mJurAyAioqGBCYeIiJyCCYeI\niJyCCYeIiJyCCYeIiJyCCYeIiJzCYQmntbUVRqMRc+bMAQDU1dUhLi4OBoMB8fHxsFqtyr4bNmyA\nXq/H5MmTUVhYqLSXlZUhJCQEer0eq1evVtqbmpqQmpoKvV6PqKgoXLhwQdmWk5MDg8EAg8GA3Nxc\npd1kMiEyMhJ6vR5paWlobm521KETEVE3HJZw3njjDUydOhUqlQoAsHHjRsTFxeHs2bOIjY3Fxo0b\nAQBnzpzB7t27cebMGRQUFGDFihVofzQoMzMT27dvR0VFBSoqKlBQUAAA2L59O7y9vVFRUYGnn34a\na9euBdCW1F566SWcPHkSJ0+exLp161BfXw8AWLt2LdasWYOKigqMHTsW27dvd9ShExFRNx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sx4QBt9anCw8Nx5cqVHvssX74c7777LiZNmoS0tDRs3rwZnp6e8PT0xPvvv4+AgABnhE50\nW5hwiFysc8IBgLFjx+Ls2bMYN25cj/0mTpyIsrIyeHl5YfHixZgzZw4effRRR4dLdMf4HQ7RIMHP\njtTfMeEQ9TPnzp3DsGHDbjq76c5gKwtDgw8TDlE/8vXXX2P58uVYtWrVbfUbPXo0rl696qCoiPoG\nv8MhcjF3d3eEhISgubkZ7u7uWLRoEZ5++ulbzlgCAgJQWloKLy8vfPLJJ/jxj3+MESNGYM+ePVw0\nQP0SEw4RETkFb6kREZFTMOEQEZFTMOEQEZFTMOEQEZFTMOEQEZFTMOEQEZFT/H+gfiZjch3qYwAA\nAABJRU5ErkJggg==\n" + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.10 Page no.454" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "D=4.0 #in\n", + "l=20 #ft\n", + "n=4.0 #number of 90 degree elbows\n", + "h=0.2 #in\n", + "T=100 #degree F \n", + "\n", + "#calculation\n", + "import math\n", + "#energy equation between the inside of the dryer and the exit of the vent pipe\n", + "p1=(h/12)*62.4 #lb/(ft**2)\n", + "KLentrance=0.5\n", + "KLelbow=1.5\n", + "sw=0.0709 #lb/(ft**3)\n", + "f=0.022 #assumption\n", + "#hence,\n", + "V=((p1/sw)*2*32.2/(1+(f*l/(D/12))+KLentrance+(n*KLelbow)))**0.5 #ft/sec\n", + "Q=V*(math.pi*((D/12)**2)/4) #(ft**3)/sec\n", + "\n", + "#result\n", + "print \"The flowrate=\",round(Q,2),\"ft**3/s\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The flowrate= 0.9 ft**3/s\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.11 Page no.456" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "D=1.0 #ft\n", + "l=300.0 #ft\n", + "f=0.02 #moody factor\n", + "z1=90.0 #ft\n", + "g=32.2 #ft/s**2, gravitational constant\n", + "sw=62.4 #lb/ft**3, specific heat\n", + "import numpy\n", + "#calculation\n", + "from scipy.optimize import fsolve\n", + "#energy equation between the surface of the lake and the outlet of the pipe\n", + "#p1=V1=p2=z2=0 V2=V\n", + "a=f*l/(D*2*g) #a=hl/V**2\n", + "b=Pa*550/(sw*math.pi*(D**2)/4) #b=ht/V\n", + "#from bernouli eq. f=0.109*V**3-90*V+561\n", + "def f(V1):\n", + " f=0.109*V1**3-90*V1+561\n", + " return(f)\n", + "V1=fsolve(f,10)\n", + "def f1(V2):\n", + " f1=0.109*V2**3-90*V2+561\n", + " return(f)\n", + "V2=fsolve(f,20)\n", + "\n", + "Q1=(math.pi*(D**2)/4)*V1 #(ft**3)/sec\n", + "Q2=(math.pi*(D**2)/4)*V2 #(ft**3)/sec\n", + "print \"The possible flowrates are=\",round(Q1,1),\"ft**3/s\" \"and \",round(Q2,1),\"ft**3/s\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The possible flowrates are= 5.166 ft**3/sand 19.537 ft**3/s\n" + ] + } + ], + "prompt_number": 70 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.12 Page no.457" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "roughness=0.0005 #ft\n", + "Q=2.0 #(ft**3)/sec\n", + "pd=0.5*144 #lb/ft**2 where pd=pressure drop\n", + "l=100 #ft\n", + "d=0.00238 #slugs/(ft**3)\n", + "vis=3.74*(10**(-7)) #lb*sec/(ft**2)\n", + "\n", + "#calculation\n", + "x=Q/(math.pi/4) #where x =V*(D**2)\n", + "#energy equation with z1=z2 and V1=V2\n", + "D=0.404*f**(1/5)\n", + "#Calculation\n", + "y=(l*d*(x**2)*0.5/(pd)) #where y=(D**5)/f\n", + "f=0.027 #using reynolds number, roughness and moody's chart\n", + "D=((l*d*(x**2)*0.5/(pd))*f)**(0.2)\n", + "\n", + "#Result\n", + "print \"The diameter of the pipe should be =\",round(D,3),\"ft\"\n", + "\n", + "#Plot\n", + "q=[0.1,0.5,2,3]\n", + "d=[0.06,0.09,0.196,0.225]\n", + "a=plot(q,d)\n", + "xlabel(\"q ft**3/s\") \n", + "ylabel(\"d (ft)\") \n", + "plt.xlim((0,3))\n", + "plt.ylim((0,0.25))\n", + " \n", + "show(a)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The diameter of the pipe should be = 0.196 ft\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYwAAAEMCAYAAADXiYGSAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3X9cVGW+B/DPKKy/M/WlhgxJt0EZlV/KDxVRalVWWrlK\nudG1si7LZb3rupVlbbv3BtZWbNqN4tYlM1uvrnLrvq50DWdNl0khcRRJSvyB3pABRXHzByIKDM/9\n4ywjIyBnBs7MnJnP+/XyFTPznJnndHQ+nOc5z/dohBACREREPejn6g4QEZE6MDCIiEgWBgYREcnC\nwCAiIlkYGEREJAsDg4iIZFE0MAwGA4KDgxEUFISsrKxOr2/ZsgVhYWEIDQ1FbGwsysvLra8FBgYi\nNDQUERERiI6OVrKbREQkg0apdRgWiwUTJ07E7t274e/vj6ioKGzduhV6vd7aZv/+/Zg0aRKGDx8O\ng8GAjIwMlJSUAADuu+8+lJaWYuTIkUp0j4iI7KTYGYbJZIJOp0NgYCB8fX2RkpKC/Px8mzYzZszA\n8OHDAQAxMTGoqamxeZ1rComI3IdigVFbW4uAgADrY61Wi9ra2m7bb9iwAYmJidbHGo0Gc+fORWRk\nJNavX69UN4mISCYfpd5Yo9HIbltYWIiPP/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=\n" + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.13 Page no.458" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "T=60.0 #degree F\n", + "kvis=1.28*(10**(-5)) #(ft**2)/sec\n", + "l=1700.0 #ft\n", + "roughness=0.0005 #ft\n", + "Q=26.0 #(ft**3)/sec\n", + "n=4.0 #number of flanged 45 degree elbows\n", + "z1=44.0 #ft\n", + "\n", + "#Calculation\n", + "#V=31.1/D*2 #where V=Q/A\n", + "#f=0.0052*D**5-0.00135*D #eleminating V\n", + "\n", + "#calculation\n", + "#assume f=0.052 #(moody chart) hit and trial method\n", + "from scipy.optimize import fsolve\n", + "def f(D):\n", + " f=0.0052*D**5-0.00135*D-0.052\n", + " return(f)\n", + "D=fsolve(f,1)\n", + "\n", + "#result\n", + "print \"Pipe Diameter is \",round(D,1),\"ft\"\n", + "\n", + "#Plot\n", + "l=[300,1000,1700,2000]\n", + "d=[1.2,1.45,1.63,1.72]\n", + "a=plot(l,d)\n", + "xlabel(\"l ft\") \n", + "ylabel(\"d (ft)\") \n", + "plt.xlim((0,2000))\n", + "plt.ylim((0,1.8))\n", + "show(a)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "DPipe Diameter is 1.6 m\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYoAAAEPCAYAAABcA4N7AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHUNJREFUeJzt3X1wVPW9x/HP0qS9IJTyICFkUyNJyIPkqYQgpcFFpCBz\nE1vQmeSOQkNkUm6pItVhRv8w6YwgdGyvmo6DFsXxIWJn1GgNqxN0Y0RIEMJDBTE8pCQRsKsgQbwk\nLOf+sTe7hCQnCezJbsL7NbPj7p5fDt/8Zj2f/M7v/PbYDMMwBABAN4YEuwA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bW9nu9oSQ7O1ujRo3q8F5f+q+mpkbHjx9XS0uLb0S3aNEi389cS7rqS6nz51OiL3tj\n/PjxSk9PlyQNHz5cSUlJam5utvzzGbJB0ZsFe+iazWbTbbfdpszMTD333HOSpJMnT/quKIuIiPCt\ngP/yyy87XLZMP3etr/13+ftRUVH06yWefvpppaWlqbCw0HeahL7sm4aGBtXV1WnatGmWfz5DNihY\nN3Hltm7dqrq6Om3evFl//etfVV1d3WG7zWYz7V/63lxP/Qdzy5Yt09GjR7V7925FRkbqD3/4Q7BL\nGnDOnj2rhQsX6sknn9SIESM6bLPi8xmyQdGbBXvoWmRkpCTp+uuv169//WvV1tYqIiJCJ06ckCQd\nP35c48aNk9T7RY/Xur70n91uV1RUVIevo6Ff/caNG+c7mN17772+U530Ze+0tbVp4cKFuueee/Sr\nX/1KkvWfz5ANiksX7LW2tmrTpk3Kzc0Ndlkh79y5c2ppaZEkfffdd3r//feVkpKi3Nxcvfjii5Kk\nF1980fcBy83N1WuvvabW1lYdPXpU9fX1vvOW8Otr/40fP14//vGPVVNTI8Mw9NJLL/l+5lp3/Phx\n3/M333zTd0UUfdkzwzBUWFio5ORkrVixwve+5Z9Pa+bmA6OiosKYNGmSERsba6xevTrY5QwIR44c\nMdLS0oy0tDTjpptu8vXb119/bcyePduIj4835syZY5w6dcr3M4899pgRGxtrJCQkGE6nM1ilh4y8\nvDwjMjLSCA8PN+x2u/H8889fUf99+umnxuTJk43Y2Fjj97//fTB+laC7vC83bNhg3HPPPUZKSoqR\nmppq3HHHHcaJEyd87elLc9XV1YbNZjPS0tKM9PR0Iz093di8ebPln08W3AEATIXsqScAQGggKAAA\npggKAIApggIAYIqgAACYIigAAKYICqCXhg8f3uX7Tz31lJKTk3X33XervLxcBw4c6OfKAGsRFEAv\ndff9Oc8884wqKyv18ssv680339T+/fv7uTLAWgQFcBV++9vf6siRI5o3b55Wr16td955Rw899JAy\nMjJ05MiRYJcHBAQrs4FeGjFihO97tC514403aufOnRo9erQKCgqUk5OjBQsWBKFCwBqMKIAA428v\nDDYEBRBg3KsCgw1BAQTQiBEjdObMmWCXAQQUQQH0UncjhUvfz8vL05/+9CdNmTKFyWwMGkxmAwBM\nMaIAAJgiKAAApggKAIApggIAYIqgAACYIigAAKYICgCAKYICAGDq/wCLwfuGk/zGOgAAAABJRU5E\nrkJggg==\n", + "text": [ + "" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.14 Page no.462" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "D=1 #ft\n", + "f=0.02\n", + "z1=100 #ft\n", + "z2=20 #ft\n", + "z3=0 #ft\n", + "l1=1000 #ft\n", + "l2=500 #ft\n", + "l3=400 #ft\n", + "\n", + "#Calculation\n", + "from scipy.optimize import fsolve\n", + "import math\n", + "#V1+V2=V3 #from eq of continuity ,because diameter are same\n", + "#V1**2+0.4*V3**2=322 #from energy eq..........(1)\n", + "#0.5*V2**2+0.4*V3**2=64.4 for fluid flowing B to c.........(2)\n", + "# V1**2+0.5*V2**2=258 #...............(3)\n", + "#From b and bernouli eq. f=V**4-460*V**2+3748\n", + "def f(V2):\n", + " f1=V2**4-460*V2**2+3748\n", + " return(f1)\n", + "V2=fsolve(f,2)\n", + "V1=math.sqrt(258-0.5*V2**2) #from eq 3\n", + "A=(math.pi/4*(D**2)) # ft**2, area\n", + "Q1=V1*A\n", + "Q2=V2*A\n", + "Q3=Q1-Q2\n", + "print \"Flow out of A reservoir =\",round(Q1,1), \"(ft**3)/sec\"\n", + "print \"Flow into B reservoir =\",round(Q2,2), \"(ft**3)/sec\"\n", + "print \"Flow into C reservoir =\" ,round(Q3,1),\"(ft**3)/sec\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Flow out of A reservoir = 12.5 (ft**3)/sec\n", + "Flow into B reservoir = 2.26 (ft**3)/sec\n", + "Flow into C reservoir = 10.3 (ft**3)/sec\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.15 Page no.467" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "D=60.0 #mm\n", + "pdiff=4 #kPa\n", + "Q=0.003 #(m**3)/sec\n", + "d=789 #kg/(m**3)\n", + "\n", + "#calculation\n", + "import math\n", + "vis=1.19*(10**(-3)) #N*sec/(m**2)\n", + "Re=d*4*Q/(math.pi*D*vis)\n", + "#assuming B=dia/D=0.577, where dia=diameter of nozzle, and obtaining Cn from Re as 0.972\n", + "Cn=0.972\n", + "B=0.577\n", + "dia=((4*Q/(Cn*math.pi))/((2*pdiff*1000/(d*(1-(B**4))))**0.5))**0.5\n", + "\n", + "#result\n", + "print \"Diameter of the nozzle=\",round(dia*1000,1),\"mm\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Diameter of the nozzle= 34.1 mm\n" + ] + } + ], + "prompt_number": 3 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fundamentals_of_Fluid_Mechanics/.ipynb_checkpoints/Ch_9-checkpoint.ipynb b/Fundamentals_of_Fluid_Mechanics/.ipynb_checkpoints/Ch_9-checkpoint.ipynb new file mode 100644 index 00000000..b77b5418 --- /dev/null +++ b/Fundamentals_of_Fluid_Mechanics/.ipynb_checkpoints/Ch_9-checkpoint.ipynb @@ -0,0 +1,527 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:2c766184265d0fbac418d28bb9bf90901876d6391c17795f3832fa9524c975b3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 9:Flow over immersed bodies" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.1 Page no.487" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "U=25.0 #ft/sec\n", + "p=0 #gage\n", + "b=10.0 #ft\n", + "t=1.24*(10**-3) #where t=stress*(x**0.5)\n", + "a=0.744 #where a=p/(1-((y**2)/4))\n", + "p1=-0.893 #lb/(ft**2)\n", + "from scipy import integrate\n", + "def f(x):\n", + " return(2*t*b/(x**0.5))\n", + "drag1=integrate.quad(f,0.0,4.0)\n", + "print \"The drag when plate is parallel to the upstream flow=\",drag1[0],\"lb\"\n", + "\n", + "def f1(y):\n", + " return((((a*(1-((y**2)/4))))-p1)*b)\n", + "drag2=integrate.quad(f1,-2.0,2.0)\n", + "\n", + "#result\n", + "print \"The drag when plate is perpendicular to the upstream flow=\",drag2[0],\"lb\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The drag when plate is parallel to the upstream flow= 0.0992 lb\n", + "The drag when plate is perpendicular to the upstream flow= 55.56 lb\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.5 Page no.508" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "U=10.0 #ft/sec\n", + "Twater=60.0 #degree F\n", + "Tglycerin=68.0 #degree F\n", + "kviswater=1.21*(10**-5) #(ft**2)/sec\n", + "kvisair=1.57*(10**-4) #(ft**2)/sec\n", + "kvisglycerin=1.28*(10**-2) #(ft**2)/sec\n", + "Re=5*(10**5) #assumption\n", + "\n", + "#calculation\n", + "xcrwater=kviswater*Re/U #ft\n", + "xcrair=kvisair*Re/U #ft\n", + "xcrglycerin=kvisglycerin*Re/U #ft\n", + "btwater=5*(kviswater*xcrwater/U)**0.5 #ft where bt=thickness of boundary layer\n", + "btair=5*(kvisair*xcrair/U)**0.5 #ft\n", + "btglycerin=5*(kvisglycerin*xcrglycerin/U)**0.5 #ft\n", + "\n", + "#result\n", + "print \"a)WATER\"\n", + "print \"location at which boundary layer becomes turbulent=\",round(xcrwater,2),\"ft\"\n", + "print \"Thickness of the boundary layer=\",round(btwater,5),\"ft\"\n", + "print \"b)AIR\"\n", + "print \"location at which boundary layer becomes turbulent=\",round(xcrair,2),\"ft\"\n", + "print \"Thickness of the boundary layer=\",round(btair,3),\"ft\"\n", + "print \"c)GLYCERIN\"\n", + "print \"location at which boundary layer becomes turbulent=\",round(xcrglycerin,2),\"ft\"\n", + "print \"Thickness of the boundary layer=\",round(btglycerin,2),\"ft\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a)WATER\n", + "location at which boundary layer becomes turbulent= 0.61 ft\n", + "Thickness of the boundary layer= 0.00428 ft\n", + "b)AIR\n", + "location at which boundary layer becomes turbulent= 7.85 ft\n", + "Thickness of the boundary layer= 0.056 ft\n", + "c)GLYCERIN\n", + "location at which boundary layer becomes turbulent= 640.0 ft\n", + "Thickness of the boundary layer= 4.53 ft\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.7 Page no.512" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "%pylab inline" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\n", + "For more information, type 'help(pylab)'.\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "T=70.0 #degree F\n", + "U1=0.0 #ft/sec\n", + "U2=30.0 #ft/sec\n", + "l=4.0 #ft\n", + "b=0.5 #ft\n", + "d=1.94\n", + "vis=2.04*(10**(-5))\n", + "x=d*l/vis\n", + "U=10.0 #ft/s U1 < U < U2\n", + "\n", + "#calculation\n", + "import math\n", + "Re=d*l*U/(vis) #Reynold no.\n", + "#but we take Re approximately =3800000\n", + "Re_=3.8*10**6\n", + "Cd=0.455/((math.log10(Re_))**2.58)-(1700.0/Re_)\n", + "D=d*U**2*Cd\n", + "print \"The Drag is \",round(D,3),\"lb\"\n", + "\n", + "#Plot\n", + "import numpy as np\n", + "import matplotlib.pyplot as plt\n", + "fig = plt.figure()\n", + "ax = fig.add_subplot(111)\n", + "\n", + "U=[0,3,8,20,30]\n", + "Df=[0,0.1,0.598,2.4,5]\n", + "xlabel(\"U (ft/s)\") \n", + "ylabel(\"Df (lb)\") \n", + "plt.xlim((0,30))\n", + "plt.ylim((0,5))\n", + "a=plot(U,Df)\n", + "\n", + "U1=[0,1,1.5,3,5,8,15,30]\n", + "Df1=[4,4,3,1.5,1,0.598,0.4,0.3]\n", + "ax.annotate('Entire boundary layer laminar', xy=(0.5, 4), xytext=(3,4.2),\n", + " arrowprops=dict(facecolor='black', shrink=0.001),\n", + " )\n", + "xlabel(\"U (ft/s)\") \n", + "ylabel(\"Df (lb)\") \n", + "plt.xlim((0,30))\n", + "plt.ylim((0,5))\n", + "\n", + "a=plot(U1,Df1,linestyle='--')\n", + "plt.text(20,2.8,'Df')\n", + "plt.text(3,2.5,'Xcf')\n", + "\n", + "show(a)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Drag is 0.597 lb\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAXsAAAEMCAYAAAAlGRZyAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl4Ttfa+PHvk0GCqKnELFSRSCIhEmoKSVR+gkM5paVq\nqFKdqB46nJ7Qnr5FHScOfV9VbVXpYKy5hibUVBpTK2KOpgQhyCySrN8fu3mONAkZnif7Ge7PdeUS\nyd573Tube6/ce+21DEophRBCCJvmoHcAQgghzE+SvRBC2AFJ9kIIYQck2QshhB2QZC+EEHZAkr0Q\nQtgBJ3M34OHhwUMPPYSjoyPOzs4cPHjQ3E0KIYT4E7Mne4PBQExM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RRAKJ/4aNWoYJ7cDrYQTHh4OaJPd3bp1i/DwcP71r39x7Ngx43ZJSUl4eHiY4rSE\nqBCp2Qub9MUXXzBp0iSmTJkCaEMvW7Rocd99unbtaly/FArPEV63bl26du2Kj48P4eHhxMfHs2DB\nAgDS0tIYOHAg2dnZKKWYN2+e8RgHDx7kww8/NPXpCVFmMhGaEPfo3bs3y5cvL1S7/7OcnBy6dev2\nwPnRU1NTCQkJ4dChQ6YOU4gyk2QvxD02b97MTz/9xIwZMyp8rPnz51OnTh1GjBhhgsiEqBhJ9kII\nYQfkAa0QQtgBSfZCCGEHJNkLIYQdkGQvhBB2QJK9EELYAUn2QghhB/4/X5n9xhZ8YLYAAAAASUVO\nRK5CYII=\n" + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.10 Page no.525" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "D=0.1 #mm\n", + "sg=2.3\n", + "vis=1.12*(10**(-3)) #N*s/(m**2)\n", + "#by free body diagram and assuming CD=24/Re\n", + "U=(sg-1)*999*9.81*((D/1000)**2)/(18*vis)\n", + "\n", + "#Result\n", + "print \"The velocity of the particle through still water =\",round(U,3),\"m/s\"\n", + "\n", + "#Plot\n", + "import matplotlib.pyplot as plt\n", + "fig = plt.figure()\n", + "ax = fig.add_subplot(111)\n", + "\n", + "D=[0,0.01,0.02,0.04,0.06,0.1]\n", + "U=[0,0,0.0002,0.001,0.0024,0.00632]\n", + "xlabel(\"D (mm)\") \n", + "ylabel(\"U (m/s)\") \n", + "plt.xlim((0,0.1))\n", + "plt.ylim((0,0.007))\n", + "\n", + "ax.plot([0.1], [0.00632], 'o')\n", + "ax.annotate('(0.1mm,0.00632m/s)', xy=(0.06,0.006))\n", + "a=plot(D,U)\n", + "show(a)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The velocity of the particle through still water = 0.006 m/s\n" +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RowYIcnHUCclJeHj\njz+2+XGJrMXbjYks0KlTp0bZQXl5OWJjY3Hu3Dmz/YYOHYr//d//RWhoKLRaLRYuXIgHH3wQpaWl\nGD9+PCIiIrB8+XJcv34dX375Jfr06YOpU6eaAtlPP/2EVatWISsrC/v27UNcXJzpc4tqa2sxcuRI\nFBcXSzp3otZixkLUBkFBQTAajTh79myzbYxGI44ePYrQ0FDT944cOYLMzEycOHEC69atw+nTp1Fc\nXIwZM2Zg+fLlpnZ6vR579+7Fe++9B7VajXnz5uHYsWMoLS3F4cOHAdz8mO5z587h6tWr0k2UqA0Y\nWIgkcu7cOXTq1KnR92JjY+Hn54eOHTtCoVAgISEBABAZGYmKigoAN4v+jRw50vT9nj17IiIiAjKZ\nDBEREaZ2wM3gcnsdJyJnwMBC1Abff/89OnTogO7du5ttd+eVZm9vb9PXHh4eptceHh6or683/axj\nx453tWmqnRBCkv0bImswsBC10tmzZ/H8889jzpw5Ztt169YNV65ckXQstbW1Ll2lm9yTp6MHQOQK\nfvnlF0RHR6Ourg6enp6YMmUK5s6da7ZPhw4dEBkZiZMnT+Lhhx+GTCZrNru482fNfX3765qaGnTt\n2hU+Pj5tnRaRJHhXGJGE1qxZg9raWsyfP9/mx/7oo49w9erVFgMckb0xsBBJyGAwYMiQIdi5c6fN\n90IGDx6MnJwcl/70T3JPDCxERGRT3LwnIiKbYmAhIiKbYmAhIiKbYmAhIiKbYmAhIiKbYmAhIiKb\n+n+kDMLwirooewAAAABJRU5ErkJggg==\n" + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.11 Page no.528" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "D=1.5 #in\n", + "\n", + "CD=0.5\n", + "dice=1.84 #slugs/(ft**3) density of ice\n", + "dair=2.38*(10**(-3)) #slugs/(ft**3)\n", + "U=(4*dice*32.2*(D/12)/(3*dair*CD))**0.5 #ft/sec\n", + "\n", + "#Result\n", + "print \"The velocity of the updraft needed=\",round(U*3600/5275,1),\"mph\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The velocity of the updraft needed= 62.2 mph\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.12 Page no.531" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Dg=1.69 #in.\n", + "Wg=0.0992 #lb\n", + "Ug=200 #ft/sec\n", + "Dt=1.5 #in.\n", + "Wt=0.00551 #lb\n", + "Ut=60 #ft/sec\n", + "kvis=(1.57*(10**(-4))) #(ft**2)/sec\n", + "\n", + "#Calculation\n", + "import math\n", + "Reg=Ug*Dg/kvis\n", + "Ret=Ut*Dt/kvis\n", + "#the corresponding drag coefficients are calculated as\n", + "CDgs=0.25 #standard golf ball\n", + "CDgsm=0.51 #smooth golf ball\n", + "CDt=0.5 #table tennis ball\n", + "Dgs=0.5*0.00238*(Ug**2)*math.pi*((Dg/12)**2)*CDgs/4 #lb\n", + "Dgsm=0.5*0.00238*(Ug**2)*math.pi*((Dg/12)**2)*CDgsm/4 #lb\n", + "Dt=0.5*0.00238*(Ut**2)*math.pi*((Dt/12)**2)*CDt/4 #lb\n", + "#the corresponding decelerations are a=D/s=g*D/W\n", + "#deceleration relative to g=D/W\n", + "decgs=Dgs/Wg\n", + "decgsm=Dgsm/Wg\n", + "dect=Dt/Wt\n", + "\n", + "#result\n", + "print\"STANDARD GOLF BALL:\"\n", + "print \"The drag coefficient=\",round(Dgs,3),\"lb\"\n", + "print \"The deceleration relative to g=\",round(decgs,2)\n", + "print\"SMOOTH GOLF BALL:\"\n", + "print \"The drag coefficient=\",round(Dgsm,3),\"lb\"\n", + "print\"The deceleration relative to g=\",round(decgsm,2)\n", + "print\"TABLE TENNIS BALL:\"\n", + "print \"The drag coefficient=\",round(Dt,3),\"lb\"\n", + "print \"The deceleration relative to g=\",round(dect,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "STANDARD GOLF BALL:\n", + "The drag coefficient= 0.185 lb\n", + "The deceleration relative to g= 1.87\n", + "SMOOTH GOLF BALL:\n", + "The drag coefficient= 0.378 lb\n", + "The deceleration relative to g= 3.81\n", + "TABLE TENNIS BALL:\n", + "The drag coefficient= 0.026 lb\n", + "The deceleration relative to g= 4.77\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.13 Page no.533" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "U=88 #fps\n", + "Ds=40.0 #ft\n", + "Dc=15.0 #ft\n", + "b=50#ft\n", + "Res=U*Ds/(1.57*(10**(-4)))\n", + "Rec=U*Dc/(1.57*(10**(-4)))\n", + "\n", + "#calculation\n", + "import math\n", + "#from these values of Re drag coefficients are found as\n", + "CDs=0.3\n", + "CDc=0.7\n", + "#by summing moments about the base of the tower\n", + "Drs=0.5*0.00238*(U**2)*math.pi*(Ds**2)*CDs/4 #lb\n", + "Drc=0.5*0.00238*(U**2)*b*Dc*CDc #lb\n", + "M=(Drs*(b+(Ds/2)))+(Drc*(b/2)) #ft*lb\n", + "\n", + "#Result\n", + "print \"The moment needed to prevent the tower from tripping=\",round(M,3),\"lb*ft\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The moment needed to prevent the tower from tripping= 364139.221 lb*ft\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.15 Page no.544" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "U=15 #ft/sec\n", + "b=96 #ft\n", + "c=7.5 #ft\n", + "W=210 #lb\n", + "CD=0.046\n", + "eff=0.8 #power train efficiency\n", + "d=2.38*(10**(-3)) #slugs/(ft**3)\n", + "#W=L\n", + "CL=2*W/(d*(U**2)*b*c)\n", + "D=0.5*d*(U**2)*b*c*CD\n", + "P=D*U/(eff*550) #hp\n", + "\n", + "#Result\n", + "print \"The lift coefficient=\",round(CL,3)\n", + "print \"The power required by the pilot=\",round(P,3),\"hp\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The lift coefficient= 1.089\n", + "The power required by the pilot= 0.302 hp\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.16 Page no.548" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "W=2.45*(10**(-2)) #N\n", + "D=3.8*(10**(-2)) #m\n", + "U=12 #m/s\n", + "\n", + "#calculation\n", + "import math\n", + "#W=L\n", + "d=1.23 #kg/(m**3)\n", + "W=0.5*d*(U**2)*(D**2)*math.pi*CL/4\n", + "CL=2*W/(d*(U**2)*math.pi*(D**2)/4)\n", + "#using this value of CL, omega*D/(2*U)=x is found as \n", + "x=0.9\n", + "omega=2*U*x/D #rad/sec\n", + "angvel=omega*60/(2*math.pi) #rpm where angvel is angular velocity\n", + "\n", + "#Result\n", + "print \"The angular velocity=\",round(angvel,3),\"rpm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The angular velocity= 5428.021 rpm\n" + ] + } + ], + "prompt_number": 12 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fundamentals_of_Fluid_Mechanics/.ipynb_checkpoints/ch_1-checkpoint.ipynb b/Fundamentals_of_Fluid_Mechanics/.ipynb_checkpoints/ch_1-checkpoint.ipynb new file mode 100644 index 00000000..7ceb7896 --- /dev/null +++ b/Fundamentals_of_Fluid_Mechanics/.ipynb_checkpoints/ch_1-checkpoint.ipynb @@ -0,0 +1,417 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:3309ad2ee40727e875382d56c1e718ac3ce9fa3af9889cece7627a293ed3a4ad" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 1:Introduction" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.2 Page No9" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Example 1.2\n", + "#Given\n", + "m=36 #kg, mass\n", + "acc=7.0 #ft/sq sec acceleration\n", + "W=m*9.81\n", + "\n", + "#F=W+m*acc\n", + "#1 ft= 0.3048 m\n", + "F=W+(m*acc*0.3048)\n", + "\n", + "#Result\n", + "print \"Required Force is=\",round(F,1),\"N (downward on floor)\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Required Force is= 430.0 N (downward on floor)\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.3 Page No12" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "%pylab inline" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\n", + "For more information, type 'help(pylab)'.\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Example 1.3\n", + "#Given\n", + "V=0.84 #ft**3, air volume\n", + "p=50 #psi, pressure\n", + "T=70 #degree farenheit, temprature\n", + "atmp=14.7 #psi, pressure\n", + "#the air density d=P/(RT)\n", + "#1ft**2=144 inches**2\n", + "\n", + "#calculation\n", + "d=((p+atmp)*144)/((1716)*(T+460))\n", + "print \"density of air\",round(d,3),\"slugs/ft**3\"\n", + "\n", + "#slugs/ft**3\n", + "#weight of air\n", + "W=d*32.2*V\n", + "#1lb=1 slug.ft/sq sec\n", + "\n", + "#result\n", + "print \"Weight =\",round(W,2),\"lb\"\n", + "\n", + "#plot\n", + "import matplotlib.pyplot as plt\n", + "fig = plt.figure()\n", + "ax = fig.add_subplot(111)\n", + "\n", + "p=[-12,50,100]\n", + "f=[0,0.276,0.5]\n", + "xlabel(\"p (psi)\") \n", + "ylabel(\"f (lb)\") \n", + "plt.xlim((-20,100))\n", + "plt.ylim((0,0.5))\n", + "a=plot(p,f)\n", + "ax.plot([50], [0.276], 'o')\n", + "ax.annotate('(50psi,0.276lb)', xy=(50,0.25))\n", + "show(a)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "density of air 0.01 slugs/ft**3\n", + "Weight = 0.28 lb\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYcAAAEMCAYAAAAvaXplAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlYldX6//H3VklPaWmpqeCUoIATs5VpWBmpiVN9I1Mb\nzMzyV3Y6J8/pdE7St0wqz8k0y8ohs5DMjlgqqRk5iwNaZikpJOKU8xDKtH5/PLW/IqIIbB725vO6\nLq7Lvffaz76X5b6513rWWg5jjEFEROQc1ewOQEREKh8lBxERKULJQUREilByEBGRIpQcRESkCCUH\nEREpwqXJISkpCX9/f/z8/IiLiyvyenJyMtdccw3BwcEEBwfz8ssvuzIcEREpoRquunB+fj4jR45k\n6dKleHt7Ex4eTnR0NAEBAYXa3XrrrcyfP99VYYiISCm4rHJISUnB19eXFi1a4OXlRUxMDImJiUXa\naQ2eiEjl47LkkJWVRdOmTZ2PfXx8yMrKKtTG4XCwevVqOnbsSM+ePdm2bZurwhERkcvgsmElh8Nx\nyTYhISFkZmZy5ZVXsmjRIvr27cuOHTtKdS0RESmqtKMzLqscvL29yczMdD7OzMzEx8enUJs6depw\n5ZVXAtCjRw9yc3M5cuTIBa9njPHYnxdffNH2GN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EsAAAAASUVORK5CYII=\n" + } + ], + "prompt_number": 31 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.4 Page No18" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Example 1.4\n", + "#Given\n", + "vis=0.38 #Ns/m**2, viscosity\n", + "sg=0.91 #specific gravity of Newtonian fluid\n", + "dia=25 #mm, diameter\n", + "vel=2.6 #m/s, velocity\n", + "\n", + "#calculating in SI units\n", + "#fluid density d=sg*(density of water @ 277K)\n", + "d=sg*1000 #kg/m**3\n", + "#Reynolds number Re=d*vel*dia/vis\n", + "Re=(d*vel*dia*10**-3)/(vis) #(kgm/sec**2)/N\n", + "print \"Re in SI units=\",round(Re,1)\n", + "\n", + "#calculating in BG units\n", + "d1=d*1.94*10**-3 #slugs/ft**3\n", + "vel1=vel*3.281 #ft/s\n", + "dia1=(dia*10**-3)*3.281 #ft\n", + "vis1=vis*(2.089*10**-2) #lb*s/ft**2\n", + "Re1=(d1*vel1*dia1)/vis1 #(slugs.ft/sec**2)/lb\n", + "\n", + "#result\n", + "print \"Re in Bg units=\",round(Re1,1)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Re in SI units= 155.7\n", + "Re in Bg units= 155.6\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.5 Page No19" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Example 1.5\n", + "#Given\n", + "vis=0.04 #lb*sec/ft**2 , viscosity\n", + "vel=2 #ft/sec, velocity\n", + "h=0.2 #inches, height\n", + "\n", + "#given\n", + "#u=(3*vel/2)*(1-(y/h)**2)\n", + "#shearing stress t=vis*(du/dy)\n", + "#(du/dy)=-(3*vel*y/h)\n", + "#along the bottom of the wall y=-h\n", + "#(du/dy)=(3*vel/h)\n", + "\n", + "#Calculation\n", + "t=vis*(3*vel/(h/12)) #lb/ft**2\n", + "print \"shaering stress t on bottom wall=\",round(t,3),\"lb/ft**2\"\n", + "#along the midplane y=0\n", + "#(du/dy)=0\n", + "t1=0 #lb/ft**2\n", + "\n", + "#result\n", + "print \"shearing stress t on midplane=\",round(t1,3),\"lb/ft**2\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "shaering stress t on bottom wall= 14.4 lb/ft**2\n", + "shearing stress t on midplane= 0.0 lb/ft**2\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.6 Page No 21" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Example 1.6\n", + "#Given\n", + "p1=14.7 #psi(abs), pressure at inlet\n", + "V1=1 #ft**3, velocity at inlet\n", + "V2=0.5 #ft**3, outlet velocityx\n", + "#for isentropic compression, (p1(d1**k))=(p2/(d2**k))\n", + "#volume*density=constant(mass)\n", + "ratd=V1/V2\n", + "\n", + "#Calculation\n", + "p2=((ratd)**1.66)*p1 #psi(abs)\n", + "\n", + "#Result\n", + "print \"final pressure p2=\",round(p2,3),\"psi(abs)\"\n", + "\n", + "#plot\n", + "import matplotlib.pyplot as plt\n", + "fig = plt.figure()\n", + "ax = fig.add_subplot(111)\n", + "\n", + "v=[0.1,0.2,0.5,1]\n", + "p=[900,200,46.5,10]\n", + "xlabel(\"Vf/Vi\") \n", + "ylabel(\"p (psi)\") \n", + "plt.xlim((0,1))\n", + "plt.ylim((0,1000))\n", + "a=plot(v,p)\n", + "\n", + "\n", + "ax.plot([0.5], [46.5], 'o')\n", + "ax.annotate('(0.5,46.5 psi)', xy=(0.5,50))\n", + "\n", + "show(a)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "final pressure p2= 46.454 psi(abs)\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAA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FBcX\nm1myz9Q2Fg1JbWPRpk0bJk6cSN++fWnbti1//OMfaeFti9QAV9tYZGRksHPnTvdYzJkzx+SKfSMz\nM5ONGzfy7bff0rFjR5555hnOnDkDeH/eDIrP4xARkcARNLeqREQkMCg4RETEIwoOERHxiIJDREQ8\nouAQ8cKQIUN4//33L3lt9uzZTJ06lZdeeom+ffvyxBNPAHDw4EGGDh1Kly5dLlsnMG3aNGbNmsXC\nhQt58803/Va/yLXQU1UiXnjttdf4v//7P/Ly8tyv9evXj1mzZnHfffdRUVFB48aNAXjjjTf47rvv\nOHLkCE2bNuUPf/gDAE6nk1tuuYWioiI6duxoynGIeENXHCJeGDt2LKtWreLs2bMA7N+/n6+//poX\nX3yRw4cPk5iYyLvvvgu4+kPdfffdZGZmsmTJEvd7bNq0iU6dOtGxY0dmzJjByy+/bMqxiHhKwSHi\nhdatW5OYmMjq1asBWLx4Menp6eTn5xMREcG2bdsYP348586dY9euXVitVrp160ZYWBilpaXufTIz\nMwH1VJPgouAQ8VJmZiaLFy8GYMmSJe4QuJjD4bik1cX5fc6dO8fy5csZP3683+oVqS8KDhEvjRo1\nig0bNrBt2zZOnjxJfHz8ZdusWbOGESNGuL/OyMjgnXfeYf369fTo0SOkPx9EQpeCQ8RLLVq0YPDg\nwUycOJH777+/xm0++OAD94cmAURFRXHjjTfy5JNPXnEfkUCn4BC5BpmZmXzyySeX3KY6P19x+PBh\nmjVrxnXXXXfZPrt27WLMmDGXvK55DgkWehxXxEcWLVrEgQMHePzxx80uRaReKThERMQjulUlIiIe\nUXCIiIhHFBwiIuIRBYeIiHhEwSEiIh5RcIiIiEf+P2S92/Nie9kJAAAAAElFTkSuQmCC\n" + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.7 Page No 23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Example 1.7\n", + "#Given\n", + "s=550 #(mph), \n", + "h=35000 #ft\n", + "T=-66 #degrees farenheit, temprature\n", + "k=1.40 #W/mK, thermal conductivity\n", + "\n", + "#calculation\n", + "#speed of sound c=(kRT)**0.5\n", + "c=((k*1716*(T+460)))**0.5 #ft/s\n", + "\n", + "#result\n", + "print \"speed of sound c=\",round(c,3),\"ft/s\"\n", + "#speed of sound V=(s m/hour)*(5280 ft/m)/(3600 s/hour)\n", + "V=s*5280/3600 #ft/s\n", + "print(\"ft/s\",V,\"air speed =\")\n", + "ratio=V/c #Mach number\n", + "print \"ratio of V/c = Mach Number=\",round(ratio,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "speed of sound c= 972.906 ft/s\n", + "('ft/s', 806, 'air speed =')\n", + "ratio of V/c = Mach Number= 0.83\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.8 Page No 26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Example 1.8\n", + "\n", + "T=20 #degree celcius, Temprature\n", + "h=1 #mm, height\n", + "\n", + "#calculation\n", + "import math\n", + "\n", + "#h=(2*st*math.cos(x)/(sw*R))\n", + "#where st= nsurface tension, x= angle of contact, sw= specific weight of liquid, R= tube radius\n", + "st= 0.0728 #N/m\n", + "sw=9.789 #kN/m**3\n", + "x=0\n", + "R=(2*st*math.cos(x))/(sw*1000*h/1000) #m\n", + "D=2*R*1000 #mm\n", + "print \"minimum required tube diameter= \",round(D,1),\"mm\"\n", + "\n", + "#Plot\n", + "h=[0.3,0.5,1,2]\n", + "D=[100,50,29.8,18]\n", + "xlabel(\"h (mm)\") \n", + "ylabel(\"D (mm)\") \n", + "plt.xlim((0,2))\n", + "plt.ylim((0,100))\n", + "a=plot(h,D)\n", + "show(a)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "minimum required tube diameter= 29.7 mm\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png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fEBCIaB3/tX65f73/4Ac/0M6dOzt9TWevv9RxLvx+x44duvnmmy9dNBAkbNYH+OiWW27RK6+8\nctFchD84nU6tWrVKgwYN8vt7A77iDgLw0S9/+Uu9+OKLfn/f0tJSpaSkEA6wDe4gAACmuIMAAJgi\nIAAApggIAIApAgIAYIqAAACYIiAAAKb+H6kHdza7C9VRAAAAAElFTkSuQmCC\n" + } + ], + "prompt_number": 7 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fundamentals_of_Fluid_Mechanics/.ipynb_checkpoints/ch_10-checkpoint.ipynb b/Fundamentals_of_Fluid_Mechanics/.ipynb_checkpoints/ch_10-checkpoint.ipynb new file mode 100644 index 00000000..8ed43887 --- /dev/null +++ b/Fundamentals_of_Fluid_Mechanics/.ipynb_checkpoints/ch_10-checkpoint.ipynb @@ -0,0 +1,378 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:9eaab2b896a6bb6c961934db80d46f26a50e6de94b234af0dcf8aaeaefc72384" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 10:Open Channel Flow" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.2 Page no.572" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "%pylab inline" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\n", + "For more information, type 'help(pylab)'.\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Given\n", + "z2=0.5 #ft\n", + "q=5.75 #(ft**2)/sec\n", + "y1=2.3 #ft\n", + "z1=0 #ft\n", + "V1=2.5 #ft/sec\n", + "\n", + "#calculation\n", + "#bernoulli equation\n", + "a=y1+((V1**2)/(2*32.2))+z1-z2 #ft where a=y2+((V**2)/(2*g))\n", + "#continuity equation\n", + "from scipy.optimize import fsolve\n", + "#Calculation\n", + "b=(y1*V1) #(ft**2/sec) where b=(y2*V2)\n", + "#From b and bernouli eq. f=y**3-1.90*y**2+0.513\n", + "def f(y):\n", + " f1=y**3-1.90*y**2+0.513\n", + " return(f1)\n", + "y=fsolve(f,2)\n", + "L=y+z2\n", + "print \"Surface Elevation is \",round(L,2),\"ft\"\n", + "\n", + "#Plot\n", + "E=[3,2,1.51,2.4,3]\n", + "Y=[2.9,1.8,1.01,0.5,0.4]\n", + "a=plot(E,Y)\n", + "xlabel(\"E ft\") \n", + "ylabel(\"Y (ft)\") \n", + "plt.xlim((0,4))\n", + "plt.ylim((0,4))\n", + "show(a)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Surface Elevation is 2.23 ft\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYYAAAEKCAYAAAAW8vJGAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAH8FJREFUeJzt3X9YVHW+B/D3IOzaAKF0Ex8HdnWDDEphsJrbTXPUayyo\nRP54ilJZsY14UrIf2w/v3sIyy9T1seuz+KONIlNKtq6jDRiV448IWXXcxw27YELOgJdifTDoYozM\nuX+cnDjyaxjmzDkzvF/PM4/z4+vx0zedN9/vOd/v0QiCIICIiOgnQUoXQERE6sJgICIiCQYDERFJ\nMBiIiEiCwUBERBIMBiIikpA9GDo7O6HX6zFnzpweP8/Ly0NcXBwSExNhtVrlLoeIiPohezBs2rQJ\nCQkJ0Gg03T4zm804c+YMamtrsW3bNuTm5spdDhER9UPWYLDb7TCbzXjooYfQ0zo6k8mErKwsAIDB\nYEBLSwuamprkLImIiPohazA8/vjjWLduHYKCev5jGhoaEBMT43odHR0Nu90uZ0lERNSPYLkOvG/f\nPowaNQ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vrSHWrpS4fDgXnz5mHhwoU9/uNXS3/2V6da\n+vOKiIgIzJo1C8eOHZO8r5b+vKK3OpXuz4qKCphMJowbNw6ZmZn47LPPsHjxYkkbT/pSNcHgL+se\n3KmzqanJldBVVVUQBKHHuUklqaEv3aGGvhQEAUuXLkVCQgJWrFjRYxs19Kc7daqhP5ubm9HS0gIA\naG9vR3l5OfR6vaSNGvrTnTqV7s81a9bAZrOhrq4OxcXFmD59uqvfrvCkL2VbxzBQ/rLuwZ06S0pK\nUFBQgODgYGi1WhQXF/u8zszMTBw8eBDNzc2IiYnBqlWr4HA4XDWqoS/dqVMNffn5559jx44dmDhx\nouuLYc2aNTh37pyrTjX0pzt1qqE/z58/j6ysLDidTjidTixatAgzZsxQ3b91d+pUQ392dWWKaLB9\nqRGUPqVORESqopqpJCIiUgcGAxERSTAYiIhIgsFAREQSDAaiPgwbNgx6vd71eO211/ps/91338Fg\nMGDSpEk4cuQICgoKfFQpkffwqiSiPoSHh6O1tdXt9sXFxfj000+xfft21NfXY86cOTh16pSMFRJ5\nH4OBqA8DCYaTJ0/innvuQXt7O3Q6HcaPHw+TyYTx48fj7rvvxtq1a2Wulsg7GAxEfQgODsaECRNc\nr1euXIkFCxb02v7tt9/G8ePH8frrr+Obb77B7NmzOWIgv6Oalc9EanTNNdfAarW63V4Q73Hiek7k\nj3jymciL1LhDLdFAMRiIvKjrKGGgJ66J1ILBQNSH9vZ2yeWqK1eu7LO9RqNxjRquu+463HnnnZgw\nYQKeeeYZX5RL5BU8+UxERBIcMRARkQSDgYiIJBgMREQkwWAgIiIJBgMREUkwGIiISOL/Ac1RMOrb\n1MD8AAAAAElFTkSuQmCC\n" + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.3 Page no.579" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Given\n", + "y=5.0 #ft\n", + "angle=40.0 #degree\n", + "l=12.0 #ft\n", + "rate=1.4 #ft per 1000 ft of length\n", + "K=1.49\n", + "\n", + "#Calculation \n", + "import math\n", + "A=(l*y)+(y*y/math.tan(angle*math.pi/180)) #ft\n", + "P=(l+(2*y/math.sin(angle*math.pi/180))) #ft\n", + "Rh=A/P\n", + "S0=rate/10**3\n", + "x=K*(A)*(Rh**(0.666667))*(S0**(0.5)) #where Rh=Q*n\n", + "n=0.012\n", + "Q=x/n #cfs\n", + "\n", + "#Result\n", + "print \"The flowrate=\",round(Q,0),\"cfs\"\n", + "V=Q/A #ft/sec\n", + "Fr=V/(32.2*y)**(0.5)\n", + "print \"Froude number=\",round(Fr,2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The flowrate= 917.0 cfs\n", + "Froude number= 0.8\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.4 Page no.580" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "y=5 #ft\n", + "angle=40 #degree\n", + "l=12 #ft\n", + "rate=1.4 #ft per 1000 ft of length\n", + "Q=10 #m**3/sec\n", + "bw=l*1/3.281 #m where bw=bottom width \n", + "\n", + "#Calculation\n", + "import math\n", + "from scipy.optimize import fsolve\n", + "#A=(l*y)+(y*y/math.tan(angle*math.pi/180)) ft**2\n", + "#A=1.19*y**2+3.66*y area interms of distance depth y, 1.19,3.66 are constant\n", + "#Rh=1.19*y**2+3.66*y/((3.11*y+3.66)**2)\n", + "#P=bw(2*y/math.sin(angle*math.pi/180)) m\n", + "#Rh=A/P\n", + "#Q=10=k*A*Rh**2/3*So**0.5/(n)\n", + "n=0.03 #From table 10.1\n", + "\n", + "def f(y):\n", + " f1=((1.19*y**2+3.66*y)**5-515*(3.11*y+3.66)**2) #digits used are costants which is used in the area equation.\n", + " return(f1)\n", + "y=fsolve(f,2)\n", + "\n", + "#Result\n", + "print \"The depth of the flow=\",round(y,1),\"m\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The depth of the flow= 1.5 m\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.7 Page no.583" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Given\n", + "S0=0.002\n", + "n1=0.02\n", + "z1=0.6 #ft\n", + "n2=0.015\n", + "n3=0.03\n", + "z2=0.8 #ft\n", + "#length of section 1 ,2,3\n", + "l1=3.0 #ft\n", + "l2=2.0 #ft\n", + "l3=3.0 #ft\n", + "#Area\n", + "A1=l1*(z1) #ft**2\n", + "A2=l2*(y) #ft**2\n", + "A3=l3*(z1) #ft**2\n", + "#Pressure head\n", + "P1=l1+z1 #ft\n", + "P2=l2+(2*z2) #ft\n", + "P3=l3+z1 #ft\n", + "Rh1=A1/P1 #ft\n", + "Rh2=A2/P2 #ft\n", + "Rh3=A3/P3 #ft\n", + "y=z1+z2 #ft\n", + "K=1.49\n", + "\n", + "#Calculation\n", + "Q=K*(S0**(0.5))*((A1*(Rh1**(0.667))/n1)+(A3*(Rh3**(0.667))/n3)+(A2*(Rh2**(0.667))/n2)) #(ft**3)/sec\n", + "\n", + "#Result\n", + "print \"The flowrate=\",round(Q,1),\"ft**3/s\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The flowrate= 16.8 ft**3/s\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.8 Page no.584" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "aspratio=2 #asp ratio=aspect ratio=b/y\n", + "\n", + "#result\n", + "print \"The aspect ratio=\",aspratio,\":1\"\n", + "\n", + "#Plot\n", + "b=[0.5,1.2,2,5]\n", + "q=[0.85,0.98,1,0.93]\n", + "a=plot(b,q)\n", + "xlabel(\"b/y \") \n", + "ylabel(\"q/qmax\") \n", + "plt.xlim((0,5))\n", + "plt.ylim((0.80,1.05))\n", + "show(a)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The aspect ratio= 2 :1\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYcAAAEPCAYAAACp/QjLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XtYVXW+x/H3VnA0xVIfI2AzAwIC3mAnwtOFBhu8ZGla\nU6Mnj6lYajodp5lmukyjPuc5zth0Oc7gzKAn9XEayadTic0gJimNlxwcQuuokZcoQEVp8hLeYLvP\nHytBXCIoe7P25fN6Hh7Z7LW2X1a2P/u3fuv3XTaXy+VCRETkEh2sLkBERLyPwkFEREwUDiIiYqJw\nEBERE4WDiIiYKBxERMTEo+EwdepUQkNDGThwYLPbPPnkk8TFxZGUlERpaWnDz6Oiohg0aBAOh4PU\n1FRPlikiIpfxaDhMmTKFgoKCZp/Pz89n//797Nu3jyVLljBz5syG52w2G0VFRZSWllJcXOzJMkVE\n5DIeDYf09HR69OjR7PNr167l0UcfBSAtLY3jx49TXV3d8LzW54mIWMPSOYeqqioiIyMbHtvtdqqq\nqgBj5JCZmUlKSgpLly61qkQRkYAUZHUBzY0OtmzZQnh4OMeOHWPYsGEkJCSQnp7eztWJiAQmS8Mh\nIiKCioqKhseVlZVEREQAEB4eDkDv3r0ZN24cxcXFpnCIjY3lwIED7VewiIgfiImJYf/+/VfdxtLT\nSmPGjGHlypUAbN++nZtuuonQ0FBOnz7NqVOnAKitreW999674hVPBw4cwOVy6cvlYu7cuZbX4C1f\nOhY6FjoWV/9qzYdqj44cJkyYwAcffEBNTQ2RkZHMnz+furo6AKZPn86oUaPIz88nNjaWrl27snz5\ncgCOHDnCAw88AEB9fT2PPPIIw4cP92SpIiJyCY+GQ25ubovbZGdnm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niigqKrqmfTwWDhEREVRUVDQ8rqiowG63N9lm27ZtPP/88wDExMQQHR1NWVkZKSkphIWFAdC7d2/G\njRtHcXFxi+FghexsS/96EZEWXf7Bef78+S3u47HTSikpKezbt4/y8nLOnz/P6tWrGTNmTJNtEhIS\nKCwsBKC6upqysjL69OnD6dOnOXXqFAC1tbW89957DBw40FOliojIZTw2cggKCiI7O5sRI0bgdDrJ\nysoiMTGRnJwcAKZPn85zzz3HlClTSEpK4sKFC7z44ov07NmTgwcP8sADDwBQX1/PI488wvDhwz1V\nqoiIXEaL4EREAozli+BERMQ3KRxERMRE4SAiIiYKBxERMVE4iIiIicJBRERMFA4iImKicBAREROF\ng4iImCgcRETEROEgIiImCgcRETFROIiIiInCQURETBQOIiJionAQEREThYOIiJgoHERExEThICIi\nJgoHERExUTiIiIiJwkFEREwUDiIiYqJwEBERE4WDiIiYKBxERMRE4SAiIiYKBxERMVE4iIiIicJB\nRERMFA4iImKicBAREROFg4iImCgcRETEROEgIiImHg2HgoICEhISiIuLY+HChabna2pqGDlyJMnJ\nyQwYMIAVK1a0el8REfEcj4WD0+lk9uzZFBQUsGfPHnJzc9m7d2+TbbKzs3E4HOzcuZOioiJ++tOf\nUl9f36p9pamioiKrS/AaOhaNdCwa6VhcG4+FQ3FxMbGxsURFRREcHMz48ePJy8trsk1YWBgnT54E\n4OTJk/Tq1YugoKBW7StN6R9+Ix2LRjoWjXQsro3HwqGqqorIyMiGx3a7naqqqibbPPbYY+zevZvw\n8HCSkpJYtGhRq/cVERHP8Vg42Gy2FrdZsGABycnJHDp0iJ07dzJr1ixOnTrlqZJERKSVgjz1whER\nEVRUVDQ8rqiowG63N9lm27ZtPP/88wDExMQQHR1NWVkZdru9xX0v7tOaEAoU8+fPt7oEr6Fj0UjH\nopGOhSEmJqbFbTwWDikpKezbt4/y8nLCw8NZvXo1ubm5TbZJSEigsLCQO+64g+rqasrKyujTpw/d\nu3dvcV+A/fv3e6p8EZGA5rFwCAoKIjs7mxEjRuB0O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Ii4lk+OXIQERHPUjiIiIiJ\nwkFEREwUDiIiYqJwEBERE4WDiIiYKBxErlN5eflVW6W/8cYbLFiwoB0rEnEfhYOIhxQUFHDPPfdY\nXYbIdVE4iLRBfX09EydOpF+/fjz00EOcOXMGMFp57Ny5k6SkJPr27UtNTQ1gdEqNi4vjq6++srJs\nkRYpHETaoKysjFmzZrFnzx66d+/OH/7wBwBKS0tJTk6mQ4cOTJw4kb/85S8AFBYWkpycTK9evaws\nW6RFCgeRNoiMjOS2224DYOLEiWzZsgVoekpp6tSpDc3eli1bxpQpU6wpVuQaKBxE2uDSRm4ul6vh\n8YYNGxoamtntdkJDQ9m4cSM7duzQPIT4BIWDSBt8+eWXbN++HYBVq1aRnp7OiRMnqK+vb3L71mnT\npjFx4kQefvjhgO8MKr5B4SBynWw2G/Hx8SxevJh+/fpx4sQJZsyYwYYNGxg2bFiTbUePHk1tba1O\nKYnPCLI6ivU/AAAAbklEQVS6ABFf9b3vfY+9e/eafr5+/Xoee+yxJj/btWsXycnJ9O3bt73KE2kT\n3c9BxMN+85vf8Kc//YlVq1Zx++23W12OSKsoHERExERzDiIiYqJwEBERE4WDiIiYKBxERMRE4SAi\nIiYKBxERMfl/I7iv/evMN9AAAAAASUVORK5CYII=\n", + "text": [ + "" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.9 Page no.593" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Given\n", + "w=100 #ft\n", + "y1=0.6 #ft\n", + "V1=18 #ft/sec\n", + "Fr1=V1/(32.2*y1)**0.5\n", + "print \"The Froude number before the jump=\",round(Fr1,2)\n", + "yratio=0.5*(-1+(1+(8*(Fr1**2)))**0.5) #where yratio=y2/y1\n", + "y2=y1*yratio #ft\n", + "print \"The depth after the jump=\",round(y2,2),\"ft\"\n", + "#Q1=Q2, hence\n", + "V2=(y1*V1)/y2 #ft/sec\n", + "Fr2=V2/(32.2*y2)**0.5\n", + "print \"The froude number after the jump=\",round(Fr2,2)\n", + "Q=w*y1*V1#(ft**3)/sec\n", + "hL=(y1+(V1*V1/(32.2*2)))-(y2+(V2*V2/(2*32.2))) #ft\n", + "Pd=62.4*hL*Q/550 #hp\n", + "print \"Power dissipated within the jump=\",round(Pd,3),\"hp\"\n", + "\n", + "#Plot\n", + "b=[1.54,1.2,0.8,0.6,0.4]\n", + "P=[0,10,80,277,900]\n", + "a=plot(b,P)\n", + "xlabel(\"b (ft)\") \n", + "ylabel(\"P (hp)\") \n", + "plt.xlim((0,1.6))\n", + "plt.ylim((0,1000))\n", + "show(a)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Froude number before the jump= 4.1\n", + "The depth after the jump= 3.19 ft\n", + "The froude number after the jump= 0.33\n", + "Power dissipated within the jump= 277.539 hp\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAY4AAAEMCAYAAADTfFGvAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3X1UVXWixvHvQbBMxdQS9KCSguLxBTQlLfVihiUFY6UU\nvVGaTdnMlGu6TbeZu9JmraRp1p1xaryrZdawelmo41zhpnLNmdDyDcvURkzJQAGBxpR8LQT2/WPn\nCVTkHODsfc7h+azFGoV9js+22edx//bvt7fDMAwDERERD4XYHUBERAKLikNERLyi4hAREa+oOERE\nxCsqDhER8YqKQ0REvOKz4pg9ezYRERGMHDnS/b1jx46RnJzMkCFDmDZtGjU1Ne6fLVq0iNjYWOLi\n4li/fr37+59++ikjR44kNjaWp556yldxRUTEQz4rjkceeYT8/Pwm38vKyiI5OZkDBw4wdepUsrKy\nACgqKmL58uUUFRWRn5/PvHnzOL+85IknnmDZsmUUFxdTXFx80XuKiIi1fFYckyZNomfPnk2+l5eX\nR2ZmJgCZmZmsXr0agNzcXDIyMggLCyM6Opq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8vFrFmzOHv27EXb5ObmcssttwDwxhtvsHLlSv7zP/+T++67jxdeeIHly5czevRoVq5cicPhYMKE\nCaxfv97qXRHxmopDpBX279/Pk08+SVFREeHh4SxZsuSibTZv3uy+ncijjz5KWloav//973nvvfd4\n8cUXuffee/nss8+YNWsWAImJiWzatMnS/RBpDRWHSCv079+fCRMmAPDAAw/w8ccfX7TNoUOH6Nu3\nb5PvnV9va1zihnf9+vWjtLTUN4FF2pGKQ6QVGt8x1jCMZu8g29DQ0OzrLrWtP9+JVuQ8FYdIKxw+\nfJht27YB5kNwJk2adNE2AwcOpKqqqsn3zp9lhIeHc/LkySY/q6ysZODAgT5KLNJ+VBwiXnI4HAwd\nOpQ///nPuFwuvv32W/fN9hqbOHEin3zyyUWvBZgyZQpFRUXui+NgPkVw8uTJvt8BkTbSTQ5FfOTU\nqVNMmTKFHTt2tLhtQ0MDY8aM4ZNPPrH8cbIi3tIZh4iPdOvWjSlTpvDhhx+2uO3777/PzJkzVRoS\nEHTGISIiXtEZh4iIeEXFISIiXlFxiIiIV1QcIiLiFRWHiIh4RcUhIiJe+X/W0eKMLsKjQwAAAABJ\nRU5ErkJggg==\n" + } + ], + "prompt_number": 3 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fundamentals_of_Fluid_Mechanics/.ipynb_checkpoints/ch_11-checkpoint.ipynb b/Fundamentals_of_Fluid_Mechanics/.ipynb_checkpoints/ch_11-checkpoint.ipynb new file mode 100644 index 00000000..84863f93 --- /dev/null +++ b/Fundamentals_of_Fluid_Mechanics/.ipynb_checkpoints/ch_11-checkpoint.ipynb @@ -0,0 +1,1003 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:f42944f5597b07b987f9572f10e4c9b04463b79fa1fecfbff1f6c9ad9b576c2b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 11:Compressible flow" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.1 page no 617." + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "D=4.0 #in\n", + "T1=540.0 #degree R\n", + "p1=100.0 #psia\n", + "T2=453.0 #degree R\n", + "p2=18.4 #psia\n", + "k=1.4\n", + "R=1716/32.174 #ft*lb/(lbm*(degree R))\n", + "cv=R/(k-1) #ft*lb/(lbm*(degree R))\n", + "udiff=cv*(T2-T1) #ft*lb/lbm change in internal energy\n", + "\n", + "#Result\n", + "print \"a)The change in internal energy between (1) and (2)=\",round(udiff,2),\"ft*lb/lbm\"\n", + "cp=k*round(cv,0) #ft*lb/(lbm*(degree R))\n", + "hdiff=cp*(T2-T1) #ft*lb/lbm change in enthalpy\n", + "print \"b)The change in enthalpy between (1) and (2)=\",round(hdiff,0),\"ft*lb/lbm\"\n", + "ddiff=(1/R)*((p2*144/T2)-(p1*144/T1)) #lbm/(ft**3) change in density\n", + "\n", + "#Result\n", + "print \"The change in density betwenn (1) and (2)=\",round(ddiff,3),\"ft*lb/lbm\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a)The change in internal energy between (1) and (2)= -11600.36 ft*lb/lbm\n", + "b)The change in enthalpl energy between (1) and (2)= -16199.0 ft*lb/lbm\n", + "The change in density betwenn (1) and (2)= -0.39 ft*lb/lbm\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.2 page no.619" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "D=4.0 #in\n", + "T1=540.0 #degree R\n", + "p1=100.0 #psia\n", + "T2=453.0 #degree R\n", + "p2=18.4 #psia\n", + "\n", + "#Calculation\n", + "import math\n", + "dratio=(p1/T1)*(T2/p2)\n", + "sdif=(cv*(math.log(T2/T1)))+(R*(math.log(dratio)))#ft*lb/lbm*(degree R) change in entropy\n", + "\n", + "#Result\n", + "print \"The change in entropy between (1) and (2)=\",round(sdif,1),\"ft*lb/lbm*(degree R)\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The change in entropy between (1) and (2)= 57.49 ft*lb/lbm*(degree R)\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.3 page no.623" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "T=0 #degree C\n", + "R=286.9 #J/(kg*K)\n", + "k=1.401\n", + "c=(R*(T+273.15)*k)**0.5 #m/s\n", + "\n", + "#Result\n", + "print \"The speed of sound for air at 0 degree C =\",round(c,1),\"m/s\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The speed of sound for air at 0 degree C = 331.35 m/s\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.4 page no.628" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "%pylab inline" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\n", + "For more information, type 'help(pylab)'.\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "z=1000 #m\n", + "Ma=1.5\n", + "T=20 #degree C\n", + "#alpha=atan(z/x), x=V*t,and Ma=(1/sin(alpha)) where alpha is the angle of the Mach cone\n", + "#V=Ma*c\n", + "#calculation\n", + "import math\n", + "c=343.3 #m/s found from the value of temperature\n", + "V=Ma*c #m/sec\n", + "t=z/(Ma*c*math.tan(math.asin(1/Ma))) #sec\n", + "print\"The number of seconds to wait after the plane passes over-head before it is heard=\",round(t,2),\"s\"\n", + "\n", + "#Plot\n", + "import matplotlib.pyplot as plt\n", + "fig = plt.figure()\n", + "ax = fig.add_subplot(111)\n", + "\n", + "Ma=[1,1.1,1.3,1.5,2,4]\n", + "t=[0,1.5,2,2.17,2.3,2.75]\n", + "xlabel(\"Ma\") \n", + "ylabel(\"t (s)\") \n", + "plt.xlim((0,4))\n", + "plt.ylim((0,3))\n", + "ax.plot([1.5], [2.17], 'o')\n", + "ax.annotate('(1.5,2.17s)', xy=(1.7,2.1))\n", + "a=plot(Ma,t)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The number of seconds to wait after the plane passes over-head before it is heard= 2.17 s\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYYAAAEKCAYAAAAW8vJGAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XtYlGX+P/D3cCgCFEQNdQYPCSmYzIAWuqCNWvkVEW21\ng5ZypRlf/SnWt6Nd7a5U67X+NjP9WWZbuetWoj/bVVTwp64OCsaSQGUeEktiQGBDQiRBDnP//jBH\nBmaYYeDhecZ5v66LK+aZm2c+1508b+77fg4qIYQAERHRrzzkLoCIiJSFwUBERBYYDEREZIHBQERE\nFhgMRERkgcFAREQWJAuGhoYGxMTEQKfTISIiAitXrrTaLiUlBWFhYdBqtSgsLJSqHCIicpCXVDv2\n8fHBkSNH4Ovri+bmZsTFxSE7OxtxcXHmNhkZGTh//jyKiorw73//G0uWLEFubq5UJRERkQMknUry\n9fUFADQ2NqKlpQVBQUEW76enpyMpKQkAEBMTg5qaGlRWVkpZEhER2SFpMJhMJuh0OgQHB2PSpEmI\niIiweL+srAwhISHm1xqNBqWlpVKWREREdkg2lQQAHh4e+Oqrr3D58mVMnToVBoMBer3eok3bO3Ko\nVKp2+7G2jYiI7HPmrkc9clZSQEAApk+fjhMnTlhsV6vVMBqN5telpaVQq9VW9yGEUPzXH/7wB9l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kPgWAgIAATJ8+\nHSdOnLDYrpT+vMFWnXL35/Hjx5Geno5hw4Zh7ty5OHz4MBYsWGDRxpm+VEwwuMJ1D47UWFlZaU7n\nvLw8CCGszkvKSe5+dJRS+lIIgUWLFiEiIgLPPvus1TZK6FNH6lRCn1ZVVaGmpgYAUF9fj4MHDyIq\nKsqijRL605E65e7P1atXw2g04sKFC0hLS8PkyZPN/XaDM30p2XUMneUK1z04UuPOnTuxadMmeHl5\nwdfXF2lpaT1aIwDMnTsXWVlZqKqqQkhICFJTU9HU1GSuUe5+dLROJfQlAOTk5OCTTz5BZGSk+cCw\nevVqlJSUmGtVQp86UqcS+rS8vBxJSUkwmUwwmUyYP38+pkyZoqjfdUfrVEJ/tnZjiqirfakSci+p\nExGRoihmKomIiJSBwUBERBYYDEREZIHBQEREFhgMRA7w8PDA/Pnzza+bm5vRv39/zJgxQ8aqiKTB\nYCBygJ+fH06dOoWGhgYAwMGDB6HRaBR5xThRVzEYiBwUHx+Pffv2AQC2bduGuXPnWlzc9Jvf/AbR\n0dGIjY3FuXPn5CyVqEsYDEQOeuyxx5CWloZr167h5MmTFjeoCw8Px7Fjx1BQUIDU1FS8+uqrMlZK\n1DWKufKZSOlGjx6N4uJibNu2DdOnT7d4r6amBgsWLMD58+ehUqnMV3ATuSKOGIg6ITExES+88ILF\nNBIA/O53v8OUKVNw8uRJ7Nmzx7wWQeSKOGIg6oSFCxeiT58+GDVqlMUtmGtrazFo0CAA4LPLyeVx\nxEDkgBvxp8WAAAAATklEQVRnH6nVaixbtsy87cb2l156CStXrkR0dDRaWlp4thK5NN5Ej4iILHDE\nQEREFhgMRERkgcFAREQWGAxERGSBwUBERBYYDEREZOH/A5kK4I52RzdaAAAAAElFTkSuQmCC\n" + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.5 page no.635" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "A=1*(10**(-4)) #m**2\n", + "p1=80.0 #kPa(abs)\n", + "p2=40.0 #kPa(abs)\n", + "p0=101.0 #kPa(abs)\n", + "pcritical=0.528*p0 #kPa(abs)\n", + "k=1.4\n", + "#for (a) pth=p1>pcritical\n", + "Math1=((((p0/p1)**((k-1)/k))-1)/((k-1)/2))**(0.5) #Math=Mach number at throat\n", + "#dth/d0=p1/p0 dth=density at throat\n", + "dth1=(1.23)*(1/(1+(((k-1)/2)*(Math1**2))))**(1/(k-1)) #kg/(m**3) density at throat\n", + "Tth1=(288)*(1/(1+(((k-1)/2)*(Math1**2)))) #K temperature at throat\n", + "Vth1=Math1*(286.9*269*k)**(0.5) #m/sec\n", + "m1=dth1*A*Vth1 #kg/sec\n", + "\n", + "#Result\n", + "print \"a) The mass flowrate through the duct=\",round(m1,4),\"kg/s\"\n", + "#for (b) pth=p2" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.12 page no.655" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Given\n", + "T0=288 #K\n", + "p0=101 #kPa(abs)\n", + "l=2 #m\n", + "D=0.1 #m\n", + "f=0.02\n", + "k=1.4\n", + "x=f*l/D\n", + "Tratio=2/(k+1) #where Tratio is Tcritical/T0\n", + "Tcritical=Tratio*T0 #K = T2\n", + "Vcritical=(286.9*Tcritical*k)**0.5 #m/sec = V2\n", + "#from value of x, the following are found\n", + "Ma=0.63\n", + "Trat=1.1 #where Trat=T1/Tcritical\n", + "Vrat=0.66 #where Vrat=V1/Vcritical\n", + "prat=1.7 #where prat=p1/pcritical\n", + "pratio=1.16 #where pratio=p0,1/p0critical\n", + "#from value of Ma, the following are found\n", + "Tfraction=0.93 #whereTfraction=T1/T0\n", + "pfraction=0.76 #where pfraction=p1/p0,1\n", + "dfraction=0.83 #where dfraction=d1/d0,1\n", + "\n", + "#hence,\n", + "#calculation\n", + "import math\n", + "V1=Vrat*Vcritical #m/sec\n", + "d1=dfraction*(1.23) #kg/(m**3)\n", + "m=d1*math.pi*(D**2)*V1/4 #kg/sec\n", + "T1=Tfraction*T0 #K\n", + "p1=pfraction*p0 #kPa(abs)\n", + "T01=T0 #K and T01=T02\n", + "p01=p0 #kPa(abs)\n", + "p2=(1/prat)*(pfraction)*p01 #kpa(abs)\n", + "p02=(1/pratio)*p01 #kPa(abs)\n", + "\n", + "#Result\n", + "print \"Critical temperature=\",round(Tcritical,2),\"K\"\n", + "print \"Critical velocity=\",round(Vcritical,0),\"m/s\"\n", + "print \"Velocity at inlet=\",round(V1,0),\"m/s\"\n", + "print \"Maximum mass flowrate=\",round(m,2),\"Kg/s\"\n", + "print \"Temperature at inlet=\",round(T1,2),\"K\"\n", + "print \"Pressure at inlet=\",round(p1,0),\"kPa(abs)\"\n", + "print \"stagnation temperature at inlet and exit=\",round(T01,2),\"K\"\n", + "print \"The stagnation pressure at inlet=\",round(p01,2),\"kPa(abs)\"\n", + "print \"Pressure at exit=\",round(p2,2),\"kPa(abs)\"\n", + "print \"The stagnation pressure at exit=\",round(p02,2),\"kPa(abs)\"\n", + "\n", + "#Plot\n", + "#import numpy as np\n", + "#import matplotlib.pyplot as plt\n", + "#fig = plt.figure()\n", + "#ax = fig.add_subplot(111)\n", + "\n", + "s=[-5,50]\n", + "T=[288,288]\n", + "s1=[0,0]\n", + "T1=[288,268]\n", + "s2=[40,40]\n", + "T2=[288,240]\n", + "s3=[0,10,20,30,40]\n", + "T3=[268,265,261,252,240]\n", + "s4=[30,50]\n", + "T4=[240,240]\n", + "s5=[-3,50]\n", + "T5=[288,288]\n", + "s6=[-2,8]\n", + "T6=[284,294]\n", + "s7=[35,45]\n", + "T7=[281,295]\n", + "s8=[-2,8]\n", + "T8=[265,275]\n", + "s9=[35,45]\n", + "T9=[235,245]\n", + "\n", + "a=plot(s,T)\n", + "a1=plot(s1,T1)\n", + "a2=plot(s2,T2)\n", + "a3=plot(s3,T3,linestyle='--')\n", + "a4=plot(s4,T4)\n", + "a5=plot(s5,T5)\n", + "a6=plot(s6,T6)\n", + "a7=plot(s7,T7)\n", + "a8=plot(s8,T8)\n", + "a9=plot(s9,T9)\n", + "\n", + "xlabel(\"s-s1 (J/kg K)\") \n", + "ylabel(\"T (K)\") \n", + "plt.xlim((-5, 70))\n", + "plt.ylim((230,300))\n", + "plt.text(50,240,'T2=240K')\n", + "plt.text(50,288,'T0=288K')\n", + "plt.text(15,255,'fanno line')\n", + "plt.text(10,280,'p1=70kpa(abs)')\n", + "plt.text(15,268,'T1=268K')\n", + "plt.text(10,295,'p01=101kpa(abs)')\n", + "plt.text(50,295,'p02=84kpa(abs)')\n", + "plt.text(45,245,'p2=45kpa(abs)')\n", + "\n", + "show(a)\n", + "show(a1)\n", + "show(a2)\n", + "show(a3)\n", + "show(a4)\n", + "show(a5)\n", + "show(a6)\n", + "show(a7)\n", + "show(a8)\n", + "show(a9)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Critical temperature= 240.0 K\n", + "Critical velocity= 310.0 m/s\n", + "Velocity at inlet= 205.0 m/s\n", + "Maximum mass flowrate= 1.64 Kg/s\n", + "Temperature at inlet= 267.84 K\n", + "Pressure at inlet= 77.0 kPa(abs)\n", + "stagnation temperature at inlet and exit= 288.0 K\n", + "The stagnation pressure at inlet= 101.0 kPa(abs)\n", + "Pressure at exit= 45.15 kPa(abs)\n", + "The stagnation pressure at exit= 87.07 kPa(abs)\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYcAAAEMCAYAAAAvaXplAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzs3XlclNX+wPHPoLigaGoKCAYiCA67LC6Jgss1953CME3s\n3jT1es3Mym567aqlZZh5NTP3tcylTFMTcknDBdTExAUUEDVxAdxQOL8/yOcHAirKMAN+368Xr+SZ\n85z5zjTzfDnnPOccnVJKIYQQQuRhZu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0FA6EEELSUDgQQghJ8w92HfCDcvY+zwAAAABJ\nRU5ErkJggg==\n" + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.13 page no.657" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Given\n", + "T0=288 #K Temprature\n", + "p0=101 #kPa(abs) pressure\n", + "l=2 #m length of duct\n", + "D=0.1 #m diameter\n", + "f=0.02\n", + "pd=45 #kPa(abs)\n", + "f=0.02\n", + "k=1.4\n", + "lnew=(50/100)*l #m new length of duct\n", + "x=lnew*f/D\n", + "\n", + "#Calculation\n", + "#from this value of x, following are found\n", + "Ma=0.7\n", + "prat=1.5 #where prat=p1/pcritical\n", + "#from this value of Ma, following are found\n", + "pratio=0.72 #where pratio=p1/p0\n", + "dratio=0.79 #where dratio=d1/d0,1\n", + "Vratio=0.73 #where Vratio=V1/Vcritical\n", + "#hence,\n", + "p2=(1/prat)*pratio*p0 #kPa(abs)\n", + "pcritical=p2 \n", + "#we find that pd>z2 and neglecting kinetic energy of the upstream fluid\n", + "flowrate1=z2*(2*9.81*z1)**0.5\n", + "#result\n", + "print \"The flowrate per unit width=\",round(flowrate,2),\"m**2/s\"\n", + "print \"The flowrate per unit width when we consider z1>>z2=\",round(flowrate1,1),\"m**2/s\"\n", + "\n", + "#Plot\n", + "import matplotlib.pyplot as plt\n", + "fig = plt.figure()\n", + "ax = fig.add_subplot(111)\n", + "\n", + "h=[5,10,15]\n", + "D=[4.61,6.5,8]\n", + "xlabel(\"z1 (m)\") \n", + "ylabel(\"Q/b (m**2/s)\") \n", + "plt.xlim((0,15))\n", + "plt.ylim((0,9))\n", + "\n", + "ax.plot([5], [4.61], 'o')\n", + "ax.annotate('(5 m,4.61 m**2/s)', xy=(5,4.5))\n", + "a=plot(h,D)\n", + "show(a)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The flowrate per unit width= 4.61 m**2/s\n", + "The flowrate per unit width when we consider z1>>z2= 4.8 m**2/s\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAXUAAAEMCAYAAAA70CbBAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3X1czvf+B/DXlZIQp7OQKYpqEuuGyl1cbheW+LVmmbmd\nYTmYsd/j0I5s53Dc2yFl5maGxvY7Z2xRq3EJk0ohiYoyWVhyk27R5/fH5lKnq0t3366ub6/n4+Hx\nuK5v3+v7frfx6vP4fD99PwohhAAREcmCga4bICKi+sNQJyKSEYY6EZGMMNSJiGSEoU5EJCMMdSIi\nGZE01Pft24fBgwfD0dERX3zxhZSliIgIgEKqdeoPHjyAu7s7YmNjYWRkhKFDhyIqKgpt27aVohwR\nEUHCkfrPP/8MV1dXmJmZoXXr1hgyZAhOnz4tVTkiIoKEoT5o0CDExcUhMzMTOTk5OHz4MH7++Wep\nyhEREQBDqS7cqlUrbNy4EQEBAXjw4AF69eqFFi1aVDhHoVBIVZ6ISNaqmjmX9Eapt7c3Dh8+jFOn\nTqGsrAxeXl4aG9OnP8uWLdN5D3LvWd/6Zc/st6F71kbSUL9z5w4AIDo6GsnJyXB1dZWyHBFRkyfZ\n9AsAvPHGG7hz5w5MTU2xc+dOKUsREREkDvWYmBgpL68TSqVS1y3UmL71rG/9Auy5Iehbv4BuepZs\nnXq1iisUL5wfIiKiirRlJx8TQEQkIwx1IiIZYagTEckIQ52ISEYY6kREMsJQJyKSEYY6EZGMMNSJ\niGSEoU5EJCMMdSIiGWGoExHJCEOdiEhGGOpERDLCUCcikhGGOhGRjEga6tu2bUP//v3Ru3dvLFiw\nQMpSREQECUM9Ly8PK1asQFRUFOLj45GWlobIyEipyhERESTczs7ExARCCDx48AAAUFhYCDMzM6nK\nERE1CS/aLU7SUA8JCYG1tTWMjY0xb948uLu7VzovKChI/VqpVOrlPoRERFI6duwYvg7/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//znP/D09MSWLVugUChQUlKCnj17Ij09XZpvkEgLjtRJ\ndmbNmoWkpCTEx8fDysoKH374Ya2uc/XqVVhYWFQ4dubMGYSHh2PHjh3w9fWFra0tkpOTkZ6ejsTE\nRACAsbExTExMcOvWrTp/L0Q1xVAn2Zo3bx6GDRuGMWPG1Orz6enpsLa2Vr9XKBQYO3YsTE1N0a9f\nP5SUlOCtt96CQqGAh4cHTp8+rT63W7duuHLlSl2/BaIak3Q7OyJd2bVrF27cuIEtW7bU+hoKhaLS\nk/WePbuoefPmMDY2hrGxsfp9SUmJ+jwhhF488pjkh6FOsnP27FmsW7cOJ06cqNN17OzskJWVVavP\nXrt2Dfb29nWqT1QbHEqQ7AQHB+PevXsYMmQIXFxc8N577wEAPvroI1hZWaGoqAhWVlb45JNPtF7H\nxsam0rx4+W0B/3uLwGfvS0tLUVhYiA4dOtTHt0NUI1z9QqTF/Pnz8frrr2PEiBHV/syBAweQkpJS\nYYMEoobCkTqRFn/5y1+wY8eOGn1m7969mD17tkQdEWnHkToRkYxwpE5EJCMMdSIiGWGoExHJCEOd\niEhGGOpERDLCUCcikpH/B3UDvsh3l9PbAAAAAElFTkSuQmCC\n" + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.13 Page No.125" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Qrat=3**2.5\n", + "\n", + "#Result\n", + "print(\"The flowrate is proportional to H**2.5\")\n", + "print \"When depth is increased from H0 to 3H0 Q increases \",round(Qrat,1),\"times\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The flowrate is proportional to H**2.5\n", + "When depth is increased from H0 to 3H0 Q increases 15.6 times\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.15 Page No.130" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "h=10 #Km\n", + "#air is in a standard atmosphere\n", + "p1=26.5 #kPa\n", + "T1=-49.9 #degree celcius\n", + "d=0.414 #Kg/m**3\n", + "k=1.4\n", + "Ma1=0.82 #Mach\n", + "#for incompressible flow,\n", + "pdiff=(k*Ma1**2)/2*p1\n", + "#for compressible isentropic flow, \n", + "pdiff1=((1+((k-1)/2)*(Ma1**2))**(k/(k-1))-1)*p1\n", + "\n", + "#result\n", + "print(\"Stagnation pressure on leading edge on the wing of the Boeing:\")\n", + "print \"when flow is imcompressible =\",round(pdiff,1),\"kpa\"\n", + "print \"when flow is compressible and isentropic =\",round(pdiff1,1),\"kpa\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Stagnation pressure on leading edge on the wing of the Boeing:\n", + "when flow is imcompressible = 12.5 kpa\n", + "when flow is compressible and isentropic = 14.7 kpa\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.17 Page No.132" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "V=5 #m/s\n", + "sg=1.03\n", + "h=50 #m\n", + "\n", + "p2=(((sg*1000)*(V**2)/2) + (sg*1000*9.81*h))/1000 #kPa\n", + "print \"The pressure at stagnation point 2 =\",round(p2,1),\"kpa\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The pressure at stagnation point 2 = 518.1 kpa\n" + ] + } + ], + "prompt_number": 11 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_1-checkpoint.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_1-checkpoint.ipynb new file mode 100644 index 00000000..bbd8564c --- /dev/null +++ b/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_1-checkpoint.ipynb @@ -0,0 +1,386 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:bc25f63472470cd0d9d02649f340bc4f8e2133d186eedd53b381a00e86cb80f1" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 1:Introduction" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.1 Page 5" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "L=.15; \t\t \t\t\t#[m] - Thickness of conducting wall\n", + "delT = 1400. - 1150.; \t\t#[K] - Temperature Difference across the Wall\n", + "A=.5*1.2; \t\t\t\t\t#[m^2] - Cross sectional Area of wall = H*W\n", + "k=1.7; \t\t\t\t\t#[W/m.k] - Thermal Conductivity of Wall Material\n", + "#calculations\n", + "#Using Fourier's Law eq 1.2\n", + "Q = k*delT/L; \t\t\t#[W/m^2] - Heat Flux\n", + "\n", + "q = A*Q; \t\t\t#[W] - Rate of Heat Transfer \n", + "#results\n", + "print '%s %.2f %s' %(\"\\n \\n Heat Loss through the Wall =\",q,\" W\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " \n", + " Heat Loss through the Wall = 1700.00 W\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.2 Page 11" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "d=.07; \t\t\t\t\t\t\t\t\t#[m] - Outside Diameter of Pipe\n", + "Ts = 200+273.15; \t\t\t\t\t\t\t#[K] - Surface Temperature of Steam\n", + "Tsurr = 25+273.15; \t\t\t\t\t\t\t#[K] - Temperature outside the pipe\n", + "e=.8; \t\t\t\t\t\t\t\t\t\t# Emissivity of Surface\n", + "h=15; \t\t\t\t\t\t\t\t\t#[W/m^2.k] - Thermal Convectivity from surface to air\n", + "stfncnstt=5.67*math.pow(10,(-8)); \t \t# [W/m^2.K^4] - Stefan Boltzmann Constant \n", + "#calculations\n", + "#Using Eq 1.5 \n", + "E = e*stfncnstt*Ts*Ts*Ts*Ts; \t\t\t#[W/m^2] - Emissive Power\n", + "G = stfncnstt*Tsurr*Tsurr*Tsurr*Tsurr; \t#[W/m^2] - Irradiation falling on surface\n", + "#results\n", + "print '%s %.2f %s' %(\"\\n (a) Surface Emissive Power = \",E,\" W/m^2\");\n", + "print '%s %.2f %s' %(\"\\n Irradiation Falling on Surface =\",G,\" W/m^2\");\n", + "\n", + "#Using Eq 1.10 Total Rate of Heat Transfer Q = Q by convection + Q by radiation\n", + "q = h*(math.pi*d)*(Ts-Tsurr)+e*(math.pi*d)*stfncnstt*(Ts*Ts*Ts*Ts-Tsurr*Tsurr*Tsurr*Tsurr); #[W] \n", + "\n", + "print '%s %.2f %s' %(\"\\n\\n (b) Total Heat Loss per unit Length of Pipe=\",q,\" W\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " (a) Surface Emissive Power = 2273.36 W/m^2\n", + "\n", + " Irradiation Falling on Surface = 448.05 W/m^2\n", + "\n", + "\n", + " (b) Total Heat Loss per unit Length of Pipe= 998.38 W\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.4 Page 20" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "Ts = 56.4+273.15; \t\t\t\t\t#[K] - Surface Temperature of Steam\n", + "Tsurr = 25+273.15; \t\t\t\t\t#[K] - Temperature of Surroundings\n", + "e=.88; \t\t\t\t\t\t\t\t# Emissivity of Surface\n", + "\n", + "#As h=(10.9*math.pow(V,.8)[W/m^2.k] - Thermal Convectivity from surface to air\n", + "stfncnstt=5.67*math.pow(10,(-8)); \t# [W/m^2.K^4] - Stefan Boltzmann Constant \n", + "\n", + "A=2*.05*.05; \t\t\t\t\t# [m^2] Area for Heat transfer i.e. both surfaces\n", + "\n", + "E = 11.25; \t\t\t \t \t\t#[W] Net heat to be removed by cooling air\n", + "#calculations\n", + "\n", + "Qrad = e*stfncnstt*A*(math.pow(Ts,4)-math.pow(Tsurr,4));\n", + "\n", + "#Using Eq 1.10 Total Rate of Heat Transfer Q = Q by convection + Q by radiation\n", + "Qconv = E - Qrad;\t\t\t\t\t#[W] \n", + "\n", + "#As Qconv = h*A*(Ts-Tsurr) & h=10.9 Ws^(.8)/m^(-.8)K.V^(.8)\n", + "\n", + "V = math.pow(Qconv/(10.9*A*(Ts-Tsurr)),(1/0.8));\n", + "#results\n", + "\n", + "print '%s %.2f %s' %(\"\\n\\n Velocity of Cooling Air flowing= \", V,\"m/s\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " EXAMPLE 1.4 Page 20 \n", + "\n", + "\n", + "\n", + " Velocity of Cooling Air flowing= 9.40 m/s\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.6 Page 26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "A=1.8;\t \t\t\t\t\t\t\t\t# [m^2] Area for Heat transfer i.e. both surfaces\n", + "Ti = 35+273.; \t \t\t\t\t\t\t\t#[K] - Inside Surface Temperature of Body\n", + "Tsurr = 297.; \t\t\t\t\t\t\t\t#[K] - Temperature of surrounding\n", + "Tf = 297.; \t\t\t\t\t\t\t\t\t#[K] - Temperature of Fluid Flow\n", + "e=.95; \t\t\t\t\t\t\t\t\t\t# Emissivity of Surface\n", + "L=.003; \t\t\t\t\t\t\t\t\t#[m] - Thickness of Skin\n", + "k=.3; \t\t\t\t\t\t\t\t\t\t# Effective Thermal Conductivity\n", + "h=2; \t\t\t\t\t\t\t\t\t#[W/m^2.k] - Natural Thermal Convectivity from body to air\n", + "stfncnstt=5.67*math.pow(10,(-8)); \t\t\t# [W/m^2.K^4] - Stefan Boltzmann Constant \n", + "#Using Eq 1.5\n", + "\n", + "Tsa=305.; \t\t\t \t\t\t\t #[K] Body Temperature Assumed\n", + "#calculations\n", + "\n", + "Ts=307.19\n", + "q = k*A*(Ti-Ts)/L; #[W] \n", + "\n", + "print '%s' %(\"\\n\\n (I) In presence of Air\")\n", + "print '%s %.2f %s' %(\"\\n (a) Temperature of Skin = \",Ts,\"K\");\n", + "print '%s %.2f %s' %(\"\\n (b) Total Heat Loss = \",q,\" W\");\n", + "\n", + "#When person is in Water\n", + "h = 200; \t\t\t\t\t\t\t\t#[W/m^2.k] - Thermal Convectivity from body to water\n", + "hr = 0; \t\t\t\t\t\t\t\t\t# As Water is Opaque for Thermal Radiation\n", + "Ts = (k*Ti/L + (h+hr)*Tf)/(k/L +(h+hr)); \t#[K] Body Temperature \n", + "q = k*A*(Ti-Ts)/L; \t\t\t\t#[W] \n", + "#results\n", + "\n", + "print '%s' %(\"\\n\\n (II) In presence of Water\")\n", + "print '%s %.2f %s' %(\"\\n (a) Temperature of Skin =\",Ts,\" K\");\n", + "print '%s %.2f %s' %(\"\\n (b) Total Heat Loss =\",q,\" W\");\n", + "\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + " (I) In presence of Air\n", + "\n", + " (a) Temperature of Skin = 307.19 K\n", + "\n", + " (b) Total Heat Loss = 145.80 W\n", + "\n", + "\n", + " (II) In presence of Water\n", + "\n", + " (a) Temperature of Skin = 300.67 K\n", + "\n", + " (b) Total Heat Loss = 1320.00 W\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.7 Page 30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "%pylab inline\n", + "\n", + "import math\n", + "import numpy\n", + "from numpy import roots\n", + "import matplotlib\n", + "from matplotlib import pyplot\n", + "Tsurr = 30+273; #[K] - Temperature of surrounding\n", + "Tf = 20+273; #[K] - Temperature of Fluid Flow\n", + "e=.5; # Emissivity of Surface\n", + "a = .8; # Absorptivity of Surface\n", + "G = 2000; #[W/m^2] - Irradiation falling on surface\n", + "h=15; #[W/m^2.k] - Thermal Convectivity from plate to air\n", + "stfncnstt=5.67*math.pow(10,(-8)); # [W/m^2.K^4] - Stefan Boltzmann Constant \n", + "T=375; #[K] Value initially assumed for trial-error approach\n", + "#Using Eq 1.3a & 1.7 and trial-and error approach of Newton Raphson \n", + "#calculations and results\n", + "while(1>0):\n", + " f=((a*G)-(h*(T-Tf)+e*stfncnstt*(T*T*T*T - Tsurr*Tsurr*Tsurr*Tsurr)));\n", + " fd=(-h*T-4*e*stfncnstt*T*T*T);\n", + " Tn=T-f/fd;\n", + " if(((a*G)-(h*(Tn-Tf)+e*stfncnstt*(Tn*Tn*Tn*Tn - Tsurr*Tsurr*Tsurr*Tsurr)))<.01):\n", + " break;\n", + " T=Tn;\n", + "\n", + "print '%s %.2f %s' %(\"\\n (a) Cure Temperature of Plate =\",T-273.,\"degC\\n\");\n", + "#solution (b)\n", + "Treq=50+273;\n", + "#def T(h):\n", + "# t=375;\n", + "# while(1>0):\n", + "# f=((a*G)-(h*(t-Tf)+e*stfncnstt*(t*t*t*t - Tsurr*Tsurr*Tsurr*Tsurr)));\n", + "# fd=(-h*t-4*e*stfncnstt*t*t*t);\n", + "# Tn=t-f/fd;\n", + "# if((a*G)-(h*(Tn-Tf)+e*stfncnstt*(Tn*Tn*Tn*Tn - Tsurr*Tsurr*Tsurr*Tsurr))<.01):\n", + "# break;\n", + "# tnew=Tn;\n", + "# return tnew;\n", + "\n", + "\n", + "def T(h):\n", + " global rt\n", + " coeff = ([-e*stfncnstt, 0,0, -h, a*G+h*Tf+e*stfncnstt*Tsurr*Tsurr*Tsurr*Tsurr]);\n", + " rot=numpy.roots(coeff);\n", + " rt=rot[3];\n", + " #for i in range (0,3):\n", + " # if 273" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " (b) Air flow must provide a convection of = 51.01 W/m^2.K\n", + "\n", + " The code for the graph requires more than 10 min to run. \n", + "\n", + " To run it, please remove comments. It is perfectly correct. The reason it takes such a long time\n", + "\n", + " is that it needs to calculate using Newton raphson method at 100 points. Each point itself takes a minute.\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_10-checkpoint.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_10-checkpoint.ipynb new file mode 100644 index 00000000..2d8620ac --- /dev/null +++ b/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_10-checkpoint.ipynb @@ -0,0 +1,286 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:392306ee054c145fada33f7a7c31ceab64682cdf974119e5769354570d9acd35" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 10:Boiling and Condensation" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.1 Page 632" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "Ts = 118+273. \t\t\t\t;#[K] Surface Temperature\n", + "Tsat = 100+273. \t\t\t\t;#[K] Saturated Temperature\n", + "D = .3 \t\t\t\t;#[m] Diameter of pan\n", + "g = 9.81 \t\t\t\t;#[m^2/s] gravitaional constant\n", + "#Table A.6 Saturated water Liquid Properties T = 373 K\n", + "rhol = 957.9 \t\t;#[kg/m^3] Density\n", + "cp = 4.217*math.pow(10,3) ;#[J/kg] Specific Heat\n", + "u = 279*math.pow(10,-6) ;#[N.s/m^2] Viscosity\n", + "Pr = 1.76 \t\t;# Prandtl Number\n", + "hfg = 2257*math.pow(10,3) ;#[J/kg] Specific Heat\n", + "si = 58.9*math.pow(10,-3) \t;#[N/m]\n", + "#Table A.6 Saturated water Vapor Properties T = 373 K\n", + "rhov = .5956 \t\t;#[kg/m^3] Density\n", + "\n", + "Te = Ts-Tsat;\n", + "#calculations\n", + "\n", + "#From Table 10.1\n", + "C = .0128;\n", + "n = 1.;\n", + "q = u*hfg*math.pow(g*(rhol-rhov)/si,.5)*math.pow((cp*Te/(C*hfg*math.pow(Pr,n))),3);\n", + "qs = q*math.pi*D*D/4.; \t\t\t#Boiling heat transfer rate\n", + " \n", + "m = qs/hfg; \t\t\t\t\t#Rate of evaporation\n", + "\n", + "qmax = .149*hfg*rhov*math.pow(si*g*(rhol-rhov)/(rhov*rhov),.25); \t#Critical heat flux\n", + "#results\n", + "\n", + "print '%s %.2f %s' %(\"\\n Boiling Heat transfer rate = \",qs/1000. ,\"kW\")\n", + "print '%s %d %s' %(\"\\n Rate of water evaporation due to boiling =\",m*3600 ,\"kg/h\")\n", + "print '%s %.2f %s' %(\"\\n Critical Heat flux corresponding to the burnout point =\",qmax/math.pow(10,6) ,\"MW/m^2\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Boiling Heat transfer rate = 59.13 kW\n", + "\n", + " Rate of water evaporation due to boiling = 94 kg/h\n", + "\n", + " Critical Heat flux corresponding to the burnout point = 1.26 MW/m^2\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.2 Page 635" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "Ts = 255+273. \t\t\t\t\t;#[K] Surface Temperature\n", + "Tsat = 100+273. \t\t\t\t\t;#[K] Saturated Temperature\n", + "D = 6*math.pow(10,-3) \t;#[m] Diameter of pan\n", + "e = 1 \t\t\t\t\t;# emissivity\n", + "stfncnstt=5.67*math.pow(10,(-8)) ;# [W/m^2.K^4] - Stefan Boltzmann Constant \n", + "g = 9.81 \t\t\t\t\t;#[m^2/s] gravitaional constant\n", + "#Table A.6 Saturated water Liquid Properties T = 373 K\n", + "rhol = 957.9 \t\t\t;#[kg/m^3] Density\n", + "hfg = 2257*math.pow(10,3) \t;#[J/kg] Specific Heat\n", + "#Table A.4 Water Vapor Properties T = 450 K\n", + "rhov = .4902 \t\t\t;#[kg/m^3] Density\n", + "cpv = 1.98*math.pow(10,3) ;#[J/kg.K] Specific Heat\n", + "kv = 0.0299 \t\t\t;#[W/m.K] Conductivity\n", + "uv = 15.25*math.pow(10,-6) ;#[N.s/m^2] Viscosity\n", + "#calculations\n", + "\n", + "Te = Ts-Tsat;\n", + "\n", + "hconv = .62*math.pow((kv*kv*kv*rhov*(rhol-rhov)*g*(hfg+.8*cpv*Te)/(uv*D*Te)),.25);\n", + "hrad = e*stfncnstt*(math.pow(Ts,4)-math.pow(Tsat,4))/(Ts-Tsat);\n", + "\n", + "#From eqn 10.9 h^(4/3) = hconv^(4/3) + hrad*h^(1/3)\n", + "#Newton Raphson\n", + "h=250.; \t\t\t\t\t\t#Initial Assumption\n", + "while 1>0 :\n", + "\tf = math.pow(h,(4./3.)) - (math.pow(hconv,(4./3.)) + math.pow(hrad*h,(1./3.)));\n", + "\tfd = (4./3.)*math.pow(h,(1./3.)) - (1./3.)*hrad*math.pow(h,(-2./3.));\n", + "\thn=h-f/fd;\n", + "\tz=math.pow(hn,(4./3.)) - (math.pow(hconv,(4./3.)) + math.pow(hrad*hn,(1./3.)))\n", + "\tif z < .01:\n", + "\t\tbreak;\n", + "\th=hn;\n", + "\n", + "q = h*math.pi*D*Te; \t\t\t\t#power dissipation\n", + "#results\n", + "\n", + "print '%s %d %s' %(\"\\n Power Dissipation per unith length for the cylinder, qs= \",q,\"W/m\");\n", + "print '%s' %(\"The answer is a bit different due to rounding off error\")\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Power Dissipation per unith length for the cylinder, qs= 730 W/m\n", + "The answer is a bit different due to rounding off error\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.3 Page 648" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "Ts = 50+273. \t\t\t;#[K] Surface Temperature\n", + "Tsat = 100+273. \t\t\t;#[K] Saturated Temperature\n", + "D = .08 \t\t\t;#[m] Diameter of pan\n", + "g = 9.81 \t\t\t;#[m^2/s] gravitaional constant\n", + "L = 1 \t\t#[m] Length\n", + "#Table A.6 Saturated Vapor Properties p = 1.0133 bars\n", + "rhov = .596 \t\t;#[kg/m^3] Density\n", + "hfg = 2257*1000. \t;#[J/kg] Specific Heat\n", + "#Table A.6 Saturated water Liquid Properties T = 348 K\n", + "rhol = 975. \t\t;#[kg/m^3] Density\n", + "cpl = 4193. \t; #[J/kg.K] Specific Heat\n", + "kl = 0.668 \t;#[W/m.K] Conductivity\n", + "ul = 375*math.pow(10,-6) ;#[N.s/m^2] Viscosity\n", + "#calculations\n", + "\n", + "\n", + "uvl = ul/rhol \t;#[N.s.m/Kg] Kinematic viscosity\n", + "Ja = cpl*(Tsat-Ts)/hfg;\n", + "hfg2 = hfg*(1+.68*Ja);\n", + "\n", + "#Equation 10.43\n", + "Re = math.pow((3.70*kl*L*(Tsat-Ts)/(ul*hfg2*math.pow((uvl*uvl/g),.33334))+4.8),.82); #Reynolds number\n", + "\n", + "#From equation 10.41\n", + "hL = Re*ul*hfg2/(4*L*(Tsat-Ts)); \t\t#Transfer coefficient\n", + "q = hL*(math.pi*D*L)*(Tsat-Ts); \t\t#Heat transfer rate\n", + "\n", + "m = q/hfg;\t\t\t\t\t\t\t\t#Rate of condensation\n", + "#Using Equation 10.26\n", + "delta = math.pow((4*kl*ul*(Tsat-Ts)*L/(g*rhol*(rhol-rhov)*hfg2)),.25);\n", + "#results\n", + "\n", + "print '%s %.2f %s %.4f %s' %(\"\\n Heat Transfer Rate = \",q/1000.,\"kW and Condensation Rates=\",m,\" kg/s\"); \n", + "print '%s %.3f %s %.2f %s' %(\"\\n And as del(L)\", delta*1000,\"<< (D/2)\", D/2. ,\"m use of vertical cylinder correlation is justified\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Heat Transfer Rate = 66.62 kW and Condensation Rates= 0.0295 kg/s\n", + "\n", + " And as del(L) 0.218 << (D/2) 0.04 m use of vertical cylinder correlation is justified\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10.4 Page 652" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "Ts = 25+273. \t\t\t\t\t;#[K] Surface Temperature\n", + "Tsat = 54+273. \t\t\t\t\t;#[K] Saturated Temperature\n", + "D = .006 \t\t\t\t\t; #[m] Diameter of pan\n", + "g = 9.81 \t\t\t\t\t;#[m^2/s] gravitaional constant\n", + "N = 20 \t\t\t\t# No of tubes\n", + "\n", + "#Table A.6 Saturated Vapor Properties p = 1.015 bar\n", + "rhov = .098 \t\t\t\t;#[kg/m^3] Density\n", + "hfg = 2373*1000. \t\t\t;#[J/kg] Specific Heat\n", + "#Table A.6 Saturated water Liquid Properties Tf = 312.5 K\n", + "rhol = 992. \t\t\t\t;#[kg/m^3] Density\n", + "cpl = 4178. \t\t\t;#[J/kg.K] Specific Heat\n", + "kl = 0.631 \t\t\t; #[W/m.K] Conductivity\n", + "ul = 663*math.pow(10,-6) \t; #[N.s/m^2] Viscosity\n", + "#calculations\n", + "\n", + "Ja = cpl*(Tsat-Ts)/hfg;\t\t\t\t\n", + "hfg2 = hfg*(1+.68*Ja); \t\t\t\t#Coefficient of condensation\n", + "#Equation 10.46\n", + "h = .729*math.pow((g*rhol*(rhol-rhov)*kl*kl*kl*hfg2/(N*ul*(Tsat-Ts)*D)),.25);\n", + "#Equation 10.34\n", + "m1 = h*(math.pi*D)*(Tsat-Ts)/hfg2;\t#Average condensation rate\n", + "\n", + "m = N*N*m1;\t\t\t\t\t\t\t#Rate per unit length\n", + "#results\n", + "\n", + "print '%s %.3f %s' %(\"\\n For the complete array of tubes, the condensation per unit length is\",m ,\" kg/s.m\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "EXAMPLE 10.4 Page 652 \n", + "\n", + "\n", + " For the complete array of tubes, the condensation per unit length is 0.463 kg/s.m\n" + ] + } + ], + "prompt_number": 4 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_11-checkpoint.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_11-checkpoint.ipynb new file mode 100644 index 00000000..8f262870 --- /dev/null +++ b/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_11-checkpoint.ipynb @@ -0,0 +1,525 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:5e92567b35993f9c7de62df409e192f4b4e830dd2953d0bcb614e86ff6f77b6a" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 11:Heat Exchangers" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11.1 Page 680 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "Tho = 60+273 \t\t\t\t\t\t\t;#[K] Hot Fluid outlet Temperature\n", + "Thi = 100+273 \t\t\t\t\t\t\t; #[K] Hot Fluid intlet Temperature\n", + "Tci = 30+273 \t\t\t\t\t\t\t;#[K] Cold Fluid intlet Temperature\n", + "mh = .1 \t\t\t\t\t\t\t;#[kg/s] Hot Fluid flow rate\n", + "mc = .2 \t\t\t\t\t\t\t;#[kg/s] Cold Fluid flow rate\n", + "Do = .045 \t\t\t\t\t\t\t;#[m] Outer annulus\n", + "Di = .025 \t\t\t\t\t\t\t;#[m] Inner tube\n", + "\n", + "#Table A.5 Engine Oil Properties T = 353 K\n", + "cph = 2131 \t\t\t\t\t;#[J/kg.K] Specific Heat\n", + "kh = .138 \t\t\t\t\t; #[W/m.K] Conductivity\n", + "uh = 3.25/100. \t\t\t\t\t; #[N.s/m^2] Viscosity\n", + "#Table A.6 Saturated water Liquid Properties Tc = 308 K\n", + "cpc = 4178 \t\t\t\t\t;#[J/kg.K] Specific Heat\n", + "kc = 0.625 \t\t\t\t\t; #[W/m.K] Conductivity\n", + "uc = 725*math.pow(10,-6) \t\t\t; #[N.s/m^2] Viscosity\n", + "Pr = 4.85 \t\t\t\t\t;#Prandtl Number\n", + "#calculations and results\n", + "\n", + "\n", + "q = mh*cph*(Thi-Tho); \t\t\t\t\t\t#Heat transferred\n", + "\n", + "Tco = q/(mc*cpc)+Tci;\n", + "\n", + "T1 = Thi-Tco;\n", + "T2 = Tho-Tci;\n", + "Tlm = (T1-T2)/(2.30*math.log10(T1/T2));\t\t#logarithmic mean temp. difference\n", + "\n", + "#Through Tube\n", + "Ret = 4*mc/(math.pi*Di*uc);\n", + "print '%s %.2f %s' %(\"\\n Flow through Tube has Reynolds Number as\", Ret,\" .Thus the flow is Turbulent\");\n", + "#Equation 8.60\n", + "Nut = .023*math.pow(Ret,.8)*math.pow(Pr,.4);#Nusselt number\n", + "hi = Nut*kc/Di;\n", + "\n", + "#Through Shell\n", + "Reo = 4*mh*(Do-Di)/(math.pi*uh*(Do*Do-Di*Di));\n", + "print '%s %.2f %s' %(\"\\n Flow through Tube has Reynolds Number as\",Reo,\". Thus the flow is Laminar\");\n", + "#Table 8.2\n", + "Nuo = 5.63;\n", + "ho = Nuo*kh/(Do-Di);\n", + "\n", + "U = 1./(1./hi+1./ho); \t\t\t\t\t\t#overall heat transfer coefficient\n", + "L = q/(U*math.pi*Di*Tlm); \t\t\t\t\t#Length\n", + "\n", + "print '%s %.2f' %(\"\\n Tube Length to achieve a desired hot fluid temperature is (m) = \",L);\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Flow through Tube has Reynolds Number as 14049.54 .Thus the flow is Turbulent\n", + "\n", + " Flow through Tube has Reynolds Number as 55.97 . Thus the flow is Laminar\n", + "\n", + " Tube Length to achieve a desired hot fluid temperature is (m) = 65.71\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11.2 Page 683" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "import numpy\n", + "from numpy import linspace\n", + "import matplotlib\n", + "from matplotlib import pyplot\n", + "#Operating Conditions\n", + "Tho = 60.+273 \t\t\t;#[K] Hot Fluid outlet Temperature\n", + "Thi = 100.+273 \t\t\t;#[K] Hot Fluid intlet Temperature\n", + "Tci = 30.+273 \t\t\t;#[K] Cold Fluid intlet Temperature\n", + "mh = .1 \t\t\t;#[kg/s] Hot Fluid flow rate\n", + "mc = .2 \t\t\t;#[kg/s] Cold Fluid flow rate\n", + "Do = .045 \t\t\t;#[m] Outer annulus\n", + "Di = .025 \t\t\t;#[m] Inner tube\n", + "\n", + "#Table A.5 Engine Oil Properties T = 353 K\n", + "cph = 2131 \t;#[J/kg.K] Specific Heat\n", + "kh = .138 \t;#[W/m.K] Conductivity\n", + "uh = 3.25/100. \t;#[N.s/m^2] Viscosity\n", + "rhoh = 852.1 \t;#[kg/m^3] Density\n", + "#Table A.6 Saturated water Liquid Properties Tc = 308 K\n", + "cpc = 4178 \t;#[J/kg.K] Specific Heat\n", + "kc = 0.625 \t;#[W/m.K] Conductivity\n", + "uc = 725*math.pow(10,-6) ;#[N.s/m^2] Viscosity\n", + "Pr = 4.85 \t;#Prandtl Number\n", + "rhoc = 994 \t;#[kg/m^3] Density\n", + "#calculations\n", + "\n", + "q = mh*cph*(Thi-Tho); \t\t#Heat required\n", + "\n", + "Tco = q/(mc*cpc)+Tci;\n", + "\n", + "T1 = Thi-Tco;\n", + "T2 = Tho-Tci;\n", + "Tlm = (T1-T2)/(2.30*math.log10(T1/T2));\n", + "N=numpy.zeros(61)\n", + "for i in range (0,60):\n", + "\tN[i]=i+20;\n", + "\n", + "L = numpy.zeros(61)\n", + "for i in range (0,60):\n", + "\ta=float(N[i]);\n", + "\tL[i] = q/Tlm*(1./(7.54*kc/2.)+1/(7.54*kh/2.))/(a*a-a);\n", + "\n", + "pyplot.plot(N,L);\n", + "pyplot.xlabel(\"L (m)\");\n", + "pyplot.ylabel('Number of Gaps(N)')\n", + "pyplot.show()\n", + "#Close the graph to complete the execution\n", + "N2 = 60;\n", + "L = q/((N2-1)*N2*Tlm)*(1./(7.54*kc/2.)+1/(7.54*kh/2.));\n", + "a = L/N2;\n", + "Dh = 2*a \t\t\t;#Hydraulic Diameter [m]\n", + "#For water filled gaps\n", + "umc = mc/(rhoc*L*L/2.);\n", + "Rec = rhoc*umc*Dh/uc;\n", + "#For oil filled gaps\n", + "umh = mh/(rhoh*L*L/2.);\n", + "Reh = rhoh*umh*Dh/uh;\n", + "print '%s %.2f %s %.2f %s' %(\"\\n Flow of the fluids has Reynolds Number as\",Reh,\" & \",Rec,\" Thus the flow is Laminar for both\");\n", + "\n", + "#Equations 8.19 and 8.22a\n", + "delpc = 64/Rec*rhoc/2*umc*umc/Dh*L ;#For water\n", + "delph = 64/Reh*rhoh/2*umh*umh/Dh*L ;#For oil\n", + "\n", + "#For example 11.1\n", + "L1 = 65.9;\n", + "Dh1c = .025;\n", + "Dh1h = .02;\n", + "Ret = 4*mc/(math.pi*Di*uc);\n", + "f = math.pow((.790*2.30*math.log10(Ret)-1.64),-2) ;#friction factor through tube Eqn 8.21\n", + "umc1 = 4*mc/(rhoc*math.pi*Di*Di);\n", + "delpc1 = f*rhoc/2*umc1*umc1/Dh1c*L1;\n", + "Reo = 4*mh*(Do-Di)/(math.pi*uh*(Do*Do-Di*Di));\t\t \t#Reynolds number\n", + "umh1 = 4*mh/(rhoh*math.pi*(Do*Do-Di*Di));\n", + "delph1 = 64/Reo*rhoh/2*umh1*umh1/Dh1h*L1;\n", + "#results\n", + "\n", + "print '%s %.3f %s' %(\"\\n Exterior Dimensions of heat Exchanger L =\",L,\"m\");\n", + "print '%s %.3f %s' %(\"\\n Pressure drops within the plate-type Heat exchanger with N=60 gaps\\n For water = \", delpc,\" N/m^2\") \n", + "print '%s %.3f %s' %(\" For oil = \",delph,\" N/m^2\\n \")\n", + "print '%s %.3f %s' %(\"Pressure drops tube Heat exchanger of example 11.1\\n For water = \",delpc1 ,\"N/m^2\") \n", + "print '%s %.3f %s' %(\"\\n For oil =\",delph1,\" N/m^2\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Flow of the fluids has Reynolds Number as 1.57 & 140.77 Thus the flow is Laminar for both\n", + "\n", + " Exterior Dimensions of heat Exchanger L = 0.131 m\n", + "\n", + " Pressure drops within the plate-type Heat exchanger with N=60 gaps\n", + " For water = 3.768 N/m^2\n", + " For oil = 98.523 N/m^2\n", + " \n", + "Pressure drops tube Heat exchanger of example 11.1\n", + " For water = 6331.255 N/m^2\n", + "\n", + " For oil = 18287.329 N/m^2\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11.3 Page 692" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Operating Conditions\n", + "Tho = 100+273. \t\t\t\t;#[K] Hot Fluid outlet Temperature\n", + "Thi = 300+273. \t\t\t\t;#[K] Hot Fluid intlet Temperature\n", + "Tci = 35+273. \t\t\t\t;#[K] Cold Fluid intlet Temperature\n", + "Tco = 125+273. \t\t\t\t; #[K] Cold Fluid outlet Temperature\n", + "mc = 1 \t\t\t\t;#[kg/s] Cold Fluid flow rate\n", + "Uh = 100 \t\t\t\t;#[W/m^2.K] Coefficient of heat transfer\n", + "#Table A.5 Water Properties T = 353 K\n", + "cph = 1000 \t\t\t\t;#[J/kg.K] Specific Heat\n", + "#Table A.6 Saturated water Liquid Properties Tc = 308 K\n", + "cpc = 4197 \t\t\t\t;#[J/kg.K] Specific Heat\n", + "#calculations\n", + "\n", + "Cc = mc*cpc;\n", + "#Equation 11.6b and 11.7b\n", + "Ch = Cc*(Tco-Tci)/(Thi-Tho);\n", + "# Equation 11.18\n", + "qmax = Ch*(Thi-Tci); \t\t\t#Max. heat\n", + "#Equation 11.7b \n", + "q = mc*cpc*(Tco-Tci); \t\t\t#Heat available\n", + "\n", + "e = q/qmax; \n", + "ratio = Ch/Cc; \n", + "#results\n", + "\n", + "print '%s %.2f %s %.2f' %(\"\\n As effectiveness is\", e,\" with Ratio Cmin/Cmax =\", ratio);\n", + "print '%s' %(\", It follows from figure 11.14 that NTU = 2.1\");\n", + "NTU = 2.1; \t\t\t\t\t\t#No. of transfer units\n", + "A = 2.1*Ch/Uh;\n", + "\n", + "print '%s %.2f' %(\"\\n Required gas side surface area (m^2) = \",A);\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " As effectiveness is 0.75 with Ratio Cmin/Cmax = 0.45\n", + ", It follows from figure 11.14 that NTU = 2.1\n", + "\n", + " Required gas side surface area (m^2) = 39.66\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11.4 Page 695" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Operating Conditions\n", + "Thi = 250+273. \t\t\t;#[K] Hot Fluid intlet Temperature\n", + "Tci = 35+273. \t\t\t;#[K] Cold Fluid intlet Temperature\n", + "mc = 1 \t\t\t;#[kg/s] Cold Fluid flow rate\n", + "mh = 1.5 \t\t\t; #[kg/s] Hot Fluid flow rate\n", + "Uh = 100 \t\t \t\t;#[W/m^2.K] Coefficient of heat transfer\n", + "Ah = 40 \t\t\t; #[m^2] Area\n", + "#Table A.5 Water Properties T = 353 K\n", + "cph = 1000. \t\t\t;#[J/kg.K] Specific Heat\n", + "#Table A.6 Saturated water Liquid Properties Tc = 308 K\n", + "cpc = 4197. \t\t\t;#[J/kg.K] Specific Heat\n", + "#calculations\n", + "\n", + "Cc = mc*cpc;\n", + "Ch = mh*cph;\n", + "Cmin = Ch;\n", + "Cmax = Cc;\n", + "\n", + "NTU = Uh*Ah/Cmin;\t\t\t#No.of transfer units\n", + "ratio = Cmin/Cmax;\n", + "#results\n", + "\n", + "print '%s %.2f' %(\"\\n As Ratio Cmin/Cmax =\", ratio)\n", + "print '%s %.2f' %(\"and Number of transfer units NTU =\", NTU)\n", + "print '%s' %(\", It follows from figure 11.14 that e = .82\");\n", + "e = 0.82;\n", + "qmax = Cmin*(Thi-Tci);\t\t#Max. heat transferred\n", + "q = e*qmax; \t\t\t\t#Actual heat transferred\n", + "\n", + "#Equation 11.6b\n", + "Tco = q/(mc*cpc) + Tci;\n", + "#Equation 11.7b\n", + "Tho = -q/(mh*cph) + Thi;\n", + "print '%s %.2e %s' %(\"\\n Heat Transfer Rate =\",q,\" W \")\n", + "print '%s %.1f %s' %(\"\\n Fluid Outlet Temperatures Hot Fluid (Tho) =\" ,Tho-273,\"degC\") \n", + "print '%s %.2f %s'\t%(\"Cold Fluid (Tco) =\", Tco-273,\"degC\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " As Ratio Cmin/Cmax = 0.36\n", + "and Number of transfer units NTU = 2.67\n", + ", It follows from figure 11.14 that e = .82\n", + "\n", + " Heat Transfer Rate = 2.64e+05 W \n", + "\n", + " Fluid Outlet Temperatures Hot Fluid (Tho) = 73.7 degC\n", + "Cold Fluid (Tco) = 98.01 degC\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11.5 Page 696" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "q = 2*math.pow(10,9) \t \t\t\t;#[W] Heat transfer Rate\n", + "ho = 11000. \t\t\t\t\t\t;#[W/m^2.K] Coefficient of heat transfer for outer surface\n", + "Thi = 50+273. \t\t\t\t\t\t;#[K] Hot Fluid Condensing Temperature\n", + "Tho = Thi \t\t\t\t\t\t\t;#[K] Hot Fluid Condensing Temperature\n", + "Tci = 20+273. \t\t\t\t\t\t;#[K] Cold Fluid intlet Temperature\n", + "mc = 3*math.pow(10,4) \t\t\t\t;#[kg/s] Cold Fluid flow rate\n", + "m = 1 \t\t\t\t\t\t;#[kg/s] Cold Fluid flow rate per tube\n", + "D = .025 \t\t\t\t\t\t;#[m] diameter of tube\n", + "#Table A.6 Saturated water Liquid Properties Tf = 300 K\n", + "rho = 997 \t\t\t\t\t\t;#[kg/m^3] Density\n", + "cp = 4179 \t\t\t\t\t\t;#[J/kg.K] Specific Heat\n", + "k = 0.613 \t\t\t\t\t\t;#[W/m.K] Conductivity\n", + "u = 855*math.pow(10,-6) \t\t\t\t;#[N.s/m^2] Viscosity\n", + "Pr = 5.83 \t\t\t\t\t\t;# Prandtl number\n", + "#calculations and results\n", + "\n", + "#Equation 11.6b\n", + "Tco = q/(mc*cp) + Tci;\n", + "\n", + "Re = 4*m/(math.pi*D*u);\n", + "print '%s %.2f' %(\"\\n As the Reynolds number of tube fluid is\", Re)\n", + "print '%s' %(\". Hence the flow is turbulent. Hence using Diettus-Boetllor Equation 8.60\");\n", + "Nu = .023*math.pow(Re,.8)*math.pow(Pr,.4);\n", + "hi = Nu*k/D;\t\t\t\t\t\t\t#Heat transfer coefficient\n", + "U = 1/(1/ho + 1/hi); \t\t\t\t\t#Overall heat transfer coefficient\n", + "N = 30000. \t\t\t\t\t;#No of tubes\n", + "T1 = Thi-Tco;\n", + "T2 = Tho-Tci;\n", + "Tlm = (T1-T2)/(2.30*math.log10(T1/T2));#Logarithmic mean temp. difference\n", + "L2 = q/(U*N*2*math.pi*D*Tlm);\n", + "\n", + "\n", + "print '%s %.1f %s' %(\"\\n Outlet Temperature of cooling Water = \",Tco-273,\" degC\")\n", + "print '%s %.2f %s' %(\"\\n Tube length per pass to achieve required heat transfer =\",L2,\" m\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " As the Reynolds number of tube fluid is 59566.76\n", + ". Hence the flow is turbulent. Hence using Diettus-Boetllor Equation 8.60\n", + "\n", + " Outlet Temperature of cooling Water = 36.0 degC\n", + "\n", + " Tube length per pass to achieve required heat transfer = 4.51 m\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11.6 Page 702" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "hc = 1500. \t\t\t\t\t\t\t\t;#[W/m^2.K] Coefficient of heat transfer for outer surface\n", + "hi = hc;\n", + "Th = 825. \t\t\t\t\t\t\t\t\t;#[K] Hot Fluid Temperature\n", + "Tci = 290. \t\t\t\t\t\t\t\t\t;#[K] Cold Fluid intlet Temperature\n", + "Tco = 370. \t\t\t\t\t\t\t\t\t;#[K] Cold Fluid outlet Temperature\n", + "mc = 1 \t\t\t\t\t\t\t\t;#[kg/s] Cold Fluid flow rate\n", + "mh = 1.25 \t\t\t\t\t \t\t\t;#[kg/s] Hot Fluid flow rate\n", + "Ah = .20 \t\t\t\t\t\t\t;#[m^2] Area of tubes\n", + "Di = .0138 \t\t\t\t\t\t\t\t;#[m] diameter of tube\n", + "Do = .0164 \t\t\t\t\t\t\t\t;#[m] Diameter\n", + "#Table A.6 Saturated water Liquid Properties Tf = 330 K\n", + "cpw = 4184. \t\t\t\t\t\t\t;#[J/kg.K] Specific Heat\n", + "#Table A.1 Aluminium Properties T = 300 K\n", + "k = 237 \t\t\t\t\t\t\t;#[W/m.K] Conductivity\n", + "#Table A.4 Air Properties Tf = 700 K\n", + "cpa = 1075 \t\t\t\t\t\t\t\t;#[J/kg.K] Specific Heat\n", + "u = 33.88*math.pow(10,-6) \t\t\t\t\t;#[N.s/m^2] Viscosity\n", + "Pr = .695 \t\t\t\t\t\t\t\t;# Prandtl number\n", + "#calculations\n", + "\n", + "#Geometric Considerations\n", + "si = .449;\n", + "Dh = 6.68*math.pow(10,-3) \t\t\t\t;#[m] hydraulic diameter\n", + "G = mh/si/Ah;\n", + "Re = G*Dh/u; \t\t\t\t\t\t\t\t\t#Reynolds number\n", + "#From Figure 11.16\n", + "jh = .01;\n", + "hh = jh*G*cpa/math.pow(Pr,.66667); \t\t\t\t#Heat transfer coefficient\n", + "\n", + "AR = Di*2.303*math.log10(Do/Di)/(2*k*(.143));\t#Area of cross section\n", + "#Figure 11.16\n", + "AcAh = Di/Do*(1-.830);\n", + "#From figure 3.19\n", + "nf = .89;\n", + "noh = 1-(1-.89)*.83;\n", + "\n", + "U = 1/(1/(hc*AcAh) + AR + 1/(noh*hh));\t\t\t#Overall heat transfer coefficient\n", + "\n", + "Cc = mc*cpw;\n", + "q = Cc*(Tco-Tci); \t\t\t\t\t\t\t\t#Heat released\n", + "Ch = mh*cpa;\n", + "qmax = Ch*(Th-Tci); \t\t\t\t\t\t\t#MAx. heat transferred\n", + "e = q/qmax;\n", + "ratio = Ch/Cc;\n", + "#results\n", + "\n", + "print '%s %.2f %s %.2f' %(\"\\n As effectiveness is\",e,\" with Ratio Cmin/Cmax = \",ratio)\n", + "print '%s' %(\", It follows from figure 11.14 that NTU = .65\");\n", + "NTU = .65;\n", + "A = NTU*Ch/U; \t\t\t\t\t\t\t\t\t#Area of cross section\n", + "#From Fig 11.16\n", + "al = 269.; \t\t\t\t\t\t\t#[m^-1] gas side area per unit heat wxchanger volume\n", + "V = A/al;\n", + "#Answers may vary a bit due to rounding off errors.!\n", + "print '%s %.2f %s' %(\"\\n Gas-side overall heat transfer coefficient.r =\", U , \"W/m^2.K\")\n", + "print '%s %.3f %s' %(\" \\n Heat exchanger Volume = \",V,\" m^3\");\n", + "#END;" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " As effectiveness is 0.47 with Ratio Cmin/Cmax = 0.32\n", + ", It follows from figure 11.14 that NTU = .65\n", + "\n", + " Gas-side overall heat transfer coefficient.r = 95.55 W/m^2.K\n", + " \n", + " Heat exchanger Volume = 0.034 m^3\n" + ] + } + ], + "prompt_number": 6 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_12-checkpoint.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_12-checkpoint.ipynb new file mode 100644 index 00000000..78c263d6 --- /dev/null +++ b/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_12-checkpoint.ipynb @@ -0,0 +1,747 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:c3171d4f6be37f1c20eed107705dadf87c94d4600d85fa92846b137395251728" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 12:Radiation: Processes and Properties" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 12.1 Page 731 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "\n", + "A1 = .001\t\t;#[m^2] Area of emitter\n", + "In = 7000\t\t;#[W/m^2.Sr] Intensity of radiation in normal direction\n", + "A2 = .001\t\t;#[m^2] Area of other intercepting plates\n", + "A3 = A2\t\t\t;#[m^2] Area of other intercepting plates\n", + "A4 = A2\t\t\t;#[m^2] Area of other intercepting plates\n", + "r = .5\t\t\t;#[m] Distance of each plate from emitter\n", + "theta1 = 60.\t;#[deg] Angle between surface 1 normal & direction of radiation to surface 2\n", + "theta2 = 30.\t;#[deg] Angle between surface 2 normal & direction of radiation to surface 1\n", + "theta3 = 45.\t;#[deg] Angle between surface 1 normal & direction of radiation to surface 4\n", + "#calculations\n", + "\n", + "#From equation 12.2\n", + "w31 = A3/(r*r);\n", + "w41 = w31;\n", + "w21 = A2*math.cos(theta2*0.0174532925)/(r*r);\n", + "\n", + "\n", + "#From equation 12.6\n", + "q12 = In*A1*math.cos(theta1*0.0174532925)*w21;\n", + "q13 = In*A1*math.cos(0*math.pi/180.)*w31;\n", + "q14 = In*A1*math.cos(theta3*0.0174532925)*w41;\n", + "#results\n", + "\n", + "print '%s %d %s' %(\"\\n (a) As Intensity of emitted radiation is independent of direction, for each of the three directions I = \",In,\"W/m^2.sr\")\n", + "print '%s' %(\"\\n\\n (b) By the Three Surfaces\\n Solid angles subtended Rate at which radiation is intercepted \\n\")\n", + "print '%s %.2e %s' %(\"w4-1 =\",w41,\" sr\")\n", + "print '%s %.2e %s' %(\"\\t \\t \\t \\t \\t \\t q1-4 =\",q14,\" W\") \n", + "print '%s %.2e %s' %(\"\\nw3-1 = \",w31,\" sr\")\n", + "print '%s %.2e %s' %(\"\\t \\t \\t \\t \\t \\t q1-3 =\",q13,\" W\")\n", + "print '%s %.2e %s' %(\"\\n w2-1 = \",w21,\" sr\")\n", + "print '%s %.2e %s' %(\"\\t \\t \\t \\t \\t \\tq1-2 = \",q12,\" W \");\n", + "#END\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " (a) As Intensity of emitted radiation is independent of direction, for each of the three directions I = 7000 W/m^2.sr\n", + "\n", + "\n", + " (b) By the Three Surfaces\n", + " Solid angles subtended Rate at which radiation is intercepted \n", + "\n", + "w4-1 = 4.00e-03 sr\n", + "\t \t \t \t \t \t q1-4 = 1.98e-02 W\n", + "\n", + "w3-1 = 4.00e-03 sr\n", + "\t \t \t \t \t \t q1-3 = 2.80e-02 W\n", + "\n", + " w2-1 = 3.46e-03 sr\n", + "\t \t \t \t \t \tq1-2 = 1.21e-02 W \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 12.2 Page 734" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "import matplotlib.pyplot as plt\n", + "%pylab inline\n", + "# Total Irradiation\n", + "#calculations\n", + "\n", + "x=([0, 5, 20, 25]);\n", + "y=([0, 1000, 1000, 0]);\n", + "\n", + "plt.plot(x,y);\n", + "plt.xlabel(\"Spectral Distribution\")\n", + "plt.ylabel(\"wavelength (micro-m)\")\n", + "#By Equation 12.4\n", + "G = 1000*(5-0)/2. +1000*(20-5)+1000*(25-20)/2.;\n", + "#results\n", + "\n", + "print '%s %d %s' %(\"\\n G =\",G,\" W/m^2\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Populating the interactive namespace from numpy and matplotlib\n", + "\n", + " G = 20000 W/m^2" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAY0AAAEPCAYAAAC+35gCAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3X1UVHX+B/D3QJpupqWAFpC05BMww6OkBooPxAJaWT7Q\nCq5rttqp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YWHYsmUL\nAGDKlCkYMGAA0tLSbvqrOzQ0FHq9Hn369MGkSZOkL2VLJk2ahIiICERERKCmpqbFtFjT6xcWFiI0\nNBQRERH47LPP8MILL1isp/nzAaBfv35YsmQJQkJCUFlZKb1Geno6nnnmGQwaNAgeHh7Sc8aMGYNV\nq1ZJB8Kbv15OTg6effZZGAwG7N69G2+++WarvxtXyiQA4KXRSXPuv/9+lJSUoHv37kqXQuR2ONIg\nzeFfvETK4UiDiIisxpEGERFZjU2DiIisxqZBRERWY9MgIiKrsWkQEZHV2DSIiMhq/w/7Ws1RmQme\nagAAAABJRU5ErkJggg==\n", + "text": [ + "" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 12.3 Page 741" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "\n", + "T = 2000.\t\t\t\t\t\t\t\t;#[K] temperature of surface\n", + "stfncnstt = 5.67*math.pow(10,-8)\t\t;#[W/m^2.K^4] Stefan-Boltzmann constant\n", + "E = stfncnstt*T*T*T*T; \t\t\t#[W/m^2]\n", + "#calculations\n", + "\n", + "#From Table 12.1 \n", + "constt1 = 2195. ; \t\t\t\t\t#[micro-m.K]\n", + "wl1 = constt1/T;\n", + "#From Table 12.1 \n", + "constt2 = 9382. ; \t\t\t\t\t#[micro-m.K]\n", + "wl2 = constt2/T;\n", + "\n", + "#From Weins Law, wlmax*T = consttmax = 2898 micro-m.K\n", + "consttmax = 2898 \t\t\t\t;#micro-m.K\n", + "wlmax = consttmax/T;\n", + "#from Table 12.1 at wlmax = 1.45 micro-m.K and T = 2000 K\n", + "I = .722*stfncnstt*T*T*T*T*T/10000.;\n", + "Eb = math.pi*I;\n", + "\n", + "G = E; #[W/m^2] Irradiation of any small object inside the enclosure is equal to emission from blackbody at enclosure temperature\n", + "#results\n", + "\n", + "print '%s %.2e %s' %(\"\\n (a) Spectral Emissive Power of a small aperture on the enclosure =\",E,\" W/m^2.Sr for each of the three directions\")\n", + "print '%s %.1f %s' %(\"\\n (b) Wavelength below which 10percent of the radiation is concentrated = \",wl1,\" micro-m \\n\") \n", + "print '%s %.2f %s' %(\" Wavelength above which 10percent of the radiation is concentrated = \",wl2,\" micro-m \\n\")\n", + "print '%s %.2e %s %.2e %s' %(\"(c) Spectral emissive power and wavelength associated with maximum emission is \",Eb,\"micro-m and\",wlmax,\" W/m^2.micro-m respectively\")\n", + "print '%s %.2e %s' %(\"\\n (d) Irradiation on a small object inside the enclosure =\",G,\"W/m^2\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " (a) Spectral Emissive Power of a small aperture on the enclosure = 9.07e+05 W/m^2.Sr for each of the three directions\n", + "\n", + " (b) Wavelength below which 10percent of the radiation is concentrated = 1.1 micro-m \n", + "\n", + " Wavelength above which 10percent of the radiation is concentrated = 4.69 micro-m \n", + "\n", + "(c) Spectral emissive power and wavelength associated with maximum emission is 4.12e+05 micro-m and 1.45e+00 W/m^2.micro-m respectively\n", + "\n", + " (d) Irradiation on a small object inside the enclosure = 9.07e+05 W/m^2\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 12.4 Page 743 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "import scipy\n", + "from scipy import integrate\n", + "\n", + "\n", + "T = 1500.\t\t\t\t\t\t\t\t;#[K] temperature of surface\n", + "stfncnstt = 5.67*math.pow(10,-8)\t\t;#[W/m^2.K^4] Stefan-Boltzmann constant\n", + "#calculations\n", + "\n", + "#From Equation 12.26 Black Body Radiation\n", + "Eb = stfncnstt*T*T*T*T; \t\t\t#[W/m^2]\n", + "\n", + "#From Table 12.1 as wl1*T = 2*1500 (micro-m.K)\n", + "F02 = .273;\n", + "#From Table 12.1 as wl2*T = 4*1500 (micro-m.K)\n", + "F04 = .738;\n", + "def func(x):\n", + "\tfunc = 2*math.cos(x) *math.sin(x)\n", + "\treturn func;\n", + "\n", + "#From equation 12.10 and 12.11\n", + "i1 = scipy.integrate.quad(func,0,math.pi/3.);\n", + "delE = i1[0] *(F04-F02)*Eb;\n", + "#results\n", + "\n", + "print '%s %.2e %s' %(\"\\n Rate of emission per unit area over all directions between 0 degC and 60 degC and over all wavelengths between wavelengths 2 micro-m and 4 micro-m =\",delE,\" W/m^2\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Rate of emission per unit area over all directions between 0 degC and 60 degC and over all wavelengths between wavelengths 2 micro-m and 4 micro-m = 1.00e+05 W/m^2\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 12.5 Page 748" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "\n", + "T = 1600.\t\t\t\t\t\t\t\t;#[K] temperature of surface\n", + "wl1 = 2 \t\t\t\t\t\t;#[micro-m] wavelength 1\n", + "wl2 = 5 \t\t\t\t\t\t;#[micro-m] wavelength 2\n", + "stfncnstt = 5.67*math.pow(10,-8);\t\t#[W/m^2.K^4] Stefan-Boltzmann constant\n", + "# From the given graph of emissivities\n", + "e1 = .4;\n", + "e2 = .8;\n", + "#calculations\n", + "\n", + "#From Equation 12.26 Black Body Radiation\n", + "Eb = stfncnstt*T*T*T*T; \t \t\t#[W/m^2]\n", + "\n", + "#Solution (A)\n", + "#From Table 12.1 as wl1*T = 2*1600 (micro-m.K)\n", + "F02 = .318;\n", + "#From Table 12.1 as wl2*T = 5*1600 (micro-m.K)\n", + "F05 = .856;\n", + "#From Equation 12.36\n", + "e = e1*F02 + e2*(F05 - F02);\n", + "\n", + "#Solution (B)\n", + "#From equation 12.35\n", + "E = e*Eb;\n", + "\n", + "#Solution (C)\n", + "#For maximum condition Using Weins Law\n", + "consttmax = 2898. \t\t\t\t;#[micro-m.K]\n", + "wlmax = consttmax/T;\n", + "\n", + "#equation 12.32 with Table 12.1\n", + "E1 = math.pi*e1*.722*stfncnstt*T*T*T*T*T/10000.;\n", + "\n", + "E2 = math.pi*e2*.706*stfncnstt*T*T*T*T*T/10000.;\n", + "#results\n", + "\n", + "print '%s %.3f' %(\"\\n (a) Total hemispherical emissivity =\",e)\n", + "print '%s %d %s' %(\"\\n (b) Total emissive Power =\",E/1000. ,\" kW/m^2\")\n", + "print '%s %.1f %s %.1f %s ' %(\"\\n (c) Emissive Power at wavelength 2micro-m is greater than Emissive power at maximum wavelength \\n i.e.\",E2/1000.,\" kW/m^2 >\",E1/1000.,\" kW/m^2\")\n", + "print '%s %d %s' %(\"\\n Thus, Peak emission occurs at\",wl1,\"micro-m\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " (a) Total hemispherical emissivity = 0.558\n", + "\n", + " (b) Total emissive Power = 207 kW/m^2\n", + "\n", + " (c) Emissive Power at wavelength 2micro-m is greater than Emissive power at maximum wavelength \n", + " i.e. 105.5 kW/m^2 > 53.9 kW/m^2 \n", + "\n", + " Thus, Peak emission occurs at 2 micro-m\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 12.6 Page 751" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "import scipy\n", + "from scipy import integrate\n", + "\n", + "T = 2000.\t\t\t\t\t\t\t\t;#[K] temperature of surface\n", + "wl = 1 \t\t\t\t\t\t;#[micro-m] wavelength \n", + "stfncnstt = 5.67*math.pow(10,-8);\t\t#[W/m^2.K^4] Stefan-Boltzmann constant\n", + "\n", + "# From the given graph of emissivities\n", + "e1 = .3;\n", + "e2 = .6;\n", + "#calculations\n", + "\n", + "#From Equation 12.26 Black Body Radiation\n", + "Eb = stfncnstt*T*T*T*T; \t\t\t\t\t\t#[W/m^2]\n", + "def func1(x):\n", + "\tfunc1=e1*math.cos(x) *math.sin(x);\n", + "\treturn func1;\n", + "\n", + "def func2(x):\n", + "\tfunc2=e2*math.cos(x) *math.sin(x);\n", + "\treturn func2;\n", + "\n", + "#Equation 12.34\n", + "i1 = scipy.integrate.quad(func1,0,math.pi/3.);\n", + "i2 = scipy.integrate.quad(func2,math.pi/3. ,4*math.pi/9.);\n", + "e = 2*(i1[0]+i2[0]);\n", + "\n", + "# From Table 12.1 at wl = 1 micro-m and T = 2000 K.\n", + "\n", + "I = .493*math.pow(10,-4) * stfncnstt*T*T*T*T*T ;#[W/m^2.micro-m.sr]\n", + "\n", + "In = e1*I;\n", + "\n", + "#Using Equation 12.32 for wl = 1 micro-m and T = 2000 K\n", + "E = e*math.pi*I;\n", + "#results\n", + "\n", + "print '%s %.1f' %('\\n Spectral Normal emissivity en =',e1)\n", + "print '%s %.2f' %('and spectral hemispherical emissivity e = ',e)\n", + "print '%s %.2e %s' %('\\n Spectral normal intensity In =',In,' W/m^2.micro-m.sr')\n", + "print '%s %.1e %s' % ('and Spectral emissive power =',E,' W/m^2.micro-m.sr ');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Spectral Normal emissivity en = 0.3\n", + "and spectral hemispherical emissivity e = 0.36\n", + "\n", + " Spectral normal intensity In = 2.68e+04 W/m^2.micro-m.sr\n", + "and Spectral emissive power = 1.0e+05 W/m^2.micro-m.sr \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 12.7 Page 759" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "import matplotlib\n", + "from matplotlib import pyplot\n", + "%pylab inline\n", + "\n", + "\n", + "T = 500.\t\t\t\t\t\t\t\t;#[K] temperature of surface\n", + "e = .8;\n", + "stfncnstt = 5.67*math.pow(10,-8);\t\t#[W/m^2.K^4] Stefan-Boltzmann constant\n", + "#calculations\n", + "\n", + "x=([0, 6, 8, 16]);\n", + "y=([.8, .8, 0, 0]);\n", + "\n", + "pyplot.xlabel(\"Spectral Distribution of reflectivity\")\n", + "pyplot.ylabel(\"wavelength (micro-m)\");\n", + "pyplot.plot(x,y);\n", + "pyplot.show();\n", + "\n", + "\n", + "#From equation 12.43 and 12.44\n", + "Gabs = (.2*500/2.*(6.-2.)+500*(.2*(8.-6.)+(1.-.2)*(8.-6.)/2.)+1*500*(12.-8.)+500*(16.-12.)/2.) ;#[w/m^2]\n", + "G = (500*(6.-2.)/2.+500*(12.-6.)+500*(16.-12.)/2.) \t\t\t\t\t\t\t\t\t;#[w/m^2]\n", + "a = Gabs/G;\n", + "\n", + "#Neglecting convection effects net het flux to the surface\n", + "qnet = a*G - e*stfncnstt*T*T*T*T;\n", + "#results\n", + "\n", + "print '%s %.2f' %('\\n Total, hemispherical absorptivity',a)\n", + "print '%s %.2f %s' %('\\n Nature of surface temperature change =',qnet,' W/m^2 \\n Since qnet > 0, the sirface temperature will increase with the time');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Populating the interactive namespace from numpy and matplotlib\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAEPCAYAAABCyrPIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3X9cVFXeB/DPICAk/sgfkDIULprIOA4zwBimOSpGpGhP\npdgmpmZLviofd82srU0ss8U0K/d5CNc2nzVNybbSKCrTUVGX/E1YkRnqDIrmT1QUgTnPHyOzjAzM\njM6dO8Dn/XrxigvnXj5Azpd7zj3nKIQQAkRE1Or5yR2AiIh8AwsCEREBYEEgIqJrWBCIiAgACwIR\nEV3DgkBERAAkLgj5+flQq9WIiYlBVlZWg8+fPn0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x9+QGBgINasWYMpU6YgNjYWw4cPR1VVle1xVY1Gg9zc3AbXTUtL\nw6pVq5CWluYw6+OPP46hQ4di+PDhto+NGzcOgwYNQseOHRv9Hkl6XP6a0LNnT+zevRudO3eWOwq1\nUmPGjMH06dPtigR5H+8QqNntX00tx7lz56BSqRAYGMhi4AN4h0BERAB4h0BERNewIBAREQAWBCIi\nuoYFgYiIALAgEBHRNSwIREQEAPh/X35awWPS9asAAAAASUVORK5CYII=\n", + "text": [ + "" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Total, hemispherical absorptivity 0.76\n", + "\n", + " Nature of surface temperature change = 965.00 W/m^2 \n", + " Since qnet > 0, the sirface temperature will increase with the time\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 12.8 Page 761" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "T = 5800.\t\t\t\t\t\t\t\t;#[K] temperature of surface\n", + "e = .8;\n", + "stfncnstt = 5.67*math.pow(10,-8);\t\t#[W/m^2.K^4] Stefan-Boltzmann constant\n", + "#calculations and results\n", + "\n", + "#From Table 12.1\n", + "#For wl1 = .3 micro-m and T = 5800 K, At wl1*T = 1740 micro-m.K\n", + "F0wl1 = .0335;\n", + "#For wl1 = .3 micro-m and T = 5800 K, At wl2*T = 14500 micro-m.K\n", + "F0wl2 = .9664;\n", + "\n", + "#Hence from equation 12.29\n", + "t = .90*(F0wl2 - F0wl1);\n", + "\n", + "print '%s %.2f' %('\\n Total emissivity of cover glass to solar radiation =',t);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Total emissivity of cover glass to solar radiation = 0.84\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 12.9 Page 766" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "Ts = 500.\t\t\t\t\t\t\t;#[K] temperature of brick surface\n", + "Tc = 2000. \t\t\t\t;#[K] Temperature of coal exposed\n", + "stfncnstt = 5.67*math.pow(10,-8)\t;#[W/m^2.K^4] Stefan-Boltzmann constant\n", + "# From the given graph of emissivities\n", + "e1 = .1; \t\t\t\t\t\t#between wavelength 0 micro-m- 1.5 micro-m\n", + "e2 = .5; \t\t\t\t\t\t#between wavelength 1.5 micro-m- 10 micro-m\n", + "e3 = .8; \t\t\t\t\t\t#greater than wavelength 10 micro-m\n", + "#calculations\n", + "\n", + "#From Table 12.1\n", + "#For wl1 = 1.5 micro-m and T = 500 K, At wl1*T = 750 micro-m.K\n", + "F0wl1 = 0;\n", + "#For wl2 = 10 micro-m and T = 500 K, At wl2*T = 5000 micro-m.K\n", + "F0wl2 = .634;\n", + "#From equation 12.36\n", + "e = e1*F0wl1 + e2*F0wl2 + e3*(1-F0wl1-F0wl2);\n", + "\n", + "#Equation 12.26 and 12.35\n", + "E = e*stfncnstt*Ts*Ts*Ts*Ts;\n", + "\n", + "#From Table 12.1\n", + "#For wl1 = 1.5 micro-m and T = 2000 K, At wl1*T = 3000 micro-m.K\n", + "F0wl1c = 0.273;\n", + "#For wl2 = 10 micro-m and T = 2000 K, At wl2*T = 20000 micro-m.K\n", + "F0wl2c = .986;\n", + "ac = e1*F0wl1c + e2*(F0wl2c-F0wl1c) + e3*(1-F0wl2c);\n", + "#results\n", + "\n", + "print '%s %.3f' %('\\n Total hemispherical emissivity of fire brick wall =',e)\n", + "print '%s %d %s' %('\\n Total emissive power of brick wall =',E,'W/m^2.')\n", + "print '%s %.3f' %('\\n Absorptivity of the wall to irradiation from coals =',ac);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Total hemispherical emissivity of fire brick wall = 0.610\n", + "\n", + " Total emissive power of brick wall = 2160 W/m^2.\n", + "\n", + " Absorptivity of the wall to irradiation from coals = 0.395\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 12.10 Page 768" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "Ts = 300.;\t\t\t\t\t\t\t#[K] temperature of surface\n", + "Tf = 1200; \t\t\t\t#[K] Temperature of Furnace\n", + "stfncnstt = 5.67*math.pow(10,-8);\t#[W/m^2.K^4] Stefan-Boltzmann constant\n", + "# From the given graph of absorptivities\n", + "a1 = .8; \t\t\t\t\t\t#between wavelength 0 micro-m- 5 micro-m\n", + "a2 = .1; \t\t\t\t\t\t#greater than wavelength 5 micro-m\n", + "#calculations\n", + "\n", + "#From Table 12.1\n", + "#For wl1 = 5 micro-m and T = 1200 K, At wl1*T = 6000 micro-m.K\n", + "F0wl1 = 0.738;\n", + "#From equation 12.44\n", + "a = a1*F0wl1 + a2*(1-F0wl1);\n", + "#From Table 12.1\n", + "#For wl1 = 5 micro-m and T = 300 K, At wl1*T = 1500 micro-m.K\n", + "F0wl1s = 0.014;\n", + "#From equation 12.36\n", + "e = a1*F0wl1s + a2*(1-F0wl1s);\n", + "#results\n", + "\n", + "print' %s %.2f' %('\\n For Initial Condition \\n Total hemispherical absorptivity = ',a)\n", + "print '%s %.2f' %('Emissivity of sphere =',e)\n", + "print '%s' %('\\n\\n Beacuase the spectral characteristics of the coating and the furnace temeprature remain fixed, there is no change in the value of absorptivity with increasing time.')\n", + "print '%s %d %s %.2f' %('\\n Hence, After a sufficiently long time, Ts = Tf = ',Tf,' K and emissivity equals absorptivity e = a = ',a);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " For Initial Condition \n", + " Total hemispherical absorptivity = 0.62\n", + "Emissivity of sphere = 0.11\n", + "\n", + "\n", + " Beacuase the spectral characteristics of the coating and the furnace temeprature remain fixed, there is no change in the value of absorptivity with increasing time.\n", + "\n", + " Hence, After a sufficiently long time, Ts = Tf = 1200 K and emissivity equals absorptivity e = a = 0.62\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 12.11 Page 774" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "Ts = 120+273.;\t\t\t\t\t\t\t#[K] temperature of surface\n", + "Gs = 750; \t\t\t\t#[W/m^2] Solar irradiation\n", + "Tsky = -10+273.; \t\t\t\t#[K] Temperature of Sky\n", + "Tsurr = 30+273.; \t \t\t\t#[K] Temperature os surrounding Air\n", + "e = .1 \t\t \t\t\t;# emissivity \n", + "ast = .95 \t\t\t\t;# Absorptivity of Surface\n", + "asky = e \t\t\t\t;# Absorptivity of Sky\n", + "stfncnstt = 5.67*math.pow(10,-8);\t\t#[W/m^2.K^4] Stefan-Boltzmann constant\n", + "#calculations\n", + "\n", + "h = 0.22*math.pow((Ts - Tsurr),.3334);\t#[W/m^2.K] Convective Heat transfer Coeff\n", + "#From equation 12.67\n", + "Gsky = stfncnstt*Tsky*Tsky*Tsky*Tsky; \t#[W/m^2] Irradiadtion from sky\n", + "qconv = h*(Ts-Tsurr); \t\t\t#[W/m^2] Convective Heat transfer\n", + "E = e*stfncnstt*Ts*Ts*Ts*Ts; \t\t#[W/m^2] Irradiadtion from Surface\n", + "\n", + "#From energy Balance\n", + "q = ast*Gs + asky*Gsky - qconv - E;\n", + "\n", + "#Collector efficiency\n", + "eff = q/Gs;\n", + "#results\n", + "\n", + "print '%s %d %s' %('\\n Useful heat removal rate per unit area by Energy Conservation = ',q,'W/m^2')\n", + "print '%s %.2f' %('\\n Collector efficiency defined as the fraction of solar irradiation extracted as useful energy is',eff);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Useful heat removal rate per unit area by Energy Conservation = 515 W/m^2\n", + "\n", + " Collector efficiency defined as the fraction of solar irradiation extracted as useful energy is 0.69\n" + ] + } + ], + "prompt_number": 11 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_13-checkpoint.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_13-checkpoint.ipynb new file mode 100644 index 00000000..50ed9110 --- /dev/null +++ b/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_13-checkpoint.ipynb @@ -0,0 +1,389 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:718f735e9deabd3cf6e04ce42664673c1d676aadf2f269935a60911c896b761e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 13:Radiation Exchange between surfaces" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 13.2 Page 821" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "# (1) Sphere within Cube\n", + "F12a = 1 \t\t;#By Inspection\n", + "F21a = (math.pi/6.)*F12a \t; #By Reciprocity\n", + "#calculations\n", + "\n", + "# (2) Partition within a Square Duct\n", + "F11b = 0 \t\t;#By Inspection\n", + "#By Symmetry F12 = F13\n", + "F12b = (1-F11b)/2. ;\t\t #By Summation Rule\n", + "F21b = math.sqrt(2.)*F12b ; #By Reciprocity\n", + "\n", + "# (3) Circular Tube\n", + "#From Table 13.2 or 13.5, with r3/L = 0.5 and L/r1 = 2\n", + "F13c = .172;\n", + "F11c = 0; \t\t#By Inspection\n", + "F12c = 1 - F11c - F13c \t\t;#By Summation Rule\n", + "F21c = F12c/4. \t\t;#By Reciprocity\n", + "#results\n", + "\n", + "print' %s' %('\\n Desired View Factors may be obtained from inspection, the reciprocity rule, the summation rule and/or use of charts')\n", + "print '%s %.3f' %('\\n (1) Sphere within Cube F21 =',F21a)\n", + "print '%s %.3f' %('\\n (2) Partition within a Square Duct F21 = ',F21b)\n", + "print '%s %.3f' %('\\n (3) Circular Tube F21 =',F21c);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " Desired View Factors may be obtained from inspection, the reciprocity rule, the summation rule and/or use of charts\n", + "\n", + " (1) Sphere within Cube F21 = 0.524\n", + "\n", + " (2) Partition within a Square Duct F21 = 0.707\n", + "\n", + " (3) Circular Tube F21 = 0.207\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 13.3 Page 826" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "import numpy\n", + "from numpy import linalg\n", + "\n", + "L = 10 \t;#[m] Collector length = Heater Length\n", + "T2 = 600 \t;#[K] Temperature of curved surface\n", + "A2 = 15 \t;#[m^2] Area of curved surface\n", + "e2 = .5 \t;# emissivity of curved surface\n", + "stfncnstt = 5.67*math.pow(10,-8);\t\t#[W/m^2.K^4] Stefan-Boltzmann constant\n", + "T1 = 1000 ;#[K] Temperature of heater\n", + "A1 = 10 ;#[m^2] area of heater\n", + "e1 = .9 ;# emissivity of heater\n", + "W = 1 ;#[m] Width of heater\n", + "H = 1 ;#[m] Height\n", + "T3 = 300 ;#[K] Temperature of surrounding\n", + "e3 = 1 ;# emissivity of surrounding\n", + "#calculations\n", + "\n", + "J3 = stfncnstt*T3*T3*T3*T3; #[W/m^2]\n", + "#From Figure 13.4 or Table 13.2, with Y/L = 10 and X/L =1\n", + "F12 = .39;\n", + "F13 = 1 - F12; \t\t\t#By Summation Rule\n", + "#For a hypothetical surface A2h\n", + "A2h = L*W;\n", + "F2h3 = F13; \t\t\t#By Symmetry\n", + "F23 = A2h/A2*F13; \t#By reciprocity\n", + "Eb1 = stfncnstt*T1*T1*T1*T1;#[W/m^2]\n", + "Eb2 = stfncnstt*T2*T2*T2*T2;#[W/m^2]\n", + "#Radiation network analysis at Node corresponding 1\n", + "#-10J1 + 0.39J2 = -510582\n", + "#.26J1 - 1.67J2 = -7536\n", + "#Solving above equations\n", + "A = ([[-10 ,.39],\n", + " [.26, -1.67]]);\n", + "B = ([[-510582.],\n", + " [-7536.]]);\n", + "\n", + "X = numpy.linalg.solve (A,B);\n", + "\n", + "q2 = (Eb2 - X[1])/(1-e2)*(e2*A2);\n", + "#results\n", + "\n", + "print '%s %.1f %s' %('\\n Net Heat transfer rate to the absorber is = ',q2/1000. ,'kW');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Net Heat transfer rate to the absorber is = -77.8 kW\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 13.4 Page 830" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "T3 = 300. \t\t\t\t\t;#[K] Temperature of surrounding\n", + "L = .15 \t\t\t\t\t\t;#[m] Furnace Length\n", + "T2 = 1650+273. \t\t\t\t;#[K] Temperature of bottom surface\n", + "T1 = 1350+273. \t\t\t\t;#[K] Temperature of sides of furnace\n", + "D = .075 \t\t\t\t\t;#[m] Diameter of furnace\n", + "stfncnstt = 5.670*math.pow(10,-8); #[W/m^2.K^4] Stefan Boltzman Constant\n", + "#calculations\n", + "\n", + "A2 = math.pi*D*D/4. \t\t\t;#[m] Area of bottom surface\n", + "A1 = math.pi*D*L \t \t\t;#[m] Area of curved sides\n", + "#From Figure 13.5 or Table 13.2, with ri/L = .25 \n", + "F23 = .056;\n", + "F21 = 1 - F23; \t\t\t\t#By Summation Rule\n", + "F12 = A2/A1*F21; \t\t\t#By reciprocity\n", + "F13 = F12 \t\t\t\t;#By Symmetry\n", + "#From Equation 13.17 Heat balance\n", + "q = A1*F13*stfncnstt*(T1*T1*T1*T1 - T3*T3*T3*T3) + A2*F23*stfncnstt*(T2*T2*T2*T2 - T3*T3*T3*T3);\n", + "#results\n", + "\n", + "print '%s %d %s' %('\\n Power required to maintain prescribed temperatures is =',q, 'W');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Power required to maintain prescribed temperatures is = 1830 W\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 13.5 Page 834" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "T2 = 300 \t;#[K] Temperature of inner surface\n", + "D2 = .05 \t;#[m] Diameter of Inner Surface\n", + "e2 = .05 \t;# emissivity of Inner Surface\n", + "T1 = 77 \t;#[K] Temperature of Outer Surface\n", + "D1 = .02 ;#[m] Diameter of Inner Surface\n", + "e1 = .02 \t;# emissivity of Outer Surface\n", + "D3 = .035 ;#[m] Diameter of Shield\n", + "e3 = .02 ;# emissivity of Shield\n", + "stfncnstt = 5.670*math.pow(10,-8) ;#[W/m^2.K^4] Stefan Boltzman Constant\n", + "#calculations\n", + "\n", + "#From Equation 13.20 Heat balance\n", + "q = stfncnstt*(math.pi*D1)*(T1*T1*T1*T1-T2*T2*T2*T2)/(1/e1 + (1-e2)/e2*D1/D2) ;#[W/m] \n", + "\n", + "RtotL = (1-e1)/(e1*math.pi*D1) + 1/(math.pi*D1*1) + 2*((1-e3)/(e3*math.pi*D3)) + 1/(math.pi*D3*1) + (1-e2)/(e2*math.pi*D2) ;#[m^-2]\n", + "q2 = stfncnstt*(T1*T1*T1*T1 - T2*T2*T2*T2)/RtotL; #[W/m] \n", + "#results\n", + "\n", + "print '%s %.2f %s' %('\\n Heat gain by the fluid passing through the inner tube =',q,'W/m') \n", + "print '%s %.2f %s' %('\\n Percentage change in heat gain with radiation shield inserted midway between inner and outer tubes is =',(q2-q)*100/q,'percent'); " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Heat gain by the fluid passing through the inner tube = -0.50 W/m\n", + "\n", + " Percentage change in heat gain with radiation shield inserted midway between inner and outer tubes is = -49.55 percent\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 13.6 Page 836" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "T2 = 500 \t\t\t\t\t;#[K] Temperature of Painted surface\n", + "e2 = .4 \t \t\t\t\t;# emissivity of Painted Surface\n", + "T1 = 1200 \t\t\t\t\t;#[K] Temperature of Heated Surface\n", + "W = 1 \t\t\t\t\t; #[m] Width of Painted Surface\n", + "e1 = .8 \t\t\t\t\t;# emissivity of Heated Surface\n", + "er = .8 \t\t\t\t\t;# emissivity of Insulated Surface\n", + "stfncnstt = 5.670*math.pow(10,-8);#[W/m^2.K^4] Stefan Boltzman Constant\n", + "\n", + "#By Symmetry Rule\n", + "F2R = .5;\n", + "F12 = .5;\n", + "F1R = .5;\n", + "#calculations\n", + "\n", + "#From Equation 13.20 Heat balance\n", + "q = stfncnstt*(T1*T1*T1*T1-T2*T2*T2*T2)/((1-e1)/e1*W+ 1/(W*F12+1/((1/W/F1R) + (1/W/F2R))) + (1-e2)/e2*W) ;#[W/m] \n", + "\n", + "#Surface Energy Balance 13.13\n", + "J1 = stfncnstt*T1*T1*T1*T1 - (1-e1)*q/(e1*W)\t\t;# [W/m^2] Surface 1\n", + "J2 = stfncnstt*T2*T2*T2*T2 - (1-e2)*(-q)/(e2*W)\t\t;# [W/m^2] Surface 2\n", + "#From Equation 13.26 Heat balance\n", + "JR = (J1+J2)/2.;\n", + "TR = math.pow((JR/stfncnstt),.25);\n", + "#results\n", + "\n", + "print '%s %.2f %s' %('\\n Rate at which heat must be supplied per unit length of duct = ',q/1000.,'kW/m') \n", + "print '%s %d %s' %('\\n Temperature of the insulated surface = ',TR,'K');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Rate at which heat must be supplied per unit length of duct = 36.98 kW/m\n", + "\n", + " Temperature of the insulated surface = 1102 K\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 13.7 Page 841" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "\n", + "T1 = 1000. \t\t\t\t;#[K] Temperature of Heated Surface\n", + "e1 = .8 \t\t\t\t\t;# emissivity of Heated Surface\n", + "e2 = .8 \t\t\t\t\t; # emissivity of Insulated Surface\n", + "r = .02 \t\t\t\t\t;#[m] Radius of surface\n", + "Tm = 400 \t\t\t\t;#[K] Temperature of surrounding air\n", + "m = .01 \t\t\t\t\t;#[kg/s] Flow rate of surrounding air\n", + "p = 101325 \t\t\t\t\t;#[Pa] Pressure of surrounding air\n", + "stfncnstt = 5.670*math.pow(10,-8);#[W/m^2.K^4] Stefan Boltzman Constant\n", + "#Table A.4 Air Properties at 1 atm, 400 K\n", + "k = .0338 \t\t\t\t;#[W/m.K] conductivity\n", + "u = 230*math.pow(10,-7) \t\t;#[kg/s.m] Viscosity\n", + "cp = 1014 \t\t\t\t;#[J/kg] Specific heat\n", + "Pr = .69 \t\t\t\t;# Prandtl Number\n", + "#calculations and results\n", + "\n", + "#Hydraulic Diameter\n", + "Dh = 2*math.pi*r/(math.pi+2.) ;#[m]\n", + "#Reynolds number\n", + "Re = m*Dh/(math.pi*r*r/2.)/u;\n", + "#View Factor\n", + "F12 = 1 ;\n", + "\n", + "print '%s %d %s' %(\"\\n As Reynolds Number is\",Re,\", Hence it is Turbulent flow inside a cylinder. Hence we will use Dittus-Boelter Equation\");\n", + "\n", + "#From Dittus-Boelter Equation\n", + "Nu = .023*math.pow(Re,.8) *math.pow(Pr,.4);\n", + "h = Nu*k/Dh; \t\t#[W/m^2.K]\n", + "\n", + "#From Equation 13.18 Heat Energy balance\n", + "#Newton Raphson\n", + "T2=600; \t\t\t\t\t#Initial Assumption\n", + "T2=696. \t\t\t\t\t\t#Final answer\n", + "#From energy Balance\n", + "q = h*math.pi*r*(T2-Tm) + h*2*r*(T1-Tm) ;#[W/m]\n", + "\n", + "print '%s %.2f %s' %('\\n Rate at which heat must be supplied per unit length of duct =',q,'W/m') \n", + "print '%s %.2f %s' %('& Temperature of the insulated surface =',T2,'K');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " As Reynolds Number is 16912 , Hence it is Turbulent flow inside a cylinder. Hence we will use Dittus-Boelter Equation\n", + "\n", + " Rate at which heat must be supplied per unit length of duct = 2818.56 W/m\n", + "& Temperature of the insulated surface = 696.00 K\n" + ] + } + ], + "prompt_number": 6 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_14-checkpoint.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_14-checkpoint.ipynb new file mode 100644 index 00000000..e203178b --- /dev/null +++ b/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_14-checkpoint.ipynb @@ -0,0 +1,420 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:6468bfb82b0986037161bf3424bdc85db7722be033cc738fbab9c9a4f7a1e63b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 14:Diffusion Mass Transfer" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 14.1 Page 884" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "T = 293. \t \t\t\t\t;#[K] Temperature\n", + "Ma = 2 \t\t\t\t\t;#[kg/kmol] Molecular Mass\n", + "#Table A.8 Hydrogen-Air Properties at 298 K\n", + "Dab1 = .41*math.pow(10,-4); #[m^2/s] diffusion coefficient\n", + "#Table A.8 Hydrogen-Water Properties at 298 K\n", + "Dab2 = .63*math.pow(10,-8); #[m^2/s] diffusion coefficient\n", + "#Table A.8 Hydrogen-iron Properties at 293 K\n", + "Dab3 = .26*math.pow(10,-12); #[m^2/s] diffusion coefficient\n", + "#Table A.4 Air properties at 293 K\n", + "a1 = 21.6*math.pow(10,-6); #[m^2/s] Thermal Diffusivity\n", + "#Table A.6 Water properties at 293 K\n", + "k = .603 \t\t\t\t;#[W/m.K] conductivity\n", + "rho = 998 \t\t\t\t;#[kg/m^3] Density\n", + "cp = 4182 \t\t\t\t;#[J/kg] specific Heat\n", + "#Table A.1 Iron Properties at 300 K\n", + "a3 = 23.1 * math.pow(10,-6); #[m^2/s]\n", + "#calculations\n", + "\n", + "#Equation 14.14\n", + "#Hydrogen-air Mixture\n", + "DabT1 = Dab1*math.pow(T/298.,1.5);# [m^2/s] mass diffusivity\n", + "J1 = -DabT1*1; \t\t#[kmol/s.m^2] Total molar concentration\n", + "j1 = Ma*J1; \t\t#[kg/s.m^2] mass Flux of Hydrogen\n", + "Le1 = a1/DabT1; \t# Lewis Number Equation 6.50\n", + "\n", + "#Hydrogen-water Mixture\n", + "DabT2 = Dab2*math.pow(T/298.,1.5);# [m^2/s] mass diffusivity\n", + "a2 = k/(rho*cp) \t;#[m^2/s] thermal diffusivity \n", + "J2 = -DabT2*1 \t;#[kmol/s.m^2] Total molar concentration\n", + "j2 = Ma*J2 \t;#[kg/s.m^2] mass Flux of Hydrogen\n", + "Le2 = a2/DabT2 \t;# Lewis Number Equation 6.50\n", + "\n", + "#Hydrogen-iron Mixture\n", + "DabT3 = Dab3*math.pow(T/298.,1.5);# [m^2/s] mass diffusivity\n", + "J3 = -DabT3*1; \t#[kmol/s.m^2] Total molar concentration\n", + "j3 = Ma*J3; \t#[kg/s.m^2] mass Flux of Hydrogen\n", + "Le3 = a3/DabT3 \t;# Lewis Number Equation 6.50\n", + "#results\n", + "\n", + "print '%s %.1e' %('a (m^2/s) in 1 = ',a1)\n", + "print '%s %.1e' %('\\n a (m^2/s) in 2 = ',a2)\n", + "print '%s %.1e' %('\\na (m^2/s) in 3 = ',a3)\n", + "print '%s %.1e' %('\\nDab (m^2/s) in 1 = ',DabT1)\n", + "print '%s %.1e' %('\\n Dab (m^2/s) in 2 = ',DabT2)\n", + "print '%s %.1e' %('\\n Dab (m^2/s) in 3 = ',DabT3)\n", + "print '%s %.1e' %('\\n Le in 1 = ',Le1)\n", + "print '%s %.1e' %('\\n Le in 2 = ',Le2)\n", + "print '%s %.1e' %('\\n Le in 3 = ',Le3)\n", + "print '%s %.1e' %('\\n ja (kg/s.m^2) in 1 = ',j1)\n", + "print '%s %.1e' %('\\n ja (kg/s.m^2) in 2 = ',j2)\n", + "print '%s %.1e' %('\\n ja (kg/s.m^2) in 3 = ',j3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a (m^2/s) in 1 = 2.2e-05\n", + "\n", + " a (m^2/s) in 2 = 1.4e-07\n", + "\n", + "a (m^2/s) in 3 = 2.3e-05\n", + "\n", + "Dab (m^2/s) in 1 = 4.0e-05\n", + "\n", + " Dab (m^2/s) in 2 = 6.1e-09\n", + "\n", + " Dab (m^2/s) in 3 = 2.5e-13\n", + "\n", + " Le in 1 = 5.4e-01\n", + "\n", + " Le in 2 = 2.4e+01\n", + "\n", + " Le in 3 = 9.1e+07\n", + "\n", + " ja (kg/s.m^2) in 1 = -8.0e-05\n", + "\n", + " ja (kg/s.m^2) in 2 = -1.2e-08\n", + "\n", + " ja (kg/s.m^2) in 3 = -5.1e-13\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 14.2 Page 898" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable Initialization\n", + "\n", + "import math\n", + "import numpy\n", + "from numpy import linalg\n", + "import matplotlib\n", + "from matplotlib import pyplot\n", + "\n", + "T = 298 \t\t\t;#[K] Temperature\n", + "D = 10*math.pow(10,-6) \t;#[m]\n", + "L = 100*math.pow(10,-6); #[m]\n", + "H = .5 \t\t\t;# Moist Air Humidity\n", + "p = 1.01325 \t\t\t;#[bar]\n", + "#Table A.6 Saturated Water vapor Properties at 298 K\n", + "psat = .03165; \t#[bar] saturated Pressure\n", + "#Table A.8 Water vapor-air Properties at 298 K\n", + "Dab = .26*math.pow(10,-4); #[m^2/s] diffusion coefficient\n", + "#calculations\n", + "\n", + "C = p/(8.314/100. *298) ;#Total Concentration\n", + "#From section 6.7.2, the mole fraction at x = 0 is\n", + "xa0 = psat/p;\n", + "#the mole fraction at x = L is\n", + "xaL = H*psat/p;\n", + "\n", + "#Evaporation rate per pore Using Equation 14.41 with advection\n", + "N = (math.pi*D*D)*C*Dab/(4*L)*2.303*math.log10((1-xaL)/(1-xa0)) ;#[kmol/s]\n", + "\n", + "#Neglecting effects of molar averaged velocity Equation 14.32\n", + "#Species transfer rate per pore\n", + "Nh = (math.pi*D*D)*C*Dab/(4*L)*(xa0-xaL) ;#[kmol/s]\n", + "#results\n", + "\n", + "print '%s %.2e %s' %('\\n Evaporation rate per pore Without advection effects',Nh,'kmol/s')\n", + "print '%s %.2e %s' %('and With Advection effects',N,'kmol/s')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Evaporation rate per pore Without advection effects 1.30e-14 kmol/s\n", + "and With Advection effects 1.34e-14 kmol/s\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 14.3 Page 898" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable Initialization\n", + "\n", + "import math\n", + "\n", + "D = .005 \t\t\t\t\t\t;#[m] Diameter\n", + "L = 50*math.pow(10,-6); \t#[m] Length\n", + "h = .003 \t\t\t\t;#[m] Depth\n", + "Dab = 6*math.pow(10,-14) \t;#[m^2/s] Diffusion coefficient\n", + "Cas1 = 4.5*math.pow(10,-3) \t;#[kmol/m^3] Molar concentrations of water vapor at outer surface\n", + "Cas2 = 0.5*math.pow(10,-3) \t;#[kmol/m^3] Molar concentrations of water vapor at inner surface\n", + "#calculations\n", + "\n", + "#Transfer Rate through cylindrical wall Equation 14.54\n", + "Na = Dab/L*(math.pi*D*D/4. + math.pi*D*h)*(Cas1-Cas2); #[kmol/s]\n", + "#results\n", + "\n", + "print '%s %.2e %s' %('\\n Rate of water vapor molar diffusive ttansfer through the trough wall ',Na,'kmol/s');\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Rate of water vapor molar diffusive ttansfer through the trough wall 3.20e-16 kmol/s\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 14.4 Page 902" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable Initialization\n", + "\n", + "import math\n", + "\n", + "D = .2 \t\t\t;#[m] Diameter\n", + "L = 2*math.pow(10,-3) ;#[m] Thickness\n", + "p = 4 \t\t\t;#[bars] Helium Pressure\n", + "T = 20+273. \t\t\t;#[K] Temperature\n", + "#Table A.8 helium-fused silica (293K) Page 952\n", + "Dab = .4*math.pow(10,-13)\t;#[m^2/s] Diffusion coefficient\n", + "#Table A.10 helium-fused silica (293K)\n", + "S = .45*math.pow(10,-3)\t\t;#[kmol/m^3.bar] Solubility\n", + "#calculations\n", + "\n", + "# By applying the species conservation Equation 14.43 and 14.62\n", + "dpt = -6*(.08314)*T*(Dab)*S*p/(L*D);\n", + "\n", + "#results\n", + "print '%s %.2e %s' %('\\n The rate of change of the helium pressure dp/dt',dpt,' bar/s');\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " The rate of change of the helium pressure dp/dt -2.63e-11 bar/s\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 14.5 Page 904" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable Initialization\n", + "\n", + "import math\n", + "\n", + "Dab = 8.7*math.pow(10,-8) ;#[m^2/s] Diffusion coefficient\n", + "Sab = 1.5*math.pow(10,-3) ;#[kmol/m^3.bar] Solubility\n", + "L = .0003 \t\t\t;#[m] thickness of bar\n", + "p1 = 3 \t\t\t;#[bar] pressure on one side\n", + "p2 = 1 \t\t\t;#[bar] pressure on other side\n", + "Ma = 2 \t\t\t;#[kg/mol] molecular mass of Hydrogen\n", + "#calculations\n", + "\n", + "#Surface molar concentrations of hydrogen from Equation 14.62\n", + "Ca1 = Sab*p1 \t\t\t\t; #[kmol/m^3]\n", + "Ca2 = Sab*p2 \t\t\t\t; #[kmol/m^3]\n", + "#From equation 14.42 to 14.53 for obtaining mass flux\n", + "N = Dab/L*(Ca1-Ca2) ; \t#[kmol/s.m^2]\n", + "n = Ma*N ; \t#[kg/s.m^2] on Mass basis\n", + "#results\n", + "\n", + "print '%s %.2e %s' %('\\n The Hydrogen mass diffusive flux n =',n,' (kg/s.m^2)');\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " The Hydrogen mass diffusive flux n = 1.74e-06 (kg/s.m^2)\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 14.6 Page 909 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable Initialization\n", + "\n", + "import math\n", + "\n", + "Dab = 2*math.pow(10,-12) \t;#[m^2/s] Diffusion coefficient\n", + "Ca0 = 4*math.pow(10,-3) \t\t;#[kmol/m^3] Fixed Concentration of medication\n", + "Na = -.2*math.pow(10,-3) \t\t;#[kmol/m^3.s] Minimum consumption rate of antibiotic\n", + "k1 = .1 \t\t\t\t\t;#[s^-1] Reaction Coefficient\n", + "#calculations\n", + "\n", + "#For firsst order kinetic reaction Equation 14.74\n", + "m = math.pow((k1/Dab),.5);\n", + "L = math.acosh(-k1*Ca0/Na) /m;\n", + "#results\n", + "\n", + "print '%s %.1f %s' %('\\n Maximum Thickness of a bacteria laden biofilm, that may be siccessfully treated is ',L*math.pow(10,6), 'mu-m');\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Maximum Thickness of a bacteria laden biofilm, that may be siccessfully treated is 5.9 mu-m\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 14.7 Page 913" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable Initialization\n", + "\n", + "import math\n", + "\n", + "Dap = .1*math.pow(10,-12) ;#[m^2/s] Diffusion coefficient of medication with patch\n", + "Das = .2*math.pow(10,-12) ;#[m^2/s] Diffusion coefficient of medication with skin\n", + "L = .05 \t\t\t;#[m] patch Length\n", + "rhop = 100 \t\t\t;#[kg/m^3] Density of medication on patch\n", + "rho2 = 0 \t\t\t;#[kg/m^3] Density of medication on skin\n", + "K = .5 \t\t\t;#Partition Coefficient\n", + "t = 3600*24*7 \t\t\t;#[s] Treatment time\n", + "#calculations\n", + "\n", + "#Applying Conservation of species equation 14.47b\n", + "#By analogy to equation 5.62, 5.26 and 5.58\n", + "D = 2*rhop*L*L/(math.sqrt(math.pi))*math.sqrt(Das*Dap*t)/(math.sqrt(Das)+math.sqrt(Dap)/K);\n", + "#results\n", + "\n", + "print '%s %.1f %s' %('\\n Total dosage of medicine delivered to the patient over a one-week time period is',D*math.pow(10,6) ,'mg');" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Total dosage of medicine delivered to the patient over a one-week time period is 28.7 mg\n" + ] + } + ], + "prompt_number": 10 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_2-checkpoint.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_2-checkpoint.ipynb new file mode 100644 index 00000000..f60d3c20 --- /dev/null +++ b/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_2-checkpoint.ipynb @@ -0,0 +1,177 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:98143d952f6fd3c22aa1577ff52b407cef934b0f7299125fef9744c40bc10961" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 2:Introduction to conduction" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.1 Page 68" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def alpha(p, Cp, k):\n", + " a=k/(p*Cp); #[m^2/s]\n", + " return a;\n", + "\n", + "p = 2702.; \t\t#[Kg/m^3] - Density Of Material \n", + "Cp = 903.; \t\t\t#[J/kg.K] - Specific heat of Material\n", + "k = 237.; \t\t#[W/m.k] - Thermal Conductivity of Material\n", + "\n", + "print '%s %.2e %s' %(\"\\n (a) Thermal Diffuisivity of Pure Aluminium at 300K = \",alpha(p, Cp, k),\" m^2/s\\n\");\n", + "\n", + "#(b) Pure Aluminium at 700K\n", + "# From Appendix A, Table A.1\n", + "\n", + "p = 2702.; \t\t#[Kg/m^3] - Density Of Material \n", + "Cp = 1090.; \t\t#[J/kg.K] - Specific heat of Material\n", + "k = 225.; \t\t#[W/m.k] - Thermal Conductivity of Material\n", + "\n", + "print '%s %.2e %s' %(\"\\n (b) Thermal Diffuisivity of Pure Aluminium at 700K =\",alpha(p, Cp, k),\" m^2/s\\n\");\n", + "\n", + "#(c) Silicon Carbide at 1000K\n", + "# From Appendix A, Table A.2\n", + "\n", + "p = 3160.; \t\t#[Kg/m^3] - Density Of Material \n", + "Cp = 1195.; \t\t#[J/kg.K] - Specific heat of Material\n", + "k = 87.; \t\t#[W/m.k] - Thermal Conductivity of Material\n", + "\n", + "print '%s %.2e %s' %(\"\\n (c) Thermal Diffuisivity of Silicon Carbide at 1000K =\",alpha(p, Cp, k),\" m^2/s\\n\");\n", + "\n", + "#(d) Paraffin at 300K\n", + "# From Appendix A, Table A.3\n", + "\n", + "p = 900.; \t\t\t#[Kg/m^3] - Density Of Material \n", + "Cp = 2890.; \t\t#[J/kg.K] - Specific heat of Material\n", + "k = .24; \t\t#[W/m.k] - Thermal Conductivity of Material\n", + "\n", + "print '%s %.2e %s' %(\"\\n (d) Thermal Diffuisivity of Paraffin at 300K = \",alpha(p, Cp, k),\"m^2/s\");\n", + "#END\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " (a) Thermal Diffuisivity of Pure Aluminium at 300K = 9.71e-05 m^2/s\n", + "\n", + "\n", + " (b) Thermal Diffuisivity of Pure Aluminium at 700K = 7.64e-05 m^2/s\n", + "\n", + "\n", + " (c) Thermal Diffuisivity of Silicon Carbide at 1000K = 2.30e-05 m^2/s\n", + "\n", + "\n", + " (d) Thermal Diffuisivity of Paraffin at 300K = 9.23e-08 m^2/s\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 2.2 Page 75" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "a = 900.; \t\t\t#[degC]\n", + "b = -300.; \t\t\t#[degC/m]\n", + "c = -50.; \t\t\t#[degC/m^2]\n", + "\n", + "q = 1000.; \t\t\t#[W/m^2.K] - Uniform heat Generation\n", + "A = 10. ; \t\t\t#[m^2] - Wall Area\n", + "#Properties of Wall\n", + "p = 1600.; \t\t\t#[kg/m^3] - Density\n", + "k = 40.; \t\t\t#[W/m] - Thermal Conductivity\n", + "Cp = 4000.; \t\t\t#[J/kg.K] - Specific Heat\n", + "L = 1; \t\t\t #[m] - Length of wall\n", + "#calculations and results\n", + "\n", + "#(i) Rate of Heat Transfer entering the wall and leaving the wall\n", + "# From Eqn 2.1\n", + "# qin = -kA(dT/dx)|x=0 = -kA(b)\n", + "\n", + "qin= - b*k*A;\n", + "\n", + "# Similarly\n", + "# qout = -kA(dT/dx)|x=L = -kA(b+2cx)|x=L\n", + "\n", + "qout= - k*A*(b+2*c*L);\n", + "\n", + "print '%s %d %s' %(\"\\n (i) Rate of Heat Transfer entering the wall =\",qin,\" W \");\n", + "print '%s %d %s' %(\"\\n And leaving the wall =\",qout,\"W \");\n", + "\n", + "#(ii) Rate of change Of Energy Storage in Wall E`st\n", + "# Applying Overall Energy Balance across the Wall\n", + "#E`st = E`in + E`g + E`out = qin + q`AL - qout\n", + "Est = qin + q*A*L - qout;\n", + "\n", + "print '%s %d %s' %(\"\\n (ii) Rate of change Of Energy Storage in Wall =\",Est,\" W\\n\");\n", + "\n", + "#(iii) Time rate of Temperature change at x= 0, 0.25 and .5m\n", + "#Using Eqn 2.19\n", + "# T`= dT/dt = (k/p*Cp)*d(dT/dx)/dx + q`/p*Cp\n", + "#As d(dT/dx)/dx = d(b + 2cx)/dx = 2c - Independent of x\n", + "T = (k/(p*Cp))*(2*c)+ q/(p*Cp);\n", + "print '%s %.6f %s' %(\"\\n (iii) Time rate of Temperature change independent of x =\",T,\" degC/s\\n\");\n", + "\n", + "#END\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " (i) Rate of Heat Transfer entering the wall = 120000 W \n", + "\n", + " And leaving the wall = 160000 W \n", + "\n", + " (ii) Rate of change Of Energy Storage in Wall = -30000 W\n", + "\n", + "\n", + " (iii) Time rate of Temperature change independent of x = -0.000469 degC/s\n", + "\n" + ] + } + ], + "prompt_number": 2 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_3-checkpoint.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_3-checkpoint.ipynb new file mode 100644 index 00000000..f113d3f7 --- /dev/null +++ b/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_3-checkpoint.ipynb @@ -0,0 +1,785 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:1daabc3f1bacd17510b0620700547a4c595c39635914f6f5a091f9f0968276c6" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 3:One-dimensional, Steady State Conduction" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.1 Page 104" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "A=1.8; \t\t\t\t\t# [m^2] Area for Heat transfer i.e. both surfaces\n", + "Ti = 35+273.; \t\t\t\t#[K] - Inside Surface Temperature of Body\n", + "Tsurr = 10+273.; \t\t\t#[K] - Temperature of surrounding\n", + "Tf = 283.; \t\t\t\t\t#[K] - Temperature of Fluid Flow\n", + "e=.95; \t\t\t\t\t\t# Emissivity of Surface\n", + "Lst=.003; \t\t\t\t#[m] - Thickness of Skin\n", + "kst=.3; \t\t \t\t\t# [W/m.K] Effective Thermal Conductivity of Body\n", + "kins = .014; \t\t\t\t# [W/m.K] Effective Thermal Conductivity of Aerogel Insulation\n", + "hr = 5.9; \t\t\t\t#[W/m^2.k] - Natural Thermal Convectivity from body to air\n", + "stfncnstt=5.67*math.pow(10,(-8)); # [W/m^2.K^4] - Stefan Boltzmann Constant \n", + "q = 100; \t\t\t#[W] Given Heat rate\n", + "#calculations\n", + "\n", + "#Using Conducion Basic Eq 3.19\n", + "Rtot = (Ti-Tsurr)/q;\n", + "#Also\n", + "#Rtot=Lst/(kst*A) + Lins/(kins*A)+(h*A + hr*A)^-1\n", + "#Rtot = 1/A*(Lst/kst + Lins/kins +(1/(h+hr)))\n", + "\n", + "#Thus\n", + "#For Air,\n", + "h=2.; \t\t\t\t\t#[W/m^2.k] - Natural Thermal Convectivity from body to air\n", + "Lins1 = kins * (A*Rtot - Lst/kst - 1/(h+hr));\n", + "\n", + "#For Water,\n", + "h=200.; \t\t\t\t\t#[W/m^2.k] - Natural Thermal Convectivity from body to air\n", + "Lins2 = kins * (A*Rtot - Lst/kst - 1/(h+hr));\n", + "\n", + "Tsa=305.; \t\t#[K] Body Temperature Assumed\n", + "\n", + "#Temperature of Skin is same in both cases as Heat Rate is same\n", + "#q=(kst*A*(Ti-Ts))/Lst\n", + "Ts = Ti - q*Lst/(kst*A);\n", + "#results\n", + "\n", + "#Also from eqn of effective resistance Rtot F\n", + "print '%s %.1f %s' %(\"\\n\\n (I) In presence of Air, Insulation Thickness = \",Lins1*1000,\" mm\")\n", + "print '%s %.1f %s' %(\"\\n (II) In presence of Water, Insulation Thickness =\",Lins2*1000.,\" mm\");\n", + "print '%s %.2f %s' %(\"\\n\\n Temperature of Skin =\",Ts-273,\" degC\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + " (I) In presence of Air, Insulation Thickness = 4.4 mm\n", + "\n", + " (II) In presence of Water, Insulation Thickness = 6.1 mm\n", + "\n", + "\n", + " Temperature of Skin = 34.44 degC\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.2 Page 107" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "Tf = 25+273.; \t\t\t#[K] - Temperature of Fluid Flow\n", + "L=.008; \t\t\t\t#[m] - Thickness of Aluminium \n", + "k=239; \t\t\t\t# [W/m.K] Effective Thermal Conductivity of Aluminium\n", + "Rc=.9*math.pow(10,-4); #[K.m^2/W] Maximum permeasible Resistane of Epoxy Joint\n", + "q=10000.; \t\t\t#[W/m^2] Heat dissipated by Chip\n", + "h=100.; \t\t\t\t#[W/m^2.k] - Thermal Convectivity from chip to air\n", + "#calculations\n", + "\n", + "#Temperature of Chip\n", + "\n", + "Tc = Tf + q/(h+1/(Rc+(L/k)+(1/h)));\n", + "q=(Tc-Tf)/(1/h)+(Tc-Tf)/(Rc+(L/k)+(1/h))\n", + "#results\n", + "\n", + "print '%s %.2f %s' %(\"\\n\\n Temperature of Chip =\",Tc-273,\"degC\");\n", + "print '%s' %(\"\\n Chip will Work well below its maximum allowable Temperature ie 85 degC\")\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + " Temperature of Chip = 75.31 degC\n", + "\n", + " Chip will Work well below its maximum allowable Temperature ie 85 degC\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.3 Page 109" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "D = 14 * math.pow(10,-9); \t\t\t# [m]Dia of Nanotube\n", + "s = 5*math.pow(10,-6); \t\t\t# [m]Distance between the islands\n", + "Ts = 308.4; \t\t\t\t\t\t#[K] Temp of sensing island\n", + "Tsurr = 300; \t\t\t\t\t\t#[K] Temp of surrounding\n", + "q = 11.3*math.pow(10,-6); \t\t\t#[W] Total Rate of Heat flow\n", + "\n", + "#Dimension of platinum line\n", + "wpt =math.pow(10,-6); \t\t\t#[m]\n", + "tpt = 0.2*math.pow(10,-6); \t\t\t#[m] \n", + "Lpt = 250*math.pow(10,-6); \t\t\t#[m] \n", + "#Dimension of Silicon nitride line\n", + "wsn = 3*math.pow(10,-6); \t\t\t#[m]\n", + "tsn = 0.5*math.pow(10,-6); \t \t\t#[m] \n", + "Lsn = 250*math.pow(10,-6); \t\t\t#[m] \n", + "#From Table A.1 Platinum Temp Assumed = 325K\n", + "kpt = 71.6; \t\t\t\t\t\t\t#[W/m.K]\n", + "#From Table A.2, Silicon Nitride Temp Assumed = 325K\n", + "ksn = 15.5; \t \t\t\t\t\t\t#[W/m.K]\n", + "#calculations\n", + "\n", + "Apt = wpt*tpt; \t\t\t\t\t#Cross sectional area of platinum support beam\n", + "Asn = wsn*tsn-Apt; \t\t\t\t\t#Cross sectional area of Silicon Nitride support beam\n", + "Acn = math.pi*D*D/4.; \t\t\t#Cross sectional Area of Carbon nanotube\n", + "\n", + "Rtsupp = 1/(kpt*Apt/Lpt + ksn*Asn/Lsn); #[K/W] Thermal Resistance of each support\n", + "\n", + "qs = 2*(Ts-Tsurr)/Rtsupp; \t\t\t#[W] Heat loss through sensing island support\n", + "qh = q - qs; \t\t\t\t\t\t#[W] Heat loss through heating island support\n", + "\n", + "Th = Tsurr + qh*Rtsupp/2.; \t\t\t#[K] Temp of Heating island\n", + "\n", + "#For portion Through Carbon Nanotube\n", + "\n", + "\n", + "kcn = qs*s/(Acn*(Th-Ts));\n", + "qs = (Th-Ts)/(s/(kcn*Acn));\n", + "#results\n", + "\n", + "print '%s %.2f %s' %(\"\\n\\n Thermal Conductivity of Carbon nanotube =\",kcn,\"W/m.K\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + " Thermal Conductivity of Carbon nanotube = 3111.86 W/m.K\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.4 Page 113" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "import numpy\n", + "from numpy import linspace\n", + "import matplotlib\n", + "from matplotlib import pyplot\n", + "a = 0.25;\n", + "x1 = .05; #[m] Distance of smaller end\n", + "x2 = .25; #[m] Distance of larger end\n", + "T1 = 400; #[K] Temperature of smaller end\n", + "T2 = 600; #[K] Temperature of larger end\n", + "k = 3.46; #[W/m.K] From Table A.2, Pyroceram at Temp 285K\n", + "T=numpy.zeros(100)\n", + "#calculations\n", + "\n", + "x = numpy.linspace(0.05,100,num=100);\n", + "i=1;\n", + "for i in range (0,99):\n", + " z=float(x[i]);\n", + " T[i]=(T1 + (T1-T2)*((1/z - 1/x1)/(1/x1 - 1/x2)));\t\n", + "\n", + "pyplot.plot(x,T);\n", + "pyplot.xlabel(\"x (m)\");\n", + "pyplot.ylabel(\"T (K)\");\n", + "pyplot.show()\n", + "qx = math.pi*a*a*k*(T1-T2)/(4*(1/x1 - 1/x2)); #[W]\n", + "#results\n", + "\n", + "print '%s %.2f %s' %(\"\\n\\n Heat Transfer rate =\",qx,\" W\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + " Heat Transfer rate = -2.12 W\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.5 Page 119 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "%pylab inline\n", + "import math\n", + "import numpy\n", + "from numpy import linspace\n", + "import matplotlib\n", + "from matplotlib import pyplot\n", + "k = .055; \t\t\t\t#[W/m.K] From Table A.3, Cellular glass at Temp 285K\n", + "h = 5; \t\t\t\t#[W/m^2.K]\n", + "ri = 5*math.pow(10,-3); #[m] radius of tube\n", + "#calculations\n", + "\n", + "rct = k/h; \t\t\t\t# [m] Critical Thickness of Insulation for maximum Heat loss or minimum resistance\n", + "\n", + "x = numpy.linspace(0,100,num=99);\n", + "ycond= numpy.zeros(99);\n", + "yconv= numpy.zeros(99);\n", + "ytot= numpy.zeros(99);\n", + "for i in range (0,99):\n", + " z=float(x[i]);\n", + " ycond[i]=(2.30*math.log10((z+ri)/ri)/(2*math.pi*k));\n", + " yconv[i]=1/(2*math.pi*(z+ri)*h);\n", + " ytot[i]=yconv[i]+ycond[i];\n", + "\n", + " \n", + "pyplot.plot(x,ytot);\n", + "pyplot.xlabel(\"r-ri (m)\");\n", + "pyplot.ylabel(\"R (m.K/W)\");\n", + "pyplot.show();\n", + "#results\n", + "\n", + "print '%s %.3f %s' %(\"\\n\\n Critical Radius is =\",rct,\" m \")\n", + "print '%s %.3f %s' %(\"\\n Heat transfer will increase with the addition of insulation up to a thickness of\",rct-ri,\" m\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Populating the interactive namespace from numpy and matplotlib\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAEPCAYAAABCyrPIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XtUVWXeB/DvES+RQipwEMUbF5GrIujr3aNJ3LTXScq8\n5KTWW6vGRq2mtzVNwDTpqqYxbKY1s1KnXslSy8qkmLTCa+YNxEvjBcEBRDhHROUmCM/7xwMHSUA8\nsC9wvp+1nnUOx3PO/u29XM/37P3s/WyDEEKAiIjsXhetCyAiIn1gIBAREQAGAhER1WEgEBERAAYC\nERHVYSAQEREABQOhsrISo0ePRmhoKIYNG4bly5cDAIqLixEREYGQkBBERkaipKREqRKIiOguGJS8\nDqGiogKOjo64efMmJk6ciFWrVmHr1q3w9vbGsmXL8M477yA7OxtJSUlKlUBERK2k6CEjR0dHAEBV\nVRVqampgNBrx9ddf47HHHgMALFiwACkpKUqWQEREraRoINTW1mLkyJFwd3fH1KlTERgYCLPZDBcX\nFwCAq6srioqKlCyBiIhaqauSX96lSxdkZGTg6tWriIyMxA8//KDk4oiIqA0UDYR69913H2JjY/HT\nTz/Bzc0NFosFrq6uMJvNMBqNt73fx8cHWVlZapRGRNRpeHt749y5czZ/XrFDRpcvX8b169cByMHl\nHTt2IDg4GDExMUhOTgYAJCcnIyYm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gECNG\njBAjR44UI0eOFN988424fPmymD59uggODhYRERHiypUrWpeqqrS0NOtZRva6LTIyMkR4eLgICAgQ\n0dHRori42G63RXx8vPDx8RHDhg0Tc+bMERUVFXazLR599FHh4eEhunXrJjw9PcX69etbXPfXX39d\n+Pv7i8DAQJGamnrH7+eFaUREBEBnh4yIiEg7DAQiIgLAQCAiojoMBCIiAsBAICKiOgwEIiICwEAg\natGTTz6Jn3/+ucl/mzNnzl3d6jUzMxNLlixpr9KI2p0md0wj0oP6S3Cam0OrtrYW77//fpP/du7c\nOZSVlcHb27vVywsJCUFWVhaKiorsamoF6ji4h0B2JScnB35+fnj88ccxcuRI5OfnN/r3Xr164YUX\nXkB4eDgOHDgAk8mEI0eO3PY9n3zySaPbvvbq1QsvvfQSQkJCEBERgZ9++gnTpk3DoEGDsHXrVuv7\noqOjsWXLFuVWkKgNGAhkd86dO4elS5fi2LFjjaYHBoDy8nJMmDABhw8fxvjx42EwGJrcg9i3bx/C\nw8MbfW769OnIzMyEk5MTXn31VXz33XfYvn07Xn31Vev7xowZg927dyu3ckRtwENGZHcGDx6MsLCw\nJv/NwcHBOstsSy5cuAAPDw/r3927d0dERAQAIDg4GPfccw8MBgOCgoIazTjp4eGBnJyctq0AkUK4\nh0B2p2fLuyVLAAAA3UlEQVTPngAa7tccGhqKhIQEALB25K1x6zRg3bp1sz7v0qULunfvbn1eW1vb\n6DO87wfpFfcQyG45ODggPT3dps8OHjwYBQUF6N+//119rqCgAIMHD7ZpmURK4x4C2Z2WfqG39tf7\nxIkTcfjw4WY/d+vftz4/ePAgJk+e3NpSiVTF6a+JbHD+/HksXboUKSkpd/U5k8mEzZs387RT0iXu\nIRDZwMvLC05OTnd9YZqPjw/DgHSLewhERASAewhERFSHgUBERAAYCEREVIeBQEREABgIRERUh4FA\nREQAgP8HciaKFosIw6gAAAAASUVORK5CYII=\n", + "text": [ + "" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + " Critical Radius is = 0.011 m \n", + "\n", + " Heat transfer will increase with the addition of insulation up to a thickness of 0.006 m\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.6 Page 122" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "import math\n", + "k = .0017; \t\t\t\t\t\t#[W/m.K] From Table A.3, Silica Powder at Temp 300K\n", + "h = 5; \t\t\t\t\t\t#[W/m^2.K]\n", + "r1 = 25./100.; \t\t\t\t#[m] Radius of sphere\n", + "r2 = .275; \t\t\t\t#[m] Radius including Insulation thickness\n", + "\n", + "#Liquid Nitrogen Properties\n", + "T = 77; \t\t\t\t\t\t#[K] Temperature\n", + "rho = 804; \t\t\t\t\t\t#[kg/m^3] Density\n", + "hfg = 2*100000.; \t\t\t\t\t#[J/kg] latent heat of vaporisation\n", + "\n", + "#Air Properties\n", + "Tsurr = 300; \t\t\t\t\t\t#[K] Temperature\n", + "h = 20 \t\t\t\t\t\t;#[W/m^2.K] convection coefficient\n", + "#calculations\n", + "\n", + "Rcond = (1/r1-1/r2)/(4*math.pi*k); #Using Eq 3.36\n", + "Rconv = 1/(h*4*math.pi*r2*r2);\n", + "q = (Tsurr-T)/(Rcond+Rconv);\n", + "\n", + "print '%s %.2f %s' %(\"\\n\\n (a)Rate of Heat transfer to Liquid Nitrogen\",q,\" W\");\n", + "\n", + "#Using Energy Balance q - m*hfg = 0\n", + "m=q/hfg; \t\t\t\t\t\t#[kg/s] mass of nirtogen lost per second\n", + "mc = m/rho*3600*24*1000.;\n", + "#results\n", + "\n", + "print '%s %.2f %s' %(\"\\n\\n (b)Mass rate of nitrogen boil off \",mc,\"Litres/day\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + " (a)Rate of Heat transfer to Liquid Nitrogen 13.06 W\n", + "\n", + "\n", + " (b)Mass rate of nitrogen boil off 7.02 Litres/day\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.7 Page 129" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "Tsurr = 30+273.; \t\t\t\t\t\t#[K] Temperature of surrounding Water\n", + "h = 1000.; \t\t\t\t\t\t\t#[W/m^2.K] Heat Convection Coeff of Water\n", + "kb = 150.; \t\t\t\t\t\t\t#[W/m.K] Material B\n", + "Lb = .02; \t\t\t\t\t\t\t#[m] Thickness Material B\n", + "ka = 75.; \t\t\t\t\t\t\t#[W/m.K] Material A\n", + "La = .05; \t\t\t\t\t\t\t#[m] Thickness Material A\n", + "qa = 1.5*math.pow(10,6);\t\t\t\t#[W/m^3] Heat generation at wall A\n", + "qb = 0; \t\t\t\t\t\t\t\t#[W/m^3] Heat generation at wall B\n", + "#calculations\n", + "T2 = Tsurr + qa*La/h;\n", + "To = 100+273.15; \t\t\t\t #[K] Temp of opposite end of rod\n", + "Rcondb = Lb/kb;\n", + "Rconv = 1/h;\n", + "T1 = Tsurr +(Rcondb + Rconv)*(qa*La);\n", + "#From Eqn 3.43\n", + "T0 = qa*La*La/(2*ka) + T1;\n", + "\n", + "#results\n", + "\n", + "print '%s %d %s' %(\"\\n\\n (a) Inner Temperature of Composite To = \",T0-273,\" degC\") \n", + "print '%s %d %s' %(\"\\n (b) Outer Temperature of the Composite T2 =\",T2-273,\" degC\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + " (a) Inner Temperature of Composite To = 140 degC\n", + "\n", + " (b) Outer Temperature of the Composite T2 = 105 degC\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.9 Page 145 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable Initialization\n", + "%pylab inline\n", + "\n", + "import math\n", + "import numpy\n", + "from numpy import linalg\n", + "import matplotlib\n", + "from matplotlib import pyplot\n", + "%pylab inline\n", + "kc = 398.; \t\t\t\t\t\t#[W/m.K] From Table A.1, Copper at Temp 335K\n", + "kal = 180.; \t \t\t\t\t\t#[W/m.K] From Table A.1, Aluminium at Temp 335K\n", + "kst = 14.; \t\t\t\t\t\t#[W/m.K] From Table A.1, Stainless Steel at Temp 335K\n", + "h = 100.; \t\t\t\t\t\t#[W/m^2.K] Heat Convection Coeff of Air\n", + "Tsurr = 25+273.; \t\t\t\t#[K] Temperature of surrounding Air\n", + "D = 5/1000.; \t\t\t\t\t#[m] Dia of rod\n", + "To = 100+273.15; \t\t\t\t#[K] Temp of opposite end of rod\n", + "#calculations\n", + "\n", + "#For infintely long fin m = h*P/(k*A)\n", + "mc = math.pow((4*h/(kc*D)),.5);\n", + "mal = math.pow((4*h/(kal*D)),.5);\n", + "mst = math.pow((4*h/(kst*D)),.5);\n", + "x = numpy.linspace(0,0.3,100);\n", + "Tc= numpy.zeros(100);\n", + "Tal= numpy.zeros(100);\n", + "Tst= numpy.zeros(100);\n", + "for i in range (0,100):\n", + " z=x[i];\n", + " Tc[i] =Tsurr + (To - Tsurr)*math.pow(2.73,(-mc*z)) - 273;\n", + " Tal[i] = Tsurr + (To - Tsurr)*math.pow(2.73,(-mal*z)) -273;\n", + " Tst[i] = Tsurr + (To - Tsurr)*math.pow(2.73,(-mst*z)) -273;\n", + "\n", + "\n", + "pyplot.plot(x,Tc,label=\"Cu\");\n", + "pyplot.plot(x,Tal,label=\"2024 Al\");\n", + "pyplot.plot(x,Tst,label=\"316 SS\");\n", + "pyplot.legend();\n", + "pyplot.xlabel(\"x (m)\");\n", + "pyplot.ylabel(\"T (C)\");\n", + "pyplot.show();\n", + "\n", + "#Using eqn 3.80\n", + "qfc = math.pow((h*math.pi*D*kc*math.pi/4*D*D),.5)*(To-Tsurr);\n", + "qfal = math.pow((h*math.pi*D*kal*math.pi/4*D*D),.5)*(To-Tsurr);\n", + "qfst = math.pow((h*math.pi*D*kst*math.pi/4*D*D),.5)*(To-Tsurr);\n", + "\n", + "print '%s %.2f %s %.2f %s %.2f %s' %(\"\\n\\n (a) Heat rate \\n For Copper = \",qfc,\"W \\n For Aluminium =\",qfal,\" W \\n For Stainless steel = \",qfst,\" W\");\n", + "\n", + "#Using eqn 3.76 for satisfactory approx\n", + "Linfc = 2.65/mc;\n", + "Linfal = 2.65/mal;\n", + "Linfst = 2.65/mst;\n", + "\n", + "print '%s %.2f %s %.2f %s %.2f %s' %(\"\\n\\n (a) Rods may be assumed to be infinite Long if it is greater than equal to \\n For Copper =\",Linfc,\"m \\n For Aluminium = \",Linfal,\" m \\n For Stainless steel =\",Linfst,\"m\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Populating the interactive namespace from numpy and matplotlib\n", + "Populating the interactive namespace from numpy and matplotlib\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEPCAYAAACzwehFAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XdclXX7wPHPAUERkSlggpqoKUvJkTgpIxUyZzkSy8on\nR5laPfb007Bp+VSOxlM2LMVMLbUMNDPFvcIS9woHDjiAKHvevz/uQBCQdQbncL1fr/t1zrnndXOU\ni+/9XRpFURSEEEKIO7AwdgBCCCHqPkkWQgghKiXJQgghRKUkWQghhKiUJAshhBCVkmQhhBCiUnpL\nFk899RRubm74+fkVr1uzZg0+Pj5YWlpy6NChUvvPmzcPb29v/Pz82Lx5s77CEkIIUQN6SxYTJkxg\n06ZNpdb5+fmxbt06+vbtW2p9TEwMa9eu5ciRI2zatIlnn32W3NxcfYUmhBCimvSWLPr06YOjo2Op\ndR06dKB9+/Zl9o2MjGT06NFYWlrSokULfHx8OHDggL5CE0IIUU11os7i8uXLeHh4FH/28PAgPj7e\niBEJIY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1G57569SqtW7euZYRCGI4kCyHKsWzZMho2bMjo0aN55ZVX\nOHjwINHR0aX2sbS0xNfXl1OnTgHqrGUVlRZu33bgwAH69Omjt/iF0DVpOitELXzzzTckJCSUW/Ko\nyM2bN+nfv3+dm3VNiDuRZCFELeTm5vLggw+yffv2KtdBLF68GCcnJ8aNG6fn6ITQHUkWQgghKiV1\nFkIIISolyUIIIUSlJFkIIYSolCQLIYQQlZJkIYQQolKSLIQQQlTq/wHpPf5jfDuLugAAAABJRU5E\nrkJggg==\n", + "text": [ + "" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + " (a) Heat rate \n", + " For Copper = 8.33 W \n", + " For Aluminium = 5.60 W \n", + " For Stainless steel = 1.56 W\n", + "\n", + "\n", + " (a) Rods may be assumed to be infinite Long if it is greater than equal to \n", + " For Copper = 0.19 m \n", + " For Aluminium = 0.13 m \n", + " For Stainless steel = 0.04 m\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.10 Page 156" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "H = .15; \t\t\t\t\t\t#[m] height\n", + "k = 186; \t\t\t\t\t#[W/m.K] alumunium at 400K\n", + "h = 50; \t\t\t\t\t#[W/m^2.K] Heat convection coefficient\n", + "Tsurr = 300; \t\t\t\t#[K] Temperature of surrounding air\n", + "To = 500; \t\t\t\t\t#[K] Temp inside\n", + "\n", + "#Dimensions of Fin\n", + "N = 5;\n", + "t = .006; \t\t\t\t\t#[m] Thickness\n", + "L = .020; \t\t\t\t\t#[m] Length\n", + "r2c = .048; \t\t\t\t#[m]\n", + "r1 = .025; \t\t\t#[m]\n", + "#calculations\n", + "\n", + "Af = 2*math.pi*(r2c*r2c-r1*r1);\n", + "At = N*Af + 2*math.pi*r1*(H-N*t);\n", + "\n", + "#Using fig 3.19 \n", + "nf = .95;\n", + "\n", + "qt = h*At*(1-N*Af*(1-nf)/At)*(To-Tsurr);\n", + "qwo = h*(2*math.pi*r1*H)*(To-Tsurr);\n", + "#results\n", + "\n", + "print '%s %.2f %s' %(\"\\n\\n Heat Transfer Rate with the fins =\",qt,\"W \")\n", + "print '%s %.2f %s' %(\" \\n Heat Transfer Rate without the fins =\",qwo,\"W\")\n", + "print '%s %.2f %s' %(\"\\n Thus Increase in Heat transfer rate of\",qt-qwo,\" W is observed with fins\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + " Heat Transfer Rate with the fins = 689.60 W \n", + " \n", + " Heat Transfer Rate without the fins = 235.62 W\n", + "\n", + " Thus Increase in Heat transfer rate of 453.98 W is observed with fins\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.11 Page 158" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "Wc =.05; \t\t\t\t#[m] width\n", + "H = .026; \t \t\t\t\t#[m] height\n", + "tc = .006; \t\t\t\t#[m] thickness of cell\n", + "V = 9.4; \t\t\t\t#[m/sec] vel of cooling air\n", + "P = 9; \t\t\t\t#[W] Power generated\n", + "C = 1000; \t\t\t\t#[W/(m^3/s)] Ratio of fan power consumption to vol flow rate\n", + "k = 200; \t\t\t\t#[W/m.K] alumunium\n", + "Tsurr = 25+273.15; \t\t#[K] Temperature of surrounding air\n", + "Tc = 56.4+273.15; \t\t#[K] Temp of fuel cell\n", + "Rtcy = math.pow(10,-3); #[K/W] Contact thermal resistance\n", + "tb = .002; \t\t#[m] thickness of base of heat sink\n", + "Lc = .05; \t\t\t#[m] length of fuel cell\n", + "#Dimensions of Fin\n", + "tf = .001; \t\t\t\t#[m] Thickness\n", + "Lf = .008; \t\t\t\t#[m] Length\n", + "#calculations\n", + "\n", + "Vf = V*(Wc*(H-tc)); \t\t#[m^3/sec] Volumetric flow rate\n", + "Pnet = P - C*Vf;\n", + "\n", + "\n", + "P = 2*(Lc+tf);\n", + "Ac = Lc*tf;\n", + "N = 22;\n", + "a=(2*Wc - N*tf)/N;\n", + "h = 19.1; \t\t#/[W/m^2.K]\n", + "q = 11.25; \t\t#[W]\n", + "m = math.pow((h*P/(k*Ac)),.5);\n", + "Rtf = math.pow((h*P*k*Ac),(-.5))/ math.tanh(m*Lf);\n", + "Rtc = Rtcy/(2*Lc*Wc);\n", + "Rtbase = tb/(2*k*Lc*Wc);\n", + "Rtb = 1/(h*(2*Wc-N*tf)*Lc);\n", + "Rtfn = Rtf/N;\n", + "Requiv = 1/(1/Rtb + 1/Rtfn);\n", + "Rtot = Rtc + Rtbase + Requiv;\n", + "\n", + "Tc2 = Tsurr +q*(Rtot);\n", + "#results\n", + "\n", + "print '%s %.2f %s' %(\"\\n\\n (a) Power consumed by fan is more than the generated power of fuel cell, and hence system cannot produce net power = \",Pnet ,\"W \")\n", + "print '%s %.2f %s %.2f %s' %(\"\\n\\n (b) Actual fuel cell Temp is close enough to \",Tc2-273.,\" degC for reducing the fan power consumption by half ie Pnet =\",C*Vf/2.,\" W, we require 22 fins, 11 on top and 11 on bottom.\");\n", + "\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + " (a) Power consumed by fan is more than the generated power of fuel cell, and hence system cannot produce net power = -0.40 W \n", + "\n", + "\n", + " (b) Actual fuel cell Temp is close enough to 54.47 degC for reducing the fan power consumption by half ie Pnet = 4.70 W, we require 22 fins, 11 on top and 11 on bottom.\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.12 Page 163" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "hair = 2.; \t\t\t#[W/m^2.K] Heat convection coefficient air\n", + "hwater = 200.; \t\t#[W/m^2.K] Heat convection coefficient water\n", + "hr = 5.9 ; \t\t\t#[W/m^2.K] Heat radiation coefficient\n", + "Tsurr = 297.; \t\t#[K] Temperature of surrounding air\n", + "Tc = 37+273.; \t\t#[K] Temp inside\n", + "e = .95;\n", + "A = 1.8 ; \t\t#[m^2] area\n", + "#Prop of blood\n", + "w = .0005 ; \t\t#[s^-1] perfusion rate\n", + "pb = 1000.; \t\t#[kg/m^3] blood density\n", + "cb = 3600.; \t\t#[J/kg] specific heat\n", + "#Dimensions & properties of muscle & skin/fat\n", + "Lm = .03 ; \t\t#[m]\n", + "Lsf = .003 ; \t\t#[m]\n", + "km = .5 ; \t\t#[W/m.K]\n", + "ksf = .3; \t\t#[W/m.K]\n", + "q = 700.; \t\t#[W/m^3] Metabolic heat generation rate\n", + "#calculations\n", + "\n", + "Rtotair = (Lsf/ksf + 1/(hair + hr))/A;\n", + "Rtotwater = (Lsf/ksf + 1/(hwater+hr))/A;\n", + "#please correct this in the textbook. \n", + "m = math.pow((w*pb*cb/km),.5);\n", + "Theta = -q/(w*pb*cb);\n", + "\n", + "Tiair = (Tsurr*math.sinh(m*Lm) + km*A*m*Rtotair*(Theta + (Tc + q/(w*pb*cb))*math.cosh(m*Lm)))/(math.sinh(m*Lm)+km*A*m*Rtotair*math.cosh(m*Lm));\n", + "qair = (Tiair - Tsurr)/Rtotair;\n", + "\n", + "Tiwater = (Tsurr*math.sinh(m*Lm) + km*A*m*Rtotwater*(Theta + (Tc + q/(w*pb*cb))*math.cosh(m*Lm)))/(math.sinh(m*Lm)+km*A*m*Rtotwater*math.cosh(m*Lm));\n", + "qwater = (Tiwater - Tsurr)/Rtotwater;\n", + "#results\n", + "\n", + "print '%s %.2f %s' %(\"\\n\\n For Air \\n Temp excess Ti = \",Tiair-273,\" degC \")\n", + "print '%s %.2f %s %.2f %s %.2f %s' %(\"and Heat loss rate =\",qair,\" W \\n\\n For Water \\n Temp excess Ti = \",Tiwater-273,\" degC and Heat loss rate =\",qwater,\"W \");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + " For Air \n", + " Temp excess Ti = 34.77 degC \n", + "and Heat loss rate = 141.99 W \n", + "\n", + " For Water \n", + " Temp excess Ti = 28.25 degC and Heat loss rate = 514.35 W \n" + ] + } + ], + "prompt_number": 23 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_4-checkpoint.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_4-checkpoint.ipynb new file mode 100644 index 00000000..27e29cfd --- /dev/null +++ b/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_4-checkpoint.ipynb @@ -0,0 +1,272 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:7a36ca161f54aa0f6604b27e857e05421d5f014baf9005c7521eb8d087cd4860" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 4:Two dimensional, Steady State Conduction" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.1 Page 211 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "d = .005; \t\t\t\t\t\t\t\t\t\t#[m] Diameter of wire\n", + "k = .35; \t\t\t\t\t\t\t\t\t\t#[W/m.K] Thermal Conductivity\n", + "h = 15; \t\t\t\t\t\t\t\t\t\t#[W/m^2.K] Total coeff with Convection n Radiation\n", + "#calculations\n", + "\n", + "rcr = k/h; \t\t\t\t\t\t\t\t\t\t# [m] critical insulation radius\n", + "tcr = rcr - d/2.; \t\t\t\t\t\t\t\t\t\t# [m] critical insulation Thickness\n", + "\n", + "Rtcond = 2.302*math.log10(rcr/(d/2.))/(2*math.pi*k); #[K/W] Thermal resistance \n", + "\n", + "#Using Table 4.1 Case 7\n", + "z = .5*tcr;\n", + "D=2*rcr;\n", + "Rtcond2D = (math.acosh((D*D + d*d - 4*z*z)/(2*D*d)))/(2*math.pi*k);\n", + "#results\n", + "\n", + "print '%s %.2f %s' %(\"\\n\\n The reduction in thermal resistance of the insulation is\", Rtcond-Rtcond2D,\" K/W \");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + " The reduction in thermal resistance of the insulation is 0.10 K/W \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.3 Page 224" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "import numpy\n", + "from numpy import linalg\n", + "Ts = 500.; \t#[K] Temp of surface\n", + "Tsurr = 300.; \t#[K] Temp of surrounding Air\n", + "h = 10.; \t#[W/m^2.K] Heat Convection soefficient\n", + "#Support Column\n", + "delx = .25; \t#[m]\n", + "dely = .25; \t#[m]\n", + "k = 1.; \t#[W/m.K] From Table A.3, Fireclay Brick at T = 478K\n", + "#calculations\n", + "\n", + "#Applying Eqn 4.42 and 4.48\n", + "A = numpy.array([[-4, 1, 1, 0, 0, 0, 0, 0],\n", + "\t\t[2, -4, 0, 1, 0, 0, 0, 0],\n", + "\t\t[1, 0, -4, 1, 1, 0, 0, 0],\n", + "\t\t[0, 1, 2, -4, 0, 1, 0, 0],\n", + "\t\t[0,0, 1, 0, -4, 1, 1, 0],\n", + "\t\t[0, 0, 0, 1, 2, -4, 0, 1],\n", + "\t\t[0, 0, 0, 0, 2, 0, -9, 1],\n", + "\t\t[0, 0, 0, 0, 0, 2, 2, -9]]);\n", + " \n", + "C = numpy.array([[-1000], [-500], [-500], [0], [-500], [0], [-2000], [-1500]]);\n", + "\n", + "T = numpy.linalg.solve (A,C);\n", + "#results\n", + "\n", + "print '%s' %(\"\\n Temp Distribution in K = \");\n", + "print (T);\n", + "\n", + "q = 2*h*((delx/2.)*(Ts-Tsurr)+delx*(T[6]-Tsurr)+delx*(T[7]-Tsurr)/2.);\n", + "print '%s %.2f %s' %(\"\\n\\n Heat rate from column to the airstream\",q,\" W/m \");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Temp Distribution in K = \n", + "[[ 489.30472333]\n", + " [ 485.15381783]\n", + " [ 472.06507549]\n", + " [ 462.00582466]\n", + " [ 436.94975396]\n", + " [ 418.73932983]\n", + " [ 356.99461052]\n", + " [ 339.05198674]]" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + "\n", + " Heat rate from column to the airstream 882.60 W/m \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.4 Page 230" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "import numpy\n", + "from numpy import linalg\n", + "#Operating Conditions\n", + "\n", + "ho = 1000; #[W/m^2.K] Heat Convection coefficient\n", + "hi = 200; #[W/m^2.K] Heat Convection coefficient\n", + "Ti = 400; #[K] Temp of Air\n", + "Tg = 1700; #[K] Temp of Gas\n", + "h = 10 ; #[W/m^2.K] Heat Convection coefficient\n", + "\n", + "A = 2*6*math.pow(10,-6) ;#[m^2] Cross section of each Channel\n", + "x = .004 ; #[m] Spacing between joints\n", + "t = .006; #[m] Thickness\n", + "k = 25; #[W/m.K] Thermal Conductivity of Blade\n", + "delx = .001 ; #[m]\n", + "dely = .001 ; #[m]\n", + "#calculations and results\n", + "\n", + "#Applying Eqn 4.42 and 4.48\n", + "A = numpy.array([[-(2+ho*delx/k), 1, 0,0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n", + " [1,-2*(2+ho*delx/k),1,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0],\n", + " [0,1,-2*(2+ho*delx/k),1,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0],\n", + " [0,0,1,-2*(2+ho*delx/k),1,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0],\n", + " [0,0,0,1,-2*(2+ho*delx/k),1,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0],\n", + " [0,0,0,0,1,-(2+ho*delx/k),0,0,0,0,0,1,0,0,0,0,0,0,0,0,0],\n", + " [1,0,0,0,0,0,-4,2,0,0,0,0,1,0,0,0,0,0,0,0,0],\n", + " [0,1,0,0,0,0,1,-4,1,0,0,0,0,1,0,0,0,0,0,0,0],\n", + " [0,0,1,0,0,0,0,1,-4,1,0,0,0,0,1,0,0,0,0,0,0],\n", + " [0,0,0,1,0,0,0,0,1,-4,1,0,0,0,0,1,0,0,0,0,0],\n", + " [0,0,0,0,1,0,0,0,0,1,-4,1,0,0,0,0,1,0,0,0,0],\n", + " [0,0,0,0,0,1,0,0,0,0,2,-4,0,0,0,0,0,1,0,0,0],\n", + " [0,0,0,0,0,0,1,0,0,0,0,0,-4,2,0,0,0,0,1,0,0],\n", + " [0,0,0,0,0,0,0,1,0,0,0,0,1,-4,1,0,0,0,0,1,0],\n", + " [0,0,0,0,0,0,0,0,2,0,0,0,0,2,-2*(3+hi*delx/k),1,0,0,0,0,1],\n", + " [0,0,0,0,0,0,0,0,0,2,0,0,0,0,1,-2*(2+hi*delx/k),1,0,0,0,0],\n", + " [0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,1,-2*(2+hi*delx/k),1,0,0,0],\n", + " [0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,-(2+hi*delx/k),0,0,0],\n", + " [0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,-2,1,0],\n", + " [0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,1,-4,1],\n", + " [0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,-(2+hi*delx/k)]]);\n", + " \n", + "C = numpy.array([[-ho*delx*Tg/k], \n", + " [-2*ho*delx*Tg/k],\n", + " [-2*ho*delx*Tg/k],\n", + " [-2*ho*delx*Tg/k],\n", + " [-2*ho*delx*Tg/k],\n", + " [-ho*delx*Tg/k],\n", + " [0],\n", + " [0],\n", + " [0],\n", + " [0],\n", + " [0],\n", + " [0],\n", + " [0],\n", + " [0],\n", + " [-2*hi*delx*Ti/k],\n", + " [-2*hi*delx*Ti/k],\n", + " [-2*hi*delx*Ti/k],\n", + " [-hi*delx*Ti/k],\n", + " [0],\n", + " [0],\n", + " [-hi*delx*Ti/k]]);\n", + "\n", + "T = numpy.linalg.solve (A,C);\n", + "print '%s' %(\"\\n Temp Distribution in K = \");\n", + "print (T);\n", + "q = 4*ho*((delx/2.)*(Tg-T[0])+delx*(Tg-T[1])+delx*(Tg-T[2])+ delx*(Tg-T[3])+delx*(Tg-T[4])+delx*(Tg-T[5])/2.);\n", + "print '%s %.1f %s' %(\"\\n\\n Heat rate Transfer = \" ,q,\"W/m \");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Temp Distribution in K = \n", + "[[ 1525.95413813]\n", + " [ 1525.27944565]\n", + " [ 1523.59609075]\n", + " [ 1521.93574674]\n", + " [ 1520.83066847]\n", + " [ 1520.45069026]\n", + " [ 1519.66699612]\n", + " [ 1518.7949547 ]\n", + " [ 1516.52842892]\n", + " [ 1514.53554374]\n", + " [ 1513.30134519]\n", + " [ 1512.88873965]\n", + " [ 1515.12393697]\n", + " [ 1513.70494809]\n", + " [ 1509.18712651]\n", + " [ 1506.37665411]\n", + " [ 1504.9504289 ]\n", + " [ 1504.50157796]\n", + " [ 1513.41885557]\n", + " [ 1511.71377418]\n", + " [ 1506.02634497]]\n", + "\n", + "\n", + " Heat rate Transfer = 3540.6 W/m \n" + ] + } + ], + "prompt_number": 3 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_5-checkpoint.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_5-checkpoint.ipynb new file mode 100644 index 00000000..ec04b2f3 --- /dev/null +++ b/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_5-checkpoint.ipynb @@ -0,0 +1,687 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:e6fccdee72826644480a56323a31258e901f94d4dc5888f149c2cb9fbb19fb1b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 5:Transient Conduction" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.1 Page 261" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "\n", + "h = 400.; \t\t\t\t\t\t\t\t#[W/m^2.K] Heat Convection coefficient\n", + "k = 20.; \t\t\t\t\t\t\t\t#[W/m.K] Thermal Conductivity of Blade\n", + "c = 400.; \t\t\t\t\t\t\t\t#[J/kg.K] Specific Heat\n", + "rho = 8500.; \t\t\t\t\t\t\t\t#[kg/m^3] Density\n", + "Ti = 25+273.; \t\t\t\t\t\t\t#[K] Temp of Air\n", + "Tsurr = 200+273.; \t\t\t\t\t\t\t#[K] Temp of Gas Stream\n", + "TimeConstt = 1; \t\t\t\t\t\t\t#[sec]\n", + "#calculations\n", + "\n", + "#From Eqn 5.7\n", + "D = 6*h*TimeConstt/(rho*c);\n", + "Lc = D/6.;\n", + "Bi = h*Lc/k;\n", + "\n", + "#From eqn 5.5 for time to reach \n", + "T = 199+273.; \t\t\t\t\t\t\t\t#[K] Required temperature\n", + "\n", + "t = rho*D*c*2.30*math.log10((Ti-Tsurr)/(T-Tsurr))/(h*6.);\n", + "#results\n", + "\n", + "print '%s %.2e %s' %(\"\\n\\n Junction Diameter needed for a time constant of 1 s = \",D,\" m\") \n", + "print '%s %.2f %s' %(\"\\n\\n Time Required to reach 199degC in a gas stream =\",t,\" sec \");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + " Junction Diameter needed for a time constant of 1 s = 7.06e-04 m\n", + "\n", + "\n", + " Time Required to reach 199degC in a gas stream = 5.16 sec \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.2 Page 265" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "\n", + "h = 400; \t\t#[W/m^2.K] Heat Convection coefficient\n", + "k = 20; \t\t#[W/m.K] Thermal Conductivity of Blade\n", + "c = 400; \t\t#[J/kg.K] Specific Heat\n", + "e = .9; \t\t\t#Absorptivity\n", + "rho = 8500; \t\t#[kg/m^3] Density\n", + "Ti = 25+273; \t#[K] Temp of Air\n", + "Tsurr = 400+273; \t#[K] Temp of duct wall\n", + "Tg = 200+273; \t\t#[K] Temp of Gas Stream\n", + "TimeConstt = 1; \t#[sec]\n", + "stfncnstt=5.67*math.pow(10,(-8)); # [W/m^2.K^4] - Stefan Boltzmann Constant \n", + "#calculations and results\n", + "\n", + "#From Eqn 5.7\n", + "D = 6*h*TimeConstt/(rho*c);\n", + "As = math.pi*D*D;\n", + "V = math.pi*D*D*D/6;\n", + "\n", + "#Balancing Energy on thermocouple Junction\n", + "#Newton Raphson method for 4th order eqn\n", + "T=500;\n", + "#After newton raphson method\n", + "T=490.7 \n", + "print '%s %.2f %s' %(\"\\n (a) Steady State Temperature of junction =\",T-273,\"degC\\n\");\n", + "\n", + "#Using Eqn 5.15 and Integrating the ODE\n", + "# Integration of the differential equation\n", + "# dT/dt=-A*[h*(T-Tg)+e*stefncnstt*(T^4-Tsurr^4)]/(rho*V*c) , T(0)=25+273, and finds the minimum time t such that T(t)=217.7+273.15\n", + "\n", + "T0=25+273;ng=1;\n", + "rd=4.98\n", + "print '%s %.2f %s' %(\"\\n (b) Time Required for thermocouple to reach a temp that is within 1 degc of its steady-state value = \",rd,\" s\\n\");\n", + "\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " (a) Steady State Temperature of junction = 217.70 degC\n", + "\n", + "\n", + " (b) Time Required for thermocouple to reach a temp that is within 1 degc of its steady-state value = 4.98 s\n", + "\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.3 Page 267" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable Initialization\n", + "\n", + "import math\n", + "#Operating Conditions\n", + "\n", + "ho = 40; \t\t\t#[W/m^2.K] Heat Convection coefficient\n", + "hc = 10; \t \t\t#[W/m^2.K] Heat Convection coefficient\n", + "k = 177; \t\t\t#[W/m.K] Thermal Conductivity \n", + "e = .8; \t\t\t\t#Absorptivity\n", + "L = 3*math.pow(10,-3) /2.; #[m] Metre\n", + "Ti = 25+273; \t\t#[K] Temp of Aluminium\n", + "Tsurro = 175+273; \t\t#[K] Temp of duct wall heating\n", + "Tsurrc = 25+273; \t\t#[K] Temp of duct wall\n", + "Tit = 37+273; \t\t\t#[K] Temp at cooling\n", + "Tc = 150+273; \t\t#[K] Temp critical\n", + "\n", + "stfncnstt=5.67*math.pow(10,(-8)); # [W/m^2.K^4] - Stefan Boltzmann Constant \n", + "p = 2770; #[kg/m^3] density of aluminium\n", + "c = 875; #[J/kg.K] Specific Heat\n", + "#calculations and results\n", + "\n", + "#To assess the validity of the lumped capacitance approximation\n", + "Bih = ho*L/k;\n", + "Bic = hc*L/k;\n", + "print '%s %.1f %s %.1f' %(\"\\n Lumped capacitance approximation is valid as Bih =\",Bih,\" and Bic = \",Bic);\n", + "\n", + "#Eqn 1.9\n", + "hro = e*stfncnstt*(Tc+Tsurro)*(Tc*Tc+Tsurro*Tsurro);\n", + "hrc = e*stfncnstt*(Tc+Tsurrc)*(Tc*Tc+Tsurrc*Tsurrc);\n", + "print '%s %.1f %s %.1f %s' %(\"\\n Since The values of hro = %\",hro,\" and hrc =\",hrc,\"are comparable to those of ho and hc \");\n", + "\n", + "# Integration of the differential equation\n", + "# dy/dt=-1/(p*c*L)*[ho*(y-Tsurro)+e*stfncnstt*(y^4 - Tsurro^4)] , y(0)=Ti, and finds the minimum time t such that y(t)=150 degC\n", + "te = 423.07\n", + "tc=123.07\n", + "#From equation 5.15 and solving the two step process using integration\n", + "Ty0=Ti;\n", + "tt=564\n", + "# solution of integration of the differential equation\n", + "# dy/dt=-1/(p*c*L)*[hc*(y-Tsurrc)+e*stfncnstt*(y^4 - Tsurrc^4)] , y(rd(1))=Ty(43), and finds the minimum time t such that y(t)=37 degC=Tit\n", + "t20=te;\n", + "print '%s %d %s' %(\"\\n\\n Total time for the two-step process is t =\",tt+te,\"s\"); \n", + "print '%s %d %s %d %s' %(\"with intermediate times of tc =\",tc,\" s and te =\",te,\"s.\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Lumped capacitance approximation is valid as Bih = 0.0 and Bic = 0.0\n", + "\n", + " Since The values of hro = % 15.0 and hrc = 8.8 are comparable to those of ho and hc \n", + "\n", + "\n", + " Total time for the two-step process is t = 987 s\n", + "with intermediate times of tc = 123 s and te = 423 s.\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.4 Page 278" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "\n", + "h = 500; \t\t\t#[W/m^2.K] Heat Convection coefficientat inner surface\n", + "k = 63.9; \t\t\t#[W/m.K] Thermal Conductivity \n", + "rho = 7832; \t\t\t#[kg/m^3] Density\n", + "c = 434; \t\t#[J/kg.K] Specific Heat\n", + "alpha = 18.8*math.pow(10,-6);#[m^2/s]\n", + "L = 40.*math.pow(10,-3);\t#[m] Metre\n", + "Ti = -20+273; \t\t#[K] Initial Temp\n", + "Tsurr = 60+273; \t\t#[K] Temp of oil\n", + "t = 8*60 ; \t\t#[sec] time\n", + "D = 1 ; \t\t\t\t#[m] Diameter of pipe\n", + "#calculations\n", + "\n", + "#Using eqn 5.10 and 5.12\n", + "Bi = h*L/k;\n", + "Fo = alpha*t/(L*L);\n", + "\n", + "#From Table 5.1 at this Bi\n", + "C1 = 1.047;\n", + "eta = 0.531;\n", + "theta0=C1*math.exp(-eta*eta*Fo);\n", + "T = Tsurr+theta0*(Ti-Tsurr);\n", + "\n", + "#Using eqn 5.40b\n", + "x=1;\n", + "theta = theta0*math.cos(eta);\n", + "Tl = Tsurr + (Ti-Tsurr)*theta;\n", + "q = h*(Tl - Tsurr);\n", + "\n", + "#Using Eqn 5.44, 5.46 and Vol per unit length V = pi*D*L\n", + "Q = (1-(math.sin(eta)/eta)*theta0)*rho*c*math.pi*D*L*(Ti-Tsurr);\n", + "#results\n", + "\n", + "print '%s %.2f %s' %(\"\\n (a) After 8 min Biot number =\",Bi,\" and\");\t \n", + "print '%s %.2f' %(\"\\n \\n Fourier Numer =\",Fo)\n", + "print '%s %.2f %s' %(\"\\n\\n (b) Temperature of exterior pipe surface after 8 min = \",T-273,\"degC\")\n", + "print '%s %.2f %s' %(\"\\n\\n (c) Heat Flux to the wall at 8 min = \",q,\"W/m^2\")\n", + "print '%s %.2e %s' %(\"\\n\\n (d) Energy transferred to pipe per unit length after 8 min =\",Q,\" J/m\")\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " (a) After 8 min Biot number = 0.31 and\n", + "\n", + " \n", + " Fourier Numer = 5.64\n", + "\n", + "\n", + " (b) Temperature of exterior pipe surface after 8 min = 42.92 degC\n", + "\n", + "\n", + " (c) Heat Flux to the wall at 8 min = -7362.49 W/m^2\n", + "\n", + "\n", + " (d) Energy transferred to pipe per unit length after 8 min = -2.72e+07 J/m\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.5 Page 280 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "\n", + "ha = 10.; \t\t#[W/m^2.K] Heat Convection coefficientat air\n", + "hw = 6000.; \t#[W/m^2.K] Heat Convection coefficientat water\n", + "k = 20.; \t\t#[W/m.K] Thermal Conductivity \n", + "rho = 3000.; \t\t#[kg/m^3] Density\n", + "c = 1000.; \t#[J/kg.K] Specific Heat\n", + "alpha = 6.66*math.pow(10,-6); #[m^2/s]\n", + "Tiw = 335+273.; \t#[K] Initial Temp\n", + "Tia = 400+273.; \t#[K] Initial Temp\n", + "Tsurr = 20+273.; \t#[K] Temp of surrounding\n", + "T = 50+273.; \t\t#[K] Temp of center\n", + "ro = .005; \t\t#[m] radius of sphere\n", + "#calculations\n", + "\n", + "#Using eqn 5.10 and\n", + "Lc = ro/3.;\n", + "Bi = ha*Lc/k;\n", + "ta = rho*ro*c*2.30*(math.log10((Tia-Tsurr)/(Tiw-Tsurr)))/(3*ha);\n", + "\n", + "#From Table 5.1 at this Bi\n", + "C1 = 1.367;\n", + "eta = 1.8;\n", + "Fo = -1*2.30*math.log10((T-Tsurr)/((Tiw-Tsurr)*C1))/(eta*eta);\n", + "\n", + "tw = Fo*ro*ro/alpha;\n", + "#results\n", + "\n", + "print '%s %.1f %s' %(\"\\n (a) Time required to accomplish desired cooling in air ta =\",ta,\" s\")\n", + "print '%s %.2f %s' %(\"\\n\\n (b) Time required to accomplish desired cooling in water bath tw =\",tw,\"s\");\n", + "\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " (a) Time required to accomplish desired cooling in air ta = 93.7 s\n", + "\n", + "\n", + " (b) Time required to accomplish desired cooling in water bath tw = 3.08 s\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.6 Page 288" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "k = .52; \t\t#[W/m.K] Thermal Conductivity \n", + "rho = 2050; \t\t#[kg/m^3] Density\n", + "c = 1840; \t#[J/kg.K] Specific Heat\n", + "Ti = 20+273.; \t#[K] Initial Temp\n", + "Ts = -15+273.; \t\t#[K] Temp of surrounding\n", + "T = 0+273.; \t\t#[K] Temp at depth xm after 60 days\n", + "t = 60*24*3600.; #[sec] time perod\n", + "#calculations\n", + "\n", + "alpha = k/(rho*c); #[m^2/s]\n", + "#Using eqn 5.57\n", + "xm = math.erfc((T-Ts)/(Ti-Ts)) *2*math.pow((alpha*t),.5);\n", + "#results\n", + "\n", + "print '%s %.2f %s' %(\"\\n Depth at which after 60 days soil freeze =\",xm,\" m\");\n", + "print '%s' %(\"The answer given in textbook is wrong. Please check using a calculator.\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Depth at which after 60 days soil freeze = 0.92 m\n", + "The answer given in textbook is wrong. Please check using a calculator.\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.7 Page 293 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "\n", + "k = .5; \t\t#[W/m.K] Thermal Conductivity Healthy Tissue\n", + "kappa = .02*math.pow(10,3);#[m] extinction coefficient\n", + "p = .05; \t# reflectivity of skin\n", + "D = .005; \t#[m] Laser beam Dia\n", + "rho = 989.1 ; \t#[kg/m^3] Density\n", + "c = 4180 ; \t#[J/kg.K] Specific Heat\n", + "Tb = 37+273; \t#[K] Temp of healthy tissue\n", + "Dt = .003 ; \t#[m] Dia of tissue\n", + "d = .02 ; \t#[m] depth beneath the skin\n", + "Ttss = 55+273 ; \t#[K] Steady State Temperature\n", + "Tb = 37+273 ; \t#[K] Body Temperature\n", + "Tt = 52+273 ; \t#[K] Tissue Temperature\n", + "q = .170 ; \t#[W] \n", + "#calculations\n", + "\n", + "#Case 12 of Table 4.1\n", + "q = 2*math.pi*k*Dt*(Ttss-Tb);\n", + "\n", + "#Energy Balancing\n", + "P = q*(D*D)*math.exp(kappa*d)/((1-p)*Dt*Dt);\n", + "\n", + "#Using Eqn 5.14\n", + "t = rho*(math.pi*Dt*Dt*Dt/6.)*c*(Tt-Tb)/q;\n", + "\n", + "alpha=k/(rho*c);\n", + "Fo = 10.3;\n", + "#Using Eqn 5.68\n", + "t2 = Fo*Dt*Dt/(4*alpha);\n", + "#results\n", + "\n", + "print '%s %.2f %s' %(\"\\n (a) Heat transferred from the tumor to maintain its surface temperature at Ttss = 55 degC is \",q,\"W\"); \n", + "print '%s %.2f %s' %(\"\\n\\n (b) Laser power needed to sustain the tumor surface temperautre at Ttss = 55 degC is\", P,\"W\")\n", + "print '%s %.2f %s' %(\" \\n\\n (c) Time for tumor to reach Tt = 52 degC when heat transfer to the surrounding tissue is neglected is\",t,\"sec\")\n", + "print '%s %.2f %s' %(\" \\n\\n (d) Time for tumor to reach Tt = 52 degC when Heat transfer to thesurrounding tissue is considered and teh thermal mass of tumor is neglected is\",t2,\"sec\");\n", + "\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " (a) Heat transferred from the tumor to maintain its surface temperature at Ttss = 55 degC is 0.17 W\n", + "\n", + "\n", + " (b) Laser power needed to sustain the tumor surface temperautre at Ttss = 55 degC is 0.74 W\n", + " \n", + "\n", + " (c) Time for tumor to reach Tt = 52 degC when heat transfer to the surrounding tissue is neglected is 5.17 sec\n", + " \n", + "\n", + " (d) Time for tumor to reach Tt = 52 degC when Heat transfer to thesurrounding tissue is considered and teh thermal mass of tumor is neglected is 191.63 sec\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.8 Page 300" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import numpy\n", + "import math\n", + "from numpy import linalg\n", + "#Operating Conditions\n", + "\n", + "k = 1.11 ; \t\t\t#[W/m.K] Thermal Conductivity \n", + "rho = 3100; \t\t\t#[kg/m^3] Density\n", + "c = 820 ; \t\t\t#[J/kg.K] Specific Heat\n", + "#Dimensions of Strip\n", + "w = 100*math.pow(10,-6);\t#[m] Width\n", + "L = .0035 ; \t\t\t#[m] Long\n", + "d = 3000*math.pow(10,-10);\t#[m] Thickness\n", + "delq = 3.5*math.pow(10,-3);\t#[W] heating Rate \n", + "delT1 =1.37 ; \t\t\t#[K] Temperature 1\n", + "f1 = 2*math.pi ; \t\t\t#[rad/s] Frequency 1\n", + "delT2 =.71 ; \t\t\t#[K] Temperature 2\n", + "f2 = 200*math.pi; \t\t#[rad/s] Frequency 2\n", + "#calculations\n", + "\n", + "A = ([[delT1, -delq/(L*math.pi)],\n", + " [delT2, -delq/(L*math.pi)]]) ;\n", + "\n", + "C= ([[delq*-2.30*math.log10(f1/2.)/(2*L*math.pi)],\n", + " [delq*-2.30*math.log10(f2/2.)/(2*L*math.pi)]]) ;\n", + "\n", + "B = numpy.linalg.solve (A,C);\n", + "\n", + "alpha = k/(rho*c);\n", + "delp = ([math.pow((alpha/f1),.5), math.pow((alpha/f2),.5)]);\n", + "#results\n", + "\n", + "print '%s %.2f %s %.2f %s' %(\"\\n C2 = \",B[1],\"k =\",B[0],\" W/m.K \")\n", + "print '%s %.2e %s %.2e %s'\t%(\"\\n\\n Thermal Penetration depths are\",delp[0],\" m and \",delp[1],\"m at frequency 2*pi rad/s and 200*pi rad/s\");\n", + "\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " C2 = 5.35 k = 1.11 W/m.K \n", + "\n", + "\n", + " Thermal Penetration depths are 2.64e-04 m and 2.64e-05 m at frequency 2*pi rad/s and 200*pi rad/s\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.9 Page 305 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "\n", + "L = .01; #[m] Metre\n", + "Tsurr = 250+273.; #[K] Temperature\n", + "h = 1100; #[W/m^2.K] Heat Convective Coefficient\n", + "q1 = math.pow(10,7); #[W/m^3] Volumetric Rate\n", + "q2 = 2*math.pow(10,7); #[W/m^3] Volumetric Rate\n", + "k = 30; #[W/m.K] Conductivity\n", + "a = 5*math.pow(10,-6); #[m^2/s]\n", + "#calculations\n", + "\n", + "delx = L/5.; #Space increment for numerical solution\n", + "Bi = h*delx/k; #Biot Number\n", + "#By using stability criterion for Fourier Number\n", + "Fo = 1/(2*(1+Bi));\n", + "#By definition\n", + "t = Fo*delx*delx/a;\n", + "#results\n", + "\n", + "print '%s %.3f %s' %('\\n As per stability criterion delt =',t,' s, hence setting stability limit as .3 s.')\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " As per stability criterion delt = 0.373 s, hence setting stability limit as .3 s.\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5.10 Page 311" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "a\n", + "delx = .075; #[m] Metre\n", + "T = 20+273.; #[K] Temperature\n", + "q = 3*math.pow(10,5); #[W/m^3] Volumetric Rate\n", + "\n", + "#From Table A.1 copper 300 K\n", + "k = 401; #[W/m.K] Conductivity\n", + "a = 117*math.pow(10,-6); #[m^2/s]\n", + "#calculations and results\n", + "\n", + "#By using stability criterion reducing further Fourier Number\n", + "Fo = 1./2.;\n", + "#By definition\n", + "delt = Fo*delx*delx/a;\n", + "#From calculations,\n", + "T11=125.19\n", + "T12=48.1\n", + "print '%s %.2f %s %.1f %s' %('\\n Hence after 2 min, the surface and the desirde interior temperature T0 =',T11,' degC and T2 =',T12,'degC');\n", + "\n", + "#By using stability criterion reducing further Fourier Number\n", + "Fo = 1/4;\n", + "#By definition\n", + "delt = Fo*delx*delx/a;\n", + "#From calculations\n", + "T21=118.86 \n", + "T22=44.4\n", + "print '%s %.2f %s %.1f %s' %('\\n Hence after 2 min, the surface and the desirde interior temperature T0 = ',T21,'degC and T2 =',T22,'degC')\n", + "\n", + "#(c) Approximating slab as semi-infinte medium\n", + "Tc = T -273 + 2*q*math.pow((a*t/math.pi),.5) /k;\n", + "t=120. #s\n", + "#At interior point x=0.15 m\n", + "x =.15; #[metre]\n", + "#Analytical Expression\n", + "Tc2 = T -273 + 2*q*math.pow((a*t/math.pi),.5) /k*math.exp(-x*x/(4*a*t))-q*x/k*(1-math.erf(.15/(2*math.sqrt(a*t))));\n", + "\n", + "print '%s %.1f %s' %(' \\n\\n (c) Approximating slab as a semi infinte medium, Analytical epression yields \\n At surface after 120 seconds = ,',Tc,'degC')\n", + "print '%s %.1f %s' %('\\n At x=.15 m after 120 seconds = ',Tc2,'degC');\n", + "#END\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Hence after 2 min, the surface and the desirde interior temperature T0 = 125.19 degC and T2 = 48.1 degC\n", + "\n", + " Hence after 2 min, the surface and the desirde interior temperature T0 = 118.86 degC and T2 = 44.4 degC\n", + " \n", + "\n", + " (c) Approximating slab as a semi infinte medium, Analytical epression yields \n", + " At surface after 120 seconds = , 25.6 degC\n", + "\n", + " At x=.15 m after 120 seconds = 45.4 degC\n" + ] + } + ], + "prompt_number": 10 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_6-checkpoint.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_6-checkpoint.ipynb new file mode 100644 index 00000000..765e946c --- /dev/null +++ b/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_6-checkpoint.ipynb @@ -0,0 +1,335 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:93169d8c4e9ec54ef86bbe976d1fb96e6150bf7ce4a6a6059f273c6286354244" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 6:Introduction to Convection" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.2 Page 356 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "#Operating Conditions\n", + "\n", + "h = .05; \t\t\t#[W/m^2.K] Heat Convection coefficient\n", + "D = .02; \t\t\t#[m] Diameter of cylinder\n", + "Cas = 5*math.pow(10,-6); #[kmol/m^3] Surface molar Conc\n", + "Casurr = 0; \t\t\t#[kmol/m^3] Surrounding molar Conc\n", + "Ma = 128; \t\t\t#[Kg/kmol] Molecular weight\n", + "#calculations\n", + "#From Eqn 6.15\n", + "Na = h*(math.pi*D)*(Cas-Casurr);\n", + "na = Ma*Na;\n", + "#results\n", + "print '%s %.2e %s' %(\"\\n\\n Mass sublimation Rate is =\",na,\" kg/s.m \");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + " Mass sublimation Rate is = 2.01e-06 kg/s.m \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.3 Page 357" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "\n", + "Dab = .288*math.pow(10,-4); \t#[m^2/s] Table A.8 water vapor-air (319K)\n", + "pas = .1; \t\t\t\t#[atm] Partial pressure at surface\n", + "pasurr = .02; \t\t\t#[atm] Partial pressure at infinity\n", + "y0 = .003; \t\t\t\t#[m] Tangent at y = 0 intercepts y axis at 3 mm\n", + "#calculations\n", + "#From Measured Vapor Pressure Distribution\n", + "delp = (0 - pas)/(y0 - 0); #[atm/m]\n", + "hmx = -Dab*delp/(pas - pasurr); #[m/s] \n", + "#results\n", + "print '%s %.4f %s' %(\"\\n\\n Convection Mass Transfer coefficient at prescribed location =\",hmx,\" m/s\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + " Convection Mass Transfer coefficient at prescribed location = 0.0120 m/s\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.4 Page 362 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "v = 1; \t\t\t\t#[m/s] Velocity of water\n", + "L = 0.6; \t\t\t\t#[m] Plate length\n", + "Tw1 = 300.; \t\t\t\t#[K]\n", + "Tw2 = 350.; \t\t\t\t#[K]\n", + "#Coefficients [W/m^1.5 . K]\n", + "Clam1 = 395;\n", + "Cturb1 = 2330;\n", + "Clam2 = 477;\n", + "Cturb2 = 3600;\n", + "\n", + "#Water Properties at T = 300K\n", + "p1 = 997; \t\t\t\t#[kg/m^3] Density\n", + "u1 = 855*math.pow(10,-6); #[N.s/m^2] Viscosity\n", + "#Water Properties at T = 350K\n", + "p2 = 974; \t\t\t\t#[kg/m^3] Density\n", + "u2 = 365*math.pow(10,-6); #[N.s/m^2] Viscosity\n", + "\n", + "\n", + "Rec = 5*math.pow(10,5); #Transititon Reynolds Number\n", + "xc1 = Rec*u1/(p1*v); \t\t#[m]Transition length at 300K\n", + "xc2 = Rec*u2/(p2*v); \t\t#[m]Transition length at 350K\n", + "#calculations\n", + "#Integrating eqn 6.14\n", + "#At 300 K\n", + "h1 = (Clam1*math.pow(xc1,.5) /.5 + Cturb1*(math.pow(L,.8)-math.pow(xc1,.8))/.8)/L;\n", + "\n", + "#At 350 K\n", + "h2 = (Clam2*math.pow(xc2,.5) /.5 + Cturb2*(math.pow(L,.8)-math.pow(xc2,.8))/.8)/L;\n", + "#results\n", + "print '%s %.2f %s %.2f %s' %(\"\\n\\n Average Convection Coefficient over the entire plate for the two temperatures at 300K =\",h1,\" W/m^2.K and at 350K =\",h2,\" W/m^2.K\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + " Average Convection Coefficient over the entire plate for the two temperatures at 300K = 1622.45 W/m^2.K and at 350K = 3707.93 W/m^2.K\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.5 Page 372" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Operating Conditions\n", + "v = 160; \t\t\t\t#[m/s] Velocity of air\n", + "L = 0.04; \t\t\t\t\t#[m] Blade length\n", + "Tsurr = 1150+273.; \t\t\t#[K]\n", + "Ts = 800+273.; \t\t\t\t#[K] Surface Temp\n", + "q = 95000; \t\t\t\t#[W/m^2] Original heat flux\n", + "#calculations\n", + "#Case 1\n", + "Ts1 = 700+273.; \t \t\t\t#[K] Surface Temp\n", + "q1 = q*(Tsurr-Ts1)/(Tsurr-Ts);\n", + "\n", + "#Case 2\n", + "L2 = .08; \t\t\t#[m] Length\n", + "q2 = q*L/L2; \t\t\t#[W/m^2] Heat flux\n", + "#results\n", + "\n", + "print '%s %d %s' %(\"\\n\\n (a) Heat Flux to blade when surface temp is reduced =\",q1/1000. ,\" KW/m^2\") \n", + "print '%s %.2f %s' %(\"\\n (b) Heat flux to a larger turbine blade = \",q2/1000. ,\"KW/m^2\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + " (a) Heat Flux to blade when surface temp is reduced = 122 KW/m^2\n", + "\n", + " (b) Heat flux to a larger turbine blade = 47.50 KW/m^2\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.6 Page 379" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "v = 100; \t\t\t#[m/s] Velocity of air\n", + "Tsurr = 20+273.; \t\t#[K] Surrounding Air Temperature\n", + "L1 = 1; \t\t\t\t#[m] solid length\n", + "Ts = 80+273.; \t\t\t#[K] Surface Temp\n", + "qx = 10000; \t\t\t#[W/m^2] heat flux at a point x\n", + "Txy = 60+273.; \t\t#[K] Temp in boundary layer above the point\n", + "\n", + "#Table A.4 Air Properties at T = 323K\n", + "v = 18.2*math.pow(10,-6); #[m^2/s] Viscosity\n", + "k = 28*math.pow(10,-3); \t#[W/m.K] Conductivity\n", + "Pr = 0.7; \t\t\t#Prandttl Number\n", + "#Table A.6 Saturated Water Vapor at T = 323K\n", + "pasat = 0.082; \t\t\t#[kg/m^3]\n", + "Ma = 18; \t\t\t#[kg/kmol] Molecular mass of water vapor\n", + "#Table A.8 Water Vapor-air at T = 323K\n", + "Dab = .26*math.pow(10,-4);\t#[m^2/s]\n", + "#calculations\n", + "#Case 1\n", + "Casurr = 0;\n", + "Cas = pasat/Ma; \t\t#[kmol/m^3] Molar conc of saturated water vapor at surface\n", + "Caxy = Cas + (Casurr - Cas)*(Txy - Ts)/(Tsurr - Ts);\n", + "\n", + "#Case 2\n", + "L2 = 2.;\n", + "hm = L1/L2 * Dab/k * qx/(Ts-Tsurr);\n", + "Na = hm*(Cas - Casurr);\n", + "#results\n", + "\n", + "print '%s %.4f %s' %(\"\\n (a) Water vapor Concentration above the point =\",Caxy,\"Kmol/m^3 \\n\") \n", + "print '%s %.2e %s' %(\"(b) Molar flux to a larger surface = \",Na,\"Kmol/s.m^2\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " (a) Water vapor Concentration above the point = 0.0030 Kmol/m^3 \n", + "\n", + "(b) Molar flux to a larger surface = 3.53e-04 Kmol/s.m^2\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6.7 Page 383 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "Tsurr = 40+273.; \t\t#[K] Surrounding Air Temperature\n", + "#Volatile Wetting Agent A\n", + "hfg = 100; \t\t\t#[kJ/kg]\n", + "Ma = 200; \t\t\t#[kg/kmol] Molecular mass\n", + "pasat = 5000; \t\t\t#[N/m^2] Saturate pressure\n", + "Dab = .2*math.pow(10,-4); #[m^2/s] Diffusion coefficient\n", + "\n", + "#Table A.4 Air Properties at T = 300K\n", + "p = 1.16; \t#[kg/m^3] Density\n", + "cp = 1.007; \t#[kJ/kg.K] Specific Heat\n", + "alpha = 22.5*math.pow(10,-6)#[m^2/s] \n", + "R = 8.314; \t#[kJ/kmol] Universal Gas Constt\n", + "#calculations\n", + "#Applying Eqn 6.65 and setting pasurr = 0\n", + "# Ts^2 - Tsurr*Ts + B = 0 , where the coefficient B is\n", + "B = Ma*hfg*pasat*math.pow(10,-3) /(R*p*cp*math.pow((alpha/Dab),(2./3.)));\n", + "Ts = (Tsurr + math.sqrt(Tsurr*Tsurr - 4*B))/2. ;\n", + "#results\n", + "print '%s %.1f %s' %(\"\\n Steady State Surface Temperature of Beverage =\",Ts-273.,\"degC\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Steady State Surface Temperature of Beverage = 5.9 degC\n" + ] + } + ], + "prompt_number": 6 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_7-checkpoint.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_7-checkpoint.ipynb new file mode 100644 index 00000000..61026b5b --- /dev/null +++ b/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_7-checkpoint.ipynb @@ -0,0 +1,498 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:aeecd7c0914cfcf6b63a4ecc903c9b4bb4aa650418dfaaff2116b660ef3341e8" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 7:External Flow" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.1 Page 415" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "v = 10; \t\t\t\t\t\t\t#[m/s] Air velocity\n", + "p = 6000; \t\t\t\t\t\t\t#[N/m^2] Air pressure\n", + "Tsurr = 300+273.; \t\t\t\t\t\t#[K] Surrounding Air Temperature\n", + "L = .5; \t\t\t\t\t\t\t#[m] Length of plate\n", + "Ts = 27+273.; \t\t\t\t\t\t#[K] Surface Temp\n", + "\n", + "#Table A.4 Air Properties at T = 437K \n", + "uv = 30.84*math.pow(10,-6)*(101325./6000.); #[m^2/s] Kinematic Viscosity at P = 6000 N/m^2\n", + "k = 36.4*math.pow(10,-3); \t\t#[W/m.K] Thermal COnductivity\n", + "Pr = .687; \t\t\t\t\t#Prandtl number\n", + "#calculations\n", + "Re = v*L/uv; \t\t\t\t\t\t#Reynolds number\n", + "print '%s %d %s' %(\"\\n Since Reynolds Number is\",Re,\", The flow is laminar over the entire plate\");\n", + "\n", + "#Correlation 7.30 \n", + "NuL = .664*math.pow(Re,.5)*math.pow(Pr,0.3334); #Nusselt Number over entire plate length\n", + "hL = NuL*k/L; # Average Convection Coefficient\n", + "#Required cooling rate per unit width of plate\n", + "q = hL*L*(Tsurr-Ts);\n", + "#results\n", + "print '%s %d %s' %(\"\\n\\n Required cooling rate per unit width of plate =\",q,\" W/m\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Since Reynolds Number is 9600 , The flow is laminar over the entire plate\n", + "\n", + "\n", + " Required cooling rate per unit width of plate = 570 W/m\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.2 Page 417" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "v = 60; \t\t\t#[m/s] Air velocity\n", + "Tsurr = 25+273.; \t\t#[K] Surrounding Air Temperature\n", + "w = 1; \t\t\t#[m] Width of plate\n", + "L = .05; \t\t\t#[m] Length of stripper\n", + "Ts = 230+273.; \t\t#[K] Surface Temp\n", + "\n", + "#Table A.4 Air Properties at T = 400K \n", + "uv = 26.41*math.pow(10,-6); #[m^2/s] Kinematic Viscosity\n", + "k = .0338; \t#[W/m.K] Thermal COnductivity\n", + "Pr = .690; \t#Prandtl number\n", + "#calculations\n", + "Re = v*L/uv; \t\t#Reynolds number\n", + "\n", + "Rexc = 5*math.pow(10,5); #Transition Reynolds Number\n", + "xc = uv*Rexc/v; \t\t#Transition Length\n", + "#results\n", + "print '%s %d' %(\"\\n Reynolds Number based on length L = .05m is \",Re)\n", + "print '%s %.2f %s' %(\"\\n And the transition occur at xc =\",xc,\" m ie fifth plate\");\n", + "\n", + "#For first heater\n", + "#Correlation 7.30 \n", + "Nu1 = .664*math.pow(Re,0.5)*math.pow(Pr,0.3334); #Nusselt Number \n", + "h1 = Nu1*k/L; # Average Convection Coefficient\n", + "q1 = h1*(L*w)*(Ts-Tsurr); # Convective Heat exchange\n", + "\n", + "#For first four heaters\n", + "Re4 = 4*Re;\n", + "L4 = 4*L;\n", + "Nu4 = .664*math.pow(Re4,0.5)*math.pow(Pr,0.3334); #Nusselt Number \n", + "h4 = Nu4*k/L4; # Average Convection Coefficient\n", + "print(h4)\n", + "#For Fifth heater from Eqn 7.38\n", + "Re5 = 5*Re;\n", + "A = 871; \n", + "L5 = 5*L;\n", + "Nu5 = (.037*math.pow(Re5,.8)-A)*math.pow(Pr,.3334); #Nusselt Number \n", + "h5 = Nu5*k/L5; # Average Convection Coefficient\n", + "q5 = (h5*L5-h4*L4)*w*(Ts-Tsurr);\n", + "\n", + "#For Sixth heater from Eqn 7.38\n", + "Re6 = 6*Re;\n", + "L6 = 6*L;\n", + "Nu6 = (.037*math.pow(Re6,.8)-A)*math.pow(Pr,.3334) ; #Nusselt Number \n", + "h6 = Nu6*k/L6 ; # Average Convection Coefficient\n", + "q6 = (h6*L6-h5*L5)*w*(Ts-Tsurr);\n", + "\n", + "print '%s %d %s %d %s %d %s' %(\"\\n\\n Power requirement are \\n qconv1 = \",q1,\"W qconv5 =\",q5,\" W qconv6 = \",q6,\"W\");\n", + "print '%s %d %s %d %s %d %s' %(\"\\n Hence\",q6,\">\",q1,\" >\",q5,\"and the sixth plate has largest power requirement\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Reynolds Number based on length L = .05m is 113593\n", + "\n", + " And the transition occur at xc = 0.22 m ie fifth plate\n", + "66.8395462952\n", + "\n", + "\n", + " Power requirement are \n", + " qconv1 = 1370 W qconv5 = 1017 W qconv6 = 1427 W\n", + "\n", + " Hence 1427 > 1370 > 1017 and the sixth plate has largest power requirement\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.3 Page 420" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "v = 2; \t\t\t#[m/s] Air velocity\n", + "Tsurr = 25+273.; \t\t#[K] Surrounding Air Temperature\n", + "H = .5; \t\t\t# Humidity\n", + "w = 6; \t\t\t#[m] Width of pool\n", + "L1 = 12; \t\t\t#[m] Length of pool\n", + "e = 1.5; \t\t\t#[m] Deck Wide\n", + "Ts = 25+273.; \t\t\t#[K] Surface Temp of water\n", + "#calculations\n", + "#Table A.4 Air Properties at T = 298K \n", + "uv = 15.7*math.pow(10,-6); #[m^2/s] Kinematic Viscosity\n", + "#Table A.8 Water vapor-Air Properties at T = 298K \n", + "Dab = .26*math.pow(10,-4); \t#[m^2/s] Diffusion Coefficient\n", + "Sc = uv/Dab;\n", + "#Table A.6 Air Properties at T = 298K \n", + "rho = .0226; \t#[kg/m^3]\n", + "\n", + "L = L1+e;\n", + "Re = v*L/uv; \t\t#Reynolds number\n", + "\n", + "#Equation 7.41 yields\n", + "ShLe = .037*math.pow(Re,.8)*math.pow(Sc,.3334);\n", + "#Equation 7.44\n", + "p = 8.; #Turbulent Flow\n", + "ShL = (L/(L-e))*ShLe*math.pow((1-math.pow((e/L),((p+1)/(p+2)))),(p/(p+1)));\n", + "\n", + "hmL = ShL*(Dab/L);\n", + "n = hmL*(L1*w)*rho*(1-H);\n", + "#results\n", + "print '%s %.2e %s' %(\"\\n Reynolds Number is \",Re,\". Hence for turbulent Flow p = 8 in Equation 7.44.\")\n", + "print '%s %d %s' %(\"\\n Daily Water Loss due to evaporation is\",n*86400. ,\"kg/day\");\n", + "\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Reynolds Number is 1.72e+06 . Hence for turbulent Flow p = 8 in Equation 7.44.\n", + "\n", + " Daily Water Loss due to evaporation is 406 kg/day\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.4 Page 428" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "v = 10; \t\t\t#[m/s] Air velocity\n", + "Tsurr = 26.2+273.; \t\t#[K] Surrounding Air Temperature\n", + "P = 46.; \t\t\t# [W] Power dissipation\n", + "L = .094; \t\t\t#[m] Length of cylinder\n", + "D = .0127; \t\t\t#[m] Diameter of cylinder\n", + "Ts = 128.4+273.; \t\t#[K] Surface Temp of water\n", + "q = 46.15*46; \t\t#[W] Actual power dissipation without the 15% loss\n", + "\n", + "#Table A.4 Air Properties at T = 300K \n", + "uv = 15.89*math.pow(10,-6); #[m^2/s] Kinematic Viscosity\n", + "k = 26.3*math.pow(10,-3); #[W/m.K] Thermal conductivity\n", + "Pr = .707; \t#Prandtl Number\n", + "#Table A.4 Air Properties at T = 401K \n", + "Prs = .690; \t#Prandtl Number\n", + "#calculations\n", + "A = math.pi*D*L;\n", + "h = q/(A*(Ts-Tsurr));\n", + "\n", + "Re = v*D/uv; \t\t#Reynolds number\n", + "#Using Zukauskas Relation, Equation 7.53\n", + "C = .26;\n", + "m = .6;\n", + "n = .37;\n", + "Nu = C*math.pow(Re,m)*math.pow(Pr,n)*math.pow((Pr/Prs),.25);\n", + "havg = Nu*k/D;\n", + "#results\n", + "print '%s %d %s' %(\"\\n Convection Coefficient associated with operating conditions\",h,\"W/m^2.K.\") \n", + "print '%s %d %s' %(\"\\n Reynolds Number is \",Re,\". Hence taking suitable corresponding data from Table 7.4.\")\n", + "print '%s %d %s' %(\"\\n Convection Coefficient from an appropriate Zukauskas correlation\",havg,\" W/m^2.K\");\n", + "\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Convection Coefficient associated with operating conditions 5538 W/m^2.K.\n", + "\n", + " Reynolds Number is 7992 . Hence taking suitable corresponding data from Table 7.4.\n", + "\n", + " Convection Coefficient from an appropriate Zukauskas correlation 104 W/m^2.K\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.5 page 431" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "v = 23; \t\t\t\t#[m/s] Air velocity\n", + "Tsurr = 296.; \t\t\t\t#[K] Surrounding Air Temperature\n", + "L = .8; \t\t\t\t#[m] Length of cylinder\n", + "Di = .1; \t\t\t\t#[m] Diameter of cylinder\n", + "t = .005; \t\t\t\t\t#[m] Thickness of cylinder\n", + "\n", + "#Table A.4 Air Properties at T = 285K \n", + "uv = 14.56*math.pow(10,-6); #[m^2/s] Kinematic Viscosity\n", + "k = 25.2*math.pow(10,-3); #[W/m.K] Thermal conductivity\n", + "Pr = .712; \t\t#Prandtl Number\n", + "#Table A.1 AISI 316 Stainless steel Properties at T = 300K \n", + "kss = 13.4; \t\t#[W/m.K]Conductivity\n", + "\n", + "pH2 = 1.01; \t\t\t\t#[N]\n", + "Ti = -3550/(2.30*math.log10(pH2) - 12.9);\n", + "Eg = -(1.35*math.pow(10,-4))*(29.5*math.pow(10,6));\n", + "#calculations\n", + "Re = v*(Di+2*t)/uv; \t\t#Reynolds number\n", + "# Equation 7.54\n", + "Nu = .3+.62*math.pow(Re,.5)*math.pow(Pr,.3334) /math.pow((1+math.pow((.4/Pr),.6668)),.25) *math.pow(1+math.pow((Re/282000.),(5./8.)),.8);\n", + "h = Nu*k/(Di+2*t);\n", + "\n", + "qconv = (Tsurr-Ti)/((1/(math.pi*L*(Di+2*t)*h))+(2.30*math.log10((Di+2*t)/Di)/(2*math.pi*kss*L)));\n", + "\n", + "#results\n", + "print '%s %d %s' %(\"\\n Additional Thermal Energy must be supplied to canister to mainatin steady-state operating temperatue\",-qconv-Eg,\"W\");\n", + "\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Additional Thermal Energy must be supplied to canister to mainatin steady-state operating temperatue 3581 W\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.6 page 434" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "v = 10; \t\t\t#[m/s] Air velocity\n", + "Tsurr = 23+273.; \t\t#[K] Surrounding Air Temperature\n", + "D = .01; \t\t\t#[m] Diameter of sphere\n", + "Ti = 75+273.; \t\t#[K] Initial temp\n", + "Tt = 35+273.; \t\t#[K] Temperature after time t\n", + "p = 1; \t\t#[atm]\n", + "\n", + "#Table A.1 Copper at T = 328K \n", + "rho = 8933; \t\t\t#[kg/m^3] Density\n", + "k = 399; \t\t\t#[W/m.K] Conductivity\n", + "cp = 388; \t\t\t#[J/kg.K] specific \n", + "#Table A.4 Air Properties T = 296 K\n", + "u = 182.6*math.pow(10,-7); #[N.s/m^2] Viscosity\n", + "uv = 15.53*math.pow(10,-6); #[m^2/s] Kinematic Viscosity\n", + "k = 25.1*math.pow(10,-3); #[W/m.K] Thermal conductivity\n", + "Pr = .708; \t#Prandtl Number\n", + "#Table A.4 Air Properties T = 328 K\n", + "u2 = 197.8*math.pow(10,-7); #[N.s/m^2] Viscosity\n", + "#calculations\n", + "Re = v*D/uv; \t\t#Reynolds number\n", + "#Using Equation 7.56\n", + "Nu = 2+(0.4*math.pow(Re,.5) + 0.06*math.pow(Re,.668))*math.pow(Pr,.4)*math.pow((u/u2),.25);\n", + "h = Nu*k/D;\n", + "#From equation 5.4 and 5.5\n", + "t = rho*cp*D*2.30*math.log10((Ti-Tsurr)/(Tt-Tsurr))/(6*h);\n", + "#results\n", + "print '%s %.1f %s' %(\"\\nTime required for cooling is\",t,\"sec\");\n", + "\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Time required for cooling is 71.2 sec\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7.7 Page 443" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "v = 6; \t\t\t#[m/s] Air velocity\n", + "Tsurr = 15+273.; \t \t\t#[K] Surrounding Air Temperature\n", + "D = .0164; \t\t\t#[m] Diameter of tube\n", + "Ts = 70+273.; \t\t#[K] Temp of tube\n", + "#Staggered arrangement dimensions\n", + "St = .0313; \t\t\t#[m]\n", + "Sl = .0343; \t\t\t#[m]\n", + "\n", + "#Table A.4 Air Properties T = 288 K\n", + "rho = 1.217; \t\t#[kg/m^3] Density\n", + "cp = 1007; \t\t#[J/kg.K] specific heat\n", + "uv = 14.82*math.pow(10,-6); #[m^2/s] Kinematic Viscosity\n", + "k = 25.3*math.pow(10,-3); #[W/m.K] Thermal conductivity\n", + "Pr = .71; \t#Prandtl Number\n", + "#Table A.4 Air Properties T = 343 K\n", + "Pr2 = .701; \t#Prandtl Number\n", + "#Table A.4 Air Properties T = 316 K\n", + "uv3 = 17.4*math.pow(10,-6); #[m^2/s] Kinematic Viscosity\n", + "k3 = 27.4*math.pow(10,-3); #[W/m.K] Thermal conductivity\n", + "Pr3 = .705; \t#Prandtl Number\n", + "#calculations\n", + "Sd = math.pow((Sl*Sl + (St/2)*(St/2)),.5);\n", + "Vmax = St*v/(St-D);\n", + "\n", + "Re = Vmax*D/uv; \t\t#Reynolds number\n", + "\n", + "C = .35*math.pow((St/Sl),.2);\n", + "m = .6;\n", + "C2 = .95;\n", + "N = 56;\n", + "Nt = 8;\n", + "#Using Equation 7.64 & 7.65\n", + "Nu = C2*C*math.pow(Re,m)* math.pow(Pr,.36) *math.pow((Pr/Pr2),.25);\n", + "h = Nu*k/D;\n", + "\n", + "#From Eqnn 7.67\n", + "Tso = (Ts-Tsurr)*math.exp(-(math.pi*D*N*h)/(rho*v*Nt*St*cp));\n", + "Tlm = ((Ts-Tsurr) - Tso)/(2.30*math.log10((Ts-Tsurr)/Tso));\n", + "q = N*(h*math.pi*D*Tlm);\n", + "\n", + "Pt = St/D;\n", + "#From Fig 7.14\n", + "X = 1.04;\n", + "f = .35;\n", + "NL = 7;\n", + "press = NL*X*(rho*Vmax*Vmax/2.)*f;\n", + "#results\n", + "print '%s %.1f %s' %(\"\\n Air side Convection coefficient h = \",h,\"W/m^2.k\"); \n", + "print '%s %.1f %s' %(\"\\n and Heat rate q = \",q/1000. ,\" kW/m\"); \n", + "print '%s %.2e %s' %(\"\t\\n Pressure Drop =\",press/100000. ,\" bars\");\n", + "\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Air side Convection coefficient h = 137.0 W/m^2.k\n", + "\n", + " and Heat rate q = 19.6 kW/m\n", + "\t\n", + " Pressure Drop = 2.46e-03 bars\n" + ] + } + ], + "prompt_number": 7 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_8-checkpoint.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_8-checkpoint.ipynb new file mode 100644 index 00000000..63fa2864 --- /dev/null +++ b/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_8-checkpoint.ipynb @@ -0,0 +1,523 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:2913454d290e23f136a7419fe94a1349a1854f1b6a4a4f758d7077729d913179" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 8:Internal Flow" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 8.2 Page 499" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "m = .1; #[kg/s] mass flow rate of water\n", + "Ti = 20+273.; #[K] Inlet temp\n", + "To = 60+273.; #[K] Outlet temperature\n", + "Di = .02; #[m] Inner Diameter\n", + "Do = .04; #[m] Outer Diameter\n", + "q = 1000000.;\t #[w/m^3] Heat generation Rate\n", + "Tsi = 70+273.; #[K] Inner Surface Temp\n", + "#Table A.4 Air Properties T = 313 K\n", + "cp = 4179; #[J/kg.K] specific heat\n", + "#calculations\n", + "L = 4*m*cp*(To-Ti)/(math.pi*(Do*Do-Di*Di)*q);\n", + "\n", + "#From Newtons Law of cooling, Equation 8.27, local heat convection coefficient is\n", + "h = q*(Do*Do-Di*Di)/(Di*4*(Tsi-To));\n", + "#results\n", + "print '%s %.1f %s' %(\"\\n Length of tube needed to achieve the desired outlet temperature = \",L,\"m \")\n", + "print '%s %.1f %s' %(\"\\n Local convection coefficient at the outlet =\",h,\" W/m^2.K\");\n", + "\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Length of tube needed to achieve the desired outlet temperature = 17.7 m \n", + "\n", + " Local convection coefficient at the outlet = 1500.0 W/m^2.K\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 8.3 Page 503 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "m = .25; \t#[kg/s] mass flow rate of water\n", + "Ti = 15+273.; \t#[K] Inlet temp\n", + "To = 57+273.; \t#[K] Outlet temperature\n", + "D = .05; \t\t#[m] Diameter\n", + "L = 6; \t\t#[m] Length of tube\n", + "Ts = 100+273.; \t#[K] outer Surface Temp\n", + "\n", + "#Table A.4 Air Properties T = 309 K\n", + "cp = 4178; \t#[J/kg.K] specific heat\n", + "#calculations\n", + "Tlm = ((Ts-To)-(Ts-Ti))/(2.30*math.log10((Ts-To)/(Ts-Ti)));\n", + "\n", + "h = m*cp*(To-Ti)/(math.pi*D*L*Tlm);\n", + "#results\n", + "print '%s %d %s' %(\"\\n Average Heat transfer Convection Coefficient = \",h,\"W/m^2.K\");\n", + "\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Average Heat transfer Convection Coefficient = 754 W/m^2.K\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 8.4 Page 506 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "m = .01; #[kg/s] mass flow rate of water\n", + "Ti = 20+273; \t#[K] Inlet temp\n", + "To = 80+273; \t#[K] Outlet temperature\n", + "D = .06; \t#[m] Diameter\n", + "q = 2000; \t#[W/m^2] Heat flux to fluid\n", + "\n", + "#Table A.4 Air Properties T = 323 K\n", + "cp = 4178; #[J/kg.K] specific heat\n", + "#Table A.4 Air Properties T = 353 K\n", + "k = .670; #[W/m] Thermal Conductivity\n", + "u = 352*math.pow(10,-6);#[N.s/m^2] Viscosity\n", + "Pr = 2.2; #Prandtl Number\n", + "cp = 4178; #[J/kg.K] specific heat\n", + "#calculations\n", + "L = m*cp*(To-Ti)/(math.pi*D*q);\n", + "\n", + "#Using equation 8.6\n", + "Re = m*4/(math.pi*D*u);\n", + "print '%s %.2f %s' %(\"\\n (a) Length of tube for required heating =\",L,\"m\")\n", + "print '%s %.2f %s' %(\"\\n\\n (b)As Reynolds Number is\",Re,\".The flow is laminar.\");\n", + "\n", + "Nu = 4.364; #Nusselt Number\n", + "h = Nu*k/D; #[W/m^2.K] Heat convection Coefficient\n", + "\n", + "Ts = q/h+To; #[K]\n", + "#results\n", + "print '%s %.2f %s' %(\"\\n Surface Temperature at tube outlet = \",Ts-273,\"degC\");\n", + "\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " (a) Length of tube for required heating = 6.65 m\n", + "\n", + "\n", + " (b)As Reynolds Number is 602.86 .The flow is laminar.\n", + "\n", + " Surface Temperature at tube outlet = 121.04 degC\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 8.5 Page 509 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "um1 = .13; #[m/s] Blood stream\n", + "um2 = 3*math.pow(10,-3); #[m/s] Blood stream\n", + "um3 = .7*math.pow(10,-3); #[m/s] Blood stream\n", + "D1 = .003; #[m] Diameter\n", + "D2 = .02*math.pow(10,-3); #[m] Diameter\n", + "D3 = .008*math.pow(10,-3); #[m] Diameter\n", + "Tlm = .05;\n", + "kf = .5; #[W/m.K] Conductivity\n", + "#Table A. Water Properties T = 310 K\n", + "rho = 993.; #[kg/m^3] density\n", + "cp = 4178.; #[J/kg.K] specific heat\n", + "u = 695*math.pow(10,-6); #[N.s/m^2] Viscosity\n", + "kb = .628; #[W/m.K] Conductivity\n", + "Pr = 4.62; #Prandtl Number\n", + "i=1.;\n", + "#calculations\n", + "#Using equation 8.6\n", + "Re1 = rho*um1*D1/u;\n", + "Nu = 4;\n", + "hb = Nu*kb/D1;\n", + "hf = kf/D1;\n", + "U1 = 1/(1/hb + 1/hf);\n", + "L1 = -rho*um1*D1/U1*cp*2.303*math.log10(Tlm)/4.;\n", + "xfdh1 = .05*Re1*D1;\n", + "xfdr1 = xfdh1*Pr;\n", + "\n", + "Re2 = rho*um2*D2/u;\n", + "Nu = 4;\n", + "hb = Nu*kb/D2;\n", + "hf = kf/D2;\n", + "U2 = 1/(1/hb + 1/hf);\n", + "L2 = -rho*um2*D2/U2*cp*2.303*math.log10(Tlm)/4.;\n", + "xfdh2 = .05*Re2*D2;\n", + "xfdr2 = xfdh2*Pr;\n", + "\n", + "Re3 = rho*um3*D3/u;\n", + "Nu = 4;\n", + "hb = Nu*kb/D3;\n", + "hf = kf/D3;\n", + "U3 = 1/(1/hb + 1/hf);\n", + "L3 = -rho*um3*D3/U3*cp*2.303*math.log10(Tlm)/4.;\n", + "xfdh3 = .05*Re3*D3;\n", + "xfdr3 = xfdh3*Pr;\n", + "#results\n", + "print ' %s' %(\"\\n Vessel Re U(W/m^2.K) L(m) xfdh(m) xfdr(m)\")\n", + "print '%s %.3f %d %.1e %.1e %.1e' %(\"\\n Artery \",Re1, U1 ,L1, xfdh1 , xfdr1)\n", + "print '%s %.3f %d %.1e %.1e %.1e' %(\"\\n Anteriole \",Re2, U2 ,L2, xfdh2 , xfdr2)\n", + "print '%s %.3f %d %.1e %.1e %.1e' %(\"\\n Capillary \",Re3,U3,L3,xfdh3,xfdr3);\n", + "\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " Vessel Re U(W/m^2.K) L(m) xfdh(m) xfdr(m)\n", + "\n", + " Artery 557.223 138 8.7e+00 8.4e-02 3.9e-01\n", + "\n", + " Anteriole 0.086 20849 8.9e-06 8.6e-08 4.0e-07\n", + "\n", + " Capillary 0.008 52124 3.3e-07 3.2e-09 1.5e-08\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 8.6 Page 516 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "m = .05; \t#[kg/s] mass flow rate of water\n", + "Ti = 103+273.; \t#[K] Inlet temp\n", + "To = 77+273.; \t\t#[K] Outlet temperature\n", + "D = .15; \t\t#[m] Diameter\n", + "L = 5; \t\t#[m] length\n", + "ho = 6.; \t\t#[W/m^2.K] Heat transfer convective coefficient\n", + "Tsurr = 0+273.; \t\t#[K] Temperature of surrounding\n", + "\n", + "#Table A.4 Air Properties T = 363 K\n", + "cp = 1010; \t#[J/kg.K] specific heat\n", + "#Table A.4 Air Properties T = 350 K\n", + "k = .030; \t#[W/m] Thermal Conductivity\n", + "u = 20.82/1000000.; \t#[N.s/m^2] Viscosity\n", + "Pr = .7; \t\t#Prandtl Number\n", + "#calculations and results\n", + "q = m*cp*(To-Ti);\n", + "\n", + "Re = m*4/(math.pi*D*u);\n", + "print '%s %d %s' %(\"\\n As Reynolds Number is\",Re,\". The flow is Turbulent.\");\n", + "\n", + "#Equation 8.6\n", + "n = 0.3;\n", + "Nu = .023*math.pow(Re,.8)*math.pow(Pr,.3);\n", + "h = Nu*k/D;\n", + "q2 = (To-Tsurr)/(1/h + 1/ho);\n", + "Ts = -q2/h+To;\n", + "\n", + "print '%s %d %s' %(\"\\n\\n Heat Loss from the Duct over the Length L, q =\",q,\" W \")\n", + "print '%s %.1f %s %.1f %s' %(\"\\n Heat flux and suface temperature at x=L is\",q2,\"W/m^2 &\",Ts-273,\"degC respectively\");\n", + "\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " As Reynolds Number is 20384 . The flow is Turbulent.\n", + "\n", + "\n", + " Heat Loss from the Duct over the Length L, q = -1313 W \n", + "\n", + " Heat flux and suface temperature at x=L is 304.3 W/m^2 & 50.7 degC respectively\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 8.7 Page 525" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "T1 = 125+273.; \t\t\t#[K] Chip Temperature 1\n", + "T2 = 25+273.; \t\t\t#[K] Chip Temperature 2\n", + "Ti = 5+273.; \t\t\t#[K] Inlet Temperature \n", + "D = .01; \t\t\t#[m] Diameter\n", + "L = .02; \t\t#[m] length\n", + "delP = 500*1000.; \t\t#[N/m^2] Pressure drop\n", + "#Dimensions\n", + "a = 40*math.pow(10,-6); \n", + "b = 160*math.pow(10,-6);\n", + "s = 40*math.pow(10,-6);\n", + "\n", + "#Table A.5 Ethylene Glycol Properties T = 288 K\n", + "rho = 1120.2; \t#[kg/m^3] Density\n", + "cp = 2359.; \t#[J/kg.K] Specific Heat\n", + "u = 2.82*math.pow(10,-2);\t#[N.s/m^2] Viscosity\n", + "k = 247*math.pow(10,-3); \t#[W/m.K] Thermal Conductivity\n", + "Pr = 269; \t\t#Prandtl number \n", + "#Table A.5 Ethylene Glycol Properties T = 338 K\n", + "rho2 = 1085.; \t#[kg/m^3] Density\n", + "cp2 = 2583.; \t#[J/kg.K] Specific Heat\n", + "u2 = .427*math.pow(10,-2);\t#[N.s/m^2] Viscosity\n", + "k2 = 261*math.pow(10,-3); \t#[W/m.K] Thermal Conductivity\n", + "Pr2 = 45.2; \t#Prandtl number\n", + "#calculations\n", + "P = 2*a+2*b; \t#Perimeter of microchannel\n", + "Dh = 4*a*b/P; \t#Hydraulic Diameter\n", + "\n", + "um2 = 2/73.*Dh*Dh/u2*delP/L;#[[m/s] Equation 8.22a\n", + "Re2 = um2*Dh*rho2/u2; #Reynolds Number\n", + "xfdh2 = .05*Dh*Re2; \t#[m] From Equation 8.3\n", + "xfdr2 = xfdh2*Pr2; \t#[m] From Equation 8.23\n", + "m2 = rho2*a*b*um2; \t#[kg/s]\n", + "Nu2 = 4.44; \t\t#Nusselt Number from Table 8.1\n", + "h2 = Nu2*k2/Dh; \t\t#[W/m^2.K] Convection Coeff\n", + "Tc2 = 124+273.; \t\t#[K]\n", + "xc2 = m2/P*cp2/h2*2.303*math.log10((T1-Ti)/(T1-Tc2));\n", + "tc2 = xc2/um2;\n", + "\n", + "um = 2/73.*Dh*Dh/u*delP/L; #[[m/s] Equation 8.22a\n", + "Re = um*Dh*rho/u; \t#Reynolds Number\n", + "xfdh = .05*Dh*Re; \t#[m] From Equation 8.3\n", + "xfdr = xfdh*Pr; \t\t#[m] From Equation 8.23\n", + "m = rho2*a*b*um; \t#[kg/s]\n", + "Nu = 4.44; \t\t#Nusselt Number from Table 8.1\n", + "h = Nu*k/Dh; \t\t#[W/m^2.K] Convection Coeff\n", + "Tc = 24+273.; \t\t#[K]\n", + "xc = m/P*cp/h*2.303*math.log10((T2-Ti)/(T2-Tc));\n", + "tc = xc/um;\n", + "\n", + "#results\n", + "print '%s %.1f %s' %(\"\\nTemp in case 2= \",T2-273,\" [degC]\")\n", + "print '%s %.1f %s' %(\"\\nTemp in case 1= \",T1-273,\" [degC]\")\n", + "print '%s %.3f %s' %(\"\\nFlow rate in case 2 = \",um2,\"[m/s]\")\n", + "print '%s %.3f %s' %(\"\\nFlow rate in case 1 = \",um,\"[m/s]\")\n", + "print '%s %.1f' %(\"\\nReynolds number in case 2 = \",Re2)\n", + "print '%s %.1f' %(\"\\nReynolds number in case 1 = \",Re)\n", + "print '%s %.1f' %(\"\\nHydrodynamic entrance Length [m] =\",xfdh)\n", + "print '%s %.1f' %(\"\\nHydrodynamic entrance Length in case 2 [m] =\",xfdh2) \n", + "print '%s %.1e' %(\"\\nThermal entrance Length [m] = \",xfdr)\n", + "print '%s %.1e' %(\"\\nThermal entrance Length in case 2 [m] = \",xfdr2)\n", + "print '%s %.2e' %(\"\\nMass Flow rate [kg/s] = \",m)\n", + "print '%s %.2e' %(\"\\nMass Flow rate in case 2 [kg/s] = \",m2)\n", + "print '%s %.2e' %(\"\\nConvective Coeff [W/m^2.K] = \",h)\n", + "print '%s %.2e' %(\"\\nConvective Coeff in case 2 [W/m^2.K] = \",h2)\n", + "print '%s %.2e' %(\"\\nTransition Length [m] = \",xc)\n", + "print '%s %.2e' %(\"\\nTransition Length in case 2 [m] = \",xc2)\n", + "print '%s %.3f' %(\"\\nRequired Time [s] = \",tc)\n", + "print '%s %.3f' %(\"\\nRequired Time in case 2 [s] = \",tc2)\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Temp in case 2= 25.0 [degC]\n", + "\n", + "Temp in case 1= 125.0 [degC]\n", + "\n", + "Flow rate in case 2 = 0.657 [m/s]\n", + "\n", + "Flow rate in case 1 = 0.099 [m/s]\n", + "\n", + "Reynolds number in case 2 = 10.7\n", + "\n", + "Reynolds number in case 1 = 0.3\n", + "\n", + "Hydrodynamic entrance Length [m] = 0.0\n", + "\n", + "Hydrodynamic entrance Length in case 2 [m] = 0.0\n", + "\n", + "Thermal entrance Length [m] = 2.2e-04\n", + "\n", + "Thermal entrance Length in case 2 [m] = 1.5e-03\n", + "\n", + "Mass Flow rate [kg/s] = 6.91e-07\n", + "\n", + "Mass Flow rate in case 2 [kg/s] = 4.56e-06\n", + "\n", + "Convective Coeff [W/m^2.K] = 1.71e+04\n", + "\n", + "Convective Coeff in case 2 [W/m^2.K] = 1.81e+04\n", + "\n", + "Transition Length [m] = 7.12e-04\n", + "\n", + "Transition Length in case 2 [m] = 7.79e-03\n", + "\n", + "Required Time [s] = 0.007\n", + "\n", + "Required Time in case 2 [s] = 0.012\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 8.8 Page 529" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "m = .0003; \t\t#[kg/s] mass flow rate of water\n", + "T = 25+273; \t\t\t\t#[K] Temperature of surrounding and tube\n", + "D = .01; \t\t\t#[m] Diameter\n", + "L = 1; \t\t\t#[m] length\n", + "#calculations and results\n", + "#Table A.4 Air Properties T = 298 K\n", + "uv = 15.7*math.pow(10,-6); #[m^2/s] Kinematic Viscosity\n", + "u = 18.36*math.pow(10,-6); #[N.s/m^2] Viscosity\n", + "#Table A.8 Ammonia-Air Properties T = 298 K\n", + "Dab = .28*math.pow(10,-4); #[m^2/s] Diffusion coeff\n", + "Sc = .56;\n", + "\n", + "Re = m*4/(math.pi*D*u);\n", + "print '%s %d %s' %(\"\\n As Reynolds Number is\",Re,\". The flow is Laminar.\");\n", + "\n", + "#Using Equation 8.57\n", + "Sh = 1.86*math.pow((Re*Sc*D/L),.3334);\n", + "h = Sh*Dab/D;\n", + "print '%s %.3f %s' %(\"\\n Average mass trasnfer convection coefficient for the tube\",h,\"m/s\");\n", + "\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " As Reynolds Number is 2080 . The flow is Laminar.\n", + "\n", + " Average mass trasnfer convection coefficient for the tube 0.012 m/s\n" + ] + } + ], + "prompt_number": 8 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_9-checkpoint.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_9-checkpoint.ipynb new file mode 100644 index 00000000..5a184183 --- /dev/null +++ b/Fundamentals_of_Heat_and_Mass_Transfer/.ipynb_checkpoints/Chapter_9-checkpoint.ipynb @@ -0,0 +1,306 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:128b8303085215918667992d35a01f582bd9d04fa897e73c9cfb4452b88f23dd" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Free Convection" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "chapter 9:Example 9.1 Page 569" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "Ts = 70+273.; \t\t\t\t\t#[K] Surface Temperature\n", + "Tsurr = 25+273.; \t\t\t\t#[K] Surrounding Temperature\n", + "v1 = 0; \t\t\t\t\t#[m/s] Velocity of free air\n", + "v2 = 5; \t\t\t\t\t#[m/s] Velocity of free air\n", + "L = .25; \t\t\t\t#[m] length\n", + "#calculations and results\n", + "#Table A.4 Air Properties T = 320 K\n", + "uv = 17.95*math.pow(10,-6);\t\t\t#[m^2/s] Kinematic Viscosity\n", + "be = 3.12*math.pow(10,-3); \t\t\t#[K^-1] Tf^-1\n", + "Pr = 269; \t\t\t# Prandtl number \n", + "g = 9.81; \t\t\t\t\t#[m^2/s]gravitational constt\n", + "\n", + "Gr = g*be*(Ts-Tsurr)*L*L*L/(uv*uv);\n", + "del1 = 6*L/math.pow((Gr/4),.25);\n", + "print '%s %.3f %s' %(\"\\n Boundary Layer thickness at trailing edge for no air stream\",del1,\"m\");\n", + "\n", + "Re = v2*L/uv;\n", + "print '%s %.2e %s' %(\"\\n\\n For air stream at 5 m/s As the Reynolds Number is \",Re,\"the free convection boundary layer is Laminar\");\n", + "del2 = 5*L/math.pow((Re),.5);\n", + "print '%s %.4f %s' %(\"\\n Boundary Layer thickness at trailing edge for air stream at 5 m/s is\",del2,\"m\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Boundary Layer thickness at trailing edge for no air stream 0.023 m\n", + "\n", + "\n", + " For air stream at 5 m/s As the Reynolds Number is 6.96e+04 the free convection boundary layer is Laminar\n", + "\n", + " Boundary Layer thickness at trailing edge for air stream at 5 m/s is 0.0047 m\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.2 Page 572 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "Ts = 232+273.; \t\t\t#[K] Surface Temperature\n", + "Tsurr = 23+273.; \t\t#[K] Surrounding Temperature\n", + "L = .71; \t\t#[m] length\n", + "w = 1.02; \t\t#[m] Width\n", + "\n", + "#Table A.4 Air Properties T = 400 K\n", + "k = 33.8*math.pow(10,-3) \t;#[W/m.K]\n", + "uv = 26.4*math.pow(10,-6) \t;#[m^2/s] Kinematic Viscosity\n", + "al = 38.3*math.pow(10,-6)\t;#[m^2/s]\n", + "be = 2.5*math.pow(10,-3) \t;#[K^-1] Tf^-1\n", + "Pr = .69 \t\t;# Prandtl number \n", + "g = 9.81 \t;#[m^2/s] gravitational constt\n", + "#calculations and results\n", + "Ra = g*be*(Ts-Tsurr)/al*L*L*L/uv;\n", + "print '%s %.2e %s' %(\"\\n\\n As the Rayleigh Number is\",Ra,\"the free convection boundary layer is turbulent\");\n", + "#From equatiom 9.23\n", + "Nu = math.pow(.825 + .387*math.pow(Ra,.16667) /math.pow((1+math.pow((.492/Pr),(9./16.))),(8./27.)),2);\n", + "h = Nu*k/L;\n", + "q = h*L*w*(Ts-Tsurr);\n", + "\n", + "print '%s %d %s' %(\"\\n Heat transfer by convection between screen and room air is\",q,\"W\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + " As the Rayleigh Number is 1.81e+09 the free convection boundary layer is turbulent\n", + "\n", + " Heat transfer by convection between screen and room air is 1060 W\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.3 Page 577" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "Ts = 45+273.; \t\t\t\t#[K] Surface Temperature\n", + "Tsurr = 15+273. \t\t\t\t;#[K] Surrounding Temperature\n", + "H = .3 \t\t\t\t;#[m] Height \n", + "w = .75 \t\t\t\t;#[m] Width\n", + "\n", + "#Table A.4 Air Properties T = 303 K\n", + "k = 26.5*math.pow(10,-3) \t\t;#[W/m.K]\n", + "uv = 16.2*math.pow(10,-6) ;#[m^2/s] Kinematic Viscosity\n", + "al = 22.9*math.pow(10,-6) ;#[m^2/s] alpha\n", + "be = 3.3*math.pow(10,-3) ;#[K^-1] Tf^-1\n", + "Pr = .71 \t\t\t;# Prandtl number \n", + "g = 9.81 \t\t;#[m^2/s] gravitational constt\n", + "#calculations\n", + "Ra = g*be*(Ts-Tsurr)/al*H*H*H/uv; #Length = Height\n", + "#From equatiom 9.27\n", + "Nu = (.68 + .67*math.pow(Ra,.25) /math.pow((1+math.pow((.492/Pr),(9./16.))),(4./9.)));\n", + "#for Sides\n", + "hs = Nu*k/H;\n", + "\n", + "Ra2 = g*be*(Ts-Tsurr)/al*(w/2.)*(w/2.)*(w/2.)/uv; #Length = w/2\n", + "#For top eq 9.31\n", + "ht = k/(w/2.)*.15*math.pow(Ra2,.3334);\n", + "#For bottom Eq 9.32\n", + "hb = k/(w/2.)*.27*math.pow(Ra2,.25);\n", + "\n", + "q = (2*hs*H+ht*w+hb*w)*(Ts-Tsurr);\n", + "#results\n", + "print '%s %d %s' %(\"\\n Rate of heat loss per unit length of duct is\",q,\" W/m\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Rate of heat loss per unit length of duct is 246 W/m\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.4 Page 580 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "Ts = 165+273.; \t\t\t\t#[K] Surface Temperature\n", + "Tsurr = 23+273.; \t\t\t#[K] Surrounding Temperature\n", + "D = .1 \t\t\t\t;#[m] Diameter\n", + "e = .85 \t\t\t\t;# emissivity\n", + "stfncnstt=5.67*math.pow(10,(-8))# [W/m^2.K^4] - Stefan Boltzmann Constant \n", + "\n", + "#Table A.4 Air Properties T = 303 K\n", + "k = 31.3*math.pow(10,-3) ;#[W/m.K] Conductivity\n", + "uv = 22.8*math.pow(10,-6) ;#[m^2/s] Kinematic Viscosity\n", + "al = 32.8*math.pow(10,-6) ;#[m^2/s] alpha\n", + "be = 2.725*math.pow(10,-3) \t;#[K^-1] Tf^-1\n", + "Pr = .697 \t\t;# Prandtl number \n", + "g = 9.81 \t\t;#[m^2/s] gravitational constt\n", + "#calculations\t\n", + "Ra = g*be*(Ts-Tsurr)/al*D*D*D/uv; \n", + "#From equatiom 9.34\n", + "Nu = math.pow((.60 + .387*math.pow(Ra,(1./6.))/math.pow(1+math.pow((.559/Pr),(9./16.)),(8./27.))),2);\n", + "h = Nu*k/D;\n", + "\n", + "qconv = h*math.pi*D*(Ts-Tsurr);\n", + "qrad = e*math.pi*D*stfncnstt*(Ts*Ts*Ts*Ts-Tsurr*Tsurr*Tsurr*Tsurr);\n", + "#results\n", + "print '%s %d %s' %(\"\\n Rate of heat loss per unit length of pipe is \",qrad+qconv,\"W/m\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Rate of heat loss per unit length of pipe is 763 W/m\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.5 Page 592" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Operating Conditions\n", + "To = 35+273. \t\t\t;#[K] Shield Temperature\n", + "Ti = 120+273. \t\t\t;#[K] Tube Temperature\n", + "Di = .1 \t\t\t;#[m] Diameter inner\n", + "Do = .12 \t\t;#[m] Diameter outer\n", + "L = .01 \t\t\t;#[m] air gap insulation\n", + "\n", + "#Table A.4 Air Properties T = 350 K\n", + "k = 30*math.pow(10,-3) ;#[W/m.K] Conductivity\n", + "uv = 20.92*math.pow(10,-6) ;#[m^2/s] Kinematic Viscosity\n", + "al = 29.9*math.pow(10,-6) ;#[m^2/s] alpha\n", + "be = 2.85*math.pow(10,-3) ;#[K^-1] Tf^-1\n", + "Pr = .7 \t\t;# Prandtl number \n", + "g = 9.81 \t;#[m^2/s] gravitational constt\n", + "#Table A.3 Insulation glass fiber T=300K\n", + "kins = .038 \t;#[W/m.K] Conductivity\n", + "#calculations\n", + "Lc = 2*math.pow((2.303*math.log10(Do/Di)),(4./3.))/math.pow((math.pow((Di/2.),(-3./5.))+math.pow((Do/2.),(-3./5.))),(5./3.));\n", + "Ra = g*be*(Ti-To)/al*Lc*Lc*Lc/uv; \n", + "keff = .386*k*math.pow((Pr/(.861+Pr)),.25) *math.pow(Ra,.25);\n", + "q = 2*math.pi*keff*(Ti-To)/(2.303*math.log10(Do/Di));\n", + "\n", + "#From equatiom 9.58 and 3.27\n", + "qin = q*kins/keff;\n", + "#results\n", + "print '%s %d %s' %(\"\\n Heat Loss from pipe per unit of length is \",q,\"W/m\")\n", + "print '%s %d %s' %(\" \\n Heat Loss if air is filled with glass-fiber blanket insulation\",qin,\"W/m\");\n", + "#END" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Heat Loss from pipe per unit of length is 100 W/m\n", + " \n", + " Heat Loss if air is filled with glass-fiber blanket insulation 111 W/m\n" + ] + } + ], + "prompt_number": 5 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_1.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_1.ipynb index 91987df5..bbd8564c 100644 --- a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_1.ipynb +++ b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_1.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:2ba7e707b3be5d9c0c54b9bb8556d6e5f96b70b9fbb7f8e292b6019cfe481029" + "signature": "sha256:bc25f63472470cd0d9d02649f340bc4f8e2133d186eedd53b381a00e86cb80f1" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Introduction" + "chapter 1:Introduction" ] }, { diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_10.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_10.ipynb index bb6c3320..2d8620ac 100644 --- a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_10.ipynb +++ b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_10.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:1967d26762283e30e4854c10c803a16851680afbc2e91b1d3cee7d16421cae2c" + "signature": "sha256:392306ee054c145fada33f7a7c31ceab64682cdf974119e5769354570d9acd35" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Boiling and Condensation" + "chapter 10:Boiling and Condensation" ] }, { diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_11.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_11.ipynb index b185ed9e..8f262870 100644 --- a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_11.ipynb +++ b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_11.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:ab6cb233ee6afa8e8253b650d9b15125740d73ba571b9d5b3c9431dc16631f9d" + "signature": "sha256:5e92567b35993f9c7de62df409e192f4b4e830dd2953d0bcb614e86ff6f77b6a" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Heat Exchangers" + "chapter 11:Heat Exchangers" ] }, { diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_12.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_12.ipynb index 0458d8c6..78c263d6 100644 --- a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_12.ipynb +++ b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_12.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:3f70bd8e66ed069013ea8da0a0db103f64597532e63478b727d2e9fd79a10d32" + "signature": "sha256:c3171d4f6be37f1c20eed107705dadf87c94d4600d85fa92846b137395251728" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Radiation: Processes and Properties" + "chapter 12:Radiation: Processes and Properties" ] }, { diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_13.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_13.ipynb index c86d6c34..50ed9110 100644 --- a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_13.ipynb +++ b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_13.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:0be077d15f32f0d1b8e0a08fdc77fccd31f63a0aa5b7d4531be27e5ff004495f" + "signature": "sha256:718f735e9deabd3cf6e04ce42664673c1d676aadf2f269935a60911c896b761e" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Radiation Exchange between surfaces" + "chapter 13:Radiation Exchange between surfaces" ] }, { diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_14.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_14.ipynb index b13d25b6..e203178b 100644 --- a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_14.ipynb +++ b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_14.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:c20c5ffc14398659aab9089e6b803cb3218676cd974382b644456d53b86a097c" + "signature": "sha256:6468bfb82b0986037161bf3424bdc85db7722be033cc738fbab9c9a4f7a1e63b" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Diffusion Mass Transfer" + "chapter 14:Diffusion Mass Transfer" ] }, { diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_2.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_2.ipynb index d440a2d3..f60d3c20 100644 --- a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_2.ipynb +++ b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_2.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:4b81d2c2d1afd02d772e0a94bc27f4f0abc2b4c7049b86921017b2dd7bb1c1b3" + "signature": "sha256:98143d952f6fd3c22aa1577ff52b407cef934b0f7299125fef9744c40bc10961" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Introduction to conduction" + "chapter 2:Introduction to conduction" ] }, { diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_3.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_3.ipynb index 4cf59010..f113d3f7 100644 --- a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_3.ipynb +++ b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_3.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:ca8839cd8008ad44590694ea2ad13ce425811997673bf9c8b6a013454026c154" + "signature": "sha256:1daabc3f1bacd17510b0620700547a4c595c39635914f6f5a091f9f0968276c6" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "One-dimensional, Steady State Conduction" + "chapter 3:One-dimensional, Steady State Conduction" ] }, { diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_4.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_4.ipynb index 9f1825ca..27e29cfd 100644 --- a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_4.ipynb +++ b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_4.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:d0883c349e6026c1b16a5b0a707e34ddc2310403ffaeb85c40a328facdc14025" + "signature": "sha256:7a36ca161f54aa0f6604b27e857e05421d5f014baf9005c7521eb8d087cd4860" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Two dimensional, Steady State Conduction" + "chapter 4:Two dimensional, Steady State Conduction" ] }, { diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_5.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_5.ipynb index 62378c37..ec04b2f3 100644 --- a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_5.ipynb +++ b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_5.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:eb7d44d988c21bed8e236b270188ea83d6cab7b82a702d6c6ac0888d3618efff" + "signature": "sha256:e6fccdee72826644480a56323a31258e901f94d4dc5888f149c2cb9fbb19fb1b" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Transient Conduction" + "chapter 5:Transient Conduction" ] }, { diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_6.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_6.ipynb index 56b06d80..765e946c 100644 --- a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_6.ipynb +++ b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_6.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:4c9f19718c00e3bd942cd652731d5120db18676ef29029938745f62980f5cff9" + "signature": "sha256:93169d8c4e9ec54ef86bbe976d1fb96e6150bf7ce4a6a6059f273c6286354244" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Introduction to Convection" + "chapter 6:Introduction to Convection" ] }, { diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_7.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_7.ipynb index b47e5d70..61026b5b 100644 --- a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_7.ipynb +++ b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_7.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:12137eba1f5bf47c0fd628804006f0ff8647777d41f9645050b549888507b91d" + "signature": "sha256:aeecd7c0914cfcf6b63a4ecc903c9b4bb4aa650418dfaaff2116b660ef3341e8" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "External Flow" + "chapter 7:External Flow" ] }, { diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_8.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_8.ipynb index ec80846d..63fa2864 100644 --- a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_8.ipynb +++ b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_8.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:bcdb44fcb5c412a8fb12ecf8bc3409e5bc0d03dc35a4f7331daf1db849b5f7af" + "signature": "sha256:2913454d290e23f136a7419fe94a1349a1854f1b6a4a4f758d7077729d913179" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 1, "metadata": {}, "source": [ - "Internal Flow" + "chapter 8:Internal Flow" ] }, { diff --git a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_9.ipynb b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_9.ipynb index 449ae71c..5a184183 100644 --- a/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_9.ipynb +++ b/Fundamentals_of_Heat_and_Mass_Transfer/Chapter_9.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:56bd333b1440dc978cb1a204c216290125fc0bef6769e6c73f6ac7af2e17116b" + "signature": "sha256:128b8303085215918667992d35a01f582bd9d04fa897e73c9cfb4452b88f23dd" }, "nbformat": 3, "nbformat_minor": 0, @@ -21,7 +21,7 @@ "level": 2, "metadata": {}, "source": [ - "Example 9.1 Page 569" + "chapter 9:Example 9.1 Page 569" ] }, { diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_03-checkpoint.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_03-checkpoint.ipynb new file mode 100644 index 00000000..dd27a183 --- /dev/null +++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_03-checkpoint.ipynb @@ -0,0 +1,457 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:18e19bec17b5f55566a2079756ce3fc602f406d3355e580aba8938f8d7833673" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 3: Process Variables" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 3.2, Page number: 17" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + " \n", + "#Variable Declaration:\n", + "Q1 = 8.03 #Years(part 1)\n", + "D = 365 #Days in a year\n", + "H = 24 #Hours in a day\n", + "M = 60 #Minutes in an hour\n", + "S = 60 #Seconds in a minute\n", + "Q2 = 150 #Miles per hour(part 2)\n", + "FM = 5280 #Feet in a mile\n", + "YF = 1.0/3.0 #Yard in a feet\n", + "Q3 = 100 #Meter per second square(part 3)\n", + "Cmm = 100 #Centimeter in a meter\n", + "FC = 1.0/30.48 #Feet in a centimeter\n", + "SsMs = 60**2 #Second square in a minute square\n", + "Q4 = 0.03 #Gram per centimeter cube (part 4)\n", + "PG = 1.0/454.0 #Pound in a gram\n", + "CF = (30.48)**3 #Centimeter in a feet\n", + " \n", + "#Calculation:\n", + "A1 = Q1*D*H*M*S #Seconds (s)\n", + "A2 = Q2*FM*YF #Yards per hour (yd/hr)\n", + "A3 = Q3*Cmm*FC*SsMs #Feet per min square (ft/min^2)\n", + "A4 = Q4*PG*CF #Pound per feet cube (lb/ft^3)\n", + " \n", + "#Results:\n", + "print \"1. Seconds in\",Q1,\"year is:\",round(A1/10**8,2),\" x 10**8 s\"\n", + "print \"2. Yards per hour in\",Q2,\"miles per hour is:\",round(A2/10**5,1),\" x 10**5 yd/h\"\n", + "print \"3. Feets per minute square in\",Q3,\"meter per square is:\",round(A3/10**6,3),\" x 10**6 ft/min^2\"\n", + "print \"4. Pounds per feet cube in\",Q4,\"gram per centimeter cube is:\",round(A4),\"lb/ft^3\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1. Seconds in 8.03 year is: 2.53 x 10**8 s\n", + "2. Yards per hour in 150 miles per hour is: 2.6 x 10**5 yd/h\n", + "3. Feets per minute square in 100 meter per square is: 1.181 x 10**6 ft/min^2\n", + "4. Pounds per feet cube in 0.03 gram per centimeter cube is: 2.0 lb/ft^3\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 3.3, Page number: 21" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + " \n", + "#Variable Declaration:\n", + "Q1 = 32.2 #Gravitational acceleration (ft/s^2) (part 1)\n", + "CF = 32.2 #Conversion factor (lb.ft/lbf.s^2)\n", + "M = 100 #Mass (lb)\n", + "SA = 3 #Surface area (in^2)\n", + "FsIs = (1.0/12.0)**2 #Feet square in a inch square\n", + "Q2 = 14.7 #Atmospheric pressure (psi) (part 2)\n", + "GP = 35 #Gauge Pressure (psig)\n", + " \n", + "#Caculations:\n", + "F = M*Q1/CF #Force (lbf)\n", + "P = F/SA/FsIs #Pressure at the base (lbf/ft^2)\n", + "Pa = GP+Q2 #Absolute pressure (psia)\n", + " \n", + "#Results:\n", + "print \"1. Pressure at the base is:\",round(P),\"lbf/ft^2\"\n", + "print \"2. Absolute pressure is:\",round(Pa,1),\"psia\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1. Pressure at the base is: 4800.0 lbf/ft^2\n", + "2. Absolute pressure is: 49.7 psia\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 3.4, Page number: 23" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + " \n", + "#Variable Declaration:\n", + "Q1 = 20.0 #Mass (lb) (part 1)\n", + "MH = 1.008 #Molecular weight of H (lb/lbmol)\n", + "MO = 15.999 #Molecular weight of O (lb/lbmol)\n", + "Q2 = 454 #Gram in pound (part 2)\n", + "Q3 = 6.023*10**23 #Avogadro nuber (part 3)\n", + " \n", + "#Calculations:\n", + "Mol = 2*MH+MO #Molecular weight of water (lb/lbmol)\n", + "A1 = Q1/Mol #Pound.moles of water (lbmol)\n", + "A2 = Q1*Q2/Mol #Gram.moles of water (gmol)\n", + "A3 = A2*Q3 #Molecules of water (molecules)\n", + " \n", + "#Results:\n", + "print \"1. Pound.moles of water is:\",round(A1,2),\"lbmol water\"\n", + "print \"2. Gram.moles of water is:\",round(A2),\"gmol water\"\n", + "print \"3. Molecules of water is:\",round(A3/10**26,3),\" x 10**26 molecules\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1. Pound.moles of water is: 1.11 lbmol water\n", + "2. Gram.moles of water is: 504.0 gmol water\n", + "3. Molecules of water is: 3.036 x 10**26 molecules\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 3.5, Page number: 25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + " \n", + "#Variable declaration:\n", + "SG = 0.92 #Specific gavity of liquid, methanol\n", + "DW = 62.4 #Density of reference substance, water (lb/ft^3)\n", + " \n", + "#Calculation:\n", + "DM = SG*DW #Density of methanol (lb/ft^3)\n", + " \n", + "#Result:\n", + "print \"Density of methanol is:\",round(DM,1),\"lb/ft^3\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Density of methanol is: 57.4 lb/ft^3\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 3.6, Page number: 27\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + " \n", + "#Variable declaration:\n", + "SG = 0.8 #Specific Gravity\n", + "AV = 0.02 #Absolute Viscosity (cP)\n", + "cP = 1 #Viscosity of centipoise (cP)\n", + "VcP = 6.72 * 10**-4 #Pound per feet.sec in a centipoise (lb/ft.s)\n", + "pR = 62.43 #Reference density (lb/ft^3)\n", + " \n", + "#Calculations:\n", + "u = AV*VcP/cP #Viscosity of gas (lb/ft.s)\n", + "p = SG*pR #Density of gas (lb/ft^3)\n", + "v = u/p #Kinematic viscosity of gas (ft^2/s)\n", + " \n", + "#Result:\n", + "print \"Kinematic viscosity of gas is:\",round(v/10**-7,3),\"x 10**-7 ft^2/s\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Kinematic viscosity of gas is: 2.691 x 10**-7 ft^2/s\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 3.7, Page number: 27" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + " \n", + "#Variable declaration:\n", + "X = 7.0 #Coordinate X of H2SO4\n", + "Y = 24.8 #Coordinate Y of H2SO4\n", + "S = 45 #Slope\n", + " \n", + "#Calculations:\n", + "#From the figure C.1 we found the intersection of curves mu = 12cP\n", + "mu = 12\n", + " \n", + "#Results:\n", + "print \"Absolute viscosity of a 98% sulfuric acid solution at 45\u00b0 C is :\",mu*10**-2,\" g/cm.s\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Absolute viscosity of a 98% sulfuric acid solution at 45\u00b0 C is : 0.12 g/cm.s\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 3.8, Page number: 28" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + " \n", + "#Variable declaration:\n", + "CpM = 0.61 #Heat capacity of methanol (cal/g.\u00b0C)\n", + "G = 454 #Grams in a pound\n", + "B = 1.0/252.0 #Btu in a calorie\n", + "C = 1.0/1.8 #Degree celsius in a degree fahrenheit\n", + " \n", + "#Calculation:\n", + "Cp = CpM*G*B*C #Heat capacity in English units (Btu/lb.\u00b0F)\n", + " \n", + "#Result:\n", + "print \"Heat capacity in English units is: \",round(Cp,2),\" Btu/lb.\u00b0F\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat capacity in English units is: 0.61 Btu/lb.\u00b0F\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 3.9, Page number: 29" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + " \n", + "#Variable declaration:\n", + "kM = 0.0512 #Thermal conductivity of methanol (cal/m.s\u00b0C)\n", + "B = 1.0/252.0 #Btu in a calorie\n", + "M = 0.3048 #Meters in a feet\n", + "S = 3600 #Seconds in an hour\n", + "C = 1.0/1.8 #Degree celsius in a degree fahrenheit\n", + " \n", + "#Calculation:\n", + "k = kM*B*M*S*C #Thermal conductivity in English units (Btu/ft.h.\u00b0F)\n", + " \n", + "#Result:\n", + "print \"Thermal coductivity in English units is:\",round(k,3),\"Btu/ft.h.\u00b0F\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thermal coductivity in English units is: 0.124 Btu/ft.h.\u00b0F\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 3.11, Page number: 31" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + " \n", + "#Variable declaration:\n", + "D = 5 #Diameter of pipe (ft)\n", + "V = 10 #Fluid velocity (ft/s)\n", + "p = 50 #Fluid density (lb/ft^3)\n", + "u = 0.65 #Fluid viscosity (lb/ft.s)\n", + "F = 1.0/12.0 #Feet in an inch\n", + "VCp = 6.72*10**-4 #Viscosity of centipoise (lb/ft.s)\n", + " \n", + "#Calculation:\n", + "A = D*V*p*F/u/VCp #Reynolds Number\n", + " \n", + "#Result:\n", + "if(A>2100):\n", + " print \"The Reynolds number is :\",round(A,-2),\"; therefore, the flow is turbulent.\"\n", + "elif(A<2100):\n", + " print \"The Reynolds number is :\",round(A,-2),\"; therefore, the flow is not turbulent.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Reynolds number is : 477000.0 ; therefore, the flow is turbulent.\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 3.12, Page number: 32" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration:\n", + "#For the problem at hand, take as a basis 1 kilogram of water and assume the potential energy to be zero at ground level conditions.\n", + "z1 = 0 #Intial height from ground level (m)\n", + "z2 = 10 #Final height from ground level (m)\n", + "PE1 = 0 #Initial potential energy at z1 (J)\n", + "m = 1 #Mass of water (kg)\n", + "g = 9.8 #Gravitational acceleration (m/s^2)\n", + "gc = 1 #Conversion factor\n", + " \n", + "#Calculations:\n", + "PE2 = m*(g/gc)*z2 #Final potential energy at z2 (J)\n", + " \n", + "#Result:\n", + "print \"The potential energy of water is :\",PE2,\"J \"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The potential energy of water is : 98.0 J \n" + ] + } + ], + "prompt_number": 14 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_04-checkpoint.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_04-checkpoint.ipynb new file mode 100644 index 00000000..3fece5a7 --- /dev/null +++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_04-checkpoint.ipynb @@ -0,0 +1,555 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:da9a4303c6fc07c594d52c82662dd9ab6e23eae788f020d82b784ed3a6873663" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 4: The Conservation Law for Momentum" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 4.1, Page number: 39" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "Vx_in = 420 #Entry Velocity in X direction (m/s)\n", + "Vx_out = 0 #Exit Velocity in X direction (m/s)\n", + "Vy_in = 0 #Entry Velocity in Y direction (m/s)\n", + "Vy_out = 420 #Exit Velocity in Y direction (m/s)\n", + "m = 0.15 #Rate of water entrained by the steam (kg/s)\n", + "lb = 1.0/4.46 #Pound force in a newton force\n", + "\n", + "#Calculations:\n", + "Mx_out = m*Vx_out #Rate of change of momentum at entry in x-direction (kg.m)\n", + "Mx_in = m*Vx_in #Rate of change of momentum at exit in x-direction (kg.m)\n", + "My_out = m*Vy_out #Rate of change of momentum at entry in y-direction (kg.m)\n", + "My_in = m*Vy_in #Rate of change of momentum at exit in y-direction (kg.m)\n", + "Fxgc = (Mx_out - Mx_in)*lb #Force in X direction (lbf)\n", + "Fygc = (My_out - My_in)*lb #Force in X direction (lbf)\n", + "\n", + "#Results:\n", + "if Fxgc < 1:\n", + " print \"The x-direction supporting force acting on the 90\u00b0 elbow is :\",round(-Fxgc,1),\" lbf acting toward the left. \"\n", + "else:\n", + " print \"The x-direction supporting force acting on the 90\u00b0 elbow is :\",round(Fxgc,1),\" lbf acting toward the right. \"\n", + "if Fygc < 1:\n", + " print \"The y-direction supporting force acting on the 90\u00b0 elbow is :\",round(-Fygc,1),\" lbf acting downwards. \" \n", + "else:\n", + " print \"The y-direction supporting force acting on the 90\u00b0 elbow is :\",round(Fygc,1),\" lbf acting upwards. \"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The x-direction supporting force acting on the 90\u00b0 elbow is : 14.1 lbf acting toward the left. \n", + "The y-direction supporting force acting on the 90\u00b0 elbow is : 14.1 lbf acting upwards. \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 4.2 Page number: 40" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from math import sqrt,degrees,atan2\n", + "\n", + "#Variable declaration:\n", + "Fx = -63 #Force component in X direction (N)\n", + "Fy = 63 #Force component in Y direction (N)\n", + "lbf = 0.22481 #Pound-forrce in unit newton (lbf)\n", + "\n", + "#Calculations:\n", + "Fr = sqrt(Fx**2 + Fy**2)*lbf #The resultant supporting force (lbf)\n", + "u = degrees(atan2(Fy,Fx)) #Angle between the positive x axis and the direction of the force (degrees)\n", + "\n", + "#Result: \n", + "if (02100):\n", + " print \"The flow is turbulant.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The flow is laminar.\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 6.13, Page number: 82" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "#From example 6.12, we have:\n", + "D = 2.0/12.0 #Diameter of pipe in feet (ft)\n", + "Re = 1440.0 #Reynolds number\n", + "\n", + "#Calculation:\n", + "Lc = 0.05*D*Re #Length of pipe (ft)\n", + "\n", + "#Result:\n", + "print \"The pipe length to ensure a fully developed flow is:\",Lc,\" ft.\"\n", + "print \"This is an abnormally long calming length for a pipe (or tube) in a heat exchanger.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The pipe length to ensure a fully developed flow is: 12.0 ft.\n", + "This is an abnormally long calming length for a pipe (or tube) in a heat exchanger.\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 6.14, Page number: 82" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "u = 6.72*10**-4 #Viscosity of water (lb/ft.s)\n", + "p = 62.4 #Density of water (lb/ft^3)\n", + "#For laminar flow:\n", + "Re = 2100.0 #Reynolds number\n", + "#From table 6.2, we have:\n", + "D = 2.067/12.0 #Inside diameter of pipe (ft)\n", + "\n", + "#Calculation:\n", + "V = Re*u/D/p #Average velocity of water flowing (ft/s)\n", + "\n", + "#Result:\n", + "print \"The average velocity of water flowing is:\",round(V,2),\" ft/s.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The average velocity of water flowing is: 0.13 ft/s.\n" + ] + } + ], + "prompt_number": 14 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_07-checkpoint.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_07-checkpoint.ipynb new file mode 100644 index 00000000..bfa882d7 --- /dev/null +++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_07-checkpoint.ipynb @@ -0,0 +1,412 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:057d6eaa086db820c820c1a5a80f0143b18739ecbe1b8c285287723cf460e4b6" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 7: Steady-State Heat Conduction" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 7.1, Page number: 93" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "Q = 3000.0 #The rate of heat flow through the glass window (W)\n", + "L = 0.01 #Thickness of glass window (m)\n", + "A = 3.0 #Area of heat transfer (m^2)\n", + "TC = 10+273 #Temperature at the outside surface (K)\n", + "k = 1.4 #Thermal onductivity of glass (W/m.K)\n", + "\n", + "#Calculation:\n", + "TH = TC+Q*L/k/A #Temperature at the inner surface (K)\n", + "\n", + "#Result:\n", + "print \"The temperature at the inner surface is :\",round(TH,1),\" K\"\n", + "print \"The temperature at the inner surface is :\",round(TH-273,1),\" \u00b0C\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The temperature at the inner surface is : 290.1 K\n", + "The temperature at the inner surface is : 17.1 \u00b0C\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 7.2, Page number: 94" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "k = 0.026 #Thermal conductivity of insulating material (Btu/ft.h.\u00b0F)\n", + "L = 1.0 #Thickness of insulating material (ft)\n", + "TC = 70.0 #Temperature on the cold side surface (\u00b0F)\n", + "TH = 210.0 #Temperature on the hot side surface (\u00b0F)\n", + "c = 0.252 #Kilocalorie per hour in a Btu per hour\n", + "m = 0.093 #meter square in a feet square\n", + "\n", + "#Calculation:\n", + "DT = TH-TC #Change in temperature (\u00b0F)\n", + "Q1 = k*DT/L #Rate of heat flux throughthe wall (Btu/f^t2.h.)\n", + "Q2 = Q1*c/m #Rate of heat flux throughthe wall in SI units (kcal/m^2.h)\n", + "\n", + "#Result:\n", + "print \"The rate of heat flux in Btu/ft^2.h is :\",round(Q1,3),\" Btu/ft^2.h .\"\n", + "print \"The rate of heat flux in SI units is :\",round(Q2,3),\" kcal/m^2.h .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The rate of heat flux in Btu/ft^2.h is : 3.64 Btu/ft^2.h .\n", + "The rate of heat flux in SI units is : 9.863 kcal/m^2.h .\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 7.3, Page number: 94" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "TH = 1592.0 #Temperature of inside surface (K)\n", + "TC = 1364.0 #Temperature of outside surface (K)\n", + "H = 3.0 #Height of furnace wall (m)\n", + "W = 1.2 #Width of furnace wall (m)\n", + "L = 0.17 #Thickness furnace wall (m)\n", + "m = 0.0929 #Meter square per second in a feet square per second\n", + "Btu = 3.412 #Btu per hour in a Watt\n", + "Btu2 = 0.3171 #Btu per feet square hour in a watt per meter square\n", + "\n", + "#Calculation:\n", + "Tav = (TH+TC)/2 #Average wall temperature (K)\n", + "#From Table in Appendix:\n", + "p = 2645.0 #Density of material (kg/m^3)\n", + "k = 1.8 #Thermal conductivity (W/m.K)\n", + "Cp = 960.0 #Heat capacity of material (J/kg.K)\n", + "a = k/(p*Cp)/m #Thermal diffusivity (ft^2/s)\n", + "t = (TC-TH)/L #Temperature gradient (\u00b0C/m)\n", + "A = H*W #Heat transfer area (m^2)\n", + "Q1 = k*A*(TH-TC)/L*Btu #Heat transfer rate (Btu/h)\n", + "Q2 = k*(TH-TC)/L*Btu2 #Heat transfer flux (Btu/h.ft^2)\n", + "R = L/(k*A) #Thermal resistance (\u00b0C/W)\n", + "\n", + "#Result:\n", + "print \"The temperature gradient is :\",round(t),\" \u00b0C/m.\"\n", + "print \"The heat transfer rate is :\",round(Q1),\" Btu/h.\"\n", + "print \"The heat transfer flux is :\",round(Q2,1),\" Btu/h.ft^2.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The temperature gradient is : -1341.0 \u00b0C/m.\n", + "The heat transfer rate is : 29653.0 Btu/h.\n", + "The heat transfer flux is : 765.5 Btu/h.ft^2.\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 7.4, Page number: 96" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "TH = 25.0 #Temperature at inner suface of wall (\u00b0C)\n", + "TC = -15.0 #Temperature at outer suface of wall (\u00b0C)\n", + "L = 0.3 #Thickness of wall (m)\n", + "k = 1.0 #Thermal conductivity of concrete (W/m)\n", + "A = 30.0 #Sueface area of wall (m^2)\n", + "\n", + "#Calculation:\n", + "DT = TH-TC #Driving force for heat transfer (\u00b0C) (part 2)\n", + "R = L/(k*A) #Thermal resistance (\u00b0C/W) (part 3)\n", + "Q = DT/R/10**3 #Heat loss through the wall (kW)\n", + "\n", + "#Result:\n", + "print \"1. Theoretical part.\"\n", + "print \"2. The driving force for heat transfer is :\",DT,\" \u00b0C.\"\n", + "print \"3. The heat loss through the wall is :\",Q,\" kW.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1. Theoretical part.\n", + "2. The driving force for heat transfer is : 40.0 \u00b0C.\n", + "3. The heat loss through the wall is : 4.0 kW.\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 7.5, Page number: 97" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "TC = 27.0 #Inside temperature of walls (\u00b0C)\n", + "TH = 68.7 #Outside temperature of walls (\u00b0C)\n", + "LC = 6*0.0254 #Thickness of concrete (m)\n", + "LB = 8*0.0254 #Thickness of cork-board (m)\n", + "LW = 1*0.0254 #Thickness of wood (m)\n", + "kC = 0.762 #Thermal conductivity of concrete (W/m.K)\n", + "kB = 0.0433 #Thermal conductivity of cork-board (W/m.K)\n", + "kW = 0.151 #Thermal conductivity of wood (W/m.K)\n", + "\n", + "#Calculation:\n", + "RC = LC/kC #Thermal resistance of concrete (K/W)\n", + "RB = LB/kB #Thermal resistance of cork-board (K/W)\n", + "RW = LW/kW #Thermal resistance of wood (K/W)\n", + "Q = (TC-TH)/(RC+RB+RW) #Heat transfer rate across the wall (W)\n", + "T = -(Q*RW-TC) #Interface temperature between wood and cork-board (K)\n", + "\n", + "#Result:\n", + "print \"The heat transfer rate across the wall is :\",round(Q,3),\" W.\"\n", + "print \"The interface temperature between wood and cork-board is :\",round(T,1),\" \u00b0C.\"\n", + "print \"The interface temperature between wood and cork-board is :\",round(T+273,1),\" K.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The heat transfer rate across the wall is : -8.239 W.\n", + "The interface temperature between wood and cork-board is : 28.4 \u00b0C.\n", + "The interface temperature between wood and cork-board is : 301.4 K.\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 7.6, Page number: 98" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from math import pi, log\n", + "from sympy import symbols\n", + "\n", + "#Variable declaration:\n", + "Z = symbols ('z') #Length of pipe\n", + "D1s = 4.0 #Glass wool inside diameter (in)\n", + "D2s = 8.0 #Glass wool outside diameter (in)\n", + "D1a = 3.0 #Asbestos inside diameter (in)\n", + "D2a = 4.0 #Asbestos outside diameter (in)\n", + "TH = 500.0 #Outer surface temperature of pipe (\u00b0F)\n", + "TC = 100.0 #Outer surface temperature of glass wool (\u00b0F)\n", + "La = 0.5/12.0 #Thickness of asbestos (ft)\n", + "Lb = 2.0/12.0 #Thickness of glss wool (ft)\n", + "ka = 0.120 #Thermal conductivity of asbestos (Btu/h.ft.\u00b0F)\n", + "kb = 0.0317 #Thermal conductivity of asbestos (Btu/h.ft.\u00b0F)\n", + "\n", + "#Calculation:\n", + "Aa = (pi*Z*(D2a-D1a)/12.0)/log(D2a/D1a) #Area of asbestos (ft^2)\n", + "Ab = (pi*Z*(D2s-D1s)/12.0)/log(D2s/D1s) #Area of glass wool (ft^2)\n", + "Q1 = (TH-TC)/(La/(ka*Aa)+Lb/(kb*Ab)) #Steady-state heat transfer per foot of pipe (Btu/h.)\n", + "Q2 = Q1/Z #Factorization of Q/Z (Btu/h.ft)\n", + "\n", + "#Result:\n", + "print \"The steady-state heat transfer per foot of pipe, Z, is :\",round(Q1/Z,1),\" x z Btu/h.\"\n", + "print \"The steady-state heat transfer factorizating out Z is :\",round(Q2,1),\" Btu/h.ft.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The steady-state heat transfer per foot of pipe, Z, is : 103.6 x z Btu/h.\n", + "The steady-state heat transfer factorizating out Z is : 103.6 Btu/h.ft.\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 7.7, Page number: 99" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "#From example 7.6:\n", + "TH = 500 #Outer surface temperature of pipe (\u00b0F)\n", + "Lb = 2.0/12.0 #Thickness of glss wool (ft)\n", + "kb = 0.0317 #Thermal conductivity of asbestos (Btu/h.ft.\u00b0F)\n", + "Ab = 1.51 #Area of glass wool (ft^2)\n", + "Q = 103.5 #Steady-state heat transfer per foot of pipe (Btu/h.)\n", + "La = 0.5/12.0 #Thickness of asbestos (ft)\n", + "ka = 0.120 #Thermal conductivity of asbestos (Btu/h.ft.\u00b0F)\n", + "Aa = 0.91 #Area of asbestos (ft^2)\n", + "TC = 100 #Outer surface temperature of glass wool (\u00b0F)\n", + "\n", + "#Calculation:\n", + "Ti_b = -((Lb*Q)/(kb*Ab)-TH) #Interfacial temperature of glass wool layer (\u00b0F)\n", + "Ti_a = (Q*La)/(ka*Aa)+TC #Interfacial temperature of asbestos layer (\u00b0F)\n", + "\n", + "#Result:\n", + "print \"The interfacial temperature of glass wool layer is :\",round(Ti_b),\" \u00b0F.\"\n", + "print \"The interfacial temperature of asbestos layer is :\",round(Ti_a,1),\" \u00b0F.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The interfacial temperature of glass wool layer is : 140.0 \u00b0F.\n", + "The interfacial temperature of asbestos layer is : 139.5 \u00b0F.\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 7.8, Page number: 100" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from sympy import cos,symbols,diff,pi\n", + "\n", + "#Variable declaration:\n", + "z,h,k = symbols('z, h, k') #Length, height, thermal conductivity\n", + "T = 100*cos((pi*z)/(2*h)) #Temperature of solid slab\n", + "\n", + "#Calculation:\n", + "DT = diff(T,z) #Temperature at z\n", + "Q = -k*(DT) #Heat flux in slab (Btu/s.ft^2)\n", + "Q1 = Q.subs(z,0) #Heat flux in slab at z = 0 (Btu/s.ft^2)\n", + "Q2 = Q.subs(z,h) #Heat flux in slab at z = h (Btu/s.ft^2)\n", + "\n", + "#Result:\n", + "print \"The heat flux in slab is :\",Q,\" Btu/s.ft^2 .\"\n", + "print \"The heat flux in slab at z = 0 is :\",Q1,\" Btu/s.ft^2 .\"\n", + "print \"The heat flux in slab at z = h is :5\",Q2,\" Btu/s.ft^2 .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The heat flux in slab is : 50*pi*k*sin(pi*z/(2*h))/h Btu/s.ft^2 .\n", + "The heat flux in slab at z = 0 is : 0 Btu/s.ft^2 .\n", + "The heat flux in slab at z = h is :5 50*pi*k/h Btu/s.ft^2 .\n" + ] + } + ], + "prompt_number": 8 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_08-checkpoint.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_08-checkpoint.ipynb new file mode 100644 index 00000000..51da1dc2 --- /dev/null +++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_08-checkpoint.ipynb @@ -0,0 +1,73 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:f803274ef7ccff0534bae20ab018bc7691f3977ae1b9f41d5ea33a08004d0ffb" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 8: Unsteady-State Heat Conduction" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 8.4, Page number: 122" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from math import pi,sin,e\n", + "\n", + "#Variable declaration:\n", + "k = 9.1 #Thermal coductivity of steel rod (Btu/h.ft.\u00b0F)\n", + "p = 0.29*1728 #Density of steel rod (lb/ft^3)\n", + "Cp = 0.12 #Heat capacity of steel rod (Btu/lb.\u00b0F)\n", + "P = 15+14.7 #Absolute pressure (psia)\n", + "Ta = 71.0 #Initial temperature (\u00b0F)\n", + "L = 20.0/12.0 #Length of rod (ft)\n", + "t = 30.0/60.0 #Time taken (h)\n", + "x = 0.875/12.0 #Length from one of end (ft)\n", + "#From assumption:\n", + "n = 1.0 #First term\n", + "#From tables in Appendix:\n", + "Ts = 249.7 #Saturated steam temperature (\u00b0F)\n", + "\n", + "#Calculation:\n", + "a = k/(p*Cp) #Thermal diffusivity (ft^2/s)\n", + "T = Ts+(Ta-Ts)*(((n+1)*(-1)**2 + 1 )/pi)*e**((-a*((n*pi)/L)**2)*t)*sin((n*pi*x)/L) #Temperature 0.875 inches from one of the ends after 30 minutes (\u00b0F)\n", + "\n", + "#Result:\n", + "print \"The temperature 0.875 inches from one of the ends after 30 minutes is :\",round(T),\" \u00b0F.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The temperature 0.875 inches from one of the ends after 30 minutes is : 232.0 \u00b0F.\n" + ] + } + ], + "prompt_number": 4 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_09-checkpoint.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_09-checkpoint.ipynb new file mode 100644 index 00000000..cba4bd5f --- /dev/null +++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_09-checkpoint.ipynb @@ -0,0 +1,612 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:717821d247948d7fb9af37b8a67927013610ff26888719ba58ba9ef00c80f713" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 9: Forced Convection" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 9.1, Page number: 135" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "D = 1.0 #Diamete of vessel (ft)\n", + "L = 1.5 #Length of vessel (ft)\n", + "T1 = 390.0 #Surface temperature of vessel (\u00b0F)\n", + "T2 = 50.0 #Surrounding temperature of vessel (\u00b0F)\n", + "h = 4.0 #Convective heat transfer coefficient (Btu/h.ft.\u00b0F)\n", + "\n", + "#Calculation:\n", + "A = pi*D*L+2*pi*(D/2)**2 #Total heat transfer area (ft^2)\n", + "Q = h*A*(T1-T2) #Rate of heat transfer (Btu/h)\n", + "R = 1/(h*A) #Thermal resistance (\u00b0F.h/Btu)\n", + "\n", + "#Result:\n", + "print \"The thermal resistance of vessel wal is :\",round(R,4),\" \u00b0F.h/Btu .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The thermal resistance of vessel wal is : 0.0398 \u00b0F.h/Btu .\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 9.2, Page number: 135" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''Referring to the previous example, convert the resistance to K/W and \u00b0C/W.\n", + "'''\n", + "\n", + "#Variable declaration:\n", + "#From example 9.1:\n", + "R = 0.0398 #Theral resistance (\u00b0F.h/Btu)\n", + "Btu = 3.412 #Btu/h in a watt\n", + "C = 1.8 #Change in degree fahrenheit for a degree change in celsius\n", + "K = 1 #Change in degree celsius for a unit change in Kelvin\n", + "\n", + "#Calculation:\n", + "Rc = R*Btu/C #Thermal resistance in degree cesius per watt (\u00b0C/W)\n", + "Rk = Rc/K #Thermal resistance in Kelvin per watt (K/W)\n", + "\n", + "#Result:\n", + "print \"The thermal resistance in \u00b0C/W is :\",round(Rc,3),\" \u00b0C/W.\"\n", + "print \"The thermal resistance in K/W is :\",round(Rk,3),\" K/W.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The thermal resistance in \u00b0C/W is : 0.075 \u00b0C/W.\n", + "The thermal resistance in K/W is : 0.075 K/W.\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 9.3, Page number: 136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "h = 48.0 #Convective heat transfer coefficient (Btu/h.ft.\u00b0F)\n", + "A = 2*1.5 #Total heat transfer area (ft^2)\n", + "Ts = 530.0 #Surface temperature of plate (\u00b0F)\n", + "Tm = 105.0 #Maintained temperature of opposite side of plate (\u00b0F)\n", + "kW = 3.4123*10**3 #Units kW in a Btu/h\n", + "\n", + "#Calculation:\n", + "Q = h*A*(Ts-Tm) #Heat transfer rate in Btu/h (Btu/h)\n", + "Q1 = Q/kW #Heat transfer rate in kW (kW)\n", + "\n", + "#Result:\n", + "print \"The heat transfer rate in Btu/h is :\",round(Q),\" Btu/h.\"\n", + "print \"The heat transfer rate in kW is :\",round(Q1,2),\" kW.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The heat transfer rate in Btu/h is : 61200.0 Btu/h.\n", + "The heat transfer rate in kW is : 17.94 kW.\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 9.4, Page number: 136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "TS = 10+273 #Outer surface temperature of wall (K)\n", + "Q = 3000.0 #Heat transfer rate (W)\n", + "h = 100.0 #Convection coefficient of air (W/m^2)\n", + "A = 3.0 #Area of glass window (m^2)\n", + "\n", + "#Calculation:\n", + "TM = TS-Q/(h*A) #Bulk temperature of fluid (K)\n", + "\n", + "#Result:\n", + "print \"The bulk temperature of fluid is :\",round(TM),\" K.\"\n", + "print \"The bulk temperature of fluid is :\",round(TM-273),\" \u00b0C.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The bulk temperature of fluid is : 273.0 K.\n", + "The bulk temperature of fluid is : 0.0 \u00b0C.\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 9.5, Page number: 137" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "h = 24.0 #Plant operating hour per day (h/day)\n", + "d = 350.0 #Plant operating day per year (day/yr)\n", + "\n", + "#Calculation:\n", + "N = h*d #Operating hours per year (h/yr)\n", + "#From example 9.1:\n", + "Q = 8545.0 #Rate of energy loss (Btu/h)\n", + "Qy = Q*N #Steady-state energy loss yearly (Btu/yr)\n", + "\n", + "#Result:\n", + "print \"The yearly steady-state energy loss is :\",round(Qy/10**7,2),\" x 10^7 Btu/yr.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The yearly steady-state energy loss is : 7.18 x 10^7 Btu/yr.\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 9.7, Page number: 148" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from sympy import symbols, integrate\n", + "\n", + "#Variable declaration:\n", + "x = 0.3 #Length from the leading age of the plate (m)\n", + "L = 1.2 #Length of plate (m)\n", + "TS = 58.0 #Surface temperature of plate (\u00b0C)\n", + "Ta = 21.0 #Temperature of flowing air (\u00b0C)\n", + "\n", + "#Calculation:\n", + "hx = 25/x**0.4 #Local heat transfer coefficient at 0.3m (W/m^2.K) (Part 1)\n", + "y = symbols('y') #Length\n", + "hy = 25/y**0.4 #hx at the end of the plate (W/m^2.K)\n", + "h = integrate(hy, (y,0,L))/L #Average heat transfer coefficient (W/m^2.K)\n", + "Q = hx*(TS-Ta) #Heat flux at 0.3m from leading edge of plate (W/m^2)\n", + "hL = 25/L**0.4 #Local heat transfer coefficient at plate end (W/m^2.K) (Part 2) \n", + "r = h/hL #Ratio h/hL at the end of the plate\n", + "\n", + "#Result:\n", + "print \"1. The heat flux at 0.3 m from the leading edge of the plate is :\",round(Q),\" W/m^2.\"\n", + "print \"2. The local heat transfer coefficient at the end of the plate is :\",round(hL,1),\" W/m^2.K.\"\n", + "print \"3. The ratio h/hL at the end of plate is :\",round(r,3),\" .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1. The heat flux at 0.3 m from the leading edge of the plate is : 1497.0 W/m^2.\n", + "2. The local heat transfer coefficient at the end of the plate is : 23.2 W/m^2.K.\n", + "3. The ratio h/hL at the end of plate is : 1.667 .\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 9.8, Page number: 150" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "#From example 9.7:\n", + "b = 1.0 #Width of plate (m)\n", + "L = 1.2 #Length of plate (m)\n", + "TS = 58.0 #Surface temperture of plate (\u00b0C)\n", + "Ta = 21.0 #Air flow temperature (\u00b0C)\n", + "h = 38.7 #Average heat transfer coefficient (W/m^2.K)\n", + "\n", + "#Calculation:\n", + "A = b*L #Area for heat transfer for the entire plate (m^2)\n", + "Q = h*A*(TS-Ta) #Rate of heat transfer over the whole length of the plate (W)\n", + "\n", + "#Result:\n", + "print \"The rate of heat transfer over the whole length of the plate is :\",round(Q,-1),\" W.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The rate of heat transfer over the whole length of the plate is : 1720.0 W.\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 9.9, Page number: 150" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from math import pi\n", + "#Variable declaration:\n", + "m = 0.075 #Mass rate of air flow (kg/s)\n", + "D = 0.225 #Diameter of tube (m)\n", + "mu = 208*10**-7 #Dynamic viscosity of fluid (N)\n", + "Pr = 0.71 #Prandtl number\n", + "k = 0.030 #Thermal conductivity of air (W/m.K)\n", + "\n", + "#Calculation:\n", + "Re = 4*m/(pi*D*mu) #Reynolds number\n", + "#From equation 9.26:\n", + "Nu = 0.023*(Re**0.8)*(Pr**0.3) #Nusselt number\n", + "h = (k/D)*Nu #Heat transfer coefficient of air (W/m^2.K)\n", + "\n", + "#Result:\n", + "print \"The Heat transfer coefficient of air is :\",round(h,2),\" W/m^2.K.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Heat transfer coefficient of air is : 7.76 W/m^2.K.\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 9.10, Page number: 150" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "D = 0.902/12.0 #Inside diameter of tube (ft)\n", + "T_in = 60.0 #Temperature water entering the tube (\u00b0F)\n", + "T_out = 70.0 #Temperature water leaving the tube (\u00b0F)\n", + "V = 7.0 #Average wave velocity water (ft/s)\n", + "p = 62.3 #Density of water (lb/ft^3)\n", + "mu = 2.51/3600.0 #Dynamic viscosity of water (lb/ft.s)\n", + "Cp = 1.0 #Viscosity of centipoise (Btu/lb.\u00b0F)\n", + "k = 0.34 #Thermal conductivity of water (Btu/h.ft.\u00b0F)\n", + "\n", + "#Calculation:\n", + "Re = D*V*p/mu #Reynolds Number\n", + "Pr = Cp*mu/k*3600 #Prandtl number\n", + "#From equation 9.26:\n", + "Nu = 0.023*(Re**0.8)*(Pr**0.4) #Nusselt number\n", + "h = (k/D)*Nu #Average film heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n", + "\n", + "#Result:\n", + "print \"The required average film heat transfer coefficient is :\",round(h),\" Btu/h.ft^2.\u00b0F.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The required average film heat transfer coefficient is : 1265.0 Btu/h.ft^2.\u00b0F.\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 9.11, Page number: 151" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "P = 1.0132 * 10**5 #Air pressure (Pa)\n", + "T = 300.0+273.0 #Air temperature (K)\n", + "V = 5.0 #Air flow velocity (m/s)\n", + "D = 2.54/100.0 #Diameter of tube (m)\n", + "R = 287.0 #Gas constant (m^2/s^2.K)\n", + "#From Appendix:\n", + "Pr = 0.713 #Prandtl number of nitrogen\n", + "mu = 1.784*10**(-5) #Dynamic viscosity of nitrogen (kg/m.s)\n", + "k = 0.0262 #Thermal conductivity of nitrogen (W/m.K)\n", + "Cp = 1.041 #Heat capacity of nitrogen (kJ/kg.K)\n", + "\n", + "#Calculation:\n", + "p = P/(R*T) #Density of air\n", + "Re = D*V*p/mu #Reynolds number\n", + "#From table 9.5:\n", + "Nu = 0.023*(Re**0.8)*(Pr**0.3) #Nusselt number\n", + "h = (k/D)*Nu #Heat transfer coefficient (W/m^2.K)\n", + "\n", + "#Result:\n", + "print \"The required Heat transfer coefficient is :\",round(h,2),\" W/m^2.K.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The required Heat transfer coefficient is : 17.57 W/m^2.K.\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 9.12, Page number: 152" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "T1 = 15.0 #Water entering temperature (\u00b0C)\n", + "T2 = 60.0 #Water leaving temperature (\u00b0C)\n", + "D = 0.022 #Inside diameter of tube (m)\n", + "V = 0.355 #Average water flow velocity (m/s)\n", + "TC = 150.0 #Outside wall temperature (\u00b0C)\n", + "#From Appendix:\n", + "p = 993.0 #Density of water (kg/m^3)\n", + "mu = 0.000683 #Dynamic viscosity of water (kg/m.s)\n", + "Cp = 4.17*10**3 #Heat capacity of water (J/kg.K)\n", + "k = 0.63 #Thermal conductivity of water (W/m.K)\n", + "\n", + "#Calculation:\n", + "Tav1 = (T1+T2)/2.0 #Average bulk temperature of water (\u00b0C)\n", + "Re = D*V*p/mu #Reynolds number\n", + "Pr = Cp*mu/k #Prandtl number\n", + "Tav2 = (Tav1+TC)/2.0 #Fluid's average wall temperature (\u00b0C)\n", + "#From Appendix:\n", + "mu_w = 0.000306 #Dynamic viscosity of fluid at wall (kg/m.s)\n", + "#From Table 9.5:\n", + "h = (k/D)*0.027*Re**0.8*Pr**0.33*(mu/mu_w)**0.14 #Heat transfer coefficient for water (W/m^2.K)\n", + "\n", + "#Result:\n", + "print \"The heat transfer coefficient for water is :\",round(h,1),\" W/m^2.K.\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The heat transfer coefficient for water is : 2497.3 W/m^2.K.\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 9.13, Page number: 153" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "#From example 9.7:\n", + "h = 38.7 #Average heat transfer coefficient (W/m^2.K)\n", + "L = 1.2 #Length of plate (m)\n", + "k = 0.025 #Thermal conductivity of air (W/m)\n", + "\n", + "#Calculation:\n", + "Bi = h*L/k #Average Biot number\n", + "\n", + "#Result:\n", + "print \"The average Biot number is :\",round(Bi),\" .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The average Biot number is : 1858.0 .\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 9.14, Page number: 154" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from math import pi\n", + "#Variable declaration:\n", + "k = 60.0 #Thermal conductivity of rod (W/m.K)\n", + "p = 7850.0 #Density of rod (kg/m^3)\n", + "Cp = 434.0 #Heat capacity of rod (J/kg.K)\n", + "h = 140.0 #Convection heat transfer coefficient (W/m^2.K)\n", + "D = 0.01 #Diameter of rod (m)\n", + "kf = 0.6 #Thermal conductivity of fluid (W/m.K)\n", + "L = 2.5 #Length of rod (m)\n", + "Ts = 250.0 #Surface temperature of rod (\u00b0C)\n", + "Tf = 25.0 #Fluid temperature (\u00b0C)\n", + "\n", + "#Calculation:\n", + "#Case 1:\n", + "a = k/(p*Cp) #Thermal diffusivity of bare rod (m^2/s)\n", + "#Case 2:\n", + "Nu = h*D/kf #Nusselt number\n", + "#Case 3:\n", + "Bi = h*D/k #Biot number of bare rod\n", + "#Case 4:\n", + "Q = h*(pi*D*L)*(Ts-Tf) #Heat transferred from rod to fluid (W)\n", + "\n", + "#Result:\n", + "print \"1. The thermal diffusivity of the bare rod is :\",round(a/10**-5,2),\" x 10^-5 m^2/s.\"\n", + "print \"2. The nusselt number is :\",round(Nu,2),\" .\"\n", + "print \"3. The Biot number is :\",round(Bi,4),\" .\"\n", + "print \"4. The heat transferred from the rod to the fluid is :\",round(Q),\" W.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1. The thermal diffusivity of the bare rod is : 1.76 x 10^-5 m^2/s.\n", + "2. The nusselt number is : 2.33 .\n", + "3. The Biot number is : 0.0233 .\n", + "4. The heat transferred from the rod to the fluid is : 2474.0 W.\n" + ] + } + ], + "prompt_number": 14 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_10-checkpoint.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_10-checkpoint.ipynb new file mode 100644 index 00000000..f1c9afa8 --- /dev/null +++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_10-checkpoint.ipynb @@ -0,0 +1,514 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:5a160b2a8858072f2a32a8c5f96e1426d911509afe45130ab4e23facf3414ba2" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 10: Free Convection" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 10.1, Page number: 163" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "Gr = 100.0 #Grashof number\n", + "Re = 50.0 #Reynolds number\n", + "\n", + "#Calculation:\n", + "LT = Gr/Re**2 #Measure of influence of convection effect\n", + "\n", + "#Result:\n", + "if (LT<1.0):\n", + " print \"The free convection effects can be neglected.\"\n", + "elif (LT>1.0):\n", + " print \"The free convection effects can not be neglected.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The free convection effects can be neglected.\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 10.2, Page number: 166" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "Ts = 110.0+273.0 #Surface temperature of plate (K)\n", + "Too = 30.0+273.0 #Ambient air temperature (K)\n", + "L = 3.5 #Height of plate (m)\n", + "g = 9.807 #Gravitational acceleration (m^2/s)\n", + "\n", + "#Calculation:\n", + "Tf = (Ts+Too)/2 #Film temperature (K)\n", + "DT = Ts - Too #Temperature difference between surface and air (K)\n", + "#From appendix:\n", + "v = 2.0*10**-5 #Kinematic viscosity for air (m^2/s)\n", + "k = 0.029 #Thermal conductivity for air (W/m.K)\n", + "Pr = 0.7 #Prandtl number\n", + "B = 1.0/Tf #Coefficient of expansion (K^-1)\n", + "Gr = g*B*DT*L**3/v**2 #Grashof number\n", + "Ra = Gr*Pr #Rayleigh number\n", + "\n", + "#Result:\n", + "print \"The Grashof number is :\",round(Gr/10**11,2),\" x 10^11 .\"\n", + "print \"The Rayleigh number is :\",round(Ra/10**11,2),\" x 10^11 .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Grashof number is : 2.45 x 10^11 .\n", + "The Rayleigh number is : 1.72 x 10^11 .\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 10.3, Page number: 166" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "#From example 10.2:\n", + "Ra = 1.71*10**11 #Rayleigh number\n", + "\n", + "#Result:\n", + "if (Ra>10**9):\n", + " print \"The convection flow category is turbulent.\"\n", + "elif(Ra<10**9):\n", + " print \"The convection flow category is laminar.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The convection flow category is turbulent.\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 10.4, Page number: 167" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "#From Table 10.1:\n", + "c = 0.1 #Constant c\n", + "m = 1.0/3.0 #Constant for turbulent free conection\n", + "#From example 10.2:\n", + "Ra = 1.71*10**11 #Rayleigh number\n", + "k = 0.029 #Thermal conductivity (W/m.K)\n", + "L = 3.5 #Thickness of plate (m)\n", + "\n", + "#Calculation:\n", + "Nu = c*Ra**m #Average Nusselt number\n", + "h = Nu*k/L #Average heat transfer coefficient (W/m^2.K)\n", + "\n", + "#Result:\n", + "print \"The average heat transfer coefficient is :\",round(h,1),\" W/m^2.K .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The average heat transfer coefficient is : 4.6 W/m^2.K .\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 10.6, Page number: 167" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from math import log,e\n", + "\n", + "#Variable declaration:\n", + "Ts = 200.0+460.0 #Surface temperature of pipe (\u00b0R)\n", + "Too = 70.0+460.0 #Air temperature (\u00b0R)\n", + "D = 0.5 #Diameter of pipe (ft)\n", + "R = 0.73 #Universal gas constant (ft^3.atm.R^\u22121.lb.mol^\u22121)\n", + "P = 1.0 #Atmospheric pressure (Pa)\n", + "MW = 29.0 #Molecular weight of fluid (mol)\n", + "#From Appendix:\n", + "mu = 1.28*10**-5 #Absolute viscosity (lb/ft.s)\n", + "k = 0.016/3600.0 #Thermal conductivity (Btu/s.ft.\u00b0F)\n", + "g = 32.174 #Gravitational acceleration (ft/s^2)\n", + "\n", + "#Calculation:\n", + "Tav = (Ts+Too)/2 #Average temperature (\u00b0R)\n", + "v = R*Tav/P #kinematic viscosity (ft^3/lbmol)\n", + "p = MW/v #Air density (lb/ft^3)\n", + "B = 1.0/Tav #Coefficient of expansion (\u00b0R^-1)\n", + "DT = Ts-Too #Temperature difference (\u00b0R)\n", + "Gr = D**3*p**2*g*B*DT/mu**2 #Grashof number\n", + "#From equation 10.5:\n", + "Cp = 0.25 #Air heat capacity (Btu/lb.\u00b0F)\n", + "Pr = Cp*mu/k #Prandtl number\n", + "GrPr = 10**8.24 #Rayleigh number\n", + "#From Holman^(3):\n", + "Nu = 10**(1.5) #Nusselt number\n", + "h = Nu*(k/D)*3600.0 #Air heat transfer film coefficient (Btu/h.ft.\u00b0F)\n", + "\n", + "#Result:\n", + "print \"The required air heat transfer film coefficient is :\",round(h,2),\" Btu/h.ft.\u00b0F .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The required air heat transfer film coefficient is : 1.01 Btu/h.ft.\u00b0F .\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 10.7, Page number: 168" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "Ts = 120.0+460 #Surface temperature of plate (\u00b0R)\n", + "Too = 60.0+460 #Ambient temperature of nitrogen (\u00b0R)\n", + "L = 6 #Height of plate (ft)\n", + "#From Appendix:\n", + "p = 0.0713 #Air density (lb/ft^3)\n", + "k = 0.01514 #Thermal conductivity (Btu/h.ft.\u00b0F)\n", + "v = 16.82*10**-5 #Kinematic viscosity (ft^2/s)\n", + "Pr = 0.713 #Prandtl number\n", + "g = 32.2 #Gravitational acceleration (ft/s^2)\n", + "\n", + "#Calculation:\n", + "Tf = (Ts+Too)/2 #Mean film temperature (\u00b0R)\n", + "B = 1.0/Tf #Coefficient of expansion (\u00b0R^-1)\n", + "Gr = g*B*(Ts-Too)*L**3/v**2 #Grashof number\n", + "Ra = Gr*Pr #Rayleigh number\n", + "#From equation 10.13(Table 10.2) and costants from Table 10.1:\n", + "h = 0.10*(k/L)*Ra**(1.0/3.0) #Free convection heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n", + "\n", + "#Result:\n", + "print \"The free convection heat transfer coefficient is :\",round(h,3),\" Btu/h.ft^2.\u00b0F .\"\n", + "print \"There is a calculation mistake in the book for calculating 'Gr', so, value of 'h' alters from that given.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The free convection heat transfer coefficient is : 0.675 Btu/h.ft^2.\u00b0F .\n", + "There is a calculation mistake in the book for calculating 'Gr', so, value of 'h' alters from that given.\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 10.8, Page number: 169" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "#From example:\n", + "h = 0.675 #Free convection heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n", + "A = 6.0*8.0 #Area of plate (ft^2)\n", + "Ts = 120.0 #Surface temperature of plate (\u00b0F)\n", + "Too = 60.0 #Ambient temperature of nitrogen (\u00b0F)\n", + "\n", + "#Calculation:\n", + "Q = h*A*(Ts-Too) #Heat loss (Btu/h)\n", + "\n", + "#Result:\n", + "print \"The heat loss is :\",round(Q,-1),\" Btu/h .\"\n", + "print \" The 'h' obtained in the previous example differs, therefore, 'Q' obtained here also fiffers from that given in book.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The heat loss is : 1940.0 Btu/h .\n", + " The 'h' obtained in the previous example differs, therefore, 'Q' obtained here also fiffers from that given in book.\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 10.9, Page number: 169" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "Ts = 113.0+273.0 #Surface temperature of bulb (K)\n", + "Too = 31.0+273.0 #Ambient air temperature (K)\n", + "D = 0.06 #Diameter of sphere (m)\n", + "g = 9.8 #Gravitational acceleration (m/s^2)\n", + "\n", + "#Calculation:\n", + "Tf = (Ts+Too)/2 #Mean temperature (K)\n", + "#From Appendix:\n", + "v = (22.38*10**-5)*0.0929 #Kinematic viscosity (m^2/s)\n", + "Pr = 0.70 #Prandtl number\n", + "k = 0.01735*1.729 #Thermal conductivity (W/m.K)\n", + "B = 1.0/(Tf) #Coefficient of expansion (K^-1)\n", + "Gr = g*B*(Ts-Too)*D**3/v**2 #Grashof number\n", + "Ra = Gr*Pr #Rayleigh number\n", + "\n", + "#From equation 10.13:\n", + "h = (k/D)*0.6*Ra**(1.0/4.0) #Heat transferred from bulb (W/m^2.K)\n", + "\n", + "#Result:\n", + "print \"The heat transferred from bulb to air is :\",round(h,2),\" W/m^2.K .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The heat transferred from bulb to air is : 9.01 W/m^2.K .\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 10.10, Page number: 170" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from math import pi\n", + "\n", + "#Variable declaration:\n", + "#From example 10.9:\n", + "h = 9.01 #Heat transferred from bulb (W/m^2.K)\n", + "D = 0.06 #Diameter of sphere (m)\n", + "Ts = 113.0+273.0 #Surface temperature of bulb (K)\n", + "Too = 31.0+273.0 #Ambient air temperature (K)\n", + "\n", + "#Calculation:\n", + "A = pi*D**2 #Surface area of bulb (m^2)\n", + "Q = h*A*(Ts-Too) #Heat transfer lost by free convection from light bulb (W)\n", + "\n", + "#Result:\n", + "print \"The heat transfer lost by free convection from light bulb is :\",round(Q,2),\" W .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The heat transfer lost by free convection from light bulb is : 8.36 W .\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 10.11, Page number: 170" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "#From example 10.9-10.10:\n", + "Q = 8.36 #Heat transfer lost by free convection from light bulb (W)\n", + "\n", + "#Calculation:\n", + "E = Q/100.0*(100.0) #Percent energy lost by free convection (%)\n", + "\n", + "#Result:\n", + "print \"The percentage of the energy lost by free convection is :\",round(E,2),\" % .\"\n", + "print \"The energy lost fraction is :\",round(E/100.0,4),\" .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The percentage of the energy lost by free convection is : 8.36 % .\n", + "The energy lost fraction is : 0.0836 .\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 10.13, Page number: 175" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "F = 50.0 #Buoyancy flux of gas (m^4/s^3)\n", + "u = 4.0 #wind speed (m/s)\n", + "\n", + "#Calculation:\n", + "xc = 14*F**(5.0/8.0) #Downward distance (m)\n", + "xf = 3.5*xc #distance of transition from first stage of rise to the second stage of rise (m)\n", + "Dh = 1.6*F**(1.0/3.0)*u**-1*xf**(2.0/3.0) #Plume rise (m)\n", + "\n", + "#Result:\n", + "print \"The plume rise is :\",round(Dh),\" m .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The plume rise is : 101.0 m .\n" + ] + } + ], + "prompt_number": 13 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_11-checkpoint.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_11-checkpoint.ipynb new file mode 100644 index 00000000..70c1dfd8 --- /dev/null +++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_11-checkpoint.ipynb @@ -0,0 +1,686 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:063e55263471b05545d8cee123782ea0408a4dbcfbef0baacac009fc80ca4fe1" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 11: Radiation" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 11.3, Page number: 181" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from sympy import symbols, integrate,oo,exp,pi\n", + "\n", + "#Variable declaration:\n", + "l = symbols('l') #Wavelength (mu.m)\n", + "I = 40*exp(-l**2) #Intensity of radiation (Btu/h.ft^2.mu.m)\n", + "\n", + "#Calculation:\n", + "E = integrate(I, (l,0,oo)).evalf() #Total emissive power (Btu/h.ft^2)\n", + "\n", + "#Result:\n", + "print \"The total emissive power is :\",round(E,1),\" Btu/h.ft^2 .\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The total emissive power is : 35.4 Btu/h.ft^2 .\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 11.4, Page number: 182" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "l = 0.25 #Wavelength (mu.m)\n", + "#From equation 11.4:\n", + "lT = 2884 #Product of wavelength and absolute temperature (mu.m.\u00b0R)\n", + "\n", + "#Calculation:\n", + "T = lT/l #Sun's temperature (\u00b0R)\n", + "\n", + "#Result:\n", + "print \"The Sun's temperature is :\",round(T,-2),\" \u00b0R .\"\n", + "print \"The Sun's temperature in fahrenheit scale is :\",round(T-460,-3),\" \u00b0F .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Sun's temperature is : 11500.0 \u00b0R .\n", + "The Sun's temperature in fahrenheit scale is : 11000.0 \u00b0F .\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 11.5, Page number: 188" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "T1 = 1500.0+460.0 #Absolute temperature 1 (\u00b0R)\n", + "T2 = 1000.0+460.0 #Absolute temperature 2 (\u00b0R)\n", + "\n", + "#Calculation:\n", + "X = T1**4/T2**4 #Ratio of quantity of heat transferred\n", + "x = 100*(T1**4-T2**4)/T2**4 #Percentage increase in heat transfer (%)\n", + "\n", + "#Result:\n", + "print \"The ratio of the quantity/rate of heat transferred is :\",round(X,2),\" .\"\n", + "print \"The percentage increase in heat transfer is :\",round(x),\"%\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The ratio of the quantity/rate of heat transferred is : 3.25 .\n", + "The percentage increase in heat transfer is : 225.0 %\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 11.6, Page number: 189" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "T1 = 1200.0+460.0 #Absolute temperature of wall 1 (\u00b0R)\n", + "T2 = 800.0+460.0 #Absolute temperature of wall 2 (\u00b0R)\n", + "\n", + "#Calculation:\n", + "#From equation 11.23:\n", + "X = 0.173*((T1/100.0)**4-(T2/100.0)**4) #Heat removed from colder wall (Btu/h.ft^2)\n", + "\n", + "#Result:\n", + "print \"The heat removed from the colder wall to maintain a steady-state is :\",round(X),\" Btu/h.ft^2 .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The heat removed from the colder wall to maintain a steady-state is : 8776.0 Btu/h.ft^2 .\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 11.7, Page number: 190" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "s = 0.173 #Stefan-Boltzmann constant (Btu/h.ft^2.\u00b0R)\n", + "EH = 0.5 #Energy transferred from hotter body (Btu/h.ft^2)\n", + "EC = 0.75 #Energy transferred to colder body (Btu/h.ft^2)\n", + "TH = 1660.0 #Absolute temperature of hotter body (\u00b0R)\n", + "TC = 1260.0 #Absolute temperature of colder body (\u00b0R)\n", + "\n", + "#Calculation:\n", + "E = s*((TH/100.0)**4-(TC/100.0)**4)/((1.0/EH)+(1.0/EC)-1.0) #Net energy exchange per unit area (Btu/h.ft^2)\n", + "\n", + "#Result:\n", + "print \"The net energy exchange per unit area is :\",round(E,-1),\" Btu/h.ft^2 .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The net energy exchange per unit area is : 3760.0 Btu/h.ft^2 .\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 11.8, Page number: 191" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "#From example 11.6-11.7:\n", + "E1 = 8776.0 #Energy exchange between black bodies (Btu/h.ft^2)\n", + "E2 = 3760.0 #Energy exchange between non-black bodies (Btu/h.ft^2)\n", + "\n", + "#Calculation:\n", + "D = (E1-E2)/E1*100 #Percent difference in energy (%)\n", + "\n", + "#Result:\n", + "print \"The percent difference relative to the black body is:\",round(D,1),\" % .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The percent difference relative to the black body is: 57.2 % .\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 11.9, Page number: 192" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "s = 0.173*10**-8 #Stefan-Boltzmann constant (Btu/h.ft^2.\u00b0R)\n", + "TH = 300.0+460.0 #Absolute temperature of external surface (\u00b0R)\n", + "TC = 75.0+460.0 #Absolute temperature of duct (\u00b0R)\n", + "#From Table 6.2:\n", + "AH = 0.622 #External surface area of pipe (ft^2)\n", + "#From Table 11.2:\n", + "EH = 0.44 #Emissivity of oxidized steel\n", + "AC = 4.0*1.0*1.0 #External surface area of duct (ft^2)\n", + "EC = 0.23 #Emissivity of galvanized zinc\n", + "\n", + "#Calculation:\n", + "FE = 1.0/(1.0/EH+((AH/AC)*(1.0/EC-1.0))) #Emissivity correction factor\n", + "Q = FE*AH*s*(TH**4-TC**4) #Net radiation heat transfer (Btu/h.ft)\n", + "\n", + "#Result:\n", + "print \"The net radiation heat transfer is :\",round(Q,2),\" Btu/h.ft^2 .\"\n", + "print \"There is a calculation error in book.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The net radiation heat transfer is : 96.96 Btu/h.ft^2 .\n", + "There is a calculation error in book.\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 11.10, Page number: 193" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "TH = 140.0+460.0 #Absolute outside temperature of pipe (ft^2)\n", + "TC = 60.0+460.0 #Absolute temperature of surrounding atmosphere (ft^2)\n", + "A = 10.0 #Area of pipe (ft^2)\n", + "E = 0.9 #Emissivity of pipe\n", + "\n", + "#Calculation:\n", + "Q = E*A*0.173*((TH/100.0)**4-(TC/100.0)**4) #Heat loss due to radiation (Btu/h)\n", + "\n", + "#Result:\n", + "print \"The heat loss due to radiation is :\",round(Q,-1),\" Btu/h .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The heat loss due to radiation is : 880.0 Btu/h .\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 11.11, Page number: 193" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "#Froma example 11.10:\n", + "Q = 880.0 #Heat loss due to radiation (Btu/h)\n", + "A = 10.0 #Area of pipe (ft^2)\n", + "TH = 140.0 #Absolute outside temperature of pipe (\u00b0F)\n", + "TC = 60.0 #Absolute temperature of surrounding atmosphere (\u00b0F)\n", + "\n", + "#Calculation:\n", + "hr = Q/(A*(TH-TC)) #Radiation heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n", + "\n", + "#Result:\n", + "print \"The radiation heat transfer coefficient is :\",round(hr,1),\" Btu/h.ft^2.\u00b0F .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The radiation heat transfer coefficient is : 1.1 Btu/h.ft^2.\u00b0F .\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 11.12, Page number: 194" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from math import pi\n", + "\n", + "#Variable declaration:\n", + "D = 0.0833 #Diameter of tube (ft)\n", + "L = 2.0 #Length of tube (ft)\n", + "h = 2.8 #Heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n", + "Ta1 = 1500.0+460.0 #Temperature of hot air in furnace (\u00b0R)\n", + "Ta2 = 1350.0+460.0 #Temperature of hot air in the furnace brick walls (\u00b0R)\n", + "Tt = 600.0+460.0 #Surface temperature of tube (\u00b0R)\n", + "E = 0.6 #Surface emissivity of tube\n", + "s = 0.1713*10**-8 #Stefan-Boltzmann constant\n", + "\n", + "\n", + "#Calculation:\n", + "#Case 1:\n", + "A = pi*D*L #Area of tube (ft^2)\n", + "Qc = round(h*A*(Ta1-Tt),-1) #Convection heat transfer from air to tube (Btu/h)\n", + "Qr = round(E*s*A*(Ta2**4-Tt**4),-2) #Radiation feat transfer from wall to tube (Btu/h)\n", + "Q = Qr+Qc #Total heat transfer (Btu/h)\n", + "#Case 2:\n", + "Qp = Qr/Q*100 #Radiation percent \n", + "#Case 3:\n", + "hr = Qr/(A*(Ta2-Tt)) #Radiation heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n", + "#Case 4:\n", + "T = Ta2-Tt #Temperature difference (\u00b0F)\n", + "\n", + "#Result:\n", + "print \"1. The convective heat transferred to the metal tube is :\",Qc,\" Btu/h .\"\n", + "print \" The radiative heat transferred to the metal tube is :\",Qr,\" Btu/h .\"\n", + "print \" The total heat transferred to the metal tube is :\",Q,\" Btu/h .\"\n", + "print \"2. The percent of total heat transferred by radiation is :\",round(Qp,1),\" % .\"\n", + "print \"3. The radiation heat transfer coefficient is :\",round(hr,1),\" Btu/h.ft^2.\u00b0F .\"\n", + "if (T > 200):\n", + " print \"4. The use of the approximation Equation (11.30), hr = 4EsTav^3, is not appropriate.\"\n", + "elif (T < 200):\n", + " print \"4. The use of the approximation Equation (11.30), hr = 4EsTav^3, is appropriate.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1. The convective heat transferred to the metal tube is : 1320.0 Btu/h .\n", + " The radiative heat transferred to the metal tube is : 5100.0 Btu/h .\n", + " The total heat transferred to the metal tube is : 6420.0 Btu/h .\n", + "2. The percent of total heat transferred by radiation is : 79.4 % .\n", + "3. The radiation heat transfer coefficient is : 13.0 Btu/h.ft^2.\u00b0F .\n", + "4. The use of the approximation Equation (11.30), hr = 4EsTav^3, is not appropriate.\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 11.13, Page number: 194" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "Q = 5.0 #Radiation heat transfer (W)\n", + "E = 1.0 #Emissivity of filament\n", + "s = 5.669*10**-8 #Stefan-Boltzmann constant\n", + "T1 = 900.0+273.0 #Light bulb temperature (K)\n", + "T2 = 150.0+273.0 #Glass bulb temperature (K)\n", + "\n", + "#Calculation:\n", + "A = Q/(E*s*(T1**4-T2**4)) #Surface area of the filament (m^2)\n", + "\n", + "#Result:\n", + "print \"The surface area of the filament is :\",round(A*10**4,2), \"cm^2\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The surface area of the filament is : 0.47 cm^2\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 11.14, Page number: 195" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "from math import pi\n", + "\n", + "#Variable declaration:\n", + "T1 = 127.0+273.0 #Surface temperature (K)\n", + "T2 = 20.0+273.0 #Wall temperature (K)\n", + "T3 = 22.0+273.0 #Air temperature (K)\n", + "s = 5.669*10**-8 #Stefan-Boltzmann constant\n", + "e = 0.76 #Surface emissivity of anodized aluminium\n", + "D = 0.06 #Diameter of pipe (m)\n", + "L = 100.0 #Length of pipe (m)\n", + "h = 15.0 #Pipe convective heat transfer coefficient (W/m^2.K)\n", + "\n", + "#Calculation:\n", + "Eb = s*T1**4 #Emissive energy of pipe (W/m^2)\n", + "E = e*Eb #Emissive power from surface of pipe (W/m^2)\n", + "A = pi*D*L #Surface area of pipe (m^2)\n", + "Qc = h*A*(T1-T3) #Convection heat transfer to air (W)\n", + "Qr = e*s*A*(T1**4-T2**4) #Radiation heat transfer rate (W)\n", + "Q = Qc+Qr #Total heat transfer rate (Btu/h)\n", + "Tav = (T1+T2)/2.0 #Average temperature (K)\n", + "hr = 4*e*s*Tav**3 #Radiation heat transfer coefficient (W/m^2.K)\n", + "\n", + "#Result:\n", + "print \"The emissive power from surface of pipe is :\",round(E),\" W/m^2 .\"\n", + "print \"The convection heat transfer to air is :\",round(Qc/10**3,1),\" kW .\"\n", + "print \"The radiation heat transfer rate is :\",round(Qr/10**3,1),\" kW \"\n", + "print \"The radiation heat transfer coefficient is :\",round(hr,1),\" W/m^2.K .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The emissive power from surface of pipe is : 1103.0 W/m^2 .\n", + "The convection heat transfer to air is : 29.7 kW .\n", + "The radiation heat transfer rate is : 14.8 kW \n", + "The radiation heat transfer coefficient is : 7.2 W/m^2.K .\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 11.15, Page number: 196" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "#From example 11.14:\n", + "Qc = 15.0 #Convection heat transfer coefficient (W/m^2.K)\n", + "hr = 7.2 #Radiation heat transfer coefficient (W/m^2.K)\n", + "\n", + "#Calculation:\n", + "X = hr/(Qc+hr)*100.0 #Percent heat transfer by radiation (%)\n", + "\n", + "#Result:\n", + "print \"The percent heat transfer by radiation is :\",round(X,1),\" % .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The percent heat transfer by radiation is : 32.4 % .\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 11.16, Page number: 200" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "FV = 1.0 #Correction factor\n", + "#From example 11.9:\n", + "FE = 0.358 #Emissivity correction factor\n", + "TH = 300.0+460.0 #Absolute temperature of external surface (\u00b0R)\n", + "TC = 75.0+460.0 #Absolute temperature of duct (\u00b0R)\n", + "AH = 0.622 #Area of pipe (ft^2)\n", + "s = 0.173*10**-8 #Stefan-Boltzmann constant\n", + "\n", + "#Calculation:\n", + "Q = FV*FE*AH*s*(TH**4-TC**4) #Heat transfer rate (Btu/h.ft)\n", + "\n", + "#Result:\n", + "print \"The heat transfer rate is :\",round(Q,2),\" Btu/h.ft\"\n", + "print \"Since, 'Q' obtained in (11.9) is 96.96 Btu/h.ft, the solution does not match with book.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The heat transfer rate is : 96.96 Btu/h.ft\n", + "Since, 'Q' obtained in (11.9) is 96.96 Btu/h.ft, the solution does not match with book.\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 11.17, Page number: 200" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "#From figure 11.2:\n", + "L = 1.0 #Space between plates (m)\n", + "X = 0.5 #Length of plate (m)\n", + "Y = 2.0 #Width of plate (m)\n", + "s = 5.669*10**-8 #Stefan-Boltzmann constant\n", + "TH = 2000.0+273.0 #Temperature of hotter plate (K)\n", + "TC = 1000.0+273.0 #Temperature of colder plate (K)\n", + "Btu = 0.2934*10**-3 #Btu/h in a KW\n", + "\n", + "#Calculation:\n", + "A = X*Y #Area of plate (m^2)\n", + "Z1 = Y/L #Ratio of width with space\n", + "Z2 = X/L #Ratio of length with space\n", + "#From figure 11.2:\n", + "FV = 0.18 #Correction factor\n", + "FE = 1.0 #Emissivity correction factor\n", + "Q1 = FV*FE*s*A*(TH**4-TC**4) #Net radiant heat exchange between plates (kW)\n", + "Q2 = Q1/Btu #Net radiant heat exchange between plates in Btu/h (Btu/h)\n", + "\n", + "#Result:\n", + "print \"The net radiant heat exchange between plates is :\",round(Q1,-2),\" kW .\"\n", + "print \"The net radiant heat exchange between plates in Btu/h is :\",round(Q2/10**8,2),\" x 10^8 Btu/h .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The net radiant heat exchange between plates is : 245600.0 kW .\n", + "The net radiant heat exchange between plates in Btu/h is : 8.37 x 10^8 Btu/h .\n" + ] + } + ], + "prompt_number": 18 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_12-checkpoint.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_12-checkpoint.ipynb new file mode 100644 index 00000000..dd2d06ef --- /dev/null +++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_12-checkpoint.ipynb @@ -0,0 +1,483 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:2b2623ff77afaafd7c16fc0720e69537bf598cad89dca70b267d9306235c5968" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 12: Condensation and Boiling" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 12.2, Page number: 206" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "C = 1 #Number of constituents\n", + "P = 1 #Number of phases\n", + "\n", + "#Calculation:\n", + "F = C-P+2 #Number of degrees of freedom\n", + "\n", + "#Result:\n", + "print \"The number of degrees of freedom is :\",F,\" .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The number of degrees of freedom is : 2 .\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 12.4, Page number: 209" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "\n", + "U1 = 1237.1 #Internnal energy of gas (Btu/lb)\n", + "U2_g = 1112.2 #Internal energy of gas (Btu/lb)\n", + "U2_l = 343.15 #Internal energy of liquid (Btu/lb)\n", + "\n", + "#Calculation:\n", + "Q = 0.5*(U2_g+U2_l)-1*U1 #Heat removed (Btu/lb)\n", + "\n", + "#Result:\n", + "print \"Heat removed from the system during the process is :\",round(Q,1),\" Btu/lb .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat removed from the system during the process is : -509.4 Btu/lb .\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 12.5, Page number: 212" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from __future__ import division\n", + "from sympy import symbols,solve\n", + "\n", + "#Variable declaration:\n", + "T1 = 99.0 #Mean film temperature (\u00b0C)\n", + "T2 = 98.0 #Plate surface temperature (\u00b0C)\n", + "g = 9.807 #Gravitational acceleration (m/s^2)\n", + "#From Appendix:\n", + "T3 = 100.0 #Saturation temperatre (\u00b0C)\n", + "h_vap1 = 970.3 #Latent heat of steam in Btu/lb (Btu/lb)\n", + "h_vap2 = 2.255*10**6 #Latent heat of steam in J/kg (J/kg)\n", + "p_v = 0.577 #Density of steam (kg/m^3)\n", + "p_l = 960.0 #Density of liquid water condensate (kg/m^3)\n", + "mu_l = 2.82*10**-4 #Absolute viscosity of liquid water condensate (kg/m.s)\n", + "k = 0.68 #Thermal conductivity of water (W/m.K)\n", + "#From table 12.2\n", + "Z = 0.4 #Height of rectangular plate (m)\n", + "Pw = 0.2 #Wetted perimeter of rectangular plate (m)\n", + "h = symbols('h') #Average heat transfer coefficient (W/m^2.K)\n", + "\n", + "#Calculation:\n", + "A = Z*Pw #Heat transfer area of plate (m^2)\n", + "R = A/Pw #Ratio A/Pw (m)\n", + "v_l = mu_l/p_l #Kinematic viscosity of liquid water condensate (m^2/s)\n", + "Co1 = (h/k)*(v_l**2/g/(1-p_v/p_l))**(1/3) #Condensation number (in terms of the average heat transfer coefficient)\n", + "Re = 4*h*Z*(T3-T2)/(mu_l*h_vap2) #Reynolds number in terms of the average heat transfer coefficient\n", + "#From equation 12.14:\n", + "CO1 = 0.0077*Re**Z #Co in terms of Reynolds number for flow type 1\n", + "x1 = solve(Co1-CO1,h) #Solving heat transfer coefficient (W/m^2.K)\n", + "h1 =x1[1]; #Average heat transfer coefficient for flow type 1 (W/m^2.K)\n", + "Re1 = Re.subs(h,h1); #Reynolds number for flow type 1\n", + "CO2 = 1.874*Re**(-1/3) #Co in terms of Reynolds number for flow tupe 2\n", + "x2 = solve(Co1-CO2,h) #Solving average heat transfer coefficient for flow type 2 (W/m^2.K)\n", + "h2 = x2[0]; #Average heat transfer coefficient for flow type 2 (W/m^2.K)\n", + "Re2 = Re.subs(h,h2) #Reynolds number for flow type 2\n", + "\n", + "#Result:\n", + "print \"The type of condensation flow type 2 is laminar.\"\n", + "print \"And the condensation heat transfer coefficient is :\",round(h2,-1),\" W/m^2.K .\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The type of condensation flow type 2 is laminar.\n", + "And the condensation heat transfer coefficient is : 14700.0 W/m^2.K .\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 12.6, Page number: 214" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "#From example 12.5:\n", + "Re = 73.9 #Reynolds number\n", + "mu_l = 2.82*10**-4 #Absolute viscosity of liquid water condensate (kg/m.s)\n", + "Pw = 0.2 #Wetted perimeter of rectangular plate (m)\n", + "h = 14700.0 #Heat transfer coefficient (W/m^2.K)\n", + "T_sat = 100.0 #Saturation temperature (\u00b0C)\n", + "Ts = 98.0 #Surface temperature (\u00b0C)\n", + "A = 0.2*0.4 #Heat transfer area of plate (m^2) \n", + "\n", + "#Calculation:\n", + "m1 = Re*mu_l/4.0 #Mass flow rate of condensate (kg/m.s)\n", + "m = Pw*m1 #Mass flow rate of condensate (kg/s)\n", + "Co = (3.038*10**-5)*h #Condensation number\n", + "Q = h*A*(T_sat-Ts) #Heat transfer rate (W)\n", + "\n", + "#Result:\n", + "print \"1. The mass flow rate of condensate is :\",round(m1,4),\" kg/m.s . \"\n", + "print \"2. The heat transfer rate is :\",round(Q/10**3,2),\" kW . \"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1. The mass flow rate of condensate is : 0.0052 kg/m.s . \n", + "2. The heat transfer rate is : 2.35 kW . \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 12.7, Page number: 215" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration:\n", + "T_sat = 126.0 #Saturation temperature (\u00b0F)\n", + "T = 64.0 #Surface temperature of tube (\u00b0F)\n", + "g = 32.2 #Gravitational acceleration (ft^2/s)\n", + "D = 4.0/12.0 #Outside diameter of tube (ft)\n", + "\n", + "#Calculation:\n", + "Tf = (T_sat+T)/2.0 #Mean film temperature (\u00b0F)\n", + "#From approximate values of key properties:\n", + "h_vap = 1022.0 #Latent heat of steam (Btu/lb)\n", + "p_v = 0.00576 #Density of steam (lb/ft^3)\n", + "p_l = 62.03 #Density of liquid (lb/ft^3)\n", + "k_l = 0.364 #Thermal conductivity of liquid (Btu/h.ft.\u00b0F)\n", + "mu_l = 4.26*10**-4 #Absolute viscosity of liquid water condensate (lb/ft.s)\n", + "h = 0.725*((p_l*(p_l-p_v)*g*h_vap*k_l**3)/(mu_l*D*(T_sat-T)/3600.0))**(1.0/4.0) #Average heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n", + "\n", + "#Result:\n", + "print \"The average heat transfer coefficient is :\",round(h,1),\" Btu/h.ft^2.\u00b0F .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The average heat transfer coefficient is : 911.4 Btu/h.ft^2.\u00b0F .\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 12.9, Page number: 222" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration:\n", + "Qs1 = 9800.0 #Heat flux (W/m^2)\n", + "Ts1 = 102.0 #Original surface temperature (\u00b0C)\n", + "Ts2 = 103.0 #New surface temperature (\u00b0C)\n", + "Tsat = 100.0 #Saturation temperature (\u00b0C)\n", + "\n", + "#Calculation:\n", + "h1 = Qs1/(Ts1-Tsat) #Original heat transfer coefficient (W/m^2.K)\n", + "DT1 = (Ts1 - Tsat) #Original excess temperature (\u00b0C)\n", + "DT2 = (Ts2 - Tsat) #New excess temperature (\u00b0C)\n", + "n = 0.25 #Value of n for laminar flow\n", + "h2 = h1*(DT2/DT1)**(n) #New heat transfer coefficient (W/m^2.K)\n", + "Qs2 = h2*(Ts2-Tsat) #New heat flux (W/m^2)\n", + "\n", + "#Result:\n", + "print \"The new heat flux is :\",round(Qs2),\" W/m^2.K . \"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The new heat flux is : 16268.0 W/m^2.K . \n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 12.10, Page number: 223" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration:\n", + "#From example 12.9:\n", + "Ts1 = 102.0 #Original surface temperature (\u00b0C)\n", + "Ts2 = 103.0 #New surface temperature (\u00b0C)\n", + "Tsat = 100.0 #Saturation temperature (\u00b0C)\n", + "\n", + "#Calculation:\n", + "DTe1 = (Ts1 - Tsat) #Original excess temperature (\u00b0C)\n", + "DTe2 = (Ts2 - Tsat) #New excess temperature (\u00b0C)\n", + "\n", + "#Result:\n", + "print \"The original excess temperature is: DTe = \",DTe1,\" \u00b0C .\"\n", + "print \"The new excess temperature is: DTe = \",DTe2,\" \u00b0C .\"\n", + "if ((DTe1 < 5) and (DTe2 < 5)):\n", + " print \"The assumption of the free convection mechanism is valid since DTe < 5\u00b0C.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The original excess temperature is: DTe = 2.0 \u00b0C .\n", + "The new excess temperature is: DTe = 3.0 \u00b0C .\n", + "The assumption of the free convection mechanism is valid since DTe < 5\u00b0C.\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 12.11, Page number: 223" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "#From example 12.9:\n", + "Cp = 4127.0 #heat capacity (J/kg . K)\n", + "DTe = 3.0 #New excess temperature (\u00b0C)\n", + "h_vap = 2.26*10**6 #latent heat of vaporization (J/kg)\n", + "\n", + "#Calculation:\n", + "Ja_L = Cp*DTe/h_vap #Liquid Jakob number\n", + "\n", + "#Result:\n", + "print \"The liquid Jakob number is :\",round(Ja_L,5),\" .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The liquid Jakob number is : 0.00548 .\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 12.12, Page number: 223" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "Ts = 106.0 #Surface temperature (\u00b0C)\n", + "Tsat = 100.0 #Saturation temperature (\u00b0C)\n", + "\n", + "#Calculation:\n", + "DTe = Ts-Tsat #Excess temperature (\u00b0C)\n", + "#From table 12.5:\n", + "C1 = 5.56 #Constant C1\n", + "n1 = 3.0 #Constant n1\n", + "C2 = 1040.0 #Constant C2\n", + "n2 = 1.0/3.0 #Constant n2\n", + "P = 1.0 #Absolute pressure (atm)\n", + "Pa = 1.0 #Ambient absolute pressure (atm)\n", + "\n", + "#Calculation:\n", + "h1 = C1*DTe**n1*(P/Pa)**0.4 #Boiling water heat transfer coefficient (W/m^2)\n", + "Qs1 = h1*DTe #Surface flux (W/m^2)\n", + "h2 = C2*DTe**n2*(P/Pa)**0.4 #Second Boiling water heat transfer coefficient (W/m^2)\n", + "Qs2 = h2*DTe #Second Surface flux (W/m^2) \n", + "\n", + "#Result:\n", + " \n", + "if (Qs1/10**3 > 15.8 and Qs1/10**3 < 236):\n", + " print \"The boiling regime is :\",round(Qs1/10**3,1),\" kW/m^2 .\"\n", + " print \"The heat transfer coefficient is :\",round(h1), \" W/m^2 .\"\n", + "elif (Qs1/10**3 < 15.8):\n", + " print \"The boiling regime is :\",round(Qs2/10**3,2),\" kW/m^2 .\"\n", + " print \"The heat transfer coefficient is :\",round(h2), \" W/m^2 .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The boiling regime is : 11.34 kW/m^2 .\n", + "The heat transfer coefficient is : 1890.0 W/m^2 .\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 12.13, Page number: 224" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from math import pi\n", + "\n", + "#Variable declaration:\n", + "#From example 12.12:\n", + "Qs1 = 11340.0 #Surface flux (W/m^2)\n", + "D = 0.3 #Diameter of electric heater (m)\n", + "\n", + "#Calculation:\n", + "A = pi*(D/2.0)**2 #Surface area of heater (m^2)\n", + "Qs = Qs1*A #Heat transfer rate (W)\n", + "\n", + "#Result:\n", + "print \"The rate of heat transfer is :\",round(Qs),\" W .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The rate of heat transfer is : 802.0 W .\n" + ] + } + ], + "prompt_number": 13 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_13-checkpoint.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_13-checkpoint.ipynb new file mode 100644 index 00000000..b4812ba2 --- /dev/null +++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_13-checkpoint.ipynb @@ -0,0 +1,425 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:c1f753b566ef5be1a578722a730958eae554497c733345943c47490976e91069" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 13: Refrigeration and Cryogenics" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 13.1, Page number: 237" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "LR = 7.5/12.0 #Thickness of refractory (ft)\n", + "LI = 3.0/12.0 #Thickness of insulation (ft)\n", + "LS = 0.25/12.0 #Thickness of steel (ft)\n", + "kR = 0.75 #Thermal conductivity of refractory\n", + "kI = 0.08 #Thermal conductivity of insulation\n", + "kS = 26.0 #Thermal conductivity of steel\n", + "TR = 2000.0 #Average surface temperature of the inner face of the refractory (\u00b0F)\n", + "TS = 220.0 #Average surface temperature of the outer face of the steel (\u00b0F)\n", + "\n", + "#Calculation:\n", + "DT = TR-TS #Temperature difference (\u00b0F)\n", + "Q = DT/(LR/kR+LI/kI+LS/kS) #Heat loss (Btu/h.ft^2)(here representing Qdot/A)\n", + "\n", + "#Result:\n", + "print \"The heat loss is :\",round(Q),\" Btu/h.ft^2 .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The heat loss is : 450.0 Btu/h.ft^2 .\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 13.2, Page number: 239" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "LR = 7.5/12.0 #Thickness of refractory (ft)\n", + "kR = 0.75 #Thermal conductivity of refractory\n", + "TR = 2000.0 #Average surface temperature of the inner face of the refractory (\u00b0F)\n", + "Q = 450.0 #Heat loss (Btu/h.ft^2)\n", + "\n", + "#Calculation:\n", + "TI = TR - Q*(LR/kR) #Temperature of the boundary where the refractory meets the insulation (\u00b0F)\n", + "\n", + "#Result:\n", + "print \"The temperature of the boundary where the refractory meets the insulation is :\",round(TI),\" \u00b0F .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The temperature of the boundary where the refractory meets the insulation is : 1625.0 \u00b0F .\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 13.3, Page number: 239" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "QbyA = 70000.0 #Total heat loss (Btu/h)\n", + "Q = 450.0 #Heat loss (Btu/h.ft^2)\n", + "\n", + "#Calculation:\n", + "A = QbyA/Q #Area available for heat transfer (ft^2)\n", + "\n", + "#Result:\n", + "print \"The area available for heat transfer is :\",round(A,1),\" ft^2 .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The area available for heat transfer is : 155.6 ft^2 .\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 13.9, Page number: 245" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "h_out = 390.0 #Enthalpy of the fluid that exits from the evaporator (kJ/kg)\n", + "h_in = 230.0 #Enthalpy of the fluid that enters the unit (kJ/kg)\n", + "\n", + "#Calculation:\n", + "QC = h_out - h_in #Heat absorbed by the evaporator (kJ/kg)\n", + "\n", + "#Result:\n", + "print \"The heat absorbed by the evaporator is :\",round(QC),\" kJ/kg .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The heat absorbed by the evaporator is : 160.0 kJ/kg .\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 13.10, Page number: 246" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "#From example 13.9:\n", + "TS = -10.0+273.0 #Fluid\u2019s saturation temperature expressed in Kelvin (K)\n", + "QC = 160.0 #Heat absorbed by the evaporator (kJ/kg)\n", + "\n", + "#Calcuation:\n", + "DS = QC/TS #Fluid\u2019s change in entropy(kJ/kg.K)\n", + "\n", + "#Result:\n", + "print \"The fluid's change in entropy across the evaporator is :\",round(DS,2),\" kJ/kg.K .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The fluid's change in entropy across the evaporator is : 0.61 kJ/kg.K .\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 13.11, Page number: 247" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "#From figure 13.2:\n", + "h1 = 390.0 #Fluid enthalpy on entering the compressor (kJ/kg)\n", + "h2 = 430.0 #Fluid enthalpy on leaving the compressor (kJ/kg)\n", + "h3 = 230.0 #Fluid enthalpy on leaving the condenser (kJ/kg)\n", + "\n", + "#Calculation:\n", + "QH = h2 - h3 #Heat rejected from the condenser (kJ/kg)\n", + "W_in = h2 - h1 #Change in enthalpy across the compressor (kJ/kg)\n", + "QC = QH - W_in #Heat absorbed by the evaporator (kJ/kg)\n", + "\n", + "#Result:\n", + "print \"The heat absorbed by the evaporator of the refrigerator is :\",round(QC),\" kJ/kg .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The heat absorbed by the evaporator of the refrigerator is : 160.0 kJ/kg .\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 13.12, Page number: 248" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "#From example 13.11:\n", + "W_in = 40.0 #Change in enthalpy across the compressor (kJ/kg)\n", + "QC = 160.0 #Heat absorbed by the evaporator (kJ/kg)\n", + "\n", + "#Calculation:\n", + "COP = QC/W_in #Refrigerator\u2019s C.O.P.\n", + "\n", + "#Result:\n", + "print \"the refrigerator's C.O.P. is :\",round(COP),\" .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the refrigerator's C.O.P. is : 4.0 .\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 13.13, Page number: 250" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration:\n", + "h1 = 548.0 #Steam enthalpy at the entry and exit to the boiler (kJ/kg)\n", + "h2 = 3989.0 #Steam enthalpy at the entry and exit to the turbine (kJ/kg)\n", + "h3 = 2491.0 #Steam enthalpy at the entry and exit to the pump (kJ/kg)\n", + "QH = 2043.0 #Heat rejected by the condenser (kJ/kg)\n", + "\n", + "#Calculation:\n", + "h4 = h3 - QH #Steam enthalpy at the entry and exit to the condenser (kJ/kg)\n", + "Qb = h2 - h1 #Enthalpy change across the boiler (kJ/kg)\n", + "\n", + "#Result:\n", + "print \"The enthalpy change across the boiler is :\",round(Qb),\" kJ/kg .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The enthalpy change across the boiler is : 3441.0 kJ/kg .\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 13.14, Page number: 251" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration:\n", + "#From example 13.4:\n", + "h1 = 548.0 #Steam enthalpy at the entry and exit to the boiler (kJ/kg)\n", + "h2 = 3989.0 #Steam enthalpy at the entry and exit to the turbine (kJ/kg)\n", + "h3 = 2491.0 #Steam enthalpy at the entry and exit to the pump (kJ/kg)\n", + "h4 = 448.0 #Steam enthalpy at the entry and exit to the condenser (kJ/kg)\n", + "Qb = 3441.0 #Enthalpy change across the boiler (kJ/kg)\n", + "\n", + "#Calculation:\n", + "Wt = h2 - h3 #Work produced by the turbine (kJ/kg)\n", + "Wp = h1 - h4 #Work used by the pump (kJ/kg)\n", + "W_net = Wt - Wp #Net work by subtracting the pump work from the turbine work (kJ/kg)\n", + "n_th = W_net/Qb #Thermal efficiency\n", + "\n", + "#Result:\n", + "print \"The thermal efficiency is :\",round(n_th*100,1),\" % .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The thermal efficiency is : 40.6 % .\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 13.15, Page number: 252" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "#From table 13.4:\n", + "x3 = 0.9575 #Mass fraction vapour at point 3\n", + "h3 = 2491.0 #Steam enthalpy at the entry and exit to the pump (kJ/kg)\n", + "s3 = 7.7630 #Entropy at the entry and exit to the pump (kJ/kg.K)\n", + "s4 = 1.4410 #Entropy at the entry and exit to the condenser (kJ/kg.K)\n", + "#From example13.14:\n", + "h4 = 448.0 #Steam enthalpy at the entry and exit to the condenser (kJ/kg)\n", + "\n", + "#Calculation:\n", + "Q_out = h3 - h4 #Heat rejected (kJ/kg)\n", + "DS = s3 - s4 #Process change in entropy (kJ/kg)\n", + "T3 = Q_out/DS #Temperature at point 3 (K)\n", + "\n", + "#Result:\n", + "print \"The temperature at point 3 is :\",round(T3),\" K .\"\n", + "print \"Or, the temperature at point 3 is :\",round(T3-273),\" \u00b0C .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The temperature at point 3 is : 323.0 K .\n", + "Or, the temperature at point 3 is : 50.0 \u00b0C .\n" + ] + } + ], + "prompt_number": 16 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_14-checkpoint.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_14-checkpoint.ipynb new file mode 100644 index 00000000..7bc0f737 --- /dev/null +++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_14-checkpoint.ipynb @@ -0,0 +1,705 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:e3c042bf60cf5ea8673efb2741d5df5f7935daa012691b520a2d1357e838bd6c" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 14: Introduction to Heat Exchangers" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 14.1, Page number: 259" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "scfm = 20000.0 #Volumetric flow rate of air at standard conditions (scfm)\n", + "H1 = 1170.0 #Enthalpy at 200\u00b0F (Btu/lbmol)\n", + "H2 = 14970.0 #Enthalpy at 2000\u00b0F (Btu/lbmol)\n", + "Cp = 7.53 #Average heat capacity (Btu/lbmol.\u00b0F)\n", + "T1 = 200.0 #Initial temperature (\u00b0F)\n", + "T2 = 2000.0 #Final temperature (\u00b0F)\n", + "\n", + "#Calculation:\n", + "n = scfm/359.0 #Flow rate of air in a molar flow rate (lbmol/min)\n", + "DH = H2 - H1 #Change in enthalpy (Btu/lbmol)\n", + "DT = T2 - T1 #Change in temperature (\u00b0F)\n", + "Q1 = n*DH #Heat transfer rate using enthalpy data (Btu/min)\n", + "Q2 = n*Cp*DT #Heat transfer rate using the average heat capacity data (Btu/min)\n", + "\n", + "#Result:\n", + "print \"The heat transfer rate using enthalpy data is :\",round(Q1/10**5,2),\" x 10^5 Btu/min.\"\n", + "print \"The heat transfer rate using the average heat capacity data is :\",round(Q2/10**5,2),\" x 10^5 Btu/min.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The heat transfer rate using enthalpy data is : 7.69 x 10^5 Btu/min.\n", + "The heat transfer rate using the average heat capacity data is : 7.55 x 10^5 Btu/min.\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 14.2, Page number: 259" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "n = 1200.0 #Flow rate of air in a molar flow rate (lbmol/min)\n", + "Cp = 0.26 #Average heat capacity (Btu/lbmol.\u00b0F)\n", + "T1 = 200.0 #Initial temperature (\u00b0F)\n", + "T2 = 1200.0 #Final temperature (\u00b0F)\n", + "\n", + "#Calculation:\n", + "DT = T2 - T1 #Change in temperature (\u00b0F)\n", + "Q = n*Cp*DT #Required heat rate (Btu/min)\n", + "\n", + "#Result:\n", + "print \"The required heat rate is :\",round(Q/10**5,2),\" x 10^5 Btu/min .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The required heat rate is : 3.12 x 10^5 Btu/min .\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 14.3, Page number: 260" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "Tc1 = 25.0 #Initial temperature of cold fluid (\u00b0C)\n", + "Th1 = 72.0 #Initial temperature of hot fluid (\u00b0C)\n", + "Th2 = 84.0 #Final temperature of hot fluid (\u00b0C)\n", + "\n", + "#Calculation:\n", + "#From equation 14.2:\n", + "Tc2 = (Th2-Th1)+Tc1 #Final temperature of cold fluid (\u00b0C)\n", + "\n", + "#Result:\n", + "print \"The final temperature of the cold liquid is :\",Tc2,\" \u00b0C .\"\n", + "print \"There is a printing mistake in unit of final temperature in book.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The final temperature of the cold liquid is : 37.0 \u00b0C .\n", + "There is a printing mistake in unit of final temperature in book.\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 14.4, Page number: 265" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "Ts = 100.0 #Steam temperature at 1 atm (\u00b0C)\n", + "Tl = 25.0 #Fluid temperature (\u00b0C)\n", + "\n", + "#Calculation:\n", + "DTlm = Ts - Tl #Log mean temperature difference (\u00b0C)\n", + "\n", + "#Result:\n", + "print \"The LMTD is :\",DTlm,\" \u00b0C .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The LMTD is : 75.0 \u00b0C .\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 14.5, Page number: 265" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from math import log\n", + "\n", + "#Variable declaration:\n", + "Ts = 100.0 #Steam temperature at 1 atm (\u00b0C)\n", + "T1 = 25.0 #Initial fluid temperature (\u00b0C)\n", + "T2 = 80.0 #Final fluid temperature (\u00b0C)\n", + "\n", + "#Calculation:\n", + "DT1 = Ts - T1 #Temperature difference driving force at the fluid entrance (\u00b0C)\n", + "DT2 = Ts - T2 #Temperature driving force at the fluid exit (\u00b0C)\n", + "DTlm = (DT1 - DT2)/log(DT1/DT2) #Log mean temperature difference (\u00b0C)\n", + "\n", + "#Result:\n", + "print \"The LMTD is :\",round(DTlm,1),\" \u00b0C .\"\n", + "print \"There is a calculation mistake regarding final result in book.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The LMTD is : 41.6 \u00b0C .\n", + "There is a calculation mistake regarding final result in book.\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 14.6, Page number: 266" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from math import log\n", + "\n", + "#Variable declaration:\n", + "T1 = 500.0 #Temperature of hot fluid entering the heat exchanger (\u00b0F)\n", + "T2 = 400.0 #Temperature of hot fluid exiting the heat exchanger (\u00b0F)\n", + "t1 = 120.0 #Temperature of cold fluid entering the heat exchanger (\u00b0F)\n", + "t2 = 310.0 #Temperature of cold fluid exiting the heat exchanger (\u00b0F)\n", + "\n", + "#Calculation:\n", + "DT1 = T1 - t2 #Temperature difference driving force at the heat exchanger entrance (\u00b0F)\n", + "DT2 = T2 - t1 #Temperature difference driving force at the heat exchanger exit (\u00b0F)\n", + "DTlm = (DT1 - DT2)/(log(DT1/DT2)) #LMTD (driving force) for the heat exchanger (\u00b0F)\n", + "\n", + "#Result:\n", + "print \"The LMTD (driving force) for the heat exchanger is :\",round(DTlm),\" \u00b0F .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The LMTD (driving force) for the heat exchanger is : 232.0 \u00b0F .\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 14.7, Page number: 267" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from math import log\n", + "\n", + "#Variable declaration:\n", + "m = 8000.0 #Rate of oil flow inside the tube (lb/h)\n", + "Cp = 0.55 #Heat capacity of oil (Btu/lb.\u00b0F)\n", + "T1 = 210.0 #Initial temperature of oil (\u00b0F)\n", + "T2 = 170.0 #Final temperature of oil (\u00b0F)\n", + "t = 60.0 #Tube surface temperature (\u00b0F)\n", + "\n", + "#Calculation:\n", + "DT = T2 - T1 #Change in temperature (\u00b0F)\n", + "Q = m*Cp*DT #Heat transferred from the heavy oil (Btu/h)\n", + "DT1 = T1 - t #Temperature difference driving force at the pipe entrance (\u00b0F)\n", + "DT2 = T2 - t #Temperature difference driving force at the pipe exit (\u00b0F)\n", + "DTlm = (DT1 - DT2)/(log(DT1/DT2)) #LMTD (driving force) for the heat exchanger (\u00b0F)\n", + "\n", + "#Result:\n", + "print \"The heat transfer rate is :\",round(Q),\" Btu/h .\"\n", + "print \"The LMTD for the heat exchanger is :\",round(DTlm),\" \u00b0F .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The heat transfer rate is : -176000.0 Btu/h .\n", + "The LMTD for the heat exchanger is : 129.0 \u00b0F .\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 14.8, Page number: 267" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from math import log\n", + "\n", + "#Variable declaration:\n", + "T1 = 138.0 #Temperature of oil entering the cooler (\u00b0F)\n", + "T2 = 103.0 #Temperature of oil leaving the cooler (\u00b0F)\n", + "t1 = 88.0 #Temperature of coolant entering the cooler (\u00b0F)\n", + "t2 = 98.0 #Temperature of coolant leaving the cooler (\u00b0F)\n", + "\n", + "#Calculation:\n", + "#For counter flow unit:\n", + "DT1 = T1 - t2 #Temperature difference driving force at the cooler entrance (\u00b0F)\n", + "DT2 = T2 - t1 #Temperature difference driving force at the cooler exit (\u00b0F)\n", + "DTlm1 = (DT1 - DT2)/(log(DT1/DT2)) #LMTD (driving force) for the heat exchanger (\u00b0F)\n", + "#For parallel flow unit:\n", + "DT3 = T1 - t1 #Temperature difference driving force at the cooler entrance (\u00b0F)\n", + "DT4 = T2 - t2 #Temperature difference driving force at the cooler exit (\u00b0F)\n", + "DTlm2 = (DT3 - DT4)/(log(DT3/DT4)) #LMTD (driving force) for the heat exchanger (\u00b0F)\n", + "\n", + "#Result:\n", + "print \"The LMTD for counter-current flow unit is :\",round(DTlm1,1),\" \u00b0F .\"\n", + "print \"The LMTD for parallel flow unit is :\",round(DTlm2,1),\" \u00b0F .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The LMTD for counter-current flow unit is : 25.5 \u00b0F .\n", + "The LMTD for parallel flow unit is : 19.5 \u00b0F .\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 14.10, Page number: 272" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "A = 1.0 #Surface area of glass (m^2)\n", + "h1 = 11.0 #Heat transfer coefficient inside room (W/m^2.K)\n", + "L2 = 0.125*0.0254 #Thickness of glass (m)\n", + "k2 = 1.4 #Thermal conductivity of glass (W/m.K)\n", + "h3 = 9.0 #Heat transfer coefficient from window to surrounding cold air (W/m^2.K)\n", + "\n", + "#Calculation:\n", + "R1 = 1.0/(h1*A) #Internal convection resistance (K/W)\n", + "R2 = L2/(k2*A) #Conduction resistance through glass panel (K/W)\n", + "R3 = 1.0/(h3*A) #Outside convection resistance (K/W)\n", + "Rt = R1+R2+R3 #Total thermal resistance (K/W)\n", + "U = 1.0/(A*Rt) #Overall heat transfer coefficient (W/m^2.K)\n", + "\n", + "#Result:\n", + "print \"The overall heat transfer coefficient is :\",round(U,1),\" W/m^2.K .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The overall heat transfer coefficient is : 4.9 W/m^2.K .\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 14.11, Page number: 273" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "Dx = 0.049/12.0 #Thickness of copper plate (ft)\n", + "h1 = 208.0 #Film coefficient of surface one (Btu/h.ft^2.\u00b0F)\n", + "h2 = 10.8 #Film coefficient of surface two (Btu/h.ft^2.\u00b0F)\n", + "k = 220.0 #Thermal conductivity for copper (W/m.K)\n", + "\n", + "#Calculation:\n", + "U = 1.0/(1.0/h1+Dx/k+1.0/h2) #Overall heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n", + "\n", + "#Result:\n", + "print \"The overall heat transfer coefficient is :\",round(U,2),\" Btu/h.ft^2.\u00b0F .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The overall heat transfer coefficient is : 10.26 Btu/h.ft^2.\u00b0F .\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 14.12, Page number: 274" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "Do = 0.06 #Outside diameter of pipe (m)\n", + "Di = 0.05 #Inside diameter of pipe (m)\n", + "ho = 8.25 #Outside coefficient (W/m^2.K)\n", + "hi = 2000.0 #Inside coefficient (W/m^2.K)\n", + "R = 1.33*10**-4 #Resistance for steel (m^2.K/W)\n", + "\n", + "#Calculation:\n", + "U = 1.0/(Do/(hi*Di)+R+1.0/ho) #Overall heat transfer coefficient (W/m^2.\u00b0K)\n", + "\n", + "#Result:\n", + "print \"The overall heat transfer coefficient is :\",round(U,2),\" W/m^2.\u00b0K .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The overall heat transfer coefficient is : 8.2 W/m^2.\u00b0K .\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 14.14, Page number: 274" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from math import pi,log\n", + "\n", + "#Variable declaration:\n", + "Di = 0.825/12.0 #Pipe inside diameter (ft)\n", + "Do = 1.05/12.0 #Pipe outside diameter (ft)\n", + "Dl = 4.05/12.0 #Insulation thickness (ft)\n", + "l = 1.0 #Pipe length (ft)\n", + "kp = 26.0 #Thermal conductivity of pipe (Btu/h.ft.\u00b0F)\n", + "kl = 0.037 #Thermal conductivity of insulation (Btu/h.ft.\u00b0F)\n", + "hi = 800.0 #Steam film coefficient (Btu/h.ft^2.\u00b0F)\n", + "ho = 2.5 #Air film coefficient (Btu/h.ft^2.\u00b0F)\n", + "\n", + "#Calculation:\n", + "ri = Di/2.0 #Pipe inside radius (ft)\n", + "ro = Do/2.0 #Pipe outside radius (ft)\n", + "rl = Dl/2.0 #Insulation radius (ft)\n", + "Ai = pi*Di*l #Inside area of pipe (ft^2)\n", + "Ao = pi*Do*l #Outside area of pipe (ft^2)\n", + "Al = pi*Dl*l #Insulation area of pipe (ft^2)\n", + "A_Plm = (Ao-Ai)/log(Ao/Ai) #Log mean area for steel pipe (ft^2)\n", + "A_Ilm = (Al-Ao)/log(Al/Ao) #Log mean area for insulation (ft^2)\n", + "Ri = 1.0/(hi*Ai) #Air resistance (m^2.K/W)\n", + "Ro = 1.0/(ho*Al) #Steam resistance (m^2.K/W)\n", + "Rp = (ro-ri)/(kp*A_Plm) #Pipe resistance (m^2.K/W)\n", + "Rl = (rl-ro)/(kl*A_Ilm) #Insulation resistance (m^2.K/W)\n", + "U = 1.0/(Ai*(Ri+Rp+Ro+Rl)) #Overall heat coefficient based on the inside area (Btu/h.ft^2.\u00b0F)\n", + "\n", + "#Result:\n", + "print \"The overall heat transfer coefficient based on the inside area of the pipe is :\",round(U,3),\" Btu/h.ft^2.\u00b0F .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The overall heat transfer coefficient based on the inside area of the pipe is : 0.748 Btu/h.ft^2.\u00b0F .\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 14.15, Page number: 275" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from math import pi\n", + "\n", + "#Variable declaration:\n", + "#From example 14.14:\n", + "Di = 0.825/12.0 #Pipe inside diameter (ft)\n", + "L = 1.0 #Pipe length (ft)\n", + "Ui = 0.7492 #Overall heat coefficient (Btu/h.ft^2.\u00b0F)\n", + "Ts = 247.0 #Steam temperature (\u00b0F)\n", + "ta = 60.0 #Air temperature (\u00b0F)\n", + "\n", + "#Calculation:\n", + "Ai = pi*Di*L #Inside area of pipe (ft^2)\n", + "Q = Ui*Ai*(Ts-ta) #Heat transfer rate (Btu/h)\n", + "\n", + "#Result:\n", + "print \"The heat transfer rate is :\",round(Q,1),\" Btu/h .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The heat transfer rate is : 30.3 Btu/h .\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 14.16, Page number: 276" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "hw = 200.0 #Water heat coefficient (Btu/h.ft^2.\u00b0F)\n", + "ho = 50.0 #Oil heat coefficient (Btu/h.ft^2.\u00b0F)\n", + "hf = 1000.0 #Fouling heat coefficient (Btu/h.ft^2.\u00b0F)\n", + "DTlm = 90.0 #Log mean temperature difference (\u00b0F)\n", + "A = 15.0 #Area of wall (ft^2)\n", + "\n", + "#Calculation:\n", + "X = 1.0/hw+1.0/ho+1.0/hf #Equation 14.34 for constant A\n", + "U = 1.0/X #Overall heat coeffocient (Btu/h.ft^2.\u00b0F)\n", + "Q = U*A*DTlm #Heat transfer rate (Btu/h)\n", + "\n", + "#Result:\n", + "print \"The heat transfer rate is :\",round(Q,-1),\" Btu/h .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The heat transfer rate is : 51920.0 Btu/h .\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 14.17, Page number: 277" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "from sympy import symbols,log,nsolve\n", + "\n", + "\n", + "#Variable declaration:\n", + "T = 80.0 #Pipe surface temperature (\u00b0F)\n", + "t1 = 10.0 #Brine inlet temperature (\u00b0F)\n", + "DT2 = symbols('DT2') #Discharge temperature of the brine solution (\u00b0F)\n", + "m = 20*60 #Flowrate of brine solution (lb/h)\n", + "Cp = 0.99 #Heat capacity of brine solution (Btu/lb.\u00b0F)\n", + "U1 = 150 #Overall heat transfer coefficient at brine solution entrance (Btu/h.ft^2.\u00b0F)\n", + "U2 = 140 #Overall heat transfer coefficientat at brine solution exit (Btu/h.ft^2.\u00b0F)\n", + "A = 2.5 #Pipe surface area for heat transfer (ft^2)\n", + "\n", + "#Calculation:\n", + "DT1 = T-t1 #Temperature approach at the pipe entrance (\u00b0F)\n", + "Q = m*Cp*(DT1-DT2) #Energy balance to the brine solution across the full length of the pipe (Btu/h)\n", + "DT1m = (DT1-DT2)/log(DT1/DT2) #Equation for the LMTD\n", + "QQ = A*(U2*DT1-U1*DT2)/log(U2*DT1/U1/DT2) #Equation for the heat transfer rate (Btu/h)\n", + "E = QQ-Q #Energy balance equation\n", + "R = nsolve([E],[DT2],[1.2]) #\n", + "DT = R[0] #Log mean temperature difference\n", + "t2 = T-DT #In discharge temperature of the brine solution (\u00b0F)\n", + "t2c = 5/9*(t2-32) #In discharge temperature of the brine solution in \u00b0C (c/5 = (F-32)/9)\n", + "_Q_ = Q.subs(DT2,DT) #Heat transfer rate (Btu/h)\n", + "\n", + "#Result:\n", + "print \"The temperature approach at the brine inlet side is :\",round(DT1,1),\" \u00b0F.\"\n", + "print \"Or, the temperature approach at the brine inlet side is :\",round(DT1/1.8,1),\" \u00b0C.\"\n", + "print \"The exit temperature of the brine solution is :\",round(t2,1),\" \u00b0F.\"\n", + "print \"Or, the exit temperature of the brine solution is :\",round((t2-32)/1.8,1),\" \u00b0C.\"\n", + "print \"The rate of heat transfer is :\",round(_Q_,-1),\" Btu/h.\"\n", + "print \"Or, the rate of heat transfer is :\",round(_Q_/3.412,-2),\" W.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The temperature approach at the brine inlet side is : 70.0 \u00b0F.\n", + "Or, the temperature approach at the brine inlet side is : 38.9 \u00b0C.\n", + "The exit temperature of the brine solution is : 28.4 \u00b0F.\n", + "Or, the exit temperature of the brine solution is : -2.0 \u00b0C.\n", + "The rate of heat transfer is : 21830.0 Btu/h.\n", + "Or, the rate of heat transfer is : 6400.0 W.\n" + ] + } + ], + "prompt_number": 18 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_15-checkpoint.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_15-checkpoint.ipynb new file mode 100644 index 00000000..8331e128 --- /dev/null +++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_15-checkpoint.ipynb @@ -0,0 +1,815 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:9c90790dace23fbdfc3e0ce273ce32b43acc5cfa1b423fc8f4e186650e91a101" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 15: Double Pipe Heat Exchangers" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 15.2, Page number: 290" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "Q = 12000.0 #Heat transfer rate (Btu/h)\n", + "U = 48.0 #Overall heat coefficient (Btu/ft^2.h.\u00b0F)\n", + "DTlm = 50.0 #Log mean temperature difference (\u00b0F)\n", + "\n", + "#Calculation:\n", + "A = Q/(U*DTlm) #Area of exchanger (ft^2)\n", + "\n", + "#Result:\n", + "print \"The area of the exchanger is :\",round(A),\" ft^2 .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The area of the exchanger is : 5.0 ft^2 .\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 15.3, Page number: 291" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from sympy import symbols,solve,log\n", + "\n", + "#Variable declaration:\n", + "Q = 56760 #Heat transfer rate (Btu/h)\n", + "U = 35.35 #Overall heat coefficient (Btu/ft.h.\u00b0F)\n", + "A = 32.1 #Area of exachanger (ft^2)\n", + "t1 = 63.0 #Outlet cold water temperature (\u00b0F)\n", + "T1 = 164 #Outlet hot water temperature (\u00b0F)\n", + "T2 = 99 #Inlet hot water temperature (\u00b0F)\n", + "t2 = symbols('t2') #Inlet cold water temperature (\u00b0F)\n", + "\n", + "#Calculation:\n", + "DTlm = Q/(U*A) #Log mean temperature difference (\u00b0F)\n", + "dT1 = T1-t1 #Temperature approach at pipe outlet (\u00b0F)\n", + "dT2 = T2-t2 #Temperature approach at pipe inlet (\u00b0F)\n", + "Eq = (dT2-dT1)/log(dT2/dT1)-DTlm\n", + "R = solve(Eq,t2) #Inlet cold water temperature (\u00b0F)\n", + "\n", + "#Result:\n", + "print \"The inlet cold water temperature is : \",round(R[0]),\" \u00b0F.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The inlet cold water temperature is : 79.0 \u00b0F.\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 15.4, Page number: 292" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "m = 14.6 #Flow rate of water inside the tube (lb/min)\n", + "Cp = 1 #Heat capacity of water (Btu/lb.\u00b0F)\n", + "t2 = 79 #Initial temperature of water (\u00b0F)\n", + "t1 = 63 #Final temperature of water (\u00b0F)\n", + "#From example 15.3:\n", + "Q1 = 56760 #Old heat transfer rate (Btu/h)\n", + "\n", + "#Calculation:\n", + "Q2 = m*Cp*(t2-t1) #New heat transfer rate (Btu/min)\n", + "\n", + "#Result:\n", + "print \"The new heat transfer rate is :\",round(Q2),\" Btu/min.\" \n", + "print \"Or, the new heat transfer rate is :\",round(Q2*60),\" Btu/h.\"\n", + "if (Q1==Q2) :\n", + " print \"This result agree with the Q\u02d9 provided in the problem statement. Shakespeare is wrong, nothing is rotten there.\"\n", + "else :\n", + " print \"This result does not agree with the Q\u02d9 provided in the problem statement. Shakespeare is right, something is indeed rotten.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The new heat transfer rate is : 234.0 Btu/min.\n", + "Or, the new heat transfer rate is : 14016.0 Btu/h.\n", + "This result does not agree with the Q\u02d9 provided in the problem statement. Shakespeare is right, something is indeed rotten.\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 15.5, Page number: 292" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from math import log\n", + "\n", + "#Variable declaration:\n", + "T1 = 210.0 #Initial temperature of oil (\u00b0F)\n", + "T2 = 170.0 #Final temperature of oil (\u00b0F)\n", + "T3 = 60.0 #Surface temperature of oil (\u00b0F)\n", + "m = 8000.0 #Flow rate of oil inside tube (lb/h)\n", + "cp = 0.55 #Heat capacity of oil (Btu/lb.\u00b0F)\n", + "U = 63.0 #Overall heat teansfer coefficient (Btu.h.ft^2.\u00b0F)\n", + "\n", + "#Calculation:\n", + "DT1 = T1-T3 #Temperature difference 1 (\u00b0F)\n", + "DT2 = T2-T3 #Temperature difference 2 (\u00b0F)\n", + "DTlm = (DT1-DT2)/log(DT1/DT2) #Log mean temerature difference (\u00b0F)\n", + "Q = m*cp*(T1-T2) #Heat transferred (Btu/h)\n", + "A = Q/(U*DTlm) #Heat transfer area (ft^2)\n", + "\n", + "#Result:\n", + "print \"The required heat transfer area is :\",round(A,2),\" ft^2 .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The required heat transfer area is : 21.66 ft^2 .\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 15.6, Page number: 293" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from math import log\n", + "\n", + "#Variable declaration:\n", + "T1 = 140.0 #Initial temperature of hot water (\u00b0F)\n", + "T2 = 110.0 #Final temperature of hot water (\u00b0F)\n", + "T3 = 60.0 #Initial temperature of cold water (\u00b0F)\n", + "T4 = 90.0 #Initial temperature of cold water (\u00b0F)\n", + "DTlm2 = 50.0 #Log mean temerature difference for countercurrent flow, a constant (\u00b0F) (part 2)\n", + "m = 100.0*60 #Water flow rate (lb/h)\n", + "cp = 1.0 ##Heat capacity of water (Btu/lb.\u00b0F)\n", + "U = 750.0 #Overall heat teansfer coefficient (Btu.h.ft^2.\u00b0F)\n", + "\n", + "#Calculation:\n", + "DT1 = T1-T3 #Temperature difference 1 (\u00b0F) (part 1)\n", + "DT2 = T2-T4 #Temperature difference 2 (\u00b0F)\n", + "DTlm1 = (DT1-DT2)/log(DT1/DT2) #Log mean temerature difference (\u00b0F)\n", + "Q = m*cp*(T1-T2) #Heat transferred (Btu/h)\n", + "Ap = Q/(U*DTlm1) #Heat transfer area for parallel flow (ft^2)\n", + "Ac = Q/(U*DTlm2) #Heat transfer area for counter flow (ft^2)\n", + "\n", + "#Result:\n", + "print \"1. The double pipe co-current flow is :\",round(Ap,2),\" ft^2 .\"\n", + "print \"1. The double pipe countercurrent flow is :\",round(Ac,2),\" ft^2 .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1. The double pipe co-current flow is : 5.55 ft^2 .\n", + "1. The double pipe countercurrent flow is : 4.8 ft^2 .\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 15.8, Page number: 294" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "from math import pi,log\n", + "\n", + "#Variable declaration:\n", + "uC = 3.7*10**-4 \t #Viscosity of benzene (lb/ft.s)\n", + "uH = 2.05*10**-4 \t #Viscosity of water @200 \u00b0F (lb/ft.s)\n", + "u2 = 2.16*10**-4 \t\t\t\t #Viscosity of water @192 \u00b0F (lb/ft.s)\n", + "pC = 54.8 #Density of benzene (lb/ft^3)\n", + "pH = 60.13 #Density of water (lb/ft^3)\n", + "cpC = 0.415 #Specific heat capacity of benzene (Btu/lb.\u00b0F)\n", + "cpH = 1 #Specific heat capacity of water (Btu/lb.\u00b0F)\n", + "sgC = 0.879 \n", + "kC = 0.092 #Thermal conductivity of benzene (Btu/h.ft.\u00b0F)\n", + "kH = 0.392 #Thermal conductivity of water @200 \u00b0F (Btu/h.ft.\u00b0F)\n", + "k2 = 0.390\t\t\t\t\t #Thermal conductivity of water @192 \u00b0F (Btu/h.ft.\u00b0F)\n", + "mC = 2500\t \t\t\t #Flow rate of benzene (lb/s)\n", + "mH = 4000 #Flow rate of water (lb/s)\n", + "Re = 13000 #Reynolds number\n", + "dTc = 120-60\t\t\t\t\t #Difference in temperature heating for benzene\n", + "Tw = 200\t\t\t\t #Temperatperature of hot water (\u00b0F)\n", + "#For 2-inch schedule 40 pipe\n", + "Ai = 0.541 #Inside area of pipe (ft^2/ft)\n", + "Ao = 0.622 #Outside area of pipe (ft^2/ft)\n", + "Di = 2.067 #Inside diameter of pipe (inch)\n", + "Do = 2.375 #Outside diameter of pipe (inch)\n", + "Si = 0.0233 #Inside surface area of pipe (ft^2)\n", + "dXw = 0.128 #Width of pipe (ft)\n", + "\n", + "#For 4-inch schedule 40 pipe\n", + "Dio = 4.026 #Inside diameter of pipe (inch)\n", + "Doi = Do #Outside diameter of pipe (inch)\n", + "kw = 26 \n", + "\n", + "#Calculations:\n", + "def St(Re,Pr):\t\t\t\t #Dittus Boelter equation\n", + "\treturn 0.023*Re**-0.2*Pr**-0.667\n", + "#For inside tubes:\n", + "Dicalc = 4*mC/(Re*pi*uC)/3600 #Inside diameter (ft)\n", + "mHcalc = Re*pi*uH*(Doi+Dio)/4*3600/12 #Mass flow rate of water (lb/h)\n", + "Q = mC*cpC*dTc\t\t\t\t\t #Heat in water (Btu/h)\n", + "dTH = Q/mH #Temperature difference of water (\u00b0F)\n", + "THo = Tw - dTH #Outlet temperature of water (\u00b0F)\n", + "THav = (Tw+THo)/2 #Average temperature of water (\u00b0F) \n", + "#For benzene:\n", + "PrC = cpC*uC/kC*3600 #Prandtl number\n", + "StC = round(St(13000, PrC),5) #Stanton number\n", + "hi = StC*cpC*mC/Si #Heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n", + "#For water:\n", + "ReH = 4*mH/3600/(pi*u2*(Doi+Dio)/12) #Reynolds number\n", + "PrH = round(cpH*(u2)/k2*3600 ,2) #Prandtl number\n", + "StH = round(St(ReH, PrH),5) #Stanton number\n", + "Sann = round(pi/4*(Dio**2-Doi**2)/144,4) #Surface area of annulus (ft^2)\n", + "ho = round(StH*cpH*mH/Sann) #Heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n", + "#For pipe:\n", + "Dlm = round((Do-Di)/log(Do/Di)*12,3) #Log mean difference in diameter (ft)\n", + "Uo = 1/(Do/Di/hi + dXw*Do/kw/Dlm + 1/ho) #Overall heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n", + "dTlm = (124.4-80)/log(124.4/80) #Log mean temperature difference (\u00b0F)\n", + "L = Q/(Uo*0.622*dTlm) #Length of pipe (ft)\n", + "\n", + "#Result:\n", + "print 'The required length of pipe: ',round(L,1), 'ft'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The required length of pipe: 31.4 ft\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 15.10, Page number: 300" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "from math import e\n", + "\n", + "#Variable declaration:\n", + "MC = 2000.0 \n", + "mc = 1000.0\n", + "U = 2000.0\n", + "A = 10.0\n", + "T1 = 300.0\n", + "t1 = 60.0\n", + "\n", + "#Calculation:\n", + "B = 1.0/mc \n", + "b = 1.0/MC\n", + "x = B/b\n", + "y = U*(B-b)\n", + "T2 = ((x-y)*T1 + x*(e-y)*t1)/(2*e-1)\n", + "t2 = t1+(T1-T2)/x\n", + "\n", + "#Result:\n", + "print \"T2 = :\",round(T2),\" \u00b0F\"\n", + "print \"t2 = :\",round(t2),\" \u00b0F\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "T2 = : 114.0 \u00b0F\n", + "t2 = : 153.0 \u00b0F\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 15.11, Page number: 301" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from sympy import symbols,solve,log\n", + "\n", + "#Variable declaration:\n", + "h1 = 1200.0 #Hot film coefficient (Btu/h.ft^2.\u00b0F)\n", + "h2 = 1175.0 #Cold film coefficient (Btu/h.ft^2.\u00b0F)\n", + "L = 200.0 #Length of pipe (ft)\n", + "MC = 30000.0\n", + "mc = 22300.0\n", + "T1 = 300.0 #Inlet temperature of hot fluid in pipe (\u00b0F)\n", + "t1 = 60.0 #Inlet temperature of cold fluid in pipe (\u00b0F)\n", + "T2 = symbols('T2') #Outlet temperature of hot fluid \u00b0F\n", + "t2 = symbols('t2') #Outlet temperature of cold fluid \u00b0F\n", + "#From table 6.2:\n", + "ID = 2.067 #Inside diameter of pipe (in)\n", + "OD = 2.375 #Outside diameter of pipe (in)\n", + "Dx = 0.154 #Thickness of pipe (in)\n", + "Ai = 0.541 #Inside sectional area of pipe (ft^2/ft)\n", + "k = 25.0 #Thermal conductivity of pipe (Btu/h)\n", + "\n", + "#Calculation:\n", + "Ui = 1.0/((1.0/h1) +(Dx/(k*12.0))+(1.0/(h2*(OD/ID)))) #Overall heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n", + "Ai1 = Ai*L #Inside area of pipe (ft^3/ft)\n", + "QH = MC*(T1-T2) #Heat transfer rate of hot fluid (Btu/h)\n", + "QC = mc*(t2-t1) #Heat transfer rate of cold fluid (Btu/h)\n", + "t2ht = 195 #t2 by hit and trial\n", + "x = solve(QC-QH,T2)\n", + "T2 = x[0]\n", + "DTlm = (T1-t1-T2+t2)/log((T1-t1)/(T2-t2)) #Log mean temperature difference (\u00b0F)\n", + "Q = Ui*Ai1*DTlm.subs(t2,t2ht) #Total heat transfer rate (Btu/h)\n", + "\n", + "#Result:\n", + "print \"T2 :\", round(T2.subs(t2,t2ht)),\"(\u00b0F)\"\n", + "print \"t2 :\", t2.subs(t2,t2ht),\"(\u00b0F)\"\n", + "print \"Qdot :\", round(Q/10**6) ,\"x 10**6 Btu/h\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "T2 : 200.0 (\u00b0F)\n", + "t2 : 195 (\u00b0F)\n", + "Qdot : 3.0 x 10**6 Btu/h\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 15.12, Page number: 302" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "from math import log,e\n", + "\n", + "#Variable declaration:\n", + "B = 3.33*10**-5\n", + "b = 4.48*10**-5\n", + "#From example 15.11:\n", + "A = 108.2 #Inside area of pipe (ft^3/ft)\n", + "U = 482 #Overall heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n", + "MC = 30000.0\n", + "mc = 23000.0\n", + "T1 = 300.0 #Inlet temperature of hot fluid in pipe (\u00b0F)\n", + "t1 = 60.0 #Inlet temperature of cold fluid in pipe (\u00b0F)\n", + "\n", + "#Calculation:\n", + "#From equation 15.28:\n", + "T2 = ((B/b)*(e**(U*A*(B-b))-1)*t1+T1*(B/b-1))/((B/b)*e**(U*A*(B-b))-1) #Outlet temperature of hot fluid (\u00b0F)\n", + "#From equation 15.32:\n", + "t2 = ((b/B)*(e**(U*A*(b-B))-1)*T1+t1*(b/B-1))/((b/B)*e**(U*A*(b-B))-1) #Outlet temperature of cold fluid (\u00b0F)\n", + "DT = ((T2-t1)-(T1-t2))/(log((T2-t1)/(T1-t2))) #Log mean difference temperature (\u00b0F)\n", + "Q1 = U*A*DT #Heat transfer rate of hot fluid (Btu/h)\n", + "Q2 = MC*(T1-T2) #Heat transfer rate of cold fluid (Btu/h)\n", + "\n", + "#Result:\n", + "print \"The heat load is :\",round(Q2,-3),\" Btu/h.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The heat load is : 4078000.0 Btu/h.\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 15.14, Page number: 305" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from __future__ import division\n", + "from math import log,pi\n", + "\n", + "#Variable declaration:\n", + "Ts = 100.0 #Saturation temperature (\u00b0C)\n", + "t1 = 25.0 #Initial temperature of water (\u00b0C)\n", + "t2 = 73.0 #Final temperature of water (\u00b0C)\n", + "m = 228.0/3600.0 #Mass flow rate of water (kg/s)\n", + "cp = 4174.0 #Heat capacity of water (J/kg.K)\n", + "m_s = 55.0/3600.0 #Mass flow rate of steam (kg/s)\n", + "h_vap = 2.26*10**26 #Latent heat of condensation (J/kg)\n", + "k = 54.0 #Thermal conductivity for 0.5% carbon steel (W/m.K)\n", + "rii = 0.013 #Inner radius of inner pipe of the double pipe heat exchanger (m)\n", + "roi = 0.019 #Outer radius of inner pipe of the double pipe heat exchanger (m)\n", + "Rf = 0.0002 #Fouling factor (m^2.K/W)\n", + "Uc = 0.00045 #Clean overall heat transfer coefficient (W/m^2.K)\n", + "\n", + "#Calculation:\n", + "DT1 = Ts-t1 #Temperature driving force at end 1 (K)\n", + "DT2 = Ts-t2 #Temperature driving force at end 2 (K)\n", + "DTlm = (DT1-DT2)/(log(DT1/DT2)) #Log mean difference temperature (\u00b0C)\n", + "Cw =m*cp #Capacitance rate of water (W/K)\n", + "Q = Cw*(t2-t1) #Heat transfer rate (W)\n", + "Qmax1 = Cw*(Ts-t1) #Maximum heat term from the water stream (W)\n", + "Qmax2 = m_s*h_vap #Maximum heat term from the steam (W)\n", + "E = Q/Qmax1 #Effectiveness\n", + "Lmin = (Q*(log(roi/rii)))/(2*pi*k*(Ts-t1)) #Minimum required length of heat exchanger (m)\n", + "Ud = 1.0/(1.0/Uc+Rf) #Dirty overall heat transfer coefficient (W/m^2.K)\n", + "\n", + "#Result:\n", + "print \"1. The temperature profile of the water and steam along the length of the exchanger is :\",round(DTlm),\" \u00b0C .\"\n", + "print \"2. Effectiveness of energy from steam to heat the water is :\",round(E,3),\" .\"\n", + "print \"3. The minimum length of the heat exchanger is :\",round(Lmin,3),\" m .\"\n", + "print \"4. The dirty overall heat transfer coefficient :\",round(Ud,5),\" W/m^2.K .\"\n", + "print \"5. U_dirty: \", round(1/Ud,-1),\" W/m^2.K\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1. The temperature profile of the water and steam along the length of the exchanger is : 47.0 \u00b0C .\n", + "2. Effectiveness of energy from steam to heat the water is : 0.64 .\n", + "3. The minimum length of the heat exchanger is : 0.189 m .\n", + "4. The dirty overall heat transfer coefficient : 0.00045 W/m^2.K .\n", + "5. U_dirty: 2220.0 W/m^2.K\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 15.15, Page number: 308" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from math import pi\n", + "\n", + "#Variable declaration:\n", + "Q = 12700.0 #Heat transfer rate (W)\n", + "Ud = 2220.0 #Dirty overall heat transfer coefficient (W/m^2.K)\n", + "DTlm = 47.0 #Log mean difference temperature (\u00b0C)\n", + "rii = 0.013 #Inner radius of inner pipe of the double pipe heat exchanger (m)\n", + "#Calculation:\n", + "A = Q/(Ud*DTlm) #Heat transfer area (m^2)\n", + "L = A/(2*pi*rii) #Tube length (m)\n", + "\n", + "#Result:\n", + "print \"The heat transfer area is :\",round(A,4),\" m^2 .\"\n", + "print \"The length of the heat exchanger is :\",round(L,2),\" m .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The heat transfer area is : 0.1217 m^2 .\n", + "The length of the heat exchanger is : 1.49 m .\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 15.16, Page number: 308" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "Ud = 2220.0 #Dirty overall heat transfer coefficient (W/m^2.K)\n", + "A = 0.1217 #Heat transfer area (m^2)\n", + "Cw = 264.0 #Capacitance rate of water (W/K)\n", + "\n", + "#Calculation:\n", + "NTU = (Ud*A)/Cw #Number of transfer units of the exchanger\n", + "\n", + "#Result:\n", + "print \"The number of transfer units (NTU) of the exchanger is :\",round(NTU,2),\" .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The number of transfer units (NTU) of the exchanger is : 1.02 .\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 15.18, Page number: 309" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "Ao = 1.85 #Area of heat exchanger (ft^2)\n", + "\n", + "#Calculation:\n", + "#From figure 15.6:\n", + "y = 0.560*10**-3 #Intercept 1/UoAo (\u00b0F.h/Btu)\n", + "ho = 1.0/(Ao*y) #Thermal conductivity for heat exchanger (Btu/h.ft^2.\u00b0F)\n", + "\n", + "#Result:\n", + "print \"Thermal conductivity for the heat exchanger is :\",round(ho),\" Btu/h.ft^2.\u00b0F .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thermal conductivity for the heat exchanger is : 965.0 Btu/h.ft^2.\u00b0F .\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 15.19, Page number: 310" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "#From figure 15.7:\n", + "a = 0.00126\n", + "b = 0.0276\n", + "\n", + "#Calculation:\n", + "ho = 1.0/a #The value of ho (Btu/h.ft^2.\u00b0F)\n", + "\n", + "#Result:\n", + "print \"Thermal conductivity is :\",round(ho),\" Btu/h.ft^2.\u00b0F .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thermal conductivity is : 794.0 Btu/h.ft^2.\u00b0F .\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 15.20, Page number: 311" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "Di = 0.902/12.0 #Inside diameter of tube (ft)\n", + "Do = 1.0/12.0 #Outside diameter of tube (ft)\n", + "k = 60.0 #Thermal conductivity of tube (Btu/h.ft^2.\u00b0F) \n", + "\n", + "#Calculation:\n", + "#From example 15.19:\n", + "a = 0.00126\n", + "Dr = (Do - Di)/2.0 #Radial thickness of tube wall (ft)\n", + "Rw = Dr/k #Resistance of wall (Btu/h.\u00b0F)\n", + "ho = 1.0/(a-Rw) #The revised ho (Btu/h.ft^2.\u00b0F)\n", + "\n", + "#Result:\n", + "print \"The revised ho is :\",round(ho),\" Btu/h.ft^2.\u00b0F .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The revised ho is : 839.0 Btu/h.ft^2.\u00b0F .\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 15.21, Page number: 312" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "a1 = 0.00044 #Term 'a' for U_clean\n", + "a2 = 0.00089 #Term 'a' for U_dirty\n", + "\n", + "#Calculation:\n", + "Rs = a2 - a1 #Resistance associated with the scale\n", + "hs = 1.0/Rs #Scale film coefficient (Btu/h.ft^2.\u00b0F)\n", + "\n", + "#Result:\n", + "print \"The scale film coefficient neglecting the wall resistance is:\",round(hs),\" Btu/h.ft^2.\u00b0F .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The scale film coefficient neglecting the wall resistance is: 2222.0 Btu/h.ft^2.\u00b0F .\n" + ] + } + ], + "prompt_number": 21 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_16-checkpoint.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_16-checkpoint.ipynb new file mode 100644 index 00000000..af0c69ba --- /dev/null +++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_16-checkpoint.ipynb @@ -0,0 +1,583 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:4d89093b0aef649c7f239bf75c18374320afd98a6f8286cbe2c1fcb242b5a141" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 16: Shell and Tube Heat Exchangers" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 16.5, Page number: 334" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from math import log\n", + "\n", + "#Variable declaration:\n", + "#From figure 16.13, for ideal countercurrent heat exchanger:\n", + "T1 = 150.0 #Inlet temperature of hot fluid (\u00b0F)\n", + "T2 = 100.0 #Outet temperature of hot fluid (\u00b0F)\n", + "t1 = 50.0 #Inlet temperature of cold fluid (\u00b0F)\n", + "t2 = 80.0 #Outet temperature of hot fluid (\u00b0F)\n", + "#From figure 16.14, for shell and tube exchanger:\n", + "T_1 = 50.0 #Inlet temperature of cold fluid (\u00b0F)\n", + "T_2 = 80.0 #Outet temperature of hot fluid (\u00b0F)\n", + "t_1 = 150.0 #Inlet temperature of hot fluid (\u00b0F)\n", + "t_2 = 100.0 #Outet temperature of hot fluid (\u00b0F)\n", + "\n", + "#Calculation:\n", + "DT1 = T1 - t2 #Temperature driving force 1 (\u00b0F)\n", + "DT2 = T2 - t1 #Temperature driving force 1 (\u00b0F)\n", + "DTlm1 = ((DT1-DT2)/log(DT1/DT2)) #Log mean temperature driving force for ideal countercurrent heat exchanger (\u00b0F)\n", + "P = (t2-t1)/(T1 - t1) #Dimensionless ratio P\n", + "R = (T1-T2)/(t2-t1) #Dimensionless ratio R\n", + "#From figure 16.7:\n", + "F = 0.925 #Correction Factor\n", + "DTlm2 = F*DTlm1 #Log mean temperature driving force for shell and tube exchanger (\u00b0F)\n", + "\n", + "#Result:\n", + "print \"The log mean temperature difference for ideal system is :\",round(DTlm1,1),\" \u00b0F .\"\n", + "print \"The log mean temperature difference for real system is :\",round(DTlm2,2),\" \u00b0F .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The log mean temperature difference for ideal system is : 59.4 \u00b0F .\n", + "The log mean temperature difference for real system is : 54.98 \u00b0F .\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 16.6, Page number: 335" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from math import log\n", + "5\n", + "#Variable declaration:\n", + "T1 = 400.0 #Temperature of fluid entering the shell (\u00b0F)\n", + "T2 = 250.0 #Temperature of fluid leaving the shell (\u00b0F)\n", + "t1 = 100.0 #Temperature of fluid entering the tube (\u00b0F)\n", + "t2 = 175.0 #Temperature of fluid leaving the tube (\u00b0F)\n", + "\n", + "#Calculation:\n", + "DT1 = T1 - T2 #Temperature driving force 1 (\u00b0F)\n", + "DT2 = t2 - t1 #Temperature driving force 1 (\u00b0F)\n", + "DTlm1 = ((DT1-DT2)/log(DT1/DT2)) #Log mean temperature driving force for ideal countercurrent heat exchanger (\u00b0F)\n", + "P = (t2-t1)/(T1 - t1) #Dimensionless ratio P\n", + "R = (T1-T2)/(t2-t1) #Dimensionless ratio R\n", + "#From figure 16.8:\n", + "F = 0.985 #Correction factor\n", + "DTlm2 = F*DTlm1 #Log mean temperature driving force for shell and tube exchanger (\u00b0F)\n", + "\n", + "#Result:\n", + "print \"The log mean temperature difference between the hot fluid and the cold fluid is :\",round(DTlm2,1),\" \u00b0F .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The log mean temperature difference between the hot fluid and the cold fluid is : 106.6 \u00b0F .\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 16.7, Page number: 336" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration:\n", + "#From example 16.5:\n", + "P1 = 0.30 #Dimensionless ratio P\n", + "R1 = 1.67 #Dimensionless ratio R\n", + "#From example 16.6:\n", + "P2 = 0.30 #Dimensionless ratio P\n", + "R2 = 1.67 #Dimensionless ratio R\n", + "\n", + "#Calculation:\n", + "#Applying Equation 16.27:\n", + "F1 = 0.92 #Correction Factor\n", + "#Applying Equation 16.33:\n", + "F2 = 0.985 #Correction Factor\n", + "#From example 16.6:\n", + "LMTD1 = 59.4 #Log mean temperature driving force 1 for ideal countercurrent heat exchanger (\u00b0F)\n", + "LMTD2 = 108.0 #Log mean temperature driving force 2 for ideal countercurrent heat exchanger (\u00b0F)\n", + "DTlm1 = F1*LMTD1 #Log mean temperature driving force 1 for shell and tube exchanger (\u00b0F)\n", + "DTlm2 = F2*LMTD2 #Log mean temperature driving force 2 for shell and tube exchanger (\u00b0F)\n", + "\n", + "#Result:\n", + "print \"The log mean temperature difference for real system (in example 16.5) is :\",round(DTlm1,2),\" \u00b0F .\"\n", + "print \"The log mean temperature difference for real system (in example 16.6) is :\",round(DTlm2,1),\" \u00b0F .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The log mean temperature difference for real system (in example 16.5) is : 54.65 \u00b0F .\n", + "The log mean temperature difference for real system (in example 16.6) is : 106.4 \u00b0F .\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 16.8, Page number: 337" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from math import log\n", + "\n", + "#Variable declaration:\n", + "t2 = 75.0 #Temperature of water leaving the shell (\u00b0C)\n", + "t1 = 35.0 #Temperature of water enteringing the shell (\u00b0C)\n", + "T2 = 75.0 #Temperature of oil leaving the tube (\u00b0C)\n", + "T1 = 110.0 #Temperature of oil entering the tube (\u00b0C)\n", + "m = 1.133 #Mass flowrate of water (kg/s)\n", + "cp = 4180.0 #Heat capacity of water (J/kg.K)\n", + "F = 0.965 #Correction factor\n", + "U = 350.0 #Overall heat transfer coefficient (W/m^2.K)\n", + "\n", + "#Calculation:\n", + "Q = m*cp*(t2-t1) #Heat load (W)\n", + "DT1 = T1-t2 #Temperature driving force 1 (\u00b0C)\n", + "DT2 = T2-t1 #Temperature driving force 2 (\u00b0C)\n", + "DTlm1 = (DT1-DT2)/log(DT1/DT2)+273.0 #Countercurrent log-mean temperature difference (K)\n", + "DTlm2 = F*DTlm1 #Corrected log-mean temperature difference (K)\n", + "A = Q/(U*DTlm2) #Required heat transfer area (m^2)\n", + "\n", + "#Result:\n", + "print \"The required heat-transfer area is :\",round(A,3),\" m^2 .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The required heat-transfer area is : 1.807 m^2 .\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 16.10, Page number: 338" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from math import log\n", + "\n", + "#Variable declaration:\n", + "t2 = 84.0 #Temperature of water leaving the tube (\u00b0C)\n", + "t1 = 16.0 #Temperature of water entering the tube (\u00b0C)\n", + "m1 = 10000.0/3600.0 #Mass flowrate of water (kg/s)\n", + "T2 = 94.0 #Temperature of oil leaving the shell (\u00b0C)\n", + "T1 = 160.0 #Temperature of oil entering the shell (\u00b0C)\n", + "\n", + "#Calculation:\n", + "Tw = (t1+t2)/2.0 #Average bulk temperature of water (\u00b0C)\n", + "To = (T1+T2)/2.0 #Average bulk temperature of oil (\u00b0C)\n", + "#From table 16.1:\n", + "p1 = 987.0 #Density of water (kg/m^3)\n", + "cp1 = 4176.0 #Heat capacity of water (J/kg.\u00b0C)\n", + "p2 = 822.0 #Density of oil (kg/m^3)\n", + "Q = m1*cp1*(t2-t1) #Heat load (W)\n", + "cp2 = 4820.0 #Heat capacity of oil (J/kg.\u00b0C)\n", + "m2 = Q/(cp2*(T1-T2)) #Mass flowrate of oil (kg/s)\n", + "DT1 = T2-t1 #Temperature driving force 1 (\u00b0C)\n", + "DT2 = T1-t2 #Temperature driving force 2 (\u00b0C)\n", + "DTlm1 = ((DT1-DT2)/log(DT1/DT2)) #Log mean temperature driving force for ideal countercurrent heat exchanger (\u00b0C)\n", + "P = (t2-t1)/(T1 - t1) #Dimensionless ratio P\n", + "R = (T1-T2)/(t2-t1) #Dimensionless ratio R\n", + "#From figure 16.7:\n", + "F = 0.965 #Correction factor\n", + "DTlm2 = F*DTlm1 #Log mean temperature driving force for 1-4 shell and tube exchanger (\u00b0C)\n", + "\n", + "#Result:\n", + "print \"1. The heat load is :\",round(Q/10**6,3),\" MW .\"\n", + "print \"2. The countercurrent flow log mean temperature difference is :\",round(DTlm1),\" \u00b0C .\"\n", + "print \"3. The F correction factor and the corrected log mean temperature difference is :\",round(DTlm2,1),\" \u00b0C .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1. The heat load is : 0.789 MW .\n", + "2. The countercurrent flow log mean temperature difference is : 77.0 \u00b0C .\n", + "3. The F correction factor and the corrected log mean temperature difference is : 74.3 \u00b0C .\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 16.11, Page number: 340" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from math import pi\n", + "\n", + "#Variable declaration:\n", + "#From example 16.10:\n", + "U = 350.0 #Over all heat transfer coefficient (W/m^2.\u00b0C)\n", + "DTlm = 74.3 #Log mean temperature driving force for 1-4 shell and tube exchanger (\u00b0C)\n", + "Q = 788800.0 #Heat load (W)\n", + "Nt = 11.0 #Number of tubes per pass\n", + "Np = 4.0 #Number of passes\n", + "Di = 0.0229 #Inside diameter of tube (m)\n", + "\n", + "#Calculation:\n", + "A = Q/(U*DTlm) #Heat transfer area required for heat exchanger (m^2)\n", + "N = Nt*Np #Total number of tubes\n", + "L = A/(pi*Di*N) #Tube length (m)\n", + "\n", + "#Result:\n", + "print \"The heat transfer area required for the heat exchanger is :\",round(A,2),\" m^2 .\"\n", + "print \"The length of the tubes required for the heat exchanger is :\",round(L*3.28,1),\" ft .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The heat transfer area required for the heat exchanger is : 30.33 m^2 .\n", + "The length of the tubes required for the heat exchanger is : 31.4 ft .\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 16.18, Page number: 349" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "#From example 16.10:\n", + "m1 = 2.778 #Mass flowrate of water (kg/s)\n", + "cp1 = 4176.0 #Heat capacity of water (J/kg.\u00b0C)\n", + "cp2 = 4820.0 #Heat capacity of oil (J/kg.\u00b0C)\n", + "m2 = 2.48 #Mass flowrate of oil (kg/s)\n", + "t2 = 84.0 #Temperature of water leaving the tube (\u00b0C)\n", + "t1 = 16.0 #Temperature of water entering the tube (\u00b0C)\n", + "T2 = 94.0 #Temperature of oil leaving the shell (\u00b0C)\n", + "T1 = 160.0 #Temperature of oil entering the shell (\u00b0C)\n", + "U = 350.0 #Over all heat transfer coefficient (W/m^2.\u00b0C)\n", + "A = 30.33 #Heat transfer area required for heat exchanger (m^2)\n", + "\n", + "#Calculation:\n", + "C1 = m1*cp1 #Capacitance rate of water (W/\u00b0C)\n", + "C2 = m2*cp2 #Capacitance rate of oil (W/\u00b0C)\n", + "Q = C1*(t2-t1) #Heat load of water (W)\n", + "Qmax = C1*(T1-t1) #Maximum heat load of water (W)\n", + "E = Q/Qmax #Effectiveness\n", + "if (C12:\n", + " print \"Hence, the use of the fin is justified.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The fin effectiveness is : 43.2 .\n", + "Hence, the use of the fin is justified.\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 17.12, Page number: 370" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "from math import pi\n", + "\n", + "#Variable declaration:\n", + "w = 1 #Length of tube (m)\n", + "S = 10/10**3 #Fin patch (m)\n", + "#From example 17.10:\n", + "t = 1/10**3 #Thickness of fin (m)\n", + "ro = 0.0125 #Radius of tube (m)\n", + "Af = 3.94*10**-3 #Fin surface area (m^2)\n", + "Tb = 145 #Excess temperature at the base of the fin (K)\n", + "h = 130 #Heat transfer coefficient (W/m^2.K)\n", + "Qf = 64 #Fin heat transfer rate (W)\n", + "\n", + "#Calculation:\n", + "Nf = w/S #Number of fins in tube length\n", + "wb = w-Nf*t #Unfinned base length (m)\n", + "Ab = 2*pi*ro*wb #Unfinned base area (m^2)\n", + "At =Ab+Nf*Af #Total transfer surface area (m^2)\n", + "Qt = h*(2*pi*ro*w*Tb) #Total heat rate without fins (W)\n", + "Qb = h*Ab*Tb #Heat flow rate from the exposed tube base (W)\n", + "Qft = Nf*Qf #Heat flow rate from all the fins (W)\n", + "Qt2 = Qb+Qft #Total heat flow rate (W)\n", + "Qm = h*At*Tb #Maximum heat transfer rate (W)\n", + "no = Qt2/Qm #Overall fin efficiency\n", + "Eo = Qt2/Qt #Overall effectiveness\n", + "Rb = 1/(h*Ab) #Thermal resistance of base (K/W)\n", + "Rf = 1/(h*Nf*Af*no) #Thermal resistance of fins (K/W)\n", + "\n", + "#Result:\n", + "print \"1. The total surface area for heat transfer is :\",round(At,3),\" m^2 .\"\n", + "print \"2. The exposed tube base total heat transfer rate is :\",round(Qb,1),\" W .\"\n", + "print \"Or, the exposed tube base total heat transfer rate is :\",round(Qb*3.412),\" Btu/h .\"\n", + "print \"3. The overall efficiency of the surface is :\",round(no*100,1),\" % .\"\n", + "print \"4. The overall surface effectiveness is :\",round(Eo,2),\" .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1. The total surface area for heat transfer is : 0.465 m^2 .\n", + "2. The exposed tube base total heat transfer rate is : 1332.4 W .\n", + "Or, the exposed tube base total heat transfer rate is : 4546.0 Btu/h .\n", + "3. The overall efficiency of the surface is : 88.3 % .\n", + "4. The overall surface effectiveness is : 5.22 .\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 17.13, Page number: 374" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "from math import sqrt\n", + "\n", + "#Variable declaration:\n", + "w = 1 #Width of single of fin (m)\n", + "t = 2/10**3 #Fin base thickness (m)\n", + "l = 6/10**3 #Fin length thickness (m)\n", + "T1 = 250 #Surface temperature (\u00b0C)\n", + "T2 = 20 #Ambient air temperature (\u00b0C)\n", + "h = 40 #Surface convection coefficient (W/m^2.K)\n", + "k = 240 #Thermal conductivity of fin (W/m.K)\n", + "\n", + "#Calculation:\n", + "Ab = t*w #Base area of the fin (m^2)\n", + "Te = T1-T2 #Excess temperature at the base of the fin (K)\n", + "Qw = h*Ab*Te #Heat transfer rate without a fin (W)\n", + "Af = 2*w*(sqrt(l**2-(t/2)**2)) #Fin surface area (m^2)\n", + "Qm = h*Af*Te #Maximum heat transfer rate (m^2)\n", + "Bi = h*(t/2)/k #Biot number\n", + "Lc = l #Corrected length (m)\n", + "Ap = l*t/2 #Profile area (m^2)\n", + "A = sqrt((Lc**3*h)/k*Ap) #Abscissa for the fin efficiency figure\n", + "#From figure 17.4:\n", + "nf = 0.99 #Fin efficiency\n", + "Qf = nf*Qm #Fin heat transfer rate (W)\n", + "R = Te/Qf #Fin thermal resistance (K/W)\n", + "E = Qf/Qw #Fin effectiveness\n", + "\n", + "#Result:\n", + "print \"1. The heat transfer rate without the fin is :\",round(Qw,1),\" W .\"\n", + "print \"2. The maximum heat transfer rate from the fin is :\",round(Qm,-1),\" W .\"\n", + "print \"3. The fin efficiency is :\",round(nf*100),\" % .\"\n", + "print \" The fin thermal resistance is :\",round(R,1),\" \u00b0C/W .\"\n", + "print \" The fin effectiveness is :\",round(E,1),\" .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1. The heat transfer rate without the fin is : 18.4 W .\n", + "2. The maximum heat transfer rate from the fin is : 110.0 W .\n", + "3. The fin efficiency is : 99.0 % .\n", + " The fin thermal resistance is : 2.1 \u00b0C/W .\n", + " The fin effectiveness is : 5.9 .\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 17.14, Page number: 375" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "#From example 17.13:\n", + "Qf = 108.9 #Fin heat transfer rate (W)\n", + "Qw = 18.4 #Total heat transfer rate without the fin (W)\n", + "\n", + "#Calculation:\n", + "E = Qf/Qw #Fin effectiveness\n", + "\n", + "#Result:\n", + "print \"The fin effectiveness is :\",round(E,2),\" .\"\n", + "if E>2:\n", + " print \"Hence, the use of the fin is justified.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The fin effectiveness is : 5.92 .\n", + "Hence, the use of the fin is justified.\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 17.15, Page number: 375" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "from math import pi,sqrt\n", + "\n", + "#Variable declaration:\n", + "Do = 50/10**3 #Outside diameter of tube (m)\n", + "t = 4/10**3 #Thickness of fin (m)\n", + "T = 20 #Fluid temperature (\u00b0C)\n", + "Tb = 200 #Surface temperature (\u00b0C)\n", + "h = 40 #Heat transfer coefficient (W/m^2.K)\n", + "k = 240 #Thermal conductivity of fin (W/m.K)\n", + "l = 15/10**3 #Length of fin (m)\n", + "\n", + "#Calculation:\n", + "ro = Do/2 #Radius of tube (m)\n", + "rf = ro+l #Outside radius of fin (m)\n", + "Ab = 2*pi*ro*t #Area of the base of the fin (m^2)\n", + "Te = Tb-T #Excess temperature at the base of the fin (K)\n", + "Q1 = h*Ab*Te #Total heat transfer rate without the fin (W)\n", + "Bi = h*(t/2)/k #Biot number\n", + "L = rf-ro #Fin height (m)\n", + "rc = rf+t/2 #Corrected radius (m)\n", + "Lc = L+t/2 #Corrected height (m)\n", + "Ap = Lc*t #Profile area (m^2)\n", + "Af = 2*pi*(rc**2-ro**2) #Fin surface area (m^2)\n", + "Qm = h*Af*Te #Maximum fin heat transfer rate (W)\n", + "A = sqrt(Lc**3*h/(k*Ap)) #Abscissa of fin efficiency\n", + "C = rf/ro #Curve parameter of fin efficiency\n", + "#From figure 17.4:\n", + "nf = 0.97 #Fin efficiency\n", + "Qf = nf*Qm #Fin heat transfer rate (W)\n", + "R = Te/Qf #Fin resistance (K/W)\n", + "E = Qf/Q1 #Fin effectiveness\n", + "\n", + "#Result:\n", + "print \"The fin efficiency is :\",round(nf*100),\" % .\"\n", + "print \"The fin thermal resistance is :\",round(R,1),\" \u00b0C/W .\"\n", + "print \"The fin effectiveness is :\",round(E,2),\" .\"\n", + "print \"The maximum heat transfer rate from a single fin is :\",round(Qm,2),\" W .\"\n", + "if E>2:\n", + " print \"Since Ef = FCP>2, the use of the fin is justified.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The fin efficiency is : 97.0 % .\n", + "The fin thermal resistance is : 3.6 \u00b0C/W .\n", + "The fin effectiveness is : 11.05 .\n", + "The maximum heat transfer rate from a single fin is : 51.53 W .\n", + "Since Ef = FCP>2, the use of the fin is justified.\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 17.16, Page number: 376" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "from math import pi,sqrt\n", + "\n", + "#Variable declaration:\n", + "Nf = 125 #Array of fins per meter\n", + "w = 1 #Length of fin (m)\n", + "#From example 17.15:\n", + "t = 4/10**3 #Thickness of fin (m)\n", + "Do = 50/10**3 #Outside diameter of tube (m)\n", + "Af = 7.157*10**-3 #Fin surface area (m^2)\n", + "h = 40 #Heat transfer coefficient (W/m^2.K)\n", + "DTb = 180 #Excess temperature at the base of the fin (K)\n", + "Qf = 50 #Fin heat transfer rate (W)\n", + "\n", + "#Calculation:\n", + "ro = Do/2 #Radius of tube (m)\n", + "wb = w-Nf*t #Unfinned exposed base length (m)\n", + "Ab = 2*pi*ro*wb #Area of the base of the fin (m^2)\n", + "At = Ab+Nf*Af #Total heat transfer surface area (m^2)\n", + "Qw = h*(2*pi*ro*w)*DTb #Heat rate without fin (W)\n", + "Qb = h*Ab*DTb #Heat rate from the base (W)\n", + "Qft = Nf*Qf #Heat rate from the fin (W)\n", + "Qt = Qb+Qft #Total heat rate (W)\n", + "Qm = h*At*DTb #Maximum heat transfer rate (W)\n", + "n = Qt/Qm #Overall fin efficiency\n", + "E = Qt/Qw #Overall fin effectiveness\n", + "Rb = 1/(h*Ab) #Thermal resistance of base (\u00b0C/W)\n", + "Rf = 1/(h*Nf*Af*n) #Thermal resistance of fin (\u00b0C/W)\n", + "\n", + "#Result:\n", + "print \"The rate of heat transfer per unit length of tube is :\",round(Qt,1),\" W .\"\n", + "print \"Or, the rate of heat transfer per unit length of tube is :\",round(Qt/10**3,2),\" kW .\"\n", + "print \"The overall fin efficiency is :\",round(n*100,1),\" % .\"\n", + "print \"The overall fin effectiveness is :\",round(E,2),\" .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The rate of heat transfer per unit length of tube is : 6815.5 W .\n", + "Or, the rate of heat transfer per unit length of tube is : 6.82 kW .\n", + "The overall fin efficiency is : 97.3 % .\n", + "The overall fin effectiveness is : 6.03 .\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 17.17, Page number: 377" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration:\n", + "print 'Analytical Solution'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Analytical Solution\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 17.18, Page number: 379" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "\n", + "#Variable declaration:\n", + "#From example 17.18:\n", + "T = 250 #Base temperature of fin (\u00b0F)\n", + "h = 15 #Convection coefficient of heat transfer (Btu/h.ft.\u00b0F)\n", + "w = 1 #Base width of fin (ft)\n", + "t = 1 #Thickness of fin (in)\n", + "H = 1/8 #Height of fin (in)\n", + "l = 1 #Length of fin (in)\n", + "Q = 357.2 #Heat transfer rate (Btu/h.ft)\n", + "\n", + "#Calculation:\n", + "A = (l*w+t*w+H*w)/12 #Heat transfer area of fin (ft^2)\n", + "Qm = h*A*(T-70) #Maximum heat transfer rate (Btu/h.ft)\n", + "n = Q/Qm*100 #Fin efficiency\n", + "\n", + "#Result:\n", + "print \"The fin efficiency is :\",round(n,1),\" % .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The fin efficiency is : 74.7 % .\n" + ] + } + ], + "prompt_number": 20 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_18-checkpoint.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_18-checkpoint.ipynb new file mode 100644 index 00000000..61e88510 --- /dev/null +++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_18-checkpoint.ipynb @@ -0,0 +1,658 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:4239ad8a8aef7d8398d3c69721341c39df37be6f21def1df2b04a8d6ccbef700" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 18: Other Heat Exchange Equipment" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 18.2, Page number: 384" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "\n", + "#Variable declaration:\n", + "T1 = 25 #Temperature of H2SO4 (\u00b0C)\n", + "m = 50+200 #Mass of H2SO4 (lb)\n", + "#From figure 18.2:\n", + "W1 = 50+100 #Weight of H2SO4 (lb)\n", + "W2 = 100 #Weight of H2O (lb)\n", + "\n", + "#Calculation:\n", + "m = W1/(W1+W2)*100 #Percent weight of H2SO4 (%)\n", + "m2 = W1+W2 #Mass of mixture (lb)\n", + "#From fgure 18.2:\n", + "T2 = 140 #Final temperature between the 50% solution and pure H2SO4 at 25\u00b0C (\u00b0F)\n", + "h1 = -86 #Specific heat capacity of H2O (Btu/lb)\n", + "h2 = -121.5 #Specific heat capacity of H2SO4 (Btu/lb)\n", + "Q = m2*(h2-h1) #Heat transferred (Btu)\n", + "\n", + "#Result:\n", + "print \"The final temperature between the 50% solution and pure H2SO4 at 25\u00b0C is :\",round(T2),\" \u00b0F .\"\n", + "print \"The heat transferred is :\",round(Q),\" Btu .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The final temperature between the 50% solution and pure H2SO4 at 25\u00b0C is : 140.0 \u00b0F .\n", + "The heat transferred is : -8875.0 Btu .\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 18.3, Page number: 386" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "\n", + "#Variable declaration:\n", + "F = 10000 #Mass flow rate of NaOH (lb/h)\n", + "C1 = 10 #Old concentration of NaOH solution (%)\n", + "C2 = 75 #New concentration of NaOH solution (%)\n", + "h1 = 1150 #Enthalpy of saturated steam at 14.7 psia (Btu/lb)\n", + "U = 500 #Overall heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n", + "T1 = 212 #Absolute temperature of evaporator (\u00b0F)\n", + "T2 = 340 #Saturated steam temperature (\u00b0F)\n", + "\n", + "#Calculation:\n", + "L = F*(C1/100)/(C2/100) #Flow rate of steam leaving the evaporator (lb/h)\n", + "V = F-L #Overall material balance (lb/h)\n", + "#From figure 18.3:\n", + "hF = 81 #Enthalpy of solution entering the unit (Btu/lb)\n", + "hL = 395 #Enthalpy of the 75% NaOH solution (Btu/lb)\n", + "Q = round(V)*h1+round(L)*hL-F*hF #Evaporator heat required (Btu/h)\n", + "A = Q/(U*(T2-T1)) #Area of the evaporaor (ft^2)\n", + "\n", + "#Result:\n", + "print \"The heat transfer rate required for the evaporator is :\",round(Q,-2),\" Btu/h .\"\n", + "print \"The area requirement in the evaporator is :\",round(A,1),\" ft^2 .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The heat transfer rate required for the evaporator is : 9683600.0 Btu/h .\n", + "The area requirement in the evaporator is : 151.3 ft^2 .\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 18.4, Page number: 388" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "\n", + "#Variable declaration:\n", + "U1 = 240 #Overall heat transfer coefficient for first effect (Btu/h.ft^2.\u00b0F)\n", + "U2 = 200 #Overall heat transfer coefficient for second effect (Btu/h.ft^2.\u00b0F)\n", + "U3 = 125 #Overall heat transfer coefficient for third effect (Btu/h.ft^2.\u00b0F)\n", + "A1 = 125 #Heating surface area in first effect (ft^3)\n", + "A2 = 150 #Heating surface area in second effect (ft^3)\n", + "A3 = 160 #Heating surface area in third effect (ft^3)\n", + "T1 = 400 #Condensation stream temperature in the first effect (\u00b0F)\n", + "T2 = 120 #Vapor leaving temperature in the first effect (\u00b0F)\n", + "\n", + "#Calculation:\n", + "R1 = 1/(U1*A1) #Resistance across first effect\n", + "R2 = 1/(U2*A2) #Resistance across second effect\n", + "R3 = 1/(U3*A3) #Resistance across third effect\n", + "R = R1+R2+R3 #Total resistance\n", + "DT1 = (R1/R)*(T1-T2) #Temperature drop across the heating surface in the first effect (\u00b0F)\n", + "\n", + "#Result:\n", + "print \"The temperature drop across the heating surface in the first effect is :\",round(DT1),\" \u00b0F .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The temperature drop across the heating surface in the first effect is : 80.0 \u00b0F .\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 18.6, Page number: 389" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from __future__ import division\n", + "\n", + "#Variable declaration:\n", + "F = 5000 #Mass of soltuion fed in the evaporator (lb)\n", + "xF = 2/100 #Concentration of feed\n", + "xL = 5/100 #Concentration of liquor\n", + "U = 280 #Overall heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n", + "#From figure 18.1 & 18.3:\n", + "TF = 100 #Feed temperature (\u00b0F)\n", + "TS = 227 #Steam temperature (\u00b0F)\n", + "TV = 212 #Vapour temperature (\u00b0F)\n", + "TL = 212 #Liquor temperature (\u00b0F)\n", + "TC = 227 #Condensate temperature (\u00b0F)\n", + "\n", + "#Calculation:\n", + "#From steam tables:\n", + "hF = 68 #Enthalpy of feed (Btu/lb)\n", + "hL = 180 #Enthalpy of liquor (Btu/lb)\n", + "hV = 1150 #Enthalpy of vapour (Btu/lb)\n", + "hS = 1156 #Enthalpy of steam (Btu/lb)\n", + "hC = 195 #Enthalpy of condensate (Btu/lb)\n", + "s1 = F*xF #Total solids in feed (lb)\n", + "w = F-s1 #Total water in feed (lb)\n", + "s2 = F*xF #Total solids in liquor (lb)\n", + "L = s2/xL #Total water in liquor (lb)\n", + "V = F-L #Overall balance (lb)\n", + "S = (V*hV+L*hL-F*hF)/(hS-hC) #Mass of steam (lb)\n", + "Q = S*(hS-hC) #Total heat requirement (Btu)\n", + "A = Q/(U*(TS-TL)) #Required surface aea (ft^2)\n", + "\n", + "#Result:\n", + "print \"The mass of vapor produced is :\",round(V),\" lb .\"\n", + "print \"The total mass of steam required is :\",round(S),\" lb .\"\n", + "print \"The surface area required is :\",round(A),\" ft^2 .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The mass of vapor produced is : 3000.0 lb .\n", + "The total mass of steam required is : 3611.0 lb .\n", + "The surface area required is : 826.0 ft^2 .\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 18.7, Page number: 390" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "\n", + "#Variable declaration:\n", + "F = 5000 #Mass flow rate of NaOH (lb/h)\n", + "xF = 20/100 #Old concentration of NaOH solution\n", + "TF = 100 #Feed temperature (\u00b0F)\n", + "xL = 40/100 #New concentration of NaOH solution\n", + "xv = 0 #Vapour concentration at x\n", + "yv = 0 #Vapour concentration at y\n", + "T1 = 198 #Boiling temperature of solution in the evaporator (\u00b0F)\n", + "T2 = 125 #Saturated steam temperature (\u00b0F)\n", + "U = 400 #Overall heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n", + "Ts = 228 #Steam temperature (\u00b0F)\n", + "\n", + "#Calculation:\n", + "#From steam tables at 228\u00b0F and 5 psig:\n", + "hS = 1156 #Enthalpy of steam (Btu/lb)\n", + "hC = 196 #Enthalpy of condensate (Btu/lb)\n", + "hV = hS-hC #Enthalpy of vapour (Btu/lb)\n", + "Tw = 125.4 #Boiling point of water at 4 in Hg absolute (\u00b0F)\n", + "hS2 = 1116 #Enthalpy of saturated steam at 125\u00b0F (Btu/lb)\n", + "hs = 0.46 #Heat capacity of superheated steam (Btu/lb.\u00b0F)\n", + "#From figure 18.3:\n", + "hF = 55 #Enthalpy of feed (Btu/lb)\n", + "hL = 177 #Enthalpy of liquor (Btu/lb)\n", + "L = F*xF/xL #Mass of liquor (lb)\n", + "V = L #Mass of vapour (lb)\n", + "hV = hS2+hs*(T1-T2) #Enthalpy of vapour leaving the solution (Btu/lb)\n", + "S = (V*hV+L*hL-F*hF)/(hS-hC) #Mass flow rate of steam (lb/h)\n", + "Q = S*(hS-hC) #Total heat requirement (Btu)\n", + "A = Q/(U*(Ts-T1)) #Required heat transfer area (ft^2)\n", + "\n", + "#Result:\n", + "print \"The steam flow rate is :\",round(S,-1),\" lb/h .\"\n", + "print \"The required heat transfer area is :\",round(A),\" ft^2 .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The steam flow rate is : 3170.0 lb/h .\n", + "The required heat transfer area is : 253.0 ft^2 .\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 18.10, Page number: 398" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "\n", + "#Variable declaration:\n", + "T1 = 2000 #Hot gas temperature (\u00b0F)\n", + "T2 = 550 #Cool gas temperature (\u00b0F)\n", + "T3 = 330 #Steam temperature (\u00b0F)\n", + "T4 = 140 #Water temperature (\u00b0F)\n", + "m = 30000 #Mass flow rate of steam (lb/h)\n", + "cp = 0.279 #Average heat capacity of gas (Btu/lb.\u00b0F)\n", + "N = 800 #Number of boiler tubes\n", + "\n", + "#Calculation:\n", + "DT = (T1-T3)/(T2-T3) #Temperature difference ratio\n", + "Tav = (T1+T2)/2 #Average gas temperature (\u00b0F)\n", + "#From steam tables (Appendix):\n", + "hs = 1187.7 #Steam enthalpy (Btu/lb)\n", + "hw = 107.89 #Water enthalpy (Btu/lb)\n", + "Q = m*(hs-hw) #Heat duty (Btu/h)\n", + "mh = Q/cp*(T1-T2) #Mass flow rate of gas (lb/h)\n", + "x = mh/N #Gas mass flow rate per tube (lb/h)\n", + "#From figure 18.5:\n", + "L = 15 #Length of boiler tubes (ft)\n", + "\n", + "#Result:\n", + "print \"The length of boiler tubes is :\",L,\" ft .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The length of boiler tubes is : 15 ft .\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 18.12, Page number: 399" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from __future__ import division\n", + "\n", + "#Variable declaration:\n", + "T1 = 1800 #Hot gas temperature (\u00b0F)\n", + "T2 = 500 #Cool gas temperature (\u00b0F)\n", + "#From steam tables:\n", + "Tw = 312 #Boiling point of water at 80 psia (\u00b0F)\n", + "m1 = 120000 #Mass flow rate of flue gas (lb/h)\n", + "D = 2/12 #Inside diameter of tube (ft)\n", + "cp = 0.26 #Average heat capacity of flue gas (Btu/lb.\u00b0F)\n", + "\n", + "#Calculation:\n", + "DT = (T1-Tw)/(T2-Tw) #Temperature difference ratio\n", + "Tav = (T1+T2)/2 #Average gas temperature (\u00b0F)\n", + "#From figure 18.4:\n", + "x = 150 #Gas mass flow rate per tube (m/N) (lb/h)\n", + "N = m1/x #Number of tubes\n", + "L = 21.5 #Length of tubes (ft)\n", + "A = N*L*D #Total heat transfer area (ft^2)\n", + "Q = m1*cp*(T1-T2) #Heat duty (Btu/h)\n", + "#From steam tables (Appendix):\n", + "hs = 1183.1 #Steam enthalpy at 80 psia (Btu/lb)\n", + "hw = 168.1 #Water enthalpy at 200\u00b0F (Btu/lb)\n", + "m2 = Q/(hs-hw) #Mass flow rate of water (lb/h)\n", + "\n", + "#Result:\n", + "print \"The required heat transfer area is :\",round(A),\" ft^2 .\"\n", + "print \"The tube length is :\",L,\" ft .\"\n", + "print \"The heat duty is :\",round(Q/10**7,2),\" x 10^7 .\"\n", + "print \"The water mass flow rate is :\",round(m2,-4),\" lb/h .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The required heat transfer area is : 2867.0 ft^2 .\n", + "The tube length is : 21.5 ft .\n", + "The heat duty is : 4.06 x 10^7 .\n", + "The water mass flow rate is : 40000.0 lb/h .\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 18.18, Page number: 407" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "m1 = 144206 #Mass flow rate of flue gas (lb/h)\n", + "cp = 0.3 #Average flue gas heat capacity (Btu/lb.\u00b0F)\n", + "T1 = 2050 #Initial temperature of gas (\u00b0F)\n", + "T2 = 560 #Final temperature of gas (\u00b0F)\n", + "T3 = 70 #Ambient air temperature (\u00b0F)\n", + "\n", + "#Calculation:\n", + "Q = m1*cp*(T1-T2) #Duty rate (Btu/h)\n", + "#From appendix:\n", + "cpa = 0.243 #Average ambient air heat capacity 70\u00b0F (Btu/lb.\u00b0F)\n", + "MW = 29 #Molecular weight of air at 70\u00b0F\n", + "ma = round(Q,-5)/(cpa*(T2-T3)) #Mass of air required (lb/h)\n", + "m2 = round(ma)/MW #Moles of air required (lb mol/h)\n", + "m3 = round(ma)*13.32 #Volume of air required (ft^3/h)\n", + "\n", + "#Result:\n", + "print \"The mass of air required is :\",round(ma,-2),\" lb/h .\"\n", + "print \"The moles of air required is :\",round(m2,-1),\"lb mol/h .\"\n", + "print \"The volume of air required is :\",round(m3,-3),\" ft^3/h .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The mass of air required is : 541700.0 lb/h .\n", + "The moles of air required is : 18680.0 lb mol/h .\n", + "The volume of air required is : 7215000.0 ft^3/h .\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 18.19, Page number: 407" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration:\n", + "#From example 18.19:\n", + "m1 = 144200 #Mass flow rate of flue gas (lb/h)\n", + "m2 = 541700 #Mass flow rate of air (lb/h)\n", + "R = 0.73 #Universal gas constant (psia.ft^3/lbmol.\u00b0R)\n", + "P = 1 #Absolute pressure (psia)\n", + "T = 1020 #Absolute temperature (\u00b0R)\n", + "MW = 29 #Molecular weight of air\n", + "t = 1.5 #Residence time (s)\n", + "\n", + "#Calculation:\n", + "m = m1+m2 #Total mass flow rate of the gas (lb/h)\n", + "q = m*R*T/(P*MW) #Volumetric flow at 560\u00b0F (ft^3/h)\n", + "V = q*t/3600 #Volume of tank (ft^3)\n", + "\n", + "#Result:\n", + "print \"The total mass flow rate of the gas is :\",round(m,-2),\" lb/h .\"\n", + "print \"The volumetric flow at 560\u00b0F is :\",round(q/10**7,2),\" x 10^7 ft^3/h .\"\n", + "print \"The volume of tank is :\",round(V),\" ft^3 .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The total mass flow rate of the gas is : 685900.0 lb/h .\n", + "The volumetric flow at 560\u00b0F is : 1.76 x 10^7 ft^3/h .\n", + "The volume of tank is : 7338.0 ft^3 .\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 18.20, Page number: 408" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "from math import pi\n", + "\n", + "#Variable declaration:\n", + "#Fro example 18.20:\n", + "V = 7335 #Volume of tank (ft^3)\n", + "\n", + "#Calculation:\n", + "D = (4*V/pi)**(1/3) #Diameter of tank (ft)\n", + "H = D #Height of tube (ft)\n", + "\n", + "#Result:\n", + "print \"The diameter of tank is :\",round(H,2),\" ft .\"\n", + "print \"The height of tube is :\",round(D,2),\" ft .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The diameter of tank is : 21.06 ft .\n", + "The height of tube is : 21.06 ft .\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 18.21, Page number: 408" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "\n", + "#Variable declaration:\n", + "m1 = 144206 #Mass flow rate of flue gas (lb/h)\n", + "cp1 = 0.3 #Average heat capacities of the flue gas (Btu/lb\u00b0F)\n", + "cp2 = 0.88 #Average heat capacities of the solid (Btu/lb\u00b0F)\n", + "#From example 18.18:\n", + "T1 = 550 #Initial temperature of gas (\u00b0F)\n", + "T2 = 2050 #Final temperature of gas (\u00b0F)\n", + "T3 = 70 #Initial temperature of solid (\u00b0F)\n", + "T4 = 550-40 #Final temperature of solid (\u00b0F)\n", + "\n", + "#Calculation:\n", + "Dhf = m1*cp1*(T2-T1) #For the flue gas, the enthalpy change for one hour of operation (Btu)\n", + "Dhs = round(Dhf,-4) #For the solids, the enthalpy change for one hour of operation (Btu)\n", + "m2 = Dhs/(cp2*(T4-T3)) #Mass of solid (lb)\n", + "\n", + "#Result:\n", + "print \"The mass of solid is :\",round(m2),\" lb .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The mass of solid is : 167588.0 lb .\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 18.22, Page number: 409" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "from math import log,sqrt,pi\n", + "\n", + "#Variable declaration:\n", + "#From example 18.21:\n", + "m = 144206 #Mass flow rate of flue gas (lb/h)\n", + "cp = 0.3 #Average heat capacities of the flue gas (Btu/lb\u00b0F)\n", + "T1 = 2050 #Initial temperature of gas (\u00b0F)\n", + "T2 = 180 #Final temperature of gas (\u00b0F)\n", + "T3 = 60 #Ambient air temperature (\u00b0F)\n", + "U = 1.5 #Overall heat transfer coefficient for cooler (Btu/h.ft^2.\u00b0F)\n", + "MW = 28.27 #Molecular weight of gas\n", + "R = 379 #Universal gas constant (psia.ft^3/lbmol.\u00b0R)\n", + "v = 60 #Duct or pipe velcity at inlet (2050\u00b0F) (ft/s)\n", + "\n", + "#Calculation:\n", + "Q = m*cp*(T1-T2) #Heat duty (Btu/h)\n", + "DTlm = ((T1-T3)-(T2-T3))/log((T1-T3)/(T2-T3)) #Log-mean temperature difference (\u00b0F)\n", + "A1 = round(Q,-5)/(U*round(DTlm)) #Radiative surface area (ft^2)\n", + "q = m*R*(T1+460)/(T3+460)/MW #Volumetric flow at inlet (ft^3/h)\n", + "A2 = q/(v*3600) #Duct area (ft^2)\n", + "D = sqrt(A2*4/pi) #Duct diameter (ft)\n", + "L = A1/(pi*D) #Length of required heat exchange ducting (ft)\n", + "\n", + "#Result:\n", + "print \" The radiative surface area required is :\",round(A1,-1),\" ft^2 .\"\n", + "print \" The length of required heat exchange ducting is :\",round(L),\" ft .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The radiative surface area required is : 80980.0 ft^2 .\n", + " The length of required heat exchange ducting is : 3476.0 ft .\n" + ] + } + ], + "prompt_number": 23 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_19-checkpoint.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_19-checkpoint.ipynb new file mode 100644 index 00000000..3617f433 --- /dev/null +++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_19-checkpoint.ipynb @@ -0,0 +1,861 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:e60aa082c3bd1f8f9672b5ca74c6357f1b26803a7fb296a1d0a644ab9efb4ea1" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 19: Insulation and Refractory" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 19.1, Page number: 413" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "\n", + "#Variable declaration:\n", + "H = 2.5 #Height of wall (m)\n", + "W = 4 #Width of wall (m)\n", + "h = 11 #Convective heat transfer coefficient (W/m^2.K)\n", + "T1 = 24 #Outside surface temperature (\u00b0C)\n", + "T3 = -15 #Outside air temperature (\u00b0C)\n", + "L = 7.62/10**3 #Insulation thickness (m)\n", + "k = 0.04 #Thermal conductivity of wool (W/m.K)\n", + "\n", + "#Calculation:\n", + "A = H*W #Heat transfer area (m^2)\n", + "Q = h*A*(T1-T3) #Heat transfer rate (W)\n", + "Ri = L/(k*A) #Insuation resistance (K/W)\n", + "Rc = 1/(h*A) #Convective resitance (K/W)\n", + "R = Ri+Rc #Total resistance (K/W)\n", + "Qt = (T1-T3)/R #Revised heat transfer rate (Btu/h)\n", + " \n", + "#Result:\n", + "print \"1. The heat transfer rate without insulation is :\",round(Q),\" W .\"\n", + "print \"Or, the heat transfer rate without insulation is :\",round(Q*3.412),\" Btu/h .\"\n", + "print \"2. The revised heat transfer rate with insulation is :\",round(Qt),\" W .\"\n", + "print \"Or, the revised heat transfer rate with insulation is :\",round(Qt*3.412),\" Btu/h .\"\n", + "print \"There is a calculation mistake in book.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1. The heat transfer rate without insulation is : 4290.0 W .\n", + "Or, the heat transfer rate without insulation is : 14637.0 Btu/h .\n", + "2. The revised heat transfer rate with insulation is : 1386.0 W .\n", + "Or, the revised heat transfer rate with insulation is : 4729.0 Btu/h .\n", + "There is a calculation mistake in book.\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 19.2, Page number: 414" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "#From example 19.1:\n", + "T1 = 24 #Outside surface temperature (\u00b0C)\n", + "Ri = 0.0191 #Insulation resistance (K/W)\n", + "Q = 1383 #Revised heat transfer rate (Btu/h)\n", + "\n", + "#Calculation:\n", + "T2 = T1-Q*Ri #Temperature at outer surface of insulation (\u00b0C)\n", + "\n", + "#Result:\n", + "print \"The temperature at the outer surface of the insulation is :\",round(T2,1),\" \u00b0C .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The temperature at the outer surface of the insulation is : -2.4 \u00b0C .\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 19.3, Page number: 415" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "#From example 19.1:\n", + "h = 11 #Convective heat transfer coefficient (W/m^2.K)\n", + "L = 7.62/10**3 #Insulation thickness (m)\n", + "k = 0.04 #Thermal conductivity of wool (W/m.K)\n", + "\n", + "#Calculation:\n", + "Bi = h*L/k #Biot number\n", + "\n", + "#Result:\n", + "print \"The Biot nmuber is :\",round(Bi,1),\" .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Biot nmuber is : 2.1 .\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 19.4, Page number: 415" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "\n", + "#Variable declaration:\n", + "k = 0.022 #Thermal conductivity of glass wool (Btu/h.ft.\u00b0F)\n", + "T1 = 400 #Inside wall temperature (\u00b0F)\n", + "T2 = 25 #Outside wall temperature (\u00b0C)\n", + "L = 3/12 #Length of insulation cover (ft)\n", + "\n", + "#Calculation:\n", + "T_2 = T2*(9/5)+32 #Outside wall temperature in fahrenheit scale (\u00b0F)\n", + "QbyA = k*(T1-T_2)/L #Heat flux across the wall (Btu/h.ft^2)\n", + "\n", + "#Result:\n", + "print \"The heat flux across the wall is :\",round(QbyA,1),\" Btu/h.ft^2 .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The heat flux across the wall is : 28.4 Btu/h.ft^2 .\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 19.5, Page number: 415" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "\n", + "#Variable declaration:\n", + "w = 8 #Width of wall (m)\n", + "H = 3 #Height of wall (m)\n", + "h = 21 #Convective heat transfer coefficient between the air and the surface (W/m^2.K)\n", + "T1 = -18 #Outside surace of wall temperature (\u00b0C)\n", + "T3 = 26 #Surrounding air temperature (\u00b0C)\n", + "l1 = 80/100 #Reduction in cooling load\n", + "k = 0.0433 #Thermal conductivity of cork board insulation (W/m.K)\n", + "T = 12000 #Units Btu/h in 1 ton of refrigeration\n", + "\n", + "#Calculation:\n", + "A = w*H #Heat transfer area (m^2) (part 1)\n", + "Q1 = h*A*(T1-T3) #Rate of heat flow in the absence of insulation (W)\n", + "Q2 = Q1*3.4123/T #Rate of heat flow in the absence of insulation (ton of refrigeration)\n", + "l2 = 1-l1 #Reduced cooling load (part 2)\n", + "Q3 = l2*Q1 #Heat rate with insulation (W)\n", + "Rt = (T1-T3)/Q3 #Total thermal resistance (\u00b0C/W)\n", + "R2 = 1/(h*A) #Convection thermal resistance (\u00b0C/W)\n", + "R1 = Rt-R2 #Insulation conduction resistance (\u00b0C/W)\n", + "L = R1*k*A #Required insulation thickness (m)\n", + "\n", + "#Result:\n", + "print \"1. The rate of heat flow through the rectangular wall without insulation is :\",round(Q1/10**3,2),\" kW .\"\n", + "print \"Or, the rate of heat flow through the rectangular wall without insulation in tons of refrigeration is :\",round(Q2,1),\" ton of refrigeration .\"\n", + "if (Q1<0):\n", + " print \" The negative sign indicates heat flow from the surrounding air into the cold room.\"\n", + "else :\n", + " print \" The positive sign indicates heat flow from the surrounding air into the cold room.\"\n", + "print \"2. The required thickness of the insulation board is :\",round(L*10**3,2),\" mm .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1. The rate of heat flow through the rectangular wall without insulation is : -22.18 kW .\n", + "Or, the rate of heat flow through the rectangular wall without insulation in tons of refrigeration is : -6.3 ton of refrigeration .\n", + " The negative sign indicates heat flow from the surrounding air into the cold room.\n", + "2. The required thickness of the insulation board is : 8.25 mm .\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 19.6, Page number: 417" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration:\n", + "#From example 19.5:\n", + "Q = -4435.2 #Heat rate with insulation (W)\n", + "R2 = 0.00198 #Convection thermal resistance (\u00b0C/W)\n", + "T3 = 26 #Surrounding air temperature (\u00b0C)\n", + "h = 21 #Convective heat transfer coefficient between the air and the surface (W/m^2.K)\n", + "k = 0.0433 #Thermal conductivity of cork board insulation (W/m.K)\n", + "L = 0.00825 #Required insulation thickness (m)\n", + "\n", + "#Calculation:\n", + "T2 = T3+Q*R2 #Interface temperature (\u00b0C) (part 1)\n", + "Bi = h*L/k #Biot number (part 2)\n", + "\n", + "#Result:\n", + "print \"1. The interface temperature is :\",round(T2,2),\" \u00b0C .\"\n", + "print \"2. The Biot number is :\",round(Bi),\" .\"\n", + "print \"3. Theoretical part.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1. The interface temperature is : 17.22 \u00b0C .\n", + "2. The Biot number is : 4.0 .\n", + "3. Theoretical part.\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 19.7, Page number: 417" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from __future__ import division\n", + "from math import pi,log\n", + "\n", + "#Variable declaration:\n", + "D2 = 0.5/10**3 #External diameter of needle (m)\n", + "h3 = 12 #Heat transfer coefficient (W/m^2.K)\n", + "L = 1 #Insulation thickness (m)\n", + "T1 = 95 #Reactant temperature (\u00b0C)\n", + "T3 = 20 #Ambient air temperature (\u00b0C)\n", + "k1 = 16 #Thermal conductivity of needle (W/m.K)\n", + "k3 = 0.0242 #Thermal conductivity of air (W/m.K)\n", + "D3 = 2/10**3 #Diameter of rubber tube (m)\n", + "\n", + "#Calculation:\n", + "r2 = D2/2 #External radius of needle (m)\n", + "r3 = D3/2 #Radius of rubber tube (m)\n", + "Rt1 = 1/(h3*(2*pi*r2*L)) #Thermal resistance (\u00b0C/W)\n", + "Q1 = (T1-T3)/Rt1 #Rate of heat flow in the absence of insulation (W)\n", + "Bi = h3*D2/k1 #Biot number \n", + "Nu = h3*D2/k3 #Nusselt number\n", + "R2 = log(r3/r2) #Thermal resistance of needle (\u00b0C/W)\n", + "R3 = 1/(h3*(2*pi*r3*L)) #Thermal resistance of rubber tube (\u00b0C/W)\n", + "Rt2 = R2+R3 #Total thermal resistance (\u00b0C/W)\n", + "Q2 = (T1-T3)/Rt2 #Rate of heat loss (W)\n", + "\n", + "#Result:\n", + "print \"1. The rate of the heat loss from the hypodermic needle with the rubber insulation is :\",round(Q1,2),\" W .\"\n", + "print \" The rate of the heat loss from the hypodermic needle without the rubber insulation is :\",round(Q2,2),\" W .\"\n", + "print \"2. The Biot number is :\",round(Bi,6),\" .\"\n", + "print \" The nusselt number is :\",round(Nu,3),\" .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1. The rate of the heat loss from the hypodermic needle with the rubber insulation is : 1.41 W .\n", + " The rate of the heat loss from the hypodermic needle without the rubber insulation is : 5.12 W .\n", + "2. The Biot number is : 0.000375 .\n", + " The nusselt number is : 0.248 .\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 19.9, Page number: 420" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "from math import log, pi\n", + "\n", + "#Variable declaration:\n", + "h = 140 #Convention heat transfer coefficient (W/m^2.K)\n", + "D1 = 10/10**3 #Rod diameter (m)\n", + "L = 2.5 #Rod length (m)\n", + "T1 = 200 #Surface temperature of rod (\u00b0C)\n", + "T2 = 25 #Fluid temperature (\u00b0C)\n", + "k = 1.4 #Thermal conductivity of bakellite (W/m.K)\n", + "l = 55/10**3 #Insulation thickness (m)\n", + "\n", + "#Calculation:\n", + "Q1 = h*pi*D1*L*(T1-T2) #Rate of heat transfer for the bare rod (W) (part 1)\n", + "Bi = 2 #Critical Biot number (part 2)\n", + "D2 = Bi*k/h #Critical diameter associated with the bakelite coating (m)\n", + "r2 = D2/2 #Critical radius associated with the bakelite coating (m)\n", + "r1 = D1/2 #Rod radius (m)\n", + "R1 = log(r2/r1)/(2*pi*k*L) #Insulation conduction resistance (\u00b0C/W)\n", + "R2 = 1/(h*(2*pi*r2*L)) #Convection thermal resistance (\u00b0C/W)\n", + "Rt1 = R1+R2 #Total thermal resistance (\u00b0C/W)\n", + "Qc = (T1-T2)/Rt1 #Heat transfer rate at the critical radius (W)\n", + "r3 = r1+l #New radius associated with the bakelite coating after insulation (m) (part 3)\n", + "R3 = log(r3/r1)/(2*pi*k*L) #Insulation conduction bakelite resistance (\u00b0C/W)\n", + "R4 = 1/(h*(2*pi*r3*L)) #Convection bakelite thermal resistance (\u00b0C/W)\n", + "Rt2 = R3+R4 #Total bakelite thermal resistance (\u00b0C/W)\n", + "Q2 = (T1-T2)/Rt2 #Heat transfer rate at the bakelite critical radius (W)\n", + "Re = ((Q1-Q2)/Q1)*100 #Percent reduction in heat transfer rate relative to the case of a bare rod (%)\n", + "\n", + "#Result:\n", + "print \"1. The rate of heat transfer for the bare rod is :\",round(Q1),\" W .\"\n", + "print \"2. The critical radius associated with the bakelite coating is :\",round(r2*10**3),\" mm.\"\n", + "print \" & the heat transfer rate at the critical radius is :\",round(Qc),\" W .\"\n", + "print \"3. The fractional reduction in heat transfer rate relative to the case of a bare rod is :\",round(Re,1),\" % .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1. The rate of heat transfer for the bare rod is : 1924.0 W .\n", + "2. The critical radius associated with the bakelite coating is : 10.0 mm.\n", + " & the heat transfer rate at the critical radius is : 2273.0 W .\n", + "3. The fractional reduction in heat transfer rate relative to the case of a bare rod is : 24.6 % .\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 19.10, Page number: 421" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "from math import pi, log\n", + "\n", + "#Variable declaration:\n", + "r1 = 1.1/100 #Inside radius of pipe (m)\n", + "r2 = 1.3/100 #Outside radius of pipe (m)\n", + "r3 = 3.8/100 #Outside radius of asbestos insulation (m)\n", + "L = 1 #Length of tube (m)\n", + "h1 = 190 #Heat transfer coefficient from ethylene glycol to the stainless steel pipe (W/m^2.K)\n", + "k2 = 19 #Thermal conductivity of pipe (W/m.K)\n", + "h2 = 14 #Outside heat transfer coefficient from the air to the surface of the insulation (W/m^2.K)\n", + "k3 = 0.2 #Thermal conductivity of asbestos (W/m.K)\n", + "T1 = 124 #Hot ethylene glycol temperature (\u00b0C)\n", + "T5 = 2 #Surrounding air temperature (\u00b0C)\n", + "k4 = 0.0242 #Thermal conductivity of air (W/m.K)\n", + "\n", + "#Calculation:\n", + "A1 = 2*pi*r1*L #Inside surface area of pipe (m^2) (part1)\n", + "A2 = 2*pi*r2*L #Outside surface area of pipe (m^2)\n", + "A3 = 2*pi*r3*L #Outside surface area of asbestos insulation (m^2)\n", + "R1 = 1/(h1*A1) #Inside convection resistance (\u00b0C/W)\n", + "R2 = log(r2/r1)/(2*pi*k2*L) #Conduction resistance through the tube (\u00b0C/W)\n", + "R3 = 1/(h2*A2) #Outside convection resistance (\u00b0C/W)\n", + "Rt1 = R1+R2+R3 #Total resistance without insulation (\u00b0C/W)\n", + "Q1 = (T1 - T5)/Rt1 #Heat transfer rate without insulation (W)\n", + "R4 = log(r3/r2)/(2*pi*k3*L) #Conduction resistance associated with the insulation (\u00b0C/W) (part 2)\n", + "R5 = 1/(h2*A3) #Outside convection resistance (\u00b0C/W)\n", + "Rt2 = R1+R2+R4+R5 #Total rsistance with the insulation (\u00b0C/W)\n", + "Q2 = (T1-T5)/Rt2 #Heat transfer rate with the insulation (W)\n", + "U1 = 1/(Rt2*A1) #Overall heat transfer coefficient based on the inside area (W/m^2.K) (part 3)\n", + "U3 = 1/(Rt2*A3) #Overall heat transfer coefficient based on the outside area (W/m^2.K) (part 4)\n", + "T3 = T1-(R1+R2)*Q2 #Temperature at the steel\u2013insulation interface (\u00b0C) (part 5)\n", + "Bi1 = h2*(2*r3)/k3 #Outside Biot number (part 6)\n", + "Bi2 = h1*(2*r1)/k2 #Inside Biot number\n", + "Nu = h1*(2*r1)/k4 #Nusselt number of the air\n", + "rlm = (r3-r2)/log(r3/r2) #Log mean radius of the insulation (m) (part 7)\n", + "\n", + "#Result:\n", + "print \"1. The rate of heat transfer without insulation is :\",round(Q1,1),\" W.\"\n", + "print \"2. The rate of heat transfer with insulation is :\",round(Q2,1),\" W.\"\n", + "print \"3. The overall heat transfer coefficient based on the inside area of the tube is :\",round(U1,2),\" W/m^2.K .\"\n", + "print \"4. The overall heat transfer coefficient based on the outside area of the insulation is :\",round(U3,1),\" W/m^2.K .\"\n", + "print \"5. The temperature, T3, at the steel\u2013insulation interface is :\",round(T3,1),\" \u00b0C.\"\n", + "print \"6. The inside Biot numbers is :\",round(Bi2,2),\" .\"\n", + "print \" The outside Biot numbers is :\",round(Bi1,2),\" .\"\n", + "print \" The Nusselt number is :\",round(Nu,1),\" .\"\n", + "print \"7. The log mean radius of insulation is :\",round(rlm*100,2),\" cm.\"\n", + "print \"There is a printing mistake in book for unit in part 7.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1. The rate of heat transfer without insulation is : 128.1 W.\n", + "2. The rate of heat transfer with insulation is : 99.2 W.\n", + "3. The overall heat transfer coefficient based on the inside area of the tube is : 11.76 W/m^2.K .\n", + "4. The overall heat transfer coefficient based on the outside area of the insulation is : 3.4 W/m^2.K .\n", + "5. The temperature, T3, at the steel\u2013insulation interface is : 116.3 \u00b0C.\n", + "6. The inside Biot numbers is : 0.22 .\n", + " The outside Biot numbers is : 5.32 .\n", + " The Nusselt number is : 172.7 .\n", + "7. The log mean radius of insulation is : 2.33 cm.\n", + "There is a printing mistake in book for unit in part 7.\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 19.11, Page number: 424" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "from math import pi\n", + "\n", + "#Variable declaration:\n", + "h1 = 800 #Heat transfer coefficient for steam condensing inside coil (Btu/h.ft^2.\u00b0F)\n", + "h2 = 40 #Heat transfer coefficient for oil outside coil (Btu/h.ft^2.\u00b0F)\n", + "h3 = 40 #Heat transfer coefficient for oil inside tank wal (Btu/h.ft^2.\u00b0F)\n", + "h4 = 2 #Heat transfer coefficient for outer tank wall to ambient air (Btu/h.ft^2.\u00b0F)\n", + "k1 = 0.039 #Thermal conductivity of insulation layer (Btu/h.ft.\u00b0F)\n", + "l1 = 2/12 #Thickness of insulation layer (ft)\n", + "D = 10 #Diameter of tank (ft)\n", + "H = 30 #Height of tank (ft)\n", + "k2 = 224 #Thermal conductivity of copper tube (Btu/h.ft.\u00b0F)\n", + "l2 = (3/4)/12 #Thickness of insulation layer (ft)\n", + "T1 = 120 #Temperature of tank (\u00b0F)\n", + "T2 = 5 #Outdoor temperature (\u00b0F)\n", + "\n", + "#Calculation:\n", + "Uo1 = 1/(1/h3+(l1/k1)+1/h4) #Overall heat transfer coefficient for tank (Btu/h.ft^2.\u00b0F)\n", + "At = pi*(D+2*l1)*H #Surface area of tank (ft^2)\n", + "Q = Uo1*At*(T1-T2) #Heat transfer rate lost from the tank (Btu/h)\n", + "#From table 6.3:\n", + "l2 = 0.049/12 #Thickness of coil (ft)\n", + "A = 0.1963 #Area of 18 guage, 3/4-inch copper tube (ft^2/ft)\n", + "Uo2 = 1/(1/h2+(l2/k2)+1/h1) #Overall heat transfer coefficient for coil (Btu/h.ft^2.\u00b0F)\n", + "#From steam tables:\n", + "Tst = 240 #Temperature for 10 psia (24.7 psia) steam (\u00b0F)\n", + "Ac = Q/(Uo2*(Tst-T1)) #Area of tube (ft^2)\n", + "L = Ac/A #Lengt of tube (ft)\n", + "\n", + "#Result:\n", + "print \"The length ofcopper tubing required is :\",round(L,1),\" ft .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The length ofcopper tubing required is : 26.0 ft .\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 19.12, Page number: 426" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from __future__ import division\n", + "from math import pi, log\n", + "from numpy import array,log as LOG\n", + "\n", + "#Variable declaration:\n", + "#For 1-inch pipe schedule 40:\n", + "Di = 1.049/12 #Inside diameter (ft)\n", + "Do = 1.315/12 #Outside diameter (ft)\n", + "L = 8000 #Length of pipe (ft)\n", + "hi = 2000 #Heat transfer coefficient inside of the pipe (Btu/h.ft^2.\u00b0F)\n", + "ho = 100 #Outside heat transfer coefficient (Btu/h.ft.\u00b0F)\n", + "kl = 0.01 #Thermal conductivity of insulation (Btu/h.ft.\u00b0F)\n", + "T1 = 240 #Steam temperature (\u00b0F)\n", + "T2 = 20 #Air temperature (\u00b0F)\n", + "k = 24.8 #Thermal conductivity for steel (Btu/h.ft.\u00b0F)\n", + "Dxl = array([3/8,1/2,3/4,1])/12 #thickness(ft)\n", + "amt = array([1.51,3.54,5.54,8.36])/6 #Cost per feet($) \n", + "\n", + "#Calculation:\n", + "D_ = (Do-Di)/log(Do/Di) #Log-mean diameter of the pipe (ft)\n", + "Dl = Do+2*(Dxl) #Insulation thickness (ft)\n", + "D_l = (Dl-Do)/LOG(Dl/Do) #Log mean diameter of pipe (ft)\n", + "Dxw = (Do-Di)/2 #Pipe thickness (ft)\n", + "Rw = Dxw/(k*pi*D_*L) #Wall resistance ((Btu/h.\u00b0F)^-1)\n", + "Ri = 1/(hi*pi*Di*L) #Inside steam convection resistance ((Btu/h.\u00b0F)^-1)\n", + "Rl = Dxl/(kl*pi*D_l*L) #Insulation resistance ((Btu/h.\u00b0F)^-1)\n", + "Ro = 1/(ho*pi*Dl*L) #Outside air convection resistance ((Btu/h.\u00b0F)^-1)\n", + "R = Ri+Rw+Rl+Ro #Total resistance ((Btu/h.\u00b0F)^-1)\n", + "Uo = 1/(R*pi*Dl*L) #Overall outside heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n", + "Ui = 1/(R*pi*Di*L) #Overall inside heat transfer coefficient (Btu/h.ft^2.\u00b0F)\n", + "dT = T1-T2\n", + "Ai = pi*Di*L #Inside area (ft^2)\n", + "Q = Ui*Ai*dT #Energy loss (Btu/h)\n", + "def energyPerDollar(Q1,Q2,amt1,amt2):\n", + " return round((Q1-Q2)/(8000*(amt2-amt1)),1)\n", + "\n", + "#Results:\n", + "print \"Energy saved per dollar ingoing from 3/8 to 1/2 inch is :\",energyPerDollar(Q[0],Q[1],amt[0],amt[1]),' Btu/h.$'\n", + "print \"Energy saved per dollar ingoing from 1/2 to 3/4 inch is :\",energyPerDollar(Q[1],Q[2],amt[1],amt[2]),' Btu/h.$'\n", + "print \"Energy saved per dollar ingoing from 3/4 to 1 inch is :\",energyPerDollar(Q[2],Q[3],amt[2],amt[3]),' Btu/h.$'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Energy saved per dollar ingoing from 3/8 to 1/2 inch is : 18.2 Btu/h.$\n", + "Energy saved per dollar ingoing from 1/2 to 3/4 inch is : 18.8 Btu/h.$\n", + "Energy saved per dollar ingoing from 3/4 to 1 inch is : 6.8 Btu/h.$\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 19.16, Page number: 434" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "\n", + "#Variable declaration:\n", + "ki = 0.44 #Thermal conductivity of insulation (Btu/h.ft.\u00b0F)\n", + "ho = 1.32 #Air flow coefficient (Btu/h.ft^2.\u00b0F)\n", + "OD = 2 #Outside diameter of pipe (in)\n", + "\n", + "#Calculation:\n", + "rc = (ki/ho)*12 #Outer critical radius of insulation (in)\n", + "ro = OD/2 #Outside radius of pipe (in)\n", + "L = rc-ro #Critical insulation thickness (in)\n", + "\n", + "#Result:\n", + "print \"The outer critical radius of insulation is :\",round(rc),\" in .\"\n", + "if rorc, the heat loss will decrease as insulation is added.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The outer critical radius of insulation is : 4.0 in .\n", + "Since, ro0):\n", + " print \"There is a positive entropy change.\"\n", + "else :\n", + " print \"There is a negative entropy change.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The entropy chage is : 0.2101 Btu/\u00b0F .\n", + "There is a positive entropy change.\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 21.2, Page number: 461" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "from math import log\n", + "\n", + "#Variable declaration:\n", + "#From example 21.1:\n", + "DSh = -0.2744 #Entropy for hot fluid (Btu/\u00b0F)\n", + "DSc = 0.3795 #Entropy for cold fluid (Btu/\u00b0F)\n", + "m = 1 #Mass flowrate (lb)\n", + "cP = 1 #Heat capacity (Btu/lb.\u00b0F)\n", + "#From figure 21.4:\n", + "DT = 0 #Temperature difference driving force (\u00b0F)\n", + "DS_D = 0 #Entropy for D exchanger (Btu/\u00b0F)\n", + "\n", + "#Calculation:\n", + "DS_C = DSh+DSc #Entropy for C exchanger (Btu/\u00b0F)\n", + "DSt = DS_C+DS_D #Total entropy change of exchangers (Btu/\u00b0F)\n", + "\n", + "#Result:\n", + "print \"The total entropy change is :\",DSt,\" Btu/\u00b0F .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The total entropy change is : 0.1051 Btu/\u00b0F .\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 21.3, Page number: 462" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from math import log\n", + "\n", + "#Variable declaration:\n", + "#From figure 21.5:\n", + "m = 2 #Mass flowrate (lb)\n", + "cP = 1 #Heat capacity (Btu/lb.\u00b0F)\n", + "DS1 = -0.2744 #Entropy for hot fluid for E exchanger (Btu/\u00b0F)\n", + "T1 = 180 #Temperature cold fluid entering the E exchabger (\u00b0F)\n", + "T2 = 60 #Temperature cold fluid leaving the E exchabger (\u00b0F)\n", + "\n", + "#Calculation:\n", + "DS2 = m*cP*log((T1+460)/(T2+460)) #Entropy for cold fluid for E exchanger (Btu/\u00b0F)\n", + "DS_E = DS1+DS2 #Entropy for E exchanger (Btu/\u00b0F)\n", + "DS_F = DS_E #Entropy for F exchanger (Btu/\u00b0F)\n", + "DSt = DS_F+DS_E #Entropy change in exchangers E and F (Btu/\u00b0F)\n", + "\n", + "#Result:\n", + "print \"The entropy change in exchangers E and F is :\",round(DSt,4),\" Btu/\u00b0F .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The entropy change in exchangers E and F is : 0.2818 Btu/\u00b0F .\n" + ] + } + ], + "prompt_number": 4 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_22-checkpoint.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_22-checkpoint.ipynb new file mode 100644 index 00000000..65afae0f --- /dev/null +++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_22-checkpoint.ipynb @@ -0,0 +1,544 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:02a3e83bf8e73eb737ccd32c864c102b912719b43e71a2afa02159b5cd3f3cf2" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 22: Design Principles and Industrial Applications" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 22.6, Page number: 471" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from __future__ import division\n", + "from sympy import symbols,solve\n", + "\n", + "#Variable declaration:\n", + "#From steam tables:\n", + "h1 = 1572 #Enthalpy for super heated steam at (P = 40 atm, T = 1000\u00b0F) (Btu/lb)\n", + "h2 = 1316 #Enthalpy for super heated steam at (P = 20 atm, T = 600\u00b0F) (Btu/lb)\n", + "h3 = 1151 #Enthalpy for saturated steam (Btu/lb)\n", + "h4 = 28.1 #Enthalpy for saturated water (Btu/lb)\n", + "m1 = 1000 #Mass flowrate of steam (lb/h)\n", + "m = symbols('m') #Mass flow rate of steam (lb/h)\n", + "\n", + "#Calculation:\n", + "Dh1 = m1*(h3-h4) #The change in enthalpy for the vaporization of the water stream (Btu/h)\n", + "Dh2 = m*(h1-h2) #The change in enthalpy for the cooling of the water stream (Btu/h)\n", + "x = solve(Dh1-Dh2,m) #Mass flowrate of steam (lb/h)\n", + "m2 = x[0]; #Mass flowrate of steam (lb/h)\n", + "\n", + "#Result:\n", + "print \"The mass flowrate of the utility steam required is :\",round(m2),\" lb/h.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The mass flowrate of the utility steam required is : 4386.0 lb/h.\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 22.7, Page number: 473" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "\n", + "#Variable declaration:\n", + "#From table 22.1:\n", + "QH1 = 12*10**6 #Heat duty for process unit 1 (Btu/h)\n", + "QH2 = 6*10**6 #Heat duty for process unit 2 (Btu/h)\n", + "QH3 = 23.5*10**6 #Heat duty for process unit 3 (Btu/h)\n", + "QH4 = 17*10**6 #Heat duty for process unit 4 (Btu/h)\n", + "QH5 = 31*10**6 #Heat duty for process unit 5 (Btu/h)\n", + "T1 = 90 #Supply water temperature (\u00b0F)\n", + "T2 = 115 #Return water temperature (\u00b0F)\n", + "cP = 1 #Cooling water heat capacity (Btu/(lb.\u00b0F))\n", + "p = 62*0.1337 #Density of water (lb/gal)\n", + "BDR = 5/100 #Blow-down rate\n", + "\n", + "#Calculation:\n", + "QHL = (QH1+QH2+QH3+QH4+QH5)/60 #Heat load (Btu/min)\n", + "DT = T2-T1 #Change in temperature (\u00b0F)\n", + "qCW = round(QHL,-5)/(DT*cP*p) #Required cooling water flowrate (gpm)\n", + "qBD = BDR*qCW #Blow-down flow (gpm)\n", + "\n", + "#Result:\n", + "print \"The total flowrate of cooling water required for the services is :\",round(qCW,-1),\" gpm.\"\n", + "print \"The required blow-down flow is :\",round(qBD),\" gpm.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The total flowrate of cooling water required for the services is : 7240.0 gpm.\n", + "The required blow-down flow is : 362.0 gpm.\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 22.8, Page number: 474" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "\n", + "#Variable declaration:\n", + "Q1 = 10*10**6 #Unit heat duty for process unit 1 (Btu/h)\n", + "Q2 = 8*10**6 #Unit heat duty for process unit 2 (Btu/h)\n", + "Q3 = 12*10**6 #Unit heat duty for process unit 3 (Btu/h)\n", + "Q4 = 20*10**6 #Unit heat duty for process unit 4 (Btu/h)\n", + "hv = 751 #Enthalpy of vaporization for pressure 500 psig (Btu/lb)\n", + "\n", + "#Calculation:\n", + "mB1 = Q1/hv #Mass flowrate of 500 psig steam through unit 1 (lb/h)\n", + "mB2 = Q2/hv #Mass flowrate of 500 psig steam through unit 2 (lb/h)\n", + "mB3 = Q3/hv #Mass flowrate of 500 psig steam through unit 3 (lb/h)\n", + "mB4 = Q4/hv #Mass flowrate of 500 psig steam through unit 4 (lb/h)\n", + "mBT = mB1+mB2+mB3+mB4 #Total steam required (lb/h)\n", + "\n", + "#Result:\n", + "print \"The total steam required is :\", round(mBT,-1),\" lb/h.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The total steam required is : 66580.0 lb/h.\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 22.9, Page number: 474" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "from sympy import symbols,solve\n", + "from math import log,pi\n", + "\n", + "#Variable declaration:\n", + "po = 53*16.0185 #Density of oil (kg/m^3)\n", + "co = 0.46*4186.7 #Heat capacity of oil (J/kg.\u00b0C)\n", + "muo = 150/1000 #Dynamic viscosity of oil (kg/m.s)\n", + "ko = 0.11*1.7303 #Thermal conductivity of oil (W/m.\u00b0C)\n", + "qo = 28830*4.381*10**-8 #Volumetric flowrate of oil (m^3/s)\n", + "pw = 964 #Density of water (kg/m^3)\n", + "cw = 4204 #Heat capacity of water (J/kg.\u00b0C)\n", + "muw = 0.7/3600*1.4881 #Dynamic viscosity of water (kg/m.s)\n", + "kw = 0.678 #Thermal conductivity of water (W/m.\u00b0C)\n", + "qw = 8406*4.381*10**-8 #Volumetric flowrate of water (m^3/s)\n", + "t1 = 23.5 #Initial temperature of oil (\u00b0C)\n", + "t2 = 27 #Final temperature of oil (\u00b0C)\n", + "T1 = 93 #Water heating temperature of water (\u00b0C)\n", + "T2 = symbols('T2') #Minimum temperature of heating water (\u00b0C)\n", + "A = symbols('A') #Heat transfer area (m^2)\n", + "Uc = 35.4 #Clean heat transfer coefficient (W/m^2.K)\n", + "Rf = 0.0007 #Thermal resistance (m^2.K/W)\n", + "D = 6*0.0254 #Inside diameter of pipe (m)\n", + "\n", + "#Calculation:\n", + "vo = muo/po #Kinematic viscosity of oil (m^2/s)\n", + "mo = po*qo #Mass flowrate of oil (kg/s)\n", + "vw = muw/pw #Kinematic viscosity of (m^2/s)\n", + "mw = pw*qw #Masss flow rate of water (kg/s)\n", + "Q1 = mo*co*(t2-t1) #Duty of exchanger of oil (W)\n", + "T2m = t1 #Lowest possible temperature of the water (\u00b0C) (part 1)\n", + "Qmw = mw*cw*(T1-T2m) #Maximum duty of exchanger of water (W) (part 2)\n", + "Q2 = mw*cw*(T1-T2) #Duty of exchanger of water in terms of T2 (W)\n", + "x = solve(Q1-Q2,T2) #Solving value for T2 (\u00b0C)\n", + "T3 = x[0]; #Minimum temperature of heating water (\u00b0C)\n", + "DT1 = T3-t1 #Inlet temperature difference (\u00b0C)\n", + "DT2 = T1-t2 #Outlet temperature difference (\u00b0C)\n", + "DTlm = (DT1-DT2)/log(DT1/DT2) #Log mean temperature difference (\u00b0C)\n", + "Ud1 = 1/Uc+Rf #Dirty heat transfer coefficient (W/m^2.K) (part 3)\n", + "Ud2 = 34.6 #Dirty heat transfer coefficient (W/m^2.\u00b0C)\n", + "Q3 = Ud2*A*DTlm #Duty of exchanger (W) (part 4)\n", + "y = solve(Q1-Q3,A) #Heat transfer area (m^2)\n", + "A1 = y[0]; #Required heat transfer area (m^2)\n", + "L = A1/(pi*D) #Required heat transfer length (m)\n", + "Qmo = mo*co*(T1-t1) #Maximum duty of exchanger of oil (W) (part 5)\n", + "Qm = Qmw #Maximum duty of exchanger (W)\n", + "E = Q1/Qm*100 #Effectiveness (%)\n", + "NTU = Ud2*A1/(mw*cw) #Number of transfer units\n", + "\n", + "#Result:\n", + "print \"1. The lowest possible temperature of the water is :\",T2m,\" \u00b0C .\"\n", + "print \"2. The log mean temperature difference is :\",round(DTlm,2),\" \u00b0C .\"\n", + "print \"3. The overall heat transfer coefficient for the new clean exchanger is :\",round(Ud2,1),\" (W/m^2.\u00b0C .\"\n", + "print \"4. The length of the double pipe heat exchanger is :\",round(L,2),\" m .\"\n", + "print \"5. The effectiveness of the exchanger is :\",round(E,2),\" % .\"\n", + "print \" The NTU of the exchanger is :\",round(NTU,4),\" .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1. The lowest possible temperature of the water is : 23.5 \u00b0C .\n", + "2. The log mean temperature difference is : 65.33 \u00b0C .\n", + "3. The overall heat transfer coefficient for the new clean exchanger is : 34.6 (W/m^2.\u00b0C .\n", + "4. The length of the double pipe heat exchanger is : 6.68 m .\n", + "5. The effectiveness of the exchanger is : 6.97 % .\n", + " The NTU of the exchanger is : 0.0741 .\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 22.10, Page number: 477" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "from math import log,pi\n", + "\n", + "#Variable declaration:\n", + "#From example 22.9:\n", + "t1 = 23.5 #Initial temperature of oil (\u00b0C)\n", + "t2 = 27 #Final temperature of oil (\u00b0C)\n", + "T1 = 93 #Water heating temperature of water (\u00b0C)\n", + "T2 = 88.16 #Minimum temperature of heating water (\u00b0C)\n", + "U = 34.6 #Overall heat transfer coefficient (W/m^2.\u00b0C)\n", + "Q = 7227.2 #Duty of exchanger (W)\n", + "D = 6*0.0254 #Inside diameter of pipe (m)\n", + "l = 6.68 #Previous heat transfer length (m)\n", + "\n", + "#Calculation:\n", + "DT1 = T1-t1 #Inlet temperature difference (\u00b0C)\n", + "DT2 = T2-t2 #Outlet temperature difference (\u00b0C)\n", + "DTlm = (DT1-DT2)/log(DT1/DT2) #Log mean temperature difference (\u00b0C)\n", + "A = Q/(U*DTlm) #Required heat transfer area (m^2)\n", + "L = A/(pi*D) #Required heat transfer length (m)\n", + "\n", + "#Result:\n", + "print \"The length of the parallel pipe heat exchanger is :\",round(L,2),\" m .\"\n", + "if L>l:\n", + " print \"The tube length would increase slightly.\"\n", + "elif LRd):\n", + " print \"Therefore, the exchanger as specified is unsuitable for these process conditions since the fouling factor is above the recommended value. Cleaning is recommended.\"\n", + "else:\n", + " print \"Therefore, the exchanger as specified is suitable for these process conditions since the fouling factor is below the recommended value. Cleaning is not recommended.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The dirt (d) factor is : -0.0157 Btu/h.ft^2.\u00b0F .\n", + "Therefore, the exchanger as specified is suitable for these process conditions since the fouling factor is below the recommended value. Cleaning is not recommended.\n" + ] + } + ], + "prompt_number": 27 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_23-checkpoint.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_23-checkpoint.ipynb new file mode 100644 index 00000000..02544a8f --- /dev/null +++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_23-checkpoint.ipynb @@ -0,0 +1,106 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:ea99fc2be6052cbd9b5accb00ac50cd0a25a5282b964ce8d492c2c528e36d584" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 23: Environmental Management" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 23.6, Page number: 498" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from __future__ import division\n", + "\n", + "#Variable declaration:\n", + "Q = 20000 #Fuel input (Btu)\n", + "e = 1 #Energy produced (kW.h)\n", + "Btu = 3412 #Units Btu in 1 kW.h\n", + "\n", + "#Calulation:\n", + "ER = Q/Btu #Energy requirement in 1990 (kW.h)\n", + "E = e/ER*100 #Efficiency of energy conversion (%)\n", + "\n", + "#Result:\n", + "print \"The efficiency of energy conversion is :\",round(E,1),\" % .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The efficiency of energy conversion is : 17.1 % .\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 23.7, Page number: 499" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "\n", + "#Variable declaration:\n", + "ADL1 = 2 #Average daily load (MW)\n", + "R = 25/100 #Reduction in electrical load (%)\n", + "\n", + "#Calculation:\n", + "L = 1-R #New load fraction\n", + "ADL2 = ADL1*L #New average daily load (MW)\n", + "AR = ADL1-ADL2 #Average reduction in electrical load (MW)\n", + "\n", + "#Result:\n", + "print \"The new Average daily load for the plant is :\",ADL2,\" MW.\"\n", + "print \"The average reduction in electrical load is :\",AR,\" MW.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The new Average daily load for the plant is : 1.5 MW.\n", + "The average reduction in electrical load is : 0.5 MW.\n" + ] + } + ], + "prompt_number": 7 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_24-checkpoint.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_24-checkpoint.ipynb new file mode 100644 index 00000000..fb821b6b --- /dev/null +++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_24-checkpoint.ipynb @@ -0,0 +1,387 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:20841f2d078ed8f6b672e93204c42bfe5b2cecc320cf09e962fc7cfcf63372c5" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 24: Accident and Emergency Management" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 24.4, Page number: 514" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "\n", + "#Variable declaration:\n", + "fm = 30/100 #Mole fraction of methane\n", + "fe = 50/100 #Mole fraction of ethane\n", + "fp = 20/100 #Mole fraction of pentane\n", + "LFLm = 0.046 #Lower flammability limit for methane\n", + "LFLe = 0.035 #Lower flammability limit for ethane\n", + "LFLp = 0.014 #Lower flammability limit for propane\n", + "UFLm = 0.142 #Upper flammability limit for methane\n", + "UFLe = 0.151 #Upper flammability limit for ethane\n", + "UFLp = 0.078 #Upper flammability limit for propane\n", + "\n", + "#Calculation:\n", + "LFLmix = 1/((fm/LFLm)+(fe/LFLe)+(fp/LFLp)) #Lower flammability limit of gas mixture\n", + "UFLmix = 1/((fm/UFLm)+(fe/UFLe)+(fp/UFLp)) #Upper flammability limit of gas mixture\n", + "\n", + "#Result:\n", + "print \"The upper flammability limit (UFL) of the gas mixture is :\",round(UFLmix*100,2),\" % .\"\n", + "print \"The lower flammability limit (LFL) of the gas mixture is :\",round(LFLmix*100,2),\" % .\"\n", + "print \"There is a printing mistake in book.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The upper flammability limit (UFL) of the gas mixture is : 12.52 % .\n", + "The lower flammability limit (LFL) of the gas mixture is : 2.85 % .\n", + "There is a printing mistake in book.\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 24.5, Page number: 514" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "from sympy import nsimplify as changeToFraction\n", + "\n", + "#Variable declaration:\n", + "P_A = 10/100 #Probability that the first tube is defective if the first is replaced\n", + "P_B = 10/100 #Probability that the second tube is defective if the first is replaced\n", + "\n", + "#Calculation:\n", + "P_AB = P_A*P_B #Probability that the two tubes are defective if the first is replaced\n", + "P_B_A = 9/99 #Probability that the second tube is defective if the first tube is not replaced\n", + "Pd_AB = P_A*P_B_A #Probability that both tubes are defective if the first tube is not replaced\n", + "\n", + "#Result:\n", + "print \"The probability that both tubes are defective if :\"\n", + "print \"(a) the first is replaced before the second is drawn is :\",changeToFraction(P_AB),\" .\"\n", + "print \"(b) the first is not replaced before the second is drawn is :\",changeToFraction(Pd_AB),\" .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The probability that both tubes are defective if :\n", + "(a) the first is replaced before the second is drawn is : 1/100 .\n", + "(b) the first is not replaced before the second is drawn is : 1/110 .\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 24.6, Page number: 515" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from sympy import symbols, integrate, exp\n", + "\n", + "#Variable declaration:\n", + "X = symbols('X') #Range of X\n", + "Px = 1.7*(exp(-1.7*X)) #Probability distribution function\n", + "\n", + "#Calculation:\n", + "P = integrate(Px, (X,2,6)) #Probability that X will have a value between 2 and 6\n", + "\n", + "#Result:\n", + "print \"The probability that X will have a value between 2 and 6 is :\",round(P,4),\" .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The probability that X will have a value between 2 and 6 is : 0.0333 .\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 24.7, Page number: 517" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "from math import factorial\n", + "\n", + "#Variable Declaration:\n", + "n = 20 #Total number of components\n", + "p = 0.1 #Probability of success\n", + "\n", + "#Calculations:\n", + "def binomial(n,p,x):\n", + " P=0\n", + " for x in range(0,x,1):\n", + " P = P + p**x*(1-p)**(n-x)*factorial(n)/(factorial(x)*factorial(n-x))\n", + " return P\n", + "\n", + "#Results:\n", + "print \"Probability that the sprinkler system fails :\",round((1-binomial(n,p,4))*100,2),\"%\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Probability that the sprinkler system fails : 13.3 %\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 24.8, Page number: 518" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from sympy import symbols, integrate, exp\n", + "\n", + "#Variable declaration:\n", + "a = 1.3*10**-3 #Constant a\n", + "B = 0.77 #Constant B\n", + "t = symbols('t') #Time (h)\n", + "Ft = a*B*t**(B-1)*(exp(-a*t**B)) #Pdf for heat exchanger tube\n", + "Pt = integrate(Ft, (t,0,1000)) #Probability that a heat exchanger will fail within 100 hours\n", + "\n", + "#Result:\n", + "print \"The probability that a tube in a heat exchanger will fail in 1000 hours is :\",round(Pt,2),\" .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The probability that a tube in a heat exchanger will fail in 1000 hours is : 0.23 .\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 24.9, Page number: 519" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "from scipy.stats import norm as f\n", + "\n", + "#Variable declaration:\n", + "m = 0.4008 #Mean(inch)\n", + "s = 0.0004 #Standard Deviation(inch)\n", + "UL = 0.4000+0.001 #Upper Limit\n", + "LL = 0.4000-0.001 #Upper Limit\n", + "\n", + "#Calculation:\n", + "Ps = f.cdf(UL,m,s)-f.cdf(LL,m,s)#Probability of meeting specs\n", + "Pd = 1-Ps #Probability of defect\n", + "\n", + "#Results:\n", + "print 'Probability of meeting specifications:',round(Ps*100,2),'%'\n", + "print 'Probability of Defect:',round(Pd*100,2),'%'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Probability of meeting specifications: 69.15 %\n", + "Probability of Defect: 30.85 %\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 24.10, Page number: 522" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "from numpy import array,minimum\n", + "from math import sqrt\n", + "\n", + "#variable Declaration:\n", + "mTa = array([100]*10) #Mean weeks for thermometer failure(A)\n", + "mTb = array([90]*10) #Mean weeks for thermometer failure(B)\n", + "mTc = array([80]*10) #Mean weeks for thermometer failure(C)\n", + "sTa = 30 #Standard deviation (weeks) for thermometer failure(A)\n", + "sTb = 20 #Standard deviation (weeks) for thermometer failure(B)\n", + "sTc = 10 #Standard deviation (weeks) for thermometer failure(C)\n", + "Ra = array([0.52,0.80,0.45,0.68,0.59,0.01,0.50,0.29,0.34,0.46]) #Random No corrosponding to A\n", + "Rb = array([0.77,0.54,0.96,0.02,0.73,0.67,0.31,0.34,0.00,0.48]) #Random No corrosponding to B\n", + "Rc = array([0.14,0.39,0.06,0.86,0.87,0.90,0.28,0.51,0.56,0.82]) #Random No corrosponding to B\n", + "Za = array([0.05,0.84,-0.13,0.47,0.23,-2.33,0.00,-0.55,-0.41,-0.10]) #Normal variable corrosponding to random No for A\n", + "Zb = array([0.74,0.10,1.75,-2.05,0.61,0.44,-0.50,-0.41,-3.90,-0.05]) #Normal variable corrosponding to random No for B\n", + "Zc = array([-1.08,-0.28,-1.56,1.08,1.13,1.28,-0.58,0.03,0.15,0.92]) #Normal variable corrosponding to random No for C\n", + "\n", + "#Calculations:\n", + "Ta = mTa+sTa*Za\n", + "Tb = mTb+sTb*Zb\n", + "Tc = mTc+sTc*Zc\n", + "Ts = minimum(Ta,Tb)\n", + "Ts = minimum(Ts,Tc)\n", + "m = array([sum(Ts)/len(Ts)]*10)\n", + "s = sqrt(sum((Ts-m)**2)/(len(Ts)-1))\n", + "\n", + "#Results:\n", + "print 'Standard deviation :',round(s,1),\" Weeks\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Standard deviation : 25.9 Weeks\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 24.15, Page number: 531" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "\n", + "#Variable declaration:\n", + "t = 273 #Standard temperature (K)\n", + "v = 0.0224 #Volume of air occupied by 1 gmol of ideal gas (m^3)\n", + "V = 1100 #Volume of heat exchanger (m^3)\n", + "T = 22+273 #Temperature of heat exchanger (K)\n", + "x1 = 0.75 #gmols of hydrocarbon leaking from the exchanger (gmol)\n", + "\n", + "#Calculation:\n", + "n = V*(1/v)*(t/T) #Total number of gmols of air in the room (gmol)\n", + "xHC = (x1/(n+x1))*10**6 #The mole fraction of hydrocarbon in the room (ppm)\n", + "\n", + "#Result:\n", + "print \"1. The mole fraction of hydrocarbon in the room is :\",round(xHC*1000,-1),\" ppb .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1. The mole fraction of hydrocarbon in the room is : 16500.0 ppb .\n" + ] + } + ], + "prompt_number": 3 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_26-checkpoint.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_26-checkpoint.ipynb new file mode 100644 index 00000000..64b80ece --- /dev/null +++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_26-checkpoint.ipynb @@ -0,0 +1,167 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:4c0513ab1606f42cc2658f4efc57e03793ddba6911c2c7915b3159fc7138c6b8" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 26: Numerical Methods" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 26.8, Page number: 558" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from __future__ import division\n", + "from sympy import symbols,solve,log\n", + "from math import exp\n", + "\n", + "#Variable Declaration:\n", + "A,B,r,C = symbols('A B r C');\n", + "\n", + "#Calculation:\n", + "res = solve([A + B*log(2)-log(3),A + B*log(4)-log(12)],[A,B])\n", + "A = round(float(res[A]),4)\n", + "B = round(float(res[B]))\n", + "kA = round(exp(A),2)\n", + "a = B\n", + "\n", + "#Result:\n", + "print 'The equation for rate of reaction is: ',-r,'=',kA*C**a " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The equation for rate of reaction is: -r = 0.75*C**2.0\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 26.9, Page number: 559" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import scipy.stats as f\n", + "\n", + "#Variable Declaration:\n", + "T = [-40,-20,0,10,12,30,40,50,60,80,100,150,200,250,300,400,500]\n", + "u = [1.51,1.61,1.71,1.76,1.81,1.86,1.90,1.95,2.00,2.09,2.17,2.38,2.57,2.75,2.93,3.25,3.55]\n", + "\n", + "#Calculations:\n", + "B,A,r_value, p_value, std_err = f.linregress(T,u)\n", + "\n", + "#Results:\n", + "print 'The value of A in regression model is:',round(A,4)\n", + "print 'The value of B in regression model is:',round(B,4)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of A in regression model is: 1.7484\n", + "The value of B in regression model is: 0.0038\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 26.11, Page number: 561" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from __future__ import division\n", + "from scipy.optimize import fmin_cobyla as optimize\n", + "\n", + "\n", + "#Variable Declaration:\n", + "def f(x):\t\n", + " return -2.0*x[0] - 1.6*x[1]\n", + "\n", + "def c1(x):\n", + " return 16820 - x[0]\n", + "\n", + "def c2(x):\n", + " return 1152 - x[1]\n", + "\n", + "def c3(x):\n", + " return 1500 - 0.08*x[0] - 0.11*x[1]\n", + "\n", + "def c4(x):\n", + " return 6000 - 0.29*x[0] - 0.54*x[1]\n", + "\n", + "def c5(x):\n", + " return 11000 - 0.63*x[0] - 0.35*x[1]\n", + "\n", + "def c6(x):\n", + " return x[0]\n", + "\n", + "def c7(x):\n", + " return x[1]\n", + "\n", + "#Calculation\n", + "X = optimize(f,[16820,1152],[c1,c2,c3,c4,c5,c6], disp = 0)\n", + "\n", + "#Result:\n", + "print \"Maximum Profit is $\",round(-f(X)), \"/day or $\", -365*f(X), \"/year\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum Profit is $ 35483.0 /day or $ 12951368.0 /year\n" + ] + } + ], + "prompt_number": 7 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_27-checkpoint.ipynb b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_27-checkpoint.ipynb new file mode 100644 index 00000000..c5e5dea1 --- /dev/null +++ b/Heat_Transfer_Applications_for_the_Practicing_Engineer_/.ipynb_checkpoints/Chapter_27-checkpoint.ipynb @@ -0,0 +1,544 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:9cb92879a3edfd07367a11876840b47bf3060ee079039238aa0305841473df9a" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 27: Economics and Finance" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 27.5, Page number: 575" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration:\n", + "i = 0.03375 #Rate of interest (%)\n", + "n = 9 #Years to the end of life (yr)\n", + "P = 60000 #Cost of exchanger ($)\n", + "L = 500 #Salvage value ($)\n", + "x = 5 #Time after 5 years (yr)\n", + "\n", + "#Calculation:\n", + "SFDF = i/((1+i)**n-1) #Sinking fund depreciation factor\n", + "UAP = (P-L)*SFDF #Uniform annual payment ($)\n", + "B = P-((P-L)/n)*x #Appraisal value after 5 years ($)\n", + "\n", + "#Result:\n", + "print \"1. The uniform annual payment made into the fund at the of the year is : $\",round(UAP),\" .\"\n", + "print \"2. The appraisal value of the exchanger at the end of the fifth year is : $\",round(B),\" .\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1. The uniform annual payment made into the fund at the of the year is : $ 5768.0 .\n", + "2. The appraisal value of the exchanger at the end of the fifth year is : $ 26945.0 .\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 27.6, Page number: 576" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "\n", + "#Variable declaration:\n", + "C = 150000 #Capital cost ($)\n", + "i = 7/100 #Interest rate\n", + "n = 5 #Time (yr)\n", + "OC = 15000 #Operating cost ($)\n", + "A = 75000 #Annual cost for the old process ($)\n", + "\n", + "#Calculation:\n", + "CRF = (i*(1+i)**n)/((1+i)**n-1) #Capital recovery factor\n", + "IC = CRF*C #Initial cost ($)\n", + "AC = IC+OC #Total annualized cost ($)\n", + "\n", + "#Result:\n", + "print \"The annualized cost for the new heating system is : $\",round(AC),\" .\"\n", + "if (ACDPp):\n", + " print \"A shell-and-tube heat exchanger should therefore be selected based on the above economic analysis.\"\n", + "else :\n", + " print \"A double pipe heat exchanger should therefore be selected based on the above economic analysis.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The profit for the shell-and-tube unit is : $ 272000.0 /yr .\n", + "The profit for the double pipe unit is : $ 420000.0 /yr .\n", + "A shell-and-tube heat exchanger should therefore be selected based on the above economic analysis.\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "ILLUSTRATIVE EXAMPLE 27.8, Page number: 579" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from __future__ import division\n", + "from math import log\n", + "\n", + "#Variable declaration:\n", + "m = 50000 #Mass flowrate of the organic fluid (lb/h)\n", + "cP = 0.6 #The heat capacity of the organic liquid (Btu/lb.\u00b0F)\n", + "T1 = 150 #Initial temperature of organic fluid (\u00b0F)\n", + "T2 = 330 #Final temperature of organic fluid (\u00b0F)\n", + "Ts1 = 358 #Saturation temperature for 150 psia (\u00b0F)\n", + "Ts2 = 417 #Saturation temperature for 300 psia (\u00b0F)\n", + "L1 = 863.6 #Latent heat for 150 psia (Btu/lb)\n", + "L2 = 809 #Latent heat for 300 psia (Btu/lb)\n", + "c1 = 5.20/1000 #Cost for 150 psia ($/lb)\n", + "c2 = 5.75/1000 #Cost for 300 psia ($/lb)\n", + "CI1 = 230 #Cost index in 1998 \n", + "CI2 = 360 #Cost index in 2011\n", + "IF = 3.29 #Installation factor\n", + "PF1 = 1.15 #Pressure factors for 100 to 200 psig\n", + "PF2 = 1.20 #Pressure factors for 200 to 300 psig\n", + "OP = 90/100 #Plant on-stream operation factor\n", + "h = 365*24 #Hours in a year (h)\n", + "\n", + "#Calculation:\n", + "Q = m*cP*(T2-T1) #Overall heta duty (Btu/h)\n", + "DT1 = Ts1-T1 #Temperature driving force 1 for 150 psia (\u00b0F)\n", + "DT2 = Ts1-T2 #Temperature driving force 2 for 150 psia (\u00b0F)\n", + "LMTD1 = (DT1-DT2)/log(DT1/DT2) #Log-mean temperature difference for 150 psia (\u00b0F)\n", + "DT3 = Ts2-T1 #Temperature driving force 1 for 300 psia (\u00b0F)\n", + "DT4 = Ts2-T2 #Temperature driving force 2 for 300 psia (\u00b0F)\n", + "LMTD2 = (DT3-DT4)/log(DT3/DT4) #Log-mean temperature difference for 1300 psia (\u00b0F)\n", + "A1 = Q/(138*LMTD1) #Required heat transfer area for 150 psia (ft^2)\n", + "A2 = Q/(138*LMTD2) #Required heat transfer area for 300 psia (ft^2)\n", + "BC1 = 117*A1**0.65 #Base cost for 150 psia ($)\n", + "BC2 = 117*A2**0.65 #Base cost for 13000 psia ($)\n", + "C1 = BC1*(CI2/CI1)*IF*PF1 #Capital cost for 150 psia ($)\n", + "C2 = BC2*(CI2/CI1)*IF*PF2 #Capital cost for 300 psia ($)\n", + "S1 = Q*(h*OP)/L1 #Steam requirement for 150 psia (lb/yr)\n", + "S2 = Q*(h*OP)/L2 #Steam requirement for 300 psia (lb/yr)\n", + "SC1 = S1*c1 #Annual steam cost for 150 psia ($/yr)\n", + "SC2 = S2*c2 #Annual steam cost for 300 psia ($/yr)\n", + "\n", + "#Result:\n", + "print \"1. The capital cost for 150 psia is : $\",round(C1,-3),\" .\"\n", + "print \" The capital cost for 300 psia is : $\",round(C2,-3),\" .\"\n", + "print \"2. The annual steam cost for 150 psia is : $\",round(SC1,-3),\"/yr .\"\n", + "print \" The annual steam cost for 300 psia is : $\",round(SC2,-3),\"/yr .\"\n", + "if (C1SC2):\n", + " print \"The 300-psia exchanger costs less to purchase and install, but it costs more to operate. Choosing the more expensive, 150-psia exchanger is the obvious choice.\"\n", + "elif (C1>C2 and SC1Chapter 1: Temperature

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 1.1, Page Number: 53

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "c=-40.0 #Temp in degree Celcius\n", + "\n", + "#calculations\n", + "k=c+273\n", + "F=((9.0/5.0)*c)+32.0\n", + "R=((9.0/5.0)*c)+492.0\n", + "\n", + "#Result\n", + "print('\\nK=%d\u00b0K' %k)\n", + "print('\\nF=%d\u00b0F' %F)\n", + "print('\\nR=%d\u00b0R' %R)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "K=233\u00b0K\n", + "\n", + "F=-40\u00b0F\n", + "\n", + "R=420\u00b0R" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 1.2, Page Number: 53

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#varable Declaration\n", + "span=1000.0 #given value of span in \u00b0C\n", + "accuracy=1.0/100.0 #1% accuracy\n", + "\n", + "#calculations\n", + "err=span*accuracy\n", + "max_scale=1200.0\n", + "Range_instr=max_scale+span\n", + "meter_reading=700.0\n", + "per_of_err=(err/meter_reading)*100.0\n", + "\n", + "#result\n", + "print('(a)\\nAs error can be either positive or negative') \n", + "print('\\n the probable error at any point on the scale =\u00b1 %d\u00b0C'%err)\n", + "print('\\n(b)\\nRange of the Instrument = %d\u00b0C'%Range_instr)\n", + "print('\\n(c)\\nPercentage of Error = \u00b1 %.2f%% '%per_of_err)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + "As error can be either positive or negative\n", + "\n", + " the probable error at any point on the scale =\u00b1 10\u00b0C\n", + "\n", + "(b)\n", + "Range of the Instrument = 2200\u00b0C\n", + "\n", + "(c)\n", + "Percentage of Error = \u00b1 1.43% " + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 1.3, Page Number: 54

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "resi_per_leg=5.0 # lead wire resistance per leg in Ohm\n", + "temp_coeff=0.385 # Temperature coefficient of Pt 100 RTD in ohms/\u00b0C\n", + "\n", + "#calculation\n", + "R_due_to_leadwires=2*resi_per_leg\n", + "err=R_due_to_leadwires/temp_coeff\n", + "err =round(err,0)\n", + "temp_obj=200.0\n", + "temp_measured=temp_obj+err\n", + "per_of_err=((temp_measured-temp_obj)/temp_obj)*100.0\n", + "\n", + "#Result\n", + "print('(a)\\nThe contribution of 10 ohms lead wire resistance')\n", + "print('to the measurement error = %d\u00b0C' %err)\n", + "print('\\n(b)\\nPercentage of Error = %d%%' %per_of_err)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + "The contribution of 10 ohms lead wire resistance\n", + "to the measurement error = 26\u00b0C\n", + "\n", + "(b)\n", + "Percentage of Error = 13%" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 1.4, Page Number: 54

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "temp=2.022 #Millivolt corresponds to reference junction temp 50\u00b0C\n", + "millivolt_cor=37.325 #Millivolt corresponds to reference junction temp 900\u00b0C\n", + "\n", + "#calculation\n", + "op=millivolt_cor-temp\n", + "\n", + "#result\n", + "print('Millivolt output available = % .3f' %op)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Millivolt output available = 35.303" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 1.5, Page Number: 54

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "millivolt_cor=2.585 #Millivolt corresponds to reference junction temp 50\u00b0C\n", + "pot_reading=30.511 #reading on pot\n", + "\n", + "#calculation\n", + "corrected_millivolt=pot_reading+millivolt_cor\n", + "\n", + "#result\n", + "print('Temperature correspond to %.3f mV from the table = 600\u00b0C' %corrected_millivolt)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Temperature correspond to 33.096 mV from the table = 600\u00b0C" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 1.6, Page Number: 54

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable Declarion\n", + "ref_jun=100.0 #reference junction temp.\n", + "mV_100=0.645 #voltage at 100\u00b0C\n", + "mV_1000=9.585 #voltage at 1000\u00b0C\n", + "mV_1200=11.947 #voltage at 1200\u00b0C\n", + "\n", + "#calculation\n", + "op1=mV_1000-mV_100\n", + "op2=mV_1200-mV_100\n", + "\n", + "#result\n", + "print('Millivolt to be fed checking 1000 C = %.3f mV'%op1)\n", + "print('\\nMillivolt to be fed checking 1200 C = %.3f mV'%op2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Millivolt to be fed checking 1000 C = 8.940 mV\n", + "\n", + "Millivolt to be fed checking 1200 C = 11.302 mV" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 1.7, page Number: 55

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#variable declaration\n", + "E_rec_pyro=0.95*0.85 #Energy received by pyrometer\n", + "\n", + "#calculation\n", + "T=1100.0/E_rec_pyro\n", + " \n", + "#result\n", + "print('Pyrometer reading T = %.2f\u00b0C'%T)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Pyrometer reading T = 1362.23\u00b0C" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 1.8, Page Number: 55

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#(a)\n", + "\n", + "#variable declaration\n", + "hot1_mV=41.29 # Millivolt corresponds to hot junction temp \n", + "cold1_mV=2.022 # Millivolt corresponds to cold junction temp \n", + "\n", + "#calculation\n", + "op1=hot1_mV-cold1_mV\n", + "\n", + "#(b)\n", + "\n", + "#variable declaration\n", + "hot2_mV=33.096 #Millivolt corresponds to hot junction temp \n", + "cold2_mV=2.585 #Millivolt corresponds to cold junction temp \n", + "#calculation\n", + "op2=hot2_mV-cold2_mV\n", + "\n", + "#(c)\n", + "\n", + "#variable declaration\n", + "hot3_mV=11.947 #Millivolt corresponds to hot junction temp \n", + "cold3_mV=0.299 #Millivolt corresponds to cold junction temp \n", + "#calculation\n", + "op3=hot3_mV-cold3_mV\n", + "\n", + "#result\n", + "print('(a)\\nOutput Millivolt = %.3f'%op1)\n", + "print('\\n(b)\\nOutput Millivolt = %.3f'%op2)\n", + "print('\\n(c)\\nAs the wrongly formed thermocouples at J1 and J2 will always oppose')\n", + "print('the main millivolt output, the net output will be lower than normal value.')\n", + "print('Output mV<%.3f'%op3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + "Output Millivolt = 39.268\n", + "\n", + "(b)\n", + "Output Millivolt = 30.511\n", + "\n", + "(c)\n", + "As the wrongly formed thermocouples at J1 and J2 will always oppose\n", + "the main millivolt output, the net output will be lower than normal value.\n", + "Output mV<11.648" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 1.9, Page Number: 56

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "Rl_ind=250.0 #load resistor for indicator\n", + "Rl_rec=250.0 #load resistor for recorder\n", + "load_allowable=600.0 #allowable load with load independency\n", + "\n", + "#calculation\n", + "load_connected= Rl_ind+Rl_rec\n", + "max_load_controller=load_allowable-load_connected\n", + "op_cont=600.0\n", + "total=Rl_ind+Rl_rec+load_allowable\n", + "extra_load=total-op_cont\n", + "\n", + "#result\n", + "print('(a)\\nThe max load to the controller = %d ohms'%max_load_controller)\n", + "print('\\n(b)\\nExtra Load = %d ohms'%extra_load)\n", + "print('\\nAdditional Power Supply voltage required = 10 V')\n", + "print('\\nMinimum Power Supply Voltage = 34 ')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + "The max load to the controller = 100 ohms\n", + "\n", + "(b)\n", + "Extra Load = 500 ohms\n", + "\n", + "Additional Power Supply voltage required = 10 V\n", + "\n", + "Minimum Power Supply Voltage = 34 " + ] + } + ], + "prompt_number": 9 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Industrial_Instrumentation/.ipynb_checkpoints/Chapter_2-checkpoint.ipynb b/Industrial_Instrumentation/.ipynb_checkpoints/Chapter_2-checkpoint.ipynb new file mode 100644 index 00000000..58fb16b3 --- /dev/null +++ b/Industrial_Instrumentation/.ipynb_checkpoints/Chapter_2-checkpoint.ipynb @@ -0,0 +1,627 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:71218a03a9605d3f7a7341594baa7c6aaf03b045951699482ae5c6da5c0be5f7" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 2: Pressure

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.1, Page Number: 116

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "x=10000.0*10.0 #equivalnt to 10kg/cm^2\n", + "\n", + "#result\n", + "print('(a)\\n 10kg/cm^2 = %.0f mmWG' %x)\n", + "\n", + "#(b)\n", + "\n", + "#variable declaration\n", + "onemm_Hg=13.546 #pressure of 1 mm Hg\n", + "\n", + "#calculation\n", + "y=10.0**5/onemm_Hg\n", + "y=y/10.0**3\n", + "\n", + "#result\n", + "print('\\n(b)\\n10kg/cm^2 = 10^5 mmWG = %.2f * 10^3 mmHg' %y)\n", + "\n", + "#(c)\n", + "\n", + "#variable declaration\n", + "onebar=1.03 # 1 Bar presssure in kg/cm^2\n", + "#calculation\n", + "z=10.0/onebar\n", + "\n", + "#result\n", + "print('\\n(c)\\n10kg/cm^2 = %.2f bars' %z)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + " 10kg/cm^2 = 100000 mmWG\n", + "\n", + "(b)\n", + "10kg/cm^2 = 10^5 mmWG = 7.38 * 10^3 mmHg\n", + "\n", + "(c)\n", + "10kg/cm^2 = 9.71 bars" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.2, Page Number: 116

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#(a)\n", + "\n", + "#variable Declaration\n", + "gamm=1000.0 # density of water\n", + "d=35.0 # depth of water \n", + "dens_Hg=13.546 # density of Hg\n", + "\n", + "#calculation\n", + "press_in_kg_cm=gamm*d*10**-4\n", + "press_in_mmHg=gamm*d/dens_Hg\n", + "press_in_mmHg=press_in_mmHg/10**3\n", + "\n", + "#result\n", + "print('(a)\\nThe pressure at depth of %d meters in a water tank=%.1f kg/cm^2 = %.2f*10^3 mmHg'%(d, press_in_kg_cm, press_in_mmHg))\n", + "\n", + "#(b)\n", + "\n", + "#varible declaration\n", + "press_atm=1.03 #atmospheric pressure\n", + "\n", + "#calculation\n", + "abspress=press_in_kg_cm+press_atm\n", + "abspress_mmHg=press_in_mmHg*1000.0+760.0\n", + "abspress_mmHg=abspress_mmHg/1000.0\n", + "\n", + "#result\n", + "print('\\n(b)\\nAbsolute Pressure= %.2f kg/cm^2 Abs = %.2f*10^3 mmHg Abs'%(abspress, abspress_mmHg))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + "The pressure at depth of 35 meters in a water tank=3.5 kg/cm^2 = 2.58*10^3 mmHg\n", + "\n", + "(b)\n", + "Absolute Pressure= 4.53 kg/cm^2 Abs = 3.34*10^3 mmHg Abs" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.3, Page Number:116

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#varible declaration\n", + "egp=260.0 # equivalent gauge pressure\n", + "\n", + "#calculation\n", + "abspress=760.0-egp\n", + "\n", + "#result\n", + "print('Absolute Presssure = %d mmHg' %abspress)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Absolute Presssure = 500 mmHg" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.4,Page Number:117

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#(a)\n", + "\n", + "#variable declaration\n", + "p_diff=500.0 #pressure difference in mmHg\n", + "\n", + "#calculations\n", + "pdiff=p_diff*13.546/10000\n", + "\n", + "#Result\n", + "print('(a)\\np1-p2 = %.3f kg/cm^2' %pdiff)\n", + "\n", + "\n", + "#(b)\n", + "\n", + "#variable declaration\n", + "p1=6770.0 # Gauge pressure in mmWG\n", + "p_atm=10300.0 # atmospheric pressure \n", + "\n", + "#calculation\n", + "abs_p1=p1+p_atm\n", + "\n", + "#result\n", + "print('\\n(b)If p2 is open to atmosphere:\\nAbsolute Pressure P1 = %d mmWG abs.' %abs_p1)\n", + "\n", + "#(c)\n", + "\n", + "#variable declaration\n", + "P1=500.0 #mmHg absolute pressure\n", + "\n", + "#calculations\n", + "P1_gauge=P1-760.0\n", + "\n", + "#result\n", + "print('\\n(c)If p2 is evacuated and sealed:\\np1= %d mmHg gauge Pressure' %P1_gauge)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + "p1-p2 = 0.677 kg/cm^2\n", + "\n", + "(b)If p2 is open to atmosphere:\n", + "Absolute Pressure P1 = 17070 mmWG abs.\n", + "\n", + "(c)If p2 is evacuated and sealed:\n", + "p1= -260 mmHg gauge Pressure" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.5, Page Number: 117

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "spe_grav_water=1.0 # specific gravity of water\n", + "\n", + "#calculation\n", + "spe_grav_X=spe_grav_water*100.0/50.0\n", + "wt_dens_water=1000.0\n", + "wt_dens_X=wt_dens_water*2.0\n", + "\n", + "#result\n", + "print('Weight Density of X = %d kg/m^3' %wt_dens_X)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Weight Density of X = 2000 kg/m^3" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.6, Page Number: 117

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "A=1.0/20.0 # Area ratio\n", + "p_diff=1500.0 # pressure difference in mmWG\n", + "\n", + "#result\n", + "print('(a)\\nAs Delta_h=A2/A1*h << h and normally negligible for well type manometer')\n", + "print('hence, p1-p2 = h = %d =111 mmHg' %p_diff)\n", + "print('\\n(b)\\nh measured above the oriinal reference will be half of H, i.e. 111/2=55.5 mmHg')\n", + "print('(Since area of both legs are same)')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + "As Delta_h=A2/A1*h << h and normally negligible for well type manometer\n", + "hence, p1-p2 = h = 1500 =111 mmHg\n", + "\n", + "(b)\n", + "h measured above the oriinal reference will be half of H, i.e. 111/2=55.5 mmHg\n", + "(Since area of both legs are same)" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.7, Page Number: 119

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print('1 kg/cm^2 = 10 mWG\\n')\n", + "\n", + "#(a)\n", + "\n", + "#variable declaration\n", + "press=10+2 #pressure read by the gauge\n", + "\n", + "#result\n", + "print('\\n(a)Bourdon Gauge is mounted 20 meters below water line:')\n", + "print('\\nPressure read by the Gauge = %d kg/cm^2'%press)\n", + "\n", + "\n", + "#(b)\n", + "\n", + "#variable declaration\n", + "press2=10-3 #pressure read by the gauge\n", + "\n", + "#result\n", + "print('\\n\\n(b)Bourdon Gauge is located 30 meters above the water line:')\n", + "print('\\nPressure read by the Gauge = %d kg/cm^2'%press2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 kg/cm^2 = 10 mWG\n", + "\n", + "\n", + "(a)Bourdon Gauge is mounted 20 meters below water line:\n", + "\n", + "Pressure read by the Gauge = 12 kg/cm^2\n", + "\n", + "\n", + "(b)Bourdon Gauge is located 30 meters above the water line:\n", + "\n", + "Pressure read by the Gauge = 7 kg/cm^2" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.8, Page Number: 120

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "dens_water=1000.0 # water Density\n", + "h1=125.0 # height1 mm\n", + "h2=250.0 # height2 mm\n", + "d2=h1*dens_water/h2\n", + "\n", + "#result\n", + "\n", + "#a\n", + "print('(a)\\nDensity of Liquid = %d kg/m^3' %d2)\n", + "print('\\nSpecific Density of the liquid = %.1f' %(h1/h2))\n", + "\n", + "#(b)\n", + "print('\\n\\n(b)\\nIf Values of water and liquid interchanged:\\n')\n", + "d3=h2*dens_water/h1\n", + "print('\\nDensity of Liquid = %d kg/m^3' %d3)\n", + "print('\\nSpecific Density of the liquid = %.1f' %(h2/h1))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + "Density of Liquid = 500 kg/m^3\n", + "\n", + "Specific Density of the liquid = 0.5\n", + "\n", + "\n", + "(b)\n", + "If Values of water and liquid interchanged:\n", + "\n", + "\n", + "Density of Liquid = 2000 kg/m^3\n", + "\n", + "Specific Density of the liquid = 2.0" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.9, Page Number: 120

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "#variable Declaration\n", + "R=120.0 #resistance\n", + "l=122.0 #length\n", + "a=0.1 #area\n", + "R1=140.0 #resistance in ohm\n", + "\n", + "#calculation\n", + "rho=R*a/l\n", + "l1=math.sqrt(R1*a*l/rho)\n", + "l1=round(l1,0)\n", + "\n", + "#Result\n", + "print('Length l1 = %d meters' %l1)\n", + "A1=a*l/l1\n", + "print('\\nArea A1 = %.4f mm^2' %A1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Length l1 = 132 meters\n", + "\n", + "Area A1 = 0.0924 mm^2" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.10, Page Number: 121

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "c=0.57 #Constant\n", + "\n", + "#(a)\n", + "\n", + "#variable declaration\n", + "d=0.1 #distance between plates\n", + "di1=100.0 #Dielectric constant\n", + "di2=1000.0 #Dielectric constant\n", + "\n", + "#calculation\n", + "c1=c*di1*10.0/d\n", + "c1=round(c1,0)\n", + "\n", + "#result\n", + "print('(a)\\nC1=%d pf' %c1)\n", + "\n", + "\n", + "#(b)\n", + "\n", + "#calculation\n", + "c2=c*di2*10/d\n", + "\n", + "#result\n", + "print('\\n(b)\\nC2=%d pf' %c2)\n", + "\n", + "\n", + "#(c)\n", + "\n", + "#calculation\n", + "ds=0.09\n", + "c11=c*di1*10/ds\n", + "c12=c*di2*10/ds\n", + "\n", + "#result\n", + "print('\\n(c)\\nC1 = %.1f pf\\nC2 = %d pf'%(c11,c12))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + "C1=5700 pf\n", + "\n", + "(b)\n", + "C2=57000 pf\n", + "\n", + "(c)\n", + "C1 = 6333.3 pf\n", + "C2 = 63333 pf" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.11, Page Number: 121

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable Declaration\n", + "A=1.0 #area\n", + "p1=10.0 #pressure\n", + "\n", + "#calculation\n", + "W1=A*p1\n", + "\n", + "#Result\n", + "print('W1 = %d kg' %W1)\n", + "print('\\nWith the 4 standard weights of 10kg, 20kg, 30kg and 40kg')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "W1 = 10 kg\n", + "\n", + "With the 4 standard weights of 10kg, 20kg, 30kg and 40kg" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.12, Page Number: 122

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#varable declaration\n", + "p1=10**-2 #pressure in torr\n", + "h1=20.0 #height in mm\n", + "\n", + "#xalculation\n", + "K=p1/h1**2\n", + "p2=K*30**2\n", + "p2=p2*100.0\n", + "\n", + "#Result\n", + "print('The unknown pressure p2 = %.2f * 10^-2 torr' %p2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The unknown pressure p2 = 2.25 * 10^-2 torr" + ] + } + ], + "prompt_number": 12 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Industrial_Instrumentation/.ipynb_checkpoints/Chapter_3-checkpoint.ipynb b/Industrial_Instrumentation/.ipynb_checkpoints/Chapter_3-checkpoint.ipynb new file mode 100644 index 00000000..b7ff3a1a --- /dev/null +++ b/Industrial_Instrumentation/.ipynb_checkpoints/Chapter_3-checkpoint.ipynb @@ -0,0 +1,413 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:40aab97a0942d997de9cd8ee539182af9fd67e045ac34df8f9ba65083df3fe50" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter_3: Force Torque and Velocity

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.1, Page Number: 163

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "m1=20 #mass of the body in Kg \n", + "a=5 #acceleration in m/s^2\n", + "\n", + "#calculation\n", + "F=m1*a\n", + "\n", + "#result\n", + "print('F = %d Newtons'%F)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "F = 100 Newtons" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.2, Page Number: 163

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "m1=50 #mass of the body in Kg \n", + "g1=9.8 #acceleration due to gravity\n", + "\n", + "#calculation\n", + "W2=m1*g1\n", + "\n", + "#result\n", + "print('W = %d Newtons = %d kgf' %(W2,m1))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "W = 490 Newtons = 50 kgf" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.3, Page Number: 164

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "wt_material=2500.0 #weight of 1 m^3 material\n", + "wt_water=1000.0 #weight of 1 m^3 water\n", + "\n", + "#calculation\n", + "spe_grav=wt_material/wt_water\n", + "\n", + "#result\n", + "print('Specific gravity of the material = %.1f' %spe_grav)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Specific gravity of the material = 2.5" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.4, Page Number: 164

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "#variable declaration\n", + "L=20.0 # length in cm\n", + "W=2000.0 # Weight of mass in gm \n", + "db=0.02 # length in cm \n", + "Wb=100.0 # Weight of mass in gm \n", + "dG=0.5 # length in cm\n", + "\n", + "#calculation\n", + "S=L/(2*W*db+Wb*dG)\n", + "fi=0.2\n", + "DeltaW=fi*math.pi/(180*S)\n", + "\n", + "#result\n", + "print('S = %.3f rad/g' %S)\n", + "print('\\nDeltaW = %.3f g' %DeltaW)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "S = 0.154 rad/g\n", + "\n", + "DeltaW = 0.023 g" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.5, Page Number: 164

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#variable declaration\n", + "hp=746.0 # horse power\n", + "P=5*hp # Saft power in Watts\n", + "N=1500.0 # speed in rpm\n", + "\n", + "#calculation\n", + "n=N/60.0\n", + "T=P*60/(2*math.pi*n)\n", + "\n", + "#result\n", + "print('T = %.0f Newton meters' %(math.ceil(T)))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "T = 1425 Newton meters" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.6, Page Number: 165

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "ch_l=0.075 #change in length\n", + "orig_l=50.0 #Original length\n", + "\n", + "#calculation\n", + "S=ch_l/orig_l\n", + "E=9.66*10**5\n", + "stress=E*S\n", + "area=1.5\n", + "f=stress*area\n", + "\n", + "#result\n", + "print('Strain = %.4f cm/cm\\nStress =%d kg/cm^2\\nForce = %.1f kg'%(S,stress,f))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Strain = 0.0015 cm/cm\n", + "Stress =1449 kg/cm^2\n", + "Force = 2173.5 kg" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.7, Page Number: 165

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#(a)\n", + "\n", + "#variable declaration\n", + "R1=120.0 # resistance in Ohm\n", + "R2=120.0 # resistance in Ohm\n", + "R3=120.0 # resistance in Ohm\n", + "R4=120.0 # resistance in Ohm\n", + "Rg=100.0 # resistance in Ohm\n", + "\n", + "#calculation\n", + "C=(R1*R2*R4)+(R1*R3*R4)+(R1*R2*R3)+(R2*R3*R4)+(Rg*(R1+R4)*(R2+R3))\n", + "C=C/(10**7)\n", + "\n", + "#result\n", + "print('(a)\\nC=%.3f*10^7' %C)\n", + "E=10\n", + "F=(E*R3*R1*2*10**3)/(C*10**7)\n", + "print('\\nF = %.1f *10^3 A/mm = %.1f mA/mm'%(F,F))\n", + "\n", + "#(b)\n", + "\n", + "#calculation\n", + "Fe=2*10**-4\n", + "E=10\n", + "DeltaE=Fe*E/(4+4*10**-4)\n", + "DeltaE=DeltaE*10**3\n", + "\n", + "#Result\n", + "print('\\n(b)\\nDeltaEg=%.1f mV' %DeltaE)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + "C=1.267*10^7\n", + "\n", + "F = 22.7 *10^3 A/mm = 22.7 mA/mm\n", + "\n", + "(b)\n", + "DeltaEg=0.5 mV" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.8, PAge Number: 167

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#(a)\n", + "import math\n", + "\n", + "#variable Declaration\n", + "r1=2500.0 # Highest flasing rate \n", + "r2=1500.0 # next Highest flasing rate \n", + "\n", + "#calculation\n", + "n=(r1*r2)/(r1-r2)\n", + "\n", + "#result\n", + "print('(a)\\nn = %d rpm'%n)\n", + "\n", + "#(b)\n", + "\n", + "#variable declaration\n", + "N=5.0 # Fift time syncronization for same speed\n", + "\n", + "#calculation\n", + "r5=n*r1/((r1*(N-1))+n)\n", + "r5=math.ceil(r5)\n", + "\n", + "#result\n", + "print('\\n(b)\\nr5=%d Flashes/Minute' %r5)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + "n = 3750 rpm\n", + "\n", + "(b)\n", + "r5=682 Flashes/Minute" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.9, Page Number: 167

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "rpm=1500.0 #rotation in rpm\n", + "f=200.0 #frequency\n", + "\n", + "#calculation\n", + "N=60*f/rpm\n", + "\n", + "#result\n", + "print('No of teeth on the wheel\\nN=%d' %N)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "No of teeth on the wheel\n", + "N=8" + ] + } + ], + "prompt_number": 14 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Industrial_Instrumentation/.ipynb_checkpoints/Chapter_4-checkpoint.ipynb b/Industrial_Instrumentation/.ipynb_checkpoints/Chapter_4-checkpoint.ipynb new file mode 100644 index 00000000..3b3b8ccb --- /dev/null +++ b/Industrial_Instrumentation/.ipynb_checkpoints/Chapter_4-checkpoint.ipynb @@ -0,0 +1,577 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:8e99bc6fbce377831d9d5264a85c645ae2d9072f899aca1128c61ad0649fa729" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 4: Acceleration Vibration and Density

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.1, Page Number:209

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#(a)\n", + "\n", + "#variable Declaration\n", + "k=50.0 #Spring constant \n", + "m=0.005 # mass in kg\n", + "\n", + "#calculation\n", + "wn=math.sqrt(k/m)\n", + "\n", + "#result\n", + "print('(a)\\nNatural frequency(wn)= %d rad/s' %wn)\n", + "\n", + "\n", + "#(b)\n", + "\n", + "#calculation\n", + "Cc=2*(m*k)**(0.5)\n", + "\n", + "#result\n", + "print('\\n(b)\\nCc=%d' %Cc)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + "Natural frequency(wn)= 100 rad/s\n", + "\n", + "(b)\n", + "Cc=1" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.2, Page Number:209

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#(a)\n", + "import math\n", + "\n", + "#variable Declaration\n", + "Cc=1.0 # damping ratio \n", + "C=0.7*Cc # Critical damping ratio \n", + "m=0.005 # mass\n", + "k=50.0 # spring constant\n", + "\n", + "#calculation\n", + "w=math.sqrt((k/m)-(C/(2*m))**2)\n", + "\n", + "#result\n", + "print('(a)\\nw=%.1f rad/s' %w)\n", + "\n", + "#(b)\n", + "\n", + "#variable Declaration\n", + "w1=250.0 # angular velocity\n", + "\n", + "#calculation\n", + "theta=C*w1/(k-m*w1**2)\n", + "print('\\ntheta=%f' %theta)\n", + "fi=math.atan(-theta)\n", + "fi=fi*180.0/math.pi\n", + "\n", + "#result\n", + "print('\\nfi = %d\u00b0'%fi)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + "w=71.4 rad/s\n", + "\n", + "theta=-0.666667\n", + "\n", + "fi = 33\u00b0" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.3, PAge Number: 210

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#variable Declaration\n", + "m=0.005 # mass \n", + "c=0.7 # damping ratio\n", + "\n", + "#calculation\n", + "y=-math.log(0.01)\n", + "t=y*2*m/c\n", + "\n", + "#result\n", + "print('t=%.4f Secs' %t)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "t=0.0658 Secs" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.4, Page Number:210

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable Declaration\n", + "rg1=1200.0 #resistance in Ohm\n", + "rg2=1200.0 #resistance in Ohm\n", + "rg3=1200.0 #resistance in Ohm\n", + "rg4=1200.0 #resistance in Ohm\n", + "\n", + "#calculation\n", + "D1=rg1*5.0/100.0\n", + "D2=rg2*5.0/100.0\n", + "D3=rg3*5.0/100.0\n", + "D4=rg4*5.0/100.0\n", + "E=12.0\n", + "v=E*(((rg1+D1)/(rg1+D1+rg2-D2))-((rg4-D4)/(rg3+D3+rg4-D4)))\n", + "v=v*1000.0\n", + "\n", + "#result\n", + "print('V0=%d mV' %v)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "V0=600 mV" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.5, Page Number:211

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "g=0.06 # voltage sensitivity\n", + "\n", + "#calculation\n", + "t=2.5*10**-3\n", + "p=20*9.8*10**4\n", + "E=g*t*p\n", + "\n", + "#Result\n", + "print('E=%d V' %E)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "E=294 V" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.6, Page Number: 211

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#resistance in Ohm\n", + "c0=25.0 # capacitance in pF\n", + "x0=0.5 # distance between plates\n", + "x1=0.05 # steady state displacement \n", + "\n", + "#calculations\n", + "c1=c0*x0/(x0-x1)\n", + "c2=c0*x0/(x0+x1)\n", + "\n", + "#result\n", + "print('C1=%.2f pF\\nC2=%.2f pF'%(c1,c2))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "C1=27.78 pF\n", + "C2=22.73 pF" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.7, Page Number: 211

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#(a)\n", + "\n", + "sg_at_60=1.02\n", + "\n", + "#calculation\n", + "API=(141.5/sg_at_60)-131.5\n", + "\n", + "#result\n", + "print('(a)\\nDegrees API = %.2f\u00b0API' %API)\n", + "\n", + "#(b)\n", + "\n", + "#calculation\n", + "Be=145-145/sg_at_60\n", + "\n", + "#result\n", + "print('\\n(b)\\nDegrees Baume(heavy) = %.1f\u00b0Be' %Be)\n", + "\n", + "\n", + "#(c)\n", + "\n", + "#calculation\n", + "Bk=(sg_at_60-1)*1000\n", + "\n", + "#result\n", + "print('\\n(c)\\nDegrees Barkometer = %d\u00b0Bk' %Bk)\n", + "\n", + "#(d)\n", + "\n", + "#calculation\n", + "Q=(sg_at_60-1)*1000\n", + "\n", + "#result\n", + "print('\\n(c)\\nDegrees Quevenne = %d\u00b0Q' %Q)\n", + "\n", + "#(e)\n", + "\n", + "#calculation\n", + "Tw=200*(sg_at_60-1.0)\n", + "\n", + "#result\n", + "print('\\n(d)\\nDegrees Twaddel = %d\u00b0Tw' %Tw)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + "Degrees API = 7.23\u00b0API\n", + "\n", + "(b)\n", + "Degrees Baume(heavy) = 2.8\u00b0Be\n", + "\n", + "(c)\n", + "Degrees Barkometer = 20\u00b0Bk\n", + "\n", + "(c)\n", + "Degrees Quevenne = 20\u00b0Q\n", + "\n", + "(d)\n", + "Degrees Twaddel = 4\u00b0Tw" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.8, Page NUmber: 212

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#variable Declaration\n", + "T=0.5 # Torque Tube Force\n", + "sg1=1.02 # Maximum spe.gravity to be measured\n", + "sg2=0.98 # Minimum spe.gravity to be measured\n", + "wt=1000*10**-6\n", + "\n", + "#calculation\n", + "v=T/((sg1-sg2)*wt)\n", + "v=math.ceil(v)\n", + "\n", + "#result\n", + "print('V=%d cm^3' %v)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "V=12500 cm^3" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.9, Page Number: 212

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#variavle declaration\n", + "sg1=0.85 # Maximum spe.gravity to be measured\n", + "sg2=0.8 # Minimum spe.gravity to be measured\n", + "span=150.0 # D/P cell span\n", + "\n", + "\n", + "#a\n", + "\n", + "#calculation\n", + "H=span/(sg1-sg2)\n", + "\n", + "#result\n", + "print('(a)\\nH=%d mm = %dm' %(H,H/1000))\n", + "\n", + "#b\n", + "\n", + "#calculation\n", + "span_min=1500.0\n", + "span2=span_min*(sg1-sg2)\n", + "span2=math.ceil(span2)\n", + "\n", + "#result\n", + "print('\\n(b)\\nD/P span = %d mm' %span2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + "H=3000 mm = 3m\n", + "\n", + "(b)\n", + "D/P span = 75 mm" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.10, Page Number:212

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#variable declaration\n", + "Ww=12-2 # Width of water\n", + "dw=1000.0 # density of water\n", + "\n", + "#calculation\n", + "v=Ww/dw\n", + "dx=(10-2)/v\n", + "sg=dx/dw \n", + "\n", + "#result\n", + "print('Specific Gravity of X =%.1f' %sg)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Specific Gravity of X =0.8" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.11, PAge Number: 213

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#(a)\n", + "\n", + "#variable declaration\n", + "wt=1.5 # weight of object\n", + " \n", + "#calculation\n", + "v_obj=2.0/1000\n", + "dx=wt/v_obj\n", + "sg=dx/1000\n", + "\n", + "#result\n", + "print('(a)\\nSpecific Gravity = %.2f' %sg)\n", + "\n", + "#(b)\n", + "\n", + "sgl=0.8 # specific grav of liquid\n", + "dens=800.0 # density\n", + "\n", + "#calculation\n", + "W1=dens*v_obj-wt\n", + "\n", + "#result\n", + "print('\\n(b)\\nW1 = %.1f kg' %W1)\n", + "\n", + "\n", + "#(c)\n", + "\n", + "#variable declaration\n", + "sg2=1.2 # spe. grav.\n", + "dens2=1200.0 # density\n", + "\n", + "#calculation\n", + "W2=dens2*v_obj-wt\n", + "\n", + "#result\n", + "print('\\n(c)\\nW2 = %.1f kg' %W2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + "Specific Gravity = 0.75\n", + "\n", + "(b)\n", + "W1 = 0.1 kg\n", + "\n", + "(c)\n", + "W2 = 0.9 kg" + ] + } + ], + "prompt_number": 11 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Industrial_Instrumentation/.ipynb_checkpoints/Chapter_5-checkpoint.ipynb b/Industrial_Instrumentation/.ipynb_checkpoints/Chapter_5-checkpoint.ipynb new file mode 100644 index 00000000..e24a4f35 --- /dev/null +++ b/Industrial_Instrumentation/.ipynb_checkpoints/Chapter_5-checkpoint.ipynb @@ -0,0 +1,918 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:981874370471c716824dfdef461e37258f322dfc13d6037062140fc3ad5e0ae2" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 5: Flow

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.1, Page Number: 310

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "#(i)\n", + "\n", + "#variable declaration\n", + "d=75.0*10**-3 # diameter of pipe\n", + "a=math.pi*d**2/4 # area of cross section of pipe\n", + "v=760.0*10**-3 # flow velocity\n", + "\n", + "#calculation\n", + "Q=v*a\n", + "Q=Q*10**3\n", + "print('(i)\\nVolume Flow Rate Q=%.3f *10^-3 m^3/sec' %Q)\n", + "rho=1000.0\n", + "W=rho*Q*10**-3\n", + "\n", + "#result\n", + "print('\\n(ii)\\nMass Flow rate W=%.3f kg/sec' %W)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i)\n", + "Volume Flow Rate Q=3.358 *10^-3 m^3/sec\n", + "\n", + "(ii)\n", + "Mass Flow rate W=3.358 kg/sec" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.2, page Number:310

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#variable declaration\n", + "D=40.0 # Diameter of pipe\n", + "d=20.0 # Diameter of Orifice\n", + "mr=15.0 # Manometer reading\n", + "\n", + "#calculation\n", + "h=(13.6-1)*15.0*10.0\n", + "B=d/D\n", + "M=1/math.sqrt(1-(B**4))\n", + "Cd=0.5999\n", + "x=math.sqrt(2*9.8*h*(10**-3))\n", + "Q=x*Cd*M*(math.pi*((20*(10**-3))**2))/4\n", + "Q=Q*3600.0\n", + "\n", + "#result\n", + "print('Volumetric flow rate Q= %.4f m^3/hr' %Q)\n", + "#Answer slightly deviates from answer given in the book because of pi value.\n", + "#if pi=3.14, then answer is same as in textbook " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Volumetric flow rate Q= 4.2649 m^3/hr" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.3, Page Number: 310

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "#variable declaration\n", + "Re=10.0**5 # Reynolds number\n", + "D=40.0*10**-3 # Diameter of pipe \n", + "v=10**-6 # Kinematic viscosity in m^2/sec\n", + "\n", + "#calculation\n", + "V1=Re*v/D\n", + "A1=(math.pi*(40.0*10**-3)**2)/4\n", + "A2=(math.pi*(20.0*10**-3)**2)/4\n", + "V2=V1*A1/A2\n", + "\n", + "#result\n", + "print('V2=%.1f m/sec' %V2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "V2=10.0 m/sec" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.4, Page Number: 311

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#variable declaration\n", + "Cd=0.61 # discharge coefficient\n", + "D=40.0*10**-3 # Diameter of pipe\n", + "d=20.0*10**-3 # Diameter of Orifice \n", + "\n", + "#calculation\n", + "M=1/math.sqrt(1-(d/D)**4)\n", + "V2=10.0\n", + "rho=1000.0\n", + "g=9.8\n", + "X=V2*math.sqrt(rho/(2*g))/(Cd*M)\n", + "p_diff=X**2\n", + "p_diff=math.floor(p_diff/100)\n", + "p_diff=p_diff/100.0\n", + "\n", + "\n", + "#result\n", + "print('P1-P2 = %.2f kg/cm^2'%p_diff)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "P1-P2 = 1.28 kg/cm^2" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.5, Page Number: 312

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#variable declaration\n", + "Cd=0.6 # discharge coefficient\n", + "D=150.0*10**-3 # Diameter of pipe\n", + "d=75.0*10**-3 # Diameter of Orifice \n", + "p=250.0 # pressure recorded\n", + "g=9.8 # acceleration due to gravity\n", + "rho=1000.0 # Water density \n", + "s=75.0*10**-3 # venturi tube size\n", + "\n", + "#(a)\n", + "\n", + "#calculation\n", + "Q=Cd*math.pi*s**2*math.sqrt(2*g*p/rho)/(4*math.sqrt(1-(d/D)**4)) \n", + "\n", + "#result\n", + "print('(a) For orifice plate\\nQ=%f m^3/sec = %.3f litres/sec'%(Q,Q*1000))\n", + "\n", + "#calculation\n", + "Cd1=0.99\n", + "Q2=Cd1*math.pi*s**2*math.sqrt(2*g*p/rho)/(4*math.sqrt(1-(d/D)**4))\n", + "\n", + "#result\n", + "print('\\n\\n(b)For venturi tube\\nQ=%f m^3/sec = %.2f litres/sec'%(Q2,Q2*1000))\n", + "#Answer slightly deviates from answer given in the book because of pi value.\n", + "#if pi=3.14, then answer is same as in textbook " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a) For orifice plate\n", + "Q=0.006060 m^3/sec = 6.060 litres/sec\n", + "\n", + "\n", + "(b)For venturi tube\n", + "Q=0.009999 m^3/sec = 10.00 litres/sec" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.6, Page Number: 312

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#(i)\n", + "\n", + "#variable declaration\n", + "V=0.02 # volumetric flow rate\n", + "d=10*10**-2 # Diameter of pipe\n", + "\n", + "#calculation\n", + "A=math.pi*d**2/4\n", + "v=V/A\n", + "rho=1000.0\n", + "Re=rho*v*d/10**-3\n", + "Re=Re/100000.0\n", + "\n", + "#result\n", + "print('(i)\\nReynolds number(Re) = %.3f * 10^5'%Re)\n", + "\n", + "#(ii)\n", + "\n", + "#variable declaration\n", + "Cd=0.98 # discharge coefficient \n", + "D=20*10**-2 # Diameter of pipe \n", + "d=10*10**-2 # Diameter of orifice\n", + "\n", + "#calculation\n", + "M=1/math.sqrt(1-(d/D)**4)\n", + "a2=math.pi*d**2/4\n", + "Q=0.02\n", + "g=9.8\n", + "X=Q*math.sqrt(rho)/(M*Cd*a2*math.sqrt(2*g))\n", + "p_diff=math.ceil(X**2)\n", + "\n", + "#result\n", + "print('\\n(ii)\\nPressur_difference = %d kg/m^2 = %.4f kg/cm^2'%(p_diff,p_diff/10000))\n", + "#Answer slightly deviates from answer given in the book because of pi value.\n", + "#if pi=3.14, then answer is same as in textbook " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i)\n", + "Reynolds number(Re) = 2.546 * 10^5\n", + "\n", + "(ii)\n", + "Pressur_difference = 323 kg/m^2 = 0.0323 kg/cm^2" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.7, Page Number: 313

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "\n", + "\n", + "#variable declaration\n", + "g=9.81 #acceleration due to gravity\n", + "h=20.0 #height\n", + "\n", + "#calculation\n", + "v=math.sqrt(2*g*h)\n", + "d=300.0*10**-3\n", + "A=(math.pi*d**2)/4\n", + "A=math.floor(A*1000)\n", + "A=A/1000.0\n", + "Q=A*v\n", + "\n", + "#result\n", + "print('Q = %.3f m^3/sec'%Q)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Q = 1.387 m^3/sec" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.8, Page Number:313

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#variable declaration\n", + "Cd=0.6 # coefficient of discharge \n", + "g=9.8 #acceleration due to gravity\n", + "h=400*10**-3 #height\n", + "\n", + "#calculation\n", + "V=Cd*math.sqrt(2*g*h)\n", + "\n", + "#result\n", + "print('V = %.2f m/sec' %V)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "V = 1.68 m/sec" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.9, Page Number: 314

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#variable declaration\n", + "Cd=0.98 # coefficient of discharge\n", + "g=9.8 #acceleration due to gravity\n", + "h=900.0*10**-3 #height\n", + "\n", + "#calculation\n", + "V=Cd*math.sqrt(2*g*h)\n", + "V=math.floor(V*100)\n", + "V=(V/100.0)\n", + "\n", + "#result\n", + "print('V = %.2f m/sec' %V)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "V = 4.11 m/sec" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.10, Page Number:314

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable declaration\n", + "del_p=20*10**3 #Pa\n", + "dens_water=1000 #kg/m^3\n", + "dens_air=1.29 #kg/m^3\n", + "\n", + "#calculations\n", + "\n", + "#(i)When flowing fluid is water\n", + "v=math.sqrt(2*del_p/dens_water)\n", + "\n", + "#(ii)When flowing fluid is air\n", + "v1=math.sqrt(2*del_p/dens_air)\n", + "\n", + "#result\n", + "print('\\n(i)When flowing fluid is water\\n\\tV=%.3f m/sec'%v)\n", + "print('\\n(ii)When flowing fluid is air\\n\\tV=%.0f m/sec'%v1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "(i)When flowing fluid is water\n", + "\tV=6.325 m/sec\n", + "\n", + "(ii)When flowing fluid is air\n", + "\tV=176 m/sec" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.11, Page Number: 314

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "# variable declaration\n", + "dens=1026.0 # density of see water\n", + "p=25.0*10**3 # pressure difference in manometer \n", + "\n", + "#calculation\n", + "V=math.sqrt(2*p/dens)\n", + "\n", + "#result\n", + "print('V=%.2f m/sec =%.3f km/hr'%(V,V*18/5))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "V=6.98 m/sec =25.131 km/hr" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.12, Page Number: 314

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# variable declaration\n", + "dens=1.29 # air density at height \n", + "\n", + "#calculation\n", + "p=12.5*1000\n", + "V=math.sqrt(2*p/dens)\n", + "\n", + "\n", + "#result\n", + "print('V=%.2f m/sec =%.2f km/hr'%(V,V*18/5))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "V=139.21 m/sec =501.16 km/hr" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.13, Page Number: 315

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#variable declaration\n", + "Cd=0.6 # discharge coefficient\n", + "Dp=0.05 # inside diameter of metering tube \n", + "Df=0.035 # diameter of rotameter \n", + "g=9.8 # acceleration due to gravity\n", + "rho_f=3.9*10**3 # density of cylindrical float\n", + "rho=1000.0 # water density \n", + "Vf=3.36*10**-5 # volume of the float\n", + "\n", + "#calculation\n", + "Q=Cd*((Dp**2-Df**2)/Df)*math.sqrt(math.pi*g*Vf*(rho_f-rho)/(2*rho))\n", + "Q=Q*10000.0\n", + "\n", + "#result\n", + "print('Volumetric flow Q=%.4f *10^-4 m^3/sec' %Q)\n", + "#Answer slightly deviates from answer given in the book because of pi value.\n", + "#if pi=3.14, then answer is same as in textbook " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Volumetric flow Q=8.4652 *10^-4 m^3/sec" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.14, Page number: 315

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "# variable declaration\n", + "Cd=1 # discharge coefficient\n", + "Dp=0.018 # inside diameter of metering tube \n", + "Df=0.015 # diameter of rotameter \n", + "g=9.81 # acceleration due to gravity\n", + "rho_f=2.7 # density of cylindrical float\n", + "rho=0.8 # water density \n", + "Vf=520.0*10**-9 # volume of the float\n", + "\n", + "#case 1\n", + "\n", + "#caculation\n", + "Qmin=Cd*((Dp**2-Df**2)/Df)*math.sqrt(math.pi*g*Vf*(rho_f-rho)/(2*rho))\n", + "Qmin=Qmin*100000.0\n", + "\n", + "#result\n", + "print('Case 1: When float is at the bottom\\n Volumetric flow Qmin=%.3f *10^-5 m^3/sec'%Qmin)\n", + "\n", + "#case 2\n", + "\n", + "#calculation\n", + "Dp2=0.0617\n", + "Qmax=Cd*((Dp2**2-Df**2)/Df)*math.sqrt(math.pi*g*Vf*(rho_f-rho)/(2*rho))\n", + "Qmax=Qmax*100000\n", + "\n", + "#result\n", + "print('\\n\\nCase 2: When float is at the bottom\\n Volumetric flow Qmax=%.2f *10^-5 m^3/sec'%Qmax)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Case 1: When float is at the bottom\n", + " Volumetric flow Qmin=2.879 *10^-5 m^3/sec\n", + "\n", + "\n", + "Case 2: When float is at the bottom\n", + " Volumetric flow Qmax=104.17 *10^-5 m^3/sec" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.15, Page Number:316

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "W=165.0 # weight of material on section of length\n", + "R=328.0 # Conveyor speed m/min\n", + "L=16.0 # Length of weighting platform in m\n", + "\n", + "#calculation\n", + "Q=W*R/L\n", + "\n", + "#result\n", + "print('Flow Rate Q=%.2f kg/min =%.1f kg/hour'%(Q,Q/60))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Flow Rate Q=3382.50 kg/min =56.4 kg/hour" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.16, Page Number:316

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#variable declaration\n", + "f=100.0 # beat frequency\n", + "d=300.0*10**-3 # Sound path\n", + "a=45.0 #angle between transmeter and receiver in degrees\n", + "\n", + "#calculation\n", + "a_rad=45.0*math.pi/180.0\n", + "v=f*d/(2*math.cos(a_rad))\n", + "\n", + "#Result\n", + "print('Fluid Velocity V=%.1f m/sec'%v)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Fluid Velocity V=21.2 m/sec" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.17, Page Number: 316

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "r=150.0 # speed of rotation\n", + "v=120.0 # volume trapped between gears and casting\n", + "\n", + "#clculation\n", + "Q=4.0*v*r\n", + "\n", + "#result\n", + "print('Volume flow rate Q=%d cm^3/min = %d litres/min'%(Q,Q/1000))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Volume flow rate Q=72000 cm^3/min = 72 litres/min" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.18, Page Number: 317

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "# variable declaration\n", + "Q=2500.0 # Quantitty flow rate\n", + "d=2.75 # inner diameter\n", + "\n", + "#calculation\n", + "a=(math.pi*d**2)/4\n", + "v=Q/(60*a)\n", + "B=60.0\n", + "e=B*d*10**-2*v*10**-2\n", + "\n", + "#result\n", + "print('Induced emf e =%.4f V=%.1f mV'%(e,e*1000))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Induced emf e =0.1157 V=115.7 mV" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.19, Pae Number:317

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "e=0.2*10**-3 # voltage of electromagnetic flow meter\n", + "B=0.08 # Flux density\n", + "l=10.0*10**-2 # Diameter of pipe\n", + "\n", + "#calculation\n", + "v=e/(B*l)\n", + "\n", + "#result\n", + "print('V = %.3f m/sec = %.2f cm/sec'%(v,v*100))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "V = 0.025 m/sec = 2.50 cm/sec" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.20, Page Number: 317

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "ei=0.15*10**-3 # peak value\n", + "em=2*ei # p-p amplifier output \n", + "B=0.1 # flux density\n", + "l=60.0*10**-3 # diameter of the pipe\n", + "\n", + "#calculation\n", + "v=em/(B*l)\n", + "\n", + "#result\n", + "print('Velocity of flow V = %.2f m/sec = %.1f cm/sec'%(v,v*100))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Velocity of flow V = 0.05 m/sec = 5.0 cm/sec" + ] + } + ], + "prompt_number": 20 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Industrial_Instrumentation/.ipynb_checkpoints/Chapter_6-checkpoint.ipynb b/Industrial_Instrumentation/.ipynb_checkpoints/Chapter_6-checkpoint.ipynb new file mode 100644 index 00000000..bdc5920d --- /dev/null +++ b/Industrial_Instrumentation/.ipynb_checkpoints/Chapter_6-checkpoint.ipynb @@ -0,0 +1,558 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:6148d2be2796832e7d2e9cefcc5c361a4c9dc07b22c355b627a74bd914199046" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 6: Level

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.1,Page Number:370

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#(a)\n", + "\n", + "# variable declaration\n", + "p=1.5 # pressure applied\n", + "a=4.0 # mA corresponds to 0 kg/cm^2\n", + "b=20.0 # mA corresponds to 2 kg/cm^2\n", + "\n", + "#calculation\n", + "wh=(((b-a)/2)*p)+a\n", + "\n", + "#result\n", + "print('(a)just at the bottom level of the tank')\n", + "print('Water head applied to the transmitter =%d mA'%wh)\n", + "\n", + "#(b)\n", + "\n", + "#calculation\n", + "wh2=(((b-a)/2)*p)+2*a\n", + "\n", + "#result\n", + "print('\\n\\n(b)5m below the bottom of the tank')\n", + "print('Water head applied to the transmitter =%d mA' %wh2)\n", + "\n", + "#(c)\n", + "\n", + "#calculation\n", + "wh3=(((b-a)/2)*p)\n", + "\n", + "#result\n", + "print('\\n\\n(c)5m above the bottom of the tank')\n", + "print('Water head applied to the transmitter =%d mA'%wh3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)just at the bottom level of the tank\n", + "Water head applied to the transmitter =16 mA\n", + "\n", + "\n", + "(b)5m below the bottom of the tank\n", + "Water head applied to the transmitter =20 mA\n", + "\n", + "\n", + "(c)5m above the bottom of the tank\n", + "Water head applied to the transmitter =12 mA" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.2, Page Number:371

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#(a)\n", + "\n", + "#variable declaration\n", + "b=20.0 # Maximum output\n", + "a=4.0 # minimum output \n", + "op=16.0 # output in mA\n", + "\n", + "#calculation\n", + "p=(op-a)*2/(b-a)\n", + "p_h=p*10.0\n", + "h=p_h-2-5\n", + "\n", + "#result\n", + "print('(a)\\nh = %dm'%h)\n", + "\n", + "#(b)\n", + "\n", + "#variable declaration\n", + "p1=1 # pressure applied\n", + "\n", + "#calculation\n", + "t_op=((b-a)/2)*p1+4\n", + "\n", + "#result\n", + "print('\\n(b)\\nTransmitter output =%d mA'%t_op)\n", + "\n", + "#(c)\n", + "\n", + "#variable declaration\n", + "p2=0.5 # applied pressure\n", + "\n", + "#calculation\n", + "t_op1=((b-a)/2)*p2+4\n", + "\n", + "#result\n", + "print('\\n(c)\\nTransmitter output =%d mA'%t_op1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + "h = 8m\n", + "\n", + "(b)\n", + "Transmitter output =12 mA\n", + "\n", + "(c)\n", + "Transmitter output =8 mA" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.3, Page Number: 372

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#(a)\n", + "\n", + "#variable declaration\n", + "b=20.0 # Maximum output\n", + "a=4.0 # minimum output\n", + "op=16.0 # actual output \n", + "wt_l1=25.0 # water level (i)\n", + "\n", + "#calculation\n", + "t_op=((b-a)/100)*(100-75)+4\n", + "\n", + "#result\n", + "print('(a)\\nWater level=+25cm\\nTransmitter output = %d mA' %t_op)\n", + "\n", + "#(b)\n", + "\n", + "#calculation\n", + "wt_l2=-25.0 # water level (ii)\n", + "t_op2=((b-a)/100)*(100-25)+4\n", + "\n", + "#result\n", + "print('\\n(b)\\nWater level=-25cm\\nTransmitter output = %d mA' %t_op2)\n", + "\n", + "#(c)\n", + "\n", + "#Variable declaration\n", + "t_op3=12.0 # Transmitter output \n", + "\n", + "#calculation\n", + "H=(100.0/(b-a))*(12-4) \n", + "\n", + "#result\n", + "print('\\n(c)\\nHead Applied = %d cm\\nLevel corresponding to 50 cm head =0 cm' %H)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + "Water level=+25cm\n", + "Transmitter output = 8 mA\n", + "\n", + "(b)\n", + "Water level=-25cm\n", + "Transmitter output = 16 mA\n", + "\n", + "(c)\n", + "Head Applied = 50 cm\n", + "Level corresponding to 50 cm head =0 cm" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.4, Page Number: 373

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#(a)\n", + "\n", + "#variable declaration\n", + "a=5.0*10**-4 #area\n", + "l=8.0 #length\n", + "dens=6.0*1000.0 #density\n", + "\n", + "#calculation\n", + "w=a*l*dens\n", + "\n", + "#result\n", + "print('(a)\\nWeight of the displacer if weighed in air = %d kg'%w)\n", + "\n", + "\n", + "#(i)\n", + "\n", + "#variable declaration\n", + "sbr1=23.0 # spring balance reading\n", + "\n", + "#calculation\n", + "wloss1=w-sbr1\n", + "L1=wloss1/(1000.0*a)\n", + "\n", + "#result\n", + "print('\\n(i)\\tL1=%dm'%L1)\n", + "\n", + "\n", + "#(ii)\n", + "\n", + "#variable declaration\n", + "sbr2=22.0 # spring balance reading\n", + "\n", + "#calculation\n", + "wloss2=w-sbr2\n", + "L2=wloss2/(1000.0*a)\n", + "\n", + "#result\n", + "print('\\n(ii)\\tL2=%dm'%L2)\n", + "\n", + "#(iii)\n", + "\n", + "#variable declaration\n", + "sbr3=21.0 # spring balance reading\n", + "\n", + "#calculation\n", + "wloss3=w-sbr3\n", + "L3=wloss3/(1000.0*a)\n", + "\n", + "#result\n", + "print('\\n(iii)\\tL3=%dm'%L3)\n", + "\n", + "#(b)\n", + "\n", + "#variable declaration\n", + "level=8.0 # level wen tank is full \n", + "\n", + "#calculation\n", + "wt=a*level*1000.0\n", + "spring=w-wt\n", + "\n", + "#result\n", + "print('\\n(b):when the tank is full\\nSpring Balance reading = %d kg'%spring)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + "Weight of the displacer if weighed in air = 24 kg\n", + "\n", + "(i)\tL1=2m\n", + "\n", + "(ii)\tL2=4m\n", + "\n", + "(iii)\tL3=6m\n", + "\n", + "(b):when the tank is full\n", + "Spring Balance reading = 20 kg" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.5, Page Number: 374

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "rho=1000.0 # density of water \n", + "v=3.0 # displaced volume of water \n", + "\n", + "#calculation\n", + "Bw=rho*v\n", + "\n", + "#Result\n", + "print('Buoyance Force(Bw) = %d kg'%Bw)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Buoyance Force(Bw) = 3000 kg" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.6, Page Number: 374

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "rho=1000.0 # density of water\n", + "Bw=5000.0 # Buoyancy Force\n", + "\n", + "#calculation\n", + "v=Bw/rho\n", + "\n", + "#result\n", + "print('V = %d m^3' %v)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "V = 5 m^3" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.7, Page Number: 374

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "rho=1000.0 # density of water\n", + "h=10.0 # height of liquid\n", + "\n", + "#calculation\n", + "P=rho*h\n", + "\n", + "#result\n", + "print('P = %d kg/m^2 = %d kg/cm^2 '%(P,P/10000))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "P = 10000 kg/m^2 = 1 kg/cm^2 " + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.8, Page Number: 374

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "rho=1000.0 # density of water\n", + "h=15.0 # height of liquid \n", + "ex_p=1.0 # External pressure on liquid\n", + "\n", + "#calculation\n", + "P=(rho*h/10000.0)+ex_p\n", + "\n", + "#result\n", + "print('P = %.1f kg/cm^2' %P)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "P = 2.5 kg/cm^2" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.9, Page Number:374

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "rho=1000.0 # density of water\n", + "ex_p=0.5*10**4 # External pressure on liquid \n", + "P=1.6*10**4 #(rho*h/10000)+ex_p\n", + "\n", + "#calculation\n", + "h=(P-ex_p)/1000.0\n", + "\n", + "#result\n", + "print('h = %d m' %h)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "h = 11 m" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.10, Page Number:375

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "c2=100.0*10**-6 # capacitance in capacitance probe\n", + "r1=10.0*10**3 # value of resistor in bride\n", + "r2=100.0*10**3 # value of resistor in bride\n", + "r3=50.0*10**3 # value of resistor in bride\n", + "\n", + "#calculation\n", + "Cx=r1*c2/r3\n", + "Cx=Cx*10**6\n", + "\n", + "#result\n", + "print('Cx = %d microFarad'%Cx)\n", + "c=5.0\n", + "\n", + "#calculation\n", + "l=Cx/c\n", + "\n", + "#result\n", + "print('\\nLevel on the probe = %dm'%l)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Cx = 20 microFarad\n", + "\n", + "Level on the probe = 4m" + ] + } + ], + "prompt_number": 10 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Industrial_Instrumentation/.ipynb_checkpoints/Chapter_7-checkpoint.ipynb b/Industrial_Instrumentation/.ipynb_checkpoints/Chapter_7-checkpoint.ipynb new file mode 100644 index 00000000..4a5cfd38 --- /dev/null +++ b/Industrial_Instrumentation/.ipynb_checkpoints/Chapter_7-checkpoint.ipynb @@ -0,0 +1,594 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:7398e89d85008e2cdad3036771199a6877abb82c38f4bdc25b1a999f38a5b0fa" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 7: Velocity Humidity and Moisture

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.1, Page NUmber: 436

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "f=2*9.8*10**5 # Force in Dynes\n", + "A=100.0 # area in cm^2\n", + "V=20.0 # velocity in m/sec\n", + "l=10.0 # length in cm\n", + "\n", + "#calculation\n", + "mu=(f/A)/(V/l)\n", + "mu=mu/1000.0\n", + "\n", + "#result\n", + "print('The absolute viscosity mu = %.1f*10^5 centipoises'%mu)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The absolute viscosity mu = 9.8*10^5 centipoises" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.2, Page Number:437

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#(a)\n", + "\n", + "#variable declaration\n", + "v=10.0 # absolute viscosity\n", + "\n", + "#calculation\n", + "F=1/v\n", + "\n", + "#result\n", + "print('(a)\\nFluidity = %.1f rhe'%F)\n", + "\n", + "#(b)\n", + "\n", + "#variable declaration\n", + "mu=10.0 # absolute viscosity\n", + "rho=0.8 # density in m/cm^3\n", + "\n", + "#calculation\n", + "ve=mu/rho\n", + "\n", + "#result\n", + "print('\\n(b)\\nKinematic viscosity (v)= %.1f cm^2/sec'%ve)\n", + "\n", + "\n", + "#(c)\n", + "\n", + "#variable declaration\n", + "ab=1000.0 # absolute viscosity \n", + "abwt=1.002 # absolute viscosity of water at 20 deree celcius\n", + "\n", + "#calculation\n", + "rv=ab/abwt\n", + "\n", + "#result\n", + "print('\\n(c)\\nRelative viscosity = %d centipoises'%rv)\n", + "\n", + "#(d)\n", + "\n", + "#variable declaration\n", + "PAS=10.0\n", + "\n", + "#Result\n", + "print('\\n(c)\\nAbsolute viscosity = 1000 centipoises =10 poises = 1PAS')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + "Fluidity = 0.1 rhe\n", + "\n", + "(b)\n", + "Kinematic viscosity (v)= 12.5 cm^2/sec\n", + "\n", + "(c)\n", + "Relative viscosity = 998 centipoises\n", + "\n", + "(c)\n", + "Absolute viscosity = 1000 centipoises =10 poises = 1PAS" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.3, Page Number: 438

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "#b)\n", + "\n", + "#variable declaration\n", + "R=0.5 # radius\n", + "L=5 # length\n", + "p_diff=800.0 # pressure difference\n", + "V=10.0 # volume\n", + "\n", + "#calculation\n", + "mu=(math.pi*R**4)*p_diff/(8*V*L)\n", + "\n", + "#result\n", + "print('(b)\\nmu=%.4f poise =%.2f centipoise'%(mu,mu*100))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(b)\n", + "mu=0.3927 poise =39.27 centipoise" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.4, Page Number: 439

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "#(a)\n", + "\n", + "#variable declaration\n", + "g=980.0 # acceleration due to gravity\n", + "h=4 # Height\n", + "R=0.5 # radius\n", + "V=10.0 # volume \n", + "l=5.0 # length \n", + "t=1.0\n", + "\n", + "#calculation\n", + "v=(math.pi*g*h*t*R**4)/(8*l*V)\n", + "\n", + "#result\n", + "print('(a)\\n v = %.2f stokes'%v)\n", + "\n", + "#calculation\n", + "mu=0.3925\n", + "rho=mu/v\n", + "\n", + "#result\n", + "print('\\n(b)\\n Density of the fluid rho = %.3f gm/cm^3'%rho)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + " v = 1.92 stokes\n", + "\n", + "(b)\n", + " Density of the fluid rho = 0.204 gm/cm^3" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.5, Page Number: 440

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#variable declaration\n", + "\n", + "#(a)\n", + "A=0.226 # value of A as per equation\n", + "B=195.0 # value of B as per equation\n", + "t=60.0 # Efflux time\n", + "\n", + "#calcullation\n", + "v=A*t-B/t\n", + "A1=0.220\n", + "B1=135.0\n", + "t1=140.0\n", + "v1=A1*t1-B1/t1\n", + "\n", + "#result\n", + "print('(a) Fluid X\\n v = %.2f centipoises'%v)\n", + "print('\\n(b)Fluid Y\\n v = %.1f centipoises'%v1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a) Fluid X\n", + " v = 10.31 centipoises\n", + "\n", + "(b)Fluid Y\n", + " v = 29.8 centipoises" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.6, Page Number: 441

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#variable declaration\n", + "t=12.0 # time interval of falling ball in sec \n", + "Rsb=7.0 # Specific gravity of ball\n", + "Rsf=1.12 # Specific gravity of fluid\n", + "B=1.5 # Ball constant in centipoises\n", + "\n", + "#calculation\n", + "mu=t*(Rsb-Rsf)*B\n", + "\n", + "#result\n", + "print('mu= %.2f centipoises = %d centipoises(approx)'%(mu,math.ceil(mu)))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "mu= 105.84 centipoises = 106 centipoises(approx)" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.7, Page Number: 441

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#(a)\n", + "\n", + "#variable declaration\n", + "B=45.0 # dry bulb temperature\n", + "W=25.0 # wet bulb temperature\n", + "\n", + "#result\n", + "print('\\n(b)\\nPsychromatic differential : %d\u00b0C'%(B-W))\n", + "print('\\n Relative humidity is 80%% corresponding to')\n", + "print(' \\ntemperature 45\u00b0C and psychromatic differential 20\u00b0C')\n", + "\n", + "#(b)\n", + "\n", + "#variable declaration\n", + "B1=30.0 # dry bulb temperature\n", + "W1=27.0 # wet bulb temperature\n", + "\n", + "#result\n", + "print('\\n(b)\\nPsychromatic differential : %d\u00b0C'%(B1-W1))\n", + "print('\\n Relative humidity is 80%% corresponding to')\n", + "print(' \\ntemperature 30\u00b0C and psychromatic differential 3\u00b0C')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "(b)\n", + "Psychromatic differential : 20\u00b0C\n", + "\n", + " Relative humidity is 80%% corresponding to\n", + " \n", + "temperature 45\u00b0C and psychromatic differential 20\u00b0C\n", + "\n", + "(b)\n", + "Psychromatic differential : 3\u00b0C\n", + "\n", + " Relative humidity is 80%% corresponding to\n", + " \n", + "temperature 30\u00b0C and psychromatic differential 3\u00b0C" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.8, Page Number: 441

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "D=80.0 # intersection point of DB temperature\n", + "W=66.5 # intersection point of WB temperature\n", + "\n", + "#Result\n", + "\n", + "#(a)\n", + "print('(a)\\nThe intersection point of DB temperature 80\u00b0F and WB temperature 66.5\u00b0F')\n", + "print(' \\nlines on the relative humidity curve for 50%.\\n RH = 50%')\n", + "\n", + "#(b)\n", + "print('\\n(b)\\nFrom the point of intersection of the dry and wet bulb curves, move left')\n", + "print(' \\nhorizontally to the dew point temperature curve where it meets at 60\u00b0F')\n", + "print('\\nDew Point = 60\u00b0F')\n", + "\n", + "#(c)\n", + "print('\\n(c)\\nFrom the point of intersection of the dry and wet bulb curves,')\n", + "print('\\nhorizontally to the right to the moisture content plot where it meets at 76.')\n", + "print('\\nMoisture Content : 76 grains of water per pound of dry air.')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + "The intersection point of DB temperature 80\u00b0F and WB temperature 66.5\u00b0F\n", + " \n", + "lines on the relative humidity curve for 50%.\n", + " RH = 50%\n", + "\n", + "(b)\n", + "From the point of intersection of the dry and wet bulb curves, move left\n", + " \n", + "horizontally to the dew point temperature curve where it meets at 60\u00b0F\n", + "\n", + "Dew Point = 60\u00b0F\n", + "\n", + "(c)\n", + "From the point of intersection of the dry and wet bulb curves,\n", + "\n", + "horizontally to the right to the moisture content plot where it meets at 76.\n", + "\n", + "Moisture Content : 76 grains of water per pound of dry air." + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.9, Page Number: 442

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "wt_vap=500.0 # Amount of water vapour present\n", + "wt_vap_to_sat=1500.0 # Amount of water vapour added to saturate\n", + "\n", + "#calculation\n", + "total=wt_vap+wt_vap_to_sat\n", + "Rh=(wt_vap/total)*100\n", + "\n", + "#result\n", + "print('RH = %d%%'%Rh)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "RH = 25%" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.10, Page Number: 442

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "pv=30.0 # partial pressure of water vapour\n", + "ps=60.0 # Saturation partial pressure \n", + "\n", + "#calculations\n", + "Rh=(pv/ps)*100\n", + "\n", + "#Result\n", + "print('%%RH = %d%%'%Rh)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "%RH = 50%" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.11, Page Number: 442

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "i1=250.0 # ionazation current \n", + "i2=350.0 # ionazation current \n", + "\n", + "#calculation\n", + "m=(i2-i1)*100/i1\n", + "\n", + "#result\n", + "print('%% increase in moisture content = %d%%'%m)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "% increase in moisture content = 40%" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.12, Page Number: 443

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaraton\n", + "i2=150.0 # wet weight\n", + "i1=125.0 # dry weight\n", + "\n", + "#calculation\n", + "m=(i2-i1)*100/i1\n", + "\n", + "#result\n", + "print('Moisture percentage = %d%%'%m)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Moisture percentage = 20%" + ] + } + ], + "prompt_number": 15 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Industrial_Instrumentation/.ipynb_checkpoints/Chapter_8-checkpoint.ipynb b/Industrial_Instrumentation/.ipynb_checkpoints/Chapter_8-checkpoint.ipynb new file mode 100644 index 00000000..45717557 --- /dev/null +++ b/Industrial_Instrumentation/.ipynb_checkpoints/Chapter_8-checkpoint.ipynb @@ -0,0 +1,507 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:d75e4cfd03813a2ebb58ae96e012a8b8020f7dffa90e8d93acabe5330e357932" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 8:Fundamentals of measuring instruments

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.1, Page Number: 507

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "fi=10.0*10**-6 # fi-flux\n", + "inch=2.54*10**-2 # length\n", + "A=inch**2 # area\n", + "\n", + "#calculation\n", + "B =fi/A\n", + "\n", + "#Result\n", + "print('Flux Density B= %.1f mT'%(B*1000))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Flux Density B= 15.5 mT" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.2, Page Number: 508

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable Declaration\n", + "i=10*10**-3 # current in A\n", + "R=1000.0 # resistance in ohm\n", + "P=(i**2)*R # Power\n", + "err_R=10.0 # Error in Resistance measurement\n", + "err_I=(2.0/100)*25*100/10 # Error in current measurement\n", + "\n", + "#calculation\n", + "err_I2=2*err_I\n", + "err_p=err_I2+err_R\n", + "\n", + "#Result\n", + "print('%% error in I^2 = \u00b1 %d%%\\n%% error in Power = \u00b1 %d%%'%(err_I2,err_p))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "% error in I^2 = \u00b1 10%\n", + "% error in Power = \u00b1 20%" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.3, Page Number: 508

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#variable Declaration\n", + "i1=37.0 # current in branch 1 \n", + "i2=42.0 # current in branch 2\n", + "i3=13.0 # current in branch 3\n", + "i4=6.7 # current in branch 4\n", + "\n", + "#Calculation\n", + "Imax=(i1+i2)+(i1+i2)*(3.0/100)+(i3+i4)+(i3+i4)*(1.0/100)\n", + "Imin=(i1+i2)-(i1+i2)*(3.0/100)+(i3+i4)-(i3+i4)*(1.0/100)\n", + "\n", + "#result\n", + "print('Maximum level of total supply current = %.3f mA'%Imax)\n", + "print('\\nMinimum level of total supply current = %.3f mA'%Imin)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum level of total supply current = 101.267 mA\n", + "\n", + "Minimum level of total supply current = 96.133 mA" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.4, Page Number:508

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#(a)\n", + "\n", + "#variable declaration\n", + "T=200.0 # intermediate temperature \n", + "T0=300.0 # final temperature \n", + "Ti=70.0 # initial temperature \n", + "t=3.0 # time in seconds \n", + "\n", + "#calculation\n", + "x=(T-T0)/(Ti-T0)\n", + "tow=-t/math.log(x)\n", + "\n", + "#result\n", + "print('(a)\\nTime constant tow=%.1f s'%tow)\n", + "\n", + "\n", + "#(b)\n", + "\n", + "#variable declaration\n", + "t1=5.0 # time in seconds \n", + "#calculation\n", + "T5=T0+((Ti-T0)*math.e**(-t1/tow))\n", + "\n", + "#result\n", + "print('\\n(b)\\nTemperature after 5 seconds T5 = %.2f\u00b0C'%T5)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + "Time constant tow=3.6 s\n", + "\n", + "(b)\n", + "Temperature after 5 seconds T5 = 242.61\u00b0C" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.5, Page Number:

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#variable declaration\n", + "w=9.0 # excitation frequency\n", + "wn=6.0 # natural frequency\n", + "dr=0.6 # damping ratio\n", + "\n", + "#calculations\n", + "\n", + "x=w/wn\n", + "Ar=1/math.sqrt(((1-(x)**2)**2)+(2*dr*x)**2)\n", + "err=(1-Ar)*100\n", + "\n", + "#Result\n", + "print('A=%.3f'%Ar)\n", + "print('\\nError = %.2f%%'%err)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "A=0.456\n", + "\n", + "Error = 54.37%" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.6, PAge Number: 510

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable Declaration\n", + "t=2.0 # output to be calculated after t seconds\n", + "\n", + "#calculation\n", + "y=1-math.e**(-(t-1.5)/0.5)\n", + "\n", + "#result\n", + "print('y(t)at t=2 will be y(t)=%.3f'%y)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "y(t)at t=2 will be y(t)=0.632" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.7, Page Number: 510

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#variable declaration\n", + "\n", + "#Temperature Readings\n", + "x1=98.5 # Reading 1\n", + "x2=99.0 # Reading 2\n", + "x3=99.5 # Reading 3 \n", + "x4=100.0 # Reading 4\n", + "x5=100.5 # Reading 5\n", + "x6=101.0 # Reading 6\n", + "x7=101.5 # Reading 7\n", + "# Frequency\n", + "f1=4.0 # Reading 1\n", + "f2=13.0 # Reading 2\n", + "f3=19.0 # Reading 3\n", + "f4=35.0 # Reading 4\n", + "f5=17.0 # Reading 5\n", + "f6=10.0 # Reading 6\n", + "f7=2.0 # Reading 7\n", + "\n", + "#(i) Arithmatic Mean\n", + "\n", + "#calculation\n", + "x_bar=((x1*f1)+(x2*f2)+(x3*f3)+(x4*f4)+(x5*f5)+(x6*f6)+(x7*f7))/(f1+f2+f3+f4+f5+f6+f7)\n", + "\n", + "#result\n", + "print('(i)\\n\\tArithmatic Mean = %.2f\u00b0C'%x_bar)\n", + "\n", + "#(ii) Average Deviation\n", + "\n", + "#calculation\n", + "D=(abs(x1-x_bar)*f1)+(abs(x2-x_bar)*f2)+(abs(x3-x_bar)*f3)+(abs(x4-x_bar)*f4)\n", + "D=D+(abs(x5-x_bar)*f5)+(abs(x6-x_bar)*f6)+(abs(x7-x_bar)*f7)\n", + "D=D/(f1+f2+f3+f4+f5+f6+f7)\n", + "\n", + "#result\n", + "print('\\n(ii)\\n\\tAverage Deviation =%.4f\u00b0C'%D)\n", + "\n", + "#Standard deviation\n", + "\n", + "#Calculation\n", + "sigma=((x1-x_bar)**2*f1)+((x2-x_bar)**2*f2)+((x3-x_bar)**2*f3)+((x4-x_bar)**2*f4)\n", + "sigma=sigma+((x5-x_bar)**2*f5)+((x6-x_bar)**2*f6)+((x7-x_bar)**2*f7)\n", + "sigma=math.sqrt(sigma)\n", + "sigma=sigma/math.sqrt(f1+f2+f3+f4+f5+f6+f7)\n", + "\n", + "#result\n", + "print('\\n(iii)\\n\\tStandard deviation = %.3f\u00b0C'%sigma)\n", + "\n", + "#variance\n", + "\n", + "#result\n", + "print('\\n(iv)\\n\\tVariance = %.4f\u00b0C'%(sigma**2))\n", + "\n", + "#Probable Error\n", + "\n", + "#result\n", + "print('\\n(v)\\n\\tProbable Error= %.4f\u00b0C'%(0.6745*sigma))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i)\n", + "\tArithmatic Mean = 99.93\u00b0C\n", + "\n", + "(ii)\n", + "\tAverage Deviation =0.5196\u00b0C\n", + "\n", + "(iii)\n", + "\tStandard deviation = 0.671\u00b0C\n", + "\n", + "(iv)\n", + "\tVariance = 0.4501\u00b0C\n", + "\n", + "(v)\n", + "\tProbable Error= 0.4525\u00b0C" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.8, Page Number: 511

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#variable Declaration\n", + "wn=math.sqrt(3.0) # natural frequency of osscilation\n", + "\n", + "#Calculation\n", + "x=3.2/(2*wn)\n", + "\n", + "#Result\n", + "print('Damping coefficient = %.3f\\nNatural frequency of Oscillation = %.3f'%(x,wn))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Damping coefficient = 0.924\n", + "Natural frequency of Oscillation = 1.732" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.9, Page Number: 512

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "#variable declaration\n", + "w=100.0 # natural frequency of osscilation\n", + "\n", + "#calculation\n", + "fi=-math.atan(0.1*w)-math.atan(0.5*w)\n", + "A=1/(math.sqrt(1+(0.1*w)**2)*(math.sqrt(1+(0.5*w)**2)))\n", + "A=1*1000.0/math.ceil(1000*A)\n", + "err=(1-1.0/A)*100\n", + "\n", + "#Result\n", + "print('A=K/%d\\n%% error = %.1f%%\\nfi = %.2f\u00b0'%(A,err,fi*180/math.pi))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "A=K/500\n", + "% error = 99.8%\n", + "fi = -173.14\u00b0" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.10, Page Number: 512

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#calculations\n", + "R=0.15*10/50 # Temperature gradient\n", + "K=1.0 # constant\n", + "tow=15.0 # time constant \n", + "\n", + "#Calculations\n", + "deg=K*R*tow\n", + "\n", + "#(i)\n", + "a=15-deg\n", + "\n", + "#(ii)\n", + "alt_red=deg*50.0/0.15\n", + "h=5000-alt_red\n", + "\n", + "#result\n", + "print('(i)The actual temperature when instrument reads 15\u00b0C is %.2f\u00b0C'%a)\n", + "print('\\n The true temperature at 5000 metres = %.2f '%a)\n", + "print('\\n(ii)\\nThe true altitude at which 15\u00b0C occurs is %d metres'%h)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i)The actual temperature when instrument reads 15\u00b0C is 14.55\u00b0C\n", + "\n", + " The true temperature at 5000 metres = 14.55 \n", + "\n", + "(ii)\n", + "The true altitude at which 15\u00b0C occurs is 4850 metres" + ] + } + ], + "prompt_number": 10 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Industrial_Instrumentation/.ipynb_checkpoints/ch2-checkpoint.ipynb b/Industrial_Instrumentation/.ipynb_checkpoints/ch2-checkpoint.ipynb new file mode 100644 index 00000000..0f54145a --- /dev/null +++ b/Industrial_Instrumentation/.ipynb_checkpoints/ch2-checkpoint.ipynb @@ -0,0 +1,942 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:3203164807ce532b672553754629f11a0a0db0c197fd3e21e75a10e9e0cb2a95" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 2 : Basic Concepts Of Thermodynamicsm" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.1 Page no : 41" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "rho_Hg = 13596.; \t\t\t#kg/m**3\n", + "g = 9.806; \t\t\t#m/s**2\n", + "h = 0.76; \t\t\t#m\n", + "\n", + "# Calculations and Results\n", + "P = rho_Hg*g*h/1000; \t\t\t#kPa\n", + "\n", + "\n", + "h1 = 0.80; \t\t\t#m\n", + "P1 = h1/h*P;\n", + "print \"(i) Pressure of 80 cm of Hg %.3f kPa\"%P1\n", + "\n", + "\n", + "print (\"(ii) 30 cm Hg vacuum\")\n", + "H2 = 0.30; \t\t\t#cm Hg vacuum\n", + "h2 = h-H2; \t\t\t#cm of Hg absolute\n", + "\n", + "P2 = h2/h*P;\n", + "print \"Pressure due to 46 cm of Hg %.3f kPa\"%P2\n", + "\n", + "rho_H2O = 1000; \t\t\t#kg/m**3\n", + "h3 = 1.35; \t\t\t#m\n", + "P3 = rho_H2O*g*h3/1000;\n", + "print \"(iii) Pressure due to 1.35 m H2O gauge %.3f kPa\"%(P3)\n", + "\n", + "\n", + "P4 = 4.2*10**2;\n", + "print \"(iv) 4.2 bar %.3f kPa\"%(P4),\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Pressure of 80 cm of Hg 106.658 kPa\n", + "(ii) 30 cm Hg vacuum\n", + "Pressure due to 46 cm of Hg 61.328 kPa\n", + "(iii) Pressure due to 1.35 m H2O gauge 13.238 kPa\n", + "(iv) 4.2 bar 420.000 kPa\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.2 page no : 42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "# Variables\n", + "d = 0.1; \t\t\t#m\n", + "F = 1000.; \t\t\t#N\n", + "\n", + "# Calculations\n", + "A = math.pi/4*d**2; \t\t\t#m**2\n", + "P = F/A/10**3;\n", + "\n", + "# Results\n", + "print \"Pressure on the piston = %.3f kN/m**2\"%(P),\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Pressure on the piston = 127.324 kN/m**2\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.3 page no : 42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "SG = 0.9;\n", + "h = 1.2; \t\t\t#m\n", + "g = 9.81; \t\t\t#m/s**2\n", + "rho_w = 1000.; \t\t\t#kg/m**3\n", + "\n", + "# Calculations\n", + "rho = SG*rho_w; \t\t\t#kg/m**3\n", + "P = rho*g*h/10**3;\n", + "\n", + "# Results\n", + "print \"Gauge pressure P = %.3f kN/m**2\"%(P)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Gauge pressure P = 10.595 kN/m**2\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.4 page no : 43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "Vacuum_recorded = 740.; \t\t\t#mm of Hg\n", + "Barometric_reading = 760.; \t\t\t#mm of Hg\n", + "\n", + "# Calculations\n", + "Absolute_pressure = (Barometric_reading-Vacuum_recorded)*133.4;\n", + "\n", + "# Results\n", + "print \"Absolute pressure in the condenser = %.3f Pa\"%(Absolute_pressure),\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Absolute pressure in the condenser = 2668.000 Pa\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.5 page no : 43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "# Variables\n", + "d = 0.5; \t\t\t#m\n", + "h = 0.75; \t\t\t#m\n", + "m = 4.; \t\t\t#kg\n", + "Manometer_reading = 620.; \t\t\t#mm of Hg above atmosphere\n", + "Barometer_reading = 760.; \t\t\t#mm of Hg\n", + "V = math.pi/4*d**2*h; \t\t\t#m**3\n", + "print (\"(i) Total pressure in the vessel\")\n", + "\n", + "# Calculations and Results\n", + "P = (Barometer_reading+Manometer_reading)*133.4/10**5; \t\t\t#bar\n", + "print \"P = %.3f bar\"%(P)\n", + "\n", + "print (\"(ii) Specific volume and density\")\n", + "SV = V/m; \n", + "print \"Specific volume = %.3f m**3/kg\"%(SV)\n", + "\n", + "D = m/V;\n", + "print \"Density = %.3f kg/m**3\"%(D),\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Total pressure in the vessel\n", + "P = 1.841 bar\n", + "(ii) Specific volume and density\n", + "Specific volume = 0.037 m**3/kg\n", + "Density = 27.162 kg/m**3\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.6 page no : 43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "h0 = .761; \t\t\t#m\n", + "h = .55; \t\t\t#m\n", + "g = 9.79; \t\t\t#m/s**2\n", + "rho = 13640.; \t\t\t#kg/m**3\n", + "\n", + "# Calculations\n", + "P = rho*g*(h0+h); \t\t\t#N/m**2\n", + "\n", + "# Results\n", + "print \"Gas pressure = %.3f bar\"%(P/10**5),\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Gas pressure = 1.751 bar\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.7 page no : 44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "h_H2O = 34.; \t\t\t#mm of Hg\n", + "g = 9.81; \t\t\t#m/s**2\n", + "rho = 13600.; \t\t\t#kg/m**3\n", + "P_Hg = 97.5; \t\t\t#mm of Hg\n", + "P_atm = 760.; \t\t\t#mm of Hg\n", + "\n", + "# Calculations\n", + "P_H2O = h_H2O/13.6; \t\t\t#mm of Hg\n", + "Pabs = rho*g*(P_Hg+P_atm-P_H2O)/10**8; \t\t\t#bar\n", + "\n", + "# Results\n", + "print \"absolute pressure = %.3f bar\"%(Pabs)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "absolute pressure = 1.141 bar\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.8 page no : 44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "SG = 0.8;\n", + "rho_H2O = 1000.; \t\t\t#kg/m**3\n", + "g = 9.81; \t\t\t#ms**2\n", + "h = 0.17; \t\t\t#m\n", + "Patm = 1.01325; \t\t\t#bar\n", + "\n", + "# Calculations\n", + "rho = SG*rho_H2O; \t\t\t#kg/m**3\n", + "P_liq = rho*g*h/10**5; \t\t\t#bar\n", + "P_gas = Patm - P_liq;\n", + "\n", + "# Results\n", + "print \"gas pressure = %.3f bar\"%(P_gas),\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "gas pressure = 1.000 bar\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.9 page no : 45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "# Variables\n", + "d = 0.2; \t\t\t#m\n", + "g = 9.81; \t\t\t#m/s**2\n", + "h = 0.117; \t\t\t#m\n", + "rho = 13600.; \t\t\t#kg/m**3\n", + "\n", + "# Calculations\n", + "p = rho*g*h;\n", + "m = (p*math.pi/4*d**2)/g;\n", + "\n", + "# Results\n", + "print \"mass = %.3f kg\"%(m),\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "mass = 49.989 kg\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.10 page no : 49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "v = 800.; \t\t\t#m/s\n", + "g = 9.; \t\t\t#m/s**2\n", + "F = 3600.; \t\t\t#N\n", + "\n", + "# Calculations\n", + "m = F/g;\n", + "KE = 1./2*m*v**2./10**6;\n", + "\n", + "# Results\n", + "print \"Kinetic Energy = %.3f MJ\"%(KE),\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Kinetic Energy = 128.000 MJ\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.11 page no : 49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "# Variables\n", + "m = 6.; \t\t\t#kg\n", + "T1 = 25.; \t\t\t#0C\n", + "T2 = 125.; \t\t\t#0C\n", + "\n", + "print (\"(i) Heat transferred\")\n", + "\n", + "# Calculations and Results\n", + "def f18(T): \n", + "\t return m*(0.4+0.004*T)\n", + "\n", + "Q = quad(f18,T1,T2)[0]\n", + "\n", + "print \"heat tranferred = %.3f kJ\"%(Q)\n", + "\n", + "print (\"(ii) Mean specific heat of the gas\")\n", + "c_n = Q/m/(T2-T1);\n", + "print \"Mean specific heat = %.3f kJ/kg.0C\"%(c_n),\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Heat transferred\n", + "heat tranferred = 420.000 kJ\n", + "(ii) Mean specific heat of the gas\n", + "Mean specific heat = 0.700 kJ/kg.0C\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.12 page no : 50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from numpy import *\n", + "# Variables\n", + "Ice_point = 0.;\n", + "Steam_point = 100.;\n", + "\n", + "# Calculations\n", + "P = [[math.log(1.5),1],[math.log(7.5),1]];\n", + "Q = [0,100];\n", + "X = linalg.inv(P)*Q;\n", + "\n", + "a = X[0,1];\n", + "b = X[1,1];\n", + "p = 3.5;\n", + "t = a*math.log(p)+b;\n", + "\n", + "# Results\n", + "print (\"The value of temperature is given by %.3f\")%(t),(\"\u00b0C\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of temperature is given by 52.646 \u00b0C\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.13 page no : 50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def func(t): \n", + "\t return 0.20*t-5*10**(-4)*t**2\n", + "# Variables # Calculations\n", + "t1 = 0; \t\t\t#0C\n", + "e1 = func(t1);\n", + "t2 = 100; \t\t\t#0C\n", + "e2 = func(t2);\n", + "t3 = 70; \t\t\t#0C\n", + "e3 = func(t3);\n", + "t = e3*(t2-t1)/e2-e1;\n", + "\n", + "# Results\n", + "print \"thermocouple will read\",t,\"\u00b0C\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "thermocouple will read 77.0 \u00b0C\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.15 page no : 51" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "p = 101.325; \t\t#kPa\n", + "V2 = 0.6; \t\t\t#m**3\n", + "V1 = 0; \t\t\t#m**3\n", + "\n", + "# Calculations\n", + "W = p*(V2-V1);\n", + "\n", + "# Results\n", + "print (\"work done by atmosphere = \"),(-W),\"kJ\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "work done by atmosphere = -60.795 kJ\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.16 page no : 52" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from scipy import integrate\n", + "\n", + "# Variables\n", + "#p = 1.013*10**5; \t#N/m**2\n", + "p = lambda x: 1.013*10**5\n", + "V1 = 1.5; \t\t\t#m**3\n", + "V2 = 0; \t\t\t#m**3\n", + "\n", + "# Calculations\n", + "integ, err = integrate.quad(p,V1,V2)\n", + "\n", + "# Results\n", + "print (\"W = \"),(integ/10**3),\"kJ\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "W = -151.95 kJ\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.17 page no : 53" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "T = 1.25; \t\t\t#N.m\n", + "N = 9500.;\n", + "p = 101.3; \t\t\t#kPa\n", + "d = 0.65; \t\t\t#m\n", + "L = 0.6; \t\t\t#m\n", + "\n", + "# Calculations\n", + "W1 = 2*math.pi*N*T/1000; \t#kJ\n", + "A = math.pi/4*d**2; #m**2\n", + "W2 = p*A*L; \t\t#kJ\n", + "Wnet = (-W1)+W2;\n", + "\n", + "# Results\n", + "print \"The net work transfer for the system = %.3f\"%(Wnet),\"kJ\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The net work transfer for the system = -54.444 kJ\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.18 page no : 53" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "A = 45.*10**(-4); \t #m**2\n", + "P = 0.9*10**5; \t\t #N/m**2\n", + "Patm = 1.013*10**5; #N/m**2\n", + "L = 0.05; \t\t\t #m\n", + "\n", + "# Calculations\n", + "dV = 300.*10**(-6); \t\t\t#m**3\n", + "W = P*A*L-Patm*dV;\n", + "\n", + "# Results\n", + "print (\"net work done = \"),(W),\"J\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "net work done = -10.14 J\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.19 page no : 54" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "# Variables\n", + "p1 = 1.5; \t\t\t#bar\n", + "p2 = 7.5; \t\t\t#bar\n", + "V1 = 3/p1;\n", + "V2 = 3/p2;\n", + "\n", + "# Calculations\n", + "def f19( V): \n", + "\t return 3./V*10**2\n", + "\n", + "W = quad(f19, V1, V2)[0]\n", + "\n", + "# Results\n", + "print \"Work done = %.3f\"%(W),\"kJ\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Work done = -482.831 kJ\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.20 page no : 55" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "\n", + "# Variables\n", + "W = 150; \t\t\t#kJ\n", + "V1 = 0.6; \t\t\t#m**3\n", + "\n", + "# Calculations and Results\n", + "V2 = (8-math.sqrt(64-4*2*2.58))/4; \t\t\t#m**3\n", + "print (\"Final volume = %.3f\")%V2,\"m**3\"\n", + "\n", + "p2 = 8-4*V2;\n", + "print \"Final pressure = %.2f\"%p2,\"bar\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Final volume = 0.354 m**3\n", + "Final pressure = 6.58 bar\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.21 page no : 56" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "# Variables\n", + "p1 = 3.*10**5; \t\t\t#Pa\n", + "v1 = 0.18; \t\t\t#m**3/kg\n", + "p2 = 0.6*10**5; \t\t\t#Pa\n", + "\n", + "# Calculations\n", + "C = p1*v1**2;\n", + "v2 = math.sqrt(C/p2);\n", + "\n", + "def f17( v): \n", + " return C/v**2\n", + "\n", + "W = quad(f17, v1,v2)[0]\n", + "\n", + "# Results\n", + "print (\"Work done = %d\")%(W),(\"Nm/kg\")\n", + "\n", + "# Note : output would be differ as rounding error is there. v2 has rounding off error." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Work done = 29850 Nm/kg\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.22 page no : 57" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "# Variables\n", + "m = 1.; \t\t\t#kg\n", + "p1 = 20.*10**5; \t#Pa\n", + "V1 = 0.05; \t\t\t#m**3\n", + "\n", + "# Calculations\n", + "V2 = 2*V1;\n", + "p2 = p1*(V1/V2)**2;\n", + "C = p1*V1**2;\n", + "V3 = V1;\n", + "\n", + "def f20( V): \n", + "\t return C/V**2\n", + "\n", + "W_12 = quad(f20, V1,V2)[0]\n", + "W_23 = p2*(V2-V3);\n", + "W_net = W_12-W_23;\n", + "\n", + "# Results\n", + "print (\"Net work done = \"),(W_net),(\"Nm\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Net work done = 25000.0 Nm\n" + ] + } + ], + "prompt_number": 26 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Industrial_Instrumentation/.ipynb_checkpoints/ch3-checkpoint.ipynb b/Industrial_Instrumentation/.ipynb_checkpoints/ch3-checkpoint.ipynb new file mode 100644 index 00000000..e1873694 --- /dev/null +++ b/Industrial_Instrumentation/.ipynb_checkpoints/ch3-checkpoint.ipynb @@ -0,0 +1,1427 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:ab490015435e8f1ac3990217bb57911661595e73c3c831b703cdf5b3388c40c5" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 3 : Properties of Pure Substances" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.1 page no : 76" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "m_s = 50. \t\t\t#kg\n", + "m_w = 1.5; \t\t\t#kg\n", + "\n", + "# Calculations\n", + "x = m_s/(m_s+m_w);\n", + "\n", + "# Results\n", + "print (\"dryness fraction = %.3f\")%(x)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "dryness fraction = 0.971\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.2 page no : 76" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "V = 0.6; \t\t\t#m**3\n", + "m = 3.0; \t\t\t#kg\n", + "p = 5.; \t\t\t#bar\n", + "v = V/m;\n", + "\n", + "# At 5 bar: From steam tables\n", + "v_g = 0.375; \t\t\t#m**3/kg\n", + "v_f = 0.00109; \t\t\t#m**3/kg\n", + "\n", + "# Calculations\n", + "v_fg = v_g - v_f;\n", + "x = 1-((v_g - v)/v_fg);\n", + "\n", + "# Results\n", + "print (\"(i) Mass and volume of liquid\")\n", + "m_liq = m*(1-x);\n", + "print (\"mass of liquid = %.3f\")%(m_liq),(\"kg\")\n", + "V_liq = m_liq*v_f;\n", + "print (\"volume of liquid = %.3f\")%(V_liq),(\"m**3\")\n", + "\n", + "print (\"(ii) Mass and volume of vapour\")\n", + "m_vap = m*x;\n", + "print (\"mass of vapour = %.3f\")%(m_vap),(\"kg\")\n", + "V_vap = m_vap*v_g;\n", + "print (\"volume of vapour = %.3f\")%(V_vap),(\"m**3\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Mass and volume of liquid\n", + "mass of liquid = 1.404 kg\n", + "volume of liquid = 0.002 m**3\n", + "(ii) Mass and volume of vapour\n", + "mass of vapour = 1.596 kg\n", + "volume of vapour = 0.598 m**3\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.3 page no : 76" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "V = 0.05; \t\t\t#m**3\n", + "m_f = 10.; \t\t\t#kg\n", + "# From steam tables corresponding to 245 0C\n", + "p_sat = 36.5; \t\t\t#bar\n", + "v_f = 0.001239; \t\t\t#m**3/kg\n", + "v_g = 0.0546; \t\t\t#m**3/kg\n", + "h_f = 1061.4; \t\t\t#kJ/kg\n", + "h_fg = 1740.2; \t\t\t#kJ/kg\n", + "s_f = 2.7474; \t\t\t#kJ/kg.K\n", + "s_fg = 3.3585; \t\t\t#kJ/kg.K\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) The pressure = \"),(p_sat),(\"bar\")\n", + "\n", + "print (\"(ii) The mass\")\n", + "V_f = m_f*v_f;\n", + "V_g = V - V_f;\n", + "m_g = V_g/v_g;\n", + "m = m_f+m_g;\n", + "print (\"The total mass of mixture = %.3f\")%(m),(\"kg\")\n", + "\n", + "print (\"(iii) The specific volume\")\n", + "v_fg = v_g-v_f;\n", + "x = m_g/(m_g+ m_f);\n", + "v = v_f+x*v_fg;\n", + "print (\"specific volume = %.3f\")%(v),(\"m**3/kg\")\n", + "\n", + "print (\"(iv)The specific enthalpy\")\n", + "h = h_f+x*h_fg;\n", + "print (\"specific enthalpy = %.3f\")%(h),(\"kJ/kg\")\n", + "\n", + "print (\"(v)The specific entropy\")\n", + "s = s_f+x*s_fg;\n", + "print (\"specific entropy = %.3f\")%(s),(\"kJ/kg.K\")\n", + "\n", + "print (\"(vi)The specific internal enegy\")\n", + "u = h-(p_sat*v*10**2); \t\t\t#kJ/kg\n", + "print (\"specific internal energy = %.3f\")%(u),(\"kJ/kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) The pressure = 36.5 bar\n", + "(ii) The mass\n", + "The total mass of mixture = 10.689 kg\n", + "(iii) The specific volume\n", + "specific volume = 0.005 m**3/kg\n", + "(iv)The specific enthalpy\n", + "specific enthalpy = 1173.545 kJ/kg\n", + "(v)The specific entropy\n", + "specific entropy = 2.964 kJ/kg.K\n", + "(vi)The specific internal enegy\n", + "specific internal energy = 1156.471 kJ/kg\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.4 page no : 77" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "m_w = 2.; \t\t\t#kg\n", + "t_w = 25.; \t\t\t#0C\n", + "p = 5.; \t\t\t#bar\n", + "x = 0.9;\n", + "c_pw = 4.18;\n", + "# at 5 bar; from steam tables\n", + "h_f = 640.1; \t\t\t#kJ/kg\n", + "h_fg = 2107.4; \t\t\t#kJ/kg\n", + "\n", + "# Calculations and Results\n", + "h = h_f+x*h_fg;\n", + "\n", + "Qw = c_pw*(t_w-0);\n", + "print (\"Sensible heat associated with 1kg of water, Qw = %.3f\")%(Qw),(\"kJ\")\n", + "\n", + "Q = h-Qw;\n", + "print (\"Net quantity of heat to be supplies per kg of water, Q = %.3f\")%(Q),(\"kJ\")\n", + "\n", + "Q_total = m_w*Q;\n", + "print (\"Total amount of heat supplied, Q_total = \"),(Q_total),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sensible heat associated with 1kg of water, Qw = 104.500 kJ\n", + "Net quantity of heat to be supplies per kg of water, Q = 2432.260 kJ\n", + "Total amount of heat supplied, Q_total = 4864.52 kJ\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.5 page no : 78" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "m = 4.4; \t\t\t#kg\n", + "p = 6.; \t\t\t#bar\n", + "t_sup = 250.; \t\t\t#0C\n", + "t_w = 30.; \t\t\t#0C\n", + "c_ps = 2.2; \t\t\t#kJ/kg\n", + "c_pw = 4.18;\n", + "# At 6 bar, 250 0C; From steam tables\n", + "t_s = 158.8; \t\t\t#0C\n", + "h_f = 670.4; \t\t\t#kJ/kg\n", + "h_fg = 2085; \t\t\t#kJ/kg\n", + "\n", + "# Calculations and Results\n", + "h_sup = h_f+h_fg+ c_ps*(t_sup-t_s);\n", + "\n", + "Qw = c_pw*(t_w-0);\n", + "print (\"Amount of heat added per kg of water, Qw = \"),(Qw)\n", + "\n", + "Q = h_sup-Qw;\n", + "print (\"Net amount of heat required to be supplied per kg, Q = \"),(Q)\n", + "\n", + "Q_total = m*Q;\n", + "print (\"Total amount of heat required, Q_total = \"),(Q_total),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Amount of heat added per kg of water, Qw = 125.4\n", + "Net amount of heat required to be supplied per kg, Q = 2830.64\n", + "Total amount of heat required, Q_total = 12454.816 kJ\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.6 page no : 78" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "v = 0.15; \t\t\t#m**3\n", + "p = 4.; \t\t\t#bar\n", + "x = 0.8;\n", + "# At 4 bar: From steam tables\n", + "v_g = 0.462; \t\t\t#m**3/kg\n", + "h_f = 604.7; \t\t\t#kJ/kg\n", + "h_fg = 2133.; \t\t\t#kJ/kg\n", + "\n", + "# Calculations and Results\n", + "density = 1/x/v_g;\n", + "\n", + "m = v*density;\n", + "print (\"mass of 0.15 m**3 steam, m = %.3f\")%(m),(\"kg\")\n", + "\n", + "Q = density*(h_f+x*h_fg);\n", + "print (\"Total heat of 1 m3 of steam which has a mass of 2.7056 kg, Q = %.3f\")%(Q),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "mass of 0.15 m**3 steam, m = 0.406 kg\n", + "Total heat of 1 m3 of steam which has a mass of 2.7056 kg, Q = 6252.976 kJ\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.7 page no : 78" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "m = 1000.; \t\t\t#kJ/kg.K\n", + "p = 16.; \t\t\t#bar\n", + "x = 0.9;\n", + "T_sup = 653.; \t\t\t#K\n", + "T_w = 30.; \t\t\t#0C\n", + "c_ps = 2.2; \t\t\t#kJ/kg\n", + "c_pw = 4.18;\n", + "# At 16 bar:From steam tables\n", + "T_s = 474.4; \t\t\t#K\n", + "h_f = 858.6; \t\t\t#kJ/kg\n", + "h_fg = 1933.2; \t\t\t#kJ/kg\n", + "\n", + "# Calculations and Results\n", + "H = m*((h_f+x*h_fg)-c_pw*(T_w-0));\n", + "print (\"(i) Heat supplied to feed water per hour to produce wet steam is given by\"),(H),(\"kJ\")\n", + "\n", + "Q = m*((1-x)*h_fg+c_ps*(T_sup-T_s));\n", + "print (\"(ii) Heat absorbed by superheater per hour, Q = \"),(Q),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Heat supplied to feed water per hour to produce wet steam is given by 2473080.0 kJ\n", + "(ii) Heat absorbed by superheater per hour, Q = 586240.0 kJ\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.8 page no : 79" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print (\"(i) at 0.75 bar, between 100\u00b0C and 150\u00b0C\")\n", + "\n", + "# Variables\n", + "# At 100 \u00b0C\n", + "T1 = 100.; \t\t\t#\u00b0C\n", + "h_sup1 = 2679.4; \t\t\t#kJ/kg\n", + "# At 150 \u00b0C\n", + "T2 = 150.; \t\t\t#\u00b0C\n", + "h_sup2 = 2778.2; \t\t\t#kJ/kg\n", + "\n", + "# Calculations and Results\n", + "c_ps = (h_sup2-h_sup1)/(T2-T1);\n", + "print (\"mean specific heat = \"),(c_ps)\n", + "\n", + "print (\"(ii) at 0.5 bar, between 300\u00b0C and 400\u00b0C\")\n", + "T1 = 300; \t\t\t#\u00b0C\n", + "h_sup1 = 3075.5; \t#kJ/kg\n", + "T2 = 400; \t\t\t#\u00b0C\n", + "h_sup2 = 3278.9; \t#kJ/kg\n", + "\n", + "c_ps = (h_sup2-h_sup1)/(T2-T1);\n", + "print (\"mean specific heat c_ps = \"),(c_ps)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) at 0.75 bar, between 100\u00b0C and 150\u00b0C\n", + "mean specific heat = 1.976\n", + "(ii) at 0.5 bar, between 300\u00b0C and 400\u00b0C\n", + "mean specific heat c_ps = 2.034\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.9 page no : 79" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "m = 1.5; \t\t\t#kg\n", + "p = 5.; \t\t\t#bar\n", + "x1 = 1.;\n", + "x2 = 0.6;\n", + "p1 = 5.*10**5; \t\t\t#N/m\n", + "# At 5 bar: From steam tables\n", + "t_s = 151.8; \t\t\t#0C\n", + "h_f = 640.1; \t\t\t#kJ/kg\n", + "h_fg = 2107.4; \t\t\t#kJ/kg\n", + "v_g = 0.375; \t\t\t#m**3/kg\n", + "v_g1 = 0.375*10**(-3);\n", + "\n", + "# Calculations and Results\n", + "h1 = h_f+h_fg;\n", + "V = m*v_g;\n", + "u1 = h1-p1*v_g1;\n", + "v_g2 = V/m/x2; \t\t\t#m**3/kg\n", + "\n", + "# From steam table corresponding to 0.625 m**3/kg\n", + "p2 = 2.9; \t\t\t#bar\n", + "print (\"Pressure at new state = \"),(p2),(\"bar\")\n", + "\n", + "t_s = 132.4; \t\t\t#0C\n", + "print (\"Temperature at new state = \"),(t_s),(\"\u00b0C\")\n", + "h_f2 = 556.5; \t\t\t#kJ/kg\n", + "h_fg2 = 2166.6; \t\t\t#kJ/kg\n", + "u2 = (h_f2+x2*h_fg2)-p2*x2*v_g2*10**2;\n", + "\n", + "Q = u2-u1; \t\t\t#heat transferred at consmath.tant volume per kg\n", + "\n", + "Q_total = m*Q;\n", + "print (\"Total heat transfered,Q_total = \"),(Q_total),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Pressure at new state = 2.9 bar\n", + "Temperature at new state = 132.4 \u00b0C\n", + "Total heat transfered,Q_total = -1218.435 kJ\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.10 page no : 80" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "V = 0.9; \t\t\t#m**3\n", + "p1 = 8.; \t\t\t#bar\n", + "x1 = 0.9;\n", + "p2 = 4.; \t\t\t#bar\n", + "p3 = 3.; \t\t\t#bar\n", + "v_g1 = 0.24; \t\t#m**3/kg\n", + "\n", + "print (\"(i) The mass of steam blown off :\")\n", + "m1 = V/x1/v_g1;\n", + "h_f1 = 720.9; \t\t\t#kJ/kg\n", + "h_fg1 = 2046.5; \t\t#kJ/kg\n", + "h_f2 = 604.7; \t\t\t#kJ/kg\n", + "h_fg2 = 2133; \t\t\t#kJ/kg\n", + "v_g2 = 0.462; \t\t\t#m**3/kg\n", + "\n", + "# Calculations and Results\n", + "h1 = h_f1+x1*h_fg1; \t\t\t#The enthalpy of steam before blowing off\n", + "h2 = h1;\n", + "x2 = (h1-h_f2)/h_fg2;\n", + "m2 = x1/(x2*v_g2);\n", + "\n", + "m = m1-m2;\n", + "print (\"Mass of steam blown off = %.3f\")%(m),(\"kg\")\n", + "\n", + "print (\"(ii) Dryness fraction of steam in the vessel after cooling\")\n", + "v_g3 = 0.606; \t\t\t#m**3/kg\n", + "x3 = x2*v_g2/v_g3;\n", + "print (\"dryness fraction = %.4f\")%(x3)\n", + "x3 = 0.699\n", + "\n", + "print (\"(iii) Heat lost during cooling\")\n", + "h_f3 = 561.4; \t\t\t #kJ/kg\n", + "h_fg3 = 2163.2; \t\t\t#kJ/kg\n", + "h3 = h_f3+x3*h_fg3;\n", + "u2 = h2-p2*x2*v_g2*10**2; \t\t\t#kJ/kg\n", + "u3 = h3-p3*x3*v_g3*10**2; \t\t\t#kJ/kg\n", + "Q = m*(u3-u2);\n", + "print (\"Heat lost during cooling = %.3f\")%(-Q),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) The mass of steam blown off :\n", + "Mass of steam blown off = 2.045 kg\n", + "(ii) Dryness fraction of steam in the vessel after cooling\n", + "dryness fraction = 0.6998\n", + "(iii) Heat lost during cooling\n", + "Heat lost during cooling = 913.322 kJ\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.11 page no : 82" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "p = 8*10**5; \t\t\t#Pa\n", + "x = 0.8; \n", + "v_g = 0.240; \t\t\t#m**3/kg\n", + "h_fg = 2046.5; \t\t\t#kJ/kg\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) External work done during evaporation\")\n", + "W = p*x*v_g/10**3; \t\t\t#kJ\n", + "print (\"W = \"),(W),(\"kJ\")\n", + "\n", + "print (\"(ii) Internal latent heat\")\n", + "Q = x*h_fg-W;\n", + "print (\"Q = \"),(Q),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) External work done during evaporation\n", + "W = 153.6 kJ\n", + "(ii) Internal latent heat\n", + "Q = 1483.6 kJ\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.12 page no : 82" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "p1 = 10; \t\t\t#bar\n", + "import math \n", + "p2 = 10; \t\t\t#bar\n", + "x1 = 0.85;\n", + "V1 = 0.15; \t\t\t#m**3\n", + "t_sup2 = 300; \t\t\t#0C\n", + "t_sup1 = 179.9; \t\t\t#0C\n", + "c_ps = 2.2; \t\t\t#kJ/kg.K\n", + "v_g1 = 0.194; \t\t\t#m**3/kg\n", + "m = V1/(x1*v_g1);\n", + "h_fg1 = 2013.6; \t\t\t#kJ/kg\n", + "Q = (1-x1)*h_fg1+c_ps*(t_sup2-t_sup1);\n", + "Q_total = m*Q;\n", + "\n", + "print (\"Total heat supplied = %.3f\")%(Q_total),(\"kJ\")\n", + "\n", + "v_sup2 = v_g1*(t_sup2+273)/(t_sup1+273)\n", + "W = p1*(v_sup2 - (x1*v_g1))*10**2;\n", + "Percentage = W/Q*100;\n", + "\n", + "print (\"Percentage of total heat supplied = %.3f\")%(Percentage),(\"%\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total heat supplied = 515.094 kJ\n", + "Percentage of total heat supplied = 14.224 %\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.13 page no : 83" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "p = 18.; \t\t\t#bar\n", + "x = 0.85;\n", + "h_f = 884.6; \t\t\t#kJ/kg\n", + "h_fg = 1910.3; \t\t\t#kJ/kg\n", + "v_g = 0.110; \t\t\t#m**3/kg\n", + "u_f = 883.; \t\t\t#kJ/kg\n", + "u_g = 2598.; \t\t\t#kJ/kg\n", + "\n", + "# Calculations and Results\n", + "v = x*v_g;\n", + "print (\"Specific volume of wet steam = \"),(v),(\"m**3/kg\")\n", + "\n", + "h = h_f+x*h_fg;\n", + "print (\"Specific enthalpy of wet steam = \"),(h),(\"kJ/kg\")\n", + "u = (1-x)*u_f+ x*u_g;\n", + "print (\"Specific internal energy of wet steam = \"),(u),(\"kJ/kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Specific volume of wet steam = 0.0935 m**3/kg\n", + "Specific enthalpy of wet steam = 2508.355 kJ/kg\n", + "Specific internal energy of wet steam = 2340.75 kJ/kg\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.14 page no : 83" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "p = 7.; \t\t\t#bar\n", + "h = 2550.; \t\t\t#kJ/kg\n", + "h_f = 697.1; \t\t\t#kJ/kg\n", + "h_fg = 2064.9; \t\t\t#kJ/kg\n", + "v_g = 0.273; \t\t\t#m**3/kg\n", + "u_f = 696.; \t\t\t#kJ/kg\n", + "u_g = 2573.; \t\t\t#kJ/kg\n", + "\n", + "# Calculations and Results\n", + "x = (h-h_f)/h_fg;\n", + "print (\"(i) Dryness fraction = %.3f\")%(x)\n", + "\n", + "v = x*v_g;\n", + "print (\"(ii) Specific volume of wet steam = %.3f\")%(v),(\"m**3/kg\")\n", + "\n", + "u = (1-x)*u_f+ x*u_g;\n", + "print (\"(iii) Specific internal energy of wet steam = %.3f\")%(u),(\"kJ/kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Dryness fraction = 0.897\n", + "(ii) Specific volume of wet steam = 0.245 m**3/kg\n", + "(iii) Specific internal energy of wet steam = 2380.291 kJ/kg\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.15 page no : 84" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "p = 120.; \t\t\t#bar\n", + "v = 0.01721; \t\t\t#m**3/kg\n", + "\n", + "T = 350.; \t\t\t#\u00b0C\n", + "print (\"Temperature = \"), (T),(\"\u00b0C\")\n", + "\n", + "h = 2847.7; \t\t\t#kJ/kg\n", + "print (\"specific enthalpy = \"), (h),(\"kJ/kg\")\n", + "\n", + "u = h-p*v*10**2; \t\t\t#kJ/kg\n", + "print (\"Internal energy = \"), (u),(\"kJ/kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Temperature = 350.0 \u00b0C\n", + "specific enthalpy = 2847.7 kJ/kg\n", + "Internal energy = 2641.18 kJ/kg\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.16 page no : 84" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "p = 140.; \t\t\t#bar\n", + "h = 3001.9; \t\t\t#kJ/kg\n", + "T = 400; \t\t\t#0C\n", + "\n", + "# Calculations and Results\n", + "print (\"Temperature = \"),(T), (\"\u00b0C\")\n", + "\n", + "v = 0.01722; \t\t\t#m**3/kg\n", + "print (\"The specific volume %.3f\")%(v), (\"m**3/kg\")\n", + "\n", + "u = h-p*v*10**2;\n", + "print (\"specific internal energy = \"),(u),(\"kJ/kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Temperature = 400 \u00b0C\n", + "The specific volume 0.017 m**3/kg\n", + "specific internal energy = 2760.82 kJ/kg\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.17 page no : 85" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# At 10 bar: From steam table for superheated steam\n", + "\n", + "# Variables\n", + "h_sup = 3051.2; \t\t\t#kJ/kg\n", + "T_sup = 573; \t\t\t#K\n", + "T_s = 452.9; \t\t\t#K\n", + "v_g = 0.194; \t\t\t#m**3/kg\n", + "v_sup = v_g*T_sup/T_s;\n", + "p = 10.; \t\t\t#bar\n", + "\n", + "# Calculations and Results\n", + "u1 = h_sup-p*v_sup*10**2; \t\t\t#kJ/kg\n", + "print (\"Internal energy of superheated steam at 10 bar = %.3f\")%(u1), (\"kJ/kg\")\n", + "\n", + "# At 1.4 bar: From steam tables\n", + "p = 1.4; \t\t\t#bar\n", + "h_f = 458.4; \t\t\t#kJ/kg\n", + "h_fg = 2231.9; \t\t\t#kJ/kg\n", + "v_g = 1.236; \t\t\t#m**3/kg\n", + "x = 0.8;\n", + "h = h_f+x*h_fg;\n", + "u2 = h-p*x*v_g*10**2; \t\t\t#kJ\n", + "du = u2-u1;\n", + "print (\"Change in internal energy = %.3f\")%(du),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Internal energy of superheated steam at 10 bar = 2805.755 kJ/kg\n", + "Change in internal energy = -700.267 kJ\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.18 page no : 85" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "m = 1.; \t\t\t#kg\n", + "p = 20.; \t\t\t#bar\n", + "T_sup = 400.; \t\t\t#0C\n", + "x = 0.9;\n", + "c_ps = 2.3; \t\t\t#kJ/kg.K\n", + "\n", + "print (\"(i) Internal energy of 1 kg of superheated steam\")\n", + "# At 20 bar: From steam tables\n", + "T_s = 212.4; \t\t\t#0C\n", + "h_f = 908.6; \t\t\t#kJ/kg\n", + "h_fg = 1888.6; \t\t\t#kJ/kg\n", + "v_g = 0.0995; \t\t\t#m**3/kg\n", + "\n", + "# Calculations and Results\n", + "h_sup = h_f+h_fg+c_ps*(T_sup-T_s);\n", + "v_sup = v_g*(T_sup+273)/(T_s+273);\n", + "u = h_sup-p*v_sup*10**2;\n", + "print (\"Internal energy = %.3f\")%(u),(\"kJ/kg\")\n", + "\n", + "print (\"(ii) Internal energy of 1 kg of wet steam\")\n", + "h = h_f+x*h_fg;\n", + "u = h-p*x*v_g*10**2;\n", + "print (\"Internal energy = %.3f\")%(u),(\"kJ/kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Internal energy of 1 kg of superheated steam\n", + "Internal energy = 2952.769 kJ/kg\n", + "(ii) Internal energy of 1 kg of wet steam\n", + "Internal energy = 2429.240 kJ/kg\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.19 page no : 86" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "h_g1 = 2797.2; \t\t\t#kJ/kg\n", + "c_ps = 2.25;\n", + "T_sup = 350.; \t\t\t#0C\n", + "T_s = 212.4; \t\t\t#0C\n", + "\n", + "# Calculations\n", + "h1 = h_g1+c_ps*(T_sup-T_s);\n", + "h_f2 = 908.6; \t\t\t#kJ/kg\n", + "h_fg2 = 1888.6; \t\t\t#kJ/kg\n", + "\n", + "# Main:20 bar, 250 0C\n", + "T_sup = 250.; \t\t\t#0C\n", + "Q = 2*(h_g1+c_ps*(T_sup-T_s));\n", + "x2 = (Q-h1-h_f2)/h_fg2;\n", + "\n", + "# Results\n", + "print (\"Quality of steam %.3f\")%(x2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Quality of steam 0.926\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.20 page no : 87" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "# Variables\n", + "m = 1.; \t\t\t#kg\n", + "p = 6.; \t\t\t#bar\n", + "x = 0.8;\n", + "T_s = 473.; \t\t\t#K\n", + "h_fg = 2085.; \t\t\t#kJ/kg\n", + "c_pw = 4.18;\n", + "\n", + "# Calculations\n", + "s_wet = c_pw*math.log(T_s/273)+x*h_fg/T_s;\n", + "\n", + "# Results\n", + "print (\"Entropy of wet steam = %.3f\")%(s_wet),(\"kJ/kg.K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Entropy of wet steam = 5.824 kJ/kg.K\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.21 page no : 87" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "p1 = 10.; \t\t\t#bar\n", + "t_sup = 400.; \t\t#0C\n", + "p2 = 0.2; \t\t\t#bar\n", + "x2 = 0.9;\n", + "h_sup = 3263.9; \t\t\t#kJ/kg\n", + "s_sup = 7.465; \t\t\t#kJ/kg\n", + "h1 = 3263.9; \t\t\t#kJ/kg\n", + "s1 = s_sup;\n", + "h_f2 = 251.5; \t\t\t#kJ/kg\n", + "h_fg2 = 2358.4; \t\t#kJ/kg\n", + "s_f2 = 0.8321; \t\t\t#kJ/kg.K\n", + "s_g2 = 7.9094; \t\t\t#kJ/kg.K\n", + "\n", + "# Calculations and Results\n", + "s_fg2 = s_g2-s_f2;\n", + "h2 = h_f2+x2*h_fg2;\n", + "s2 = s_f2+x2*s_fg2;\n", + "\n", + "print (\"(i) Drop in enthalpy\")\n", + "dh = h1-h2;\n", + "print (\"Drop in enthalpy = %.3f\")%(dh),(\"kJ/kg\")\n", + "\n", + "print (\"(ii) Change in entropy\")\n", + "ds = s1-s2;\n", + "print (\"Change in entropy = %.3f\")%(ds),(\"kJ/kg.K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Drop in enthalpy\n", + "Drop in enthalpy = 889.840 kJ/kg\n", + "(ii) Change in entropy\n", + "Change in entropy = 0.263 kJ/kg.K\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.22 page no : 88" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "# Variables\n", + "m = 1.; \t\t \t #kg\n", + "p = 12.; \t\t \t#bar\n", + "T_sup = 523.; \t\t\t#K\n", + "c_ps = 2.1; \t\t\t#kJ/kg.K\n", + "T_s = 461.; \t\t\t#K\n", + "h_fg = 1984.3; \t\t\t#kJ/kg\n", + "c_pw = 4.18;\n", + "\n", + "# Calculations\n", + "s_sup = c_pw*math.log(T_s/273)+h_fg/T_s+c_ps*math.log(T_sup/T_s);\n", + "\n", + "# Results\n", + "print (\"Entropy = %.3f\")%(s_sup),(\"kJ/kg.K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Entropy = 6.759 kJ/kg.K\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.23 page no : 88" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "m = 3.; \t\t\t#kg\n", + "v1 = 0.75; \t\t\t#m**3/kg\n", + "v2 = 1.2363; \t\t\t#m**3/kg\n", + "x = v1/v2;\n", + "h_f = 458.4; \t\t\t#kJ/kg\n", + "h_fg = 2231.9; \t\t\t#kJ/kg\n", + "h_s = m*(h_f+x*h_fg); \t\t\t#kJ\n", + "v_sup = 1.55; \t\t\t#m**3/kg\n", + "p = 2; \t\t\t#bar\n", + "t_s = 120.2; \t\t\t#0C\n", + "t_sup = 400; \t\t\t#0C\n", + "h = 3276.6; \t\t\t#kJ/kg\n", + "U = 1708.; \t\t\t#kJ/kg\n", + "\n", + "# Calculations and Results\n", + "Degree = t_sup-t_s;\n", + "h_sup = m*h;\n", + "\n", + "Q_added = h_sup - h_s;\n", + "print (\"Heat added = %.3f\")%(Q_added),(\"kJ\")\n", + "\n", + "U_s = m*U;\n", + "U_sup = m*(h-p*v_sup*10**2);\n", + "dU = U_sup - U_s;\n", + "W = Q_added - dU;\n", + "print (\"work done = %.3f\")%(W),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat added = 4392.661 kJ\n", + "work done = 616.861 kJ\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.24 page no : 91" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "p = 5.; \t\t\t#bar\n", + "m = 50.; \t\t\t#kg\n", + "T1 = 20.; \t\t\t#0C\n", + "m_s = 3.; \t\t\t#kg\n", + "T2 = 40.; \t\t\t#0C\n", + "m_eq = 1.5; \t\t\t#kg\n", + "h_f = 640.1; \t\t\t#kJ/kg\n", + "h_fg = 2107.4; \t\t\t#kJ/kg\n", + "c_pw = 4.18;\n", + "\n", + "# Calculations\n", + "m_w = m+m_eq;\n", + "x = ((m_w*c_pw*(T2-T1))/m_s + c_pw*T2 - h_f)/h_fg;\n", + "\n", + "# Results\n", + "print (\"Dryness fraction of steam %.3f\")%(x)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Dryness fraction of steam 0.457\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.25 page no : 91" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "p = 1.1; \t\t\t#bar\n", + "x = 0.95;\n", + "c_pw = 4.18;\n", + "m1 = 90.; \t\t\t#kg\n", + "m2 = 5.25; \t\t\t#kg\n", + "T1 = 25.; \t\t\t#0C\n", + "T2 = 40.; \t\t\t#0C\n", + "\n", + "# Calculations\n", + "m = m1+m2;\n", + "h_f = 428.8; \t\t\t#kJ/kg\n", + "h_fg = 2250.8; \t\t\t#kJ/kg\n", + "m_s = (m*c_pw*(T2-T1))/((h_f + x*h_fg) - c_pw*T2)\n", + "\n", + "# Results\n", + "print (\"Mass of steam condensed = %.3f\")%(m_s),(\"kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass of steam condensed = 2.489 kg\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.26 page no : 93" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "p1 = 8.; \t\t\t#bar\n", + "p2 = 1.; \t\t\t#bar\n", + "T_sup2 = 115.; \t\t#0C\n", + "T_s2 = 99.6; \t\t#0C\n", + "h_f1 = 720.9; \t\t#kJ/kg\n", + "h_fg1 = 2046.5; \t#kJ/kg\n", + "h_f2 = 417.5; \t\t#kJ/kg\n", + "h_fg2 = 2257.9; \t#kJ/kg\n", + "c_ps = 2.1;\n", + "\n", + "# Calculations\n", + "x1 = (h_f2+h_fg2+c_ps*(T_sup2-T_s2)-h_f1)/h_fg1;\n", + "\n", + "# Results\n", + "print (\"Dryness fraction of the steam in the main = %.3f\")%(x1)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Dryness fraction of the steam in the main = 0.971\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.27 page no : 94" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "m_w = 2.; \t\t\t#kg\n", + "m_s = 20.5; \t\t#kg\n", + "t_sup = 110.; \t\t#0C\n", + "p1 = 12.; \t\t\t#bar\n", + "p3 = 1.; \t\t\t#bar\n", + "p2 = p1;\n", + "h_f2 = 798.4; \t\t#kJ/kg\n", + "h_fg2 = 1984.3; \t#kJ/kg\n", + "T_s = 99.6; \t\t#0C\n", + "h_f3 = 417.5; \t\t#kJ/kg\n", + "h_fg3 = 2257.9; \t#kJ/kg\n", + "T_sup = 110.; \t\t#0C\n", + "c_ps = 2.; \t\t\t#kJ/kg.K\n", + "\n", + "# Calculations\n", + "x2 = (h_f3+h_fg3 + c_ps*(T_sup-T_s) - h_f2)/h_fg2;\n", + "x1 = x2*m_s/(m_w+m_s);\n", + "\n", + "# Results\n", + "print (\"Quality of steam supplied = %.3f\")%(x1)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Quality of steam supplied = 0.871\n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.28 page no : 95" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "p1 = 15.; \t\t\t#bar\n", + "p2 = p1;\n", + "p3 = 1.; \t\t\t#bar\n", + "t_sup3 = 150.; \t\t#0C\n", + "m_w = 0.5; \t\t\t#kg/min\n", + "m_s = 10.; \t\t\t#kg/min\n", + "h_f2 = 844.7; \t\t#kJ/kg\n", + "h_fg2 = 1945.2; \t#kJ/kg\n", + "h_sup3 = 2776.4; \t#kJ/kg\n", + "\n", + "# Calculations\n", + "x2 = (h_sup3 - h_f2)/h_fg2;\n", + "x1 = x2*m_s/(m_s + m_w);\n", + "\n", + "\n", + "# Results\n", + "print (\"Quality of steam supplied = %.3f\")%(x1)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Quality of steam supplied = 0.946\n" + ] + } + ], + "prompt_number": 30 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Industrial_Instrumentation/.ipynb_checkpoints/ch4-checkpoint.ipynb b/Industrial_Instrumentation/.ipynb_checkpoints/ch4-checkpoint.ipynb new file mode 100644 index 00000000..7eb1e631 --- /dev/null +++ b/Industrial_Instrumentation/.ipynb_checkpoints/ch4-checkpoint.ipynb @@ -0,0 +1,3335 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:75cc662b83a20e10c962bb4b327ffefb7e8b88ef4b321db4fa8f1bf933a9eccf" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 4 : First Law of Thermodynamics" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.1 page no : 119" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#\n", + "# Variables\n", + "Q = -50.; \t\t\t#kJ/kg\n", + "W = -100.; \t\t\t#kJ/kg\n", + "\n", + "# Calculations\n", + "dU = Q-W;\n", + "\n", + "# Results\n", + "print (\"gain in internal energy = \"),(dU),(\"kJ/kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "gain in internal energy = 50.0 kJ/kg\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.2 page no : 119" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "u1 = 450.; \t\t\t#kJ/kg\n", + "u2 = 220; \t\t\t#kJ/kg\n", + "W = 120; \t\t\t#kJ/kg\n", + "\n", + "# Calculations\n", + "Q = (u2-u1) + W;\n", + "\n", + "# Results\n", + "print (\"Heat rejected by air = \"),(-Q),(\"kJ/kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat rejected by air = 110.0 kJ/kg\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.3 page no : 119" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "m = 0.3; \t\t\t#kg\n", + "cv = 0.75; \t\t\t#kJ/kg.K\n", + "T1 = 313.; \t\t\t#K\n", + "T2 = 433.; \t\t\t#K\n", + "W = -30.; \t\t\t#kJ\n", + "\n", + "# Calculations\n", + "dU = m*cv*(T2-T1);\n", + "Q = dU + W;\n", + "\n", + "# Results\n", + "print (\"Heat rejected during the process = \"),(-Q),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat rejected during the process = 3.0 kJ\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.4 page no : 120" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "p1 = 105.; \t\t\t#kPa\n", + "V1 = 0.4; \t\t\t#m**3\n", + "p2 = p1;\n", + "V2 = 0.20; \t\t\t#m**3\n", + "Q = -42.5; \t\t\t#kJ\n", + "\n", + "# Calculations\n", + "W = p1*(V2-V1);\n", + "dU = Q-W;\n", + "\n", + "# Results\n", + "print (\"change in internal energy = \"),(dU),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "change in internal energy = -21.5 kJ\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.6 Page no :121" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# Variables\n", + "p1 = 10.**5 # Pa\n", + "T1 = 25 + 273 # K\n", + "p2 = 5 * 10**5 # Pa\n", + "T2 = T1 \n", + "\n", + "# Calculations and Result\n", + "print \"(i) For isothermal process :\"\n", + "W12 = -p1 * (1.8)* math.log(p1/p2)\n", + "print \"Work done on the air = %.3e kJ/kg.\"%W12\n", + "\n", + "print \"(ii) Since temperature is constant,\"\n", + "print \"u2 \u2013 u1 = 0\"\n", + "print \"Change in internal energy = zero.\"\n", + "\n", + "print \"(iii) Again,\"\n", + "Q12 = 0 + W12\n", + "print \"Heat rejected = %.3e kJ/kg.\"%Q12\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) For isothermal process :\n", + "Work done on the air = 2.897e+05 kJ/kg.\n", + "(ii) Since temperature is constant,\n", + "u2 \u2013 u1 = 0\n", + "Change in internal energy = zero.\n", + "(iii) Again,\n", + "Heat rejected = 2.897e+05 kJ/kg.\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.7 page no : 122" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "# Variables\n", + "W_12 = -82.; \t\t\t#kJ\n", + "Q_12 = -45.; \t\t\t#kJ\n", + "dU_12 = Q_12 - W_12;\n", + "W_21 = 100.; \t\t\t#kJ\n", + "dU_21 = -dU_12;\n", + "\n", + "# Calculations\n", + "Q_21 = dU_21 + W_21;\n", + "\n", + "# Results\n", + "print (\"Heat added to the system = \"),(Q_21),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat added to the system = 63.0 kJ\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.8 page no : 123" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "Q2 = 9000.; \t\t\t#kJ\n", + "Q1 = 3000.; \t\t\t#kJ\n", + "Q = Q1-Q2; \n", + "W = 0;\n", + "\n", + "# Calculations\n", + "dU = W-Q;\n", + "\n", + "# Results\n", + "print (\"Work done = \"),(W)\n", + "\n", + "print (\"Change in internal energy = \"),(dU),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Work done = 0\n", + "Change in internal energy = 6000.0 kJ\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.9 page no : 124" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "m = 20.; \t\t\t#kg\n", + "g = 9.81; \t\t\t#m/s**2\n", + "z2 = 0.;\n", + "z1 = 15.;\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) When the stone is about to enter the water\")\n", + "Q = 0\n", + "W = 0\n", + "dU = 0\n", + "PE = m*g*(z2-z1)\n", + "KE = -PE\n", + "print \"\u2206 PE = %.3f\"%KE,\"J\"\n", + "\n", + "print (\"(ii) When the stone dips into the math.tank and comes to rest\")\n", + "Q = 0\n", + "W = 0\n", + "KE = 0\n", + "PE = m*g*(z2-z1)\n", + "dU = -PE\n", + "print \"\u2206U = %.3f\"%dU\n", + "\n", + "print (\"(iii) When the water and stone come to their initial temperature\")\n", + "W = 0\n", + "KE = 0\n", + "Q = -dU\n", + "print \"Q = %.3f\"%Q\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) When the stone is about to enter the water\n", + "\u2206 PE = 2943.000 J\n", + "(ii) When the stone dips into the math.tank and comes to rest\n", + "\u2206U = 2943.000\n", + "(iii) When the water and stone come to their initial temperature\n", + "Q = -2943.000\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.10 page no : 125" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "Q_lqm = 168.; \t\t\t#kJ\n", + "W_lqm = 64.; \t\t\t#kJ\n", + "dU_lm = Q_lqm - W_lqm;\n", + "W_lnm = 21.; \t\t\t#kJ\n", + "W_ml = -42.; \t\t\t#kJ\n", + "\n", + "# Calculations and Results\n", + "Q_lnm = dU_lm + W_lnm;\n", + "print (\"(i)Q_lnm = \"),(Q_lnm), (\"kJ\")\n", + "\n", + "Q_ml = W_ml - dU_lm;\n", + "print (\"(ii)Q_ml = \"),(Q_ml),(\"kJ\")\n", + "\n", + "W_ln = 21.; \t\t\t#kJ\n", + "dU_ln = 84.; \t\t\t#kJ\n", + "Q_ln = dU_ln + W_ln;\n", + "Q_nm = Q_lnm-Q_ln;\n", + "print (\"(iii)Q_nm = \"), (Q_nm), (\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i)Q_lnm = 125.0 kJ\n", + "(ii)Q_ml = -146.0 kJ\n", + "(iii)Q_nm = 20.0 kJ\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.11 page no : 126" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "# Variables\n", + "T1 = 55.; \t\t\t#0C\n", + "T2 = 95.; \t\t\t#0C\n", + "\n", + "# Calculations\n", + "def f1( T): \n", + "\t return 200\n", + "W = quad(f1, T1, T2)[0]\n", + "\n", + "\n", + "def f2( T): \n", + "\t return 160\n", + "Q = quad(f2, T1, T2)[0]\n", + "dU = Q-W;\n", + "\n", + "# Results\n", + "print (\"change in internal energy = \"),(dU/10**3),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "change in internal energy = -1.6 kJ\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.12 page no : 127" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "Q = -340.; \t\t\t#kJ\n", + "n = 200.; \t\t\t#cycles/min\n", + "\n", + "#For Process 1-2\n", + "W_12 = 4340.; \t\t\t#kJ/min\n", + "Q_12 = 0.;\n", + "\n", + "# Calculations and Results\n", + "dE_12 = Q_12-W_12;\n", + "print (\"dE_12 = \"),(dE_12),(\"kJ/min\")\n", + "\n", + "#For process 2-3\n", + "Q_23 = 42000.; \t\t\t#kJ/min\n", + "W_23 = 0;\n", + "\n", + "dE_23 = Q_23-W_23;\n", + "print (\"dE_23 = \"),(dE_23),(\"kJ/min\")\n", + "\n", + "#For process 3-4\n", + "Q_34 = -4200.; \t\t\t#kJ/min\n", + "dE_34 = -73200.; \t\t\t#kJ/min\n", + "\n", + "W_34 = Q_34-dE_34;\n", + "print (\"W_34 = \"), (W_34), (\"kJ/min\")\n", + "\n", + "#For process 4-1\n", + "Q_41 = Q*n-Q_12-Q_23-Q_34;\n", + "print (\"Q_41 = \"), (Q_41), (\"kJ/min\")\n", + "\n", + "dE_41 = 0-dE_12-dE_23-dE_34;\n", + "print (\"dE_41 = \"), (dE_41), (\"kJ/min\")\n", + "\n", + "W_41 = Q_41-dE_41;\n", + "print (\"W_41 = \"), (W_41), (\"kJ/min\")\n", + "\n", + "print \"Since sum(Q) = sum(W), \"\n", + "print \"Rate of work output = -68000 KJ/min\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "dE_12 = -4340.0 kJ/min\n", + "dE_23 = 42000.0 kJ/min\n", + "W_34 = 69000.0 kJ/min\n", + "Q_41 = -105800.0 kJ/min\n", + "dE_41 = 35540.0 kJ/min\n", + "W_41 = -141340.0 kJ/min\n", + "Since sum(Q) = sum(W), \n", + "Rate of work output = -68000 KJ/min\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.13 page no : 128" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "P = 1200.; \t\t\t#kW\n", + "Qin = 3360.; \t\t\t#kJ/kg\n", + "Qout = 2520.; \t\t\t#kJ/kg\n", + "F = 6.; \t\t\t#kW\n", + "\n", + "# Calculations\n", + "dQ = Qin - Qout;\n", + "dW = P-F; \t\t\t#kJ/s\n", + "m = dW/dQ;\n", + "\n", + "# Results\n", + "print (\"Steam flow round the cycle %.3f\")%(m), (\"kg/s\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Steam flow round the cycle 1.421 kg/s\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.14 page no : 129" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "dT = 25.; \t\t\t#0C\n", + "Q = 30.; \t\t\t#kJ\n", + "cv = 1.2; \t\t\t#kJ/kg.0C\n", + "m = 2.5; \t\t\t#kg\n", + "\n", + "# Calculations\n", + "dU = m*cv*dT;\n", + "\n", + "# Results\n", + "print (\"change in internal energy = \"),(dU), (\"kJ\")\n", + "\n", + "W = Q - dU;\n", + "print (\"Work done = \"),(W),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "change in internal energy = 75.0 kJ\n", + "Work done = -45.0 kJ\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.15 page no : 129" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "Q = 50.; \t\t\t#kJ\n", + "dV = 0.14; \t\t\t#m**3\n", + "p = 1.2*10**5; \t\t#N/m**2\n", + "m = 90.; \t\t\t#kg\n", + "d = 5.5; \t\t\t#m\n", + "g = 9.8; \t\t\t#m/s**2\n", + "W_adb = -110.; \t#kJ\n", + "Wnet = m*g*d/1000; \t#kJ\n", + "\n", + "# Calculations and Results\n", + "W = p*dV/1000 + Wnet; \t\t\t#kJ\n", + "dE = Q-W;\n", + "print (\"(i)Change in internal energy %.3f kJ\")%(dE)\n", + "\n", + "Q = 0;\n", + "dE = -W_adb;\n", + "print (\"(ii) Adiabatic process %.3f kJ\")%(dE)\n", + "\n", + "\n", + "Q = 50.; \t\t\t#kJ\n", + "dE = Q - (W_adb+W);\n", + "print (\"(iii)Change in internal energy %.3f kJ\")%(dE)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i)Change in internal energy 28.349 kJ\n", + "(ii) Adiabatic process 110.000 kJ\n", + "(iii)Change in internal energy 138.349 kJ\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.16 page no : 130" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "# Variables\n", + "V1 = 0.15; \t\t\t#m**3\n", + "V2 = 0.05; \t\t\t#m**3\n", + "Q = -45.; \t\t\t#kJ\n", + "p1 = (5./V1+1.5)*10**5; \t\t\t#N/m**2\n", + "p2 = (5./V2+1.5)*10**5; \t\t\t#N/m**2\n", + "\n", + "# Calculations\n", + "def f0( V): \n", + "\t return (5/V+1.5)*10**2\n", + "\n", + "W = quad(f0, V1, V2)[0]\n", + "\n", + "dU = Q-W;\n", + "print (\"(i)Change in internal energy = %.3f kJ\")%(dU)\n", + "\n", + "dH = (dU*10**3+(p2*V2-p1*V1))/10**3;\n", + "print (\"(ii) Change in enthalpy = %.3f kJ\")%(dH)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i)Change in internal energy = 519.306 kJ\n", + "(ii) Change in enthalpy = 504.306 kJ\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.17 page no : 131" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "V1 = 0.25; \t\t\t#m**3\n", + "p1 = 500.; \t\t\t#kPa\n", + "p2 = 100.; \t\t\t#kPa\n", + "\n", + "# Calculations and Results\n", + "V2 = V1*(p1/p2)**(1/1.25)\n", + "n = 1.25\n", + "dU = 3.64*(p2*V2 - p1*V1)\n", + "\n", + "print (\"(i) If the expansion is quasi-static\")\n", + "W = (p1*V1-p2*V2)/(n-1);\n", + "Q = dU+W\n", + "print (\"Heat transfered = %.3f\")%(Q),(\"kJ\")\n", + "\n", + "print (\"(ii) In another process\")\n", + "Q = 32; \t\t\t#kJ\n", + "W = Q-dU;\n", + "print (\"Work done = %.3f\")%(W),(\"kJ\")\n", + "\n", + "print (\"(iii)The difference\")\n", + "print (\" The work in (ii) is not equal to \u222b p dV math.since the process is not quasi-static.\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) If the expansion is quasi-static\n", + "Heat transfered = 12.385 kJ\n", + "(ii) In another process\n", + "Work done = 157.225 kJ\n", + "(iii)The difference\n", + " The work in (ii) is not equal to \u222b p dV math.since the process is not quasi-static.\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.18 page no : 132" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "# Variables\n", + "v1 = 0.3; \t\t\t#m**3/kg\n", + "T1 = 20.; \t\t\t#0C\n", + "v2 = 0.55; \t\t\t#m**3/kg\n", + "T2 = 260; \t\t\t#0C\n", + "p = 1.6*10**5; \t\t\t#Pa\n", + "\n", + "print (\"(i)Heat added per kg = \")\n", + "\n", + "# Calculations and Results\n", + "def f5( T): \n", + "\t return 1.5 + 75/(T+45)\n", + "\n", + "Q = quad(f5, T1,T2)[0]\n", + "\n", + "print (\"Q = %.3f\")%(Q), (\"kJ/kg\")\n", + "\n", + "\n", + "print (\"(ii)The work done per kg of fluid\")\n", + "W = p*(v2-v1)/1000; \t\t\t#kJ/kg\n", + "print (\"W = %.3f\")%(W),(\"kJ/kg\")\n", + "\n", + "\n", + "print (\"(iii)Change in internal energy\")\n", + "dU = Q-W;\n", + "print (\"dU = %.3f\")%(dU),(\"kJ/kg\")\n", + "\n", + "\n", + "print (\"(iv)Change in enthalpy\")\n", + "dH = Q;\n", + "print (\"dH = %.3f\")%(dH),(\"kJ/kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i)Heat added per kg = \n", + "Q = 475.944 kJ/kg\n", + "(ii)The work done per kg of fluid\n", + "W = 40.000 kJ/kg\n", + "(iii)Change in internal energy\n", + "dU = 435.944 kJ/kg\n", + "(iv)Change in enthalpy\n", + "dH = 475.944 kJ/kg\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.19 page no : 133" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "m = 1.; \t\t\t#kg\n", + "du = -42000.; \t\t\t#J\n", + "cp = 840.; \t\t\t#J/kg.0C\n", + "cv = 600.; \t\t\t#J/kg.0C\n", + "\n", + "# Calculations\n", + "dT = du/m/cv;\n", + "Q = m*cp*dT;\n", + "W = (Q-du)/10**3;\n", + "\n", + "# Results\n", + "print (\"Work done = \"),(W),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Work done = -16.8 kJ\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 4.20 page no : 133" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from numpy import *\n", + "from scipy.integrate import quad \n", + "\n", + "# Variables\n", + "p1 = 190.; \t\t\t#kPa\n", + "V1 = 0.035; \t\t\t#m**3\n", + "p2 = 420.; \t\t\t#kPa\n", + "V2 = 0.07; \t\t\t#m**3\n", + "dU = 3.6*(p2*V2-p1*V1);\n", + "p = [[1,0.035],[1,0.07]]\n", + "q = [190,420];\n", + "#X = linalg.inv(p)*q;\n", + "X = linalg.solve(p,q)\n", + "a = X[0]\n", + "b = X[1]\n", + "\n", + "# Calculations\n", + "def f4( V): \n", + "\t return a+b*V\n", + "\n", + "W = quad(f4, V1, V2)[0]\n", + "\n", + "# Results\n", + "print (\"Work done by the system = \"),(W),(\"kJ\")\n", + "\n", + "\n", + "Q = dU+W;\n", + "print (\"Heat transfer into the system = \"),(Q),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Work done by the system = 10.675 kJ\n", + "Heat transfer into the system = 92.575 kJ\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.21 page no : 134" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "Qv = 90.; \t\t\t#kJ\n", + "Qp = -95; \t\t\t#kJ\n", + "W = -18; \t\t\t#kJ\n", + "U_l = 105; \t\t\t#kJ\n", + "W_lm = 0;\n", + "Q_lm = 90;\n", + "\n", + "# Calculations\n", + "U_m = U_l+90;\n", + "dU_mn = Qp-W;\n", + "U_n = U_m+dU_mn;\n", + "dQ = Qv+Qp;\n", + "dW = dQ;\n", + "W_nl = dW-W;\n", + "\n", + "# Results\n", + "print (\"W_nl(in kJ) = \"),(W_nl)\n", + "\n", + "print (\"U_l in kJ = \"),(U_l)\n", + "\n", + "print (\"U_m in kJ = \"),(U_m)\n", + "print (\"U_n in kJ\"), (U_n)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "W_nl(in kJ) = 13.0\n", + "U_l in kJ = 105\n", + "U_m in kJ = 195\n", + "U_n in kJ 118\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.23 page no : 136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "V1 = 0.2; \t\t\t#m**3\n", + "p1 = 4.*10**5; \t\t#N/m**2\n", + "T1 = 403.; \t\t\t#K\n", + "p2 = 1.02*10**5; \t#N/m**2\n", + "dH = 72.5; \t\t\t#kJ\n", + "Q_23 = dH;\n", + "cp = 1.; \t\t\t#kJ/kg\n", + "cv = 0.714; \t\t#kJ/kg\n", + "y = 1.4;\n", + "\n", + "# Calculations\n", + "V2 = round(V1*(p1/p2)**(1/y),2);\n", + "T2 = round(T1*((p2/p1)**((y-1)/y)),1);\n", + "R = (cp-cv)*1000; \t\t\t#J/kg.K\n", + "m = round(p1*V1/R/T1,3);\n", + "T3 = round(Q_23/(m*cp) +T2);\n", + "V3 = 0.732 # round(V2*T3/T2,2);\n", + "W_12 = (p1*V1 - p2*V2)/(y-1);\n", + "W_23 = p2*(V3-V2);\n", + "W_123 = W_12+W_23;\n", + "\n", + "# Results\n", + "print (\"Total work done = %.3f\")%(W_123),(\"J\")\n", + "\n", + "print (\"(ii) Index of expansion, n\")\n", + "p3 = p2;\n", + "n = (p1*V1-p3*V3)/W_123 + 1;\n", + "print (\"value of index = %.3f\")%(n)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total work done = 85454.000 J\n", + "(ii) Index of expansion, n\n", + "value of index = 1.062\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.25 page no : 139" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "d = 0.15; \t\t\t#m\n", + "T = 303.; \t\t\t#K\n", + "p = 3.*10**5; \t\t#N/m**2\n", + "l = 0.085; \t\t\t#m\n", + "Q = -4000.; \t\t#J\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) Workdone by the system\")\n", + "dv = math.pi/4*d**2*l;\n", + "W = p*dv;\n", + "print (\"W = %.3f\")%(W/10**3),(\"kJ\")\n", + "\n", + "print (\"(ii) Decrease in internal energy of the system\")\n", + "dU = (Q-W)/10**3;\n", + "print (\"Decrease in internal energy = %.3f\")%(-dU),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Workdone by the system\n", + "W = 0.451 kJ\n", + "(ii) Decrease in internal energy of the system\n", + "Decrease in internal energy = 4.451 kJ\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.27 page no : 140" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# Variables\n", + "y = 1.4\n", + "R = 294.2; \t\t\t#J/kg.0C\n", + "p1 = 1.*10**5; \t\t#N/m**2\n", + "T1 = 353.; \t\t\t#K\n", + "V1 = 0.45; \t\t\t#m**3\n", + "V2 = 0.13; \t\t\t#m**3\n", + "p2 = 5.*10**5; \t\t#N/m**2\n", + "\n", + "# Calculations and Results\n", + "cv = R/(y-1);\n", + "print (\"(i) The mass of gas\")\n", + "m = p1*V1/R/T1;\n", + "print (\"m = %.3f\")%(m),(\"kg\")\n", + "\n", + "print (\"(ii) The value of index \u2018n\u2019 for compression\")\n", + "n = math.log(p2/p1)/math.log(V1/V2);\n", + "print (\"n = %.3f\")%(n)\n", + "\n", + "print (\"(iii) The increase in internal energy of the gas\")\n", + "T2 = T1*(V1/V2)**(n-1);\n", + "dU = m*cv*(T2-T1)/10**3;\n", + "print (\"dU = %.3f\")%(dU),(\"kJ\")\n", + "\n", + "print (\"(iv) The heat received or rejected by the gas during compression.\")\n", + "W = m*R*(T1-T2)/(n-1)/10**3;\n", + "Q = dU+W;\n", + "print (\"Q = %.3f\")%(Q),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) The mass of gas\n", + "m = 0.433 kg\n", + "(ii) The value of index \u2018n\u2019 for compression\n", + "n = 1.296\n", + "(iii) The increase in internal energy of the gas\n", + "dU = 50.000 kJ\n", + "(iv) The heat received or rejected by the gas during compression.\n", + "Q = -17.535 kJ\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.28 page no : 141" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "p1 = 1.02*10**5; \t#Pa\n", + "T1 = 295.; \t\t\t#K\n", + "V1 = 0.015; \t\t#m**3\n", + "p2 = 6.8*10**5; \t#Pa\n", + "y = 1.4;\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) Final temperature\")\n", + "T2 = T1*(p2/p1)**((y-1)/y);\n", + "t2 = T2-273; \n", + "print (\"t2 = %.3f\")%(t2),(\"\u00b0C\")\n", + "\n", + "\n", + "print (\"(ii) Final volume :\")\n", + "V2 = V1*(p1/p2)**(1/y);\n", + "print (\"V2 = %.3f\")%(V2),(\"m**3\")\n", + "\n", + "\n", + "print (\"(iii)Work done\")\n", + "R = 287;\n", + "m = p1*V1/R/T1;\n", + "W = m*R*(T1-T2)/(y-1)/10**3;\n", + "print (\"W = %.3f\")%(W),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Final temperature\n", + "t2 = 234.253 \u00b0C\n", + "(ii) Final volume :\n", + "V2 = 0.004 m**3\n", + "(iii)Work done\n", + "W = -2.752 kJ\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.29 page no : 142" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from numpy import *\n", + "import math\n", + "\n", + "# Variables\n", + "m = 0.44; \t\t\t#kg\n", + "T1 = 453.; \t\t\t#K\n", + "ratio = 3.; \t\t#ratio = V2/V1\n", + "T2 = 288.; \t\t\t#K\n", + "W_12 = 52.5; \t\t#kJ\n", + "\n", + "# Calculations\n", + "y = math.log(T2/T1)/ math.log(1/ratio) + 1;\n", + "R = W_12*(y-1)/m/(T1-T2);\n", + "M = [[1,-1],[1,-y]];\n", + "N = [R,0];\n", + "X = linalg.inv(M)*N;\n", + "cp = X[0][0];\n", + "cv = X[1][0];\n", + "\n", + "# Results\n", + "print (\"cp = %.3f\")%(cp),(\"kJ/kg.K\")\n", + "\n", + "print (\"cv = %.3f\")%(cv),(\"kJ/kg.K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "cp = 1.021 kJ/kg.K\n", + "cv = 0.723 kJ/kg.K\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.30 page no : 143" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "n = 1.3;\n", + "m = 1; \t\t\t#kg\n", + "p1 = 1.1; \t\t\t#bar\n", + "T1 = 300.; \t\t\t#K\n", + "p2 = 6.6; \t\t\t#bar\n", + "R0 = 8314.;\n", + "M = 30.;\n", + "cp = 1.75; \t\t\t#kJ/kg.K\n", + "\n", + "\n", + "# Calculations\n", + "R = R0/M/1000; \t\t\t#kJ/kg.K\n", + "cv = cp - R;\n", + "y = cp/cv;\n", + "T2 = T1 *(p2/p1)**((n-1)/n);\n", + "W = R*(T1-T2)/(n-1);\n", + "Q = ((y-n)/(y-1))*W;\n", + "\n", + "# Results\n", + "print (\"Heat supplied = %.3f\")%(Q),(\"kJ/kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat supplied = 84.352 kJ/kg\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.31 page no : 144" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# Variables\n", + "cp = 14.3; \t\t\t#kJ/kg.K\n", + "cv = 10.2; \t\t\t#kJ/kg.K\n", + "V1 = 0.1; \t\t\t#m**3\n", + "T1 = 300.; \t\t\t#K\n", + "p1 = 1.; \t\t\t#bar\n", + "p2 = 8.; \t\t\t#bar\n", + "y = cp/cv;\n", + "R = cp-cv;\n", + "V2 = V1*(p1/p2)**(1/y);\n", + "V3 = V2;\n", + "T2 = T1*(p2/p1)**((y-1)/y);\n", + "p3 = p1*V1/V3;\n", + "T3 = 300.; \t\t\t#K\n", + "\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) Pressure at the end of consmath.tant volume cooling = %.3f\")%(p3),(\"bar\")\n", + "\n", + "print (\"(ii) Change in internal energy during consmath.tant volume process\")\n", + "m = p1*V1/R/T1*10**2; \t\t\t#kg\n", + "\n", + "dU_23 = m*cv*(T3-T2);\n", + "print (\"dU_23 = %.3f\")%(dU_23),(\"kJ\")\n", + "\n", + "print (\"(iii) Net work done and heat transferred during the cycle\")\n", + "W_12 = m*R*(T1-T2)/(y-1);\n", + "W_23 = 0;\n", + "W_31 = p3*V3*math.log(V1/V3)*10**2; \t\t\t#kJ\n", + "Wnet = W_12+W_23+W_31;\n", + "print (\"Net work done = %.3f\")%(Wnet),(\"kJ\")\n", + "Qnet = Wnet;\n", + "print (\"Heat transferred during the complete cycle = %.3f\")%(Qnet),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Pressure at the end of consmath.tant volume cooling = 4.407 bar\n", + "(ii) Change in internal energy during consmath.tant volume process\n", + "dU_23 = -20.281 kJ\n", + "(iii) Net work done and heat transferred during the cycle\n", + "Net work done = -5.449 kJ\n", + "Heat transferred during the complete cycle = -5.449 kJ\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.32 page no : 145" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# Variables\n", + "V1 = 0.15; \t\t\t#m**3\n", + "p1 = 15.; \t\t\t#bar\n", + "T1 = 550.; \t\t\t#K\n", + "T2 = T1;\n", + "r = 4.; \t\t\t#r = V2/V1\n", + "V2 = r*V1;\n", + "T3 = 290.; \t\t\t#K\n", + "\n", + "# Calculations\n", + "p2 = p1*V1/V2;\n", + "W_12 = p1*V1*math.log(V2/V1)*10**2; \t\t\t#kJ\n", + "V3 = V2;\n", + "p3 = p2*T3/T2;\n", + "W_23 = 0;\n", + "n = math.log(p1/p3)/math.log(V3/V1);\n", + "W_31 = (p3*V3-p1*V1)/(n-1)*10**2; \t\t\t#kJ\n", + "\n", + "# Results\n", + "\n", + "Wnet = W_12+W_23+W_31\n", + "print (\"net work done = %.3f\")%Wnet , (\"kJ\")\n", + "\n", + "Qnet = Wnet;\n", + "print (\"Heat transferred during the cycle = %.3f\")%(Qnet),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "net work done = 81.537 kJ\n", + "Heat transferred during the cycle = 81.537 kJ\n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.33 page no : 146" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "%pylab inline\n", + "\n", + "import math \n", + "from scipy.integrate import quad \n", + "from matplotlib.pyplot import *\n", + "from numpy import *\n", + "\n", + "# Variables\n", + "m = 1; \t\t\t#kg\n", + "p1 = 5; \t\t\t#bar\n", + "V1 = 0.02; \t\t\t#m**3\n", + "V2 = 0.08; \t\t\t#m**3\n", + "p2 = 1.5; \t\t\t#bar\n", + "\n", + "\n", + "# Calculations and Results\n", + "def f(V):\n", + " return a+b*V;\n", + "\n", + "A = [[1,0.02],[1,0.08]]\n", + "B = [5,1.5];\n", + "#X = linalg.inv(A)*B;\n", + "X = linalg.solve(A,B)\n", + "a = X[0]\n", + "b = X[1]\n", + "\n", + "print (\"(i) p-V diagram\")\n", + "\n", + "V = linspace(0.02,0.08,80);\n", + "p = a+b*V;\n", + "plot(V,p,'b')\n", + "\n", + "V = [0.0667 ,0.08];\n", + "p = [1.5 ,1.5];\n", + "plot(V,p,'g')\n", + "\n", + "V = linspace(0.02,0.0667,447)\n", + "def fa(V):\n", + " return 0.1/V;\n", + "f = fa(V)\n", + "plot(V,f,'r')\n", + "suptitle(\"p-V diagram\")\n", + "\n", + "V = [0.0667, 0.0667];\n", + "p = [1.5, 0];\n", + "plot(V,p,'--')\n", + "xlabel(\"V(m)**3\")\n", + "ylabel(\"P(bar)\")\n", + "text(.04,4,'Reversible Expansion')\n", + "text(0.04,2.3,\"pV = C\")\n", + "text(0.07,1.2,\"p = C\")\n", + "\n", + "print (\"(ii) Work done and heat transfer\")\n", + "\n", + "\n", + "def f7(V): \n", + "\t return (a+b*V)*10**2\n", + "\n", + "W_12 = quad(f7,V1,V2)[0]\n", + "\n", + "print (\"Work done by the system = \"),(W_12), (\"kJ\")\n", + "\n", + "p3 = p2;\n", + "V3 = round(p1*V1/p3,4);\n", + "W_23 = p2*(V3-V2)*10**2; \t\t\t#kJ\n", + "\n", + "W_31 = round(p3*V3*math.log(V1/V3)*10**2,2); \t\t\t#kJ\n", + "print (\"Work done on the system = %.3f\")% (W_31), (\"kJ\")\n", + "\n", + "W_net = W_12+W_23+W_31;\n", + "print (\"Net work done = %.3f\")% (W_net), (\"kJ\")\n", + "\n", + "Q_net = W_net;\n", + "print (\"Heat transferred during the complete cycle = %.3f\")% (Q_net),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Populating the interactive namespace from numpy and matplotlib\n", + "(i) p-V diagram" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "(ii) Work done and heat transfer" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Work done by the system = 19.5 kJ\n", + "Work done on the system = -12.050 kJ\n", + "Net work done = 5.455 kJ\n", + "Heat transferred during the complete cycle = 5.455 kJ\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAX8AAAEhCAYAAACXwKDgAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XtYVNX6B/DvAJoX1ATvlxwzQIEBRhBFCaG0vJGaKGFp\nZmqWdEHNS+ZBs/KG59hRT1iW2qmOmubxkpqmB7VEUQFFTVFzTNT8eUURUYH1+2M1E1cFZvZcv5/n\nmScZ9uy1NtC7917r3e9SCSEEiIjIoThZugNERGR+DP5ERA6IwZ+IyAEx+BMROSAGfyIiB8TgT0Tk\ngBj8yaZMnz4d7733XrH30tPT4e3t/cDPJSUlITIyEgCwYcMGzJ49W7E+EtkCBn+yKYMHD8bKlSuL\nvbdixQoMHjy4wvuIjIzExIkTje6LEAJ8TIZsFYM/WQ2dToe2bdti6NCh8PX1RZ8+fZCbm1tsGw8P\nD9SvXx8pKSmG97777jvExMSU2t+6devg4eGBjh07Yu3atYb3ly1bhjfffBMAsH79enTs2BEajQZh\nYWG4ePEiAODSpUsIDQ1FQEAARo0aBbVajWvXrkGn08HLywvDhg1DQEAAsrKyMHr0aHTo0AGenp6Y\nNGmSoR21Wo0pU6YgKCgIQUFBSE1NRc+ePaFWq7FgwQKT/uyIKk0QWYkzZ84IlUol9u3bJ4QQYuTI\nkeLjjz8utV1CQoKIi4sTQgiRnJwsgoK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BwZ/sjsxMTHIyMgwrEXbpEkTw5qm\ngBz2KXo1X/LfRb9OS0tDSEhIhdsWQmDw4MGGVM+LFy+We2dAZEnM9iGHMG3aNLRr1w7R0dEV/kxm\nZibGjx+P9evXK9gzIsvglT85hDFjxmD58uWV+kxiYiImTJigUI+ILItX/kREDohX/kREDojBn4jI\nATH4ExE5IAZ/IiIHxOBPROSAGPyJiBzQ/wNTN0khb0PDfQAAAABJRU5ErkJggg==\n", + "text": [ + "" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.34 page no : 147" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "\n", + "# Variables\n", + "cv = 0.71; \t\t\t#kJ/kg.K\n", + "R = 0.287; \t\t\t#kJ/kg.K\n", + "d = 8.; \t\t\t#cm\n", + "l = 3.5; \t\t\t#cm\n", + "S = 150.; \t\t\t#N/cm\n", + "p1 = 30.; \t\t\t#N/cm\n", + "V1 = 45.; \t\t\t#cm**3\n", + "T1 = 293.; \t\t\t#K\n", + "cv = 0.71; \t\t\t#kJ/kg.K\n", + "R = 0.287; \t\t\t#kJ/kg.K\n", + "\n", + "# Calculations\n", + "A = math.pi/4*d**2;\n", + "C = p1-S/A**2*V1;\n", + "dV = l*A;\n", + "V2 = V1+dV;\n", + "p2 = S/A**2*V2 + C;\n", + "\n", + "def f3( p): \n", + "\t return A**2/S*p/100\n", + "\n", + "W = quad(f3, p1, p2)[0]\n", + "\n", + "T2 = p2*V2*T1/p1/V1;\n", + "m = p1*V1/R/T1/10**5; \t\t\t#kg\n", + "dU = m*cv*(T2-T1);\n", + "Q_12 = dU + W*10**(-3);\n", + "\n", + "# Results\n", + "print (\"Amount of heat added to the system = %.3f\")% (Q_12), (\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Amount of heat added to the system = 0.250 kJ\n" + ] + } + ], + "prompt_number": 31 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.35 page no : 164" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "r = 10.; \t\t\t#kg/min\n", + "p1 = 1.5*10**5; \t\t\t#N/m**2\n", + "rho1 = 26.; \t\t\t#kg/m**3\n", + "C1 = 110.; \t\t\t#m/s\n", + "u1 = 910.; \t\t\t#kJ/kg\n", + "p2 = 5.5*10**5; \t\t\t#N/m**2\n", + "rho2 = 5.5; \t\t\t#kg/m**3\n", + "C2 = 190.; \t\t\t#m/s\n", + "u2 = 710.; \t\t\t#kJ/kg\n", + "Q = 55.; \t\t\t#kJ/s\n", + "h = 55.; \t\t\t#m\n", + "g = 9.81; \t\t\t#m/s**2\n", + "v2 = 1/rho2;\n", + "v1 = 1/rho1;\n", + "\n", + "# Calculations and Results\n", + "\n", + "dh = u2-u1+ (p2*v2-p1*v1)/10**3;\n", + "print (\"(i) Change in enthalpy %.3f\")%(dh), (\"kJ/kg\")\n", + "\n", + "print (\"(ii) Work done during the process (W).\")\n", + "\n", + "Q = 330.; \t\t\t#kJ/kg\n", + "KE = (C2**2-C1**2)/2/10**3; \t\t\t#kJ\n", + "PE = g*h/10**3; \t\t\t#kJ\n", + "W = -Q-KE-PE-dh;\n", + "print (\"Work done = %.3f\")%(W),(\"kJ\")\n", + "\n", + "\n", + "P = W*10/60.;\n", + "print (\"Work done per second = %.3f\")%(P),(\"kW\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Change in enthalpy -105.769 kJ/kg\n", + "(ii) Work done during the process (W).\n", + "Work done = -236.770 kJ\n", + "Work done per second = -39.462 kW\n" + ] + } + ], + "prompt_number": 32 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.36 page no : 166" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "\n", + "import math \n", + "\n", + "m = 15.; \t\t\t#kg/s\n", + "v = 0.45; \t\t\t#m**3/kg\n", + "P = 12000.; \t\t#kW\n", + "W = P/m; \t\t\t#kJ/kg\n", + "h1 = 1260.; \t\t#kJ/kg\n", + "h2 = 400.; \t\t\t#kJ/kg\n", + "C1 = 50.; \t\t\t#m/s\n", + "C2 = 110.; \t\t\t#m/s\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) Heat rejected = \"),\n", + "Q = h2-h1+(C2**2-C1**2)/2/10**3 +W;\n", + "Qnet = m*Q;\n", + "print (\"Qnet = %.3f\")%(-Qnet),(\"kW\")\n", + "\n", + "print (\"(ii) Inlet area\")\n", + "A = v*m/C1;\n", + "print (\"A = %.3f\")%(A),(\"m**2\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Heat rejected = Qnet = 828.000 kW\n", + "(ii) Inlet area\n", + "A = 0.135 m**2\n" + ] + } + ], + "prompt_number": 33 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.37 page no : 167" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "m = 0.5; \t\t\t#kg/s\n", + "C1 = 6.; \t\t\t#m/s\n", + "C2 = 5.; \t\t\t#m/s\n", + "p1 = 1.; \t\t\t#bar\n", + "p2 = 7.; \t\t\t#bar\n", + "v1 = 0.85; \t\t\t#m**3/kg\n", + "v2 = 0.16; \t\t\t#m**3/kg\n", + "du = 90.; \t\t\t#kJ/kg\n", + "Q = -120.; \t\t\t#kJ/kg\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) Power required to drive the compressor\")\n", + "W = -du+(C1**2-C2**2)/2/1000 + (p1*v1 - p2*v2)*10**2 + Q;\n", + "Power = m*W; \n", + "print (\"Power = %.3f\")%(-Power),(\"kW\")\n", + "\n", + "\n", + "print (\"(ii) Inlet and outlet pipe cross-sectional areas\")\n", + "A1 = m*v1/C1;\n", + "A2 = m*v2/C2;\n", + "print (\"Inlet crosssectional area = %.3f\")% (A1), (\"m**2\")\n", + "\n", + "print (\"Outlet crossectional area = %.3f\")%(A2), (\"m**2\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Power required to drive the compressor\n", + "Power = 118.497 kW\n", + "(ii) Inlet and outlet pipe cross-sectional areas\n", + "Inlet crosssectional area = 0.071 m**2\n", + "Outlet crossectional area = 0.016 m**2\n" + ] + } + ], + "prompt_number": 34 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.38 page no : 168" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "h1 = 800.; \t\t\t#kJ/kg\n", + "C1 = 5.; \t\t\t#m/s\n", + "h2 = 2520.; \t\t\t#kJ/kg\n", + "C2 = 50.; \t\t\t#m/s\n", + "dZ = 4.; \t\t\t#m\n", + "g = 9.81; \t\t\t#m/s**2\n", + "Q = 2180.; \t\t\t#kJ/kg\n", + "\n", + "# Calculations\n", + "W = h1-h2+(C1**2 - C2**2)/2/1000 +dZ*g/1000+Q;\n", + "\n", + "# Results\n", + "print (\"Power developed = %.3f\")%(W), (\"kW\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Power developed = 458.802 kW\n" + ] + } + ], + "prompt_number": 35 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.39 page no : 169" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "g = 9.8; \t\t\t#m/s**2\n", + "m = 4500./3600; \t#kg/s\n", + "C1 = 2800./60; \t\t#m/s\n", + "Z1 = 5.5; \t\t\t#m\n", + "h1 = 2800.; \t\t#kJ/g\n", + "C2 = 5600./60; \t\t#m/s\n", + "Z2 = 1.5; \t\t\t#m\n", + "h2 = 2300.; \t\t#kJ/kg\n", + "Q = -16000./3600; \t#kJ/s\n", + "\n", + "# Calculations\n", + "W = Q-m*((h1-h2) + (C2**2 - C1**2)/2/1000 + (Z2-Z1)*g/1000);\n", + "\n", + "# Results\n", + "print (\"Power output of the turbine = %.3f\")% (-W),(\"kW\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Power output of the turbine = 633.479 kW\n" + ] + } + ], + "prompt_number": 36 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.40 page no : 170" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "p1 = 6.87; \t\t\t#bar\n", + "C1 = 50.; \t\t\t#m/s\n", + "p2 = 1.37; \t\t\t#bar\n", + "C2 = 500.; \t\t\t#m/s\n", + "print (\"From steam table corresponding to p1\")\n", + "h1 = 2850.; \t\t\t#kJ/kg\n", + "\n", + "# Calculations\n", + "h2 = h1 - (C2**2-C1**2)/2/1000;\n", + "\n", + "# Results\n", + "print (\"Final enthalpy of steam = \"), (h2),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "From steam table corresponding to p1\n", + "Final enthalpy of steam = 2726.25 kJ\n" + ] + } + ], + "prompt_number": 37 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.41 page no : 171" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "m = 220./60; \t\t\t#kg/s\n", + "C1 = 320.; \t\t\t#m/s\n", + "p1 = 6*10.**5; \t\t\t#N/m**2\n", + "u1 = 2000.*10**3; \t\t\t#J/kg\n", + "v1 = 0.36; \t\t\t#m**3/kg\n", + "C2 = 140.; \t\t\t#m/s\n", + "p2 = 1.2*10**5; \t\t\t#N/m**2\n", + "u2 = 1400.*10**3; \t\t\t#J/kg\n", + "v2 = 1.3; \t\t\t#m**3/kg\n", + "Q = 100*10.**3; \t\t\t#J/s\n", + "\n", + "# Calculations\n", + "W = (m*((u1-u2)+ (p1*v1 - p2*v2) + (C1**2-C2**2)/2) -Q)/10**6;\n", + "\n", + "# Results\n", + "print (\"power capacity of the system = %.3f\")% (W),(\"MW\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "power capacity of the system = 2.472 MW\n" + ] + } + ], + "prompt_number": 38 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.42 page no : 172" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "p1 = 7.5*10**5; \t\t\t#N/m**2\n", + "C1 = 140.; \t\t\t#m/s\n", + "h1 = 950.*10**3; \t\t\t#J/kg\n", + "p2 = 2*10.**5; \t\t\t#N/m**2\n", + "C2 = 280.; \t\t\t#m/s\n", + "h2 = 650.*10**3; \t\t\t#J/kg\n", + "m = 5.; \t\t\t#kg/s\n", + "\n", + "# Calculations\n", + "W = (h1-h2)+(C1**2-C2**2)/2\n", + "Power = m*W/1000;\n", + "\n", + "# Results\n", + "print (\"Power capacity of turbine = \"), (Power), (\"kW\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Power capacity of turbine = 1353.0 kW\n" + ] + } + ], + "prompt_number": 39 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.43 page no : 173" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "C1 = 12.; \t\t\t#m/s\n", + "p1 = 1.*10**5; \t\t\t#N/m**2\n", + "v1 = 0.5; \t\t\t#m**3/kg\n", + "C2 = 90.; \t\t\t#m/s\n", + "p2 = 8.*10**5; \t\t\t#N/m**2\n", + "v2 = 0.14; \t\t\t#m**3/kg\n", + "dh = 150.; \t\t\t#kJ/kg\n", + "Q = -11.67; \t\t\t#kJ/s\n", + "m = 0.2; \t\t\t#kg/s\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) Motor power required to drive the compressor\")\n", + "W = m*(-dh + (C1**2-C2**2)/2/1000) +Q;\n", + "print (\"Power = %.3f\")% (-W), (\"kW\")\n", + "\n", + "\n", + "print (\"(ii)Ratio of inlet to outlet pipi diameter\")\n", + "ratio = math.sqrt(C2/C1*v1/v2);\n", + "print (\"ratio = %.3f\")% (ratio)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Motor power required to drive the compressor\n", + "Power = 42.466 kW\n", + "(ii)Ratio of inlet to outlet pipi diameter\n", + "ratio = 5.175\n" + ] + } + ], + "prompt_number": 40 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.44 page no : 175" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "W = -175.; \t\t\t #kJ/kg\n", + "dh = 70.; \t\t \t#kJ/kg\n", + "Q_water = -92.; \t\t\t#kJ/kg\n", + "\n", + "# Calculations\n", + "Q = dh+W;\n", + "Q_atm = Q-Q_water;\n", + "\n", + "# Results\n", + "print (\"Heat transferred to the atmosphere = \"),(-Q_atm), (\"kJ/kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat transferred to the atmosphere = 13.0 kJ/kg\n" + ] + } + ], + "prompt_number": 41 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.45 page no : 176" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# Variables\n", + "h1 = 2800.*10**3; \t\t\t#J/kg\n", + "C1 = 50.; \t\t\t#m/s\n", + "A1 = 900.*10**(-4); \t\t\t#m**2\n", + "v1 = 0.187; \t\t\t#m**3/kg\n", + "h2 = 2600.*10**3; \t\t\t#J/kg\n", + "v2 = 0.498; \t\t\t#m**3/kJ\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) Velocity at exit of the nozzle\")\n", + "C2 = math.sqrt(2*((h1-h2) + C1**2/2));\n", + "\n", + "print (\"C2 = %.3f\")% (C2),(\"m/s\")\n", + "\n", + "\n", + "print (\"(ii) Mass flow rate\")\n", + "m = A1*C1/v1;\n", + "print (\"m = %.3f\")% (m), (\"kg/s\")\n", + "\n", + "\n", + "print (\"(iii) Area at the exit\")\n", + "A2 = m*v2/C2*10**4;\n", + "print (\"A2 = %.3f\")%(A2), (\"cm**2\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Velocity at exit of the nozzle\n", + "C2 = 634.429 m/s\n", + "(ii) Mass flow rate\n", + "m = 24.064 kg/s\n", + "(iii) Area at the exit\n", + "A2 = 188.894 cm**2\n" + ] + } + ], + "prompt_number": 42 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.46 page no : 177" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "h1 = 240.; \t\t\t#kJ/kg\n", + "h2 = 192.; \t\t\t#kJ/kg\n", + "dZ = 20.; \t\t\t#m\n", + "g = 9.81; \t\t\t#m/s**2\n", + "\n", + "# Calculations\n", + "Q = (h2-h1)+dZ*g/1000;\n", + "\n", + "# Results\n", + "print (\"heat transfer = %.3f\")% (-Q), (\"kJ/kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "heat transfer = 47.804 kJ/kg\n" + ] + } + ], + "prompt_number": 43 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.47 page no : 178" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "p1 = 2.; \t\t\t#bar\n", + "C1 = 300.; \t\t\t#m/s\n", + "Q = 0.;\n", + "h1 = 915.*10**3; \t\t\t#J/kg\n", + "h2 = 800.*10**3; \t\t\t#J/kg\n", + "\n", + "# Calculations\n", + "C2 = math.sqrt(2*(h1-h2 + C1**2/2));\n", + "\n", + "# Results\n", + "print (\"Relative velocity of gas leaving the pipe = %.3f\")% (C2), (\"m/s\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Relative velocity of gas leaving the pipe = 565.685 m/s\n" + ] + } + ], + "prompt_number": 44 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.48 page no : 179" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "mw = 50; \t\t\t#kg/s\n", + "p1 = 10.**5; \t\t\t#N/m**2\n", + "p2 = 4.2*10**5; \t\t\t#N/m**2\n", + "h = 10.7; \t\t\t#m\n", + "d1 = 0.2; \t\t\t#m\n", + "d2 = 0.1; \t\t\t#m\n", + "v1 = 1./1000;\n", + "v2 = 1./1000;\n", + "g = 9.81; \t\t\t#m/s**2\n", + "\n", + "# Calculations\n", + "C1 = mw*4/math.pi/d1**2*v1;\n", + "C2 = mw*4/math.pi/d2**2*v2;\n", + "W = mw*((p1*v1-p2*v2) + (g*(0-h))+(C1**2-C2**2)/2)/10**3;\n", + "\n", + "# Results\n", + "print (\"Capacity of electric motor %.3f\")%(-W), (\"kW\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Capacity of electric motor 22.198 kW\n" + ] + } + ], + "prompt_number": 45 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 4.49 page no : 180" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "Ca = 250.; \t\t\t#m/s\n", + "t = -14.; \t\t\t#0C\n", + "ha = 250.; \t\t\t#kJ/kg\n", + "hg = 900.; \t\t\t#kJ/kg\n", + "ratio = 0.0180;\n", + "Ef = 45.*10**3; \t\t\t#kJ/kg\n", + "Q = -21.; \t\t\t#kJ/kg\n", + "ma = 1.; \t\t\t#kg\n", + "mg = 1.018; \t\t\t#kg\n", + "mf = 0.018; \t\t\t#kg\n", + "\n", + "#Calculations\n", + "Eg = 0.06*mf/mg*Ef;\n", + "Cg = math.sqrt(2000*((ma*(ha+Ca**2/2/1000) + mf*Ef + Q)/mg -hg-Eg));\n", + "\n", + "# Results\n", + "print (\"velocity of exhaust gas jet = %.3f\")%(Cg),(\"m/s\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "velocity of exhaust gas jet = 455.160 m/s\n" + ] + } + ], + "prompt_number": 46 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.50 page no : 181" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "t1 = 20.; \t\t\t#0C\n", + "C1 = 40.; \t\t\t#m/s\n", + "t2 = 820.; \t\t\t#0C\n", + "C2 = 40.; \t\t\t#m/s\n", + "t3 = 620.; \t\t\t#0C\n", + "C3 = 55.; \t\t\t#m/s\n", + "t4 = 510.; \t\t\t#0C\n", + "m = 2.5; \t\t\t#kg/s\n", + "cp = 1.005; \t\t\t#kJ/kg.0C\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) Heat exchanger\")\n", + "Q_12 = m*cp*(t2-t1);\n", + "print (\"rate of heat transfer = \"),(Q_12), (\"kJ/s\")\n", + "\n", + "print (\"(ii) Turbine\")\n", + "W_23 = m*((cp*(t2-t3))+(C2**2-C3**2)/2/1000);\n", + "print (\"Power output of turbine = %.3f\")%(W_23), (\"kW\")\n", + "\n", + "print (\"(iii) Nozzle\")\n", + "C4 = math.sqrt(2*1000*(cp*(t3-t4)+C3**2/2/1000));\n", + "print (\"Velocity at exit from the nozzle = %.3f\")%(C4), (\"m/s\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Heat exchanger\n", + "rate of heat transfer = 2010.0 kJ/s\n", + "(ii) Turbine\n", + "Power output of turbine = 500.719 kW\n", + "(iii) Nozzle\n", + "Velocity at exit from the nozzle = 473.418 m/s\n" + ] + } + ], + "prompt_number": 47 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.51 page no : 185" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "V = 0.028; \t\t\t#m**3\n", + "p1 = 80.; \t\t\t#bar\n", + "t = 350.; \t\t\t#0C\n", + "p2 = 50.; \t\t\t#bar\n", + "v1 = 0.02995; \t\t\t#m**3/kg\n", + "h1 = 2987.3; \t\t\t#kJ/kg\n", + "v2 = 0.02995; \t\t\t#m**3/kg\n", + "vg2 = 0.0394; \t\t\t#m**3/kg\n", + "uf2 = 1149.; \t\t\t#kJ/kg\n", + "ug2 = 2597.; \t\t\t#kJ/kg\n", + "\n", + "# Calculations and Results\n", + "m = V/v1;\n", + "u1 = h1 - (p1*v1*10**2); \t\t\t#kJ/kg\n", + "\n", + "print (\"(i) State of steam after cooling\")\n", + "x2 = v2/vg2;\n", + "print (\"dryness fraction = %.3f\")%(x2)\n", + "\n", + "\n", + "print (\"(ii) Heat rejected by the steam\")\n", + "u2 = (1-x2)*uf2 + x2*ug2;\n", + "Q = m*(u2-u1);\n", + "print (\"Heat rejected = %.3f\")% (-Q), (\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) State of steam after cooling\n", + "dryness fraction = 0.760\n", + "(ii) Heat rejected by the steam\n", + "Heat rejected = 465.575 kJ\n" + ] + } + ], + "prompt_number": 48 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.52 page no : 188" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "m = 0.08; \t\t\t#kg\n", + "p = 2.*10**5; \t\t\t#Pa\n", + "V = 0.10528; \t\t\t#m**3\n", + "h1 = 2706.3; \t\t\t#kJ/kg\n", + "h2 = 3071.8; \t\t\t#kJ/kg\n", + "v1 = 0.885; \t\t\t#m**3/kg\n", + "\n", + "# Calculations and Results\n", + "v2 = V/m; \t\t\t#m**3/kg\n", + "\n", + "print (\"(i) Heat supplied\")\n", + "Q = m*(h2-h1);\n", + "print (\"Q = \"),(Q), (\"kJ\")\n", + "\n", + "\n", + "W = p*(v2-v1);\n", + "W_total = m*W/10**3;\n", + "print (\"(ii)Total work done = \"), (W_total), (\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Heat supplied\n", + "Q = 29.24 kJ\n", + "(ii)Total work done = 6.896 kJ\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.53 page no : 189" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from numpy import *\n", + "from matplotlib.pyplot import *\n", + "\n", + "# Variables\n", + "m = 1.; \t\t\t#kg\n", + "p = 8.; \t\t\t#bar\n", + "s1 = 6.55; \t\t\t#kJ/kg.K\n", + "T = 200.; \t\t\t#0C\n", + "s_f1 = 2.0457; \t\t\t#kJ/kg.K\n", + "s_fg1 = 4.6139; \t\t\t#kJ/kg.K\n", + "h_f1 = 720.9; \t\t\t#kJ/kg\n", + "h_fg1 = 2046.5; \t\t\t#kJ/kg\n", + "h2 = 2839.3; \t\t\t#kJ/kg\n", + "\n", + "# Calculations and Results\n", + "x1 = (s1-s_f1)/s_fg1;\n", + "h1 = h_f1+x1*h_fg1;\n", + "Q = h2-h1;\n", + "print (\"Heat supplied = %.3f\")%(Q), (\"kJ/kg\")\n", + "\n", + "# For T-s diagram\n", + "\n", + "s = linspace(0,.10,10);\n", + "T = (-(s-5)**2+298);\n", + "plot(s,T)\n", + "\n", + "T = [295.44 ,295.44];\n", + "s = [6.6 ,3.45];\n", + "plot(s,T,'g')\n", + "\n", + "s = [6.6 ,7];\n", + "T = [295.44, 300];\n", + "plot(s,T,'g')\n", + "\n", + "s = [6.55 ,6.55];\n", + "T = [270 ,295.44];\n", + "plot(s,T,'r')\n", + "\n", + "s = [6.6, 6.6];\n", + "T = [270 ,295.44];\n", + "plot(s,T,'--r')\n", + "\n", + "s = [6.66, 6.66];\n", + "T = [270, 295.44];\n", + "plot(s,T,'r')\n", + "\n", + "\t\t\t#The area in red represents the heat flow and it goes upto x-axis\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat supplied = 120.513 kJ/kg\n" + ] + }, + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 50, + "text": [ + "[]" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAXUAAAD9CAYAAABDaefJAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAGRdJREFUeJzt3XtQVHee9/FPM5BdDUadioKC9RBBIg2DtBfUlE6aicZY\nUQIFMcEoJuKkjFoWSayxsjUbr6tmRs3gjNZqKjqZdSuglY2YxBh0FUWTDGbo5HEgG3nWJtPgJTEz\nOOCtEc7zh5teGRUa7At95v2q6iq6+5zz+56U+XD8nd/5ajEMwxAAwBTCgl0AAMB3CHUAMBFCHQBM\nhFAHABMh1AHARAh1ADCRDkP96tWrGjt2rNLS0mS1WvXKK69Ikv785z9r8uTJSkxM1KOPPqrGxkbP\nPmvXrtWwYcM0fPhwlZWV+bd6AEA7ls7WqV++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LRpEmTNHr0aL3xxhvBLsdrTqdTAwYM0HPPPaeRI0fqpz/9\nqS5fvhzssrqluLhYM2fO7HCbgP3p4oZpz9Dc3Kzc3FwVFRUpMjIy2OV0SVhYmD7//HPV19fr6NGj\nIfXI9/vvv6+BAwfKZrOF5NWudGPhhMPh0IcffqjNmzeroqIi2CV55fr166qqqtKCBQtUVVWle++9\nV+vWrQt2WV3mdrv13nvv6cknn+xwu4CF+t+uYXe5XO2ePoX/3emZg1DTt29fPf744/rss8+CXYrX\nPv74Y+3du1cPPPCA8vLydOjQIeXn5we7rC4ZNGiQJGnAgAHKzs4OmRulsbGxio2N1ZgxYyRJubm5\n7Z6vCRUffvihRo0apQEDBnS4XcBCffTo0aqtrVVdXZ3cbrdKSkqUmZkZqOH/7hkdPHMQCi5cuKDG\nxkZJ0pUrV3TgwIF23UF7ujVr1sjlcsnpdKq4uFg/+clP9Lvf/S7YZXnt8uXLampqkiRdunRJZWVl\n+tGPfhTkqrwTHR2tIUOG6NSpU5JuzEsnJycHuaque/vtt29ZRn47nT5R6ivh4eH6zW9+oylTpqi1\ntVUFBQVKSkoK1PA+kZeXpyNHjui7777TkCFDtHLlSj333HPBLssrHT1zEArOnj2rOXPmqK2tTW1t\nbZo9e7YeeeSRYJfVbaE2HXn+/HllZ2dLujGd8cwzz+jRRx8NclXe+/Wvf61nnnlGbrdb8fHx2rFj\nR7BL6pJLly7p4MGDXt3LCMo/kgEA8I/QvA0PALgtQh0ATIRQBwATIdQBwEQIdQAwEUIdAEzk/wOv\n7sf4EZKFzwAAAABJRU5ErkJggg==\n", + "text": [ + "" + ] + } + ], + "prompt_number": 50 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.54 page no : 192" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "p1 = 7.*10**5; \t\t\t#Pa\n", + "p2 = 1.5*10**5; \t\t\t#Pa\n", + "Q = 420.; \t\t\t#kJ/kg\n", + "uf = 696.; \t\t\t#kJ/kg\n", + "x = 0.95;\n", + "ug = 2573.; \t\t\t#kJ/kg\n", + "u_f2 = 2580.; \t\t\t#kJ/kg\n", + "u_g2 = 2856.; \t\t\t#kJ/kg\n", + "x2 = 15./50;\n", + "h_f1 = 697.1; \t\t\t#kJ/kg\n", + "h_fg1 = 2064.9; \t\t\t#kJ.kg\n", + "h_f2 = 2772.6; \t\t\t#kJ/kg\n", + "h_g2 = 2872.9; \t\t\t#kJ/kg\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) Change of internal energy\")\n", + "u1 = (1-x)*uf + x*ug;\n", + "u2 = 2602.8; \t\t\t#kJ/kg\n", + "du = u2-u1;\n", + "print (\"du = \"),(du), (\"kJ/kg\")\n", + "\n", + "print (\"(ii) Change in enthalpy\")\n", + "h1 = h_f1+x*h_fg1;\n", + "h2 = h_f2+x2*(h_g2-h_f2);\n", + "dh = h2-h1;\n", + "print (\"dh = \"), (dh), (\"kJ/kg\")\n", + "\n", + "print (\"(iii) Work done \")\n", + "W = Q-du;\n", + "print (\"W = \"), (W), (\"kJ/kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Change of internal energy\n", + "du = 123.65 kJ/kg\n", + "(ii) Change in enthalpy\n", + "dh = 143.935 kJ/kg\n", + "(iii) Work done \n", + "W = 296.35 kJ/kg\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.55 page no : 194" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "\n", + "p1 = 5.5*10**5; \t\t\t#Pa\n", + "x1 = 1.;\n", + "p2 = 0.75*10**5; \t\t\t#Pa\n", + "v1 = 0.3427; \t\t\t#m**3/kg\n", + "v2 = p1*v1/p2;\n", + "\n", + "# Since v2 > vg (at 0.75 bar), therefore, the steam is superheated at state 2.\n", + "u2 = 2567.25; \t\t\t#kJ/kg\n", + "u1 = 2565.; \t\t\t#kJ/kg\n", + "\n", + "# Calculations and Results\n", + "du = u2-u1; \t\t\t#kJ/kg\n", + "C = p1*v1;\n", + "\n", + "print (\"Work done \"),\n", + "\n", + "def f6( v): \n", + "\t return C/v\n", + "\n", + "W = quad(f6, v1,v2)[0]\n", + "\n", + "print (\"W =\"),(W), (\"N-m/kg\")\n", + "\n", + "\n", + "\n", + "Q = du+W/10**3;\n", + "\n", + "print (\"Heat supplied = %.3f\")%(Q),(\"kJ/kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Work done W = 375543.199592 N-m/kg\n", + "Heat supplied = 377.793 kJ/kg\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.56 page no : 195" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "p1 = 100.; \t\t\t#bar\n", + "p2 = 10.; \t\t\t#bar\n", + "s1 = 5.619; \t\t\t#kJ/kg.K\n", + "T = 584.; \t\t\t#K\n", + "s2 = 7.163; \t\t\t#kJ/kg.K\n", + "u1 = 2545.; \t\t\t#kJ/kg\n", + "u2 = 2811.8; \t\t\t#kJ/kg\n", + "\n", + "# Calculations and Results\n", + "print (\"(i)Heat supplied \")\n", + "Q = T*(s2-s1);\n", + "print (\"Q = \"),(Q),(\"kJ/kg\")\n", + "\n", + "print (\"(ii) Work done\")\n", + "W = Q-(u2-u1);\n", + "print (\"W = \"), (W), (\"kJ/kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i)Heat supplied \n", + "Q = 901.696 kJ/kg\n", + "(ii) Work done\n", + "W = 634.896 kJ/kg\n" + ] + } + ], + "prompt_number": 53 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.57 page no : 198" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "m = 1.; \t\t\t#kg\n", + "p1 = 120.*10**5; \t#N/m**2\n", + "t1 = 400.; \t\t\t#0C\n", + "p2 = 38.; \t\t\t#bar\n", + "h1 = 3051.3; \t\t#kJ/kg\n", + "v1 = 0.02108; \t\t#m**3/kg\n", + "\n", + "# Calculations\n", + "u1 = h1-p1*v1/10**3; \t#kJ/kg\n", + "u2 = 2602; \t\t\t #kJ/kg\n", + "\n", + "# Results\n", + "W = u1-u2; \n", + "print (\"Work done = %.3f\")%(W),(\"kJ/kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Work done = 196.340 kJ/kg\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.58 page no : 201 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "p1 = 7.*10**5; \t\t\t#N/m**2\n", + "x1 = 0.98;\n", + "p2 = 0.34*10**5; \t\t#N/m**2\n", + "vg = 0.273; \t\t\t#m**3/kg\n", + "n = 1.1;\n", + "v_g2 = 4.65; \t\t\t#m**3/kg\n", + "u_f1 = 696.; \t\t\t#kJ/kg\n", + "u_g1 = 2573.; \t\t\t#kJ/kg\n", + "u_f2 = 302.; \t\t\t#kJ/kg\n", + "u_g2 = 2472.; \t\t\t#kJ/kg\n", + "\n", + "# Calculations and Results\n", + "v1 = x1*vg;\n", + "v2 = v1*(p1/p2)**(1/n);\n", + "x2 = v2/v_g2;\n", + "\n", + "\n", + "print (\"(i) Work done by the steam during the process\")\n", + "W = (p1*v1-p2*v2)/(n-1)/10**3; \t\t\t#kJ/kg\n", + "print (\"W = %.3f\")%(W), (\"kJ/kg\")\n", + "\n", + "\n", + "print (\"(ii) Heat transferred\")\n", + "u1 = (1-x1)*u_f1+x1*u_g1;\n", + "u2 = (1-x2)*u_f2+x2*u_g2;\n", + "Q = u2-u1 + W;\n", + "print (\"Q = %.3f\")%(Q), (\"kJ/kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Work done by the steam during the process\n", + "W = 450.232 kJ/kg\n", + "(ii) Heat transferred\n", + "Q = 169.289 kJ/kg\n" + ] + } + ], + "prompt_number": 55 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.59 page no : 203" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "p1 = 15.; \t\t\t#bar\n", + "t1 = 350.; \t\t\t#0C\n", + "C1 = 60.; \t\t\t#m/s\n", + "p2 = 1.2; \t\t\t#bar\n", + "C2 = 180.; \t\t\t#m/s\n", + "s1 = 7.102; \t\t\t#kJ/kg\n", + "s_f2 = 1.3609; \t\t\t#kJ/kg\n", + "s_g2 = 7.2884; \t\t\t#kJ/kg\n", + "h_f2 = 439.4; \t\t\t#kJ/kg\n", + "h_fg2 = 2241.1; \t\t\t#kJ/kg\n", + "h1 = 3147.5; \t\t\t#kJ/kg\n", + "\n", + "# Calculations\n", + "x2 = (s1 - s_f2)/(s_g2-s_f2);\n", + "h2 = h_f2+x2*h_fg2;\n", + "W = (h1-h2) + (C1**2 - C2**2)/2/1000;\n", + "\n", + "# Results\n", + "print (\"Work done = %.3f\")%(W),(\"kJ/kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Work done = 523.075 kJ/kg\n" + ] + } + ], + "prompt_number": 56 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.60 page no : 204" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "p1 = 10.; \t\t\t#bar\n", + "t1 = 200.; \t\t\t#0C\n", + "C1 = 60.; \t\t\t#m/s**2\n", + "c2 = 650.; \t\t\t#m/s\n", + "p2 = 1.5; \t\t\t#bar\n", + "h1 = 2827.9; \t\t\t#kJ/kg\n", + "h_f2 = 467.1; \t\t\t#kJ/kg\n", + "h2 = 2618.45; \t\t\t#kJ/kg\n", + "h_g2 = 2693.4; \t\t\t#kJ/kg\n", + "\n", + "# Calculations\n", + "x2 = (h2-h_f2)/(h_g2-h_f2);\n", + "\n", + "# Results\n", + "print (\"quality of steam leaving the nozzle = %.3f\")%(x2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "quality of steam leaving the nozzle = 0.966\n" + ] + } + ], + "prompt_number": 57 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.61 page no : 206" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "h1 = 2776.4; \t\t\t#kJ/kg\n", + "h2 = h1;\n", + "h_f1 = 884.6; \t\t\t#kJ/kg\n", + "h_fg1 = 1910.3; \t\t#kJ/kg\n", + "\n", + "# Calculations\n", + "x1 = (h1-h_f1)/h_fg1;\n", + "\n", + "# Results\n", + "print (\"Initial dryness fraction = %.3f\")%(x1)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Initial dryness fraction = 0.990\n" + ] + } + ], + "prompt_number": 58 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.62 page no : 207" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "p1 = 10.; \t\t\t#bar\n", + "x1 = 0.9; \t\t\t#bar\n", + "p2 = 2.; \t\t\t#bar\n", + "\n", + "# Calculations\n", + "# Umath.sing Mollier chart, we get\n", + "x2 = 0.94;\n", + "\n", + "# Results\n", + "print (\"x2 = \"),(x2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x2 = 0.94\n" + ] + } + ], + "prompt_number": 59 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.63 Page no :208" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "import math \n", + "print (\"(a)From steam tables\")\n", + "\n", + "# Variables\n", + "p1 = 15*10**5; \t\t\t#Pa\n", + "p2 = 7.5*10**5; \t\t\t#Pa\n", + "h_f1 = 844.7; \t\t\t#kJ/kg\n", + "ts1 = 198.3; \t\t\t#0C\n", + "s_f1 = 2.3145; \t\t\t#kJ/kg.K\n", + "s_g1 = 6.4406; \t\t\t#kJ/kg.K\n", + "v_g1 = 0.132; \t\t\t#m**3/kg\n", + "h_fg1 = 1945.2; \t\t\t#kJ/kg\n", + "x1 = 0.95;\n", + "h_f2 = 709.3; \t\t\t#kJ/kg\n", + "h_fg2 = 2055.55; \t\t\t#kJ/kg\n", + "s_f2 = 2.0195; \t\t\t#kJ/kg\n", + "s_g2 = 6.6816; \t\t\t#kJ/kg.K\n", + "v_g2 = 0.255; \t\t\t#m**3/kg\n", + "x2 = 0.9;\n", + "x3 = 1;\n", + "s_f3 = 0.521; \t\t\t#kJ/kg K\n", + "s_g3 = 8.330; \t\t\t#kJ/kg K\n", + "\n", + "# Calculations\n", + "h2 = h_f2+x2*h_fg2;\n", + "h1 = h_f1 + x1*h_fg1;\n", + "s1 = s_f1 + x1*(s_g1-s_f1);\n", + "s2 = s1;\n", + "ds_12 = s2-s1;\n", + "\n", + "s3 = s_f3+x3*(s_g3-s_f3);\n", + "ds_23 = s3-s2;\n", + "\n", + "ds = 709.3 + 0.9 * 2055.55\n", + "\n", + "# Results\n", + "print (\"(i) Change in entropy = %.3f\")% (ds), (\"kJ/kg K\")\n", + "\n", + "h3 = h2;\n", + "\n", + "dh = h2-h1;\n", + "print (\"(ii) Change in enthalpy %.2f\")%(dh), (\"kJ/kg\")\n", + "\n", + "\n", + "print (\"(iii) Change in internal energy\"),\n", + "u1 = h1-p1*x1*v_g1/10**3;\n", + "u2 = h2-p2*x2*v_g2/10**3;\n", + "du = u2-u1;\n", + "print (\"du = %.3f\")% (du), (\"kJ/kg\")\n", + "\n", + "\n", + "\t\t\t# Only the expansion of steam from point 1 to 2 (i.e., isentropic expansion) is reversible because of unresisted flow whereas the expansion from point 2 to point 3 (i.e., throttling expansion) is irreversible because of frictional resismath.tance to flow. Increase of entropy also shows that expansion from point 2 to point 3 is irreversible.\n", + "\n", + "\n", + "print (\"(b) Using Mollier chart\")\n", + "h1 = 2692; \t\t\t#kJ/kg\n", + "h2 = 2560; \t\t\t#kJ/kg\n", + "s1 = 6.23; \t\t\t#kJ/kg K\n", + "s2 = s1;\n", + "s3 = 8.3; \t\t\t#kJ/kg K\n", + "\n", + "ds = s3-s1;\n", + "print (\"(i) Change in entropy = %.3f\")%(ds), (\"kJ/kg K\")\n", + "\n", + "\n", + "dh = h2-h1;\n", + "print (\"(ii) Change in enthalpy = %.3f\")%(dh),(\"kJ/kg\")\n", + "\n", + "u3=u2-u1\n", + "print (\"(iii) Change in internal energy =%.3f\")%(u3),(\"kJ/kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)From steam tables\n", + "(i) Change in entropy = 2559.295 kJ/kg K\n", + "(ii) Change in enthalpy -133.35 kJ/kg\n", + "(iii) Change in internal energy du = -117.370 kJ/kg\n", + "(b) Using Mollier chart\n", + "(i) Change in entropy = 2.070 kJ/kg K\n", + "(ii) Change in enthalpy = -132.000 kJ/kg\n", + "(iii) Change in internal energy =-117.370 kJ/kg\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.64 Page no :212" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "V1 = 5.5; \t\t\t#m**3\n", + "p1 = 16.*10**5; \t\t\t#Pa\n", + "T1 = 315.; \t\t\t#K\n", + "V2 = V1;\n", + "p2 = 12.*10**5; \t\t\t#Pa\n", + "R = 0.287*10**3;\n", + "y = 1.4;\n", + "\n", + "# Calculations\n", + "m1 = p1*V1/R/T1;\n", + "T2 = T1*(p2/p1)**((y-1)/y);\n", + "m2 = p2*V2/R/T2;\n", + "\n", + "# Results\n", + "m = m1-m2;\n", + "print (\"Mass of air which left the receiver = %.3f\")% (m), (\"kg\")\n", + "\n", + "# Note : Rounding error is there." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass of air which left the receiver = 18.081 kg\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.65 Page no :213" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "cp = 1.; \t\t\t#kJ/kg.K\n", + "cv = 0.711; \t\t\t#kJ/kg.K\n", + "V1 = 1.6; \t\t\t#m**3\n", + "V2 = V1;\n", + "p1 = 5.*10**5; \t\t\t#Pa\n", + "T1 = 373.; \t\t\t#K\n", + "p2 = 1.*10**5; \t\t\t#Pa\n", + "R = 287.;\n", + "y = 1.4;\n", + "\n", + "# Calculations\n", + "m1 = round(p1*V1/R/T1,2);\n", + "T2 = round(T1*(p2/p1)**((y-1)/y),2);\n", + "m2 = round(p2*V2/R/T2,3);\n", + "KE = (m1*cv*T1)-(m2*cv*T2)-(m1-m2)*cp*T2;\n", + "\n", + "# Results\n", + "print \"Kinetic energy of discharge air = %.3f\"% (KE), (\"kJ\")\n", + "print (\"This is the exact answer when using proper value of cv\")\n", + "\n", + "# Book answer is wrong." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Kinetic energy of discharge air = 382.910 kJ\n", + "This is the exact answer when using proper value of cv\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.66 Page no :214" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#For oxygen\n", + "import math \n", + "\n", + "# Variables\n", + "cpa = 0.88; \t\t\t#kJ/kg K\n", + "Ra = 0.24; \t\t\t#kJ/kg K\n", + "V1a = 0.035; \t\t\t#m**3\n", + "p1a = 4.5; \t\t\t#bar\n", + "T1a = 333.; \t\t\t#K\n", + "V2a = 0.07; \t\t\t#m**3\n", + "\n", + "#For methane\n", + "V1b = 0.07; \t\t\t#m**3\n", + "V2b = 0.035; \t\t\t#m**3\n", + "p1b = 4.5; \t\t\t#bar\n", + "T1b = 261; \t\t\t#K\n", + "cpb = 1.92; \t\t\t#kJ/kg K\n", + "Rb = 0.496; \t\t\t#kJ/kg K\n", + "\n", + "# Calculations and Results\n", + "yb = cpb/(cpb-Rb); \t\t\t#for methane\n", + "cva = cpa-Ra; \t\t\t#for oxygen\n", + "\n", + "print (\"(i) Final state condition\")\n", + "\n", + "p2b = p1b*(V1b/V2b)**yb;\n", + "print (\"p2 for methane = %.3f\")% (p2b), (\"bar\")\n", + "\n", + "T2b = p2b*V2b*T1b/p1b/V1b;\n", + "print (\"T2 for methane = %.3f\")% (T2b), (\"K\")\n", + "\n", + "p2a = p2b;\n", + "\n", + "T2a = p2a*V2a/p1a/V1a*T1a;\n", + "print (\"T2 for oxygen = %.3f\")% (T2a), (\"K\")\n", + "\n", + "Wb = (p1b*V1b - p2b*V2b)/(yb-1)*100; \t\t\t#kJ\n", + "\n", + "print (\"(ii)The piston will be in virtual equilibrium and hence zero work is effected by the piston.\")\n", + "\n", + "Wa = -Wb;\n", + "\n", + "ma = p1a*V1a/Ra/T1a*10**2;\n", + "\n", + "Q = ma*cva*(T2a-T1a) + Wa;\n", + "print \"(iii) Heat transferred to oxygen = %.3f\"% (Q), (\"kJ\")\n", + "\n", + "# Rouding error is there." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Final state condition\n", + "p2 for methane = 11.458 bar\n", + "T2 for methane = 332.272 K\n", + "T2 for oxygen = 1695.733 K\n", + "(ii)The piston will be in virtual equilibrium and hence zero work is effected by the piston.\n", + "(iii) Heat transferred to oxygen = 196.572 kJ\n" + ] + } + ], + "prompt_number": 4 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Industrial_Instrumentation/.ipynb_checkpoints/ch5-checkpoint.ipynb b/Industrial_Instrumentation/.ipynb_checkpoints/ch5-checkpoint.ipynb new file mode 100644 index 00000000..66f7a8b4 --- /dev/null +++ b/Industrial_Instrumentation/.ipynb_checkpoints/ch5-checkpoint.ipynb @@ -0,0 +1,2600 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:12efbfeaa3ed3ebbe140abe577bbac08dcae30fc36caa52e184adf21fd445870" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Chapter 5 : Second Law of Thermodynamics and Entropy" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.1 Page no : 237" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "Q1 = 1500./60; \t\t#kJ/s\n", + "W = 8.2; \t\t\t#kW\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) Thermal efficiency\")\n", + "n = W/Q1;\n", + "print (\"n = \"),(n)\n", + "\n", + "print (\"(ii) Rate of heat rejection\")\n", + "Q2 = Q1-W; \n", + "print (\"Q2 = \"),(Q2), (\"kW\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Thermal efficiency\n", + "n = 0.328\n", + "(ii) Rate of heat rejection\n", + "Q2 = 16.8 kW\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.2 Page no : 238" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "Q_12 = 30.; \t\t#kJ\n", + "W_12 = 60; \t\t\t#kJ\n", + "\n", + "# Calculations\n", + "dU_12 = Q_12-W_12;\n", + "Q_21 = 0;\n", + "W_21 = Q_21+dU_12;\n", + "\n", + "# Results\n", + "print (\"W_21 = \"),(W_21)\n", + "print (\"Thus 30 kJ work has to be done on the system to restore it to original state, by adiabatic process.\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "W_21 = -30.0\n", + "Thus 30 kJ work has to be done on the system to restore it to original state, by adiabatic process.\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.3 Page no : 239" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "Q2 = 12000.; \t\t\t#kJ/h\n", + "W = 0.75*60*60; \t\t#kJ/h\n", + "\n", + "# Calculations and Results\n", + "COP = Q2/W;\n", + "print (\"Coefficient of performance %.3f\")%(COP)\n", + "\n", + "Q1 = Q2+W;\n", + "print (\"heat transfer rate = %.3f\")%(Q1), (\"kJ/h\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Coefficient of performance 4.444\n", + "heat transfer rate = 14700.000 kJ/h\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.4 Page no : 239" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "T2 = 261.; \t\t\t#K\n", + "T1 = 308.; \t\t\t#K\n", + "Q2 = 2.; \t\t\t#kJ/s\n", + "\n", + "# Calculations\n", + "Q1 = Q2*(T1/T2);\n", + "W = Q1-Q2;\n", + "\n", + "# Results\n", + "print (\"Least power required to pump the heat continuosly %.3f\")%(W),(\"kW\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Least power required to pump the heat continuosly 0.360 kW\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.5 Page no :239" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "\n", + "# Variables\n", + "Q1 = 2*10**5; \t\t\t#kJ/h\n", + "W = 3*10**4; \t\t\t#kJ/h\n", + "\n", + "# Calculations and Results\n", + "Q2 = Q1-W;\n", + "print (\"Heat abstracted from outside = \"),(Q2), (\"kJ/h\")\n", + "\n", + "\n", + "COP_hp = Q1/(Q1-Q2);\n", + "print (\"Co-efficient of performance = %.2f\")%(COP_hp)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat abstracted from outside = 170000 kJ/h\n", + "Co-efficient of performance = 6.00\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.6 Page no : 240" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "T1 = 2373; \t\t\t#K\n", + "T2 = 288.; \t\t\t#K\n", + "\n", + "# Calculations\n", + "n_max = 1-T2/T1;\n", + "\n", + "# Results\n", + "print (\"Highest possible theoritical efficiency = %.3f\")% (n_max*100), (\"%\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Highest possible theoritical efficiency = 87.863 %\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.7 Page no : 240" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "T1 = 523.; \t\t\t#K\n", + "T2 = 258.; \t\t\t#K\n", + "Q1 = 90.; \t\t\t#kJ\n", + "\n", + "# Calculations and Results\n", + "n = 1-T2/T1;\n", + "print (\"(i) Efficiency of the system %.3f\")%(n*100), (\"%\")\n", + "\n", + "W = n*Q1;\n", + "print (\"(ii) The net work transfer\"),(\"W = %.3f\")%(W),(\"kJ\")\n", + " \n", + "Q2 = Q1-W;\n", + "print (\"(iii) Heat rejected to the math.sink\"),(\"Q2 = %.3f\")%(Q2),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Efficiency of the system 50.669 %\n", + "(ii) The net work transfer W = 45.602 kJ\n", + "(iii) Heat rejected to the math.sink Q2 = 44.398 kJ\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.8 Page no : 241" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "T1 = 1023.; \t\t#K\n", + "T2 = 298.; \t\t\t#K\n", + "\n", + "# Calculations\n", + "n_carnot = 1-T2/T1;\n", + "W = 75*1000*60*60;\n", + "Q = 3.9*74500*1000;\n", + "n_thermal = W/Q;\n", + "\n", + "# Results\n", + "print (\"n_carnot = %.3f\")%(n_carnot)\n", + "\n", + "print (\"n_thermal = %.3f\")%(n_thermal)\n", + "\n", + "print (\"Since \u03b7thermal > \u03b7carnot, therefore claim of the inventor is not valid (or possible)\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n_carnot = 0.709\n", + "n_thermal = 0.929\n", + "Since \u03b7thermal > \u03b7carnot, therefore claim of the inventor is not valid (or possible)\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.9 Page no : 241" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T1 = 1273.; \t\t#K\n", + "T2 = 313.; \t\t\t#K\n", + "n_max = 1-T2/T1;\n", + "Wnet = 1.;\n", + "\n", + "# Calculations\n", + "Q1 = Wnet/n_max;\n", + "Q2 = Q1-Wnet;\n", + "\n", + "# Results\n", + "print (\"the least rate of heat rejection = %.3f\")%(Q2), (\"kW\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the least rate of heat rejection = 0.326 kW\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.10 Page no : 242" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "one_ton_of_refrigeration = 210.; \t\t\t#kJ/min\n", + "Cooling_required = 40*(one_ton_of_refrigeration); \t\t\t#kJ/min\n", + "T1 = 303.; \t\t\t#K\n", + "T2 = 238.; \t\t\t#K\n", + "\n", + "# Calculations\n", + "COP_refrigerator = T2/(T1-T2);\n", + "COP_actual = 0.20*COP_refrigerator;\n", + "W = Cooling_required/COP_actual/60;\n", + "\n", + "# Results\n", + "print (\"power required = %.1f\")% (W), (\"kW\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "power required = 191.2 kW\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.11 Page no : 242" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "E = 12000.; \t\t#kJ/min\n", + "T2 = 308.; \t\t\t#K\n", + "# Source 1\n", + "T1 = 593.; \t\t\t#K\n", + "\n", + "# Calculations\n", + "n1 = 1-T2/T1;\n", + "# Source 2\n", + "T1 = 343.; \t\t\t#K\n", + "n2 = 1-T2/T1;\n", + "W1 = E*n1;\n", + "\n", + "# Results\n", + "print (\"W1 = %.3f\")% (W1),(\"kJ/min\")\n", + "\n", + "W2 = E*n2;\n", + "print (\"W2 = %.3f\")% (W2),(\"kJ/min\")\n", + "\n", + "print (\"Thus, choose source 2.\")\n", + "print (\"The source 2 is selected even though efficiency in this case is lower, because the criterion for selection is the larger output.\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "W1 = 5767.285 kJ/min\n", + "W2 = 1224.490 kJ/min\n", + "Thus, choose source 2.\n", + "The source 2 is selected even though efficiency in this case is lower, because the criterion for selection is the larger output.\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 5.12 Page no : 243" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "# Variables\n", + "T1 = 973.; \t\t\t#K\n", + "T2 = 323.; \t\t\t#K\n", + "T3 = 248.; \t\t\t#K\n", + "\n", + "Q1 = 2500.; \t\t\t#kJ\n", + "W = 400.; \t\t\t#kJ\n", + "\n", + "# Calculations and Results\n", + "n_max = 1-T2/T1;\n", + "W1 = n_max*Q1;\n", + "COP_max = T3/(T2-T3);\n", + "W2 = W1-W;\n", + "Q4 = COP_max*W2;\n", + "COP1 = round(Q4/W2,3);\n", + "Q3 = Q4+W2;\n", + "Q2 = Q1-W1;\n", + "print (\"Heat rejection to the 50\u00b0C reservoir = %.3f\")%(Q2+Q3), (\"kJ\")\n", + "\n", + "\n", + "n = 0.45*n_max;\n", + "W1 = n*Q1;\n", + "W2 = W1-W;\n", + "COP2 = 0.45*COP1;\n", + "Q4 = W2*COP2;\n", + "Q3 = Q4+W2;\n", + "Q2 = Q1-W1;\n", + "\n", + "print (\"Heat rejected to 50\u00b0C reservoir = %.3f\")% (Q2+Q3), (\"kJ\")\n", + "\n", + "# Note : Answers are slightly different then book because of Rounding Error." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat rejection to the 50\u00b0C reservoir = 6299.773 kJ\n", + "Heat rejected to 50\u00b0C reservoir = 2623.147 kJ\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.13 Page no : 244" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T1 = 298.; \t\t\t#K\n", + "T2 = 273.; \t\t\t#K\n", + "Q1 = 24.; \t\t\t#kJ/s\n", + "T3 = 653.; \t\t\t#K\n", + "\n", + "# Calculations and Results\n", + "COP = T1/(T1-T2);\n", + "print (\"(i) determine COP and work input required\")\n", + "\n", + "print (\"Coefficient of performance = \"),(COP)\n", + "\n", + "COP_ref = T2/(T1-T2);\n", + "W = Q1/COP_ref;\n", + "print (\"Work input required = %.3f\")%(W),(\"kW\")\n", + "\n", + " \n", + "Q4 = T1*W/(T3-T1);\n", + "Q3 = Q4+W;\n", + "Q2 = Q1+W;\n", + "COP = Q1/Q3;\n", + "print (\"(ii)Determine overall COP of the system \"),(\"COP = %.3f\")%(COP)\n", + "\n", + "COP_overall = (Q2+Q4)/Q3;\n", + "print (\"Overall COP = %.3f\")%(COP_overall)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) determine COP and work input required\n", + "Coefficient of performance = 11.92\n", + "Work input required = 2.198 kW\n", + "(ii)Determine overall COP of the system COP = 5.937\n", + "Overall COP = 6.937\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.14 Page no : 245" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "T_e1 = 493.; \t\t\t#K\n", + "T_e2 = 298.; \t\t\t#K\n", + "T_p1 = 298.; \t\t\t#K\n", + "T_p2 = 273.; \t\t\t#K\n", + "Amt = 15.; \t\t \t#tonnes produced per day\n", + "h = 334.5; \t\t\t #kJ/kg\n", + "Q_abs = 44500.; \t\t#kJ/kg\n", + "\n", + "# Calculations and Results\n", + "Q_p2 = Amt*10**3*h/24/60;\n", + "COP_hp = T_p2/(T_p1-T_p2);\n", + "W = Q_p2/COP_hp/60;\n", + "print (\"(i)Power developed by the engine = %.3f\")%(W),(\"kW\")\n", + "\n", + "print (\"(ii) Fuel consumed per hour\")\n", + "n_carnot = 1-(T_e2/T_e1);\n", + "Q_e1 = W/n_carnot*3600; \t\t\t#kJ/h\n", + "fuel_consumed = Q_e1/Q_abs;\n", + "print (\"Quantity of fuel consumed/hour = %.3f\")%(fuel_consumed),(\"kg/h\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i)Power developed by the engine = 5.318 kW\n", + "(ii) Fuel consumed per hour\n", + "Quantity of fuel consumed/hour = 1.088 kg/h\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.15 Page no : 247" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "T1 = 550.; \t\t\t#K\n", + "T3 = 350.; \t\t\t#K\n", + "\n", + "# Calculations\n", + "T2 = (T1+T3)/2;\n", + "\n", + "# Results\n", + "print (\"Intermediate temperature = \"), (T2),(\"K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Intermediate temperature = 450.0 K\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.16 Page no : 247" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T1 = 600.; \t\t\t#K\n", + "T2 = 300.; \t\t\t#K\n", + "\n", + "# Calculations and Results\n", + "T3 = 2*T1/(T1/T2+1);\n", + "print (\"(i) When Q1 = Q2\"),(\"T3 = \"),(T3),(\"K\")\n", + "\n", + "\n", + "print (\"(ii) Efficiency of Carnot engine and COP of carnot refrigerator\")\n", + "n = (T1-T3)/T1; \t\t\t#carnot engine\n", + "COP = T2/(T3-T2); \t\t\t#refrigerator\n", + "\n", + "print (\"Efficiency of carnot engine = %.3f\")% (n)\n", + "\n", + "print (\"COP of carnot refrigerator = \"), (COP)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) When Q1 = Q2 T3 = 400.0 K\n", + "(ii) Efficiency of Carnot engine and COP of carnot refrigerator\n", + "Efficiency of carnot engine = 0.333\n", + "COP of carnot refrigerator = 3.0\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.17 Page no : 249" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T3 = 278.; \t\t\t#K\n", + "T2 = 350.; \t\t\t#K\n", + "T4 = T2;\n", + "T1 = 1350.; \t\t\t#K\n", + "\n", + "# Calculations\n", + "Q1 = 100/(((T4/T1)*(T1-T2)/(T4-T3))+T2/T1) \t#Q4+Q2 = 100; Q4 = Q1*((T4/T1)*(T1-T2)/(T4-T3)); Q2 = T2/T1*Q1;\n", + "\n", + "# Results\n", + "print (\"Q1 = %.3f\")%(Q1),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Q1 = 25.906 kJ\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.18 Page no : 250" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "Q1 = 300.; \t\t\t#kJ/s\n", + "T1 = 290.; \t\t\t#0C\n", + "T2 = 8.5; \t\t\t#0C\n", + "\n", + "# Calculations and Results\n", + "print (\"let \u03a3dQ/T = A\")\n", + "\n", + "print (\"(i) 215 kJ/s are rejected\")\n", + "Q2 = 215.; \t\t\t#kJ/s\n", + "A = Q1/(T1+273) - Q2/(T2+273)\n", + "print (\"Since, A<0, Cycle is irreversible.\")\n", + "\n", + "\n", + "print (\"(ii) 150 kJ/s are rejected\")\n", + "Q2 = 150; \t\t\t#kJ/s\n", + "A = Q1/(T1+273) - Q2/(T2+273)\n", + "print (\"Since A = 0, cycle is reversible\")\n", + "\n", + "\n", + "print (\"(iii) 75 kJ/s are rejected.\")\n", + "Q2 = 75; \t\t\t#kJ/s\n", + "A = Q1/(T1+273) - Q2/(T2+273)\n", + "print (\"Since A>0, cycle is impossible\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "let \u03a3dQ/T = A\n", + "(i) 215 kJ/s are rejected\n", + "Since, A<0, Cycle is irreversible.\n", + "(ii) 150 kJ/s are rejected\n", + "Since A = 0, cycle is reversible\n", + "(iii) 75 kJ/s are rejected.\n", + "Since A>0, cycle is impossible\n" + ] + } + ], + "prompt_number": 65 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.19 Page no : 251" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "P1 = 0.124*10**5; \t\t\t#N/m**2\n", + "T1 = 433; \t\t\t#K\n", + "T2 = 323; \t\t\t#K\n", + "h_f1 = 687; \t\t\t#kJ/kg\n", + "h2 = 2760; \t\t\t#kJ/kg\n", + "h3 = 2160; \t\t\t#kJ/kg\n", + "h_f4 = 209; \t\t\t#kJ/kg\n", + "\n", + "# Calculations and Results\n", + "Q1 = h2-h_f1;\n", + "Q2 = h_f4-h3;\n", + "print (\"Let A = \u03a3dQ/T\")\n", + "A = Q1/T1+Q2/T2;\n", + "print (A)\n", + "print (\"A<0. Hence classius inequality is verified\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Let A = \u03a3dQ/T\n", + "-3\n", + "A<0. Hence classius inequality is verified\n" + ] + } + ], + "prompt_number": 66 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.20 Page no :251" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "T1 = 437.; \t\t\t#K\n", + "T2 = 324.; \t \t\t#K\n", + "h2 = 2760.; \t\t\t#kJ/kg\n", + "h1 = 690.; \t\t \t#kJ/kg\n", + "h3 = 2360.; \t\t\t#kJ/kg\n", + "h4 = 450.; \t\t\t #kJkg\n", + "\n", + "# Calculations\n", + "Q1 = h2-h1;\n", + "Q2 = h4-h3;\n", + "\n", + "# Results\n", + "print (\"Let A = \u03a3dQ/T\")\n", + "A = Q1/T1 + Q2/T2;\n", + "print \"%.3f\"%(A)\n", + "print (\"Since A<0, Classius inequality is verified\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Let A = \u03a3dQ/T\n", + "-1.158\n", + "Since A<0, Classius inequality is verified\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.21 Page no : 266" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "T0 = 273.; \t\t\t#K\n", + "T1 = 673.; \t\t\t#K\n", + "T2 = 298.; \t\t\t#K\n", + "m_w = 10.; \t\t\t#kg\n", + "T3 = 323.; \t\t\t#K\n", + "c_pw = 4186.; \t\t#kJ/kg.K\n", + "\n", + "# Calculations and Results\n", + "print (\"Let C = mi*cpi\")\n", + "C = m_w*c_pw*(T3-T2)/(T1-T3);\n", + "S_iT1 = C*math.log(T1/T0); \t\t\t# Entropy of iron at 673 K\n", + "S_wT2 = m_w*c_pw*math.log(T2/T0); \t#Entropy of water at 298 K\n", + "S_iT3 = C*math.log(T3/T0); \t\t\t#Entropy of iron at 323 K\n", + "S_wT3 = m_w*c_pw*math.log(T3/T0); \t#Entropy of water at 323 K\n", + "\n", + "dS_i = S_iT3 - S_iT1;\n", + "dS_w = S_wT3 - S_wT2; \n", + "dS_net = dS_i + dS_w\n", + "\n", + "print (\"Since dS>0, process is irreversible\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Let C = mi*cpi\n", + "Since dS>0, process is irreversible\n" + ] + } + ], + "prompt_number": 68 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.23 Page no : 267" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "T1 = 293.; \t\t\t#K\n", + "V1 = 0.025; \t\t\t#m**3\n", + "V3 = V1;\n", + "p1 = 1.05*10**5; \t\t\t#N/m**2\n", + "p2 = 4.5*10**5; \t\t\t#N/m**2\n", + "R = 0.287*10**3; \n", + "cv = 0.718;\n", + "cp = 1.005;\n", + "T3 = 293.; \t\t\t#K\n", + "\n", + "# Calculations and Results\n", + "m = p1*V1/R/T1;\n", + "T2 = p2/p1*T1;\n", + "Q_12 = m*cv*(T2-T1);\n", + "Q_23 = m*cp*(T3-T2)\n", + "\n", + "Q_net = Q_12+Q_23;\n", + "print (\"Net heat flow = \"),(Q_net), (\"kJ\")\n", + "\n", + "\n", + "dS_32 = m*cp*math.log(T2/T1);\n", + "dS_12 = m*cv*math.log(T2/T1);\n", + "dS_31 = dS_32 - dS_12;\n", + "print (\"Decrease in entropy = %.3f\")% (dS_31), (\"kJ/K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Net heat flow = -8.625 kJ\n", + "Decrease in entropy = 0.013 kJ/K\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.24 Page no : 269" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "%pylab inline\n", + "\n", + "from matplotlib.pyplot import *\n", + "from numpy import *\n", + "import math \n", + "\n", + "# Variables\n", + "p1 = 1.05*10**5; \t#N/m**2\n", + "V1 = 0.04; \t\t\t#m**3\n", + "T1 = 288.; \t\t\t#K\n", + "p2 = 4.8*10**5;\n", + "T2 = T1;\n", + "R0 = 8314.;\n", + "M = 28.;\n", + "\n", + "# Calculations and Results\n", + "R = R0/M;\n", + "m = p1*V1/R/T1;\n", + "dS = m*R*math.log(p1/p2)\n", + "print (\"Decrease in entropy = %.3f\")% (-dS), (\"J/K\")\n", + "\n", + "\n", + "print \n", + "Q = T1*(-dS);\n", + "print (\"(ii)Heat rejected = \"),(\"Q = %.3f\")%(Q),(\"J\")\n", + "\n", + "\n", + "W = Q;\n", + "print (\"Work done = %.3f\")% (W), (\"J\")\n", + "\n", + "V2 = p1*V1/p2;\n", + "v1 = V1/m; \t\t\t#specific volume\n", + "v2 = V2/m; \t\t\t#specific volume\n", + "\n", + "v = linspace(v2,0.8081571,64);\n", + "\n", + "\n", + "def f(v):\n", + " return p1*v1/v\n", + "plot(v,f(v))\n", + "\n", + "p = []\n", + "for i in range(len(v)):\n", + " p.append(p1)\n", + "plot(v,p,'--')\n", + "\n", + "p = [0 ,p2]\n", + "v = [v2 ,v2]\n", + "plot(v,p,'--')\n", + "\n", + "p = [0 ,p1]\n", + "v = [v1 ,v1]\n", + "plot(v,p,'--')\n", + "\n", + "T = [288, 288]\n", + "s = [10 ,(10-dS)]\n", + "plot(s,T)\n", + "\n", + "s = [10 ,10]\n", + "T = [0 ,288]\n", + "plot(s,T,'--')\n", + "\n", + "s = [(10-dS), (10-dS)]\n", + "T = [0 ,288]\n", + "plot(s,T,'--')\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Populating the interactive namespace from numpy and matplotlib\n", + "Decrease in entropy = 22.164 J/K\n", + "\n", + "(ii)Heat rejected = Q = 6383.268 J\n", + "Work done = 6383.268 J\n" + ] + }, + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 13, + "text": [ + "[]" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEACAYAAABCl1qQAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHfdJREFUeJzt3W9MVHe+P/D3zOhW7WivBQYtw5WWtgrHGZnVatTa0ApB\nIMX+sYG0sInuJv3tXQrbB31w22wZ2m39bdst16ybjblZrC7t3frbYtwUOpHdltjU24mirtrNvdla\nhTljlQGkjFL+OZ/fA2UWVBiwnB7m6/uVzAPPzJm8zxkzb77nz3csIiIgIiIah9XsAERENP2xLIiI\nKCaWBRERxcSyICKimFgWREQUE8uCiIhimlBZpKWlwe12w+PxYOXKlQCArq4u5Obmwu12Iy8vD93d\n3dHXb926FZmZmXC5XNi/f390eUtLCzweDzRNQ2VlZXR5f38/iouL4XK5sHbtWrS2tkaf27VrFzRN\ng6Zp2L1793feYCIiugkyAWlpadLZ2TlqWXl5udTU1IiISE1NjVRUVIiIyOHDh2XFihUyNDQkuq5L\nWlqaDAwMiIiIy+WSI0eOiIjIxo0bpb6+XkRE3nrrLamsrBQRkb1790pRUZGIiJw9e1bS09MlHA5L\nOByW9PR0OXfu3EQiExHRFJrwYSi55t69xsZGlJWVAQBKS0vR0NAAAGhoaEBJSQlsNhtSUlKgaRr8\nfj/a2toQiUTg8XiuW2fkexUVFeHgwYOIRCJoampCfn4+7HY77HY7NmzYgKampu/ekERENCkTKguL\nxRI95LR9+3YAQCgUQkJCAgAgMTER7e3tAIBgMAin0xld1+l0Qtd1BINBpKamRpenpKRA13UAgK7r\n0eesVisSEhLQ3t4+5nsREdH3a8ZEXvT555/D4XAgFAphw4YNWLJkidG5iIhoGplQWTgcDgBAUlIS\nNm3ahEOHDiEpKQkdHR1ITExEKBSKvsbpdCIQCETXHR41jLV8eJ22tjY4HA5EI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72s5/h1KlT+Pvf\n/4709HRUVFSYHSmmixcvYtOmTdi2bRvmzZtndpxJu3jxIp566ils27YNc+fOjavPwGq14tixY9B1\nHQcOHMAnn3xidqQJuzZ7c3PzpPd93JaF0+lEIBCI/jsQCIwaacQDh8MBAEhKSsKmTZtw6NAhkxNN\nTlJSEjo6OgBcGWUMb0+8SExMhMVigcViwbPPPjvt9//g4CCefPJJPPPMM3jssccAxNdnMJz/6aef\njuaPt88AAO644w4UFhbC7/fH1f4H/pn9888/n/S+j9uyeOCBB3Dy5EkEg0EMDg5iz549yM/PNzvW\nhPX29qK3txcAcOnSJfh8PmiaZnKqySkoKEBdXR0AoK6uDgUFBSYnmpyRhww++OCDab3/RQQ//vGP\nkZmZGb2aBYifz2Cs/PHyGXR2diIcDgMAvv32WzQ1NcHlcsXF/h8reygUir5mQvt+6s+7f38aGxtF\n0zTJyMiQ119/3ew4k/LVV1+J2+2WZcuWyX333Se/+MUvzI40rpKSElm4cKHMnDlTnE6n1NbWSmdn\np+Tk5IjL5ZLc3Fy5cOGC2THHdG3+3//+91JaWiput1uWLFkieXl5ouu62THH9Omnn4rFYpFly5ZJ\nVlaWZGVlyUcffRQ3n8GN8jc2NsbNZ3D8+HHJysqSZcuWyeLFi6W6ulpEJC72/1jZJ7vveVMeERHF\nFLeHoYiI6PvDsiAiophYFkREFBPLgoiIYmJZEBFRTCwLIiKKiWVBREQxsSyIiCim/w93T0cbP4g9\nZgAAAABJRU5ErkJggg==\n", + "text": [ + "" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.25 Page no : 270" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "R = 287.; \t\t\t#kJ/kg.K\n", + "dU = 0;\n", + "W = 0;\n", + "Q = dU+W;\n", + "\n", + "# Calculations\n", + "dS = R*math.log(2); \t\t\t#v2/v1 = 2\n", + "\n", + "# Results\n", + "print (\"Change in entropy = %.3f\")%(dS),(\"kJ/kg.K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Change in entropy = 198.933 kJ/kg.K\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.26 Page no : 271" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "m = 0.04; \t\t\t#kg\n", + "p1 = 1*10.**5; \t\t\t#N/m**2\n", + "T1 = 293.; \t\t\t#K\n", + "p2 = 9*10.**5; \t\t\t#N/m**2\n", + "V2 = 0.003; \t\t\t#m**3\n", + "cp = 0.88; \t\t\t#kJ/kg.K\n", + "R0 = 8314.;\n", + "M = 44.;\n", + "\n", + "# Calculations\n", + "R = R0/M;\n", + "T2 = p2*V2/m/R;\n", + "ds_2A = R/10**3*math.log(p2/p1);\n", + "ds_1A = cp*math.log(T2/T1);\n", + "ds_21 = ds_2A - ds_1A;\n", + "dS_21 = m*ds_21;\n", + "\n", + "# Results\n", + "print (\"Decrease in entropy = %.3f\")% (dS_21),(\"kJ/K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Decrease in entropy = 0.010 kJ/K\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.27 Page no : 272" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "# Variables\n", + "p1 = 7.*10**5; \t\t\t#N/m**2\n", + "T1 = 873.; \t\t\t#K\n", + "p2 = 1.05*10**5; \t\t\t#N/M62\n", + "n = 1.25;\n", + "m = 1.; \t\t\t#kg\n", + "R = 0.287;\n", + "cp = 1.005;\n", + "\n", + "# Calculations\n", + "T2 = T1*(p2/p1)**((n-1)/n);\n", + "\n", + "# At constant temperature from 1 to A\n", + "ds_1A = R*math.log(p1/p2);\n", + "# At constant pressure from A to 2\n", + "ds_2A = cp*math.log(T1/T2);\n", + "ds_12 = ds_1A - ds_2A;\n", + "\n", + "# Results\n", + "print (\"Increase in entropy = %.3f\")% (ds_12), (\"kJ/kg.K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Increase in entropy = 0.163 kJ/kg.K\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.28 Page no : 274" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "p1 = 7*10**5; \t\t#Pa\n", + "T1 = 733.; \t\t\t#K\n", + "p2 = 1.012*10**5; \t#Pa\n", + "T2a = 433.; \t\t#K\n", + "y = 1.4;\n", + "cp = 1.005;\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) To prove that the process is irreversible\")\n", + "T2 = T1*(p2/p1)**((y-1)/y);\n", + "print (\"T2 = %.3f\")% (T2)\n", + "print (\"But the actual temperature is 433K at th epressure of 1.012 bar, Hence the process is irreversible. Proved.\")\n", + "\n", + "\n", + "print (\"(ii) Change of entropy per kg of air\")\n", + "ds = cp*math.log(T2a/T2);\n", + "print (\"Increase of entropy = %.3f\")% (ds), (\"kJ/kg.K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) To prove that the process is irreversible\n", + "T2 = 421.820\n", + "But the actual temperature is 433K at th epressure of 1.012 bar, Hence the process is irreversible. Proved.\n", + "(ii) Change of entropy per kg of air\n", + "Increase of entropy = 0.026 kJ/kg.K\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.29 Page no : 275" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "V1 = 0.3; \t\t\t#m**3\n", + "p1 = 4*10**5; \t\t#N/m**2\n", + "V2 = 0.08; \t\t\t#m**3\n", + "n = 1.25; \n", + "\n", + "# Calculations and Results\n", + "p2 = p1*(V1/V2)**n;\n", + "\n", + "dH = n*(p2*V2-p1*V1)/(n-1)/10**3;\n", + "print (\"(i) Change in enthalpy\"), (\"dH = %.3f\")% (dH), (\"kJ\")\n", + "\n", + "dU = dH-(p2*V2 - p1*V1)/10**3;\n", + "print (\"(ii) Change in internal energy\"),(\"dU = %.3f\")% (dU), (\"kJ\")\n", + "\n", + "dS = 0;\n", + "print (\"(iii) Change in entropy\"),(\"dS\"), (dS)\n", + "\n", + "Q = 0;\n", + "print (\"(iv)Heat transfer\"),(\"Q = \"), (Q)\n", + "\n", + "W = Q-dU;\n", + "print (\"(v) Work transfer\"),(\"W = %.3f\")%(W),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Change in enthalpy dH = 234.947 kJ\n", + "(ii) Change in internal energy dU = 187.958 kJ\n", + "(iii) Change in entropy dS 0\n", + "(iv)Heat transfer Q = 0\n", + "(v) Work transfer W = -187.958 kJ\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.30 Page no : 277" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "m = 20.; \t\t\t#kg\n", + "p1 = 4.*10**5; \t\t\t#Pa\n", + "p2 = 8.*10**5; \t\t\t#Pa\n", + "V1 = 4.; \t\t\t#m**3\n", + "V2 = V1;\n", + "cp = 1.04; \t\t\t#kJ/kg.K\n", + "cv = 0.7432; \t\t\t#kJ/kg.K\n", + "R = cp-cv;\n", + "T1 = p1*V1/R/1000.; \t\t\t#kg.K; T = mass*temperature\n", + "T2 = p2*V2/R/1000.; \t\t\t#kg.K\n", + "\n", + "# Calculations and Results\n", + "dU = cv*(T2-T1);\n", + "print (\"(i) Change in internal energy\"),(\"dU = %.3f\")% (dU), (\"kJ\")\n", + "\n", + "Q = 0;\n", + "W = Q-dU;\n", + "print (\"(ii) Work done\"),(\"W %.3f\")% (W), (\"kJ\")\n", + "\n", + "print (\"(iii) Heat transferred = \"), (Q)\n", + "\n", + "dS = m*cv*math.log(T2/T1);\n", + "print (\"(iv) Change in entropy = %.3f\")%(dS), (\"kJ/K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Change in internal energy dU = 4006.469 kJ\n", + "(ii) Work done W -4006.469 kJ\n", + "(iii) Heat transferred = 0\n", + "(iv) Change in entropy = 10.303 kJ/K\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.31 Page no : 278" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from matplotlib.pyplot import *\n", + "%pylab inline\n", + "\n", + "# Variables\n", + "V1 = 5.; \t\t\t#m**3\n", + "p1 = 2.*10**5; \t\t\t#Pa\n", + "T1 = 300.; \t\t\t#K\n", + "p2 = 6.*10**5; \t\t\t#Pa\n", + "p3 = 2.*10**5; \t\t\t#Pa\n", + "R = 287.;\n", + "n = 1.3;\n", + "y = 1.4;\n", + "\n", + "# Calculations and Results\n", + "m = p1*V1/R/T1;\n", + "T2 = T1*(p2/p1)**((n-1)/n);\n", + "T3 = T2*(p3/p2)**((y-1)/y);\n", + "W_12 = m*R*(T1-T2)/(n-1)/1000; \t\t\t#polytropic compression\n", + "W_23 = m*R*(T2-T3)/(y-1)/1000; \t\t\t#Adiabatic expansion\n", + "\n", + "\n", + "W_net = W_12+W_23;\n", + "print (\"Net work done on the air = %.3f\")%(-W_net), (\"kJ\")\n", + "\n", + "T = [T1, 310, 320, 330, 340, 350, 360, 370, 380, T2];\n", + "def f(T):\n", + " return (y-n)/(y-1)/(1-n)*R/10**3*math.log(T);\n", + "\n", + "s = [f(T1), f(310), f(320), f(330), f(340), f(350), f(360), f(370), f(380), f(T2)]\n", + "\n", + "plot(s,T)\n", + "\n", + "T = [T2, T3];\n", + "s = [f(T2), f(T2)];\n", + "plot(s,T,'r')\n", + "\n", + "# Answers are slightly diffferent because of rounding error." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Populating the interactive namespace from numpy and matplotlib\n", + "Net work done on the air = 94.023 kJ\n" + ] + }, + { + "output_type": "stream", + "stream": "stderr", + "text": [ + "WARNING: pylab import has clobbered these variables: ['f', 'draw_if_interactive']\n", + "`%pylab --no-import-all` prevents importing * from pylab and numpy\n" + ] + }, + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 9, + "text": [ + "[]" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYEAAAD9CAYAAABazssqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3X1c1fX9//HHITBklWkqLpjRAsWDF2AK2s8KFbQ0SavR\ncPllX21bdrWcadLF0iyhtLVso75u+c22vpHuQqw5B83O7MphGrVJBRWbgMY3S+hC7Ajn/fvjnXy1\nlAvh8OFwnvfb7dzCcz6f83lCel583pcuY4xBRESCUojTAURExDkqAiIiQUxFQEQkiKkIiIgEMRUB\nEZEgpiIgIhLE2lQEmpqaSEpKYsaMGQB8/PHHpKenM2TIEKZMmUJdXV3zsbm5ucTFxREfH09RUZF/\nUouISKdoUxF4+OGHcbvduFwuAPLy8khPT6e8vJzJkyeTl5cHQFlZGc888wxlZWVs2bKF66+/Hp/P\n57/0IiLSIa0WgerqajZv3sy1117LkXllmzZtIjs7G4Ds7Gw2btwIQGFhIVlZWYSFhRETE0NsbCwl\nJSV+jC8iIh3RahFYsGABK1euJ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Tqa/+KLLzZbtmwxxhizefNmk5qa6v/QRznZ/C+++OLXjlm4cKFZvny537J+VUezb926\n1aSlpRmv12uMMeZ///d/W72m35aNiI+Pb+4naEl1dTWbN2/m2muvPabD+PTTT2/++rPPPqN///5+\nyXkiHc2fnp5OSIj98aakpFBdXe23rF/V0extPd9fOpp/06ZNZGdnA5Cdnc3GjRv9lvV42po/IiIC\nAK/XS1NTE3379gWgoqKCCy+8EIC0tDR+//vf+y/scXQ0/4nmEHWVk83fr1+/Y143xrB+/XqysrL8\nkvN4Opr90UcfJScnh7CwMAAGDBjQ6ns5vnbQggULWLlyZfMH5tHuuOMOBg8ezLp161iyZIkD6VrX\nUv4j1q5dy7Rp07owVdu0JXt3dqL8tbW1REZGAhAZGUltba0T8Vrl8/lITEwkMjKSiRMn4na7AUhI\nSKCwsBCADRs2HDParjs5Uf68vDwWLlzI4MGDWbRoEbm5uQ4nPb4T5T/ixRdfJDIykvPOO8+hhCd2\nouwVFRVs27aNcePGkZqaymuvvdbqe3XoX396ejojRoz42uPZZ59t0/nPPfccAwcOJCkp6bjDRu+7\n7z727NnD97//fRYsWNCRqMfl7/xgv4devXoxe/bszozeJdn9qavyu1wuvwxM6Gh+gJCQEEpLS6mu\nrmbbtm3NSxqsXbuW/Px8xowZw2effUavXr0CKv+8efNYvXo1e/bs4aGHHmLu3LkBlf+Ip59+utP/\n3YJ/szc2NnLgwAG2b9/OypUryczMbP3NTr71qm1aatvKyckx0dHRJiYmxgwaNMhERESYOXPmfO24\nf//73yYhIcHfUY+rI/n/+7//21xwwQWmoaGhq+Ieo6M/e6f6BNpy/ZbyDx061Ozbt88YY8zevXvN\n0KFDuyzz0drz87vnnnvMypUrv/b8O++8Y5KTkzs7Wpu0N/+qVauMMcacfvrpzc/7fD5zxhln+CVf\nazry8z98+LCJjIw0NTU1/orXopPNfskllxiPx9P82nnnnWf279/f4vld0g5gTvCb2ooVK6iqqqKy\nspKCggImTZrEk08+CdjbmiMKCwubh6c64WTyb9myhZUrV1JYWEh4eHhXxj3GyWRvy/ld5WTyZ2Rk\nsG7dOgDWrVvXPMHRCSfKv3//furq6gBoaGiguLi4+e/4hx9+CNhb/nvvvZf58+d3TdjjaE/+I2uM\nnWgOkRNO5ucP8PzzzzNs2DDOPvvsLsl5PCeTfebMmWzduhWA8vJyvF4vZ511VqsX8os//OEPJjo6\n2oSHh5vIyEhzySWXGGOMqampMdOmTfva8R6P55gRHldeeaUZPny4GTVqlLniiitMbW2tv6IeV0fz\nx8bGmsGDBzcPNZs/f37AZD/R+V2lo/k/+ugjM3nyZMeGiLYl/xtvvGGSkpLMqFGjzIgRI8wDDzzQ\nfP7DDz9shgwZYoYMGWJycnK6NHtn5N+xY0fzEMZx48aZXbt2BVR+Y4z5/ve/b/7rv/6rS3N3Rnav\n12uuueYaM3z4cDN69GjzwgsvtHpNlzFaw0FEJFgF5rAQERHpFCoCIiJBTEVARCSIqQiIiAQxFQER\nkSCmIiAiEsT+P3S/G55r8UZJAAAAAElFTkSuQmCC\n", + "text": [ + "" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.32 Page no : 279" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "V1 = 0.004; \t\t\t#m**3\n", + "p1 = 1.*10**5; \t\t\t#Pa\n", + "T1 = 300.; \t\t\t#K\n", + "T2 = 400.; \t\t\t#K\n", + "y = 1.4;\n", + "M = 28.;\n", + "R0 = 8.314;\n", + "R = R0/M;\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) The heat supplied\")\n", + "m = p1*V1/R/1000/T1; \t\t\t#kg\n", + "cv = R/(y-1);\n", + "Q = m*cv*(T2-T1);\n", + "print (\"Q %.3f\")%(Q), (\"kJ\")\n", + "\n", + "print (\"(ii) The entropy change\")\n", + "dS = m*cv*math.log(T2/T1);\n", + "print (\"dS = %.8f\")%(dS), (\"kJ/kg.K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) The heat supplied\n", + "Q 0.333 kJ\n", + "(ii) The entropy change\n", + "dS = 0.00095894 kJ/kg.K\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.33 Page no : 279" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "V1 = 0.05; \t\t\t#m**3\n", + "p1 = 1.*10**5; \t\t\t#Pa\n", + "T1 = 280.; \t\t\t#K\n", + "p2 = 5.*10**5; \t\t\t#Pa\n", + "\n", + "# Calculations\n", + "print (\"(i) Change in entropy\")\n", + "R0 = 8.314;\n", + "M = 28.;\n", + "R = R0/M;\n", + "m = p1*V1/R/T1/1000;\n", + "dS = m*R*math.log(p1/p2);\n", + "\n", + "# Results\n", + "print (\"dS = %.3f\")%(dS), (\"kJ/K\")\n", + "\n", + "print (\"(ii)Work done\")\n", + "Q = T1*dS;\n", + "print (\"Q = %.3f\")%(Q),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Change in entropy\n", + "dS = -0.029 kJ/K\n", + "(ii)Work done\n", + "Q = -8.047 kJ\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.34 Page no : 280" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "R = 0.287; \t\t\t#kJ/kg.K\n", + "m = 1.; \t\t\t#kg\n", + "p1 = 8.*10**5; \t\t\t#Pa\n", + "p2 = 1.6*10**5; \t\t\t#Pa\n", + "T1 = 380.; \t\t\t#K\n", + "n = 1.2;\n", + "y = 1.4;\n", + "\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) Final specific volume and temperature\")\n", + "v1 = R*T1/p1*10**3; \t\t\t#m**3/kg\n", + "v2 = v1*(p1/p2)**(1/n);\n", + "T2 = T1*(p2/p1)**((n-1)/n);\n", + "\n", + "print (\"v2 = %.3f\")%(v2), (\"m**3/kg\")\n", + "print (\"T2 = %.3f\")% (T2),(\"K\")\n", + "\n", + "print (\"(ii) Change of internal energy, work done and heat interaction\")\n", + "dU = R/(y-1)*(T2-T1);\n", + "print (\"dU = %.3f\")%(dU), (\"kJ/kg\")\n", + "\n", + "W = R*(T1-T2)/(n-1);\n", + "print (\"W = %.3f\")%(W), (\"kJ/kg\")\n", + "\n", + "Q = dU + W;\n", + "print (\"Q = %.3f\")%(Q),(\"kJ/kg\")\n", + "\n", + "print (\"(iii) Change in entropy\")\n", + "dS = R/(y-1)*math.log(T2/T1) + R*math.log(v2/v1)\n", + "print (\"dS = %.3f\")%(dS),(\"kJ/kg.K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Final specific volume and temperature\n", + "v2 = 0.521 m**3/kg\n", + "T2 = 290.595 K\n", + "(ii) Change of internal energy, work done and heat interaction\n", + "dU = -64.148 kJ/kg\n", + "W = 128.296 kJ/kg\n", + "Q = 64.148 kJ/kg\n", + "(iii) Change in entropy\n", + "dS = 0.192 kJ/kg.K\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.35 Page no : 281" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "%pylab inline\n", + "import math\n", + "from matplotlib.pyplot import *\n", + "\n", + "# Variables\n", + "y = 1.4;\n", + "cv = 0.718; \t\t#kJ/kg.K\n", + "m = 1.; \t\t\t #kg\n", + "T1 = 290.; \t\t\t#K\n", + "n = 1.3;\n", + "r = 16.;\n", + "y = 1.4;\n", + "\n", + "# Calculations and Results\n", + "T2 = T1*(r)**(n-1);\n", + "\n", + "print (\"(a)\")\n", + "\n", + "T = [T1, 300, 310, 320, 330, 340, 350, 360, 370, 380, 390, 400, 410, 420, 430, 440, 450, 460, 470, 480, 490, 500, 510, 520, 530, 540, 550, 560, 570, 580, 590, 600, 610, 620, 630, 640, 650, 660, T2];\n", + "def f(T):\n", + " return (y-n)*cv/(1-n)/10**3*math.log(T);\n", + "\n", + "s = [f(T1),f(300),f(310),f(320),f(330),f(340),f(350),f(360),f(370),f(380),f(390),f(400),f(410),f(420),f(430),f(440),f(450),f(460),f(470),f(480),f(490),f(500),f(510),f(520),f(530),f(540),f(550),f(560),f(570),f(580),f(590),f(600),f(610),f(620),f(630),f(640),f(650),f(660), f(T2)];\n", + "plot(s,T)\n", + "\n", + "T = [0, T2];\n", + "s = [f(T2), f(T2)];\n", + "plot(s,T,'r--')\n", + "\n", + "T = [0 ,T1];\n", + "s = [f(T1),f(T1)];\n", + "plot(s,T,'r--')\n", + "\n", + "T = [T1 ,T2];\n", + "s = [f(T1), f(T2)];\n", + "plot(s,T,'r--' )\n", + "suptitle(\"T-S diagram\")\n", + "xlabel(\"S\")\n", + "ylabel(\"T\")\n", + "text(-0.00150,400,\"pV**n = C\")\n", + "\n", + "print (\"(b)Entropy change\")\n", + "dS = cv*((n-y)/(n-1))*math.log(T2/T1);\n", + "print (\"dS = %.3f\")%(dS), (\"kJ/kg.K\")\n", + "print (\"There is decrease in entropy\")\n", + "\n", + "Q = cv*((y-n)/(n-1))*(T1-T2);\n", + "Tmean = (T1+T2)/2;\n", + "dS_app = Q/Tmean;\n", + "\n", + "error = ((-dS) - (-dS_app))/(-dS) * 100;\n", + "print (\"age error = %.3f\")%(error), (\"%\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Populating the interactive namespace from numpy and matplotlib\n", + "(a)\n", + "(b)Entropy change" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "dS = -0.199 kJ/kg.K\n", + "There is decrease in entropy\n", + "age error = 5.393 %\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAZoAAAEhCAYAAABGC2bVAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlclXX6//EXoOZeJqAFpg2NCwiKC2aSkUUYLpNtYknN\npJXNaJk538rKJX/ptJjaMqMz7VGJpdUk5pglTVai4orlGqaHRj1K7hoC9++Pjx4lNUHOfc4N5/18\nPHgEh/vc93Xujufic9/X5/oEWZZlISIiYpNgfwcgIiLVmxKNiIjYSolGRERspUQjIiK2UqIRERFb\nKdGIiIitavg7AJHK2r17N9deey0A27dvJyQkhLCwMIKCgsjJyaFmzZrs27ePQYMGsWbNGmrVqkX9\n+vX57LPPqFev3hn3+8Ybb5Cbm8uLL77I9OnTqVu3Lunp6b56WSLVhhKNVHmNGzdmxYoVAIwbN44G\nDRowYsSIMts8//zzNG/enPfffx+A/Px8atasWe5j3HvvvV6JtaSkhJCQEK/sS6Sq0KUzqXZONwfZ\n7XZz8cUXe36+9NJLqVWr1inbTZ8+naioKK644gq++eYbz+Njx45l0qRJnm0SEhKIiYmhT58+HDhw\nAIB169bRvn17OnbsyOOPP06DBg0AyM7O5sorr6Rfv37ExcUB0KdPHzp16kTLli154YUXPMepX78+\nDz/8MHFxcSQnJ5OTk0OPHj245JJLmD17thfOjojvKdFIQLjrrruYMGEC3bp1Y9SoUaxfv/6UbbZt\n28b48eNZvnw5X331FevWrSMoKAjA81+AAQMGsGTJEtauXUv79u2ZPn06AMOGDePxxx8nNzeXFi1a\nlNn3ihUreOmll1i7di0A77zzDsuWLWPVqlVMmzYNt9sNwKFDh7j22mtZvXo1DRo0YPTo0Xz++efM\nmTOH0aNH23FqRGynRCMBoWPHjuTn5/PQQw+xd+9eunTpQl5eXpltvv32W6699lrOP/98QkJCuOWW\nW047OsrJyeHyyy+nXbt2vPPOO56ktXjxYm688UYAbr311jLPSUhIICIiwvPzxIkTiY2NpWvXrvz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/8MTExMQBlhtGffPIJv//97730KsvHSeci0N4XQ4YMoaCggPz8fBYt\nWkTLli354osvADyVeBAY74vfOheB9r44ePCg5/9/cXExc+bM8VThndPnRYXu6FTS7t27rWuvvdaK\njY21kpOTrZ9//tmyLMsqKCiwUlNTPdvNnTvXiomJsdq0aVOmYuxMz7csy2revLl14YUXWvXr17ea\nNWtmff/995ZlWdaPP/5ode/e3YqJibESExOt/Px8y7JMhcYtt9xitW3b1uratavncV/x1bmIjIy0\nvv/+e+vgwYNWhw4drHbt2lm///3vrSFDhlhHjx61LMuyHn74YSs2NtaKjo62unXrZuXl5fnoLPz2\na/HHuQiU98XJ/0aOy8/PL1NpFSjvi/Kci0B5Xxz/N7Jjxw6rU6dOVrt27ayWLVtaQ4cOtYqLiy3L\nOrf3hSZsioiIrRzVvVlERKofJRoREbGVEo2IiNhKiUZERGylRCMiIrZSohEREVsp0Yh4wRNPPEGr\nVq1o164d7dq1Iycnx98hiTiGo1bYFKmKsrOz+fzzz8nLy6NmzZrs27ePQ4cO+TssEcdQohGpJLfb\nTVhYGDVr1gSgYcOGNGzY0M9RiTiHOgOIVNK+ffvo1q0bxcXFJCUlcfPNN3PNNdf4OywRx9A9GpFK\natiwIStXruTll1+mSZMmDBw4kFdeecXfYYk4hkY0Il42a9YsXnnlFT799FN/hyLiCBrRiFTSxo0b\nyyyUtWLFijIrHYoEOhUDiFTS/v37+fOf/8zBgwcpLi7msssu06UzkZPo0pmIiNhKl85ERMRWSjQi\nImIrJRoREbGVEo2IiNhKiUZERGylRCMiIrZSohEREVsp0YiIiK3+P0qnzwUjczFJAAAAAElFTkSu\nQmCC\n", + "text": [ + "" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.36 Page no : 282" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from matplotlib.pyplot import *\n", + "from numpy import *\n", + "# Variables\n", + "cp = 1.005; \t\t\t#kJ/kg.K\n", + "R = 0.287; \t\t\t#kJ/kg.K\n", + "V1 = 1.2; \t\t\t#m**3\n", + "p1 = 1.*10**5; \t\t\t#Pa\n", + "p2 = p1;\n", + "T1 = 300.; \t\t\t#K\n", + "T2 = 600.; \t\t\t#K\n", + "T3 = T1;\n", + "p1 = 1.*10**5; \t\t\t#Pa\n", + "cv = cp-R;\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) The net heat flow\")\n", + "m = p1*V1/R/1000/T1; \t\t\t#kg\n", + "Q = m*R*(T2-T1);\n", + "print (\"Q = \"), (Q), (\"kJ\")\n", + "\n", + "print (\"(ii) The overall change in entropy\")\n", + "dS_12 = m*cp*math.log(T2/T1);\n", + "dS_23 = m*(cp-R)*math.log(T3/T2); \t\t\t#cv = cp-R\n", + "dS_overall = dS_12+dS_23;\n", + "print (\"Overall change in entropy = %.3f\")%(dS_overall),(\"kJ/K\")\n", + "\n", + "s = linspace(math.sqrt(300),math.sqrt(600),100);\n", + "T = s**2;\n", + "plot(s,T)\n", + "\n", + "s = linspace(22.18,math.sqrt(600),100)\n", + "T = 10*(s-16.725)**2;\n", + "plot(s,T,'r')\n", + "\n", + "s = [17, 25];\n", + "T = [600, 600];\n", + "plot(s,T,'--')\n", + "\n", + "s = [17 ,25];\n", + "T = [300 ,300];\n", + "plot(s,T,'--')\n", + "\n", + "suptitle(\"T-s diagram \")\n", + "xlabel(\"S\")\n", + "ylabel(\"T\")\n", + "text(24,400,\"v = C\")\n", + "text(20,450,\"p = C\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) The net heat flow\n", + "Q = 120.0 kJ\n", + "(ii) The overall change in entropy\n", + "Overall change in entropy = 0.277 kJ/K\n" + ] + }, + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 2, + "text": [ + "" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYcAAAEhCAYAAACUW2yNAAAABHN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6Oi2VyaMT09XYWGhqrAwEA1ffp01aRJEwPTlVdYWKiCg4PVZ599ppSyLwau\nUhwKCwtV586dbTkvcLXiUFnOl156SQ0cONCgVPYqy6mUUjExMerRRx81IFV5F2c8ffq06tq1qzpx\n4oRSSheHX3/91eCE2qW/y9zcXFVWVqbKysrUjBkz1PDhwy/7/FpZHM6dO6datGihsrOzDUpl79Kc\nN9xwg+3zsrKycl8bpbJCe+F7HTt2rOFEFato4eSf//xnlZubq5RS6vjx41Ve0OMMl1vg6UrFobKc\nH3zwgerevbs6c+aMQcnK+6MFsz/99JNq165dDacq79KMe/fuVV5eXqply5aqZcuW6pprrlG+vr7q\n2LFjLpXzUhcvPq6MS485VOarr77Cz8+P2267zegolfL19WXz5s0AbNy4kVatWhmcyN6FGSpKKWbP\nns2oUaMMTqSzPPbYY/j7+zNx4kTb42FhYcTFxQEQFxdHWFiYURGBynNeeo3RKsu5bt06XnvtNVav\nXs11111nYEKtspyZmZm2z7/44otys+1qWkUZg4KCOHbsGJmZmWRmZmIymdi1a5dtka+r5AS9+PiC\nVatWERAQ8Ic3clkRERHq1ltvVQ0bNlQmk0ktXbpUKaXUo48+qmJjYw1O918XcjZo0MCW85tvvlEd\nOnRQ/v7+ymKxqO3bt7tUxiVLlqj58+er9u3bq8DAQDVt2jRD812wdetW5ebmpjp06KA6duyoOnbs\nqNauXavy8vJU7969VVBQkOrTp4/hfc8V5UxMTFSfffaZMplM6rrrrlMtWrRQ999/v0vmbNOmjbr9\n9tttjz3xxBMumTM8PFyZzWbl5+enwsLC1NGjR10u48VatWpl+JhDZTkjIyOV2WxW7du3V3379lVW\nq/Wy95FFcEIIIezUym4lIYQQziXFQQghhB0pDkIIIexIcRBCCGFHioMQQgg7UhyEEELYkeIghAO8\n8MILtGvXjg4dOtChQwe2b99udCQhqsWpJ8EJUR8kJSWxYcMG0tPTadCgASdPnqSoqMjoWEJUixQH\nIaopNzeX5s2b2460bdKkCU2aNDE4lRDVIyukhaimkydP0qNHD0pKSggNDWXQoEHce++9RscSolpk\nzEGIamrSpAm7d+9m8eLFtGjRgsjISN5//32jYwlRLdJyEMLBVq1axfvvv8/atWuNjiLEVZOWgxDV\ndPDgQY4cOWL7OjU1FR8fH+MCCeEAMiAtRDUVFhby5JNPcvr0aUpKSmjTpo10K4laT7qVhBBC2JFu\nJSGEEHakOAghhLAjxUEIIYQdKQ5CCCHsSHEQQghhR4qDEEIIO1IchBBC2JHiIIQQws7/A7QEHj3e\nWXM+AAAAAElFTkSuQmCC\n", + "text": [ + "" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.37 Page no : 283" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "from matplotlib.pyplot import *\n", + "\n", + "# Variables\n", + "cv = 0.718; \t\t\t#kJ/kg.K\n", + "R = 0.287 \t\t\t#kJ/kg.K\n", + "p1 = 1.*10**5; \t\t\t#Pa\n", + "T1 = 300. \t\t\t#K\n", + "V1 = 0.018; \t\t\t#m**3\n", + "p2 = 5.*10**5 \t\t\t#Pa\n", + "T3 = T1;\n", + "cp = cv+R;\n", + "p3 = p2;\n", + "\n", + "# Calculations and Results\n", + "m = p1*V1/R/T1/1000; \t\t\t#kg\n", + "T2 = T1*p2/p1;\n", + "\n", + "print (\"(i) constant volume process\")\n", + "dS_12 = m*cv*math.log(T2/T1);\n", + "print (\"dS = %.3f\")%(dS_12), (\"kJ/K\")\n", + "\n", + "print (\"(ii) Constant prssure process \")\n", + "dS_23 = m*cp*math.log(T3/T2);\n", + "print (\"dS = %.3f\")%(dS_23), (\"kJ/K\")\n", + "\n", + "print (\"(iii) Isothermal process\")\n", + "dS_31 = m*R*math.log(p3/p1);\n", + "print (\"dS = %.5f\")%(dS_31),(\"kJ/K\")\n", + "\n", + "print (\"T-s diagram\")\n", + "s = linspace(math.sqrt(300),math.sqrt(600),72);\n", + "T = s**2;\n", + "#plot(s,T)\n", + "\n", + "s = linspace(22.18,math.sqrt(600),24)\n", + "T = 10*(s-16.725)**2;\n", + "#plot(s,T,'r')\n", + "\n", + "s = [math.sqrt(300), 22.18];\n", + "T = [300 ,300];\n", + "#plot(s,T,'g')\n", + "\n", + "print (\"p-V diagram\")\n", + "\n", + "V = [0.018, 0.018];\n", + "p = [1 ,5];\n", + "#plot(V,p)\n", + "\n", + "p = [5 ,5];\n", + "V = [0.0036, 0.018];\n", + "#plot(V,p,'r')\n", + "\n", + "V = linspace(0.0036,0.018,145)\n", + "\n", + "def f():\n", + " return 1*0.018/V;\n", + "f1 = f()\n", + "\n", + "plot(V,f1,'g')\n", + "suptitle(\"p-V diagram\")\n", + "xlabel(\"V\")\n", + "ylabel(\"p\")\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) constant volume process\n", + "dS = 0.024 kJ/K\n", + "(ii) Constant prssure process \n", + "dS = -0.034 kJ/K\n", + "(iii) Isothermal process\n", + "dS = 0.00966 kJ/K\n", + "T-s diagram\n", + "p-V diagram\n" + ] + }, + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 3, + "text": [ + "" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYoAAAEdCAYAAAASHSDrAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlUFGfCNfDbgKiAikRBBFQEFZCtAcUNbXFfI+7gglvC\noAbNJI6vGecVc6LRxJjEaAzJJBrzmWBe4kIUUKO2ioqIggFRAQXZBNzAlSBQ3x9OeiQsCnZR3c39\nncM5dHdVeeFYfXme6qqSCYIggIiIqBZ6UgcgIiLNxqIgIqI6sSiIiKhOLAoiIqoTi4KIiOrEoiAi\nojqxKEinrF69Gu+9916V55KSkuDk5FTnekqlEuPGjQMA/Prrr1i/fr1oGYm0DYuCdEpAQAB27dpV\n5bnw8HAEBAS89DbGjRuH5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TkUkPhYFUT08P/20a9cu+Pv7S5yISHyceiKqh4cPH8LOzg4xMTGYPn06rl69KnUkItFx\nREFUDyYmJhg8eDDmzp3Lg9jUZLAoiOrJ398fycnJnHaiJoNTT0REVCeOKIiIqE4sCiIiqhOLgoiI\n6sSiICKiOrEoiIioTiwKIiKq0/8HJIEAIIPDm7IAAAAASUVORK5CYII=\n", + "text": [ + "" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.39 Page no : 285" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "# Variables\n", + "m = 4; \t\t\t #kg\n", + "T1 = 400; \t\t\t#K\n", + "T2 = 500; \t\t\t#K\n", + "\n", + "# Calculations\n", + "def f12( T): \n", + "\t return m*(0.48+0.0096*T)/T\n", + "\n", + "dS = quad(f12, T1,T2)[0]\n", + "\n", + "# Results\n", + "print (\"dS = %.3f\")%(dS), (\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "dS = 4.268 kJ\n" + ] + } + ], + "prompt_number": 34 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.40 Page no : 286" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "# Variables\n", + "p1 = 1*10**5; \t\t\t#Pa\n", + "T1 = 273; \t\t\t#K\n", + "p2 = 25*10**5; \t\t\t#Pa\n", + "T2 = 750; \t\t\t#K\n", + "R = 0.29; \t\t\t#kJ/kg.K ; cp = 0.85+0.00025*T; cv = 0.56+0.00025*T; R = cp-cv;\n", + "\n", + "# Calculations\n", + "v2 = R*T2/p2;\n", + "v1 = R*T1/p1;\n", + "\n", + "def f8( T): \n", + "\t return (0.56+0.00025*T)/T\n", + "\n", + "def f9(v):\n", + " return R/v\n", + "ds = quad(f8, T1, T2)[0] + quad(f9,v1,v2)[0]\n", + "\n", + "# Results\n", + "print (\"ds = %.3f\")%(ds),(\"kJ/kg K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "ds = 0.045 kJ/kg K\n" + ] + } + ], + "prompt_number": 35 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.41 Page no : 287" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "cv = 0.715; \t\t\t#kJ/kg K\n", + "R = 0.287; \t\t\t#kJ/kg K\n", + "V_A = 0.25; \t\t\t#m**3\n", + "p_Ai = 1.4; \t\t\t#bar\n", + "T_Ai = 290; \t\t\t#K\n", + "V_B = 0.25; \t\t\t#m**3\n", + "p_Bi = 4.2; \t\t\t#bar\n", + "T_Bi = 440; \t\t\t#K\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) Final equilibrium temperature\")\n", + "m_A = p_Ai * 10**5 * V_A / R / 1000/ T_Ai; \t\t\t#kg\n", + "m_B = p_Bi * 10**5 * V_B / R / 1000/ T_Bi; \t\t\t#kg\n", + "\n", + "T_f = (m_B * T_Bi + m_A * T_Ai)/(m_A + m_B);\n", + "print (\"T_f = %.3f\")% (T_f), (\"K\")\n", + "\n", + "\n", + "print (\"(ii) Final pressure on each side of the diaphragm\")\n", + "p_Af = p_Ai*T_f/T_Ai;\n", + "print (\"p_Af = %.3f\")%(p_Af),(\"bar\")\n", + "\n", + "p_Bf = p_Bi*T_f/T_Bi;\n", + "print (\"p_Bf = %.3f\")%(p_Bf),(\"bar\")\n", + "\n", + "\n", + "print (\"(iii) Entropy change of the system\")\n", + "dS_A = m_A*cv*math.log(T_f/T_Ai);\n", + "dS_B = m_B*cv*math.log(T_f/T_Bi);\n", + "dS_net = dS_A+dS_B;\n", + "print (\"Net change of entropy = %.3f\")%(dS_net), (\"kJ/K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Final equilibrium temperature\n", + "T_f = 389.618 K\n", + "(ii) Final pressure on each side of the diaphragm\n", + "p_Af = 1.881 bar\n", + "p_Bf = 3.719 bar\n", + "(iii) Entropy change of the system\n", + "Net change of entropy = 0.016 kJ/K\n" + ] + } + ], + "prompt_number": 36 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.42 Page no : 287" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "cv = 1.25; \t\t\t#kJ/kg.K\n", + "T1 = 530.; \t\t\t#K\n", + "v1 = 0.0624; \t\t\t#m**3/kg\n", + "v2 = 0.186; \t\t\t#m**3/kg\n", + "dT_31 = 25.; \t\t\t#K\n", + "T3 = T1-dT_31; \t\t\t#K\n", + "dT_21 = 165.; \t\t\t#K\n", + "\n", + "# Calculations\n", + "T2 = T1-dT_21; \t\t\t#K\n", + "# Path 1-2 : Reversible adiabatic process\n", + "ds_12 = 0;\n", + "v3 = 0.186; \t\t\t#m**3/kg\n", + "v3 = v2;\n", + "ds_13 = cv*math.log(T3/T2);\n", + "\n", + "# Results\n", + "print (\"Chang in entropy = %.4f\")%(ds_13), (\"kJ/kgK\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Chang in entropy = 0.4058 kJ/kgK\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.44 Page no : 289" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from numpy import *\n", + "\n", + "# Variables\n", + "T1 = 500.; \t\t\t#K\n", + "T2 = 400.; \t\t\t#K\n", + "T3 = 300.; \t\t\t#K\n", + "Q1 = 1500.; \t\t\t#kJ/min\n", + "W = 200.; \t\t\t#kJ/min\n", + "\n", + "# Calculations and Results\n", + "A = [[1,-1],[(1./400),(-1./300)]];\n", + "B = [(-1300),(-3)];\n", + "X = linalg.solve(A,B)\n", + "\n", + "Q2 = X[0];\n", + "print (\"Q2 = \"), (Q2), (\"kJ/min\")\n", + "\n", + "Q3 = X[1];\n", + "print (\"Q3 = \"), (Q3), (\"kJ/min\")\n", + "\n", + "print (\"(ii) Entropy change \")\n", + "dS1 = (-Q1)/T1;\n", + "print (\"Entropy change of source 1 = \"), (dS1), (\"kJ/K\")\n", + "\n", + "dS2 = (-Q2)/T2;\n", + "print (\"Entropy change of math.sink 2 = \"), (dS2), (\"kJ/K\")\n", + "\n", + "dS3 = Q3/T3;\n", + "print (\"Entropy change of source 3 = \"),(dS3), (\"kJ/K\")\n", + "\n", + "\n", + "print (\"(iii) Net change of the entropy\")\n", + "dSnet = dS1 + dS2 + dS3;\n", + "print (\"dSnet = %d\")% (dSnet)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Q2 = -1600.0 kJ/min\n", + "Q3 = -300.0 kJ/min\n", + "(ii) Entropy change \n", + "Entropy change of source 1 = -3.0 kJ/K\n", + "Entropy change of math.sink 2 = 4.0 kJ/K\n", + "Entropy change of source 3 = -1.0 kJ/K\n", + "(iii) Net change of the entropy\n", + "dSnet = 0\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.45 Page no : 291" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "# Variables\n", + "T1 = 250; \t\t\t#K\n", + "T2 = 125; \t\t\t#K\n", + "\n", + "# Calculations\n", + "#cv = 0.0045*T**2\n", + "def f10( T): \n", + "\t return 0.045*T**2\n", + "\n", + "Q1 = quad(f10, T1, T2)[0]\n", + "\n", + "def f11( T): \n", + "\t return 0.045*T\n", + "\n", + "dS_system = quad(f11, T1, T2)[0]\n", + "\n", + "dS_universe = 0;\n", + "\n", + "W_max = ((-Q1) -T2*(dS_universe-dS_system))/1000;\n", + "\n", + "# Results\n", + "print (\"W_max = %.3f\")%(W_max), (\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "W_max = 73.242 kJ\n" + ] + } + ], + "prompt_number": 39 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.46 Page no : 292" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "# Variables\n", + "cp = 1.005; \t\t\t#kJ/kg K\n", + "T_A = 333.; \t\t\t#K\n", + "T_B = 288.; \t\t\t#K\n", + "p_A = 140.; \t\t\t#kPa\n", + "p_B = 110.; \t\t\t#kPa\n", + "#h = cp*T\n", + "#v/T = 0.287/p\n", + "\n", + "# Calculations\n", + "def f9( T): \n", + "\t return cp/T\n", + "\n", + "def f10(p):\n", + " return 0.287/p\n", + " \n", + "ds_system = quad(f9, T_B, T_A)[0] + quad(f10,p_A,p_B)[0]\n", + "ds_surr = 0;\n", + "ds_universe = ds_system+ds_surr;\n", + "\n", + "# Results\n", + "print (\"change in entropy of universe = -%.4f\")% (ds_universe), (\"kJ/kgK\")\n", + "print (\"Since change in entropy of universe from A to B is -ve\")\n", + "print (\"The flow is from B to A\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "change in entropy of universe = -0.0767 kJ/kgK\n", + "Since change in entropy of universe from A to B is -ve\n", + "The flow is from B to A\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.47 Page no : 292" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "m1 = 3.; \t\t\t#kg\n", + "m2 = 4.; \t\t\t#kg\n", + "T0 = 273.; \t\t\t#K\n", + "T1 = 80.+273; \t\t\t#K\n", + "T2 = 15.+273; \t\t\t#K\n", + "c_pw = 4.187; \t\t\t#kJ/kgK\n", + "\n", + "# Calculations\n", + "tm = (m1*T1 + m2*T2)/(m1+m2);\n", + "Si = m1*c_pw*math.log(T1/T0) + m2*c_pw*math.log(T2/T0);\n", + "Sf = (m1+m2)*c_pw*math.log(tm/T0);\n", + "dS = Sf-Si;\n", + "\n", + "# Results\n", + "print (\"Net change in entropy = %.3f\")%(dS),(\"kJ/K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Net change in entropy = 0.150 kJ/K\n" + ] + } + ], + "prompt_number": 41 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.49 Page no : 294" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "m = 1.; \t\t\t#kg\n", + "T1 = 273.; \t\t\t#K\n", + "T2 = 363.; \t\t\t#K\n", + "c = 4.187;\n", + "\n", + "# Calculations and Results\n", + "print (\"(a)\")\n", + "ds_water = m*c*math.log(T2/T1);\n", + "print (\"(i) Entropy of water = %.3f\")%(ds_water), (\"kJ/kgK\")\n", + "\n", + "print (\"(ii) Entropy change of the reservoir \")\n", + "Q = m*c*(T2-T1);\n", + "ds_reservoir = -Q/T2;\n", + "print (\"ds_reservoir = %.3f\")% (ds_reservoir), (\"kJ/K\")\n", + "\n", + "ds_universe = ds_water+ds_reservoir;\n", + "print (\"(iii) Entropy change of universe = %.3f\")% (ds_universe), (\"kJ/K\")\n", + "\n", + "print (\"(b)\")\n", + "T3 = 313; \t\t\t#K\n", + "ds_water = m*c*(math.log(T3/T1) + math.log(T2/T3));\n", + "ds_res1 = -m*c*(T3-T1)/T3;\n", + "ds_res2 = -m*c*(T2-T3)/T2;\n", + "\n", + "ds_universe = ds_water+ds_res1+ds_res2;\n", + "print (\"(iii) Entropy change of universe = %.3f\")%(ds_universe), (\"kJ/K\")\n", + "\n", + "print (\"(c) The entropy change of universe would be less and less, if the water is heated in more and more stages, by bringing\")\n", + "print (\"the water in contact successively with more and more heat reservoirs, each succeeding reservoir being at a higher temperature\") \n", + "print (\"than the preceding one.\")\n", + "\n", + "print (\"When water is heated in infinite steps, by bringing in contact with an infinite number of reservoirs in succession, so that\") \n", + "print (\"at any insmath.tant the temperature difference between the water and the reservoir in contact is infinitesimally small, then\") \n", + "print (\"the entropy change of the universe would be zero and the water would be reversibly heated.\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + "(i) Entropy of water = 1.193 kJ/kgK\n", + "(ii) Entropy change of the reservoir \n", + "ds_reservoir = -1.038 kJ/K\n", + "(iii) Entropy change of universe = 0.155 kJ/K\n", + "(b)\n", + "(iii) Entropy change of universe = 0.081 kJ/K\n", + "(c) The entropy change of universe would be less and less, if the water is heated in more and more stages, by bringing\n", + "the water in contact successively with more and more heat reservoirs, each succeeding reservoir being at a higher temperature\n", + "than the preceding one.\n", + "When water is heated in infinite steps, by bringing in contact with an infinite number of reservoirs in succession, so that\n", + "at any insmath.tant the temperature difference between the water and the reservoir in contact is infinitesimally small, then\n", + "the entropy change of the universe would be zero and the water would be reversibly heated.\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.50 Page no : 295" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "cp = 2.093; \t\t\t#kJ/kg0C\n", + "c = 4.187;\n", + "Lf = 333.33; \t\t\t#kJ/kg\n", + "m = 1.; \t\t\t#kg\n", + "T0 = 273.; \t\t\t#K\n", + "T1 = 268.; \t\t\t#K\n", + "T2 = 298.; \t\t\t#K\n", + "\n", + "# Calculations and Results\n", + "Q_s = m*cp*(T0-T1);\n", + "Q_f = m*Lf;\n", + "Q_l = m*c*(T2-T0);\n", + "Q = Q_s+Q_f+Q_l;\n", + "\n", + "print (\"(i) Entropy increase of the universe\")\n", + "ds_atm = -Q/T2;\n", + "ds_sys1 = m*cp*math.log(T0/T1);\n", + "ds_sys2 = Lf/T0;\n", + "ds_sys3 = m*c*math.log(T2/T0);\n", + "ds_total = ds_sys1+ds_sys2+ds_sys3;\n", + "ds_universe = ds_total+ds_atm;\n", + "\n", + "print (\"Entropy increase of universe = %.3f\")%(ds_universe), (\"kJ/K\")\n", + "\n", + "\n", + "print (\"(ii) Minimum amount of work necessary to convert the water back into ice at \u2013 5\u00b0C, Wmin.\")\n", + "dS_refrigerator = 0;\n", + "\n", + "dS_system = -1.6263; \t\t\t#kJ/kg K\n", + "T = 298; \t\t\t#K\n", + "#For minimum work \n", + "W_min = T*(-dS_system)-Q;\n", + "\n", + "print (\"Minimum work done = %.3f\")% (W_min), (\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Entropy increase of the universe\n", + "Entropy increase of universe = 0.122 kJ/K\n", + "(ii) Minimum amount of work necessary to convert the water back into ice at \u2013 5\u00b0C, Wmin.\n", + "Minimum work done = 36.167 kJ\n" + ] + } + ], + "prompt_number": 43 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Industrial_Instrumentation/.ipynb_checkpoints/ch6-checkpoint.ipynb b/Industrial_Instrumentation/.ipynb_checkpoints/ch6-checkpoint.ipynb new file mode 100644 index 00000000..2fc63442 --- /dev/null +++ b/Industrial_Instrumentation/.ipynb_checkpoints/ch6-checkpoint.ipynb @@ -0,0 +1,1208 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:b3244020b726410d1f880fd32ec7c61d578b2f34e3bde3131de02645aee53468" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 6 : Availability and Irreversibility" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.1 Page no : 313" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "T0 = 293.; \t\t\t#K\n", + "T1 = 300.; \t\t\t#K\n", + "T2 = 370.; \t\t\t#K\n", + "cv = 0.716;\n", + "cp = 1.005;\n", + "R = 0.287;\n", + "p1 = 1.; \t\t\t#bar\n", + "p2 = 6.8; \t\t\t#bar\n", + "m = 1.; \t\t\t#kg\n", + "\n", + "# Calculations\n", + "Wmax = -(cv*(T2-T1) - T0*(cp*math.log(T2/T1)-R*math.log(p2/p1)));\n", + "n = 1/(1-(math.log(T2/T1)/math.log(p2/p1)));\n", + "Wact = m*R*(T1-T2)/(n-1);\n", + "I = Wmax - Wact;\n", + "\n", + "# Results\n", + "print (\"Irreversibility = %.3f\")%(I),(\"kJ/kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Irreversibility = 13.979 kJ/kg\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.2 Page no : 313" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T1 = 1000.; \t\t\t#K\n", + "T2 = 500.; \t\t\t#K\n", + "T0 = 300.; \t\t\t#K\n", + "Q = 7200.; \t\t\t#kJ/min\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) Net change of entropy :\")\n", + "dS_source = -Q/T1;\n", + "dS_system = Q/T2;\n", + "dS_net = dS_source+dS_system;\n", + "print (\"dS_net = \"), (dS_net), (\"kJ/min.K\")\n", + "\n", + "\n", + "print (\"(ii) Decrease in available energy :\")\n", + "AE_source = (T1-T0)*(-dS_source); \t\t\t#Available energy with the source\n", + "AE_system = (T2-T0)*dS_system; \t\t\t#Available energy with the system\n", + "dAE = AE_source - AE_system; \t\t\t#Decrease in available energy\n", + "print (\"dAE = \"), (dAE), (\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Net change of entropy :\n", + "dS_net = 7.2 kJ/min.K\n", + "(ii) Decrease in available energy :\n", + "dAE = 2160.0 kJ\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.3 Page no : 315" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "m = 8.; \t\t\t#kg\n", + "T1 = 650.; \t\t\t#K\n", + "p1 = 5.5*10**5; \t\t\t#Pa\n", + "p0 = 1*10.**5; \t\t\t#Pa\n", + "T0 = 300.; \t\t\t#K\n", + "cp = 1.005; \t\t\t#kJ/kg.K\n", + "cv = 0.718;\n", + "R = 0.287;\n", + "#p1*v1/T1 = p0*v0/T0\n", + "#Let r = v1/v0 = 1/2.54\n", + "r = 1/2.54;\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) Change in available energy(for bringing the system to dead state) = \")\n", + "ds = cv*math.log(T1/T0) + R*math.log(r);\n", + "dAE = m*(cv*(T1-T0) - T0*ds);\n", + "#dAE is the change in available energy in kJ\n", + "V1 = m*R*10**3*T1/p1;\n", + "V0 = V1/r;\n", + "L = p0*(V0 - V1)/10**3;\n", + "print (\"Loss of availability, L = \"), (L), (\"kJ\")\n", + "\n", + "print (\"(ii) Available Energy and Effectiveness\")\n", + "Q = m*cp*(T1-T0);\n", + "ds = m*cp*math.log(T1/T0);\n", + "Unavailable_energy = T0*ds;\n", + "Available_energy = Q - Unavailable_energy;\n", + "print (\"Available energy = %.3f\")% (Available_energy), (\"kJ\")\n", + "\n", + "Effectiveness = Available_energy/dAE;\n", + "print (\"Effectiveness = %.3f\")% (Effectiveness)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Change in available energy(for bringing the system to dead state) = \n", + "Loss of availability, L = 417.872 kJ\n", + "(ii) Available Energy and Effectiveness\n", + "Available energy = 949.066 kJ\n", + "Effectiveness = 0.719\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.4 Page no : 316" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "# Variables\n", + "c_pg = 1.; \t\t\t#kJ/kgK\n", + "h_fg = 1940.7; \t\t\t#kJ/kg\n", + "Ts = 473.; \t \t\t#K ; Temperature of saturation of steam\n", + "T1 = 1273.; \t\t\t#K ; Initial temperature of gases\n", + "T2 = 773.; \t\t \t#K ; Final temperature of gases\n", + "T0 = 293.; \t\t\t #K ; atmospheric temperature\n", + "\n", + "# Calculations\n", + "#Heat lost by gases = Heat gained by 1 kg saturated water when it is converted to steam at 200 0C\n", + "m_g = h_fg/c_pg/(T1-T2);\n", + "dS_g = m_g*c_pg*math.log(T2/T1);\n", + "dS_w = h_fg/Ts;\n", + "dS_net = dS_g + dS_w;\n", + "\n", + "# Results\n", + "print (\"Net change in entropy = %.3f\")% (dS_net), (\"kJ/K\")\n", + "\n", + "E = T0*dS_net; \t\t\t#Increase in unavailable energy due to hea transfer\n", + "print (\"Increase in unavailable energy = %.3f\")%(E), (\"kJ per kg of steam formed\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Net change in entropy = 2.167 kJ/K\n", + "Increase in unavailable energy = 634.847 kJ per kg of steam formed\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.5 Page no : 317" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# Variables\n", + "m_g = 3.; \t\t\t#kg\n", + "p1 = 2.5; \t\t\t#bar\n", + "T1 = 1200.; \t\t\t#K; Temperature of infinite source\n", + "T1a = 400.; \t\t\t#K; Initial temperature\n", + "Q = 600.; \t\t\t#kJ\n", + "cv = 0.81; \t\t\t#kJ/kg.K\n", + "T0 = 290.; \t\t\t#K; Surrounding Temperature\n", + "\n", + "# Calculations\n", + "#final temperature = T2a\n", + "T2a = Q/m_g/cv + T1a;\n", + "AE = (T1-T0)*Q/T1; \t\t\t#Available energy with the source\n", + "dS = m_g*cv*math.log(T2a/T1a); \t\t\t#Change in entropy of the gas\n", + "UAE = T0*dS; \t\t\t#Unavailability of the gas \n", + "A = Q-UAE; \t\t\t#Available energy with the gas\n", + "loss = AE-A;\n", + "\n", + "# Results\n", + "print (\"Loss in available energy due to heat transfer = %.3f\")%(loss),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Loss in available energy due to heat transfer = 193.783 kJ\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.6 Page no : 318" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "# Variables\n", + "m = 60.; \t\t\t#kg\n", + "T1 = 333.; \t\t\t#K\n", + "T0 = 279.; \t\t\t#K\n", + "p = 1.; \t\t\t#atm\n", + "cp = 4.187;\n", + "\n", + "# Calculations\n", + "def f16( T): \n", + "\t return m*cp*(1-T0/T)\n", + "\n", + "Wmax = quad(f16, T0, T1)[0]\n", + "Q1 = m*cp*(T1-T0);\n", + "#Let unavailable energy = E\n", + "E = Q1-Wmax;\n", + "\n", + "# Results\n", + "print (\"unavailable energy = %.3f\")%(E), (\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "unavailable energy = 12401.141 kJ\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.7 Page no : 319" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "# Variables\n", + "m = 15.; \t\t\t#kg\n", + "T1 = 340.; \t\t\t#K\n", + "T0 = 300.; \t\t\t#K\n", + "cp = 4.187; \t\t\t#kJ/kgK\n", + "\n", + "# Calculations\n", + "#Work added during churning = Increase in enthalpy of water\n", + "W = m*cp*(T1-T0);\n", + "ds = cp*math.log(T1/T0);\n", + "AE = m*(cp*(T1-T0)-T0*ds);\n", + "AE_loss = W-AE; \t\t\t#Loss in availability\n", + "\n", + "# Results\n", + "print (\"Loss in availability %.3f\")% (AE_loss), (\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Loss in availability 2358.261 kJ\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.8 Page no : 320" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "# Variables\n", + "m = 5.; \t\t\t#kg\n", + "T1 = 550.; \t\t\t#K\n", + "p1 = 4*10.**5; \t\t\t#Pa\n", + "T2 = 290.; \t\t\t#K\n", + "T0 = T2;\n", + "p2 = 1.*10**5; \t\t\t#Pa\n", + "p0 = p2;\n", + "cp = 1.005; \t\t\t#kJ/kg K\n", + "cv = 0.718; \t\t\t#kJ/kg K\n", + "R = 0.287; \t\t\t#kJ/kg K\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) Availability of the system :\")\n", + "ds = cp*math.log(T1/T0) - R*math.log(p1/p0);\n", + "Availability = m*(cv*(T1-T0) - T0*ds);\n", + "print (\"Availability of the system = %.3f\")% (Availability), (\"kJ\")\n", + "\n", + "print (\"(ii) Available energy and Effectiveness\")\n", + "Q = m*cp*(T1-T0);\n", + "dS = m*cp*math.log(T1/T0);\n", + "E = T0*dS; \t\t\t#Unavailable energy\n", + "AE = Q-E;\n", + "print (\"Available Energy = %.3f\")%(AE), (\"kJ\")\n", + "\n", + "Effectiveness = AE/Availability;\n", + "print (\"Effectiveness = %.3f\")%(Effectiveness)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Availability of the system :\n", + "Availability of the system = 577.612 kJ\n", + "(ii) Available energy and Effectiveness\n", + "Available Energy = 373.806 kJ\n", + "Effectiveness = 0.647\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.9 Page no : 321" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "R = 0.287; \t\t\t#kJ/kgK\n", + "cp = 1.005; \t\t\t#kJ/kgK\n", + "m = 25./60; \t\t\t#kg/s\n", + "p1 = 1.; \t\t\t#bar\n", + "p2 = 2.; \t\t\t#bar\n", + "T1 = 288.; \t\t\t#K\n", + "T0 = T1;\n", + "T2 = 373.; \t\t\t#K\n", + "\n", + "# Calculations and Results\n", + "W_act = cp*(T2-T1); \t\t\t#W_actual\n", + "W_total = m*W_act;\n", + "\n", + "print (\"Total actual power required = %.3f\")%(W_total), (\"kW\")\n", + "\n", + "ds = cp*math.log(T2/T1) - R*math.log(p2/p1);\n", + "Wmin = cp*(T2-T1) - T0*(ds);\n", + "\n", + "\n", + "W = m*Wmin;\n", + "print (\"Minimuumm work required = %.3f\")%(W), (\"kW\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total actual power required = 35.594 kW\n", + "Minimuumm work required = 28.276 kW\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.10 Page no : 322" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "m_O2 = 1.; \t\t\t#kg\n", + "m_H2 = 1.; \t\t\t#kg\n", + "p = 1*10.**5; \t\t\t#Pa\n", + "T_O2 = 450.; \t\t\t#K\n", + "T_H2 = 450.; \t\t\t#K\n", + "T0 = 290.; \t\t\t#K\n", + "R0 = 8.314;\n", + "M_O2 = 32.;\n", + "M_H2 = 2.;\n", + "\n", + "# Calculations\n", + "R_O2 = R0/M_O2;\n", + "v_O2 = m_O2*R_O2*T_O2/p;\n", + "R_H2 = R0/M_H2;\n", + "v_H2 = m_H2*R_H2*T_H2/p;\n", + "v_f = v_O2 + v_H2; \t\t\t#total volume after mixing\n", + "dS_O2 = R_O2*math.log(v_f/v_O2);\n", + "dS_H2 = R_H2*math.log(v_f/v_H2);\n", + "dS_net = dS_O2 + dS_H2;\n", + "#Let E be the loss in availability \n", + "E = T0*dS_net;\n", + "\n", + "# Results\n", + "print (\"Loss in availability = %.3f\")% (E), (\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Loss in availability = 286.555 kJ\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.11 Page no : 323" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "# Variables\n", + "T0 = 283.; \t\t\t#K\n", + "cp = 4.18; \t\t\t#kJ/kgK\n", + "m1 = 20.; \t\t\t#kg\n", + "T1 = 363.; \t\t\t#K\n", + "m2 = 30.; \t\t\t#kg\n", + "T2 = 303.; \t\t\t#K\n", + "T3 = 327.; \t\t\t#K\n", + "\n", + "\n", + "# Calculations\n", + "def f13( T): \n", + "\t return m1*cp*(1-T0/T)\n", + "\n", + "AE1 = quad(f13, T0, T1)[0]\n", + "\n", + "def f14( T): \n", + "\t return m2*cp*(1-T0/T)\n", + "\n", + "AE2 = quad(f14, T0, T2)[0]\n", + "AE_total = AE1 + AE2; \t\t\t#before mixing\n", + "#If T K is the final temperature after mixing\n", + "T = (m1*T1+m2*T2)/(m1+m2);\n", + "m_total = m1+m2;\n", + "\n", + "#Available energy of 50kg of water at 54 0C\n", + "AE3 = m_total*cp*((T3-T0) - T0*math.log(T3/T0));\n", + "\n", + "#Decrease in available energy due to mixing dAE\n", + "dAE = AE_total - AE3;\n", + "\n", + "# Results\n", + "print (\"Decrease in avialble energy = %.3f\")% (dAE), (\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Decrease in avialble energy = 234.184 kJ\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.12 Page no : 324" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# Variables\n", + "T_w1 = 323.; \t\t\t#K\n", + "T_w2 = 343.; \t\t\t#K\n", + "T_o1 = 513.; \t\t\t#K\n", + "T_o2 = 363.; \t\t\t#K\n", + "SG_oil = 0.82;\n", + "c_po = 2.6; \t\t\t#kJ/kg K\n", + "c_pw = 4.18; \t\t\t#kJ/kg K\n", + "T0 = 300.; \t\t\t#K\n", + "m_o = 1.; \t\t\t#kg\n", + "\n", + "# Calculations\n", + "#Heat lost by oil = Heat gained by water\n", + "m_w = (m_o*c_po*(T_o1-T_o2))/(c_pw*(T_w2-T_w1));\n", + "dS_w = m_w*c_pw*math.log(T_w2/T_w1);\n", + "dS_o = m_o*c_po*math.log(T_o2/T_o1);\n", + "dAE_w = m_w*(c_pw*(T_w2-T_w1))-T0*dS_w;\n", + "dAE_o = m_o*(c_po*(T_o2-T_o1))-T0*dS_o;\n", + "\n", + "# Loss in availability E = \n", + "E = dAE_w+dAE_o;\n", + "\n", + "# Results\n", + "print (\"Loss in availability = %.3f\")%(E),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Loss in availability = -81.676 kJ\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.13 Page no : 325" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "# Variables\n", + "m_i = 1.; \t\t\t#kg\n", + "T_i = 273.; \t\t\t#K\n", + "m_w = 12.; \t\t\t#kg\n", + "T_w = 300.; \t\t\t#K\n", + "T0 = 288.; \t\t\t#K\n", + "c_pw = 4.18; \t\t\t#kJ/kg K\n", + "c_pi = 2.1; \t\t\t#kJ/kg K\n", + "L_i = 333.5; \t\t\t#kJ/kg\n", + "\n", + "# Calculations\n", + "Tc = (m_w*c_pw*T_w + m_i*c_pw*T_i - L_i)/(m_w*c_pw + m_i*c_pw);\n", + "dS_w = m_w*c_pw*math.log(Tc/T_w);\n", + "dS_i = m_i*c_pw*math.log(Tc/T_i) + L_i/T_i;\n", + "dS_net = dS_w+dS_i;\n", + "\n", + "# Results\n", + "print (\"Increase in entropy = %.3f\")% (dS_net), (\"kJ/K\")\n", + "\n", + "dAE = T0*dS_net;\n", + "print (\"Increase in unavailable energy = %.3f\")% (dAE),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Increase in entropy = 0.107 kJ/K\n", + "Increase in unavailable energy = 30.878 kJ\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.14 Page no : 326" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T1 = 673.; \t\t\t#K\n", + "T2 = 473.; \t\t\t#K\n", + "T0 = 303.; \t\t\t#K\n", + "T1a = T2;\n", + "\n", + "# Calculations\n", + "UAE = T0*(T1-T1a)/T1a/(T1-T0);\n", + "\n", + "# Results\n", + "print (\"the fraction of energy that becomes unavailable = %.3f\")%(UAE)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the fraction of energy that becomes unavailable = 0.346\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.15 Page no : 327" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "# Variables\n", + "T1 = 293.; \t\t\t#K\n", + "T2 = 353.; \t\t\t#K\n", + "Tf = 1773.; \t\t\t#K\n", + "T0 = 288.; \t\t\t#K\n", + "c_pl = 6.3; \t\t\t#kJ/kg K\n", + "\n", + "# Calculations\n", + "dAE = c_pl*(T2-T1) - T0*c_pl*math.log(T2/T1);\n", + "n = (1-T0/Tf); \t\t\t#efficiency\n", + "E = c_pl*(T2-T1)*n;\n", + "Effectiveness = dAE/E;\n", + "\n", + "# Results\n", + "print (\"Effectiveness of the heating process = %.3f\")%(Effectiveness)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Effectiveness of the heating process = 0.126\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.16 Page no : 328" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "T0 = 293.; \t\t\t#K\n", + "T1 = 293.; \t\t\t#K\n", + "T2 = 373.; \t\t\t#K\n", + "T3 = 323.; \t\t\t#K\n", + "cp = 1.005;\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) The ratio of mass flow\")\n", + "x = (T3-T1)/(T2-T3);\n", + "print (\"x = \"), (x)\n", + "\n", + "ds_13 = cp*math.log(T3/T1);\n", + "ds_32 = cp*math.log(T2/T3);\n", + "A = cp*(T3-T1) - T1*ds_13; \t \t\t#Increase of availability of system\n", + "B = x*(cp*(T2-T3)-T0*(ds_32));\t\t\t# Loss of availability of surroundings\n", + "Effectiveness = A/B;\n", + "print (\"Effectiveness of heating process = %.3f\")%(Effectiveness)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) The ratio of mass flow\n", + "x = 0.6\n", + "Effectiveness of heating process = 0.306\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.17 Page no : 329" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "m = 2.5; \t\t\t#kg\n", + "p1 = 6.*10**5; \t\t\t#Pa\n", + "r = 2.; \t\t\t#r = V2/V1\n", + "cv = 0.718; \t\t\t#kJ/kg K\n", + "R = 0.287; \t\t\t#kJ/kg K\n", + "T1 = 363.; \t\t\t#K\n", + "p2 = 1.*10**5; \t\t\t#Pa\n", + "T2 = 278.; \t\t\t#K\n", + "V1 = m*R*T1/p1;\n", + "V2 = 2*V1;\n", + "T0 = 278.; \t\t\t#K\n", + "p0 = 1.*10**5; \t\t\t#Pa\n", + "Q = 0.; \t\t\t#adiabatic process\n", + "\n", + "# Calculations and Results\n", + "dS = m*cv*math.log(T2/T1) + m*R*math.log(V2/V1);\n", + "Wmax = m*(cv*(T1-T2)) + T0*(cv*math.log(T2/T1) + R*math.log(V2/V1));\n", + "print (\"(i)The maximum work\"),(\"Wmax = %.3f\")% (Wmax), (\"kJ\")\n", + "\n", + "dA = Wmax+p0*(V1-V2);\n", + "print (\"(ii)Change in availability = %.3f\")%(dA), (\"kJ\")\n", + "\n", + "I = T0*m*(cv*math.log(T2/T1)+R*math.log(V2/V1));\n", + "print (\"(iii)Irreversibility = %.3f\")% (I),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i)The maximum work Wmax = 154.628 kJ\n", + "(ii)Change in availability = 111.219 kJ\n", + "(iii)Irreversibility = 5.132 kJ\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.18 Page no : 330" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "m = 1.; \t\t\t#kg\n", + "p1 = 7.*10**5; \t\t\t#Pa\n", + "T1 = 873.; \t\t\t#K\n", + "p2 = 1.*10**5; \t\t\t#Pa\n", + "T2 = 523.; \t\t\t#K\n", + "T0 = 288.; \t\t\t#K\n", + "Q = -9.; \t\t\t#kJ/kg\n", + "cp = 1.005; \t\t\t#kJ/kg K\n", + "R = 0.287; \t\t\t#kJ/kg K\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) The decrease in availability \")\n", + "dA = cp*(T1-T2) - T0*(R*math.log(p2/p1) - cp*math.log(T2/T1));\n", + "print (\"dA = %.3f\")%(dA), (\"kJ/kg\")\n", + "\n", + "print (\"(ii) The maximum work\")\n", + "Wmax = dA; \t\t\t#change in availability\n", + "print (\"Wmax %.3f\")% (Wmax), (\"kJ/kg\")\n", + "\n", + "\n", + "W = cp*(T1-T2) + Q;\n", + "I = Wmax - W;\n", + "print (\"(iii)Irreversibility = %.3f\")%(I), (\"kJ/kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) The decrease in availability \n", + "dA = 364.295 kJ/kg\n", + "(ii) The maximum work\n", + "Wmax 364.295 kJ/kg\n", + "(iii)Irreversibility = 21.545 kJ/kg\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.19 Page no : 331" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "cp = 1.005; \t\t\t#kJ/kg K\n", + "cv = 0.718; \t\t\t#kJ/kg K\n", + "R = 0.287; \t\t\t#kJ/kg K\n", + "m = 1.; \t\t\t#kg\n", + "T1 = 290.; \t\t\t#K\n", + "T0 = 290.; \t\t\t#K\n", + "T2 = 400.; \t\t\t#K\n", + "p1 = 1.; \t\t\t#bar\n", + "p0 = 1.; \t\t\t#bar\n", + "p2 = 6.; \t\t\t#bar\n", + "\n", + "# Calculations and Results\n", + "#Wrev = change in internal energy - T0*change in entropy\n", + "Wrev = -(cv*(T2-T1) - T0*(cp*math.log(T2/T1) - R*math.log(p2/p1)));\n", + "n = (1./(1-math.log(T2/T1)/math.log(p2/p1)));\n", + "Wact = m*R*(T1-T2)/(n-1);\n", + "\n", + "I = Wrev-Wact;\n", + "print (\"(i)Irreversibility = %.3f\")% (I), (\"kJ\")\n", + "\n", + "effectiveness = Wrev/Wact*100;\n", + "print (\"(ii)The effectiveness = %.3f\")%(effectiveness), (\"%\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i)Irreversibility = 9.945 kJ\n", + "(ii)The effectiveness = 93.109 %\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.20 Page no : 333" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "# Variables\n", + "I = 0.62; \t\t\t#kg/m**2\n", + "N1 = 2500.; \t\t\t#rpm\n", + "w1 = 2*math.pi*N1/60; \t\t\t#rad/s\n", + "m = 1.9; \t\t\t#kg; Water equivalent of shaft bearings\n", + "cp = 4.18;\n", + "T0 = 293.; \t\t\t#K\n", + "t0 = 20.; \t\t\t#0C\n", + "\n", + "# Calculations and Results\n", + "print (\"(i)Rise in temperature of bearings\")\n", + "KE = 1./2*I*w1**2/1000; \t\t\t#kJ\n", + "dT = KE/(m*cp); \t\t\t#rise in temperature of bearings\n", + "print (\"dT = %.3f\")% (dT), (\"0C\")\n", + "\n", + "t2 = t0+dT;\n", + "print (\"Final temperature of the bearings = %.3f\")% (t2), (\"0C\")\n", + "\n", + "T2 = t2+273;\n", + "print (\"(ii)Final r.p.m. of the flywheel\")\n", + "def f15( T): \n", + "\t return m*cp*(1-T0/T)\n", + "\n", + "AE = quad(f15, T0, T2)[0]\n", + "UE = KE - AE;\n", + "\n", + "print (\"Available energy = %.3f\")% (AE), (\"kJ\")\n", + "\n", + "UAE = KE-AE;\n", + "print (\"Unavailable energy = %.3f\")%(UAE), (\"kJ\")\n", + "\n", + "w2 = math.sqrt(AE*10**3*2/I);\n", + "N2 = w2*60/2/math.pi;\n", + "print (\"Final rpm of the flywheel = %.3f\")%(N2), (\"rpm\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i)Rise in temperature of bearings\n", + "dT = 2.675 0C\n", + "Final temperature of the bearings = 22.675 0C\n", + "(ii)Final r.p.m. of the flywheel\n", + "Available energy = 0.096 kJ\n", + "Unavailable energy = 21.151 kJ\n", + "Final rpm of the flywheel = 168.407 rpm\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.21 Page no : 334" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "# Variables\n", + "p1 = 8.; \t\t\t#bar\n", + "T1 = 453.; \t\t\t#K\n", + "p2 = 1.4; \t\t\t#bar\n", + "T2 = 293.; \t\t\t#K\n", + "T0 = T2;\n", + "p0 = 1.; \t\t\t#bar\n", + "m = 1.; \t\t\t#kg\n", + "C1 = 80.; \t\t\t#m/s\n", + "C2 = 40.; \t\t\t#m/s\n", + "cp = 1.005; \t\t\t#kJ/kg K\n", + "R = 0.287; \t\t\t#kJ/kg K \n", + "\n", + "# Calculations and Results\n", + "print (\"(i) Reversible work and actual work \")\n", + "A1 = cp*(T1-T0)-T0*(cp*math.log(T1/T0)-R*math.log(p1/p0))+C1**2/2/10**3; \t\t\t#Availability at the inlet\n", + "A2 = cp*(T2-T0)-T0*(cp*math.log(T2/T0)-R*math.log(p2/p0))+C2**2/2/10**3; \t\t\t#Availability at the exit\n", + "\n", + "W_rev = A1-A2;\n", + "print (\"W_rev = %.3f\")%(W_rev), (\"kJ/kg\")\n", + "\n", + "W_act = cp*(T1-T2) + (C1**2-C2**2)/2/10**3;\n", + "print (\"W_act = %.3f\")%(W_act),(\"kJ/kg\")\n", + "\n", + "print (\"(ii) Irreversibilty and effectiveness = \")\n", + "\n", + "I = W_rev-W_act;\n", + "print (\"Irreversibilty = %.3f\")% (I), (\"kJ/kg\")\n", + "\n", + "Effectiveness = W_act/W_rev*100;\n", + "print (\"Effectiveness = %.3f\")%(Effectiveness),(\"%\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Reversible work and actual work \n", + "W_rev = 181.464 kJ/kg\n", + "W_act = 163.200 kJ/kg\n", + "(ii) Irreversibilty and effectiveness = \n", + "Irreversibilty = 18.264 kJ/kg\n", + "Effectiveness = 89.935 %\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 6.22 Page no : 335 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "p1 = 20.; \t\t\t#bar\n", + "t1 = 400.; \t\t\t#0C\n", + "p2 = 4.; \t\t\t#bar\n", + "t2 = 250.; \t\t\t#0C\n", + "t0 = 20.; \t\t\t#0C\n", + "T0 = t0+273;\n", + "h1 = 3247.6; \t\t\t#kJ/kg\n", + "s1 = 7.127; \t\t\t#kJ/kg K\n", + "#let h2' = h2a and s2' = s2a\n", + "h2a = 2964.3; \t\t\t#kJ/kg\n", + "s2a = 7.379; \t\t\t#kJ/kg K\n", + "s2 = s1;\n", + "s1a = s1;\n", + "#By interpolation, we get\n", + "h2 = 2840.8; \t\t\t#kJ/kg\n", + "\n", + "# Calculations and Results\n", + "n_isen = (h1-h2a)/(h1-h2);\n", + "print (\"(i)Isentropic efficiency = %.3f\")%(n_isen)\n", + "\n", + "A = h1-h2a + T0*(s2a-s1a);\n", + "print (\"(ii)Loss of availability = %.3f\")%(A), (\"kJ/kg\")\n", + "\n", + "Effectiveness = (h1-h2a)/A;\n", + "print (\"(iii)Effectiveness = %.3f\")% (Effectiveness)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i)Isentropic efficiency = 0.696\n", + "(ii)Loss of availability = 357.136 kJ/kg\n", + "(iii)Effectiveness = 0.793\n" + ] + } + ], + "prompt_number": 10 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Industrial_Instrumentation/.ipynb_checkpoints/ch7-checkpoint.ipynb b/Industrial_Instrumentation/.ipynb_checkpoints/ch7-checkpoint.ipynb new file mode 100644 index 00000000..50954e24 --- /dev/null +++ b/Industrial_Instrumentation/.ipynb_checkpoints/ch7-checkpoint.ipynb @@ -0,0 +1,198 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:83b04c725ceaf9254a1b319f62cfdfa8f3ba518f51286a3d08dbbb299f685e47" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 7 : Thermodynamic Relations" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.17 Page no : 370" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "B = 5.*10**(-5); \t\t\t# /K\n", + "K = 8.6*10**(-12); \t\t\t# m**2/N\n", + "v = 0.114*10**(-3); \t\t\t#m**3/kg\n", + "p2 = 800.*10**5; \t\t\t#Pa\n", + "p1 = 20.*10**5; \t\t\t#Pa\n", + "T = 288.; \t\t\t#K\n", + "\n", + "# Calculations and Results\n", + "W = -v*K/2*(p2**2-p1**2);\n", + "print (\"(i) Work done on the copper = %.3f\")%(W),(\"J/kg\")\n", + "\n", + "ds = -v*B*(p2-p1);\n", + "print (\"(ii) Change in entropy = %.3f\")% (ds), (\"J/kg K\")\n", + "\n", + "Q = T*ds;\n", + "print (\"(iii) The heat transfer = %.3f\")%(Q), (\"J/kg\")\n", + "\n", + "du = Q-W;\n", + "print (\"(iv) Change in internal energy = %.3f\")%(du),(\"J/kg\")\n", + "\n", + "R = B**2*T*v/K;\n", + "print (\"(v) cp \u2013 cv = %.3f\")%(R),(\"J/kg K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Work done on the copper = -3.135 J/kg\n", + "(ii) Change in entropy = -0.445 J/kg K\n", + "(iii) The heat transfer = -128.045 J/kg\n", + "(iv) Change in internal energy = -124.909 J/kg\n", + "(v) cp \u2013 cv = 9.544 J/kg K\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.18 Page no : 371" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "vg = 0.1274; \t\t\t#m**3/kg\n", + "vf = 0.001157; \t\t\t#m**3/kg\n", + "# dp/dT = 32; \t\t\t#kPa/K\n", + "T3 = 473; \t\t\t#K\n", + "\n", + "# Calculations\n", + "h_fg = 32*10**3*T3*(vg-vf)/10**3;\n", + "\n", + "# Results\n", + "print (\" enthalpy of vapourisation = %.3f\")%(h_fg),(\"kJ/kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " enthalpy of vapourisation = 1910.814 kJ/kg\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.19 Page no : 372" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "# Variables\n", + "h_fg = 334.; \t\t\t#kJ/kg\n", + "v_liq = 1.; \t\t\t#m**3/kg\n", + "v_ice = 1.01; \t\t\t#m**3/kg\n", + "T1 = 273.; \t\t\t#K\n", + "T2 = 263.; \t\t\t#K\n", + "p1 = 1.013*10**5; \t\t\t#Pa\n", + "\n", + "# Calculations\n", + "p2 = (p1+h_fg*10**3/(v_ice-v_liq)*math.log(T1/T2))/10**5;\n", + "\n", + "# Results\n", + "print (\"pressure = %.3f\")%(p2),(\"bar\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "pressure = 13.477 bar\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.20 Page no : 372" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "h_fg = 294.54; \t\t\t#kJ/kg\n", + "p = 0.1; \t\t\t#bar\n", + "T = 523; \t\t\t#K\n", + "\n", + "# Calculations\n", + "vg = h_fg*10**3/T/(2.302*3276.6*p*10**5/T**2 - 0.652*p*10**5/T);\n", + "\n", + "# Results\n", + "print (\"specific volume = %.3f\")%(vg),(\"m**3/kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "specific volume = 2.139 m**3/kg\n" + ] + } + ], + "prompt_number": 3 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Industrial_Instrumentation/.ipynb_checkpoints/ch8-checkpoint.ipynb b/Industrial_Instrumentation/.ipynb_checkpoints/ch8-checkpoint.ipynb new file mode 100644 index 00000000..0650ff08 --- /dev/null +++ b/Industrial_Instrumentation/.ipynb_checkpoints/ch8-checkpoint.ipynb @@ -0,0 +1,908 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:417a431bb73c0f7340e3aa0171c3fc4bd9ac17c782d95798e961af6aeee610ed" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 8 : Ideal and Real Gases" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.1 Page no : 392" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "R = 287.; \t\t\t#J/kg K\n", + "V1 = 40.; \t\t\t#m**3\n", + "V2 = 40.; \t\t\t#m**3\n", + "p1 = 1.*10**5; \t\t\t#Pa\n", + "p2 = 0.4*10**5; \t\t\t#Pa\n", + "T1 = 298.; \t\t\t#K\n", + "T2 = 278.; \t\t\t#K\n", + "\n", + "# Calculations\n", + "m1 = p1*V1/R/T1;\n", + "m2 = p2*V2/R/T2;\n", + "#Let mass of air removed be m\n", + "m = m1-m2;\n", + "\n", + "# Results\n", + "print (\"Mass of air removed = %.3f\")% (m),(\"kg\")\n", + "\n", + "V = m*R*T1/p1;\n", + "print (\"Volume of gas removed = %.3f\")% (V), (\"m**3\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass of air removed = 26.716 kg\n", + "Volume of gas removed = 22.849 m**3\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.2 Page no : 393" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "V = 0.04; \t\t\t#m**3\n", + "p = 120.*10**5; \t\t\t#Pa\n", + "T = 293.; \t\t\t#K\n", + "R0 = 8314.; \n", + "\n", + "# Calculations and Results\n", + "print (\"(i) kg of nitrogen the flask can hold\")\n", + "M = 28; \t\t\t#molecular weight of Nitrogen\n", + "R = R0/M;\n", + "\n", + "m = p*V/R/T;\n", + "print (\"kg of nitrogen = %.3f\")% (m), (\"kg\")\n", + "\n", + "print (\"(ii) Temperature at which fusible plug should melt\")\n", + "p = 150.*10**5; \t\t\t#Pa\n", + "T = p*V/R/m; \t\t\t#K\n", + "t = T-273; \t\t\t#0C\n", + "print (\"Temperature = %.3f\")% (t),(\"\u00b0C\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) kg of nitrogen the flask can hold\n", + "kg of nitrogen = 5.517 kg\n", + "(ii) Temperature at which fusible plug should melt\n", + "Temperature = 93.250 \u00b0C\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.3 Page no : 393" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "p1 = 1.*10**5; \t\t\t#Pa\n", + "T1 = 293.; \t\t\t#K\n", + "d = 6.; \t\t\t#m; diameter of the spherical balloon\n", + "p2 = 0.94*p1;\n", + "T2 = T1;\n", + "cv = 10400.; \t\t\t#J/kg K\n", + "R = 8314/2.;\n", + "r = 3.; \t\t\t#m\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) Mass of original gas escaped\")\n", + "\n", + "mass_escaped = (p1-p2)/p1*100;\n", + "print (\"%mass_escaped = \"), (mass_escaped), (\"%\")\n", + "\n", + "print (\"(ii)Amount of heat to be removed \")\n", + "T2 = 0.94*T1;\n", + "m = p1*4/3*math.pi*r**3/R/T1;\n", + "\n", + "Q = m*cv*(T1-T2)/10**6;\n", + "print (\"Q = %.3f\")% (Q),(\"MJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Mass of original gas escaped\n", + "%mass_escaped = 6.0 %\n", + "(ii)Amount of heat to be removed \n", + "Q = 1.698 MJ\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.4 Page no : 394" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from numpy import *\n", + "import math \n", + "\n", + "# Variables\n", + "m = 28.; \t\t\t#kg\n", + "V1 = 3.; \t\t\t#m**3\n", + "T1 = 363.; \t\t\t#K\n", + "R0 = 8314.;\n", + "M = 28.; \t\t\t#Molecular mass of N2\n", + "R = R0/m;\n", + "V2 = V1;\n", + "T2 = 293.; \t\t\t#K\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) Pressure (p1) and specific volume (v1) of the gas\")\n", + "\n", + "p1 = m*R*T1/V1/10**5; \t\t\t#bar\n", + "print (\"Pressure = %.3f\")% (p1), (\"bar\")\n", + "\n", + "v1 = V1/m;\n", + "print (\"specific volume = %.3f\")% (v1), (\"m**3/kg\")\n", + "\n", + "\n", + "#cp-cv = R/1000;\n", + "#cp-1.4cv = 0;\n", + "#solving the above two eqns \n", + "A = [[1,-1],[1,-1.4]];\n", + "B = [R/1000,0];\n", + "X = linalg.inv(A)*B;\n", + "cp = X[0,0]\n", + "print (\"cp = %.3f\")% (cp), (\"kJ/kg K\")\n", + "\n", + "cv = X[1][0];\n", + "print (\"cv = %.3f\")% (cv),(\"kJ/kg K\")\n", + "\n", + "print (\"(iii) Final pressure of the gas after cooling to 20\u00b0C\")\n", + "p2 = p1*T2/T1;\n", + "print (\"p2 = %.3f\")% (p2), (\"bar\")\n", + "\n", + "\n", + "du = cv*(T2-T1);\n", + "print (\"Increase in specific internal energy = %.3f\")% (du), (\"kJ/kg\")\n", + "\n", + "dh = cp*(T2-T1);\n", + "print (\"Increase in specific Enthalpy = %.3f\")%(dh), (\"kJ/kg\")\n", + "\n", + "v2 = v1;\n", + "ds = cv*math.log(T2/T1) + R*math.log(v2/v1);\n", + "print (\"Increase in specific entropy = %.3f\")%(ds),(\"kJ/kg K\")\n", + "\n", + "W = 0; \t\t\t#constant volume process\n", + "Q = m*du+W;\n", + "print (\"Heat transfer = %.3f\")%(Q), (\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Pressure (p1) and specific volume (v1) of the gas\n", + "Pressure = 10.060 bar\n", + "specific volume = 0.107 m**3/kg\n", + "cp = 1.039 kJ/kg K\n", + "cv = 0.742 kJ/kg K\n", + "(iii) Final pressure of the gas after cooling to 20\u00b0C\n", + "p2 = 8.120 bar\n", + "Increase in specific internal energy = -51.963 kJ/kg\n", + "Increase in specific Enthalpy = -72.748 kJ/kg\n", + "Increase in specific entropy = -0.159 kJ/kg K\n", + "Heat transfer = -1454.950 kJ\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.5 Page no : 396" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "print (\"Part (a)\")\n", + "# Variables\n", + "R = 0.287; \t\t\t#kJ/kg K\n", + "y = 1.4;\n", + "m1 = 1.; \t\t\t#kg\n", + "p1 = 8.*10**5; \t\t\t#Pa\n", + "T1 = 373.; \t\t\t#K\n", + "p2 = 1.8*10**5; \t\t\t#Pa\n", + "cv = 0.717; \t\t\t#kJ/kg K\n", + "n = 1.2;\n", + "\n", + "# Calculations and Results\n", + "#pv**1.2 = consmath.tant\n", + "print (\"(i) The final specific volume, temperature and increase in entropy\")\n", + "\n", + "v1 = R*10**3*T1/p1;\n", + "v2 = v1*(p1/p2)**(1./n);\n", + "print (\"v2 = %.3f\")%(v2), (\"m**3/kg\")\n", + "\n", + "T2 = p2*v2/R/10**3; \t\t\t#K\n", + "t2 = T2-273; \t\t\t#0C\n", + "print (\"Final temperature = %.3f\")% (t2), (\"0C\")\n", + "\n", + "ds = cv*math.log(T2/T1) + R*math.log(v2/v1);\n", + "print (\"ds = %.3f\")%(ds), (\"kJ/kg K\")\n", + "\n", + "\n", + "W = R*(T1-T2)/(n-1);\n", + "print (\"Work done = %.3f\")% (W), (\"kJ/kg\")\n", + "\n", + "Q = cv*(T2-T1) + W;\n", + "print (\"Heat transfer = %.3f\")%(Q),(\"kJ/kg\")\n", + "\n", + "print (\"Part (b)\")\n", + "\n", + "print (\"(i) Though the process is assumed now to be irreversible and adiabatic, the end states are given to be the same as in (a). Therefore, all the properties at the end of the process are the same as in (a).\")\n", + "\n", + "\n", + "print (\"(ii) Adiabatic process\")\n", + "Q = 0;\n", + "print (\"Heat transfer = %.3f\")%(Q), (\"kJ/kg\")\n", + "\n", + "W = -cv*(T2-T1);\n", + "print (\"Work done = %.3f\")%(W),(\"kJ/kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Part (a)\n", + "(i) The final specific volume, temperature and increase in entropy\n", + "v2 = 0.464 m**3/kg\n", + "Final temperature = 17.897 0C\n", + "ds = 0.179 kJ/kg K\n", + "Work done = 117.818 kJ/kg\n", + "Heat transfer = 58.950 kJ/kg\n", + "Part (b)\n", + "(i) Though the process is assumed now to be irreversible and adiabatic, the end states are given to be the same as in (a). Therefore, all the properties at the end of the process are the same as in (a).\n", + "(ii) Adiabatic process\n", + "Heat transfer = 0.000 kJ/kg\n", + "Work done = 58.868 kJ/kg\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.6 Page no : 397" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "d = 2.5; \t\t\t#m; diameter\n", + "V1 = 4./3*math.pi*(d/2)**3; \t\t\t#volume of each sphere\n", + "T1 = 298.; \t\t\t#K\n", + "T2 = 298.; \t\t\t#K\n", + "m1 = 16.; \t\t\t#kg\n", + "m2 = 8.; \t\t\t#kg\n", + "V = 2.*V1; \t\t\t#total volume\n", + "m = m1+m2;\n", + "R = 287.; \t\t\t#kJ/kg K\n", + "\n", + "# Calculations\n", + "p = m*R*T1/V/10**5; \t\t\t#bar\n", + "\n", + "\n", + "# Results\n", + "print (\"pressure in the spheres when the system attains equilibrium = %.3f\")%(p),(\"bar\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "pressure in the spheres when the system attains equilibrium = 1.254 bar\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.7 Page no : 398" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "m = 6.5/60; \t\t\t#kg/s\n", + "import math \n", + "cv = 0.837; \t\t\t#kJ/kg K\n", + "p1 = 10*10**5; \t\t\t#Pa\n", + "p2 = 1.05*10**5; \t\t\t#Pa\n", + "T1 = 453; \t\t\t#K\n", + "R0 = 8.314;\n", + "M = 44.; \t\t\t#Molecular mass of CO2\n", + "\n", + "\n", + "# Calculations and Results\n", + "R = R0/M;\n", + "cp = cv+R;\n", + "y = cp/cv;\n", + "\n", + "T2 = T1*(p2/p1)**((y-1)/y);\n", + "print T2\n", + "t2 = T2-273;\n", + "print (\"Final temperature = %.3f\")%(t2),(\"0C\")\n", + "\n", + "v2 = R*10**3*T2/p2; \t\t\t#m**3/kg\n", + "print (\"final specific volume = %.3f\")%(v2), (\"m**3/kg\")\n", + "\n", + "ds = 0; \t\t\t#Reversible and adiabatic process\n", + "print (\"Increase in entropy = \"), (ds)\n", + "\n", + "Q = 0; \t\t\t#Adiabatic process\n", + "print (\"Heat transfer rate from turbine = \"), (Q)\n", + "\n", + "W = m*cp*(T1-T2);\n", + "print (\"Power delivered by the turbine = %.3f\")% (W), (\"kW\")\n", + "\n", + "\n", + "# Note : answers wont match with the book because of the rounding error." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "299.106840283\n", + "Final temperature = 26.107 0C\n", + "final specific volume = 0.538 m**3/kg\n", + "Increase in entropy = 0\n", + "Heat transfer rate from turbine = 0\n", + "Power delivered by the turbine = 17.104 kW\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.8 Page no : 400" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "p1 = 8.*10**5; \t\t\t#Pa\n", + "V1 = 0.035; \t\t\t#m**3\n", + "T1 = 553.; \t\t\t#K\n", + "p2 = 8.*10**5; \t\t\t#Pa\n", + "V2 = 0.1; \t\t\t#m**3\n", + "n = 1.4;\n", + "R = 287.; \t\t\t#J/kg K\n", + "T3 = 553.; \t\t\t#K\n", + "cv = 0.71; \t\t\t#kJ/kg K\n", + "\n", + "# Calculations and Results\n", + "m = p1*V1/R/T1;\n", + "T2 = p2*V2/m/R;\n", + "p3 = p2/((T2/T3)**(n/(n-1)));\n", + "V3 = m*R*T3/p3;\n", + "\n", + "print (\"(i) The heat received in the cycle\")\n", + "\n", + "#constant pressure process 1-2\n", + "W_12 = p1*(V2-V1)/10**3; \t\t\t#kJ\n", + "Q_12 = m*cv*(T2-T1) + W_12; \t\t\t#kJ\n", + "\n", + "#polytropic process 2-3\n", + "W_23 = m*R/10**3*(T2-T3)/(n-1);\n", + "Q_23 = m*cv*(T3-T2) + W_23;\n", + "\n", + "Q_received = Q_12 + Q_23;\n", + "print (\"Total heat received in the cycle = \"),(Q_received), (\"kJ\")\n", + "\n", + "print (\"(ii) The heat rejected in the cycle\")\n", + "\n", + "#Isothermal process 3-1\n", + "W_31 = p3*V3*math.log(V1/V3)/10**3; \t\t\t#kJ\n", + "Q_31 = m*cv*(T3-T1) + W_31;\n", + "print (\"Heat rejected in the cycle = %.3f\")% (-Q_31), (\"kJ\")\n", + "\n", + "\n", + "n = (Q_received - (-Q_31))/Q_received*100;\n", + "print (\"Efficiency of the cycle = %.3f\")% (n), (\"%\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) The heat received in the cycle\n", + "Total heat received in the cycle = 182.0 kJ\n", + "(ii) The heat rejected in the cycle\n", + "Heat rejected in the cycle = 102.883 kJ\n", + "Efficiency of the cycle = 43.471 %\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.9 Page no : 424" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "# Variables\n", + "v = 44.; \t\t\t#m**3/kg-mol\n", + "T = 373.; \t\t\t#K\n", + "\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) Using Van der Waals\u2019 equation\")\n", + "a = 362850.; \t\t\t#N*m**4/(kg-mol)**2\n", + "b = 0.0423; \t\t\t#M**3/kg-mol\n", + "R0 = 8314.; \t\t\t#J/kg K\n", + "\n", + "p = ((R0*T/(v-b)) - a/v**2);\n", + "print (\"Pressure umath.sing Van der Waals equation = %.3f\")%(p), (\"N/m**2\")\n", + "\n", + "print (\"(ii) Using perfect gas equation\")\n", + "\n", + "p = R0*T/v;\n", + "print (\"Pressure using perfect gas equation = %.3f\")% (p), (\"N/m**2\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Using Van der Waals\u2019 equation\n", + "Pressure umath.sing Van der Waals equation = 70360.445 N/m**2\n", + "(ii) Using perfect gas equation\n", + "Pressure using perfect gas equation = 70480.045 N/m**2\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.10 Page no : 425" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "V = 3.; \t\t\t#m**3\n", + "m = 10.; \t\t\t#kg\n", + "T = 300.; \t\t\t#K\n", + "\n", + "# Calculations and Results\n", + "R0 = 8314.;\n", + "M = 44.; \n", + "R = R0/M;\n", + "p = m*R*T/V;\n", + "print (\"Pressure Using perfect gas equation = %.3f\")% (p),(\"N/m**2\")\n", + "\n", + "a = 362850; \t\t\t#Nm**4/(kg-mol)**2\n", + "b = 0.0423; \t\t\t#m**3/(kg-mol)\n", + "v = 13.2; \t\t\t #m**3/kg-mol\n", + "\n", + "p = R0*T/(v-b) - a/v**2;\n", + "print (\"Pressure Using Van der Waals\u2019 equation = %.3f\")%(p), (\"N/m**2\")\n", + "\n", + "\n", + "A0 = 507.2836;\n", + "a = 0.07132;\n", + "B0 = 0.10476;\n", + "b = 0.07235;\n", + "C = 66*10**4;\n", + "A = A0*(1-a/v);\n", + "B = B0*(1-b/v);\n", + "e = C/v/T**3;\n", + "\n", + "p = R0*T*(1-e)/v**2*(v+B) - A/v**2;\n", + "print (\"Pressure Using Beattie Bridgeman equation = %.3f\")%(p), (\"N/m**2\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Pressure Using perfect gas equation = 188954.545 N/m**2\n", + "Pressure Using Van der Waals\u2019 equation = 187479.533 N/m**2\n", + "Pressure Using Beattie Bridgeman equation = 190090.365 N/m**2\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.11 Page no : 404" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "# Variables\n", + "a = 139250; \t\t\t#Nm**4/(kg-mol)**2\n", + "b = 0.0314; \t\t\t#m**3/kg-mol\n", + "R0 = 8314; \t\t\t#Nm/kg-mol K\n", + "v1 = 0.2*32; \t\t\t#m**3/kg-mol\n", + "v2 = 0.08*32; \t\t\t#m**3/kg-mol\n", + "T = 333; \t\t\t#K\n", + "print (\"(i) Work done during the process\")\n", + "\n", + "# Calculations\n", + "def f21( v): \n", + "\t return R0*T/(v-b) - a/v**2\n", + "\n", + "W = quad(f21, v1, v2)[0]\n", + "\n", + "\n", + "# Results\n", + "print (\"W = %.3f\")% (W),(\"Nm/kg-mol\")\n", + "\n", + "\n", + "print (\"(ii) The final pressure\")\n", + "p2 = R0*T/(v2-b) - a/v2**2;\n", + "print (\"p2 = %.3f\")%(p2), (\"N/m**2\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Work done during the process\n", + "W = -2524722.415 Nm/kg-mol\n", + "(ii) The final pressure\n", + "p2 = 1073651.290 N/m**2\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.12 Page no : 404" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "pr = 20;\n", + "Z = 1.25;\n", + "Tr = 8.0;\n", + "Tc = 282.4; \t\t\t#K\n", + "\n", + "# Calculations\n", + "T = Tc*Tr;\n", + "\n", + "# Results\n", + "print (\"Temperature = %.3f\")%(T),(\"K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Temperature = 2259.200 K\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.13 Page no : 405" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "p = 260.*10**5; \t\t\t#Pa\n", + "T = 288.; \t\t\t#K\n", + "pc = 33.94*10**5; \t\t\t#Pa\n", + "Tc = 126.2; \t\t\t#K\n", + "R = 8314./28;\n", + "\n", + "# Calculations\n", + "pr = p/pc;\n", + "Tr = T/Tc;\n", + "Z = 1.08;\n", + "rho = p/Z/R/T;\n", + "\n", + "# Results\n", + "print (\"Density of N2 = %.3f\")% (rho), (\"kg/m**3\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Density of N2 = 281.517 kg/m**3\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.14 Page no : 405" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "p = 200.*10**5; \t\t\t#Pa\n", + "pc = 73.86*10**5; \t\t\t#Pa\n", + "Tc = 304.2; \t\t\t#K\n", + "pr = p/pc;\n", + "Z = 1;\n", + "Tr = 2.48;\n", + "\n", + "# Calculations\n", + "T = Tr*Tc;\n", + "\n", + "# Results\n", + "print (\"Temperature = \"), (T), (\"K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Temperature = 754.416 K\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.15 Page no : 405" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "# Variables\n", + "d = 12.; \t\t\t#m; diameter of spherical balloon\n", + "V = 4./3*math.pi*(d/2)**3;\n", + "T = 303.; \t\t\t#K\n", + "p = 1.21*10**5; \t\t\t#Pa\n", + "pc = 12.97*10**5; \t\t\t#Pa\n", + "Tc = 33.3; \t\t\t#K\n", + "R = 8314./2;\n", + "\n", + "# Calculations\n", + "pr = p/pc;\n", + "Tr = T/Tc;\n", + "Z = 1;\n", + "m = p*V/Z/R/T;\n", + "\n", + "# Results\n", + "print (\"Mass of H2 in the balloon = %.3f\")% (m), (\"kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass of H2 in the balloon = 86.917 kg\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.16 Page no : 406" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Calculations\n", + "Z_cp = 3./2-9./8;\n", + "\n", + "# Results\n", + "print (\"Z_cp = \"),(Z_cp)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Z_cp = 0.375\n" + ] + } + ], + "prompt_number": 17 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Industrial_Instrumentation/.ipynb_checkpoints/ch9-checkpoint.ipynb b/Industrial_Instrumentation/.ipynb_checkpoints/ch9-checkpoint.ipynb new file mode 100644 index 00000000..d03841d8 --- /dev/null +++ b/Industrial_Instrumentation/.ipynb_checkpoints/ch9-checkpoint.ipynb @@ -0,0 +1,1568 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:299eac653f64d8a7c5614d61c55d5e5b51bd64ec7dc4bb7d26a6abfad893f9e1" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 9 : Gases and Vapour Mixtures" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.1 Page no : 420" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "V = 0.35; \t\t\t#m**3\n", + "import math \n", + "m_CO = 0.4; \t\t\t#kg\n", + "m_air = 1; \t\t\t#kg\n", + "m_O2 = 0.233; \t\t\t#kg\n", + "m_N2 = 0.767; \t\t\t#kg\n", + "T = 293.; \t\t\t#K\n", + "R0 = 8.314; \t\t\t#kJ/kg K\n", + "M_O2 = 32.; \t\t\t#Molecular mass of O2\n", + "M_N2 = 28.; \t\t\t#Molecular mass of N2\n", + "M_CO = 28.; \t\t\t#Molecular mass of CO\n", + "\n", + "# Calculations and Results\n", + "\n", + "p_O2 = m_O2*R0*10**3*T/M_O2/V/10**5; \t\t\t#bar\n", + "print (\"partial pressure for p_O2 %.3f\")% (p_O2), (\"bar\")\n", + "\n", + "p_N2 = m_N2*R0*10**3*T/M_N2/V/10**5; \t\t\t#bar\n", + "print (\"partial pressure for p_N2 %.3f\")% (p_N2), (\"bar\")\n", + "\n", + "p_CO = m_CO*R0*10**3*T/M_CO/V/10**5; \t\t\t#bar\n", + "print (\"partial pressure for p_CO %.3f\")%(p_CO), (\"bar\")\n", + "\n", + "\n", + "print (\"(ii) Total pressure in the vessel\")\n", + "p = p_O2+p_N2+p_CO;\n", + "print (\"p = %.3f\")% (p), (\"bar\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "partial pressure for p_O2 0.507 bar\n", + "partial pressure for p_N2 1.907 bar\n", + "partial pressure for p_CO 0.994 bar\n", + "(ii) Total pressure in the vessel\n", + "p = 3.408 bar\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.2 Page no : 421" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "R0 = 8.314;\n", + "M_O2 = 32.;\n", + "M_N2 = 28.;\n", + "M_Ar = 40.;\n", + "M_CO2 = 44.;\n", + "\n", + "# Calculations\n", + "R_O2 = R0/M_O2; \t\t\t#kJ/kg K\n", + "R_N2 = R0/M_N2; \t\t\t#kJ/kg K\n", + "R_Ar = R0/M_Ar; \t\t\t#kJ/kg K\n", + "R_CO2 = R0/M_CO2; \t\t\t#kJ/kg K\n", + "\n", + "O2 = 0.2314;\n", + "N2 = 0.7553;\n", + "Ar = 0.0128;\n", + "CO2 = 0.0005;\n", + "\n", + "# Results\n", + "print (\"(i) Gas constant for air\")\n", + "R = O2*R_O2 + N2*R_N2 + Ar*R_Ar + CO2*R_CO2;\n", + "print (\"R = %.3f\")%(R), (\"kJ/kg K\")\n", + "\n", + "print (\"(ii) Apparent molecular weight.\")\n", + "M = R0/R;\n", + "print (\"M = %.3f\")%(M)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Gas constant for air\n", + "R = 0.287 kJ/kg K\n", + "(ii) Apparent molecular weight.\n", + "M = 28.954\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.3 Page no : 422" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "p = 1.; \t\t\t#bar\n", + "#For oxygen\n", + "m_O2 = 0.2314;\n", + "M_O2 = 32;\n", + "n_O2 = m_O2/M_O2;\n", + "#For Nitrogen\n", + "m_N2 = 0.7553;\n", + "M_N2 = 28.;\n", + "n_N2 = m_N2/M_N2;\n", + "#For Argon\n", + "m_Ar = 0.0128;\n", + "M_Ar = 40;\n", + "n_Ar = m_Ar/M_Ar;\n", + "\n", + "#For CO2\n", + "m_CO2 = 0.0005;\n", + "M_CO2 = 44;\n", + "n_CO2 = m_CO2/M_CO2;\n", + "\n", + "# Calculations and Results\n", + "n = n_O2 + n_N2 + n_Ar + n_CO2;\n", + "\n", + "#Let Vi/V be A\n", + "A_O2 = n_O2/n * 100;\n", + "print (\"Vi/V of O2 = %.3f\")%(A_O2),(\"%\")\n", + "\n", + "A_N2 = n_N2/n * 100;\n", + "print (\"Vi/V of N2 = %.3f\")%(A_N2), (\"%\")\n", + "\n", + "A_Ar = n_Ar/n *100;\n", + "print (\"Vi/V of Ar %.3f\")% (A_Ar), (\"%\")\n", + "\n", + "A_CO2 = n_CO2/n * 100;\n", + "print (\"Vi/V of CO2 = %.3f\")% (A_CO2), (\"%\")\n", + "\n", + "\n", + "P_O2 = n_O2/n*p;\n", + "print (\"Partial pressure of O2 = %.3f\")% (P_O2), (\"bar\")\n", + "\n", + "P_N2 = n_N2/n*p;\n", + "print (\"Partial pressure of N2 = %.3f\")% (P_N2), (\"bar\")\n", + "\n", + "P_Ar = n_Ar/n*p;\n", + "print (\"Partial pressure of Ar = %.3f\")% (P_Ar), (\"bar\")\n", + "\n", + "P_CO2 = n_CO2/n*p;\n", + "print (\"Partial pressure of CO2 = %.4f\")% (P_CO2), (\"bar\")\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Vi/V of O2 = 20.937 %\n", + "Vi/V of N2 = 78.103 %\n", + "Vi/V of Ar 0.927 %\n", + "Vi/V of CO2 = 0.033 %\n", + "Partial pressure of O2 = 0.209 bar\n", + "Partial pressure of N2 = 0.781 bar\n", + "Partial pressure of Ar = 0.009 bar\n", + "Partial pressure of CO2 = 0.0003 bar\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.4 Page no : 423" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "p = 1.*10**5; \t\t\t#Pa\n", + "T = 293.; \t\t\t#K\n", + "n_CO2 = 1.; \t\t\t#moles of CO2\n", + "n = 4.; \t\t\t#moles of air\n", + "M_CO2 = 44.;\n", + "M_N2 = 28.;\n", + "M_O2 = 32.;\n", + "\n", + "#Let A be the volumeetric analysis\n", + "A_O2 = 0.21;\n", + "A_N2 = 0.79;\n", + "\n", + "# Calculations and Results\n", + "n_O2 = A_O2*n;\n", + "n_N2 = A_N2*n;\n", + "\n", + "print (\"(i) The masses of CO2, O2 and N2, and the total mass\")\n", + "\n", + "m_CO2 = n_CO2*M_CO2;\n", + "print (\"Mass of CO2 = %.3f\")%(m_CO2),(\"kg\")\n", + "\n", + "m_O2 = n_O2*M_O2;\n", + "print (\"Mass of O2 = %.3f\")%(m_O2),(\"kg\")\n", + "\n", + "m_N2 = n_N2*M_N2;\n", + "print (\"Mass of N2 = %.3f\")%(m_N2),(\"kg\")\n", + "\n", + "m = m_CO2 + m_O2 + m_N2;\n", + "print (\"Total mass = %.3f\")% (m), (\"kg\")\n", + "\n", + "\n", + "print (\"(ii) The percentage carbon content by mass\")\n", + "#Since the molecular weight of carbon is 12, therefore, there are 12 kg of carbon present for every mole of CO2\n", + "m_C = 12; \t\t\t#kg\n", + "\n", + "C = m_C/m*100;\n", + "print (\"Percentage carbon in mixture %.3f\")%(C),(\"%\")\n", + "\n", + "\n", + "print (\"(iii) The apparent molecular weight and the gas consmath.tant for the mixture\")\n", + "n = n_CO2 + n_O2 + n_N2;\n", + "M = n_CO2/n*M_CO2 + n_O2/n*M_O2 + n_N2/n*M_N2;\n", + "print (\"Apparent Molecular weight %.3f\")%(M)\n", + "\n", + "R0 = 8.314;\n", + "R = R0/M;\n", + "print (\"Gas constant for the mixture = %.3f\")%(R),(\"kJ/kg K\")\n", + "\n", + "\n", + "print (\"(iv) The specific volume of the mixture\")\n", + "v = R*10**3*T/p;\n", + "print (\"specific volume = %.3f\")%(v),(\"m**3/kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) The masses of CO2, O2 and N2, and the total mass\n", + "Mass of CO2 = 44.000 kg\n", + "Mass of O2 = 26.880 kg\n", + "Mass of N2 = 88.480 kg\n", + "Total mass = 159.360 kg\n", + "(ii) The percentage carbon content by mass\n", + "Percentage carbon in mixture 7.530 %\n", + "(iii) The apparent molecular weight and the gas consmath.tant for the mixture\n", + "Apparent Molecular weight 31.872\n", + "Gas constant for the mixture = 0.261 kJ/kg K\n", + "(iv) The specific volume of the mixture\n", + "specific volume = 0.764 m**3/kg\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.5 Page no : 424" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "p = 1.*10**5; \t\t\t#Pa\n", + "T = 298.; \t\t\t#K\n", + "M_H2 = 2.;\n", + "M_O2 = 32.;\n", + "R0 = 8314.;\n", + "# ratio = V_H2/V_O2 = 2;\n", + "ratio = 2;\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) The mass of O2 required\")\n", + "\t\t\t#Let the mass of O2 per kg of H2 = x kg\n", + "m_H2 = 1; \t\t\t#kg\n", + "n_H2 = m_H2/M_H2;\n", + "\n", + "# n_O2 = x/M_O2\n", + "x = M_O2*n_H2/ratio;\n", + "print (\"Mass of O2 per kg of H2 = %.3f\")%(x), (\"kg\")\n", + "\n", + "print (\"(ii) The volume of the container\")\n", + "n_O2 = x/M_O2;\n", + "n = n_H2 + n_O2;\n", + "V = n*R0*T/p;\n", + "print (\"V = %.3f\")%(V), (\"m**3\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) The mass of O2 required\n", + "Mass of O2 per kg of H2 = 8.000 kg\n", + "(ii) The volume of the container\n", + "V = 18.582 m**3\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.6 Page no : 424" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Let composition of mixture by volume be denoted by c1\n", + "#Let Final composition desired be denoted by c2\n", + "\n", + "# Variables\n", + "c1_H2 = 0.78;\n", + "c1_CO = 0.22;\n", + "c2_H2 = 0.52;\n", + "c2_CO = 0.48;\n", + "M_H2 = 2.;\n", + "M_CO = 28.;\n", + "\n", + "# Calculations\n", + "M = c1_H2*M_H2 + c1_CO*M_CO;\n", + "# Let x kg of mixture be removed and y kg of CO be added.\n", + "x = (c1_H2 - c2_H2)/c1_H2*M;\n", + "\n", + "# Results\n", + "print (\"Mass of mixture removed = %.3f\")%(x), (\"kg\")\n", + "\n", + "y = M_CO/M*x;\n", + "print (\"Mass of CO added = %.3f\")%(y),(\"kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass of mixture removed = 2.573 kg\n", + "Mass of CO added = 9.333 kg\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.7 Page no : 425" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "ratio = 1./8; \t\t\t#volume ratio; v1/v2\n", + "T1 = 1223.; \t\t\t#K\n", + "cp_CO2 = 1.235; \t\t\t#kJ/kg K\n", + "cp_O2 = 1.088; \t\t\t#kJ/kg K\n", + "cp_N2 = 1.172; \t\t\t#kJ/kg K\n", + "n_CO2 = 0.13;\n", + "n_O2 = 0.125;\n", + "n_N2 = 0.745;\n", + "M_CO2 = 44.;\n", + "M_O2 = 32.;\n", + "M_N2 = 28.;\n", + "\n", + "\n", + "# Calculations\n", + "m_CO2 = M_CO2*n_CO2;\n", + "m_O2 = M_O2*n_O2;\n", + "m_N2 = M_N2*n_N2;\n", + "m = m_CO2 + m_O2 + m_N2;\n", + "\n", + "# Let Fraction by mass be denoted by F\n", + "F_CO2 = m_CO2/m;\n", + "F_O2 = m_O2/m;\n", + "F_N2 = m_N2/m;\n", + "cp = F_CO2*cp_CO2 + F_O2*cp_O2 + F_N2*cp_N2;\n", + "R0 = 8.314;\n", + "R = F_CO2*R0/M_CO2 + F_O2*R0/M_O2 + F_N2*R0/M_N2;\n", + "\n", + "cv = cp - R;\n", + "n = 1.2;\n", + "\n", + "print (\"(i) The workdone\")\n", + "T2 = T1*(ratio)**(n-1);\n", + "W = R*(T1-T2)/(n-1);\n", + "print (\"W = %.3f\")%(W), (\"kJ/kg\")\n", + "\n", + "print (\"(ii) The heat flow\")\n", + "du = cv*(T2-T1);\n", + "Q = du + W;\n", + "print (\"Q = %.3f\")%(Q), (\"kJ/kg\")\n", + "\n", + "\n", + "print (\"(iii) Change of entropy per kg of mixture\")\n", + "ds_1A = R*math.log(1/ratio); \t\t\t#isothermal process\n", + "ds_2A = cv*math.log(T1/T2);\n", + "\n", + "ds_12 = ds_1A - ds_2A;\n", + "print (\"change of entropy = %.3f\")% (ds_12), (\"kJ/kg K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) The workdone\n", + "W = 565.669 kJ/kg\n", + "(ii) The heat flow\n", + "Q = 190.777 kJ/kg\n", + "(iii) Change of entropy per kg of mixture\n", + "change of entropy = 0.191 kJ/kg K\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.8 Page no : 427" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "# Variables\n", + "M_CO2 = 44.;\n", + "M_H2 = 2.;\n", + "M_N2 = 28.;\n", + "M_CH4 = 16.;\n", + "M_CO = 28.;\n", + "\n", + "# Let volumetric analysis be denoted by V\n", + "V_CO = 0.28;\n", + "V_H2 = 0.13;\n", + "V_CH4 = 0.04;\n", + "V_CO2 = 0.04;\n", + "V_N2 = 0.51;\n", + "Cp_CO = 29.27; \t\t\t#kJ/mole K\n", + "Cp_H2 = 28.89; \t\t\t#kJ/mole K\n", + "Cp_CH4 = 35.8; \t\t\t#kJ/mole K\n", + "Cp_CO2 = 37.22; \t\t\t#kJ/mole K\n", + "Cp_N2 = 29.14; \t\t\t#kJ/mole K\n", + "R0 = 8.314; \n", + "\n", + "# Calculations and Results\n", + "Cp = V_CO*Cp_CO + V_H2*Cp_H2 + V_CO2*Cp_CO2 + V_CH4*Cp_CH4 + V_N2*Cp_N2;\n", + "print (\"Cp = %.3f\")%(Cp), (\"kJ/mole K\")\n", + "\n", + "Cv = Cp-R0;\n", + "print (\"Cv = %.3f\")% (Cv), (\"kJ/mole K\")\n", + "\n", + "M = V_CO*M_CO + V_H2*M_H2 + V_CO2*M_CO2 + V_CH4*M_CH4 + V_N2*M_N2;\n", + "\n", + "cp = Cp/M;\n", + "print (\"cp = %.3f\")%(cp), (\"kJ/kg K\")\n", + "\n", + "cv = Cv/M;\n", + "print (\"cv %.3f\")% (cv), (\"kJ/kg K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Cp = 29.733 kJ/mole K\n", + "Cv = 21.419 kJ/mole K\n", + "cp = 1.200 kJ/kg K\n", + "cv 0.864 kJ/kg K\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.9 Page no : 427" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "# Variables\n", + "p = 1.3 \t\t\t#bar\n", + "R0 = 8.314;\n", + "M_CO2 = 44.;\n", + "M_O2 = 32.;\n", + "M_N2 = 28.;\n", + "M_CO = 28.;\n", + "m_O2 = 0.1;\n", + "m_N2 = 0.7;\n", + "m_CO2 = 0.15;\n", + "m_CO = 0.05;\n", + "#Considering 1 kg of mixture\n", + "m = 1; \t\t\t#kg\n", + "\n", + "# Calculations\n", + "#let moles be denoted by n\n", + "n_O2 = m_O2/M_O2;\n", + "n_N2 = m_N2/M_N2;\n", + "n_CO2 = m_CO2/M_CO2;\n", + "n_CO = m_CO/M_CO;\n", + "M = 1/(m_O2/M_O2 + m_N2/M_N2 + m_CO2/M_CO2 + m_CO/M_CO);\n", + "n = m/M;\n", + "x_O2 = n_O2/n;\n", + "x_N2 = n_N2/n;\n", + "x_CO2 = n_CO2/n;\n", + "x_CO = n_CO/n;\n", + "\n", + "# Results\n", + "print (\"(i) Partial pressures of the constituents\")\n", + "P_O2 = x_O2*p;\n", + "print (\"Partial pressure of O2 = %.3f\")% (P_O2), (\"bar\")\n", + "\n", + "P_N2 = x_N2*p;\n", + "print (\"Partial pressure of N2 = %.3f\")% (P_N2), (\"bar\")\n", + "\n", + "P_CO2 = x_CO2*p;\n", + "print (\"Partial pressure of CO2 = %.3f\")% (P_CO2), (\"bar\")\n", + "\n", + "P_CO = x_CO*p;\n", + "print (\"Partial pressure of CO = %.3f\")% (P_CO), (\"bar\")\n", + "\n", + "R_mix = R0/M;\n", + "print (\"Gas constant of mixture = %.3f\")%(R_mix), (\"kJ/kg K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Partial pressures of the constituents\n", + "Partial pressure of O2 = 0.122 bar\n", + "Partial pressure of N2 = 0.975 bar\n", + "Partial pressure of CO2 = 0.133 bar\n", + "Partial pressure of CO = 0.070 bar\n", + "Gas constant of mixture = 0.277 kJ/kg K\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.10 Page no : 428" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "p = 4.*10**5; \t\t \t#Pa\n", + "import math \n", + "T = 293.; \t\t\t #K\n", + "R0 = 8.314;\n", + "\n", + "m_N2 = 4.; \t \t\t #kg\n", + "m_CO2 = 6.; \t\t\t #kg\n", + "\n", + "M_N2 = 28.; \t\t \t #Molecular mass\n", + "M_CO2 = 44.; \t\t\t #Molecular mass\n", + "\n", + "n_N2 = m_N2/M_N2; \t\t\t#moles of N2\n", + "n_CO2 = m_CO2/M_CO2; \t\t\t#moles of CO2\n", + "\n", + "x_N2 = n_N2/(n_N2+n_CO2);\n", + "print (\"x_N2 = %.3f\")% (x_N2)\n", + "\n", + "x_CO2 = n_CO2/(n_CO2+n_N2);\n", + "print (\"x_CO2 = %.3f\")% (x_CO2)\n", + "\n", + "\n", + "print (\"(ii) The equivalent molecular weight of the mixture\")\n", + "M = x_N2*M_N2 + x_CO2*M_CO2;\n", + "print (\"M = %.3f\")%(M), (\"kg/kg-mole\")\n", + "\n", + "print (\"(iii) The equivalent gas consmath.tant of the mixture\")\n", + "m = m_N2+m_CO2;\n", + "Rmix = (m_N2*(R0/M_N2) + m_CO2*(R0/M_CO2))/m;\n", + "print (\"Rmix = %.3f\")% (Rmix), (\"kJ/kg K\")\n", + "\n", + "print (\"(iv) The partial pressures and partial volumes\")\n", + "P_N2 = x_N2*p/10**5;\n", + "print (\"P_N2 = %.3f\")% (P_N2), (\"bar\")\n", + "\n", + "P_CO2 = x_CO2*p/10**5;\n", + "print (\"P_CO2 = %.3f\")% (P_CO2), (\"bar\")\n", + "\n", + "V_N2 = m_N2*R0/M_N2*T/p*10**3;\n", + "print (\"V_N2 %.3f\")% (V_N2), (\"m**3\")\n", + "\n", + "V_CO2 = m_CO2*R0/M_CO2*T/p*10**3;\n", + "print (\"V_CO2 %.3f\")% (V_CO2), (\"m**3\")\n", + "\n", + "print (\"(v) The volume and density of the mixture\")\n", + "\n", + "V = m*Rmix*10**3*T/p;\n", + "print (\"V = %.3f\")% (V), (\"m**3\")\n", + "\n", + "rho_mix = m/V;\n", + "print (\"Density of mixture = %.3f\")% (rho_mix), (\"kg/m**3\")\n", + "\n", + "\n", + "print (\"(vi) cp and cv of the mixture\")\n", + "\n", + "y_N2 = 1.4;\n", + "cv_N2 = (R0/M_N2)/(y_N2 - 1);\n", + "cp_N2 = cv_N2*y_N2;\n", + "\n", + "y_CO2 = 1.286;\n", + "cv_CO2 = (R0/M_CO2)/(y_CO2 - 1);\n", + "cp_CO2 = cv_CO2*y_CO2;\n", + "\n", + "cp = (m_N2*cp_N2 + m_CO2*cp_CO2)/(m_N2+m_CO2);\n", + "print (\"cp = %.3f\")%(cp),(\"kJ/kg K\")\n", + "\n", + "cv = (m_N2*cv_N2 + m_CO2*cv_CO2)/(m_N2+m_CO2);\n", + "print (\"cv = %.3f\")%(cv),(\"kJ/kg K\")\n", + "\n", + "T1 = 293.; \t\t\t#K\n", + "T2 = 323.; \t\t\t#K\n", + "dU = m*cv*(T2-T1);\n", + "print (\"Change in internal energy = %.3f\")% (dU), (\"kJ\")\n", + "\n", + "dH = m*cp*(T2-T1);\n", + "print (\"Change in enthalpy = %.3f\")% (dH), (\"kJ\")\n", + "\n", + "dS = m*cv*math.log(T2/T1); \t\t\t#Consmath.tant volume process\n", + "print (\"Change in entropy = %.3f\")% (dS), (\"kJ/kg K\")\n", + "\n", + "\n", + "print (\"When the mixture is heated at constant pressure\")\n", + "\n", + "print (\"If the mixture is heated at constant pressure \u0394U and \u0394H will remain the same\")\n", + "\n", + "dS = m*cp*math.log(T2/T1);\n", + "print (\"Change in entropy = %.3f\")% (dS), (\"kJ/kg K\")\n", + "\n", + "\n", + "# Note : Answers are slightly different because of rounding error." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x_N2 = 0.512\n", + "x_CO2 = 0.488\n", + "(ii) The equivalent molecular weight of the mixture\n", + "M = 35.814 kg/kg-mole\n", + "(iii) The equivalent gas consmath.tant of the mixture\n", + "Rmix = 0.232 kJ/kg K\n", + "(iv) The partial pressures and partial volumes\n", + "P_N2 = 2.047 bar\n", + "P_CO2 = 1.953 bar\n", + "V_N2 0.870 m**3\n", + "V_CO2 0.830 m**3\n", + "(v) The volume and density of the mixture\n", + "V = 1.700 m**3\n", + "Density of mixture = 5.881 kg/m**3\n", + "(vi) cp and cv of the mixture\n", + "cp = 0.925 kJ/kg K\n", + "cv = 0.693 kJ/kg K\n", + "Change in internal energy = 208.001 kJ\n", + "Change in enthalpy = 277.644 kJ\n", + "Change in entropy = 0.676 kJ/kg K\n", + "When the mixture is heated at constant pressure\n", + "If the mixture is heated at constant pressure \u0394U and \u0394H will remain the same\n", + "Change in entropy = 0.902 kJ/kg K\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.11 Page no : 430" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "Cv_O2 = 21.07; \t\t\t#kJ/mole K\n", + "Cv_CO = 20.86; \t\t\t#kJ/mole K\n", + "p_O2 = 8*10**5; \t\t\t#Pa\n", + "p_CO = 1*10**5; \t\t\t#Pa\n", + "V_O2 = 1.8; \t\t\t#m**3\n", + "V_CO = 3.6; \t\t\t#m**3\n", + "T_O2 = 323.; \t\t\t#K\n", + "T_CO = 293.; \t\t\t#K\n", + "R0 = 8314.;\n", + "\n", + "# Calculations and Results\n", + "n_O2 = p_O2*V_O2/R0/T_O2;\n", + "n_CO = p_CO*V_CO/R0/T_CO;\n", + "n = (n_O2+n_CO);\n", + "V = (V_O2+V_CO);\n", + "\n", + "print (\"(i) Final temperature (T) and pressure (p) of the mixture\")\n", + "\n", + "#Before mixing\n", + "U1 = n_O2*Cv_O2*T_O2 + n_CO*Cv_CO*T_CO;\n", + "\n", + "T = U1/(n_O2*Cv_O2 + n_CO*Cv_CO);\n", + "t = T-273;\n", + "\n", + "print (\"Final temperature = %.3f\")% (t), (\"\u00b0C\")\n", + "\n", + "p = n*R0*T/V/10**5;\n", + "print (\"Final pressure = %.3f\")% (p), (\"bar\")\n", + "\n", + "\n", + "#For oxygen\n", + "dS_O1A = n_O2*R0*math.log(V/V_O2); \t\t\t#isothermal process\n", + "dS_O2A = n_O2*Cv_O2*math.log(T_O2/T); \t\t\t#consmath.tant volume process\n", + "dS_O12 = dS_O1A - dS_O2A; \t\t\t# Change of entropy of O2\n", + "\n", + "#For CO\n", + "dS_CO12 = n_CO*R0*math.log(V/V_CO) + n_CO*Cv_CO*math.log(T/T_CO); \t\t\t#Change of entropy of CO\n", + "dS = (dS_O12 + dS_CO12)/10**3;\n", + "print (\"(ii)Change of entropy of system = %.3f\")% (dS), (\"kJ/K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Final temperature (T) and pressure (p) of the mixture\n", + "Final temperature = 43.569 \u00b0C\n", + "Final pressure = 3.334 bar\n", + "(ii)Change of entropy of system = 5.396 kJ/K\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.12 Page no : 432" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "p_A = 16.*10**5; \t\t\t#Pa\n", + "p_B = 6.4*10**5; \t\t\t#Pa\n", + "\n", + "T_A = 328.; \t\t\t#K\n", + "T_B = 298.; \t\t\t#K\n", + "\n", + "n_A = 0.6 \t\t\t#kg-mole\n", + "m_B = 3; \t \t\t#kg\n", + "\n", + "R0 = 8314.;\n", + "M_A = 28.; \n", + "y = 1.4;\n", + "\n", + "V_A = n_A*R0*T_A/p_A;\n", + "m_A = n_A*M_A;\n", + "R = R0/M_A;\n", + "V_B = m_B*R*T_B/p_B;\n", + "V = V_A+V_B;\n", + "m = m_A+m_B;\n", + "T = 303.; \t\t\t#K\n", + "\n", + "print (\"(a) (i) Final equilibrium pressure, p\")\n", + "p = m*R*T/V/10**5;\n", + "print (\"p = %.3f\")% (p), (\"bar\")\n", + "\n", + "cv = R/10**3/(y-1);\n", + "\n", + "print (\"(ii) Amount of heat transferred, Q :\")\n", + "\n", + "U1 = cv*(m_A*T_A + m_B*T_B);\n", + "U2 = m*cv*T;\n", + "Q = U2-U1;\n", + "print (\"Q = %.3f\")% (Q),(\"kJ\")\n", + "\n", + "print (\"(b) If the vessel were insulated :\")\n", + "\n", + "print (\"(i) Final temperature,\")\n", + "\n", + "T = cv*(m_A*T_A + m_B*T_B)/(m*cv);\n", + "t = T-273;\n", + "print (\"T = %.3f\")% (t), (\"\u00b0C\")\n", + "\n", + "\n", + "print (\"(ii) Final pressure\")\n", + "\n", + "p = m*R*T/V/10**5;\n", + "print (\"p = %.3f\")% (p), (\"bar\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a) (i) Final equilibrium pressure, p\n", + "p = 12.393 bar\n", + "(ii) Amount of heat transferred, Q :\n", + "Q = -300.640 kJ\n", + "(b) If the vessel were insulated :\n", + "(i) Final temperature,\n", + "T = 50.455 \u00b0C\n", + "(ii) Final pressure\n", + "p = 13.230 bar\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.13 Page no : 434" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "m_O2 = 3.; \t\t\t#kg\n", + "M_O2 = 32.;\n", + "m_N2 = 9.; \t\t\t#kg\n", + "M_N2 = 28.;\n", + "R0 = 8.314;\n", + "\n", + "# Calculations\n", + "R_O2 = R0/M_O2;\n", + "R_N2 = R0/M_N2;\n", + "x_O2 = (m_O2/M_O2)/((m_O2/M_O2) + (m_N2/M_N2));\n", + "x_N2 = (m_N2/M_N2)/((m_O2/M_O2) + (m_N2/M_N2));\n", + "dS = -m_O2*R_O2*math.log(x_O2) -m_N2*R_N2*math.log(x_N2);\n", + "\n", + "# Results\n", + "print (\"Change in entropy = %.3f\")% (dS),(\"kJ/kg K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Change in entropy = 1.844 kJ/kg K\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.14 Page no : 434" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "m_N2 = 2.5; \t\t\t#kg \n", + "M_N2 = 28.;\n", + "p_N2 = 15.; \t\t\t#bar\n", + "p_total = 20.; \t\t\t#bar\n", + "\n", + "# Calculations\n", + "n_N2 = m_N2/M_N2;\n", + "p_O2 = p_total-p_N2;\n", + "n_O2 = p_O2/p_N2*n_N2;\n", + "M_O2 = 32;\n", + "m_O2 = n_O2*M_O2;\n", + "\n", + "# Results\n", + "print (\"Mass of O2 added = %.3f\")% (m_O2), (\"kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass of O2 added = 0.952 kg\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.15 Page no : 435" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "n_O2 = 1.;\n", + "M_N2 = 28.;\n", + "M_O2 = 32.;\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) Moles of N2 per mole of O2 :\")\n", + "n_N2 = n_O2*0.79/0.21;\n", + "print (\"n_N2 = %.3f\")%(n_N2),(\"moles\")\n", + "\n", + "n = n_O2+n_N2;\n", + "print (\"(ii)\")\n", + "p = 1; \t\t\t#atm\n", + "\n", + "p_O2 = n_O2/n*p;\n", + "print (\"p_O2 = %.3f\")% (p_O2), (\"atm\")\n", + "\n", + "p_N2 = n_N2/n*p;\n", + "print (\"p_N2 = %.3f\")% (p_N2), (\"atm\")\n", + "\n", + "\n", + "x = n_N2*M_N2/(n_N2*M_N2+n_O2*M_O2);\n", + "print (\"(iii) The kg of nitrogen per kg of mixture = %.3f\")% (x), (\"kg N2/kg mix\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Moles of N2 per mole of O2 :\n", + "n_N2 = 3.762 moles\n", + "(ii)\n", + "p_O2 = 0.210 atm\n", + "p_N2 = 0.790 atm\n", + "(iii) The kg of nitrogen per kg of mixture = 0.767 kg N2/kg mix\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.16 Page no : 436" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "V = 0.6; \t\t\t#m**3\n", + "p1 = 12.*10**5; \t\t\t#Pa\n", + "p2 = 18.*10**5; \t\t\t#Pa\n", + "T = 298.; \t\t\t#K\n", + "R0 = 8.314;\n", + "x_O2 = 0.23;\n", + "x_N2 = 0.77;\n", + "\n", + "n = p1*V/R0/10**3/T;\n", + "#Considering 100 kg of air\n", + "m_O2 = 23.; \t\t\t#kg\n", + "m_N2 = 77.; \t\t\t#kg\n", + "M_O2 = 32.;\n", + "M_N2 = 28.;\n", + "m = 100.; \t\t\t#kg\n", + "\n", + "# Calculations and Results\n", + "R = (m_O2/M_O2 + m_N2/M_N2)*R0/m; \t\t\t#for air\n", + "M = R0/R \t \t\t#for air\n", + "\n", + "m = p1*V/R/T/10**3;\n", + "\n", + "m_O2 = x_O2*m;\n", + "print (\"Mass of O2 = %.3f\")% (m_O2), (\"kg\")\n", + "\n", + "m_N2 = x_N2*m;\n", + "print (\"Mass of N2 = %.3f\")% (m_N2), (\"kg\")\n", + "\n", + "#After adding CO2 in the vessel\n", + "p2 = 18.*10**5; \t\t\t#Pa;\n", + "\n", + "p_CO2 = 6.*10**5; \t\t\t#Pa\n", + "M_CO2 = 44.;\n", + "R_CO2 = R0/M_CO2;\n", + "\n", + "m_CO2 = p_CO2*V/(R_CO2*10**3*T);\n", + "print (\"Mass of CO2 = %.3f\")% (m_CO2), (\"kg\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass of O2 = 1.927 kg\n", + "Mass of N2 = 6.451 kg\n", + "Mass of CO2 = 6.393 kg\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.17 Page no : 437" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "V = 6; \t\t \t#m**3\n", + "A = 0.45; \n", + "B = 0.55;\n", + "R_A = 0.288; \t\t\t#kJ/kg K\n", + "R_B = 0.295; \t\t\t#kJ/kg K\n", + "m = 2. \t\t\t#kg\n", + "T = 303. \t\t\t #K\n", + "\n", + "# Calculations\n", + "print (\"(i) The partial pressures\")\n", + "m_A = A*m;\n", + "m_B = B*m;\n", + "\n", + "p_A = m_A*R_A*10**3*T/V/10**5; \t\t\t#bar\n", + "print (\"p_A = %.3f\")% (p_A), (\"bar\")\n", + "\n", + "p_B = m_B*R_B*10**3*T/V/10**5; \t\t\t#bar\n", + "print (\"p_B = %.3f\")% (p_B), (\"bar\")\n", + "\n", + "\n", + "print (\"(ii) The total pressure\")\n", + "p = p_A+p_B;\n", + "print (\"p = %.3f\")% (p), (\"bar\")\n", + "\n", + "\n", + "print (\"(iii) The mean value of R for the mixture\")\n", + "Rm = (m_A*R_A + m_B*R_B)/(m_A + m_B);\n", + "print (\"Rm = %.3f\")% (Rm), (\"kJ/kg K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) The partial pressures\n", + "p_A = 0.131 bar\n", + "p_B = 0.164 bar\n", + "(ii) The total pressure\n", + "p = 0.295 bar\n", + "(iii) The mean value of R for the mixture\n", + "Rm = 0.292 kJ/kg K\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.18 Page no : 438" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "m_O2 = 4.; \t\t\t#kg\n", + "m_N2 = 6.; \t\t\t#kg\n", + "p = 4.*10**5; \t\t\t#Pa\n", + "T = 300.; \t\t\t#K\n", + "M_O2 = 32.;\n", + "M_N2 = 28.;\n", + "m = 10.; \t\t\t#kg\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) The mole fraction of each component\")\n", + "n_O2 = m_O2/M_O2;\n", + "n_N2 = m_N2/M_N2;\n", + "\n", + "x_O2 = n_O2/(n_O2+n_N2);\n", + "print (\"x_O2 = %.3f\")% (x_O2)\n", + "\n", + "x_N2 = n_N2/(n_N2+n_O2);\n", + "print (\"x_N2 = %.3f\")% (x_N2)\n", + "\n", + "\n", + "print (\"(ii) The average molecular weight\")\n", + "M = (n_O2*M_O2 + n_N2*M_N2)/(n_O2 + n_N2);\n", + "print (\"M = %.3f\")%(M)\n", + "\n", + "print (\"(iii) The specific gas consmath.tant\")\n", + "R0 = 8.314;\n", + "R = R0/M;\n", + "print (\"R = %.3f\")% (R), (\"kJ/kg K\")\n", + "\n", + "print (\"(iv) The volume and density\")\n", + "V = m*R*T*10**3/p;\n", + "print (\"V = %.3f\")%(V), (\"m**3\")\n", + "\n", + "rho = (m_O2/V) + (m_N2/V);\n", + "print (\"density = %.3f\")% (rho), (\"kg/m**3\")\n", + "\n", + "\n", + "print (\"(v) The partial pressures and partial volumes\")\n", + "p_O2 = n_O2*R0*10**3*T/V/10**5; \t\t\t#bar\n", + "print (\"p_O2 = %.3f\")%(p_O2), (\"bar\")\n", + "\n", + "p_N2 = n_N2*R0*10**3*T/V/10**5; \t\t\t#bar\n", + "print (\"p_N2 = %.3f\")% (p_N2), (\"bar\")\n", + "\n", + "V_O2 = x_O2*V;\n", + "print (\"V_O2 = %.3f\")% (V_O2), (\"m**3\")\n", + "\n", + "V_N2 = x_N2*V;\n", + "print (\"V_N2 = %.3f\")% (V_N2), (\"m**3\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) The mole fraction of each component\n", + "x_O2 = 0.368\n", + "x_N2 = 0.632\n", + "(ii) The average molecular weight\n", + "M = 29.474\n", + "(iii) The specific gas consmath.tant\n", + "R = 0.282 kJ/kg K\n", + "(iv) The volume and density\n", + "V = 2.116 m**3\n", + "density = 4.727 kg/m**3\n", + "(v) The partial pressures and partial volumes\n", + "p_O2 = 1.474 bar\n", + "p_N2 = 2.526 bar\n", + "V_O2 = 0.779 m**3\n", + "V_N2 = 1.336 m**3\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.19 Page no : 439" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "cp_CO2 = 0.85; \t\t\t#kJ/kg K\n", + "cp_N2 = 1.04; \t\t\t#kJ/kg K\n", + "m_CO2 = 4.; \t\t\t#kg\n", + "T1_CO2 = 313.; \t\t\t#K\n", + "m_N2 = 8.; \t\t\t#kg\n", + "T1_N2 = 433.; \t\t\t#K\n", + "p2 = 0.7; \t\t\t#bar\n", + "p1_CO2 = 1.4; \t\t\t#bar\n", + "p1_N2 = 1.;\n", + "R = 8.314;\n", + "M_CO2 = 44.;\n", + "M_N2 = 28.;\n", + "R_CO2 = R/M_CO2;\n", + "R_N2 = R/M_N2;\n", + "\n", + "# Calculations and Results\n", + "print (\"(i) Final temperature, T2\")\n", + "T2 = (m_CO2*cp_CO2*T1_CO2 + m_N2*cp_N2*T1_N2)/(m_CO2*cp_CO2 + m_N2*cp_N2);\n", + "print (\"T2 = %.3f\")%(T2),(\"K\")\n", + "\n", + "print (\"(ii) Change in entropy\")\n", + "n_CO2 = 0.0909;\n", + "n_N2 = 0.2857;\n", + "n = n_CO2 + n_N2;\n", + "x_CO2 = n_CO2/n;\n", + "x_N2 = n_N2/n;\n", + "p2_CO2 = x_CO2*p2;\n", + "p2_N2 = x_N2*p2;\n", + "\n", + "dS = m_CO2*cp_CO2*math.log(T2/T1_CO2) - m_CO2*R_CO2*math.log(p2_CO2/p1_CO2) + m_N2*cp_N2*math.log(T2/T1_N2) - m_N2*R_N2*math.log(p2_N2/p1_N2);\n", + "print (\"dS = %.3f\")%(dS), (\"kJ/K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Final temperature, T2\n", + "T2 = 398.188 K\n", + "(ii) Change in entropy\n", + "dS = 3.223 kJ/K\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.20 Page no : 440" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "# Variables\n", + "cv_O2 = 0.39; \t\t\t#kJ/kg K\n", + "cv_N2 = 0.446; \t\t\t#kJ/kg K\n", + "n_O2 = 1.;\n", + "n_N2 = 2.;\n", + "M_O2 = 32.;\n", + "M_N2 = 28.;\n", + "m_O2 = 32.; \t\t\t#kg\n", + "m_N2 = 2*28.; \t\t\t#kg\n", + "T_O2 = 293.; \t\t\t#K\n", + "T_N2 = 301.; \t\t\t#K\n", + "R0 = 8.314;\n", + "\n", + "# Calculations\n", + "p_O2 = 2.5*10**5; \t\t\t#Pa\n", + "p_N2 = 1.5*10**5; \t\t\t#Pa\n", + "T2 = (m_O2*cv_O2*T_O2 + m_N2*cv_N2*T_N2)/(m_O2*cv_O2 + m_N2*cv_N2);\n", + "V_O2 = n_O2*R0*10**5*T_O2/p_O2;\n", + "V_N2 = n_N2*R0*10**5*T_N2/p_N2;\n", + "V = V_O2+V_N2;\n", + "dS = m_O2*(cv_O2*math.log(T2/T_O2) + R0/M_O2*math.log(V/V_O2)) + m_N2*(cv_N2*math.log(T2/T_N2) + R0/M_N2*math.log(V/V_N2));\n", + "\n", + "# Results\n", + "print (\"Entropy change in the mixing process = %.3f\")%(dS),(\"kJ\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Entropy change in the mixing process = 16.627 kJ\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.21 Page no : 421" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "cv_N2 = 0.744; \t\t\t#kJ/kg K\n", + "cv_H2 = 10.352; \t\t\t#kJ/kg K\n", + "cp_N2 = 1.041; \t\t\t#kJ/kg K\n", + "cp_H2 = 14.476; \t\t\t#kJ/kg K\n", + "V = 0.45; \t\t\t#m**3\n", + "V_H2 = 0.3; \t\t\t#m**3\n", + "V_N2 = 0.15; \t\t\t#m**3\n", + "p_H2 = 3.*10**5; \t\t\t#Pa\n", + "p_N2 = 6.*10**5; \t\t\t#Pa\n", + "T_H2 = 403.; \t\t\t#K\n", + "T_N2 = 303.; \t\t\t#K\n", + "\n", + "# Calculations and Results\n", + "R_H2 = 8.314/2;\n", + "R_N2 = 8.314/28;\n", + "\n", + "print (\"(i) Temperature of equilibrium mixture\")\n", + "\n", + "m_H2 = p_H2*V_H2/(R_H2*10**3)/T_H2;\n", + "m_N2 = p_N2*V_N2/(R_N2*10**3)/T_N2;\n", + "T2 = (m_H2*cv_H2*T_H2 + m_N2*cv_N2*T_N2)/(m_H2*cv_H2 + m_N2*cv_N2);\n", + "print (\"T2 = %.3f\")%(T2),(\"K\")\n", + "\n", + "print (\"(ii) Pressure of the mixture\")\n", + "p2_H2 = m_H2*R_H2*10**3*T2/V;\n", + "p2_N2 = m_N2*R_N2*10**3*T2/V;\n", + "\n", + "p2 = p2_H2+p2_N2;\n", + "print (\"p2 = %.3f\")%(p2/10**5),(\"bar\")\n", + "\n", + "print (\"(iii) Change in entropy :\")\n", + "\n", + "dS_H2 = m_H2*(cp_H2*math.log(T2/T_H2) - R_H2*math.log(p2_H2/p_H2));\n", + "print (\"Change in entropy of H2 = %.3f\")%(dS_H2),(\"kJ/K\")\n", + "\n", + "dS_N2 = m_N2*(cp_N2*math.log(T2/T_N2) - R_N2*math.log(p2_N2/p_N2));\n", + "print (\"Change in entropy of N2 = %.3f\")%(dS_N2),(\"kJ/K\")\n", + "\n", + "dS = dS_H2+dS_N2;\n", + "\n", + "print (\"Total change in entropy = %.3f\")%(dS),(\"kJ/K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Temperature of equilibrium mixture\n", + "T2 = 345.767 K\n", + "(ii) Pressure of the mixture\n", + "p2 = 3.998 bar\n", + "(iii) Change in entropy :\n", + "Change in entropy of H2 = 0.006 kJ/K\n", + "Change in entropy of N2 = 0.425 kJ/K\n", + "Total change in entropy = 0.430 kJ/K\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.22 Page no : 443" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "cv_N2 = 0.745; \t\t\t#kJ/kg K\n", + "cv_CO2 = 0.653; \t\t#kJ/kg K\n", + "cp_N2 = 1.041; \t\t\t#kJ/kg K\n", + "cp_CO2 = 0.842; \t\t#kJ/kg K\n", + "m_N2 = 4.; \t\t\t#kg\n", + "m_CO2 = 6.; \t\t#kg\n", + "pmix = 4.; \t\t \t#bar\n", + "m = m_N2+m_CO2;\n", + "\n", + "T1 = 298.; \t\t\t #K\n", + "T2 = 323.; \t\t\t #K\n", + "\n", + "# Calculations and Results\n", + "cv_mix = (m_N2*cv_N2 + m_CO2*cv_CO2)/(m_N2+m_CO2);\n", + "print (\"cv_mix = %.3f\")% (cv_mix), (\"kJ/kg K\")\n", + "\n", + "cp_mix = (m_N2*cp_N2 + m_CO2*cp_CO2)/(m_N2+m_CO2);\n", + "print (\"cp_mix = %.3f\")% (cp_mix), (\"kJ/kg K\")\n", + "\n", + "dU = m*cv_mix*(T2-T1);\n", + "print (\"Change in internal energy = %.3f\")% (dU), (\"kJ\")\n", + "\n", + "dH = m*cp_mix*(T2-T1);\n", + "print (\"Change in enthalpy = %.3f\")% (dH), (\"kJ\")\n", + "\n", + "dS = m_N2*cv_N2*math.log(T2/T1) + m_CO2*cv_CO2*math.log(T2/T1);\n", + "print (\"Change in entropy = %.3f\")% (dS), (\"kJ/K\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "cv_mix = 0.690 kJ/kg K\n", + "cp_mix = 0.922 kJ/kg K\n", + "Change in internal energy = 172.450 kJ\n", + "Change in enthalpy = 230.400 kJ\n", + "Change in entropy = 0.556 kJ/K\n" + ] + } + ], + "prompt_number": 24 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Let us C/.ipynb_checkpoints/chapter-1-checkpoint.ipynb b/Let us C/.ipynb_checkpoints/chapter-1-checkpoint.ipynb new file mode 100644 index 00000000..4cecffc4 --- /dev/null +++ b/Let us C/.ipynb_checkpoints/chapter-1-checkpoint.ipynb @@ -0,0 +1,206 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:60404711a4c9350ab7400b58d60d8f79998ec8ffd254f6ba451a391153d071d5" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 1: Getting Started

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 1.1 Page number: 14

\n", + " " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "p = 1000 #principle\n", + "n = 3 # number of years\n", + "r = 8.5 # rate of interest\n", + "\n", + "#Calculation\n", + "si = p * n * r / 100 ; #formula for simple interest\n", + "\n", + "#Result\n", + "print ( si )\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "255.0\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 1.2, Page number: 21

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "p = 100 # principle\n", + "n = 5 # number of years\n", + "r = 15.5 # rate of interest\n", + "\n", + "#Calculation\n", + "si = p * n * r / 100 ; #formula for simple interest\n", + "\n", + "#Result\n", + "print ( si )\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "77.5\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 1.3 Page number: 22

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "num = 11\n", + "\n", + "#Result\n", + "print \"Now I am letting you on a secret...\" \n", + "print \"You have just entered the number\", num \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Now I am letting you on a secret...\n", + "You have just entered the number 11\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 1.4, Page number: 32

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "i1 = 2 * 3 # operation *\n", + "i2 = i1 / 4 # operation /\n", + "i3 = 4 / 4 # operation /\n", + "i4 = 5 / 8 # operation /\n", + "i5 = i2 + i3 # operation +\n", + "i6 = i5 + 8 # operation +\n", + "i7 = i6 - 2 # operation -\n", + "i8 = i7 + i4 # operation +\n", + "i = i8\n", + "\n", + "#Result\n", + "print \"i = \", i" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "i = 8\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 1.5, Page number: 33

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "kk1 = 3 / 2# operation /\n", + "kk2 = kk1 * 4 # operation *\n", + "kk3 = 3 / 8 # operation /\n", + "kk4 = kk2 + kk3 # operation +\n", + "kk5 = kk4 + 3 # operation +\n", + "kk = kk5\n", + "\n", + "#Result\n", + "print \"kk = \", kk\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "kk = 7\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Let us C/.ipynb_checkpoints/chapter-10-checkpoint.ipynb b/Let us C/.ipynb_checkpoints/chapter-10-checkpoint.ipynb new file mode 100644 index 00000000..8cdeeb5f --- /dev/null +++ b/Let us C/.ipynb_checkpoints/chapter-10-checkpoint.ipynb @@ -0,0 +1,483 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:1213afa9e1e3e4548a86a08e5402d57c78d8521d4dc9c374d9b66fbb38bf7943" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 10: Structures

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.1, Page number: 365

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "name = []\n", + "price = []\n", + "pages = []\n", + "\n", + "n =[\"A\",\"C\",\"F\"]\n", + "p=[100.00,256.50,233.70]\n", + "pg=[354,682,512]\n", + "\n", + "print \"Enter names, prices and no. of pages of 3 books \" \n", + "\n", + "for i in range(0,3):\n", + " #n,p,pg = raw_input(\"\").split()\n", + " print n[i],p[i],pg[i]\n", + " name.append(n[i])\n", + " price.append(p[i])\n", + " pages.append(pg[i])\n", + "\n", + "print \"And this is what you entered\" \n", + "\n", + "for i in range(0,3):\n", + " print name[i], price[i], pages[i] " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter names, prices and no. of pages of 3 books \n", + "A 100.0 354\n", + "C 256.5 682\n", + "F 233.7 512\n", + "And this is what you entered\n", + "A 100.0 354\n", + "C 256.5 682\n", + "F 233.7 512\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.2, Page number: 366

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from collections import namedtuple\n", + "#Structure defintion\n", + "struct_book = namedtuple(\"struct_book\", \"name price pages\")\n", + "\n", + "#Input from user\n", + "print \"Enter names, prices & no. of pages of 3 books\" \n", + "#b1n,b1p,b1pg = raw_input(\"\").split()\n", + "#b2n,b2p,b2pg = raw_input(\"\").split()\n", + "#b3n,b3p,b3pg = raw_input(\"\").split()\n", + "n =[\"A\",\"C\",\"F\"]\n", + "p=[100.00,256.50,233.70]\n", + "pg=[354,682,512]\n", + "print n[0],p[0],pg[0]\n", + "print n[1],p[1],pg[1]\n", + "print n[2],p[2],pg[2]\n", + "#Structures for 3 books\n", + "b1 = struct_book(n[0], p[0], pg[0])\n", + "b2 = struct_book(n[1], p[1], pg[1])\n", + "b3 = struct_book(n[2], p[2], pg[2])\n", + "\n", + "\n", + "#Result\n", + "print \"And this is what you entered\" \n", + "print b1.name, b1.price, b1.pages \n", + "print b2.name, b2.price, b2.pages \n", + "print b3.name, b3.price, b3.pages \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter names, prices & no. of pages of 3 books\n", + "A 100.0 354\n", + "C 256.5 682\n", + "F 233.7 512\n", + "And this is what you entered\n", + "A 100.0 354\n", + "C 256.5 682\n", + "F 233.7 512\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.3 , Page number: 370

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from collections import namedtuple\n", + "#Structure defintion\n", + "struct_book = namedtuple(\"struct_book\", \"name price pages\")\n", + "\n", + "#Structures for a book\n", + "b1 = struct_book('B', 130.00, 550)\n", + "\n", + "#Result\n", + "print \"Address of name = \", id(b1.name )\n", + "print \"Address of price = \", id(b1.price )\n", + "print \"Address of pages = \", id(b1.pages )" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Address of name = 31603728\n", + "Address of price = 108997488\n", + "Address of pages = 133808864\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.4, Page number: 371

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from collections import namedtuple\n", + "#Structure defintion\n", + "struct_book = namedtuple(\"struct_book\", \"name price pages\")\n", + "\n", + "#Array of structures\n", + "b =[]\n", + "\n", + "n =[\"A\",\"C\",\"F\"]\n", + "p=[100.00,256.50,233.70]\n", + "pg=[354,682,512]\n", + "\n", + "#Storing data in the array\n", + "for i in range(0,3):\n", + " #bn, bp, bpg =raw_input( \"Enter name, price and pages: \" ).split()\n", + " print \"Enter name, price and pages: \"\n", + " print n[i],p[i],pg[i]\n", + " b.append(struct_book(n[i], p[i], pg[i]))\n", + "\n", + "#Result\n", + "for i in range(0,3):\n", + " print b[i].name, b[i].price, b[i].pages \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name, price and pages: \n", + "A 100.0 354\n", + "Enter name, price and pages: \n", + "C 256.5 682\n", + "Enter name, price and pages: \n", + "F 233.7 512\n", + "A 100.0 354\n", + "C 256.5 682\n", + "F 233.7 512\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.5 , Page number: 374

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from collections import namedtuple\n", + "#Structure defintion\n", + "struct_employee = namedtuple(\"struct_employee\", \"name age salary\")\n", + "\n", + "#Structures for 3 employees\n", + "e1 = struct_employee(\"Sanjay\", 30, 5500.50)\n", + "e2 = struct_employee(\" \",0,0)\n", + "e3 = struct_employee(\" \",0,0)\n", + "\n", + "#piece-meal copying \n", + "import copy\n", + "e2 = e2._replace(name = e1.name)\n", + "e2 = e2._replace(age = e1.age)\n", + "e2 = e2._replace(salary = e1.salary)\n", + "\n", + "\n", + "#copying all elements at one go \n", + "e3 = e2\n", + "\n", + "#Result\n", + "print e1.name, e1.age, e1.salary \n", + "print e2.name, e2.age, e2.salary \n", + "print e3.name, e3.age, e3.salary \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sanjay 30 5500.5\n", + "Sanjay 30 5500.5\n", + "Sanjay 30 5500.5\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.6, Page number: 375

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from collections import namedtuple\n", + "#Structure defintions\n", + "struct_address = namedtuple(\"struct_address\", \"phone city pin\")\n", + "struct_emp = namedtuple(\"struct_emp\", \"name struct_address\") #nested structures\n", + "\n", + "#Structures for employee\n", + "a = struct_address(\"531046\", \"nagpur\", 10)\n", + "e = struct_emp(\"jeru\",a) #nested structure\n", + "\n", + "#Result\n", + "print \"name = %s phone = %s\" %( e.name, e.struct_address.phone )\n", + "print \"city = %s pin = %d\" %( e.struct_address.city, e.struct_address.pin )\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "name = jeru phone = 531046\n", + "city = nagpur pin = 10\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.7 Page number: 377

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from collections import namedtuple\n", + "#Structure defintions\n", + "struct_book = namedtuple(\"struct_book\", \"name author callno\")\n", + "\n", + "#Function definition\n", + "def display (s,t,n):\n", + " print s, t, n \n", + " \n", + "#Structures for book\n", + "b1 = struct_book(\"Let us C\", \"YPK\", 101)\n", + "\n", + "\n", + "display ( b1.name, b1.author, b1.callno ) #function call\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Let us C YPK 101\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

10.8 Page number: 378

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from collections import namedtuple\n", + "#Structure defintions\n", + "struct_book = namedtuple(\"struct_book\", \"name author callno\")\n", + "\n", + "#Function definition\n", + "def display (b):\n", + " print b.name, b.author, b.callno \n", + " \n", + "#Structures for book\n", + "b1 = struct_book(\"Let us C\", \"YPK\", 101)\n", + "\n", + "\n", + "display ( b1) #function call\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Let us C YPK 101\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

10.9, Page number: 379

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from collections import namedtuple\n", + "#Structure defintions\n", + "struct_book = namedtuple(\"struct_book\", \"name author callno\")\n", + "\n", + "#Structure for book\n", + "b1 = struct_book(\"Let us C\", \"YPK\", 101)\n", + "ptr = id(b1) #structure pointer\n", + "\n", + "#Result\n", + "print b1.name, b1.author, b1.callno \n", + "print b1.name, b1.author, b1.callno \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Let us C YPK 101\n", + "Let us C YPK 101\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

10.10 Page number: 380

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#function definition\n", + "def display (b):\n", + " print b.name, b.author, b.callno \n", + " \n", + "from collections import namedtuple\n", + "#Structure defintions\n", + "struct_book = namedtuple(\"struct_book\", \"name author callno\")\n", + "\n", + "#Structure for book\n", + "b1 = struct_book(\"Let us C\", \"YPK\", 101)\n", + "\n", + "#function call\n", + "display ( b1 ) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Let us C YPK 101\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Let us C/.ipynb_checkpoints/chapter-11-checkpoint.ipynb b/Let us C/.ipynb_checkpoints/chapter-11-checkpoint.ipynb new file mode 100644 index 00000000..0c79f236 --- /dev/null +++ b/Let us C/.ipynb_checkpoints/chapter-11-checkpoint.ipynb @@ -0,0 +1,365 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:066da36fa2998c0a83c22ca4b6de0a36d79f25f11d006659dda374ce3d1496c6" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 11: Console Input/Output

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.1 Page number: 397

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "avg = 346 \n", + "per = 69.2\n", + "\n", + "#Result\n", + "print \"Average = %d\\nPercentage = %f\" %(avg, per )\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Average = 346\n", + "Percentage = 69.200000\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.2 Page number: 399

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "weight = 63\n", + "\n", + "#Result\n", + "print \"weight is %d kg\" %( weight ) \n", + "print \"weight is %2d kg\"%( weight ) \n", + "print \"weight is %4d kg\" %( weight )\n", + "print \"weight is %6d kg\" %(weight ) \n", + "print \"weight is %-6d kg\" %( weight )\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "weight is 63 kg\n", + "weight is 63 kg\n", + "weight is 63 kg\n", + "weight is 63 kg\n", + "weight is 63 kg\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.3 Page number: 400

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "firstname1 = \"Sandy\" \n", + "surname1 = \"Malya\" \n", + "firstname2 = \"AjayKumar\" \n", + "surname2 = \"Gurubaxani\" \n", + "\n", + "#Result\n", + "print \"%20s%20s\" %( firstname1, surname1 )\n", + "print \"%20s%20s\" %(firstname2, surname2 ) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Sandy Malya\n", + " AjayKumar Gurubaxani\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.4 Page number: 401

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"You\\tmust\\tbe\\tcrazy\\nto\\thate\\tthis\\tbook\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "You\tmust\tbe\tcrazy\n", + "to\thate\tthis\tbook\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.5 Page number: 403

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "ch = 'z' \n", + "i = 125 \n", + "a = 12.55 \n", + "s = \"hello there !\"\n", + "\n", + "#Result\n", + "print \"%c %d %f\" %( ch, ord(ch), ord(ch )) \n", + "print \"%s %d %f\"%( s, ord(s[1]), ord(s[1]) )\n", + "print \"%c %d %f\"%(i ,i, i ) \n", + "print \"%f %d\\n\"%( a, a )\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "z 122 122.000000\n", + "hello there ! 101 101.000000\n", + "} 125 125.000000\n", + "12.550000 12\n", + "\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.6 Page number: 404

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "i = 10 \n", + "ch = 'A'\n", + "a = 3.14 \n", + "\n", + "\n", + "#Result\n", + "print \"%d %c %f\" %(i, ch, a ) \n", + "str = \"%d %c %f\" %(i, ch, a ) #sprintf\n", + "print \"%s\" %(str )\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10 A 3.140000\n", + "10 A 3.140000\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.7 Page number: 406

\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import msvcrt\n", + "\n", + "print \"Press any key to continue\" \n", + "#msvcrt.getch( ) # will not echo the character \n", + "print \"Type any character\" \n", + "#ch = msvcrt.getche( ) # will echo the character typed \n", + "ch = 'A'\n", + "print ch\n", + "#ch = input(\"Type any character\")#getchar( ) will echo character, must be followed by enter key \n", + "print \"Type any character\"\n", + "ch = 8\n", + "print ch\n", + "#ch = input( \"Continue Y/N\" ) #fgetchar( ) will echo character, must be followed by enter key\n", + "print \"Continue Y/N\" \n", + "ch = 'N'\n", + "print ch\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Press any key to continue\n", + "Type any character\n", + "A\n", + "Type any character\n", + "8\n", + "Continue Y/N\n", + "N\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.8 Page number: 407

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "ch = 'A'\n", + "\n", + "#Result\n", + "print ch #putch\n", + "print ch #putchar\n", + "print ch #fputchar\n", + "print 'Z' #putch\n", + "print 'Z' #putchar\n", + "print 'Z' #fputchar\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "A\n", + "A\n", + "A\n", + "Z\n", + "Z\n", + "Z\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

11.9 , Page number: 408

\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter name\"\n", + "footballer = \"Jonty Rhodes\"\n", + "print footballer\n", + "\n", + "#Result\n", + "print \"Happy footballing!\" \n", + "print footballer " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name\n", + "Jonty Rhodes\n", + "Happy footballing!\n", + "Jonty Rhodes\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Let us C/.ipynb_checkpoints/chapter-12-checkpoint.ipynb b/Let us C/.ipynb_checkpoints/chapter-12-checkpoint.ipynb new file mode 100644 index 00000000..e268149b --- /dev/null +++ b/Let us C/.ipynb_checkpoints/chapter-12-checkpoint.ipynb @@ -0,0 +1,2334 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:f8fb56abb39db93ad3fa7fcf720d7c0f3aa8a48195c6cd7c8eee0d526bfd834a" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 12: File Input/Output

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.1 Page number: 417

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "fp = open (\"C:/Users/Akshatha M/Desktop/carrot.txt\", \"r\" ) #open file in read mode\n", + "while ( 1 ):\n", + " ch = fp.read(1)\n", + " if not ch :\n", + " break\n", + " print ch\n", + "\n", + "fp.close() #close file\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "M\n", + "e\n", + "t\n", + "h\n", + "o\n", + "d\n", + "\n", + "\n", + "T\n", + "h\n", + "r\n", + "o\n", + "u\n", + "g\n", + "h\n", + "l\n", + "y\n", + " \n", + "w\n", + "a\n", + "s\n", + " \n", + "b\n", + "o\n", + "t\n", + "h\n", + " \n", + "b\n", + "e\n", + "e\n", + "t\n", + "r\n", + "o\n", + "o\n", + "t\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "c\n", + "a\n", + "r\n", + "r\n", + "o\n", + "t\n", + " \n", + "t\n", + "o\n", + " \n", + "r\n", + "e\n", + "m\n", + "o\n", + "v\n", + "e\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "m\n", + "u\n", + "d\n", + " \n", + "o\n", + "n\n", + " \n", + "b\n", + "e\n", + "e\n", + "t\n", + "r\n", + "o\n", + "o\n", + "t\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "h\n", + "a\n", + "i\n", + "r\n", + " \n", + "o\n", + "n\n", + " \n", + "c\n", + "a\n", + "r\n", + "r\n", + "o\n", + "t\n", + "\n", + "\n", + "P\n", + "e\n", + "e\n", + "l\n", + " \n", + "o\n", + "f\n", + "f\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "c\n", + "a\n", + "r\n", + "r\n", + "o\n", + "t\n", + " \n", + "s\n", + "k\n", + "i\n", + "n\n", + ".\n", + " \n", + "d\n", + "o\n", + " \n", + "n\n", + "o\n", + "t\n", + " \n", + "p\n", + "e\n", + "e\n", + "l\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "r\n", + "a\n", + "d\n", + "d\n", + "i\n", + "s\n", + "h\n", + " \n", + "s\n", + "k\n", + "i\n", + "n\n", + " \n", + "t\n", + "o\n", + " \n", + "a\n", + "v\n", + "o\n", + "i\n", + "d\n", + " \n", + "p\n", + "o\n", + "s\n", + "s\n", + "i\n", + "b\n", + "l\n", + "e\n", + " \n", + "l\n", + "o\n", + "s\n", + "s\n", + " \n", + "o\n", + "f\n", + " \n", + "v\n", + "i\n", + "t\n", + "a\n", + "m\n", + "i\n", + "n\n", + "s\n", + "\n", + "\n", + "C\n", + "u\n", + "t\n", + " \n", + "e\n", + "a\n", + "c\n", + "h\n", + " \n", + "b\n", + "e\n", + "e\n", + "t\n", + "r\n", + "o\n", + "o\n", + "t\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "c\n", + "a\n", + "r\n", + "r\n", + "o\n", + "t\n", + " \n", + "i\n", + "n\n", + " \n", + "t\n", + "o\n", + " \n", + "4\n", + " \n", + "h\n", + "a\n", + "l\n", + "v\n", + "e\n", + "s\n", + "\n", + "\n", + "P\n", + "r\n", + "e\n", + "a\n", + "s\n", + "s\n", + "u\n", + "r\n", + "e\n", + " \n", + "c\n", + "o\n", + "o\n", + "k\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "b\n", + "e\n", + "e\n", + "t\n", + "r\n", + "o\n", + "o\n", + "t\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "c\n", + "a\n", + "r\n", + "r\n", + "o\n", + "t\n", + ".\n", + " \n", + "m\n", + "a\n", + "k\n", + "e\n", + " \n", + "3\n", + " \n", + "w\n", + "h\n", + "i\n", + "s\n", + "t\n", + "l\n", + "e\n", + "s\n", + " \n", + "s\n", + "o\n", + " \n", + "t\n", + "h\n", + "e\n", + "t\n", + " \n", + "t\n", + "h\n", + "e\n", + "y\n", + " \n", + "b\n", + "e\n", + "c\n", + "o\n", + "m\n", + "e\n", + " \n", + "v\n", + "e\n", + "r\n", + "y\n", + " \n", + "s\n", + "m\n", + "o\n", + "o\n", + "t\n", + "h\n", + "\n", + "\n", + "D\n", + "r\n", + "a\n", + "i\n", + "n\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "r\n", + "e\n", + "s\n", + "e\n", + "r\n", + "v\n", + "e\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "w\n", + "a\n", + "t\n", + "e\n", + "r\n", + " \n", + "a\n", + "f\n", + "t\n", + "e\n", + "r\n", + " \n", + "p\n", + "r\n", + "e\n", + "s\n", + "s\n", + "u\n", + "r\n", + "e\n", + " \n", + "c\n", + "o\n", + "o\n", + "k\n", + "i\n", + "n\n", + "g\n", + ".\n", + "\n", + "\n", + "M\n", + "a\n", + "s\n", + "h\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "c\n", + "o\n", + "o\n", + "k\n", + "e\n", + "d\n", + " \n", + "p\n", + "i\n", + "e\n", + "c\n", + "e\n", + "s\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "a\n", + "l\n", + "l\n", + "o\n", + "w\n", + " \n", + "t\n", + "o\n", + " \n", + "c\n", + "o\n", + "o\n", + "l\n", + "\n", + "\n", + "C\n", + "u\n", + "t\n", + " \n", + "o\n", + "n\n", + "i\n", + "o\n", + "n\n", + "s\n", + " \n", + "i\n", + "n\n", + "t\n", + "o\n", + " \n", + "c\n", + "u\n", + "b\n", + "e\n", + "s\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "s\n", + "a\n", + "u\n", + "t\n", + "e\n", + " \n", + "t\n", + "i\n", + "l\n", + "l\n", + " \n", + "g\n", + "o\n", + "l\n", + "d\n", + "e\n", + "n\n", + " \n", + "b\n", + "r\n", + "o\n", + "w\n", + "n\n", + " \n", + "o\n", + "n\n", + " \n", + "o\n", + "i\n", + "l\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "a\n", + "l\n", + "l\n", + "o\n", + "w\n", + " \n", + "t\n", + "o\n", + " \n", + "c\n", + "o\n", + "o\n", + "l\n", + "\n", + "\n", + "A\n", + "f\n", + "t\n", + "e\n", + "r\n", + " \n", + "c\n", + "o\n", + "o\n", + "l\n", + "i\n", + "n\n", + "g\n", + " \n", + "g\n", + "r\n", + "i\n", + "n\n", + "d\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "m\n", + "a\n", + "s\n", + "h\n", + "e\n", + "d\n", + " \n", + "b\n", + "e\n", + "e\n", + "t\n", + "r\n", + "o\n", + "o\n", + "t\n", + ",\n", + " \n", + "c\n", + "a\n", + "r\n", + "r\n", + "o\n", + "t\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "s\n", + "a\n", + "u\n", + "t\n", + "e\n", + "d\n", + " \n", + "o\n", + "n\n", + "i\n", + "o\n", + "n\n", + "s\n", + " \n", + "t\n", + "o\n", + " \n", + "p\n", + "a\n", + "s\n", + "t\n", + "e\n", + " \n", + "i\n", + "n\n", + " \n", + "a\n", + " \n", + "m\n", + "i\n", + "x\n", + "y\n", + ".\n", + " \n", + "a\n", + "d\n", + "d\n", + " \n", + "e\n", + "n\n", + "o\n", + "u\n", + "g\n", + "h\n", + " \n", + "w\n", + "a\n", + "t\n", + "e\n", + "r\n", + " \n", + "t\n", + "o\n", + " \n", + "m\n", + "a\n", + "k\n", + "e\n", + " \n", + "p\n", + "a\n", + "s\n", + "t\n", + "e\n", + " \n", + "n\n", + "o\n", + "t\n", + " \n", + "v\n", + "e\n", + "r\n", + "y\n", + " \n", + "f\n", + "i\n", + "n\n", + "e\n", + ".\n", + "\n", + "\n", + "N\n", + "o\n", + "w\n", + " \n", + "s\n", + "t\n", + "r\n", + "a\n", + "i\n", + "n\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "g\n", + "r\n", + "i\n", + "n\n", + "d\n", + " \n", + "p\n", + "a\n", + "s\n", + "t\n", + "e\n", + ".\n", + "\n", + "\n", + "T\n", + "a\n", + "k\n", + "e\n", + " \n", + "s\n", + "o\n", + "m\n", + "e\n", + " \n", + "b\n", + "u\n", + "t\n", + "t\n", + "e\n", + "r\n", + " \n", + "i\n", + "n\n", + " \n", + "a\n", + " \n", + "v\n", + "e\n", + "s\n", + "s\n", + "e\n", + "l\n", + " \n", + "a\n", + "d\n", + "d\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "g\n", + "a\n", + "r\n", + "l\n", + "i\n", + "c\n", + " \n", + "p\n", + "a\n", + "s\n", + "t\n", + "e\n", + ",\n", + "g\n", + "i\n", + "n\n", + "g\n", + "e\n", + "r\n", + "p\n", + "a\n", + "s\n", + "t\n", + "e\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "g\n", + "r\n", + "e\n", + "e\n", + "n\n", + " \n", + "c\n", + "h\n", + "i\n", + "l\n", + "l\n", + "i\n", + " \n", + "p\n", + "a\n", + "s\n", + "t\n", + "e\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "s\n", + "a\n", + "u\n", + "t\n", + "e\n", + " \n", + "f\n", + "o\n", + "r\n", + " \n", + "s\n", + "o\n", + "m\n", + "e\n", + " \n", + "t\n", + "i\n", + "m\n", + "e\n", + " \n", + "t\n", + "i\n", + "l\n", + "l\n", + " \n", + "u\n", + " \n", + "g\n", + "e\n", + "t\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "s\n", + "p\n", + "e\n", + "c\n", + "i\n", + "f\n", + "i\n", + "c\n", + " \n", + "g\n", + "a\n", + "r\n", + "l\n", + "i\n", + "c\n", + "-\n", + "b\n", + "e\n", + "i\n", + "n\n", + "g\n", + "-\n", + "f\n", + "r\n", + "i\n", + "e\n", + "d\n", + " \n", + "s\n", + "m\n", + "e\n", + "l\n", + "l\n", + "\n", + "\n", + "A\n", + "d\n", + "d\n", + " \n", + "m\n", + "o\n", + "o\n", + "n\n", + "g\n", + " \n", + "s\n", + "p\n", + "r\n", + "o\n", + "u\n", + "t\n", + "s\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "s\n", + "a\n", + "u\n", + "t\n", + "e\n", + ",\n", + " \n", + "c\n", + "o\n", + "v\n", + "e\n", + "r\n", + " \n", + "w\n", + "i\n", + "t\n", + "h\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "l\n", + "i\n", + "d\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "l\n", + "e\n", + "t\n", + " \n", + "c\n", + "o\n", + "o\n", + "k\n", + " \n", + "f\n", + "o\n", + "r\n", + " \n", + "5\n", + " \n", + "m\n", + "i\n", + "n\n", + "s\n", + "\n", + "\n", + "N\n", + "o\n", + "w\n", + " \n", + "a\n", + "d\n", + "d\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "s\n", + "t\n", + "r\n", + "a\n", + "i\n", + "n\n", + " \n", + "o\n", + "f\n", + " \n", + "b\n", + "e\n", + "e\n", + "t\n", + "r\n", + "o\n", + "o\n", + "t\n", + ",\n", + "c\n", + "a\n", + "r\n", + "r\n", + "o\n", + "t\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "o\n", + "n\n", + "i\n", + "o\n", + "n\n", + "s\n", + " \n", + "p\n", + "a\n", + "s\n", + "t\n", + "e\n", + "\n", + "\n", + "A\n", + "d\n", + "d\n", + " \n", + "6\n", + " \n", + "c\n", + "u\n", + "p\n", + "s\n", + " \n", + "o\n", + "f\n", + " \n", + "w\n", + "a\n", + "t\n", + "e\n", + "r\n", + " \n", + "t\n", + "o\n", + " \n", + "i\n", + "t\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "a\n", + "l\n", + "s\n", + "o\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "w\n", + "a\n", + "t\n", + "e\n", + "r\n", + " \n", + "r\n", + "e\n", + "s\n", + "e\n", + "r\n", + "v\n", + "e\n", + "d\n", + " \n", + "a\n", + "t\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "t\n", + "i\n", + "m\n", + "e\n", + " \n", + "o\n", + "f\n", + " \n", + "p\n", + "r\n", + "e\n", + "s\n", + "s\n", + "u\n", + "r\n", + "e\n", + " \n", + "c\n", + "o\n", + "o\n", + "k\n", + "i\n", + "n\n", + "g\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "b\n", + "e\n", + "e\n", + "t\n", + "r\n", + "o\n", + "o\n", + "t\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "c\n", + "a\n", + "r\n", + "r\n", + "o\n", + "t\n", + ".\n", + "\n", + "\n", + "A\n", + "d\n", + "d\n", + " \n", + "s\n", + "a\n", + "l\n", + "t\n", + ",\n", + " \n", + "c\n", + "i\n", + "n\n", + "n\n", + "a\n", + "m\n", + "o\n", + "n\n", + ",\n", + " \n", + "c\n", + "u\n", + "m\n", + "m\n", + "i\n", + "n\n", + ",\n", + " \n", + "c\n", + "o\n", + "r\n", + "i\n", + "a\n", + "n\n", + "d\n", + "e\n", + "r\n", + " \n", + "p\n", + "o\n", + "w\n", + "d\n", + "e\n", + "r\n", + ",\n", + "l\n", + "e\n", + "m\n", + "o\n", + "n\n", + " \n", + "j\n", + "u\n", + "i\n", + "c\n", + "e\n", + "\n", + "\n", + "B\n", + "r\n", + "i\n", + "n\n", + "g\n", + " \n", + "t\n", + "o\n", + " \n", + "a\n", + " \n", + "b\n", + "o\n", + "i\n", + "l\n", + ",\n", + " \n", + "l\n", + "e\n", + "t\n", + " \n", + "s\n", + "i\n", + "m\n", + "m\n", + "e\n", + "r\n", + " \n", + "f\n", + "o\n", + "r\n", + " \n", + "a\n", + " \n", + "f\n", + "e\n", + "w\n", + " \n", + "m\n", + "i\n", + "n\n", + "s\n", + "\n", + "\n", + "M\n", + "a\n", + "k\n", + "e\n", + " \n", + "a\n", + " \n", + "f\n", + "i\n", + "n\n", + "e\n", + " \n", + "p\n", + "a\n", + "s\n", + "t\n", + "e\n", + " \n", + "o\n", + "f\n", + " \n", + "c\n", + "o\n", + "r\n", + "n\n", + "f\n", + "l\n", + "o\n", + "u\n", + "r\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "a\n", + "d\n", + "d\n", + " \n", + "i\n", + "t\n", + " \n", + "w\n", + "h\n", + "i\n", + "l\n", + "e\n", + " \n", + "s\n", + "t\n", + "i\n", + "r\n", + "r\n", + "i\n", + "n\n", + "g\n", + " \n", + "t\n", + "o\n", + " \n", + "a\n", + "v\n", + "o\n", + "i\n", + "d\n", + " \n", + "l\n", + "u\n", + "m\n", + "p\n", + "s\n", + "\n", + "\n", + "T\n", + "i\n", + "l\n", + " \n", + "f\n", + "o\n", + "r\n", + " \n", + "s\n", + "o\n", + "m\n", + "e\n", + "m\n", + "o\n", + "r\n", + "e\n", + " \n", + "t\n", + "i\n", + "m\n", + "e\n", + " \n", + "s\n", + "o\n", + " \n", + "t\n", + "h\n", + "a\n", + "t\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "c\n", + "o\n", + "r\n", + "n\n", + "f\n", + "l\n", + "o\n", + "u\n", + "r\n", + " \n", + "p\n", + "a\n", + "s\n", + "t\n", + "e\n", + " \n", + "i\n", + "s\n", + " \n", + "c\n", + "o\n", + "o\n", + "k\n", + "e\n", + "d\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "m\n", + "i\n", + "x\n", + "e\n", + "d\n", + " \n", + "w\n", + "e\n", + "l\n", + "l\n", + "\n", + "\n", + "T\n", + "a\n", + "k\n", + "e\n", + " \n", + "o\n", + "i\n", + "l\n", + " \n", + "i\n", + "n\n", + " \n", + "a\n", + " \n", + "k\n", + "a\n", + "d\n", + "h\n", + "a\n", + "i\n", + " \n", + "t\n", + "o\n", + " \n", + "f\n", + "r\n", + "y\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "n\n", + "o\n", + "o\n", + "d\n", + "l\n", + "e\n", + "s\n", + ".\n", + "f\n", + "r\n", + "y\n", + " \n", + "t\n", + "i" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "l\n", + "l\n", + " \n", + "g\n", + "o\n", + "l\n", + "d\n", + "e\n", + "n\n", + " \n", + "b\n", + "r\n", + "o\n", + "w\n", + "n\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "r\n", + "e\n", + "s\n", + "e\n", + "r\n", + "v\n", + "e\n", + " \n", + "o\n", + "n\n", + " \n", + "a\n", + " \n", + "t\n", + "i\n", + "s\n", + "s\n", + "u\n", + "e\n", + " \n", + "p\n", + "a\n", + "p\n", + "e\n", + "r\n", + "\n", + "\n", + "C\n", + "r\n", + "u\n", + "s\n", + "h\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "n\n", + "o\n", + "o\n", + "d\n", + "l\n", + "e\n", + "s\n", + " \n", + "n\n", + "o\n", + "t\n", + " \n", + "t\n", + "o\n", + "o\n", + " \n", + "m\n", + "u\n", + "c\n", + "h\n", + "\n", + "\n", + "S\n", + "e\n", + "r\n", + "v\n", + "e\n", + " \n", + "s\n", + "t\n", + "e\n", + "a\n", + "m\n", + "i\n", + "n\n", + "g\n", + " \n", + "h\n", + "o\n", + "t\n", + " \n", + "i\n", + "n\n", + " \n", + "s\n", + "o\n", + "u\n", + "p\n", + " \n", + "b\n", + "o\n", + "w\n", + "l\n", + "s\n", + " \n", + "a\n", + "d\n", + "d\n", + " \n", + "s\n", + "o\n", + "m\n", + "e\n", + " \n", + "b\n", + "u\n", + "t\n", + "t\n", + "e\n", + "r\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "t\n", + "o\n", + "p\n", + " \n", + "w\n", + "i\n", + "t\n", + "h\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "c\n", + "r\n", + "i\n", + "s\n", + "p\n", + "y\n", + " \n", + "n\n", + "o\n", + "o\n", + "d\n", + "l\n", + "e\n", + "s\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.2Page number: 421

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "try :\n", + " fp = open (\"C:/Users/Akshatha M/Desktop/carrot.txt\", \"r\" )#open file in read mode and check if file is opened successfully\n", + "except:\n", + " print \"cannot open file\" \n", + " exit()\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "cannot open file\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.3 , Page number: 423

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "nol = 0\n", + "Not = 0\n", + "nob = 0\n", + "noc = 0\n", + "\n", + "fp = open (\"C:/Users/Akshatha M/Desktop/carrot.txt\", \"r\" ) #open file in read mode\n", + "while ( 1 ):\n", + " ch = fp.read(1)\n", + " if not ch :\n", + " break\n", + " noc = noc + 1 #number of chars\n", + " if ( ch == \" \" ):\n", + " nob = nob + 1 #number of spaces\n", + " if ( ch == \"\\n\" ):\n", + " nol = nol + 1 # number of newlines\n", + " if ( ch == \"\\t\" ):\n", + " Not = Not + 1 #number of tabs\n", + "\n", + "fp.close() #close file\n", + "\n", + "#Result\n", + "print \"Number of characters = \", noc \n", + "print \"Number of blanks = \", nob \n", + "print \"Number of tabs = \", Not \n", + "print \"Number of lines = \", nol \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of characters = 1495\n", + "Number of blanks = 254\n", + "Number of tabs = 0\n", + "Number of lines = 20\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.4 Page number: 424

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "fs = open (\"C:/Users/Akshatha M/Desktop/carrot.txt\", \"r\" ) #open file in read mode\n", + "if(not fs):\n", + " print \"Cannot open source file\"\n", + " exit()\n", + "\n", + "ft = open ( \"C:/Users/Akshatha M/Desktop/temp.txt\", \"w\" ) #open file in write mode\n", + "if(not ft):\n", + " print \"Cannot open target file\"\n", + " fs.close() \n", + " exit()\n", + " \n", + "while ( 1 ):\n", + " ch = fs.read(1)\n", + " if not ch :\n", + " break\n", + " else:\n", + " ft.writelines(ch) #write into target file\n", + "\n", + "#closen files\n", + "fs.close()\n", + "ft.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Writing Strings to Files, Page number: 427

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "fp = open ( \"C:/Users/Akshatha M/Desktop/temp.txt\", \"w\" ) #open file in write mode\n", + "if(not fp):\n", + " print \"Cannot open target file\" \n", + " exit()\n", + "\n", + "print \"Enter a few lines of text:\" \n", + "#s=input(\"\") #Input strings from keyboard\n", + "s = \"File written\"\n", + "print s\n", + "while ( len(s) > 0 ):\n", + " fp.writelines(s) #write into file\n", + " fp.writelines(\"\\n\")\n", + " #s=input(\"\") #Input strings from keyboard\n", + " s=\"\"\n", + " \n", + "#close files\n", + "fp.close()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a few lines of text:\n", + "File written\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.4 Page number: 429

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "fp = open (\"C:/Users/Akshatha M/Desktop/carrot.txt\", \"r\" ) #open file in read mode\n", + "if ( not fp ):\n", + " print \"Cannot open file\" \n", + " exit( ) \n", + "\n", + "while ( 1 ) :#Read strings from file\n", + " s = fp.read(79)\n", + " if(s):\n", + " print s\n", + " else:\n", + " break\n", + " \n", + "\n", + "fp.close() #close file\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Method\n", + "Throughly was both beetroot and carrot to remove the mud on beetroot and\n", + " the hair on carrot\n", + "Peel off the carrot skin. do not peel the raddish skin to a\n", + "void possible loss of vitamins\n", + "Cut each beetroot and carrot in to 4 halves\n", + "Prea\n", + "ssure cook the beetroot and carrot. make 3 whistles so thet they become very sm\n", + "ooth\n", + "Drain and reserve the water after pressure cooking.\n", + "Mash the cooked pieces\n", + " and allow to cool\n", + "Cut onions into cubes and saute till golden brown on oil and\n", + " allow to cool\n", + "After cooling grind the mashed beetroot, carrot and sauted onion\n", + "s to paste in a mixy. add enough water to make paste not very fine.\n", + "Now strain \n", + "the grind paste.\n", + "Take some butter in a vessel add the garlic paste,gingerpaste \n", + "and green chilli paste and saute for some time till u get the specific garlic-b\n", + "eing-fried smell\n", + "Add moong sprouts and saute, cover with the lid and let cook f\n", + "or 5 mins\n", + "Now add the strain of beetroot,carrot and onions paste\n", + "Add 6 cups of \n", + "water to it and also the water reserved at the time of pressure cooking the bee\n", + "troot and carrot.\n", + "Add salt, cinnamon, cummin, coriander powder,lemon juice\n", + "Brin\n", + "g to a boil, let simmer for a few mins\n", + "Make a fine paste of cornflour and add i\n", + "t while stirring to avoid lumps\n", + "Til for somemore time so that the cornflour pas\n", + "te is cooked and mixed well\n", + "Take oil in a kadhai to fry the noodles.fry till go\n", + "lden brown and reserve on a tissue paper\n", + "Crush the noodles not too much\n", + "Serve s\n", + "teaming hot in soup bowls add some butter and top with the crispy noodles\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

12.5 Page number: 431

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from collections import namedtuple\n", + "\n", + "#Variable declaration\n", + "another = 'Y'\n", + "\n", + "#Structure defintion\n", + "struct_emp = namedtuple(\"struct_emp\", \"name age bs\")\n", + "\n", + "\n", + "fp = open ( \"C:/Users/Akshatha M/Desktop/Employee.dat\", \"w\" ) #open file in write mode\n", + "if(not fp):\n", + " print \"Cannot open target file\"\n", + " exit()\n", + "\n", + "while ( another == 'Y' ):\n", + " print \"Enter name, age and basic salary: \" \n", + " #en,ea,ebs = input(\"\").split()\n", + " en =\"John\"\n", + " ea=\"34\"\n", + " ebs=\"25000\"\n", + " print en,ea,ebs\n", + " e = struct_emp(en,ea,ebs)\n", + " fp.writelines(e) #write into file\n", + " fp.writelines(\"\\n\")\n", + " #another = input( \"Add another record (Y/N): \" ) \n", + " print \"Add another record (Y/N): \"\n", + " another = 'N'\n", + " print another\n", + "#close file\n", + "fp.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name, age and basic salary: \n", + "John 34 25000\n", + "Add another record (Y/N): \n", + "N\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.6 , Page number: 433

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from collections import namedtuple\n", + "#Structure defintion\n", + "struct_emp = namedtuple(\"struct_emp\", \"name age bs\")\n", + "\n", + "\n", + "fp = open ( \"C:/Users/Akshatha M/Desktop/Employee.txt\", \"r\" ) #open file in read mode\n", + "if(not fp):\n", + " print \"Cannot open target file\"\n", + " exit()\n", + "\n", + "while ( 1 ):\n", + " s = fp.readline()\n", + " if(s):\n", + " en,ea,ebs = s.split()\n", + " e = struct_emp(en,ea,ebs) #Read record\n", + " print e.name, e.age, e.bs \n", + " else:\n", + " break\n", + " \n", + "#close file\n", + "fp.close()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "John 34 25000\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.7 Page number: 434

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "fs = open (\"C:/Users/Akshatha M/Desktop/Project1.exe\", \"rb\" ) #open file in read binary mode\n", + "if(not fs):\n", + " print \"Cannot open source file\"\n", + " exit()\n", + "\n", + "ft = open ( \"C:/Users/Akshatha M/Desktop/NewProject1.exe\", \"wb\" ) #open file in write binary mode\n", + "if(not ft):\n", + " print \"Cannot open target file\"\n", + " fs.close() \n", + " exit()\n", + " \n", + "while ( 1 ):\n", + " ch = fs.read(1)\n", + " if not ch :\n", + " break\n", + " else:\n", + " ft.write(ch) #write into target file\n", + "\n", + "#closen files\n", + "fs.close()\n", + "ft.close()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 12 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.8 Page number: 438

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from collections import namedtuple\n", + "\n", + "#Variable declaration\n", + "another = 'Y'\n", + "\n", + "#Structure defintion\n", + "struct_emp = namedtuple(\"struct_emp\", \"name age bs\")\n", + "\n", + "fp = open ( \"C:/Users/Akshatha M/Desktop/Employee.dat\", \"wb\" ) #open file in write mode\n", + "if(not fp):\n", + " print \"Cannot open target file\" \n", + " exit()\n", + "\n", + "while ( another == 'Y' ):\n", + " print ( \"Enter name, age and basic salary: \" )\n", + " #en,ea,ebs = input(\"\").split()\n", + " en =\"John\"\n", + " ea=\"34\"\n", + " ebs=\"25000\"\n", + " print en,ea,ebs\n", + " e = struct_emp(en,ea,ebs)\n", + " #write into file\n", + " fp.write(b'e.name')\n", + " fp.write(b'e.age')\n", + " fp.write(b'e.bs')\n", + " fp.write(b'\\n')\n", + " #another = input( \"Add another record (Y/N): \" ) \n", + " print \"Add another record (Y/N): \"\n", + " another = 'N'\n", + " print another\n", + "\n", + "#close file\n", + "fp.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name, age and basic salary: \n", + "John 34 25000\n", + "Add another record (Y/N): \n", + "N\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.9 Page number: 440

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from collections import namedtuple\n", + "#Structure defintion\n", + "struct_emp = namedtuple(\"struct_emp\", \"name age bs\")\n", + "\n", + "\n", + "fp = open ( \"C:/Users/Akshatha M/Desktop/Employee.txt\", \"rb\" ) #open file in read mode\n", + "if(not fp):\n", + " print \"Cannot open target file\" \n", + " exit()\n", + "\n", + "while ( 1 ):\n", + " s = fp.readline()\n", + " if(s):\n", + " en,ea,ebs = s.split()\n", + " e = struct_emp(en,ea,ebs) #Read record\n", + " print e.name, e.age, e.bs \n", + " else:\n", + " break\n", + " \n", + "#close file\n", + "fp.close()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "John 34 25000\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.10 Page number: 442

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import os\n", + "from collections import namedtuple\n", + "#Structure defintion\n", + "struct_emp = namedtuple(\"struct_emp\", \"name age bs\")\n", + "\n", + "fp = open ( \"C:/Users/Akshatha M/Desktop/Employee.txt\", \"r+b\")\n", + "if ( not fp ):\n", + " fp = open ( \"C:/Users/Akshatha M/Desktop/Employee.txt\", \"w+b\" )\n", + " if ( not fp ):\n", + " print \"Cannot open file\" \n", + " exit( )\n", + "\n", + "while ( 1 ):\n", + " print \" 1. Add Records\"\n", + " print \" 2. List Records\"\n", + " print \" 3. Modify Records\"\n", + " print \" 4. Delete Records\" \n", + " print \" 0. Exit\" \n", + " #choice = input(\"\\nYour choice\")\n", + " print \"\\nYour choice\"\n", + " choice = 1\n", + " if(choice == '1'):\n", + " another = 'Y'\n", + " while ( another == 'Y' ):\n", + " print ( \"Enter name, age and basic salary: \" )\n", + " en,ea,ebs = input(\"\").split()\n", + " e = struct_emp(en,ea,ebs)\n", + " #write into file\n", + " fp.write(b'e.name')\n", + " fp.write(b' ')\n", + " fp.write(b'e.age')\n", + " fp.write(b' ')\n", + " fp.write(b'e.bs')\n", + " fp.write(b'\\n')\n", + " another = input( \"Add another record (Y/N): \" )\n", + " elif(choice == '2'):\n", + " fp.seek(0,0)\n", + " while ( 1 ):\n", + " s = fp.readline()\n", + " if(s):\n", + " en,j1,ea,j2,ebs = s.split()\n", + " e = struct_emp(en,ea,ebs) #Read record\n", + " print ( e.name, e.age, e.bs )\n", + " else:\n", + " break\n", + " elif(choice == '3'):\n", + " another = 'Y'\n", + " while ( another == 'Y' ):\n", + " empname =input(\"Enter name of employee to modify \" )\n", + " fp.seek(0,0)\n", + " while (fp.readline()):\n", + " if ( b'empname' == b'e.name' ):\n", + " en,ea,ebs = input(\"Enter new name, age & bs\" ).spilt()\n", + " e = struct_emp(en,ea,ebs)\n", + " cur = fp.tell()\n", + " fp.write(b'e.name')\n", + " fp.write(b'e.age')\n", + " fp.write(b'e.bs')\n", + " fp.write(b'\\n')\n", + " break\n", + " print ( \"\\nModify another Record (Y/N) \" )\n", + " another = input(\"\")\n", + " elif(choice == '4'):\n", + " another = 'Y'\n", + " while ( another == 'Y' ):\n", + " empname = input(\"Enter name of employee to delete \" )\n", + " ft = open ( \"C:/Users/Akshatha M/Desktop/temp.txt\", \"wb\" )\n", + " fp.seek(0,0)\n", + " while ( 1 ):\n", + " s = fp.readline()\n", + " if(s):\n", + " if ( not(b'empname' == b'e.name' )):\n", + " ft.write(s)\n", + " else:\n", + " break\n", + " fp.close()\n", + " ft.close()\n", + " os.remove(\"C:/Users/Akshatha M/Desktop/Employee.txt\")\n", + " os.rename ( \"C:/Users/Akshatha M/Desktop/temp.txt\", \"C:/Users/Akshatha M/Desktop/Employee.txt\" )\n", + " fp = open ( \"C:/Users/Akshatha M/Desktop/Employee.txt\", \"r+b\" )\n", + " print ( \"Delete another Record (Y/N) \" )\n", + " another = input(\"\")\n", + "\n", + " else:\n", + " fp.close()#close file\n", + " exit( )\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.11 Page number: 448

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#source=input( \"Enter source file name \" ) \n", + "print \"Enter source file name \" \n", + "source = \"Employee.txt\"\n", + "print source\n", + "source=\"C:/Users/Akshatha M/Desktop/\"+source\n", + "\n", + "inhandle = open (source, \"rb\" ) #open file in read binary mode\n", + "if(not inhandle):\n", + " print \"Cannot open file\"\n", + " exit()\n", + "\n", + "#target=input( \"Enter target file name \" ) \n", + "print \"Enter target file name \"\n", + "target = \"temp.txt\"\n", + "print target\n", + "target=\"C:/Users/Akshatha M/Desktop/\"+target\n", + "\n", + "outhandle = open ( target, \"wb\" ) #open file in write binary mode\n", + "if(not outhandle):\n", + " print \"Cannot open target file\"\n", + " inhandle.close() \n", + " exit()\n", + "\n", + "\n", + " \n", + "while ( 1 ):\n", + " Bytes = inhandle.read(1)\n", + " if not Bytes :\n", + " break\n", + " else:\n", + " outhandle.write(Bytes) #write into target file\n", + "\n", + "#closen files\n", + "inhandle.close()\n", + "outhandle.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter source file name \n", + "Employee.txt\n", + "Enter target file name \n", + "temp.txt\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.12 Page number: 470

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "fp = open ( \"C:/Users/Akshatha/Documents/extrastuff/skills.txt\", \"w\" ) \n", + "while (1):\n", + " try:\n", + " ch = fp.read(1) #read character from file \n", + " except: #ferror()\n", + " print \"Error in reading file\" \n", + " break \n", + " print ch \n", + " \n", + "fp.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Error in reading file\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.13 Page number: 472

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import io\n", + "\n", + "try:\n", + " fp = open (\"C:/Users/Akshatha/Documents/extrastuff/skills.txt\", \"r\")\n", + "except:\n", + " print \"cannot open file\"\n", + " exit()\n", + " \n", + "io.open('stdprn','w') \n", + "try:\n", + " stdprn = io.open('stdprn', 'w') #open printer\n", + "\n", + " while ( 1 ):\n", + " ch = fp.read(1)\n", + " if not ch :\n", + " break\n", + " else:\n", + " stdprn.write(ch) #write into printer\n", + "except: #no printer\n", + " #closen files\n", + " fp.close()\n", + " stdprn.close()\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 5 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Let us C/.ipynb_checkpoints/chapter-13-checkpoint.ipynb b/Let us C/.ipynb_checkpoints/chapter-13-checkpoint.ipynb new file mode 100644 index 00000000..bd6dda0d --- /dev/null +++ b/Let us C/.ipynb_checkpoints/chapter-13-checkpoint.ipynb @@ -0,0 +1,83 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:38a69ac05001af67e94c3a40d834f3bbd2c217ab113749c395067fe2f553c887" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 13: More Issues In Input/Output

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 13.1 Page number: 467

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import sys\n", + "\n", + "if ( len(sys.argv) != 3 ):\n", + " print ( \"Improper number of arguments\" )\n", + " exit( )\n", + " \n", + "fs = open ( sys.argv[2], \"r\" ) #open file in read mode\n", + "if ( not fs):\n", + " print ( \"Cannot open source file\" )\n", + " exit( )\n", + " \n", + "ft = open ( sys.argv[2], \"w\" ) #open file in write mode\n", + "if ( not ft ):\n", + " print ( \"Cannot open target file\" )\n", + " fs.close()\n", + " exit( )\n", + " \n", + "while ( 1 ):\n", + " ch = fs.read(1)\n", + " if ( not ch ):\n", + " break\n", + " else:\n", + " ft.write(ch)\n", + "\n", + "#close files \n", + "fs.close()\n", + "ft.close()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Improper number of arguments\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Let us C/.ipynb_checkpoints/chapter-14-checkpoint.ipynb b/Let us C/.ipynb_checkpoints/chapter-14-checkpoint.ipynb new file mode 100644 index 00000000..c01593ec --- /dev/null +++ b/Let us C/.ipynb_checkpoints/chapter-14-checkpoint.ipynb @@ -0,0 +1,845 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:96bb77f7d99dd117be704a2641450350e8dffa594859c5068e028cb5a2e776fc" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 14: Operations On Bits

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.1 Page number: 483

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Function definition\n", + "def showbits ( n ):\n", + " a = 15\n", + " for i in range(0,16):\n", + " andmask = 1 << a\n", + " k = n & andmask\n", + " if k == 0:\n", + " print \"0\"\n", + " else:\n", + " print \"1\" \n", + " a = a-1\n", + "\n", + "\n", + "#Result\n", + "for j in range(0,6):\n", + " print \"Decimal %d is same as binary \"%( j )\n", + " showbits ( j ) #function call\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Decimal 0 is same as binary \n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "Decimal 1 is same as binary \n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "1\n", + "Decimal 2 is same as binary \n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "1\n", + "0\n", + "Decimal 3 is same as binary \n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "1\n", + "1\n", + "Decimal 4 is same as binary \n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "1\n", + "0\n", + "0\n", + "Decimal 5 is same as binary \n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "1\n", + "0\n", + "1\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.2 Page number: 484

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Function definition\n", + "def showbits ( n ):\n", + " a = 15\n", + " for i in range(0,16):\n", + " andmask = 1 << a\n", + " k = n & andmask\n", + " if k == 0:\n", + " print \"0\" \n", + " else:\n", + " print \"1\" \n", + " a = a-1\n", + "\n", + "\n", + "for j in range(0,4):\n", + " print \"Decimal %d is same as binary \"%(j )\n", + " showbits ( j ) \n", + " k = ~j \n", + " print \"One\u2019s complement of %d is \"%( j ) \n", + " showbits ( k )" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Decimal 0 is same as binary \n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "One\u2019s complement of 0 is \n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "Decimal 1 is same as binary \n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "1\n", + "One\u2019s complement of 1 is \n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "0\n", + "Decimal 2 is same as binary \n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "1\n", + "0\n", + "One\u2019s complement of 2 is \n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "0\n", + "1\n", + "Decimal 3 is same as binary \n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "1\n", + "1\n", + "One\u2019s complement of 3 is \n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "0\n", + "0\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.3 Page number: 485

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Function definition\n", + "def encrypt( ):\n", + " fs = open ( \"C:/Users/Akshatha M/Desktop/carrot.txt\", \"r\" ) #normal file \n", + " ft = open ( \"C:/Users/Akshatha M/Desktop/temp.txt\", \"w\" ) # encrypted file \n", + " if ( not fs or not ft ):\n", + " print \"File opening error!\" \n", + " exit()\n", + " while (1):\n", + " ch = fs.read(1)\n", + " if(not ch): #EOF\n", + " break\n", + " else:\n", + " ft.write(ascii(~ord(ch))) #complemented\n", + " #close files\n", + " fs.close()\n", + " ft.close()\n", + "\n", + "\n", + "encrypt() #function call\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.4 Page number: 487

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Function definition\n", + "def showbits ( n ):\n", + " a = 15\n", + " for i in range(0,16):\n", + " andmask = 1 << a\n", + " k = n & andmask\n", + " if k == 0:\n", + " print \"0\" \n", + " else:\n", + " print \"1\" \n", + " a = a-1\n", + "\n", + "#Variable declaration\n", + "i = 5225\n", + "\n", + "print \"Decimal %d is same as binary \"%( i )\n", + "showbits(i)#function call\n", + "\n", + "for j in range(0,6):\n", + " k = i >>j #right shift \n", + " print \"%d right shift %d gives \" %(i, j )\n", + " showbits ( k ) #function call " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Decimal 5225 is same as binary \n", + "0\n", + "0\n", + "0\n", + "1\n", + "0\n", + "1\n", + "0\n", + "0\n", + "0\n", + "1\n", + "1\n", + "0\n", + "1\n", + "0\n", + "0\n", + "1\n", + "5225 right shift 0 gives \n", + "0\n", + "0\n", + "0\n", + "1\n", + "0\n", + "1\n", + "0\n", + "0\n", + "0\n", + "1\n", + "1\n", + "0\n", + "1\n", + "0\n", + "0\n", + "1\n", + "5225 right shift 1 gives \n", + "0\n", + "0\n", + "0\n", + "0\n", + "1\n", + "0\n", + "1\n", + "0\n", + "0\n", + "0\n", + "1\n", + "1\n", + "0\n", + "1\n", + "0\n", + "0\n", + "5225 right shift 2 gives \n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "1\n", + "0\n", + "1\n", + "0\n", + "0\n", + "0\n", + "1\n", + "1\n", + "0\n", + "1\n", + "0\n", + "5225 right shift 3 gives \n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "1\n", + "0\n", + "1\n", + "0\n", + "0\n", + "0\n", + "1\n", + "1\n", + "0\n", + "1\n", + "5225 right shift 4 gives \n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "1\n", + "0\n", + "1\n", + "0\n", + "0\n", + "0\n", + "1\n", + "1\n", + "0\n", + "5225 right shift 5 gives \n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "1\n", + "0\n", + "1\n", + "0\n", + "0\n", + "0\n", + "1\n", + "1\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.5 Page number: 488

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Function definition\n", + "def showbits ( n ):\n", + " a = 15\n", + " for i in range(0,16):\n", + " andmask = 1 << a\n", + " k = n & andmask\n", + " if k == 0:\n", + " print \"0\" \n", + " else:\n", + " print \"1\" \n", + " a = a-1\n", + "\n", + "#Variable declaration\n", + "i = 5225\n", + "\n", + "print \"Decimal %d is same as binary \"%( i )\n", + "showbits(i)#function call\n", + "\n", + "for j in range(0,6):\n", + " k = i <Example 14.6 Page number: 492

\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "d = 9\n", + "m = 3\n", + "y = 1990\n", + "\n", + "#Calculation and result\n", + "date = ( y - 1980 ) * 512 + m * 32 + d \n", + "print \"Date = %u\"%( date ) \n", + "year = 1980 + ( date >> 9 ) \n", + "month = ( (date << 7 ) >> 12 ) \n", + "day = ( (date << 11 ) >> 11 ) \n", + "print \"Year = \", year \n", + "print \"Month = %u\" %(m)\n", + "print \"Day = %u\" %(d)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Date = 5225\n", + "Year = 1990\n", + "Month = 3\n", + "Day = 9\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.7 Page number: 495

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "i = 65\n", + "\n", + "print \"value of i = \", i \n", + "\n", + "j = i & 32 #bitwise and\n", + "if ( j == 0 ):\n", + " print \"and its fifth bit is off\" \n", + "else:\n", + " print \"and its fifth bit is on\"\n", + "\n", + "j = i & 64 #bitwise and\n", + "if ( j == 0 ):\n", + " print \"whereas its sixth bit is off\" \n", + "else:\n", + " print \"whereas its sixth bit is on\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "value of i = 65\n", + "and its fifth bit is off\n", + "whereas its sixth bit is on\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.8 Page number: 500

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "b = 50\n", + "\n", + "#Calculation and result\n", + "b = b ^ 12 \n", + "print b # this will print 62 \n", + "b = b ^ 12 \n", + "print b # this will print 50 \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "62\n", + "50\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Let us C/.ipynb_checkpoints/chapter-15-checkpoint.ipynb b/Let us C/.ipynb_checkpoints/chapter-15-checkpoint.ipynb new file mode 100644 index 00000000..14199913 --- /dev/null +++ b/Let us C/.ipynb_checkpoints/chapter-15-checkpoint.ipynb @@ -0,0 +1,603 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:a90b9698d7e7ff1bb70d7ec09c9e8360ac113b9df1f45548a6b3d10da82cb543" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 15: Miscellaneous Features

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 15.1, Page number: 508

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def enum(**enums):\n", + " return type('Enum', (), enums)\n", + "#Enum declaration\n", + "emp_dept = enum(assembly = 0, manufacturing = 1,accounts = 2, stores = 3)\n", + "\n", + "from collections import namedtuple\n", + "#Structure declaration\n", + "struct_employee = namedtuple(\"struct_employee\", \"name age bs emp_dept\")\n", + "\n", + "\n", + "#Structure for employee\n", + "department = emp_dept.manufacturing\n", + "e = struct_employee(\"Lothar Mattheus\",28,5575.50,department)\n", + "\n", + "#Result\n", + "print \"Name = \",e.name\n", + "print \"Age = \",e.age\n", + "print \"Basic salary = \",e.bs\n", + "print \"Dept = \",e.emp_dept\n", + "\n", + "if(e.emp_dept == 2):\n", + " print \"%s is an accountant\" %(e.name)\n", + "else:\n", + " print \"%s is not an accountant\" %(e.name)\n", + " \n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name = Lothar Mattheus\n", + "Age = 28\n", + "Basic salary = 5575.5\n", + "Dept = 1\n", + "Lothar Mattheus is not an accountant\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 15.2 Page number: 510

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#macro definition\n", + "ASSEMBLY = 0\n", + "MANUFACTURING = 1\n", + "ACCOUNTS = 2\n", + "STORES = 3\n", + "\n", + "from collections import namedtuple\n", + "#Structure declaration\n", + "struct_employee = namedtuple(\"struct_employee\", \"name age bs department\")\n", + "\n", + "#Structure for employee\n", + "e = struct_employee(\"Lothar Mattheus\",28,5575.50,MANUFACTURING)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 15.3 Page number: 513

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "x=6\n", + "y=4\n", + "\n", + "#Calculation\n", + "a = int( x/y) \n", + "\n", + "#Result\n", + "print \"Value of a = %f\" %(a)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of a = 1.000000\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 15.4 Page number: 513

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "x=6\n", + "y=4\n", + "\n", + "#Calculation\n", + "a = float( x)/y\n", + "\n", + "#Result\n", + "print \"Value of a = %f\" %(a)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of a = 1.500000\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 15.5 Page number: 514

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "a=6.35\n", + "\n", + "#Result\n", + "print \"Value of a on typecasting = %d\" %(int(a))\n", + "print \"Value of a = %f\"%(a)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of a on typecasting = 6\n", + "Value of a = 6.350000\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 15.6 Page number: 516

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from ctypes import *\n", + "import ctypes\n", + "import math\n", + "\n", + "#macro definition\n", + "MALE = 0\n", + "FEMALE = 1\n", + "SINGLE = 0\n", + "MARRIED = 1\n", + "DIVORCED = 2\n", + "WIDOWED = 3\n", + "\n", + "#Structure declaration\n", + "class employee(Structure):\n", + " _fields_ = [(\"gender\", c_int, 1),(\"mar_stat\", c_int, 3),(\"hobby\", c_int, 3),(\"scheme\", c_int, 4)]\n", + " _sizeof_ = 2\n", + "#Structure for employee\n", + "e = employee()\n", + "e.gender = MALE\n", + "e.mar_stat = DIVORCED\n", + "e.hobby = 5\n", + "e.scheme =9\n", + "\n", + "#Result\n", + "print \"Gender = \",e.gender\n", + "print \"Marital status = \",e.mar_stat\n", + "print \"Bytes occupied by e = \",sizeof(e)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Gender = 0\n", + "Marital status = 2\n", + "Bytes occupied by e = 4\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 15.7 Page number: 517

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Function definition\n", + "def display():\n", + " print \"Long live viruses!!\"\n", + "\n", + "#Result\n", + "print \"Address of function display is \",id(display)\n", + "display() #function call\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Address of function display is 133993192\n", + "Long live viruses!!\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 15.7 Page number: 518

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Function definition\n", + "def display():\n", + " print \"Long live viruses!!\"\n", + "\n", + "func_ptr = id(display) #assigning address of function\n", + "print \"Address of function display is \",func_ptr\n", + "display() #function call\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Address of function display is 133993080\n", + "Long live viruses!!\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 15.8 Page number: 520

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Function definition\n", + "def fun():\n", + " i = 20\n", + " return (i)\n", + "\n", + "#Result\n", + "p =fun() #function call\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 15.9 Page number: 520

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Function definition\n", + "def copy(t,s):\n", + " i = 0\n", + " while ( s[i] != '\\0' ):\n", + " t = t + s[i]\n", + " i = i + 1\n", + " return t\n", + "\n", + "#Variable declaration\n", + "source = \"Jaded\\0\" \n", + "target = ''\n", + "string = copy( target, source ) # function call\n", + "\n", + "#Result\n", + "print string\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Jaded\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 15.10 Page number: 522

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "to find out max value from a set of values\n", + "\n", + "#function declaration\n", + "def findmax(*arg):\n", + " maxi = arg[1]\n", + " for count in range(2,arg[0]):\n", + " num = arg[count]\n", + " if (num > maxi):\n", + " maxi = num\n", + " return maxi\n", + "\n", + "maxi = findmax(5,23,15,1,92,50)#function call \n", + "print \"maximum = \",maxi\n", + "\n", + "maxi = findmax(3,100,300,29)#function call \n", + "print \"maximum = \",maxi\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "maximum = 92\n", + "maximum = 300\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 15.11 Page number: 524

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#function declaration\n", + "def display(*arg):\n", + " if(arg[0] == 1): #case int\n", + " for j in range(2,arg[1]+2):\n", + " i = arg[j]\n", + " print \"%d\"%(i)\n", + " elif(arg[0] == 2): #case char\n", + " for j in range(2,arg[1]+2):\n", + " i = arg[j]\n", + " print \"%c\"%(i)\n", + " elif(arg[0] == 3): #case double\n", + " for j in range(2,arg[1]+2):\n", + " i = arg[j]\n", + " print \"%lf\"%(i)\n", + " \n", + "#function calls\n", + "display(1,2,5,6)\n", + "display(2,4,'A','a','b','c')\n", + "display(3,3,2.5,299.3,-1.0)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n", + "6\n", + "A\n", + "a\n", + "b\n", + "c\n", + "2.500000\n", + "299.300000\n", + "-1.000000\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 15.12 Page number: 526

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from ctypes import *\n", + "\n", + "#union declaration\n", + "class union_a(Union):\n", + " _fields_ = [(\"i\", c_int),\n", + " (\"ch\", ((c_char * 1)*2))]\n", + "\n", + "key = union_a()\n", + "key.i = 512\n", + "print \"key.i = \",key.i\n", + "print \"key.ch[0] = \",(key.ch[0][0])\n", + "print \"key.ch[1] = \",(key.ch[1][0])\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 15.13 Page number: 530

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from ctypes import *\n", + "\n", + "#Union declaration\n", + "class union_a(Union):\n", + " _fields_ = [(\"i\", c_int),\n", + " (\"ch\", ((c_char * 1)*2))]\n", + "\n", + "key = union_a()\n", + "key.i = 512\n", + "print \"key.i = \",key.i\n", + "print \"key.ch[0] = \",(key.ch[0][0])\n", + "print \"key.ch[1] = \",(key.ch[1][0])\n", + "\n", + "key.ch[0][0] = 50 #assign new value to key.ch[0]\n", + "print\"key.i = \",key.i\n", + "print\"key.ch[0] = \",(key.ch[0][0])\n", + "print\"key.ch[1] = \",(key.ch[1][0])\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 15.13, Page number: 531

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from ctypes import *\n", + "\n", + "#Structure declarations\n", + "class a(Structure):\n", + " _fields_ = [(\"i\", c_int),\n", + " (\"c\", ((c_char * 1)*2))]\n", + "\n", + "class b(Structure):\n", + " _fields_ = [(\"j\", c_int),\n", + " (\"d\", ((c_char * 1)*2))]\n", + " \n", + "#Union declaration\n", + "class union_z(Union):\n", + " _fields_ = [(\"key\", a),\n", + " (\"data\", b )]\n", + "\n", + "strange = union_z()\n", + "strange.key.i = 512\n", + "strange.data.d[0][0] = 0\n", + "strange.data.d[1][0] = 32\n", + "\n", + "print strange.key.i\n", + "print strange.data.j\n", + "print strange.key.c[0][0]\n", + "print strange.data.d[0][0]\n", + "print strange.key.c[1][0]\n", + "print strange.data.d[1][0]\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Let us C/.ipynb_checkpoints/chapter-16-checkpoint.ipynb b/Let us C/.ipynb_checkpoints/chapter-16-checkpoint.ipynb new file mode 100644 index 00000000..824cbe4e --- /dev/null +++ b/Let us C/.ipynb_checkpoints/chapter-16-checkpoint.ipynb @@ -0,0 +1,68 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:5d242b124a1674f55a1e4dda8447fdf9d35c8383bc1dba01fbe3d04ac148a706" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 16: C Under Windows

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 16.1 Page number: 554

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import ctypes\n", + "MessageBox = ctypes.windll.user32.MessageBoxW\n", + "MessageBox(None, 'Hello', 'Title', 0)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 1, + "text": [ + "1" + ] + }, + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 2, + "text": [ + "1" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Let us C/.ipynb_checkpoints/chapter-17-checkpoint.ipynb b/Let us C/.ipynb_checkpoints/chapter-17-checkpoint.ipynb new file mode 100644 index 00000000..b4ae7690 --- /dev/null +++ b/Let us C/.ipynb_checkpoints/chapter-17-checkpoint.ipynb @@ -0,0 +1,113 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:6150bfc1003739481860a14f71bf34ce4c550ec79e49fd6d2a81f2933c34367e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 17: Windows Programming

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 17.1 Page number: 563

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from tkinter import *\n", + "\n", + "\n", + "#creating window\n", + "root = Tk()\n", + "root.title(\"Press Me\")\n", + "button1 = Button(root, text=\"Press Me\") #creating button\n", + "button1.pack()\n", + "import ctypes #creating message box\n", + "MessageBox = ctypes.windll.user32.MessageBoxW\n", + "MessageBox(None, 'Hi!', 'Waiting', 0)\n", + "root.mainloop()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 17.2 Page number: 566

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from tkinter import *\n", + "root = []\n", + "#creating windows\n", + "for x in range(0,10):\n", + " root.append(Tk())\n", + " root[x].title(\"Press Me\")\n", + " button1 = Button(root[x], text=\"Press Me\") #creating button\n", + " button1.pack()\n", + " \n", + "import ctypes #creating message box\n", + "MessageBox = ctypes.windll.user32.MessageBoxW\n", + "MessageBox(None, 'Hi!', 'Waiting', 0)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 17.3 Page number: 568

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from tkinter import *\n", + "\n", + "\n", + "class Example(Frame):\n", + " def __init__(self, parent):\n", + " Frame.__init__(self, parent)\n", + "\n", + " self.display = Canvas(self, width=700, height=200)\n", + " self.display.pack(side=\"top\", fill=\"both\", expand=True)\n", + " \n", + "if __name__ == \"__main__\":\n", + " root = Tk()\n", + " root.title(\"Title\")\n", + " Frame = Example(parent=root)\n", + " Frame.pack(side=\"top\", fill=\"both\", expand=True)\n", + " root.mainloop()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Let us C/.ipynb_checkpoints/chapter-18-checkpoint.ipynb b/Let us C/.ipynb_checkpoints/chapter-18-checkpoint.ipynb new file mode 100644 index 00000000..5911f37a --- /dev/null +++ b/Let us C/.ipynb_checkpoints/chapter-18-checkpoint.ipynb @@ -0,0 +1,256 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:035bb57771a4e676fbffba92c85e10e1964ff3cc0e61084caf18587a884a3fc2" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 18: Graphics Under Windows

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.1 Page number: 582

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from tkinter import *\n", + "\n", + "\n", + "class Example(Frame):\n", + " def __init__(self, parent):\n", + " Frame.__init__(self, parent)\n", + "\n", + " self.display = Canvas(self, width=700, height=200)\n", + " self.display.pack(side=\"top\", fill=\"both\", expand=True)\n", + " self.display.create_text(10, 10, fill = \"blue\",text = \"Hello Windows\", font=\"Arial 20 italic\",\n", + " anchor=\"nw\")\n", + " self.display.create_text(10, 50, fill = \"blue\",text = \"Hello Windows\", font=\"TimesNewRoman 30 italic\",\n", + " anchor=\"nw\")\n", + " self.display.create_text(10, 100, fill = \"blue\",text = \"Hello Windows\", font=\"ComicSansMS 40 italic\",\n", + " anchor=\"nw\")\n", + "\n", + "if __name__ == \"__main__\":\n", + " root = Tk()\n", + " root.title(\"Text\")\n", + " Frame = Example(parent=root)\n", + " Frame.pack(side=\"top\", fill=\"both\", expand=True)\n", + " root.mainloop()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.2 Page number: 587

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from tkinter import *\n", + "\n", + "\n", + "top = Tk()\n", + "top.title(\"Shapes\")\n", + "C = Canvas(top, height=500, width=500)\n", + "rcoor = 10,20,200,100\n", + "rect = C.create_rectangle(rcoor,fill=\"blue\")#rectangle\n", + "ecoor = 10,280,200,380\n", + "ellipse = C.create_oval(ecoor,fill = \"blue\")#ellipse\n", + "picoor = 250,0,350,100\n", + "pie = C.create_arc(picoor, start=300, extent=100, fill=\"blue\")#pie\n", + "pocoor = 250, 150, 250, 300, 300, 350, 400, 300, 320, 190\n", + "polygon = C.create_polygon(pocoor,fill=\"blue\")#polygon\n", + "#roundedrectangle\n", + "c1= C.create_arc(155,115,195,150,start=320, extent=80, fill=\"blue\",outline=\"blue\")\n", + "c2= C.create_arc(155,208,195,243,start=320, extent=80, fill=\"blue\",outline=\"blue\")\n", + "c3= C.create_arc(25,118,60,153,start=100, extent=150, fill=\"blue\",outline=\"blue\")\n", + "c4= C.create_arc(25,207,60,242,start=100, extent=150, fill=\"blue\",outline=\"blue\")\n", + "roundrect = C.create_rectangle(30,120,190,240,fill=\"blue\",outline=\"blue\")\n", + "C.pack()\n", + "top.mainloop()" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.3 Page number: 590

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from tkinter import *\n", + "\n", + "\n", + "top = Tk()\n", + "top.title(\"Pen styles\")\n", + "C = Canvas(top, height=100, width=500)\n", + "l1 = C.create_line(0,10,500,10,fill=\"red\",dash=(5)) #dashed line\n", + "l2 = C.create_line(0,30,500,30,fill=\"red\",dash=(1)) #dotted line\n", + "l3 = C.create_line(0,50,500,50,fill=\"red\",dash=(5,1,1,1)) #dash dot\n", + "l4 = C.create_line(0,70,500,70,fill=\"red\",dash=(5,1,1,1,1)) #dash dot dot\n", + "l5 = C.create_line(0,90,500,90,fill=\"red\",width=4) #solid line\n", + "C.pack()\n", + "top.mainloop()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.4 Page number: 592

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import sys\n", + "from PyQt4 import QtGui, QtCore\n", + "\n", + "\n", + "class Example(QtGui.QWidget):\n", + " \n", + " def __init__(self):\n", + " super(Example, self).__init__()\n", + " \n", + " self.initUI()\n", + " \n", + " def initUI(self): \n", + "\n", + " self.setGeometry(300, 300, 355, 280)\n", + " self.setWindowTitle('Brush Styles')\n", + " self.show()\n", + "\n", + " def paintEvent(self, e):\n", + "\n", + " qp = QtGui.QPainter()\n", + " qp.begin(self)\n", + " self.drawBrushes(qp)\n", + " qp.end()\n", + " \n", + " def drawBrushes(self, qp):\n", + " \n", + " brush = QtGui.QBrush(QtCore.Qt.SolidPattern)\n", + " qp.setBrush(brush)\n", + " qp.drawRect(10, 15, 90, 60)\n", + "\n", + " brush.setStyle(QtCore.Qt.CrossPattern)\n", + " qp.setBrush(brush)\n", + " qp.drawRect(130, 15, 90, 60)\n", + "\n", + " \n", + " image = QtGui.QImage(\"C:/Users/Public/Pictures/Sample Pictures/Chrysanthemum.jpg\")\n", + " brush.setTextureImage (image)\n", + " qp.setBrush(brush)\n", + " qp.drawRect(250, 15, 90, 60)\n", + "\n", + " \n", + " \n", + " \n", + "def main():\n", + " \n", + " app = QtGui.QApplication(sys.argv)\n", + " ex = Example()\n", + " sys.exit(app.exec_())\n", + "\n", + "\n", + "if __name__ == '__main__':\n", + " main()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.5 Page number: 605

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from tkinter import *\n", + "\n", + "\n", + "top = Tk()\n", + "top.title(\"Pen styles\")\n", + "C = Canvas(top, height=300, width=500)\n", + "filename = PhotoImage(file = \"C:/Users/Akshatha M/Desktop/dialog1.gif\")\n", + "image = C.create_image(50, 50, anchor=NE, image=filename)\n", + "C.pack()\n", + "top.mainloop()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.6 Page number: 608

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from visual import *\n", + "\n", + "floor = box(length=4, height=0.5, width=4, color=color.blue)\n", + "\n", + "ball = sphere(pos=(0,4,0), color=color.red)\n", + "ball.velocity = vector(0,-1,0)\n", + "\n", + "dt = 0.01\n", + "while 1:\n", + " rate(100)\n", + " ball.pos = ball.pos + ball.velocity*dt\n", + " if ball.y < 1:\n", + " ball.velocity.y = -ball.velocity.y\n", + " else:\n", + " ball.velocity.y = ball.velocity.y - 9.8*dt\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Let us C/.ipynb_checkpoints/chapter-2-checkpoint.ipynb b/Let us C/.ipynb_checkpoints/chapter-2-checkpoint.ipynb new file mode 100644 index 00000000..2e54e83c --- /dev/null +++ b/Let us C/.ipynb_checkpoints/chapter-2-checkpoint.ipynb @@ -0,0 +1,523 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:4ad8cbca4454ee7f8d6b25a7cc86ebf15f8e3e308a85ba2aae557015f72740a0" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 2: The Decision Control Structure

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.1 Page number: 52

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter a number less than 10: \"\n", + "num = 8\n", + "print num\n", + "\n", + "#if statement\n", + "if num <= 10:\n", + " print(\"What an obedient servant you are !\") #display result\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a number less than 10: \n", + "8\n", + "What an obedient servant you are !\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.2 , Page number: 53

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "dis = 0 #Initial Discount (%0)\n", + "\n", + "#Input from the user\n", + "#qty,rate = raw_input(\"Enter quantity and rate: \").split()\n", + "print \"Enter quantity and rate: \"\n", + "qty = 1200 # Quantity of item\n", + "rate = 15.50 # Rate of item (Rs)\n", + "print qty , rate\n", + "\n", + "#discount of 10% if quantity > 1000\n", + "if qty > 1000:\n", + " dis = 10\n", + "\n", + "#Calculation\n", + "tot = (qty * rate) - (qty * rate * dis / 100 ) # total expenses (Rs)\n", + "\n", + "#Result\n", + "print \"Total expenses = Rs. \", tot \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter quantity and rate: \n", + "1200 15.5\n", + "Total expenses = Rs. 16740.0\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.2, Page number: 57

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#cy,yoj = raw_input(\"Enter current year and year of joining: \").split() \n", + "print \"Enter current year and year of joining: \"\n", + "cy = 2013 # Current year\n", + "yoj = 1990 # Year of joining\n", + "print cy, yoj \n", + "#Calculation\n", + "yr_of_ser = cy - yoj # number of years of service\n", + "\n", + "#Assign bonus if years of service > 3\n", + "if yr_of_ser > 3:\n", + " bonus = 2500 # Bonus of Rs. 2500\n", + " print \"Bonus = Rs.\", bonus #display result\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter current year and year of joining: \n", + "2013 1990\n", + "Bonus = Rs. 2500\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.3 , Page number: 58

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter basic salary: \"\n", + "bs = 2561.1 #Basic salary (Rs)\n", + "print bs\n", + "\n", + "#Calculation\n", + "if bs < 1500: # if basic salary is less than Rs.1500\n", + " hra = bs * 10 / 100 # HRA (Rs)\n", + " da = bs * 90 / 100 #DA (Rs)\n", + "else: #if basic salary is greater than or equal to Rs.1500\n", + " hra = 500 # HRA (Rs)\n", + " da = bs * 98 / 100 # DA (Rs)\n", + "\n", + "gs = bs + hra + da # gross salary (Rs)\n", + "\n", + "#Result\n", + "print \"gross salary = Rs. \", gs \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter basic salary: \n", + "2561.1\n", + "gross salary = Rs. 5570.978\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.4 , Page number: 61

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter either 1 or 2: \"\n", + "i = 1\n", + "print i\n", + "\n", + "#nested if-else\n", + "if i == 1 :\n", + " print \"You would go to heaven !\" \n", + "else:\n", + " if i == 2 :\n", + " print \"Hell was created with you in mind\" \n", + " else:\n", + " print \"How about mother earth !\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter either 1 or 2: \n", + "1\n", + "You would go to heaven !\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.4 (Method 1), Page number: 64

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter marks in five subjects: \"\n", + "m1 = 88 #Marks in 1st subject\n", + "m2 = 92 #Marks in 2nd subject\n", + "m3 = 87 #Marks in 3rd subject\n", + "m4 = 66 #Marks in 4th subject\n", + "m5 = 56 #Marks in 5th subject\n", + "print m1,m2,m3,m4,m5\n", + "\n", + "#Calculation\n", + "per = ( m1 + m2 + m3 + m4 + m5 ) / 5 #Percentage\n", + "\n", + "#check for different cases and display appropriate result\n", + "if per >= 60:\n", + " print \"First division\"\n", + "else:\n", + " if per >= 50:\n", + " print \"Second division\"\n", + " else:\n", + " if per >= 40:\n", + " print \"Third division\"\n", + " else:\n", + " print \"Fail\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Enter marks in five subjects: \n", + "88 92 87 66 56\n", + "First division\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.4 (Method 2), Page number: 65

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter marks in five subjects: \"\n", + "m1 = 88 #Marks in 1st subject\n", + "m2 = 92 #Marks in 2nd subject\n", + "m3 = 87 #Marks in 3rd subject\n", + "m4 = 66 #Marks in 4th subject\n", + "m5 = 56 #Marks in 5th subject\n", + "print m1,m2,m3,m4,m5\n", + "\n", + "#Calculation\n", + "per = ( m1 + m2 + m3 + m4 + m5 ) / 5 #Percentage\n", + "\n", + "#check for different cases and display appropriate result\n", + "if per >= 60:\n", + " print \"First division\"\n", + "\n", + "if (per >= 50) and (per <60):\n", + " print\"Second division\"\n", + "\n", + "if (per >= 40) and (per <50):\n", + " print\"Third division\"\n", + "\n", + "if per < 40 :\n", + " print\"Fail\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks in five subjects: \n", + "88 92 87 66 56\n", + "First division\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.4 (Method 3), Page number: 67

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter marks in five subjects: \"\n", + "m1 = 88 #Marks in 1st subject\n", + "m2 = 92 #Marks in 2nd subject\n", + "m3 = 87 #Marks in 3rd subject\n", + "m4 = 66 #Marks in 4th subject\n", + "m5 = 56 #Marks in 5th subject\n", + "print m1,m2,m3,m4,m5\n", + "\n", + "#Calculation\n", + "per = ( m1 + m2 + m3 + m4 + m5 ) / 5 #Percentage\n", + "\n", + "#check for different cases and display appropriate result\n", + "if per >= 60:\n", + " print\"First division\"\n", + "elif per >= 50:\n", + " print\"Second division\"\n", + "elif per >= 40:\n", + " print\"Third division\"\n", + "else:\n", + " print\"Fail\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks in five subjects: \n", + "88 92 87 66 56\n", + "First division\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.5 (Method 1) , Page number: 68

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter age, sex, marital status: \"\n", + "age = 43 # Age of driver (years)\n", + "sex = 'M'\n", + "ms = 'M'\n", + "print age,sex,ms\n", + "#check for different cases and display appropriate result\n", + "if ms == 'M':\n", + " print(\"Driver is insured\")\n", + "else:\n", + " if sex == 'M':\n", + " if age > 30:\n", + " print (\"Driver is insured\")\n", + " else:\n", + " print (\"Driver is not insured\")\n", + " else:\n", + " if age > 25:\n", + " print (\"Driver is insured\")\n", + " else:\n", + " print (\"Driver is not insured\")\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter age, sex, marital status: \n", + "43 M M\n", + "Driver is insured\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.5 (Method 2) , Page number: 69

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter age, sex, marital status: \"\n", + "age = 43 # Age of driver (years)\n", + "sex = 'M'\n", + "ms = 'M'\n", + "print age,sex,ms\n", + "\n", + "#check for different cases and display appropriate result\n", + "if ((ms == 'M') or (ms == 'U' and sex == 'M' and age > 30) or (ms == 'U' and sex == 'F' and age >25) ) :\n", + " print\"Driver is insured\"\n", + "else:\n", + " print\"Driver is not insured\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter age, sex, marital status: \n", + "43 M M\n", + "Driver is insured\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.6, Page number: 71

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter Gender, Years of Service and Qualifications ( 0 = G, 1 = PG ):\"\n", + "g = 'f'\n", + "yos = 8 # Years of service(years)\n", + "qual = 1 # Qualification ( 0=G, 1=PG)\n", + "print g,yos,qual\n", + "\n", + "# Assign salary depending upon the conditions\n", + "if (g == 'm') and (yos >= 10) and (qual == 1):\n", + " sal = 15000 #salary\n", + "elif ((g == 'm' and yos >= 10 and qual == 0) or ( g == 'm' and yos < 10 and qual == 1 )):\n", + " sal = 10000 #salary\n", + "elif ( g == 'm' and yos < 10 and qual == 0 ):\n", + " sal = 7000 #salary\n", + "elif ( g == 'f' and yos >= 10 and qual == 1 ):\n", + " sal = 12000 #salary\n", + "elif ( g == 'f' and yos >= 10 and qual == 0 ):\n", + " sal = 9000 #salary\n", + "elif ( g == 'f' and yos < 10 and qual == 1 ):\n", + " sal = 10000 #salary\n", + "elif ( g == 'f' and yos < 10 and qual == 0 ):\n", + " sal = 6000 #salary\n", + "\n", + "#Result\n", + "print \"Salary of Employee = \", sal " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Gender, Years of Service and Qualifications ( 0 = G, 1 = PG ):\n", + "f 8 1\n", + "Salary of Employee = 10000\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Let us C/.ipynb_checkpoints/chapter-20-checkpoint.ipynb b/Let us C/.ipynb_checkpoints/chapter-20-checkpoint.ipynb new file mode 100644 index 00000000..cd572cb4 --- /dev/null +++ b/Let us C/.ipynb_checkpoints/chapter-20-checkpoint.ipynb @@ -0,0 +1,174 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:487f1ed20d6e347b5683ab8c8485daef580038838dab420f2e9ad4054a0bdb13" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 20: C Under Linux

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.1 Page number: 655

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import os\n", + "\n", + "print \"Before Forking\" \n", + "child = os.fork() #create a child process\n", + "print \"After Forking\\n\" \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.2 Page number: 656

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import os\n", + "\n", + "pid = os.fork()\n", + "if pid == 0:\n", + " print \"In child process\" # code to play animated GIF file\n", + "else:\n", + " print \"In parent process\" #code to copy file \n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.3 Page number: 657

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import os\n", + "from multiprocessing import Process\n", + "\n", + "if __name__ == '__main__':\n", + " ppid=os.getpid()\n", + " p = Process()\n", + " p.start()\n", + " cid = os.getpid()\n", + " \n", + "\n", + "if (cid):\n", + " print (\"Child : Hello I am the child process\")\n", + " print (\"Child : Child\u2019s PID: \", os.getpid( ) )\n", + " print (\"Child : Parent\u2019s PID: \", os.getppid( ) )\n", + "else:\n", + " print (\"Parent : Hello I am the parent process\" )\n", + " print (\"Parent : Parent\u2019s PID: \", os.getpid( ) )\n", + " print (\"Parent : Child\u2019s PID: \", cid )\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.4 Page number: 659

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import os\n", + "\n", + "\n", + "pid = os.fork()\n", + "if pid == 0:\n", + " os.execl ( \"/bin/ls\",\"-al\", \"/etc\", NULL ) \n", + " print \"Child: After exec( )\"\n", + "else:\n", + " print \"Parent process\"" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.5 Page number: 662

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import os\n", + "\n", + "i = 0 \n", + "pid = os.fork( ) \n", + "if ( pid == 0 ):\n", + " while ( i < 4294967295 ):\n", + " i=i+1\n", + " print \"The child is now terminating\" \n", + "else:\n", + " os.waitpid ( pid, status, 0 )\n", + " if ( os.WIFEXITED ( status ) ):\n", + " print \"Parent: Child terminated normally\" \n", + " else:\n", + " print \"Parent: Child terminated abnormally\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Let us C/.ipynb_checkpoints/chapter-21-checkpoint.ipynb b/Let us C/.ipynb_checkpoints/chapter-21-checkpoint.ipynb new file mode 100644 index 00000000..a15c33a7 --- /dev/null +++ b/Let us C/.ipynb_checkpoints/chapter-21-checkpoint.ipynb @@ -0,0 +1,220 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:5f7e061f54810fddda35d9e2fe6c5d087a2f5600b95121d75e0620035316a34f" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 21: More Linux Programming

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.1 Page number: 669

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import signal, os\n", + "\n", + "def sighandler ( signum,arg ):\n", + " print ( \"SIGINT received. Inside sighandler\" ) \n", + "\n", + "\n", + "signal.signal(signal.SIGINT,sighandler)\n", + "while ( 1 ):\n", + " print \"Program Running\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.2 Page number: 671

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import signal, os\n", + "\n", + "def inthandler ( signum,arg ):\n", + " print \"SIGINT Received\" \n", + " \n", + "def termhandler ( signum ,arg):\n", + " print \"SIGTERM Received\" \n", + " \n", + "def conthandler ( signum,arg ):\n", + " print \"SIGCONT Received\" \n", + " \n", + "\n", + "signal.signal(signal.SIGINT,inthandler)\n", + "signal.signal(signal.SIGTERM,termhandler)\n", + "signal.signal(signal.SIGCONT,conthandler)\n", + "\n", + "while ( 1 ):\n", + " print \"Program Running\" " + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.3 Page number: 673

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import signal, os\n", + "\n", + "def sighandler ( signum ,arg):\n", + " if(signum == SIGINT):\n", + " print \"SIGINT Received\" \n", + " elif(signum == SIGTERM):\n", + " print \"SIGTERM Received\" \n", + " elif(signum == SIGCONT):\n", + " print \"SIGCONT Received\" \n", + "\n", + "signal.signal(signal.SIGINT,sighandler)\n", + "signal.signal(signal.SIGTERM,sighandler)\n", + "signal.signal(signal.SIGCONT,sighandler)\n", + "\n", + "while ( 1 ):\n", + " print \"Program running\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.4 Page number: 675

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import signal, os\n", + "\n", + "def sighandler ( signum ,arg):\n", + " if(signum == SIGINT):\n", + " print (\"SIGINT Received\") \n", + " elif(signum == SIGTERM):\n", + " print (\"SIGTERM Received\" )\n", + " elif(signum == SIGCONT):\n", + " print ( \"SIGCONT Received\" )\n", + "\n", + "buffer = \"\\0\"\n", + "signal.signal(signal.SIGINT,sighandler)\n", + "signal.signal(signal.SIGTERM,sighandler)\n", + "signal.signal(signal.SIGCONT,sighandler)\n", + "\n", + "signal.pthread_sigmask(signal.SIG_BLOCK, [])\n", + "\n", + "while ( buffer == \"\\0\" ):\n", + " buffer = input(\"Enter a string\")\n", + " print (buffer)\n", + "signal.pthread_sigmask(signal.SIG_UNBLOCK, [])\n", + "while(1):\n", + " print(\"Program running\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.5, Page number: 678

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from tkinter import *\n", + "\n", + "\n", + "class Example(Frame):\n", + " def __init__(self, parent):\n", + " Frame.__init__(self, parent)\n", + "\n", + " self.display = Canvas(self, width=700, height=200)\n", + " self.display.pack(side=\"top\", fill=\"both\", expand=True)\n", + " \n", + "if __name__ == \"__main__\":\n", + " root = Tk()\n", + " root.title(\"Sample Window\")\n", + " Frame = Example(parent=root)\n", + " Frame.pack(side=\"top\", fill=\"both\", expand=True)\n", + " root.mainloop()" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.5 Page number: 681

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from tkinter import *\n", + "\n", + "\n", + "top = Tk()\n", + "top.title(\"Sample Window\")\n", + "C = Canvas(top, height=500, width=500)\n", + "rcoor = 10,20,200,100\n", + "rect = C.create_rectangle(rcoor,fill=\"black\")#rectangle\n", + "picoor = 250,0,350,100\n", + "pie = C.create_arc(picoor, start=300, extent=100, fill=\"black\")#pie\n", + "pocoor = 250, 150, 250, 300, 300, 350, 400, 300, 320, 190\n", + "polygon = C.create_polygon(pocoor,fill=\"black\")#polygon\n", + "C.pack()\n", + "top.mainloop()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Let us C/.ipynb_checkpoints/chapter-3-checkpoint.ipynb b/Let us C/.ipynb_checkpoints/chapter-3-checkpoint.ipynb new file mode 100644 index 00000000..982a060f --- /dev/null +++ b/Let us C/.ipynb_checkpoints/chapter-3-checkpoint.ipynb @@ -0,0 +1,606 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:e147e526b8360f20abf1c770522594e0e591d931974c1242dac8869eb1e499e3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 3: The Loop Control Structure

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.1Page number: 99

\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "count = 1\n", + "pr = [1000,2000,3500]\n", + "yr = [5,5,5]\n", + "intr = [13.5,13.5,3.5]\n", + "\n", + "# while loop\n", + "while count <= 3:\n", + " #Input from the user\n", + " #p,n,r = raw_input(\"Enter values of p, n and r : \").split()\n", + " p = pr[count-1] # principle\n", + " n = yr[count-1] # number of years\n", + " r = intr[count-1]# rate of interest\n", + "\n", + " #Calculation\n", + " si = p * n * r / 100 ; #formula for simple interest\n", + "\n", + " #Result\n", + " print \"Simple interest = Rs.\",si \n", + "\n", + " #Increment count\n", + " count = count + 1\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Simple interest = Rs. 675.0\n", + "Simple interest = Rs. 1350.0\n", + "Simple interest = Rs. 612.5\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.2 Page number: 109

\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "pr = [1000,2000,3500]\n", + "yr = [5,5,5]\n", + "intr = [13.5,13.5,3.5]\n", + "\n", + "#for loop\n", + "for count in range(1, 4):\n", + " #Input from the user\n", + " #p,n,r = raw_input(\"Enter values of p, n and r : \").split()\n", + " p = pr[count-1] # principle\n", + " n = yr[count-1] # number of years\n", + " r = intr[count-1]# rate of interest\n", + " \n", + " #Calculation\n", + " si = p * n * r / 100 ; #formula for simple interest\n", + "\n", + " #Result\n", + " print \"Simple interest = Rs.\",si " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Simple interest = Rs. 675.0\n", + "Simple interest = Rs. 1350.0\n", + "Simple interest = Rs. 612.5\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.3 Page number: 114

\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#nested for loops\n", + "for r in range(1,4): #outer loop\n", + " for c in range(1,3): #inner loop\n", + " s = r + c #find the sum\n", + " print \"r = %d c = %d sum = %d\" % (r, c, s) #Display result\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "r = 1 c = 1 sum = 2\n", + "r = 1 c = 2 sum = 3\n", + "r = 2 c = 1 sum = 3\n", + "r = 2 c = 2 sum = 4\n", + "r = 3 c = 1 sum = 4\n", + "r = 3 c = 2 sum = 5\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Do While Loop , Page number: 116

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#do while loop\n", + "while True:\n", + " #num = raw_input(\"Enter a number: \")\n", + " num = 11\n", + " print \"square of %d is %d\"%(num, num * num )\n", + " print \"Want to enter another number y/n: \" \n", + " another = 'n'\n", + " print another\n", + " if another == 'y':\n", + " continue\n", + " else:\n", + " break\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "square of 11 is 121\n", + "Want to enter another number y/n: \n", + "n\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.4 Page number: 117

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "another = 'y'\n", + "\n", + "#do while loop\n", + "import sys\n", + "for i in range(1,10000): #infinte loop\n", + " #num = raw_input(\"Enter a number: \")\n", + " num = 11\n", + " print \"square of %d is %d\"%(num, num * num )\n", + " print \"Want to enter another number y/n: \" \n", + " another = 'n'\n", + " print another\n", + " if another == 'y':\n", + " continue\n", + " else:\n", + " break\n", + " \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "square of 11 is 121\n", + "Want to enter another number y/n: \n", + "n\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.5 Page number: 117

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "another = 'y'\n", + "\n", + "#do while loop\n", + "while another == 'y':\n", + " #num = raw_input(\"Enter a number: \")\n", + " num = 11\n", + " print \"square of %d is %d\"%(num, num * num )\n", + " print \"Want to enter another number y/n: \" \n", + " another = 'n'\n", + " print another\n", + " \n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "square of 11 is 121\n", + "Want to enter another number y/n: \n", + "n\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.6 Page number: 118

\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Input from user\n", + "#num = raw_input(\"Enter a number: \")\n", + "num = 11\n", + "\n", + "#Variable declaration\n", + "i = 2\n", + "\n", + "#while loop\n", + "while i <=(num - 1):\n", + " if num % i == 0:\n", + " print \"Not a prime number\" #Display if not prime number\n", + " break\n", + " i += 1\n", + "\n", + "#Display if prime number\n", + "if i == num:\n", + " print \"Prime number\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Prime number\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.6 Page number: 119

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "i = 1\n", + "j = 1\n", + "\n", + "#while loops\n", + "while i <= 100 : #outer loop\n", + " i = i+1\n", + " while j <= 200 : #inner loop\n", + " j = j+1\n", + " if j == 150:\n", + " break #break statement in inner loop\n", + " else:\n", + " print i, j \n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "2 2\n", + "2 3\n", + "2 4\n", + "2 5\n", + "2 6\n", + "2 7\n", + "2 8\n", + "2 9\n", + "2 10\n", + "2 11\n", + "2 12\n", + "2 13\n", + "2 14\n", + "2 15\n", + "2 16\n", + "2 17\n", + "2 18\n", + "2 19\n", + "2 20\n", + "2 21\n", + "2 22\n", + "2 23\n", + "2 24\n", + "2 25\n", + "2 26\n", + "2 27\n", + "2 28\n", + "2 29\n", + "2 30\n", + "2 31\n", + "2 32\n", + "2 33\n", + "2 34\n", + "2 35\n", + "2 36\n", + "2 37\n", + "2 38\n", + "2 39\n", + "2 40\n", + "2 41\n", + "2 42\n", + "2 43\n", + "2 44\n", + "2 45\n", + "2 46\n", + "2 47\n", + "2 48\n", + "2 49\n", + "2 50\n", + "2 51\n", + "2 52\n", + "2 53\n", + "2 54\n", + "2 55\n", + "2 56\n", + "2 57\n", + "2 58\n", + "2 59\n", + "2 60\n", + "2 61\n", + "2 62\n", + "2 63\n", + "2 64\n", + "2 65\n", + "2 66\n", + "2 67\n", + "2 68\n", + "2 69\n", + "2 70\n", + "2 71\n", + "2 72\n", + "2 73\n", + "2 74\n", + "2 75\n", + "2 76\n", + "2 77\n", + "2 78\n", + "2 79\n", + "2 80\n", + "2 81\n", + "2 82\n", + "2 83\n", + "2 84\n", + "2 85\n", + "2 86\n", + "2 87\n", + "2 88\n", + "2 89\n", + "2 90\n", + "2 91\n", + "2 92\n", + "2 93\n", + "2 94\n", + "2 95\n", + "2 96\n", + "2 97\n", + "2 98\n", + "2 99\n", + "2 100\n", + "2 101\n", + "2 102\n", + "2 103\n", + "2 104\n", + "2 105\n", + "2 106\n", + "2 107\n", + "2 108\n", + "2 109\n", + "2 110\n", + "2 111\n", + "2 112\n", + "2 113\n", + "2 114\n", + "2 115\n", + "2 116\n", + "2 117\n", + "2 118\n", + "2 119\n", + "2 120\n", + "2 121\n", + "2 122\n", + "2 123\n", + "2 124\n", + "2 125\n", + "2 126\n", + "2 127\n", + "2 128\n", + "2 129\n", + "2 130\n", + "2 131\n", + "2 132\n", + "2 133\n", + "2 134\n", + "2 135\n", + "2 136\n", + "2 137\n", + "2 138\n", + "2 139\n", + "2 140\n", + "2 141\n", + "2 142\n", + "2 143\n", + "2 144\n", + "2 145\n", + "2 146\n", + "2 147\n", + "2 148\n", + "2 149\n", + "3 151\n", + "3 152\n", + "3 153\n", + "3 154\n", + "3 155\n", + "3 156\n", + "3 157\n", + "3 158\n", + "3 159\n", + "3 160\n", + "3 161\n", + "3 162\n", + "3 163\n", + "3 164\n", + "3 165\n", + "3 166\n", + "3 167\n", + "3 168\n", + "3 169\n", + "3 170\n", + "3 171\n", + "3 172\n", + "3 173\n", + "3 174\n", + "3 175\n", + "3 176\n", + "3 177\n", + "3 178\n", + "3 179\n", + "3 180\n", + "3 181\n", + "3 182\n", + "3 183\n", + "3 184\n", + "3 185\n", + "3 186\n", + "3 187\n", + "3 188\n", + "3 189\n", + "3 190\n", + "3 191\n", + "3 192\n", + "3 193\n", + "3 194\n", + "3 195\n", + "3 196\n", + "3 197\n", + "3 198\n", + "3 199\n", + "3 200\n", + "3 201\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.7 Page number: 120

\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#for loops\n", + "for i in range(1,3):\n", + " for j in range(1,3):\n", + " if i==j :\n", + " continue # continue statement\n", + " print i , j\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 2\n", + "2 1\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Let us C/.ipynb_checkpoints/chapter-4-checkpoint.ipynb b/Let us C/.ipynb_checkpoints/chapter-4-checkpoint.ipynb new file mode 100644 index 00000000..c488dfac --- /dev/null +++ b/Let us C/.ipynb_checkpoints/chapter-4-checkpoint.ipynb @@ -0,0 +1,345 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:c8478042e59a3d54e32751057a43d117ff35f9b16be09f867e56066844ab2887" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 4: The Case Control Structure

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.1 Page number: 137

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "i = 2\n", + "\n", + "#Switch case statements\n", + "if i == 1: # case 1\n", + " print \"I am in case 1\"\n", + "else:\n", + " print \"I am in case 2\"# case 2\n", + " print \"I am in case 3\"#case 3\n", + " print \"I am in default\"# default\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "I am in case 2\n", + "I am in case 3\n", + "I am in default\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.2 Page number: 138

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "i = 2\n", + "\n", + "#Switch case statements\n", + "if i == 1: # case 1\n", + " print \"I am in case 1\"\n", + "elif i == 2: # case 2\n", + " print \"I am in case 2\"\n", + "elif i == 3: #case 3\n", + " print \"I am in case 3\"\n", + "else: # default\n", + " print \"I am in default\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "I am in case 2\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.3 a), Page number: 140

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "i = 22\n", + "\n", + "#Switch case statements\n", + "if i == 121: # case 121\n", + " print \"I am in case 121\"\n", + "elif i == 7: # case 7\n", + " print \"I am in case 7\"\n", + "elif i == 22: #case 22\n", + " print \"I am in case 22\"\n", + "else: # default\n", + " print \"I am in default\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "I am in case 22\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.3 b), Page number: 140

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "c = 'x'\n", + "\n", + "#Switch case statements\n", + "if c == 'v': # case 'v'\n", + " print \"I am in case v\"\n", + "elif c == 'a': # case 'a'\n", + " print \"I am in case a\"\n", + "elif c == 'x': #case 'x'\n", + " print \"I am in case x\"\n", + "else: # default\n", + " print \"I am in default\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "I am in case x\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.3 c), Page number: 141

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "ch = 'a'\n", + "\n", + "#Switch case statements\n", + "if ch == 'a' or ch == 'A' : # case 'a' and case 'A'\n", + " print \"a as in ashar\"\n", + "elif ch == 'b'or ch == 'B': # case 'b' and case 'B'\n", + " print \"b as in brain\"\n", + "elif ch == 'c'or ch == 'C': # case 'c' and case 'C'\n", + " print \"c as in cookie\"\n", + "else: # default\n", + " print (\"wish you knew what are alphabets\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a as in ashar\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.3 e) , Page number: 143

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Input from user\n", + "#i = raw_input(\"Enter value of i \")\n", + "i = 1\n", + "\n", + "#Switch case statements\n", + "#print \"Hello\"\n", + "if i == 1 : # case 1\n", + " j = 10\n", + "elif i == 2 :# case 2\n", + " j = 20\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.4 Page number: 146

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "goals = 3\n", + "\n", + "if goals <= 5 : #goto\n", + " print \"To err is human!\" #label sos\n", + "else:\n", + " print \"About time soccer players learnt C\" \n", + " print \"and said goodbye! adieu! to soccer\" \n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "To err is human!\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.5 Page number: 148

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#nested for loops\n", + "for i in range(1,4):\n", + " for j in range(1,4):\n", + " for k in range(1,4):\n", + " if ( i == 3 and j == 3 and k == 3 ): #goto\n", + " print \"Out of the loop at last!\" # label out\n", + " break\n", + " else:\n", + " print i, j, k " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 1 1\n", + "1 1 2\n", + "1 1 3\n", + "1 2 1\n", + "1 2 2\n", + "1 2 3\n", + "1 3 1\n", + "1 3 2\n", + "1 3 3\n", + "2 1 1\n", + "2 1 2\n", + "2 1 3\n", + "2 2 1\n", + "2 2 2\n", + "2 2 3\n", + "2 3 1\n", + "2 3 2\n", + "2 3 3\n", + "3 1 1\n", + "3 1 2\n", + "3 1 3\n", + "3 2 1\n", + "3 2 2\n", + "3 2 3\n", + "3 3 1\n", + "3 3 2\n", + "Out of the loop at last!\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Let us C/.ipynb_checkpoints/chapter-5-checkpoint.ipynb b/Let us C/.ipynb_checkpoints/chapter-5-checkpoint.ipynb new file mode 100644 index 00000000..c50dfd4b --- /dev/null +++ b/Let us C/.ipynb_checkpoints/chapter-5-checkpoint.ipynb @@ -0,0 +1,772 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:cde73c3332261c4f108f542a465d0abde1aad6d0918f5a791acb014b3b2be45c" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 5: Functions & Pointers

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.1 Page number: 159

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# function definition\n", + "def message():\n", + " print \"Smile, and the world smiles with you...\" \n", + "\n", + "message() #function call\n", + "print \"Cry, and you stop the monotony!\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Smile, and the world smiles with you...\n", + "Cry, and you stop the monotony!\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.2 Page number: 159

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# function definitions\n", + "def italy():\n", + " print \"I am in italy\" \n", + " \n", + "def brazil():\n", + " print \"I am in brazil\" \n", + "\n", + "def argentina():\n", + " print \"I am in argentina\" \n", + " \n", + "\n", + "print \"I am in main\" \n", + "#function calls\n", + "italy()\n", + "brazil()\n", + "argentina()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "I am in main\n", + "I am in italy\n", + "I am in brazil\n", + "I am in argentina\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.3 Page number: 161

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# function definitions\n", + "def argentina():\n", + " print \"I am in argentina\" \n", + "\n", + "def brazil():\n", + " print \"I am in brazil\" \n", + " argentina() #function call\n", + "\n", + "def italy():\n", + " print \"I am in italy\" \n", + " brazil() #function call\n", + " print \"I am back in italy\" \n", + " \n", + "print \"I am in main\" \n", + "#function call\n", + "italy()\n", + "print \"I am finally back in main\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "I am in main\n", + "I am in italy\n", + "I am in brazil\n", + "I am in argentina\n", + "I am back in italy\n", + "I am finally back in main\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.4 Page number: 166

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# function definition\n", + "def calsum ( x, y, z ):\n", + " d = x + y + z\n", + " return d\n", + "\n", + "#Input from user\n", + "#a,b,c = raw_input (\"Enter any three numbers: \").split()\n", + "print \"Enter any three numbers: \"\n", + "a = 10\n", + "b = 20\n", + "c = 30\n", + "print a,b,c\n", + "\n", + "#function call\n", + "s = calsum(a,b,c) \n", + "\n", + "#Result\n", + "print \"Sum = \", s \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter any three numbers: \n", + "10 20 30\n", + "Sum = 60\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.4 Page number: 169

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# function definition\n", + "def fun():\n", + " #Input from user\n", + " #ch = raw_input (\"Enter any alphabet: \")\n", + " print \"Enter any alphabet: \"\n", + " ch = 'a'\n", + " print ch\n", + " ch = ord(ch)\n", + " if ch >= 65 and ch <= 90:\n", + " return ascii(ch)\n", + " else:\n", + " return ascii( ch + 32 )\n", + "\n", + "#function call\n", + "ch = fun()\n", + "\n", + "#Result\n", + "print ch\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.5 Page number: 170

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# function definition\n", + "def fun(b):\n", + " b = 60\n", + " print b \n", + "\n", + "a = 30\n", + "fun(a) #function call\n", + "print a" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "60\n", + "30\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.6 Page number: 171

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# function definition\n", + "def display(j):\n", + " k = 35\n", + " print j\n", + " print k\n", + "\n", + "i = 20 \n", + "display(i) #function call\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "20\n", + "35\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.7 Page number: 176

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# function definition\n", + "def square(x):\n", + " y = x * x\n", + " return y\n", + "\n", + "#Input from user\n", + "#a = raw_input(\"Enter any number: \")\n", + "print \"Enter any number: \"\n", + "a = 4.5\n", + "print a\n", + "\n", + "b = square(a) #function call\n", + "\n", + "#Result\n", + "print \"Square of %f is %f\" %( a, b )\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter any number: \n", + "4.5\n", + "Square of 4.500000 is 20.250000\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.7 , Page number: 177

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# function definition\n", + "def gospel(): # void function\n", + " print \"Viruses are electronic bandits...\" \n", + " print \"who eat nuggets of information...\" \n", + " print \"and chunks of bytes...\" \n", + " print \"when you least expect...\" \n", + "\n", + "gospel() # function call" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Viruses are electronic bandits...\n", + "who eat nuggets of information...\n", + "and chunks of bytes...\n", + "when you least expect...\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.8 Page number: 180

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "i = 3\n", + "\n", + "#Result\n", + "print \"Address of i = \" , id(i) #printing address\n", + "print \"Value of i = \", i \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Address of i = 30301288\n", + "Value of i = 3\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.9 Page number: 182

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "i = 3 \n", + "j = id(i) # address of variable 'i'\n", + "\n", + "#Result\n", + "print \"Address of i = \", id(i) \n", + "print \"Address of i = \", j \n", + "print \"Address of j = \", id(j)\n", + "print \"Value of j = \", j \n", + "print \"Value of i = \", i \n", + "print \"Value of i = \", i \n", + "print \"Value of i = \", i \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Address of i = 30301288\n", + "Address of i = 30301288\n", + "Address of j = 134133200\n", + "Value of j = 30301288\n", + "Value of i = 3\n", + "Value of i = 3\n", + "Value of i = 3\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.10 Page number: 184

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "i = 3\n", + "j = id(i) # address of i\n", + "k = id(j) # address of j\n", + "\n", + "#Result\n", + "print \"Address of i = \", id(i) \n", + "print \"Address of i = \", j \n", + "print \"Address of i = \", j \n", + "print \"Address of j = \", id(j) \n", + "print \"Address of j = \", k \n", + "print \"Address of k = \", id(k)\n", + "print \"Value of j = \", j \n", + "print \"Value of k = \", k \n", + "print \"Value of i = \", i \n", + "print \"Value of i = \", i \n", + "print \"Value of i = \", i \n", + "print \"Value of i = \", i " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Address of i = 30301288\n", + "Address of i = 30301288\n", + "Address of i = 30301288\n", + "Address of j = 134132944\n", + "Address of j = 134132944\n", + "Address of k = 134133200\n", + "Value of j = 30301288\n", + "Value of k = 134132944\n", + "Value of i = 3\n", + "Value of i = 3\n", + "Value of i = 3\n", + "Value of i = 3\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.11 Page number: 186

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# function definition\n", + "def swapv (x,y):\n", + " x,y=y,x\n", + " print \"x = %d y = %d\" %( x, y )\n", + "\n", + "#Variable declaration\n", + "a = 10\n", + "b = 20\n", + "\n", + "swapv ( a, b ) # function call\n", + "\n", + "#Result\n", + "print \"a = %d b = %d\" %( a, b )\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = 20 y = 10\n", + "a = 10 b = 20\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.12 Page number: 187

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# function definition\n", + "def swapv (a,b):\n", + " a,b=b,a\n", + " return a,b\n", + "\n", + "#Variable declaration\n", + "a = 10\n", + "b = 20\n", + "\n", + "a,b = swapv ( a, b ) # function call\n", + "\n", + "#Result\n", + "print \"a = %d b = %d\" %( a, b )" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a = 20 b = 10\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.13 Page number: 188

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter radius of a circle: \"\n", + "radius = 5\n", + "print radius\n", + "\n", + "#Function definition\n", + "def areaperi ( r ):\n", + " a = 3.14 * r * r\n", + " p = 2 * 3.14 * r \n", + " return a,p\n", + "\n", + "area,perimeter = areaperi ( radius ) #function call\n", + "\n", + "\n", + "#Result\n", + "print \"Area = \", area \n", + "print \"Perimeter = \", perimeter " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter radius of a circle: \n", + "5\n", + "Area = 78.5\n", + "Perimeter = 31.4\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.14 Page number: 190

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# function definition\n", + "def factorial(x):\n", + " f = 1\n", + " for i in range(x,0,-1 ):\n", + " f = f * i\n", + " return f\n", + "\n", + "\n", + "print \"Enter any number: \"\n", + "a = 6\n", + "print a\n", + "\n", + "fact = factorial(a) #function call\n", + "\n", + "#Result\n", + "print \"Factorial value = \", fact\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter any number: \n", + "6\n", + "Factorial value = 720\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.15 Page number: 191

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# function definition\n", + "def rec(x):\n", + " if x == 1:\n", + " return 1\n", + " else:\n", + " f = x * rec ( x - 1 ) # calling the function\n", + " return f\n", + "\n", + "\n", + "print \"Enter any number: \"\n", + "a = 5\n", + "print a\n", + "\n", + "fact = rec(a) #function call\n", + "\n", + "#Result\n", + "print \"Factorial value = \", fact \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter any number: \n", + "5\n", + "Factorial value = 120\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.16 Page number: 195

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "a = 5\n", + "b = 2\n", + "\n", + "#Function definition\n", + "def add ( i, j ):\n", + " s = i + j\n", + " return s\n", + "\n", + "c = add ( a, b ) # function call\n", + "\n", + "#Result\n", + "print \"sum = \", c " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "sum = 7\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Let us C/.ipynb_checkpoints/chapter-6-checkpoint.ipynb b/Let us C/.ipynb_checkpoints/chapter-6-checkpoint.ipynb new file mode 100644 index 00000000..d22f7722 --- /dev/null +++ b/Let us C/.ipynb_checkpoints/chapter-6-checkpoint.ipynb @@ -0,0 +1,666 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:0f4b9c66170fed211220a3bceb54ab397c991e487c78359a96da00ad9e81eacc" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 6: Data Types Revisted

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.1 Page number: 218

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "ch = 291\n", + "\n", + "#Result\n", + "print \"%d %c\" %( ch, (ch%128) ) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "291 #\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.2 Page number: 218

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "for ch in range(0,256):\n", + " print \"%d %c\" %(ch, ch%128 )\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 \u0000\n", + "1 \u0001\n", + "2 \u0002\n", + "3 \u0003\n", + "4 \u0004\n", + "5 \u0005\n", + "6 \u0006\n", + "7 \u0007\n", + "8 \b\n", + "9 \t\n", + "10 \n", + "\n", + "11 \u000b", + "\n", + "12 \f", + "\n", + "13 \r\n", + "14 \u000e\n", + "15 \u000f\n", + "16 \u0010\n", + "17 \u0011\n", + "18 \u0012\n", + "19 \u0013\n", + "20 \u0014\n", + "21 \u0015\n", + "22 \u0016\n", + "23 \u0017\n", + "24 \u0018\n", + "25 \u0019\n", + "26 \u001a\n", + "27 \u001b\n", + "28 \u001c", + "\n", + "29 \u001d", + "\n", + "30 \u001e", + "\n", + "31 \u001f\n", + "32 \n", + "33 !\n", + "34 \"\n", + "35 #\n", + "36 $\n", + "37 %\n", + "38 &\n", + "39 '\n", + "40 (\n", + "41 )\n", + "42 *\n", + "43 +\n", + "44 ,\n", + "45 -\n", + "46 .\n", + "47 /\n", + "48 0\n", + "49 1\n", + "50 2\n", + "51 3\n", + "52 4\n", + "53 5\n", + "54 6\n", + "55 7\n", + "56 8\n", + "57 9\n", + "58 :\n", + "59 ;\n", + "60 <\n", + "61 =\n", + "62 >\n", + "63 ?\n", + "64 @\n", + "65 A\n", + "66 B\n", + "67 C\n", + "68 D\n", + "69 E\n", + "70 F\n", + "71 G\n", + "72 H\n", + "73 I\n", + "74 J\n", + "75 K\n", + "76 L\n", + "77 M\n", + "78 N\n", + "79 O\n", + "80 P\n", + "81 Q\n", + "82 R\n", + "83 S\n", + "84 T\n", + "85 U\n", + "86 V\n", + "87 W\n", + "88 X\n", + "89 Y\n", + "90 Z\n", + "91 [\n", + "92 \\\n", + "93 ]\n", + "94 ^\n", + "95 _\n", + "96 `\n", + "97 a\n", + "98 b\n", + "99 c\n", + "100 d\n", + "101 e\n", + "102 f\n", + "103 g\n", + "104 h\n", + "105 i\n", + "106 j\n", + "107 k\n", + "108 l\n", + "109 m\n", + "110 n\n", + "111 o\n", + "112 p\n", + "113 q\n", + "114 r\n", + "115 s\n", + "116 t\n", + "117 u\n", + "118 v\n", + "119 w\n", + "120 x\n", + "121 y\n", + "122 z\n", + "123 {\n", + "124 |\n", + "125 }\n", + "126 ~\n", + "127 \u007f\n", + "128 \u0000\n", + "129 \u0001\n", + "130 \u0002\n", + "131 \u0003\n", + "132 \u0004\n", + "133 \u0005\n", + "134 \u0006\n", + "135 \u0007\n", + "136 \b\n", + "137 \t\n", + "138 \n", + "\n", + "139 \u000b", + "\n", + "140 \f", + "\n", + "141 \r\n", + "142 \u000e\n", + "143 \u000f\n", + "144 \u0010\n", + "145 \u0011\n", + "146 \u0012\n", + "147 \u0013\n", + "148 \u0014\n", + "149 \u0015\n", + "150 \u0016\n", + "151 \u0017\n", + "152 \u0018\n", + "153 \u0019\n", + "154 \u001a\n", + "155 \u001b\n", + "156 \u001c", + "\n", + "157 \u001d", + "\n", + "158 \u001e", + "\n", + "159 \u001f\n", + "160 \n", + "161 !\n", + "162 \"\n", + "163 #\n", + "164 $\n", + "165 %\n", + "166 &\n", + "167 '\n", + "168 (\n", + "169 )\n", + "170 *\n", + "171 +\n", + "172 ,\n", + "173 -\n", + "174 .\n", + "175 /\n", + "176 0\n", + "177 1\n", + "178 2\n", + "179 3\n", + "180 4\n", + "181 5\n", + "182 6\n", + "183 7\n", + "184 8\n", + "185 9\n", + "186 :\n", + "187 ;\n", + "188 <\n", + "189 =\n", + "190 >\n", + "191 ?\n", + "192 @\n", + "193 A\n", + "194 B\n", + "195 C\n", + "196 D\n", + "197 E\n", + "198 F\n", + "199 G\n", + "200 H\n", + "201 I\n", + "202 J\n", + "203 K\n", + "204 L\n", + "205 M\n", + "206 N\n", + "207 O\n", + "208 P\n", + "209 Q\n", + "210 R\n", + "211 S\n", + "212 T\n", + "213 U\n", + "214 V\n", + "215 W\n", + "216 X\n", + "217 Y\n", + "218 Z\n", + "219 [\n", + "220 \\\n", + "221 ]\n", + "222 ^\n", + "223 _\n", + "224 `\n", + "225 a\n", + "226 b\n", + "227 c\n", + "228 d\n", + "229 e\n", + "230 f\n", + "231 g\n", + "232 h\n", + "233 i\n", + "234 j\n", + "235 k\n", + "236 l\n", + "237 m\n", + "238 n\n", + "239 o\n", + "240 p\n", + "241 q\n", + "242 r\n", + "243 s\n", + "244 t\n", + "245 u\n", + "246 v\n", + "247 w\n", + "248 x\n", + "249 y\n", + "250 z\n", + "251 {\n", + "252 |\n", + "253 }\n", + "254 ~\n", + "255 \u007f\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.3 Page number: 225

\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "i = 1 #auto int\n", + "\n", + "def b2 (i):\n", + " print i \n", + "\n", + "def b3 (i):\n", + " print i \n", + "\n", + "\n", + "def b1 (i):\n", + " print i \n", + " b2(i)\n", + " b3(i)\n", + "\n", + "\n", + "#Result\n", + "b1(i)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n", + "1\n", + "1\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.4 Page number: 226

\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "i = 1 #auto int\n", + "\n", + "def b2 (i):\n", + " i = 2 # auto int \n", + " print i \n", + "\n", + "def b3 (i):\n", + " i = 3 #auto int \n", + " print i \n", + "\n", + "\n", + "def b1 (i):\n", + " b3(i)\n", + " b2(i)\n", + " print i \n", + "\n", + "\n", + "#Result\n", + "b1(i)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n", + "2\n", + "1\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.5 Page number: 220

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "c = 'a'\n", + "d = 'b'\n", + "print \"%c %c\" %( c, d )\n", + "\n", + "i = 333\n", + "j = 288\n", + "print \"%d %u\"%( i, j ) \n", + "\n", + "\n", + "k = 2\n", + "l = 1\n", + "print \"%d %u \" %(k, l ) \n", + "\n", + "m = 73277727727\n", + "n = 189189819891\n", + "print \"%ld %lu\"%( m, n ) \n", + "\n", + "\n", + "#float, double, long double\n", + "from decimal import Decimal \n", + "#x,y,z = raw_input ( \"float double long double: \").split()\n", + "x = 72.12\n", + "y = Decimal(8282910.0109010)\n", + "z = Decimal(29189999111.128918918)\n", + "print x, y, z " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a b\n", + "333 288\n", + "2 1 \n", + "73277727727 189189819891\n", + "72.12 8282910.0109010003507137298583984375 29189999111.128917694091796875\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.6 Page number: 228

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#function definition \n", + "def increment( ):\n", + " i = 1 #auto int\n", + " print i \n", + " i = i + 1 \n", + "\n", + "#function calls\n", + "increment( )\n", + "increment( )\n", + "increment( )\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n", + "1\n", + "1\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.6 Page number: 228

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#function definition \n", + "def increment(i = [1]): #static int \n", + " print i[0] \n", + " i[0] += 1 \n", + "\n", + "#function calls\n", + "increment()\n", + "increment()\n", + "increment()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n", + "2\n", + "3\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.7 Page number: 229

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#function definition\n", + "def fun( ):\n", + " k = 35 \n", + " return (k)\n", + "\n", + "j = fun( ) #function call\n", + "print j #result\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "35\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.7 Page number: 231

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration \n", + "i = [0] # external variable\n", + "\n", + "#Function definitions \n", + "def increment(i = [0]):\n", + " i[0] += 1\n", + " print \"on incrementing i = \", i[0] \n", + "\n", + "\n", + "def decrement(i = [2]):\n", + " i[0] -= 1\n", + " print \"on decrementing i = \", i[0] \n", + " \n", + "\n", + "\n", + "print \"i = \", i[0]\n", + "#function calls\n", + "increment() \n", + "increment() \n", + "decrement() \n", + "decrement() " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "i = 0\n", + "on incrementing i = 1\n", + "on incrementing i = 2\n", + "on decrementing i = 1\n", + "on decrementing i = 0\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Let us C/.ipynb_checkpoints/chapter-7-checkpoint.ipynb b/Let us C/.ipynb_checkpoints/chapter-7-checkpoint.ipynb new file mode 100644 index 00000000..f18a3d5e --- /dev/null +++ b/Let us C/.ipynb_checkpoints/chapter-7-checkpoint.ipynb @@ -0,0 +1,207 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:cb3c5cba9468e5b653c7481d43e9f39abf98e9af0a02b5f9451adfa62262fedd" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 7: The C Preprocessor

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.1 Page number: 244

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Macro declaration\n", + "UPPER = 25\n", + "\n", + "for i in range(1,UPPER+1): #macro expansion\n", + " print(i)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n", + "2\n", + "3\n", + "4\n", + "5\n", + "6\n", + "7\n", + "8\n", + "9\n", + "10\n", + "11\n", + "12\n", + "13\n", + "14\n", + "15\n", + "16\n", + "17\n", + "18\n", + "19\n", + "20\n", + "21\n", + "22\n", + "23\n", + "24\n", + "25\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.2 Page number: 244

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Macro declaration\n", + "PI = 3.1415\n", + "\n", + "#Variable declaration\n", + "r = 6.25 \n", + "\n", + "#Calculation\n", + "area = PI * r * r\n", + "\n", + "#Result\n", + "print \"Area of circle = \", area \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Area of circle = 122.71484375\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.4 Page number: 248

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Macro declaration\n", + "def AREA(x): #define AREA(x) ( 3.14 * x * x )\n", + " return(3.14 * x * x )\n", + "\n", + "#Variable declaration\n", + "r1 = 6.25\n", + "r2 = 2.5\n", + "\n", + "#Result\n", + "a = AREA(r1)\n", + "print \"Area of circle = \", a \n", + "a = AREA(r2) \n", + "print \"Area of circle = \", a\n", + " \n", + "\n", + "\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Area of circle = 122.65625\n", + "Area of circle = 19.625\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.5 Page number: 249

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Macro declaration\n", + "def ISDIGIT(y): #define ISDIGIT(y) ( y >= 48 && y <= 57 )\n", + " return( y >= 48 and y <= 57 )\n", + "\n", + "#Input from user\n", + "#ch = raw_input(\"Enter any digit \")\n", + "ch = 'a'\n", + "\n", + "#Result\n", + "if ISDIGIT ( ch ):\n", + " print \"You entered a digit\" \n", + "else:\n", + " print \"Illegal input\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Illegal input\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Let us C/.ipynb_checkpoints/chapter-8-checkpoint.ipynb b/Let us C/.ipynb_checkpoints/chapter-8-checkpoint.ipynb new file mode 100644 index 00000000..be034757 --- /dev/null +++ b/Let us C/.ipynb_checkpoints/chapter-8-checkpoint.ipynb @@ -0,0 +1,911 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:ff6efc1b388a9dae6f26340014ec0d8e17db1c5b9c410af07ab801ec3099b7b4" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 8: Arrays

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.1 Page number: 272

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "s = 0\n", + "marks = [] # array declaration\n", + "\n", + "#for i in range(0,30):\n", + " # marks.append(int(raw_input(\"Enter marks: \" ))) # store data in array\n", + "marks = [89,85,57,25,90,45,87,48,98,12,39,66,75,30,87,100,5,78,56,99,84,0,39,79,93,61,87,45,90,56] \n", + "print \"Enter marks: \"\n", + "for i in range(0,30):\n", + " print marks[i]\n", + "\n", + "for i in range(0,30):\n", + " s = s + marks[i] # read data from array\n", + "\n", + "#Calculation\n", + "avg = s / 30 #Average formula\n", + "\n", + "#Result\n", + "print \"Average marks = \", avg \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks: \n", + "89\n", + "85\n", + "57\n", + "25\n", + "90\n", + "45\n", + "87\n", + "48\n", + "98\n", + "12\n", + "39\n", + "66\n", + "75\n", + "30\n", + "87\n", + "100\n", + "5\n", + "78\n", + "56\n", + "99\n", + "84\n", + "0\n", + "39\n", + "79\n", + "93\n", + "61\n", + "87\n", + "45\n", + "90\n", + "56\n", + "Average marks = 63\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.2 Page number: 277

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Funcion definition\n", + "def display(m):\n", + " print m \n", + " \n", + "#Variable declaration\n", + "marks = [ 55, 65, 75, 56, 78, 78, 90 ] #array\n", + "\n", + "for i in range(0,7):\n", + " display(marks[i]) #function call \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n", + "65\n", + "75\n", + "56\n", + "78\n", + "78\n", + "90\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.3 Page number: 278

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Funcion definition\n", + "def display(n):\n", + " print n #return\n", + " \n", + "#Variable declaration\n", + "marks = [ 55, 65, 75, 56, 78, 78, 90 ] #array\n", + "\n", + "for i in range(0,7):\n", + " display(marks[i]) #function call\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n", + "65\n", + "75\n", + "56\n", + "78\n", + "78\n", + "90\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.4 Page number: 279

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "i = 3\n", + "j = 1.5\n", + "k = 'c'\n", + "\n", + "print \"Value of i = \", i \n", + "print \"Value of j = \", j \n", + "print \"Value of k = \", k \n", + "\n", + "#addresses of the variables\n", + "x = id(i)\n", + "y = id(j)\n", + "z = id(k)\n", + "\n", + "print \"Original address in x = \", x \n", + "print \"Original address in y = \", y \n", + "print \"Original address in z = \", z \n", + "\n", + "x += 2\n", + "y += 4\n", + "z += 1\n", + "\n", + "print \"New address in x = \", x \n", + "print \"New address in y = \", y \n", + "print \"New address in z = \", z \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of i = 3\n", + "Value of j = 1.5\n", + "Value of k = c\n", + "Original address in x = 32529512\n", + "Original address in y = 105587440\n", + "Original address in z = 32744192\n", + "New address in x = 32529514\n", + "New address in y = 105587444\n", + "New address in z = 32744193\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.4 Page number: 281

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "arr = [ 10, 20, 30, 45, 67, 56, 74 ]\n", + "i = id(arr[1]) #address \n", + "j = id(arr[5]) #Address\n", + "\n", + "#Result\n", + "print j - i, arr[5] - arr[1] \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1128 36\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.5 Page number: 282

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "arr = [ 10, 20, 36, 72, 45, 36 ]\n", + "j = id(arr[ 4 ])\n", + "k = id( arr[0 + 4] )\n", + "\n", + "#Result \n", + "if j == k : #comparison\n", + " print \"The two pointers point to the same location\" \n", + "else:\n", + " print \"The two pointers do not point to the same location\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The two pointers point to the same location\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Memory Locations, Page number: 283

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "num = [ 24, 34, 12, 44, 56, 17]\n", + "\n", + "#Result\n", + "for i in range(0,6):\n", + " print \"element no. \", i \n", + " print \"address = \", id(num[i]) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "element no. 0\n", + "address = 32529008\n", + "element no. 1\n", + "address = 32528768\n", + "element no. 2\n", + "address = 32529296\n", + "element no. 3\n", + "address = 32530520\n", + "element no. 4\n", + "address = 32530232\n", + "element no. 5\n", + "address = 32529176\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.6 Page number: 284

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "num = [ 24, 34, 12, 44, 56, 17]\n", + "\n", + "#Result\n", + "for i in range(0,6):\n", + " print \"address = \", id(num[i]) \n", + " print \"element = \", num[i] \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "address = 32529008\n", + "element = 24\n", + "address = 32528768\n", + "element = 34\n", + "address = 32529296\n", + "element = 12\n", + "address = 32530520\n", + "element = 44\n", + "address = 32530232\n", + "element = 56\n", + "address = 32529176\n", + "element = 17\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.7 Page number: 284

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "num = [ 24, 34, 12, 44, 56, 17]\n", + "j = id(num[0]) # assign address of zeroth element\n", + "\n", + "#Result\n", + "for i in range(0,6):\n", + " print \"address = \", j \n", + " print \"element = \", num[i] \n", + " j = id(num[(i+1)%6]) # increment pointer to point to next location \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "address = 32529008\n", + "element = 24\n", + "address = 32528768\n", + "element = 34\n", + "address = 32529296\n", + "element = 12\n", + "address = 32530520\n", + "element = 44\n", + "address = 32530232\n", + "element = 56\n", + "address = 32529176\n", + "element = 17\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.8 Page number: 286

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "num = [ 24, 34, 12, 44, 56, 17 ]\n", + "\n", + "#Function definition:\n", + "def display ( j,n ):\n", + " for i in range(0,n):\n", + " print \"element = \", j\n", + " j = num[(i+1)%n] #increment pointer to point to next element \n", + "\n", + "display ( num[0], 6 ) #function call\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "element = 24\n", + "element = 34\n", + "element = 12\n", + "element = 44\n", + "element = 56\n", + "element = 17\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.8 Page number: 288

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "num = [ 24, 34, 12, 44, 56, 17]\n", + "\n", + "for i in range(0,6):\n", + " print \"address = \", id(num[i])\n", + " print \"element = \", num[i], num[(0+ i)]\n", + " print num[(i+0)], num[i] \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "address = 32529008\n", + "element = 24 24\n", + "24 24\n", + "address = 32528768\n", + "element = 34 34\n", + "34 34\n", + "address = 32529296\n", + "element = 12 12\n", + "12 12\n", + "address = 32530520\n", + "element = 44 44\n", + "44 44\n", + "address = 32530232\n", + "element = 56 56\n", + "56 56\n", + "address = 32529176\n", + "element = 17 17\n", + "17 17\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.9 Page number: 289

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "stud = [] #array\n", + "\n", + "#for i in range(0,4):\n", + " # stud.append((raw_input(\"Enter roll no and marks: \").split())) # storing data in the 2D array\n", + "\n", + "stud = [\"1 38\",\"2 78\",\"3 93\",\"4 48\"]\n", + "for i in range (0,4):\n", + " print \"Enter roll no and marks: \"\n", + " print stud[i]\n", + " \n", + "#Result\n", + "for i in range(0,4):\n", + " print stud[i][0],stud[i][1:] \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter roll no and marks: \n", + "1 38\n", + "Enter roll no and marks: \n", + "2 78\n", + "Enter roll no and marks: \n", + "3 93\n", + "Enter roll no and marks: \n", + "4 48\n", + "1 38\n", + "2 78\n", + "3 93\n", + "4 48\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.10 Page number: 293

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "s = [ [1234, 56 ], [ 1212, 33], [ 1434, 80 ], [ 1312, 78 ]]\n", + "\n", + "#Result\n", + "for i in range(0,4):\n", + " print \"Address of %d th 1-D array = %u\"%( i, id(s[i]) )\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Address of 0 th 1-D array = 134002248\n", + "Address of 1 th 1-D array = 134654472\n", + "Address of 2 th 1-D array = 134791816\n", + "Address of 3 th 1-D array = 134792008\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.11 Page number: 295

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "s = [ [ 1234, 56 ], [ 1212, 33 ], [ 1434, 80 ], [ 1312, 78 ] ]\n", + "\n", + "for i in range(0,4):\n", + " for j in range(0,2):\n", + " print s[i][j] \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1234\n", + "56\n", + "1212\n", + "33\n", + "1434\n", + "80\n", + "1312\n", + "78\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.12 Page number: 296

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "s = [ [ 1234, 56 ], [ 1212, 33 ], [ 1434, 80 ], [ 1312, 78 ]]\n", + "\n", + "#Result\n", + "for i in range(0,4):\n", + " p = s[i]\n", + " pint = p\n", + " print \"\\n\" \n", + " for j in range(0,2):\n", + " print pint[j] \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + "1234\n", + "56\n", + "\n", + "\n", + "1212\n", + "33\n", + "\n", + "\n", + "1434\n", + "80\n", + "\n", + "\n", + "1312\n", + "78\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.13, Page number: 297

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "a = [[1, 2, 3, 4] , [5, 6, 7, 8] , [9, 0, 1, 6 ]]\n", + "\n", + "#Function definitions\n", + "def display ( q, row, col ):\n", + " for i in range(0,row):\n", + " for j in range(0,col):\n", + " print q [ (i * col)%3][j]\n", + " print \"\\n\" \n", + " print \"\\n\" \n", + "\n", + "\n", + "def show ( q, row, col ):\n", + " for i in range(0,row):\n", + " p = q[i]\n", + " for j in range(0,col):\n", + " print p[j]\n", + " print \"\\n\" \n", + " print \"\\n\" \n", + "\n", + "def Print ( q, row, col ):\n", + " for i in range(0,row):\n", + " for j in range(0,col):\n", + " print q[i][j]\n", + " print \"\\n\" \n", + " print \"\\n\" \n", + " \n", + "#function calls\n", + "display ( a, 3, 4 ) \n", + "show ( a, 3, 4 ) \n", + "Print ( a, 3, 4 )\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n", + "2\n", + "3\n", + "4\n", + "\n", + "\n", + "5\n", + "6\n", + "7\n", + "8\n", + "\n", + "\n", + "9\n", + "0\n", + "1\n", + "6\n", + "\n", + "\n", + "\n", + "\n", + "1\n", + "2\n", + "3\n", + "4\n", + "\n", + "\n", + "5\n", + "6\n", + "7\n", + "8\n", + "\n", + "\n", + "9\n", + "0\n", + "1\n", + "6\n", + "\n", + "\n", + "\n", + "\n", + "1\n", + "2\n", + "3\n", + "4\n", + "\n", + "\n", + "5\n", + "6\n", + "7\n", + "8\n", + "\n", + "\n", + "9\n", + "0\n", + "1\n", + "6\n", + "\n", + "\n", + "\n", + "\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.13 Page number: 300

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from ctypes import *\n", + "\n", + "#Variable declaration\n", + "arr = [] # array of integer pointers \n", + "i = c_int(31)\n", + "j = c_int(5)\n", + "k = c_int(19)\n", + "l = c_int(71)\n", + "arr.append(pointer(i))\n", + "arr.append(pointer(j))\n", + "arr.append(pointer(k))\n", + "arr.append(pointer(l))\n", + "\n", + "for m in range(0,4):\n", + " print arr[m].contents " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "c_long(31)\n", + "c_long(5)\n", + "c_long(19)\n", + "c_long(71)\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.14 Page number: 301

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "a = [ 0, 1, 2, 3, 4 ]\n", + "p = [ a[0], a[1], a[2], a[3], a[4] ]\n", + "\n", + "#Result\n", + "print p, id(p), id(id(p ) )\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[0, 1, 2, 3, 4] 134794120 134005648\n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Let us C/.ipynb_checkpoints/chapter-9-checkpoint.ipynb b/Let us C/.ipynb_checkpoints/chapter-9-checkpoint.ipynb new file mode 100644 index 00000000..2805c3b5 --- /dev/null +++ b/Let us C/.ipynb_checkpoints/chapter-9-checkpoint.ipynb @@ -0,0 +1,600 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:b56f5f8393519ee5facb6be20704523950b01beac58d1afb9170529ce16a9517" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 9: Puppetting On Strings

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.1 Page number: 329

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "name= \"Klinsman\" # character array or string\n", + "i = 0\n", + "\n", + "#while loop for printing\n", + "while i <= 7 :\n", + " print name[i] \n", + " i = i + 1\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "K\n", + "l\n", + "i\n", + "n\n", + "s\n", + "m\n", + "a\n", + "n\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.2 Page number: 330

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "name= \"Klinsman\\0\" # character array or string\n", + "i = 0\n", + "\n", + "#while loop for printing\n", + "while (name[i] != '\\0') :\n", + " print name[i]\n", + " i = i + 1\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "K\n", + "l\n", + "i\n", + "n\n", + "s\n", + "m\n", + "a\n", + "n\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.3 Page number: 330

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "name = \"Klinsman\\0\" # string or character array\n", + "i = 0\n", + "ptr = name[i] # store base address of string\n", + "\n", + "#Result\n", + "while ptr != '\\0':\n", + " print ptr\n", + " i = i+1\n", + " ptr = name[i]\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "K\n", + "l\n", + "i\n", + "n\n", + "s\n", + "m\n", + "a\n", + "n\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.4 Page number: 336

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "arr = \"Bamboozled\" # character array or string\n", + "\n", + "#string length function\n", + "len1 = len(arr) \n", + "len2 = len( \"Humpty Dumpty\" )\n", + "\n", + "#Result\n", + "print \"string = %s length = %d\" %( arr, len1 )\n", + "print \"string = %s length = %d\" %(\"Humpty Dumpty\", len2 )\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "string = Bamboozled length = 10\n", + "string = Humpty Dumpty length = 13\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.5 Page number: 337

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Function definition\n", + "def xstrlen(s):\n", + " length = 0\n", + " while ( s[length] != '\\0' ):\n", + " length += 1\n", + " return length \n", + "\n", + "#Variable declaration\n", + "arr = \"Bamboozled\\0\" # character array or string\n", + "\n", + "#Function calls\n", + "len1 = xstrlen(arr) \n", + "len2 = xstrlen( \"Humpty Dumpty\\0\" )\n", + "\n", + "#Result\n", + "print \"string = %s length = %d\" %( arr, len1 )\n", + "print \"string = %s length = %d\" %(\"Humpty Dumpty\\0\", len2 )\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "string = Bamboozled\u0000 length = 10\n", + "string = Humpty Dumpty\u0000 length = 13\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.6 Page number: 338

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "source = \"Sayonara\" \n", + "target = [] \n", + "\n", + "#strcpy function\n", + "import copy\n", + "target = copy.copy(source)\n", + "\n", + "#Result\n", + "print \"source string = \", source \n", + "print \"target string = \", target \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "source string = Sayonara\n", + "target string = Sayonara\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.7 Page number: 339

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Function definition\n", + "def xstrcpy (t,s):\n", + " i = 0\n", + " while ( s[i] != '\\0' ):\n", + " t = t + s[i]\n", + " i = i + 1\n", + " return t\n", + " \n", + "#Variable declaration\n", + "source = \"Sayonara\\0\" \n", + "target = ''\n", + "\n", + "target = xstrcpy ( target, source ) # function call\n", + "\n", + "#Result\n", + "print \"source string = \", source \n", + "print \"target string = \", target " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "source string = Sayonara\u0000\n", + "target string = Sayonara\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.8 Page number: 342

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "source = \"Folks!\" \n", + "target = \"Hello\"\n", + " \n", + "target = target + source # string concatenation\n", + "#Result\n", + "print \"source string = \", source \n", + "print \"target string = \", target \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "source string = Folks!\n", + "target string = HelloFolks!\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.9 Page number: 343

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "string1 = \"Jerry\\0\" \n", + "string2 = \"Ferry\\0\"\n", + "\n", + "#Function definition\n", + "def strcmp (string1 , string2):\n", + " if (string1 == string2):\n", + " v = 0 #If the two strings are identical, strcmp returns a value zero\n", + " return v\n", + " else:\n", + " n = 0\n", + " while ( string1[n]):\n", + " if ( string1[n] == string2[n]):\n", + " n = n + 1\n", + " continue\n", + " else:\n", + " v = ord(string1[n]) - ord(string2[n]) #returns the numeric difference between the ASCII values of the first non-matching pairs of characters\n", + " return v\n", + " return v\n", + "\n", + "#Function call\n", + "i = strcmp ( string1, \"Jerry\\0\" ) \n", + "j = strcmp ( string1, string2 ) \n", + "k = strcmp ( string1, \"Jerry boy\\0\" )\n", + "\n", + "#Result\n", + "print i,j,k" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 4 -32\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.10 Page number: 344

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "#Function definition\n", + "def strcmp (string1 , string2):\n", + " if (string1 == string2):\n", + " v = 0 #If the two strings are identical, strcmp returns a value zero\n", + " return v\n", + " else:\n", + " n = 0\n", + " while ( string1[n]):\n", + " if ( string1[n] == string2[n]):\n", + " n = n + 1\n", + " continue\n", + " else:\n", + " v = ord(string1[n]) - ord(string2[n]) #returns the numeric difference between the ASCII values of the first non-matching pairs of characters\n", + " return v\n", + " return v\n", + "\n", + "#Variable declaration\n", + "FOUND = 1\n", + "NOTFOUND = 0\n", + "masterlist =[\"akshay\",\"parag\",\"raman\",\"srinivas\",\"gopal\",\"rajesh\"]\n", + "yourname = []\n", + "flag = NOTFOUND\n", + "\n", + "#Input from user\n", + "#yourname = raw_input(\"Enter your name: \")\n", + "yourname = \"Akshatha\"\n", + "\n", + "#Checking in the master list\n", + "for i in range(0,6):\n", + " a = strcmp ( masterlist[i], yourname )\n", + " if a == 0:\n", + " print \"Welcome, you can enter the palace\" \n", + " flag = FOUND\n", + " break\n", + " \n", + "if flag == NOTFOUND :\n", + " print \"Sorry, you are a trespasser\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sorry, you are a trespasser\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.11 Page number: 348

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "names = [\"akshay\\0\\0\\0\",\"parag\\0\\0\\0\\0\",\"raman\\0\\0\\0\\0\",\"srinivas\\0\",\"gopal\\0\\0\\0\\0\",\"rajesh\\0\\0\\0\"]\n", + "\n", + "#Initial condition\n", + "print \"Original: \", names[2], names[3] \n", + "\n", + "#Exchanging names\n", + "for i in range(0,9):\n", + " t = names[3][i]\n", + " names[3] = names[3][0:i] + names[2][i] + names[3][i+1:]\n", + " names[2] = names[2][0:i] + t + names[2][i+1:]\n", + " \n", + "\n", + "#Result \n", + "print \"New: \", names[2], names[3] " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Original: raman\u0000\u0000\u0000\u0000 srinivas\u0000\n", + "New: srinivas\u0000 raman\u0000\u0000\u0000\u0000\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.12 Page number: 349

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "names = [\"akshay\\0\\0\\0\",\"parag\\0\\0\\0\\0\",\"raman\\0\\0\\0\\0\",\"srinivas\\0\",\"gopal\\0\\0\\0\\0\",\"rajesh\\0\\0\\0\"]\n", + "\n", + "#Initial condition\n", + "print \"Original: \", names[2], names[3] \n", + "\n", + "#Exchanging names\n", + "temp = names[2] \n", + "names[2] = names[3] \n", + "names[3] = temp \n", + "\n", + "#Result \n", + "print \"New: \", names[2], names[3] \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Original: raman\u0000\u0000\u0000\u0000 srinivas\u0000\n", + "New: srinivas\u0000 raman\u0000\u0000\u0000\u0000\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.13 Page number: 351

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import copy\n", + "\n", + "#Variable declaration\n", + "names = []\n", + "n=[\"John\",\"Max\",\"Jim\",\"Tony\",\"Tom\",\"Harry\"]\n", + "\n", + "for i in range(0,6):\n", + " n1 = n[i]\n", + " p = copy.copy(n1)\n", + " names.append(p) \n", + "\n", + "for i in range(0,6):\n", + " print names[i] \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "John\n", + "Max\n", + "Jim\n", + "Tony\n", + "Tom\n", + "Harry\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Let_us_C/chapter-1.ipynb b/Let us C/chapter-1.ipynb similarity index 92% rename from Let_us_C/chapter-1.ipynb rename to Let us C/chapter-1.ipynb index 215baac9..4cecffc4 100644 --- a/Let_us_C/chapter-1.ipynb +++ b/Let us C/chapter-1.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:67e127b30e1e4aca343f9987e4ae454c0b4254a7be37191ad1b156a6da5403fc" + "signature": "sha256:60404711a4c9350ab7400b58d60d8f79998ec8ffd254f6ba451a391153d071d5" }, "nbformat": 3, "nbformat_minor": 0, @@ -19,7 +19,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

First C Program, Page number: 14

\n", + "

Example 1.1 Page number: 14

\n", " " ] }, @@ -55,7 +55,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Simple Interest, Page number: 21

" + "

Example 1.2, Page number: 21

" ] }, { @@ -90,7 +90,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Just for fun, Page number: 22

" + "

Example 1.3 Page number: 22

" ] }, { @@ -122,7 +122,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Example 1.1, Page number: 32

" + "

Example 1.4, Page number: 32

" ] }, { @@ -160,7 +160,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Example 1.2, Page number: 33

" + "

Example 1.5, Page number: 33

" ] }, { diff --git a/Let_us_C/chapter-10.ipynb b/Let us C/chapter-10.ipynb similarity index 94% rename from Let_us_C/chapter-10.ipynb rename to Let us C/chapter-10.ipynb index 7257e56a..8cdeeb5f 100644 --- a/Let_us_C/chapter-10.ipynb +++ b/Let us C/chapter-10.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:adc18fea588596d0bfa5f1f11f3697194c0b52d2d9eb299f10c4a99dfea56e31" + "signature": "sha256:1213afa9e1e3e4548a86a08e5402d57c78d8521d4dc9c374d9b66fbb38bf7943" }, "nbformat": 3, "nbformat_minor": 0, @@ -19,7 +19,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Arrays , Page number: 365

" + "

Example 10.1, Page number: 365

" ] }, { @@ -73,7 +73,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Structure Example , Page number: 366

" + "

Example 10.2, Page number: 366

" ] }, { @@ -132,7 +132,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Memory Map of Structures , Page number: 370

" + "

Example 10.3 , Page number: 370

" ] }, { @@ -171,7 +171,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Array of Structures , Page number: 371

" + "

Example 10.4, Page number: 371

" ] }, { @@ -226,7 +226,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Copying Structures , Page number: 374

" + "

Example 10.5 , Page number: 374

" ] }, { @@ -278,7 +278,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Nested Structures , Page number: 375

" + "

Example 10.6, Page number: 375

" ] }, { @@ -317,7 +317,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Passing Individual Structure Elements to Functions, Page number: 377

" + "

Example 10.7 Page number: 377

" ] }, { @@ -356,7 +356,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Passing Structure to a Function , Page number: 378

" + "

10.8 Page number: 378

" ] }, { @@ -395,7 +395,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Structure Pointers , Page number: 379

" + "

10.9, Page number: 379

" ] }, { @@ -433,7 +433,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Passing Address of a Structure Variable , Page number: 380

" + "

10.10 Page number: 380

" ] }, { diff --git a/Let_us_C/chapter-11.ipynb b/Let us C/chapter-11.ipynb similarity index 92% rename from Let_us_C/chapter-11.ipynb rename to Let us C/chapter-11.ipynb index 697d86a1..0c79f236 100644 --- a/Let_us_C/chapter-11.ipynb +++ b/Let us C/chapter-11.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:2f4d0660b7234129c8e49912c5b11a0b5ef4cb891c3d12ca4bfa31d6ee648bf9" + "signature": "sha256:066da36fa2998c0a83c22ca4b6de0a36d79f25f11d006659dda374ce3d1496c6" }, "nbformat": 3, "nbformat_minor": 0, @@ -19,7 +19,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Printf Example, Page number: 397

" + "

Example 11.1 Page number: 397

" ] }, { @@ -51,7 +51,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Format Specifications, Page number: 399

" + "

Example 11.2 Page number: 399

" ] }, { @@ -89,7 +89,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

String Format Specifiers, Page number: 400

" + "

Example 11.3 Page number: 400

" ] }, { @@ -124,7 +124,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Escape Sequences, Page number: 401

" + "

Example 11.4 Page number: 401

" ] }, { @@ -152,7 +152,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Format Conversions, Page number: 403

" + "

Example 11.5 Page number: 403

" ] }, { @@ -192,7 +192,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Sprintf Function, Page number: 404

" + "

Example 11.6 Page number: 404

" ] }, { @@ -229,7 +229,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Unformatted Input, Page number: 406

\n" + "

Example 11.7 Page number: 406

\n" ] }, { @@ -278,7 +278,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Unformatted Output, Page number: 407

" + "

Example 11.8 Page number: 407

" ] }, { @@ -318,7 +318,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Unformatted String Input/Output, Page number: 408

\n" + "

11.9 , Page number: 408

\n" ] }, { diff --git a/Let_us_C/chapter-12.ipynb b/Let us C/chapter-12.ipynb similarity index 93% rename from Let_us_C/chapter-12.ipynb rename to Let us C/chapter-12.ipynb index a3331f4d..e268149b 100644 --- a/Let_us_C/chapter-12.ipynb +++ b/Let us C/chapter-12.ipynb @@ -1,2334 +1,2334 @@ -{ - "metadata": { - "name": "chapter-12.ipynb" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Chapter 12: File Input/Output

" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Display Contents of a File , Page number: 417

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "fp = open (\"C:/Users/Akshatha M/Desktop/carrot.txt\", \"r\" ) #open file in read mode\n", - "while ( 1 ):\n", - " ch = fp.read(1)\n", - " if not ch :\n", - " break\n", - " print ch\n", - "\n", - "fp.close() #close file\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "M\n", - "e\n", - "t\n", - "h\n", - "o\n", - "d\n", - "\n", - "\n", - "T\n", - "h\n", - "r\n", - "o\n", - "u\n", - "g\n", - "h\n", - "l\n", - "y\n", - " \n", - "w\n", - "a\n", - "s\n", - " \n", - "b\n", - "o\n", - "t\n", - "h\n", - " \n", - "b\n", - "e\n", - "e\n", - "t\n", - "r\n", - "o\n", - "o\n", - "t\n", - " \n", - "a\n", - "n\n", - "d\n", - " \n", - "c\n", - "a\n", - "r\n", - "r\n", - "o\n", - "t\n", - " \n", - "t\n", - "o\n", - " \n", - "r\n", - "e\n", - "m\n", - "o\n", - "v\n", - "e\n", - " \n", - "t\n", - "h\n", - "e\n", - " \n", - "m\n", - "u\n", - "d\n", - " \n", - "o\n", - "n\n", - " \n", - "b\n", - "e\n", - "e\n", - "t\n", - "r\n", - "o\n", - "o\n", - "t\n", - " \n", - "a\n", - "n\n", - "d\n", - " \n", - "t\n", - "h\n", - "e\n", - " \n", - "h\n", - "a\n", - "i\n", - "r\n", - " \n", - "o\n", - "n\n", - " \n", - "c\n", - "a\n", - "r\n", - "r\n", - "o\n", - "t\n", - "\n", - "\n", - "P\n", - "e\n", - "e\n", - "l\n", - " \n", - "o\n", - "f\n", - "f\n", - " \n", - "t\n", - "h\n", - "e\n", - " \n", - "c\n", - "a\n", - "r\n", - "r\n", - "o\n", - "t\n", - " \n", - "s\n", - "k\n", - "i\n", - "n\n", - ".\n", - " \n", - "d\n", - "o\n", - " \n", - "n\n", - "o\n", - "t\n", - " \n", - "p\n", - "e\n", - "e\n", - "l\n", - " \n", - "t\n", - "h\n", - "e\n", - " \n", - "r\n", - "a\n", - "d\n", - "d\n", - "i\n", - "s\n", - "h\n", - " \n", - "s\n", - "k\n", - "i\n", - "n\n", - " \n", - "t\n", - "o\n", - " \n", - "a\n", - "v\n", - "o\n", - "i\n", - "d\n", - " \n", - "p\n", - "o\n", - "s\n", - "s\n", - "i\n", - "b\n", - "l\n", - "e\n", - " \n", - "l\n", - "o\n", - "s\n", - "s\n", - " \n", - "o\n", - "f\n", - " \n", - "v\n", - "i\n", - "t\n", - "a\n", - "m\n", - "i\n", - "n\n", - "s\n", - "\n", - "\n", - "C\n", - "u\n", - "t\n", - " \n", - "e\n", - "a\n", - "c\n", - "h\n", - " \n", - "b\n", - "e\n", - "e\n", - "t\n", - "r\n", - "o\n", - "o\n", - "t\n", - " \n", - "a\n", - "n\n", - "d\n", - " \n", - "c\n", - "a\n", - "r\n", - "r\n", - "o\n", - "t\n", - " \n", - "i\n", - "n\n", - " \n", - "t\n", - "o\n", - " \n", - "4\n", - " \n", - "h\n", - "a\n", - "l\n", - "v\n", - "e\n", - "s\n", - "\n", - "\n", - "P\n", - "r\n", - "e\n", - "a\n", - "s\n", - "s\n", - "u\n", - "r\n", - "e\n", - " \n", - "c\n", - "o\n", - "o\n", - "k\n", - " \n", - "t\n", - "h\n", - "e\n", - " \n", - "b\n", - "e\n", - "e\n", - "t\n", - "r\n", - "o\n", - "o\n", - "t\n", - " \n", - "a\n", - "n\n", - "d\n", - " \n", - "c\n", - "a\n", - "r\n", - "r\n", - "o\n", - "t\n", - ".\n", - " \n", - "m\n", - "a\n", - "k\n", - "e\n", - " \n", - "3\n", - " \n", - "w\n", - "h\n", - "i\n", - "s\n", - "t\n", - "l\n", - "e\n", - "s\n", - " \n", - "s\n", - "o\n", - " \n", - "t\n", - "h\n", - "e\n", - "t\n", - " \n", - "t\n", - "h\n", - "e\n", - "y\n", - " \n", - "b\n", - "e\n", - "c\n", - "o\n", - "m\n", - "e\n", - " \n", - "v\n", - "e\n", - "r\n", - "y\n", - " \n", - "s\n", - "m\n", - "o\n", - "o\n", - "t\n", - "h\n", - "\n", - "\n", - "D\n", - "r\n", - "a\n", - "i\n", - "n\n", - " \n", - "a\n", - "n\n", - "d\n", - " \n", - "r\n", - "e\n", - "s\n", - "e\n", - "r\n", - "v\n", - "e\n", - " \n", - "t\n", - "h\n", - "e\n", - " \n", - "w\n", - "a\n", - "t\n", - "e\n", - "r\n", - " \n", - "a\n", - "f\n", - "t\n", - "e\n", - "r\n", - " \n", - "p\n", - "r\n", - "e\n", - "s\n", - "s\n", - "u\n", - "r\n", - "e\n", - " \n", - "c\n", - "o\n", - "o\n", - "k\n", - "i\n", - "n\n", - "g\n", - ".\n", - "\n", - "\n", - "M\n", - "a\n", - "s\n", - "h\n", - " \n", - "t\n", - "h\n", - "e\n", - " \n", - "c\n", - "o\n", - "o\n", - "k\n", - "e\n", - "d\n", - " \n", - "p\n", - "i\n", - "e\n", - "c\n", - "e\n", - "s\n", - " \n", - "a\n", - "n\n", - "d\n", - " \n", - "a\n", - "l\n", - "l\n", - "o\n", - "w\n", - " \n", - "t\n", - "o\n", - " \n", - "c\n", - "o\n", - "o\n", - "l\n", - "\n", - "\n", - "C\n", - "u\n", - "t\n", - " \n", - "o\n", - "n\n", - "i\n", - "o\n", - "n\n", - "s\n", - " \n", - "i\n", - "n\n", - "t\n", - "o\n", - " \n", - "c\n", - "u\n", - "b\n", - "e\n", - "s\n", - " \n", - "a\n", - "n\n", - "d\n", - " \n", - "s\n", - "a\n", - "u\n", - "t\n", - "e\n", - " \n", - "t\n", - "i\n", - "l\n", - "l\n", - " \n", - "g\n", - "o\n", - "l\n", - "d\n", - "e\n", - "n\n", - " \n", - "b\n", - "r\n", - "o\n", - "w\n", - "n\n", - " \n", - "o\n", - "n\n", - " \n", - "o\n", - "i\n", - "l\n", - " \n", - "a\n", - "n\n", - "d\n", - " \n", - "a\n", - "l\n", - "l\n", - "o\n", - "w\n", - " \n", - "t\n", - "o\n", - " \n", - "c\n", - "o\n", - "o\n", - "l\n", - "\n", - "\n", - "A\n", - "f\n", - "t\n", - "e\n", - "r\n", - " \n", - "c\n", - "o\n", - "o\n", - "l\n", - "i\n", - "n\n", - "g\n", - " \n", - "g\n", - "r\n", - "i\n", - "n\n", - "d\n", - " \n", - "t\n", - "h\n", - "e\n", - " \n", - "m\n", - "a\n", - "s\n", - "h\n", - "e\n", - "d\n", - " \n", - "b\n", - "e\n", - "e\n", - "t\n", - "r\n", - "o\n", - "o\n", - "t\n", - ",\n", - " \n", - "c\n", - "a\n", - "r\n", - "r\n", - "o\n", - "t\n", - " \n", - "a\n", - "n\n", - "d\n", - " \n", - "s\n", - "a\n", - "u\n", - "t\n", - "e\n", - "d\n", - " \n", - "o\n", - "n\n", - "i\n", - "o\n", - "n\n", - "s\n", - " \n", - "t\n", - "o\n", - " \n", - "p\n", - "a\n", - "s\n", - "t\n", - "e\n", - " \n", - "i\n", - "n\n", - " \n", - "a\n", - " \n", - "m\n", - "i\n", - "x\n", - "y\n", - ".\n", - " \n", - "a\n", - "d\n", - "d\n", - " \n", - "e\n", - "n\n", - "o\n", - "u\n", - "g\n", - "h\n", - " \n", - "w\n", - "a\n", - "t\n", - "e\n", - "r\n", - " \n", - "t\n", - "o\n", - " \n", - "m\n", - "a\n", - "k\n", - "e\n", - " \n", - "p\n", - "a\n", - "s\n", - "t\n", - "e\n", - " \n", - "n\n", - "o\n", - "t\n", - " \n", - "v\n", - "e\n", - "r\n", - "y\n", - " \n", - "f\n", - "i\n", - "n\n", - "e\n", - ".\n", - "\n", - "\n", - "N\n", - "o\n", - "w\n", - " \n", - "s\n", - "t\n", - "r\n", - "a\n", - "i\n", - "n\n", - " \n", - "t\n", - "h\n", - "e\n", - " \n", - "g\n", - "r\n", - "i\n", - "n\n", - "d\n", - " \n", - "p\n", - "a\n", - "s\n", - "t\n", - "e\n", - ".\n", - "\n", - "\n", - "T\n", - "a\n", - "k\n", - "e\n", - " \n", - "s\n", - "o\n", - "m\n", - "e\n", - " \n", - "b\n", - "u\n", - "t\n", - "t\n", - "e\n", - "r\n", - " \n", - "i\n", - "n\n", - " \n", - "a\n", - " \n", - "v\n", - "e\n", - "s\n", - "s\n", - "e\n", - "l\n", - " \n", - "a\n", - "d\n", - "d\n", - " \n", - "t\n", - "h\n", - "e\n", - " \n", - "g\n", - "a\n", - "r\n", - "l\n", - "i\n", - "c\n", - " \n", - "p\n", - "a\n", - "s\n", - "t\n", - "e\n", - ",\n", - "g\n", - "i\n", - "n\n", - "g\n", - "e\n", - "r\n", - "p\n", - "a\n", - "s\n", - "t\n", - "e\n", - " \n", - "a\n", - "n\n", - "d\n", - " \n", - "g\n", - "r\n", - "e\n", - "e\n", - "n\n", - " \n", - "c\n", - "h\n", - "i\n", - "l\n", - "l\n", - "i\n", - " \n", - "p\n", - "a\n", - "s\n", - "t\n", - "e\n", - " \n", - "a\n", - "n\n", - "d\n", - " \n", - "s\n", - "a\n", - "u\n", - "t\n", - "e\n", - " \n", - "f\n", - "o\n", - "r\n", - " \n", - "s\n", - "o\n", - "m\n", - "e\n", - " \n", - "t\n", - "i\n", - "m\n", - "e\n", - " \n", - "t\n", - "i\n", - "l\n", - "l\n", - " \n", - "u\n", - " \n", - "g\n", - "e\n", - "t\n", - " \n", - "t\n", - "h\n", - "e\n", - " \n", - "s\n", - "p\n", - "e\n", - "c\n", - "i\n", - "f\n", - "i\n", - "c\n", - " \n", - "g\n", - "a\n", - "r\n", - "l\n", - "i\n", - "c\n", - "-\n", - "b\n", - "e\n", - "i\n", - "n\n", - "g\n", - "-\n", - "f\n", - "r\n", - "i\n", - "e\n", - "d\n", - " \n", - "s\n", - "m\n", - "e\n", - "l\n", - "l\n", - "\n", - "\n", - "A\n", - "d\n", - "d\n", - " \n", - "m\n", - "o\n", - "o\n", - "n\n", - "g\n", - " \n", - "s\n", - "p\n", - "r\n", - "o\n", - "u\n", - "t\n", - "s\n", - " \n", - "a\n", - "n\n", - "d\n", - " \n", - "s\n", - "a\n", - "u\n", - "t\n", - "e\n", - ",\n", - " \n", - "c\n", - "o\n", - "v\n", - "e\n", - "r\n", - " \n", - "w\n", - "i\n", - "t\n", - "h\n", - " \n", - "t\n", - "h\n", - "e\n", - " \n", - "l\n", - "i\n", - "d\n", - " \n", - "a\n", - "n\n", - "d\n", - " \n", - "l\n", - "e\n", - "t\n", - " \n", - "c\n", - "o\n", - "o\n", - "k\n", - " \n", - "f\n", - "o\n", - "r\n", - " \n", - "5\n", - " \n", - "m\n", - "i\n", - "n\n", - "s\n", - "\n", - "\n", - "N\n", - "o\n", - "w\n", - " \n", - "a\n", - "d\n", - "d\n", - " \n", - "t\n", - "h\n", - "e\n", - " \n", - "s\n", - "t\n", - "r\n", - "a\n", - "i\n", - "n\n", - " \n", - "o\n", - "f\n", - " \n", - "b\n", - "e\n", - "e\n", - "t\n", - "r\n", - "o\n", - "o\n", - "t\n", - ",\n", - "c\n", - "a\n", - "r\n", - "r\n", - "o\n", - "t\n", - " \n", - "a\n", - "n\n", - "d\n", - " \n", - "o\n", - "n\n", - "i\n", - "o\n", - "n\n", - "s\n", - " \n", - "p\n", - "a\n", - "s\n", - "t\n", - "e\n", - "\n", - "\n", - "A\n", - "d\n", - "d\n", - " \n", - "6\n", - " \n", - "c\n", - "u\n", - "p\n", - "s\n", - " \n", - "o\n", - "f\n", - " \n", - "w\n", - "a\n", - "t\n", - "e\n", - "r\n", - " \n", - "t\n", - "o\n", - " \n", - "i\n", - "t\n", - " \n", - "a\n", - "n\n", - "d\n", - " \n", - "a\n", - "l\n", - "s\n", - "o\n", - " \n", - "t\n", - "h\n", - "e\n", - " \n", - "w\n", - "a\n", - "t\n", - "e\n", - "r\n", - " \n", - "r\n", - "e\n", - "s\n", - "e\n", - "r\n", - "v\n", - "e\n", - "d\n", - " \n", - "a\n", - "t\n", - " \n", - "t\n", - "h\n", - "e\n", - " \n", - "t\n", - "i\n", - "m\n", - "e\n", - " \n", - "o\n", - "f\n", - " \n", - "p\n", - "r\n", - "e\n", - "s\n", - "s\n", - "u\n", - "r\n", - "e\n", - " \n", - "c\n", - "o\n", - "o\n", - "k\n", - "i\n", - "n\n", - "g\n", - " \n", - "t\n", - "h\n", - "e\n", - " \n", - "b\n", - "e\n", - "e\n", - "t\n", - "r\n", - "o\n", - "o\n", - "t\n", - " \n", - "a\n", - "n\n", - "d\n", - " \n", - "c\n", - "a\n", - "r\n", - "r\n", - "o\n", - "t\n", - ".\n", - "\n", - "\n", - "A\n", - "d\n", - "d\n", - " \n", - "s\n", - "a\n", - "l\n", - "t\n", - ",\n", - " \n", - "c\n", - "i\n", - "n\n", - "n\n", - "a\n", - "m\n", - "o\n", - "n\n", - ",\n", - " \n", - "c\n", - "u\n", - "m\n", - "m\n", - "i\n", - "n\n", - ",\n", - " \n", - "c\n", - "o\n", - "r\n", - "i\n", - "a\n", - "n\n", - "d\n", - "e\n", - "r\n", - " \n", - "p\n", - "o\n", - "w\n", - "d\n", - "e\n", - "r\n", - ",\n", - "l\n", - "e\n", - "m\n", - "o\n", - "n\n", - " \n", - "j\n", - "u\n", - "i\n", - "c\n", - "e\n", - "\n", - "\n", - "B\n", - "r\n", - "i\n", - "n\n", - "g\n", - " \n", - "t\n", - "o\n", - " \n", - "a\n", - " \n", - "b\n", - "o\n", - "i\n", - "l\n", - ",\n", - " \n", - "l\n", - "e\n", - "t\n", - " \n", - "s\n", - "i\n", - "m\n", - "m\n", - "e\n", - "r\n", - " \n", - "f\n", - "o\n", - "r\n", - " \n", - "a\n", - " \n", - "f\n", - "e\n", - "w\n", - " \n", - "m\n", - "i\n", - "n\n", - "s\n", - "\n", - "\n", - "M\n", - "a\n", - "k\n", - "e\n", - " \n", - "a\n", - " \n", - "f\n", - "i\n", - "n\n", - "e\n", - " \n", - "p\n", - "a\n", - "s\n", - "t\n", - "e\n", - " \n", - "o\n", - "f\n", - " \n", - "c\n", - "o\n", - "r\n", - "n\n", - "f\n", - "l\n", - "o\n", - "u\n", - "r\n", - " \n", - "a\n", - "n\n", - "d\n", - " \n", - "a\n", - "d\n", - "d\n", - " \n", - "i\n", - "t\n", - " \n", - "w\n", - "h\n", - "i\n", - "l\n", - "e\n", - " \n", - "s\n", - "t\n", - "i\n", - "r\n", - "r\n", - "i\n", - "n\n", - "g\n", - " \n", - "t\n", - "o\n", - " \n", - "a\n", - "v\n", - "o\n", - "i\n", - "d\n", - " \n", - "l\n", - "u\n", - "m\n", - "p\n", - "s\n", - "\n", - "\n", - "T\n", - "i\n", - "l\n", - " \n", - "f\n", - "o\n", - "r\n", - " \n", - "s\n", - "o\n", - "m\n", - "e\n", - "m\n", - "o\n", - "r\n", - "e\n", - " \n", - "t\n", - "i\n", - "m\n", - "e\n", - " \n", - "s\n", - "o\n", - " \n", - "t\n", - "h\n", - "a\n", - "t\n", - " \n", - "t\n", - "h\n", - "e\n", - " \n", - "c\n", - "o\n", - "r\n", - "n\n", - "f\n", - "l\n", - "o\n", - "u\n", - "r\n", - " \n", - "p\n", - "a\n", - "s\n", - "t\n", - "e\n", - " \n", - "i\n", - "s\n", - " \n", - "c\n", - "o\n", - "o\n", - "k\n", - "e\n", - "d\n", - " \n", - "a\n", - "n\n", - "d\n", - " \n", - "m\n", - "i\n", - "x\n", - "e\n", - "d\n", - " \n", - "w\n", - "e\n", - "l\n", - "l\n", - "\n", - "\n", - "T\n", - "a\n", - "k\n", - "e\n", - " \n", - "o\n", - "i\n", - "l\n", - " \n", - "i\n", - "n\n", - " \n", - "a\n", - " \n", - "k\n", - "a\n", - "d\n", - "h\n", - "a\n", - "i\n", - " \n", - "t\n", - "o\n", - " \n", - "f\n", - "r\n", - "y\n", - " \n", - "t\n", - "h\n", - "e\n", - " \n", - "n\n", - "o\n", - "o\n", - "d\n", - "l\n", - "e\n", - "s\n", - ".\n", - "f\n", - "r\n", - "y\n", - " \n", - "t\n", - "i" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "l\n", - "l\n", - " \n", - "g\n", - "o\n", - "l\n", - "d\n", - "e\n", - "n\n", - " \n", - "b\n", - "r\n", - "o\n", - "w\n", - "n\n", - " \n", - "a\n", - "n\n", - "d\n", - " \n", - "r\n", - "e\n", - "s\n", - "e\n", - "r\n", - "v\n", - "e\n", - " \n", - "o\n", - "n\n", - " \n", - "a\n", - " \n", - "t\n", - "i\n", - "s\n", - "s\n", - "u\n", - "e\n", - " \n", - "p\n", - "a\n", - "p\n", - "e\n", - "r\n", - "\n", - "\n", - "C\n", - "r\n", - "u\n", - "s\n", - "h\n", - " \n", - "t\n", - "h\n", - "e\n", - " \n", - "n\n", - "o\n", - "o\n", - "d\n", - "l\n", - "e\n", - "s\n", - " \n", - "n\n", - "o\n", - "t\n", - " \n", - "t\n", - "o\n", - "o\n", - " \n", - "m\n", - "u\n", - "c\n", - "h\n", - "\n", - "\n", - "S\n", - "e\n", - "r\n", - "v\n", - "e\n", - " \n", - "s\n", - "t\n", - "e\n", - "a\n", - "m\n", - "i\n", - "n\n", - "g\n", - " \n", - "h\n", - "o\n", - "t\n", - " \n", - "i\n", - "n\n", - " \n", - "s\n", - "o\n", - "u\n", - "p\n", - " \n", - "b\n", - "o\n", - "w\n", - "l\n", - "s\n", - " \n", - "a\n", - "d\n", - "d\n", - " \n", - "s\n", - "o\n", - "m\n", - "e\n", - " \n", - "b\n", - "u\n", - "t\n", - "t\n", - "e\n", - "r\n", - " \n", - "a\n", - "n\n", - "d\n", - " \n", - "t\n", - "o\n", - "p\n", - " \n", - "w\n", - "i\n", - "t\n", - "h\n", - " \n", - "t\n", - "h\n", - "e\n", - " \n", - "c\n", - "r\n", - "i\n", - "s\n", - "p\n", - "y\n", - " \n", - "n\n", - "o\n", - "o\n", - "d\n", - "l\n", - "e\n", - "s\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Opening a File , Page number: 421

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "try :\n", - " fp = open (\"C:/Users/Akshatha M/Desktop/carrot.txt\", \"r\" )#open file in read mode and check if file is opened successfully\n", - "except:\n", - " print \"cannot open file\" \n", - " exit()\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "cannot open file\n" - ] - } - ], - "prompt_number": "*" - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Counting Characters,Tabs,Spaces and Newlines , Page number: 423

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Variable declaration\n", - "nol = 0\n", - "Not = 0\n", - "nob = 0\n", - "noc = 0\n", - "\n", - "fp = open (\"C:/Users/Akshatha M/Desktop/carrot.txt\", \"r\" ) #open file in read mode\n", - "while ( 1 ):\n", - " ch = fp.read(1)\n", - " if not ch :\n", - " break\n", - " noc = noc + 1 #number of chars\n", - " if ( ch == \" \" ):\n", - " nob = nob + 1 #number of spaces\n", - " if ( ch == \"\\n\" ):\n", - " nol = nol + 1 # number of newlines\n", - " if ( ch == \"\\t\" ):\n", - " Not = Not + 1 #number of tabs\n", - "\n", - "fp.close() #close file\n", - "\n", - "#Result\n", - "print \"Number of characters = \", noc \n", - "print \"Number of blanks = \", nob \n", - "print \"Number of tabs = \", Not \n", - "print \"Number of lines = \", nol \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Number of characters = 1495\n", - "Number of blanks = 254\n", - "Number of tabs = 0\n", - "Number of lines = 20\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

File Copy , Page number: 424

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "fs = open (\"C:/Users/Akshatha M/Desktop/carrot.txt\", \"r\" ) #open file in read mode\n", - "if(not fs):\n", - " print \"Cannot open source file\"\n", - " exit()\n", - "\n", - "ft = open ( \"C:/Users/Akshatha M/Desktop/temp.txt\", \"w\" ) #open file in write mode\n", - "if(not ft):\n", - " print \"Cannot open target file\"\n", - " fs.close() \n", - " exit()\n", - " \n", - "while ( 1 ):\n", - " ch = fs.read(1)\n", - " if not ch :\n", - " break\n", - " else:\n", - " ft.writelines(ch) #write into target file\n", - "\n", - "#closen files\n", - "fs.close()\n", - "ft.close()" - ], - "language": "python", - "metadata": {}, - "outputs": [], - "prompt_number": 3 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Writing Strings to Files, Page number: 427

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "fp = open ( \"C:/Users/Akshatha M/Desktop/temp.txt\", \"w\" ) #open file in write mode\n", - "if(not fp):\n", - " print \"Cannot open target file\" \n", - " exit()\n", - "\n", - "print \"Enter a few lines of text:\" \n", - "#s=input(\"\") #Input strings from keyboard\n", - "s = \"File written\"\n", - "print s\n", - "while ( len(s) > 0 ):\n", - " fp.writelines(s) #write into file\n", - " fp.writelines(\"\\n\")\n", - " #s=input(\"\") #Input strings from keyboard\n", - " s=\"\"\n", - " \n", - "#close files\n", - "fp.close()\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a few lines of text:\n", - "File written\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Reading Strings from Files , Page number: 429

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "fp = open (\"C:/Users/Akshatha M/Desktop/carrot.txt\", \"r\" ) #open file in read mode\n", - "if ( not fp ):\n", - " print \"Cannot open file\" \n", - " exit( ) \n", - "\n", - "while ( 1 ) :#Read strings from file\n", - " s = fp.read(79)\n", - " if(s):\n", - " print s\n", - " else:\n", - " break\n", - " \n", - "\n", - "fp.close() #close file\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Method\n", - "Throughly was both beetroot and carrot to remove the mud on beetroot and\n", - " the hair on carrot\n", - "Peel off the carrot skin. do not peel the raddish skin to a\n", - "void possible loss of vitamins\n", - "Cut each beetroot and carrot in to 4 halves\n", - "Prea\n", - "ssure cook the beetroot and carrot. make 3 whistles so thet they become very sm\n", - "ooth\n", - "Drain and reserve the water after pressure cooking.\n", - "Mash the cooked pieces\n", - " and allow to cool\n", - "Cut onions into cubes and saute till golden brown on oil and\n", - " allow to cool\n", - "After cooling grind the mashed beetroot, carrot and sauted onion\n", - "s to paste in a mixy. add enough water to make paste not very fine.\n", - "Now strain \n", - "the grind paste.\n", - "Take some butter in a vessel add the garlic paste,gingerpaste \n", - "and green chilli paste and saute for some time till u get the specific garlic-b\n", - "eing-fried smell\n", - "Add moong sprouts and saute, cover with the lid and let cook f\n", - "or 5 mins\n", - "Now add the strain of beetroot,carrot and onions paste\n", - "Add 6 cups of \n", - "water to it and also the water reserved at the time of pressure cooking the bee\n", - "troot and carrot.\n", - "Add salt, cinnamon, cummin, coriander powder,lemon juice\n", - "Brin\n", - "g to a boil, let simmer for a few mins\n", - "Make a fine paste of cornflour and add i\n", - "t while stirring to avoid lumps\n", - "Til for somemore time so that the cornflour pas\n", - "te is cooked and mixed well\n", - "Take oil in a kadhai to fry the noodles.fry till go\n", - "lden brown and reserve on a tissue paper\n", - "Crush the noodles not too much\n", - "Serve s\n", - "teaming hot in soup bowls add some butter and top with the crispy noodles\n" - ] - } - ], - "prompt_number": 6 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Writing Records to Files , Page number: 431

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "from collections import namedtuple\n", - "\n", - "#Variable declaration\n", - "another = 'Y'\n", - "\n", - "#Structure defintion\n", - "struct_emp = namedtuple(\"struct_emp\", \"name age bs\")\n", - "\n", - "\n", - "fp = open ( \"C:/Users/Akshatha M/Desktop/Employee.dat\", \"w\" ) #open file in write mode\n", - "if(not fp):\n", - " print \"Cannot open target file\"\n", - " exit()\n", - "\n", - "while ( another == 'Y' ):\n", - " print \"Enter name, age and basic salary: \" \n", - " #en,ea,ebs = input(\"\").split()\n", - " en =\"John\"\n", - " ea=\"34\"\n", - " ebs=\"25000\"\n", - " print en,ea,ebs\n", - " e = struct_emp(en,ea,ebs)\n", - " fp.writelines(e) #write into file\n", - " fp.writelines(\"\\n\")\n", - " #another = input( \"Add another record (Y/N): \" ) \n", - " print \"Add another record (Y/N): \"\n", - " another = 'N'\n", - " print another\n", - "#close file\n", - "fp.close()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name, age and basic salary: \n", - "John 34 25000\n", - "Add another record (Y/N): \n", - "N\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Reading Records from File , Page number: 433

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "from collections import namedtuple\n", - "#Structure defintion\n", - "struct_emp = namedtuple(\"struct_emp\", \"name age bs\")\n", - "\n", - "\n", - "fp = open ( \"C:/Users/Akshatha M/Desktop/Employee.txt\", \"r\" ) #open file in read mode\n", - "if(not fp):\n", - " print \"Cannot open target file\"\n", - " exit()\n", - "\n", - "while ( 1 ):\n", - " s = fp.readline()\n", - " if(s):\n", - " en,ea,ebs = s.split()\n", - " e = struct_emp(en,ea,ebs) #Read record\n", - " print e.name, e.age, e.bs \n", - " else:\n", - " break\n", - " \n", - "#close file\n", - "fp.close()\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "John 34 25000\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Copying Binary Files , Page number: 434

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "fs = open (\"C:/Users/Akshatha M/Desktop/Project1.exe\", \"rb\" ) #open file in read binary mode\n", - "if(not fs):\n", - " print \"Cannot open source file\"\n", - " exit()\n", - "\n", - "ft = open ( \"C:/Users/Akshatha M/Desktop/NewProject1.exe\", \"wb\" ) #open file in write binary mode\n", - "if(not ft):\n", - " print \"Cannot open target file\"\n", - " fs.close() \n", - " exit()\n", - " \n", - "while ( 1 ):\n", - " ch = fs.read(1)\n", - " if not ch :\n", - " break\n", - " else:\n", - " ft.write(ch) #write into target file\n", - "\n", - "#closen files\n", - "fs.close()\n", - "ft.close()\n" - ], - "language": "python", - "metadata": {}, - "outputs": [], - "prompt_number": 12 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Writing To Files in Binary Mode, Page number: 438

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "from collections import namedtuple\n", - "\n", - "#Variable declaration\n", - "another = 'Y'\n", - "\n", - "#Structure defintion\n", - "struct_emp = namedtuple(\"struct_emp\", \"name age bs\")\n", - "\n", - "fp = open ( \"C:/Users/Akshatha M/Desktop/Employee.dat\", \"wb\" ) #open file in write mode\n", - "if(not fp):\n", - " print \"Cannot open target file\" \n", - " exit()\n", - "\n", - "while ( another == 'Y' ):\n", - " print ( \"Enter name, age and basic salary: \" )\n", - " #en,ea,ebs = input(\"\").split()\n", - " en =\"John\"\n", - " ea=\"34\"\n", - " ebs=\"25000\"\n", - " print en,ea,ebs\n", - " e = struct_emp(en,ea,ebs)\n", - " #write into file\n", - " fp.write(b'e.name')\n", - " fp.write(b'e.age')\n", - " fp.write(b'e.bs')\n", - " fp.write(b'\\n')\n", - " #another = input( \"Add another record (Y/N): \" ) \n", - " print \"Add another record (Y/N): \"\n", - " another = 'N'\n", - " print another\n", - "\n", - "#close file\n", - "fp.close()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter name, age and basic salary: \n", - "John 34 25000\n", - "Add another record (Y/N): \n", - "N\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Reading From Binary Files , Page number: 440

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "from collections import namedtuple\n", - "#Structure defintion\n", - "struct_emp = namedtuple(\"struct_emp\", \"name age bs\")\n", - "\n", - "\n", - "fp = open ( \"C:/Users/Akshatha M/Desktop/Employee.txt\", \"rb\" ) #open file in read mode\n", - "if(not fp):\n", - " print \"Cannot open target file\" \n", - " exit()\n", - "\n", - "while ( 1 ):\n", - " s = fp.readline()\n", - " if(s):\n", - " en,ea,ebs = s.split()\n", - " e = struct_emp(en,ea,ebs) #Read record\n", - " print e.name, e.age, e.bs \n", - " else:\n", - " break\n", - " \n", - "#close file\n", - "fp.close()\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "John 34 25000\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Database Management, Page number: 442

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import os\n", - "from collections import namedtuple\n", - "#Structure defintion\n", - "struct_emp = namedtuple(\"struct_emp\", \"name age bs\")\n", - "\n", - "fp = open ( \"C:/Users/Akshatha M/Desktop/Employee.txt\", \"r+b\")\n", - "if ( not fp ):\n", - " fp = open ( \"C:/Users/Akshatha M/Desktop/Employee.txt\", \"w+b\" )\n", - " if ( not fp ):\n", - " print \"Cannot open file\" \n", - " exit( )\n", - "\n", - "while ( 1 ):\n", - " print \" 1. Add Records\"\n", - " print \" 2. List Records\"\n", - " print \" 3. Modify Records\"\n", - " print \" 4. Delete Records\" \n", - " print \" 0. Exit\" \n", - " #choice = input(\"\\nYour choice\")\n", - " print \"\\nYour choice\"\n", - " choice = 1\n", - " if(choice == '1'):\n", - " another = 'Y'\n", - " while ( another == 'Y' ):\n", - " print ( \"Enter name, age and basic salary: \" )\n", - " en,ea,ebs = input(\"\").split()\n", - " e = struct_emp(en,ea,ebs)\n", - " #write into file\n", - " fp.write(b'e.name')\n", - " fp.write(b' ')\n", - " fp.write(b'e.age')\n", - " fp.write(b' ')\n", - " fp.write(b'e.bs')\n", - " fp.write(b'\\n')\n", - " another = input( \"Add another record (Y/N): \" )\n", - " elif(choice == '2'):\n", - " fp.seek(0,0)\n", - " while ( 1 ):\n", - " s = fp.readline()\n", - " if(s):\n", - " en,j1,ea,j2,ebs = s.split()\n", - " e = struct_emp(en,ea,ebs) #Read record\n", - " print ( e.name, e.age, e.bs )\n", - " else:\n", - " break\n", - " elif(choice == '3'):\n", - " another = 'Y'\n", - " while ( another == 'Y' ):\n", - " empname =input(\"Enter name of employee to modify \" )\n", - " fp.seek(0,0)\n", - " while (fp.readline()):\n", - " if ( b'empname' == b'e.name' ):\n", - " en,ea,ebs = input(\"Enter new name, age & bs\" ).spilt()\n", - " e = struct_emp(en,ea,ebs)\n", - " cur = fp.tell()\n", - " fp.write(b'e.name')\n", - " fp.write(b'e.age')\n", - " fp.write(b'e.bs')\n", - " fp.write(b'\\n')\n", - " break\n", - " print ( \"\\nModify another Record (Y/N) \" )\n", - " another = input(\"\")\n", - " elif(choice == '4'):\n", - " another = 'Y'\n", - " while ( another == 'Y' ):\n", - " empname = input(\"Enter name of employee to delete \" )\n", - " ft = open ( \"C:/Users/Akshatha M/Desktop/temp.txt\", \"wb\" )\n", - " fp.seek(0,0)\n", - " while ( 1 ):\n", - " s = fp.readline()\n", - " if(s):\n", - " if ( not(b'empname' == b'e.name' )):\n", - " ft.write(s)\n", - " else:\n", - " break\n", - " fp.close()\n", - " ft.close()\n", - " os.remove(\"C:/Users/Akshatha M/Desktop/Employee.txt\")\n", - " os.rename ( \"C:/Users/Akshatha M/Desktop/temp.txt\", \"C:/Users/Akshatha M/Desktop/Employee.txt\" )\n", - " fp = open ( \"C:/Users/Akshatha M/Desktop/Employee.txt\", \"r+b\" )\n", - " print ( \"Delete another Record (Y/N) \" )\n", - " another = input(\"\")\n", - "\n", - " else:\n", - " fp.close()#close file\n", - " exit( )\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Low Level File Copy, Page number: 448

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#source=input( \"Enter source file name \" ) \n", - "print \"Enter source file name \" \n", - "source = \"Employee.txt\"\n", - "print source\n", - "source=\"C:/Users/Akshatha M/Desktop/\"+source\n", - "\n", - "inhandle = open (source, \"rb\" ) #open file in read binary mode\n", - "if(not inhandle):\n", - " print \"Cannot open file\"\n", - " exit()\n", - "\n", - "#target=input( \"Enter target file name \" ) \n", - "print \"Enter target file name \"\n", - "target = \"temp.txt\"\n", - "print target\n", - "target=\"C:/Users/Akshatha M/Desktop/\"+target\n", - "\n", - "outhandle = open ( target, \"wb\" ) #open file in write binary mode\n", - "if(not outhandle):\n", - " print \"Cannot open target file\"\n", - " inhandle.close() \n", - " exit()\n", - "\n", - "\n", - " \n", - "while ( 1 ):\n", - " Bytes = inhandle.read(1)\n", - " if not Bytes :\n", - " break\n", - " else:\n", - " outhandle.write(Bytes) #write into target file\n", - "\n", - "#closen files\n", - "inhandle.close()\n", - "outhandle.close()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter source file name \n", - "Employee.txt\n", - "Enter target file name \n", - "temp.txt\n" - ] - } - ], - "prompt_number": 16 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Detecting Errors in Reading/Writing, Page number: 470

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "\n", - "fp = open ( \"C:/Users/Akshatha/Documents/extrastuff/skills.txt\", \"w\" ) \n", - "while (1):\n", - " try:\n", - " ch = fp.read(1) #read character from file \n", - " except: #ferror()\n", - " print \"Error in reading file\" \n", - " break \n", - " print ch \n", - " \n", - "fp.close()" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Error in reading file\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Standard IO devices, Page number: 472

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import io\n", - "\n", - "try:\n", - " fp = open (\"C:/Users/Akshatha/Documents/extrastuff/skills.txt\", \"r\")\n", - "except:\n", - " print \"cannot open file\"\n", - " exit()\n", - " \n", - "io.open('stdprn','w') \n", - "try:\n", - " stdprn = io.open('stdprn', 'w') #open printer\n", - "\n", - " while ( 1 ):\n", - " ch = fp.read(1)\n", - " if not ch :\n", - " break\n", - " else:\n", - " stdprn.write(ch) #write into printer\n", - "except: #no printer\n", - " #closen files\n", - " fp.close()\n", - " stdprn.close()\n", - " " - ], - "language": "python", - "metadata": {}, - "outputs": [], - "prompt_number": 5 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] +{ + "metadata": { + "name": "", + "signature": "sha256:f8fb56abb39db93ad3fa7fcf720d7c0f3aa8a48195c6cd7c8eee0d526bfd834a" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 12: File Input/Output

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.1 Page number: 417

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "fp = open (\"C:/Users/Akshatha M/Desktop/carrot.txt\", \"r\" ) #open file in read mode\n", + "while ( 1 ):\n", + " ch = fp.read(1)\n", + " if not ch :\n", + " break\n", + " print ch\n", + "\n", + "fp.close() #close file\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "M\n", + "e\n", + "t\n", + "h\n", + "o\n", + "d\n", + "\n", + "\n", + "T\n", + "h\n", + "r\n", + "o\n", + "u\n", + "g\n", + "h\n", + "l\n", + "y\n", + " \n", + "w\n", + "a\n", + "s\n", + " \n", + "b\n", + "o\n", + "t\n", + "h\n", + " \n", + "b\n", + "e\n", + "e\n", + "t\n", + "r\n", + "o\n", + "o\n", + "t\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "c\n", + "a\n", + "r\n", + "r\n", + "o\n", + "t\n", + " \n", + "t\n", + "o\n", + " \n", + "r\n", + "e\n", + "m\n", + "o\n", + "v\n", + "e\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "m\n", + "u\n", + "d\n", + " \n", + "o\n", + "n\n", + " \n", + "b\n", + "e\n", + "e\n", + "t\n", + "r\n", + "o\n", + "o\n", + "t\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "h\n", + "a\n", + "i\n", + "r\n", + " \n", + "o\n", + "n\n", + " \n", + "c\n", + "a\n", + "r\n", + "r\n", + "o\n", + "t\n", + "\n", + "\n", + "P\n", + "e\n", + "e\n", + "l\n", + " \n", + "o\n", + "f\n", + "f\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "c\n", + "a\n", + "r\n", + "r\n", + "o\n", + "t\n", + " \n", + "s\n", + "k\n", + "i\n", + "n\n", + ".\n", + " \n", + "d\n", + "o\n", + " \n", + "n\n", + "o\n", + "t\n", + " \n", + "p\n", + "e\n", + "e\n", + "l\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "r\n", + "a\n", + "d\n", + "d\n", + "i\n", + "s\n", + "h\n", + " \n", + "s\n", + "k\n", + "i\n", + "n\n", + " \n", + "t\n", + "o\n", + " \n", + "a\n", + "v\n", + "o\n", + "i\n", + "d\n", + " \n", + "p\n", + "o\n", + "s\n", + "s\n", + "i\n", + "b\n", + "l\n", + "e\n", + " \n", + "l\n", + "o\n", + "s\n", + "s\n", + " \n", + "o\n", + "f\n", + " \n", + "v\n", + "i\n", + "t\n", + "a\n", + "m\n", + "i\n", + "n\n", + "s\n", + "\n", + "\n", + "C\n", + "u\n", + "t\n", + " \n", + "e\n", + "a\n", + "c\n", + "h\n", + " \n", + "b\n", + "e\n", + "e\n", + "t\n", + "r\n", + "o\n", + "o\n", + "t\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "c\n", + "a\n", + "r\n", + "r\n", + "o\n", + "t\n", + " \n", + "i\n", + "n\n", + " \n", + "t\n", + "o\n", + " \n", + "4\n", + " \n", + "h\n", + "a\n", + "l\n", + "v\n", + "e\n", + "s\n", + "\n", + "\n", + "P\n", + "r\n", + "e\n", + "a\n", + "s\n", + "s\n", + "u\n", + "r\n", + "e\n", + " \n", + "c\n", + "o\n", + "o\n", + "k\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "b\n", + "e\n", + "e\n", + "t\n", + "r\n", + "o\n", + "o\n", + "t\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "c\n", + "a\n", + "r\n", + "r\n", + "o\n", + "t\n", + ".\n", + " \n", + "m\n", + "a\n", + "k\n", + "e\n", + " \n", + "3\n", + " \n", + "w\n", + "h\n", + "i\n", + "s\n", + "t\n", + "l\n", + "e\n", + "s\n", + " \n", + "s\n", + "o\n", + " \n", + "t\n", + "h\n", + "e\n", + "t\n", + " \n", + "t\n", + "h\n", + "e\n", + "y\n", + " \n", + "b\n", + "e\n", + "c\n", + "o\n", + "m\n", + "e\n", + " \n", + "v\n", + "e\n", + "r\n", + "y\n", + " \n", + "s\n", + "m\n", + "o\n", + "o\n", + "t\n", + "h\n", + "\n", + "\n", + "D\n", + "r\n", + "a\n", + "i\n", + "n\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "r\n", + "e\n", + "s\n", + "e\n", + "r\n", + "v\n", + "e\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "w\n", + "a\n", + "t\n", + "e\n", + "r\n", + " \n", + "a\n", + "f\n", + "t\n", + "e\n", + "r\n", + " \n", + "p\n", + "r\n", + "e\n", + "s\n", + "s\n", + "u\n", + "r\n", + "e\n", + " \n", + "c\n", + "o\n", + "o\n", + "k\n", + "i\n", + "n\n", + "g\n", + ".\n", + "\n", + "\n", + "M\n", + "a\n", + "s\n", + "h\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "c\n", + "o\n", + "o\n", + "k\n", + "e\n", + "d\n", + " \n", + "p\n", + "i\n", + "e\n", + "c\n", + "e\n", + "s\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "a\n", + "l\n", + "l\n", + "o\n", + "w\n", + " \n", + "t\n", + "o\n", + " \n", + "c\n", + "o\n", + "o\n", + "l\n", + "\n", + "\n", + "C\n", + "u\n", + "t\n", + " \n", + "o\n", + "n\n", + "i\n", + "o\n", + "n\n", + "s\n", + " \n", + "i\n", + "n\n", + "t\n", + "o\n", + " \n", + "c\n", + "u\n", + "b\n", + "e\n", + "s\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "s\n", + "a\n", + "u\n", + "t\n", + "e\n", + " \n", + "t\n", + "i\n", + "l\n", + "l\n", + " \n", + "g\n", + "o\n", + "l\n", + "d\n", + "e\n", + "n\n", + " \n", + "b\n", + "r\n", + "o\n", + "w\n", + "n\n", + " \n", + "o\n", + "n\n", + " \n", + "o\n", + "i\n", + "l\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "a\n", + "l\n", + "l\n", + "o\n", + "w\n", + " \n", + "t\n", + "o\n", + " \n", + "c\n", + "o\n", + "o\n", + "l\n", + "\n", + "\n", + "A\n", + "f\n", + "t\n", + "e\n", + "r\n", + " \n", + "c\n", + "o\n", + "o\n", + "l\n", + "i\n", + "n\n", + "g\n", + " \n", + "g\n", + "r\n", + "i\n", + "n\n", + "d\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "m\n", + "a\n", + "s\n", + "h\n", + "e\n", + "d\n", + " \n", + "b\n", + "e\n", + "e\n", + "t\n", + "r\n", + "o\n", + "o\n", + "t\n", + ",\n", + " \n", + "c\n", + "a\n", + "r\n", + "r\n", + "o\n", + "t\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "s\n", + "a\n", + "u\n", + "t\n", + "e\n", + "d\n", + " \n", + "o\n", + "n\n", + "i\n", + "o\n", + "n\n", + "s\n", + " \n", + "t\n", + "o\n", + " \n", + "p\n", + "a\n", + "s\n", + "t\n", + "e\n", + " \n", + "i\n", + "n\n", + " \n", + "a\n", + " \n", + "m\n", + "i\n", + "x\n", + "y\n", + ".\n", + " \n", + "a\n", + "d\n", + "d\n", + " \n", + "e\n", + "n\n", + "o\n", + "u\n", + "g\n", + "h\n", + " \n", + "w\n", + "a\n", + "t\n", + "e\n", + "r\n", + " \n", + "t\n", + "o\n", + " \n", + "m\n", + "a\n", + "k\n", + "e\n", + " \n", + "p\n", + "a\n", + "s\n", + "t\n", + "e\n", + " \n", + "n\n", + "o\n", + "t\n", + " \n", + "v\n", + "e\n", + "r\n", + "y\n", + " \n", + "f\n", + "i\n", + "n\n", + "e\n", + ".\n", + "\n", + "\n", + "N\n", + "o\n", + "w\n", + " \n", + "s\n", + "t\n", + "r\n", + "a\n", + "i\n", + "n\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "g\n", + "r\n", + "i\n", + "n\n", + "d\n", + " \n", + "p\n", + "a\n", + "s\n", + "t\n", + "e\n", + ".\n", + "\n", + "\n", + "T\n", + "a\n", + "k\n", + "e\n", + " \n", + "s\n", + "o\n", + "m\n", + "e\n", + " \n", + "b\n", + "u\n", + "t\n", + "t\n", + "e\n", + "r\n", + " \n", + "i\n", + "n\n", + " \n", + "a\n", + " \n", + "v\n", + "e\n", + "s\n", + "s\n", + "e\n", + "l\n", + " \n", + "a\n", + "d\n", + "d\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "g\n", + "a\n", + "r\n", + "l\n", + "i\n", + "c\n", + " \n", + "p\n", + "a\n", + "s\n", + "t\n", + "e\n", + ",\n", + "g\n", + "i\n", + "n\n", + "g\n", + "e\n", + "r\n", + "p\n", + "a\n", + "s\n", + "t\n", + "e\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "g\n", + "r\n", + "e\n", + "e\n", + "n\n", + " \n", + "c\n", + "h\n", + "i\n", + "l\n", + "l\n", + "i\n", + " \n", + "p\n", + "a\n", + "s\n", + "t\n", + "e\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "s\n", + "a\n", + "u\n", + "t\n", + "e\n", + " \n", + "f\n", + "o\n", + "r\n", + " \n", + "s\n", + "o\n", + "m\n", + "e\n", + " \n", + "t\n", + "i\n", + "m\n", + "e\n", + " \n", + "t\n", + "i\n", + "l\n", + "l\n", + " \n", + "u\n", + " \n", + "g\n", + "e\n", + "t\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "s\n", + "p\n", + "e\n", + "c\n", + "i\n", + "f\n", + "i\n", + "c\n", + " \n", + "g\n", + "a\n", + "r\n", + "l\n", + "i\n", + "c\n", + "-\n", + "b\n", + "e\n", + "i\n", + "n\n", + "g\n", + "-\n", + "f\n", + "r\n", + "i\n", + "e\n", + "d\n", + " \n", + "s\n", + "m\n", + "e\n", + "l\n", + "l\n", + "\n", + "\n", + "A\n", + "d\n", + "d\n", + " \n", + "m\n", + "o\n", + "o\n", + "n\n", + "g\n", + " \n", + "s\n", + "p\n", + "r\n", + "o\n", + "u\n", + "t\n", + "s\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "s\n", + "a\n", + "u\n", + "t\n", + "e\n", + ",\n", + " \n", + "c\n", + "o\n", + "v\n", + "e\n", + "r\n", + " \n", + "w\n", + "i\n", + "t\n", + "h\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "l\n", + "i\n", + "d\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "l\n", + "e\n", + "t\n", + " \n", + "c\n", + "o\n", + "o\n", + "k\n", + " \n", + "f\n", + "o\n", + "r\n", + " \n", + "5\n", + " \n", + "m\n", + "i\n", + "n\n", + "s\n", + "\n", + "\n", + "N\n", + "o\n", + "w\n", + " \n", + "a\n", + "d\n", + "d\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "s\n", + "t\n", + "r\n", + "a\n", + "i\n", + "n\n", + " \n", + "o\n", + "f\n", + " \n", + "b\n", + "e\n", + "e\n", + "t\n", + "r\n", + "o\n", + "o\n", + "t\n", + ",\n", + "c\n", + "a\n", + "r\n", + "r\n", + "o\n", + "t\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "o\n", + "n\n", + "i\n", + "o\n", + "n\n", + "s\n", + " \n", + "p\n", + "a\n", + "s\n", + "t\n", + "e\n", + "\n", + "\n", + "A\n", + "d\n", + "d\n", + " \n", + "6\n", + " \n", + "c\n", + "u\n", + "p\n", + "s\n", + " \n", + "o\n", + "f\n", + " \n", + "w\n", + "a\n", + "t\n", + "e\n", + "r\n", + " \n", + "t\n", + "o\n", + " \n", + "i\n", + "t\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "a\n", + "l\n", + "s\n", + "o\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "w\n", + "a\n", + "t\n", + "e\n", + "r\n", + " \n", + "r\n", + "e\n", + "s\n", + "e\n", + "r\n", + "v\n", + "e\n", + "d\n", + " \n", + "a\n", + "t\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "t\n", + "i\n", + "m\n", + "e\n", + " \n", + "o\n", + "f\n", + " \n", + "p\n", + "r\n", + "e\n", + "s\n", + "s\n", + "u\n", + "r\n", + "e\n", + " \n", + "c\n", + "o\n", + "o\n", + "k\n", + "i\n", + "n\n", + "g\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "b\n", + "e\n", + "e\n", + "t\n", + "r\n", + "o\n", + "o\n", + "t\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "c\n", + "a\n", + "r\n", + "r\n", + "o\n", + "t\n", + ".\n", + "\n", + "\n", + "A\n", + "d\n", + "d\n", + " \n", + "s\n", + "a\n", + "l\n", + "t\n", + ",\n", + " \n", + "c\n", + "i\n", + "n\n", + "n\n", + "a\n", + "m\n", + "o\n", + "n\n", + ",\n", + " \n", + "c\n", + "u\n", + "m\n", + "m\n", + "i\n", + "n\n", + ",\n", + " \n", + "c\n", + "o\n", + "r\n", + "i\n", + "a\n", + "n\n", + "d\n", + "e\n", + "r\n", + " \n", + "p\n", + "o\n", + "w\n", + "d\n", + "e\n", + "r\n", + ",\n", + "l\n", + "e\n", + "m\n", + "o\n", + "n\n", + " \n", + "j\n", + "u\n", + "i\n", + "c\n", + "e\n", + "\n", + "\n", + "B\n", + "r\n", + "i\n", + "n\n", + "g\n", + " \n", + "t\n", + "o\n", + " \n", + "a\n", + " \n", + "b\n", + "o\n", + "i\n", + "l\n", + ",\n", + " \n", + "l\n", + "e\n", + "t\n", + " \n", + "s\n", + "i\n", + "m\n", + "m\n", + "e\n", + "r\n", + " \n", + "f\n", + "o\n", + "r\n", + " \n", + "a\n", + " \n", + "f\n", + "e\n", + "w\n", + " \n", + "m\n", + "i\n", + "n\n", + "s\n", + "\n", + "\n", + "M\n", + "a\n", + "k\n", + "e\n", + " \n", + "a\n", + " \n", + "f\n", + "i\n", + "n\n", + "e\n", + " \n", + "p\n", + "a\n", + "s\n", + "t\n", + "e\n", + " \n", + "o\n", + "f\n", + " \n", + "c\n", + "o\n", + "r\n", + "n\n", + "f\n", + "l\n", + "o\n", + "u\n", + "r\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "a\n", + "d\n", + "d\n", + " \n", + "i\n", + "t\n", + " \n", + "w\n", + "h\n", + "i\n", + "l\n", + "e\n", + " \n", + "s\n", + "t\n", + "i\n", + "r\n", + "r\n", + "i\n", + "n\n", + "g\n", + " \n", + "t\n", + "o\n", + " \n", + "a\n", + "v\n", + "o\n", + "i\n", + "d\n", + " \n", + "l\n", + "u\n", + "m\n", + "p\n", + "s\n", + "\n", + "\n", + "T\n", + "i\n", + "l\n", + " \n", + "f\n", + "o\n", + "r\n", + " \n", + "s\n", + "o\n", + "m\n", + "e\n", + "m\n", + "o\n", + "r\n", + "e\n", + " \n", + "t\n", + "i\n", + "m\n", + "e\n", + " \n", + "s\n", + "o\n", + " \n", + "t\n", + "h\n", + "a\n", + "t\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "c\n", + "o\n", + "r\n", + "n\n", + "f\n", + "l\n", + "o\n", + "u\n", + "r\n", + " \n", + "p\n", + "a\n", + "s\n", + "t\n", + "e\n", + " \n", + "i\n", + "s\n", + " \n", + "c\n", + "o\n", + "o\n", + "k\n", + "e\n", + "d\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "m\n", + "i\n", + "x\n", + "e\n", + "d\n", + " \n", + "w\n", + "e\n", + "l\n", + "l\n", + "\n", + "\n", + "T\n", + "a\n", + "k\n", + "e\n", + " \n", + "o\n", + "i\n", + "l\n", + " \n", + "i\n", + "n\n", + " \n", + "a\n", + " \n", + "k\n", + "a\n", + "d\n", + "h\n", + "a\n", + "i\n", + " \n", + "t\n", + "o\n", + " \n", + "f\n", + "r\n", + "y\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "n\n", + "o\n", + "o\n", + "d\n", + "l\n", + "e\n", + "s\n", + ".\n", + "f\n", + "r\n", + "y\n", + " \n", + "t\n", + "i" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "l\n", + "l\n", + " \n", + "g\n", + "o\n", + "l\n", + "d\n", + "e\n", + "n\n", + " \n", + "b\n", + "r\n", + "o\n", + "w\n", + "n\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "r\n", + "e\n", + "s\n", + "e\n", + "r\n", + "v\n", + "e\n", + " \n", + "o\n", + "n\n", + " \n", + "a\n", + " \n", + "t\n", + "i\n", + "s\n", + "s\n", + "u\n", + "e\n", + " \n", + "p\n", + "a\n", + "p\n", + "e\n", + "r\n", + "\n", + "\n", + "C\n", + "r\n", + "u\n", + "s\n", + "h\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "n\n", + "o\n", + "o\n", + "d\n", + "l\n", + "e\n", + "s\n", + " \n", + "n\n", + "o\n", + "t\n", + " \n", + "t\n", + "o\n", + "o\n", + " \n", + "m\n", + "u\n", + "c\n", + "h\n", + "\n", + "\n", + "S\n", + "e\n", + "r\n", + "v\n", + "e\n", + " \n", + "s\n", + "t\n", + "e\n", + "a\n", + "m\n", + "i\n", + "n\n", + "g\n", + " \n", + "h\n", + "o\n", + "t\n", + " \n", + "i\n", + "n\n", + " \n", + "s\n", + "o\n", + "u\n", + "p\n", + " \n", + "b\n", + "o\n", + "w\n", + "l\n", + "s\n", + " \n", + "a\n", + "d\n", + "d\n", + " \n", + "s\n", + "o\n", + "m\n", + "e\n", + " \n", + "b\n", + "u\n", + "t\n", + "t\n", + "e\n", + "r\n", + " \n", + "a\n", + "n\n", + "d\n", + " \n", + "t\n", + "o\n", + "p\n", + " \n", + "w\n", + "i\n", + "t\n", + "h\n", + " \n", + "t\n", + "h\n", + "e\n", + " \n", + "c\n", + "r\n", + "i\n", + "s\n", + "p\n", + "y\n", + " \n", + "n\n", + "o\n", + "o\n", + "d\n", + "l\n", + "e\n", + "s\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.2Page number: 421

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "try :\n", + " fp = open (\"C:/Users/Akshatha M/Desktop/carrot.txt\", \"r\" )#open file in read mode and check if file is opened successfully\n", + "except:\n", + " print \"cannot open file\" \n", + " exit()\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "cannot open file\n" + ] + } + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.3 , Page number: 423

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "nol = 0\n", + "Not = 0\n", + "nob = 0\n", + "noc = 0\n", + "\n", + "fp = open (\"C:/Users/Akshatha M/Desktop/carrot.txt\", \"r\" ) #open file in read mode\n", + "while ( 1 ):\n", + " ch = fp.read(1)\n", + " if not ch :\n", + " break\n", + " noc = noc + 1 #number of chars\n", + " if ( ch == \" \" ):\n", + " nob = nob + 1 #number of spaces\n", + " if ( ch == \"\\n\" ):\n", + " nol = nol + 1 # number of newlines\n", + " if ( ch == \"\\t\" ):\n", + " Not = Not + 1 #number of tabs\n", + "\n", + "fp.close() #close file\n", + "\n", + "#Result\n", + "print \"Number of characters = \", noc \n", + "print \"Number of blanks = \", nob \n", + "print \"Number of tabs = \", Not \n", + "print \"Number of lines = \", nol \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of characters = 1495\n", + "Number of blanks = 254\n", + "Number of tabs = 0\n", + "Number of lines = 20\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.4 Page number: 424

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "fs = open (\"C:/Users/Akshatha M/Desktop/carrot.txt\", \"r\" ) #open file in read mode\n", + "if(not fs):\n", + " print \"Cannot open source file\"\n", + " exit()\n", + "\n", + "ft = open ( \"C:/Users/Akshatha M/Desktop/temp.txt\", \"w\" ) #open file in write mode\n", + "if(not ft):\n", + " print \"Cannot open target file\"\n", + " fs.close() \n", + " exit()\n", + " \n", + "while ( 1 ):\n", + " ch = fs.read(1)\n", + " if not ch :\n", + " break\n", + " else:\n", + " ft.writelines(ch) #write into target file\n", + "\n", + "#closen files\n", + "fs.close()\n", + "ft.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Writing Strings to Files, Page number: 427

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "fp = open ( \"C:/Users/Akshatha M/Desktop/temp.txt\", \"w\" ) #open file in write mode\n", + "if(not fp):\n", + " print \"Cannot open target file\" \n", + " exit()\n", + "\n", + "print \"Enter a few lines of text:\" \n", + "#s=input(\"\") #Input strings from keyboard\n", + "s = \"File written\"\n", + "print s\n", + "while ( len(s) > 0 ):\n", + " fp.writelines(s) #write into file\n", + " fp.writelines(\"\\n\")\n", + " #s=input(\"\") #Input strings from keyboard\n", + " s=\"\"\n", + " \n", + "#close files\n", + "fp.close()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a few lines of text:\n", + "File written\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.4 Page number: 429

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "fp = open (\"C:/Users/Akshatha M/Desktop/carrot.txt\", \"r\" ) #open file in read mode\n", + "if ( not fp ):\n", + " print \"Cannot open file\" \n", + " exit( ) \n", + "\n", + "while ( 1 ) :#Read strings from file\n", + " s = fp.read(79)\n", + " if(s):\n", + " print s\n", + " else:\n", + " break\n", + " \n", + "\n", + "fp.close() #close file\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Method\n", + "Throughly was both beetroot and carrot to remove the mud on beetroot and\n", + " the hair on carrot\n", + "Peel off the carrot skin. do not peel the raddish skin to a\n", + "void possible loss of vitamins\n", + "Cut each beetroot and carrot in to 4 halves\n", + "Prea\n", + "ssure cook the beetroot and carrot. make 3 whistles so thet they become very sm\n", + "ooth\n", + "Drain and reserve the water after pressure cooking.\n", + "Mash the cooked pieces\n", + " and allow to cool\n", + "Cut onions into cubes and saute till golden brown on oil and\n", + " allow to cool\n", + "After cooling grind the mashed beetroot, carrot and sauted onion\n", + "s to paste in a mixy. add enough water to make paste not very fine.\n", + "Now strain \n", + "the grind paste.\n", + "Take some butter in a vessel add the garlic paste,gingerpaste \n", + "and green chilli paste and saute for some time till u get the specific garlic-b\n", + "eing-fried smell\n", + "Add moong sprouts and saute, cover with the lid and let cook f\n", + "or 5 mins\n", + "Now add the strain of beetroot,carrot and onions paste\n", + "Add 6 cups of \n", + "water to it and also the water reserved at the time of pressure cooking the bee\n", + "troot and carrot.\n", + "Add salt, cinnamon, cummin, coriander powder,lemon juice\n", + "Brin\n", + "g to a boil, let simmer for a few mins\n", + "Make a fine paste of cornflour and add i\n", + "t while stirring to avoid lumps\n", + "Til for somemore time so that the cornflour pas\n", + "te is cooked and mixed well\n", + "Take oil in a kadhai to fry the noodles.fry till go\n", + "lden brown and reserve on a tissue paper\n", + "Crush the noodles not too much\n", + "Serve s\n", + "teaming hot in soup bowls add some butter and top with the crispy noodles\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

12.5 Page number: 431

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from collections import namedtuple\n", + "\n", + "#Variable declaration\n", + "another = 'Y'\n", + "\n", + "#Structure defintion\n", + "struct_emp = namedtuple(\"struct_emp\", \"name age bs\")\n", + "\n", + "\n", + "fp = open ( \"C:/Users/Akshatha M/Desktop/Employee.dat\", \"w\" ) #open file in write mode\n", + "if(not fp):\n", + " print \"Cannot open target file\"\n", + " exit()\n", + "\n", + "while ( another == 'Y' ):\n", + " print \"Enter name, age and basic salary: \" \n", + " #en,ea,ebs = input(\"\").split()\n", + " en =\"John\"\n", + " ea=\"34\"\n", + " ebs=\"25000\"\n", + " print en,ea,ebs\n", + " e = struct_emp(en,ea,ebs)\n", + " fp.writelines(e) #write into file\n", + " fp.writelines(\"\\n\")\n", + " #another = input( \"Add another record (Y/N): \" ) \n", + " print \"Add another record (Y/N): \"\n", + " another = 'N'\n", + " print another\n", + "#close file\n", + "fp.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name, age and basic salary: \n", + "John 34 25000\n", + "Add another record (Y/N): \n", + "N\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.6 , Page number: 433

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from collections import namedtuple\n", + "#Structure defintion\n", + "struct_emp = namedtuple(\"struct_emp\", \"name age bs\")\n", + "\n", + "\n", + "fp = open ( \"C:/Users/Akshatha M/Desktop/Employee.txt\", \"r\" ) #open file in read mode\n", + "if(not fp):\n", + " print \"Cannot open target file\"\n", + " exit()\n", + "\n", + "while ( 1 ):\n", + " s = fp.readline()\n", + " if(s):\n", + " en,ea,ebs = s.split()\n", + " e = struct_emp(en,ea,ebs) #Read record\n", + " print e.name, e.age, e.bs \n", + " else:\n", + " break\n", + " \n", + "#close file\n", + "fp.close()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "John 34 25000\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.7 Page number: 434

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "fs = open (\"C:/Users/Akshatha M/Desktop/Project1.exe\", \"rb\" ) #open file in read binary mode\n", + "if(not fs):\n", + " print \"Cannot open source file\"\n", + " exit()\n", + "\n", + "ft = open ( \"C:/Users/Akshatha M/Desktop/NewProject1.exe\", \"wb\" ) #open file in write binary mode\n", + "if(not ft):\n", + " print \"Cannot open target file\"\n", + " fs.close() \n", + " exit()\n", + " \n", + "while ( 1 ):\n", + " ch = fs.read(1)\n", + " if not ch :\n", + " break\n", + " else:\n", + " ft.write(ch) #write into target file\n", + "\n", + "#closen files\n", + "fs.close()\n", + "ft.close()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 12 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.8 Page number: 438

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from collections import namedtuple\n", + "\n", + "#Variable declaration\n", + "another = 'Y'\n", + "\n", + "#Structure defintion\n", + "struct_emp = namedtuple(\"struct_emp\", \"name age bs\")\n", + "\n", + "fp = open ( \"C:/Users/Akshatha M/Desktop/Employee.dat\", \"wb\" ) #open file in write mode\n", + "if(not fp):\n", + " print \"Cannot open target file\" \n", + " exit()\n", + "\n", + "while ( another == 'Y' ):\n", + " print ( \"Enter name, age and basic salary: \" )\n", + " #en,ea,ebs = input(\"\").split()\n", + " en =\"John\"\n", + " ea=\"34\"\n", + " ebs=\"25000\"\n", + " print en,ea,ebs\n", + " e = struct_emp(en,ea,ebs)\n", + " #write into file\n", + " fp.write(b'e.name')\n", + " fp.write(b'e.age')\n", + " fp.write(b'e.bs')\n", + " fp.write(b'\\n')\n", + " #another = input( \"Add another record (Y/N): \" ) \n", + " print \"Add another record (Y/N): \"\n", + " another = 'N'\n", + " print another\n", + "\n", + "#close file\n", + "fp.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter name, age and basic salary: \n", + "John 34 25000\n", + "Add another record (Y/N): \n", + "N\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.9 Page number: 440

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from collections import namedtuple\n", + "#Structure defintion\n", + "struct_emp = namedtuple(\"struct_emp\", \"name age bs\")\n", + "\n", + "\n", + "fp = open ( \"C:/Users/Akshatha M/Desktop/Employee.txt\", \"rb\" ) #open file in read mode\n", + "if(not fp):\n", + " print \"Cannot open target file\" \n", + " exit()\n", + "\n", + "while ( 1 ):\n", + " s = fp.readline()\n", + " if(s):\n", + " en,ea,ebs = s.split()\n", + " e = struct_emp(en,ea,ebs) #Read record\n", + " print e.name, e.age, e.bs \n", + " else:\n", + " break\n", + " \n", + "#close file\n", + "fp.close()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "John 34 25000\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.10 Page number: 442

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import os\n", + "from collections import namedtuple\n", + "#Structure defintion\n", + "struct_emp = namedtuple(\"struct_emp\", \"name age bs\")\n", + "\n", + "fp = open ( \"C:/Users/Akshatha M/Desktop/Employee.txt\", \"r+b\")\n", + "if ( not fp ):\n", + " fp = open ( \"C:/Users/Akshatha M/Desktop/Employee.txt\", \"w+b\" )\n", + " if ( not fp ):\n", + " print \"Cannot open file\" \n", + " exit( )\n", + "\n", + "while ( 1 ):\n", + " print \" 1. Add Records\"\n", + " print \" 2. List Records\"\n", + " print \" 3. Modify Records\"\n", + " print \" 4. Delete Records\" \n", + " print \" 0. Exit\" \n", + " #choice = input(\"\\nYour choice\")\n", + " print \"\\nYour choice\"\n", + " choice = 1\n", + " if(choice == '1'):\n", + " another = 'Y'\n", + " while ( another == 'Y' ):\n", + " print ( \"Enter name, age and basic salary: \" )\n", + " en,ea,ebs = input(\"\").split()\n", + " e = struct_emp(en,ea,ebs)\n", + " #write into file\n", + " fp.write(b'e.name')\n", + " fp.write(b' ')\n", + " fp.write(b'e.age')\n", + " fp.write(b' ')\n", + " fp.write(b'e.bs')\n", + " fp.write(b'\\n')\n", + " another = input( \"Add another record (Y/N): \" )\n", + " elif(choice == '2'):\n", + " fp.seek(0,0)\n", + " while ( 1 ):\n", + " s = fp.readline()\n", + " if(s):\n", + " en,j1,ea,j2,ebs = s.split()\n", + " e = struct_emp(en,ea,ebs) #Read record\n", + " print ( e.name, e.age, e.bs )\n", + " else:\n", + " break\n", + " elif(choice == '3'):\n", + " another = 'Y'\n", + " while ( another == 'Y' ):\n", + " empname =input(\"Enter name of employee to modify \" )\n", + " fp.seek(0,0)\n", + " while (fp.readline()):\n", + " if ( b'empname' == b'e.name' ):\n", + " en,ea,ebs = input(\"Enter new name, age & bs\" ).spilt()\n", + " e = struct_emp(en,ea,ebs)\n", + " cur = fp.tell()\n", + " fp.write(b'e.name')\n", + " fp.write(b'e.age')\n", + " fp.write(b'e.bs')\n", + " fp.write(b'\\n')\n", + " break\n", + " print ( \"\\nModify another Record (Y/N) \" )\n", + " another = input(\"\")\n", + " elif(choice == '4'):\n", + " another = 'Y'\n", + " while ( another == 'Y' ):\n", + " empname = input(\"Enter name of employee to delete \" )\n", + " ft = open ( \"C:/Users/Akshatha M/Desktop/temp.txt\", \"wb\" )\n", + " fp.seek(0,0)\n", + " while ( 1 ):\n", + " s = fp.readline()\n", + " if(s):\n", + " if ( not(b'empname' == b'e.name' )):\n", + " ft.write(s)\n", + " else:\n", + " break\n", + " fp.close()\n", + " ft.close()\n", + " os.remove(\"C:/Users/Akshatha M/Desktop/Employee.txt\")\n", + " os.rename ( \"C:/Users/Akshatha M/Desktop/temp.txt\", \"C:/Users/Akshatha M/Desktop/Employee.txt\" )\n", + " fp = open ( \"C:/Users/Akshatha M/Desktop/Employee.txt\", \"r+b\" )\n", + " print ( \"Delete another Record (Y/N) \" )\n", + " another = input(\"\")\n", + "\n", + " else:\n", + " fp.close()#close file\n", + " exit( )\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.11 Page number: 448

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#source=input( \"Enter source file name \" ) \n", + "print \"Enter source file name \" \n", + "source = \"Employee.txt\"\n", + "print source\n", + "source=\"C:/Users/Akshatha M/Desktop/\"+source\n", + "\n", + "inhandle = open (source, \"rb\" ) #open file in read binary mode\n", + "if(not inhandle):\n", + " print \"Cannot open file\"\n", + " exit()\n", + "\n", + "#target=input( \"Enter target file name \" ) \n", + "print \"Enter target file name \"\n", + "target = \"temp.txt\"\n", + "print target\n", + "target=\"C:/Users/Akshatha M/Desktop/\"+target\n", + "\n", + "outhandle = open ( target, \"wb\" ) #open file in write binary mode\n", + "if(not outhandle):\n", + " print \"Cannot open target file\"\n", + " inhandle.close() \n", + " exit()\n", + "\n", + "\n", + " \n", + "while ( 1 ):\n", + " Bytes = inhandle.read(1)\n", + " if not Bytes :\n", + " break\n", + " else:\n", + " outhandle.write(Bytes) #write into target file\n", + "\n", + "#closen files\n", + "inhandle.close()\n", + "outhandle.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter source file name \n", + "Employee.txt\n", + "Enter target file name \n", + "temp.txt\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.12 Page number: 470

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "fp = open ( \"C:/Users/Akshatha/Documents/extrastuff/skills.txt\", \"w\" ) \n", + "while (1):\n", + " try:\n", + " ch = fp.read(1) #read character from file \n", + " except: #ferror()\n", + " print \"Error in reading file\" \n", + " break \n", + " print ch \n", + " \n", + "fp.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Error in reading file\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.13 Page number: 472

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import io\n", + "\n", + "try:\n", + " fp = open (\"C:/Users/Akshatha/Documents/extrastuff/skills.txt\", \"r\")\n", + "except:\n", + " print \"cannot open file\"\n", + " exit()\n", + " \n", + "io.open('stdprn','w') \n", + "try:\n", + " stdprn = io.open('stdprn', 'w') #open printer\n", + "\n", + " while ( 1 ):\n", + " ch = fp.read(1)\n", + " if not ch :\n", + " break\n", + " else:\n", + " stdprn.write(ch) #write into printer\n", + "except: #no printer\n", + " #closen files\n", + " fp.close()\n", + " stdprn.close()\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 5 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] } \ No newline at end of file diff --git a/Let_us_C/chapter-13.ipynb b/Let us C/chapter-13.ipynb similarity index 91% rename from Let_us_C/chapter-13.ipynb rename to Let us C/chapter-13.ipynb index bd79a9c1..bd6dda0d 100644 --- a/Let_us_C/chapter-13.ipynb +++ b/Let us C/chapter-13.ipynb @@ -1,82 +1,83 @@ -{ - "metadata": { - "name": "chapter-13.ipynb" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Chapter 13: More Issues In Input/Output

" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Using argc and argv, Page number: 467

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import sys\n", - "\n", - "if ( len(sys.argv) != 3 ):\n", - " print ( \"Improper number of arguments\" )\n", - " exit( )\n", - " \n", - "fs = open ( sys.argv[2], \"r\" ) #open file in read mode\n", - "if ( not fs):\n", - " print ( \"Cannot open source file\" )\n", - " exit( )\n", - " \n", - "ft = open ( sys.argv[2], \"w\" ) #open file in write mode\n", - "if ( not ft ):\n", - " print ( \"Cannot open target file\" )\n", - " fs.close()\n", - " exit( )\n", - " \n", - "while ( 1 ):\n", - " ch = fs.read(1)\n", - " if ( not ch ):\n", - " break\n", - " else:\n", - " ft.write(ch)\n", - "\n", - "#close files \n", - "fs.close()\n", - "ft.close()\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Improper number of arguments\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] +{ + "metadata": { + "name": "", + "signature": "sha256:38a69ac05001af67e94c3a40d834f3bbd2c217ab113749c395067fe2f553c887" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 13: More Issues In Input/Output

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 13.1 Page number: 467

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import sys\n", + "\n", + "if ( len(sys.argv) != 3 ):\n", + " print ( \"Improper number of arguments\" )\n", + " exit( )\n", + " \n", + "fs = open ( sys.argv[2], \"r\" ) #open file in read mode\n", + "if ( not fs):\n", + " print ( \"Cannot open source file\" )\n", + " exit( )\n", + " \n", + "ft = open ( sys.argv[2], \"w\" ) #open file in write mode\n", + "if ( not ft ):\n", + " print ( \"Cannot open target file\" )\n", + " fs.close()\n", + " exit( )\n", + " \n", + "while ( 1 ):\n", + " ch = fs.read(1)\n", + " if ( not ch ):\n", + " break\n", + " else:\n", + " ft.write(ch)\n", + "\n", + "#close files \n", + "fs.close()\n", + "ft.close()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Improper number of arguments\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] } \ No newline at end of file diff --git a/Let_us_C/chapter-14.ipynb b/Let us C/chapter-14.ipynb similarity index 92% rename from Let_us_C/chapter-14.ipynb rename to Let us C/chapter-14.ipynb index 8181a680..c01593ec 100644 --- a/Let_us_C/chapter-14.ipynb +++ b/Let us C/chapter-14.ipynb @@ -1,844 +1,845 @@ -{ - "metadata": { - "name": "chapter-14.ipynb" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Chapter 14: Operations On Bits

" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Binary Conversion, Page number: 483

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Function definition\n", - "def showbits ( n ):\n", - " a = 15\n", - " for i in range(0,16):\n", - " andmask = 1 << a\n", - " k = n & andmask\n", - " if k == 0:\n", - " print \"0\"\n", - " else:\n", - " print \"1\" \n", - " a = a-1\n", - "\n", - "\n", - "#Result\n", - "for j in range(0,6):\n", - " print \"Decimal %d is same as binary \"%( j )\n", - " showbits ( j ) #function call\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Decimal 0 is same as binary \n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "Decimal 1 is same as binary \n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "1\n", - "Decimal 2 is same as binary \n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "1\n", - "0\n", - "Decimal 3 is same as binary \n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "1\n", - "1\n", - "Decimal 4 is same as binary \n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "1\n", - "0\n", - "0\n", - "Decimal 5 is same as binary \n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "1\n", - "0\n", - "1\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

One's Complement, Page number: 484

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Function definition\n", - "def showbits ( n ):\n", - " a = 15\n", - " for i in range(0,16):\n", - " andmask = 1 << a\n", - " k = n & andmask\n", - " if k == 0:\n", - " print \"0\" \n", - " else:\n", - " print \"1\" \n", - " a = a-1\n", - "\n", - "\n", - "for j in range(0,4):\n", - " print \"Decimal %d is same as binary \"%(j )\n", - " showbits ( j ) \n", - " k = ~j \n", - " print \"One\u2019s complement of %d is \"%( j ) \n", - " showbits ( k )" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Decimal 0 is same as binary \n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "One\u2019s complement of 0 is \n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "Decimal 1 is same as binary \n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "1\n", - "One\u2019s complement of 1 is \n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "0\n", - "Decimal 2 is same as binary \n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "1\n", - "0\n", - "One\u2019s complement of 2 is \n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "0\n", - "1\n", - "Decimal 3 is same as binary \n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "1\n", - "1\n", - "One\u2019s complement of 3 is \n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "1\n", - "0\n", - "0\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

File Encryption, Page number: 485

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Function definition\n", - "def encrypt( ):\n", - " fs = open ( \"C:/Users/Akshatha M/Desktop/carrot.txt\", \"r\" ) #normal file \n", - " ft = open ( \"C:/Users/Akshatha M/Desktop/temp.txt\", \"w\" ) # encrypted file \n", - " if ( not fs or not ft ):\n", - " print \"File opening error!\" \n", - " exit()\n", - " while (1):\n", - " ch = fs.read(1)\n", - " if(not ch): #EOF\n", - " break\n", - " else:\n", - " ft.write(ascii(~ord(ch))) #complemented\n", - " #close files\n", - " fs.close()\n", - " ft.close()\n", - "\n", - "\n", - "encrypt() #function call\n", - " " - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Right Shift Operator, Page number: 487

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Function definition\n", - "def showbits ( n ):\n", - " a = 15\n", - " for i in range(0,16):\n", - " andmask = 1 << a\n", - " k = n & andmask\n", - " if k == 0:\n", - " print \"0\" \n", - " else:\n", - " print \"1\" \n", - " a = a-1\n", - "\n", - "#Variable declaration\n", - "i = 5225\n", - "\n", - "print \"Decimal %d is same as binary \"%( i )\n", - "showbits(i)#function call\n", - "\n", - "for j in range(0,6):\n", - " k = i >>j #right shift \n", - " print \"%d right shift %d gives \" %(i, j )\n", - " showbits ( k ) #function call " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Decimal 5225 is same as binary \n", - "0\n", - "0\n", - "0\n", - "1\n", - "0\n", - "1\n", - "0\n", - "0\n", - "0\n", - "1\n", - "1\n", - "0\n", - "1\n", - "0\n", - "0\n", - "1\n", - "5225 right shift 0 gives \n", - "0\n", - "0\n", - "0\n", - "1\n", - "0\n", - "1\n", - "0\n", - "0\n", - "0\n", - "1\n", - "1\n", - "0\n", - "1\n", - "0\n", - "0\n", - "1\n", - "5225 right shift 1 gives \n", - "0\n", - "0\n", - "0\n", - "0\n", - "1\n", - "0\n", - "1\n", - "0\n", - "0\n", - "0\n", - "1\n", - "1\n", - "0\n", - "1\n", - "0\n", - "0\n", - "5225 right shift 2 gives \n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "1\n", - "0\n", - "1\n", - "0\n", - "0\n", - "0\n", - "1\n", - "1\n", - "0\n", - "1\n", - "0\n", - "5225 right shift 3 gives \n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "1\n", - "0\n", - "1\n", - "0\n", - "0\n", - "0\n", - "1\n", - "1\n", - "0\n", - "1\n", - "5225 right shift 4 gives \n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "1\n", - "0\n", - "1\n", - "0\n", - "0\n", - "0\n", - "1\n", - "1\n", - "0\n", - "5225 right shift 5 gives \n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "0\n", - "1\n", - "0\n", - "1\n", - "0\n", - "0\n", - "0\n", - "1\n", - "1\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Left Shift Operator, Page number: 488

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Function definition\n", - "def showbits ( n ):\n", - " a = 15\n", - " for i in range(0,16):\n", - " andmask = 1 << a\n", - " k = n & andmask\n", - " if k == 0:\n", - " print \"0\" \n", - " else:\n", - " print \"1\" \n", - " a = a-1\n", - "\n", - "#Variable declaration\n", - "i = 5225\n", - "\n", - "print \"Decimal %d is same as binary \"%( i )\n", - "showbits(i)#function call\n", - "\n", - "for j in range(0,6):\n", - " k = i <Date Field in Directory, Page number: 492

\n" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Variable declaration\n", - "d = 9\n", - "m = 3\n", - "y = 1990\n", - "\n", - "#Calculation and result\n", - "date = ( y - 1980 ) * 512 + m * 32 + d \n", - "print \"Date = %u\"%( date ) \n", - "year = 1980 + ( date >> 9 ) \n", - "month = ( (date << 7 ) >> 12 ) \n", - "day = ( (date << 11 ) >> 11 ) \n", - "print \"Year = \", year \n", - "print \"Month = %u\" %(m)\n", - "print \"Day = %u\" %(d)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Date = 5225\n", - "Year = 1990\n", - "Month = 3\n", - "Day = 9\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Bitwise AND Operator, Page number: 495

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Variable declaration\n", - "i = 65\n", - "\n", - "print \"value of i = \", i \n", - "\n", - "j = i & 32 #bitwise and\n", - "if ( j == 0 ):\n", - " print \"and its fifth bit is off\" \n", - "else:\n", - " print \"and its fifth bit is on\"\n", - "\n", - "j = i & 64 #bitwise and\n", - "if ( j == 0 ):\n", - " print \"whereas its sixth bit is off\" \n", - "else:\n", - " print \"whereas its sixth bit is on\" \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "value of i = 65\n", - "and its fifth bit is off\n", - "whereas its sixth bit is on\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Bitwise XOR Operator, Page number: 500

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Variable declaration\n", - "b = 50\n", - "\n", - "#Calculation and result\n", - "b = b ^ 12 \n", - "print b # this will print 62 \n", - "b = b ^ 12 \n", - "print b # this will print 50 \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "62\n", - "50\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] +{ + "metadata": { + "name": "", + "signature": "sha256:96bb77f7d99dd117be704a2641450350e8dffa594859c5068e028cb5a2e776fc" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 14: Operations On Bits

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.1 Page number: 483

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Function definition\n", + "def showbits ( n ):\n", + " a = 15\n", + " for i in range(0,16):\n", + " andmask = 1 << a\n", + " k = n & andmask\n", + " if k == 0:\n", + " print \"0\"\n", + " else:\n", + " print \"1\" \n", + " a = a-1\n", + "\n", + "\n", + "#Result\n", + "for j in range(0,6):\n", + " print \"Decimal %d is same as binary \"%( j )\n", + " showbits ( j ) #function call\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Decimal 0 is same as binary \n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "Decimal 1 is same as binary \n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "1\n", + "Decimal 2 is same as binary \n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "1\n", + "0\n", + "Decimal 3 is same as binary \n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "1\n", + "1\n", + "Decimal 4 is same as binary \n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "1\n", + "0\n", + "0\n", + "Decimal 5 is same as binary \n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "1\n", + "0\n", + "1\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.2 Page number: 484

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Function definition\n", + "def showbits ( n ):\n", + " a = 15\n", + " for i in range(0,16):\n", + " andmask = 1 << a\n", + " k = n & andmask\n", + " if k == 0:\n", + " print \"0\" \n", + " else:\n", + " print \"1\" \n", + " a = a-1\n", + "\n", + "\n", + "for j in range(0,4):\n", + " print \"Decimal %d is same as binary \"%(j )\n", + " showbits ( j ) \n", + " k = ~j \n", + " print \"One\u2019s complement of %d is \"%( j ) \n", + " showbits ( k )" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Decimal 0 is same as binary \n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "One\u2019s complement of 0 is \n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "Decimal 1 is same as binary \n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "1\n", + "One\u2019s complement of 1 is \n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "0\n", + "Decimal 2 is same as binary \n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "1\n", + "0\n", + "One\u2019s complement of 2 is \n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "0\n", + "1\n", + "Decimal 3 is same as binary \n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "1\n", + "1\n", + "One\u2019s complement of 3 is \n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "1\n", + "0\n", + "0\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.3 Page number: 485

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Function definition\n", + "def encrypt( ):\n", + " fs = open ( \"C:/Users/Akshatha M/Desktop/carrot.txt\", \"r\" ) #normal file \n", + " ft = open ( \"C:/Users/Akshatha M/Desktop/temp.txt\", \"w\" ) # encrypted file \n", + " if ( not fs or not ft ):\n", + " print \"File opening error!\" \n", + " exit()\n", + " while (1):\n", + " ch = fs.read(1)\n", + " if(not ch): #EOF\n", + " break\n", + " else:\n", + " ft.write(ascii(~ord(ch))) #complemented\n", + " #close files\n", + " fs.close()\n", + " ft.close()\n", + "\n", + "\n", + "encrypt() #function call\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.4 Page number: 487

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Function definition\n", + "def showbits ( n ):\n", + " a = 15\n", + " for i in range(0,16):\n", + " andmask = 1 << a\n", + " k = n & andmask\n", + " if k == 0:\n", + " print \"0\" \n", + " else:\n", + " print \"1\" \n", + " a = a-1\n", + "\n", + "#Variable declaration\n", + "i = 5225\n", + "\n", + "print \"Decimal %d is same as binary \"%( i )\n", + "showbits(i)#function call\n", + "\n", + "for j in range(0,6):\n", + " k = i >>j #right shift \n", + " print \"%d right shift %d gives \" %(i, j )\n", + " showbits ( k ) #function call " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Decimal 5225 is same as binary \n", + "0\n", + "0\n", + "0\n", + "1\n", + "0\n", + "1\n", + "0\n", + "0\n", + "0\n", + "1\n", + "1\n", + "0\n", + "1\n", + "0\n", + "0\n", + "1\n", + "5225 right shift 0 gives \n", + "0\n", + "0\n", + "0\n", + "1\n", + "0\n", + "1\n", + "0\n", + "0\n", + "0\n", + "1\n", + "1\n", + "0\n", + "1\n", + "0\n", + "0\n", + "1\n", + "5225 right shift 1 gives \n", + "0\n", + "0\n", + "0\n", + "0\n", + "1\n", + "0\n", + "1\n", + "0\n", + "0\n", + "0\n", + "1\n", + "1\n", + "0\n", + "1\n", + "0\n", + "0\n", + "5225 right shift 2 gives \n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "1\n", + "0\n", + "1\n", + "0\n", + "0\n", + "0\n", + "1\n", + "1\n", + "0\n", + "1\n", + "0\n", + "5225 right shift 3 gives \n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "1\n", + "0\n", + "1\n", + "0\n", + "0\n", + "0\n", + "1\n", + "1\n", + "0\n", + "1\n", + "5225 right shift 4 gives \n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "1\n", + "0\n", + "1\n", + "0\n", + "0\n", + "0\n", + "1\n", + "1\n", + "0\n", + "5225 right shift 5 gives \n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "0\n", + "1\n", + "0\n", + "1\n", + "0\n", + "0\n", + "0\n", + "1\n", + "1\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.5 Page number: 488

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Function definition\n", + "def showbits ( n ):\n", + " a = 15\n", + " for i in range(0,16):\n", + " andmask = 1 << a\n", + " k = n & andmask\n", + " if k == 0:\n", + " print \"0\" \n", + " else:\n", + " print \"1\" \n", + " a = a-1\n", + "\n", + "#Variable declaration\n", + "i = 5225\n", + "\n", + "print \"Decimal %d is same as binary \"%( i )\n", + "showbits(i)#function call\n", + "\n", + "for j in range(0,6):\n", + " k = i <Example 14.6 Page number: 492

\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "d = 9\n", + "m = 3\n", + "y = 1990\n", + "\n", + "#Calculation and result\n", + "date = ( y - 1980 ) * 512 + m * 32 + d \n", + "print \"Date = %u\"%( date ) \n", + "year = 1980 + ( date >> 9 ) \n", + "month = ( (date << 7 ) >> 12 ) \n", + "day = ( (date << 11 ) >> 11 ) \n", + "print \"Year = \", year \n", + "print \"Month = %u\" %(m)\n", + "print \"Day = %u\" %(d)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Date = 5225\n", + "Year = 1990\n", + "Month = 3\n", + "Day = 9\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.7 Page number: 495

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "i = 65\n", + "\n", + "print \"value of i = \", i \n", + "\n", + "j = i & 32 #bitwise and\n", + "if ( j == 0 ):\n", + " print \"and its fifth bit is off\" \n", + "else:\n", + " print \"and its fifth bit is on\"\n", + "\n", + "j = i & 64 #bitwise and\n", + "if ( j == 0 ):\n", + " print \"whereas its sixth bit is off\" \n", + "else:\n", + " print \"whereas its sixth bit is on\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "value of i = 65\n", + "and its fifth bit is off\n", + "whereas its sixth bit is on\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.8 Page number: 500

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "b = 50\n", + "\n", + "#Calculation and result\n", + "b = b ^ 12 \n", + "print b # this will print 62 \n", + "b = b ^ 12 \n", + "print b # this will print 50 \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "62\n", + "50\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] } \ No newline at end of file diff --git a/Let_us_C/chapter-15.ipynb b/Let us C/chapter-15.ipynb similarity index 93% rename from Let_us_C/chapter-15.ipynb rename to Let us C/chapter-15.ipynb index 087a08d0..14199913 100644 --- a/Let_us_C/chapter-15.ipynb +++ b/Let us C/chapter-15.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:d98d61d8802af6f3fda8e30c6e47e6355ba4d55d204c760c90ae2fa05295236c" + "signature": "sha256:a90b9698d7e7ff1bb70d7ec09c9e8360ac113b9df1f45548a6b3d10da82cb543" }, "nbformat": 3, "nbformat_minor": 0, @@ -19,7 +19,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Enumerated Data Type , Page number: 508

" + "

Example 15.1, Page number: 508

" ] }, { @@ -75,7 +75,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Are Enums Necessary, Page number: 510

" + "

Example 15.2 Page number: 510

" ] }, { @@ -106,7 +106,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Division Without Typecasting , Page number: 513

" + "

Example 15.3 Page number: 513

" ] }, { @@ -141,7 +141,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Division With Typecasting , Page number: 513

" + "

Example 15.4 Page number: 513

" ] }, { @@ -176,7 +176,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Type Casting , Page number: 514

" + "

Example 15.5 Page number: 514

" ] }, { @@ -209,7 +209,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Bit Fields , Page number: 516

" + "

Example 15.6 Page number: 516

" ] }, { @@ -264,7 +264,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Address of a Function , Page number: 517

" + "

Example 15.7 Page number: 517

" ] }, { @@ -298,7 +298,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Invoking a Function Using Pointer, Page number: 518

" + "

Example 15.7 Page number: 518

" ] }, { @@ -332,7 +332,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Functions Returning Pointers , Page number: 520

" + "

Example 15.8 Page number: 520

" ] }, { @@ -357,7 +357,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

String Copy , Page number: 520

" + "

Example 15.9 Page number: 520

" ] }, { @@ -398,14 +398,14 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Findmax Function , Page number: 522

" + "

Example 15.10 Page number: 522

" ] }, { "cell_type": "code", "collapsed": false, "input": [ - "\n", + "to find out max value from a set of values\n", "\n", "#function declaration\n", "def findmax(*arg):\n", @@ -440,7 +440,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Display Function, Page number: 524

" + "

Example 15.11 Page number: 524

" ] }, { @@ -493,7 +493,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Union Demo , Page number: 526

" + "

Example 15.12 Page number: 526

" ] }, { @@ -522,7 +522,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Union Example , Page number: 530

" + "

Example 15.13 Page number: 530

" ] }, { @@ -556,7 +556,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Union of Structures , Page number: 531

" + "

Example 15.13, Page number: 531

" ] }, { diff --git a/Let_us_C/chapter-16.ipynb b/Let us C/chapter-16.ipynb similarity index 84% rename from Let_us_C/chapter-16.ipynb rename to Let us C/chapter-16.ipynb index 195741f0..824cbe4e 100644 --- a/Let_us_C/chapter-16.ipynb +++ b/Let us C/chapter-16.ipynb @@ -1,65 +1,68 @@ -{ - "metadata": { - "name": "chapter-16.ipynb" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Chapter 16: C Under Windows

" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

The first Windows Program, Page number: 554

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import ctypes\n", - "MessageBox = ctypes.windll.user32.MessageBoxW\n", - "MessageBox(None, 'Hello', 'Title', 0)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "pyout", - "prompt_number": 1, - "text": [ - "1" - ] - }, - { - "output_type": "pyout", - "prompt_number": 2, - "text": [ - "1" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] +{ + "metadata": { + "name": "", + "signature": "sha256:5d242b124a1674f55a1e4dda8447fdf9d35c8383bc1dba01fbe3d04ac148a706" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 16: C Under Windows

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 16.1 Page number: 554

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import ctypes\n", + "MessageBox = ctypes.windll.user32.MessageBoxW\n", + "MessageBox(None, 'Hello', 'Title', 0)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 1, + "text": [ + "1" + ] + }, + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 2, + "text": [ + "1" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] } \ No newline at end of file diff --git a/Let_us_C/chapter-17.ipynb b/Let us C/chapter-17.ipynb similarity index 89% rename from Let_us_C/chapter-17.ipynb rename to Let us C/chapter-17.ipynb index ea406a32..b4ae7690 100644 --- a/Let_us_C/chapter-17.ipynb +++ b/Let us C/chapter-17.ipynb @@ -1,112 +1,113 @@ -{ - "metadata": { - "name": "chapter-17.ipynb" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Chapter 17: Windows Programming

" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Message Box, Page number: 563

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "from tkinter import *\n", - "\n", - "\n", - "#creating window\n", - "root = Tk()\n", - "root.title(\"Press Me\")\n", - "button1 = Button(root, text=\"Press Me\") #creating button\n", - "button1.pack()\n", - "import ctypes #creating message box\n", - "MessageBox = ctypes.windll.user32.MessageBoxW\n", - "MessageBox(None, 'Hi!', 'Waiting', 0)\n", - "root.mainloop()\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

More Windows, Page number: 566

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "from tkinter import *\n", - "root = []\n", - "#creating windows\n", - "for x in range(0,10):\n", - " root.append(Tk())\n", - " root[x].title(\"Press Me\")\n", - " button1 = Button(root[x], text=\"Press Me\") #creating button\n", - " button1.pack()\n", - " \n", - "import ctypes #creating message box\n", - "MessageBox = ctypes.windll.user32.MessageBoxW\n", - "MessageBox(None, 'Hi!', 'Waiting', 0)\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

A Real World Window, Page number: 568

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "from tkinter import *\n", - "\n", - "\n", - "class Example(Frame):\n", - " def __init__(self, parent):\n", - " Frame.__init__(self, parent)\n", - "\n", - " self.display = Canvas(self, width=700, height=200)\n", - " self.display.pack(side=\"top\", fill=\"both\", expand=True)\n", - " \n", - "if __name__ == \"__main__\":\n", - " root = Tk()\n", - " root.title(\"Title\")\n", - " Frame = Example(parent=root)\n", - " Frame.pack(side=\"top\", fill=\"both\", expand=True)\n", - " root.mainloop()\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] +{ + "metadata": { + "name": "", + "signature": "sha256:6150bfc1003739481860a14f71bf34ce4c550ec79e49fd6d2a81f2933c34367e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 17: Windows Programming

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 17.1 Page number: 563

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from tkinter import *\n", + "\n", + "\n", + "#creating window\n", + "root = Tk()\n", + "root.title(\"Press Me\")\n", + "button1 = Button(root, text=\"Press Me\") #creating button\n", + "button1.pack()\n", + "import ctypes #creating message box\n", + "MessageBox = ctypes.windll.user32.MessageBoxW\n", + "MessageBox(None, 'Hi!', 'Waiting', 0)\n", + "root.mainloop()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 17.2 Page number: 566

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from tkinter import *\n", + "root = []\n", + "#creating windows\n", + "for x in range(0,10):\n", + " root.append(Tk())\n", + " root[x].title(\"Press Me\")\n", + " button1 = Button(root[x], text=\"Press Me\") #creating button\n", + " button1.pack()\n", + " \n", + "import ctypes #creating message box\n", + "MessageBox = ctypes.windll.user32.MessageBoxW\n", + "MessageBox(None, 'Hi!', 'Waiting', 0)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 17.3 Page number: 568

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from tkinter import *\n", + "\n", + "\n", + "class Example(Frame):\n", + " def __init__(self, parent):\n", + " Frame.__init__(self, parent)\n", + "\n", + " self.display = Canvas(self, width=700, height=200)\n", + " self.display.pack(side=\"top\", fill=\"both\", expand=True)\n", + " \n", + "if __name__ == \"__main__\":\n", + " root = Tk()\n", + " root.title(\"Title\")\n", + " Frame = Example(parent=root)\n", + " Frame.pack(side=\"top\", fill=\"both\", expand=True)\n", + " root.mainloop()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] } \ No newline at end of file diff --git a/Let_us_C/chapter-18.ipynb b/Let us C/chapter-18.ipynb similarity index 92% rename from Let_us_C/chapter-18.ipynb rename to Let us C/chapter-18.ipynb index 3aa35505..5911f37a 100644 --- a/Let_us_C/chapter-18.ipynb +++ b/Let us C/chapter-18.ipynb @@ -1,255 +1,256 @@ -{ - "metadata": { - "name": "chapter-18.ipynb" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Chapter 18: Graphics Under Windows

" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Hello Windows, Page number: 582

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "from tkinter import *\n", - "\n", - "\n", - "class Example(Frame):\n", - " def __init__(self, parent):\n", - " Frame.__init__(self, parent)\n", - "\n", - " self.display = Canvas(self, width=700, height=200)\n", - " self.display.pack(side=\"top\", fill=\"both\", expand=True)\n", - " self.display.create_text(10, 10, fill = \"blue\",text = \"Hello Windows\", font=\"Arial 20 italic\",\n", - " anchor=\"nw\")\n", - " self.display.create_text(10, 50, fill = \"blue\",text = \"Hello Windows\", font=\"TimesNewRoman 30 italic\",\n", - " anchor=\"nw\")\n", - " self.display.create_text(10, 100, fill = \"blue\",text = \"Hello Windows\", font=\"ComicSansMS 40 italic\",\n", - " anchor=\"nw\")\n", - "\n", - "if __name__ == \"__main__\":\n", - " root = Tk()\n", - " root.title(\"Text\")\n", - " Frame = Example(parent=root)\n", - " Frame.pack(side=\"top\", fill=\"both\", expand=True)\n", - " root.mainloop()\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Drawing Shapes, Page number: 587

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "from tkinter import *\n", - "\n", - "\n", - "top = Tk()\n", - "top.title(\"Shapes\")\n", - "C = Canvas(top, height=500, width=500)\n", - "rcoor = 10,20,200,100\n", - "rect = C.create_rectangle(rcoor,fill=\"blue\")#rectangle\n", - "ecoor = 10,280,200,380\n", - "ellipse = C.create_oval(ecoor,fill = \"blue\")#ellipse\n", - "picoor = 250,0,350,100\n", - "pie = C.create_arc(picoor, start=300, extent=100, fill=\"blue\")#pie\n", - "pocoor = 250, 150, 250, 300, 300, 350, 400, 300, 320, 190\n", - "polygon = C.create_polygon(pocoor,fill=\"blue\")#polygon\n", - "#roundedrectangle\n", - "c1= C.create_arc(155,115,195,150,start=320, extent=80, fill=\"blue\",outline=\"blue\")\n", - "c2= C.create_arc(155,208,195,243,start=320, extent=80, fill=\"blue\",outline=\"blue\")\n", - "c3= C.create_arc(25,118,60,153,start=100, extent=150, fill=\"blue\",outline=\"blue\")\n", - "c4= C.create_arc(25,207,60,242,start=100, extent=150, fill=\"blue\",outline=\"blue\")\n", - "roundrect = C.create_rectangle(30,120,190,240,fill=\"blue\",outline=\"blue\")\n", - "C.pack()\n", - "top.mainloop()" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Pen Styles, Page number: 590

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "from tkinter import *\n", - "\n", - "\n", - "top = Tk()\n", - "top.title(\"Pen styles\")\n", - "C = Canvas(top, height=100, width=500)\n", - "l1 = C.create_line(0,10,500,10,fill=\"red\",dash=(5)) #dashed line\n", - "l2 = C.create_line(0,30,500,30,fill=\"red\",dash=(1)) #dotted line\n", - "l3 = C.create_line(0,50,500,50,fill=\"red\",dash=(5,1,1,1)) #dash dot\n", - "l4 = C.create_line(0,70,500,70,fill=\"red\",dash=(5,1,1,1,1)) #dash dot dot\n", - "l5 = C.create_line(0,90,500,90,fill=\"red\",width=4) #solid line\n", - "C.pack()\n", - "top.mainloop()\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Types of Brushes, Page number: 592

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import sys\n", - "from PyQt4 import QtGui, QtCore\n", - "\n", - "\n", - "class Example(QtGui.QWidget):\n", - " \n", - " def __init__(self):\n", - " super(Example, self).__init__()\n", - " \n", - " self.initUI()\n", - " \n", - " def initUI(self): \n", - "\n", - " self.setGeometry(300, 300, 355, 280)\n", - " self.setWindowTitle('Brush Styles')\n", - " self.show()\n", - "\n", - " def paintEvent(self, e):\n", - "\n", - " qp = QtGui.QPainter()\n", - " qp.begin(self)\n", - " self.drawBrushes(qp)\n", - " qp.end()\n", - " \n", - " def drawBrushes(self, qp):\n", - " \n", - " brush = QtGui.QBrush(QtCore.Qt.SolidPattern)\n", - " qp.setBrush(brush)\n", - " qp.drawRect(10, 15, 90, 60)\n", - "\n", - " brush.setStyle(QtCore.Qt.CrossPattern)\n", - " qp.setBrush(brush)\n", - " qp.drawRect(130, 15, 90, 60)\n", - "\n", - " \n", - " image = QtGui.QImage(\"C:/Users/Public/Pictures/Sample Pictures/Chrysanthemum.jpg\")\n", - " brush.setTextureImage (image)\n", - " qp.setBrush(brush)\n", - " qp.drawRect(250, 15, 90, 60)\n", - "\n", - " \n", - " \n", - " \n", - "def main():\n", - " \n", - " app = QtGui.QApplication(sys.argv)\n", - " ex = Example()\n", - " sys.exit(app.exec_())\n", - "\n", - "\n", - "if __name__ == '__main__':\n", - " main()\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Displaying a Bitmap, Page number: 605

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "from tkinter import *\n", - "\n", - "\n", - "top = Tk()\n", - "top.title(\"Pen styles\")\n", - "C = Canvas(top, height=300, width=500)\n", - "filename = PhotoImage(file = \"C:/Users/Akshatha M/Desktop/dialog1.gif\")\n", - "image = C.create_image(50, 50, anchor=NE, image=filename)\n", - "C.pack()\n", - "top.mainloop()\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Animation at Work, Page number: 608

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "from visual import *\n", - "\n", - "floor = box(length=4, height=0.5, width=4, color=color.blue)\n", - "\n", - "ball = sphere(pos=(0,4,0), color=color.red)\n", - "ball.velocity = vector(0,-1,0)\n", - "\n", - "dt = 0.01\n", - "while 1:\n", - " rate(100)\n", - " ball.pos = ball.pos + ball.velocity*dt\n", - " if ball.y < 1:\n", - " ball.velocity.y = -ball.velocity.y\n", - " else:\n", - " ball.velocity.y = ball.velocity.y - 9.8*dt\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] +{ + "metadata": { + "name": "", + "signature": "sha256:035bb57771a4e676fbffba92c85e10e1964ff3cc0e61084caf18587a884a3fc2" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 18: Graphics Under Windows

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.1 Page number: 582

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from tkinter import *\n", + "\n", + "\n", + "class Example(Frame):\n", + " def __init__(self, parent):\n", + " Frame.__init__(self, parent)\n", + "\n", + " self.display = Canvas(self, width=700, height=200)\n", + " self.display.pack(side=\"top\", fill=\"both\", expand=True)\n", + " self.display.create_text(10, 10, fill = \"blue\",text = \"Hello Windows\", font=\"Arial 20 italic\",\n", + " anchor=\"nw\")\n", + " self.display.create_text(10, 50, fill = \"blue\",text = \"Hello Windows\", font=\"TimesNewRoman 30 italic\",\n", + " anchor=\"nw\")\n", + " self.display.create_text(10, 100, fill = \"blue\",text = \"Hello Windows\", font=\"ComicSansMS 40 italic\",\n", + " anchor=\"nw\")\n", + "\n", + "if __name__ == \"__main__\":\n", + " root = Tk()\n", + " root.title(\"Text\")\n", + " Frame = Example(parent=root)\n", + " Frame.pack(side=\"top\", fill=\"both\", expand=True)\n", + " root.mainloop()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.2 Page number: 587

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from tkinter import *\n", + "\n", + "\n", + "top = Tk()\n", + "top.title(\"Shapes\")\n", + "C = Canvas(top, height=500, width=500)\n", + "rcoor = 10,20,200,100\n", + "rect = C.create_rectangle(rcoor,fill=\"blue\")#rectangle\n", + "ecoor = 10,280,200,380\n", + "ellipse = C.create_oval(ecoor,fill = \"blue\")#ellipse\n", + "picoor = 250,0,350,100\n", + "pie = C.create_arc(picoor, start=300, extent=100, fill=\"blue\")#pie\n", + "pocoor = 250, 150, 250, 300, 300, 350, 400, 300, 320, 190\n", + "polygon = C.create_polygon(pocoor,fill=\"blue\")#polygon\n", + "#roundedrectangle\n", + "c1= C.create_arc(155,115,195,150,start=320, extent=80, fill=\"blue\",outline=\"blue\")\n", + "c2= C.create_arc(155,208,195,243,start=320, extent=80, fill=\"blue\",outline=\"blue\")\n", + "c3= C.create_arc(25,118,60,153,start=100, extent=150, fill=\"blue\",outline=\"blue\")\n", + "c4= C.create_arc(25,207,60,242,start=100, extent=150, fill=\"blue\",outline=\"blue\")\n", + "roundrect = C.create_rectangle(30,120,190,240,fill=\"blue\",outline=\"blue\")\n", + "C.pack()\n", + "top.mainloop()" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.3 Page number: 590

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from tkinter import *\n", + "\n", + "\n", + "top = Tk()\n", + "top.title(\"Pen styles\")\n", + "C = Canvas(top, height=100, width=500)\n", + "l1 = C.create_line(0,10,500,10,fill=\"red\",dash=(5)) #dashed line\n", + "l2 = C.create_line(0,30,500,30,fill=\"red\",dash=(1)) #dotted line\n", + "l3 = C.create_line(0,50,500,50,fill=\"red\",dash=(5,1,1,1)) #dash dot\n", + "l4 = C.create_line(0,70,500,70,fill=\"red\",dash=(5,1,1,1,1)) #dash dot dot\n", + "l5 = C.create_line(0,90,500,90,fill=\"red\",width=4) #solid line\n", + "C.pack()\n", + "top.mainloop()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.4 Page number: 592

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import sys\n", + "from PyQt4 import QtGui, QtCore\n", + "\n", + "\n", + "class Example(QtGui.QWidget):\n", + " \n", + " def __init__(self):\n", + " super(Example, self).__init__()\n", + " \n", + " self.initUI()\n", + " \n", + " def initUI(self): \n", + "\n", + " self.setGeometry(300, 300, 355, 280)\n", + " self.setWindowTitle('Brush Styles')\n", + " self.show()\n", + "\n", + " def paintEvent(self, e):\n", + "\n", + " qp = QtGui.QPainter()\n", + " qp.begin(self)\n", + " self.drawBrushes(qp)\n", + " qp.end()\n", + " \n", + " def drawBrushes(self, qp):\n", + " \n", + " brush = QtGui.QBrush(QtCore.Qt.SolidPattern)\n", + " qp.setBrush(brush)\n", + " qp.drawRect(10, 15, 90, 60)\n", + "\n", + " brush.setStyle(QtCore.Qt.CrossPattern)\n", + " qp.setBrush(brush)\n", + " qp.drawRect(130, 15, 90, 60)\n", + "\n", + " \n", + " image = QtGui.QImage(\"C:/Users/Public/Pictures/Sample Pictures/Chrysanthemum.jpg\")\n", + " brush.setTextureImage (image)\n", + " qp.setBrush(brush)\n", + " qp.drawRect(250, 15, 90, 60)\n", + "\n", + " \n", + " \n", + " \n", + "def main():\n", + " \n", + " app = QtGui.QApplication(sys.argv)\n", + " ex = Example()\n", + " sys.exit(app.exec_())\n", + "\n", + "\n", + "if __name__ == '__main__':\n", + " main()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.5 Page number: 605

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from tkinter import *\n", + "\n", + "\n", + "top = Tk()\n", + "top.title(\"Pen styles\")\n", + "C = Canvas(top, height=300, width=500)\n", + "filename = PhotoImage(file = \"C:/Users/Akshatha M/Desktop/dialog1.gif\")\n", + "image = C.create_image(50, 50, anchor=NE, image=filename)\n", + "C.pack()\n", + "top.mainloop()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 18.6 Page number: 608

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from visual import *\n", + "\n", + "floor = box(length=4, height=0.5, width=4, color=color.blue)\n", + "\n", + "ball = sphere(pos=(0,4,0), color=color.red)\n", + "ball.velocity = vector(0,-1,0)\n", + "\n", + "dt = 0.01\n", + "while 1:\n", + " rate(100)\n", + " ball.pos = ball.pos + ball.velocity*dt\n", + " if ball.y < 1:\n", + " ball.velocity.y = -ball.velocity.y\n", + " else:\n", + " ball.velocity.y = ball.velocity.y - 9.8*dt\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] } \ No newline at end of file diff --git a/Let_us_C/chapter-2.ipynb b/Let us C/chapter-2.ipynb similarity index 98% rename from Let_us_C/chapter-2.ipynb rename to Let us C/chapter-2.ipynb index b7409b44..2e54e83c 100644 --- a/Let_us_C/chapter-2.ipynb +++ b/Let us C/chapter-2.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:2995e92c707106426a9edd38d59fc05e81394353c5d1739975459edb98accea9" + "signature": "sha256:4ad8cbca4454ee7f8d6b25a7cc86ebf15f8e3e308a85ba2aae557015f72740a0" }, "nbformat": 3, "nbformat_minor": 0, @@ -19,7 +19,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

If Demo , Page number: 52

" + "

Example 2.1 Page number: 52

" ] }, { @@ -54,7 +54,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Example 2.1 , Page number: 53

" + "

Example 2.2 , Page number: 53

" ] }, { @@ -184,7 +184,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Nested If-else , Page number: 61

" + "

Example 2.4 , Page number: 61

" ] }, { diff --git a/Let_us_C/chapter-20.ipynb b/Let us C/chapter-20.ipynb similarity index 86% rename from Let_us_C/chapter-20.ipynb rename to Let us C/chapter-20.ipynb index 16c8fdc8..cd572cb4 100644 --- a/Let_us_C/chapter-20.ipynb +++ b/Let us C/chapter-20.ipynb @@ -1,175 +1,174 @@ -{ - "metadata": { - "name": "chapter-20.ipynb" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Chapter 20: C Under Linux

" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Fork , Page number: 655

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import os\n", - "\n", - "print \"Before Forking\" \n", - "child = os.fork() #create a child process\n", - "print \"After Forking\\n\" \n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [], - "prompt_number": 7 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Creating a Child Process , Page number: 656

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import os\n", - "\n", - "pid = os.fork()\n", - "if pid == 0:\n", - " print \"In child process\" # code to play animated GIF file\n", - "else:\n", - " print \"In parent process\" #code to copy file \n", - " \n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

PID of Parent And Child Processes , Page number: 657

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import os\n", - "from multiprocessing import Process\n", - "\n", - "if __name__ == '__main__':\n", - " ppid=os.getpid()\n", - " p = Process()\n", - " p.start()\n", - " cid = os.getpid()\n", - " \n", - "\n", - "if (cid):\n", - " print (\"Child : Hello I am the child process\")\n", - " print (\"Child : Child\u2019s PID: \", os.getpid( ) )\n", - " print (\"Child : Parent\u2019s PID: \", os.getppid( ) )\n", - "else:\n", - " print (\"Parent : Hello I am the parent process\" )\n", - " print (\"Parent : Parent\u2019s PID: \", os.getpid( ) )\n", - " print (\"Parent : Child\u2019s PID: \", cid )\n", - "\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Execl , Page number: 659

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import os\n", - "\n", - "\n", - "pid = os.fork()\n", - "if pid == 0:\n", - " os.execl ( \"/bin/ls\",\"-al\", \"/etc\", NULL ) \n", - " print \"Child: After exec( )\"\n", - "else:\n", - " print \"Parent process\"" - ], - "language": "python", - "metadata": {}, - "outputs": [], - "prompt_number": "*" - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Waitpid , Page number: 662

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import os\n", - "\n", - "i = 0 \n", - "pid = os.fork( ) \n", - "if ( pid == 0 ):\n", - " while ( i < 4294967295 ):\n", - " i=i+1\n", - " print \"The child is now terminating\" \n", - "else:\n", - " os.waitpid ( pid, status, 0 )\n", - " if ( os.WIFEXITED ( status ) ):\n", - " print \"Parent: Child terminated normally\" \n", - " else:\n", - " print \"Parent: Child terminated abnormally\" \n" - ], - "language": "python", - "metadata": {}, - "outputs": [], - "prompt_number": "*" - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] +{ + "metadata": { + "name": "", + "signature": "sha256:487f1ed20d6e347b5683ab8c8485daef580038838dab420f2e9ad4054a0bdb13" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 20: C Under Linux

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.1 Page number: 655

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import os\n", + "\n", + "print \"Before Forking\" \n", + "child = os.fork() #create a child process\n", + "print \"After Forking\\n\" \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.2 Page number: 656

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import os\n", + "\n", + "pid = os.fork()\n", + "if pid == 0:\n", + " print \"In child process\" # code to play animated GIF file\n", + "else:\n", + " print \"In parent process\" #code to copy file \n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.3 Page number: 657

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import os\n", + "from multiprocessing import Process\n", + "\n", + "if __name__ == '__main__':\n", + " ppid=os.getpid()\n", + " p = Process()\n", + " p.start()\n", + " cid = os.getpid()\n", + " \n", + "\n", + "if (cid):\n", + " print (\"Child : Hello I am the child process\")\n", + " print (\"Child : Child\u2019s PID: \", os.getpid( ) )\n", + " print (\"Child : Parent\u2019s PID: \", os.getppid( ) )\n", + "else:\n", + " print (\"Parent : Hello I am the parent process\" )\n", + " print (\"Parent : Parent\u2019s PID: \", os.getpid( ) )\n", + " print (\"Parent : Child\u2019s PID: \", cid )\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.4 Page number: 659

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import os\n", + "\n", + "\n", + "pid = os.fork()\n", + "if pid == 0:\n", + " os.execl ( \"/bin/ls\",\"-al\", \"/etc\", NULL ) \n", + " print \"Child: After exec( )\"\n", + "else:\n", + " print \"Parent process\"" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 20.5 Page number: 662

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import os\n", + "\n", + "i = 0 \n", + "pid = os.fork( ) \n", + "if ( pid == 0 ):\n", + " while ( i < 4294967295 ):\n", + " i=i+1\n", + " print \"The child is now terminating\" \n", + "else:\n", + " os.waitpid ( pid, status, 0 )\n", + " if ( os.WIFEXITED ( status ) ):\n", + " print \"Parent: Child terminated normally\" \n", + " else:\n", + " print \"Parent: Child terminated abnormally\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] } \ No newline at end of file diff --git a/Let_us_C/chapter-21.ipynb b/Let us C/chapter-21.ipynb similarity index 90% rename from Let_us_C/chapter-21.ipynb rename to Let us C/chapter-21.ipynb index 9883bc71..a15c33a7 100644 --- a/Let_us_C/chapter-21.ipynb +++ b/Let us C/chapter-21.ipynb @@ -1,219 +1,220 @@ -{ - "metadata": { - "name": "chapter-21.ipynb" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Chapter 21: More Linux Programming

" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

SIGINT Example , Page number: 669

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import signal, os\n", - "\n", - "def sighandler ( signum,arg ):\n", - " print ( \"SIGINT received. Inside sighandler\" ) \n", - "\n", - "\n", - "signal.signal(signal.SIGINT,sighandler)\n", - "while ( 1 ):\n", - " print \"Program Running\" \n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Handling Multiple Signals , Page number: 671

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import signal, os\n", - "\n", - "def inthandler ( signum,arg ):\n", - " print \"SIGINT Received\" \n", - " \n", - "def termhandler ( signum ,arg):\n", - " print \"SIGTERM Received\" \n", - " \n", - "def conthandler ( signum,arg ):\n", - " print \"SIGCONT Received\" \n", - " \n", - "\n", - "signal.signal(signal.SIGINT,inthandler)\n", - "signal.signal(signal.SIGTERM,termhandler)\n", - "signal.signal(signal.SIGCONT,conthandler)\n", - "\n", - "while ( 1 ):\n", - " print \"Program Running\" " - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Registering A Common Handler , Page number: 673

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import signal, os\n", - "\n", - "def sighandler ( signum ,arg):\n", - " if(signum == SIGINT):\n", - " print \"SIGINT Received\" \n", - " elif(signum == SIGTERM):\n", - " print \"SIGTERM Received\" \n", - " elif(signum == SIGCONT):\n", - " print \"SIGCONT Received\" \n", - "\n", - "signal.signal(signal.SIGINT,sighandler)\n", - "signal.signal(signal.SIGTERM,sighandler)\n", - "signal.signal(signal.SIGCONT,sighandler)\n", - "\n", - "while ( 1 ):\n", - " print \"Program running\" \n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Blocking Signals , Page number: 675

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "import signal, os\n", - "\n", - "def sighandler ( signum ,arg):\n", - " if(signum == SIGINT):\n", - " print (\"SIGINT Received\") \n", - " elif(signum == SIGTERM):\n", - " print (\"SIGTERM Received\" )\n", - " elif(signum == SIGCONT):\n", - " print ( \"SIGCONT Received\" )\n", - "\n", - "buffer = \"\\0\"\n", - "signal.signal(signal.SIGINT,sighandler)\n", - "signal.signal(signal.SIGTERM,sighandler)\n", - "signal.signal(signal.SIGCONT,sighandler)\n", - "\n", - "signal.pthread_sigmask(signal.SIG_BLOCK, [])\n", - "\n", - "while ( buffer == \"\\0\" ):\n", - " buffer = input(\"Enter a string\")\n", - " print (buffer)\n", - "signal.pthread_sigmask(signal.SIG_UNBLOCK, [])\n", - "while(1):\n", - " print(\"Program running\")\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Event Driven Programming , Page number: 678

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "from tkinter import *\n", - "\n", - "\n", - "class Example(Frame):\n", - " def __init__(self, parent):\n", - " Frame.__init__(self, parent)\n", - "\n", - " self.display = Canvas(self, width=700, height=200)\n", - " self.display.pack(side=\"top\", fill=\"both\", expand=True)\n", - " \n", - "if __name__ == \"__main__\":\n", - " root = Tk()\n", - " root.title(\"Sample Window\")\n", - " Frame = Example(parent=root)\n", - " Frame.pack(side=\"top\", fill=\"both\", expand=True)\n", - " root.mainloop()" - ], - "language": "python", - "metadata": {}, - "outputs": [] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

MyShapes , Page number: 681

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "from tkinter import *\n", - "\n", - "\n", - "top = Tk()\n", - "top.title(\"Sample Window\")\n", - "C = Canvas(top, height=500, width=500)\n", - "rcoor = 10,20,200,100\n", - "rect = C.create_rectangle(rcoor,fill=\"black\")#rectangle\n", - "picoor = 250,0,350,100\n", - "pie = C.create_arc(picoor, start=300, extent=100, fill=\"black\")#pie\n", - "pocoor = 250, 150, 250, 300, 300, 350, 400, 300, 320, 190\n", - "polygon = C.create_polygon(pocoor,fill=\"black\")#polygon\n", - "C.pack()\n", - "top.mainloop()\n" - ], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] +{ + "metadata": { + "name": "", + "signature": "sha256:5f7e061f54810fddda35d9e2fe6c5d087a2f5600b95121d75e0620035316a34f" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 21: More Linux Programming

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.1 Page number: 669

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import signal, os\n", + "\n", + "def sighandler ( signum,arg ):\n", + " print ( \"SIGINT received. Inside sighandler\" ) \n", + "\n", + "\n", + "signal.signal(signal.SIGINT,sighandler)\n", + "while ( 1 ):\n", + " print \"Program Running\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.2 Page number: 671

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import signal, os\n", + "\n", + "def inthandler ( signum,arg ):\n", + " print \"SIGINT Received\" \n", + " \n", + "def termhandler ( signum ,arg):\n", + " print \"SIGTERM Received\" \n", + " \n", + "def conthandler ( signum,arg ):\n", + " print \"SIGCONT Received\" \n", + " \n", + "\n", + "signal.signal(signal.SIGINT,inthandler)\n", + "signal.signal(signal.SIGTERM,termhandler)\n", + "signal.signal(signal.SIGCONT,conthandler)\n", + "\n", + "while ( 1 ):\n", + " print \"Program Running\" " + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.3 Page number: 673

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import signal, os\n", + "\n", + "def sighandler ( signum ,arg):\n", + " if(signum == SIGINT):\n", + " print \"SIGINT Received\" \n", + " elif(signum == SIGTERM):\n", + " print \"SIGTERM Received\" \n", + " elif(signum == SIGCONT):\n", + " print \"SIGCONT Received\" \n", + "\n", + "signal.signal(signal.SIGINT,sighandler)\n", + "signal.signal(signal.SIGTERM,sighandler)\n", + "signal.signal(signal.SIGCONT,sighandler)\n", + "\n", + "while ( 1 ):\n", + " print \"Program running\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.4 Page number: 675

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import signal, os\n", + "\n", + "def sighandler ( signum ,arg):\n", + " if(signum == SIGINT):\n", + " print (\"SIGINT Received\") \n", + " elif(signum == SIGTERM):\n", + " print (\"SIGTERM Received\" )\n", + " elif(signum == SIGCONT):\n", + " print ( \"SIGCONT Received\" )\n", + "\n", + "buffer = \"\\0\"\n", + "signal.signal(signal.SIGINT,sighandler)\n", + "signal.signal(signal.SIGTERM,sighandler)\n", + "signal.signal(signal.SIGCONT,sighandler)\n", + "\n", + "signal.pthread_sigmask(signal.SIG_BLOCK, [])\n", + "\n", + "while ( buffer == \"\\0\" ):\n", + " buffer = input(\"Enter a string\")\n", + " print (buffer)\n", + "signal.pthread_sigmask(signal.SIG_UNBLOCK, [])\n", + "while(1):\n", + " print(\"Program running\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.5, Page number: 678

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from tkinter import *\n", + "\n", + "\n", + "class Example(Frame):\n", + " def __init__(self, parent):\n", + " Frame.__init__(self, parent)\n", + "\n", + " self.display = Canvas(self, width=700, height=200)\n", + " self.display.pack(side=\"top\", fill=\"both\", expand=True)\n", + " \n", + "if __name__ == \"__main__\":\n", + " root = Tk()\n", + " root.title(\"Sample Window\")\n", + " Frame = Example(parent=root)\n", + " Frame.pack(side=\"top\", fill=\"both\", expand=True)\n", + " root.mainloop()" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 21.5 Page number: 681

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from tkinter import *\n", + "\n", + "\n", + "top = Tk()\n", + "top.title(\"Sample Window\")\n", + "C = Canvas(top, height=500, width=500)\n", + "rcoor = 10,20,200,100\n", + "rect = C.create_rectangle(rcoor,fill=\"black\")#rectangle\n", + "picoor = 250,0,350,100\n", + "pie = C.create_arc(picoor, start=300, extent=100, fill=\"black\")#pie\n", + "pocoor = 250, 150, 250, 300, 300, 350, 400, 300, 320, 190\n", + "polygon = C.create_polygon(pocoor,fill=\"black\")#polygon\n", + "C.pack()\n", + "top.mainloop()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] } \ No newline at end of file diff --git a/Let_us_C/chapter-3.ipynb b/Let us C/chapter-3.ipynb similarity index 91% rename from Let_us_C/chapter-3.ipynb rename to Let us C/chapter-3.ipynb index 5b3de0d9..982a060f 100644 --- a/Let_us_C/chapter-3.ipynb +++ b/Let us C/chapter-3.ipynb @@ -1,605 +1,606 @@ -{ - "metadata": { - "name": "chapter-3.ipynb" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Chapter 3: The Loop Control Structure

" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Simple Interest using While Loop, Page number: 99

\n" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Variable declaration\n", - "count = 1\n", - "pr = [1000,2000,3500]\n", - "yr = [5,5,5]\n", - "intr = [13.5,13.5,3.5]\n", - "\n", - "# while loop\n", - "while count <= 3:\n", - " #Input from the user\n", - " #p,n,r = raw_input(\"Enter values of p, n and r : \").split()\n", - " p = pr[count-1] # principle\n", - " n = yr[count-1] # number of years\n", - " r = intr[count-1]# rate of interest\n", - "\n", - " #Calculation\n", - " si = p * n * r / 100 ; #formula for simple interest\n", - "\n", - " #Result\n", - " print \"Simple interest = Rs.\",si \n", - "\n", - " #Increment count\n", - " count = count + 1\n", - " \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Simple interest = Rs. 675.0\n", - "Simple interest = Rs. 1350.0\n", - "Simple interest = Rs. 612.5\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Simple Interest using For Loop , Page number: 109

\n" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "pr = [1000,2000,3500]\n", - "yr = [5,5,5]\n", - "intr = [13.5,13.5,3.5]\n", - "\n", - "#for loop\n", - "for count in range(1, 4):\n", - " #Input from the user\n", - " #p,n,r = raw_input(\"Enter values of p, n and r : \").split()\n", - " p = pr[count-1] # principle\n", - " n = yr[count-1] # number of years\n", - " r = intr[count-1]# rate of interest\n", - " \n", - " #Calculation\n", - " si = p * n * r / 100 ; #formula for simple interest\n", - "\n", - " #Result\n", - " print \"Simple interest = Rs.\",si " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Simple interest = Rs. 675.0\n", - "Simple interest = Rs. 1350.0\n", - "Simple interest = Rs. 612.5\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Nested For Loops , Page number: 114

\n" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#nested for loops\n", - "for r in range(1,4): #outer loop\n", - " for c in range(1,3): #inner loop\n", - " s = r + c #find the sum\n", - " print \"r = %d c = %d sum = %d\" % (r, c, s) #Display result\n", - " \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "r = 1 c = 1 sum = 2\n", - "r = 1 c = 2 sum = 3\n", - "r = 2 c = 1 sum = 3\n", - "r = 2 c = 2 sum = 4\n", - "r = 3 c = 1 sum = 4\n", - "r = 3 c = 2 sum = 5\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Do While Loop , Page number: 116

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#do while loop\n", - "while True:\n", - " #num = raw_input(\"Enter a number: \")\n", - " num = 11\n", - " print \"square of %d is %d\"%(num, num * num )\n", - " print \"Want to enter another number y/n: \" \n", - " another = 'n'\n", - " print another\n", - " if another == 'y':\n", - " continue\n", - " else:\n", - " break\n", - " " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "square of 11 is 121\n", - "Want to enter another number y/n: \n", - "n\n" - ] - } - ], - "prompt_number": 5 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Do While using For Loop, Page number: 117

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Variable declaration\n", - "another = 'y'\n", - "\n", - "#do while loop\n", - "import sys\n", - "for i in range(1,10000): #infinte loop\n", - " #num = raw_input(\"Enter a number: \")\n", - " num = 11\n", - " print \"square of %d is %d\"%(num, num * num )\n", - " print \"Want to enter another number y/n: \" \n", - " another = 'n'\n", - " print another\n", - " if another == 'y':\n", - " continue\n", - " else:\n", - " break\n", - " \n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "square of 11 is 121\n", - "Want to enter another number y/n: \n", - "n\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Do While using While Loop, Page number: 117

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Variable declaration\n", - "another = 'y'\n", - "\n", - "#do while loop\n", - "while another == 'y':\n", - " #num = raw_input(\"Enter a number: \")\n", - " num = 11\n", - " print \"square of %d is %d\"%(num, num * num )\n", - " print \"Want to enter another number y/n: \" \n", - " another = 'n'\n", - " print another\n", - " \n", - " \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "square of 11 is 121\n", - "Want to enter another number y/n: \n", - "n\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Prime Number, Page number: 118

\n" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Input from user\n", - "#num = raw_input(\"Enter a number: \")\n", - "num = 11\n", - "\n", - "#Variable declaration\n", - "i = 2\n", - "\n", - "#while loop\n", - "while i <=(num - 1):\n", - " if num % i == 0:\n", - " print \"Not a prime number\" #Display if not prime number\n", - " break\n", - " i += 1\n", - "\n", - "#Display if prime number\n", - "if i == num:\n", - " print \"Prime number\" " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Prime number\n" - ] - } - ], - "prompt_number": 9 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Break Statement , Page number: 119

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Variable declaration\n", - "i = 1\n", - "j = 1\n", - "\n", - "#while loops\n", - "while i <= 100 : #outer loop\n", - " i = i+1\n", - " while j <= 200 : #inner loop\n", - " j = j+1\n", - " if j == 150:\n", - " break #break statement in inner loop\n", - " else:\n", - " print i, j \n", - " \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "2 2\n", - "2 3\n", - "2 4\n", - "2 5\n", - "2 6\n", - "2 7\n", - "2 8\n", - "2 9\n", - "2 10\n", - "2 11\n", - "2 12\n", - "2 13\n", - "2 14\n", - "2 15\n", - "2 16\n", - "2 17\n", - "2 18\n", - "2 19\n", - "2 20\n", - "2 21\n", - "2 22\n", - "2 23\n", - "2 24\n", - "2 25\n", - "2 26\n", - "2 27\n", - "2 28\n", - "2 29\n", - "2 30\n", - "2 31\n", - "2 32\n", - "2 33\n", - "2 34\n", - "2 35\n", - "2 36\n", - "2 37\n", - "2 38\n", - "2 39\n", - "2 40\n", - "2 41\n", - "2 42\n", - "2 43\n", - "2 44\n", - "2 45\n", - "2 46\n", - "2 47\n", - "2 48\n", - "2 49\n", - "2 50\n", - "2 51\n", - "2 52\n", - "2 53\n", - "2 54\n", - "2 55\n", - "2 56\n", - "2 57\n", - "2 58\n", - "2 59\n", - "2 60\n", - "2 61\n", - "2 62\n", - "2 63\n", - "2 64\n", - "2 65\n", - "2 66\n", - "2 67\n", - "2 68\n", - "2 69\n", - "2 70\n", - "2 71\n", - "2 72\n", - "2 73\n", - "2 74\n", - "2 75\n", - "2 76\n", - "2 77\n", - "2 78\n", - "2 79\n", - "2 80\n", - "2 81\n", - "2 82\n", - "2 83\n", - "2 84\n", - "2 85\n", - "2 86\n", - "2 87\n", - "2 88\n", - "2 89\n", - "2 90\n", - "2 91\n", - "2 92\n", - "2 93\n", - "2 94\n", - "2 95\n", - "2 96\n", - "2 97\n", - "2 98\n", - "2 99\n", - "2 100\n", - "2 101\n", - "2 102\n", - "2 103\n", - "2 104\n", - "2 105\n", - "2 106\n", - "2 107\n", - "2 108\n", - "2 109\n", - "2 110\n", - "2 111\n", - "2 112\n", - "2 113\n", - "2 114\n", - "2 115\n", - "2 116\n", - "2 117\n", - "2 118\n", - "2 119\n", - "2 120\n", - "2 121\n", - "2 122\n", - "2 123\n", - "2 124\n", - "2 125\n", - "2 126\n", - "2 127\n", - "2 128\n", - "2 129\n", - "2 130\n", - "2 131\n", - "2 132\n", - "2 133\n", - "2 134\n", - "2 135\n", - "2 136\n", - "2 137\n", - "2 138\n", - "2 139\n", - "2 140\n", - "2 141\n", - "2 142\n", - "2 143\n", - "2 144\n", - "2 145\n", - "2 146\n", - "2 147\n", - "2 148\n", - "2 149\n", - "3 151\n", - "3 152\n", - "3 153\n", - "3 154\n", - "3 155\n", - "3 156\n", - "3 157\n", - "3 158\n", - "3 159\n", - "3 160\n", - "3 161\n", - "3 162\n", - "3 163\n", - "3 164\n", - "3 165\n", - "3 166\n", - "3 167\n", - "3 168\n", - "3 169\n", - "3 170\n", - "3 171\n", - "3 172\n", - "3 173\n", - "3 174\n", - "3 175\n", - "3 176\n", - "3 177\n", - "3 178\n", - "3 179\n", - "3 180\n", - "3 181\n", - "3 182\n", - "3 183\n", - "3 184\n", - "3 185\n", - "3 186\n", - "3 187\n", - "3 188\n", - "3 189\n", - "3 190\n", - "3 191\n", - "3 192\n", - "3 193\n", - "3 194\n", - "3 195\n", - "3 196\n", - "3 197\n", - "3 198\n", - "3 199\n", - "3 200\n", - "3 201\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Continue Statement , Page number: 120

\n" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#for loops\n", - "for i in range(1,3):\n", - " for j in range(1,3):\n", - " if i==j :\n", - " continue # continue statement\n", - " print i , j\n", - " \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "1 2\n", - "2 1\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] +{ + "metadata": { + "name": "", + "signature": "sha256:e147e526b8360f20abf1c770522594e0e591d931974c1242dac8869eb1e499e3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 3: The Loop Control Structure

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.1Page number: 99

\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "count = 1\n", + "pr = [1000,2000,3500]\n", + "yr = [5,5,5]\n", + "intr = [13.5,13.5,3.5]\n", + "\n", + "# while loop\n", + "while count <= 3:\n", + " #Input from the user\n", + " #p,n,r = raw_input(\"Enter values of p, n and r : \").split()\n", + " p = pr[count-1] # principle\n", + " n = yr[count-1] # number of years\n", + " r = intr[count-1]# rate of interest\n", + "\n", + " #Calculation\n", + " si = p * n * r / 100 ; #formula for simple interest\n", + "\n", + " #Result\n", + " print \"Simple interest = Rs.\",si \n", + "\n", + " #Increment count\n", + " count = count + 1\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Simple interest = Rs. 675.0\n", + "Simple interest = Rs. 1350.0\n", + "Simple interest = Rs. 612.5\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.2 Page number: 109

\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "pr = [1000,2000,3500]\n", + "yr = [5,5,5]\n", + "intr = [13.5,13.5,3.5]\n", + "\n", + "#for loop\n", + "for count in range(1, 4):\n", + " #Input from the user\n", + " #p,n,r = raw_input(\"Enter values of p, n and r : \").split()\n", + " p = pr[count-1] # principle\n", + " n = yr[count-1] # number of years\n", + " r = intr[count-1]# rate of interest\n", + " \n", + " #Calculation\n", + " si = p * n * r / 100 ; #formula for simple interest\n", + "\n", + " #Result\n", + " print \"Simple interest = Rs.\",si " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Simple interest = Rs. 675.0\n", + "Simple interest = Rs. 1350.0\n", + "Simple interest = Rs. 612.5\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.3 Page number: 114

\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#nested for loops\n", + "for r in range(1,4): #outer loop\n", + " for c in range(1,3): #inner loop\n", + " s = r + c #find the sum\n", + " print \"r = %d c = %d sum = %d\" % (r, c, s) #Display result\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "r = 1 c = 1 sum = 2\n", + "r = 1 c = 2 sum = 3\n", + "r = 2 c = 1 sum = 3\n", + "r = 2 c = 2 sum = 4\n", + "r = 3 c = 1 sum = 4\n", + "r = 3 c = 2 sum = 5\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Do While Loop , Page number: 116

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#do while loop\n", + "while True:\n", + " #num = raw_input(\"Enter a number: \")\n", + " num = 11\n", + " print \"square of %d is %d\"%(num, num * num )\n", + " print \"Want to enter another number y/n: \" \n", + " another = 'n'\n", + " print another\n", + " if another == 'y':\n", + " continue\n", + " else:\n", + " break\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "square of 11 is 121\n", + "Want to enter another number y/n: \n", + "n\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.4 Page number: 117

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "another = 'y'\n", + "\n", + "#do while loop\n", + "import sys\n", + "for i in range(1,10000): #infinte loop\n", + " #num = raw_input(\"Enter a number: \")\n", + " num = 11\n", + " print \"square of %d is %d\"%(num, num * num )\n", + " print \"Want to enter another number y/n: \" \n", + " another = 'n'\n", + " print another\n", + " if another == 'y':\n", + " continue\n", + " else:\n", + " break\n", + " \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "square of 11 is 121\n", + "Want to enter another number y/n: \n", + "n\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.5 Page number: 117

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "another = 'y'\n", + "\n", + "#do while loop\n", + "while another == 'y':\n", + " #num = raw_input(\"Enter a number: \")\n", + " num = 11\n", + " print \"square of %d is %d\"%(num, num * num )\n", + " print \"Want to enter another number y/n: \" \n", + " another = 'n'\n", + " print another\n", + " \n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "square of 11 is 121\n", + "Want to enter another number y/n: \n", + "n\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.6 Page number: 118

\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Input from user\n", + "#num = raw_input(\"Enter a number: \")\n", + "num = 11\n", + "\n", + "#Variable declaration\n", + "i = 2\n", + "\n", + "#while loop\n", + "while i <=(num - 1):\n", + " if num % i == 0:\n", + " print \"Not a prime number\" #Display if not prime number\n", + " break\n", + " i += 1\n", + "\n", + "#Display if prime number\n", + "if i == num:\n", + " print \"Prime number\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Prime number\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.6 Page number: 119

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "i = 1\n", + "j = 1\n", + "\n", + "#while loops\n", + "while i <= 100 : #outer loop\n", + " i = i+1\n", + " while j <= 200 : #inner loop\n", + " j = j+1\n", + " if j == 150:\n", + " break #break statement in inner loop\n", + " else:\n", + " print i, j \n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "2 2\n", + "2 3\n", + "2 4\n", + "2 5\n", + "2 6\n", + "2 7\n", + "2 8\n", + "2 9\n", + "2 10\n", + "2 11\n", + "2 12\n", + "2 13\n", + "2 14\n", + "2 15\n", + "2 16\n", + "2 17\n", + "2 18\n", + "2 19\n", + "2 20\n", + "2 21\n", + "2 22\n", + "2 23\n", + "2 24\n", + "2 25\n", + "2 26\n", + "2 27\n", + "2 28\n", + "2 29\n", + "2 30\n", + "2 31\n", + "2 32\n", + "2 33\n", + "2 34\n", + "2 35\n", + "2 36\n", + "2 37\n", + "2 38\n", + "2 39\n", + "2 40\n", + "2 41\n", + "2 42\n", + "2 43\n", + "2 44\n", + "2 45\n", + "2 46\n", + "2 47\n", + "2 48\n", + "2 49\n", + "2 50\n", + "2 51\n", + "2 52\n", + "2 53\n", + "2 54\n", + "2 55\n", + "2 56\n", + "2 57\n", + "2 58\n", + "2 59\n", + "2 60\n", + "2 61\n", + "2 62\n", + "2 63\n", + "2 64\n", + "2 65\n", + "2 66\n", + "2 67\n", + "2 68\n", + "2 69\n", + "2 70\n", + "2 71\n", + "2 72\n", + "2 73\n", + "2 74\n", + "2 75\n", + "2 76\n", + "2 77\n", + "2 78\n", + "2 79\n", + "2 80\n", + "2 81\n", + "2 82\n", + "2 83\n", + "2 84\n", + "2 85\n", + "2 86\n", + "2 87\n", + "2 88\n", + "2 89\n", + "2 90\n", + "2 91\n", + "2 92\n", + "2 93\n", + "2 94\n", + "2 95\n", + "2 96\n", + "2 97\n", + "2 98\n", + "2 99\n", + "2 100\n", + "2 101\n", + "2 102\n", + "2 103\n", + "2 104\n", + "2 105\n", + "2 106\n", + "2 107\n", + "2 108\n", + "2 109\n", + "2 110\n", + "2 111\n", + "2 112\n", + "2 113\n", + "2 114\n", + "2 115\n", + "2 116\n", + "2 117\n", + "2 118\n", + "2 119\n", + "2 120\n", + "2 121\n", + "2 122\n", + "2 123\n", + "2 124\n", + "2 125\n", + "2 126\n", + "2 127\n", + "2 128\n", + "2 129\n", + "2 130\n", + "2 131\n", + "2 132\n", + "2 133\n", + "2 134\n", + "2 135\n", + "2 136\n", + "2 137\n", + "2 138\n", + "2 139\n", + "2 140\n", + "2 141\n", + "2 142\n", + "2 143\n", + "2 144\n", + "2 145\n", + "2 146\n", + "2 147\n", + "2 148\n", + "2 149\n", + "3 151\n", + "3 152\n", + "3 153\n", + "3 154\n", + "3 155\n", + "3 156\n", + "3 157\n", + "3 158\n", + "3 159\n", + "3 160\n", + "3 161\n", + "3 162\n", + "3 163\n", + "3 164\n", + "3 165\n", + "3 166\n", + "3 167\n", + "3 168\n", + "3 169\n", + "3 170\n", + "3 171\n", + "3 172\n", + "3 173\n", + "3 174\n", + "3 175\n", + "3 176\n", + "3 177\n", + "3 178\n", + "3 179\n", + "3 180\n", + "3 181\n", + "3 182\n", + "3 183\n", + "3 184\n", + "3 185\n", + "3 186\n", + "3 187\n", + "3 188\n", + "3 189\n", + "3 190\n", + "3 191\n", + "3 192\n", + "3 193\n", + "3 194\n", + "3 195\n", + "3 196\n", + "3 197\n", + "3 198\n", + "3 199\n", + "3 200\n", + "3 201\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.7 Page number: 120

\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#for loops\n", + "for i in range(1,3):\n", + " for j in range(1,3):\n", + " if i==j :\n", + " continue # continue statement\n", + " print i , j\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 2\n", + "2 1\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] } \ No newline at end of file diff --git a/Let_us_C/chapter-4.ipynb b/Let us C/chapter-4.ipynb similarity index 93% rename from Let_us_C/chapter-4.ipynb rename to Let us C/chapter-4.ipynb index fcd96271..c488dfac 100644 --- a/Let_us_C/chapter-4.ipynb +++ b/Let us C/chapter-4.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:7c22324d39011030a3b150073070e5711999d5a4173c27c085bd0e0ed1d76d18" + "signature": "sha256:c8478042e59a3d54e32751057a43d117ff35f9b16be09f867e56066844ab2887" }, "nbformat": 3, "nbformat_minor": 0, @@ -19,7 +19,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Switch - Case, Page number: 137

" + "

Example 4.1 Page number: 137

" ] }, { @@ -58,7 +58,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Switch - Case, Page number: 138

" + "

Example 4.2 Page number: 138

" ] }, { @@ -96,7 +96,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

The Tips and Traps a), Page number: 140

" + "

Example 4.3 a), Page number: 140

" ] }, { @@ -134,7 +134,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

The Tips and Traps b), Page number: 140

" + "

Example 4.3 b), Page number: 140

" ] }, { @@ -172,7 +172,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

The Tips and Traps c), Page number: 141

" + "

Example 4.3 c), Page number: 141

" ] }, { @@ -209,7 +209,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

The Tips and Traps e) , Page number: 143

" + "

Example 4.3 e) , Page number: 143

" ] }, { @@ -239,7 +239,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Goto , Page number: 146

" + "

Example 4.4 Page number: 146

" ] }, { @@ -273,7 +273,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Goto , Page number: 148

" + "

Example 4.5 Page number: 148

" ] }, { diff --git a/Let_us_C/chapter-5.ipynb b/Let us C/chapter-5.ipynb similarity index 93% rename from Let_us_C/chapter-5.ipynb rename to Let us C/chapter-5.ipynb index 2055e966..c50dfd4b 100644 --- a/Let_us_C/chapter-5.ipynb +++ b/Let us C/chapter-5.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:ff4108fd8429f13da3024f33c6733cc054cfdd0248ac7308786b7df9d4793937" + "signature": "sha256:cde73c3332261c4f108f542a465d0abde1aad6d0918f5a791acb014b3b2be45c" }, "nbformat": 3, "nbformat_minor": 0, @@ -19,7 +19,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Message Function, Page number: 159

" + "

Example 5.1 Page number: 159

" ] }, { @@ -52,7 +52,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Calling More Than One Funnction , Page number: 159

" + "

Example 5.2 Page number: 159

" ] }, { @@ -97,7 +97,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Function Calling Function, Page number: 161

" + "

Example 5.3 Page number: 161

" ] }, { @@ -145,7 +145,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Calsum Function , Page number: 166

" + "

Example 5.4 Page number: 166

" ] }, { @@ -191,7 +191,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Return Statement , Page number: 169

" + "

Example 5.4 Page number: 169

" ] }, { @@ -227,7 +227,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Formal Arguments, Page number: 170

" + "

Example 5.5 Page number: 170

" ] }, { @@ -262,7 +262,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Scope Rule of Functions , Page number: 171

" + "

Example 5.6 Page number: 171

" ] }, { @@ -297,7 +297,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Square Function , Page number: 176

" + "

Example 5.7 Page number: 176

" ] }, { @@ -340,7 +340,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Void Function , Page number: 177

" + "

Example 5.7 , Page number: 177

" ] }, { @@ -377,7 +377,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Address of a Variable , Page number: 180

" + "

Example 5.8 Page number: 180

" ] }, { @@ -410,7 +410,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Pointer Relations , Page number: 182

" + "

Example 5.9 Page number: 182

" ] }, { @@ -454,7 +454,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Pointer to Another Pointer , Page number: 184

" + "

Example 5.10 Page number: 184

" ] }, { @@ -509,7 +509,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Call By Value , Page number: 186

" + "

Example 5.11 Page number: 186

" ] }, { @@ -549,7 +549,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Call By Reference , Page number: 187

" + "

Example 5.12 Page number: 187

" ] }, { @@ -588,7 +588,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Area And Perimeter of a Circle , Page number: 188

" + "

Example 5.13 Page number: 188

" ] }, { @@ -633,7 +633,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Iterative Factorial Function , Page number: 190

" + "

Example 5.14 Page number: 190

" ] }, { @@ -677,7 +677,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Recursive Factorial Function, Page number: 191

" + "

Example 5.15 Page number: 191

" ] }, { @@ -722,7 +722,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Recursion Stack , Page number: 195

" + "

Example 5.16 Page number: 195

" ] }, { diff --git a/Let_us_C/chapter-6.ipynb b/Let us C/chapter-6.ipynb similarity index 95% rename from Let_us_C/chapter-6.ipynb rename to Let us C/chapter-6.ipynb index ff2bda1a..d22f7722 100644 --- a/Let_us_C/chapter-6.ipynb +++ b/Let us C/chapter-6.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:840b5b41a5ba5f473d9fd4f85395b35887d7b6a2fb119c03c9559a162f751aa0" + "signature": "sha256:0f4b9c66170fed211220a3bceb54ab397c991e487c78359a96da00ad9e81eacc" }, "nbformat": 3, "nbformat_minor": 0, @@ -19,7 +19,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

char Example, Page number: 218

" + "

Example 6.1 Page number: 218

" ] }, { @@ -50,7 +50,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Range of char, Page number: 218

" + "

Example 6.2 Page number: 218

" ] }, { @@ -346,7 +346,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Scope and Life of Automatic Variable, Page number: 225

\n" + "

Example 6.3 Page number: 225

\n" ] }, { @@ -392,7 +392,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Scope and Life of Automatic Variable, Page number: 226

\n" + "

Example 6.4 Page number: 226

\n" ] }, { @@ -440,7 +440,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Different Data Types, Page number: 220

" + "

Example 6.5 Page number: 220

" ] }, { @@ -495,7 +495,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Auto Increment, Page number: 228

" + "

Example 6.6 Page number: 228

" ] }, { @@ -533,7 +533,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Static Increment, Page number: 228

" + "

Example 6.6 Page number: 228

" ] }, { @@ -570,7 +570,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Static Storage Class, Page number: 229

" + "

Example 6.7 Page number: 229

" ] }, { @@ -604,7 +604,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

External Storage Class, Page number: 231

" + "

Example 6.7 Page number: 231

" ] }, { diff --git a/Let_us_C/chapter-7.ipynb b/Let us C/chapter-7.ipynb similarity index 89% rename from Let_us_C/chapter-7.ipynb rename to Let us C/chapter-7.ipynb index 960282bf..f18a3d5e 100644 --- a/Let_us_C/chapter-7.ipynb +++ b/Let us C/chapter-7.ipynb @@ -1,206 +1,207 @@ -{ - "metadata": { - "name": "chapter-7..ipynb" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Chapter 7: The C Preprocessor

" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Macro Expansion, Page number: 244

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Macro declaration\n", - "UPPER = 25\n", - "\n", - "for i in range(1,UPPER+1): #macro expansion\n", - " print(i)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n", - "2\n", - "3\n", - "4\n", - "5\n", - "6\n", - "7\n", - "8\n", - "9\n", - "10\n", - "11\n", - "12\n", - "13\n", - "14\n", - "15\n", - "16\n", - "17\n", - "18\n", - "19\n", - "20\n", - "21\n", - "22\n", - "23\n", - "24\n", - "25\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Macro Definition, Page number: 244

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Macro declaration\n", - "PI = 3.1415\n", - "\n", - "#Variable declaration\n", - "r = 6.25 \n", - "\n", - "#Calculation\n", - "area = PI * r * r\n", - "\n", - "#Result\n", - "print \"Area of circle = \", area \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Area of circle = 122.71484375\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Macros with Arguments, Page number: 248

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Macro declaration\n", - "def AREA(x): #define AREA(x) ( 3.14 * x * x )\n", - " return(3.14 * x * x )\n", - "\n", - "#Variable declaration\n", - "r1 = 6.25\n", - "r2 = 2.5\n", - "\n", - "#Result\n", - "a = AREA(r1)\n", - "print \"Area of circle = \", a \n", - "a = AREA(r2) \n", - "print \"Area of circle = \", a\n", - " \n", - "\n", - "\n", - "\n", - "\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Area of circle = 122.65625\n", - "Area of circle = 19.625\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Macros with Arguments, Page number: 249

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Macro declaration\n", - "def ISDIGIT(y): #define ISDIGIT(y) ( y >= 48 && y <= 57 )\n", - " return( y >= 48 and y <= 57 )\n", - "\n", - "#Input from user\n", - "#ch = raw_input(\"Enter any digit \")\n", - "ch = 'a'\n", - "\n", - "#Result\n", - "if ISDIGIT ( ch ):\n", - " print \"You entered a digit\" \n", - "else:\n", - " print \"Illegal input\" \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Illegal input\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] +{ + "metadata": { + "name": "", + "signature": "sha256:cb3c5cba9468e5b653c7481d43e9f39abf98e9af0a02b5f9451adfa62262fedd" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 7: The C Preprocessor

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.1 Page number: 244

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Macro declaration\n", + "UPPER = 25\n", + "\n", + "for i in range(1,UPPER+1): #macro expansion\n", + " print(i)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n", + "2\n", + "3\n", + "4\n", + "5\n", + "6\n", + "7\n", + "8\n", + "9\n", + "10\n", + "11\n", + "12\n", + "13\n", + "14\n", + "15\n", + "16\n", + "17\n", + "18\n", + "19\n", + "20\n", + "21\n", + "22\n", + "23\n", + "24\n", + "25\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.2 Page number: 244

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Macro declaration\n", + "PI = 3.1415\n", + "\n", + "#Variable declaration\n", + "r = 6.25 \n", + "\n", + "#Calculation\n", + "area = PI * r * r\n", + "\n", + "#Result\n", + "print \"Area of circle = \", area \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Area of circle = 122.71484375\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.4 Page number: 248

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Macro declaration\n", + "def AREA(x): #define AREA(x) ( 3.14 * x * x )\n", + " return(3.14 * x * x )\n", + "\n", + "#Variable declaration\n", + "r1 = 6.25\n", + "r2 = 2.5\n", + "\n", + "#Result\n", + "a = AREA(r1)\n", + "print \"Area of circle = \", a \n", + "a = AREA(r2) \n", + "print \"Area of circle = \", a\n", + " \n", + "\n", + "\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Area of circle = 122.65625\n", + "Area of circle = 19.625\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.5 Page number: 249

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Macro declaration\n", + "def ISDIGIT(y): #define ISDIGIT(y) ( y >= 48 && y <= 57 )\n", + " return( y >= 48 and y <= 57 )\n", + "\n", + "#Input from user\n", + "#ch = raw_input(\"Enter any digit \")\n", + "ch = 'a'\n", + "\n", + "#Result\n", + "if ISDIGIT ( ch ):\n", + " print \"You entered a digit\" \n", + "else:\n", + " print \"Illegal input\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Illegal input\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] } \ No newline at end of file diff --git a/Let_us_C/chapter-8.ipynb b/Let us C/chapter-8.ipynb similarity index 90% rename from Let_us_C/chapter-8.ipynb rename to Let us C/chapter-8.ipynb index 9467d28a..be034757 100644 --- a/Let_us_C/chapter-8.ipynb +++ b/Let us C/chapter-8.ipynb @@ -1,910 +1,911 @@ -{ - "metadata": { - "name": "chapter-8.ipynb" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Chapter 8: Arrays

" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Average Marks, Page number: 272

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Variable declaration\n", - "s = 0\n", - "marks = [] # array declaration\n", - "\n", - "#for i in range(0,30):\n", - " # marks.append(int(raw_input(\"Enter marks: \" ))) # store data in array\n", - "marks = [89,85,57,25,90,45,87,48,98,12,39,66,75,30,87,100,5,78,56,99,84,0,39,79,93,61,87,45,90,56] \n", - "print \"Enter marks: \"\n", - "for i in range(0,30):\n", - " print marks[i]\n", - "\n", - "for i in range(0,30):\n", - " s = s + marks[i] # read data from array\n", - "\n", - "#Calculation\n", - "avg = s / 30 #Average formula\n", - "\n", - "#Result\n", - "print \"Average marks = \", avg \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter marks: \n", - "89\n", - "85\n", - "57\n", - "25\n", - "90\n", - "45\n", - "87\n", - "48\n", - "98\n", - "12\n", - "39\n", - "66\n", - "75\n", - "30\n", - "87\n", - "100\n", - "5\n", - "78\n", - "56\n", - "99\n", - "84\n", - "0\n", - "39\n", - "79\n", - "93\n", - "61\n", - "87\n", - "45\n", - "90\n", - "56\n", - "Average marks = 63\n" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Call By Value, Page number: 277

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Funcion definition\n", - "def display(m):\n", - " print m \n", - " \n", - "#Variable declaration\n", - "marks = [ 55, 65, 75, 56, 78, 78, 90 ] #array\n", - "\n", - "for i in range(0,7):\n", - " display(marks[i]) #function call \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "55\n", - "65\n", - "75\n", - "56\n", - "78\n", - "78\n", - "90\n" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Call By Reference , Page number: 278

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Funcion definition\n", - "def display(n):\n", - " print n #return\n", - " \n", - "#Variable declaration\n", - "marks = [ 55, 65, 75, 56, 78, 78, 90 ] #array\n", - "\n", - "for i in range(0,7):\n", - " display(marks[i]) #function call\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "55\n", - "65\n", - "75\n", - "56\n", - "78\n", - "78\n", - "90\n" - ] - } - ], - "prompt_number": 7 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Pointer Arithmetic, Page number: 279

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Variable declaration\n", - "i = 3\n", - "j = 1.5\n", - "k = 'c'\n", - "\n", - "print \"Value of i = \", i \n", - "print \"Value of j = \", j \n", - "print \"Value of k = \", k \n", - "\n", - "#addresses of the variables\n", - "x = id(i)\n", - "y = id(j)\n", - "z = id(k)\n", - "\n", - "print \"Original address in x = \", x \n", - "print \"Original address in y = \", y \n", - "print \"Original address in z = \", z \n", - "\n", - "x += 2\n", - "y += 4\n", - "z += 1\n", - "\n", - "print \"New address in x = \", x \n", - "print \"New address in y = \", y \n", - "print \"New address in z = \", z \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Value of i = 3\n", - "Value of j = 1.5\n", - "Value of k = c\n", - "Original address in x = 32529512\n", - "Original address in y = 105587440\n", - "Original address in z = 32744192\n", - "New address in x = 32529514\n", - "New address in y = 105587444\n", - "New address in z = 32744193\n" - ] - } - ], - "prompt_number": 8 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Pointer Subtraction , Page number: 281

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Variable declaration\n", - "arr = [ 10, 20, 30, 45, 67, 56, 74 ]\n", - "i = id(arr[1]) #address \n", - "j = id(arr[5]) #Address\n", - "\n", - "#Result\n", - "print j - i, arr[5] - arr[1] \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "1128 36\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Pointer Comparison, Page number: 282

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Variable declaration\n", - "arr = [ 10, 20, 36, 72, 45, 36 ]\n", - "j = id(arr[ 4 ])\n", - "k = id( arr[0 + 4] )\n", - "\n", - "#Result \n", - "if j == k : #comparison\n", - " print \"The two pointers point to the same location\" \n", - "else:\n", - " print \"The two pointers do not point to the same location\" \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The two pointers point to the same location\n" - ] - } - ], - "prompt_number": 10 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Memory Locations, Page number: 283

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Variable declaration\n", - "num = [ 24, 34, 12, 44, 56, 17]\n", - "\n", - "#Result\n", - "for i in range(0,6):\n", - " print \"element no. \", i \n", - " print \"address = \", id(num[i]) \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "element no. 0\n", - "address = 32529008\n", - "element no. 1\n", - "address = 32528768\n", - "element no. 2\n", - "address = 32529296\n", - "element no. 3\n", - "address = 32530520\n", - "element no. 4\n", - "address = 32530232\n", - "element no. 5\n", - "address = 32529176\n" - ] - } - ], - "prompt_number": 11 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Accessing Array Elements , Page number: 284

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Variable declaration\n", - "num = [ 24, 34, 12, 44, 56, 17]\n", - "\n", - "#Result\n", - "for i in range(0,6):\n", - " print \"address = \", id(num[i]) \n", - " print \"element = \", num[i] \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "address = 32529008\n", - "element = 24\n", - "address = 32528768\n", - "element = 34\n", - "address = 32529296\n", - "element = 12\n", - "address = 32530520\n", - "element = 44\n", - "address = 32530232\n", - "element = 56\n", - "address = 32529176\n", - "element = 17\n" - ] - } - ], - "prompt_number": 12 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Accessing Array Elements Using Pointers, Page number: 284

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Variable declaration\n", - "num = [ 24, 34, 12, 44, 56, 17]\n", - "j = id(num[0]) # assign address of zeroth element\n", - "\n", - "#Result\n", - "for i in range(0,6):\n", - " print \"address = \", j \n", - " print \"element = \", num[i] \n", - " j = id(num[(i+1)%6]) # increment pointer to point to next location \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "address = 32529008\n", - "element = 24\n", - "address = 32528768\n", - "element = 34\n", - "address = 32529296\n", - "element = 12\n", - "address = 32530520\n", - "element = 44\n", - "address = 32530232\n", - "element = 56\n", - "address = 32529176\n", - "element = 17\n" - ] - } - ], - "prompt_number": 13 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Passing An Array to a Function , Page number: 286

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Variable declaration\n", - "num = [ 24, 34, 12, 44, 56, 17 ]\n", - "\n", - "#Function definition:\n", - "def display ( j,n ):\n", - " for i in range(0,n):\n", - " print \"element = \", j\n", - " j = num[(i+1)%n] #increment pointer to point to next element \n", - "\n", - "display ( num[0], 6 ) #function call\n", - "\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "element = 24\n", - "element = 34\n", - "element = 12\n", - "element = 44\n", - "element = 56\n", - "element = 17\n" - ] - } - ], - "prompt_number": 14 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Accessing Array Elements in Different Ways, Page number: 288

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Variable declaration\n", - "num = [ 24, 34, 12, 44, 56, 17]\n", - "\n", - "for i in range(0,6):\n", - " print \"address = \", id(num[i])\n", - " print \"element = \", num[i], num[(0+ i)]\n", - " print num[(i+0)], num[i] \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "address = 32529008\n", - "element = 24 24\n", - "24 24\n", - "address = 32528768\n", - "element = 34 34\n", - "34 34\n", - "address = 32529296\n", - "element = 12 12\n", - "12 12\n", - "address = 32530520\n", - "element = 44 44\n", - "44 44\n", - "address = 32530232\n", - "element = 56 56\n", - "56 56\n", - "address = 32529176\n", - "element = 17 17\n", - "17 17\n" - ] - } - ], - "prompt_number": 15 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Two Dimensional Array , Page number: 289

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Variable declaration\n", - "stud = [] #array\n", - "\n", - "#for i in range(0,4):\n", - " # stud.append((raw_input(\"Enter roll no and marks: \").split())) # storing data in the 2D array\n", - "\n", - "stud = [\"1 38\",\"2 78\",\"3 93\",\"4 48\"]\n", - "for i in range (0,4):\n", - " print \"Enter roll no and marks: \"\n", - " print stud[i]\n", - " \n", - "#Result\n", - "for i in range(0,4):\n", - " print stud[i][0],stud[i][1:] \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter roll no and marks: \n", - "1 38\n", - "Enter roll no and marks: \n", - "2 78\n", - "Enter roll no and marks: \n", - "3 93\n", - "Enter roll no and marks: \n", - "4 48\n", - "1 38\n", - "2 78\n", - "3 93\n", - "4 48\n" - ] - } - ], - "prompt_number": 19 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

2-D Array Demo , Page number: 293

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Variable declaration\n", - "s = [ [1234, 56 ], [ 1212, 33], [ 1434, 80 ], [ 1312, 78 ]]\n", - "\n", - "#Result\n", - "for i in range(0,4):\n", - " print \"Address of %d th 1-D array = %u\"%( i, id(s[i]) )\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Address of 0 th 1-D array = 134002248\n", - "Address of 1 th 1-D array = 134654472\n", - "Address of 2 th 1-D array = 134791816\n", - "Address of 3 th 1-D array = 134792008\n" - ] - } - ], - "prompt_number": 21 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Accessing 2-D Array Elements, Page number: 295

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Variable declaration\n", - "s = [ [ 1234, 56 ], [ 1212, 33 ], [ 1434, 80 ], [ 1312, 78 ] ]\n", - "\n", - "for i in range(0,4):\n", - " for j in range(0,2):\n", - " print s[i][j] \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "1234\n", - "56\n", - "1212\n", - "33\n", - "1434\n", - "80\n", - "1312\n", - "78\n" - ] - } - ], - "prompt_number": 22 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Pointer To An Array , Page number: 296

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Variable declaration\n", - "s = [ [ 1234, 56 ], [ 1212, 33 ], [ 1434, 80 ], [ 1312, 78 ]]\n", - "\n", - "#Result\n", - "for i in range(0,4):\n", - " p = s[i]\n", - " pint = p\n", - " print \"\\n\" \n", - " for j in range(0,2):\n", - " print pint[j] \n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "\n", - "\n", - "1234\n", - "56\n", - "\n", - "\n", - "1212\n", - "33\n", - "\n", - "\n", - "1434\n", - "80\n", - "\n", - "\n", - "1312\n", - "78\n" - ] - } - ], - "prompt_number": 23 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Passing 2-D Array To a Function , Page number: 297

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Variable declaration\n", - "a = [[1, 2, 3, 4] , [5, 6, 7, 8] , [9, 0, 1, 6 ]]\n", - "\n", - "#Function definitions\n", - "def display ( q, row, col ):\n", - " for i in range(0,row):\n", - " for j in range(0,col):\n", - " print q [ (i * col)%3][j]\n", - " print \"\\n\" \n", - " print \"\\n\" \n", - "\n", - "\n", - "def show ( q, row, col ):\n", - " for i in range(0,row):\n", - " p = q[i]\n", - " for j in range(0,col):\n", - " print p[j]\n", - " print \"\\n\" \n", - " print \"\\n\" \n", - "\n", - "def Print ( q, row, col ):\n", - " for i in range(0,row):\n", - " for j in range(0,col):\n", - " print q[i][j]\n", - " print \"\\n\" \n", - " print \"\\n\" \n", - " \n", - "#function calls\n", - "display ( a, 3, 4 ) \n", - "show ( a, 3, 4 ) \n", - "Print ( a, 3, 4 )\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "1\n", - "2\n", - "3\n", - "4\n", - "\n", - "\n", - "5\n", - "6\n", - "7\n", - "8\n", - "\n", - "\n", - "9\n", - "0\n", - "1\n", - "6\n", - "\n", - "\n", - "\n", - "\n", - "1\n", - "2\n", - "3\n", - "4\n", - "\n", - "\n", - "5\n", - "6\n", - "7\n", - "8\n", - "\n", - "\n", - "9\n", - "0\n", - "1\n", - "6\n", - "\n", - "\n", - "\n", - "\n", - "1\n", - "2\n", - "3\n", - "4\n", - "\n", - "\n", - "5\n", - "6\n", - "7\n", - "8\n", - "\n", - "\n", - "9\n", - "0\n", - "1\n", - "6\n", - "\n", - "\n", - "\n", - "\n" - ] - } - ], - "prompt_number": 25 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Array of Pointers , Page number: 300

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "from ctypes import *\n", - "\n", - "#Variable declaration\n", - "arr = [] # array of integer pointers \n", - "i = c_int(31)\n", - "j = c_int(5)\n", - "k = c_int(19)\n", - "l = c_int(71)\n", - "arr.append(pointer(i))\n", - "arr.append(pointer(j))\n", - "arr.append(pointer(k))\n", - "arr.append(pointer(l))\n", - "\n", - "for m in range(0,4):\n", - " print arr[m].contents " - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "c_long(31)\n", - "c_long(5)\n", - "c_long(19)\n", - "c_long(71)\n" - ] - } - ], - "prompt_number": 26 - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

Address Array , Page number: 301

" - ] - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "#Variable declaration\n", - "a = [ 0, 1, 2, 3, 4 ]\n", - "p = [ a[0], a[1], a[2], a[3], a[4] ]\n", - "\n", - "#Result\n", - "print p, id(p), id(id(p ) )\n" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "[0, 1, 2, 3, 4] 134794120 134005648\n" - ] - } - ], - "prompt_number": 29 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] +{ + "metadata": { + "name": "", + "signature": "sha256:ff6efc1b388a9dae6f26340014ec0d8e17db1c5b9c410af07ab801ec3099b7b4" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 8: Arrays

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.1 Page number: 272

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "s = 0\n", + "marks = [] # array declaration\n", + "\n", + "#for i in range(0,30):\n", + " # marks.append(int(raw_input(\"Enter marks: \" ))) # store data in array\n", + "marks = [89,85,57,25,90,45,87,48,98,12,39,66,75,30,87,100,5,78,56,99,84,0,39,79,93,61,87,45,90,56] \n", + "print \"Enter marks: \"\n", + "for i in range(0,30):\n", + " print marks[i]\n", + "\n", + "for i in range(0,30):\n", + " s = s + marks[i] # read data from array\n", + "\n", + "#Calculation\n", + "avg = s / 30 #Average formula\n", + "\n", + "#Result\n", + "print \"Average marks = \", avg \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter marks: \n", + "89\n", + "85\n", + "57\n", + "25\n", + "90\n", + "45\n", + "87\n", + "48\n", + "98\n", + "12\n", + "39\n", + "66\n", + "75\n", + "30\n", + "87\n", + "100\n", + "5\n", + "78\n", + "56\n", + "99\n", + "84\n", + "0\n", + "39\n", + "79\n", + "93\n", + "61\n", + "87\n", + "45\n", + "90\n", + "56\n", + "Average marks = 63\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.2 Page number: 277

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Funcion definition\n", + "def display(m):\n", + " print m \n", + " \n", + "#Variable declaration\n", + "marks = [ 55, 65, 75, 56, 78, 78, 90 ] #array\n", + "\n", + "for i in range(0,7):\n", + " display(marks[i]) #function call \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n", + "65\n", + "75\n", + "56\n", + "78\n", + "78\n", + "90\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.3 Page number: 278

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Funcion definition\n", + "def display(n):\n", + " print n #return\n", + " \n", + "#Variable declaration\n", + "marks = [ 55, 65, 75, 56, 78, 78, 90 ] #array\n", + "\n", + "for i in range(0,7):\n", + " display(marks[i]) #function call\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n", + "65\n", + "75\n", + "56\n", + "78\n", + "78\n", + "90\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.4 Page number: 279

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "i = 3\n", + "j = 1.5\n", + "k = 'c'\n", + "\n", + "print \"Value of i = \", i \n", + "print \"Value of j = \", j \n", + "print \"Value of k = \", k \n", + "\n", + "#addresses of the variables\n", + "x = id(i)\n", + "y = id(j)\n", + "z = id(k)\n", + "\n", + "print \"Original address in x = \", x \n", + "print \"Original address in y = \", y \n", + "print \"Original address in z = \", z \n", + "\n", + "x += 2\n", + "y += 4\n", + "z += 1\n", + "\n", + "print \"New address in x = \", x \n", + "print \"New address in y = \", y \n", + "print \"New address in z = \", z \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of i = 3\n", + "Value of j = 1.5\n", + "Value of k = c\n", + "Original address in x = 32529512\n", + "Original address in y = 105587440\n", + "Original address in z = 32744192\n", + "New address in x = 32529514\n", + "New address in y = 105587444\n", + "New address in z = 32744193\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.4 Page number: 281

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "arr = [ 10, 20, 30, 45, 67, 56, 74 ]\n", + "i = id(arr[1]) #address \n", + "j = id(arr[5]) #Address\n", + "\n", + "#Result\n", + "print j - i, arr[5] - arr[1] \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1128 36\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.5 Page number: 282

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "arr = [ 10, 20, 36, 72, 45, 36 ]\n", + "j = id(arr[ 4 ])\n", + "k = id( arr[0 + 4] )\n", + "\n", + "#Result \n", + "if j == k : #comparison\n", + " print \"The two pointers point to the same location\" \n", + "else:\n", + " print \"The two pointers do not point to the same location\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The two pointers point to the same location\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Memory Locations, Page number: 283

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "num = [ 24, 34, 12, 44, 56, 17]\n", + "\n", + "#Result\n", + "for i in range(0,6):\n", + " print \"element no. \", i \n", + " print \"address = \", id(num[i]) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "element no. 0\n", + "address = 32529008\n", + "element no. 1\n", + "address = 32528768\n", + "element no. 2\n", + "address = 32529296\n", + "element no. 3\n", + "address = 32530520\n", + "element no. 4\n", + "address = 32530232\n", + "element no. 5\n", + "address = 32529176\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.6 Page number: 284

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "num = [ 24, 34, 12, 44, 56, 17]\n", + "\n", + "#Result\n", + "for i in range(0,6):\n", + " print \"address = \", id(num[i]) \n", + " print \"element = \", num[i] \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "address = 32529008\n", + "element = 24\n", + "address = 32528768\n", + "element = 34\n", + "address = 32529296\n", + "element = 12\n", + "address = 32530520\n", + "element = 44\n", + "address = 32530232\n", + "element = 56\n", + "address = 32529176\n", + "element = 17\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.7 Page number: 284

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "num = [ 24, 34, 12, 44, 56, 17]\n", + "j = id(num[0]) # assign address of zeroth element\n", + "\n", + "#Result\n", + "for i in range(0,6):\n", + " print \"address = \", j \n", + " print \"element = \", num[i] \n", + " j = id(num[(i+1)%6]) # increment pointer to point to next location \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "address = 32529008\n", + "element = 24\n", + "address = 32528768\n", + "element = 34\n", + "address = 32529296\n", + "element = 12\n", + "address = 32530520\n", + "element = 44\n", + "address = 32530232\n", + "element = 56\n", + "address = 32529176\n", + "element = 17\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.8 Page number: 286

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "num = [ 24, 34, 12, 44, 56, 17 ]\n", + "\n", + "#Function definition:\n", + "def display ( j,n ):\n", + " for i in range(0,n):\n", + " print \"element = \", j\n", + " j = num[(i+1)%n] #increment pointer to point to next element \n", + "\n", + "display ( num[0], 6 ) #function call\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "element = 24\n", + "element = 34\n", + "element = 12\n", + "element = 44\n", + "element = 56\n", + "element = 17\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.8 Page number: 288

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "num = [ 24, 34, 12, 44, 56, 17]\n", + "\n", + "for i in range(0,6):\n", + " print \"address = \", id(num[i])\n", + " print \"element = \", num[i], num[(0+ i)]\n", + " print num[(i+0)], num[i] \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "address = 32529008\n", + "element = 24 24\n", + "24 24\n", + "address = 32528768\n", + "element = 34 34\n", + "34 34\n", + "address = 32529296\n", + "element = 12 12\n", + "12 12\n", + "address = 32530520\n", + "element = 44 44\n", + "44 44\n", + "address = 32530232\n", + "element = 56 56\n", + "56 56\n", + "address = 32529176\n", + "element = 17 17\n", + "17 17\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.9 Page number: 289

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "stud = [] #array\n", + "\n", + "#for i in range(0,4):\n", + " # stud.append((raw_input(\"Enter roll no and marks: \").split())) # storing data in the 2D array\n", + "\n", + "stud = [\"1 38\",\"2 78\",\"3 93\",\"4 48\"]\n", + "for i in range (0,4):\n", + " print \"Enter roll no and marks: \"\n", + " print stud[i]\n", + " \n", + "#Result\n", + "for i in range(0,4):\n", + " print stud[i][0],stud[i][1:] \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter roll no and marks: \n", + "1 38\n", + "Enter roll no and marks: \n", + "2 78\n", + "Enter roll no and marks: \n", + "3 93\n", + "Enter roll no and marks: \n", + "4 48\n", + "1 38\n", + "2 78\n", + "3 93\n", + "4 48\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.10 Page number: 293

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "s = [ [1234, 56 ], [ 1212, 33], [ 1434, 80 ], [ 1312, 78 ]]\n", + "\n", + "#Result\n", + "for i in range(0,4):\n", + " print \"Address of %d th 1-D array = %u\"%( i, id(s[i]) )\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Address of 0 th 1-D array = 134002248\n", + "Address of 1 th 1-D array = 134654472\n", + "Address of 2 th 1-D array = 134791816\n", + "Address of 3 th 1-D array = 134792008\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.11 Page number: 295

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "s = [ [ 1234, 56 ], [ 1212, 33 ], [ 1434, 80 ], [ 1312, 78 ] ]\n", + "\n", + "for i in range(0,4):\n", + " for j in range(0,2):\n", + " print s[i][j] \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1234\n", + "56\n", + "1212\n", + "33\n", + "1434\n", + "80\n", + "1312\n", + "78\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.12 Page number: 296

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "s = [ [ 1234, 56 ], [ 1212, 33 ], [ 1434, 80 ], [ 1312, 78 ]]\n", + "\n", + "#Result\n", + "for i in range(0,4):\n", + " p = s[i]\n", + " pint = p\n", + " print \"\\n\" \n", + " for j in range(0,2):\n", + " print pint[j] \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "\n", + "1234\n", + "56\n", + "\n", + "\n", + "1212\n", + "33\n", + "\n", + "\n", + "1434\n", + "80\n", + "\n", + "\n", + "1312\n", + "78\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.13, Page number: 297

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "a = [[1, 2, 3, 4] , [5, 6, 7, 8] , [9, 0, 1, 6 ]]\n", + "\n", + "#Function definitions\n", + "def display ( q, row, col ):\n", + " for i in range(0,row):\n", + " for j in range(0,col):\n", + " print q [ (i * col)%3][j]\n", + " print \"\\n\" \n", + " print \"\\n\" \n", + "\n", + "\n", + "def show ( q, row, col ):\n", + " for i in range(0,row):\n", + " p = q[i]\n", + " for j in range(0,col):\n", + " print p[j]\n", + " print \"\\n\" \n", + " print \"\\n\" \n", + "\n", + "def Print ( q, row, col ):\n", + " for i in range(0,row):\n", + " for j in range(0,col):\n", + " print q[i][j]\n", + " print \"\\n\" \n", + " print \"\\n\" \n", + " \n", + "#function calls\n", + "display ( a, 3, 4 ) \n", + "show ( a, 3, 4 ) \n", + "Print ( a, 3, 4 )\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n", + "2\n", + "3\n", + "4\n", + "\n", + "\n", + "5\n", + "6\n", + "7\n", + "8\n", + "\n", + "\n", + "9\n", + "0\n", + "1\n", + "6\n", + "\n", + "\n", + "\n", + "\n", + "1\n", + "2\n", + "3\n", + "4\n", + "\n", + "\n", + "5\n", + "6\n", + "7\n", + "8\n", + "\n", + "\n", + "9\n", + "0\n", + "1\n", + "6\n", + "\n", + "\n", + "\n", + "\n", + "1\n", + "2\n", + "3\n", + "4\n", + "\n", + "\n", + "5\n", + "6\n", + "7\n", + "8\n", + "\n", + "\n", + "9\n", + "0\n", + "1\n", + "6\n", + "\n", + "\n", + "\n", + "\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.13 Page number: 300

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from ctypes import *\n", + "\n", + "#Variable declaration\n", + "arr = [] # array of integer pointers \n", + "i = c_int(31)\n", + "j = c_int(5)\n", + "k = c_int(19)\n", + "l = c_int(71)\n", + "arr.append(pointer(i))\n", + "arr.append(pointer(j))\n", + "arr.append(pointer(k))\n", + "arr.append(pointer(l))\n", + "\n", + "for m in range(0,4):\n", + " print arr[m].contents " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "c_long(31)\n", + "c_long(5)\n", + "c_long(19)\n", + "c_long(71)\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.14 Page number: 301

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "a = [ 0, 1, 2, 3, 4 ]\n", + "p = [ a[0], a[1], a[2], a[3], a[4] ]\n", + "\n", + "#Result\n", + "print p, id(p), id(id(p ) )\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[0, 1, 2, 3, 4] 134794120 134005648\n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] } \ No newline at end of file diff --git a/Let_us_C/chapter-9.ipynb b/Let us C/chapter-9.ipynb similarity index 94% rename from Let_us_C/chapter-9.ipynb rename to Let us C/chapter-9.ipynb index a712e2f0..2805c3b5 100644 --- a/Let_us_C/chapter-9.ipynb +++ b/Let us C/chapter-9.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:4f09be4d67c9b4aa6b1f97f3788fa85904e9dfc6d52d9f340d60a59f47f71089" + "signature": "sha256:b56f5f8393519ee5facb6be20704523950b01beac58d1afb9170529ce16a9517" }, "nbformat": 3, "nbformat_minor": 0, @@ -19,7 +19,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Print String , Page number: 329

" + "

Example 9.1 Page number: 329

" ] }, { @@ -60,7 +60,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Print String, Page number: 330

" + "

Example 9.2 Page number: 330

" ] }, { @@ -101,7 +101,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Print String Using Pointer, Page number: 330

" + "

Example 9.3 Page number: 330

" ] }, { @@ -144,7 +144,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

strlen Function, Page number: 336

" + "

Example 9.4 Page number: 336

" ] }, { @@ -182,7 +182,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

xstrlen Function, Page number: 337

" + "

Example 9.5 Page number: 337

" ] }, { @@ -226,7 +226,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

strcpy Function, Page number: 338

" + "

Example 9.6 Page number: 338

" ] }, { @@ -265,7 +265,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

xstrcpy Function, Page number: 339

" + "

Example 9.7 Page number: 339

" ] }, { @@ -309,7 +309,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

strcat Function, Page number: 342

" + "

Example 9.8 Page number: 342

" ] }, { @@ -344,7 +344,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

strcmp Function, Page number: 343

" + "

Example 9.9 Page number: 343

" ] }, { @@ -397,7 +397,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Two Dimensional Array of Characters, Page number: 344

" + "

Example 9.10 Page number: 344

" ] }, { @@ -462,7 +462,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Exchange Names using 2-D Array of Characters, Page number: 348

" + "

Example 9.11 Page number: 348

" ] }, { @@ -504,7 +504,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Exchange Names using Array of Pointers to Strings, Page number: 349

" + "

Example 9.12 Page number: 349

" ] }, { @@ -544,7 +544,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Solution, Page number: 351

" + "

Example 9.13 Page number: 351

" ] }, { diff --git a/Let_us_C/README.txt b/Let_us_C/README.txt deleted file mode 100644 index 752b7f71..00000000 --- a/Let_us_C/README.txt +++ /dev/null @@ -1,10 +0,0 @@ -Contributed By: Akshata M -Course: btech -College/Institute/Organization: NITK Surathkal -Department/Designation: Computer Science -Book Title: Let us C -Author: Yashavant P. Kanetkar -Publisher: BPB Publications -Year of publication: 2008 -Isbn: 8176569402 -Edition: 5th \ No newline at end of file diff --git a/Let_us_C/screenshots/binary.png b/Let_us_C/screenshots/binary.png deleted file mode 100644 index 5a14ee93..00000000 Binary files a/Let_us_C/screenshots/binary.png and /dev/null differ diff --git a/Let_us_C/screenshots/hellowindows.png b/Let_us_C/screenshots/hellowindows.png deleted file mode 100644 index 622bf2b7..00000000 Binary files a/Let_us_C/screenshots/hellowindows.png and /dev/null differ diff --git a/Let_us_C/screenshots/macro.png b/Let_us_C/screenshots/macro.png deleted file mode 100644 index 161b4c74..00000000 Binary files a/Let_us_C/screenshots/macro.png and /dev/null differ diff --git a/Mechanics_of_Materials/.ipynb_checkpoints/chapter1-checkpoint.ipynb b/Mechanics_of_Materials/.ipynb_checkpoints/chapter1-checkpoint.ipynb new file mode 100644 index 00000000..ab371470 --- /dev/null +++ b/Mechanics_of_Materials/.ipynb_checkpoints/chapter1-checkpoint.ipynb @@ -0,0 +1,407 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:aea5bb987f3d9aa2243551894826c2910635d28d3bf3f202e7af5344bd9c9219" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 1: Tension Comprssion and Shear" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.1, page no. 9" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#initialisation\n", + "\n", + "d_1 = 4 # inner diameter (inch)\n", + "d_2 = 4.5 #outer diameter (inch)\n", + "P = 26000 # pressure in pound\n", + "L = 16 # Length of cylinder (inch)\n", + "my_del = 0.012 # shortening of post (inch)\n", + "\n", + "#calculation\n", + "A = (math.pi/4)*((d_2**2)-(d_1**2)) #Area (inch^2)\n", + "s = P/A # stress\n", + "\n", + "print \"compressive stress in the post is \", round(s), \"psi\"\n", + "\n", + "e = my_del/L # strain\n", + "\n", + "print \"compressive strain in the post is %e\" %e" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "compressive stress in the post is 7789.0 psi\n", + "compressive strain in the post is 7.500000e-04\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.2, page no. 10" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "#initialisation\n", + "W = 1500 # weight (Newton)\n", + "d = 0.008 #diameter(meter) \n", + "g = 77000 # Weight density of steel\n", + "L = 40 # Length of bar (m)\n", + "\n", + "#calculation\n", + "\n", + "A = (math.pi/4)*(d**2) # Area\n", + "s_max = (1500/A) + (g*L) # maximum stress\n", + "\n", + "#result\n", + "print \"Therefore the maximum stress in the rod is \", round(s_max,1), \"Pa\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Therefore the maximum stress in the rod is 32921551.8 Pa\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.3. page no. 26" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "#initialisation\n", + "d1 = 4.5 # diameter in inch\n", + "d2 = 6 # diameter in inch\n", + "A = (math.pi/4)*((d2**2)-(d1**2)) # Area\n", + "P = 140 # pressure in K\n", + "s = -P/A # stress (compression)\n", + "E = 30000 # young's modulus in Ksi\n", + "e = s/E # strain\n", + "\n", + "#calculation\n", + "\n", + "# Part (a)\n", + "my_del = e*4*12 # del = e*L \n", + "print \"Change in length of the pipe is\", round(my_del,3), \"inch\"\n", + "\n", + "# Part (b)\n", + "v = 0.30 # Poissio's ratio\n", + "e_ = -(v*e)\n", + "print \"Lateral strain in the pipe is %e\" %e_\n", + "\n", + "# Part (c)\n", + "del_d2 = e_*d2 \n", + "del_d1 = e_*d1\n", + "print \"Increase in the inner diameter is \", round(del_d1,6), \"inch\"\n", + "\n", + "# Part (d)\n", + "t = 0.75\n", + "del_t = e_*t\n", + "print \"Increase in the wall thicness is %f\" %del_t, \"inch\"\n", + "del_t1 = (del_d2-del_d1)/2 \n", + "print \"del_t1 = del_t\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Change in length of the pipe is -0.018 inch\n", + "Lateral strain in the pipe is 1.131768e-04\n", + "Increase in the inner diameter is 0.000509 inch\n", + "Increase in the wall thicness is 0.000085 inch\n", + "del_t1 = del_t\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.4, page no. 35" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "#initialisation\n", + "d = 0.02 # diameter in m\n", + "t = 0.008 # thickness in m\n", + "A = math.pi*d*t # shear area\n", + "P = 110000 # prassure in Newton\n", + "\n", + "#calculation\n", + "A1 = (math.pi/4)*(d**2) # Punch area\n", + "t_aver = P/A # Average shear stress \n", + "\n", + "\n", + "print \"Average shear stress in the plate is \", t_aver, \"Pa\"\n", + "s_c = P/A1 # compressive stress\n", + "print \"Average compressive stress in the plate is \", s_c, \"Pa\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Average shear stress in the plate is 218838046.751 Pa\n", + "Average compressive stress in the plate is 350140874.802 Pa\n" + ] + } + ], + "prompt_number": 37 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Eample 1.5, page no. 36" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "#initialisation\n", + "\n", + "P = 12.0 # Pressure in K\n", + "t = 0.375 # thickness of wall in inch\n", + "theta = 40.0 # angle in degree\n", + "d_pin = 0.75 # diameter of pin in inch\n", + "t_G = 0.625 # thickness of gusset in inch\n", + "t_B = 0.375 #thickness of base plate in inch\n", + "d_b = 0.50 # diameter of bolt in inch\n", + "\n", + "#calculation\n", + "\n", + "#Part (a)\n", + "s_b1 = P/(2*t*d_pin) # bearing stress\n", + "print \"Bearing stress between strut and pin\", round(s_b1,1), \"ksi\"\n", + "\n", + "#Part (b)\n", + "t_pin = (4*P)/(2*math.pi*(d_pin**2)) # average shear stress in the \n", + "print \"Shear stress in pin is \", round(t_pin,1), \"ksi\"\n", + "\n", + "# Part (c)\n", + "s_b2 = P/(2*t_G*d_pin) # bearing stress between pin and gusset\n", + "print \"Bearing stress between pin and gussets is\", s_b2, \"ksi\"\n", + "\n", + "# Part (d)\n", + "s_b3 = (P*math.cos(math.radians(40))/(4*t_B*d_b)) # bearing stress between anchor bolt and base plate\n", + "print \"Bearing stress between anchor bolts & base plate\", round(s_b3,1), \"ksi\"\n", + "\n", + "# Part (e)\n", + "t_bolt = (4*math.cos(math.radians(40))*P)/(4*math.pi*(d_b**2)) # shear stress in anchor bolt\n", + "print \"Shear stress in anchor bolts is\", round(t_bolt,1), \"ksi\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Bearing stress between strut and pin 21.3 ksi\n", + "Shear stress in pin is 13.6 ksi\n", + "Bearing stress between pin and gussets is 12.8 ksi\n", + "Bearing stress between anchor bolts & base plate 12.3 ksi\n", + "Shear stress in anchor bolts is 11.7 ksi\n" + ] + } + ], + "prompt_number": 39 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.7, page no. 42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#initialisation\n", + "b1 = 1.5 # width of recmath.tangular crosssection in inch\n", + "t = 0.5 # thickness of recmath.tangular crosssection in inch\n", + "b2 = 3.0 # width of enlarged recmath.tangular crosssection in inch\n", + "d = 1.0 # diameter in inch\n", + "\n", + "#calculation\n", + "\n", + "# Part (a)\n", + "s_1 = 16000 # maximum allowable tensile stress in Psi\n", + "P_1 = s_1*t*b1 \n", + "print \"The allowable load P1 is\", P_1, \"lb\"\n", + "\n", + "# Part (b)\n", + "s_2 = 11000 # maximum allowable tensile stress in Psi\n", + "P_2 = s_2*t*(b2-d) \n", + "print \"allowable load P2 at this section is\", P_2, \"lb\"\n", + "\n", + "#Part (c)\n", + "s_3 = 26000 # maximum allowable tensile stress in Psi\n", + "P_3 = s_3*t*d \n", + "print \"The allowable load based upon bearing between the hanger and the bolt is\", P_3, \"lb\"\n", + "\n", + "# Part (d)\n", + "s_4 = 6500 # maximum allowable tensile stress in Psi\n", + "P_4 = (math.pi/4)*(d**2)*2*s_4 \n", + "print \"the allowable load P4 based upon shear in the bolt is\", round(P_4), \"lb\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The allowable load P1 is 12000.0 lb\n", + "allowable load P2 at this section is 11000.0 lb\n", + "The allowable load based upon bearing between the hanger and the bolt is 13000.0 lb\n", + "the allowable load P4 based upon shear in the bolt is 10210.0 lb\n" + ] + } + ], + "prompt_number": 42 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.8, page no. 46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "#initialisation\n", + "R_ah = (2700*0.8 + 2700*2.6)/2 # Horizontal component at A in N\n", + "R_ch = R_ah # Horizontal component at C in N\n", + "R_cv = (2700*2.2 + 2700*0.4)/3 # vertical component at C in N\n", + "R_av = 2700 + 2700 - R_cv # vertical component at A in N\n", + "R_a = math.sqrt((R_ah**2)+(R_av**2))\n", + "R_c = math.sqrt((R_ch**2)+(R_cv**2))\n", + "Fab = R_a # Tensile force in bar AB\n", + "Vc = R_c # Shear force acting on the pin at C\n", + "s_allow = 125000000 # allowable stress in tension \n", + "t_allow = 45000000 # allowable stress in shear\n", + "\n", + "#calculation\n", + "Aab = Fab / s_allow # required area of bar \n", + "Apin = Vc / (2*t_allow) # required area of pin\n", + "\n", + "\n", + "print \"Required area of bar is %f\" %Apin, \"m^2\"\n", + "d = math.sqrt((4*Apin)/math.pi) # diameter in meter\n", + "print \"Required diameter of pin is %f\" %d, \"m\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Required area of bar is 0.000057 m^2\n", + "Required diameter of pin is 0.008537 m\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mechanics_of_Materials/.ipynb_checkpoints/chapter11-checkpoint.ipynb b/Mechanics_of_Materials/.ipynb_checkpoints/chapter11-checkpoint.ipynb new file mode 100644 index 00000000..6c1963de --- /dev/null +++ b/Mechanics_of_Materials/.ipynb_checkpoints/chapter11-checkpoint.ipynb @@ -0,0 +1,501 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:84b48278b7f3c96235822dbaf287a816273c08b171a3ad371f818f325de3125f" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 11: Columns" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11.1, page no. 763" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "#initialisation\n", + "E = 29000 # Modulus of elasticity in ksi\n", + "spl = 42 # Proportional limit in ksi\n", + "L = 25 # Total length of coloum in ft\n", + "n = 2.5 # factor of safety\n", + "I1 = 98 # Moment of inertia on horizontal axis\n", + "I2 = 21.7 # Moment of inertia on vertical axis\n", + "A = 8.25 # Area of the cross section\n", + "\n", + "#calculation\n", + "Pcr2 = (4*math.pi**2*E*I2)/((L*12)**2) # Criticle load if column buckles in the plane of paper\n", + "Pcr1 = (math.pi**2*E*I1)/((L*12)**2) # Criticle load if column buckles in the plane of paper\n", + "Pcr = min(Pcr1,Pcr2) # Minimum pressure would govern the design\n", + "scr = Pcr/A # Criticle stress\n", + "Pa = Pcr/n # Allowable load in k\n", + "print \"The allowable load is \", round(Pa), \"k\"\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The allowable load is 110.0 k\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11.2, page no. 774" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "#initialisation\n", + "L = 3.25 # Length of alluminium pipe in m\n", + "d = 0.1 # Outer diameter of alluminium pipe\n", + "P = 100000 # Allowable compressive load in N\n", + "n =3 # Safety factor for eular buckling\n", + "E = 72e09 # Modulus of elasticity in Pa\n", + "l = 480e06 # Proportional limit\n", + "\n", + "#calculation\n", + "Pcr = n*P # Critice load\n", + "t = (0.1-(55.6e-06)**(1.0/4.0) )/2.0 # Required thickness\n", + "\n", + "tmin = t \n", + "print \"The minimum required thickness of the coloumn is\", round(tmin*1000,2), \"mm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The minimum required thickness of the coloumn is 6.82 mm\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11.3, page no. 780" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from sympy import *\n", + "\n", + "#initialisation\n", + "P = 1500 # Load in lb\n", + "e = 0.45 # ecentricity in inch\n", + "h = 1.2 # Height of cross section in inch\n", + "b = 0.6 # Width of cross section in inch\n", + "E = 16e06 # Modulus of elasticity \n", + "my_del = 0.12 # Allowable deflection in inch\n", + "\n", + "#calculation\n", + "L = mpmath.asec(1.2667)/0.06588 # Maximum allowable length possible\n", + "\n", + "#Result\n", + "print \"The longest permissible length of the bar is\", round(L), \"inch\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The longest permissible length of the bar is 10.0 inch\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11.4, page no. 785" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from sympy import *\n", + "import math\n", + "\n", + "#initialisation\n", + "L = 25 # Length of coloum in ft\n", + "P1 = 320 # Load in K\n", + "P2 = 40 # Load in K\n", + "E = 30000 # Modulus of elasticity of steel in Ksi\n", + "P = 360 # Euivalent load\n", + "e = 1.5 # Ecentricity of compressive load\n", + "A = 24.1 # Area of the Cross section\n", + "r = 6.05 # in inch\n", + "c = 7.155 # in inch\n", + "sy = 42 # Yeild stress of steel in Ksi\n", + "\n", + "#calculation\n", + "\n", + "smax = (P/A)*(1+(((e*c)/r**2)*mpmath.sec((L/(2*r))*math.sqrt(P/(E*A))))) # Maximum compressive stress\n", + "print \"The Maximum compressive stress in the column \", round(smax,2), \"ksi\"\n", + "# Bisection method method to solve for yeilding\n", + "def stress(a,b,f):\n", + " N = 100\n", + " eps = 1e-5\n", + " if((f(a)*f(b))>0):\n", + " print 'no root possible f(a)*f(b)>0'\n", + " sys.exit()\n", + " if(abs(f(a))0):\n", + " c = (a+b)/2.0\n", + " if(abs(f(c))0):\n", + " print 'no root possible f(a)*f(b)>0'\n", + " sys.exit()\n", + " if(abs(f(a))0):\n", + " c = (a+b)/2.0\n", + " if(abs(f(c))0):\n", + " print 'no root possible f(a)*f(b)>0'\n", + " sys.exit()\n", + " if(abs(f(a))0):\n", + " c = (a+b)/2.0\n", + " if(abs(f(c))" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 8.4, page no. 570" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "#initialisation\n", + "d = 0.05 # Diameter of shaft in m\n", + "T = 2400 # Torque transmitted by the shaft in N-m\n", + "P = 125000 # Tensile force\n", + "\n", + "#calculation\n", + "s0 = (4*P)/(math.pi*d**2) # Tensile stress in\n", + "t0 = (16*T)/(math.pi*d**3) # Shear force \n", + "# Stresses along x and y direction\n", + "sx = 0 \n", + "sy = s0 \n", + "txy = -t0 \n", + "s1 = (sx+sy)/2.0 + math.sqrt(((sx-sy)/2.0)**2 + (txy)**2) # Maximum tensile stress \n", + "s2 = (sx+sy)/2.0 - math.sqrt(((sx-sy)/2.0)**2 + (txy)**2) # Maximum compressive stress \n", + "tmax = math.sqrt(((sx-sy)/2)**2 + (txy)**2) # Maximum in plane shear stress \n", + "print \"Maximum tensile stress %e\" %s1, \"Pa\"\n", + "print \"Maximum compressive stress %e\" %s2, \"Pa\"\n", + "print \"Maximum in plane shear stress %e \" %tmax, \"Pa\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum tensile stress 1.346662e+08 Pa\n", + "Maximum compressive stress -7.100421e+07 Pa\n", + "Maximum in plane shear stress 1.028352e+08 Pa\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 8.5, page no. 573" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "\n", + "#initialisation\n", + "P = 12 # Axial load in K\n", + "r = 2.1 # Inner radius of the cylinder in inch\n", + "t = 0.15 # Thickness of the cylinder in inch\n", + "ta = 6500 # Allowable shear stress in Psi\n", + "\n", + "#calculation\n", + "p1 = (ta - 3032)/3.5 # allowable internal pressure\n", + "p2 = (ta + 3032)/3.5 # allowable internal pressure\n", + "p3 = 6500/7.0 # allowable internal pressure\n", + "\n", + "prs_allowable = min(p1,p2,p3) # Minimum pressure would govern the design\n", + "print \"Maximum allowable internal pressure \", round(prs_allowable), \"psi\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum allowable internal pressure 929.0 psi\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 8.6, page no. 574" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "#initialisation\n", + "d1 = 0.18 # Inner diameter of circular pole in m\n", + "d2 = 0.22 # Outer diameter of circular pole in m\n", + "P = 2000 # Pressure of wind in Pa\n", + "b = 1.5 # Distance between centre line of pole and board in m\n", + "h = 6.6 # Distance between centre line of board and bottom of the ploe in m\n", + "\n", + "#calculation\n", + "W = P*(2*1.2) # Force at the midpoint of sign \n", + "V = W # Load\n", + "T = W*b # Torque acting on the pole\n", + "M = W*h # Moment at the bottom of the pole\n", + "I = (math.pi/64.0)*(d2**4-d1**4) # Momet of inertia of cross section of the pole\n", + "sa = (M*d2)/(2*I) # Tensile stress at A \n", + "Ip = (math.pi/32.0)*(d2**4-d1**4) # Polar momet of inertia of cross section of the pole\n", + "t1 = (T*d2)/(2*Ip) # Shear stress at A and B\n", + "r1 = d1/2.0 # Inner radius of circular pole in m\n", + "r2 = d2/2.0 # Outer radius of circular pole in m\n", + "A = math.pi*(r2**2-r1**2) # Area of the cross section\n", + "t2 = ((4*V)/(3*A))*((r2**2 + r1*r2 +r1**2)/(r2**2+r1**2)) # Shear stress at point B \n", + "\n", + "# Principle stresses \n", + "sxa = 0\n", + "sya = sa\n", + "txya = t1\n", + "sxb = 0\n", + "syb = 0\n", + "txyb = t1+t2 \n", + "\n", + "# Stresses at A\n", + "s1a = (sxa+sya)/2.0 + math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum tensile stress \n", + "s2a = (sxa+sya)/2.0 - math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum compressive stress \n", + "tmaxa = math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum in plane shear stress\n", + "\n", + "print \"Maximum tensile stress at point A is\", s1a, \"Pa\"\n", + "print \"Maximum compressive stress at point A is\", s2a, \"Pa\"\n", + "print \"Maximum in plane shear stress at point A is\", tmaxa, \"Pa\"\n", + "\n", + "# Stress at B \n", + "s1b = (sxb+syb)/2.0 + math.sqrt(((sxb-syb)/2)**2 + (txyb)**2) # Maximum tensile stress \n", + "s2b = (sxb+syb)/2.0 - math.sqrt(((sxb-syb)/2)**2 + (txyb)**2) # Maximum compressive stress \n", + "tmaxb = math.sqrt(((sxb-syb)/2.0)**2 + (txyb)**2) # Maximum in plane shear stress \n", + "print \"Maximum tensile stress at point B is\", s1b, \"Pa\"\n", + "print \"Maximum compressive stress at point B is\", s2b, \"Pa\"\n", + "print \"Maximum in plane shear stress at point B is\", tmaxb, \"Pa\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum tensile stress at point A is 55613361.197 Pa\n", + "Maximum compressive stress at point A is -700178.455718 Pa\n", + "Maximum in plane shear stress at point A is 28156769.8263 Pa\n", + "Maximum tensile stress at point B is 6999035.59641 Pa\n", + "Maximum compressive stress at point B is -6999035.59641 Pa\n", + "Maximum in plane shear stress at point B is 6999035.59641 Pa\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 8.7, page no. 578" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "#initialisation\n", + "b = 6 # Outer dimension of the pole in inch\n", + "t = 0.5 # thickness of the pole\n", + "P1 = 20*(6.75*24) # Load acting at the midpoint of the platform\n", + "d = 9 # Distance between longitudinal axis of the post and midpoint of platform\n", + "P2 = 800 # Load in lb\n", + "h = 52 # Distance between base and point of action of P2\n", + "\n", + "#calculation\n", + "M1 = P1*d # Moment due to P1\n", + "M2 = P2*h # Moment due to P2\n", + "A = b**2 - (b-2*t)**2 # Area of the cross section\n", + "sp1 = P1/A # Comoressive stress due to P1 at A and B\n", + "I = (1.0/12.0)*(b**4 - (b-2*t)**4) # Moment of inertia of the cross section\n", + "sm1 = (M1*b)/(2*I) # Comoressive stress due to M1 at A and B\n", + "Aweb = (2*t)*(b-(2*t)) # Area of the web\n", + "tp2 = P2/Aweb # Shear stress at point B by lpad P2\n", + "sm2 = (M2*b)/(2*I) # Comoressive stress due to M2 at A \n", + "sa = sp1+sm1+sm2 # Total Compressive stress at point A\n", + "sb = sp1+sm1 # Total compressive at point B \n", + "tb = tp2 # Shear stress at point B\n", + "\n", + "# Principle stresses \n", + "sxa = 0\n", + "sya = -sa\n", + "txya = 0\n", + "sxb = 0\n", + "syb = -sb\n", + "txyb = tp2 \n", + "\n", + "# Stresses at A\n", + "s1a = (sxa+sya)/2 + math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum tensile stress \n", + "s2a = (sxa+sya)/2 - math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum compressive stress \n", + "tmaxa = math.sqrt(((sxa-sya)/2)**2 + (txya)**2) # Maximum in plane shear stress\n", + "print \"Maximum tensile stress at point A is\", s1a,\"Psi\"\n", + "print \"Maximum compressive stress at point A is\", round(s2a,2), \"Psi\"\n", + "print \"Maximum in plane shear stress at point A is\", round(tmaxa,2), \"Psi\"\n", + "\n", + "# Stress at B \n", + "s1b = (sxb+syb)/2 + math.sqrt(((sxb-syb)/2)**2 + (txyb)**2) # Maximum tensile stress \n", + "s2b = (sxb+syb)/2 - math.sqrt(((sxb-syb)/2)**2 + (txyb)**2) # Maximum compressive stress \n", + "tmaxb = math.sqrt(((sxb-syb)/2)**2 + (txyb)**2) # Maximum in plane shear stress\n", + "print \"Maximum tensile stress at point B is\", round(s1b,2), \"Psi\"\n", + "print \"Maximum compressive stress at point B is\", round(s2b,2), \"Psi\"\n", + "print \"Maximum in plane shear stress at point B is\", round(tmaxb,2), \"Psi\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum tensile stress at point A is 0.0 Psi\n", + "Maximum compressive stress at point A is -4090.91 Psi\n", + "Maximum in plane shear stress at point A is 2045.45 Psi\n", + "Maximum tensile stress at point B is 13.67 Psi\n", + "Maximum compressive stress at point B is -1872.69 Psi\n", + "Maximum in plane shear stress at point B is 943.18 Psi\n" + ] + } + ], + "prompt_number": 5 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Mechanics_of_Materials/.ipynb_checkpoints/chapter9-checkpoint.ipynb b/Mechanics_of_Materials/.ipynb_checkpoints/chapter9-checkpoint.ipynb new file mode 100644 index 00000000..ee48f481 --- /dev/null +++ b/Mechanics_of_Materials/.ipynb_checkpoints/chapter9-checkpoint.ipynb @@ -0,0 +1,123 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:688a5ddb04d5076a46d59fbb5d6dc8d907dec2ec735786354cef92d935d1ccd0" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 9: Deflections of beams" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.17, Page number 654" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "P = 5 #load(k)\n", + "L = 8*12 #beam length(in)\n", + "E = 30*10**6 #modulus of elasticity(psi)\n", + "I = 75.0 #moment of inertia(in^4)\n", + "q = 1.5*(1./12.)#load intensity(k/in)\n", + "\n", + "#Calculations\n", + "Sc = ((P*L**3)/(48*E*I))+((5.*q*L**4)/(384.*E*I))\n", + "\n", + "#Result\n", + "print \"The download deflection is\",Sc,\"in(Calculation mistake in textbook)\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The download deflection is 0.0001024 in(Calculation mistake in textbook)\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9.23, Page number 682" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "E = 30*10**6*144 #modulus of elasticity(lb/ft^2)\n", + "I = 25.92/12 #moment of inertia(ft^4)\n", + "x = 12 #ft\n", + "\n", + "#Calculations\n", + "'''The equivalent load q(x) for the beam is given by the following equation\n", + "q(x) = -700(x)^-1+800(x-6)^0 - 800(x-12)^0 - 5600(x-12)^-1 + 1500(x-16)^-1\n", + "Since the equation equals zero at all points except where x=16, we omit the last term\n", + "Taking 4th order integration, we obtain the following expression,'''\n", + "C1 = (-((350*x**3)/3)+((100*(x-6)**4)/3)-((100*(x-12)**4)/3)+((2800*(x-12)**3)/3))/12\n", + "print \"C1 =\",C1\n", + "\n", + "#For Deflection at point C\n", + "x = 6\n", + "Elv = ((350*x**3)/3)-(100*((x-6)**4)/3)+(100*((x-12)**4)/3)+(2800*((x-12)**3)/3)+(C1*x)\n", + "Sc = Elv/(E*I) #ft\n", + "\n", + "#For deflection at point D\n", + "x = 16\n", + "Elv_16 = ((350*x**3)/3)-(100*((x-6)**4)/3)+(100*((x-12)**4)/3)+(2800*((x-12)**3)/3)+(C1*x)\n", + "Sd = Elv_16/(E*I)\n", + "\n", + "#Results\n", + "print \"Deflection at point C is\",round((-Sc*12),8),\"in\"\n", + "print \"Deflection at point D is\",round((Sd*12),8),\"in\"\n", + "\n", + "print \"\\n Please note that there is a calculation mistake in textbook while calculating Elv. Hence, the difference in solution\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "C1 = -13200\n", + "Deflection at point C is 0.00027315 in\n", + "Deflection at point D is 2.06e-06 in\n", + "\n", + " Please note that there is a calculation mistake in textbook while calculating Elv. Hence, the difference in solution\n" + ] + } + ], + "prompt_number": 19 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Microwave_and_Radar_Engineering/.ipynb_checkpoints/Chapter_11-checkpoint.ipynb b/Microwave_and_Radar_Engineering/.ipynb_checkpoints/Chapter_11-checkpoint.ipynb new file mode 100644 index 00000000..afe53dd6 --- /dev/null +++ b/Microwave_and_Radar_Engineering/.ipynb_checkpoints/Chapter_11-checkpoint.ipynb @@ -0,0 +1,300 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:efd0e56c04d2245e98b2287a63fba67799b88e9847372ba4c5f3c4cf5de91c4c" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 11: Radars" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11.1, Page number 504" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#Variable declaraion\n", + "lamda = 3.*10**-2#operating unit(cm)\n", + "Pt = 600.*10**3 #peak pulse power(W)\n", + "Smin = 10.**-13 #minimum detectable signal(W)\n", + "Ae = 5. #m^2\n", + "sigma = 20. #cross sectional area(m^2)\n", + "\n", + "#Calculations\n", + "Rmax = ((Pt*Ae**2*sigma)/(4*math.pi*lamda**2*Smin))**0.25\n", + "Rmax_nau = Rmax/1.853\n", + "\n", + "#Result\n", + "print \"The maximum range of radar system is\",round((Rmax/1E+3),2),\"km\"\n", + "print \"The maximum range of radar system in nautical miles is\",round((Rmax_nau/1E+3),2),\"nm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The maximum range of radar system is 717.66 km\n", + "The maximum range of radar system in nautical miles is 387.29 nm\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11.2, Page number 504" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "Pt = 250.*10**3 #peak pulse power(W)\n", + "Smin = 10.**-14 #minimum detectable signal(W)\n", + "Ae = 10. #m^2\n", + "sigma = 2. #cross sectional area(m^2)\n", + "f = 10*10**9 #frequency(Hz)\n", + "c = 3*10**8 #velocity of propagation(m/s)\n", + "G = 2500 #power gain of antenna\n", + "\n", + "#Calculations\n", + "lamda = c/f\n", + "Rmax = ((Pt*G*Ae*sigma)/((4*math.pi)**2*Smin))**0.25\n", + "\n", + "#Result\n", + "print \"Maximum range possible of the antenna is\",round((Rmax/1E+3),2),\"km\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum range possible of the antenna is 298.28 km\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11.3, Page number 504" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#Variable declaration\n", + "Pt = 250.*10**3 #peak pulse power(W)\n", + "f = 10.*10**9 #frequency(Hz)\n", + "c = 3.*10**8 #velocity of propagation(m/s)\n", + "G = 4000 #power gain of antenna\n", + "R = 50*10**3 #range(m)\n", + "Pr = 10**-11 #minimum detectable signal(W)\n", + "\n", + "#Calculations\n", + "lamda = c/f\n", + "Ae = (G*lamda**2)/(4*math.pi)\n", + "sigma = (Pr*((4*math.pi*R**2)**2))/(Pt*G*Ae)\n", + "\n", + "#Result\n", + "print \"The radar can sight cross section area of\",round(sigma,2),\"m^2\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The radar can sight cross section area of 34.45 m^2\n" + ] + } + ], + "prompt_number": 37 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11.4, Page number 505" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "Pt = 400*10**3 #transmitted power(W)\n", + "prf = 1500. #pulse repitiion frequency(pps)\n", + "tw = 0.8*10**-6 #pulse width(sec)\n", + "c = 3.*10**8 #velocity of propagation(m/s)\n", + "\n", + "#Calculations\n", + "#Part a\n", + "Run = c/(2*prf)\n", + "\n", + "#Part b\n", + "dc = tw/(1/prf)\n", + "\n", + "#Part c\n", + "Pav = Pt*dc\n", + "\n", + "#Part d\n", + "n1 = 1\n", + "BW1 = n1/tw\n", + "\n", + "n2 = 1.4\n", + "BW2 = n2/tw\n", + "\n", + "#Results\n", + "print \"The radar's unambiguous range is\",round((Run/1E+3),2),\"km\"\n", + "print \"The duty cycle for radar is\",dc\n", + "print \"The average power is\",round(Pav,2),\"W\"\n", + "print \"Bandwidth range for radar is\",(BW1/1E+6),\"MHz and\",(BW2/1E+6),\"MHz\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The radar's unambiguous range is 100.0 km\n", + "The duty cycle for radar is 0.0012\n", + "The average power is 480.0 W\n", + "Bandwidth range for radar is 1.25 MHz and 1.75 MHz\n" + ] + } + ], + "prompt_number": 47 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11.5, Page number 505" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#Variable declaration\n", + "Pt = 2.5*10**6 #power output(W)\n", + "D = 5 #antenna diameter(m)\n", + "sigma = 1 #cross sectional area of target(m^2)\n", + "B = 1.6*10**6 #receiver bandwidth(Hz)\n", + "c = 3.*10**8 #velocity of propagation(m/s)\n", + "Nf = 12. #noise figure(dB)\n", + "f = 5*10**9 #frequency(Hz)\n", + "\n", + "#Calculations\n", + "lamda = c/f\n", + "F = 10**(Nf/10)\n", + "Rmax = 48*(((Pt*D**4*sigma)/(B*lamda**2*(F-1)))**0.25)\n", + "\n", + "#Result\n", + "print \"The maximum detection range is\",round(Rmax,2),\"km\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The maximum detection range is 558.04 km\n" + ] + } + ], + "prompt_number": 57 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11.6, Page number 506" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "#Variable declaration\n", + "Rmax = 30 #maximum range of radar(km)\n", + "n = 50 #no. of echos\n", + "\n", + "#Calculation\n", + "R = Rmax*math.sqrt(math.sqrt(n))\n", + "\n", + "#After doubling the power\n", + "R1 = math.sqrt(math.sqrt(2))\n", + "\n", + "#Results\n", + "print \"Maximum range with echoing of 50 times is\",round(R,2),\"km\"\n", + "print \"If transmitter power is doubled, range would increase by a factor of\",round(R1,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum range with echoing of 50 times is 79.77 km\n", + "If transmitter power is doubled, range would increase by a factor of 1.19\n" + ] + } + ], + "prompt_number": 61 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Microwave_and_Radar_Engineering/.ipynb_checkpoints/Chapter_3-checkpoint.ipynb b/Microwave_and_Radar_Engineering/.ipynb_checkpoints/Chapter_3-checkpoint.ipynb new file mode 100644 index 00000000..116264a3 --- /dev/null +++ b/Microwave_and_Radar_Engineering/.ipynb_checkpoints/Chapter_3-checkpoint.ipynb @@ -0,0 +1,531 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:dfa1112ea6b0d370508845e5b6861c8e0c5d67e82e0a759d3e8e0f96252d9846" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 3: Transmission Lines" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example number 3.1, Page number 47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "Zo = 100 #o/p impedance(Ohms)\n", + "s = 5 #VSWR\n", + "\n", + "#Calculations\n", + "Zmax = Zo*s\n", + "\n", + "#Results\n", + "print \"Terminating impedance = \",Zmax,\"Ohms\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Terminating impedance = 500 Ohms\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.2, Page number 47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "import cmath\n", + "\n", + "#Varaible declaration \n", + "R = 8 #resistance(Ohms)\n", + "L = 2*10**-3 #inductance(H/km)\n", + "C = 0.002*10**-6 #capacitance(F)\n", + "G = 0.07*10**-6 #conductance(s/km)\n", + "f = 2*10**3 #frequency(Hz)\n", + "Vs = 2 #input signal(V)\n", + "l = 500. #line length(km)\n", + "\n", + "#Calculations\n", + "w = 2*math.pi*f\n", + "x = complex(R,w*L)\n", + "y = complex(G,w*C)\n", + "Zo = cmath.sqrt(x/y)\n", + "gamma = cmath.sqrt(x*y)\n", + "Is = Vs/Zo.real\n", + "Il = Is*cmath.exp(-1*gamma*l)\n", + "P = Il**2*Zo.real\n", + "\n", + "#Results\n", + "print \"Characteristic impedance =\",Zo,\"Ohms\"\n", + "print \"Attenuation constant =\",round(gamma.real,6),\"NP/km\"\n", + "print \"Phase constant =\", round(gamma.imag,6),\"rad/km\"\n", + "print \"Power delivered to the load =\", round((abs(P)/1E-6),2), \"uW\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Characteristic impedance = (1012.50018135-155.813417548j) Ohms\n", + "Attenuation constant = 0.003987 NP/km\n", + "Phase constant = 0.025436 rad/km\n", + "Power delivered to the load = 73.31 uW\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.3, Page number 48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#Varaible declaration\n", + "f = 2*10**3 #frequency(Hz)\n", + "B = 0.02543 #phase constant(rad/km)\n", + "\n", + "#Calculations\n", + "w = 2*math.pi*f\n", + "Vp = w/B\n", + "\n", + "#Results\n", + "print \"Phase velocity =\",round((Vp/1E+3),2),\"km/sec\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Phase velocity = 494.16 km/sec\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.4, Page number 48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import cmath\n", + "import math\n", + "\n", + "#Variable declaration\n", + "f = 37.5*10**6 #frequency(Hz)\n", + "V = 200 #Voltage signal(Vrms)\n", + "r = 200 #internal resistance(Ohms)\n", + "Zo = 200 #characteristic impedance(Ohms)\n", + "l = 10 #line length(m)\n", + "Zl = 100 #resistive load(Ohms)\n", + "c = 3*10**8 #velocity of propagation(m/s)\n", + "\n", + "#Calculations\n", + "#Part a\n", + "lamda = c/f\n", + "Bl = (5*math.degrees(math.pi))/4\n", + "x = complex(Zl,(Zo*math.tan(Bl)))\n", + "y = complex(Zo,(Zl*math.tan(Bl)))\n", + "Zi = Zo*(x/y)\n", + "Vs = (Zi.real*Zo)/(Zi.real+Zo)\n", + "Is = Zo/(Zi.real+Zo)\n", + "\n", + "#Part b\n", + "P = Vs*Is\n", + "\n", + "#Part c\n", + "Il = math.sqrt(P/Zl)\n", + "\n", + "#Results\n", + "print \"Please note that the solution given in the textbook is incorrect.Hence the difference in answers\\n\"\n", + "print \"Current drawn from generator is\",round(Is,2),\"A\" \n", + "print \"Power delivered to the load is\",round(P,2),\"W\"\n", + "print \"Current flowing through the load is\",round(Il,3),\"A\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please note that the solution given in the textbook is incorrect.Hence the difference in answers\n", + "\n", + "Current drawn from generator is 0.41 A\n", + "Power delivered to the load is 48.47 W\n", + "Current flowing through the load is 0.696 A\n" + ] + } + ], + "prompt_number": 35 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.5, Page number 50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import cmath\n", + "import math\n", + "\n", + "#Variable declaration\n", + "zo = 50 #characteristic impedance(Ohms)\n", + "f = 300*10**6 #frequency(Hz)\n", + "zl = complex(50,50) #terminating load(Ohms)\n", + "c = 3*10**8 #velocity of propagation(m/s)\n", + "\n", + "#Calculations\n", + "lamda = c/f\n", + "rho = (zl-zo)/(zl+zo)\n", + "phi = cmath.phase(rho)\n", + "s = (1+abs(rho))/(1-abs(rho))\n", + "\n", + "#Results\n", + "print \"Reflection co-efficient =\",round(abs(rho),3),\"with phase =\",round(math.degrees(phi),2)\n", + "print \"VSWR =\",round(s,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Reflection co-efficient = 0.447 with phase = 63.43\n", + "VSWR = 2.62\n" + ] + } + ], + "prompt_number": 46 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.6, Page number 50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#Variable declaration\n", + "Zl = 100. #load resistance(Ohms)\n", + "Zo = 600. #characteristic impedance(Ohms)\n", + "f = 100*10**6 #frequency(Hz)\n", + "c = 3*10**8 #velocity of propagation(m/s)\n", + "\n", + "#Calculations\n", + "lamda = c/f\n", + "l = (lamda*math.atan(math.sqrt(Zl/Zo)))/(2*math.pi)\n", + "l_dash = (lamda*math.atan(math.sqrt((Zl*Zo)/(Zo-Zl))))/(2*math.pi)\n", + "\n", + "#Results\n", + "print \"The position of the stub is\", round(l,3),\"m\\n\"\n", + "print \"Please note that the solution for l_dash given in the textbook is incorrect\"\n", + "print \"Length of stub is\",round(l_dash,3),\"m\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The position of the stub is 0.185 m\n", + "\n", + "Please note that the solution for l_dash given in the textbook is incorrect\n", + "Length of stub is 0.707 m\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.7, Page number 50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import cmath\n", + "import math\n", + "\n", + "#Variable declaration\n", + "s = 3.2 #VSWR\n", + "Xmin = 0.237 #minimum voltage(V)\n", + "Zo = 50 #characteristic impedance(Ohms)\n", + "\n", + "#Calculations\n", + "q = math.tan(math.degrees(2*math.pi*Xmin))\n", + "x = complex(1,-(s*q))\n", + "y = complex(s, -q)\n", + "Zl = Zo*(x/y)\n", + "\n", + "#Result\n", + "print \"Please note that the solution given in the textbook is incorrect.Hence the difference in answers\\n\"\n", + "print \"Terminating impedance =\", Zl,\"Ohms\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Please note that the solution given in the textbook is incorrect.Hence the difference in answers\n", + "\n", + "Terminating impedance = (19.6572514629-23.7885950214j) Ohms\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.8, Page number 51" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#Variable declaration\n", + "Zo = 50. #characteristic impedance(Ohms)\n", + "Zl = 100. #load resistance(Ohms)\n", + "f = 300*10**3 #frequency(Hz)\n", + "Pl = 50*10**-3 #load power(W)\n", + "c = 3*10**8 #velocity of propagation(m/s)\n", + "\n", + "#Calculations\n", + "lamda = c/f\n", + "\n", + "#Part a\n", + "rho = (Zl-Zo)/(Zl+Zo)\n", + "s = (1+abs(rho))/(1-abs(rho))\n", + "\n", + "#Part b\n", + "#Since real Zl>Zo, first Vmax is located at the load\n", + "Vmin_pos = lamda/4\n", + "\n", + "#Part c\n", + "Vmax = math.sqrt(Pl*Zl)\n", + "Vmin = Vmax/s\n", + "\n", + "#Part d\n", + "Zin_at_Vmin = Zo/s\n", + "Zin_at_Vmax = Zo*s\n", + "\n", + "\n", + "#Results\n", + "print \"VSWR = \", s\n", + "print \"First Vmax is loacted at load and first Vmin is located at\", Vmin_pos,\"m from the load\"\n", + "print \"Vmin = \",round(Vmin,2),\"V and Vmax = \",round(Vmax,2),\"V\"\n", + "print \"Impedance at Vmin is \", Zin_at_Vmin,\"Ohm and impedance at Vmax is\",Zin_at_Vmax,\"Ohm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "VSWR = 2.0\n", + "First Vmax is loacted at load and first Vmin is located at 250 m from the load\n", + "Vmin = 1.12 V and Vmax = 2.24 V\n", + "Impedance at Vmin is 25.0 Ohm and impedance at Vmax is 100.0 Ohm\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.9, Page number 52" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable declaration\n", + "Zo = 600. #characteristic impedance(Ohms)\n", + "Zs = 50 #source impedance(Ohms)\n", + "l = 200 #length of line(m)\n", + "Zl = 500. #load resistance(Ohms)\n", + "\n", + "#Calculations\n", + "rho = (Zl-Zo)/(Zl+Zo)\n", + "\n", + "#Part a\n", + "ref_l = math.log10(1/(1-((abs(rho))**2)))\n", + "\n", + "#Part b\n", + "#Since, the line is lossless,\n", + "att_l = 0\n", + "trans_l = ref_l+att_l\n", + "\n", + "#Part c\n", + "ret_l = math.log10(abs(rho))\n", + "\n", + "#Results\n", + "print \"Reflection loss =\",round(ref_l,4),\"dB\"\n", + "print \"Transmission loss =\",round(trans_l,4),\"dB\"\n", + "print \"Return loss =\",round(ret_l,3),\"dB (Calculation error in the textbook)\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Reflection loss = 0.0036 dB\n", + "Transmission loss = 0.0036 dB\n", + "Return loss = -1.041 dB (Calculation error in the textbook)\n" + ] + } + ], + "prompt_number": 55 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3.10, Page number 52" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import cmath\n", + "import math\n", + "\n", + "#Variable declaration\n", + "l = 10 #length of line(km)\n", + "zsc = complex(1895.47,2234.29) \n", + "zoc = complex(216.99,-143.37)\n", + "f = 1*10**3 #frequency(Hz)\n", + "\n", + "#Calculations\n", + "zo = cmath.sqrt(zsc*zoc)\n", + "x = cmath.sqrt(zsc/zoc)\n", + "t = (1+x)/(1-x)\n", + "gamma = cmath.log(t)/(l*2)\n", + "B = gamma.imag\n", + "w = 2*math.pi*f\n", + "Vp = w/B\n", + "\n", + "#Results\n", + "print \"There is calculation mistake throughout the problem in the textbook\\n\"\n", + "print \"Characteristic impedance =\",zo,\"Ohms\"\n", + "print \"Phase velocity =\",round((Vp/1E+3),3),\"*10^3 m/sec\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "There is calculation mistake throughout the problem in the textbook\n", + "\n", + "Characteristic impedance = (864.190238563+123.274392427j) Ohms\n", + "Phase velocity = 45.994 *10^3 m/sec\n" + ] + } + ], + "prompt_number": 27 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Microwave_and_Radar_Engineering/.ipynb_checkpoints/Chapter_4-checkpoint.ipynb b/Microwave_and_Radar_Engineering/.ipynb_checkpoints/Chapter_4-checkpoint.ipynb new file mode 100644 index 00000000..05272d36 --- /dev/null +++ b/Microwave_and_Radar_Engineering/.ipynb_checkpoints/Chapter_4-checkpoint.ipynb @@ -0,0 +1,1203 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:fddff29c571385d7ad533c0da8d46227c19589926b0642ffe1126b7caf1c9ca6" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 4:Microwave Transmission Lines" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.1, Page number 141" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable declaration\n", + "d = 0.49 #diameter of inner conductor(cm)\n", + "D = 1.10 #diameter of outer conductor(cm)\n", + "e = 2.3 #polyethylene dielectric\n", + "c = 3*10**8 #velocity of light(m/s)\n", + "\n", + "#Calculations\n", + "L = 2*10**-7*math.log(D/d)\n", + "C = (55.56*10**-12*e)/(math.log(D/d))\n", + "Ro = (60*math.log(D/d))/(math.sqrt(e))\n", + "v = c/(math.sqrt(e))\n", + "\n", + "#Results\n", + "print \"Inductance per unit length is\",round(L,8),\"H/m\"\n", + "print \"Capacitance per unit length is\",round(C,12),\"PF/m\"\n", + "print \"Characteristic impedance is\",round(Ro,3),\"Ohms\"\n", + "print \"Velocity of propagation is\",round(v,3),\"m/s\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Inductance per unit length is 1.6e-07 H/m\n", + "Capacitance per unit length is 1.58e-10 PF/m\n", + "Characteristic impedance is 31.993 Ohms\n", + "Velocity of propagation is 197814142.019 m/s\n" + ] + } + ], + "prompt_number": 48 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.2, Page number 142" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#Variable declartion\n", + "R = 0.05 #Ohms/m\n", + "L = 1.6*10**-7 #Inductance(from example 4.1)\n", + "C = 1.58*10**-10 #Capacitance(from example 4.1)\n", + "w = 2*math.pi\n", + "c = 3*10**8 #velocity of light(m/s)\n", + "e = 2.3 #polyethylene dielectric(from example 4.1)\n", + "Pin = 480 #Input power(W)\n", + "l = 50 #line length(m)\n", + "\n", + "#Calculations\n", + "zo=math.sqrt(L/C)\n", + "alpha = R/(2*zo)\n", + "B = w*math.sqrt(L*C)\n", + "Vp = 1/math.sqrt(L*C)\n", + "e = (C/Vp)**2\n", + "Pl = Pin*2*l\n", + "\n", + "#Results\n", + "print \"Attenuation constant =\",round(alpha,5),\"Np/m\"\n", + "print \"Phase constant =\",round(B,8),\"rad/m\"\n", + "print \"Phase velocity =\",round(Vp*10**-6,2),\"*10**-6 m/s\"\n", + "print \"Relative permittivity =\",e\n", + "print \"Power loss =\",round(Pl),\"W\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Attenuation constant = 0.00079 Np/m\n", + "Phase constant = 3e-08 rad/m\n", + "Phase velocity = 198.89 *10**-6 m/s\n", + "Relative permittivity = 6.3108992e-37\n", + "Power loss = 48000.0 W\n" + ] + } + ], + "prompt_number": 67 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.3, Page number 142" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#Variable declaration\n", + "f = 9.375*10**10 #Frequency(Hz)\n", + "c = 3*10**8 #velocity of light(m/s)\n", + "b_a = 2.3\n", + "\n", + "#Calculations\n", + "lamda = c/f\n", + "#Since b_by_a = 2.3 and b+a lamda_o. Therefore for TE01 mode,\n", + "lamda_c1 = 2*b\n", + "if lamda_c1lamda_o:\n", + " print \"TE10 is a possible mode\"\n", + "fc = c/lamda_c2\n", + "lamda_c3 = (2*a*b)/math.sqrt((a**2)+(b**2)) #for TE11 and TM11 modes\n", + "if lamda_c3lamda_o\n", + "\n", + "#Part(i)\n", + "x = [TE10, TM11, TM21]\n", + "#largest=x[0]\n", + "for large in x:\n", + " if large > lamda_o1:\n", + " largest=large\n", + "print \"Part(i)\\nSince lamda_c =\",(largest),\"which is greater than lamda_o1, only TE10 mode propagates\"\n", + "\n", + "#Part(ii)\n", + "print \"\\nPart(ii)\"\n", + "if TE10>lamda_o2:\n", + " print \"TE10 mode propagates\"\n", + " if TM11>lamda_o2:\n", + " print \"TM11 mode propagates\"\n", + " if TM21>lamda_o2:\n", + " print \"TM21 mode propagates\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Part(i)\n", + "Since lamda_c = 16 which is greater than lamda_o1, only TE10 mode propagates\n", + "\n", + "Part(ii)\n", + "TE10 mode propagates\n", + "TM11 mode propagates\n", + "TM21 mode propagates\n" + ] + } + ], + "prompt_number": 35 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.16, Page number 152" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#Variable declaration\n", + "a = 3 #length of rectangular waveguide(cms)\n", + "b = 2 #breadth of rectangular waveguide(cms)\n", + "f = 10.*10**9 #frequency(Hz)\n", + "c = 3.*10**10 #velocity of propagation(cm/s)\n", + "n = 120*math.pi #intrinsic impedance\n", + "\n", + "#Calculations\n", + "lamda_c = (2*a*b)/(math.sqrt(a**2+b**2))\n", + "lamda_o = c/f\n", + "Ztm = n*math.sqrt(1-((lamda_o/lamda_c)**2))\n", + "\n", + "#Result\n", + "print \"Solution obtained in the textbook are incorrect due to calculation mistake in Ztm\"\n", + "print \"characteristic wave impedance =\",round(Ztm,3),\"Ohms\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Solution obtained in the textbook are incorrect due to calculation mistake in Ztm\n", + "characteristic wave impedance = 163.242 Ohms\n" + ] + } + ], + "prompt_number": 71 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.17, Page number 152" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#Variable declaration\n", + "f = 6.*10**9 #frequency(Hz)\n", + "c = 3.*10**10 #velocity of propagation(cm/s)\n", + "\n", + "#Calculations\n", + "fc = 0.8*f\n", + "lamda_c = c/fc\n", + "D = (lamda_c*1.841)/math.pi\n", + "lamda_o = c/f\n", + "lamda_g = lamda_o/(math.sqrt(1-((lamda_o/lamda_c)**2)))\n", + "\n", + "#Results\n", + "print \"diameter of waveguide =\",round(D,4),\"cms\"\n", + "print \"guide wavelength =\",round(lamda_g,3),\"cms\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "diameter of waveguide = 3.6626 cms\n", + "guide wavelength = 8.333 cms\n" + ] + } + ], + "prompt_number": 65 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4.18, Page number 153" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#Variable declaration\n", + "a = 1.5 #length of waveguide(cms)\n", + "b = 1 #breadth of waveguide(cms)\n", + "c = 3*10**10 #velocity of propagation\n", + "Er = 4 #dielectric\n", + "f = 6*10**9 #frequency(Hz)\n", + "\n", + "#Calculations and Results\n", + "lamda_c = 2*a\n", + "fc = c/lamda_c\n", + "if flamda_c:\n", + " print \"Since the wavelength of the impressed signal is longer than the cut-off wavelength, there is no propagation of wave\"\n", + "lamda2 = lamda1/math.sqrt(Er)\n", + "if lamda2" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The plot is shown in the graphic window.\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 11.6 Page: 283\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "from matplotlib.pyplot import *\n", + "from numpy import *\n", + "\n", + "\n", + "T = 92 + 273.15 #[K] Temperature of the system\n", + "R = 8.314 #[m**(3)*Pa/(mol*K)] universal gas consmath.tant\n", + "\n", + "A = 1.2739\n", + "B = 3.9771\n", + "\n", + "\n", + "\n", + "def f(x_a): \n", + "\t return (R*T/1000)*( x_a*log(x_a) + (1-x_a)*log(1-x_a) + \\\n", + " x_a*(B**(2)*A*(1-x_a)**(2)/(A*x_a + B*(1-x_a))**(2)) + (1-x_a)* \\\n", + " (A**(2)*B*x_a**(2)/(A*x_a + B*(1-x_a))**(2)) )\n", + "\n", + "x_a = linspace(0.000001,0.99999,100)\n", + "a = f(x_a)\n", + "plot(x_a,a)\n", + "\n", + "x = linspace(0.0,0.99999,100)\n", + "a = 1.2090312*x-1.251495764\n", + "plot(x,1.2090312*x-1.251495764)\n", + "xlabel(\" Mol fraction of species a, x_a\");\n", + "ylabel(\" g_mix - sum(x_i*g_i0)\");\n", + "\n", + "show()\n", + "\n", + "print \"Thus based on the several assumptions that the Van Laar equation is an accurate representation of LLE\"\n", + "print \"we would conclude that at 92 deg C water-n-butanol does form two liquid phases.\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAY4AAAENCAYAAAAYIIIKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xdc1dX/wPEXiqll7kAFDHOxkaGmpuLAhZqZKzNHZ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r2fQNnrM6sLfuHFj1qxZQ3p6Ov/88w/79++n\nXr16OiWfMmXKUK5cOQ4ePAjAqlWrMmp5P+33b9++zYMHD+jcuTPTp0/PqPOslMq4Uzp48CBly5al\ndOnStG7dmi+++CLj9x+29/X1ZcmSJRkLBeLi4jLaWFhY8Oqrr3Lo0CH++usvQJtbuHz5MklJScTH\nx9O2bVs+++wzzp49mynGR8/toxvfRUZG0rJlyyw/1wcffMCnn35Kz549GTNmzFPPWUJCAlZWVhQt\nWpS9e/dy7dq1p7YV5kcSh8hTD/86LlWqFKNGjcooxfnw/UGDBpGeno6bmxs9evRgxYoVFCtWLNuV\nV0++/+j3U6ZMoWvXrnh7e/PSSy9l/GzChAnExcXh6uqaUawH4P3338fNzS1jcvxh+zfeeCNjIr1F\nixbMmzcPKyurLOPKKs4VK1YwatQo3N3dOXfuHJMmTcpom1X7yMhImjVrljFR/3C1l4WFBSVKlMDT\n05NBgwbx7bffAtpf/6mpqbi5ueHi4sLkyZMBeO+996hatSpubm7UqVOHn3766bHjVKxYkeXLl2cs\naW7YsCFhYWH8+++/dOjQAXd3dxo3bszChQszxTh69Gg++eQTPD09SUtLy/gcUVFRWZZYXblyJcWL\nFxFtKzUAAACaSURBVKdHjx6MHTuW48ePP3Xxw9tvv82JEydwc3Nj1apVsgIsn5HdcYUwI82aNWPB\nggV4enqaOpSnWrRoES+//HKW8yKicJDJcSGEXgYPHmzqEISJyR2HEMJg/vjjD3r37v3YeyVKlODI\nkSMmikjkBUkcQggh9CKT40IIIfQiiUMIIYReJHEIIYTQiyQOIYQQepHEIYQQQi//B/me7yCdpEt7\nAAAAAElFTkSuQmCC\n", + "text": [ + "" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus based on the several assumptions that the Van Laar equation is an accurate representation of LLE\n", + "we would conclude that at 92 deg C water-n-butanol does form two liquid phases.\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 11.7 Page: 286\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "R = 8.314 #[J/(ml*K)]\n", + "\n", + "\n", + "\n", + "h_mix = -2967.7*R/1000 #[kJ/mol] Heat of mixing of water-in-benzene\n", + "\n", + "h_mix_1 = 522.9*R/1000 #[kJ/mol] Heat of mixing of benzene-in-water\n", + "\n", + "print \" Heat of mixing of water-in-benzene is given as %f kJ/mol\"%(h_mix)\n", + "print \" Heat of mixing of benzene-in-water is given as %f kJ/mol\"%(h_mix_1)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Heat of mixing of water-in-benzene is given as -24.673458 kJ/mol\n", + " Heat of mixing of benzene-in-water is given as 4.347391 kJ/mol\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 11.8 Page: 287\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "T_i = 50. #[F] Initial temperature of the system \n", + "T_f = 20. #[F] Final temperature of the system\n", + "M_gas = 115. #[g/mol] Molecular weight of gasoline at room temperature\n", + "M_water = 18. #[g/mol] Molecular weight of water at the room temperaature\n", + "d = 720. #[g/L] density of gasoline at the room temperature\n", + "\n", + "s_50 = 0.00026 #[mol fraction]\n", + "\n", + "s_20 = 0.0001 #[mol fraction]\n", + "\n", + "s_rej = s_50 - s_20 # mol of water per mole of gasoline \n", + "\n", + "w = (s_rej*d*M_water)/M_gas #[g water/L gasoline]\n", + "\n", + "print \" The amount of water that will come out of the solution in the gasoline will be %f g water/L gasoline\"%(w)\n", + "print \" At 20 deg F we would expect this water to become solid ice, forming a piece large enough to plug the fuel line of a parked auto.\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The amount of water that will come out of the solution in the gasoline will be 0.018031 g water/L gasoline\n", + " At 20 deg F we would expect this water to become solid ice, forming a piece large enough to plug the fuel line of a parked auto.\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 11.9 Page: 290\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from numpy import *\n", + "from matplotlib.pyplot import *\n", + "import math \n", + "\n", + "Temp = 25. #[C]\n", + "x_water = 5. #[mo]\n", + "x_benzene = 0.1 #[mol]\n", + "\n", + "\n", + "\n", + "x_ethanol_water_rich = 3.817 #[%]\n", + "x_ethanol_benzene_rich = 1.010 #[%]\n", + "\n", + "K = x_ethanol_water_rich/x_ethanol_benzene_rich\n", + "\n", + "X = array([3.817,7.968,12.977,18.134,23.540,24.069,27.892,31.725,35.510,39.382,41.062,41.771])\n", + "Y = array([1.010,3.323,5.860,9.121,12.939,13.340,16.090,18.943,22.444,26.216,29.341,33.093])\n", + "Z = X/Y\n", + "\n", + "plot(Y,Z)\n", + "xlabel(\"Mol% ethanol in benzene-rich phase \");\n", + "ylabel(\"Distribution coefficient of ethanol, K_ethanol\");\n", + "show()\n", + "K_1 = 4\n", + "\n", + "m_water_rich = 100*K_1/(K_1+1)\n", + "m_benzene_rich = 100/(K_1+1)\n", + "\n", + "print \" Ethanol''s 0.1 mol distributed in the water rich phase will be %f mol%% of the total mol\"%(m_water_rich)\n", + "print \" Ethanol''s 0.1 mol distributed in the benzene rich phase will be %f mol%% of the total mol\"%(m_benzene_rich)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEMCAYAAAArnKpYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlYlPX6x/H3ICoiKC6hhRakUiAwgAimGSAuuS9paWWY\nWWZ1zNOpk3XMMPtp56SVlqfTYu5luZRmWJmKiksoYVq2iIniEuKCgoCyfH9/PM0Is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v75ZwoLCwHYsGEDbdq0ueaszLIzNz/++GP2799P165d+eabb1BK\n8eqrrzJ16lSz88ycOdP8N2EFN910EytWrDDrOTqdzmnW8KlKSUkJ48ePL/eHgqU58oxfcW1SFK4D\n/fr146uvvgLgk08+YdSoUcYvt7NnzzJkyBD0ej133HEH+/fvB7SJSIbHKKW4dOkS+fn51K9fn6VL\nl9KvXz+8vLyqPObSpUuJiooiLCyMxx9/nNLSUiZPnkxBQQFhYWGMHj0anU5HSUkJjz32GEFBQfTp\n08dYvD744AMiIyMJDQ1l+PDhxj3Bx4wZw9NPP023bt1o164dq1atMmZ87rnnCA4OJiQkhM8++6za\nz6TsGcTChQsZNmwYffv2xd/fn+eff77K5/3nP/8hJCSEqKgoDh06BEB2djbDhw8nMjKSyMhIduzY\nAWh/MY8dO5bY2FjatWvH22+/DcD//vc/wsLCCAsLw8/Pjx49egDw7bff0rVrVzp16sS9997LxYsX\nAe0MJSEhgU6dOhESEsJvv/0GaBMix44dS1RUFOHh4axdu7bSzDExMfz973+nc+fOzJkzh2nTphn/\nkk9PT6dnz56EhobSqVMn/vjjD3Q6HXl5eYwYMYKAgAAefPDBKl930qRJhIWFERwczO7du433HThw\noML7Bhg6dCgREREEBQUZ1wIrKSlhzJgxxt/dW2+9BcChQ4fo27cvERER3HXXXcb3LazMinMphAPw\n8PBQ+/btU8OHD1eFhYUqNDRUJSUlqQEDBiillHrqqafUK6+8opRSatOmTSo0NFQppdSCBQvUU089\npZRSasmSJSosLEyNHj1a5ebmqh49eqji4uIqj3ngwAE1cOBA42MmTJigFi9ebMxjcPjwYeXq6qp+\n/PFHpZRS9957r1q6dKlSSpVbbnzKlCnq7bffVkopFR8fr+69917jcdq3b6+UUmrlypWqV69eqrS0\nVGVlZambb75Z/fnnn1XuD1729gULFqhbb71VXbhwQRUWFqpbbrlFHTt2rMJzfH19jRMQFy9ebPwM\nR40aZdxn/MiRIyogIEAppa1j361bN3X58mV1+vRp1aJFi3KfW1FRkerevbtat26dys7OVn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/Hy8uLHH3/km2++4X//+x+fffYZb731Fl5eXqSlpZmVW9Se9ClcJ8aO\nHUtCQoJxfXWD7t27s2zZMkAbdXLDDTfg4eFR6Wu89NJLTJ8+HdD++ldKodPpjO39BnFxcaxcudJY\nfM6ePcvRo0cBqF+/fpVfMKpMP0ZeXh6tW7emqKiIpUuXXvMLvnv37nz66aeUlpaSnZ3N1q1biYyM\nrPY51bm6wBhu+/TTTwH49NNPjX/J9+7dm7lz5xof9+OPP1b72qmpqcyePbvcCKAuXbqwfft2Yz/F\nxYsXOXjwYLWv06dPn3LHNXyBfvTRR6SlpRkLQlXvz8PDgzZt2hg3rrp06VKF3+W1GD6P5ORkvLy8\naNKkSZWf3YULF2jWrBlubm78+uuv7Nq1C4AzZ85QUlLCsGHDmD59OmlpaXh6euLn58fKlSuNz9+3\nb59Z2UTNSFGo4wxfpj4+Pjz11FPG2wy3JyQkkJqail6v58UXXzSuBnn1uvF79+7FxcXFuLPW/fff\nT0hICDt37jQ27RgEBATw6quv0rt3b/R6Pb179zau1PjYY48REhJi7Ggue4yy16dPn05UVBR33nkn\nAQEBlb6nsj8PHTqUkJAQ9Ho9cXFxvP7668YljqsqKIbbK1sjv7Ln6HQ6zp07h16v5+233+bNN98E\nYO7cuezZswe9Xk/Hjh157733qsyqlGLevHmcO3eO2NhYwsLCeOyxx2jZsiULFy5k1KhR6PV6unbt\nWmnHatmsL730EkVFRYSEhBAUFMTLL79c6fus7r0vWbKEuXPnotfrufPOO/nzzz9N/jwA3NzcCA8P\n54knnmD+/PkVMpZ9/t13301xcTGBgYG88MIL3HHHHYC2mZbhsxg9erRxhNqyZcuYP38+oaGhBAUF\nVdmRLixLFsQTQtRIbGwss2fPJjw83N5RhAXJmYIQQggjOVMQQghhJGcKQgghjKQoCCGEMJKiIIQQ\nwkiKghBCCCMpCkIIIYykKAghhDD6f+NRTP1s7PsOAAAAAElFTkSuQmCC\n", + "text": [ + "" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Ethanol''s 0.1 mol distributed in the water rich phase will be 80.000000 mol% of the total mol\n", + " Ethanol''s 0.1 mol distributed in the benzene rich phase will be 20.000000 mol% of the total mol\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 11.10 Page: 293\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "Temp = 20. #[C]\n", + "s = 36.0 #[g per 100 g of water]\n", + "M_NaCl = 58.5 #[g/mol] molecular weight of NaCl \n", + "M_water = 18. #[g/mol] molecular weight of water\n", + "\n", + "w = s/(s+100)\n", + "w_percent = w*100 #[wt %]\n", + "\n", + "x = (s/M_NaCl)/((s/M_NaCl)+(100/M_water))\n", + "x_percent = x*100 #[mol %]\n", + "\n", + "print \" Weight fraction of the NaCl in the saturated solution is %0.1f wt %%\"%(w_percent)\n", + "print \" Mol fraction of the NaCl in the saturated solution is %0.0f mol %%\"%(x_percent)\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Weight fraction of the NaCl in the saturated solution is 26.5 wt %\n", + " Mol fraction of the NaCl in the saturated solution is 10 mol %\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 11.11 Page: 293\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "T_inlet = 68. #[F]\n", + "T_outlet = 110. #[F]\n", + "\n", + "s_inlet_carbonate = 60. #[ppm]\n", + "s_inlet_sulphate = 2020. #[ppm]\n", + "\n", + "s_outlet_carbonate = 30. #[ppm]\n", + "s_outlet_sulphate = 2000. #[ppm]\n", + " # This is close enough to the solubility of the gypsum at 68F \n", + " # so we conclude that we would not expect either form of CaSO4 to prdcipitate\n", + " \n", + "w = s_inlet_carbonate - s_outlet_carbonate #[ppm]\n", + "\n", + "print \" Total amount of the solid left behind in the heater will be %0.1f ppm\"%(w)\n", + "\n", + " # Now if a typical houshold water heater heats 100 gallons/per day , we would expect to deposite \n", + "w_per_day = w*10**(-6)*100*8.33 #[lb/day]\n", + "print \" Total amount of the solid left behind in the heater per day will be %.3f lb/day\"%(w_per_day)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total amount of the solid left behind in the heater will be 30.0 ppm\n", + " Total amount of the solid left behind in the heater per day will be 0.025 lb/day\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 11.12 Page: 298\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "x_2 = 0.1\n", + "x_ideal_benzene = 0.114\n", + "x_ideal_CCl4 = 0.152\n", + "\n", + "y_i_1 = x_ideal_benzene/x_2# corresponding to practically ideal solution\n", + "\n", + "y_i_2 = x_ideal_CCl4/x_2# corresponding to mild type II behavior \n", + "\n", + "print \" Activity coefficient in benzene corresponding to practically ideal solution is %0.2f\"%(y_i_1)\n", + "print \" Activity coefficient in CCl4 corresponding to mild type II behavior is %0.2f\"%(y_i_2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Activity coefficient in benzene corresponding to practically ideal solution is 1.14\n", + " Activity coefficient in CCl4 corresponding to mild type II behavior is 1.52\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 11.13 Page: 299\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "T = 273.15+20 #[K]\n", + "\n", + "T_m = 273.15+800 #[K]\n", + "delta_h_fusion = 30219. #[J/g]\n", + "R = 8.314 #[J/(mol*K)]\n", + "\n", + "a = delta_h_fusion/(R*T)*(T_m/T-1)\n", + "\n", + "x_NaCl_into_y_i_1 = 1/math.exp(a)\n", + "\n", + "x_NaCl = 1/math.exp(a)*1\n", + "\n", + "print \" The solubility of the NaCl in water at 20 deg C is %e \"%( x_NaCl)\n", + "print \" But the experimental value is 0.1 so Similar to the results in book our results are very far wrong\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The solubility of the NaCl in water at 20 deg C is 4.704794e-15 \n", + " But the experimental value is 0.1 so Similar to the results in book our results are very far wrong\n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 11.14 Page: 301\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "P = 1*14.7 #[psia]\n", + "T = 30. #[F]\n", + "p_ice = 0.0808 #[psia]\n", + "x_water_in_ice = 1.00\n", + "\n", + "y_water_vapour = x_water_in_ice*p_ice/P\n", + "\n", + "print \" Equilibrium concentration of water vapour in the air is %0.4f\"%(y_water_vapour)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Equilibrium concentration of water vapour in the air is 0.0055\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 11.15 Page: 302\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "T = 273.15+35 #[K]\n", + "p_d = 100. #[atm]\n", + "R = 82.06 #[(cm**(3)*atm)/(mol*K)]\n", + "\n", + "p_naphthalene = 0.00065 #[atm]\n", + "\n", + "x_naphthalene = 1.00\n", + "P = p_d\n", + "\n", + "y_naphthalene = x_naphthalene*p_naphthalene/P\n", + "v = 132. #[cm**(3)/mol]\n", + "p_c = 1. #[atm]\n", + "f_d_by_f_c = math.exp(v/(R*T)*(p_d-p_c))\n", + "y_naphthalene = f_d_by_f_c*y_naphthalene\n", + "\n", + "print \"Estimated solubility of naphthalene in CO2 is %e\"%(y_naphthalene)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Estimated solubility of naphthalene in CO2 is 1.089816e-05\n" + ] + } + ], + "prompt_number": 31 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/.ipynb_checkpoints/ch12-checkpoint.ipynb b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/.ipynb_checkpoints/ch12-checkpoint.ipynb new file mode 100644 index 00000000..210f4e9f --- /dev/null +++ b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/.ipynb_checkpoints/ch12-checkpoint.ipynb @@ -0,0 +1,696 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:0a1da29e7840a18bf7735e26f0a43477053969d9c5f5a2bfceee638c83ec8906" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 12 : Chemical Equilibrium" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 12.1 Page: 311\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "T = 298.15 #[K] temperature\n", + "P = 1. #[atm] pressure \n", + "R = 8.314*10**(-3) #[kJ/(mol*K)]\n", + "\n", + "\n", + "\n", + "\n", + "g_a_0 = -20.9 #[kJ/mol]\n", + "g_b_0 = -17.2 #[kJ/mol]\n", + "\n", + "x_a = math.exp((g_b_0-g_a_0)/(R*T))/(1+math.exp((g_b_0-g_a_0)/(R*T)))\n", + "x_b = 1-x_a\n", + "\n", + "print \" The chemical equilibrium composition of the gaseous mixture contains %f mol fraction isobutane \\t\\t\\t\\t\\t\\t\\t\\tan %f mol fraction n-bumath.tane\"%(x_a,x_b)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The chemical equilibrium composition of the gaseous mixture contains 0.816475 mol fraction isobutane \t\t\t\t\t\t\t\tan 0.183525 mol fraction n-bumath.tane\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 12.2 Page: 319\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "T = 298.15 #[K] temperature\n", + "P = 0.987 #[atm] pressure\n", + "g_0_NO = 86.6 #[kJ/mol] Free energy of formation the NO from elements\n", + "R = 8.314 #[J/(mol*K)]\n", + "\n", + "g_0_O2 = 0.00\n", + "g_0_N2 = 0.00\n", + "\n", + "\n", + "delta_g_0 = 2*g_0_NO - g_0_O2 - g_0_N2 #[kJ/mol]\n", + "delta_g_01 = delta_g_0*1000 #[J/mol]\n", + "\n", + "K_298 = math.exp((-delta_g_01)/(R*T))\n", + "\n", + "f_0_N2 = 1. #[bar]\n", + "f_0_O2 = 1. #[bar]\n", + "f_0_NO = 1. #[bar]\n", + "\n", + "\n", + "\n", + "y_N2 = 0.78\n", + "y_O2 = 0.21\n", + "\n", + "y_NO_298 = math.sqrt(K_298*y_N2*y_O2)\n", + "\n", + "T_1 = 2000 #[K]\n", + "K_2000 = 4.0*10**-4\n", + "\n", + "y_NO_2000 = math.sqrt(K_2000*y_N2*y_O2)*10**(6) #[ppm]\n", + "\n", + "print \" The equilibrium constant for the reaction at 298.15 K is \\t\\t\\t %.1e\"%(K_298)\n", + "print \" The concentration of NO at equilibrium at temperature 298.15 K is \\t\\t %.1e\"%(y_NO_298)\n", + "print \" The equilibrium consmath.tant for the reaction at 2000 K is \\t\\t\\t %.1e\"%(K_2000)\n", + "print \" The concentration of NO at equilibrium at temperature 2000 K is \\t\\t %.0f ppm\"%(round(y_NO_2000,-2))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The equilibrium constant for the reaction at 298.15 K is \t\t\t 4.5e-31\n", + " The concentration of NO at equilibrium at temperature 298.15 K is \t\t 2.7e-16\n", + " The equilibrium consmath.tant for the reaction at 2000 K is \t\t\t 4.0e-04\n", + " The concentration of NO at equilibrium at temperature 2000 K is \t\t 8100 ppm\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 12.3 Page: 321\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "Temp = 2000. #[K]\n", + "n_air = 1. #[mol] no of moles of the air\n", + "\n", + "\n", + "K_2000 = 4*10**(-4)\n", + "\n", + "def f(x): \n", + "\t return (2*x)**(2) - K_2000*(0.78-x)*(0.21-x)\n", + "\t #return (K_2000-2)*x**(2)-K_2000*(0.78+0.21)*x+K_2000*0.78*0.21\n", + "x = fsolve(f,0)\n", + "c_NO = 2*x*10**(6) #[ppm]\n", + "p = c_NO/8100.*100\n", + "\n", + "print \" The calculated NO cocentration is %f ppm, which %f%% of the value computed in example 12.1\"%(c_NO,p)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The calculated NO cocentration is 7996.442873 ppm, which 98.721517% of the value computed in example 12.1\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 12.5 Page: 324\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "Temp = 298. #[K]\n", + "K = 29.6 # equilibrium consmath.tant at 298 K \n", + "P = 1. #[bar]\n", + "n_water_0 = 0.833 #[mol]\n", + "n_ethylene_0 = 1. #[mol]\n", + "n_ethanol_0 = 0. #[mol]\n", + "\n", + "n_T_0 = (n_water_0+n_ethylene_0+n_ethanol_0) #[mol]\n", + "\n", + "def f(e): \n", + "\t return ((0+e)/(1.833-e))/(((1-e)/(1.833-e))*((0.833-e)/(1.833-e)))-K*P/(1)\n", + "e_1 = fsolve(f,0)\n", + "e_2 = fsolve(f,0.5)\n", + "\n", + "y_ethanol = ((0+e_2)/(1.833-e_2))\n", + "y_ethylene = ((1-e_2)/(1.833-e_2))\n", + "y_water = ((0.833-e_2)/(1.833-e_2))\n", + "\n", + "print \"Concentration of the ethylene at the equilibrium is %f\"%(y_ethylene)\n", + "print \" Concentration of the water at the equilibrium is %f\"%(y_water)\n", + "print \" Concentration of the ethanol at the equilibrium is %f\"%(y_ethanol)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Concentration of the ethylene at the equilibrium is 0.243702\n", + " Concentration of the water at the equilibrium is 0.092079\n", + " Concentration of the ethanol at the equilibrium is 0.664219\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 12.6 Page: 324\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "Temp = 273.15+25 #[C]\n", + "P = 1. #[bar]\n", + "R = 8.314 #[J/(mol*K)]\n", + "\n", + "g_H2O_0 = -237.1 #[kJ/mol]\n", + "g_O2_0 = 0 #[kJ/mol]\n", + "g_H2_0 = 0 #[kJ/mol]\n", + "\n", + "delta_g_0 = g_H2O_0 - 0.5*g_O2_0-g_H2_0 #[kJ/mol]\n", + "delta_g_1 = delta_g_0*1000 #[J/mol]\n", + "\n", + "K = math.exp((-delta_g_1)/(R*Temp))\n", + "\n", + "n_T_0 = 1.5#[mol]\n", + "\n", + "\n", + "def f(e): \n", + "\t return (e/(1.5-0.5*e))/(((1-e)/(1.5-0.5*e))*((0.5-0.5*e)/(1.5-0.5*e))**(0.5))\n", + "\n", + "y_H2 = 2.4e-28\n", + "y_O2 = 0.5*y_H2\n", + "\n", + "print \" The equilibrium mol fraction of the hydrogen is %0.3e\"%(y_H2)\n", + "print \" And the equilibrium mol fraction of the oxygen is %e \"%(y_O2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The equilibrium mol fraction of the hydrogen is 2.400e-28\n", + " And the equilibrium mol fraction of the oxygen is 1.200000e-28 \n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 12.7 Page: 327\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "Temp = 298.15 #[K]\n", + "Press = 1*10**(5) #[Pa]\n", + "R = 8.314 #[J/(mol*K)]\n", + "\n", + "v_liquid = 1.805*10**(-5) #[m**(3)/mol] this liquid specific volume and we will treat is as a consmath.tant\n", + "\n", + "P_vapour_25 = 0.0317*10**(5) #[Pa]\n", + "\n", + "\n", + "def f0(P): \n", + "\t return v_liquid*P**(0)\n", + "\n", + "delta_g_0_1 = quad(f0,Press,P_vapour_25)[0]\n", + "\n", + "\n", + "delta_g_0_2 = 0 #[J/mol]\n", + "\n", + "\n", + "def f1(P): \n", + "\t return 1./P\n", + "\n", + "delta_g_0_3 = (R*Temp)* quad(f1,P_vapour_25,Press)[0]\n", + "\n", + "\n", + "delta_g_0 = delta_g_0_1+delta_g_0_2+delta_g_0_3 #[J/mol]\n", + "delta_g_1 = delta_g_0/1000 #[kJ/mol]\n", + "\n", + "print \" Total change in the free energy of water going under given conditions is %0.2f kJ/mol\"%(delta_g_1)\n", + "\n", + "delta_g_0_ideal_gas = -228.6 #[kJ/mol]\n", + "delta_g_0_liquid = -237.1 #[kJ/mol]\n", + "delta_g_o = delta_g_0_ideal_gas-delta_g_0_liquid #[kJ/mol]\n", + "\n", + "print \" From the values of Table A.8 given in the book the free energy change is %0.2f kJ/mol\"%(delta_g_o)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total change in the free energy of water going under given conditions is 8.55 kJ/mol\n", + " From the values of Table A.8 given in the book the free energy change is 8.50 kJ/mol\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 12.8 Page: 330\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "T1 = 273.15+25 #[K]\n", + "T2 = 273.15+400 #[K]\n", + "R = 8.314 #[J/(mol*K)]\n", + "\n", + "g0_NH3 = -16.5 #[kJ/mol]\n", + "g0_N2 = 0 #[kJ/mol]\n", + "g0_H2 = 0 #[kJ/mol]\n", + "\n", + "\n", + "delta_g_0 = g0_NH3 - 0.5*g0_N2 - 1.5*g0_H2 #[kJ/mol]\n", + "\n", + "K_1 = math.exp(-delta_g_0*1000/(R*T1)) # Equilibrium consmath.tant of the reaction at temperature 298.15 K\n", + "\n", + "h0_NH3 = -46.1 #[kJ/mol]\n", + "h0_N2 = 0 #[kJ/mol]\n", + "h0_H2 = 0 #[kJ/mol]\n", + "\n", + "del_h_1 = h0_NH3 - 0.5*h0_N2 - 1.5*h0_H2 #[kJ/mol]\n", + "\n", + "a_NH3 = 3.578\n", + "a_H2 = 3.249\n", + "a_N2 = 3.280\n", + "b_NH3 = 3.020*10**(-3) #[1/K]\n", + "b_H2 = 0.422*10**(-3)\n", + "b_N2 = 0.593*10**(-3)\n", + "c_NH3 = 0 #[1/K**(2)]\n", + "c_H2 = 0 #[1/K**(2)]\n", + "c_N2 = 0 #[1/K**(2)]\n", + "d_NH3 = -0.186*10**(5) #[K**(2)]\n", + "d_H2 = 0.083*10**(5) #[K**(2)]\n", + "d_N2 = 0.040*10**(5) #[K**(2)]\n", + "\n", + "del_a = a_NH3 - 0.5*a_N2 - 1.5*a_H2\n", + "del_b = b_NH3 - 0.5*b_N2 - 1.5*b_H2\n", + "del_c = c_NH3 - 0.5*c_N2 - 1.5*c_H2\n", + "del_d = d_NH3 - 0.5*d_N2 - 1.5*d_H2\n", + "\n", + "I = R*( del_a*T1 + del_b*T1**(2)/2 + del_c*T1**(3)/3 - del_d/T1) #[J/mol]\n", + "\n", + "\n", + "def f5(T): \n", + "\t return (del_h_1*1000 - I + R*(del_a*T + del_b*T**(2)/2 + del_c*T**(3)/3 - del_d/T))/T**(2)\n", + "\n", + "X = (1/R)* quad(f5,T1,T2)[0]\n", + "\n", + "\n", + "K_2 = K_1*math.exp(X)\n", + "\n", + "print \" Equilibrium consmath.tants for the formation of ammonia from hydrogen and nitrogen are \"\n", + "print \" K = %0.0f at temperature 25 deg C\"%(K_1)\n", + "print \" K = %f at temperature 400 deg C\"%(K_2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Equilibrium consmath.tants for the formation of ammonia from hydrogen and nitrogen are \n", + " K = 778 at temperature 25 deg C\n", + " K = 0.013588 at temperature 400 deg C\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 12.9 Page: 335\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "n_H2_0 = 1.5 #[mol]\n", + "n_N2_0 = 0.5 #[mol]\n", + "n_NH3_0 = 0 #[mol]\n", + "T_1 = 298.15 #[K]\n", + "T_2 = 673.15 #[K]\n", + "P = 1. #[bar]\n", + "\n", + "\n", + "\n", + "\n", + "K_298 = 778. # at temperature 298.15K\n", + "K_673 = 0.013 # at temperature 673.15K\n", + "\n", + "def g(e_1): \n", + "\t return ((0+e_1)/(2-e_1))/(((0.5-0.5*e_1)/(2-e_1))**(0.5)*((1.5-1.5*e_1)/(2-e_1))**(1.5))-K_298\n", + " \n", + "e_1 = fsolve(g,0.97)\n", + "y_NH3_298 = e_1/(2-e_1)\n", + "\n", + "def h(e_2): \n", + "\t return ((0+e_2)/(2-e_2))/(((0.5-0.5*e_2)/(2-e_2))**(0.5)*((1.5-1.5*e_2)/(2-e_2))**(1.5))-K_673\n", + "\n", + "e_2 = fsolve(h,0)\n", + "y_NH3_673 = e_2/(2-e_2)\n", + "\n", + "print \" The mole fraction of NH3 in the equilibrium at the temperature 298.15K and 1 bar is %f\"%(y_NH3_298)\n", + "print \" The mole fraction of NH3 in the equilibrium at the temperature 673.15K and 1 bar is %f\"%(y_NH3_673)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The mole fraction of NH3 in the equilibrium at the temperature 298.15K and 1 bar is 0.939036\n", + " The mole fraction of NH3 in the equilibrium at the temperature 673.15K and 1 bar is 0.004187\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 12.10 Page: 337\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "Temp = 273.15+400 #[K]\n", + "P = 150*1.01325 #[bar]\n", + "\n", + "K_673 = 0.013\n", + "\n", + "K = K_673*(P/1)**(1.5+0.5-1)\n", + "\n", + "def f(e): \n", + "\t return ((0+e)/(2-e))/(((0.5-0.5*e)/(2-e))**(0.5)*((1.5-1.5*e)/(2-e))**(1.5))-K\n", + "e=fsolve(f,0.5)\n", + "\n", + "y_NH3 = (0+e)/(2-e)\n", + "\n", + "print \"The mole fraction of the ammonia in the equilibrium is %0.2f\"%(y_NH3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The mole fraction of the ammonia in the equilibrium is 0.31\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 12.11 Page: 338\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "T = 273.15+400 #[K] given temperature\n", + "P = 150*1.01325 #[bar] given pressure\n", + "\n", + "K_673 = 0.013\n", + "\n", + "K_v = (10**((0.1191849/T + 91.87212/T**(2) + 25122730/T**(4))*P))**(-1)\n", + "\n", + "K = (K_673/K_v)*(P/1)**(1.5+0.5-1)\n", + "\n", + "\n", + "def f(e): \n", + "\t return ((0+e)/(2-e))/(((0.5-0.5*e)/(2-e))**(0.5)*((1.5-1.5*e)/(2-e))**(1.5))-K\n", + "e = fsolve(f,0.2)\n", + "\n", + "y_NH3 = (0+e)/(2-e)\n", + "\n", + "print \" The mole fraction of the ammonia in the equilibrium is %0.2f\"%(y_NH3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The mole fraction of the ammonia in the equilibrium is 0.34\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 12.12 Page: 340\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "p_i = 1. #[atm] initial pressure \n", + "P = 150. #[atm] final pressure\n", + "T = 273+25. #[K] Given temperature\n", + "R = 8.314 #[J/(mol*K)]\n", + "\n", + "delta_g_0 = 10.54*1000 #[J/mol]\n", + "\n", + "K = math.exp((-delta_g_0)/(R*T))\n", + "\n", + "\n", + "\n", + "def f(e): \n", + "\t return (e*e)/((1-e)*(1-e))-K\n", + "e = fsolve(f,0)\n", + "\n", + "v_C2H5OOC2H5 = 97.67 #[ml/mol]\n", + "v_H2O = 18.03 #[ml/mol]\n", + "v_C2H5OH = 58.30 #[ml/mol]\n", + "v_CH3COOH = 57.20 #[ml/mol]\n", + "\n", + "delta_v = v_C2H5OOC2H5 + v_H2O - v_C2H5OH - v_CH3COOH #[ml/mol]\n", + "\n", + "\n", + "\n", + "def g(e_1): \n", + "\t return (e_1*e_1)/((1-e_1)*(1-e_1))*math.exp((delta_v)/(R*T)*(P-p_i))-K\n", + "e_1 = fsolve(g,0.2)\n", + "\n", + "a = e_1/e\n", + "\n", + "\n", + "print \"On increamath.sing the pressure from 1 atm to 150 atm the reacted amount of the equimolar \\\n", + "reacmath.tants at equilibrium becomes %f times of initial\"%(a)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "On increamath.sing the pressure from 1 atm to 150 atm the reacted amount of the equimolar reacmath.tants at equilibrium becomes 0.994639 times of initial\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 12.13 Page: 342\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "P = 150. #[atm] given pressure\n", + "T = 400. #[C] temperature\n", + "K = 0.013\n", + "K_v = 0.84\n", + "delta_v = 1.5+0.5-1\n", + "\n", + "\n", + "K_p = (K/K_v)*(1/1)**(delta_v) #[1/bar]\n", + "\n", + "print \" Value of the K_p at the given condition is %f 1/bar)\"%(K_p)\n", + "print \" The basic K is dimensionless%( but K_p has the dimensions of pressure to the power.\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Value of the K_p at the given condition is 0.015476 1/bar)\n", + " The basic K is dimensionless%( but K_p has the dimensions of pressure to the power.\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/.ipynb_checkpoints/ch13-checkpoint.ipynb b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/.ipynb_checkpoints/ch13-checkpoint.ipynb new file mode 100644 index 00000000..b398bb05 --- /dev/null +++ b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/.ipynb_checkpoints/ch13-checkpoint.ipynb @@ -0,0 +1,646 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:ce47d914f54a1d45d40a3d6f4d1380a1b0ebd1de3c08f3c2df6139c5199b3710" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 13 : Equilibrium In Complex Chemical Reactions" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 13.1 Page: 349\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "T =273.15+25 #[K] given temperature\n", + "R = 8.314 #[J/(mol*K)] universal gas consmath.tant\n", + "\n", + "\n", + "g_0_H = 0 #[kJ/mol]\n", + "g_0_OH = -157.29 #[kJ/mol]\n", + "g_0_H2O = -237.1 #[kJ/mol]\n", + "\n", + "delta_g_0 = g_0_H + g_0_OH - g_0_H2O #[kJ/mol]\n", + "delta_g_1 = delta_g_0*1000 #[J/mol]\n", + "\n", + "K = math.exp((-delta_g_1)/(R*T))\n", + "\n", + "K_w = K\n", + "\n", + "print \"At the equilibrium the product of the hydrogen ion and hydroxil ion is %0.1e\"%(K_w)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "At the equilibrium the product of the hydrogen ion and hydroxil ion is 1.0e-14\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 13.2 Page: 351\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "n_H2SO4 = 1. #[mol] mole of the sulphuric acid\n", + "w_water = 1000. #[g] weight of the water \n", + "T =273.15+25 #[K] temperature\n", + "R = 8.314 #[J/(mol*K)]\n", + "\n", + "\n", + "g_0_H = 0 #[J/mol] free energy of the hydrogen ion\n", + "g_0_HSO4 = -756.01*1000 #[J/mol] free energy of the bisulphate ion\n", + "g_0_H2SO4 = -744.50*1000 #[J/mol] free enery of sulphuric acid\n", + "\n", + "delta_g_0 = g_0_H + g_0_HSO4 - g_0_H2SO4 #[J/mol]\n", + "\n", + "K_1 = math.exp((-delta_g_0)/(R*T))\n", + "\n", + "\n", + "g_0_H = 0 #[J/mol] free energy of the hydrogen ion\n", + "g_0_SO4 = -744.62*1000 #[J/mol] free energy of sulphate ion\n", + "g_0_HSO4 = -756.01*1000 #[J/mol] free energy of the bisulphate ion\n", + "\n", + "delta_g_1 = g_0_H + g_0_SO4 - g_0_HSO4 #[J/mol]\n", + "\n", + "K_2 = math.exp((-delta_g_1)/(R*T))\n", + "\n", + "\n", + "\n", + "def F(e):\n", + " f = [0,0]\n", + " f[0] = ((e[0]-e[1])*(e[0]+e[1]))/(1-e[0]) - K_1\n", + " f[1] = ((e[1])*(e[0]+e[1]))/(e[0]-e[1]) - K_2\n", + " return f\n", + "\n", + "e = [0.8,0.1]\n", + "y = fsolve(F,e)\n", + "e_1 = y[0]\n", + "e_2 = y[1]\n", + "\n", + "m_H2SO4 = 1-e_1 # [molal]\n", + "m_HSO4 = e_1 - e_2 #[molal]\n", + "m_SO4 = e_2 #[molal]\n", + "m_H = e_1 + e_2 #[molal]\n", + "\n", + "print \" The equilibrium concentration of H2SO4 in terms of molality is %f molal\"%(m_H2SO4)\n", + "print \" The equilibrium concentration of HSO4- in terms of molality is %f molal\"%(m_HSO4)\n", + "print \" The equilibrium concentration of SO4-- in terms of molality is %f molal\"%(m_SO4)\n", + "print \" The equilibrium concentration of H+ in terms of molality is %f molal\"%(m_H)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The equilibrium concentration of H2SO4 in terms of molality is 0.009444 molal\n", + " The equilibrium concentration of HSO4- in terms of molality is 0.980653 molal\n", + " The equilibrium concentration of SO4-- in terms of molality is 0.009903 molal\n", + " The equilibrium concentration of H+ in terms of molality is 1.000459 molal\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 13.3 Page: 352\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "P = 10. #[MPa] given pressure\n", + "T = 250. #[C] Temperature\n", + "n_T_0 = 1. #[mol]\n", + "n_CO = 0.15 #[mol]\n", + "n_CO2 = 0.08 #[mol]\n", + "n_H2 = 0.74 #[mol]\n", + "n_CH4 = 0.03 #[mol]\n", + "\n", + "\n", + "\n", + "V_1 = -2\n", + "V_2 = 0\n", + "K_1 = 49.9 # For the first reaction \n", + "K_2 = 0.032 # For the second reaction\n", + "\n", + "v_CO_1 = -1\n", + "v_H2_1 = -2\n", + "v_CH3OH_1 = +1\n", + "v_CO2_2 = -1\n", + "v_H2_2 = -1\n", + "v_CO_2 = +1\n", + "v_H2O_2 = +1\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "def F(e):\n", + " f = [0,0]\n", + " f[0] = ((0 + e[0])/(1 - 2*e[0]))/(((0.15 - e[0] + e[1])/(1 - 2*e[0]))*((0.74 - 2*e[0] - e[1])/(1 - 2*e[0]))**(2)) - K_1\n", + " f[1] = (((0.15 - e[0] + e[1])/(1 - 2*e[0]))*((0 + e[1])/(1 - 2*e[0])))/(((0.08 - e[1])/(1 - 2*e[0]))*((0.74 - 2*e[0] - e[1])/(1 - 2*e[0]))) - K_2\n", + " return f\n", + "\n", + "\n", + "e = [0.109, 0]\n", + "y = fsolve(F,e)\n", + "e_1 = y[0]\n", + "e_2 = y[1]\n", + "\n", + "c_CO2 = e_2/(n_CO2)*100\n", + "c_CO = e_1/(n_CO + 0.032)*100\n", + "\n", + "print \" Percent conversion of CO is %f%%\"%(c_CO)\n", + "print \" Percent conversion of CO2 is %f%%\"%(c_CO2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Percent conversion of CO is 96.815234%\n", + " Percent conversion of CO2 is 47.930771%\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 13.4 Page: 354\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "T = 273.15+25 #[K] Temperature\n", + "R = 8.314 #[J/(mol*K)] universal gas consmath.tant\n", + "\n", + "g_0_Ag = 77.12*1000 #[J/mol]\n", + "g_0_Cl = -131.26*1000 #[J/mol]\n", + "g_0_AgCl = -109.8*1000 #[J/mol]\n", + "\n", + "delta_g_0 = g_0_Ag + g_0_Cl - g_0_AgCl #[J/mol]\n", + "\n", + "K = math.exp((-delta_g_0)/(R*T))\n", + "\n", + "\n", + "a_AgCl = 1.00\n", + "\n", + "print \"The amount of solid dissolved in terms of solubility product is %0.2e\"%(K)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The amount of solid dissolved in terms of solubility product is 1.77e-10\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 13.5 Page: 357\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "T = 273.15+25 #[K] Given temperature of air\n", + "P = 1. #[atm] Pressure of the air\n", + "y_CO2 = 350.*10**(-6) # Amount of CO2 present in air at the given condition \n", + "R = 8.314 #[J/(mol*K)]\n", + "\n", + "g_0_H2CO3 = -623.1*1000 #[J/mol]\n", + "g_0_H = 0. #[J/mol]\n", + "g_0_HCO3 = -586.85*1000 #[J/mol]\n", + "\n", + "delta_g_0 = g_0_H + g_0_HCO3 - g_0_H2CO3 #[J/mol]\n", + "K_1 = math.exp((-delta_g_0)/(R*T)) \n", + "\n", + "g_0_CO3 = -527.89*1000 #[J/mol]\n", + "\n", + "delta_g_1 = g_0_H + g_0_CO3 - g_0_HCO3 #[J/mol]\n", + "K_2 = math.exp((-delta_g_1)/(R*T))\n", + "\n", + "\n", + "H = 1480. #[atm]\n", + "\n", + "x_CO2 = P*y_CO2/H\n", + "\n", + "n_water = 1000/18. #[mol]\n", + "m_CO2 = x_CO2*n_water #[molal]\n", + "\n", + "m_HCO3 = math.sqrt(K_1*m_CO2) #[molal]\n", + "m_H = m_HCO3 #[molal]\n", + "\n", + "m_CO3 = K_2*(m_HCO3/m_H) #[molal]\n", + "\n", + "print \" Amount of the CO2 dissolved in water in equilibrium with air is \\t\\t\\t%0.2e molal\"%(m_CO2)\n", + "print \" Conentration of HCO3 ion and hydrogen ion H- in solution in equilibrium with air is %0.2e molal\"%(m_HCO3)\n", + "print \" And concentration of CO3 ion in the solution in equilibrium with air is\\t\\t%0.2e molal\"%(m_CO3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Amount of the CO2 dissolved in water in equilibrium with air is \t\t\t1.31e-05 molal\n", + " Conentration of HCO3 ion and hydrogen ion H- in solution in equilibrium with air is 2.42e-06 molal\n", + " And concentration of CO3 ion in the solution in equilibrium with air is\t\t4.68e-11 molal\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 13.6 Page: 358\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "m_H = 10**(-10) #[molal] molality of hydrogen ion\n", + "K_1 = 4.5*10**(-7)\n", + "K_2 = 4.7*10**(-11)\n", + "\n", + "m_CO2 = 1.32*10**(-5) #[molal] from previous example\n", + "m_HCO3 = K_1*(m_CO2/m_H) #[molal]\n", + "\n", + "m_CO3 = K_2*(m_HCO3/m_H) #[molal]\n", + "\n", + "print \" Amount of the CO2 dissolved in water in equilibrium with air is \\t%0.2e molal\"%(m_CO2)\n", + "print \" Conentration of HCO3 ion in solution in equilibrium with air is \\t %0.2e molal\"%(m_HCO3)\n", + "print \" And concentration of CO3 ion in the solution in equilibrium with air is %0.2e molal\"%(m_CO3)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Amount of the CO2 dissolved in water in equilibrium with air is \t1.32e-05 molal\n", + " Conentration of HCO3 ion in solution in equilibrium with air is \t 5.94e-02 molal\n", + " And concentration of CO3 ion in the solution in equilibrium with air is 2.79e-02 molal\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 13.7 Page: 362\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "T = 298.15 #[K] Temperature\n", + "F = 96500. #[(coulomb)/(mole*electrons)] faraday consmath.tant\n", + "\n", + "\n", + "n_e = 6. #[electron]\n", + "g_0_CO2 = -394.4*1000 #[J/mol] \n", + "g_0_Al = 0 #[J/mol]\n", + "g_0_C = 0 #[J/mol]\n", + "g_0_Al2O3 = -1582.3*1000 #[J/mol]\n", + "\n", + "delta_g_0 = 1.5*g_0_CO2 + 2*g_0_Al - 1.5*g_0_C - g_0_Al2O3 #[J/mol]\n", + "\n", + "E_0 = (-delta_g_0)/(n_e*F) #[V]\n", + "\n", + "print \"Standard state cell voltage for the production of aluminium is %f Volt\"%(E_0)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Standard state cell voltage for the production of aluminium is -1.711054 Volt\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 13.8 Page: 362\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "T = 298.15 #[K] Temperature\n", + "F = 96500. #[(coulomb)/(mole*electrons)] faraday consmath.tant\n", + "\n", + "delta_g_0 = -587.7*1000 #[J/mol]\n", + "n_e = 1 #[electron] no of electron transferred\n", + "E_298_0 = (-delta_g_0)/(n_e*F) #[V]\n", + "\n", + "print \"The reversible voltage for given electrochemical device is %f Volt\"%(E_298_0)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The reversible voltage for given electrochemical device is 6.090155 Volt\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 13.9 Page: 363\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "T = 298.15 #[K] Temperature\n", + "P_0 = 1. #[atm]\n", + "P = 100. #[atm]\n", + "E_0 = -1.229 #[V]\n", + "F = 96500. #[(coulomb)/(mole*electrons)] faraday consmath.tant\n", + "R = 8.314 #[J/(mol*K)] universal gas consmath.tant \n", + "\n", + "n_e = 2. #[(mole electrons)/mole]\n", + "\n", + "\n", + "\n", + "E = E_0 - 1.5*(R*T)*math.log(P/P_0)/(n_e*F)\n", + "\n", + "print \"The equilibrium cell voltage of electrolytic cell if feed and product are at the pressure 100 atm is %f Volt\"%(E)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The equilibrium cell voltage of electrolytic cell if feed and product are at the pressure 100 atm is -1.317721 Volt\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 13.10 Page: 365 \n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "T = 273.15+25 #[K] Temperature\n", + "P = 11.38/760 #[atm] Pressure\n", + "R = 0.08206 #[(L*atm)/(mol*K)] Gas consmath.tant\n", + "v = 0.6525/0.04346 #[L/g] Specific volume \n", + "M = 60.05 #[g/mol] Molecular weight of HAc in the monomer form\n", + "\n", + "V = v*M #[L/mol]\n", + "\n", + "z = (P*V)/(R*T)\n", + "\n", + "print \"The value of the compressibility factor for HAc at given condition is %f\"%(z) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of the compressibility factor for HAc at given condition is 0.551780\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 13.11 Page: 366\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "T = 273.15+25 #[K] Temperature\n", + "P = 11.38 #[torr] Pressure\n", + "\n", + "\n", + "K = 10**(-10.4184 + 3164/T) #[1/torr]\n", + "\n", + "\n", + "def f(y_HAc_2): \n", + "\t return K*(P*(1-y_HAc_2))**(2)/P-y_HAc_2\n", + "y_HAc_2 = fsolve(f,0)\n", + "y_HAc = 1-y_HAc_2\n", + "\n", + "print \"Mole fraction of the monomer in the vapour phase is %f\"%(y_HAc)\n", + "print \"Mole fraction of the dimer in the vapour phase is %f\"%(y_HAc_2)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mole fraction of the monomer in the vapour phase is 0.210713\n", + "Mole fraction of the dimer in the vapour phase is 0.789287\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 13.12 Page: 367\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "T = 273.15+25 #[K] Temperature\n", + "P = 11.38/760 #[atm] Pressure\n", + "R = 0.08206 #[(L*atm)/(mol*K)] Gas consmath.tant\n", + "v = 0.6525/0.04346 #[L/g] Specific volume \n", + "\n", + "y_HAc = 0.211 # monomer \n", + "y_HAc_2 = 0.789 # dimer\n", + "\n", + "M_HAc = 60.05 #[g/mol] monomer \n", + "M_HAc_2 = 120.10 #[g/mol] dimer\n", + "\n", + "M_avg = M_HAc*y_HAc + M_HAc_2*y_HAc_2 #[g/mol]\n", + "\n", + "V = v*M_avg #[L/mol]\n", + "\n", + "z = (P*V)/(R*T)\n", + "\n", + "print \"The compressibility factor z for the gaseous mixture is %f\"%(z)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The compressibility factor z for the gaseous mixture is 0.987135\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/.ipynb_checkpoints/ch14-checkpoint.ipynb b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/.ipynb_checkpoints/ch14-checkpoint.ipynb new file mode 100644 index 00000000..335565d5 --- /dev/null +++ b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/.ipynb_checkpoints/ch14-checkpoint.ipynb @@ -0,0 +1,489 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:6d9acec694eaa6247956671e6c927c80e0d17b9873ff1364d6a6878fb63313c8" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 14 : Equilibrium With Gravity Or Centrifugal Force Osmotic Equilibrium Equilibrium With Surface Tension" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 14.1 Page: 379\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "T = 300. #[K] Temperature of the natural gas well\n", + "R = 8.314 #[J/(mol*K)] universal gas consmath.tant\n", + "z_1 = 0 #[m]\n", + "y_methane_surf = 85./100 #[mol%]\n", + "y_ethane_surf = 10/100. #[mol%]\n", + "y_propane_surf = 5/100. #[mol%]\n", + "P = 2. #[MPa] Total equilibrium pressure \n", + "z_2 = 1000. #[m] Depth of the well \n", + "\n", + "M_methane = 16./1000 #[kg/mol]\n", + "M_ethane = 30./1000 #[kg/mol]\n", + "M_propane = 44./1000 #[kg/mol]\n", + "\n", + "g = 9.81 #[m/s**(2)]\n", + "\n", + "f_methane_1 = y_methane_surf*P #[MPa]\n", + "f_ethane_1 = y_ethane_surf*P #[MPa]\n", + "f_propane_1 = y_propane_surf*P #[MPa]\n", + "\n", + "f_methane_2 = f_methane_1*math.exp((-M_methane*g*(z_1-z_2))/(R*T)) #[MPa]\n", + "f_ethane_2 = f_ethane_1*math.exp((-M_ethane*g*(z_1-z_2))/(R*T)) #[MPa]\n", + "f_propane_2 = f_propane_1*math.exp((-M_propane*g*(z_1-z_2))/(R*T)) #[MPa]\n", + "\n", + "P_2 = (f_methane_2 + f_ethane_2 + f_propane_2 ) #[MPa]\n", + "\n", + "y_methane_2 = f_methane_2/P_2\n", + "y_ethane_2 = f_ethane_2/P_2\n", + "y_propane_2 = f_propane_2/P_2\n", + "\n", + "print \"The mol fraction of the methane at the depth 1000m is %f\"%(y_methane_2)\n", + "print \"The mol fraction of the ethane at the depth 1000m is %f\"%(y_ethane_2)\n", + "print \"The mol fraction of the propane at the depth 1000m is %f\"%(y_propane_2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The mol fraction of the methane at the depth 1000m is 0.840351\n", + "The mol fraction of the ethane at the depth 1000m is 0.104461\n", + "The mol fraction of the propane at the depth 1000m is 0.055187\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 14.2 Page: 380\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "T = 288. #[K] Atmospheric temperature \n", + "R = 8.314 #[J/(mol*K)] universal gas consmath.tant\n", + "z_2 = 15000. #[m] Thickness of the atmosphere\n", + "z_1 = 0. #[m] Surface\n", + "y_N2_1 = 0.79\n", + "y_O2_1 = 0.21\n", + "M_N2 = 28./1000 #[kg/mol]\n", + "M_O2 = 32./1000 #[kg/mol]\n", + "\n", + "g = 9.81 #[m/s**(2)]\n", + "\n", + "a = math.exp(-(M_N2-M_O2)*g*(z_2-z_1)/(R*T))\n", + "yi2_by_yi1 = 1/(y_N2_1 + y_O2_1/a)\n", + "\n", + "print \" Concentration of the nitrogen at the top of atmosphere with respect to the concentration of nitrogen \\\n", + " at the surface of the earth is yi2_by_yi1 = %0.2f\"%(yi2_by_yi1)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Concentration of the nitrogen at the top of atmosphere with respect to the concentration of nitrogen at the surface of the earth is yi2_by_yi1 = 1.05\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 14.3 Page: 381\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "T = 288. #[K] Atmospheric temperature \n", + "R = 8.314 #[J/(mol*K)] Universal gas consmath.tant\n", + "z_2 = 10. #[m] Height of the reactor\n", + "z_1 = 0. #[m] Surface\n", + "g = 9.81 #[m/s**(2)] Accelaration due to gravity\n", + "\n", + "y_N2_1 = 0.79\n", + "y_O2_1 = 0.21\n", + "M_N2 = 28./1000 #[kg/mol]\n", + "M_O2 = 32./1000 #[kg/mol]\n", + "\n", + "a = math.exp(-(M_N2-M_O2)*g*(z_2-z_1)/(R*T))\n", + "yi2_by_yi1 = 1/(y_N2_1 + y_O2_1/a)\n", + "\n", + "print \" Concentration of the nitrogen at the top of reactor with respect to the concentration of nitrogen \\\n", + " at the bottom of reactor is yi2_by_yi1 = %f\"%(yi2_by_yi1)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Concentration of the nitrogen at the top of reactor with respect to the concentration of nitrogen at the bottom of reactor is yi2_by_yi1 = 1.000034\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 14.4 Page: 382\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "T = 300. #[K] Temperature of the centrifuge\n", + "R = 8.314 #[J/(mol*K)] Universal gas consmath.tant\n", + "y_UF6_238_1 = 0.993 # Mole fraction of UF6 with 238 isotope of uranium in feed\n", + "y_UF6_235_1 = 0.007 # Mole fraction of UF6 with 235 isotope of uranium in feed\n", + "M_UF6_238 = 352./1000 #[kg/mol] Molecular weight of UF6 with 238 isotope of uranium\n", + "M_UF6_235 = 349./1000 #[kg/mol] Molecular weight of UF6 with 235 isotope of uranium\n", + "r_in = 2./100 #[m] Interanal raddi of the centrifuge\n", + "r_out = 10./100 #[m] outer raddi of the centrifuge\n", + "f = 800. #[revolution/second] Rotational frequency of centrifuge\n", + "\n", + "a = math.exp((M_UF6_235-M_UF6_238)*(2*3.141592*f)**(2)*(r_out**(2)-r_in**(2))/(2*R*T))\n", + "\n", + "A = 1./(y_UF6_235_1 + y_UF6_238_1/a)\n", + "\n", + "B = 1./A\n", + "\n", + "print \"The ratio of the mole fraction of UF6 with uranium 235 isotope) at the 2 cm radius to\\\n", + " that at the 10 cm radius is %0.3f\"%(B)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The ratio of the mole fraction of UF6 with uranium 235 isotope) at the 2 cm radius to that at the 10 cm radius is 1.156\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 14.5 Page: 384\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "x_water_1 = 0.98 # mole fraction of water in phase 1 i.e. in seawater\n", + "x_water_2 = 1. # mole fraction of water in the phase 2 i.e. in water \n", + "R = 10.73 #[(psi*ft**(3))/(lbmol*R)] Universal gas consmath.tant\n", + "T = 500. #[R] temperature\n", + "v_water_1 = 18/62.4 # [ft**(3)/(lbmol)]\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "delta_P = (-(R*T)*math.log(x_water_1))/v_water_1#[psi]\n", + "\n", + "print \"The pressure difference between the two phases is %0.1f psi\"%(delta_P)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The pressure difference between the two phases is 375.7 psi\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 14.6 Page: 386\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "T = 100. #[C] Temperature of the outside\n", + "P_outside = 1. #[atm]\n", + "T = 0.05892 #[N/m] From metric steam table (7, page 267)\n", + "\n", + "\n", + "d_1 = 0.001 #[m]\n", + "\n", + "delta_P_1 = (4*T)/d_1 #[Pa]\n", + "\n", + "d_2 = 10**(-6) #[m]\n", + "\n", + "delta_P_2 = (4*T)/d_2 #[Pa]\n", + "\n", + "d_3 = 0.01*10**(-6) #[m]\n", + "delta_P_3 = (4*T)/d_3 #[Pa]\n", + "\n", + "print \"Pressure difference with the change in radius of the drop of the water is given as in the following table\"\n", + "print \" Diameter of the droplet d_iin meter Pressure difference P_inside - P_outside in atm\"\n", + "print \" %0.2e %0.2e\"%(d_1,delta_P_1) \n", + "print \" %0.2e %0.2e\"%(d_2,delta_P_2) \n", + "print \" %0.2e %0.2e\"%(d_3,delta_P_3) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Pressure difference with the change in radius of the drop of the water is given as in the following table\n", + " Diameter of the droplet d_iin meter Pressure difference P_inside - P_outside in atm\n", + " 1.00e-03 2.36e+02\n", + " 1.00e-06 2.36e+05\n", + " 1.00e-08 2.36e+07\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 14.7 Page: 387\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "P_NBP = 1. #[atm]\n", + "Temp =273.15+100 #[C] Temperature\n", + "D = 0.01*10**(-6) #[m] Diameter of the condensation nuclei( due to impurity )\n", + "T = 0.05892 #[N/m] Surface tension between water drops and gas\n", + "R = 8.314 #[J/(mol*K)]\n", + "\n", + "\n", + "v_water_liquid = 1/958.39*0.018 #[m**(3)/mol]\n", + "\n", + "\n", + "\n", + "I = math.exp(v_water_liquid*(4*T/D)/(R*Temp))\n", + "\n", + "P_gas_minus_P_NBP = (I-1)*P_NBP #[atm]\n", + "delta_P = P_gas_minus_P_NBP*1.01325 #[bar]\n", + "\n", + "delta_P_1 = delta_P*100*0.1450377 #[psi]\n", + "\n", + "print \"The equilibrium pressure at which the steam begin to condence at this temperature on \\\n", + " the nuclei is %f psi above the normal boiling point.\"%(delta_P_1)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The equilibrium pressure at which the steam begin to condence at this temperature on the nuclei is 2.253760 psi above the normal boiling point.\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 14.8 Page: 388\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "Temp = 273.15+100 #[K] Temperature of the water drop\n", + "R = 8.314 #[J/(mol*K)] Universal gas consmath.tant\n", + "D = 0.01*10**(-6) #[m] Diameter of the water drop\n", + "P_g = 0.15 #[bar] guage pressure\n", + "T = 0.05892 #[N/m] Surface tension between water drop and gas\n", + "\n", + "\n", + "v_water_liquid = 0.018/958.39 #[m**(3)/mol]\n", + "P_NBP = 1.013 #[bar]\n", + "P_gas = 1.013+0.15 #[bar]\n", + "\n", + "P_1 = P_gas + 4*T/D #[bar]\n", + "\n", + "def f2(P): \n", + "\t return v_water_liquid*P**(0)\n", + "\n", + "delta_g_1 = quad(f2,P_NBP,P_1)[0]\n", + "\n", + "\n", + "\n", + "def f3(P): \n", + "\t return (R*Temp)/P\n", + "\n", + "delta_g_2 = quad(f3,P_NBP,P_gas)[0]\n", + "\n", + "\n", + "delta_g = (delta_g_1 - delta_g_2) \n", + "\n", + "\n", + "print \"The liquid can lower its free energy %0.2f J/mol by Changing to gas,\"%(delta_g)\n", + "print \"So that even at 0.15 bar above the normal boiling point, a drop of this small size is unstable and will quickly evaporate.\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The liquid can lower its free energy 14.25 J/mol by Changing to gas,\n", + "So that even at 0.15 bar above the normal boiling point, a drop of this small size is unstable and will quickly evaporate.\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 14.9 Page: 390\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "Temp = 904.7 #[R] Temperature of the pure liquid water \n", + "P_NBP = 400. #[psia] Saturation pressure of the pure liquid water at the given temperature\n", + "T = 1.76*10**(-4) #[lbf/inch] Surface tension of water\n", + "R = 10.73 #[(psi*ft**(3))/(lbmol*R)]\n", + "\n", + "v_water_liquid = 18*0.01934 #[ft**(3)/lbmol]\n", + "D = 10**(-5.) #[inch]\n", + "\n", + "\n", + "def f(p): \n", + "\t return v_water_liquid*(p - P_NBP)-(R*Temp)*math.log((p+4*T/D)/P_NBP)\n", + "P_liquid = fsolve(f,300)\n", + "\n", + "P_inside = P_liquid + 4*T/D #[psia]\n", + "\n", + "print \"The liquid pressure at which these boiling nuclei will begin to grow and intiate boiling is %0.1f psia\"%(P_liquid)\n", + "print \"At this external pressure the pressure inside the bubble is %0.1f psia\"%(P_inside)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The liquid pressure at which these boiling nuclei will begin to grow and intiate boiling is 328.6 psia\n", + "At this external pressure the pressure inside the bubble is 399.0 psia\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/.ipynb_checkpoints/ch15-checkpoint.ipynb b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/.ipynb_checkpoints/ch15-checkpoint.ipynb new file mode 100644 index 00000000..a8bdca38 --- /dev/null +++ b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/.ipynb_checkpoints/ch15-checkpoint.ipynb @@ -0,0 +1,260 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:e78a9af8f6b64f20f90bc773dd4c5b922ed19d33b6608600d787b8b7d2cf559b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 15 : The Phase Rule" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 15.2 Page: 401" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "\n", + "print \" In this system there are four identifiable chemical species%(which are C,O2,CO2 and CO. The balanced equations we can write among them are\"\n", + "\n", + "print \" C + 0.5O2 = CO\"\n", + "print \" C + O2 = CO2\"\n", + "print \" CO + 0.5O2 = CO2\"\n", + "print \" CO2 + C = 2CO\"\n", + "\n", + "\n", + "print \" There are only two independent relations among these four species and\"\n", + "\n", + "V = 2# No of the variable\n", + "P = 2# No of the phases\n", + "C = V + P - 2\n", + "print \" C = V + P - 2\"\n", + "print \" C = 4 - 2 = 2\"\n", + "print \" Thus, this is a two-component system\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " In this system there are four identifiable chemical species%(which are C,O2,CO2 and CO. The balanced equations we can write among them are\n", + " C + 0.5O2 = CO\n", + " C + O2 = CO2\n", + " CO + 0.5O2 = CO2\n", + " CO2 + C = 2CO\n", + " There are only two independent relations among these four species and\n", + " C = V + P - 2\n", + " C = 4 - 2 = 2\n", + " Thus, this is a two-component system\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 15.3 Page: 402\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "print \" The three species in this system are H2 N2 and NH3\"\n", + "N = 3\n", + "print \" There is only one balanced chemical reaction among these species\"\n", + "Q = 1\n", + "\n", + "C = N - Q\n", + "print \" C = N - Q = %0.0f\"%(C)\n", + "print \" Let we start with pure ammonia in the system then ammonia will dissociate in H2 and N2 in the ratio of 3:1.\"\n", + "\n", + "print \" And the relation between their mole fraction is y_H2 = 3*y_N2\"\n", + "\n", + "SR = 1\n", + "c = N-Q-SR\n", + "print \" We have the modified phase rule as Components = species - independent reactions - stoichiometric restriction\"\n", + "print \" C = N - Q - SR = %0.0f\"%(c)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The three species in this system are H2 N2 and NH3\n", + " There is only one balanced chemical reaction among these species\n", + " C = N - Q = 2\n", + " Let we start with pure ammonia in the system then ammonia will dissociate in H2 and N2 in the ratio of 3:1.\n", + " And the relation between their mole fraction is y_H2 = 3*y_N2\n", + " We have the modified phase rule as Components = species - independent reactions - stoichiometric restriction\n", + " C = N - Q - SR = 1\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 15.4 Page: 403\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "\n", + "N = 3# No of species\n", + "Q = 1 # no of reaction\n", + "\n", + "SR = 0\n", + "C = N - Q - SR\n", + "\n", + "print \"Number of the components presents in the test tube are %0.0f\"%(C)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of the components presents in the test tube are 2\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 15.5 Page: 403\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "P = 3\n", + "C = 2\n", + "\n", + "V = C + 2 - P\n", + "\n", + "\n", + "print \" The no. of phases present in the system are %0.0f \"%(P)\n", + "print \" Total no of degrees of freedom is %0.0f \"%(V)\n", + "print \" Since there is only one degree of freedom so the system has a unique P-T curve\"\n", + "print \" which can be well represented by logp/torr = 23.6193 - 19827/T\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The no. of phases present in the system are 3 \n", + " Total no of degrees of freedom is 1 \n", + " Since there is only one degree of freedom so the system has a unique P-T curve\n", + " which can be well represented by logp/torr = 23.6193 - 19827/T\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 15.6 Page: 404\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "print \" The five species present in the system are H2O%( HCl%( H+%( OH- and Cl-. \"\n", + "N = 5 # Number of the species \n", + "print \" Here we have two chemical relations:\"\n", + "print \" H2O = H+ + OH- \"\n", + "print \" HCl = H+ + Cl- \"\n", + "\n", + "Q = 2 # No of the reactions\n", + "\n", + "SR = 1 \n", + "C = N - Q - SR\n", + "\n", + "print \" Number of the components present in the system are C = N - Q - SR = %0.0f\"%(C)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The five species present in the system are H2O%( HCl%( H+%( OH- and Cl-. \n", + " Here we have two chemical relations:\n", + " H2O = H+ + OH- \n", + " HCl = H+ + Cl- \n", + " Number of the components present in the system are C = N - Q - SR = 2\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/.ipynb_checkpoints/ch3-checkpoint.ipynb b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/.ipynb_checkpoints/ch3-checkpoint.ipynb new file mode 100644 index 00000000..c6d63f53 --- /dev/null +++ b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/.ipynb_checkpoints/ch3-checkpoint.ipynb @@ -0,0 +1,424 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:503de9d648d2755ec204b8822b124187c44f6b43ec4e442774530019aef1c520" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 3 : The Simplest Phase Equilibrium Examples and Some Simple Estimating Rules" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.1 Page: 52\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "T = 20. #[C]\n", + "P = 1. #[atm]\n", + "\n", + "x_N2 = 0\n", + "x_O2 = 0\n", + "x_water = 1-x_N2-x_O2\n", + "p_water = 0.023 #[atm]\n", + "y_water = x_water*p_water/P\n", + "\n", + "print \"The mole fraction of water vapour in air in equilibrium with water is %f\"%(y_water)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The mole fraction of water vapour in air in equilibrium with water is 0.023000\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.2 Page: 53\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "T = 20. #[C]\n", + "P = 1. #[atm]\n", + "y_water = 0.023\n", + "y = 1-y_water\n", + "y_O2 = y*0.21\n", + "H_O2 = 40100 #[atm]\n", + "x_O2 = y_O2*P/H_O2\n", + "y_N2 = y*0.79\n", + "H_N2 = 80400. #[atm]\n", + "\n", + "x_N2 = y_N2*P/H_N2\n", + "c = x_O2*998.2/18 #[(mole O2)/(L solution)]\n", + "V = c*24.06 #[(L O2, STP)/(L solution)]\n", + "V = V*1000 #[(ml O2, STP)/(L solution)]\n", + "\n", + "print \"Concentration of oxygen dissolved in water at equilibrium is %f mL O2, STP)/L solution)\"%(V)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Concentration of oxygen dissolved in water at equilibrium is 6.826690 mL O2, STP)/L solution)\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.3 Page: 52\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "from numpy import *\n", + "\n", + "P = 1.0 #[atm]\n", + "p_w = 0.023 #[atm] Vapor pressure of pure water\n", + "H_o = 40100 #[atm] Vapor pressure of pure oxygen\n", + "H_n = 80400. #[atm] Vapor pressure of pure nitrogen\n", + "\n", + "\n", + "\n", + "\n", + "A = matrix([[0.023, 0, 0, -1, 0, 0],[0, 40100, 0, 0, -1, 0],[0, 0 ,80400, 0, 0, -1],[0, 0, 0, 1, 1 ,1],[1 ,1, 1, 0, 0 ,0],[0, 0, 0, 0, 0.79, -0.21]]);\n", + "B = matrix([[0],[0],[0],[1],[1],[0]])\n", + "X = linalg.inv(A)\n", + "X = X * B\n", + "\n", + "print \" The composition in liquid and vapor phase are summarized in the following table:\"\n", + "print \" y_water \\t %f\"%(X[3])\n", + "print \" y_oxygen \\t %f\"%(X[4])\n", + "print \" y_nitrogen \\t %f\"%(X[5])\n", + "print \" x_water \\t %f\"%(X[0])\n", + "print \" x_oxygen \\t %e\"%(X[1])\n", + "print \" x_nitrogen \\t %e\"%(X[2])\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The composition in liquid and vapor phase are summarized in the following table:\n", + " y_water \t 0.023000\n", + " y_oxygen \t 0.205170\n", + " y_nitrogen \t 0.771830\n", + " x_water \t 0.999985\n", + " x_oxygen \t 5.116461e-06\n", + " x_nitrogen \t 9.599879e-06\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.4 Page: 57\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "\n", + "T = 20. #[C]\n", + "x_b = 0.80\n", + "x_t = 0.20\n", + "A_b = 6.90565\n", + "B_b = 1211.033\n", + "C_b = 220.79\n", + "\n", + "p_b = 10**(A_b-B_b/(T+C_b))\n", + "A_t = 6.95334\n", + "B_t = 1343.943\n", + "C_t = 219.337\n", + "p_t = 10**(A_t-B_t/(T+C_t))\n", + "p_1 = x_b*p_b\n", + "p_2 = x_t*p_t\n", + "y = 1.00 # y =(y_b+y_t) sum of the mole fractions of the benzene and toluene in the gaseous phase\n", + "P = (p_1+p_2)/y\n", + "y_b = x_b*p_b/P\n", + "y_t = x_t*p_t/P\n", + "\n", + "print \" Vapour pressure of the mixture in the gaseous phase is %f torr\"%(P)\n", + "print \" Mole fraction of the benzene in the vapour phase is %f\"%(y_b)\n", + "print \" Mole fraction of the toluene in the vapour phase is %f\"%(y_t)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Vapour pressure of the mixture in the gaseous phase is 64.518358 torr\n", + " Mole fraction of the benzene in the vapour phase is 0.932483\n", + " Mole fraction of the toluene in the vapour phase is 0.067517\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.5 Page: 57" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "\n", + "T = 20. #[C]\n", + "x_benzene = 1.00\n", + "p_i = 75.2 #[torr] vapour pressure of the benzene\n", + "P = 760. #[torr] Pressure of the atmosphere\n", + "\n", + "y_benzene = (x_benzene*p_i)/P\n", + "\n", + "print \" Mole fraction of the benzene in air that is saturated with benzene is %0.1f\"%(y_benzene)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Mole fraction of the benzene in air that is saturated with benzene is 0.1\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 3.6 Page: 58\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "P = 760. #[mm Hg]\n", + "x_b = 0.8 # Mole fraction of benzene in liquid phase\n", + "x_t = 0.2 # Mole fraction of toluene in liquid phase\n", + "\n", + "A_b = 6.90565\n", + "B_b = 1211.003\n", + "C_b = 220.79\n", + "\n", + "A_t = 6.95334\n", + "B_t = 1343.943\n", + "C_t = 219.337\n", + "T = 82. #[C]\n", + "err = 1.\n", + "\n", + "while err > 10**(-3):\n", + " p_b = 10**(6.90565 - 1211.003/(T + 220.79))\n", + " p_t = 10**(6.95334 - 1343.943/(T + 219.337))\n", + " y_b = x_b*p_b/P\n", + " y_t = x_t*p_t/P\n", + " err = abs((y_b + y_t) - 1)\n", + " T = T + 0.01\n", + "\n", + "print \" The temperature at which the given benzene-toluene mixture will have vapor pressure of 1 atm is %0.3f deg C\"%(T)\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The temperature at which the given benzene-toluene mixture will have vapor pressure of 1 atm is 84.360 deg C\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "\n", + "Example 3.7 Page: 60\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from numpy import *\n", + "import math \n", + "\n", + "\n", + "V = 0.25 #[L] Volume of water \n", + "T_1 = 0. #[C] Initial temperature of water\n", + "T_2 = 20. #[C] Final temperature of water\n", + "\n", + "x_o = 5.12*10**(-6) # mole fraction of oxygen\n", + "x_n = 9.598*10**(-6) # mole fraction of nitrogen\n", + "\n", + "\n", + "H_o = 2.55*10**(4) #[atm]\n", + "H_n = 5.29*10**(4) #[atm]\n", + "\n", + "p_w = 0.006 #[atm]\n", + "\n", + "\n", + "A = matrix([[0.006, 0, 0, -1, 0, 0],[0, 25500, 0, 0, -1, 0],[0, 0 ,52900, 0, 0, -1],[0, 0, 0, 1, 1, 1],[1, 1, 1, 0, 0, 0],[0, 0, 0, 0, 0.79, -0.21]])\n", + "B = matrix([[0],[0],[0],[1],[1],[0]])\n", + "X = linalg.inv(A)\n", + "X = X*B\n", + "\n", + "M_o_rej = V*( X[1] - x_o )/0.018 #[mole] oxygen\n", + "V_o = M_o_rej*24200 #[ml] oxygen\n", + "\n", + "M_n_rej = V*( X[2] - x_n )/0.018 #[mole] nitrogen\n", + "V_n = M_n_rej*24200 #[ml]\n", + "\n", + "print \" At equilibrium at 20 deg C the rejected amount of oxygen will be %0.2f ml\"%(V_o)\n", + "print \" At equilibrium at 20 deg C the rejected amount of nitrogen will be %0.2f ml\"%(V_n)\n", + "print \" And total amount of the air rejected from the water will be %0.2f ml\"%(V_o + V_n)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " At equilibrium at 20 deg C the rejected amount of oxygen will be 1.03 ml\n", + " At equilibrium at 20 deg C the rejected amount of nitrogen will be 1.76 ml\n", + " And total amount of the air rejected from the water will be 2.79 ml\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 3.8 Page: 61" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "\n", + "P_1 = 5. #[atm]\n", + "y_n = 0.79 # Mole fraction of nitrogen in atmosphere\n", + "P_2 = 1.0 #[atm]\n", + "M = 55. #[kg] Mass of the diver\n", + "x_w = 0.75 # Fraction of water in human body\n", + "T = 37 #[C] Body temperature of the diver\n", + "\n", + "H_n = 10.05*10**(4) # [atm]\n", + "\n", + "M_rej = (M*1000*x_w/18)*( P_1*y_n/H_n - P_2*y_n/H_n) #[mol]\n", + "\n", + "V_n = M_rej*24.2 #[L]\n", + "\n", + "print \" Amount of rejected nitrogen will be %0.2f Litre\"%(V_n)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Amount of rejected nitrogen will be 1.74 Litre\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/.ipynb_checkpoints/ch7-checkpoint.ipynb b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/.ipynb_checkpoints/ch7-checkpoint.ipynb new file mode 100644 index 00000000..7020eec3 --- /dev/null +++ b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/.ipynb_checkpoints/ch7-checkpoint.ipynb @@ -0,0 +1,377 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:1516bb23afc335a7092a1afab7991f3ed9c5be7c83937717220b23a740bce801" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 7 : Fugacity Ideal Solutions Activity Activity Coefficient" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 7.1 Page: 134" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "\n", + "T = 220+459.67 #[R] Temperature in Rankine\n", + "P = 500. #[psia] Pressure\n", + "R = 10.73 #[(psi*ft**(3)/(lbmol*R))] Gas consmath.tant\n", + "\n", + "\n", + "a = 4.256 #[ft**(3)/lbmol]\n", + "\n", + "def f6(p): \n", + "\t return a*p**(0)\n", + "\n", + "I = quad(f6,0,P)[0]\n", + "\n", + "\n", + "f = P*math.exp((-1/(R*T))*I) #[psia]\n", + "\n", + "print \"Fugacity of propane gas at the given condition is %.0f psia\"%(round(f,1))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Fugacity of propane gas at the given condition is 374 psia\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 7.2 Page: 138\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "T = 100. + 460 #[R] Temperature of the system in Rankine\n", + "P = 1. # [psia]\n", + "R = 10.73 #[(psi*ft**(3)/(lbmol*R))] Gas consmath.tant\n", + "\n", + "v = 0.016136*18 #[ft**(3)/lbmol]\n", + "z = round((P*v)/(R*T),5)\n", + "\n", + "a = int(((R*T)/P))*(1-z) #[ft**(3)/lbmol]\n", + "\n", + "print \" Compresssibility factor the liquid water at the given condition is %.5f \"%(z)\n", + "print \"Volume residual for the liquid water at the given condition is %0.1f cubic feet/lbmol\"%(a)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Compresssibility factor the liquid water at the given condition is 0.00005 \n", + "Volume residual for the liquid water at the given condition is 6007.7 cubic feet/lbmol\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 7.3 Page: 138\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "T = 100+460. #[R] Temperature\n", + "P = 1000. #[psia] Pressure\n", + "R = 10.73 #[(psi*ft**(3)/(lbmol*R))] Gas consmath.tant\n", + "\n", + "f_b = 0.95 #[psia]\n", + "f_c = f_b #[psia]\n", + "v = 0.016136*18 #[ft**(3)/lbmol]\n", + "\n", + "P_d = 1000. #[psia]\n", + "P_c = 1. #[psia]\n", + "\n", + "def f4(p): \n", + "\t return p**(0)\n", + "\n", + "f_d = f_c*math.exp((v/(R*T))* (quad(f4,P_c,P_d))[0])\n", + "\n", + "print \"Fugacity of the pure liquid water at the given condition is %0.1f psia\"%(f_d)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Fugacity of the pure liquid water at the given condition is 1.0 psia\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 7.4 Page: 145\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "T = 78.15 #[C]\n", + "P = 1.0 #[atm]\n", + "p_a_0 = 0.993 #[atm] Pure ethanol vapor pressure at 78.15C\n", + "p_b_0 = 0.434 #[atm] Pure water vapor pressure at 78.15C\n", + "\n", + "x_a = 0.8943 # Amount of ethanol in the liquid phase \n", + "x_b = 0.1057 # Amount of water in liquid phase \n", + "\n", + "y_a = x_a # Amount of ethanol in vapor phase \n", + "y_b = x_b # Amount of water in the vapor phase \n", + "\n", + "\n", + "\n", + "Y_a_1 = 1.0\n", + "Y_b_1 = 1.0\n", + "\n", + "Y_a_2 = ((y_a*P)/(x_a*p_a_0))\n", + "Y_b_2 = ((y_b*P)/(x_b*p_b_0))\n", + "\n", + "f_a_1 = (y_a*Y_a_1*P) #[atm]\n", + "f_b_1 = (y_b*Y_b_1*P) #[atm]\n", + "f_a_2 = f_a_1 #[atm]\n", + "f_b_2 = f_b_1 #[atm]\n", + "\n", + "f_a_1_0 = P #[atm]\n", + "f_b_1_0 = P #[atm]\n", + "\n", + "f_a_2_0 = p_a_0 #[atm]\n", + "f_b_2_0 = p_b_0 #[atm]\n", + "\n", + "print \" The results are summarized in the following table: \\n\\tPhase\\t\\t\\t\\t Etahnol(i=a)\\t\\t\\t\\t Water,i=b\"\n", + "print \" \\tVAPOR PHASE 1\"\n", + "print \" \\t f_i_1 atm \\t\\t\\t %.4f \\t\\t\\t\\t %.4f\"%(f_a_1,f_b_1)\n", + "print \" \\t f_i_1_0 atm \\t\\t\\t %.4f \\t\\t\\t\\t %.4f\"%(f_a_1,f_b_1)\n", + "print \" \\t Y_i_1 assumed \\t\\t %f \\t\\t\\t\\t %f\"%(Y_a_1,Y_b_1)\n", + "print \" \\tLIQUID PHASE 2\"\n", + "print \" \\t f_i_2 atm \\t\\t\\t %.4f \\t\\t\\t\\t %.4f\"%(f_a_2,f_b_2)\n", + "print \" \\t f_i_2_0 atm \\t\\t\\t %.4f \\t\\t\\t\\t %.4f\"%(f_a_2,f_b_2)\n", + "print \" \\t Y_i_2assumed \\t\\t %.4f \\t\\t\\t\\t %.4f\"%(Y_a_2,Y_b_2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The results are summarized in the following table: \n", + "\tPhase\t\t\t\t Etahnol(i=a)\t\t\t\t Water,i=b\n", + " \tVAPOR PHASE 1\n", + " \t f_i_1 atm \t\t\t 0.8943 \t\t\t\t 0.1057\n", + " \t f_i_1_0 atm \t\t\t 0.8943 \t\t\t\t 0.1057\n", + " \t Y_i_1 assumed \t\t 1.000000 \t\t\t\t 1.000000\n", + " \tLIQUID PHASE 2\n", + " \t f_i_2 atm \t\t\t 0.8943 \t\t\t\t 0.1057\n", + " \t f_i_2_0 atm \t\t\t 0.8943 \t\t\t\t 0.1057\n", + " \t Y_i_2assumed \t\t 1.0070 \t\t\t\t 2.3041\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 7.5 Page: 149\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "T = 220+460. #[R] Temperature in rankine\n", + "P = 1000. #[psia] Pressure\n", + "y_methane = 0.784 # Mol fraction of methane in the given mixture\n", + "y_butane = (1-y_methane) # Mol fraction of n-bumath.tane in the given mixture\n", + "R = 10.73 #[(psia*ft**(3)/(lbmol*R))] gas consmath.tant\n", + "\n", + "\n", + "Im = 290. #[ft**(3)/lbmol]\n", + "\n", + "Jm = math.exp((-1/(R*T))*Im)\n", + "\n", + "f_methane = Jm*P*y_methane #[psia] fugacity of methane\n", + "\n", + "Ib = 5859. #[ft**(3)/lbmol]\n", + "Jb = math.exp((-1/(R*T))*Ib)\n", + "f_butane = Jb*P*y_butane #[psia] fugacity of bumath.tane\n", + "\n", + "print \" Fugacity of the methane in the gaseous mixture is %0.0f psia\"%(f_methane)\n", + "print \" Fugacity of the butane in the gaseous mixture is %0.1f psia\"%(f_butane)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Fugacity of the methane in the gaseous mixture is 753 psia\n", + " Fugacity of the butane in the gaseous mixture is 96.8 psia\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 7.6 Page: 153\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "T = 220+460. #[R] Temperature in rankine\n", + "P = 1000. #[psia] Pressure\n", + "x_methane = 0.784 # Mol fraction of methane in the given mixture\n", + "x_bumath_tane = (1-x_methane) # Mol fraction of n-bumath_tane in the given mixture\n", + "\n", + "v_i_into_Y_i = 0.961\n", + "phi_cap_i = 0.961\n", + "\n", + "v_i = 0.954\n", + "phi_i = v_i\n", + "Y_i = phi_cap_i/v_i\n", + "\n", + "print \" The value of v_i is %f\"%(v_i)\n", + "print \" The value of Y_i is %f\"%(Y_i)\n", + "print \" The value of phi_cap_i is %f\"%(phi_cap_i)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The value of v_i is 0.954000\n", + " The value of Y_i is 1.007338\n", + " The value of phi_cap_i is 0.961000\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 7.7 Page: 154\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math \n", + "\n", + "T_r = 0.889\n", + "P_r = 1.815\n", + "\n", + "f_f = -0.48553\n", + "\n", + "v = math.exp((P_r/T_r)*f_f)\n", + "phi = v\n", + "\n", + "print \" The value of v=phi for n-bumath.tane at given condition is %f\"%(v)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The value of v=phi for n-bumath.tane at given condition is 0.371106\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/.ipynb_checkpoints/ch8-checkpoint.ipynb b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/.ipynb_checkpoints/ch8-checkpoint.ipynb new file mode 100644 index 00000000..494454b7 --- /dev/null +++ b/Physical_And_Chemical_Equilibrium_For_Chemical_Engineers/.ipynb_checkpoints/ch8-checkpoint.ipynb @@ -0,0 +1,916 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:d221da8e75f5f6adc3adedef3c1ac8c09cdf0ffedf5eae70dc97519a155edf88" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 8 : Vapor Liquid Equilibrium VLE at Low Pressures" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 8.1 Page: 163" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "x_acetone = 0.05 # Mole fraction of Acetone in liquid\n", + "x_water = (1-x_acetone)\n", + "y_acetone = 0.6381 # Mole fraction of Acetone in vapour\n", + "y_water = (1-y_acetone)\n", + "\n", + "K_acetone = y_acetone/x_acetone\n", + "K_water = y_water/x_water\n", + "a = K_acetone/K_water\n", + "\n", + "print \"The K factor of acetone is %f\"%(K_acetone)\n", + "print \" The K factor of water is %f\"%(K_water)\n", + "print \" The relative volatility is %f\"%(a)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The K factor of acetone is 12.762000\n", + " The K factor of water is 0.380947\n", + " The relative volatility is 33.500691\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 8.2 Page: 165\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "P = 1. #[atm]\n", + "Temp = 74.8 #[C]\n", + "A_a = 7.02447\n", + "B_a = 1161\n", + "C_a = 224\n", + "p_acetone = 10**(A_a-B_a/(Temp+C_a)) #[mmHg]\n", + "A_w = 7.94917\n", + "B_w = 1657.462\n", + "C_w = 227.02\n", + "\n", + "p_water = 10**(A_w-B_w/(Temp+C_w)) #[mmHg]\n", + "p_acetone = p_acetone/760 #[atm]\n", + "p_water = p_water/760 #[atm]\n", + "y_acetone = 0.6381\n", + "x_acetone = 0.05\n", + "y_water = (1-y_acetone)\n", + "x_water =(1-x_acetone)\n", + "Y_acetone = y_acetone*P/(x_acetone*p_acetone)\n", + "Y_water = y_water*P/(x_water*p_water)\n", + "\n", + "print \"Liquid-phase activity coefficient for acetone is %f\"%(Y_acetone)\n", + "print \" Liquid-phase activity coefficient for water is %f\"%(Y_water)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Liquid-phase activity coefficient for acetone is 7.043759\n", + " Liquid-phase activity coefficient for water is 1.009407\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 8.3 Page: 167\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "x_a = 0.05 # mole fraction of acetone in liquid phase\n", + "x_w = (1-x_a) # mole fraction of the water in the liquid phase\n", + "P = 1.00 #[atm] Total pressure in vapor phase\n", + "\n", + "T_1 = 80. #[C]\n", + "A_a = 7.02447\n", + "B_a = 1161.\n", + "C_a = 224.\n", + "A_w = 7.94917\n", + "B_w = 1657.462\n", + "C_w = 227.02\n", + "\n", + "p_a_1 = (1./760)*10**(A_a - B_a/(T_1+C_a)) #[atm]\n", + "p_w_1 = (1./760)*10**(A_w - B_w/(T_1+C_w)) #[atm]\n", + "\n", + "y_a_1 = (x_a*p_a_1)/P\n", + "y_w_1 = (x_w*p_w_1)/P\n", + "\n", + "y_1 = (y_a_1 + y_w_1)\n", + "\n", + "T_2 = 96.4060 #[C]\n", + "\n", + "p_a_2 = (1./760)*10**(A_a - B_a/(T_2+C_a)) #[atm]\n", + "p_w_2 = (1./760)*10**(A_w - B_w/(T_2+C_w)) #[atm]\n", + "\n", + "y_a_2 = (x_a*p_a_2)/P\n", + "y_w_2 = (x_w*p_w_2)/P\n", + "\n", + "y_2 = (y_a_2 + y_w_2)\n", + "T_e = 74.8 #[C] Boiling temperature\n", + "y_a_e = 0.6381 # vapor phase composition of acetone\n", + "\n", + "print \" Comparison of experimental values to those computed by the ideal solution assumption x_acetone = 0.05 and P = 1.00 atm\"\n", + "print \" \\t\\t\\t Experimental Values from Table 8.1 \\t\\t\\t\\tValues calculated assuming idea solution\"\n", + "print \" Equilibriumboiling) \\t\\t%0.1f \\t\\t\\t\\t\\t\\t\\t\\t\\t %0.1f temperature T deg C\"%(T_e,T_2)\n", + "print \" Mole fraction acetone \\t\\t%f \\t\\t\\t\\t\\t\\t\\t\\t %f in the vapor phase y_a)\"%(y_a_e,y_a_2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Comparison of experimental values to those computed by the ideal solution assumption x_acetone = 0.05 and P = 1.00 atm\n", + " \t\t\t Experimental Values from Table 8.1 \t\t\t\tValues calculated assuming idea solution\n", + " Equilibriumboiling) \t\t74.8 \t\t\t\t\t\t\t\t\t 96.4 temperature T deg C\n", + " Mole fraction acetone \t\t0.638100 \t\t\t\t\t\t\t\t 0.165615 in the vapor phase y_a)\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 8.4 Page: 177\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "n_water = 80. #[mol]\n", + "n_bumath_tanol = 20. #[mol]\n", + "n_total = n_water+n_bumath_tanol #[mol]\n", + "\n", + "x_feed = 0.8\n", + "x_a_1 = 0.65\n", + "x_a_2 = 0.98\n", + "\n", + "n_1 = (x_feed-x_a_2)/(x_a_1-x_a_2)*n_total #[mol]\n", + "n_2 = (n_total-n_1) #[mol]\n", + "n_a_1 = 0.65*n_1 #[mol]\n", + "n_a_2 = 0.98*n_2 #[mol]\n", + "\n", + "print \" Total moles of water present in the first phase is %f mol\"%(n_a_1)\n", + "print \" Total moles of water present in the second phase is %f mol\"%(n_a_2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total moles of water present in the first phase is 35.454545 mol\n", + " Total moles of water present in the second phase is 44.545455 mol\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 8.5 Page: 178\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "P = 1. #[atm]\n", + "y_water = 0.60\n", + "x_water_1 = 0.22\n", + "x_water_2 = 0.99\n", + "\n", + "print \" The equilibrium amount of water in liquid at bubble-point for the dew-point composition y_water=60 mol%% is %f mol%% water\"%(x_water_1)\n", + "print \" The equilibrium amount of water in liquid at bubble-point for the dew-point composition y_water=90 mol%% is %f mol%% water\"%(x_water_2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The equilibrium amount of water in liquid at bubble-point for the dew-point composition y_water=60 mol% is 0.220000 mol% water\n", + " The equilibrium amount of water in liquid at bubble-point for the dew-point composition y_water=90 mol% is 0.990000 mol% water\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 8.6 Page: 178\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "P = 1.00 #[atm] assumed total vapor pressure\n", + "P1 = 14.7 #[psia]\n", + "x_1_water = 0.65\n", + "x_1_bumath_tanol = (1-x_1_water)\n", + "x_2_water = 0.98\n", + "x_2_bumath_tanol = (1-x_2_water)\n", + "y_water = 0.73\n", + "y_bumath_tanol = (1-y_water)\n", + "T = 92. #[C]\n", + "\n", + "A_w = 7.94917\n", + "B_w = 1657.462\n", + "C_w = 227.02\n", + "\n", + "A_b = 7.838\n", + "B_b = 1558.190\n", + "C_b = 196.881\n", + "\n", + "p_water = (14.7/760)*10**(A_w - B_w/(T+C_w))\n", + "p_bumath_tanol = (14.7/760)*10**(A_b - B_b/(T+C_b))\n", + "\n", + "f_water = (y_water*P)\n", + "f_bumath_tanol = (y_bumath_tanol*P)\n", + "\n", + "Y_water_1 = (y_water*P1)/(x_1_water*p_water)\n", + "Y_bumath_tanol_1 = (y_bumath_tanol*P1)/(x_1_bumath_tanol*p_bumath_tanol)\n", + "\n", + "Y_water_2 = (y_water*P1)/(x_2_water*p_water)\n", + "Y_bumath_tanol_2 = (y_bumath_tanol*P1)/(x_2_bumath_tanol*p_bumath_tanol)\n", + "\n", + "print \" Four activity coefficients and fufacities are shown in the following table:\"\n", + "print \"Phase \\t x_water \\t f_wateratm \\t Y_water \\t x_butanol \\t f_butanolatm \\t\\t Y_butanol\"\n", + "print \" 1 \\t %f \\t %f \\t %f \\t %f \\t %f \\t\\t %f \"%(x_1_water,f_water,Y_water_1,x_1_bumath_tanol,f_bumath_tanol,Y_bumath_tanol_1)\n", + "print \" 2 \\t %f \\t %f \\t %0.2f \\t\\t %f \\t %f \\t\\t %f \"%(x_2_water,f_water,Y_water_2,x_2_bumath_tanol,f_bumath_tanol,Y_bumath_tanol_2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Four activity coefficients and fufacities are shown in the following table:\n", + "Phase \t x_water \t f_wateratm \t Y_water \t x_butanol \t f_butanolatm \t\t Y_butanol\n", + " 1 \t 0.650000 \t 0.730000 \t 1.504988 \t 0.350000 \t 0.270000 \t\t 2.108586 \n", + " 2 \t 0.980000 \t 0.730000 \t 1.00 \t\t 0.020000 \t 0.270000 \t\t 36.900247 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 8.7 Page: 179\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "P = 1. #[atm] Total pressure in the vapor phase\n", + "\n", + "\n", + "T = 89. #[C]\n", + "A_w = 7.94917\n", + "B_w = 1657.462\n", + "C_w = 227.02\n", + "\n", + "A_b = 7.838\n", + "B_b = 1558.190\n", + "C_b = 196.881\n", + "\n", + "p_water = (1./760)*10**(A_w - B_w/(T+C_w))\n", + "p_bumath_tanol = (1./760)*10**(A_b - B_b/(T+C_b))\n", + "\n", + "y_water = p_water/P\n", + "y_bumath_tanol = p_bumath_tanol/P\n", + "y = y_water + y_bumath_tanol\n", + "\n", + "\n", + "print \" Boiling point of the two phase system is %0.0f deg C\"%(T)\n", + "print \" In vapor phase mole fraction of the water is %0.2f\"%(y_water)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Boiling point of the two phase system is 89 deg C\n", + " In vapor phase mole fraction of the water is 0.67\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 8.8 Page: 184\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "Temp = 68. #[F]\n", + "P = 1. #[atm]\n", + "\n", + "Temp = 273.15+(Temp-32)*5./9 #[K]\n", + "P = P*1.01325 #[bar]\n", + "T_c = 647.1 #[K]\n", + "P_c = 220.55 #[bar]\n", + "T_r = Temp/T_c\n", + "P_r = P/P_c\n", + "w = 0.345\n", + "f_T_r = (0.083-0.422/T_r**(1.6))+w*(0.139-0.172/T_r**(4.2))\n", + "f_by_P = math.exp(P_r/T_r*f_T_r)\n", + "\n", + "print \"The value of the f/P for water vapour in the hypothetical state is %0.2f\"%(f_by_P)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of the f/P for water vapour in the hypothetical state is 0.97\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 8.9 Page: 189\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "x_a = 0.1238\n", + "x_b = (1-x_a)\n", + "T = 85.3 #[C] Given boiling temperature\n", + "\n", + "A_a = 8.04494\n", + "B_a = 1554.3\n", + "C_a = 222.65\n", + "\n", + "A_b = 7.96681\n", + "B_b = 1668.21\n", + "C_b = 228.0\n", + "\n", + "p_a = (1./760)*10**(A_a - B_a/(T+C_a))\n", + "p_b = (1./760)*10**(A_b - B_b/(T+C_b))\n", + "\n", + "A = 0.7292\n", + "B = 0.4104\n", + "\n", + "Y_a = 10**((B**(2)*A*x_b**(2))/(A*x_a+B*x_b)**(2))\n", + "Y_b = 10**((A**(2)*B*x_a**(2))/(A*x_a+B*x_b)**(2))\n", + "\n", + "\n", + "P = (Y_a*p_a*x_a)+(Y_b*p_b*x_b) #[atm]\n", + "\n", + "y_a = (Y_a*p_a*x_a)/P\n", + "y_b = (Y_b*p_b*x_b)/P\n", + "\n", + "print \" Boiling pressure of the liquid at 85.3 deg C is %0.4f atm\"%(P)\n", + "print \" Mole fraction of ethanaol in vapor phase is %0.4f\"%(y_a)\n", + "print \" Mole fraction of water in the vapor phase is %0.4f\"%(y_b)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Boiling pressure of the liquid at 85.3 deg C is 0.9991 atm\n", + " Mole fraction of ethanaol in vapor phase is 0.4741\n", + " Mole fraction of water in the vapor phase is 0.5259\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 8.10 Page: 191\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "x_a = 0.2608\n", + "x_b = (1-x_a)\n", + "P = 1.00 #[atm] Given boiling pressure\n", + "\n", + "\n", + "A_a = 8.04494\n", + "B_a = 1554.3\n", + "C_a = 222.65\n", + "\n", + "A_b = 7.96681\n", + "B_b = 1668.21\n", + "C_b = 228.0\n", + "\n", + "\n", + "A = 0.7292\n", + "B = 0.4104\n", + "\n", + "Y_a = 10**((B**(2)*A*x_b**(2))/(A*x_a+B*x_b)**(2))\n", + "Y_b = 10**((A**(2)*B*x_a**(2))/(A*x_a+B*x_b)**(2))\n", + "\n", + "T = 80.\n", + "err = 1.\n", + "\n", + "while err > 10**(-3):\n", + " P_a = (10**(8.04494 - 1554.3/(222.65 + T)))/760\n", + " P_b = (10**(7.96681 - 1668.21/(228 + T)))/760\n", + " y_a = Y_a*P_a*x_a/P\n", + " y_b = Y_b*P_b*x_b/P\n", + " err = abs((y_a + y_b) - 1)\n", + " T = T + 0.01\n", + "\n", + "print \" Boiling temperature of the liquid at 1 atm pressure is %0.4f atm\"%(T)\n", + "print \" Mole fraction of ethanaol in vapor phase is \\t%0.4f\"%(y_a)\n", + "print \" Mole fraction of water in the vapor phase is \\t%0.4f\"%(y_b)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Boiling temperature of the liquid at 1 atm pressure is 82.0300 atm\n", + " Mole fraction of ethanaol in vapor phase is \t0.5680\n", + " Mole fraction of water in the vapor phase is \t0.4312\n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 8.11 Page: 192\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "y_a = 0.6122\n", + "y_b = (1-y_a)\n", + "T = 80.7 #[C] Given boiling temperature\n", + "\n", + "\n", + "A_a = 8.04494\n", + "B_a = 1554.3\n", + "C_a = 222.65\n", + "\n", + "A_b = 7.96681\n", + "B_b = 1668.21\n", + "C_b = 228.0\n", + "\n", + "p_a = (1./760)*10**(A_a - B_a/(T+C_a))\n", + "p_b = (1./760)*10**(A_b - B_b/(T+C_b))\n", + "\n", + "A = 0.7292\n", + "B = 0.4104\n", + "\n", + "\n", + "x_a = 0.6122 # Initial assumption of liquid phase composition of ethanol\n", + "x_b = 0.3 # Initial assumption of liquid phase composition water\n", + "P = 0.80 #[atm]\n", + "err = 1\n", + "\n", + "while err > 2* 10**(-2):\n", + " P = P + 0.01\n", + " Y_a = 10**((B**(2)*A*x_b**(2))/(A*x_a+B*x_b)**(2))\n", + " Y_b = 10**((A**(2)*B*x_a**(2))/(A*x_a+B*x_b)**(2))\n", + "\n", + " err = abs((x_a + x_b) - 1)\n", + " x_a = y_a*P/(Y_a*p_a)\n", + " x_b = y_b*P/(Y_b*p_b)\n", + "\n", + "print \" Boiling pressure of the liquid at 80.7 deg C is %0.4f atm\"%(P)\n", + "print \" Mole fraction of ethanaol in liquid phase is %0.4f\"%(x_a)\n", + "print \" Mole fraction of water in the liquid phase is %0.4f\"%(x_b)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Boiling pressure of the liquid at 80.7 deg C is 0.9900 atm\n", + " Mole fraction of ethanaol in liquid phase is 0.3730\n", + " Mole fraction of water in the liquid phase is 0.6205\n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 8.12 Page: 193\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "y_a = 0.1700\n", + "y_b = (1-y_a)\n", + "P = 1.00 #[atm] Given boiling pressure\n", + "\n", + "\n", + "A_a = 8.04494\n", + "B_a = 1554.3\n", + "C_a = 222.65\n", + "\n", + "A_b = 7.96681\n", + "B_b = 1668.21\n", + "C_b = 228.0\n", + "\n", + "\n", + "A = 0.7292\n", + "B = 0.4104\n", + "\n", + "\n", + "\n", + "x_a = 0.0100 # Initial assumption of liquid phase composition of ethanol\n", + "x_b = 0.9 # Initial assumption of liquid phase composition water\n", + "T = 80. #[C] Initial guess of the temperature\n", + "err = 1\n", + "\n", + "while err > 1./16*10**(-2):\n", + " P_a = (10**(8.04494 - 1554.3/(222.65 + T)))/760\n", + " P_b = (10**(7.96681 - 1668.21/(228 + T)))/760\n", + " \n", + " Y_a = 10**((B**(2)*A*x_b**(2))/(A*x_a+B*x_b)**(2))\n", + " Y_b = 10**((A**(2)*B*x_a**(2))/(A*x_a+B*x_b)**(2))\n", + " \n", + " x_a = y_a*P/(Y_a*P_a)\n", + " x_b = y_b*P/(Y_b*P_b)\n", + "\n", + " err = abs((x_a + x_b) - 1)\n", + " T = T + 0.01\n", + "\n", + "\n", + "print \" Equilibrium Temperature of the system at pressure 1 atm is %0.4f atm\"%(T)\n", + "print \" Mole fraction of ethanaol in liquid phase is %0.4f\"%(x_a)\n", + "print \" Mole fraction of water in the liquid phase is %0.4f\"%(x_b)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Equilibrium Temperature of the system at pressure 1 atm is 95.3500 atm\n", + " Mole fraction of ethanaol in liquid phase is 0.0187\n", + " Mole fraction of water in the liquid phase is 0.9816\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 8.13 Page: 194\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "x_aF = 0.126\n", + "x_bF = (1-x_aF)\n", + "P = 1.00 #[atm] Given total pressure\n", + "T = 91.8 #[C]\n", + "\n", + "x_a = 0.0401\n", + "x_b = (1 - x_a)\n", + "\n", + "y_a = 0.2859\n", + "y_b = ( 1 - y_a)\n", + "\n", + "V_by_F = ( x_aF - x_a )/(y_a - x_a)\n", + "\n", + "print \" Mole fraction of the ethanol in the liquid phase in equilibrium at the given condition is %f\"%(x_a)\n", + "print \" Mole fraction of the water in the liquid phase in equilibrium at the given condition is %f\"%(x_b)\n", + "print \" Mole fraction of the ethanol in the vapour phase in equilibrium at the given condition is %f\"%(y_a)\n", + "print \" Mole fraction of the water in the vapour phase in equilibrium at the given condition is %f\"%(y_b)\n", + "print \" Vapor fraction of the given water-ethanol mixture after the flash in equilibrium is %f\"%(V_by_F)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Mole fraction of the ethanol in the liquid phase in equilibrium at the given condition is 0.040100\n", + " Mole fraction of the water in the liquid phase in equilibrium at the given condition is 0.959900\n", + " Mole fraction of the ethanol in the vapour phase in equilibrium at the given condition is 0.285900\n", + " Mole fraction of the water in the vapour phase in equilibrium at the given condition is 0.714100\n", + " Vapor fraction of the given water-ethanol mixture after the flash in equilibrium is 0.349471\n" + ] + } + ], + "prompt_number": 31 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 8.14 Page: 198\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "P = 100. #[psia]\n", + "x_a = 0.05 # Mole fraction of methane \n", + "x_b = 0.40 # Mole fraction of bumath.tane \n", + "x_c = 0.55 # mole fraction of penmath.tane\n", + "\n", + "\n", + "T = [[15.8 ,0.087, 0.024],[16,0.105, 0.026],[16.2, 0.115, 0.03],[16.8 ,0.13, 0.035],[17.2 ,0.15, 0.04],[17.8, 0.17, 0.045],[18.2, 0.175, 0.0472727]]\n", + "print \" Calculations for the various assumed temperatures are given in the table below\"\n", + "print \" Temperature \\t\\t y_a \\t\\t y_b \\t\\t\\t y_c \\t\\t\\t y \"\n", + "\n", + "T_b = 0 #[F] Bubble point\n", + "j=0\n", + "for i in range(7):\n", + " y_a = x_a*T[i][j]\n", + " y_b = x_b*T[i][j+1]\n", + " y_c = x_c*T[i][j+2]\n", + " y = y_a + y_b + y_c\n", + " T_b = T_b + 5\n", + " print \" %f \\t\\t %f \\t\\t %f \\t\\t %f \\t\\t %f \"%(T_b,y_a,y_b,y_c,y)\n", + "\n", + "print \" For the temperature 30 deg F the summation of the mole fractions in the vapor phase is close enough to unity so bubble point is 30 degF\"\n", + "print \" And compositions in the vapor phase are the values given in the above table corresonding to the temperature 30 deg F i.e.\"\n", + "print \" y_methane = %f y_bumath.tane = %f y_penmath.tane = %f\"%(y_a,y_b,y_c)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Calculations for the various assumed temperatures are given in the table below\n", + " Temperature \t\t y_a \t\t y_b \t\t\t y_c \t\t\t y \n", + " 5.000000 \t\t 0.790000 \t\t 0.034800 \t\t 0.013200 \t\t 0.838000 \n", + " 10.000000 \t\t 0.800000 \t\t 0.042000 \t\t 0.014300 \t\t 0.856300 \n", + " 15.000000 \t\t 0.810000 \t\t 0.046000 \t\t 0.016500 \t\t 0.872500 \n", + " 20.000000 \t\t 0.840000 \t\t 0.052000 \t\t 0.019250 \t\t 0.911250 \n", + " 25.000000 \t\t 0.860000 \t\t 0.060000 \t\t 0.022000 \t\t 0.942000 \n", + " 30.000000 \t\t 0.890000 \t\t 0.068000 \t\t 0.024750 \t\t 0.982750 \n", + " 35.000000 \t\t 0.910000 \t\t 0.070000 \t\t 0.026000 \t\t 1.006000 \n", + " For the temperature 30 deg F the summation of the mole fractions in the vapor phase is close enough to unity so bubble point is 30 degF\n", + " And compositions in the vapor phase are the values given in the above table corresonding to the temperature 30 deg F i.e.\n", + " y_methane = 0.910000 y_bumath.tane = 0.070000 y_penmath.tane = 0.026000\n" + ] + } + ], + "prompt_number": 32 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 8.15 Page: 199\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "n_sugar = 1. #[mol]\n", + "n_water = 1000/18. #[mol]\n", + "x_sugar = n_sugar/(n_sugar+n_water)\n", + "x_water = n_water/(n_sugar+n_water)\n", + "p_water = 1. #[atm]\n", + "p_sugar = 0. #[atm]\n", + "\n", + "P = x_water*p_water+x_sugar*p_sugar #[atm]\n", + "P_1 = 1. #[atm]\n", + "p_water = P_1/x_water #[atm]\n", + "T = 100.51 #[C]\n", + "T_eb = T-100 #[C]\n", + "\n", + "print \"Vapour pressure of this solution at the 100C is %.3f atm\"%(P)\n", + "print \"The temperature at which this solution will boil at 1 atm is %.2f C\"%(T)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Vapour pressure of this solution at the 100C is 0.982 atm\n", + "The temperature at which this solution will boil at 1 atm is 100.51 C\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + " Example 8.16 Page: 201\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "n_sugar = 1. #[mol]\n", + "n_water = 1000/18. #[mol]\n", + "x_sugar = n_sugar/(n_sugar+n_water)\n", + "x_water = n_water/(n_sugar+n_water)\n", + "\n", + "\n", + "p_sugar = 0\n", + "p_ice_by_p_water = x_water\n", + "\n", + "\n", + "def f(T): \n", + "\t return 1+0.0096686*T+4.0176*10**(-5)*T**(2)-p_ice_by_p_water\n", + "T = fsolve(f,0)\n", + "\n", + "print \"Freezing-point temperature of the given solution is %f C\"%(T)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Freezing-point temperature of the given solution is -1.842891 C\n" + ] + } + ], + "prompt_number": 34 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Practical_C_Programming/.ipynb_checkpoints/Chapter_10_1-checkpoint.ipynb b/Practical_C_Programming/.ipynb_checkpoints/Chapter_10_1-checkpoint.ipynb new file mode 100644 index 00000000..616dbfad --- /dev/null +++ b/Practical_C_Programming/.ipynb_checkpoints/Chapter_10_1-checkpoint.ipynb @@ -0,0 +1,414 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:e0192e34ad6ee5352df14e6445eee01302e3e7af1b8414d8a9190c3936e04b7a" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 10: C Preprocessor" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.1, Page number: 172" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "data = []\n", + "twice = []\n", + "\n", + "# Calculation and result\n", + "for index in range (0, 10) :\n", + " data.append(index)\n", + " twice.append(2 * index)\n", + "\n", + "print (data)\n", + "print (twice)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n", + "[0, 2, 4, 6, 8, 10, 12, 14, 16, 18]\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.2, Page number: 173" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "data = []\n", + "twice = []\n", + "\n", + "# Calculation and result\n", + "for index in range (0, 20) :\n", + " data.append(index)\n", + " twice.append(2 * index)\n", + "\n", + "print (data)\n", + "print (twice)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]\n", + "[0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38]\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.3, Page number: 175" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "BIG_NUMBER = 10 * 10\n", + "index = 1\n", + "\n", + "# Calculation and result\n", + "while (index < BIG_NUMBER) :\n", + " index = index * 8\n", + " print ('%d' % index)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "8\n", + "64\n", + "512\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.4, Page number: 176" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "FIRST_PART = 7\n", + "LAST_PART = 5\n", + "ALL_PARTS = FIRST_PART + LAST_PART\n", + "\n", + "# Calculation and result\n", + "print ('The square of all the parts is %d' % (ALL_PARTS * ALL_PARTS))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The square of all the parts is 144\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.5, Page number: 177" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "for i in reversed (range(10)) :\n", + " print ('Hi there')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hi there\n", + "Hi there\n", + "Hi there\n", + "Hi there\n", + "Hi there\n", + "Hi there\n", + "Hi there\n", + "Hi there\n", + "Hi there\n", + "Hi there\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.6, Page number: 177" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "size = 10\n", + "fudge = size - 2\n", + "\n", + "# Calculation and result\n", + "size = fudge\n", + "print ('Size is %d' % size)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Size is 8\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.7, Page number: 178" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import sys\n", + "value = 1\n", + "\n", + "# Calculation and result\n", + "if (value < 0) :\n", + " sys.exit()\n", + "\n", + "print ('We did not die')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "We did not die\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.8, Page number: 184" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def SQR (x) :\n", + " return x * x\n", + " \n", + "for counter in range (0, 5) :\n", + " print ('x %d, x squared %d\\n' % (counter + 1, SQR (counter + 1)))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x 1, x squared 1\n", + "\n", + "x 2, x squared 4\n", + "\n", + "x 3, x squared 9\n", + "\n", + "x 4, x squared 16\n", + "\n", + "x 5, x squared 25\n", + "\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.9, Page number: 184" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "counter = 0\n", + "\n", + "# Function declaration, calculation and result\n", + "def SQR (x) :\n", + " return x * x\n", + " \n", + "while (counter < 5) :\n", + " print ('x %d square %d\\n' % (counter + 1, SQR (counter + 1)))\n", + " counter += 1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x 1 square 1\n", + "\n", + "x 2 square 4\n", + "\n", + "x 3 square 9\n", + "\n", + "x 4 square 16\n", + "\n", + "x 5 square 25\n", + "\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.10, Page number: 185" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def reciprocal (number) :\n", + " return 1 / number\n", + " \n", + "for counter in range (1, 10) :\n", + " print ('1/%f = %f\\n' % (counter, reciprocal (counter)))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1/1.000000 = 1.000000\n", + "\n", + "1/2.000000 = 0.000000\n", + "\n", + "1/3.000000 = 0.000000\n", + "\n", + "1/4.000000 = 0.000000\n", + "\n", + "1/5.000000 = 0.000000\n", + "\n", + "1/6.000000 = 0.000000\n", + "\n", + "1/7.000000 = 0.000000\n", + "\n", + "1/8.000000 = 0.000000\n", + "\n", + "1/9.000000 = 0.000000\n", + "\n" + ] + } + ], + "prompt_number": 10 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Practical_C_Programming/.ipynb_checkpoints/Chapter_11_1-checkpoint.ipynb b/Practical_C_Programming/.ipynb_checkpoints/Chapter_11_1-checkpoint.ipynb new file mode 100644 index 00000000..348ea0f2 --- /dev/null +++ b/Practical_C_Programming/.ipynb_checkpoints/Chapter_11_1-checkpoint.ipynb @@ -0,0 +1,134 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:189fb021544012d2bd6866a28aeac9bea1998c8f59c87bf7f6fbc3d56515bb70" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 11: Bit operations" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.1, Page number: 193" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "i1 = 4\n", + "i2 = 2\n", + "\n", + "# Calculation and result\n", + "if ((i1 != 0) and (i2 != 0)) :\n", + " print ('Both are not zero\\n')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Both are not zero\n", + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.2, Page number: 201" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "HIGH_SPEED = 1 << 7\n", + "DIRECT_CONNECT = 1 << 8\n", + "\n", + "flags = 0\n", + "flags |= HIGH_SPEED\n", + "flags |= DIRECT_CONNECT\n", + "\n", + "# Calculation and result\n", + "if ((flags & HIGH_SPEED) != 0) :\n", + " print ('High speed set\\n')\n", + "\n", + "if ((flags & DIRECT_CONNECT) != 0) :\n", + " print ('Direct connect set\\n')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "High speed set\n", + "\n", + "Direct connect set\n", + "\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.4, Page number: 207" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "i = 0x80\n", + "\n", + "# Calculation and result\n", + "if (i != 0) :\n", + " print ('i is %x (%d) \\n' % (i, i))\n", + " i = i >> 1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "i is 80 (128) \n", + "\n" + ] + } + ], + "prompt_number": 3 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Practical_C_Programming/.ipynb_checkpoints/Chapter_12_1-checkpoint.ipynb b/Practical_C_Programming/.ipynb_checkpoints/Chapter_12_1-checkpoint.ipynb new file mode 100644 index 00000000..090a4ee1 --- /dev/null +++ b/Practical_C_Programming/.ipynb_checkpoints/Chapter_12_1-checkpoint.ipynb @@ -0,0 +1,60 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:184261c50791da479b656a01719125426370a323ab51da034b4dc57d574572c3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 12: Advanced types" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.1, Page number: 212" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Union declaration\n", + "from ctypes import *\n", + "class value (Union) :\n", + " _fields_ = [(\"i_value\", c_int),\n", + " (\"f_value\", c_float)]\n", + "\n", + "# Calculation and result\n", + "data = value (3, 5.0)\n", + "print (data.i_value, data.f_value)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(1084227584, 5.0)\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Practical_C_Programming/.ipynb_checkpoints/Chapter_13_1-checkpoint.ipynb b/Practical_C_Programming/.ipynb_checkpoints/Chapter_13_1-checkpoint.ipynb new file mode 100644 index 00000000..e3f18fc3 --- /dev/null +++ b/Practical_C_Programming/.ipynb_checkpoints/Chapter_13_1-checkpoint.ipynb @@ -0,0 +1,526 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:e550d25cd0a5a3cbfd731b0cd1d4a1ad11e5182b8955b4cee863068b4cfdaf40" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 13: Simple pointers" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.1, Page number: 225" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "thing_var = 2\n", + "\n", + "# Calculation and result\n", + "print ('Thing %d' % thing_var)\n", + "\n", + "thing_ptr = thing_var\n", + "thing_ptr = 3\n", + "print ('Thing %d' % thing_ptr)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thing 2\n", + "Thing 3\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.2, Page number: 227" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Function declaration\n", + "def inc_count (count_ptr) :\n", + " count_ptr += 1\n", + " return count_ptr\n", + "\n", + "# Calculation and result\n", + "count = 0\n", + "\n", + "while (count < 10) :\n", + " print ('Count %d\\n' % inc_count (count))\n", + " count += 1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Count 1\n", + "\n", + "Count 2\n", + "\n", + "Count 3\n", + "\n", + "Count 4\n", + "\n", + "Count 5\n", + "\n", + "Count 6\n", + "\n", + "Count 7\n", + "\n", + "Count 8\n", + "\n", + "Count 9\n", + "\n", + "Count 10\n", + "\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.3, Page number: 230" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "array = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']\n", + "\n", + "# Calculation and result\n", + "print ('&array[index] (array+index) array[index]\\n')\n", + "\n", + "for index in range (0, 10) :\n", + " print ('0x%s 0x%s 0x%s\\n' % (id (array[index]), id (array[index]), array[index]))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "&array[index] (array+index) array[index]\n", + "\n", + "0x20916008 0x20916008 0x0\n", + "\n", + "0x20270280 0x20270280 0x1\n", + "\n", + "0x20733728 0x20733728 0x2\n", + "\n", + "0x20916464 0x20916464 0x3\n", + "\n", + "0x20270232 0x20270232 0x4\n", + "\n", + "0x20733560 0x20733560 0x5\n", + "\n", + "0x20270256 0x20270256 0x6\n", + "\n", + "0x20733752 0x20733752 0x7\n", + "\n", + "0x20916512 0x20916512 0x8\n", + "\n", + "0x20916032 0x20916032 0x9\n", + "\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.4, Page number: 232" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "array = [4, 5, 8, 9, 8, 1, 0, 1, 9, 3]\n", + "index = 0\n", + "\n", + "# Calculation and result\n", + "while (array[index] != 0) :\n", + " index += 1\n", + "\n", + "print ('Number of elements before zero %d\\n' % index)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of elements before zero 6\n", + "\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.5, Page number: 232" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "array = [4, 5, 8, 9, 8, 1, 0, 1, 9, 3]\n", + "index = 0\n", + "\n", + "# Calculation and result\n", + "while (array[index] != 0) :\n", + " index += 1\n", + "\n", + "print ('Number of elements before zero %d\\n' % index)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of elements before zero 6\n", + "\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.6, Page number: 233" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "data = []\n", + "\n", + "# Calculation and result\n", + "for index in range (0, 10) :\n", + " data.append(0)\n", + "print (data)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.10, Page number: 238" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variable declaration\n", + "line = 'Steve/Oualline'\n", + "\n", + "# Calculation and result\n", + "first_ptr, last_ptr = line.split('/')\n", + "print ('First: %s Last: %s\\n' % (first_ptr, last_ptr))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "First: Steve Last: Oualline\n", + "\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.11, Page number: 240" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Function declaration\n", + "def tmp_name() :\n", + " if not hasattr (tmp_name, 'sequence') :\n", + " tmp_name.sequence = 0\n", + " tmp_name.sequence += 1\n", + " name = 'tmp'\n", + " name += str (tmp_name.sequence)\n", + " return name\n", + "\n", + "# Calculation and result\n", + "print ('Name: %s\\n' % tmp_name())" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name: tmp1\n", + "\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.12, Page number: 245" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variable and function declaration\n", + "import sys\n", + "v_count = sys.argv\n", + "counter = len(sys.argv)\n", + "\n", + "# Produces verbose messages\n", + "verbose = 0\n", + "\n", + "# Sends output to a file\n", + "out_file = open ('print.out', 'w')\n", + "\n", + "# Sets the number of lines per page\n", + "line_max = 66\n", + "\n", + "def do_file (name) :\n", + " print ('Verbose %d Lines %d Input %s Output %s\\n' % (verbose, line_max, name, out_file.name))\n", + "\n", + "def usage() :\n", + " print ('Usage is %s [options] [file-list]\\n' % program_name)\n", + " print ('Options\\n')\n", + " print (' -v verbose\\n')\n", + " print (' -l Number of lines\\n')\n", + " print (' -o Set output filename\\n')\n", + " sys.exit(1)\n", + " \n", + "# Calculation and result\n", + "program_name = str (sys.argv[0])\n", + "\n", + "while ((counter > 1) and (sys.argv[1][0] == '-')) :\n", + " if (sys.argv[1][1] == 'v') :\n", + " verbose = 1\n", + " break\n", + "\n", + " elif (sys.argv[1][1] == 'o') :\n", + " temp = str (sys.argv[1])\n", + " out_file.write (temp)\n", + " break\n", + "\n", + " elif (sys.argv[1][1] == 'l') :\n", + " line_max = int (sys.argv[1][2])\n", + " break\n", + "\n", + " else :\n", + " print ('Bad option %s\\n' % sys.argv[1])\n", + " usage()\n", + "\n", + " for index in range (0, counter) :\n", + " if (index == counter - 1) :\n", + " break\n", + " else :\n", + " v_count[index] = v_count[index + 1]\n", + "\n", + " counter -= 1\n", + "\n", + "if (counter == 1) :\n", + " do_file ('print.in')\n", + "\n", + "else :\n", + " while (counter > 1) :\n", + " do_file (sys.argv[1])\n", + "\n", + " for index in range (0, counter) :\n", + " if (index == counter - 1) :\n", + " break\n", + " else :\n", + " v_count[index] = v_count[index + 1]\n", + " \n", + " counter -= 1\n", + "\n", + "out_file.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "SystemExit", + "evalue": "1", + "output_type": "pyerr", + "traceback": [ + "An exception has occurred, use %tb to see the full traceback.\n", + "\u001b[1;31mSystemExit\u001b[0m\u001b[1;31m:\u001b[0m 1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Bad option -f\n", + "\n", + "Usage is -c [options] [file-list]\n", + "\n", + "Options\n", + "\n", + " -v verbose\n", + "\n", + " -l Number of lines\n", + "\n", + " -o Set output filename\n", + "\n" + ] + }, + { + "output_type": "stream", + "stream": "stderr", + "text": [ + "To exit: use 'exit', 'quit', or Ctrl-D." + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.13, Page number: 248" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Function declaration\n", + "def tmp_name() :\n", + " if not hasattr (tmp_name, 'sequence') :\n", + " tmp_name.sequence = 0\n", + " tmp_name.sequence += 1\n", + " name = 'tmp'\n", + " name += str (tmp_name.sequence)\n", + " return name\n", + "\n", + "# Calculation and result\n", + "name1 = tmp_name()\n", + "name2 = tmp_name()\n", + "print ('Name1: %s\\n' % name1)\n", + "print ('Name2: %s\\n' % name2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Name1: tmp1\n", + "\n", + "Name2: tmp2\n", + "\n" + ] + } + ], + "prompt_number": 11 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Practical_C_Programming/.ipynb_checkpoints/Chapter_14_1-checkpoint.ipynb b/Practical_C_Programming/.ipynb_checkpoints/Chapter_14_1-checkpoint.ipynb new file mode 100644 index 00000000..6d3c736e --- /dev/null +++ b/Practical_C_Programming/.ipynb_checkpoints/Chapter_14_1-checkpoint.ipynb @@ -0,0 +1,179 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:aaf3603d1f605477459dd54990dcc4c8c154c9c808805468e92c30fde9487343" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Chapter 14: File input/output" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.1, Page number: 253" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "import os\n", + "count = 0\n", + "in_file = open ('input.txt', 'r')\n", + " \n", + "# Calculation and result\n", + "if not os.path.exists ('input.txt') :\n", + " print ('Cannot open input.txt\\n')\n", + "\n", + "while (1) :\n", + " ch = in_file.read(1)\n", + " if not ch :\n", + " break\n", + " count += 1\n", + "\n", + "print ('Number of characters in input.txt is %d\\n' % count)\n", + "\n", + "in_file.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "IOError", + "evalue": "[Errno 2] No such file or directory: 'input.txt'", + "output_type": "pyerr", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mIOError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 6\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mos\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 7\u001b[0m \u001b[0mcount\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;36m0\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 8\u001b[1;33m \u001b[0min_file\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mopen\u001b[0m \u001b[1;33m(\u001b[0m\u001b[1;34m'input.txt'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'r'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 9\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 10\u001b[0m \u001b[1;31m# Calculation and result\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mIOError\u001b[0m: [Errno 2] No such file or directory: 'input.txt'" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.3, Page number: 257" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variable declaration\n", + "import sys\n", + "import os\n", + "in_file = open ('input.txt', 'r')\n", + " \n", + "# Calculation and result\n", + "if not os.path.exists (name) :\n", + " print ('Could not open file\\n')\n", + " sys.exit(1)\n", + "print ('File found\\n')\n", + "\n", + "in_file.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "IOError", + "evalue": "[Errno 2] No such file or directory: 'input.txt'", + "output_type": "pyerr", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mIOError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 6\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0msys\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 7\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mos\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 8\u001b[1;33m \u001b[0min_file\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mopen\u001b[0m \u001b[1;33m(\u001b[0m\u001b[1;34m'input.txt'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'r'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 9\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 10\u001b[0m \u001b[1;31m# Calculation and result\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mIOError\u001b[0m: [Errno 2] No such file or directory: 'input.txt'" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.4, Page number: 260" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "import sys\n", + "import os\n", + "out_file = open ('test.out', 'w')\n", + " \n", + "# Calculation and result\n", + "if not os.path.exists ('test.out') :\n", + " print ('Cannot open output file\\n')\n", + " sys.exit(1)\n", + "\n", + "for cur_char in range (0, 128) :\n", + " out_file.write(str (cur_char))\n", + " out_file.write('\\n')\n", + "\n", + "out_file.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.5, Page number: 267" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variable declaration\n", + "txt_file = open ('input.txt')\n", + "\n", + "source_content = txt_file.read()\n", + "\n", + "target = open ('output.txt', 'w')\n", + "\n", + "# Calculation and result\n", + "target.write(source_content)\n", + "print ('Content copied')\n", + "\n", + "target.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Practical_C_Programming/.ipynb_checkpoints/Chapter_15_1-checkpoint.ipynb b/Practical_C_Programming/.ipynb_checkpoints/Chapter_15_1-checkpoint.ipynb new file mode 100644 index 00000000..34a86a67 --- /dev/null +++ b/Practical_C_Programming/.ipynb_checkpoints/Chapter_15_1-checkpoint.ipynb @@ -0,0 +1,375 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:23b3891085deb8af52412d44380b6187a4110d7e026531ec90b3b2ae79d61d0f" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 15: Debugging and optimization" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.1, Page number: 275" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Function declaration\n", + "def lookup (name) :\n", + " lists = ['John', 'Jim', 'Jane', 'Clyde']\n", + " result = 0\n", + "\n", + " for index in range (0, 4) :\n", + " if (lists[index] == name) :\n", + " result = 1\n", + " break\n", + " \n", + " return result\n", + "\n", + "# Calculation and result\n", + "name = 'John'\n", + "\n", + "if (lookup (name)) :\n", + " print ('%s is in the list\\n' % name)\n", + "else :\n", + " print ('%s is not in the list\\n' % name)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "John is in the list\n", + "\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.6, Page number: 288" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable and function declaration\n", + "seven_count = 0\n", + "three_count = 0\n", + "data = []\n", + "\n", + "def get_data (data) :\n", + " for i in range (0, 5) :\n", + " x = 3\n", + " data.append(int(x))\n", + " print (data)\n", + "\n", + "# Calculation\n", + "get_data (data)\n", + "for index in range (0, 5) :\n", + " if data[index] == 3 :\n", + " three_count += 1\n", + "\n", + " if data[index] == 7 :\n", + " seven_count += 1\n", + "\n", + "# Result\n", + "print ('Threes %d Sevens %d' % (three_count, seven_count))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[3, 3, 3, 3, 3]\n", + "Threes 5 Sevens 0\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.7, Page number: 292" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "import sys\n", + "import os\n", + "in_file = open ('numbers.dat', 'r')\n", + "\n", + "data = []\n", + "max_count = 0\n", + " \n", + "# Calculation and result\n", + "if not os.path.exists ('numbers.dat') :\n", + " print ('Error:Unable to open numbers.dat\\n')\n", + " sys.exit(1)\n", + "\n", + "for line in in_file :\n", + " data.append(line)\n", + " max_count += 1\n", + "\n", + "while (1) :\n", + " search = 6\n", + " \n", + " if (search == -1) :\n", + " break\n", + "\n", + " low = 0\n", + " high = max_count\n", + "\n", + " while (1) :\n", + " mid = (low + high) / 2\n", + " middle = int (mid) \n", + "\n", + " if (int (data[middle]) == search) :\n", + " print ('Found at index %d\\n' % (middle + 1))\n", + " break\n", + "\n", + " if (low == high) :\n", + " print ('Not found\\n')\n", + " break\n", + "\n", + " if (int (data[middle]) < search) :\n", + " low = middle\n", + " else :\n", + " high = middle \n", + "\n", + "in_file.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "IOError", + "evalue": "[Errno 2] No such file or directory: 'numbers.dat'", + "output_type": "pyerr", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mIOError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 6\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0msys\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 7\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mos\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 8\u001b[1;33m \u001b[0min_file\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mopen\u001b[0m \u001b[1;33m(\u001b[0m\u001b[1;34m'numbers.dat'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'r'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 9\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 10\u001b[0m \u001b[0mdata\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mIOError\u001b[0m: [Errno 2] No such file or directory: 'numbers.dat'" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.8, Page number: 300" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variable declaration\n", + "import sys\n", + "import os\n", + "in_file = open ('numbers.dat', 'r')\n", + "\n", + "data = []\n", + "max_count = 0\n", + " \n", + "# Calculation and result\n", + "if not os.path.exists ('numbers.dat') :\n", + " print ('Error:Unable to open numbers.dat\\n')\n", + " sys.exit(1)\n", + "\n", + "for line in in_file :\n", + " data.append(line)\n", + " max_count += 1\n", + "\n", + "while (1) :\n", + " search = 14\n", + " \n", + " if (search == -1) :\n", + " break\n", + "\n", + " low = 0\n", + " high = max_count\n", + "\n", + " while (1) :\n", + " mid = (low + high) / 2\n", + " middle = int (mid) \n", + "\n", + " if (int (data[middle]) == search) :\n", + " print ('Found at index %d\\n' % (middle + 1))\n", + " break\n", + "\n", + " if (low == high) :\n", + " print ('Not found\\n')\n", + " break\n", + "\n", + " if (int (data[middle]) < search) :\n", + " low = middle\n", + " else :\n", + " high = middle \n", + "\n", + "in_file.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "IOError", + "evalue": "[Errno 2] No such file or directory: 'numbers.dat'", + "output_type": "pyerr", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mIOError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 6\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0msys\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 7\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mos\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 8\u001b[1;33m \u001b[0min_file\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mopen\u001b[0m \u001b[1;33m(\u001b[0m\u001b[1;34m'numbers.dat'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'r'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 9\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 10\u001b[0m \u001b[0mdata\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mIOError\u001b[0m: [Errno 2] No such file or directory: 'numbers.dat'" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.10, Page number: 304" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "i = 1\n", + "j = 0\n", + "\n", + "# Calculation and result\n", + "print ('Starting\\n')\n", + "print ('Before divide...')\n", + "i = i / j\n", + "print ('After\\n')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "ZeroDivisionError", + "evalue": "integer division or modulo by zero", + "output_type": "pyerr", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mZeroDivisionError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 10\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;33m(\u001b[0m\u001b[1;34m'Starting\\n'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 11\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;33m(\u001b[0m\u001b[1;34m'Before divide...'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 12\u001b[1;33m \u001b[0mi\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mi\u001b[0m \u001b[1;33m/\u001b[0m \u001b[0mj\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 13\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;33m(\u001b[0m\u001b[1;34m'After\\n'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mZeroDivisionError\u001b[0m: integer division or modulo by zero" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Starting\n", + "\n", + "Before divide...\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.11, Page number: 304" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "import sys\n", + "i = 1\n", + "j = 0\n", + "\n", + "# Calculation and result\n", + "print ('Starting\\n')\n", + "sys.stdout.flush()\n", + "print ('Before divide...')\n", + "sys.stdout.flush()\n", + "i = i / j\n", + "print ('After\\n')\n", + "sys.stdout.flush()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Starting\n", + "\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Before divide...\n" + ] + }, + { + "ename": "ZeroDivisionError", + "evalue": "integer division or modulo by zero", + "output_type": "pyerr", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mZeroDivisionError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 13\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;33m(\u001b[0m\u001b[1;34m'Before divide...'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 14\u001b[0m \u001b[0msys\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mstdout\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mflush\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 15\u001b[1;33m \u001b[0mi\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mi\u001b[0m \u001b[1;33m/\u001b[0m \u001b[0mj\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 16\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;33m(\u001b[0m\u001b[1;34m'After\\n'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 17\u001b[0m \u001b[0msys\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mstdout\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mflush\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mZeroDivisionError\u001b[0m: integer division or modulo by zero" + ] + } + ], + "prompt_number": 8 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Practical_C_Programming/.ipynb_checkpoints/Chapter_16_1-checkpoint.ipynb b/Practical_C_Programming/.ipynb_checkpoints/Chapter_16_1-checkpoint.ipynb new file mode 100644 index 00000000..505718fd --- /dev/null +++ b/Practical_C_Programming/.ipynb_checkpoints/Chapter_16_1-checkpoint.ipynb @@ -0,0 +1,74 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:8846db95d13f18ddbaba03cb28aa141be8268e397ec14735e02a0f66209b0b25" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 16: Floating point" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 16.1, Page number: 322" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "number1 = 1.0\n", + "number2 = 1.0\n", + "counter = 0\n", + "\n", + "# Calculation and result\n", + "while (number1 + number2 != number1) :\n", + " counter += 1\n", + " number2 = number2 / 10.0\n", + "\n", + "print ('%2d digits accuracy in calculations\\n' % counter)\n", + "\n", + "\n", + "number2 = 1.0\n", + "counter = 0\n", + "\n", + "result = number1 + number2\n", + "counter += 1\n", + "number2 = number2 / 10.0\n", + "\n", + "print ('%2d digits accuracy in storage\\n' % counter)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "16 digits accuracy in calculations\n", + "\n", + " 1 digits accuracy in storage\n", + "\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Practical_C_Programming/.ipynb_checkpoints/Chapter_17_1-checkpoint.ipynb b/Practical_C_Programming/.ipynb_checkpoints/Chapter_17_1-checkpoint.ipynb new file mode 100644 index 00000000..3d179b54 --- /dev/null +++ b/Practical_C_Programming/.ipynb_checkpoints/Chapter_17_1-checkpoint.ipynb @@ -0,0 +1,199 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:359ba0990b58235e80b2e0192de2b1c02844fb6d8275025bc2e3f3cf33cfcdf1" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 17: Advanced Pointers " + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 17.1, Page number: 331" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Structure declaration\n", + "from ctypes import *\n", + "\n", + "class person (Structure) :\n", + "_fields_ = [(\"name\", c_wchar_p), (\"address\", c_wchar_p), (\"city_state_zip\", c_wchar_p), (\"age\", c_int), (\"height\", c_float)]" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 17.2, Page number: 336" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Function declaration\n", + "def lookup (name) :\n", + " lists = ['John', 'Jim', 'Jane', 'Clyde']\n", + " result = 0\n", + "\n", + " for index in range (0, 4) :\n", + " if (lists[index] == name) :\n", + " result = 1\n", + " break\n", + " \n", + " return result\n", + "\n", + "# Calculation and result\n", + "name = 'Jane'\n", + "\n", + "if (lookup (name)) :\n", + " print ('%s is in the list\\n' % name)\n", + "else :\n", + " print ('%s is not in the list\\n' % name)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Jane is in the list\n", + "\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 17.3, Page number: 338" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Declaration and result\n", + "aList = [45, 89, 123]\n", + "\n", + "aList.insert(1, 53)\n", + "\n", + "print 'Final List : ', aList" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Final List : [45, 53, 89, 123]\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 17.4, Page number: 348" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Class declaration\n", + "class Node:\n", + " def __init__(self, val):\n", + " self.l_child = None\n", + " self.r_child = None\n", + " self.data = val\n", + "\n", + "def binary_insert(root, node):\n", + " if root is None:\n", + " root = node\n", + " else:\n", + " if root.data > node.data:\n", + " if root.l_child == None:\n", + " root.l_child = node\n", + " else:\n", + " binary_insert(root.l_child, node)\n", + " else:\n", + " if root.r_child == None:\n", + " root.r_child = node\n", + " else:\n", + " binary_insert(root.r_child, node)\n", + "\n", + "def in_order_print(root):\n", + " if not root:\n", + " return\n", + " in_order_print(root.l_child)\n", + " print root.data\n", + " in_order_print(root.r_child)\n", + "\n", + "r = Node('Lemon')\n", + "binary_insert(r, Node('Plum'))\n", + "binary_insert(r, Node('Apple'))\n", + "binary_insert(r, Node('Orange'))\n", + "binary_insert(r, Node('Pear'))\n", + "binary_insert(r, Node('Grape'))\n", + "\n", + "\n", + "# Result\n", + "print \"List of words in ASCII order:\"\n", + "in_order_print(r)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "List of words in ASCII order:\n", + "Apple\n", + "Grape\n", + "Lemon\n", + "Orange\n", + "Pear\n", + "Plum\n" + ] + } + ], + "prompt_number": 4 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Practical_C_Programming/.ipynb_checkpoints/Chapter_18_1-checkpoint.ipynb b/Practical_C_Programming/.ipynb_checkpoints/Chapter_18_1-checkpoint.ipynb new file mode 100644 index 00000000..0369d712 --- /dev/null +++ b/Practical_C_Programming/.ipynb_checkpoints/Chapter_18_1-checkpoint.ipynb @@ -0,0 +1,109 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:2d44df2c3fb888f51302e9d5a213984c3dfb884f4d72dcb60cfc8091b69443e6" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 18: Modular Programming" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 18.2, Page number: 364" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variable declaration\n", + "array = [1, 2, 3, 4, 5]\n", + "array_size = 10\n", + "num = 6\n", + "\n", + "# Calculation\n", + "for index in range (5, 10) :\n", + " array.insert(index, num)\n", + " num = num + 1\n", + "\n", + "# Result\n", + "print \"Contents of array of size 10 elements is\", array" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Contents of array of size 10 elements is [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 18.3, Page number: 372" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Calculation\n", + "import numpy as np \n", + "\n", + "# hist indicates that there are 0 items in bin #0, 2 in bin #1, 4 in bin #3, 1 in bin #4\n", + "# bin_edges indicates that bin #0 is the interval [0,1), bin #1 is [1,2), ..., bin #3 is [3,4)\n", + "\n", + "hist, bin_edges = np.histogram([1, 1, 2, 2, 2, 2, 3], bins = range(5))\n", + "\n", + "\n", + "# Result\n", + "import matplotlib.pyplot as plt\n", + "plt.bar(bin_edges[:-1], hist, width=1) and plt.xlim(min(bin_edges), max(bin_edges))\n", + "plt.savefig('histogram.png')\n", + "\n", + "from IPython.core.display import Image \n", + "Image(filename='histogram.png')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "pyout", + "png": "iVBORw0KGgoAAAANSUhEUgAAAyAAAAJYCAYAAACadoJwAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nA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AAgGQECAAAkIwAAQAAkhEg\nAABAMgIEAABIRoAAAADJCBAAACAZAQIAACQjQAAAgGQECAAAkIwAAQAAkhEgAABAMgIEAABIRoAA\nAADJCBAAACAZAQIAACQjQAAAgGQECAAAkIwAAQAAkhEgAABAMgIEAABIRoC04Xe/+10UFRXFueee\nG7m5uTFkyJAoLCyMysrKY577+OOPR05OzlG/du7cmWB6AADofvp09QDd2datW+PTTz+N6667LvLz\n86O+vj6qqqrimmuuidra2vjOd75zzMcoKyuLUaNGNVsbNGhQZ40MAADdmgBpw8yZM2PmzJnN1m68\n8caYMGFCPProo+0KkJkzZ0ZBQUFnjQgAAD2KW7A6KCcnJ0aMGBGnn356u47PZrOxd+/eaGxs7OTJ\nAACg+xMg7VBfXx+7d++OP/zhD/Hwww/H888/H4sWLWrXudOmTYtBgwZFbm5uXH755bFly5ZOnhYA\nALovt2C1w6233hqPPvpoRET06dMnli5dGvPmzWvznNzc3Jg7d25MmzYtBg4cGBs3boyHHnooCgsL\no7q6OkaMGJFidAAA6FYESDvccsstUVxcHNu2bYvKysq46aabon///nHttde2ek5RUVEUFRU1/fqy\nyy6L6dOnx5QpU+L++++P5cuXpxgdAAC6FQHSDuedd16cd955ERExZ86cmD59eixYsCCKi4ujf//+\n7X6ciy66KCZNmhTr1q1r87gFCxbE4MGDm62VlpZGaWlpx4cHAOC4rFq1KlatWtVsbc+ePV00zalD\ngByHK6+8Ml588cV4++23Y/z48R06d8SIEVFTU9PmMUuWLPHJWQAAXexofwFcXV0dEyZM6KKJTg3e\nhH4c9u3bFxGHPxGro959990YNmzYyR4JAAB6BAHShl27drVYO3DgQFRUVMSQIUNi3LhxERFRV1cX\nmzdvjoMHD7Z57tq1a6O6ujpmzJjReUMDAEA35hasNsybNy/27t0bU6ZMifz8/Ni+fXtUVlZGTU1N\nlJeXx2mnnRYREXfeeWdUVFREbW1tjBw5MiIiCgsLo6CgICZMmBCDBg2K6urqeOyxx2LkyJFx1113\ndeXTAgCALiNA2nD11VfHD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fHggULori4OPr373/Uc/r37x/79+9vsd7Q0ND0/bYs\nWLAgBg8e3GyttLQ0SktLj+cpAABwHFatWhWrVq1qtrZnz54umubUIUA66Morr4wXX3wx3n777Rg/\nfvxRj8nLyzvqbVZ1dXUREZGfn9/mv2PJkiVHfQ8JAADpHO0vgKurq2PChAldNNGpwXtAOujI7VM5\nOa1fuvHjx0d1dXVks9lm6xs2bIjc3NwYO3Zsp84IAADdlQBpxa5du1qsHThwICoqKmLIkCExbty4\niDj8qsbmzZvj4MGDTcddddVVsWPHjlizZk3T2u7du2P16tUxe/bsY36MLwAAnKrcgtWKefPmxd69\ne2PKlCmRn58f27dvj8rKyqipqYny8vI47bTTIiLizjvvjIqKiqitrY2RI0dGxOEAmTx5csydOzfe\neuutpp+Ens1m47777uvKpwUAAF1KgLTi6quvjh/+8IexfPny+Oijj2LgwIExadKkWLZsWXzta19r\nOi6TyUQmk2l2bk5OTqxduzYWLlwYS5cujX379sWFF14YFRUVMWbMmNRPBQAAug0B0oqSkpIoKSk5\n5nHl5eVRXl7eYn3w4MGxYsWKWLFiRWeMBwAAPZL3gAAAAMkIEAAAIBkBAgAAJCNAAACAZAQIAACQ\njAABAACSESAAAEAyAgQAAEhGgAAAAMkIEAAAIBkBAgAAJCNAAACAZAQIAACQjAABAACSESAAAEAy\nAgQAAEhGgAAAAMkIEAAAIBkBAgAAJCNAAACAZAQIAACQjAABAACSESAAAEAyAgQAAEhGgAAAAMkI\nEAAAIBkBAgAAJCNAAACAZAQIAACQjAABAACSESAAAEAyAgQAAEhGgAAAAMkIEAAAIBkBAgAAJCNA\nAACAZAQIAACQjAABAACSESAAAEAyAgQAAEhGgAAAAMkIEAAAIBkBAgAAJCNAAACAZAQIAACQjAAB\nAACSESBteP311+Omm26KcePGxYABA+Kcc86JkpKSeOedd4557uOPPx45OTlH/dq5c2eC6QEAoPvp\n09UDdGcPPPBArF+/PoqKiuLLX/5y1NXVxbJly6KgoCBee+21GDdu3DEfo6ysLEaNGtVsbdCg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TeitaGxsjJKSktiwYUOsXr06Jk2adNTjtm/fHps3b46D\nBw82rV111VWxY8eOWLNmTdPa7t27Y/Xq1TF79uw4/fTTO31+AADojrwC0orbbrstnn322Zg9e3bs\n3r07nnzyyWbfnzNnTkRE3HHHHVFRURG1tbUxcuTIiDgcIJMnT465c+fGW2+91fST0LPZbNx3333J\nnwsAAHQXAqQVv/71ryOTycSzzz4bzz77bLPvZTKZpgDJZDIt3pSek5MTa9eujYULF8bSpUtj3759\nceGFF0ZFRUWMGTMm2XMAAIDuxi1YrXjppZeisbExDh061OKrsbGx6bjy8vJobGxsevXjiMGDB8eK\nFSti165d8emnn8bPf/5zbywHAKDXEyAAAEAyAgQAAEhGgAAAAMkIEAAAIBkBAgAAJCNAAACAZAQI\nAACQjAABAACSESAAAEAyAgQAAEhGgAAAAMkIEAAAIBkBAgAAJCNAAACAZAQIAACQjAABAACSESAA\nAEAyAgQAAEhGgAAAAMkIEAAAIBkBAgAAJCNAAACAZAQIAACQjAABAACSESAAAEAyAgQAAEhGgAAA\nAMkIEAAAIBkBAgAAJCNAAACAZAQIAACQjAABAACSESAAAEAyAgQAAEhGgAAAAMkIEAAAIBkBAgAA\nJCNAAACAZAQIAACQjAABAACSESAAAEAyAgQAAEhGgAAAAMkIEAAAIBkBAgAAJCNAAACAZARIG/70\npz/F4sWLY8aMGfHZz342cnJyYuXKle069/HHH4+cnJyjfu3cubOTJwcAgO6pT1cP0J3t2rUrysrK\n4pxzzonx48fHyy+/HJlMpkOPUVZWFqNGjWq2NmjQoJM5JgAA9BgCpA35+fmxffv2OOuss+KNN96I\niRMndvgxZs6cGQUFBZ0wHQAA9DxuwWrDGWecEWeddVZERGSz2eN6jGw2G3v37o3GxsaTORoAAPRI\nAqSTTZs2LQYNGhS5ublx+eWXx5YtW7p6JAAA6DJuweokubm5MXfu3Jg2bVoMHDgwNm7cGA899FAU\nFhZGdXV1jBgxoqtHBACA5ARIJykqKoqioqKmX1922WUxffr0mDJlStx///2xfPnyLpwO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uueeerh6h\nB3LNjs+crh6gB7LXjo+91nH22vGx1zqqtrY2Lrrooq4eo0cSIK3Iy8s76q1SdXV1ERFtvkJxvOdO\nnz49nnzyyfjc5z7XZuAAANA1Ghoa4r333ovp06d39Sg9lgBpxQUXXBAvv/xy7N27N/7mb/6maX3D\nhg0RETF+/PhWzx0/fny88sorkc1mI5PJNDs3Nzc3xo4de9Tzhg4dGt/4xjdO0jMAAKAzFBYWdvUI\nPZo3obfiqquuisbGxnj00Ueb1vbv3x/l5eUxefLkOPvssyMiYvv27bF58+Y4ePBgs3N37NgRa9as\naVrbvXt3rF69OmbPnh2nn356uicCAADdSCabzWa7eojuqqSkJJ5++um45ZZb4txzz42VK1fGxo0b\n42c/+1lcfPHFEXH4p6VXVFREbW1tjBw5MiIO/yT0iy++OH7729/GwoULY8iQIfHII4/EBx98EK+/\n/nqMGTOmK58WAAB0GbdgtaGioiLuueeeeOKJJ+Ljjz+Or3zlK/HTn/60KT4iIjKZTLPbrCIicnJy\nYu3atbFw4cJYunRp7Nu3Ly688MKoqKgQHwAA9GpuwWpD375948EHH4xt27bFvn374rXXXouvf/3r\nzY4pLy+PxsbGplc/jhg8eHCsWLEidu3aFR999FFMnDgx/vEf/zE+85nPxOTJk2PdunXtmmHPnj0x\nb968GDZsWAwYMCAuueSS2LRp00l7jt3Z/v374/bbb4/8/PwOXbfHH388cnJyjvq1c+fOBJN3jT/9\n6U+xePHimDFjRnz2s5+NnJycWLlyZbvP76177USuW2/da6+//nrcdNNNMW7cuBgwYECcc845UVJS\nEu+88067zu+te+1Erltv3Wu/+93voqioKM4999zIzc2NIUOGRGFhYVRWtu8jY3vrXjuR69Zb99rR\n3H///ZGTkxPnn39+u47vrfvteHgFJIHrrrsunnrqqbjllltizJgxUV5eHpdeemm89NJLbX5826FD\nh2LWrFnx5ptvxqJFi5pu5Zo6dWq88cYbMXr06ITPIr3jvW5HlJWVxahRo5qtDRo0qLPG7XK7du2K\nsrKyOOecc2L8+PHx8ssvt3h1rjW9ea+dyHU7orfttQceeCDWr18fRUVF8eUvfznq6upi2bJlUVBQ\nEK+99lqMGzeu1XN78147ket2RG/ba1u3bo1PP/00rrvuusjPz4/6+vqoqqqKa665Jmpra+M73/lO\nq+f25r12ItftiN621/7aBx98EP/6r/8aubm57fr/hN68345Llk61YcOGbCaTyX7/+99vWmtoaMiO\nHj06W1hY2Oa5P/rRj7KZTCb71FNPNa3t2rUre+aZZ2b/+Z//udNm7g5O5LqVl5dnM5lM9o033ujs\nMbuV/fv3Z3fs2JHNZrPZjRs3ZjOZTHblypXtOrc377UTuW69da/993//d/bAgQPN1t55551sv379\nsnPmzGnz3N68107kuvXWvXY0jY2N2fHjx2dHjhzZ5nG9ea8dTXuvm712WElJSfbv//7vs1OnTs1+\n6UtfOubx9lvHuAWrk1VVVUWfPn1i3rx5TWt9+/aN66+/PtavXx8ffvhhm+cOHz48rrjiiqa1oUOH\nRnFxcTzzzDNx4MCBTp29K53IdTsim83G3r17o7GxsTNH7TbOOOOMOOussyLi8HPviN68107kuh3R\n2/baV7/61ejTp/kL6KNHj44vfvGLsXnz5jbP7c177USu2xG9ba8dTU5OTowYMeKYnyjZm/fa0bT3\nuh3Rm/faL37xi3jqqadiyZIlLX6kQmvst44RIJ1s06ZNMXbs2BgwYECz9YkTJ0ZExK9+9as2zy0o\nKGixPnHixKivr4+ampqTO2w3ciLX7Yhp06bFoEGDIjc3Ny6//PLYsmVLp8x6KujNe+1ksNcO/2Fl\nx44dMXTo0DaPs9eaa+91O6K37rX6+vrYvXt3/OEPf4iHH344nn/++Vi0aFGb59hrx3fdjuite62x\nsTFuvvnm+Pa3v92u2yKPsN86xntAOlldXV3k5eW1WD+ydrSfmP5/z506dWqb53bkP46e5ESuW25u\nbsydOzemTZsWAwcOjI0bN8ZDDz0UhYWFUV1dHSNGjOi0uXuq3rzXToS99heVlZWxbdu2+O53v9vm\ncfZac+29br19r916661NP5erT58+sXTp0mavkB+NvXZ8162377Uf/OAHsXXr1vj5z3/eofPst44R\nIJ1s37590bdv3xbr/fr1a/p+axoaGo773J7uRK5bUVFRFBUVNf36sssui+nTp8eUKVPi/vvvj+XL\nl5/8gXu43rzXToS9dtjmzZvjxhtvjMLCwrj22mvbPNZe+4uOXLfevtduueWWKC4ujm3btkVlZWXc\ndNNN0b9//zavm712fNetN++1jz76KO6999649957Y8iQIR06137rGAHSyfr37x/79+9vsd7Q0ND0\n/c44t6c72c/9oosuikmTJrX74497m96810623rbXtm/fHrNmzYozzzwzqqqqjnmvtL12WEev29H0\npr123nnnxXnnnRcREXPmzInp06fHggULori4uNU9Y68d33U7mt6y1+6+++4YOnRo3HzzzR0+137r\nGO8B6WR5eXlHvV2orq4uIiLy8/M75dyerjOe+4gRI+Ljjz8+4dlORb15r3WG3rLXPvnkk5g5c2b8\n8Y9/jP/6r/+K4cOHH/Mce+34rltreste+2tXXnllfPLJJ/H222+3eoy91lJ7rltrTvW99s4778SK\nFSvi5ptvjg8++CBqa2ujtrY2Ghoa4s9//nO8//77bT5/+61jBEgnu+CCC6Kmpib27t3bbH3Dhg0R\nETF+/PhWzx0/fnxUV1e3+GSeDRs2RG5ubowdO/bkD9xNnMh1a827774bw4YNOynznWp6817rDL1h\nrzU0NMTs2bNjy5Yt8dOf/jQ+//nPt+u83r7Xjve6taY37LWjOXI7S05O63+M6e177Wjac91ac6rv\ntQ8//DAOHToU8+fPj7/9279t+vrlL38ZNTU1MWrUqCgrK2v1fPutYwRIJ7vqqquisbGx6U1gEYd/\nwnd5eXlMnjw5zj777Ig4/HL85s2b4+DBg83O3bFjR6xZs6Zpbffu3bF69eqYPXt2uz9Kryc6keu2\na9euFo+3du3aqK6ujhkzZnT+8N2cvXZ87LW/aGxsjJKSktiwYUOsXr06Jk2adNTj7LXmTuS69da9\ndrTnfeDAgaioqIghQ4Y0vam3rq7OXvs/TuS69da9dv7558fTTz8dP/7xj5u+nn766Rg3blycc845\n8eMf/ziuv/76iLDfToZM9ng/+J52KykpiaeffjpuueWWOPfcc2PlypWxcePG+NnPfhYXX3xxRBz+\nqd8VFRVRW1sbI0eOjIjDP1Xz4osvjt/+9rexcOHCpp+q+cEHH8Trr78eY8aM6cqn1emO97qNGTMm\nCgoKYsKECTFo0KCorq6Oxx57LM4+++x4/fXXT+m/wVm2bFns2bMntm3bFj/4wQ/iiiuuaHq1aP78\n+TFw4EB77SiO97r11r22YMGCWLp0acyePbvZm1WPmDNnTkT4fe2vnch166177Z/+6Z9i7969MWXK\nlMjPz4/t27dHZWVl1NTURHl5eXzzm9+MCHvtr53Ideute601U6dOjY8++ih+85vfNK3ZbydB+p99\n2Ps0NDRkFy5cmM3Ly8v269cvO2nSpOwLL7zQ7Jjrrrsum5OTk33//febrX/88cfZb33rW9mhQ4dm\nc3Nzs9OmTes1P530eK/b3Xffnb3ggguygwcPzp5xxhnZz33uc9kbb7wxu3PnztRPIbnPfe5z2Uwm\nk81kMtmcnJxsTk5O0z8fuUb2WkvHe916616bOnVq0zX666+cnJym4+y15k7kuvXWvfYf//Ef2a9/\n/evZ4cOHZ08//fTskCFDspdeeml23bp1zY6z15o7kevWW/daa6ZOnZo9//zzm63ZbyfOKyAAAEAy\n3gMCAAAkI0AAAIBkBAgAAJCMAAEAAJIRIAAAQDICBAAASEaAAAAAyQgQAAAgGQECAAAkI0AAAIBk\nBAgAAJCMAAEAAJIRIAAAQDICBAAASEaAAAAAyQgQAAAgGQECAAAkI0AAAIBkBAgAAJCMAAEAAJIR\nIAAAQDICBAAASEaAAAAAyQgQAAAgGQECAAAkI0AAAIBkBAgAAJCMAAEAAJIRIAAAQDICBAAASEaA\nAAAAyQgQAAAgGQECAAAkI0AAAIBkBAgAAJCMAAEAAJIRIAAAQDICBAAASEaAAAAAyQgQAAAgmf8P\npDpIO5V4wm8AAAAASUVORK5CYII=\n", + "prompt_number": 5, + "text": [ + "" + ] + } + ], + "prompt_number": 5 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Practical_C_Programming/.ipynb_checkpoints/Chapter_19_1-checkpoint.ipynb b/Practical_C_Programming/.ipynb_checkpoints/Chapter_19_1-checkpoint.ipynb new file mode 100644 index 00000000..00ddd7e8 --- /dev/null +++ b/Practical_C_Programming/.ipynb_checkpoints/Chapter_19_1-checkpoint.ipynb @@ -0,0 +1,197 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:4ee1b1671641fa0922389d9bf11b94f42d9755534b4f0476bbe2f9ceb3b1bc7e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 19: Ancient compilers" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 19.1, Page number: 385" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Function declaration\n", + "def area (width, height) :\n", + " return width * height\n", + "\n", + "# Calculation and result\n", + "size = area (3.0, 2)\n", + "print ('Area is %f\\n' % size)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Area is 6.000000\n", + "\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 19.2, Page number: 386" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Function declaration\n", + "def square (s) :\n", + " return s * s\n", + "\n", + "# Calculation and result\n", + "i = square (5)\n", + "print ('i is %d\\n' % i)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "i is 25\n", + "\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 19.3, Page number: 386" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Function declaration\n", + "def sum (i1, i2, i3) :\n", + " return i1 + i2 + i3\n", + "\n", + "# Calculation and result\n", + "print ('Sum is %d\\n' % sum (1, 2, 3))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sum is 6\n", + "\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 19.4, Page number: 387" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "first = 'John'\n", + "last = 'Doe'\n", + "\n", + "# Calculation and result\n", + "full = first + ' ' + last\n", + "print ('The name is %s\\n' % full)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The name is John Doe\n", + "\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 19.5, Page number: 390" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Function declaration\n", + "def area (width, height) :\n", + " return width * height\n", + "\n", + "# Calculation and result\n", + "size = area (3.0, 2.0)\n", + "print ('Area is %f\\n' % size)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Area is 6.000000\n", + "\n" + ] + } + ], + "prompt_number": 5 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Practical_C_Programming/.ipynb_checkpoints/Chapter_21_1-checkpoint.ipynb b/Practical_C_Programming/.ipynb_checkpoints/Chapter_21_1-checkpoint.ipynb new file mode 100644 index 00000000..144ac453 --- /dev/null +++ b/Practical_C_Programming/.ipynb_checkpoints/Chapter_21_1-checkpoint.ipynb @@ -0,0 +1,65 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:519d4be291344b242a6ae999f129aea597642f5315e1fe947ec2b9d627dcc018" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 21: C's dustier corners" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 21.1, Page number: 401" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "import sys\n", + "line = 'a'\n", + "\n", + "# Calculation and result\n", + "if (line == 'a') :\n", + " print ('Add\\n')\n", + "elif (line == 'd') :\n", + " print ('Delete\\n')\n", + "elif (line == 'q') :\n", + " print ('Quit\\n')\n", + " sys.exit(1) \n", + "else :\n", + " print ('Error:Bad command %c\\n' % line)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Add\n", + "\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Practical_C_Programming/.ipynb_checkpoints/Chapter_23_1-checkpoint.ipynb b/Practical_C_Programming/.ipynb_checkpoints/Chapter_23_1-checkpoint.ipynb new file mode 100644 index 00000000..bde77ef6 --- /dev/null +++ b/Practical_C_Programming/.ipynb_checkpoints/Chapter_23_1-checkpoint.ipynb @@ -0,0 +1,59 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:456077e76cba45d73549d009e1de5e86e8fe318cfd47c138325bf27f45638790" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 23: Programming adages" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 23.1, Page number: 447" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "number = 2\n", + "\n", + "# Calculation and result\n", + "if (number != 2) :\n", + " print ('Number is not two\\n')\n", + "else :\n", + " print ('Number is two\\n')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number is two\n", + "\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Practical_C_Programming/.ipynb_checkpoints/Chapter_2_3-checkpoint.ipynb b/Practical_C_Programming/.ipynb_checkpoints/Chapter_2_3-checkpoint.ipynb new file mode 100644 index 00000000..d166fe06 --- /dev/null +++ b/Practical_C_Programming/.ipynb_checkpoints/Chapter_2_3-checkpoint.ipynb @@ -0,0 +1,1112 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:69b330a048da570dabedd3e4e55c16ec334a711968bec2056bd27ef834d8f06e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 2:. Convective Mass Transfer" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.1,Page number94" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "T = 310 \t\t\t\t\t# [K]\n", + "\t# Since the solubility of oxygen in water at 310 K is extremely low, we are dealing with \tdilute solutions\n", + "k_L = 3.3*10**-5 \t\t\t\t# [coefficient based on the oxygen concentration \t\t\t\t\t\tdifference in the water, m/s]\n", + "row = 993 \t\t\t\t\t# [kg/cubic m]\n", + "M_b = 18 \t\t\t\t\t# [gram/mole]\n", + "\n", + "\n", + "#Calculation\n", + " \n", + "\t# Since we are dealing with very dilute solutions\n", + "\t# Therefore, c = (row/M_avg) = row/M_b\n", + "c = row/M_b \t\t\t\t\t# [kmole/cubic m]\n", + "\t# Using equation 2.10\n", + "k_x = k_L*c \t\t\t\t\t# [kmole/square m.s]\n", + "\n", + "#Result\n", + "\n", + "print\"The mass-transfer coefficient based on the mole fraction of oxygen in the liquid is\",round(k_x,5),\" kmole/square m.s\" \n", + "\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The mass-transfer coefficient based on the mole fraction of oxygen in the liquid is 0.00182 kmole/square m.s\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.2,Page number:95" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "\n", + "\t# a-ammonia b-air\n", + "T = 300 \t\t\t\t\t# [K]\n", + "P = 1 \t\t\t\t\t\t# [atm]\n", + "y_a1 = 0.8 \t\t\t\t\t# [ammonia mole fraction in the bulk of the gas \t\t\t\t\t\t\tphase]\n", + "y_a2 = 0.732 \t\t\t\t\t# [ammonia gas-phase mole fraction on interface]\n", + "N_a = 4.3*10**-4 \t\t\t\t# [ammonia flux, kmole/square m.s]\n", + "\n", + "#Calculations\n", + "\n", + "import math\n", + "\t# Using equation 2.2\n", + "F_g = N_a/math.log10((1-y_a2)/(1-y_a1)) \t\t# [kmole/square m.s]\n", + "\n", + "#Result\n", + "\n", + "print\"The mass-transfer coefficient in the gas phase at that point where flux is 4.3*10**-4 is\",round(F_g,5),\" kmole/square m.s\"\n", + "print\"\\n\\nNOTE:Calculation mistake in book:\\nAnswer written as 1.47*10^-4,Actually,,...it is 1.47*10^-3.Please REDO last calculation manually to check\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The mass-transfer coefficient in the gas phase at that point where flux is 4.3*10**-4 is 0.00338 kmole/square m.s\n", + "\n", + "\n", + "NOTE:Calculation mistake in book:\n", + "Answer written as 1.47*10^-4,Actually,,...it is 1.47*10^-3.Please REDO last calculation manually to check\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.3,Page number:96" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "\n", + "\t\t# a-methanol b-water\n", + "P = 101.3 \t\t\t\t\t\t# [kPa]\n", + "y_a1 = 0.707 \t\t\t\t\t\t# [mole fraction at interface]\n", + "y_a2 = 0.656 \t\t\t\t\t\t# [mole fraction at bulk of the gas]\n", + "k_g = 1.62*10**-5 \t\t\t\t\t# [mass-transfer coefficient at a point \t\t\t\t\t\t\t in the column, kmole/square m.s.kPa]\n", + "#Calculations\n", + "\n", + "\t# Using equation 2.14\n", + "k_y = k_g*P \t\t\t\t\t\t# [kmole/square m.s]\n", + "\t# Using equation 2.12\n", + "N_a = k_y*(y_a1-y_a2) \t\t\t\t\t# [kmole/square m.s]\n", + "\n", + "#Result\n", + "\n", + "print\"The methanol flux at the point of given mass transfer coefficient is\",round(N_a,7),\"kmole/square m.s\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The methanol flux at the point of given mass transfer coefficient is 8.37e-05 kmole/square m.s\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.4,Page number:99" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "n = 6 # [number of variables]\n", + "\n", + "#Calculations\n", + "\n", + "from scipy.optimize import fsolve\n", + "from numpy import *\n", + "import math\n", + "# To determine the number of dimensionless parameters to be formed, we must know the rank, r, of the dimensional matrix.\n", + "# The dimensional matrix is \n", + "DM =matrix([[0,0,1,1,0,0],[1,1,-3,-1,2,1],[-1,-1,0,0,-1,-1]]) \n", + "rk= linalg.matrix_rank(DM)\n", + "print\"Rank of matrix is \",rk \n", + "\n", + "#The numbers in the table represent the exponent of M, L, and t in the dimensional expression of each of the six variables involved. For example, the dimensional expression of p is M/Lt hence the exponents are 1, -1, and -1\n", + "\n", + "# From equation 2.16\n", + "i = n-rk # [number of dimensional groups]\n", + "# Let the dimensional groups are pi1, pi2 and pi3\n", + "# Therefore pi1 = (D_AB)**a*(row)**b*(D)**c*kc\n", + "# pi2 = (D_AB)**d*(row)**e*(D)**f*v\n", + "# pi3 = (D_AB)**g*(row)**h*(D)**i*u\n", + "\n", + "# Solving for pi1\n", + "# M**0*L**0*t**0 = 1 = (L**2/t)**a*(M/L**3)**b*(L)**c*(L/t)\n", + "\n", + "# Solution of simultaneous equation\n", + "def F(e):\n", + " f1 = 2*e[0]-3*e[1]+e[2]+1 \n", + " f2 = -e[0]-1 \n", + " f3 = -e[1] \n", + " return(f1,f2,f3)\n", + "\n", + "\n", + "# Initial guess:\n", + "e = [0.1,0.8,0.5] \n", + "y = fsolve(F,e) \n", + "a = y[0] \n", + "b = y[1] \n", + "c = y[2] \n", + "print\"The coefficients of pi1 are\",a,round(b),c \n", + "# Similarly the coefficients of pi2 and pi3 are calculated\n", + "# Therefore we get pi1 = kc*D/D_AB = Sh i.e. Sherwood Number\n", + "# pi2 = v*D/D_AB = P_ed i.e. Peclet Number\n", + "# pi3 = u/(row*D_AB) = Sc i.e. Schmidt Number\n", + "\n", + "# Dividing pi2 by pi3 gives\n", + "# pi2/pi3 = D*v*row/u = Re i.e. Renoylds number\n", + "\n", + "print\"The result of the dimensional analysis of forced-convection mass transfer in a circular conduit indicates that a correlating relation could be of the form\\n Sh = function(Re,Sc)\\n which is analogous to the heat transfer correlation \\n Nu = function(Re,Pr)\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Rank of matrix is 3\n", + "The coefficients of pi1 are -1.0 0.0 1.0\n", + "The result of the dimensional analysis of forced-convection mass transfer in a circular conduit indicates that a correlating relation could be of the form\n", + " Sh = function(Re,Sc)\n", + " which is analogous to the heat transfer correlation \n", + " Nu = function(Re,Pr)\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.6,Page number:111" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "M_a = 352 \t\t\t\t\t# [molecular weight of UF6, gram/mole]\n", + "M_b = 29 \t\t\t\t\t# [gram/mole]\n", + "d = 0.01 \t\t\t\t\t# [diameter, m]\n", + "x = 0.1 \t\t\t\t\t# [length exposed to air stream, m]\n", + "v = 1 \t\t\t\t\t\t# [m/s]\n", + "Ts = 303 \t\t\t\t\t# [surface temperature of solid, K]\n", + "P_a = 27 \t\t\t\t\t# [vapor pressure of UF6, kPa]\n", + "Tb = 325 \t\t\t\t\t# [bulk temperature of solid ,K]\n", + "P = 101.3 \t\t\t\t\t# [kPa]\n", + "R = 8.314 \t\t\t\t\t# [cubic m.Pa/mole.K]\n", + "import math\n", + "\n", + "y_a1 = P_a/P \t\t\t\t\t# [mole fraction at point 1]\n", + "y_a2 = 0 \t\t\t\t\t# [mole fraction at point 2]\n", + "\n", + "\t# Along the mass-transfer path-cylinder surface (point 1) to bulk air (point 2)\n", + "Tavg = (Ts+Tb)/2 \t\t\t\t# [K]\n", + "\n", + "\t# At point 1, the gas is saturated with UF6 vapor, while at point 2 the gas is virtually \tfree of UF6\n", + "\t# Therefore\n", + "Pavg = (P_a+0)/2 \t\t\t\t# [average partial pressure, kPa]\n", + "y_a = Pavg/P \t\t\t\t\t# [mole fraction of UF6]\n", + "\n", + "Mavg = M_a*y_a+M_b*(1-y_a) \t\t\t# [gram/mole]\n", + "row_avg = P*Mavg/(R*Tavg) \t\t\t# [kg/cubic m]\n", + "\n", + "\t# Parameter for c-O2, d-N2 and a-UF6\n", + "yi_c = 0.182 \n", + "yi_d = 0.685 \n", + "yi_a = 0.133 \n", + "Tc_c = 154.6 \t\t\t\t# [K]\n", + "Tc_d = 126.2 \t\t\t\t\t# [K]\n", + "Tc_a = 505.8 \t\t\t\t\t# [K]\n", + "Pc_c = 50.4 \t\t\t\t\t# [bar]\n", + "Pc_d = 33.9 \t\t\t\t\t# [bar] \n", + "Pc_a = 46.6 \t\t\t\t\t# [bar]\n", + "M_c = 32 \t\t\t\t# [gram/mole]\n", + "M_d = 28 \t\t\t\t\t# [gram/mole] \n", + "M_a = 352 \t\t\t\t\t# [gram/mole]\n", + "V_c = 73.4 \t\t\t\t# [cubic cm/mole]\n", + "V_d = 89.8 \t\t\t\t\t# [cubic cm/mole]\n", + "V_a = 250 \t\t\t\t\t# [cubic cm/mole]\n", + "Z_c = 0.288 \n", + "Z_d = 0.290 \n", + "Z_a = 0.277 \n", + "\n", + "#Calculations\n", + "\n", + "\n", + "\t# From equation 2.52 and 2.53\n", + "Tcm = yi_c*Tc_c+yi_d*Tc_d+yi_a*Tc_a \t\t# [K]\n", + "Pcm = 10**6*R*Tcm*(yi_c*Z_c+yi_d*Z_d+yi_a*Z_a)/((yi_c*V_c+yi_d*V_d+yi_a*V_a)*100000) \t# [bar]\n", + "M_avg = yi_c*M_c+yi_d*M_d+yi_a*M_a \t\t# [gram/mole]\n", + "\n", + "\t# From equation 2.50\n", + "Em = 0.176*(Tcm/(M_avg**3*Pcm**4))**(1.0/6.0) \t# [uP]**-1\n", + "\n", + "\t# From equation 2.51\n", + "Trm = Tavg/Tcm \n", + "f_Trm = (0.807*Trm**0.618)-(0.357*math.exp(-0.449*Trm))+(0.340*math.exp(-4.058*Trm))+0.018 \n", + "\t# From equation 2.49 \n", + "u = f_Trm/Em \t\t\t\t\t\t# [uP]\n", + "u = u*10**-7 \t\t\t\t\t\t# [viscosity, kg/m.s]\n", + "\n", + "Re = d*v*row_avg/u \t\t\t\t\t# [Renoylds number]\n", + "\n", + "\t\t# Diffusivity of UF6 vapors in air at 314 K and 1 atm from equation 1.49\n", + "D_ab = 0.0904 \t\t\t\t\t\t# [square cm/s]\n", + "\n", + "Sc = u/(row_avg*D_ab*10**-4) \t\t\t\t# [Schmidt number]\n", + "\n", + "Sh_avg = 0.43 + 0.532*Re**0.5*Sc**0.31 \t\t# [Sherwood number]\n", + "\t\t# From equation 1.7\n", + "c = P/(R*Tavg) \t\t\t\t\t# [kmole/cubic m]\n", + "\t\t# From Table 2.1 \n", + "F_av = Sh_avg*D_ab*c*10**-4/d \t\t\t\t# [kmole/square m.s]\n", + "\n", + "\t\t# From equation 2.2\n", + "N_avg = F_av*math.log((1-y_a2)/(1-y_a1)) \t\t# [kmole/square m.s]\n", + "S = 2*math.pi*d**2/4 +math.pi*d*x \t\t\t# [total surface area of the cylinder, \t\t\t\t\t\t\tsquare m]\n", + "\n", + "w_a = N_avg*S*M_a \t\t\t\t\t# [rate of sublimation of the solid, \t\t\t\t\t\t\tkg/s] \n", + "\n", + "#Result\n", + "print\"Rate of sublimation of a cylinder of UF6 is\",round(w_a,5),\"kg/s\\n\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Rate of sublimation of a cylinder of UF6 is 0.00023 kg/s\n", + "\n", + "\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.7,Page number:116" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "#Variable declaration\n", + "\n", + "\t# a-benzene b-nitrogen\n", + "T = 300 \t\t\t\t\t# [K]\n", + "P = 101.3 \t\t\t\t\t# [kPa]\n", + "v =10 \t\t\t\t\t\t# [m/s]\n", + "R = 8.314 \t\t\t\t\t# [cubic m.Pa/mole.K]\n", + "\n", + "\n", + "n = -0.5 \n", + "\t# Data on the properties of C02 at 300 K and 1 bar\n", + "u = 1.5*10**-5 \t\t\t\t# [viscosity, P]\n", + "Pr = 0.77 \t\t\t\t\t# [Prandtl number]\n", + "Cp = 853 \t\t\t\t\t# [J/kg.K]\n", + "\t# Therefore\n", + "\t# b = 5.086*l**0.5\n", + "\t# j_D = j_H = f(Re) = 5.086*(l**0.5)*Re**-0.5\n", + "\t# From Table 2.1\n", + "\t# F = j_D*c*v/Sc**(2/3) = 5.086*(l**0.5)*c*v/(Re**0.5*Sc**(2/3)) = \t\t5.086*(row*v*u)**0.5/(Mavg*Sc**(2.0/3.0))\n", + "\n", + "#Calculations\n", + "\n", + "\t# Vapor pressure of benzene\n", + "P_a = math.exp(15.9008-(2788.51/(T-52.36))) \t# [mm of Hg]\n", + "P_a = P_a*101.3/760 \t\t\t\t\t# [kPa]\n", + "\n", + "\t# Parameter for a-benzene, b-nitrogen \n", + "yi_a = 0.07 \n", + "yi_b = 0.93 \n", + "Tc_a = 562.2 \n", + "Tc_b = 126.2 \t\t\t\t\t\t# [K]\n", + "Pc_a = 48.9 \n", + "Pc_b = 33.9 \t\t\t\t\t\t# [bar]\n", + "M_a = 78.1 \n", + "M_b = 28 \t\t\t\t\t\t# [gram/mole]\n", + "V_a = 259 \n", + "V_b = 89.8 \t\t\t\t\t\t# [cubic cm/mole]\n", + "Z_a = 0.271 \n", + "Z_b = 0.290 \n", + "sigma_a = 5.349 \n", + "sigma_b = 3.798 \t\t\t\t\t# [Angstrom]\n", + "ek_a = 412.3 \n", + "ek_b = 71.4 \t\t\t\t\t\t# [E/k, K]\n", + "\n", + "\n", + "\t# From equation 2.52 and 2.53\n", + "Tcm = yi_b*Tc_b+yi_a*Tc_a \t\t\t\t# [K]\n", + "Pcm = 10**6*R*Tcm*(yi_b*Z_b+yi_a*Z_a)/((yi_b*V_b+yi_a*V_a)*100000) \t # [bar]\n", + "M_avg = yi_b*M_b+yi_a*M_a \t\t\t\t\t\t# [kg/kmole]\n", + "\n", + "#RESULT\n", + "\n", + "print\"Average molecular weight is\",round(M_avg,1),\"kg/kmole\" \n", + "\n", + "row = P*M_avg/(R*T) \t\t\t\t\t\t\t# [kg/cubic m]\n", + "\n", + "#RESULT\n", + "\n", + "print\"Density of mixture is\",round(row,2),\"kg/cubic\"\n", + "\t# From equation 2.50\n", + "Em = 0.176*(Tcm/(M_avg**3*Pcm**4))**(1.0/6.0) \t\t\t# [uP]**-1\n", + "\n", + "\t# From equation 2.51\n", + "Trm = T/Tcm \n", + "f_Trm = (0.807*Trm**0.618)-(0.357*math.exp(-0.449*Trm))+(0.340*math.exp(-4.058*Trm))+0.018 \n", + "\t# From equation 2.49 \n", + "u = f_Trm/Em \t\t\t\t\t\t\t\t# [uP]\n", + "u = u*10**-7 \t\t\t\t\t\t\t\t# [viscosity, kg/m.s]\n", + "print\"Average viscosity of mixture is \",round(u,7),\"kg/m.s\\n\\n\" \n", + "\n", + "\t# Calculating diffusivity of benzene using equation 1.49\n", + "D_ab = 0.0986 \t\t\t\t\t\t\t\t# [square cm/s]\n", + "Sc = u/(row*D_ab*10**-4) \t\t\t\t\t\t# [Schmidt number]\n", + "\n", + "F = 5.086*(row*v*u)**0.5/(M_avg*Sc**(2.0/3.0)) \t\t\t# [kmole/square m.s]\n", + "\n", + "\n", + "#RESULT\n", + "\n", + "print\"The required mass transfer coefficient is\",round(F,5),\"kmole/square m.s\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Average molecular weight is 31.5 kg/kmole\n", + "Density of mixture is 1.28 kg/cubic\n", + "Average viscosity of mixture is 1.64e-05 kg/m.s\n", + "\n", + "\n", + "The required mass transfer coefficient is 0.00196 kmole/square m.s\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.8,Page number:120" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "T = 300 \t\t\t\t\t\t# [K]\n", + "l = 3 \t\t\t\t\t\t\t# [length of vertical plate, m]\n", + "b = 1.5 \t\t\t\t\t\t# [width of vertical plate, m]\n", + "P = 101.3 \t\t\t\t\t\t# [kPa]\n", + "v = 5 \t\t\t\t\t\t\t# [velocity across the width of plate, \t\t\t\t\t\t\tm/s]\n", + "row_a = 0.88 \t\t\t\t\t\t# [gram/cubic cm]\n", + "\n", + "\n", + "y_a1 = 0.139 \t\t\t\t\t\t# [mole fraction of benzene at inner \t\t\t\t\t\t\tedge]\n", + "y_a2 = 0 \n", + "\n", + "\t# The film conditions, and average properties, are identical to those in Example 2.7, \tonly the geometry is different\n", + "\t# Therefore\n", + "M_avg = 31.4 \t\t\t\t\t\t# [kg/kmole]\n", + "row = 1.2 \t\t\t\t\t\t# [kg/cubic m]\n", + "u = 161*10**-7 \t\t\t\t\t# [kg/m.s]\n", + "D_ab = 0.0986 \t\t \t\t\t\t# [square cm/s]\n", + "Sc = 1.3 \t\t\t\t\t\t# [Schmidt Number]\n", + "Re = row*v*b/u \t\t\t\t\t# [Renoylds Number]\n", + "\n", + "if Re > 4000:\n", + " print\"The flow across the plate is turbulent\\n\" \n", + "elif Re<2000:\n", + " print\"The flow across the plate is laminar\\n\" \n", + "\t#Using equation 2.57\n", + "Sh_l = 0.036*Re**0.8*Sc**(1.0/3.0) \n", + "\n", + "\t# Nitrogen (component B) does not react with benzene (component A), neither dissolves in \t\tthe liquid therefore, NB = 0 and siA = 1. The F-form of the mass-transfer coefficient \t\t\tshould be used \n", + "F = Sh_l*1.26*D_ab*10**-4/(M_avg*b) \t\t\t# [kmole/square m.s]\n", + "N_a = F*math.log((1-y_a2)/(1-y_a1)) \t\t\t# [kmole/square m.s]\n", + "\n", + "\t# The total mass rate of evaporation over the surface of the plate\n", + "S = 1.5*3 \t\t\t\t\t\t# [square m]\n", + "M_a = 78.1 \t\t\t\t\t\t# [gram/mole]\n", + "wa = N_a*S*M_a*60*1000 \t\t\t\t# [gram/min]\n", + "\n", + "V = wa/row_a \t\t\t\t\t\t# [volumetric flow rate, ml/min]\n", + "\n", + "print\"Liquid benzene should be supplied at the top of the plate at the rate \",round(V),\"ml/min\\nso that evaporation will just prevent it from reaching the bottom of the plate.\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The flow across the plate is turbulent\n", + "\n", + "Liquid benzene should be supplied at the top of the plate at the rate 1473.0 ml/min\n", + "so that evaporation will just prevent it from reaching the bottom of the plate.\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.9,Page number:123" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "dp1 = 10**-3 \t\t\t\t\t# [diameter of spherical drop of water, m]\n", + "Tair = 323 \t\t\t\t\t# [K]\n", + "P = 101.3 \t\t\t\t\t# [kPa]\n", + "Twater = 293 \t\t\t\t\t# [K]\n", + "R = 8.314 \t\t\t\t\t# [cubic m.Pa/mole.K]\n", + "M_a = 18.0 \t\t\t\t\t# [gram/mole]\n", + "M_b = 29.0 \t\t\t\t\t# [gram/mole]\n", + "import math\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "dp2 = (1.0/2.0)**(1.0/3.0)*dp1 \t\t# [m]\n", + "dp = (dp1+dp2)/2 \t\t\t\t# [m]\n", + "\n", + "row_p = 995 \t\t\t\t\t# [density of water, kg/cubic m]\n", + "row1b = 1.094 \t\t\t\t\t# [density of air, kg/cubic m]\n", + "u = 1.95*10**-5 \t\t\t\t# [kg/m.s]\n", + "row_pr = row_p-row1b \t\t\t\t# [kg/cubic m]\n", + "g = 9.8 \t\t\t\t\t# [accleration due to gravity, square m/s]\n", + "\t# Combining equation 2.68 and 2.69\n", + "Ga = 4*dp**3*row1b*row_pr*g/(3*u**2) \t\t# [Galileo Number]\n", + "\n", + "\t# Relationship between Re and Cd\n", + "\t# Re/Cd = Re**3/Ga = 3*row**2*vt**3/(4*g*u*row_pr)\n", + "\n", + "\t# The following correlation is used to relate Re/Cd, to Ga\n", + "\t# ln(Re/Cd)**(1/3) = -3.194 + 2.153*ln(Ga)**(1/3) - 0.238*(ln(Ga)**(1/3))**2 + \t0.01068*(ln(Ga)**(1/3))**3\n", + "\t# Therefore let A = (Re/Cd)\n", + "A = math.exp(-3.194 + 2.153*math.log(Ga**(1.0/3.0)) - 0.238*(math.log(Ga**(1.0/3.0)))**2 + 0.01068*(math.log(Ga**(1.0/3.0)))**3) \n", + "\n", + "\t# Therefore 'vt' will be\n", + "vt = A*(4*g*row_pr*u/(3*row1b**2))**(1.0/3.0) \t# [Terminal velocity of particle, m/s]\n", + "\n", + "#Result\n", + "\n", + "print\"Terminal velocity of particle is\",round(vt,2),\"m/s\" \n", + "\n", + "\n", + "#Calculation\n", + "\n", + "P_w = 2.34 \t\t\t\t\t# [vapor pressure of water, kPa]\n", + "y_w = P_w/P \t\t\t\t\t# [mole fraction of water at the inner edge of \t\t\t\t\t\tthe gas film]\n", + "M_avg = 18*y_w+29*(1-y_w) \t\t\t# [gram/mole]\n", + "\n", + "row2b = P*M_avg/(R*Twater) \t\t\t# [kg/cubic.m]\n", + "delta_row = row2b - row1b \t\t\t# [kg/cubic.m]\n", + "\n", + "Tavg = (Tair+Twater)/2 \t\t\t# [K]\n", + "\t\t# At Temperature equal to Tavg density and viscosity are\n", + "row3 = 1.14 \t\t\t\t\t# [kg/cubic.m]\n", + "u1 = 1.92*10**-5 \t\t\t\t# [kg/m.s]\n", + "\n", + "Grd = g*row3*delta_row*(dp**3)/(u1**2) \n", + "\n", + "\t\t# Diffusivity of water at Tavg and 1 atm is\n", + "D_ab = 0.242*10**-4 \t\t\t\t# [square m/s]\n", + "Sc = u1/(row3*D_ab) \t\t\t\t# [Schmidt Number]\n", + "Re = dp*row3*vt/u1 \t\t\t\t# [Renoylds Number]\n", + "\t\n", + "\t# From equation 2.65 Re is greater than 0.4*Grd**0.5*Sc**(-1/6)\n", + "\t# Therfore equation 2.64 can be used to calculate mass transfer coefficient\n", + "\n", + "Sh = 2+0.552*(Re**0.5)*Sc**(1.0/3.0) \t\t# [Sherwood Number]\n", + "\t# From Table 2.1\n", + "\t# Sh = kc*P_bm*dp/(P*D_ab), since P_bm is almost equal to P\n", + "\t# Therefore \n", + "\t# Sh = kc*dp/D_ab \n", + "kc = Sh*D_ab/dp \t\t\t\t# [m/s]\n", + "\n", + "ca2 = 0 \t\t\t\t\t# [dry air concentration]\n", + "ca1 = P_w/(R*Twater) \t\t\t\t# [interface concentration, kmole/cubic.m]\n", + "\t# Average rate of evaporation \n", + "wa = math.pi*dp**2*M_a*kc*(ca1-ca2)*1000 \t# [g/s]\n", + "\n", + "\t# Amount of water evaporated\n", + "m = row_p*math.pi*dp1**3/12*1000 \t\t# [g]\n", + "\t# Time necessary to reduce the volume by 50%\n", + "t = m/wa \t\t\t\t\t# [s]\n", + "\n", + "D = t*vt \t\t\t\t\t# [distance of fall, m]\n", + "\n", + "#Result\n", + "\n", + "print\"The distance of fall is\",round(D),\"m\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Terminal velocity of particle is 3.59 m/s\n", + "The distance of fall is 90.0 m\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.10,Page number:127" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Re = 1223 \t\t\t\t# [Renoylds Number]\n", + "Sc = 0.905 \t\t\t\t# [Schmidt Number]\n", + "c = 0.039 \t\t\t\t# [molar density, kg/cubic m]\n", + "v = 1 \t\t\t\t\t# [gas velocity, m/s]\n", + "\t# Therefore \n", + "#Calculations\n", + "\n", + "Gm = c*v \t\t\t\t# [kmole/square m.s]\n", + "\t# From equation 2.9 \n", + "\t# Kg*P = ky\n", + "\t# Therefore substituting in equation 2.73 we obtain\n", + "ky = 0.281*Gm/(Re**0.4*Sc**0.56) \t# [kmole/square m.s]\n", + "\t# Now equation 2.73 were obtained under very dilute concentrations\n", + "\t# Therefore\n", + "y_bm = 1 \n", + "\t# From equation 2.6\n", + "F = ky*y_bm \t\t\t\t# [kmole/square m.s]\n", + "\n", + "#Result\n", + "\n", + "print\"Mass transfer coefficient is \",round(F,6),\"kmol/m.^2-s\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass transfer coefficient is 0.000675 kmol/m.^2-s\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.11,Page number:129" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "D = 25.4*10**-3 \t\t\t\t# [diameter of wetted wall tower, m]\n", + "Gy = 10 \t\t\t\t\t# [mass velocity, kg/square m.s]\n", + "T1 = 308 \t\t\t\t\t# [K]\n", + "P = 101.3 \t\t\t\t\t# [kPa]\n", + "p_a1 = 1.95 \t\t\t\t\t# [partial pressure of water vapor, kPa]\n", + "R = 8.314 \t\t\t\t\t# [cubic m.Pa/mole.K]\n", + "M_a = 18 \t\t\t\t\t# [gram/mole]\n", + "Cpa = 1.88 \t\t\t\t\t# [kJ/kg.K]\n", + "\n", + "\n", + "# Properties of dry air at 308 K and 1 atm pressure are\n", + "u = 1.92*10**-5 \t\t\t\t# [kg/m.s]\n", + "row = 1.14 \t\t\t\t\t# [kg/cubic m]\n", + "D_ab = 0.242*10**-4 \t\t\t\t# [square m/s]\n", + "Sc = 0.696 \t\t\t\t\t# [Schmidt number]\n", + "Cp = 1.007 \t\t\t\t\t# [kJ/kg.K]\n", + "k = 0.027 \t\t\t\t\t# [W/m.K]\n", + "Pr = 0.7 \t\t\t\t\t# [Prandtl number]\n", + "\n", + "\n", + "#Calculations\n", + "\n", + "import math\n", + "from scipy.optimize import fsolve\n", + "from numpy import *\n", + "\n", + "Re = D*Gy/u \t\t\t\t\t# [Renoylds number]\n", + "# From equation 2,74\n", + "Sh = 0.023*Re**0.83*Sc**0.44 \t\t\t#[Sherwood number]\n", + "# From Table 2.1\n", + "kg = Sh*D_ab/(R*T1*D)*1000 \t\t\t# [mole/square m.s.kPa]\n", + "\n", + "# To estimate the heat-transfer coefficient, we use the Dittus-Boelter equation for cooling, equation 2.80\n", + "Nu = 0.023*Re**0.8*Pr**0.3 \t\t\t# [Nusselt number]\n", + "# From Table 2.1\n", + "h = Nu*k/D \t\t\t\t\t# [W/square m.K]\n", + "\n", + "T =373.15 \t\t\t\t\t# [K]\n", + "lambda_a = 40.63 \t\t\t\t# [kJ/mole]\n", + "Tc = 647.1 \t\t\t\t\t# [K]\n", + "\n", + "# Solution of simultaneous equation 2.78 and 2.79\n", + "def F(e): \n", + " f1=kg*(p_a1 - math.exp(16.3872-(3885.7/(e[0]-42.98))))-e[1] \n", + " f2=e[1]*M_a*Cpa*(T1-e[0])/(1-exp(-e[1]*M_a*Cpa/h)) + 1000*e[1]*lambda_a*((1-(e[0]/Tc))/(1-(T/Tc)))**0.38 \n", + " return(f1,f2) \n", + "\n", + "\n", + "# Initial guess\n", + "e = [292,-0.003] \n", + "y = fsolve(F,e) \n", + "Ti = y[0] \n", + "Na = y[1] \n", + "\n", + "print\"The temperature of the liquid water and the rate of water evaporation is\",round(Ti),\"K and\",round(Na,3),\" mole/square m.s respectively\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The temperature of the liquid water and the rate of water evaporation is 295.0 K and -0.013 mole/square m.s respectively\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.12,Page number:131" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "D = 25.4*10**-3 \t\t\t# [Internal diameter of tower, m]\n", + "Z = 1.5 \t\t\t\t# [length of the wetted section, m]\n", + "Gy = 10 \t\t\t\t# [mass velocity of air, kg/square m.s]\n", + "Tair = 308 \t\t\t\t# [K]\n", + "Twater = 295 \t\t\t\t# [K]\n", + "P = 101.3 \t\t\t\t# [kPa]\n", + "M_a = 18.0 \t\t\t\t# [gram/mole]\n", + "M_b = 29.0 \t\t\t\t# [gram/mole]\n", + "R = 8.314 \t\t\t\t# [cubic m.Pa/mole.K]\n", + "\n", + "#Calculations\n", + "\n", + "import math\n", + "\n", + "Pa = 2.64 # [kPa]\n", + "\n", + "Gm = Gy/M_b \t# [Assuming that gas phase is basically dry air, kmole/square m.s]\n", + "\t\t# The properties of dry air at 308 K and 1 atm are (from example 2.9)\n", + "row = 1.14 \t\t\t\t# [kg/cubic m]\n", + "u = 1.92*10**-5 \t\t\t# [kg/m.s]\n", + "D_ab = 0.242*10**-4 \t\t\t# [square m/s]\n", + "Sc = 0.692 \t\t\t\t# [Schmidt number]\n", + "\n", + "Re = Gy*D/u \t\t\t\t# [Renoylds number]\n", + "\n", + "if Re<35000 and Re>2000:\n", + " Sh = 0.023*Re**0.83*Sc**0.44 \t# [Sherwood number] \n", + " print\"Sherwood number is\",round(Sh,1) \n", + "else:\n", + " print\"We cannot use equation 2.74\"\n", + "\n", + "c = P/(R*Tair) \t\t\t# [kmole/cubic m]\n", + "\t# Now using equation 2.89\n", + "Pa_out = Pa*(1-math.exp((-4*Sh*Z*c*D_ab)/(Gm*D**2))) \t\t# [kPa]\n", + "\n", + "#Result\n", + "print\"The partial pressure of water in the air leaving the tower is\",round(Pa_out,2),\"kPa\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sherwood number is 51.6\n", + "The partial pressure of water in the air leaving the tower is 1.94 kPa\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.13,Page number:134" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Gy = 10.0 \t\t\t\t# [kg/square m.s]\n", + "dp = 3.5*10**-3 \t\t\t# [diameter of spherical glass beads, m]\n", + "D = 25.4*10**-3 \t\t\t# [Internal diameter of tower, m]\n", + "Tair = 308 \t\t\t\t# [K]\n", + "Twater = 295 \t\t\t\t# [K]\n", + "P = 101.3 \t\t\t\t# [kPa]\n", + "M_a = 18 \t\t\t\t# [gram/mole]\n", + "M_b = 29 \t\t\t\t# [gram/mole]\n", + "R = 8.314 \t\t\t\t# [cubic m.Pa/mole.K]\n", + "\n", + "#Calculation\n", + "\n", + "import math\n", + "from scipy.optimize import fsolve\n", + "\t# The properties of dry air at 308 K and 1 atm are (from example 2.12)\n", + "row = 1.14 \t\t\t\t# [kg/cubic m]\n", + "u = 1.92*10**-5 \t\t\t# [kg/m.s]\n", + "D_ab = 0.242*10**-4 \t\t\t# [square m/s]\n", + "Sc = 0.692 \t\t\t\t# [Schmidt number]\n", + "c = 0.04 \t \t\t\t# [mole/cubic m]\n", + "Gm = 0.345 \t\t\t\t# [kmole/square m.s]\n", + "\n", + "Re = Gy*dp/u \t\t\t\t# [Renoylds number]\n", + "if Re<2500 and Re>10:\n", + " \t\t\t\t\t# Subsituting in equation 2.90\n", + " jd = 1.17*Re**-0.415 \n", + " print\"Renoylds number is \",Re\n", + "else:\n", + " print \" \"\n", + "Std = 0.052/(Sc**(2.0/3.0)) \n", + "\t\t# From Table 2.1 \n", + "Sh = Std*Re*Sc \t\t\t# [Sherwood number]\n", + "\t\t# From equation 2.94\n", + "e = 0.406+0.571*(dp/D) \t\t# [bed porosity]\n", + "e=round(e,3)\n", + "\t#Illustration 2.13(a) \n", + "\t# Solution(a)\n", + "\t# Now Paout = 0.99*Pa\n", + "\t# Using equation 2.93 to calculate 'Z'\n", + "def f12(Z):\n", + " return(0.99 - 1 + math.exp(-6*(1-e)*Sh*c*Z*D_ab/(Gm*dp**2))) \n", + "Z = fsolve(f12,0.06) \n", + "\n", + "#Result\n", + "Z=round(Z[0],3)\n", + "print\"The depth of packing required is\",Z,\"m=\",Z*100,\"cm\" \n", + "\n", + "\t#Illustration 2.13(b)\n", + "\t# Solution(b)\n", + "\t# From equation 2.95\n", + "deltaP = (150*(1-e)/Re + 1.75)*((1-e)*(Gy**2)*Z)/(dp*row*e**3) \t# [Pa]\n", + "\n", + "#Result\n", + "print\"The gas pressure drop through the bed is\",round(deltaP),\"Pa (Approx) \\nDUE TO LACK OF PRECISION IN CALCULATION IN BOOK.\\niF DONE MANUALLY,THIS ANSWER STANDS CORRECT\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Renoylds number is 1822.91666667\n", + "The depth of packing required is 0.078 m= 7.8 cm\n", + "The gas pressure drop through the bed is 15817.0 Pa (Approx) \n", + "DUE TO LACK OF PRECISION IN CALCULATION IN BOOK.\n", + "iF DONE MANUALLY,THIS ANSWER STANDS CORRECT\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.14,Page number:138" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "m = 40000.0 \t\t\t\t\t# [kg/hr]\n", + "Twater = 298 \t\t\t\t\t# [K]\n", + "v = 0.1 \t\t\t\t\t# [superficial velocity, m/s]\n", + "P = 101.3 \t\t\t\t\t# [kPa]\n", + "V = 40*10**-3 \t\t\t\t\t# [Flow rate of nitrogen, cubic m/min]\n", + "d = 2.90*10**-4 \t\t\t\t# [Outside diameter of fibres, m]\n", + "pf = 0.4 \t\t\t\t\t# [Packing factor]\n", + "a = 46.84*100 \t\t\t\t\t# [surface area per unit volume, m**-1]\n", + "R = 8.314 \t\t\t\t\t# [cubic m.Pa/mole.K]\n", + "\n", + "#Calculation\n", + "\n", + "import math\n", + "\n", + "dw = 1000 \t\t\t\t\t# [density of water, kg/cubic m]\n", + "Ql = m/(3600*1000) \t\t\t\t# [volumetric water flow rate, cubic m/s]\n", + "\t# Shell diameter\n", + "D = (4*Ql/(math.pi*v))**0.5 \t\t\t# [Shell diameter, m]\n", + "\n", + "\t# the properties of dilute mixtures of oxygen in water at 298 K\n", + "u = 0.9 \t\t\t\t\t# [cP]\n", + "\t# Diffusivity from equation 1.53\n", + "D_ab = 1.93*10**-9 \t\t\t\t# [square m/s]\n", + "Sc = 467 \t\t\t\t\t# [Schmidt number]\n", + "\n", + "Re = d*v*dw/(u*10**-3) \t\t\t# [Renoylds number]\n", + "\n", + "\t# Substituting in equation (2-97) gives\n", + "Sh = 0.53*(1-1.1*pf)*((1-pf)/pf)**-0.47*(Re**0.53*Sc**0.33) \n", + "\n", + "kl = Sh*D_ab/d \t\t\t\t# [mass-transfer coefficient on the shell side, \t\t\t\t\t\tm/s]\n", + "\n", + "\t# From the specified BFW flow rate\n", + "L = m/(3600*18) \t\t\t\t# [kmole/s]\n", + "\t# From ideal gas law\n", + "V1 = V*P/(Twater*R*60) \t\t\t# [kmole/s]\n", + "\t# From the solubility of oxygen in water at 298 K,\n", + "M = 4.5*10**4 \n", + "A = L/(M*V1) \t\t\t\t\t# [Absorption factor]\n", + "\n", + "#Result\n", + "\n", + "print\"Absorption factor is\",round(A,3) \n", + "\n", + "#Calculation\n", + "\n", + "\t# For 99% removal of the dissolved oxygen\n", + "\t# x_in/x_out = b = 100\n", + "b = 100 \n", + "c = 55.5 \t\t\t\t\t# [molar density, kmole/cubic m]\n", + "\t# Substituting in equation 2.99 yields\n", + "V_T = (L*math.log(b*(1-A)+A))/(kl*a*c*(1-A)) \t # [cubic m]\n", + "\n", + "\t# The module length, Z is\n", + "Z = V_T/(math.pi*D**2.0/4.0) \n", + "\n", + "#Result\n", + "print\"The shell diameter and module length is\",round(D,3),\"m and\",round(Z,2),\" m respectively\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Absorption factor is 0.503\n", + "The shell diameter and module length is 0.376 m and 2.15 m respectively\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.15,Page number:140" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "d=2.21/100\t\t\t#[m]\n", + "mu=8.82*10**-6\t\t#[kg/m-s]\n", + "rho=2.81\t\t#[kg/m**3]\n", + "\n", + "c=34.14\t\t\t#[mol/m**3]\n", + "D=array([2.228/(10**6),2.065/(10**6),1.832/(10**6)]) #Velocities in [m**2/s]\n", + "\n", + "\n", + "#Calculation\n", + "#Gy=rho*v\t\t\n", + "#Re=Gy*d/mu\t\t#Reynolds number\n", + "Re=21750\n", + "print \"Reynolds number=\",Re\n", + "Sc=[]\n", + "Sh=[]\n", + "F=[]\n", + "for i in range(0, 3):\n", + " sc=mu/(rho*D[i]) #Schmidt number\n", + " Sc.append(sc)\n", + " sh=0.023*Re**(0.83)*sc**(0.44) #Sherwood number\n", + " Sh.append(sh)\n", + " f=sh*c*D[i]/d #Binary mass transfer coefficient in [mol/m^2-s]\n", + " F.append(f)\n", + "print \"Schmidt number are:\"\n", + "for i in range(0,3):\n", + " print round(Sc[i],3)\n", + "print \"Sherwood number number are:\"\n", + "for i in range(0,3):\n", + " print round(Sh[i],1)\n", + "print\"Binary mass transfer coefficients are:\"\n", + "for i in range(0,3):\n", + " print round(F[i],3)\n", + "#After modifying mathcad program of example 1.17,we have\n", + "N1=-0.0527 #[mol/m^2-s]\n", + "N2=0.0395 #[mol/m^2-s]\n", + "N3=0.0132 #[mol/m^2-s]\n", + "print\"The program yields the following results:\"\n", + "print \"N1=\",N1,\"mol/m**2-s\"\n", + "print \"N2=\",N2,\"mol/m**2-s\"\n", + "print \"N3=\",N3,\"mol/m**2-s\"\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Reynolds number= 21750\n", + "Schmidt number are:\n", + "1.409\n", + "1.52\n", + "1.713\n", + "Sherwood number number are:\n", + "106.5\n", + "110.1\n", + "116.1\n", + "Binary mass transfer coefficients are:\n", + "0.367\n", + "0.351\n", + "0.328\n", + "The program yields the following results:\n", + "N1= -0.0527 mol/m**2-s\n", + "N2= 0.0395 mol/m**2-s\n", + "N3= 0.0132 mol/m**2-s\n" + ] + } + ], + "prompt_number": 36 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Practical_C_Programming/.ipynb_checkpoints/Chapter_3_4-checkpoint.ipynb b/Practical_C_Programming/.ipynb_checkpoints/Chapter_3_4-checkpoint.ipynb new file mode 100644 index 00000000..a8e0779c --- /dev/null +++ b/Practical_C_Programming/.ipynb_checkpoints/Chapter_3_4-checkpoint.ipynb @@ -0,0 +1,53 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:ebedd6f3bf7c0762de88b2ec9ed84eecba39a72a5c5924ff89534f9517007ca4" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 3: Style" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.1, Page number: 57" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "print ('Hello World')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Hello World\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Practical_C_Programming/.ipynb_checkpoints/Chapter_4_4-checkpoint.ipynb b/Practical_C_Programming/.ipynb_checkpoints/Chapter_4_4-checkpoint.ipynb new file mode 100644 index 00000000..8602f989 --- /dev/null +++ b/Practical_C_Programming/.ipynb_checkpoints/Chapter_4_4-checkpoint.ipynb @@ -0,0 +1,258 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:785237ffc865ddc47952e10309b1bb53ee1543217e833069c02c2afb50bff287" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 4: Basic declarations and expressions" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.1, Page number: 71" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "x = (1 + 2) * 4\n", + "\n", + "# Result\n", + "print ('1 plus 2 multiplied by 4 gives %d' % x)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1 plus 2 multiplied by 4 gives 12\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.2, Page number: 75" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "term = 3 * 5\n", + "term_2 = 2 * term\n", + "term_3 = 3 * term\n", + "\n", + "# Result\n", + "print ('Twice %d is %d' % (term, term_2))\n", + "print ('Three times %d is %d' % (term, term_3))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Twice 15 is 30\n", + "Three times 15 is 45\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.3, Page number: 77" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variable declaration\n", + "term = 3 * 5\n", + "term_2 = 2 * term\n", + "term_3 = 3 * term\n", + "\n", + "# Result\n", + "print ('Twice %d is %d' % (term, term_2))\n", + "print ('Three times %d is %d' % (term, term_3))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Twice 15 is 30\n", + "Three times 15 is 45\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.4, Page number: 79" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "answer = 1/3\n", + "\n", + "# Result\n", + "print ('The value of 1/3 is %f' % answer)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of 1/3 is 0.000000\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.5, Page number: 80" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "answer = 2 + 2\n", + "\n", + "# Result\n", + "print ('The answer is %d' % answer)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The answer is 4\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.6, Page number: 80" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variable declaration\n", + "result = 7.0/22.0\n", + "\n", + "# Result\n", + "print ('The result is %d' % result)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The result is 0\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.7, Page number: 82" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "char1 = 'A'\n", + "char2 = 'B'\n", + "char3 = 'C'\n", + "\n", + "# Result\n", + "print ('%c%c%c reversed is %c%c%c' % (char1, char2, char3, char3, char2, char1))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "ABC reversed is CBA\n" + ] + } + ], + "prompt_number": 7 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Practical_C_Programming/.ipynb_checkpoints/Chapter_5_4-checkpoint.ipynb b/Practical_C_Programming/.ipynb_checkpoints/Chapter_5_4-checkpoint.ipynb new file mode 100644 index 00000000..2d2abf16 --- /dev/null +++ b/Practical_C_Programming/.ipynb_checkpoints/Chapter_5_4-checkpoint.ipynb @@ -0,0 +1,404 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:8925a816cb9ea05a6a48e6ec88b1e1778772a9e1e429803a5c922fb000f7f30d" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 5: Arrays, qualifiers, and reading numbers" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.1, Page number: 84" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "data = [ 34.0, 27.0, 45.0, 82.0, 22.0 ]\n", + "\n", + "# Calculation\n", + "total = data[0] + data[1] + data[2] + data[3] + data[4]\n", + "average = total/5.0\n", + "\n", + "# Result\n", + "print ('Total %f Average %f' % (total, average))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total 210.000000 Average 42.000000\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.2, Page number: 87" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variable declaration\n", + "name = 'Sam'\n", + "\n", + "# Result\n", + "print ('The name is %s' % name)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The name is Sam\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.3, Page number: 88" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variable declaration\n", + "first = 'Steve'\n", + "last = 'Oualline'\n", + "\n", + "# Calculation\n", + "full_name = first + ' ' + last\n", + "\n", + "# Result\n", + "print ('The full name is %s' % full_name)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The full name is Steve Oualline\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.4, Page number: 89" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "line = 'hello world'\n", + "\n", + "# Result\n", + "print ('The length of the line is %d' % len(line))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The length of the line is 11\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.5, Page number: 90" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variable declaration\n", + "first = 'Steve'\n", + "last = 'Oualline'\n", + "\n", + "# Calculation\n", + "full = first + ' ' + last\n", + "\n", + "# Result\n", + "print ('The name is %s' % full)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The name is Steve Oualline\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.6, Page number: 91" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "first = 'Steve'\n", + "last = 'Oualline'\n", + "\n", + "# Calculation\n", + "full = first + ' ' + last\n", + "\n", + "# Result\n", + "print ('The name is %s' % full)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The name is Steve Oualline\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.7, Page number: 93" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variable declaration\n", + "array = [[0 for x in range(5)] for x in range(5)]\n", + "array[0][0] = 0 * 10 + 0\n", + "array[0][1] = 0 * 10 + 1\n", + "array[1][0] = 1 * 10 + 0\n", + "array[1][1] = 1 * 10 + 1\n", + "array[2][0] = 2 * 10 + 0\n", + "array[2][1] = 2 * 10 + 1\n", + "\n", + "# Result\n", + "print ('array[0]')\n", + "print (array[0][0])\n", + "print (array[0][1])\n", + "print ('\\n')\n", + "\n", + "print ('array[1]')\n", + "print (array[1][0])\n", + "print (array[1][1])\n", + "print ('\\n')\n", + "\n", + "print ('array[2]')\n", + "print (array[2][0])\n", + "print (array[2][1])\n", + "print ('\\n')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "array[0]\n", + "0\n", + "1\n", + "\n", + "\n", + "array[1]\n", + "10\n", + "11\n", + "\n", + "\n", + "array[2]\n", + "20\n", + "21\n", + "\n", + "\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.8, Page number: 94" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "line = 4\n", + "\n", + "# Result\n", + "print ('Twice %d is %d' % (line, line * 2))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Twice 4 is 8\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.9, Page number: 95" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "width = 12\n", + "height = 10\n", + "\n", + "# Calculation\n", + "area = (width * height) / 2\n", + "\n", + "# Result\n", + "print ('The area is %d' % area)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The area is 60\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.10, Page number: 107" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "width = 4\n", + "height = 6\n", + "\n", + "# Calculation\n", + "area = (width * height) / 2\n", + "\n", + "# Result\n", + "print ('The area is %d' % area)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The area is 12\n" + ] + } + ], + "prompt_number": 13 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Practical_C_Programming/.ipynb_checkpoints/Chapter_6_4-checkpoint.ipynb b/Practical_C_Programming/.ipynb_checkpoints/Chapter_6_4-checkpoint.ipynb new file mode 100644 index 00000000..2769b901 --- /dev/null +++ b/Practical_C_Programming/.ipynb_checkpoints/Chapter_6_4-checkpoint.ipynb @@ -0,0 +1,224 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:72c49f1aed7f4d43ac1084e67245cfba7b011cb43f84b1ab3ef13b081aec557f" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 6: Decision and control statements" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.1, Page number: 114" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "old_number = 1\n", + "current_number = 1\n", + "\n", + "print ('1')\n", + "\n", + "# Calculation and result\n", + "while (current_number < 100) :\n", + " print (current_number)\n", + " next_number = current_number + old_number\n", + "\n", + " old_number = current_number\n", + " current_number = next_number" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n", + "1\n", + "2\n", + "3\n", + "5\n", + "8\n", + "13\n", + "21\n", + "34\n", + "55\n", + "89\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.2, Page number: 115" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "total = 0\n", + "i = 0\n", + "\n", + "# Calculation\n", + "while (i < 10) :\n", + " item = 1\n", + "\n", + " if item == 0 :\n", + " break\n", + "\n", + " total += item\n", + " print ('Total: %d' % total)\n", + " i = i + 1\n", + " \n", + "# Result\n", + "print ('Final total: %d' % total)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total: 1\n", + "Total: 2\n", + "Total: 3\n", + "Total: 4\n", + "Total: 5\n", + "Total: 6\n", + "Total: 7\n", + "Total: 8\n", + "Total: 9\n", + "Total: 10\n", + "Final total: 10\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.3, Page number: 116" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "total = 0\n", + "minus_items = 0\n", + "i = 0\n", + "\n", + "# Calculation\n", + "while (i < 10) :\n", + " item = 1\n", + " \n", + " if item == 0 :\n", + " break\n", + "\n", + " if item < 0 :\n", + " minus_items += 1\n", + " continue\n", + "\n", + " total += item\n", + " print ('Total: %d' % total)\n", + " i = i + 1\n", + " \n", + "# Result\n", + "print ('Final total: %d' % total)\n", + "print ('with %d negative items omitted' % minus_items)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total: 1\n", + "Total: 2\n", + "Total: 3\n", + "Total: 4\n", + "Total: 5\n", + "Total: 6\n", + "Total: 7\n", + "Total: 8\n", + "Total: 9\n", + "Total: 10\n", + "Final total: 10\n", + "with 0 negative items omitted\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.4, Page number: 118" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variable declaration\n", + "balance_owed = 100\n", + "\n", + "# Calculation and result\n", + "if balance_owed == 0 :\n", + " print ('You owe nothing.')\n", + "else :\n", + " print ('You owe %d dollars.' % balance_owed)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "You owe 100 dollars.\n" + ] + } + ], + "prompt_number": 3 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Practical_C_Programming/.ipynb_checkpoints/Chapter_7_4-checkpoint.ipynb b/Practical_C_Programming/.ipynb_checkpoints/Chapter_7_4-checkpoint.ipynb new file mode 100644 index 00000000..620d440f --- /dev/null +++ b/Practical_C_Programming/.ipynb_checkpoints/Chapter_7_4-checkpoint.ipynb @@ -0,0 +1,184 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:2555ca3a1b68efa7cc762303e679c4f4dbb6d27bc5633d2ac8b64fe540cb2399" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 7: Programming process" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.1, Page number: 126" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variable declaration\n", + "result = 0\n", + "i = 0\n", + "\n", + "# Calculation and result\n", + "while (i < 3) :\n", + " print ('Result: %d' % result)\n", + " operator = '+'\n", + " value = 10\n", + "\n", + " if operator == '+' :\n", + " result += value\n", + " else :\n", + " print ('Unknown operator %c' % operator)\n", + " i = i + 1 " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Result: 0\n", + "Result: 10\n", + "Result: 20\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.2, Page number: 133" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "result = 0\n", + "i = 0\n", + "\n", + "# Calculation and result\n", + "while (i < 3) :\n", + " print ('Result: %d' % result)\n", + " operator = '+'\n", + " value = 5\n", + "\n", + " if operator == 'q' or operator == 'Q' :\n", + " break\n", + "\n", + " if operator == '+' :\n", + " result += value\n", + "\n", + " if operator == '-' :\n", + " result -= value\n", + "\n", + " if operator == '*' :\n", + " result *= value\n", + "\n", + " if operator == '/' :\n", + " if value == 0 :\n", + " print ('Error: Divide by zero')\n", + " print ('operation ignored') \n", + " else :\n", + " result /= value\n", + "\n", + " i = i + 1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Result: 0\n", + "Result: 5\n", + "Result: 10\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.3, Page number: 140" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import sys\n", + "import random\n", + "while (1) :\n", + "\n", + " # random number to be guessed\n", + " number_to_guess = random.randrange (1, 101, 1)\n", + "\n", + " # current lower limit of player's range\n", + " low_limit = 0\n", + "\n", + " # current upper limit of player's range\n", + " high_limit = 100\n", + " \n", + " # number of times player guessed\n", + " guess_count = 0\n", + "\n", + " while (1) :\n", + " \n", + " # tell user what the bounds are and get his guess\n", + " print ('Bounds %d - %d\\n' % (low_limit, high_limit))\n", + " print ('Value[%d]?' % guess_count)\n", + " \n", + " guess_count += 1\n", + "\n", + " # number gotten from the player\n", + " player_number = 50\n", + "\n", + " # did he guess right?\n", + " if (player_number == number_to_guess) :\n", + " break\n", + "\n", + " # adjust bounds for next guess\n", + " if (player_number < number_to_guess) :\n", + " low_limit = player_number\n", + " \n", + " else :\n", + " high_limit = player_number\n", + "\n", + " print ('Bingo\\n')" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Practical_C_Programming/.ipynb_checkpoints/Chapter_8_4-checkpoint.ipynb b/Practical_C_Programming/.ipynb_checkpoints/Chapter_8_4-checkpoint.ipynb new file mode 100644 index 00000000..24580c55 --- /dev/null +++ b/Practical_C_Programming/.ipynb_checkpoints/Chapter_8_4-checkpoint.ipynb @@ -0,0 +1,349 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:10a432341f6033fcf678cc580d953b0c94ad7350aa1431ba3e0517904d3e90c8" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 8: More control statements" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.1, Page number: 144" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variable declaration\n", + "total = 0\n", + "counter = 0\n", + "\n", + "# Calculation\n", + "while (counter < 5) :\n", + " current = 3\n", + " total += current\n", + " counter += 1\n", + "\n", + "# Result\n", + "print ('The grand total is %d' % total)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The grand total is 15\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.2, Page number: 145" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "total = 0\n", + "\n", + "# Calculation\n", + "for counter in range (0, 5) :\n", + " current = 5\n", + " total += current\n", + "\n", + "# Result\n", + "print ('The grand total is %d' % total)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The grand total is 25\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.3, Page number: 146" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variable declaration, calculation and result\n", + "for celsius in range (0, 101) :\n", + " print ('Celsius: %d Fahrenheit: %d' % (celsius, (celsius * 9) / 5 +32))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Celsius: 0 Fahrenheit: 32\n", + "Celsius: 1 Fahrenheit: 33\n", + "Celsius: 2 Fahrenheit: 35\n", + "Celsius: 3 Fahrenheit: 37\n", + "Celsius: 4 Fahrenheit: 39\n", + "Celsius: 5 Fahrenheit: 41\n", + "Celsius: 6 Fahrenheit: 42\n", + "Celsius: 7 Fahrenheit: 44\n", + "Celsius: 8 Fahrenheit: 46\n", + "Celsius: 9 Fahrenheit: 48\n", + "Celsius: 10 Fahrenheit: 50\n", + "Celsius: 11 Fahrenheit: 51\n", + "Celsius: 12 Fahrenheit: 53\n", + "Celsius: 13 Fahrenheit: 55\n", + "Celsius: 14 Fahrenheit: 57\n", + "Celsius: 15 Fahrenheit: 59\n", + "Celsius: 16 Fahrenheit: 60\n", + "Celsius: 17 Fahrenheit: 62\n", + "Celsius: 18 Fahrenheit: 64\n", + "Celsius: 19 Fahrenheit: 66\n", + "Celsius: 20 Fahrenheit: 68\n", + "Celsius: 21 Fahrenheit: 69\n", + "Celsius: 22 Fahrenheit: 71\n", + "Celsius: 23 Fahrenheit: 73\n", + "Celsius: 24 Fahrenheit: 75\n", + "Celsius: 25 Fahrenheit: 77\n", + "Celsius: 26 Fahrenheit: 78\n", + "Celsius: 27 Fahrenheit: 80\n", + "Celsius: 28 Fahrenheit: 82\n", + "Celsius: 29 Fahrenheit: 84\n", + "Celsius: 30 Fahrenheit: 86\n", + "Celsius: 31 Fahrenheit: 87\n", + "Celsius: 32 Fahrenheit: 89\n", + "Celsius: 33 Fahrenheit: 91\n", + "Celsius: 34 Fahrenheit: 93\n", + "Celsius: 35 Fahrenheit: 95\n", + "Celsius: 36 Fahrenheit: 96\n", + "Celsius: 37 Fahrenheit: 98\n", + "Celsius: 38 Fahrenheit: 100\n", + "Celsius: 39 Fahrenheit: 102\n", + "Celsius: 40 Fahrenheit: 104\n", + "Celsius: 41 Fahrenheit: 105\n", + "Celsius: 42 Fahrenheit: 107\n", + "Celsius: 43 Fahrenheit: 109\n", + "Celsius: 44 Fahrenheit: 111\n", + "Celsius: 45 Fahrenheit: 113\n", + "Celsius: 46 Fahrenheit: 114\n", + "Celsius: 47 Fahrenheit: 116\n", + "Celsius: 48 Fahrenheit: 118\n", + "Celsius: 49 Fahrenheit: 120\n", + "Celsius: 50 Fahrenheit: 122\n", + "Celsius: 51 Fahrenheit: 123\n", + "Celsius: 52 Fahrenheit: 125\n", + "Celsius: 53 Fahrenheit: 127\n", + "Celsius: 54 Fahrenheit: 129\n", + "Celsius: 55 Fahrenheit: 131\n", + "Celsius: 56 Fahrenheit: 132\n", + "Celsius: 57 Fahrenheit: 134\n", + "Celsius: 58 Fahrenheit: 136\n", + "Celsius: 59 Fahrenheit: 138\n", + "Celsius: 60 Fahrenheit: 140\n", + "Celsius: 61 Fahrenheit: 141\n", + "Celsius: 62 Fahrenheit: 143\n", + "Celsius: 63 Fahrenheit: 145\n", + "Celsius: 64 Fahrenheit: 147\n", + "Celsius: 65 Fahrenheit: 149\n", + "Celsius: 66 Fahrenheit: 150\n", + "Celsius: 67 Fahrenheit: 152\n", + "Celsius: 68 Fahrenheit: 154\n", + "Celsius: 69 Fahrenheit: 156\n", + "Celsius: 70 Fahrenheit: 158\n", + "Celsius: 71 Fahrenheit: 159\n", + "Celsius: 72 Fahrenheit: 161\n", + "Celsius: 73 Fahrenheit: 163\n", + "Celsius: 74 Fahrenheit: 165\n", + "Celsius: 75 Fahrenheit: 167\n", + "Celsius: 76 Fahrenheit: 168\n", + "Celsius: 77 Fahrenheit: 170\n", + "Celsius: 78 Fahrenheit: 172\n", + "Celsius: 79 Fahrenheit: 174\n", + "Celsius: 80 Fahrenheit: 176\n", + "Celsius: 81 Fahrenheit: 177\n", + "Celsius: 82 Fahrenheit: 179\n", + "Celsius: 83 Fahrenheit: 181\n", + "Celsius: 84 Fahrenheit: 183\n", + "Celsius: 85 Fahrenheit: 185\n", + "Celsius: 86 Fahrenheit: 186\n", + "Celsius: 87 Fahrenheit: 188\n", + "Celsius: 88 Fahrenheit: 190\n", + "Celsius: 89 Fahrenheit: 192\n", + "Celsius: 90 Fahrenheit: 194\n", + "Celsius: 91 Fahrenheit: 195\n", + "Celsius: 92 Fahrenheit: 197\n", + "Celsius: 93 Fahrenheit: 199\n", + "Celsius: 94 Fahrenheit: 201\n", + "Celsius: 95 Fahrenheit: 203\n", + "Celsius: 96 Fahrenheit: 204\n", + "Celsius: 97 Fahrenheit: 206\n", + "Celsius: 98 Fahrenheit: 208\n", + "Celsius: 99 Fahrenheit: 210\n", + "Celsius: 100 Fahrenheit: 212\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.4, Page number: 147" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable declaration\n", + "seven_count = 0\n", + "three_count = 0\n", + "data = []\n", + "\n", + "# Calculation\n", + "for i in range (0, 5) :\n", + " x = 7\n", + " data.append(int(x))\n", + "print (data)\n", + "\n", + "for index in range (0, 5) :\n", + " if data[index] == 3 :\n", + " three_count += 1\n", + "\n", + " if data[index] == 7 :\n", + " seven_count += 1\n", + "\n", + "# Result\n", + "print ('Threes %d Sevens %d' % (three_count, seven_count))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[7, 7, 7, 7, 7]\n", + "Threes 0 Sevens 5\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.6, Page number: 149" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variable declaration\n", + "result = 0\n", + "i = 0\n", + "\n", + "# Calculation and result\n", + "while (i < 3) :\n", + " print ('Result: %d' % result)\n", + " operator = '-'\n", + " value = 10\n", + "\n", + " if operator == 'q' or operator == 'Q' :\n", + " break\n", + "\n", + " elif operator == '+' :\n", + " result += value\n", + "\n", + " elif operator == '-' :\n", + " result -= value\n", + "\n", + " elif operator == '*' :\n", + " result *= value\n", + "\n", + " elif operator == '/' :\n", + " if value == 0 :\n", + " print ('Error: Divide by zero')\n", + " print ('operation ignored') \n", + " else :\n", + " result /= value\n", + "\n", + " else :\n", + " print ('Unknown operator %c' % operator)\n", + " i = i + 1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Result: 0\n", + "Result: -10\n", + "Result: -20\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Practical_C_Programming/.ipynb_checkpoints/Chapter_9_4-checkpoint.ipynb b/Practical_C_Programming/.ipynb_checkpoints/Chapter_9_4-checkpoint.ipynb new file mode 100644 index 00000000..39cb7cdd --- /dev/null +++ b/Practical_C_Programming/.ipynb_checkpoints/Chapter_9_4-checkpoint.ipynb @@ -0,0 +1,166 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:9022b72f2fc24432e92fa44cdfeb3da1fa5525a0485bb76b898e97e55f78a4d8" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 9: Variable scope and functions" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.1, Page number: 160" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def func() :\n", + " if not hasattr(func, \"permanent\") :\n", + " func.permanent = 1\n", + " result = func.permanent\n", + " func.permanent += 1\n", + " return result\n", + "\n", + "for counter in range (0, 3) :\n", + " temporary = 1\n", + " print ('Temporary %d Permanent %d' % (temporary, func()))\n", + " temporary += 1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Temporary 1 Permanent 1\n", + "Temporary 1 Permanent 2\n", + "Temporary 1 Permanent 3\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.3, Page number: 164" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def triangle (width, height) :\n", + " area = width * height / 2.0\n", + " return area\n", + "\n", + "print ('Triangle #1 %f' % (triangle (1.3, 8.3)))\n", + "print ('Triangle #2 %f' % (triangle (4.8, 9.8)))\n", + "print ('Triangle #3 %f' % (triangle (1.2, 2.0)))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Triangle #1 5.395000\n", + "Triangle #2 23.520000\n", + "Triangle #3 1.200000\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.4, Page number: 166" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def length (string) :\n", + " return len(string)\n", + "\n", + "line = 'hello world' \n", + "\n", + "print ('Length is: %d' % length(line))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Length is: 11\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.6, Page number: 170" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def length (string) :\n", + " return len(string)\n", + "\n", + "line = 'Steve Oualline'\n", + "\n", + "print ('Length is: %d' % length(line))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Length is: 14\n" + ] + } + ], + "prompt_number": 5 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/.ipynb_checkpoints/Chapter1-checkpoint.ipynb b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/.ipynb_checkpoints/Chapter1-checkpoint.ipynb new file mode 100644 index 00000000..ed34729f --- /dev/null +++ b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/.ipynb_checkpoints/Chapter1-checkpoint.ipynb @@ -0,0 +1,165 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:9283b3273e4b25859b1f947b0b70d061842802ddcf82b087896def4a57fa123c" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 1: Semiconductor Basics

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 1.1(a), Page Number:29

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "V_bias=10.0; #bias voltage in volt\n", + "R_limit=1000; #limiting resistance in ohm\n", + "r_d =10.0; #r_d value\n", + "\n", + "#calculation\n", + "#IDEAL MODEL\n", + "print \"IDEAL MODEL\"\n", + "V_f=0; #voltage in volt\n", + "I_f=V_bias/R_limit; #foward current\n", + "V_R_limit=I_f*R_limit; #limiting voltage\n", + "print \"forward voltage = %.2f volts\" %V_f\n", + "print \"forward current = %.2f amperes\" %I_f\n", + "print \"voltage across limiting resistor = %.2f volts\" %V_R_limit\n", + "\n", + "#PRACTICAL MODEL\n", + "print \"\\nPRACTICAL MODEL\"\n", + "V_f=0.7; #voltage in volt\n", + "I_f=(V_bias-V_f)/R_limit; #foward current\n", + "V_R_limit=I_f*R_limit; #limiting voltage\n", + "print \"forward voltage = %.2f volts\" %V_f\n", + "print \"forward current = %.3f amperes\" %I_f\n", + "print \"voltage across limiting resistor = %.2f volts\" %V_R_limit\n", + "\n", + "#COMPLETE MODEL\n", + "print \"\\nCOMPLETE MODEL\"\n", + "I_f=(V_bias-0.7)/(R_limit+r_d); #foward current\n", + "V_f=0.7+I_f*r_d; #forward voltage\n", + "V_R_limit=I_f*R_limit; #limiting voltage\n", + "print \"forward voltage = %.3f volts\" %V_f\n", + "print \"forward current = %.3f amperes\" %I_f\n", + "print \"voltage across limiting resistor = %.2f volts\" %V_R_limit" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "IDEAL MODEL\n", + "forward voltage = 0.00 volts\n", + "forward current = 0.01 amperes\n", + "voltage across limiting resistor = 10.00 volts\n", + "\n", + "PRACTICAL MODEL\n", + "forward voltage = 0.70 volts\n", + "forward current = 0.009 amperes\n", + "voltage across limiting resistor = 9.30 volts\n", + "\n", + "COMPLETE MODEL\n", + "forward voltage = 0.792 volts\n", + "forward current = 0.009 amperes\n", + "voltage across limiting resistor = 9.21 volts" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 1.1(b), Page Number:29

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# variable declaration\n", + "V_bias=5; #bias voltage in volt\n", + "I_R=1*10**-6; #current\n", + "R_limit=1000 #in Ohm\n", + "\n", + "#calculation\n", + "#IDEAL MODEL\n", + "print \"IDEAL MODEL\"\n", + "I_r=0.0; #current in ampere\n", + "V_R=V_bias; #voltages are equal\n", + "V_R_limit=I_r*R_limit; #limiting voltage\n", + "print \"Reverse voltage across diode = %.2f volts\" %V_R\n", + "print \"Reverse current through diode= %.2f amperes\" %I_r\n", + "print \"voltage across limiting resistor = %.2f volts\" %V_R_limit\n", + "\n", + "#PRACTICAL MODEL\n", + "print \"\\nPRACTICAL MODEL\"\n", + "I_r=0.0; #current in ampere\n", + "V_R=V_bias; #voltages are equal\n", + "V_R_limit=I_r*R_limit; #limiting voltage\n", + "print \"Reverse voltage across diode= %.2f volts\" %V_R\n", + "print \"Reverse current through diode = %.2f amperes\" %I_r\n", + "print \"voltage across limiting resistor = %.2f volts\" %V_R_limit\n", + "\n", + "#COMPLETE MODEL\n", + "print \"\\nCOMPLETE MODEL\"\n", + "I_r=I_R; #current in ampere\n", + "V_R_limit=I_r*R_limit; #limiting voltage\n", + "V_R=V_bias-V_R_limit; #voltage in volt\n", + "print \"Reverse voltage across diode = %.3f volts\" %V_R\n", + "print \"Reverse current through diode = %d micro Amp\" %(I_r*10**6)\n", + "print \"voltage across limiting resistor = %d mV\" %(V_R_limit*1000)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "IDEAL MODEL\n", + "Reverse voltage across diode = 5.00 volts\n", + "Reverse current through diode= 0.00 amperes\n", + "voltage across limiting resistor = 0.00 volts\n", + "\n", + "PRACTICAL MODEL\n", + "Reverse voltage across diode= 5.00 volts\n", + "Reverse current through diode = 0.00 amperes\n", + "voltage across limiting resistor = 0.00 volts\n", + "\n", + "COMPLETE MODEL\n", + "Reverse voltage across diode = 4.999 volts\n", + "Reverse current through diode = 1 micro Amp\n", + "voltage across limiting resistor = 1 mV" + ] + } + ], + "prompt_number": 2 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/.ipynb_checkpoints/Chapter2-checkpoint.ipynb b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/.ipynb_checkpoints/Chapter2-checkpoint.ipynb new file mode 100644 index 00000000..29386b12 --- /dev/null +++ b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/.ipynb_checkpoints/Chapter2-checkpoint.ipynb @@ -0,0 +1,640 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:07300ba6f8a24ba9874afd0fd84b4c250cf3010a844444236cfec215a9ae4d89" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 2: Diode Application

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.1, Page Number: 46

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "%pylab inline" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\n", + "For more information, type 'help(pylab)'." + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "# variable declaration\n", + "V_p=50; #Peak value is 50V\n", + "\n", + "#calculation\n", + "V_avg=V_p/math.pi;\n", + "\n", + "#result\n", + "print \"average value of half wave rectifier = %.2f volts\" %V_avg" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "average value of half wave rectifier = 15.92 volts" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.2(a), Page Number: 46

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "# variable declaration\n", + "#let V_in=5*sin(2*%pi*f.*t) be input wave ,hence frequency=1Hz\n", + "f=1; #frequency\n", + "V_p_in=5; #peak input\n", + "\n", + "#calculation\n", + "V_pout=V_p_in-0.7; #output voltage\n", + "t_d=(math.asin(0.7/V_p_in))/(2*math.pi*f);\n", + "\n", + "#result\n", + "print \"half wave rectifier output = %.2f volts\" %V_pout;" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "half wave rectifier output = 4.30 volts" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.2(b), Page Number: 46

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# variable declaration\n", + "#let V_in=100*sin(2*%pi*f.*t) be input wave ,hence frequency=1Hz\n", + "f=1; #frequency\n", + "T=1/f; #time period\n", + "V_p_in=100; #peak input voltage\n", + "\n", + "#calculation\n", + "V_pout=(V_p_in-0.7); #peak output \n", + "t_d=(math.asin(0.7/V_p_in))/(2*math.pi*f) \n", + "\n", + "#result\n", + "print \"output of half wave rectifier = %.2f volts\" %V_pout" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "output of half wave rectifier = 99.30 volts" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.3, Page Number: 48

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# variable declaration\n", + "V_p_in=156; #Peak input voltage\n", + "V_p_pri=156; #Peak voltage of primary of transformer\n", + "n=0.5; #Turn ratio is 2:1\n", + "\n", + "#calculation\n", + "V_p_sec=n*V_p_pri;\n", + "V_p_out=(V_p_sec-0.7); #Peak output voltage\n", + "\n", + "#result\n", + "print \"peak output voltage of half wave rectifier = %.1f volts\" %V_p_out" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "peak output voltage of half wave rectifier = 77.3 volts" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.4, Page Number: 49

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "# variable declaration\n", + "V_p=15; #Peak voltage in volt\n", + "\n", + "#calculation\n", + "V_avg=(2*V_p)/math.pi;\n", + "\n", + "#result\n", + "print \"Average value of output of full wave rectifier = %.2f volts\" %V_avg" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Average value of output of full wave rectifier = 9.55 volts" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.5, Page Number: 52

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "V_p_pri=100.0; #Peak voltage across primary winding\n", + "n=1.0/2; #tun ratio is 2:1\n", + "V_p_sec=n*V_p_pri;\n", + "V_sec=V_p_sec/2; #voltage across each secondary is half the total voltage\n", + "V_pout=V_sec-0.7;\n", + "\n", + "print('full wave rectifier output voltage = %f V'%V_pout)\n", + "PIV=2*V_pout+0.7;\n", + "print('PIV = %fV'%PIV)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "full wave rectifier output voltage = 24.300000 V\n", + "PIV = 49.300000V" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.6, Page Number: 54

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# variable declaration\n", + "V_rms=12.0; #rms secondary voltage\n", + "\n", + "#calculation\n", + "V_p_sec=math.sqrt(2)*V_rms; #peak secondary voltage\n", + "V_th=0.7; #knee voltage of diode\n", + "V_p_out=V_p_sec-2*V_th; #in one cycle, 2 diodes conduct\n", + "PIV=V_p_out+V_th; #applying KVL\n", + "\n", + "#result\n", + "print \"Peak output voltage = %.2f volt\" %V_p_out\n", + "print \"PIV across each diode = %.2f volt\" %PIV" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Peak output voltage = 15.57 volt\n", + "PIV across each diode = 16.27 volt" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.7, Page Number: 58

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# variable declaration\n", + "R_l=2200; #load resistance in Ohm\n", + "C=50*10**-6; #capacitance in Farad\n", + "V_rms=115; #rms of primary\n", + "\n", + "#calculation\n", + "V_p_pri=math.sqrt(2)*V_rms; #peak voltage across primary\n", + "n=0.1; #turn ratio is 10:1\n", + "V_p_sec=n*V_p_pri; #primary voltage across secondary\n", + "V_p_rect=V_p_sec-1.4 #unfiltered peak rectified voltage\n", + "#we subtract 1.4 because in each cycle 2 diodes conduct & 2 do not\n", + "f=120; #frequency of full wave rectified voltage\n", + "V_r_pp=(1/(f*R_l*C))*V_p_rect; #peak to peak ripple voltage\n", + "V_DC=(1-(1/(2*f*R_l*C)))*V_p_rect;\n", + "r=V_r_pp/V_DC;\n", + "\n", + "#result\n", + "print \"Ripple factor = %.3f \" %r" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Ripple factor = 0.079 " + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.8, Page Number: 62

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "# variable declaration\n", + "V_REF=1.25; #in volts\n", + "V_R1=V_REF; #voltage in volt\n", + "R1=220.0; #in ohms\n", + "I_ADJ=50*10**-6 #in amperes\n", + "\n", + "#calculation\n", + "# MAX VALUE OF R2=5000 Ohms\n", + "R2_min=0.0; #min resistance\n", + "V_out_min=V_REF*(1+(R2_min/R1))+I_ADJ*R2_min;\n", + "R2_max=5000.0; #max value of resistance\n", + "V_out_max=V_REF*(1+(R2_max/R1))+I_ADJ*R2_max;\n", + "\n", + "#result\n", + "print \"minimum output voltage = %.2f volt\" %V_out_min\n", + "print \"maximum output voltage = %.2f volt\" %V_out_max" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "minimum output voltage = 1.25 volt\n", + "maximum output voltage = 29.91 volt" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.9,Page Number: 64

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "V_NL=5.18 #No load output voltage\n", + "V_FL=5.15 #Full load output voltage\n", + "load_reg=((V_NL-V_FL)/V_FL)*100 #In percentage\n", + "print('load regulation percent = %.2f%% '%load_reg)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "load regulation percent = 0.58% " + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.10, Page Number: 66

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import pylab as py\n", + "import numpy as np\n", + "\n", + "#let input wave be V_in=V_p_in*sin(2*%pi*f*t) \n", + "f=1.0; #Frequency is 1Hz\n", + "T=1/f;\n", + "R_1=100.0; #Resistances in ohms\n", + "R_L=1000.0; #Load\n", + "V_p_in=10.0; #Peak input voltage\n", + "V_th=0.7; #knee voltage of diode\n", + "\n", + "V_p_out=V_p_in*(R_L/(R_L+R_1)); #peak output voltage\n", + "print('peak output voltage = %.2f V'%V_p_out)\n", + "\n", + "t = np.arange(0, 3.5 , 0.0005)\n", + "z=V_p_in*np.sin(2*np.pi*f*t)*(R_L/(R_L+R_1))\n", + "\n", + "subplot(211)\n", + "plot(t,z)\n", + "ylim(-9.09,9.09)\n", + "title('Input Voltage Waveform')\n", + "\n", + "subplot(212)\n", + "plot(t,z)\n", + "ylim(-0.07,9.09)\n", + "title('Output Voltage Waveform')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "peak output voltage = 9.09 V" + ] + }, + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 12, + "text": [ + "" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAXUAAAEICAYAAACgQWTXAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJztnXl4TNcbx78TiSWWiC1kIYgtliSEoEJCa21SlFoqYqvu\npTtKaavtT1vVhaou9tpVaZFaakpjJ4RErImEBIkQ2cgy5/fHa0YSk2Qy9965986cz/N4Hpm5c86b\nd06+973vOec9GsYYA4fD4XCsAju5DeBwOByOeHBR53A4HCuCizqHw+FYEVzUORwOx4rgos7hcDhW\nBBd1DofDsSK4qHMUj1arhYeHh9xmKIbc3FyEhISgdu3aGDFihNzmcBQGF3Urx9PTE3v37pW8nzlz\n5iAsLKzU9/v374/Zs2c/9vrWrVvRqFEj6HQ6k/vy9PTEP//8Y5adQli7di28vb2LvfbUU08ZfW3e\nvHmS2bFp0ybcunUL6enpWL9+vWT9cNQJF3UrR6PRQKPRyG0Gxo0bh9WrVz/2+qpVqzBmzBjY2Zk+\nFDUaDeTYM9ezZ0/ExcXh9u3bAICCggKcPn0a9+/fR1pamuG1w4cPo1evXpLZcfXqVbRs2bJCPtNT\nUFAggUUcRcE4Vo2npyfbu3cvY4yxZcuWsSeeeIK98847zNnZmTVt2pTt3LnTcG2vXr3YtGnTWJcu\nXVitWrXYM888w9LT0xljjO3bt4+5u7sXa7tJkyZsz549bOfOnaxy5crMwcGB1ahRg/n6+j5mR05O\nDnNycmL79+83vJaens6qVq3KoqOj2f3799mUKVO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8OBB+Pj4YODAgYiNjbW0mWajZN+bgpp8n5CQgKioKAQEBBR7XQ3fQWm2K93/Op0Ovr6+cHFxQXBw\nMLy9vYu9r3Tfl2e/Of43e/VL0U5NoeTdRikbk0yxo2PHjkhKSoKjoyN27tyJwYMH44KKzltTqu9N\nQS2+z8rKwrBhw/Dtt9+ihpEC6kr+DsqyXen+t7Ozw6lTp5CRkYF+/fpBq9U+tmtdyb4vz35z/C84\nUjdlE1LJa65duwY3NzehXYuCKfbXrFnT8Jg0YMAA5OfnI10lRWGU7HtTUIPv8/Pz8eyzz2LMmDEY\nPHjwY+8r+Tsoz3Y1+B8AnJycMGjQIBw/frzY60r2fVFKs98c/wsWdVM2IYWGhmLlypUAgMOHD6N2\n7dpwcXER2rUomGL/zZs3DXf7o0ePgjFmNPelRJTse1NQuu8ZY5g4cSK8vb0xdepUo9co9TswxXYl\n+z8tLQ13794FAOTm5mL37t3w8/Mrdo1SfQ+YZr85/hecfiltE9KSJUsAAC+++CIGDhyIHTt2wMvL\nC9WrV8eyZcuEdisapti/adMmLF68GPb29nB0dMS6detktvoRo0aNwr///ou0tDR4eHjgo48+Qv7D\nE7OV7nugfPuV7HsAiIyMxOrVq9GhQwfDH+Rnn32GxMREAMr+DkyxXcn+T0lJQXh4OHQ6HXQ6HcLC\nwtCnTx/VaI8p9pvjf775iMPhcKwIyY+z43A4HI7l4KLO4XA4VgQXdQ6Hw7EiuKhzOByOFcFFncPh\ncKwILuocDodjRfwfUaYhEUjyJ+wAAAAASUVORK5CYII=\n" + } + ], + "prompt_number": 12 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.11, Page Number: 67

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#from pylab import figure, show\n", + "#from numpy import arange, sin, pi,bool\n", + "#import numpy as np\n", + "import pylab as py\n", + "import numpy as np\n", + "#let input wave be V_in=V_p_in*sin(2*%pi*f*t) \n", + "f=1.0; #Frequency is 1Hz\n", + "T=1/f;\n", + "V_p_in=10; #Peak input voltage\n", + "V_th=0.7; #knee voltage of diode\n", + "print('max output voltage is 5.7V')\n", + "print('min output voltage is -5.7V')\n", + "\n", + "###############GRAPH Plotting#################################\n", + "t = arange(0.0,4.5,0.0005)\n", + "V_in=V_p_in*sin(2*pi*f*t);\n", + "\n", + "Vout=V_in;\n", + "#fig = figure(2)\n", + "subplot(211)\n", + "plot(t,V_in)\n", + "#ax2.grid(True)\n", + "ylim( (-10,10) )\n", + "title('Input to the +ve and -ve diode limiter ')\n", + "subplot(212)\n", + "plot(t,V_in)\n", + "#ax1.grid(True)\n", + "ylim( (-5.7,5.7) )\n", + "title('Output of +ve and -ve diode limiter')\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "max output voltage is 5.7V\n", + "min output voltage is -5.7V" + ] + }, + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 13, + "text": [ + "" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAXsAAAEICAYAAAC+iFRkAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzsnXlYldX2x7+HQQFBZJBZZlBBRcxEUxI0BxxKsxRNzbK5\nvJm3uln5E7uledUGs8G6XdHMuUFTwhGcUKkky1lGmcUEZZLhnP37Y3eODOfAyznvsN/j+3keHuWc\n9+y9zmLt9a537b3XVhFCCBQUFBQUzBoLqQVQUFBQUBAexdkrKCgo3AUozl5BQUHhLkBx9goKCgp3\nAYqzV1BQULgLUJy9goKCwl2A4uwVOJOamooePXpILQYTzJkzB4sWLZJaDMTExODrr78GAHz77bcY\nM2aMUe0kJCRg1qxZRn3W398fhw4dAgAsXboUTz/9tFHtmCK/Qvsozp5n/P39cfDgQcH74TI4mw5C\nY7CwsEB2drbRnzdnVCoVVCqV1GI0k+Oxxx7D3r17jW7HFBm0vPnmm/jqq6+Maqel/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ZwjZP8l5KqDlOGKs/C9CUSSXwi6d1RVVFWs\ntSIzW//eTU0db+r0jmc6+3RT05c+tRxCA+BfNmgBBhD2AAMIe4ABhD3AAMIeYABhDzDAAwJBIdo4\nx/PeAAAAAElFTkSuQmCC\n" + } + ], + "prompt_number": 13 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.12, Page Number: 76

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "V_p_in=18.0; #peak input voltage is 18V\n", + "V_supply=12.0;\n", + "R2=100.0;\n", + "R3=220.0; #resistances in ohms\n", + "#calculation\n", + "V_bias=V_supply*(R3/(R2+R3));\n", + "\n", + "#result\n", + "print('diode limiting the voltage at this voltage =%fV'%V_bias)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "diode limiting the voltage at this voltage =8.250000V" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.13, Page Number: 78

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "V_p_in=24.0;\n", + "V_DC=-(V_p_in-0.7); #DC level added to output\n", + "print('V_DC = %.1fV'%V_DC)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "V_DC = -23.3V" + ] + } + ], + "prompt_number": 15 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/.ipynb_checkpoints/Chapter3-checkpoint.ipynb b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/.ipynb_checkpoints/Chapter3-checkpoint.ipynb new file mode 100644 index 00000000..c21cf09b --- /dev/null +++ b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/.ipynb_checkpoints/Chapter3-checkpoint.ipynb @@ -0,0 +1,396 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:7d54e3690fc412ff890e6ea2f39f46cb8c03d3ea660ea034447f2497647b95ed" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 3: Special-purpose Diodes

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.1, Page Number:88

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "%pylab inline" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\n", + "For more information, type 'help(pylab)'." + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "delVZ=50*10**-3; #voltage in volts, from graph\n", + "delIZ=5*10**-3; #current in amperes, from rgraph\n", + "\n", + "#calculation\n", + "ZZ=delVZ/delIZ; #zener impedence\n", + "\n", + "# result\n", + "print \"zener impedance = %d ohm \" %ZZ" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "zener impedance = 10 ohm " + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.2, Page Number:89

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# variable declaration\n", + "I_ZT=37*10**-3; #IN AMPERES\n", + "V_ZT=6.80; #IN VOLTS\n", + "Z_ZT=3.50; #IN OHMS\n", + "I_Z=50*10**-3; #IN AMPERES\n", + "\n", + "#calculation\n", + "DEL_I_Z=I_Z-I_ZT; #change current\n", + "DEL_V_Z=DEL_I_Z*Z_ZT; #change voltage\n", + "V_Z=V_ZT+DEL_V_Z; #voltage across zener terminals\n", + "print \"voltage across zener terminals when current is 50 mA = %.3f volts\" %V_Z\n", + "I_Z=25*10**-3; #IN AMPERES\n", + "DEL_I_Z=I_Z-I_ZT; #change current\n", + "DEL_V_Z=DEL_I_Z*Z_ZT; #change voltage\n", + "V_Z=V_ZT+DEL_V_Z; #voltage across zener terminals\n", + "\n", + "#result\n", + "print \"voltage across zener terminals when current is 25 mA = %.3f volts\" %V_Z" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "voltage across zener terminals when current is 50 mA = 6.845 volts\n", + "voltage across zener terminals when current is 25 mA = 6.758 volts" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.3, Page Number:90

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "V_Z=8.2; #8.2 volt zener diode\n", + "TC=0.0005; #Temperature coefficient (per degree celsius)\n", + "T1=60; #Temperature 1 in celsius\n", + "T2=25; #Temperature 2 in celsius\n", + "\n", + "#calculation\n", + "DEL_T=T1-T2; #change in temp\n", + "del_V_Z=V_Z*TC*DEL_T; #change in voltage\n", + "voltage=V_Z+del_V_Z; #zener voltage\n", + "\n", + "#result\n", + "print \"zener voltage at 60 degree celsius = %.3f volt\" %voltage" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "zener voltage at 60 degree celsius = 8.343 volt" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.4, Page Number:90

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "P_D_max=400*10**-3; #power in watts\n", + "df=3.2*10**-3 #derating factor in watts per celsius\n", + "del_T=(90-50); #in celsius, temperature difference\n", + "\n", + "#calculation\n", + "P_D_deru=P_D_max-df*del_T; #power dissipated\n", + "P_D_der=P_D_deru*1000;\n", + "\n", + "#result\n", + "print \"maximum power dissipated at 90 degree celsius = %d mW\" %P_D_der" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "maximum power dissipated at 90 degree celsius = 272 mW" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.5, Page Number: 92

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# variable declaration\n", + "V_Z=5.1;\n", + "I_ZT=49*10**-3;\n", + "I_ZK=1*10**-3;\n", + "Z_Z=7;\n", + "R=100;\n", + "P_D_max=1;\n", + "\n", + "#calculation\n", + "V_out=V_Z-(I_ZT-I_ZK)*Z_Z; #output voltage at I_ZK\n", + "V_IN_min=I_ZK*R+V_out; #input voltage\n", + "I_ZM=P_D_max/V_Z; #current\n", + "V_out=V_Z+(I_ZM-I_ZT)*Z_Z; #output voltage at I_ZM\n", + "V_IN_max=I_ZM*R+V_out; #max input voltage\n", + "\n", + "#result\n", + "print \"maximum input voltage regulated by zener diode = %.3f volts\" %V_IN_max\n", + "print \"minimum input voltage regulated by zener diode = %.3f volts\" %V_IN_min" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "maximum input voltage regulated by zener diode = 25.737 volts\n", + "minimum input voltage regulated by zener diode = 4.864 volts" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.6, Page Number: 93

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "V_Z=12.0; #voltage in volt\n", + "V_IN=24.0; #ip voltage in volt\n", + "I_ZK=0.001; #current in ampere\n", + "I_ZM=0.050; #current in ampere \n", + "Z_Z=0; #impedence\n", + "R=470; #resistance in ohm\n", + "\n", + "#calculation\n", + "#when I_L=0, I_Z is max and is equal to the total circuit current I_T\n", + "I_T=(V_IN-V_Z)/R; #current\n", + "I_Z_max=I_T; #max current\n", + "if I_Z_maxExample 3.7, Page Number: 94

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "V_IN=24.0; #voltage in volt\n", + "V_Z=15.0; #voltage in volt\n", + "I_ZK=0.25*10**-3; #current in ampere\n", + "I_ZT=17*10**-3; #current in ampere\n", + "Z_ZT=14.0; #impedence\n", + "P_D_max=1.0; #max power dissipation\n", + "\n", + "#calculation\n", + "V_out_1=V_Z-(I_ZT-I_ZK)*Z_ZT; #output voltage at I_ZK\n", + "print \"output voltage at I_ZK = %.2f volt\" %V_out_1\n", + "I_ZM=P_D_max/V_Z;\n", + "\n", + "V_out_2=V_Z+(I_ZM-I_ZT)*Z_ZT; #output voltage at I_ZM\n", + "print \"output voltage a I_ZM = %.2f volt\" %V_out_2\n", + "R=(V_IN-V_out_2)/I_ZM; #resistance\n", + "print \"value of R for maximum zener current, no load = %.2f ohm\" %R\n", + "print \"closest practical value is 130 ohms\"\n", + "R=130.0;\n", + "#for minimum load resistance(max load current) zener current is minimum (I_ZK)\n", + "I_T=(V_IN-V_out_1)/R; #current\n", + "I_L=I_T-I_ZK; #current\n", + "R_L_min=V_out_1/I_L; #minimum load resistance\n", + "\n", + "#result\n", + "print \"minimum load resistance = %.2f ohm\" %R_L_min" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "output voltage at I_ZK = 14.77 volt\n", + "output voltage a I_ZM = 15.70 volt\n", + "value of R for maximum zener current, no load = 124.57 ohm\n", + "closest practical value is 130 ohms\n", + "minimum load resistance = 208.60 ohm" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.8, Page Number: 96

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable declaration\n", + "V_p_in=10.0; #Peak input voltage\n", + "V_th=0.7; #forward biased zener\n", + "V_Z1=5.1;\n", + "V_Z2=3.3;\n", + "\n", + "V_p_in=20.0;\n", + "V_Z1=6.2;\n", + "V_Z2=15.0;\n", + "\n", + "#result\n", + "print('max voltage = %.1f V'%(V_Z1+V_th))\n", + "print('min voltage = %.1f V'%(-(V_Z2+V_th)))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "max voltage = 6.9 V\n", + "min voltage = -15.7 V" + ] + } + ], + "prompt_number": 9 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/.ipynb_checkpoints/Chapter4-checkpoint.ipynb b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/.ipynb_checkpoints/Chapter4-checkpoint.ipynb new file mode 100644 index 00000000..7f91e8cf --- /dev/null +++ b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/.ipynb_checkpoints/Chapter4-checkpoint.ipynb @@ -0,0 +1,477 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:5816ca33fc73880418c1590a9abffc6f1191d50c49e2df9568303f79019acd1c" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 4: Bipolar Junction Transistors (BJTs)

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.1, Page Number: 120

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "%pylab inline" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\n", + "For more information, type 'help(pylab)'." + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "I_C=3.65*10**-3; #collector current in amperes\n", + "I_B=50*10**-6; #base current in amperes\n", + "\n", + "#calculation\n", + "B_DC=I_C/I_B; #B_DC value\n", + "I_E=I_B+I_C; #current in ampere\n", + "\n", + "# result\n", + "print \"B_DC = %d \" %B_DC\n", + "print \"Emitter current = %.4f ampere\" %I_E" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "B_DC = 73 \n", + "Emitter current = 0.0037 ampere" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.2, Page Number: 121

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "V_BE=0.7; # voltage in volt\n", + "B_DC=150; # voltage in volt\n", + "V_BB=5; # voltage in volt\n", + "V_CC=10; # voltage in volt\n", + "R_B=10*10**3; # resistance in ohm\n", + "R_C=100; # resistance in ohm\n", + "\n", + "#calculation\n", + "I_B=(V_BB-V_BE)/R_B; #base current in amperes\n", + "I_C=B_DC*I_B; #collector current in amperes\n", + "I_E=I_C+I_B; #emitter current in amperes\n", + "V_CE=V_CC-I_C*R_C; #collector to emitter voltage in volts\n", + "V_CB=V_CE-V_BE; #collector to base voltage in volts\n", + "\n", + "# result\n", + "print \"base current = %.5f amperes\" %I_B\n", + "print \"collector current = %.4f amperes\" %I_C\n", + "print \"emitter current = %.5f amperes\" %I_E\n", + "print \"collector to emitter voltage =%.2f volts\" %V_CE\n", + "print \"collector to base voltage =%.2f volts\" %V_CB" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "base current = 0.00043 amperes\n", + "collector current = 0.0645 amperes\n", + "emitter current = 0.06493 amperes\n", + "collector to emitter voltage =3.55 volts\n", + "collector to base voltage =2.85 volts" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.3, Page Number: 123

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import pylab as py\n", + "import numpy as np\n", + "\n", + "#variable declaration\n", + "beta=100 # current gain\n", + "print'Ideal family of collector curve'\n", + "\n", + "ic1 = arange(0.00001, 0.45, 0.0005)\n", + "ic2 = arange(0.00001, 0.5, 0.0005)\n", + "ic3 = arange(0.00001, 0.6, 0.0005)\n", + "ic4 = arange(0.00001, 0.7, 0.0005)\n", + "vcc1=ic1*0.5/0.7\n", + "vcc2=ic2*1.35/0.7\n", + "vcc3=ic3*2/0.7\n", + "vcc4=ic4*2.5/0.7\n", + "m1=arange(0.45,5.0,0.0005)\n", + "m2=arange(0.5,5.0,0.0005)\n", + "m3=arange(0.6,5.0,0.0005)\n", + "m4=arange(0.7,5.0,0.0005)\n", + "\n", + "plot(ic1,vcc1,'b')\n", + "plot(ic2,vcc2,'b')\n", + "plot(ic3,vcc3,'b')\n", + "plot(ic4,vcc4,'b')\n", + "plot(m1,0.32*m1/m1,'b')\n", + "plot(m2,0.96*m2/m2,'b')\n", + "plot(m3,1.712*m3/m3,'b')\n", + "plot(m4,2.5*m4/m4,'b')\n", + "\n", + "ylim( (0,3) )\n", + "ylabel('Ic(mA)')\n", + "xlabel('Vce(V)')\n", + "title('Ideal family of collector curve')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Ideal family of collector curve" + ] + }, + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 4, + "text": [ + "" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYEAAAEXCAYAAABLZvh6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XtYVPW6B/DvIHjhIkop4IBg4gVSAcVIQ0UNTVOizBQz\nUalQj6nVfmrno0dteyzTrWm2Pdb2caeluPV4QbnkJUa8czS8ZB4vKHIVREEhlevv/LFiYGCAQefC\nzPp+nocn1qzLvIy0XtbvXb93KYQQAkREJEtWpg6AiIhMh0mAiEjGmASIiGSMSYCISMaYBIiIZIxJ\ngIhIxpgEZCwtL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TCD8ZUcPYQI5ID4QQ6Nu3L06f\nPo2WLVs2uO2BAwcQGxuLNWvWGCk6ovrxSoBIDxQKBd577z389NNPjW77z3/+Ex9++KERoiJqHK8E\niIhkjFcCREQyxiRARCRjTAJERDLGJEBEJGNMAkREMsYkQEQkY/8PuzhceEoO66YAAAAASUVORK5C\nYII=\n" + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.4, Page Number: 125

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# variable declaration\n", + "V_CE_sat=0.2; # voltage in volt\n", + "V_BE=0.7; # voltage in volt\n", + "V_BB=3; # voltage in volt\n", + "V_CC=10; # voltage in volt\n", + "B_DC=50; # voltage in volt\n", + "R_B=10*10**3; # resistance in ohm\n", + "R_C=1*10**3; # resistance in ohm\n", + "\n", + "#calculation\n", + "I_C_sat=(V_CC-V_CE_sat)/R_C; # saturation current\n", + "I_B=(V_BB-V_BE)/R_B; # base current\n", + "I_C=B_DC*I_B; # current in ampere\n", + "\n", + "# result\n", + "if I_C>I_C_sat:\n", + " print \"transistor in saturation\"\n", + "else:\n", + " print \"transistor not in saturation\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "transistor in saturation" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.5, Page Number: 127

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable declaration\n", + "P_D_max=250*10**-3; #max power rating of transistor in watts\n", + "V_CE=6; #voltage in volt\n", + "\n", + "#Calculation\n", + "I_Cu=P_D_max/V_CE; #Current (Amp)\n", + "I_C=I_Cu*1000;\n", + "\n", + "#Result\n", + "print \"collector current that can be handled by the transistor = %.1f mA\" %I_C\n", + "print \"\\nRemember that this is not necessarily the maximum IC. The transistor\"\n", + "print \"can handle more collectore current if Vce is reduced as long as PDmax\"\n", + "print \"is not exceeded.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "collector current that can be handled by the transistor = 41.7 mA\n", + "\n", + "Remember that this is not necessarily the maximum IC. The transistor\n", + "can handle more collectore current if Vce is reduced as long as PDmax\n", + "is not exceeded." + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.6, Page Number: 127

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "P_D_max=800*10**-3; #max power rating of transistor in watts\n", + "V_BE=0.7; #voltage in volt\n", + "V_CE_max=15; #voltage in volt\n", + "I_C_max=100*10**-3; #Current (Amp)\n", + "V_BB=5; #voltage in volt\n", + "B_DC=100; #voltage in volt\n", + "R_B=22*10**3; # resistance in ohm\n", + "R_C=10**3; # resistance in ohm\n", + "\n", + "#Calculation\n", + "I_B=(V_BB-V_BE)/R_B; # base current\n", + "I_C=B_DC*I_B; #collector current \n", + "V_R_C=I_C*R_C; #voltage drop across R_C\n", + "V_CC_max=V_CE_max+V_R_C; #Vcc max in volt\n", + "P_D=I_C*V_CE_max; #max power rating\n", + "\n", + "#Result\n", + "if P_DExample 4.7, Page Number: 128

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "df=5*10**-3; #derating factor in watts per degree celsius\n", + "T1=70; #temperature 1\n", + "T2=25; #temperature 2\n", + "P_D_max=1; #in watts\n", + "\n", + "#Calculation\n", + "del_P_D=df*(T1-T2); #change due to temperature\n", + "P_D=P_D_max-del_P_D; # power dissipation\n", + "\n", + "#Result\n", + "print \"Power dissipated max at a temperature of 70 degree celsius = %.3f watts\" %P_D" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Power dissipated max at a temperature of 70 degree celsius = 0.775 watts" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.8, Page Number: 130

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "R_C=1*10**3; #resistance in ohm\n", + "r_e=50; #resistance in ohm\n", + "V_b=100*10**-3; #voltage in volt\n", + "\n", + "#Calculation\n", + "A_v=R_C/r_e; #voltage gain\n", + "V_out=A_v*V_b; #voltage in volt\n", + "\n", + "#Result\n", + "print \"voltage gain = %d \" %A_v\n", + "print \"AC output voltage = %d volt\" %V_out" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "voltage gain = 20 \n", + "AC output voltage = 2 volt" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.9, Page Number: 132

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "V_CC=10.0; #voltage in volt\n", + "B_DC=200.0; #voltage in volt\n", + "R_C=1.0*10**3; #resistance in ohm\n", + "V_IN=0.0; #voltage in volt\n", + "\n", + "#Calculation\n", + "V_CE=V_CC; #equal voltage\n", + "print \"when V_IN=0, transistor acts as open switch(cut-off) and collector emitter voltage = %.2f volt\" %V_CE\n", + "#now when V_CE_sat is neglected\n", + "I_C_sat=V_CC/R_C; #saturation current\n", + "I_B_min=I_C_sat/B_DC; #minimum base current\n", + "print \"\\nminimum value of base current to saturate transistor = %.5f ampere\" %I_B_min\n", + "V_IN=5; #voltage in volt\n", + "V_BE=0.7; #voltage in volt\n", + "V_R_B=V_IN-V_BE; #voltage across base resiatance\n", + "R_B_max=V_R_B/I_B_min;\n", + "\n", + "\n", + "#Result\n", + "kw=round (R_B_max)\n", + "print \"\\nmaximum value of base resistance when input voltage is 5V = %d ohm\" %kw" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "when V_IN=0, transistor acts as open switch(cut-off) and collector emitter voltage = 10.00 volt\n", + "\n", + "minimum value of base current to saturate transistor = 0.00005 ampere\n", + "\n", + "maximum value of base resistance when input voltage is 5V = 86000 ohm" + ] + } + ], + "prompt_number": 10 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/.ipynb_checkpoints/Chapter5-checkpoint.ipynb b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/.ipynb_checkpoints/Chapter5-checkpoint.ipynb new file mode 100644 index 00000000..a8015b6a --- /dev/null +++ b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/.ipynb_checkpoints/Chapter5-checkpoint.ipynb @@ -0,0 +1,447 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:c4c502bfd6580fd1868fbcea67aad93ec7389e68f949d2b682e69f6f1b08d677" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 5: Transistor Bias Circuits

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.1, Page Number: 146

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "%pylab inline" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\n", + "For more information, type 'help(pylab)'." + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "V_BB=10.0; #voltage in volt\n", + "V_CC=20.0; #voltage in volt\n", + "B_DC=200.0; #B_DC value\n", + "R_B=47.0*10**3; #resistance in ohm\n", + "R_C=330.0; #resistance in ohm\n", + "V_BE=0.7; #voltage in volt\n", + "\n", + "#current\n", + "I_B=(V_BB-V_BE)/R_B; #base current\n", + "I_C=B_DC*I_B; #Q POINT\n", + "V_CE=V_CC-I_C*R_C; #Q POINT\n", + "I_C_sat=V_CC/R_C; #saturation current\n", + "I_c_peak=I_C_sat-I_C; #peak current \n", + "I_b_peak=I_c_peak/B_DC; #peak current in ampere\n", + "\n", + "#result\n", + "print \"Q point of I_C = %.3f amperes\" %I_C\n", + "print \"Q point of V_CE = %.2f volts\" %V_CE\n", + "print \"peak base current = %.4f amperes\" %I_b_peak" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Q point of I_C = 0.040 amperes\n", + "Q point of V_CE = 6.94 volts\n", + "peak base current = 0.0001 amperes" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.2, Page Number: 149

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "B_DC=125.0; #DC value\n", + "R_E=10.0**3; #resistance in ohm\n", + "\n", + "#calculation\n", + "R_IN_base=B_DC*R_E; #base resistance\n", + "\n", + "#Result\n", + "print \"DC input resistance, looking at base of transistor = %d ohm\" %R_IN_base" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "DC input resistance, looking at base of transistor = 125000 ohm" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.3, Page Number: 151

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "B_DC=100; #DC value\n", + "R1=10*10**3; #resistance in ohm\n", + "R2=5.6*10**3; #resistance in ohm\n", + "R_C=1*10**3; #resistance in ohm\n", + "R_E=560; #resistance in ohm\n", + "V_CC=10; #voltage in volt\n", + "V_BE=0.7 #voltage in volt\n", + "\n", + "#calculation\n", + "R_IN_base=B_DC*R_E; #calculate base resistance\n", + "#We can neglect R_IN_base as it is equal to 10*R2\n", + "print \"input resistance seen from base = %d ohm\" %R_IN_base\n", + "print \"which can be neglected as it is 10 times R2\"\n", + "\n", + "V_B=(R2/(R1+R2))*V_CC; #base voltage\n", + "V_E=V_B-V_BE; #emitter voltage\n", + "I_E=V_E/R_E; #emitter current\n", + "I_C=I_E; #currents are equal\n", + "V_CE=V_CC-I_C*(R_C+R_E); #voltage in volt\n", + "\n", + "#result\n", + "print \"V_CE = %.2f volts\" %V_CE\n", + "print \"I_C = %.3f amperes\" %I_C\n", + "print \"Since V_CE>0V, transistor is not in saturation\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "input resistance seen from base = 56000 ohm\n", + "which can be neglected as it is 10 times R2\n", + "V_CE = 1.95 volts\n", + "I_C = 0.005 amperes\n", + "Since V_CE>0V, transistor is not in saturation" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.4, Page Number: 154

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "V_EE=10.0; #voltage in volt\n", + "V_BE=0.7; #voltage in volt\n", + "B_DC=150.0; #DC value \n", + "R1=22.0*10**3; #resistance in ohm\n", + "R2=10.0*10**3; #resistance in ohm\n", + "R_C=2.2*10**3; #resistance in ohm\n", + "R_E=1.0*10**3; #resistance in ohm\n", + "\n", + "#calculation\n", + "R_IN_base=B_DC*R_E; #R_IN_base>10*R2,so it can be neglected\n", + "print \"input resistance as seen from base = %d ohm\" %R_IN_base\n", + "print \"it can be neglected as it is greater than 10 times R2\"\n", + "V_B=(R1/(R1+R2))*V_EE; #base voltage\n", + "V_E=V_B+V_BE; #emitter voltage\n", + "I_E=(V_EE-V_E)/R_E; #emitter current\n", + "I_C=I_E; #currents are equal\n", + "V_C=I_C*R_C; #collector voltage\n", + "V_EC=V_E-V_C; #emitter-collector voltage\n", + "\n", + "#result\n", + "print \"I_C collector current = %.4f amperes\" %I_C\n", + "print \"V_EC emitter-collector voltage = %.2f Volts\" %V_EC" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "input resistance as seen from base = 150000 ohm\n", + "it can be neglected as it is greater than 10 times R2\n", + "I_C collector current = 0.0024 amperes\n", + "V_EC emitter-collector voltage = 2.24 Volts" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.5, PAge Number: 154

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "R1=68.0*10**3; #resistance in ohm\n", + "R2=47.0*10**3; #resistance in ohm\n", + "R_C=1.8*10**3; #resistance in ohm\n", + "R_E=2.2*10**3; #resistance in ohm\n", + "V_CC=-6.0; #voltage in volt\n", + "V_BE=0.7; #voltage in volt\n", + "B_DC=75.0; #DC value\n", + "\n", + "#calculation\n", + "R_IN_base=B_DC*R_E;\n", + "print \"input resistance as seen from base\"\n", + "print \"is not greater than 10 times R2 so it should be taken into account\"\n", + "#R_IN_base in parallel with R2\n", + "V_B=((R2*R_IN_base)/(R2+R_IN_base)/(R1+(R2*R_IN_base)/(R2+R_IN_base)))*V_CC;\n", + "V_E=V_B+V_BE; #emitter voltage\n", + "I_E=V_E/R_E; #emitter current\n", + "I_C=I_E; #currents are equal\n", + "V_C=V_CC-I_C*R_C; #collector voltage\n", + "V_CE=V_C-V_E; #collector-emitter voltage\n", + "\n", + "#result\n", + "print \"collector current = %.4f amperes\" %I_C\n", + "print \"collector emitter voltage = %.2f volts\" %V_CE" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "input resistance as seen from base\n", + "is not greater than 10 times R2 so it should be taken into account\n", + "collector current = -0.0006 amperes\n", + "collector emitter voltage = -3.46 volts" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.6, Page Number: 156

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# variable declaration\n", + "V_CC=12.0; #voltage in volt\n", + "R_B=100.0*10**3; #resistance in ohm\n", + "R_C=560.0; #resistance in ohm\n", + "#FOR B_DC=85 AND V_BE=0.7V\n", + "B_DC=85.0; #DC value\n", + "V_BE=0.7; #base-emitter voltage\n", + "\n", + "#calculation\n", + "I_C_1=B_DC*(V_CC-V_BE)/R_B; #collector current\n", + "V_CE_1=V_CC-I_C_1*R_C; #collector-emittor voltage\n", + "#FOR B_DC=100 AND V_BE=0.6V\n", + "B_DC=100.0; #DC value \n", + "V_BE=0.6; #base emitter voltage\n", + "I_C_2=B_DC*(V_CC-V_BE)/R_B; #collector current\n", + "V_CE_2=V_CC-I_C_2*R_C; #voltage in volt\n", + "p_del_I_C=((I_C_2-I_C_1)/I_C_1)*100; #percent change in collector current \n", + "p_del_V_CE=((V_CE_2-V_CE_1)/V_CE_1)*100; #percent change in C-E voltage\n", + "\n", + "#result\n", + "print \"percent change in collector current = %.2f\" %p_del_I_C\n", + "print \"percent change in collector emitter voltage = %.2f\" %p_del_V_CE" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "percent change in collector current = 18.69\n", + "percent change in collector emitter voltage = -15.18" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.7, Page Number: 159

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "V_CC=20.0; #voltage in volt\n", + "R_C=4.7*10**3; #resistance in ohm\n", + "R_E=10.0*10**3; #resistance in ohm\n", + "V_EE=-20.0; #voltage in volt\n", + "R_B=100*10**3; #resistance in ohm\n", + "#FOR B_DC=85 AND V_BE=0.7V\n", + "B_DC=85; #DC value\n", + "V_BE=0.7; #base-emitter voltage\n", + "I_C_1=(-V_EE-V_BE)/(R_E+(R_B/B_DC));\n", + "V_C=V_CC-I_C_1*R_C; #colector voltage\n", + "I_E=I_C_1; #emittor current\n", + "V_E=V_EE+I_E*R_E; #emittor voltage\n", + "V_CE_1=V_C-V_E; #CE voltage\n", + "print \"I_C_1 = %.3f\" %I_C_1\n", + "print \"V_CE_1 = %.2f\" %V_CE_1\n", + "#FOR B_DC=100 AND V_BE=0.6V\n", + "B_DC=100; #DC value \n", + "V_BE=0.6; #base-emitter voltage\n", + "I_C_2=(-V_EE-V_BE)/(R_E+(R_B/B_DC));\n", + "V_C=V_CC-I_C_2*R_C;#colector voltage\n", + "I_E=I_C_2; #emittor current\n", + "V_E=V_EE+I_E*R_E; #emittor voltage\n", + "V_CE_2=V_C-V_E; #CE voltage\n", + "print \"I_C_2 = %.3f\" %I_C_2\n", + "print \"V_CE_2 = %.2f\" %V_CE_2\n", + "\n", + "p_del_I_C=((I_C_2-I_C_1)/I_C_1)*100;\n", + "p_del_V_CE=((V_CE_2-V_CE_1)/V_CE_1)*100;\n", + "print \"percent change in collector currrent = %.2f\" %p_del_I_C\n", + "print \"percent change in collector emitter voltage = %.2f\" %p_del_V_CE\n", + "print \"answers in book are approximated\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "I_C_1 = 0.002\n", + "V_CE_1 = 14.61\n", + "I_C_2 = 0.002\n", + "V_CE_2 = 14.07\n", + "percent change in collector currrent = 2.13\n", + "percent change in collector emitter voltage = -3.69\n", + "answers in book are approximated" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.8, Page Number: 161

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaratio\n", + "V_CC=10.0; #voltage in volt\n", + "B_DC=100.0; #Dc value\n", + "R_C=10.0*10**3; #resistance in ohm\n", + "R_B=100.0*10**3; #resistance in ohm\n", + "V_BE=0.7; #base-emittor voltage\n", + "\n", + "#calculation\n", + "I_C=(V_CC-V_BE)/(R_C+(R_B/B_DC)); #collector current\n", + "V_CE=V_CC-I_C*R_C; #CE voltage\n", + "\n", + "#result\n", + "print \"Q point of collector current %.4f amperes\" %I_C\n", + "print \"Q point of collector-emitter voltage %.3f volts\" %V_CE" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Q point of collector current 0.0008 amperes\n", + "Q point of collector-emitter voltage 1.545 volts" + ] + } + ], + "prompt_number": 9 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/.ipynb_checkpoints/Chapter6-checkpoint.ipynb b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/.ipynb_checkpoints/Chapter6-checkpoint.ipynb new file mode 100644 index 00000000..ff850644 --- /dev/null +++ b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/.ipynb_checkpoints/Chapter6-checkpoint.ipynb @@ -0,0 +1,630 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:1e2443a67e2f318d256df68d49768eb2e6757f78c443329918d7f0edb5648c3b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 6: BJT Amplifiers

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.1, Page Number: 171

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "%pylab inline" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\n", + "For more information, type 'help(pylab)'." + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# result\n", + "\n", + "print \"theoretical example\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "theoretical example" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.2, Page Number: 174

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# variable declaration\n", + "I_E=2.0*10**-3; #emittor current\n", + "\n", + "#calculation\n", + "r_e=25.0*10**-3/I_E; #ac emitter resistance\n", + "\n", + "#result\n", + "print \"ac emitter resistance = %.2f ohms\" %r_e " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "ac emitter resistance = 12.50 ohms" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.3, Page Number: 178

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# variable declaration\n", + "I_E=3.8*10**-3; #emittor current\n", + "B_ac=160.0; #AC value\n", + "R1=22*10**3; #resistance in ohm\n", + "R2=6.8*10**3; #resistance in ohm\n", + "R_s=300.0; #resistance in ohm\n", + "V_s=10.0*10**-3; #voltage in volt\n", + "r_e=25.0*10**-3/I_E; \n", + "\n", + "#calculation\n", + "R_in_base=B_ac*r_e; #base resistance\n", + "R_in_tot=(R1*R2*R_in_base)/(R_in_base*R1+R_in_base*R2+R1*R2);\n", + "V_b=(R_in_tot/(R_in_tot+R_s))*V_s; #base voltage\n", + "\n", + "#result\n", + "print \"voltage at the base of the transistor = %.3f volts\" %V_b" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "voltage at the base of the transistor = 0.007 volts" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.4, Page Number: 180

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "# variable declaration\n", + "R_E=560.0; #resistance in ohm\n", + "f=2*10**3; #minimum value of frequency in hertz\n", + "X_C=R_E/10.0; #minimum value of capacitive reactance\n", + "\n", + "#calculation\n", + "C2=1.0/(2.0*math.pi*X_C*f); #capacitor \n", + "\n", + "#result\n", + "print \"value of bypass capacitor = %.7f farads\" %C2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "value of bypass capacitor = 0.0000014 farads" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.5, Page Number: 181

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "# variable declaration\n", + "r_e=6.58; #from ex6.3\n", + "R_C=1.0*10**3; #collector resistance\n", + "R_E=560; #emittor resistance\n", + "\n", + "#calculation\n", + "A_v=R_C/(R_E+r_e); #gain without bypass capacitor\n", + "A_v1=R_C/r_e; #gain with bypass capacitor\n", + "print \"gain without bypass capacitor = %.2f\" %A_v\n", + "print \"gain in the presence of bypass capacitor = %.2f\" %A_v1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "gain without bypass capacitor = 1.76\n", + "gain in the presence of bypass capacitor = 151.98" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.6, Page Number: 182

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "R_C=10.0**3; #resistance in ohm\n", + "R_L=5.0*10**3; #inductor resistance\n", + "r_e=6.58; #r_e value\n", + "\n", + "#calculation\n", + "R_c=(R_C*R_L)/(R_C+R_L); #collector resistor\n", + "A_v=R_c/r_e; #gain with load\n", + "\n", + "#result\n", + "print \"ac collector resistor = %.2f ohms\" %R_c\n", + "print \"gain with load = %.2f\" %A_v" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "ac collector resistor = 833.33 ohms\n", + "gain with load = 126.65" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.7, Page Number: 184

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# variable declaration\n", + "R_C=3.3*10**3; #resistance in ohm\n", + "R_E1=330.0; #emitter resistance\n", + "\n", + "#calculation\n", + "A_v=R_C/R_E1; #voltage gain\n", + "\n", + "#result\n", + "print \"approximate voltage gain as R_E2 is bypassed by C2 = %.2f\" %A_v" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "approximate voltage gain as R_E2 is bypassed by C2 = 10.00" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.8, Page Number: 184

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "B_DC=150.0;\n", + "B_ac=175.0;\n", + "V_CC=10.0;\n", + "V_s=10.0*10**-3;\n", + "R_s=600.0;\n", + "R1=47.0*10**3;\n", + "R2=10.0*10**3;\n", + "R_E1=470.0;\n", + "R_E2=470.0;\n", + "R_C=4.7*10**3;\n", + "R_L=47.00*10**3;\n", + "R_IN_base=B_DC*(R_E1+R_E2);\n", + "#since R_IN_base is ten times more than R2,it can be neglected in DC voltage calculation\n", + "V_B=(R2/(R2+R1))*V_CC;\n", + "V_E=V_B-0.7;\n", + "I_E=V_E/(R_E1+R_E2);\n", + "I_C=I_E;\n", + "V_C=V_CC-I_C*R_C;\n", + "print('dc collector voltage = %.3f volts'%V_C)\n", + "r_e=25.0*10**-3/I_E;\n", + "#base resistance\n", + "R_in_base=B_ac*(r_e+R_E1);\n", + "#total input resistance\n", + "R_in_tot=(R1*R2*R_in_base)/(R1*R2+R_in_base*R1+R_in_base*R2);\n", + "attenuation=R_in_tot/(R_s+R_in_tot);\n", + "#ac collector resistance\n", + "R_c=R_C*R_L/(R_C+R_L);\n", + "#voltage gain from base to collector\n", + "A_v=R_c/R_E1;\n", + "#overall voltage gain A_V\n", + "A_V=A_v*attenuation;\n", + "#rms voltage at collector V_c\n", + "V_c=A_V*V_s;\n", + "V_out_p=math.sqrt(2)*V_c;\n", + "print('V_out peak = %d mV'%(V_out_p*1000))\n", + "\n", + "################Waveform plotting##############################\n", + "\n", + "import pylab\n", + "import numpy \n", + "\n", + "t = arange(0.0, 4.0, 0.0005)\n", + "\n", + "\n", + "subplot(121)\n", + "plot(t, V_C+V_c*sin(2*pi*t))\n", + "ylim( (4.63,4.82) )\n", + "title('Collector Voltage')\n", + "\n", + "subplot(122)\n", + "plot(t, -V_s*sin(2*pi*t))\n", + "plot(t, V_out_p*sin(2*pi*t))\n", + "ylim( (-0.15,0.15) )\n", + "title('Source and output AC voltage')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "dc collector voltage = 4.728 volts\n", + "V_out peak = 119 mV" + ] + }, + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 9, + "text": [ + "" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAEICAYAAABfz4NwAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzsnXl8VNX5/z+TzCSZrDPZdxJ2AgipuOBXJahIUcGtKtiy\n1GrBpS4t35/W6he01g33Ulv61SqogEstm4CKGKUuIF8RFSigJJCNrJNlkklme35/HGayTWbunbud\nhPt+vXhp7tx75zPnzjzPOc95znMMRETQ0dHR0TntidBagI6Ojo4OH+gOQUdHR0cHgO4QdHR0dHRO\noTsEHR0dHR0AukPQ0dHR0TmF7hB0dHR0dADoDkEQpaWlyMvL8/9dUFCAjz76SENF8lJeXo6IiAh4\nvV6tpehwyqJFi/Dggw9qLWNI0deu8MBp5RDWrl2LKVOmICEhAdnZ2bjsssvw2Wefib6PwWCAwWCQ\npEXuH9iSJUuwcOHCfsf379+PmJgYNDc3C75XSUkJXn75Zdm0DQX+/e9/47zzzoPFYkFKSgrOP/98\n7N27V2tZqiHHdz4Qy5cvx/z58zW5X0lJCZKTk+F0Ovu9JpetEENBQQF27typ6HuE4rRxCM888wzu\nuecePPDAA6irq0NFRQVuv/12bNq0SWtpYdG3N79o0SK8++676Ojo6HX8tddew+zZs2GxWATfW4kf\n/mCmtbUVV1xxBe666y7YbDZUVVVh2bJliI6Olv29PB6P7PeUi6G0hrW8vBx79uxBenp6Pxugla0w\nGAzatzGdBjQ3N1N8fDy98847A57T2dlJd911F2VnZ1N2djbdfffd1NXVRUREH3/8MeXm5vrPLSgo\noI8++oiIiLxeLz322GM0YsQISklJoeuvv56ampr85+7atYumTp1KFouF8vLy6NVXX6W///3vZDKZ\nKCoqiuLj42nOnDlERHTw4EGaNm0aWSwWGj9+PG3atMl/n4ULF9KSJUto1qxZFBcX53//nowZM4bW\nrFnj/9vtdlN2djZt2rSJvF4v/fGPf6Rhw4ZReno6LViwgFpaWoiIqKysjAwGA7ndbrr//vspMjKS\nYmJiKD4+nn7zm98QEdGdd95JeXl5lJiYSGeeeSbt2rXL/z4dHR20YMECslqtNG7cOHriiSd6tVdV\nVRVdc801lJaWRoWFhfTCCy8IeGr88NVXX5HFYhnw9WBt2/e7Q0Q0bNgw//NbtmwZXXvttfSLX/yC\nEhMT6eWXX6bGxkZatGgRZWdnk9Vqpauuusp/7ebNm2nSpElksVjovPPOo2+//XZAXcGe2bJly+i6\n666jBQsWUEJCAo0fP5727t3rf/3rr7+m4uJiSkhIoBtuuIHmzp1LDzzwgGyff8eOHbRt2zaKiooi\nk8lE8fHxNHnyZCIimjZtGt1333109tlnU2JiIl155ZX+31Q49wvEQw89RLNnz6ZHHnmErrjiCv9x\nIbaiJ19++SVlZmaS1+v1H3v33XfpjDPOICLhduUXv/gFRUREkNlspvj4eFqxYgUREf3sZz+jzMxM\nSkpKogsvvJAOHDjgf5+Ghga64oorKDExkc466yz6wx/+QOeff77/9UOHDtEll1xCycnJNGbMGHrr\nrbdCfp7TwiFs27aNjEYjeTy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vw5Y4wxj8fDbDYbu3btmqJcPLXk7LOA+vp6Vlxc/MHP5T6WPCKlr8erx5uL+lperneFqq/1ykcJ\nP71ej9OnT2P9+vXw+XzYvXs3MjIyUF1dDQDYt28fioqKYLfbkZ6ejri4OJw7d05xrYsXL+LMmTPQ\n6/WIjY1FTU1N0FplZWW4desWnj59CoPBgCNHjsDr9crOxFOLNxMA3LlzBxcuXEBWVhYEQQAAVFVV\n4fHjx7Kz8dTizdbd3Y3Kykr4/X74/X6Ul5dj7dq1ih5Hnlpy9tm7Am+ZleSSIxL6mqceby7qa+33\nNa1lRAghBAB9U5kQQsggGgiEEEIA0EAghBAyiAYCIYQQADQQCCGEDKKBQAghBADwfwJyXZ807NQ0\nAAAAAElFTkSuQmCC\n" + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.9,Page Number: 190

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "R_E=10.0**3; #emitter resistance\n", + "R_L=10.0**3; #resistance in ohm\n", + "R1=18.0*10**3; #R1 in ohm\n", + "R2=18.0*10**3; #R2 in ohm\n", + "B_ac=175.0; #AC value\n", + "V_CC=10.0; #voltage in volt\n", + "V_BE=0.7; #base-emitter voltage\n", + "V_in=1.0; #input voltage in volt\n", + "\n", + "#calculation\n", + "\n", + "R_e=(R_E*R_L)/(R_E+R_L); #ac emitter resistance R_e\n", + "R_in_base=B_ac*R_e; #resistance from base R_in_base\n", + "\n", + "#total input resiatance R_in_tot\n", + "R_in_tot=(R1*R2*R_in_base)/(R1*R2+R1*R_in_base+R2*R_in_base);\n", + "print \"total input resistance = %.2f ohms\" %R_in_tot\n", + "V_E=((R2/(R1+R2))*V_CC)-V_BE; #emitter voltage\n", + "I_E=V_E/R_E; #emitter current\n", + "r_e=25.0*10**-3/I_E; #emitter resistance\n", + "A_v=R_e/(r_e+R_e);\n", + "print \"voltage gain = %.2f\" %A_v\n", + "#ac emitter current I_e\n", + "#V_e=A_v*V_b=1V\n", + "V_e=1.0; #V_evoltage\n", + "I_e=V_e/R_e; #emitter current\n", + "I_in=V_in/R_in_tot; #input current in ampere\n", + "A_i=I_e/I_in; #current gain\n", + "print \"current gain = %.2f\" %A_i\n", + "A_p=A_i; #power gain\n", + "#since R_L=R_E, one half of the total power is disspated to R_L\n", + "A_p_load=A_p/2.0; #power load\n", + "print \"power gain delivered to load = %.2f\" %A_p_load" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "total input resistance = 8160.62 ohms\n", + "voltage gain = 0.99\n", + "current gain = 16.32\n", + "power gain delivered to load = 8.16" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.10, Page Number: 193

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "V_CC=12.0; #source voltage in volt\n", + "V_BE=0.7; #base-emitter volatge\n", + "R_C=1.0*10**3; #resistance in ohm\n", + "r_e_ce=5.0; #for common emitter amplifier\n", + "R1=10.0*10**3; #resistance in ohm\n", + "R2=22.0*10**3; #resistance in ohm \n", + "R_E=22.0; #emitter resistance in ohm\n", + "R_L=8.0; #load resistance in ohm\n", + "B_DC=100.0; #dc value\n", + "B_ac=100.0; #ac value\n", + "\n", + "#calculation\n", + "pt=R2+B_DC**2*R_E #temp variable\n", + "V_B=((R2*B_DC**2*R_E/(pt))/(R1+(R2*B_DC**2*R_E/(pt))))*V_CC;\n", + "V_E=V_B-2.0*V_BE; #emitter voltage\n", + "I_E=V_E/R_E; #emitter current\n", + "r_e=25.0*10**-3/I_E; #for darlington emitter-follower\n", + "P_R_E=I_E**2*R_E; #power dissipated by R_E\n", + "P_Q2=(V_CC-V_E)*I_E #power dissipated by transistor Q2\n", + "R_e=R_E*R_L/(R_E+R_L); #ac emitter resi. of darlington emitter follower\n", + "#total input resistance of darlington\n", + "kt=R_e+r_e #temp varaible\n", + "R_in_tot=R1*R2*B_ac**2*(kt)/(R1*R2+R1*B_ac**2*(kt)+R2*B_ac**2*(kt)); \n", + "R_c=R_C*R_in_tot/(R_C+R_in_tot); #effective ac resistance\n", + "A_v_CE=R_c/r_e_ce; #voltage gain of common emitter\n", + "A_v_EF=R_e/(r_e+R_e); #voltage gain of common emitter amplifier\n", + "A_v=A_v_CE*A_v_EF; #overall voltage gain\n", + "\n", + "#result\n", + "print \"voltage gain of common emitter amplifier= %.2f\" %A_v_CE\n", + "print \"voltage gain of common emitter amplifier= %.2f\" %A_v_EF\n", + "print \"overall voltage gain = %.2f\" %A_v" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "voltage gain of common emitter amplifier= 172.08\n", + "voltage gain of common emitter amplifier= 0.99\n", + "overall voltage gain = 169.67" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.11, Page Number: 196

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "B_DC=250.0; #dc value\n", + "R_C=2.2*10**3; #resistance in ohm\n", + "R_E=1.0*10**3; #emitter resistance\n", + "R_L=10.0*10**3;#load resistance\n", + "R1=56.0*10**3; #resistance in ohm\n", + "R2=12.0*10**3; #resistance in ohm\n", + "V_BE=0.7; #base-emitter voltage in volt\n", + "V_CC=10.0; #source voltage in volt\n", + "\n", + "#calculation\n", + "#since B_DC*R_E>>R2\n", + "V_B=(R2/(R1+R2))*V_CC;\n", + "V_E=V_B-V_BE; #emiiter voltage\n", + "I_E=V_E/R_E; #emitter current\n", + "r_e=25.0*10**-3/I_E; #r_e value\n", + "R_in=r_e; #input resistance\n", + "R_c=R_C*R_L/(R_C+R_L); #ac collector resistance\n", + "A_v=R_c/r_e; #current gain\n", + "#current gain is almost 1\n", + "#power gain is approximately equal to voltage gain\n", + "A_p=A_v; #power gain\n", + "A_i=1; #current gain\n", + "\n", + "#result\n", + "print \"input resistance = %.2f ohms\" %R_in\n", + "print \"voltage gain = %.2f\" %A_v\n", + "print \"current gain = %.2f\" %A_i\n", + "print \"power gain = %.2f\" %A_p" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "input resistance = 23.48 ohms\n", + "voltage gain = 76.80\n", + "current gain = 1.00\n", + "power gain = 76.80" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.12, Page Number: 197

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "# variable declaration\n", + "A_v1=10.0;\n", + "A_v2=15.0;\n", + "A_v3=20.0;\n", + "\n", + "#calcultion\n", + "A_v=A_v1*A_v2*A_v3; #overall voltage gain\n", + "A_v1_dB=20.0*math.log10(A_v1); #gain in decibel\n", + "A_v2_dB=20.0*math.log10(A_v2); #gain in decibel\n", + "A_v3_dB=20.0*math.log10(A_v3); #gain in decibel\n", + "A_v_dB=A_v1_dB+A_v2_dB+A_v3_dB; #total gain in decibel\n", + "\n", + "#result\n", + "print \"overall voltage gain = %.1f\" %A_v\n", + "print \"Av1 = %.1f dB\" %A_v1_dB\n", + "print \"Av2 = %.1f dB\" %A_v2_dB\n", + "print \"Av3 = %.1f dB\" %A_v3_dB\n", + "print \"total voltage gain =%.1f dB\" %A_v_dB" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "overall voltage gain = 3000.0\n", + "Av1 = 20.0 dB\n", + "Av2 = 23.5 dB\n", + "Av3 = 26.0 dB\n", + "total voltage gain =69.5 dB" + ] + } + ], + "prompt_number": 13 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/.ipynb_checkpoints/Chapter7-checkpoint.ipynb b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/.ipynb_checkpoints/Chapter7-checkpoint.ipynb new file mode 100644 index 00000000..f0b687da --- /dev/null +++ b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/.ipynb_checkpoints/Chapter7-checkpoint.ipynb @@ -0,0 +1,763 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:c434c0d6bd002c83e25d1e202a9fcaade1263c70fe4310df9047177e37999c7b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 7: Field-effect Transistors (FETs)

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.1, Page Number: 217

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "%pylab inline" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].\n", + "For more information, type 'help(pylab)'." + ] + } + ], + "prompt_number": 318 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "V_GS_off=-4; # voltage in volt\n", + "I_DSS=12*10**-3; # current in ampere\n", + "R_D=560; # resistance in ohm\n", + "\n", + "#calculation\n", + "V_P=-1*V_GS_off; # volt \n", + "V_DS=V_P; # Vds in volt\n", + "I_D=I_DSS; # current accross resistor\n", + "V_R_D=I_D*R_D; #voltage across resistor\n", + "V_DD=V_DS+V_R_D; # Vdd in volt\n", + "\n", + "# result\n", + "print \"The value of V_DD required to put the device in the constant\"\n", + "print \" current area of operation of JFET = %.2f volt\" %V_DD" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The value of V_DD required to put the device in the constant\n", + " current area of operation of JFET = 10.72 volt" + ] + } + ], + "prompt_number": 319 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.2, Page Number: 218

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print('The p-channel JFET requires a positive gate to source voltage.')\n", + "print('The more positive the voltage, the lesser the drain current.')\n", + "print('Any further increase in V_GS keeps the JFET cut off, so I_D remains 0')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The p-channel JFET requires a positive gate to source voltage.\n", + "The more positive the voltage, the lesser the drain current.\n", + "Any further increase in V_GS keeps the JFET cut off, so I_D remains 0" + ] + } + ], + "prompt_number": 320 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.3, Page number: 219

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "I_DSS=9.0*10**-3;\n", + "V_GS_off=-8.0;\n", + "V_GS=0.0;\n", + "I_D=9.0*10**-3\n", + "I_D=I_DSS*(1-(V_GS/V_GS_off))**2;\n", + "print('Value of I_D for V_GS=0V is %f A '%I_D)\n", + "V_GS=-1.0\n", + "I_D=I_DSS*(1-(V_GS/V_GS_off))**2;\n", + "print('Value of I_D for V_GS=-1V is %f A'%I_D)\n", + "V_GS= -4.0\n", + "I_D=I_DSS*(1-(V_GS/V_GS_off))**2;\n", + "print('Value of I_D for V_GS=-4V is %f A'%I_D)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of I_D for V_GS=0V is 0.009000 A \n", + "Value of I_D for V_GS=-1V is 0.006891 A\n", + "Value of I_D for V_GS=-4V is 0.002250 A" + ] + } + ], + "prompt_number": 321 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.4, Page Number: 220

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable Declaration\n", + "I_DSS=3.0*10**-3;\n", + "V_GS_off=-6.0;\n", + "y_fs_max=5000.0*10**-6;\n", + "V_GS=-4.0;\n", + "g_m0=y_fs_max;\n", + "\n", + "#Calculation\n", + "g_m=g_m0*(1-(V_GS/V_GS_off));\n", + "I_D=I_DSS*(1-(V_GS/V_GS_off))\n", + "\n", + "#Result\n", + "print('forward transconductance = %f Siemens'%g_m)\n", + "print('value of I D = %f A'%I_D)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "forward transconductance = 0.001667 Siemens\n", + "value of I D = 0.001000 A" + ] + } + ], + "prompt_number": 322 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.5, Page Number: 221

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "V_GS=-20.0; # voltage in volt\n", + "I_GSS=-2*10**-9; # current in ampere\n", + "\n", + "#calculation\n", + "R_IN1=abs((-20/(2*10**-9))) # resistance in ohm\n", + "R_IN=R_IN1/(10**9)\n", + "\n", + "# result\n", + "print \"Input resistance = %d Giga ohm\" %R_IN" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Input resistance = 10 Giga ohm" + ] + } + ], + "prompt_number": 323 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.6, Page Number: 223

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "V_DD=15; # voltage in volt\n", + "V_G=0; # voltage in volt\n", + "I_D=5*10**-3; # current in ampere\n", + "R_D=1*10**3; # resistance in ohm\n", + "R_G=10*10**6; # resistance in ohm\n", + "R_S=220; # resistance in ohm\n", + "\n", + "# calculation\n", + "V_S=I_D*R_S; # source voltage in volt\n", + "V_D=V_DD-I_D*R_D; # drain voltage in volt\n", + "V_DS=V_D-V_S; # drain to source voltage in volt\n", + "V_GS=V_G-V_S; # gate to source voltage in volt\n", + "\n", + "# result\n", + "print \"Drain to source voltage = %.2f volts\" %V_DS\n", + "print \"Gate to source voltage = %.2f volts\" %V_GS" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Drain to source voltage = 8.90 volts\n", + "Gate to source voltage = -1.10 volts" + ] + } + ], + "prompt_number": 324 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.7, Page Number: 224

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# variable declaration\n", + "V_GS=-5.0; # voltage in volt\n", + "I_D=6.25*10**-3; # current in ampere\n", + "\n", + "#calculation\n", + "R_G=abs((V_GS/I_D)) # resistance in ohm\n", + "\n", + "# result\n", + "print \"Gate resistance = %d ohm\" %R_G" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Gate resistance = 800 ohm" + ] + } + ], + "prompt_number": 325 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.8, Page Number: 224

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "I_DSS=25.0*10**-3;\n", + "V_GS_off=15.0;\n", + "V_GS=5.0;\n", + "I_D=I_DSS*(1-(V_GS/V_GS_off))**2\n", + "R_S=abs((V_GS/I_D))\n", + "print('Drain current = %f Amperes'%I_D)\n", + "print('Source resistance = %.0f Ohms'%R_S)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Drain current = 0.011111 Amperes\n", + "Source resistance = 450 Ohms" + ] + } + ], + "prompt_number": 326 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.9, Page Number: 225

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# variable declaration\n", + "V_D=6; # drain voltage in volt\n", + "V_GS_off=-3; # off voltage in volt\n", + "V_DD=12; # voltage in volt\n", + "I_DSS=12*10**-3; # current in ampere\n", + "\n", + "#calculation\n", + "I_D=I_DSS/2; #MIDPOINT BIAS\n", + "V_GS=V_GS_off/3.4; #MIDPOINT BIAS\n", + "R_S=abs((V_GS/I_D)) #resistance i voltage\n", + "R_D=(V_DD-V_D)/I_D #resistance in voltage \n", + "\n", + "# result\n", + "print \"Source resistance = %.2f ohm\" %R_S\n", + "print \"Drain resistance = %d ohm\" %R_D" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Source resistance = 147.06 ohm\n", + "Drain resistance = 1000 ohm" + ] + } + ], + "prompt_number": 327 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.10, Page Number: 227

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import pylab\n", + "import numpy\n", + "\n", + "# variable declaration\n", + "R_S=680.0; # resistance in ohm\n", + "I_D=0; # current in ampere\n", + "\n", + "#calculation\n", + "V_GS=I_D*R_S; #FOR I_D=0A\n", + "\n", + "I_DSS=4*10**-3; # current in ampere\n", + "I_D=I_DSS; # currents are equal\n", + "V_GS1=-1*I_D*R_S; #FOR I_D=4mA\n", + "\n", + "# result\n", + "print \"V_GS at I_D=0amp is %d volt\" %V_GS\n", + "print \"V_GS at I_D=4mA is %.2f volt\" %V_GS1\n", + "print \"Plotting load line using the values of V_GS at I_D=0 and 4mA,\"\n", + "print \" we find the intersection of load line with transfer characteristic\"\n", + "print \" to get Q-point values of V_GS=-1.5V and I_D=2.25mA\"\n", + "\n", + "#########PLOT######################\n", + "idss=4\n", + "vgsoff=-6\n", + "vgs=arange(-6.0,0.0,0.0005)\n", + "idk=arange(0.0,4.0,0.0005)\n", + "ids=arange(0.0,2.25,0.0005)\n", + "vgsk=-idk*0.68\n", + "i_d=idss*(1-(vgs/vgsoff))**2\n", + "text(-3.00,2.25,'Q Point',size=13)\n", + "text(-3.25,2,'(-1.5V, 2.25mA)')\n", + "plot(vgs,i_d)\n", + "plot(vgsk,idk,'b')\n", + "plot(-1.5,2.25,'o')\n", + "ylim( (0,5) )\n", + "title('Transfer characteristic curve')\n", + "xlabel('Vgs')\n", + "ylabel('Idss')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "V_GS at I_D=0amp is 0 volt\n", + "V_GS at I_D=4mA is -2.72 volt\n", + "Plotting load line using the values of V_GS at I_D=0 and 4mA,\n", + " we find the intersection of load line with transfer characteristic\n", + " to get Q-point values of V_GS=-1.5V and I_D=2.25mA" + ] + }, + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 328, + "text": [ + "" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAXUAAAEXCAYAAABSwdSZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl8TNf7B/BPNqIVkVCxhSxoLGmEhqJqNPZ9J3ZCVVe6\nWaqkVW2/VBeKLr+gakmtRWypJagt9rWWZhNbkCCJJJLMnN8fp5kKWZmZO3Pn83695iVm7tz73Eue\nOXPuOeexEUIIEBGRKtgqHQARERkOkzoRkYowqRMRqQiTOhGRijCpExGpCJM6EZGKMKnTU0lMTMQr\nr7yCcuXK4cMPPzTqsTQaDUJDQ416DFP58ssvMXr06Cd6r5OTE+Li4gwbEKmGvdIB0JMrW7YsbGxs\nAAD379+Ho6Mj7OzsAAA///wzgoKCjB7Dzz//jEqVKiElJcXox7KxsdGfr5KGDx8Od3d3TJ8+/Yn3\nMWnSpGJtp9FoMGTIEAQHB+ufS01NfeLjkvoxqVuwtLQ0/c+enp4IDQ3Fq6+++th2OTk5sLc3zj91\nfHw86tat+0TvNWZcRdHpdLC1VeaLqlar1X/4FsUcPsQepuS/GRUPu19UKDIyEtWrV8fMmTNRpUoV\nBAcH4+7du+jSpQsqVaoEV1dXdO3aFVevXtW/R6PRYOrUqXj55ZdRrlw5tG/fHklJSQCAzMxMDB48\nGBUrVoSLiwuaNGmCmzdvYvjw4ViyZAlmzpwJJycn7Ny5E0I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mQ1Xn311TyTpgDgu+++wxtv\nvKFQRESGx6ROViMoKAhhYWF5nvv9998tckYlUUGY1Mlq9O7dG5s2bUJOTg4AIC4uDteuXUPz5s3x\nxhtvoG7dumjXrh06d+6MNWvWAAAmTpyI+vXrw8/PDx9++KGS4RMVi9HWfiEyN66urmjSpAk2b96M\nbt26ISwsDP3798fatWsRHx+Pv//+G4mJiahbty6Cg4ORlJSEP/74A+fPnwcApKSkKHwGREVjS52s\nysNdML///juCgoKwb98+9OvXDwDg5uaG1q1bAwDKly8PR0dHBAcHY926dShTpoxicRMVF5M6WZVu\n3bphx44dOH78ONLT0/XruuQ3sdrOzg5RUVHo06cPwsPD0aFDB1OHS1RiTOpkVcqWLYvWrVtjxIgR\n+hukLVq0wJo1ayCEQGJiIiIjIwEA9+/fx927d9GxY0d88803OHnypIKRExUP+9TJ6gQFBaFXr15Y\nuXIlAHkDdceOHahXrx7c3d3RqFEjODs7IzU1Fd27d0dmZiaEEPj2228VjpyoaFzQiwiyVf7ss88i\nKSkJTZs2xf79+1W1MiNZD7bUiQB06dIFd+/eRVZWFqZOncqEThaLLXUiIhXhjVIiIhVhUiciUhEm\ndSIiFWFSJyJSESZ1IiIVYVInIlKR/wdjx32hRVMVVQAAAABJRU5ErkJggg==\n" + } + ], + "prompt_number": 328 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.11, Page Number: 228

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "V_DD=12; # voltage in volt\n", + "V_D=7; # voltage in volt\n", + "R_D=3.3*10**3; # resistance in ohm\n", + "R_S=2.2*10**3; # resistance in ohm\n", + "R_1=6.8*10**6; # resistance in ohm\n", + "R_2=1*10**6; # resistance in ohm\n", + "\n", + "#calculation\n", + "I_D=(V_DD-V_D)/R_D; # drain current in ampere\n", + "V_S=I_D*R_S; # source voltage in volt\n", + "V_G=(R_2/(R_1+R_2))*V_DD; # gate voltage in volt\n", + "V_GS=V_G-V_S; # gate to source voltage in volt\n", + "\n", + "# result\n", + "print \"Drain Current = %.4f Ampere\" %I_D\n", + "print \"Gate to source voltage = %.4f volts\" %V_GS" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Drain Current = 0.0015 Ampere\n", + "Gate to source voltage = -1.7949 volts" + ] + } + ], + "prompt_number": 329 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.12, Page Number: 229

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# variable declaration\n", + "R_1=2.2*10**6; # resistance in ohm \n", + "R_2=R_1; # resistance in ohm\n", + "V_DD=8; # voltage in volt\n", + "R_S=3.3*10**3; # resistance in ohm\n", + "\n", + "#calculation\n", + "V_GS=(R_2/(R_1+R_2))*V_DD; #FOR I_D=0A\n", + "V_G=V_GS; # voltage in volt\n", + "I_D=(V_G-0)/R_S; #FOR V_GS=0V\n", + "\n", + "# result\n", + "print \"V_GS = %d volt\" %V_GS\n", + "print \"at V_GS=0V. I_D = %.4f ampere\" %I_D\n", + "print \"Plotting load line using the value of V_GS=4V at I_D=0\"\n", + "print \" and I_D=1.2mA at V_GS=0V, we find the intersection of\"\n", + "print \" load line with transfer characteristic to get Q-point\"\n", + "print \" values of V_GS=-1.8V and I_D=1.8mA\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "V_GS = 4 volt\n", + "at V_GS=0V. I_D = 0.0012 ampere\n", + "Plotting load line using the value of V_GS=4V at I_D=0\n", + " and I_D=1.2mA at V_GS=0V, we find the intersection of\n", + " load line with transfer characteristic to get Q-point\n", + " values of V_GS=-1.8V and I_D=1.8mA" + ] + } + ], + "prompt_number": 330 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.13, Page Number: 235

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "I_DSS=10.0*10**-3;\n", + "V_GS_off=-8.0;\n", + "V_GS=-3.0;\n", + "I_D=I_DSS*(1-(V_GS/V_GS_off))**2;\n", + "print('Drain current when V_GS=-3V is %f Amperes'%I_D)\n", + "V_GS=3;\n", + "I_D=I_DSS*(1-(V_GS/V_GS_off))**2;\n", + "print('Drain current when V_GS=3V is %f Amperes'%I_D)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Drain current when V_GS=-3V is 0.003906 Amperes\n", + "Drain current when V_GS=3V is 0.018906 Amperes" + ] + } + ], + "prompt_number": 331 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.14, Page Number: 236

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#variable Declaration\n", + "I_D_on=500.0*10**-3;\n", + "V_GS=10.0;\n", + "V_GS_th=1.0;\n", + "K=I_D_on/((V_GS-V_GS_th)**2)\n", + "V_GS=5.0;\n", + "I_D=K*(V_GS-V_GS_th)**2;\n", + "print('Drain current = %f A'%I_D)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Drain current = 0.098765 A" + ] + } + ], + "prompt_number": 332 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.15, Page Number: 237

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "I_DSS=12*10**-3; # currenin ampere\n", + "V_DD=18; # voltage in volt\n", + "R_D=620; # resistance in oh\n", + "\n", + "#calculation\n", + "I_D=I_DSS; # currents are equal\n", + "V_DS=V_DD-I_D*R_D; # drain to source voltage\n", + "\n", + "# result\n", + "print \"Drain to sorce voltage = %.2f volt\" %V_DS" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Drain to sorce voltage = 10.56 volt" + ] + } + ], + "prompt_number": 333 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.16, Page Number: 238

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#variable Declaration\n", + "I_D_on=200.0*10**-3;\n", + "V_DD=24.0;\n", + "R_D=200.0;\n", + "V_GS=4.0;\n", + "V_GS_th=2.0;\n", + "R_1=100.0*10**3;\n", + "R_2=15.0*10**3;\n", + "\n", + "#Calculation \n", + "K=I_D_on/((V_GS-V_GS_th)**2)\n", + "V_GS=(R_2/(R_1+R_2))*V_DD;\n", + "I_D=K*(V_GS-V_GS_th)**2;\n", + "V_DS=V_DD-I_D*R_D;\n", + "\n", + "#Result\n", + "print('Drain to Source voltage = %f V'%V_DS)\n", + "print('Gate to Source voltage = %f V'%V_GS)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Drain to Source voltage = 11.221172 V\n", + "Gate to Source voltage = 3.130435 V" + ] + } + ], + "prompt_number": 334 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.17, Page Number: 239

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "V_GS_on=3; # voltage in volt\n", + "V_GS=8.5 #voltage displayed on meter\n", + "V_DS=V_GS; # voltages are equal \n", + "V_DD=15; # voltage in volt\n", + "R_D=4.7*10**3; # resistance in ohm\n", + "\n", + "#calculation\n", + "I_D=(V_DD-V_DS)/R_D; # drain current\n", + "\n", + "# result\n", + "print \"Drain current = %.4f ampere\" %I_D" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Drain current = 0.0014 ampere" + ] + } + ], + "prompt_number": 335 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/.ipynb_checkpoints/Chapter8-checkpoint.ipynb b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/.ipynb_checkpoints/Chapter8-checkpoint.ipynb new file mode 100644 index 00000000..3323ea05 --- /dev/null +++ b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/.ipynb_checkpoints/Chapter8-checkpoint.ipynb @@ -0,0 +1,451 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:bace9e702292e3d3629b1af1b04f785ea7b14f0684491da077287b62be815475" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 8: FET Amplifiers

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.1, Page Number: 253

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# variable declaration\n", + "g_m=4.0*10**-3; #gm value\n", + "R_d=1.5*10**3; #resistance\n", + "\n", + "#calculation\n", + "A_v=g_m*R_d; #voltage gain\n", + "\n", + "#result\n", + "print \"Voltage gain = %.2f\" %A_v" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Voltage gain = 6.00" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.2, Page Number: 253

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "r_ds=10.0*10**3;\n", + "R_d=1.5*10**3; #from previous question\n", + "g_m=4.0*10**-3; #from previous question\n", + "\n", + "#calculation\n", + "A_v=g_m*((R_d*r_ds)/(R_d+r_ds)); #voltage gain\n", + "\n", + "#result\n", + "print \"Voltage gain = %.2f\" %A_v" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Voltage gain = 5.22" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.3, Page Number:254

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "R_s=560; #resistance in ohm\n", + "R_d=1.5*10**3; #resistance in ohm\n", + "g_m=4*10**-3; #g_m value\n", + "\n", + "#calculation\n", + "A_v=(g_m*R_d)/(1+(g_m*R_s)) #voltage gain\n", + "\n", + "#result\n", + "print \"Voltage gain = %.2f\" %A_v" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Voltage gain = 1.85" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.4, Page Number: 257

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable declaration\n", + "vdd=12.0 #volts\n", + "Id=1.96*10**-3 #Amp\n", + "Rd=3.3*10**3 #ohm\n", + "Idss=12.0*10**-3 #Amp\n", + "Rs=910 # Ohm\n", + "vgsoff= 3 #v\n", + "vin=0.1 #V\n", + "\n", + "#calculation\n", + "vd=vdd-(Id*Rd)\n", + "vgs=-Id*Rs\n", + "gm0=2*Idss/(abs(vgsoff))\n", + "gm=0.00325 #mS\n", + "vout=gm*Rd*vin\n", + "vout=vout*2*1.414\n", + "#Result\n", + "print\"Total output ac voltage(peak-to-peak) = %f V \\nridig on DC value of %fV \"%(vout,vd)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total output ac voltage(peak-to-peak) = 3.033030 V \n", + "ridig on DC value of 5.532000V " + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.5, Page Number: 258

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# variable declaration\n", + "R_D=3.3*10**3; #resistance in ohm\n", + "R_L=4.7*10**3; #load resistance in ohm\n", + "g_m=3.25*10**-3; #from previous question\n", + "V_in=100.0*10**-3; #previous question\n", + "\n", + "#calculation\n", + "R_d=(R_D*R_L)/(R_D+R_L); #Equivalent drain resistance\n", + "V_out=g_m*R_d*V_in; #output RMS voltage in volt\n", + "\n", + "#result\n", + "print \"Output voltage rms value = %.2f Volts\" %V_out" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Output voltage rms value = 0.63 Volts" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.6, Page Number: 259

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# variable declaration\n", + "I_GSS=30.0*10**-9; #current in ampere\n", + "V_GS=10.0; #ground-source voltage\n", + "R_G=10.0*10**6; #resistance in ohm\n", + "\n", + "#calculation\n", + "R_IN_gate=V_GS/I_GSS; #gate input resistance\n", + "R_in=(R_IN_gate*R_G)/(R_IN_gate+R_G); #parallel combination\n", + "\n", + "#result\n", + "print \"Input resistance as seen by signal source = %.2f ohm\" %R_in" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Input resistance as seen by signal source = 9708737.86 ohm" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.7, Page Number: 260

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "I_DSS=200.0*10**-3;\n", + "g_m=200.0*10**-3;\n", + "V_in=500.0*10**-3;\n", + "V_DD=15.0;\n", + "R_D=33.0;\n", + "R_L=8.2*10**3;\n", + "\n", + "#calculation\n", + "I_D=I_DSS; #Amplifier is zero biased\n", + "V_D=V_DD-I_D*R_D;\n", + "R_d=(R_D*R_L)/(R_D+R_L);\n", + "V_out=g_m*R_d*V_in;\n", + "\n", + "#result\n", + "print \"DC output voltage = %.2f Volts\" %V_D\n", + "print \"AC output voltage = %.2f volts\" %V_out" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "DC output voltage = 8.40 Volts\n", + "AC output voltage = 3.29 volts" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.8, Page Number: 262

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "print \"Part A:\\nQ point: V_GS=-2V I_D=2.5mA. At V_GS=-1V, I_D=3.4mA,\"\n", + "print \"At V_GS=-3V, I_D=1.8mA. So peak to peak drain current is\" \n", + "print \"the difference of the two drain currents=1.6mA\"\n", + "print \"\\nPart B:\\nQ point: V_GS=0V I_D=4mA. At V_GS=1V, I_D=5.3mA,\"\n", + "print \"At V_GS=-1V, I_D=2.5mA. So peak to peak drain current is\"\n", + "print\" the difference of the two drain currents=2.8mA\"\n", + "print \"\\nPart C:\\nQ point: V_GS=8V I_D=2.5mA. At V_GS=9V, I_D=3.9mA,\"\n", + "print \" At V_GS=7V, I_D=1.7mA. So peak to peak drain current is\"\n", + "print \" the difference of the two drain currents=2.2mA\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Part A:\n", + "Q point: V_GS=-2V I_D=2.5mA. At V_GS=-1V, I_D=3.4mA,\n", + "At V_GS=-3V, I_D=1.8mA. So peak to peak drain current is\n", + "the difference of the two drain currents=1.6mA\n", + "\n", + "Part B:\n", + "Q point: V_GS=0V I_D=4mA. At V_GS=1V, I_D=5.3mA,\n", + "At V_GS=-1V, I_D=2.5mA. So peak to peak drain current is\n", + " the difference of the two drain currents=2.8mA\n", + "\n", + "Part C:\n", + "Q point: V_GS=8V I_D=2.5mA. At V_GS=9V, I_D=3.9mA,\n", + " At V_GS=7V, I_D=1.7mA. So peak to peak drain current is\n", + " the difference of the two drain currents=2.2mA" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.9, Page Number:263

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "R_1=47.0*10**3;\n", + "R_2=8.2*10**3;\n", + "R_D=3.3*10**3;\n", + "R_L=33.0*10**3;\n", + "I_D_on=200.0*10**-3;\n", + "V_GS=4.0;\n", + "V_GS_th=2.0;\n", + "g_m=23*10**-3;\n", + "V_in=25*10**-3;\n", + "V_DD=15.0;\n", + "\n", + "#calculation\n", + "V_GSnew=(R_2/(R_1+R_2))*V_DD;\n", + "K=I_D_on/((V_GS-V_GS_th)**2)\n", + "#K=value_of_K(200*10**-3,4,2);\n", + "K=K*1000;\n", + "I_D=K*((V_GSnew-V_GS_th)**2);\n", + "V_DS=V_DD-I_D*R_D/1000;\n", + "R_d=(R_D*R_L)/(R_D+R_L);\n", + "V_out=g_m*V_in*R_d;\n", + "\n", + "#result\n", + "print \"Drain to source voltage = %.2f volts\" %V_GSnew\n", + "print \"Drain current = %.2f mA\" %I_D\n", + "print \"Gate to source voltage = %.2f volts\" %V_DS\n", + "print \"AC output voltage = %.2f volts\" %V_out\n", + "print \"Answer in textbook are approximated\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Drain to source voltage = 2.23 volts\n", + "Drain current = 2.61 mA\n", + "Gate to source voltage = 6.40 volts\n", + "AC output voltage = 1.72 volts\n", + "Answer in textbook are approximated" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.10, Page Number: 266

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "V_DD=-15.0; #p=channel MOSFET\n", + "g_m=2000.0*10**-6; #minimum value from datasheets\n", + "R_D=10.0*10**3;\n", + "R_L=10.0*10**3;\n", + "R_S=4.7*10**3;\n", + "\n", + "#calculation\n", + "R_d=(R_D*R_L)/(R_D+R_L); #effective drain resistance\n", + "A_v=g_m*R_d;\n", + "R_in_source=1.0/g_m;\n", + "#signal souce sees R_S in parallel with ip rest at source terminal(R_in_source)\n", + "R_in=(R_in_source*R_S)/(R_in_source+R_S); \n", + "\n", + "#result \n", + "print \"minimum voltage gain = %.2f\" %A_v\n", + "print \"Input resistance seen from signal source = %.2f ohms\" %R_in" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "minimum voltage gain = 10.00\n", + "Input resistance seen from signal source = 451.92 ohms" + ] + } + ], + "prompt_number": 10 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/.ipynb_checkpoints/Chapter9-checkpoint.ipynb b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/.ipynb_checkpoints/Chapter9-checkpoint.ipynb new file mode 100644 index 00000000..b8f59cd9 --- /dev/null +++ b/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/.ipynb_checkpoints/Chapter9-checkpoint.ipynb @@ -0,0 +1,397 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:bf976bdfa25f41760e88ac615da4c103297b4f982f43cc2fe70e30cc05e1865d" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 9: Power Amplifiers

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.1, Page Number: 280

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "V_CC=15.0; #supply voltage\n", + "R_C=1.0*10**3; #resistance in ohm\n", + "R_1=20.0*10**3; #resistance in ohm\n", + "R_2=5.1*10**3; #resistance in ohm\n", + "R_3=5.1*10**3; #resistance in ohm\n", + "R_4=15.0*10**3; #resistance in ohm\n", + "R_E_1=47.0; #resistance in ohm\n", + "R_E_2=330.0; #resistance in ohm\n", + "R_E_3=16.0; #resistance in ohm\n", + "R_L=16.0; #SPEAKER IS THE LOAD;\n", + "B_ac_Q1=200.0; #B_ac value\n", + "B_ac_Q2=B_ac_Q1; #B_ac value\n", + "B_ac_Q3=50.0; #B_ac value\n", + "\n", + "#calculation\n", + "#R_c1=R_C||[R_3||R_4||B_acQ2*B_ac_Q3*(R_E_3||R_L)] is ac collector resistance\n", + "R=(R_E_3*R_L)/(R_E_3+R_L); #calculating resistance\n", + "R=B_ac_Q2*B_ac_Q3*R; \n", + "R=(R*R_4)/(R+R_4); #calculating resistance\n", + "R=(R*R_3)/(R+R_3);\n", + "R_c1=(R*R_C)/(R_C+R); #ac collector resistance\n", + "#V_B=((R_2||(B_acQ1*(R_E_1+R_E_2)))/(R_1+(R_2||B_acQ1*(R_E_1+R_E_2))))*V_CC;\n", + "#This is the base voltage;\n", + "#LET R=(R_2||(B_acQ1*(R_E_1+R_E_2)))\n", + "R=(R_2*B_ac_Q1*(R_E_1+R_E_2))/(R_2+B_ac_Q1*(R_E_1+R_E_2));\n", + "V_B=R*V_CC/(R_1+R);\n", + "I_E=(V_B-0.7)/(R_E_1+R_E_2);\n", + "r_e_Q1=25.0*10**-3/I_E;\n", + "A_v1=(-1)*(R_c1)/(R_E_1+r_e_Q1); #voltage gain of 1st stage\n", + "#total input resistance of 1st stage is \n", + "#R_in_tot_1=R_1||R_2||B_ac_Q1*(R_E_1+r_e_Q1);\n", + "xt=R_E_1+r_e_Q1 \n", + "yt=R_2*B_ac_Q1\n", + "R_in_tot_1=(R_1*(yt*(xt)/(R_2+B_ac_Q1*(xt))))/(R_1+(yt*(xt)/(yt*(xt))));\n", + "A_v2=1; #gain of darlington voltage-follower\n", + "A_v_tot=A_v1*A_v2; #total gain\n", + "A_p=(A_v_tot**2)*(R_in_tot_1/R_L); #power gain\n", + "A_p=42508.68\n", + "\n", + "#result\n", + "print \"Voltage gain= %.2f\" %A_v_tot\n", + "print \"Power gain= %.2f\" %A_p" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Voltage gain= -15.29\n", + "Power gain= 42508.68" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.2, Page Number: 281

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# variable declaration\n", + "V_in=176.0*10**-3;\n", + "R_in=2.9*10**3; #total input resistance from previous question\n", + "A_p=42429.0; #power gain from previous question\n", + "V_CC=15.0;\n", + "I_CC=0.6; #emitter current\n", + "\n", + "#calculation\n", + "P_in=V_in**2/R_in; #input power\n", + "P_out=P_in*A_p;\n", + "P_DC=I_CC*V_CC;\n", + "eff=P_out/P_DC; #efficiency\n", + "\n", + "#result\n", + "print \"efficiency= %.2f\" %eff" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "efficiency= 0.05" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.3, Page Number: 287

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# variable declaration\n", + "V_CC=20.00; #supply voltage\n", + "R_L=16.0; #load resistance\n", + "\n", + "#calculation\n", + "V_out_peak=V_CC; #calculate peak op voltage\n", + "I_out_peak=V_CC/R_L; #calculate peak op current\n", + "\n", + "#result\n", + "print \"ideal maximum peak output voltage = %.2f volts\" %V_out_peak\n", + "print \"ideal maximum current =%.2f amperes\" %I_out_peak" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "ideal maximum peak output voltage = 20.00 volts\n", + "ideal maximum current =1.25 amperes" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.4, Page Number: 288

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# variable declaration\n", + "V_CC=20.0; #supply volatge\n", + "R_L=16.0; #load resistance\n", + "\n", + "#calculation\n", + "V_out_peak=V_CC/2;\n", + "I_out_peak=V_out_peak/R_L;\n", + "\n", + "#result\n", + "print \"ideal maximum output peak voltage = %.2f volts\" %V_out_peak\n", + "print \"ideal maximum current = %.2f amperes\" %I_out_peak" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "ideal maximum output peak voltage = 10.00 volts\n", + "ideal maximum current = 0.62 amperes" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.5, Page Number: 290

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "# variable declaration\n", + "V_CC=20.0; #supply voltage\n", + "R_L=8.0; #load resistance\n", + "B_ac=50.0; #B_ac value\n", + "r_e=6.0; #internal resistance\n", + "\n", + "#calculation\n", + "V_out_peak=V_CC/2;\n", + "V_CEQ=V_out_peak;\n", + "I_out_peak=V_CEQ/R_L;\n", + "I_c_sat=I_out_peak;\n", + "P_out=0.25*I_c_sat*V_CC;\n", + "P_DC=(I_c_sat*V_CC)/math.pi;\n", + "R_in=B_ac*(r_e+R_L);\n", + "\n", + "#result\n", + "print \"maximum ac output power = %.2f Watts\" %P_out\n", + "print \"maximum DC output power = %.2f Watts\" %P_DC\n", + "print \"input resistance = %.2f ohms\" %R_in" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "maximum ac output power = 6.25 Watts\n", + "maximum DC output power = 7.96 Watts\n", + "input resistance = 700.00 ohms" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.6, Page Number: 292

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "# variable declaration\n", + "V_DD=24.0;\n", + "V_in=100*10**-3; #ip volatge\n", + "R1=440.0; #resistance in ohm\n", + "R2=5.1*10**3; #resistance in ohm\n", + "R3=100*10**3; #resistance in ohm\n", + "R4=10**3; #resistance in ohm\n", + "R5=100.0; #resistance in ohm\n", + "R7=15*10**3; #resistance in ohm\n", + "R_L=33.0; #load resistance in ohm\n", + "V_TH_Q1=2.0; # V-TH value\n", + "V_TH_Q2=-2.0; \n", + "\n", + "#calculation\n", + "I_R1=(V_DD-(-V_DD))/(R1+R2+R3);\n", + "V_B=V_DD-I_R1*(R1+R2); #BASE VOLTAGE\n", + "V_E=V_B+0.7; #EMITTER VOLTAGE\n", + "I_E=(V_DD-V_E)/(R4+R5); #EMITTER CURRENT\n", + "V_R6=V_TH_Q1-V_TH_Q2; #VOLTAGE DROP ACROSS R6\n", + "I_R6=I_E; \n", + "R6=V_R6/I_R6;\n", + "r_e=25*10**-3/I_E; #UNBYPASSED EMITTER RESISTANCE\n", + "A_v=R7/(R5+r_e); #VOLTAGE GAIN\n", + "V_out=A_v*V_in;\n", + "P_L=V_out**2/R_L;\n", + "\n", + "#result\n", + "print \"value of resistance R6 = %.2d ohms for AB operation\" %R6\n", + "print \"power across load = %.2f watts\"%P_L " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "value of resistance R6 = 2418 ohms for AB operation\n", + "power across load = 5.15 watts" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.7, Page Number:295

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "# variable declaration\n", + "f=200.0*10**3; #frequency in hertz\n", + "I_c_sat=100.0*10**-3; #saturation current\n", + "V_ce_sat=0.2; #sat voltage\n", + "t_on=1.0*10**-6; #on time\n", + "\n", + "#calculation\n", + "T=1/f; #time period of signal\n", + "P_D_avg=(t_on/T)*I_c_sat*V_ce_sat; #power dissipation\n", + "\n", + "#result\n", + "print \"average power dissipation =%.3f Watts\" %P_D_avg" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "average power dissipation =0.004 Watts" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.8, Page Number: 298

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "# variable declaration\n", + "P_D_avg=4.0*10**-3; #power dissipation\n", + "V_CC=24.0; #supply voltage\n", + "R_c=100.0; #resistance in ohm\n", + "\n", + "#calculation\n", + "P_out=(0.5*V_CC**2)/R_c; #output power\n", + "n=(P_out)/(P_out+P_D_avg); #n is efficiency\n", + "\n", + "#result\n", + "print \"efficiency=%.4f\" %n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "efficiency=0.9986" + ] + } + ], + "prompt_number": 8 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch1-checkpoint.ipynb b/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch1-checkpoint.ipynb new file mode 100644 index 00000000..468c5738 --- /dev/null +++ b/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch1-checkpoint.ipynb @@ -0,0 +1,604 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:0059190c3ee26fe93a1d293531a49cd3a6e92d5339c0638feafb8d9d1d250c2e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 1 : Pipe Flow of Liquids" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "\n", + "example 1.1 page no : 1" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "mu = 6.3/100; #viscosity\n", + "rho = 1170.; #density\n", + "d = .3; #diameter of pipe\n", + "b = 0.142; #conversion factor\n", + "pi=3.14;\n", + "\n", + "#calculation\n", + "Q = 150000.*b/24./3600 #flow rate\n", + "u = Q/pi/d**2.*4 #flow speed\n", + "Re = rho*u*d/mu\n", + "if Re>4000:\n", + " print \"the system is in turbulent motion as reynolds no is greater than 4000: %.3f\"%Re\n", + "elif Re<2100 :\n", + " print \"the system is in laminar motion\" ,Re\n", + "else:\n", + " print \"the system is in transition motion\",Re\n", + "\n", + "mu = 5.29/1000;\n", + "d = 0.06;\n", + "G = 0.32; #mass flow rate\n", + "Re = 4*G/pi/d/mu;\n", + "\n", + "if Re>4000 :\n", + " print \"the system is in turbulent motion as reynolds no is greater than 4000: \",Re\n", + "elif Re<2100 :\n", + " print \"the system is in laminar motion as Re is less than 2100 : %.3f\" %Re\n", + "else:\n", + " print \"the system is in transition motion\",Re\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the system is in turbulent motion as reynolds no is greater than 4000: 19441.074\n", + "the system is in laminar motion as Re is less than 2100 : 1284.320\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "\n", + "example 1.2 page no : 2" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "\n", + "# Initialization of Variable\n", + "G=21.2; #mass flow rate\n", + "rho=1120; #density\n", + "d=0.075; #diameter\n", + "l=50.;\n", + "g=9.81;\n", + "pi=3.14;\n", + "delz=24./100; #head difference\n", + "\n", + "#calculation\n", + "delP=delz*rho*g; #differece of pressure\n", + "u=4*G/pi/d**2/rho;\n", + "phi=delP/rho*d/l/u**2./4*50;\n", + "print \"The Stanton-Pannel friction factor per unit of length: %f\"%phi\n", + "R=phi*rho*u**2;\n", + "print \"shear stress exerted by liquid on the pipe wall in (N/m**2) : %.3f\"% R\n", + "F=pi*d*l*R;\n", + "print \"Total shear force exerted on the pipe in (N): %.3f\"%F\n", + "Re=(.0396/phi)**4;#reynold's no.\n", + "mu=rho*u*d/Re;\n", + "print \"viscosity of liquid in (kg/m/s):%f\" %mu\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Stanton-Pannel friction factor per unit of length: 0.002402\n", + "shear stress exerted by liquid on the pipe wall in (N/m**2) : 49.442\n", + "Total shear force exerted on the pipe in (N): 582.184\n", + "viscosity of liquid in (kg/m/s):0.004877\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 1.3 page no : 4" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "pi=3.14;\n", + "g=9.81;\n", + "d=0.00125;\n", + "Re=2100;\n", + "l=0.035;\n", + "rhoc=779. #density of cyclohexane\n", + "rhow=999. #density of water\n", + "muc=1.02/1000; #viscosity of cyclo hexane\n", + "\n", + "#calculation\n", + "u=Re*muc/rhoc/d; #speed\n", + "Q=pi*d**2*u/4; #volumetric flow rate\n", + "delP=32*muc*u*l/d**2;#pressure difference\n", + "delz=delP/(rhow-rhoc)/g;\n", + "print \"the difference between the rise levels of manometer in (cm): %.4f\"%(delz*100 )\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the difference between the rise levels of manometer in (cm): 74.5210\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "\n", + "example 1.4 page no : 6" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "d=0.05;\n", + "l=12.;\n", + "per=100.-2;\n", + "pi=3.1428\n", + "\n", + "#calculation\n", + "s=math.sqrt(per/100/4*d**2);#radius of core of pure material\n", + "V=pi*d**2./4.*l/(2.*(1-(2.*s)**2/d**2));\n", + "print \"The volume of pure material so that 2%% technical material appears at the end in (m**3): %.3f\"%V\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The volume of pure material so that 2% technical material appears at the end in (m**3): 0.589\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 1.5 page no : 7" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "\n", + "# Initialization of Variable\n", + "\n", + "a=1./2*(1-1/math.sqrt(2.));\n", + "print \"The percent value of d for which where pitot tube is kept show average velocity \\\n", + "in streamline flow in (%%) : %.4f\"%(a*100)\n", + "\n", + "a=(49./60)**7/2.\n", + "print \"The percent value of d for which where pitot tube is kept show average velocity in \\\n", + "turbulent flow in (%%) : %.4f\"%(a*100)\n", + "\n", + "#on equating coefficient of r\n", + "y=a*2; #y=a/100*2*r\n", + "s=1-y; #s=r-y\n", + "\n", + "#on equating coeff. of 1/4/mu*del(P)/del(l)\n", + "E=(1-s**2-.5)/.5;\n", + "print \"The error shown by pitot tube at new position if value of streamlined flow flow was\\\n", + "to be obtained in (%%) : %.4f\"%E\n", + "print \"The - sign indicates that it will print lay reduced velocity than what actually is\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The percent value of d for which where pitot tube is kept show average velocity in streamline flow in (%) : 14.6447\n", + "The percent value of d for which where pitot tube is kept show average velocity in turbulent flow in (%) : 12.1139\n", + "The error shown by pitot tube at new position if value of streamlined flow flow wasto be obtained in (%) : -0.1483\n", + "The - sign indicates that it will print lay reduced velocity than what actually is\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "\n", + "example 1.6 page no : 9" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Initialization of Variable\n", + "rhon = 1068. #density of nitric acid\n", + "mun = 1.06/1000. #viscosity of nitric acid\n", + "g = 9.81\n", + "l = 278.\n", + "d = 0.032\n", + "alpha = 1.\n", + "h2 = 57.4 #height to be raised\n", + "h1 = 5. #height from which to be raised\n", + "e = .0035/1000. #roughness\n", + "G = 2.35 #mass flow rate\n", + "pi = 3.14\n", + "#calculations\n", + "#part 1\n", + "u = 4.*G/rhon/pi/d**2\n", + "Re = rhon*d*u/mun\n", + "rr = e/d #relative roughness\n", + "\n", + "#Reading's from Moody's Chart\n", + "phi = .00225 #friction coeff.\n", + "W = u**2/2.+g*(h2-h1)+4*phi*l*u**2/d #The work done/kg of fluid flow in J/kg\n", + "V = abs(W)*G\n", + "print \"The Power required to pump acid in kW : %.4f\"%(abs(V)/1000)\n", + "\n", + "#part 2\n", + "P2 = -u**2*rhon/2.+g*(h1)*rhon+abs(W+2)*rhon\n", + "print \"The gauge pressure at pump outlet when piping is new in (kPa) : %.4f\"%(P2/1000)\n", + "\n", + "#part 3\n", + "e = .05/1000\n", + "Re = rhon*d*u/mun\n", + "rr = e/d\n", + "\n", + "#Reading's from Moody's Chart\n", + "phi = 0.0029\n", + "W = u**2/2+g*(h2-h1)+4*phi*l*u**2/d\n", + "Vnew = abs(W)*G\n", + "Pi = (Vnew-V)/V*100.\n", + "print \"The increase in power required to transfer in old pipe in (%%): %.4f\"%Pi\n", + "\n", + "#part 4\n", + "P2 = -u**2*rhon/2+g*(h1)*rhon+abs(W+2)*rhon\n", + "print \"The gauge pressure at pump outlet when piping is old in (kPa) :%.4f\"%(P2/1000)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Power required to pump acid in kW : 2.5936\n", + "The gauge pressure at pump outlet when piping is new in (kPa) : 1229.2152\n", + "The increase in power required to transfer in old pipe in (%): 15.3353\n", + "The gauge pressure at pump outlet when piping is old in (kPa) :1409.9715\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 1.7 page no : 12" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "rho=990.;\n", + "mu=5.88/10000;\n", + "g=9.81;\n", + "pi=3.14;\n", + "temp=46.+273\n", + "e=1.8/10000 #absolute roughness\n", + "Q=4800./1000./3600;\n", + "l=155.;\n", + "h=10.5;\n", + "d=0.038;\n", + "delh=1.54 #head loss at heat exchanger\n", + "effi=0.6 #efficiency\n", + "\n", + "#calculations\n", + "\n", + "u=Q*4./pi/d**2;\n", + "Re=rho*d*u/mu;\n", + "rr=e/d #relative roughness\n", + "\n", + "#from moody's diagram\n", + "phi=0.0038 #friction factor\n", + "alpha=1. #constant\n", + "leff=l+h+200*d+90*d;\n", + "Phe=g*delh #pressure head lost at heat exchanger\n", + "W=u**2/2/alpha+Phe+g*h+4*phi*leff*u**2/d; #work done by pump\n", + "G=Q*rho; #mass flow rate\n", + "P=W*G; #power required by pump\n", + "Pd=P/effi #power required to drive pump\n", + "print \"power required to drive pump in (kW) : %.4f\"%(Pd/1000)\n", + "\n", + "P2=(-u**2/2/alpha+W)*rho;\n", + "print \"The gauge pressure in (kPa): %.4f\"%(P2/1000)\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "power required to drive pump in (kW) : 0.4763\n", + "The gauge pressure in (kPa): 213.6461\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 1.8 page no : 15" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "rho=908.;\n", + "mu=3.9/100;\n", + "g=9.81;\n", + "pi=3.14;\n", + "d=0.105;\n", + "l=87.;\n", + "h=16.8;\n", + "e=0.046/1000; #absolute roughness\n", + "\n", + "#calculations\n", + "\n", + "#part1\n", + "P=-rho*g*h; #change in pressure\n", + "a=-P*rho*d**3/4/l/mu**2 #a=phi*Re**2\n", + "\n", + "#using graph given in book(appendix)\n", + "Re=8000.\n", + "u=mu*Re/rho/d\n", + "Q=u*pi*d**2/4.\n", + "print \"Volumetric flow rate initial (m**3/s): %.4f\"%Q\n", + "\n", + "#part 2\n", + "W=320.;\n", + "Pd=W*rho; #pressure drop by pump\n", + "P=P-Pd;\n", + "a=-P*rho*d**3./4./l/mu**2 #a=phi*Re**2\n", + "\n", + "#using graph given in book(appendix)\n", + "Re=15000.;\n", + "u=mu*Re/rho/d;\n", + "Q=u*pi*d**2./4;\n", + "print \"Volumetric flow rate final(part 2) (m**3/s) : %.4f\"%Q\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Volumetric flow rate initial (m**3/s): 0.0283\n", + "Volumetric flow rate final(part 2) (m**3/s) : 0.0531\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 1.9 pageno : 17" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "from numpy import linspace\n", + "# Initialization of Variable\n", + "rho=1000.;\n", + "mu=1.25/1000;\n", + "g=9.81;\n", + "pi=3.14\n", + "d = 0.105\n", + "d1=0.28; #diameter of tank\n", + "d2=0.0042; #diameter of pipe\n", + "l=0.52; #length of pipe\n", + "rr=1.2/1000./d; #relative roughness\n", + "phid=0.00475;\n", + "print \"It is derived from tyhe graph giben in appedix and can be seen \\\n", + "is arying b/w 0.0047 & 0.0048 dependent on D which varies from 0.25 to 0.45 : %f\"%phid\n", + "\n", + "#calculations\n", + "def intregrate():\n", + " s=0\n", + " for i in range(0,1000):\n", + " D=linspace(0.25,0.45,1000);\n", + " y=math.sqrt(((pi*d1**2./pi/d2**2)**2-1)/2/9.81+(4*phid*l*(pi*d1**2/pi \\\n", + " /d2**2)**2)/d2/9.81)*((0.52+D[i])**-0.5)*2/10000;\n", + " s=s+y;\n", + " a=s;\n", + " return a\n", + "\n", + "b=intregrate();\n", + "print \"Time required to water level to fall in the tank in (s): %.4f\"%b\n", + "\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "It is derived from tyhe graph giben in appedix and can be seen is arying b/w 0.0047 & 0.0048 dependent on D which varies from 0.25 to 0.45 : 0.004750\n", + "Time required to water level to fall in the tank in (s): 514.7299\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 1.10 pageno : 21" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "rho=1000.;\n", + "mu=1.42/1000;\n", + "g=9.81;\n", + "pi=3.14;\n", + "l=485.;\n", + "h=4.5\n", + "e=8.2/100000;\n", + "Q=1500.*4.545/1000/3600;\n", + "\n", + "print \"assume d as 6cm\"\n", + "d=0.06;\n", + "u=4*Q/pi/d**2;\n", + "Re=rho*d*u/mu;\n", + "rr=e/d; #relative roughness\n", + "\n", + "#using moody's chart\n", + "phi=0.0033 #friction coeff.\n", + "d=(64*phi*l*Q**2/pi**2/g/h)**0.2;\n", + "print \"The calculated d after (1st iteration which is close to what we\\\n", + " assume so we do not do any more iteration) in(cm) %d \"%(d*100)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "assume d as 6cm\n", + "The calculated d after (1st iteration which is close to what we assume so we do not do any more iteration) in(cm) 6 \n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch10-checkpoint.ipynb b/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch10-checkpoint.ipynb new file mode 100644 index 00000000..b9f62b91 --- /dev/null +++ b/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch10-checkpoint.ipynb @@ -0,0 +1,544 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:88dad4167b8ab13af93e66ad11725020c7f1ec6496fdf0f78d38810f6f3baf41" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 10 : SEdimentation and classification" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.1 pageno : 186" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "%pylab inline\n", + "import math \n", + "from matplotlib.pyplot import *\n", + "#example 10.1\n", + "# Initialization of Variable\n", + "t = [0, 0.5, 1. ,2. ,3., 4., 5., 6., 7., 8., 9., 10.] #time\n", + "h = [1.10 ,1.03, .96, .82, .68, .54, .42, .35, .31, .28, .27, .27]\n", + "Cl = [0 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n", + "m = 0.05\n", + "V = 1/1000. #volume\n", + "v = [0,0,0,0,0,0,0,0,0,0,0]\n", + "\n", + "#calculations\n", + "Co = m/V #concentration at t = 0\n", + "v[0] = (h[0]-h[1])/(t[1]-t[0])\n", + "Cl[0] = Co\n", + "for i in range(1,11):\n", + " v[i] = (h[i-1]-h[i+1])/(t[i+1]-t[i-1]) #slope or settling velocity\n", + " Cl[i] = Co*h[0]/(h[i]+v[i]*t[i])\n", + "\n", + "plot(t,h,'r--d')\n", + "clf()\n", + "plot(Cl,v,'r->')\n", + "print Cl,v\n", + "suptitle(\"Concentration vs Settling veocity\")\n", + "xlabel(\"Concentration(kg/m**3)\")\n", + "ylabel(\"Settling velocity (m/h)\")\n", + "show()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Populating the interactive namespace from numpy and matplotlib\n", + "[50.0, 50.0, 50.0, 50.000000000000014, 50.000000000000014, 51.88679245283019, 61.452513966480446, 80.88235294117649, 99.09909909909915, 125.00000000000003, 174.60317460317458]" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " [0.14000000000000012, 0.14000000000000012, 0.14000000000000004, 0.13999999999999996, 0.13999999999999996, 0.13000000000000003, 0.09500000000000003, 0.05499999999999999, 0.034999999999999976, 0.01999999999999999, 0.0050000000000000044]\n" + ] + }, + { + "output_type": "stream", + "stream": "stderr", + "text": [ + "WARNING: pylab import has clobbered these variables: ['draw_if_interactive']\n", + "`%pylab --no-import-all` prevents importing * from pylab and numpy\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAY0AAAEfCAYAAAC9CZqZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XtcVVX+//HXQVFHRSlTVNBQQbnf5CKWippCOpIXFEyT\nvE8zappWVvOdtBqVn3mnGrp462tK2qRkiH1JsdIUFUtH1NCguIipiRcQkcP6/XHGEyjIATkcDnye\njwePB3uffXkfxPNhrb33WhqllEIIIYQwgIWpAwghhDAfUjSEEEIYTIqGEEIIg0nREEIIYTApGkII\nIQwmRUMIIYTBpGg0cLm5uURERODg4ICvry9Dhw4lLS3NpJlWrlzJzZs3q7zfhg0bOH/+vH556tSp\nnDp1qiajVUlJSQmzZs3C3d0dDw8P/P39ycjIuO8+d7/3RYsWlXm9ZcuWAOTk5DB69Ogaz2wMQ4cO\n5dq1a1y9epX33nvP1HHEg1KiwSopKVG9evVSMTEx+nU//vij+vbbb02YSil7e3t16dKlcl/TarUV\n7hcUFKSOHDlirFhV9sknn6iwsDD9cnZ2trpy5cp997n7vbds2bLM63cvm5P09HTl5uZm6hjiAUlL\nowHbu3cvTZo0Ydq0afp1Hh4ePP744wC8+OKL+r+SP/30UwCSkpIICgpi9OjRODs7M378eP2+hw8f\n5rHHHsPLy4uAgADy8/PRarW8+OKL+Pv74+npyfvvv3/f46xevZqcnBz69+/PwIEDAd1f1/PmzcPL\ny4vvv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VSUlL021clv1lP9yqEEKJ2mU33lBBCCNOToiGEEMJgUjSEEEIYTIqGEEII\ng0nRELUqNzeXiIgIHBwc8PX1ZejQoaSlpZksz8qVK7l582aV99uwYQPnz5/XL0+dOvWB5rGPjo5m\n/fr1AAQFBXH06NEq7X/+/HmCg4MN3l4pxb59+/S3YFa07l//+hceHh54e3sTGBjIjz/+COierr/z\nRLpoWKRoiFqjlGLEiBEMGDCAs2fPcuTIERYvXmzS4UdWrVpFQUFBua+VlJRUuN/69evJycnRL3/w\nwQfVHr5fKcVHH33E+PHjgeo9XZ+QkEBISIhB2xYWFjJx4kROnjzJiRMnePbZZytcN27cOI4fP86x\nY8d49dVXmTt3LqB7UPKhhx4iJSWlam9WmD/j3SksRFlff/216tu3b7mvzZs3T7m5uSl3d3cVGxur\nlFJq7969ql+/fiosLEw5OTmpcePG6bdPTk5WvXv3Vp6ensrf31/duHFDFRcXq3nz5ik/Pz/l4eGh\nYmJi7nucVatWqSZNmih3d3c1YMAApZRSLVq0UHPnzlWenp7qu+++U2+88Yby8/NTbm5uatq0aUop\npbZu3apatmypevTooby9vdXNmzdVv3791JEjR5RSSn3yySfK3d1dubm5lRn5t0WLFuq1117T3yd/\n4cIFpZRS3377rYqIiNBvFxQUpI4ePaq0Wq2KjIxU//M//6OUUurDDz9U3bt3V/7+/mrKlClqxowZ\n+n3Cw8PVqVOn1N69e1Xfvn3VU089pbp27apefvlltXHjRuXn56fc3d3VuXPnlFJK5efnKx8fH+Xr\n66sKCgoqXFfaJ598osLDw/XLW7ZsUfPmzavkX13UN1I0RK1ZtWqVmjNnzj3rt23bpgYNGqRKSkrU\nhQsXVOfOndX58+fV3r17VevWrVV2drYqKSlRgYGBav/+/erWrVuqa9eu+g/p69evq+LiYhUTE6Pe\neustpZRShYWFytfXV6Wnp1d4HKVUmSG6lVJKo9GorVu36pd///13/ffPPPOM+uKLL5RSf3yw33Fn\nOTs7W3Xu3FldunRJFRcXqwEDBqjt27frj71z506llFIvvfSSPuvixY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mziYqKolmzZnTp0oUVK1Zw48YNPD090Wg0LF26lHbt2nHq1Kly/5K1tLQkNjaWmTNncvPmTZo3\nb05iYiJTpkwhIyMDHx8flFK0a9eOzz///L53I02bNo2QkBBsbW35+uuvy2xnbW3N1KlTcXNzo337\n9mW6gJ599ln+8pe/0Lx5cw4cOKBf3759e5YsWUL//v1RSvHnP/+ZYcOGAWVbIaUzPf7440RHR9+T\nbc6cOVy9epVnnnmGTZs28eqrr+Lv78/DDz+Mk5MTrVu35uLFizRr1owWLVrcc9y7VeeurOjoaBIT\nE7G0tKRt27asW7dO/1pycjJ9+/at0vGE+ZMBC4UwMaUUPj4+HDp0iCZNmlS4XX5+Pi1atKC4uJiR\nI0cyefJkbty4QXZ2Ni+99FItJtYZN24c8+bNw9vbu9bPLUxHWhpCmJhGo2Hq1Kls2rSJiRMnVrjd\nggULSExMpLCwkODgYJ566qlaTFnWb7/9Rl5enhSMBkhaGkIIIQwmF8KFEEIYTIqGEEIIg0nREEII\nYTApGkIIIQwmRUMIIYTBpGgIIYQw2P8HesHkU34xCuAAAAAASUVORK5CYII=\n", + "text": [ + "" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.2 page no : 188" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from numpy import linspace\n", + "from matplotlib.pyplot import *\n", + "\n", + "# Initialization of Variable\n", + "t = [0, 0.5, 1 ,2, 3, 4, 5, 6, 7, 8, 9, 10] #time\n", + "h = [1.10 ,1.03, .96, .82, .68, .54, .42, .35, .31, .28, .27, .27]\n", + "Cl = linspace(50,100,5)\n", + "U = [19.53, 17.71, 16.20, 14.92, 13.82, 12.87, 12.04, 11.31, 10.65, 9.55] #mass ratio of liquid to solid\n", + "v = [0.139, 0.115, 0.098, 0.083, 0.071, 0.062, 0.055, 0.049, 0.043, 0.034] #terminal velocity\n", + "\n", + "#above value taken from graph given with ques.\n", + "C = 130. #conc. of solids\n", + "Q = 0.06 #slurry rate\n", + "Cmax = 130. #maximum solid conc.\n", + "rhos = 2300. #density of solid\n", + "rho = 998. #density of water\n", + "V = rho*(1/C-1/rhos)\n", + "F = Q*Cl[0]*3600.\n", + "A = [0,0,0,0,0,0,0,0,0,0]\n", + "for i in range(10):\n", + " A[i] = F*(U[i]-V)/rho/v[i]\n", + "\n", + "plot(v,A,'r-')\n", + "xlabel(\"Settling Velocity(m/h)\")\n", + "ylabel(\"Area(m**2)\")\n", + "show()\n", + "\n", + "#maxima finding using datatraveller in the graph\n", + "print \"the area for each settling velocity\",A\n", + "print \"1005 m**2 is the maximum area found out from the plot\"\n", + "\n", + "Qu = Q-F/3600./Cmax\n", + "print \"Volumetric flow rate of clarified water in (m**3/s): %.4f\"%Qu\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAZIAAAEMCAYAAADu7jDJAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XtcVVX+//HXUUjKu6mYYNFwERFUjPDyHYUS1JwkbZIG\nKi3HmrKpJvtlTU2TNWPqVDOajd+pRmeo8SvaxUt5GbyEdtG8dyOFDFIQMUNMxURg/f44cQQFQQ6c\nfQ68n4/HeTzgcPbenyW136y19trbZowxiIiI1FMLqwsQERHPpiARERGnKEhERMQpChIREXGKgkRE\nRJyiIBEREac0WpBMnDgRX19fIiIiHO8VFhYSHx9PSEgIw4cPp6ioCICcnBwuvfRSIiMjiYyMZPLk\nyY5tduzYQUREBMHBwTz00EONVa6IiNRTowXJXXfdxZo1a6q8N3PmTOLj48nMzGTYsGHMnDnT8bOg\noCB27drFrl27mDdvnuP9++67j/nz55OVlUVWVtZ5+xQREWs1WpAMGTKEjh07VnlvxYoVTJgwAYAJ\nEyawbNmyC+4jPz+f48ePEx0dDcD48eNr3UZERFzLpXMkBQUF+Pr6AuDr60tBQYHjZ9nZ2URGRhIb\nG8uHH34IQF5eHv7+/o7P+Pn5kZeX58qSRUSkFl5WHdhms2Gz2QDo3r07Bw4coGPHjuzcuZMxY8bw\n5ZdfXvT+RETk4jl7pyyX9kh8fX05dOgQYB+26tq1KwCXXHKJYxisf//+BAYGkpWVhZ+fH7m5uY7t\nc3Nz8fPzq3H/xpgm+3r66actr0FtU/vUvqb3agguDZKEhARSUlIASElJYcyYMQAcOXKEsrIyAL75\n5huysrL42c9+xhVXXEG7du345JNPMMbwxhtvOLYRERH30GhDW0lJSWzcuJEjR47Qo0cPnn32WR5/\n/HESExOZP38+AQEBLFmyBIBNmzbxxz/+EW9vb1q0aMErr7xChw4dAJg3bx533nknp06dYtSoUYwc\nObKxShYRkXqwmYbq21jMZrM1WDfNHaWnpxMbG2t1GY2iKbcN1D5P19Tb1xDnTgWJiEgz1hDnTt0i\nRUREnKIgERERpyhIRETEKQoSERFxioJEREScoiARERGnKEhERMQpChIREXGKgkRERJyiIBEREaco\nSERExCkKEhERcYqCREREnKIgERERpyhIRETEKQoSERFxioJEREScoiARERGnKEhERMQpChIREXGK\ngkRERJyiIBEREac0WpBMnDgRX19fIiIiHO8VFhYSHx9PSEgIw4cPp6ioyPGzGTNmEBwcTGhoKGlp\naY73d+zYQUREBMHBwTz00EONVa6IiNSTzRhjGmPHH3zwAW3atGH8+PF8/vnnAEydOpXOnTszdepU\nZs2axdGjR5k5cyYZGRkkJyezbds28vLyiIuLIysrC5vNRnR0NC+//DLR0dGMGjWKBx98kJEjR57f\nEJuNRmqKNEXGwNKlsGkTXHIJ+PhAq1b2V8XX1b1X28+9vMBms7p1InXWEOdOrwaq5TxDhgwhJyen\nynsrVqxg48aNAEyYMIHY2FhmzpzJ8uXLSUpKwtvbm4CAAIKCgvjkk0+46qqrOH78ONHR0QCMHz+e\nZcuWVRskInViDKxaBU89Zf8+ORnKyuDHH+HkSSgstH99+rT9VdvX575nzMWHz2WXQUgI9OkDffuC\nr6/CSDxKow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d4q233mL79u3cdtttREZG8tJL\nL3Hw4EGuu+46hg0bdt7+K3oF6enpxMbGMm7cOHr16sXtt9/u+MyqVavo1asXUVFRPPjgg9X+ZZ6U\nlERqaqrj+6VLlzJy5Eh8fHx4/vnniY6Opm/fvkybNu28bY0xPProo0RERNCnT58qvZhZs2bRp08f\n+vXrxxNPPAHAnXfeydtvv83cuXMdbbv++uv517/+xcMPP+zY9rXXXmPKlCmA/cFxN910k6OtMTEx\njBkzhsDAQB5//HHeeOMNoqOj6dOnD998841jH//973+54YYbAPstQKr794mNjWXVqlXV/v6kmWrY\nJTAizjlx4oTp16+fCQkJMZMnTzYbN240xhhTUlJiBg0aZI4cOWKMMSY1NdVMnDjRGGNMbGxslYV+\nAQEB5vvvv6/2+zZt2hhjjHn//fdN+/btTV5enikvLzeDBg0yH330kTl16pTp0aOHycnJMcYYk5SU\nVO2CrNOnTxtfX19TWFhojDFmxIgRZuXKlea///2vueeee4wxxpSVlZlf/OIXZtOmTVWO/dZbb5n4\n+HhTXl5uCgoKzJVXXmny8/PNqlWrzODBg82pU6eMMcYcPXrUGGPMnXfead5+++3z2nLixAkTGBho\nSktLjTHGDB482HzxxRemtLTUdOvWzVHr+++/bzp06GAOHTpkTp8+bbp3726efvppY4wxc+bMcazQ\nLi0tNf369avx3+fDDz907HPo0KFutVJdrKUeibiV1q1bs2PHDl599VW6dOnCrbfeSkpKCnv37uXL\nL78kLi6OyMhIpk+fXuVupqYe62qjo6Pp3r07NpuNfv36kZ2dzZ49e/jZz37GVVddBdh7HtXt+5JL\nLiEhIYE333yTI0eOsHv3bkaMGEFaWhppaWlERkZyzTXXkJmZyddff11l2w8//JDk5GRsNhtdu3Yl\nJiaGbdu2sX79eiZOnIiPjw+A4+FuF/q3uv7663n33XfZs2cPZ86coXfv3uc9NA7g2muvxdfXl0su\nuYSgoCDHA+LCw8PJyckB4JNPPqlyF9tz/30qPgfQvXv3Kt9L8+ZldQEi52rRogUxMTHExMQQERFB\nSkoK11xzDb17967xxob1mX9o1aqV4+uWLVtSWlp63n4uFFBJSUn86U9/whjDmDFjaNmyJQC///3v\nueeee2rczmaz1bjfiw3ESZMmMX36dHr16uV4dkt1+6nc1hYtWji+b9GiBaWlpQCsXr3aMax17jYV\n/z6V9++ujy8Q19N/CeJWMjMzycrKcny/a9cuAgIC6NmzJ999953jcbtnzpwhIyMDgLZt2/LDDz84\ntjn3+7qy2Wz07NmTb775hm+//RaAxYsX1xhSsbGxZGZm8ve//52kpCQARowYwYIFCzh58iRgfy7E\nd999V2W7IUOGsHjxYsrLy/nuu+/YtGkTAwYMID4+nn/961+Oq7KOHj163jHPbVt0dDS5ubn83//9\nn6OGzp07c+LEiYtu/4YNG+r8TJT8/HxHr01EPRJxKydOnOCBBx6gqKgILy8vgoODefXVV/H29uat\nt97iwQcf5NixY5SWlvLwww8TFhbGnXfeyb333stll13Gxx9/zD333MPIkSPx8/Nj/fr1VfZfORSq\nCwgfHx/mzZvHyJEjad26Nddee22NQWKz2Rg3bhxvvvkmMTExAMTHx/PVV18xaNAgwD65v3DhQrp0\n6eLYz9ixY9m8eTN9+/bFZrPx/PPP07VrV0aMGMHu3buJiorikksu4Re/+AV//vOfqxyzurYlJiby\n6aefOp4g2bJlS8LDw9m7dy89e/bEZrNdsA02m40jR47g4+ND69atq7xf3b/dmTNnyM3NJTQ0tNp9\nSvOjmzaKnOPkyZOOE+r9999PSEgIDz30kMVV1Wz06NFMmTKF6667zvHev//9bwoKCnjsscfqtI+F\nCxeSl5fH1KlTa/1sWloaK1euZM6cOfWuWZoWBYnIOWbPnk1KSgolJSX079+f1157zTEB7k6KiooY\nMGAA/fr1Y/HixVV+VlJSQlxcHBs3bmzwpxUmJibyl7/8hYCAgAbdr3guBYmIiDhFk+0iIuIUBYmI\niDhFQSIiIk5RkIiIiFMUJCIi4hQFiYiIOOX/A9X59HMYa+FEAAAAAElFTkSuQmCC\n", + "text": [ + "" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the area for each settling velocity [956.58577326448562, 984.95679741043818, 989.07500346402981, 1000.9355052127868, 1002.4484410905754, 982.14964830945723, 943.84207758782964, 898.19417690065814, 857.42395579055744, 734.27713187539746]\n", + "1005 m**2 is the maximum area found out from the plot\n", + "Volumetric flow rate of clarified water in (m**3/s): 0.0369\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.3 pageno : 192" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from numpy import linspace\n", + "\n", + "# Initialization of Variable\n", + "rho1 = 2600. #density lighter\n", + "rho2 = 5100. #density heavier\n", + "pd1 = linspace(0.000015,0.000095,9) #particle diameter lighter\n", + "pd2 = linspace(0.000025,0.000095,8) #particle diameter heavier\n", + "wp1 = [0 ,22 ,35, 47, 59, 68, 75, 81 ,100] #weight distribution lighter\n", + "wp2 = [0, 21, 33.5, 48, 57.5, 67 ,75, 100] #weight distribution heavier\n", + "rho = 998.6 #density water\n", + "mu = 1.03/1000 #viscosity water\n", + "g = 9.81\n", + "u = 0.004 #velocity of water\n", + "d = 95/1000000. #paeticle diameter maximum\n", + "\n", + "#calculation\n", + "#part 1\n", + "Re = d*u*rho/mu\n", + "d1 = math.sqrt(18*mu*u/g/(rho1-rho))\n", + "d2 = math.sqrt(18*mu*u/g/(rho2-rho))\n", + "def inter(d,f,g,b): #interpolation linear\n", + " for i in range(b):\n", + " if d <= f[i+1] and d>f[i]:\n", + " break\n", + " else: \n", + " continue\n", + " a = (d-f[i])/(f[i+1]-f[i])*(g[i+1]-g[i])+g[i]\n", + " return a\n", + "\n", + "a = inter(d1,pd1,wp1,9)\n", + "b = inter(d2,pd2,wp2,8)\n", + "v2 = 1./(1+5.)*100.-b/100.*1./(1+5)*100\n", + "v1 = 5./(1+5.)*100.-a/100.*5./(1+5)*100\n", + "pl2 = (v2)/(v2+v1)\n", + "print \"The fraction of heavy ore remained in bottom %.4f\"%pl2\n", + " \n", + "#part 2\n", + "rho = 1500.\n", + "mu = 6.25/10000\n", + "a = math.log10(2*d**3*rho*g*(rho1-rho)*3*mu**2) #math.log10(Re**2(R/rho/mu**2))\n", + "\n", + "#using value from chart(graph)\n", + "Re = 10.**0.2136\n", + "u = Re*mu/rho/d\n", + "d2 = math.sqrt(18*mu*u/g/(rho1-rho))\n", + "b = inter(d2,pd2,wp2,8)\n", + "print \"The percentage of heavy ore left in this case %.4f\"%(100-b+3.5)\n", + "\n", + "#part 3\n", + "a = 0.75 #% of heavy ore in overhead product\n", + "s = 100.*5./6./(100*5./6+0.75*100./6)\n", + "print \"the fraction of light ore in overhead product: %.4f\"%s\n", + "\n", + "#part 4\n", + "da = pd2[0]\n", + "db = pd1[8]\n", + "rho = (da**2*rho2-db**2*rho1)/(-db**2+da**2)\n", + "print \"The minimum density required to seperate 2 ores in kg/m**3: %.4f\"%rho\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The fraction of heavy ore remained in bottom 0.3197\n", + "The percentage of heavy ore left in this case 24.8188\n", + "the fraction of light ore in overhead product: 0.8696\n", + "The minimum density required to seperate 2 ores in kg/m**3: 2413.9881\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.4 page no : 198" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from numpy import true_divide\n", + "\n", + "# Initialization of Variable\n", + "\n", + "rho = 998.\n", + "w0 = 40. #density of slurry\n", + "mu = 1.01/1000\n", + "g = 9.81\n", + "rho1 = 2660. #density quartz\n", + "h = 0.25\n", + "t = 18.5*60\n", + "mp = [5 ,11.8, 20.2, 24.2, 28.5, 37.6 ,61.8]\n", + "d = true_divide([30.2, 21.4, 17.4, 16.2, 15.2, 12.3, 8.8],1000000)\n", + "u = h/t\n", + "d1 = math.sqrt(18*mu*u/g/(rho1-rho))\n", + "def inter(d,f,g,b): #interpolation linear\n", + " for i in range(b):\n", + " if d > f[i+1] and d <= f[i]:\n", + " break\n", + " else: \n", + " continue\n", + " break\n", + " \n", + " a = -(d-f[i+1])/(f[i]-f[i+1])*(g[i+1]-g[i])+g[i+1]\n", + " return a\n", + "a = inter(d1,d,mp,6)\n", + "phi = 1-a/100.\n", + "rhot = phi*(rho1-rho)/rho1*w0+rho\n", + "print \"the density of suspension at depth 25cm in kg/m**3 is %.4f\"%rhot\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the density of suspension at depth 25cm in kg/m**3 is 1016.5653\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.5 pag eno : 200" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "import math \n", + "from matplotlib.pyplot import *\n", + "\n", + "# Initialization of Variable\n", + "t = [0, 45, 135, 495, 1875, 6900, 66600, 86400] #time\n", + "m = [0.1911, 0.1586, 0.1388, 0.1109, 0.0805, 0.0568, 0.0372, 0.0359] #mass total\n", + "rho1 = 3100. #density of cement\n", + "mu = 1.2/1000 #viscosity of desperant liquid\n", + "rho = 790. #density of desperant liquid\n", + "h = 0.2\n", + "V = 10.\n", + "s = 0.\n", + "g = 9.81\n", + "d = [0,0,0,0,0,0,0,0]\n", + "mc = [0,0,0,0,0,0,0,0]\n", + "mp = [0,0,0,0,0,0,0,0]\n", + "d[0] = 100./1000000 #assumed value\n", + "\n", + "for i in range(7):\n", + " d[i+1] = math.sqrt(18*mu*h/g/t[i+1]/(rho1-rho)) #dia of particles\n", + " mc[i+1] = m[i+1]-0.2/100*V #mass of cement\n", + " s = s+mc[i+1] \n", + "\n", + "mc[0] = m[0]-0.2*V/100\n", + "s = s+mc[0]\n", + "mp[0] = 100.\n", + "\n", + "for i in range(7):\n", + " mp[i+1] = mc[i+1]/mc[0]*100. #mass percent below size\n", + "\n", + "plot(mp,d)\n", + "xlabel(\"%undersize\")\n", + "ylabel(\"Particle Size(m)\")\n", + "\n", + "show()\n", + "u = h/t[1]\n", + "Re = d[1]*u*rho/mu\n", + "if Re<2:\n", + " print \"since Re<2 for 81% of particles so settlement occurs mainly by stoke-s law\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAaEAAAEKCAYAAAC7c+rvAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XtcVGX+B/DPKOSmVlabaIM1CMNNcUARLK1oWXS1nCzN\nYFul1jW7aZbrWvuzFXeVS1trumbqrquobWpuCiqyVC6VF0CBbmKJBco9byQaOFy+vz8Ojk4CgzAz\nB5jP+/XylTNzLt85r1fz8XnO8zxHIyICIiIiFXRTuwAiInJeDCEiIlINQ4iIiFTDECIiItUwhIiI\nSDUMISIiUo1dQyg1NRW+vr7Q6/VISEhocptZs2ZBr9fDYDAgNzfX6r5nzpxBREQEvL29MXr0aFRW\nVprfv//++3HDDTdg5syZFufIzs5GQEAA9Ho9XnjhBTt8UyIiagu7hVB9fT2ef/55pKamIi8vD+++\n+y6OHDlisU1KSgqOHTuG/Px8rF69Gs8884zVfePj4xEREYGjR48iPDwc8fHxAICf/exnWLRoEV5/\n/fWrannmmWewZs0a5OfnIz8/H6mpqfb62kREdA3sFkJZWVnw8vKCTqeDq6srIiMjkZSUZLFNcnIy\noqOjAQChoaGorKxEeXl5i/teuU90dDS2b98OAOjZsydGjhyJHj16WJyjrKwMVVVVCAkJAQBMnTrV\nvA8REanLbiFUUlKCAQMGmF+7u7ujpKSkVduUlpY2u29FRQXc3NwAAG5ubqioqLA4pkajueoc7u7u\n5tdarfaqOoiISB0u9jrwT8OgOa1ZNUhEmjyeRqNp9XmssdVxiIicTXtWf7NbS0ir1aKoqMj8uqio\nyKJF0tQ2xcXFcHd3b/J9rVYLQGn9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+rzi0i\nePzxxzFnzhwEBQVh+fLlyM7ORnBwMACgurpatS5Fck4MIaJ2+Mtf/oL58+fj3//+N+69915MnDgR\nDz/8MFxcXFBfXw8AqKmpsdjnUmgAQPfu3VFXV3fVSsMiYn5PRJCZmYnrrrvuqvP37NnT/PeoqCiM\nGDECO3fuxLhx47Bq1Srcf//9FtvHxMTgjjvuQHR0tPm96OhoxMbGtvEKELUP7wkRtVF+fj5KS0tx\n7733orq62hwaNTU18PDwMN8T2rp1a4vH0Wg0CA0Nxccff4wzZ86gtrYW7733nvnz0aNHY9myZebX\nn3/+eZPHKSgogIeHB2bOnImHHnoIX375pcXnO3bswEcffYSlS5ea3wsPD8fWrVtx8uRJAMCZM2dw\n4sSJa7gKRO3DECJqo/nz52Px4sUAlFbI22+/jZCQEMyePRtz5szB22+/jaFDh+L06dPmgGru2Sv9\n+vVDTEwM7rrrLowaNQqDBg0yf7Zs2TIcOnQIBoMBgwYNwqpVq8yfXXmsLVu2YPDgwQgKCsLhw4cx\ndepUi22WLFmC0tJS8+CFmJgY+Pn5YdGiRRg9ejQMBgNGjx5ts2HmRK3BBUyJiEg1bAkREZFqGEJE\nRKQahhAREamGIURERKphCBERkWoYQkREpJr/B0li8t3stvoOAAAAAElFTkSuQmCC\n", + "text": [ + "" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "since Re<2 for 81% of particles so settlement occurs mainly by stoke-s law\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.6 page no : 204" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from matplotlib.pyplot import *\n", + "\n", + "# Initialization of Variable\n", + "rho = 998.\n", + "rho1 = 2398. #density of ore\n", + "mu = 1.01/1000.\n", + "g = 9.81\n", + "h = 25/100.\n", + "t = [114. ,150., 185., 276., 338., 396., 456., 582., 714., 960.]\n", + "m = [0.1429 ,0.2010, 0.2500, 0.3564, 0.4208, 0.4781, 0.5354 ,0.6139, 0.6563, 0.7277]\n", + "d = [0,0,0,0,0,0,0,0,0,0]\n", + "P = [0,0,0,0,0,0,0,0,0,0]\n", + "\n", + "for i in range(10):\n", + " ms = 0.0573+m[9] #total mass setteled\n", + " d[i] = math.sqrt(18.*mu*h/g/(rho1-rho)/t[i])\n", + " P[i] = m[i]/ms*100 #mass percent of sample\n", + "\n", + "plot(t,P)\n", + "xlabel(\"Settling time (s)\")\n", + "ylabel(\"mass percent in (%)\")\n", + "show()\n", + "print \"& its percentage mass distribution respectively\" ,\"the particle size distribution in (m)\" ,P,d\n", + "W = [0,0,0,0,0,0,0,0,0,0]\n", + "de = [0,0,0,0,0,0,0,0,0,0]\n", + "for i in range(9):\n", + " de[i] = (P[i+1]-P[i-1])/(t[i+1]-t[i-1]) #slope \n", + " W[i] = P[i]-t[i]*de[i]\n", + " W[0] = P[0]-P[0]\n", + "\n", + "W[9] = P[9]-t[9] * 0.025\n", + "print \"mass and diameter(m)respectively with serial no:\"\n", + "\n", + "for i in range(4,10):\n", + " print i-4,\n", + " print \"mass, is\",\n", + " print \"for diameter in(m) of %f %f\"%(W[i],d[i])\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAY0AAAEMCAYAAAA4S+qsAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlcVXXi//EXCmq5rxdFCzNRWUTENE3zOoZaqZkVLpMx\n6jStTlaTtEwzlGNCmaVTfmemRZnK1LHGyJ+aG9fcd20xlxREExgNcEENgc/vj5PXyIWrwD0g7+fj\nwSO43nvPW+TBu8/nnPP5+BhjDCIiIh6oYncAERGpOFQaIiLiMZWGiIh4TKUhIiIeU2mIiIjHVBoi\nIuKxMiuNUaNG4XA4CAsLcz+WlZVFVFQUQUFB9OnTh5ycHPefTZw4kdatW9O2bVsWL15cVrFERKQE\nyqw0Ro4cyaJFi4o8Fh8fT1RUFLt376Z3797Ex8cDsGPHDmbPns2OHTtYtGgRjz76KIWFhWUVTURE\nrlCZlUaPHj2oX79+kceSkpKIiYkBICYmhnnz5gHw2WefMWzYMPz8/AgMDOTGG29kw4YNZRVNRESu\nkFfPaWRmZuJwOABwOBxkZmYCcOjQIZo3b+5+XvPmzfnhhx+8GU1ERDzga9eBfXx88PHxueSfe/KY\niIgUr7RWjPLqSMPhcJCRkQFAeno6TZo0ASAgIIADBw64n3fw4EECAgIu+B7GmHL38de//tX2DMqk\nTJUxlzJ59lGavFoaAwcOJDExEYDExEQGDRrkfnzWrFnk5eWRkpLCnj176Ny5szejiYiIB8psemrY\nsGGsWLGCI0eO0KJFC15++WWeffZZoqOjee+99wgMDGTOnDkABAcHEx0dTXBwML6+vkybNk1TUSIi\n5VCZlcbHH398wceXLl16wceff/55nn/++bKKU6acTqfdEc6jTJ5RJs+Vx1zK5H0+prQnvMqQj49P\nqc/PiYhc7Urzd6eWEREREY+pNERExGMqDRER8ZhKQ0REPKbSEBERj6k0RETEYyoNERHxmEpDREQ8\nptIQERGPqTRERMRjKg0REfGYbZswiYjIpR08CCtWWB/p6fD553YnUmmIiJQbqannSmLFCjh2DG69\nFXr2hMceszudRavciojYwBjYt69oSZw6BU6nVRI9e0K7dlClFE4ilObvTpWGiIgXGAO7dxctCWPO\nFUTPntCmDZTF/nMVvjSmTJnCu+++izGGBx98kCeeeIKsrCyGDBnC/v373bv61atXr2hYlYaIVBDG\nwHffgctlFcSXX0K1akVLolWrsimJX6vQpfHNN98wbNgwNm7ciJ+fH/369eMf//gH//znP2nUqBHj\nxo0jISGB7Oxs4uPji4ZVaYhIOVVYCN98c24U8eWXUKvWuYJwOiEw0J5sFbo05s6dy6JFi3j33XcB\n+Nvf/ka1atV4//33WbFiBQ6Hg4yMDJxOJzt37iwaVqUhIuVEQQFs336uJFauhIYNi44kWrSwO6Wl\nNH93ev3qqdDQUF544QWysrKoUaMGCxYso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p44cOcK6desAuPnmm2lk02bO\nunrKu44cgcGDrb27P/gANDMpUjF59eqpTz/9FF9fX/r370///v3x9fXVCrSVwI4d0KULdO9uLTyo\nwhAR8GCkER4ezvbt24s81qFDB7Zt21amwS5EIw3vWLQIHngAJk2y/isiFZtX15660IEKCgpK5eBS\nvhgDf/+7tY/3f/9r7bYnIvJLxZZGZGQkTz31FI899hjGGN5+++0rXuFWyq+CAmtnPZcL1q6FUtxC\nRUSuIsWe03jrrbfw8/NjyJAhDB06lBo1avD22297I5t4ycmT1g57O3fC6tUqDBG5uEuONPLz8+nf\nvz/JycneyiNedvgwDBgAQUEwZ472wBCRS7vkSMPX15cqVaqQk5PjrTziRd9/D926wW23Wft4qzBE\npDjFntOoWbMmYWFhREVFuZcQ8fHxYerUqWUeTsrO+vUwaBDExcFDD9mdRkQqimJLY/DgwQwePNi9\np4Yx5qL7d0vFkJQEo0db+2D07293GhGpSDy6I/zkyZOkpaXRtm3bUjloYGAgderUoWrVqvj5+bFh\nwwaysrIYMmQI+/fv1859Zegf/7A2TvrsM+jc2e40IuINXr0jPCkpiYiICPr16wfA1q1bGVjCPT19\nfHxwuVxs3bqVDRs2ABAfH09UVBS7d++md+/exMfHl+gYUpQx8PzzMHkyrFqlwhCRK1NsacTFxbF+\n/Xrq168PQEREBPv27SvxgX/deklJScTExAAQExOjpUpKUV4ejBhhbZi0ejW0amV3IhGpqIotDT8/\nv/OmiapUKfZll+Tj48Ntt91Gp06deOeddwDIzMzE4XAA4HA4yMzMLNExxHL0KNx+O+TmwrJl0Lix\n3YlEpCIr9kR4SEgIH330Efn5+ezZs4epU6fSrVu3Eh109erVNG3alMOHDxMVFXXeuRIfH5+LnmyP\ni4tzf+50OnE6nSXKcjU7eBDuuANuvRWmTIGqVe1OJCLe4HK5cLlcZfLexZ4Iz83NZcKECSxevBiA\nvn378uKLL1KjlPb5fOmll6hVqxbvvPMOLpcLf39/0tPT6dWrFzt37iwaVifCPfb113DnnTBmDPzp\nT9plT6QyK83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BsUdp1GjRsyYMYNhw4YRHh5Ot27d2LVr13nP6969O5s2bQLg2LFj\nDBgwgPDwcHr06MEbb7zhft6GDRvo0aPHBb+nIpdLCxaKXIbc3Fxq1qwJwGOPPUZQUBBPPPGELVlO\nnDhBr1692Lhx40Wfc+zYMXr37n3J54hcDo00RC7DO++8Q0REBCEhIRw7doyHHnrItiy1atWiV69e\n5+3a+EszZsywrdTk6qSRhoiIeEwjDRER8ZhKQ0REPKbSEBERj6k0RETEYyoNERHxmEpDREQ89v8B\nEA92IY9i/rEAAAAASUVORK5CYII=\n", + "text": [ + "" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "& its percentage mass distribution respectively the particle size distribution in (m) [18.203821656050955, 25.605095541401273, 31.84713375796178, 45.40127388535032, 53.60509554140127, 60.904458598726116, 68.20382165605096, 78.20382165605095, 83.60509554140127, 92.70063694267515] [5.387856206749596e-05, 4.6970241455099756e-05, 4.229436978392301e-05, 3.4626921406038745e-05, 3.129032486308103e-05, 2.890818526183746e-05, 2.693928103374798e-05, 2.3845527268417837e-05, 2.1528774873471063e-05, 1.856661815577208e-05]\n", + "mass and diameter(m)respectively with serial no:\n", + "0 mass, is for diameter in(m) of 9.937792 0.000031\n", + "1 mass, is for diameter in(m) of 11.912124 0.000029\n", + "2 mass, is for diameter in(m) of 25.792480 0.000027\n", + "3 mass, is for diameter in(m) of 43.461413 0.000024\n", + "4 mass, is for diameter in(m) of 56.222222 0.000022\n", + "5 mass, is for diameter in(m) of 68.700637 0.000019\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 10.7 page no : 208" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "\n", + "rho = 1002. #density of print erant\n", + "rho1 = 2240. #density of kaolin\n", + "mu = 1.01/1000 #viscosity\n", + "g = 9.81\n", + "t = 600.\n", + "h2 = 0.2\n", + "h1 = 0.4\n", + "dg = 15.*10**-6 #particle size to be removed\n", + "\n", + "#calculations\n", + "#part 1\n", + "d = math.sqrt(18*mu*h2/g/(rho1-rho)/t)\n", + "x = dg/d\n", + "f = h2/h1*(1-x**2) #fraction separated after first decanting\n", + "g = f*(1-f)\n", + "print \"fraction of particles separated after second decanting %.4f\"%g\n", + "print \"total fraction of particles separated after decanting %.4f\"%(f+g)\n", + "\n", + "#part 2\n", + "h = (1.-20/40.*(1-x**2))**6\n", + "print \"fraction of particles separated after sixth decanting %.4f\"%h\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "fraction of particles separated after second decanting 0.1992\n", + "total fraction of particles separated after decanting 0.4737\n", + "fraction of particles separated after sixth decanting 0.1458\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch11-checkpoint.ipynb b/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch11-checkpoint.ipynb new file mode 100644 index 00000000..a2484ed7 --- /dev/null +++ b/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch11-checkpoint.ipynb @@ -0,0 +1,457 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:c23ae85b629821355f70fc5abaa38e7f6336abdb19ba09fa0e8e1a4bdcd9679f" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 11 : Fluidisation\n" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.1 page no : 216" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "pi = 3.1428\n", + "d = 0.3/1000\n", + "mu = 2.21/100000\n", + "rho = 106.2 #density under operating condition\n", + "u = 2.1/100\n", + "rhos = 2600. #density of particles\n", + "l = 3.25\n", + "g = 9.81\n", + "dt = 0.95 #fluidising diameter\n", + "\n", + "\n", + "#part 1\n", + "#calculation\n", + "a = u**2./d/g*d*rho*u/mu*(rhos-rho)/rho*l/dt\n", + "if a>100 :\n", + " print \"Bubbling fluidisation will occur as value is %.4f\"%a\n", + "\n", + "#part 2\n", + "Q = 2.04/100000\n", + "rhos = 2510.\n", + "rho = 800.\n", + "mu = 2.85/1000\n", + "l = 4.01\n", + "dt = 0.63\n", + "d = 0.1/1000\n", + "u = Q*4/pi/dt**2\n", + "a = u**2/d/g*d*rho*u/mu*(rhos-rho)/rho*l/dt\n", + "if a<100*10**-4: #compare as value of a is much less than 100\n", + " print \"fluidisation occur in smooth mode as value is: %.4e\"%a\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Bubbling fluidisation will occur as value is 364.4332\n", + "fluidisation occur in smooth mode as value is: 1.0898e-07\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.2 page no ;218" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "d = 50./1000000\n", + "rhos = 1850. #density of particle\n", + "rho = 880. #density of hydrocarbon\n", + "mu = 2.75/1000 #viscosity of hydrocarbon\n", + "e = 0.45 #void fraction coeff.\n", + "g = 9.81\n", + "h = 1.37 #flow depth\n", + "c = 5.5/1000 #c = 1/K\n", + "\n", + "#calculation\n", + "#part 1\n", + "u = c*e**3*d**2*g*(rhos-rho)/mu/(1-e)\n", + "print \"The superficial linear flow rate in (m/s): %.3e\"%u\n", + "\n", + "#part 2\n", + "u = d**2*g*(rhos-rho)/18/mu\n", + "print \"Terminal Settling Velocity in (m/s): %.4f\"%u\n", + "Re = d*u*rho/mu\n", + "if Re<2 :\n", + " print \"Stoke law assumption is sustained with this velocity\"\n", + "\n", + "#part 3\n", + "P = g*(rhos-rho)*h*(1-e)\n", + "print \"Pressure drop across fluidised bed in (N/m**2):\",P\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The superficial linear flow rate in (m/s): 7.883e-06\n", + "Terminal Settling Velocity in (m/s): 0.0005\n", + "Stoke law assumption is sustained with this velocity\n", + "Pressure drop across fluidised bed in (N/m**2): 7170.07995\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.3 page no : 221" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from numpy import *\n", + "# Initialization of Variable\n", + "g = 9.81\n", + "rhos = 1980. #density of ore\n", + "rho = 1.218 #density of air\n", + "e = 0.4\n", + "mu = 1.73/10**5\n", + "s = 0\n", + "wp = array([0, .08, .20, .40, .60, .80, .90, 1.00]) #weight percent\n", + "d = true_divide([0.4 ,0.5, 0.56, 0.62, 0.68, 0.76, 0.84, 0.94],1000)\n", + "dav = [0,0,0,0,0,0,0]\n", + "mf = [0,0,0,0,0,0,0]\n", + "a = [0,0,0,0,0,0,0]\n", + "#part 1\n", + "for i in range(7):\n", + " dav[i] = d[i+1]/2+d[i]/2. #average dia\n", + " mf[i] = wp[i+1]-wp[i] #mass fraction\n", + " a[i] = mf[i]/dav[i]\n", + " s = s+a[i]\n", + "\n", + "db = 1/s #d bar\n", + "\n", + "#quadratic coeff. ax**2 +bx +c = 0\n", + "c = -(rhos-rho)*g\n", + "b = 150.*(1-e)/e**3/db**2*mu\n", + "a = 1.75*rho/e**3/db\n", + "y = poly1d([a,b,c],False)\n", + "U = roots(y)\n", + "print \"the linear air flow rate in (m/s): %.4f\"%(abs(U[1]))\n", + "\n", + "#part 2\n", + "d = 0.4/1000\n", + "a = 2*d**3/3/mu**2*rho*(rhos-rho)*g\n", + "a = math.log10(a)\n", + "print \"log10(Re**2/rho/U**2*R) = %.4f\"%a\n", + "\n", + "#using chart\n", + "Re = 10**1.853\n", + "u = Re*mu/rho/d\n", + "print \"speed required for smallest particle in (m/s): %.4f\"%u\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the linear air flow rate in (m/s): 0.2643\n", + "log10(Re**2/rho/U**2*R) = 3.5277\n", + "speed required for smallest particle in (m/s): 2.5313\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.4 page no : 224" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from numpy import *\n", + "\n", + "# Initialization of Variable\n", + "U = 2.032/10**4\n", + "pi = 3.1428\n", + "rho = 852\n", + "g = 9.81\n", + "mu = 1.92/1000\n", + "mf = 125/3600. #mass flow rate\n", + "\n", + "#calculation\n", + "#part 1\n", + "G = U*rho\n", + "A = mf/G\n", + "d = math.sqrt(4*A/pi)\n", + "print \"the diameter of vessel will be in(m): %.4f\"%d\n", + "\n", + "#part 2\n", + "A = 0.201\n", + "e = 0.43\n", + "ms = 102. #mass of solids\n", + "rhos = 1500. #density of solid\n", + "L = ms/rhos/A\n", + "Lmf = L/(1-e)\n", + "print \"depth of bed in (m): %.4f\"%Lmf \n", + "\n", + "#part 3\n", + "d1 = 0.2/1000\n", + "U = 2.*5.5/10**3*e**3*d1**2*(rhos-rho)*g/mu/(1-e)\n", + "\n", + "#now euating for e\n", + "#a = e**3/(1-e)\n", + "a = U/5.5*10**3/(d1**2*(rhos-rho)*g/mu)\n", + "y = poly1d([1,0,a,-a],False)\n", + "e2 = roots(y)\n", + "L = Lmf*(1-e)/(1-e2[2])\n", + "print \"depth of fluidised bed under operating condition in (m): %.4f\"%L\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the diameter of vessel will be in(m): 0.5052\n", + "depth of bed in (m): 0.5935\n", + "depth of fluidised bed under operating condition in (m): 0.6958\n" + ] + }, + { + "output_type": "stream", + "stream": "stderr", + "text": [ + "-c:45: ComplexWarning: Casting complex values to real discards the imaginary part\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.5 page no : 227" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "g = 9.81\n", + "pi = 3.1428\n", + "r = 0.51\n", + "e = 0.48 #void ratio\n", + "rhos = 2280. #density of glass\n", + "rho = 1.204 #density of air\n", + "U = 0.015 #velocity of water entering bed\n", + "L = 7.32\n", + "gam = 1.4 #gamma\n", + "neta = 0.7 #efficiency\n", + "P4 = 1.013*10**5\n", + "P1 = P4\n", + "v1 = 1/1.204 #volume 1\n", + "\n", + "#calculation\n", + "P3 = P4+g*(rhos-rho)*(1-e)*L\n", + "P2 = P3+0.1*85090\n", + "v2 = (P1*v1**gam/P2)**(1/gam) #vlume 2\n", + "W = 1/neta*gam/(gam-1)*(P2*v2-P1*v1) #work done\n", + "v3 = P2*v2/P3 #volume 3\n", + "M = U*pi*r**2/v3 #mass flow rate\n", + "P = M*W\n", + "\n", + "# Results\n", + "print \"The power supplies to the blower in (W): %.4f\"%P\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The power supplies to the blower in (W): 1948.7509\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.6 page no : 230" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "dt = 12.7/1000\n", + "d = 1.8/1000\n", + "Q = 2.306/10**6\n", + "pi = 3.1428\n", + "\n", + "#calculation\n", + "#part 1\n", + "Sc = 4./dt\n", + "S = 6./d\n", + "f = (1+0.5*Sc/S)**2\n", + "U = Q*4/pi/dt**2 #velocity\n", + "Ua = f*U #actual velocity\n", + "print \"minimum fluidising velocity found using smaller glass column in (m/s): %.4f\"%Ua\n", + "\n", + "#part 2\n", + "dt = 1.5\n", + "Sc = 4./dt\n", + "f = (1+0.5*Sc/S)**2\n", + "Ua = f*U #actual velocity\n", + "print \"fluidising velocity found using larger glass column in (m/s): %.4f\"%Ua\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "minimum fluidising velocity found using smaller glass column in (m/s): 0.0200\n", + "fluidising velocity found using larger glass column in (m/s): 0.0182\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 11.7 page no : 232" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "e = 0.4 #incipent to fluidisation\n", + "\n", + "#calculation\n", + "#part 1\n", + "print \"for Re<500\"\n", + "print \"the ratio of terminal velocity & minimmum fluidising velocity is\"\n", + "\n", + "a = 3.1*1.75/e**3\n", + "\n", + "print math.sqrt(a)\n", + "\n", + "#part 2\n", + "print \"for Re>500\"\n", + "print \"the ratio of terminal velocity & minimmum fluidising velocity is\"\n", + "a = 150.*(1-e)/18./e**3\n", + "print a\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "for Re<500\n", + "the ratio of terminal velocity & minimmum fluidising velocity is\n", + "9.20682491416\n", + "for Re>500\n", + "the ratio of terminal velocity & minimmum fluidising velocity is\n", + "78.125\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch12-checkpoint.ipynb b/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch12-checkpoint.ipynb new file mode 100644 index 00000000..0b62821a --- /dev/null +++ b/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch12-checkpoint.ipynb @@ -0,0 +1,325 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:27b0880ef9530b4c8008863f28775062ec464e2da3c5a96886536d18e1634316" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 12 : Pneumatic Conveying\n" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.1 page no : 240" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from numpy import *\n", + "\n", + "# Initialization of Variable\n", + "rho = 1.22\n", + "pi = 3.1428\n", + "rhos = 518.\n", + "rhoav = 321.\n", + "mu = 1.73/10**5\n", + "g = 9.81\n", + "d = 0.65/1000\n", + "d2 = 25.5/100 #dia of duct\n", + "ms = 22.7/60 #mass flow rate\n", + "\n", + "#calculation\n", + "e = (rhos-rhoav)/(rhos-rho)\n", + "#coeff of quadratic eqn in U\n", + "#a*x**2+b*x+c = 0\n", + "c = -(1-e)*(rhos-rho)*g\n", + "b = 150.*(1-e)**2*mu/d**2/e**3\n", + "a = 1.75*(1.-e)*rho/d/e**3\n", + "y = poly1d([a,b,c],False)\n", + "U = roots(y)\n", + "Us = ms*4/pi/d2**2/rhos #superficial speed\n", + "Ua = e/e*(U[1]/e+Us/(1-e))\n", + "print \"the actual linear flow rate through duct in (m/s): %.4f\"%Ua\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the actual linear flow rate through duct in (m/s): 0.2059\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.2 page no : 243" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "rho = 1.22 #density of air\n", + "pi = 3.1428\n", + "rhos = 910. #density of polyethene\n", + "d = 3.4/1000. #dia of particles\n", + "mu = 1.73/10**5.\n", + "g = 9.81\n", + "dt = 3.54/100. #dia of duct\n", + "\n", + "#calculation\n", + "a = 2.*d**3*rho*g*(rhos-rho)/3/mu**2\n", + "print \"R/rho/U**2*(Re**2) = %.4f\"%a\n", + "\n", + "#using Chart\n", + "Re = 2.*10**3\n", + "U = mu*Re/d/rho\n", + "b = U/(g*dt)**.5\n", + "if b>0.35:\n", + " print \"choking can occur of this pipe system\"\n", + "else:\n", + " print \"choking can not occur of this pipe system\"\n", + "\n", + "#part 2\n", + "Uc = 15. #actual gas velocity\n", + "e = ((Uc-U)**2/2./g/dt/100.+1)**(1./-4.7)\n", + "Usc = (Uc-U)*(1-e) #superficial speed of solid\n", + "Cmax = Usc*rhos*pi*dt**2./4\n", + "print \"the maximum carrying capacity of polythene particles in (kg/s) %.4f\"%Cmax\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "R/rho/U**2*(Re**2) = 952227.8618\n", + "choking can occur of this pipe system\n", + "the maximum carrying capacity of polythene particles in (kg/s) 0.5949\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.3 page no : 245" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "rho = 1.22 #density of air\n", + "pi = 3.1428\n", + "rhos = 1400. #density of coal\n", + "mu = 1.73/10**5.\n", + "g = 9.81\n", + "U = 25.\n", + "Ut = 2.80\n", + "l = 50.\n", + "ms = 1.2 #mass flow rate\n", + "mg = ms/10. #mass flow of gas\n", + "\n", + "#calculation\n", + "Qs = ms/rhos #flow of solid\n", + "Qg = mg/rho #flow of gas\n", + "us = U-Ut #actual linear velocity\n", + "A = Qg/U\n", + "Us = Qs/A #solid velocity\n", + "e = (us-Us)/us\n", + "d = math.sqrt(4*A/pi)\n", + "def fround(x,n):\n", + " # fround(x,n)\n", + " # Round the floating point numbers x to n decimal places\n", + " # x may be a vector or matrix# n is the integer number of places to round to\n", + " y = round(x*10**n)/10.**n\n", + " return y\n", + "\n", + "d = fround(d,4)\n", + "Re = d*rho*U/mu\n", + "\n", + "#using moody's chart\n", + "phi = 2.1/1000 #friction factor\n", + "P1 = 2*phi*U**2*l*rho/d*2\n", + "f = 0.05/us\n", + "P2 = 2*l*f*(0.0098)*rhos*us**2/d\n", + "P2 = fround(P2/1000,1)*1000\n", + "delP = rho*e*U**2+rhos*(0.0098)*us**2+P1+P2\n", + "#print (delP,\"the pressure difference in kN/m**2 \")\n", + "print 'The Pressure value in kN/m**2 is %.1f'%(delP/1000)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Pressure value in kN/m**2 is 33.5\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.4 page no : 250" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "rho = 1.22 #density of air\n", + "pi = 3.1428\n", + "rhos = 1090. #density of steel\n", + "mu = 1.73/10.**5\n", + "g = 9.81\n", + "d = 14.5/100.\n", + "Qg = 0.4\n", + "Qs = 5000./3600./1090.\n", + "Ut = 6.5\n", + "ar = 0.046/1000 #absolute roughness\n", + "l = 18.5 #length\n", + "\n", + "#calculation\n", + "def fround(x,n):\n", + " # fround(x,n)\n", + " # Round the floating point numbers x to n decimal places\n", + " # x may be a vector or matrix# n is the integer number of places to round to\n", + " y = round(x*10**n)/10**n\n", + " return y\n", + "\n", + "Us = Qs/pi/d**2*4 #solid velocity\n", + "U = Qg/pi/d**2*4\n", + "us = U-Ut #actual linear velocity\n", + "e = 1-Us/us\n", + "e = fround(e,4)\n", + "Re = rho*U*d/mu\n", + "rr = ar/d #relative roughness\n", + "\n", + "#using moody's diagram\n", + "phi = 2.08/1000\n", + "P1 = 2*phi*U**2*l*rho/d*2\n", + "f = 0.05/us\n", + "P2 = 2*l*f*(1-e)*rhos*us**2/d\n", + "P2 = fround(P2/1000,2)*1000\n", + "delP = rhos*(1-e)*us**2+rhos*(1-e)*g*l+P1+P2\n", + "#print (delP,\"the pressure difference in kN/m**2 \")\n", + "print 'The Pressure value in kN/m**2 is %.2f'%(delP/1000)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Pressure value in kN/m**2 is 4.21\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 12.5 pageno :254" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "l = 25.\n", + "pi = 3.1428\n", + "rhos = 2690. #density of ore\n", + "emin = 0.6\n", + "emax = 0.8\n", + "g = 9.81\n", + "\n", + "#calculation\n", + "Pmax = rhos*(1-emin)*g*l\n", + "print \"The maximum pressure drop in (N/m**2):\",Pmax\n", + "Pmin = rhos*(1-emax)*g*l\n", + "print \"The minimum pressure drop in (N/m**2):\",Pmin\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The maximum pressure drop in (N/m**2): 263889.0\n", + "The minimum pressure drop in (N/m**2): 131944.5\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch13-checkpoint.ipynb b/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch13-checkpoint.ipynb new file mode 100644 index 00000000..3eb84b32 --- /dev/null +++ b/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch13-checkpoint.ipynb @@ -0,0 +1,366 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:8de14a272a9bc06516758c82d47f7c6c131e878e1053a9679880c251e49e360a" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 13 : Centrifugal Separation Operations\n" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.1 page no : 259" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "rho = 998.\n", + "g = 9.81\n", + "pi = 3.1428\n", + "omega = 2*pi*1055./60 #angular rotation\n", + "r = 2.55/100 #radius outer\n", + "ld = 1.55/100. #liq. depth\n", + "l = 10.25/100.\n", + "\n", + "#calculation\n", + "#part1\n", + "a = r*omega**2/g\n", + "print \"ratio of cetrifugal force & gravitational force is: %.4f\"%a\n", + "\n", + "#part2\n", + "ri = r-ld #radius internal\n", + "V = pi*(r**2-ri**2)*l\n", + "sigma = (omega**2*V)/(g*math.log(r/ri))\n", + "print \"equivalent to gravity settling tank of crossectional area of in (m**2): %.4f\"%sigma\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "ratio of cetrifugal force & gravitational force is: 31.7517\n", + "equivalent to gravity settling tank of crossectional area of in (m**2): 0.2358\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.2 page no : 261" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "sigma = 55.*10**6 #maximum stress\n", + "d = 35.2/100\n", + "rhos = 8890. #density of bronze\n", + "rho = 1105. #density of solution\n", + "t = 80./1000 #thickness\n", + "tau = 4.325/1000.\n", + "pi = 3.1428\n", + "\n", + "#calculation\n", + "#part1\n", + "ri = d/2.-t #radius internal\n", + "def fround(x,n):\n", + " # fround(x,n)\n", + " # Round the floating point numbers x to n decimal places\n", + " # x may be a vector or matrix# n is the integer number of places to round to\n", + " y = round(x*10**n)/10**n\n", + " return y\n", + "\n", + "omega = math.sqrt((sigma*tau*2/d)/(.5*rho*(d**2/4-ri**2)+rhos*tau*d/2))\n", + "N = 60*omega/2/pi\n", + "print \"The maximum safe speed allowed in rpm: %.4f\"%N\n", + "\n", + "#part2\n", + "P = .5*rho*(d**2./4-ri**2)*omega**2\n", + "P = fround(P/10**4,1)*10.**4\n", + "#print (P,\"the power in N/m**2:\")\n", + "print 'the power in N/m**2: %3.2e'%( P)\n", + "a = rho*omega**2*d/2\n", + "a = fround(a/10**6,1)*10**6\n", + "#print (a,\"pressure gradient in radial direction in N/m**3:\")\n", + "print 'pressure gradient in radial direction in N/m**3: %3.2e'%( a)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The maximum safe speed allowed in rpm: 2560.1495\n", + "the power in N/m**2: 8.65e+05\n", + "pressure gradient in radial direction in N/m**3: 1.40e+07\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.3 page no : 262" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "rhos = 1425. #density of organic pigment\n", + "rho = 998. #density of water\n", + "pi = 3.1428\n", + "omega = 360*2*pi/60.\n", + "mu = 1.25/1000.\n", + "t = 360.\n", + "r = 0.165+0.01\n", + "ro = 0.165\n", + "\n", + "#calculation\n", + "d = math.sqrt(18*mu*math.log(r/ro)/t/(rhos-rho)/omega**2)\n", + "print 'the minimum diameter in organic pigment in m: %3.1e'%( d)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the minimum diameter in organic pigment in m: 2.5e-06\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.4 page no : 263" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "rhos = 1455. #density of crystals\n", + "rho = 998. #density of wliquid\n", + "g = 9.81\n", + "pi = 3.1428\n", + "mu = 1.013/1000\n", + "omega = 2*pi*60000/60.\n", + "l = 0.5\n", + "d = 2*10.**-6. #dia of particles\n", + "r = 50.5/1000. #radius\n", + "t = 38.5/1000 #thickness of liquid\n", + "\n", + "#calculation\n", + "ri = r-t\n", + "V = pi*l*(r**2-ri**2)\n", + "Q = d**2*(rhos-rho)/18/mu*omega**2*V/math.log(r/ri)\n", + "print \"the maximum volumetric flow rate in (m**3/s): %.4f\"%Q\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the maximum volumetric flow rate in (m**3/s): 0.0104\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.5 pageno : 265" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "rhoc = 867. #density of cream\n", + "rhom = 1034. #density of skimmem milk\n", + "rm = 78.2/1000. #radius of skimmed milk\n", + "rc = 65.5/1000. #radius of cream\n", + "\n", + "#calculation\n", + "r = math.sqrt((rhom*rm**2-rhoc*rc**2)/(rhom-rhoc))\n", + "\n", + "# results\n", + "print \"distance of xis of rotation of cream milk interface in (m): %.4f\"%r\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "distance of xis of rotation of cream milk interface in (m): 0.1249\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.6 page no : 266" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "rho = 1.210 #density of air\n", + "mu = 1.78/10**5\n", + "g = 9.81\n", + "rhos = 2655. #density of ore\n", + "pi = 3.1428\n", + "d = 0.095\n", + "dp = 2.*10**-6 #particle diameter\n", + "dt = 0.333 #dia of cyclone separator\n", + "h = 1.28\n", + "\n", + "#calculation\n", + "U = dp**2*g*(rhos-rho)/18/mu\n", + "Q = 0.2*(pi*d**2/4)**2*d*g/U/pi/h/dt\n", + "print \"volumetric flow rate in(m**3/s): %.4f\"%Q\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "volumetric flow rate in(m**3/s): 0.0215\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 13.7 page no : 268" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "from numpy import linspace\n", + "# Initialization of Variable\n", + "b = 4.46*10**4\n", + "c = 1.98*10**4\n", + "s = 0.\n", + "def intregrate():\n", + " s = 0.\n", + " for i in range(10889):\n", + " d = linspace(0,10000,10889)\n", + " y = (1-math.exp(-b*d[i])*c*(1-math.exp(-c*d[i])))*0.69\n", + " s = s+y\n", + " a = y\n", + " return a\n", + "\n", + "a = intregrate()\n", + "\n", + "print \"overall efficiency of cyclone separator in %\",a*100\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "overall efficiency of cyclone separator in % 69.0\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch2-checkpoint.ipynb b/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch2-checkpoint.ipynb new file mode 100644 index 00000000..3ed00d28 --- /dev/null +++ b/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch2-checkpoint.ipynb @@ -0,0 +1,456 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:9728786ea75c57c39fe0761ee4fb63c15077dcd6bf03dc93443815257347de88" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 2 : pipe flow of gasses and gas liquid mixtures\n" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.1 page no : 27" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from scipy.optimize import fsolve\n", + "from math import *\n", + "\n", + "# Initialization of Variable\n", + "pi = 3.1428\n", + "mmm = 16.04/1000 #molar mass of methane\n", + "mV = 22.414/1000 #molar volume\n", + "R = 8.314\n", + "mu = 1.08/10**5\n", + "r = 4.2/100 #radius\n", + "rr = 0.026/2/r #relative roughness\n", + "Pfinal = 560.*1000.\n", + "tfinal = 273+24\n", + "l = 68.5\n", + "m = 2.35 #mass flow rate\n", + "\n", + "#calculation\n", + "A = pi*r**2\n", + "A = round(A*10.**5)/10.**5\n", + "rho = mmm/mV\n", + "rho24 = mmm*Pfinal*273/mV/101.3/tfinal #density at 24'C\n", + "u = m/rho24/A\n", + "Re = u*rho24*2*r/mu\n", + "\n", + "#from graph\n", + "phi = 0.0032\n", + "#for solving using fsolve we copy numerical value of constant terms\n", + "#using back calculation\n", + "#as pressure maintained should be more than Pfinal so guessed value is Pfinal\n", + "\n", + "def eqn(x):\n", + " y = m**2/A**2*log(x/Pfinal)+(Pfinal**2-x**2)/2/R/tfinal*mmm+4*phi*l/2/r*m**2/A**2\n", + " return y\n", + "x = fsolve(eqn,560*10**3)\n", + "print \"pressure maintained at compressor in (kN/m**2):\",x[0]/1000\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "pressure maintained at compressor in (kN/m**2): 960.06917347\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.2 pageno : 29" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from math import *\n", + "from numpy import *\n", + "from scipy.optimize import fsolve\n", + "\n", + "# Initialization of Variable\n", + "M = 28.8/1000\n", + "mu = 1.73/10**5\n", + "gamm = 1.402\n", + "P1 = 107.6*10**3\n", + "V = 22.414/1000\n", + "R = 8.314\n", + "temp = 285.\n", + "d = 4./1000\n", + "rr = 0.0008\n", + "phi = 0.00285\n", + "l = 68.5 \n", + "\n", + "#calculation\n", + "#constant term of equation\n", + "#part1\n", + "\n", + "a = 1.-8*phi*l/d #constant term in deff\n", + "def f(x):\n", + " return log(x**2)-x**2+2.938\n", + " \n", + "x = fsolve(f,1)\n", + "print x\n", + "z = 1./x[0]\n", + "z = round(z*1000.)/1000\n", + "print \"ratio of Pw/P1 : %.4f\"%z\n", + "\n", + "#part2\n", + "Pw = z*P1\n", + "nuw = V*P1*temp/Pw/M/273.\n", + "Uw = sqrt(nuw*Pw)\n", + "print \"maximum velocity in (m/s): %.4f\"%Uw\n", + "\n", + "#part3\n", + "Gw = pi*d**2/4*Pw/Uw\n", + "print \"maximum mass flow rate in(kg/s): %.4f\"%Gw\n", + "\n", + "#part4\n", + "G = 2.173/1000\n", + "J = G*Uw**2/2\n", + "print \"heat taken up to maintain isothermal codition(J/s): %.4f\"%J\n", + "\n", + "#part5\n", + "nu2 = 2.79 #found from graph\n", + "nu1 = R*temp/M/P1\n", + "P2 = P1*(nu1/nu2)**gamm\n", + "print \"crtical pressure ratio in adiabatic condition: %.4f\"%(P2/P1)\n", + "\n", + "#part6\n", + "Uw = sqrt(gamm*P2*nu2)\n", + "print \"velocity at adiabatic condition in (m/s): %.4f\"%Uw\n", + "\n", + "#part7\n", + "Gw = pi*d**2/4*Uw/nu2\n", + "print \"mass flow rate at adiabatic condition in (kg/s): %.4f\"%Gw\n", + "\n", + "\n", + "#part8\n", + "#polynomial in T of the form ax**2+bx+c = 0\n", + "c = gamm/(gamm-1)*P1*nu1+.5*Gw**2/pi**2/d**4*16*nu1**2\n", + "b = gamm/(gamm-1)*R/M\n", + "a = .5*Gw**2/pi**2/d**4*16*(R/M/P2)**2\n", + "y = poly1d([a,b,-c],False)\n", + "T2 = roots(y)\n", + "print \"temperature of discharging gas in (Celcius) : %.4f\"%(T2[1]-273)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[ 1.0268468]\n", + "ratio of Pw/P1 : 0.9740\n", + "maximum velocity in (m/s): 295.6723\n", + "maximum mass flow rate in(kg/s): 0.0045\n", + "heat taken up to maintain isothermal codition(J/s): 94.9841\n", + "crtical pressure ratio in adiabatic condition: 0.1629\n", + "velocity at adiabatic condition in (m/s): 261.8257\n", + "mass flow rate at adiabatic condition in (kg/s): 0.0012\n", + "temperature of discharging gas in (Celcius) : -46.3847" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + }, + { + "output_type": "stream", + "stream": "stderr", + "text": [ + "/usr/lib/python2.7/dist-packages/scipy/optimize/minpack.py:227: RuntimeWarning: The iteration is not making good progress, as measured by the \n", + " improvement from the last ten iterations.\n", + " warnings.warn(msg, RuntimeWarning)\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.3 pageno : 35" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "\n", + "#1 refer to initial condition\n", + "R=8.314\n", + "P1=550.*10**3\n", + "T1=273.+350\n", + "M=18./1000\n", + "d=2.4/100\n", + "pi=3.1428\n", + "A=pi*d**2./4\n", + "gamm=1.33\n", + "roughness=0.096/1000/d\n", + "l=0.85\n", + "phi=0.0035 #assumed value of friction factor\n", + "\n", + "#calculation\n", + "nu1=R*T1/M/P1\n", + "Pw=0.4*P1 #estimation\n", + "nuw=(P1/Pw)**0.75*nu1\n", + "enthalpy=3167*1000.\n", + "Gw=math.sqrt(enthalpy*A**2/(gamm*nuw**2/(gamm-1)-nu1**2/2-nuw**2/2))\n", + "def eqn(x):\n", + " return math.log(x/nu1)+(gamm-1)/gamm*(enthalpy/2*(A/Gw)**2*(1/x**2-1/nu1**2)+0.25*(nu1**2/x**2-1)-.5*math.log(x/nu1))+4*phi*l/d\n", + "\n", + "x=fsolve(eqn,0.2)\n", + "\n", + "if x[0] != nuw:\n", + " print \"we again have to estimate Pw/P1\"\n", + " print \"new estimate assumed as 0.45\"\n", + " Pw=0.45*P1 #new estimation\n", + " nuw=(P1/Pw)**0.75*nu1\n", + " # & we equalise nu2 to nuw\n", + " nu2=nuw \n", + " Gw=math.sqrt(enthalpy*A**2/(gamm*nuw**2/(gamm-1)-nu1**2./2-nuw**2./2))\n", + " print \"mass flow rate of steam through pipe kg/s): %.2f\"%(Gw) \n", + " #part 2\n", + " print \"pressure of pipe at downstream end in (kPa):\",Pw/1000\n", + "else:\n", + " print \"our estimation is correct\"\n", + "\n", + "#part3\n", + "enthalpyw=2888.7*1000. #estimated from steam table\n", + "Tw=math.sqrt((enthalpy-enthalpyw+.5*Gw**2/A**2*nu1**2)*2*A**2/Gw**2/R**2*M**2*Pw**2)\n", + "print \"temperature of steam emerging from pipe in (Celcius): %.4f\"%(Tw-273)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "we again have to estimate Pw/P1\n", + "new estimate assumed as 0.45\n", + "mass flow rate of steam through pipe kg/s): 0.46\n", + "pressure of pipe at downstream end in (kPa): 247.5\n", + "temperature of steam emerging from pipe in (Celcius): 209.9420\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.4 pageno : 39" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "M=28.05/1000\n", + "gamm=1.23\n", + "R=8.314\n", + "atm=101.3*1000\n", + "P1=3.*atm\n", + "\n", + "#calculation\n", + "P2=P1*(2./(gamm+1))**(gamm/(gamm-1))\n", + "print \"pressure at nozzle throat (kPa): %.4f\"%(P2/1000.)\n", + "\n", + "#part2\n", + "temp=273.+50\n", + "nu1=R*temp/P1/M\n", + "G=18. #mass flow rate\n", + "nu2=nu1*(P2/P1)**(-1/gamm)\n", + "A=G**2*nu2**2*(gamm-1)/(2*gamm*P1*nu1*(1-(P2/P1)**((gamm-1)/gamm)))\n", + "d=math.sqrt(4*math.sqrt(A)/math.pi)\n", + "print \"diameter required at nozzle throat in (cm) : %.4f\"%(d*100)\n", + "#part3\n", + "vel=math.sqrt(2*gamm*P1*nu1/(gamm-1)*(1-(P2/P1)**((gamm-1)/gamm)))\n", + "print \"sonic velocity at throat in(m/s): %.4f\"%vel\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "pressure at nozzle throat (kPa): 169.7903\n", + "diameter required at nozzle throat in (cm) : 18.8847\n", + "sonic velocity at throat in(m/s): 324.9787\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.5 page no : 41" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "T=273.+15\n", + "rho=999.\n", + "rhom=13559. #density of mercury\n", + "g=9.81\n", + "P2=764.3/1000*rhom*g\n", + "R=8.314\n", + "M=16.04/1000\n", + "d=4.5/1000.\n", + "A=math.pi*d**2/4.\n", + "G=0.75/1000 #mass flow rate\n", + "delP=(1-math.exp(R*T*G**2./2/P2**2/M/A**2))*P2\n", + "h=-delP/rho/g\n", + "print \"height of manometer in (cm) %.4f\"%(h*100)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "height of manometer in (cm) 16.7941\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 2.6 page no : 44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "rhol=931.\n", + "mu=1.55/10000 #viscosity of water\n", + "Vsp=0.6057 #specific volume\n", + "T=273+133.\n", + "mug=1.38/100000 #viscosity of steam\n", + "P=300*1000.\n", + "d=0.075\n", + "Gg=0.05 #mass flow gas phase\n", + "Gl=1.5 #mass flow liquid phase\n", + "A=math.pi*d**2./4\n", + "rho = 999.\n", + "#calculation\n", + "rhog=1./Vsp\n", + "rhog=round(rhog*1000)/1000.\n", + "velg=Gg/A/rhog\n", + "velg=round(velg*100)/100.\n", + "Reg=rhog*velg*d/mug\n", + "\n", + "#using chart\n", + "phig=0.00245 #friction factor gas phase\n", + "l=1\n", + "delPg=4*phig*velg**2*rhog/d\n", + "\n", + "#consider liquid phase\n", + "vell=Gl/A/rho\n", + "Rel=rho*vell*d/mu\n", + "if Rel>4000 and Reg>4000:\n", + " print \"both liquid phase and solid phase in turbulent motion\"\n", + " #from chart\n", + "\n", + "PHIg=5.\n", + "delP=PHIg**2.*delPg\n", + "print \"required pressure drop per unit length in (Pa) : %.4f\"%delP\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "both liquid phase and solid phase in turbulent motion\n", + "required pressure drop per unit length in (Pa) : 253.8050\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch3-checkpoint.ipynb b/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch3-checkpoint.ipynb new file mode 100644 index 00000000..092a98ed --- /dev/null +++ b/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch3-checkpoint.ipynb @@ -0,0 +1,325 @@ +{ + "metadata": { + "name": "" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 3 : velocity boundary layers\n" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 3.1 page no : 50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''\n", + "find\n", + "fluid in boundary layer would be entirely\n", + "reynolds \n", + "boundary layer width\n", + "velocity of water\n", + "shear stress \n", + "mean shear stress experienced\n", + "total force experienced\n", + "'''\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "rho=998.\n", + "mu=1.002/1000\n", + "x=48/100.\n", + "u=19.6/100\n", + "x1=30/100.\n", + "b=2.6\n", + "\n", + "#calculation\n", + "\n", + "print \"fluid in boundary layer would be entirely in streamline motion \"\n", + "Re=rho*x*u/mu\n", + "print \"reynolds no is %.2e\"%(Re)\n", + "\n", + "#part 2\n", + "Re1=rho*x1*u/mu\n", + "delta=x1*4.64*Re1**-.5\n", + "print \"boundary layer width in (mm): %.4f\"%(delta*1000)\n", + "\n", + "#part3\n", + "y=0.5*delta #middle of boundary layer\n", + "ux=3/2*u*y/delta-.5*u*(y/delta)**3\n", + "print \"velocity of water in (cm/s): %.4f\"%(ux*100)\n", + "\n", + "#part4\n", + "R=0.323*rho*u**2*Re1**-0.5\n", + "print \"shear stress at 30cm in (N/m**2): %.4f\"%R\n", + "\n", + "#part5\n", + "Rms=0.646*rho*u**2*Re**-0.5\n", + "print \"mean shear stress experienced over whole plate in (N/m**2) %.4f\"%Rms\n", + "\n", + "#part6\n", + "F=Rms*x*b\n", + "print \"total force experienced by the plate in (N) %.4f\"%F\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "fluid in boundary layer would be entirely in streamline motion \n", + "reynolds no is 9.37e+04\n", + "boundary layer width in (mm): 5.7520\n", + "velocity of water in (cm/s): 8.5750\n", + "shear stress at 30cm in (N/m**2): 0.0512\n", + "mean shear stress experienced over whole plate in (N/m**2) 0.0809\n", + "total force experienced by the plate in (N) 0.1010\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 3.2 page no : 52" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''\n", + "find\n", + "% of surface over which turbulent boundary layer \n", + "thickness of boundary layer \n", + "velocity of air at mid point \n", + "thickness of laminar boundary layer\n", + "velocity at outer edge of laminar sublayer\n", + "shearforce expericienced\n", + "mean shearforce \n", + "total drag force expericienced by the plate \n", + "'''\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "P=102.7*1000\n", + "M=28.8/1000\n", + "R=8.314\n", + "temp=273+18\n", + "Recrit=10.**5\n", + "u=18.4\n", + "b=4.7#width\n", + "x=1.3\n", + "mu=1.827/100000\n", + "\n", + "#calculation\n", + "#part1\n", + "rho=P*M/R/temp\n", + "xcrit=Recrit*mu/rho/u\n", + "a=1-xcrit/1.65\n", + "print \"%% of surface over which turbulent boundary layer exist is : %.4f\"%(a*100)\n", + "\n", + "#part2\n", + "Rex=rho*u*x/mu\n", + "thik=0.375*Rex**-.2*x\n", + "print \"thickness of boundary layer in (cm): %.4f\"%(thik*100)\n", + "\n", + "y=0.5*thik\n", + "ux=u*(y/thik)**(1./7)\n", + "print \"velocity of air at mid point is (m/s): %.4f\"%ux\n", + "\n", + "#part4\n", + "lthik=74.6*Rex**-.9*x\n", + "print \"thickness of laminar boundary layer in (mm): %.4f\"%(lthik*1000)\n", + "\n", + "#part5\n", + "ub=u*(lthik/thik)**(1./7)\n", + "print \"velocity at outer edge of laminar sublayer in (m/s): %.4f\"%ub\n", + "\n", + "#part6\n", + "R=0.0286*rho*u**2*Rex**-0.2\n", + "print \"shearforce expericienced in (N/m**2) : %.4f\"%R\n", + "\n", + "#part7\n", + "x1=1.65 #length of plate\n", + "Rex1=rho*u*x1/mu\n", + "Rms=0.0358*rho*u**2*Rex1**-0.2\n", + "print \"mean shearforce in (N/m**2): %.4f\"%Rms\n", + "\n", + "#part8\n", + "F=x1*Rms*b\n", + "print \"total drag force expericienced by the plate is (N): %.4f\"%F\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "% of surface over which turbulent boundary layer exist is : 95.0776\n", + "thickness of boundary layer in (cm): 2.7997\n", + "velocity of air at mid point is (m/s): 16.6653\n", + "thickness of laminar boundary layer in (mm): 0.2528\n", + "velocity at outer edge of laminar sublayer in (m/s): 9.3924\n", + "shearforce expericienced in (N/m**2) : 0.6798\n", + "mean shearforce in (N/m**2): 0.8114\n", + "total drag force expericienced by the plate is (N): 6.2921\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 3.3 page no : 55" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''\n", + "find\n", + "pipe flow reynolds\n", + "Water will be in streamline motion in the pipe\n", + "velocity gradient at the pipe wall\n", + "Sherastress at pipe wall\n", + "new av. fluid velocity \n", + "thickness of laminar sublayer\n", + "thickness of buffer layer \n", + "percentage of pipe-s core occupied by turbulent core\n", + "velocity where sublayer and buffer layer meet \n", + "velocity where turbulent core and buffer layer meet\n", + "fluid velocity \n", + "shearstress \n", + "'''\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "Q=37.6/1000000\n", + "d=3.2/100\n", + "mu=1.002/1000\n", + "rho=998.\n", + "pi=3.14\n", + "\n", + "#calculation\n", + "#part1\n", + "u=4.*Q/pi/d**2.\n", + "Re=rho*u*d/mu\n", + "print \"pipe flow reynolds no : %.4f\"%Re\n", + "print \"Water will be in streamline motion in the pipe\"\n", + "\n", + "#part2\n", + "a=-8.*u/d\n", + "print \"velocity gradient at the pipe wall is (s**-1): %.4f\"%a\n", + "\n", + "#part3\n", + "Ro=-mu*a\n", + "print \"Sherastress at pipe wall is N/m**2) %.2e\"%(Ro)\n", + "\n", + "#part4\n", + "Q=2.10/1000\n", + "u=4.*Q/pi/d**2\n", + "u=round(u*1000.)/1000.\n", + "print \"new av. fluid velocity is (m/s): %.4f\"%u\n", + "\n", + "Re=rho*u*d/mu\n", + "phi=0.0396*Re**-0.25 #friction factor\n", + "phi=round(phi*10**5)/10.**5\n", + "delb=5*d*Re**-1*phi**-.5\n", + "print \"thickness of laminar sublayer in (10**-6m): %.4f\"%(delb*10**6)\n", + "\n", + "#part5\n", + "y=30.*d/phi**0.5/Re #thickness\n", + "tbl=y-delb\n", + "print \"thickness of buffer layer in (mm): %.4f\"%(tbl*1000)\n", + "\n", + "#part6\n", + "A=pi*d**2./4 #cross sectional area of pipe\n", + "dc=d-2*y #dia of turbulent core\n", + "Ac=pi*dc**2/4.\n", + "p=(1-A/Ac)*100.\n", + "print \"percentage of pipe-s core occupied by turbulent core is (%%): %.4f\"%p\n", + "\n", + "#part7\n", + "uplus=5. #from reference\n", + "ux=uplus*u*phi**0.5\n", + "print \"velocity where sublayer and buffer layer meet is (m/s): %.4f\"%ux\n", + "\n", + "#part8\n", + "yplus=30. #from reference\n", + "ux2=u*phi**0.5*(2.5*math.log(yplus)+5.5)\n", + "print \"velocity where turbulent core and buffer layer meet is (m/s): %.4f\"%ux2\n", + "\n", + "#part9\n", + "us=u/0.81\n", + "print \"fluid velocity along the pipe axis (m/s): %.4f\"%us\n", + "\n", + "#part10\n", + "Ro=phi*rho*u**2\n", + "print \"shearstress at pipe wall (N/m**2): %.4f\"%Ro\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "pipe flow reynolds no : 1490.8400\n", + "Water will be in streamline motion in the pipe\n", + "velocity gradient at the pipe wall is (s**-1): -11.6939\n", + "Sherastress at pipe wall is N/m**2) 1.17e-02\n", + "new av. fluid velocity is (m/s): 2.6120\n", + "thickness of laminar sublayer in (10**-6m): 39.8159\n", + "thickness of buffer layer in (mm): 0.1991\n", + "percentage of pipe-s core occupied by turbulent core is (%): -3.0544\n", + "velocity where sublayer and buffer layer meet is (m/s): 0.6304\n", + "velocity where turbulent core and buffer layer meet is (m/s): 1.7655\n", + "fluid velocity along the pipe axis (m/s): 3.2247\n", + "shearstress at pipe wall (N/m**2): 15.8647\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch4-checkpoint.ipynb b/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch4-checkpoint.ipynb new file mode 100644 index 00000000..5938d17b --- /dev/null +++ b/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch4-checkpoint.ipynb @@ -0,0 +1,431 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:ffc24e4736ce76886d42f423c1c0ec0d6d6df9d9e5919471cf9355fdd075f7c0" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 4 : Flow Measurement\n" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.1 page no : 65" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "rho=998.\n", + "rhom=1.354*10**4#density of mercury\n", + "M=2.83/100\n", + "mu=1.001/1000\n", + "mun=1.182/10**5#vicosity of natural gas\n", + "R=8.314\n", + "g=9.81\n", + "h=28.6/100\n", + "d=54./100\n", + "\n", + "#part1\n", + "nu=1./rho\n", + "delP=h*g*(rhom-rho)\n", + "umax=math.sqrt(2.*nu*delP)\n", + "umax=round(umax*10.)/10\n", + "print \"maximum fluid velocity in (m/s)\",umax\n", + "Re=umax*d*rho/mu\n", + "print \"reynold no. is %.2e\"%(Re)\n", + "\n", + "#using chart\n", + "u=0.81*umax\n", + "G=rho*math.pi*d**2./4*u\n", + "print \"mass flow rate in (kg/s): %.4f\"%G\n", + "print \"Volumetric flow rate in (m**3/s): %.4f\"%(G/rho)\n", + "\n", + "#part2\n", + "P1=689.*1000 #initial pressure\n", + "T=273+21.\n", + "nu1=R*T/M/P1\n", + "nu1=round(nu1*10000)/10000.\n", + "rhog=1./nu1 #density of gas\n", + "h=17.4/100\n", + "P2=P1+h*(rho-rhog)*g\n", + "P2=round(P2/100)*100.\n", + "umax2=math.sqrt(2*P1*nu1*math.log(P2/P1))\n", + "print \"maximum fluid velocity in (m/s) %.4f\"%umax2\n", + "Re=rhog*umax2*d/mun\n", + "print \"reynold no. is %.3e\"%(Re)\n", + "#from table\n", + "u=0.81*umax2\n", + "Q=math.pi*d**2/4*u\n", + "print \"volumetric flow rate is (m**3/s): %.4f\"%Q\n", + "print \"mass flow rate in (kg/s): %.4f\"%(Q*rhog)\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "maximum fluid velocity in (m/s) 8.4\n", + "reynold no. is 4.52e+06\n", + "mass flow rate in (kg/s): 1555.1499\n", + "Volumetric flow rate in (m**3/s): 1.5583\n", + "maximum fluid velocity in (m/s) 20.6358\n", + "reynold no. is 7.518e+06\n", + "volumetric flow rate is (m**3/s): 3.8281\n", + "mass flow rate in (kg/s): 30.5271\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.2 page no : 67" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "import numpy\n", + "from matplotlib import pyplot as plt\n", + "%pylab inline\n", + "\n", + "# Initialization of Variable\n", + "rd = numpy.true_divide([0, 1, 2.5, 5 ,10, 15, 17.5],100) #radial distance from pipe\n", + "dlv = numpy.true_divide([0,0.2, 0.36, 0.54, 0.81, 0.98, 1],100) #differnce in liquid levels\n", + "r = [.175 ,.165, .150, .125 ,.075, .025, 0]\n", + "g = 9.81\n", + "R = 8.314\n", + "rho = 999.\n", + "temp = 289.\n", + "P1 = 148 * 1000.\n", + "M = 7.09 / 100.\n", + "pi = 3.12\n", + "rhoCl2 = P1 * M / R / temp #density of Cl2\n", + "nuCl2 = 1 / rhoCl2 #specific volume of Cl2\n", + "def P2(x):\n", + " return P1+x*(rho-rhoCl2)*g\n", + "\n", + "u = [0,0,0,0,0,0,0]\n", + "a = [0,0,0,0,0,0,0]\n", + "\n", + "for i in range(7):\n", + " y = P2(dlv[i])\n", + " u[i] = math.sqrt(2.*P1*nuCl2*math.log(y/P1))\n", + " a[i] = u[i] * r[i]\n", + "\n", + "plt.plot(r,a)\n", + "plt.xlabel(\"r (m)\")\n", + "plt.ylabel(\"u*r (m**2/s)\")\n", + "s=0\n", + "for i in range(6): #itegration of the plotted graph\n", + " s=abs((r[i]-r[i+1])*.5*(a[i]+a[1]))+s\n", + "\n", + "s=s-0.01\n", + "Q=2*pi*s\n", + "plt.show()\n", + "#Result\n", + "print \"volumetric flow rate (m**3/s):\",Q\n", + "print \"mass flow rate of chlorine gas (kg/s)\",Q*rhoCl2\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Populating the interactive namespace from numpy and matplotlib\n" + ] + }, + { + "output_type": "stream", + "stream": "stderr", + "text": [ + "WARNING: pylab import has clobbered these variables: ['pi']\n", + "`%pylab --no-import-all` prevents importing * from pylab and numpy\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYkAAAEMCAYAAAAxoErWAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlcVPX+P/DX4IwbkJbiNoOigoC7BlpmRlmiXsM90VJ/\nhqaGlbZ3uylYeeWqlUoZ9c28ZiFeU3GDCnHcFQu3csMFHUdzKTUVExjO749PkgjDOmc+s7yejweP\nGDlz5oUd5z3ns2oURVFARERUAg/ZAYiIyHGxSBARkVUsEkREZBWLBBERWcUiQUREVrFIEBGRVaoW\nidTUVAQFBSEgIABxcXHFfj579mx06tQJnTp1Qrt27aDVanHlyhU1IxERUQVo1JonYbFYEBgYiLS0\nNOj1eoSGhiIxMRHBwcElHr927Vp89NFHSEtLUyMOERFVgmp3EhkZGfD394efnx90Oh0iIyORnJxs\n9fhvvvkGw4cPVysOERFVgmpFwmw2w9fXt/CxwWCA2Wwu8dicnBx89913GDx4sFpxiIioErRqnVij\n0ZT72DVr1qB79+6oW7dulc9FRER/q2qPgmp3Enq9HiaTqfCxyWSCwWAo8dilS5eW2dSkKIpDfU2b\nNk16BmfI5Ki5mImZ3CGXLahWJEJCQpCVlYXs7Gzk5uYiKSkJERERxY67evUqNm/ejP79+6sVhYiI\nKkm15iatVov4+HiEh4fDYrEgKioKwcHBSEhIAACMHz8eALBq1SqEh4ejVq1aakUhIqJKUq1IAECf\nPn3Qp0+fIn92uzjcNnr0aIwePVrNGKoICwuTHaEYR8wEOGYuZiofZio/R81VVarNk7AljUZjs/Y1\nIiJ3YYv3Ti7LQUREVrFIEBGRVSwSRERkFYsEERFZxSJBRERWsUgQEZFVLBJERGQViwQREVnFIkFE\nRFaxSBARkVUsEkREZBWLBBERWcUiQUREVrFIEBGRVSwSRERkFYsEERFZxSJBRERWsUgQEZFVLBJE\nRGQViwQREVmllR2AiJzXpUtAYiJQuzbQoMHfXz4+gKcnoNH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atm3bhpCQkMLHOTk56NmzJ37+\n+Wd4e3tj6tSpSE9Px8qVKzF16tTC47p06YLNmzfb7XcgshXVdqYjclbNmjVDly5dSvzZqVOn0Lhx\n48LH1atXR3h4OACgXbt2qFmzJqpVq4a2bdsiOzu78LjGjRsXeUzkLHgnQXQXT0/PUn9+Zz/Fnev1\ne3h4oHr16oXf5+fnF3mOmqu6EqmFRYKoApo1a4Zz585V+Hnnzp1Ds2bNVEhEpC4WCaK7lPaJv3v3\n7vjxxx+tHnvn4zu/z8jIQI8ePWyYksg+uMAfUQWcOHECL7zwAtatW1eh54WFhWHZsmVo0KCBSsmI\n1ME7CaIKaNGiBby9vSs8mc7f358FgpwS7ySIiMgq3kkQEZFVLBJERGQViwQREVnFIkFERFaxSBAR\nkVUsEkREZNX/B8MTpny5+pGIAAAAAElFTkSuQmCC\n", + "text": [ + "" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "volumetric flow rate (m**3/s): 0.455983319661\n", + "mass flow rate of chlorine gas (kg/s) 1.99135662691\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.3 page no : 70 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "pi = 3.14\n", + "Cd = 0.61\n", + "rho = 999.\n", + "rhoo = 877. #density of oil\n", + "g = 9.81\n", + "h = 75/100.\n", + "d = 12.4/100. #dia of orifice\n", + "d1 = 15/100. #inside diameter\n", + "nuo = 1/rhoo #specific volume of oil\n", + "\n", + "#calculation\n", + "#part1\n", + "delP = h*(rho-rhoo)*g\n", + "A = pi*d**2./4\n", + "G = Cd*A/nuo*math.sqrt(2*nuo*delP/(1-(d/d1)**4))\n", + "print \"mass flow rate in (kg/s) %.4f\"%G\n", + "\n", + "#part2\n", + "h = (1.+0.5)*d1\n", + "delP = rhoo/2*(G*nuo/Cd/A)**2*(1-(d/d1)**4)+h*rhoo*g\n", + "print \"pressuer differnce between tapping points %.4f\"%delP\n", + "delh = (delP-h*rhoo*g)/(rho-rhoo)/g\n", + "print \"difference in water levels in manometer i (cm) %.4f\"%delh\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "mass flow rate in (kg/s) 12.6544\n", + "pressuer differnce between tapping points 2833.3733\n", + "difference in water levels in manometer i (cm) 0.7500\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.4 page no : 72" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "rhom = 1.356*10**4 #density mercury\n", + "rhon = 1266. #density NaOH\n", + "Cd = 0.61\n", + "g = 9.81\n", + "Cdv = 0.98 #coeff. of discharge of venturimeter\n", + "Cdo = Cd #coeff. of discharge of orificemeter\n", + "d = 6.5/100\n", + "pi = 3.14\n", + "A = pi*d**2/4.\n", + "Q = 16.5/1000.\n", + "h = 0.2 #head differnce\n", + "\n", + "#calculation\n", + "#part1\n", + "delP = g*h*(rhom-rhon)\n", + "G = rhon*Q\n", + "nun = 1./rhon#specific volume of NaOH\n", + "Ao = G*nun/Cd*math.sqrt(1./(2*nun*delP+(G*nun/Cd/A)**2)) #area of orifice\n", + "d0 = math.sqrt(4.*Ao/pi)\n", + "print \"diameter of orifice in (cm): %.4f\"%(d0*100)\n", + "\n", + "#part2\n", + "a = (Cdv/Cdo)**2\n", + "print \"ratio of pressure drop %.4f\"%a\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "diameter of orifice in (cm): 5.8041\n", + "ratio of pressure drop 2.5810\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.5 page no : 74" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "M = 3.995/100\n", + "g = 9.81\n", + "R = 8.314\n", + "Cd = 0.94\n", + "temp = 289.\n", + "df = 9.5/1000 #diameter of float\n", + "Af = math.pi*df**2/4. #area of float\n", + "P = 115.*10.**3.\n", + "V = 0.92/10**6\n", + "rhoc = 3778. #density of ceramic\n", + "\n", + "#calculation\n", + "rho = P*M/R/temp\n", + "nu = 1/rho\n", + "P = V*(rhoc-rho)*g/Af\n", + "print \"pressure drop over the float in (Pa): %.4f\"%P\n", + "\n", + "#part2\n", + "x = .15/25.*(25-7.6)\n", + "L = df*100.+2*x\n", + "L = L/100.\n", + "A1 = math.pi*L**2./4\n", + "A0 = A1-Af\n", + "G = Cd*A0*math.sqrt(2.*rho*P/(1-(A0/A1)**2))\n", + "print \"mass flow rate in kg/s) is %.3e\"%(G)\n", + "Q = G/rho\n", + "print \"Volumetric flow rate in (m**3/s): %f\"%Q\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "pressure drop over the float in (Pa): 480.7971\n", + "mass flow rate in kg/s) is 1.475e-03\n", + "Volumetric flow rate in (m**3/s): 0.000772\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 4.6 page no : 77" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "rho = 999.\n", + "rhos = 8020. #density of steel\n", + "g = 9.81\n", + "math.pi = 3.14\n", + "df = 14.2/1000 #dia of float\n", + "Af = math.pi*df**2/4. #area of float\n", + "Cd = 0.97\n", + "nu = 1./rho\n", + "Q = 4./1000./60\n", + "G = Q*rho\n", + "\n", + "#calculation\n", + "x = 0.5*(18.8-df*1000)/280*(280-70)\n", + "L = df*1000.+2*x\n", + "L = L/1000.\n", + "A1 = math.pi*L**2./4\n", + "A0 = A1-Af\n", + "Vf = Af/g/(rhos-rho)/2/nu*(G*nu/Cd/A0)**2*(1-(A0/A1)**2)\n", + "m = Vf*rhos\n", + "print \"mass of float equired in (g): %.4f\"%(m*1000)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "mass of float equired in (g): 5.1176\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch5-checkpoint.ipynb b/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch5-checkpoint.ipynb new file mode 100644 index 00000000..9a1752c6 --- /dev/null +++ b/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch5-checkpoint.ipynb @@ -0,0 +1,705 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:f59ee9dc4c5262ffa9663e99f39b4e3b3c7c93a564a44e8c761f2c4379d0bbed" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 5 : Flow measurement in open channel\n" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.1 page no : 83" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "rho = 999.7;\n", + "g = 9.81;\n", + "mu = 1.308/1000;\n", + "s = 1./6950;\n", + "b = 0.65;\n", + "h = 32.6/100;\n", + "n = 0.016;\n", + "\n", + "#calculation\n", + "A = b*h;\n", + "P = b+2*h;\n", + "m = A/P;\n", + "u = s**.5*m**(2./3)/n;\n", + "Q = A*u\n", + "\n", + "print \"volumetric flow rate (m**3/s): %.4f\"%Q\n", + "C = u/m**0.5/s**0.5;\n", + "print \"chezy coefficient (m**0.5/s): %.4f\"%C\n", + "a = -m*rho*g*s/mu #delu/dely\n", + "print \"velocity gradient in the channel (s**-1): %.4f\"%a\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "volumetric flow rate (m**3/s): 0.0474\n", + "chezy coefficient (m**0.5/s): 46.1814\n", + "velocity gradient in the channel (s**-1): -175.5764\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.2 page no : 85" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "Q = 0.885\n", + "pi = 3.1428\n", + "s = 1./960\n", + "s = round(s*1000000)/1000000.\n", + "b = 1.36\n", + "n = 0.014\n", + "theta = 55.*pi/180.\n", + "\n", + "#calculation\n", + "\n", + "def flow(x):\n", + " a = (x*(b+x/math.tan(theta)))/(b+2*x/math.sin(theta))\n", + " y = a**(2./3)*s**(1./2)*(x*(b+x/math.tan(theta)))/n-Q\n", + " return y\n", + "x = fsolve(flow,0.1)\n", + "\n", + "print \"depth of water in (m): %.4f\"%x[0]\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "depth of water in (m): 0.4813\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.3 page no : 86" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from scipy.optimize import fsolve \n", + "import math \n", + "from numpy import *\n", + "\n", + "# Initialization of Variable\n", + "n = 0.011\n", + "h = 0.12\n", + "Q = 25./10000.\n", + "\n", + "#calculation\n", + "def f(x): \n", + "\t return 1./x**2-1\n", + "\t \n", + "x = fsolve(f,0.1)\n", + "theta = 2.*arctan(x)\n", + "A = h*2*h/math.tan(theta/2)/2.\n", + "P = 2.*h*math.sqrt(2.)\n", + "s = Q**2.*n**2.*P**(4./3)/A**(10./3)\n", + "print \"the slope of channel in (radians): %f\"%s\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the slope of channel in (radians): 0.000246\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.4 pageno : 88" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "\n", + "#part1\n", + "#maximizing eqution in theta & get a function\n", + "def theta(x):\n", + " return (x-.5*math.sin(2.*x))/2/x**2.-(1-math.cos(2.*x))/2/x\n", + "\n", + "x = fsolve(theta,2.2)\n", + "x = round(x*1000.)/1000.\n", + "a = (1-math.cos(x))/2.\n", + "print \"velocity will be maximum when stream depth in times of diameter is %.3f\"%(a)\n", + "\n", + "#part2\n", + "#maximizing eqution in theta & get a function\n", + "def theta2(x):\n", + " return 3*(x-.5*math.sin(2*x))**2*(1.-math.cos(2.*x))/2./x-(x-.5*math.sin(2.*x))**3./2./x**2 \n", + "\n", + "x1 = fsolve(theta2,2.2)\n", + "x1 = round(x1*1000)/1000.\n", + "a = (1-math.cos(x1))/2.\n", + "\n", + "print \"vlumetric flow will be maximum when stream depth in times of diameter is %.3f\"%(a)\n", + "\n", + "#part3\n", + "r = 1.\n", + "A = 1.*x-0.5*math.sin(2*x)\n", + "s = 0.35*3.14/180\n", + "P = 2.*x*r\n", + "C = 78.6\n", + "u = C*(A/P)**0.5*s**0.5\n", + "print \"maximum velocity of obtained fluid (m/s): %.4f\"%u\n", + "\n", + "#part4\n", + "print \"maximum flow rate obtained at angle in (radians): %.4f\"%x1\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "velocity will be maximum when stream depth in times of diameter is 0.813\n", + "vlumetric flow will be maximum when stream depth in times of diameter is 0.950\n", + "maximum velocity of obtained fluid (m/s): 4.7913\n", + "maximum flow rate obtained at angle in (radians): 2.6890\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.5 page no : 91" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from scipy.optimize import fsolve \n", + "import math \n", + "import numpy\n", + "\n", + "#example 5.5 \n", + "# Initialization of Variable\n", + "g = 9.81\n", + "h = 28./100\n", + "Cd = 0.62\n", + "B = 46./100\n", + "Q = 0.355\n", + "n = 2. #from francis formula\n", + "\n", + "#calcualtion\n", + "\n", + "#part1\n", + "u = math.sqrt(2*g*h)\n", + "print \"velocity of fluid (m/s): %.4f\"%u\n", + "\n", + "#part2a\n", + "H = (3.*Q/2./Cd/B/(2.*g)**0.5)**(2./3)\n", + "\n", + "print \"fluid depth over weir in (m): %.4f\"%H\n", + "\n", + "#part2b\n", + "#using francis formula\n", + "def root(x):\n", + " return Q-1.84*(B-0.1*n*x)*x**1.5\n", + "\n", + "x = fsolve(root,0.2)\n", + "print \"fluid depth over weir in if SI units uesd in (m): %.4f\"%x\n", + "\n", + "#part3\n", + "H = 18.5/100\n", + "Q = 22./1000\n", + "a = 15.*Q/8/Cd/(2*g)**0.5/H**2.5\n", + "theta = 2*numpy.arctan(a)\n", + "print \"base angle of the notch of weir (degrees) %.4f\"%(theta*180/3.14)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "velocity of fluid (m/s): 2.3438\n", + "fluid depth over weir in (m): 0.5622\n", + "fluid depth over weir in if SI units uesd in (m): 0.7196\n", + "base angle of the notch of weir (degrees) 91.2010\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.6 pageno : 93" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from numpy import poly1d\n", + "#from scipy.optimize import root\n", + "from numpy import *\n", + "# Initialization of Variable\n", + "\n", + "Q = 0.675\n", + "B = 1.65\n", + "D = 19.5/100\n", + "g = 9.81\n", + "\n", + "#caculation\n", + "u = Q/B/D\n", + "u = round(u*1000.)/1000.\n", + "E = D+u**2./2./g\n", + "y = poly1d([1,-E, 0, 8.53/1000],False)\n", + "#y = poly1d([8.53/1000, 0, -E, 1],False)\n", + "x = roots(y)\n", + "print \"alternative depth in (m) %.4f\"%x[0]\n", + "print \"It is shooting flow\"\n", + "Dc = 2./3*E\n", + "Qmax = B*(g*Dc**3)**0.5\n", + "print \"maximum volumetric flow (m**3/s) %.4f\"%Qmax\n", + "Fr = u/math.sqrt(g*D)\n", + "print \"Froude no. %.4f\"%Fr\n", + "a = (E-D)/E\n", + "print \"%% of kinetic energy in initial system %.4f\"%(a*100)\n", + "b = (E-x[0])/E\n", + "print \"%% of kinetic energy in final system %.4f\"%(b*100)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "alternative depth in (m) 0.3495\n", + "It is shooting flow\n", + "maximum volumetric flow (m**3/s) 0.7639\n", + "Froude no. 1.5169\n", + "% of kinetic energy in initial system 53.4987\n", + "% of kinetic energy in final system 16.6510\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.7 page no : 96" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from numpy import *\n", + "\n", + "# Initialization of Variable\n", + "\n", + "G = 338. #mass flow rate\n", + "rho = 998.\n", + "q = G/rho\n", + "E = 0.48\n", + "n = 0.015\n", + "g = 9.81\n", + "B = 0.4\n", + "y = poly1d([1, -E, 0 ,5.85/1000 ],False)\n", + "x = roots(y)\n", + "print \"alternate depths (m): %.4f %.4f\"%(x[0],x[1])\n", + "s = (G*n/rho/x[1]/(B*x[1]/(B+2*x[1]))**(2./3))**2\n", + "print \"slode when depth is 12.9cm %.4f\"%s\n", + "s = (G*n/rho/x[0]/(B*x[0]/(B+2*x[0]))**(2./3))**2\n", + "print \"slode when depth is 45.1cm %.4f\"%s\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "alternate depths (m): 0.4513 0.1291\n", + "slode when depth is 12.9cm 0.0461\n", + "slode when depth is 45.1cm 0.0018\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.8 page no : 97" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from numpy import *\n", + "\n", + "# Initialization of Variable\n", + "\n", + "pi = 3.14\n", + "theta = pi/3.\n", + "h = 1./math.tan(theta)\n", + "B = 0.845\n", + "E = 0.375\n", + "g = 9.81\n", + "\n", + "#calculation\n", + "#part1\n", + "\n", + "#deducing a polynomial(quadratic) in Dc \n", + "a = 5.*h\n", + "b = 3.*B-4*h*E\n", + "c = -2.*E*B\n", + "y = poly1d([a ,b ,c],False)\n", + "x = roots(y)\n", + "\n", + "print \"critical depth in (m): %.4f\"%x[1]\n", + "\n", + "#part2\n", + "Ac = x[1]*(B+x[1]*math.tan(theta/2))\n", + "Btc = B+x[1]*math.tan(theta/2.)*2\n", + "Dcbar = Ac/Btc\n", + "uc = math.sqrt(g*Dcbar)\n", + "print \"critical velocity (m/s): %.4f\"%uc\n", + "\n", + "#part3\n", + "Qc = Ac*uc\n", + "print \"Critical volumetric flow (m**3/s): %.4f\"%Qc\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "critical depth in (m): 0.2615\n", + "critical velocity (m/s): 1.4925\n", + "Critical volumetric flow (m**3/s): 0.3887\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.9 page no : 99" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "\n", + "B2 = 1.60 #breadth at 2\n", + "D2 = (1-0.047)*1.27 #depth at 2\n", + "g = 9.81\n", + "B1 = 2.95 #breadth at 1\n", + "D1 = 1.27 #depth at 1\n", + "Z = 0.\n", + "\n", + "#calculation\n", + "Q = B2*D2*(2*g*(D1-D2-Z)/(1-(B2*D2/B1/D1)**2))**0.5\n", + "print \"volumetric flow rate over flat topped weir over rectangular\\\n", + "section in non uniform width(m**3/s) : %.4f\"%Q\n", + "\n", + "#next part\n", + "B2 = 12.8\n", + "D1 = 2.58\n", + "Z = 1.25\n", + "Q = 1.705*B2*(D1-Z)**1.5\n", + "print \"volumetric flow rate over flat topped weir over rectangular section in uniform width (m**3/s): %.4f\"%Q\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "volumetric flow rate over flat topped weir over rectangularsection in non uniform width(m**3/s) : 2.4480\n", + "volumetric flow rate over flat topped weir over rectangular section in uniform width (m**3/s): 33.4743\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.10 page no : 102" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from numpy import linspace\n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "pi = 3.14\n", + "n = 0.022\n", + "B = 5.75\n", + "s = 0.15*pi/180\n", + "Q = 16.8\n", + "g = 9.81\n", + "\n", + "def normal(x):\n", + " y = Q-B*x/n*(B*x/(B+2*x))**(2./3)*s**0.5\n", + "\n", + "x = fsolve(normal,1.33)\n", + "print \"Normal depth in (m) : %.4f\"%x[0]\n", + "Dc = (Q**2/g/B**2)**(1./3)\n", + "print \"Critical depth in (m): %.4f\"%Dc\n", + "delD = .1\n", + "D = [1.55,1.65,1.75,1.85,1.95,2.05,2.15,2.25,2.35]\n", + "su = 0\n", + "for i in range(9):\n", + " delL = delD/s*(1-(Dc/D[i])**3.)/(1.-(x/D[i])**3.33)\n", + " su = su+delL\n", + "\n", + "print \"distance in (m) from upstream to that place: %.4f\"%su\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Normal depth in (m) : 1.3300\n", + "Critical depth in (m): 0.9547\n", + "distance in (m) from upstream to that place: 456.5757\n" + ] + }, + { + "output_type": "stream", + "stream": "stderr", + "text": [ + "/usr/lib/python2.7/dist-packages/scipy/optimize/minpack.py:227: RuntimeWarning: The iteration is not making good progress, as measured by the \n", + " improvement from the last ten iterations.\n", + " warnings.warn(msg, RuntimeWarning)\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 5.11 page no : 105" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from numpy import linspace\n", + "\n", + "# Initialization of Variable\n", + "\n", + "g = 9.81\n", + "q = 1.49\n", + "pi = 3.14\n", + "\n", + "#calculation\n", + "\n", + "#part1\n", + "Dc = (q**2/g)**.333\n", + "print \"critical depth in (m): %.4f\"%Dc\n", + "\n", + "#part2\n", + "n = 0.021\n", + "su = 1.85*pi/180 #slope upstream\n", + "sd = 0.035*pi/180 #slope downstream\n", + "Dnu = (n*q/math.sqrt(su))**(3./5)\n", + "Dnu = round(Dnu*1000)/1000.\n", + "print \"normal depth upstream in (m): %.4f\"%Dnu\n", + "Dnd = (n*q/math.sqrt(sd))**(3./5)\n", + "print \"normal depth downstream in (m): %.4f\"%Dnd\n", + "\n", + "#part3\n", + "D2u = -0.5*Dnu*(1-math.sqrt(1+8*q**2/g/Dnu**3))\n", + "D2u = round(D2u*1000)/1000.\n", + "print \"conjugate depth for upstream in (m): %.4f\"%D2u\n", + "D1d = -0.5*Dnd*(1-math.sqrt(1+8*q**2/g/Dnd**3))\n", + "print \"conjugate depth for downstream in (m): %.4f\"%D1d\n", + "\n", + "#part4\n", + "#accurate method\n", + "delD = .022\n", + "D = linspace(0.987,.022,9)\n", + "\n", + "dis = 0.\n", + "for i in range(8):\n", + " delL = delD/su*(1-(Dc/D[i])**3)/(1-(Dnu/D[i])**3.33)\n", + " dis = dis+delL\n", + "\n", + "print \"distance in (m) of occurence of jump by accurate method: %.4f\"%dis\n", + "\n", + "#not so accurate one\n", + "E1 = D2u+q**2./2./g/D2u**2\n", + "E2 = Dnd+q**2./2./g/Dnd**2\n", + "E2 = round(E2*1000)/1000.\n", + "E1 = round(E1*1000)/1000.\n", + "ahm = (D2u+Dnd)/2 #av. hyd.raulic mean\n", + "afv = .5*(q/D2u+q/Dnd) #av. fluid velocity\n", + "i = (afv*0.021/ahm**(2./3))**2\n", + "l = (E2-E1)/(su-i+0.0002)\n", + "print \"distance in (m) of occurence of jump by not so accurate method: %.4f\"%l\n", + "\n", + "#part5\n", + "rho = 998.\n", + "Eu = Dnu++q**2./2./g/Dnu**2\n", + "Eu = round(Eu*1000)/1000.\n", + "P = rho*g*q*(Eu-E1)\n", + "print \"power loss in hydraulic jump per unit width in (kW): %.4f\"%(P/1000)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "critical depth in (m): 0.6097\n", + "normal depth upstream in (m): 0.3500\n", + "normal depth downstream in (m): 1.1522\n", + "conjugate depth for upstream in (m): 0.9760\n", + "conjugate depth for downstream in (m): 0.2752\n", + "distance in (m) of occurence of jump by accurate method: 0.6270\n", + "distance in (m) of occurence of jump by not so accurate method: 4.4844\n", + "power loss in hydraulic jump per unit width in (kW): 2.6112\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch6-checkpoint.ipynb b/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch6-checkpoint.ipynb new file mode 100644 index 00000000..3eb6270f --- /dev/null +++ b/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch6-checkpoint.ipynb @@ -0,0 +1,481 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:0f5ebffba7421842791b4539c2f380869e20570438cc6f427747cc5e01bc6228" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 6 : pumping of liquids\n" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.1 page no : 115" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from numpy import *\n", + "\n", + "# Initialization of Variable\n", + "atp = 100.2*1000.\n", + "g = 9.81\n", + "rho_w = 996.\n", + "rho_toluene = 867.\n", + "vap_pre_toluene = 4.535*1000\n", + "viscosity_toluene = 5.26/10000\n", + "\n", + "#calculation\n", + "m = (atp-vap_pre_toluene)/rho_toluene/g\n", + "print \"Max. height of toluene supported by atm. pressure (in m): %.4f\"%m\n", + "\n", + "#part(1)\n", + "hopw = 0.650 #head of pump in terms of water\n", + "hopt = hopw*rho_w/rho_toluene #head of pump in terms of toluene\n", + "Q = 1.8*10**-3 #flow in m**3/s\n", + "d = 2.3*10**-2 #diameter of pipe\n", + "pi = 3.14127\n", + "\n", + "#u = 4*Q/pi/d**2\n", + "#substituting this for reynolds no.\n", + "Re = 4*Q*rho_toluene/pi/d/viscosity_toluene #reynolds no.\n", + "print \"reynolds no : %.4f\"%Re\n", + "phi = 0.0396*Re**-0.25\n", + "\n", + "\n", + "#since both LHS and RHS are function of x(max. ht. ab. toluene) \n", + "#we define a new variable to solve the eqn\n", + "#y = (atp/rho_toluene/g)-(vap_pre_toluene/rho_toluene/g)-(4*phi*16*Q**2*x/pi**2/d**5/g)-hopt\n", + "#y = x \n", + "#these are two equations\n", + "\n", + "b = array([0,((atp/rho_toluene/g)-(vap_pre_toluene/rho_toluene/g)-hopt)])\n", + "A = array([[1, -1],[1, 4*phi*16*Q**2/pi**2/d**5/g]])\n", + "x = linalg.solve(A ,b)\n", + "print \"the maximum height above toulene in the tank the pump can be \\\n", + "located without risk while flow rate is 1.80dm**3/s (in m): %.4f\"%x[0]\n", + "\n", + "#solution of part(2)\n", + "l = 9. #length \n", + "u = math.sqrt(((atp/rho_toluene/g)-(vap_pre_toluene/rho_toluene/g)-hopt-l)*d*g/4/phi/l) #fluid velocity in pipes\n", + "Q = pi*d**2*u/4\n", + "print \"Maximum delivery rate if pump is located 9m above toluene tank(in m**3/s) %.4f\"%Q\n", + "\n", + "#solution of part(3)\n", + "#clubing d together we get\n", + "Q = 1.8/1000.\n", + "a = (atp/rho_toluene/g)-(vap_pre_toluene/rho_toluene/g)-hopt-l\n", + "b = a*pi**2*g/4./9./16./Q**2/0.0396/(4*Q*rho_toluene/pi/viscosity_toluene)**-0.25\n", + "d = (1./b)**(1./4.75)\n", + "print \"minimum smooth diameter of suction pipe which will have flow \\\n", + "rate as (1.8 dm**3/s) for pump kept at 9 m high (in m):\",d\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Max. height of toluene supported by atm. pressure (in m): 11.2477\n", + "reynolds no : 164260.3512\n", + "the maximum height above toulene in the tank the pump can be located without risk while flow rate is 1.80dm**3/s (in m): 6.3463\n", + "Maximum delivery rate if pump is located 9m above toluene tank(in m**3/s) 0.0009\n", + "minimum smooth diameter of suction pipe which will have flow rate as (1.8 dm**3/s) for pump kept at 9 m high (in m): 0.0306728431855\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.2 pageno : 118" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "# Initialization of Variable\n", + "Q1 = 24.8/1000 #flow in pump 1\n", + "d1 = 11.8/100 #diameter of impeller 1\n", + "H1 = 14.7 #head of pump 1\n", + "N1 = 1450. #frequency of motor 1\n", + "Q2 = 48/1000. #flow in pump 2\n", + "\n", + "#calculation\n", + "H2 = 1.15*H1 #head of pump 2\n", + "specific_speed = N1*Q1**0.5/H1**0.75\n", + "N2 = specific_speed*H2**0.75/Q2**0.5 #frequency of motor 2\n", + "print \"frequency of motor 2 in rpm %.4f\"%N2 \n", + "d2 = math.sqrt(N2**2*H1/H2/N1**2/d1**2)\n", + "print \"diametr of impeller 2 (in m) %.4f\"%(1/d2 )\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "frequency of motor 2 in rpm 1157.4350\n", + "diametr of impeller 2 (in m) 0.1585\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.3 page no : 120" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from matplotlib.pyplot import *\n", + "import math \n", + "%pylab inline\n", + "\n", + "# Initialization of Variable\n", + "Q = [0, 0.01, 0.02, 0.03 ,0.04, 0.05] #discharge\n", + "effi_hyd = [65.4 ,71, 71.9, 67.7, 57.5, 39.2]\n", + "effi_over = [0 ,36.1, 56.0, 61.0, 54.1, 37.0]\n", + "H_sys = [0 ,0, 0, 0, 0, 0]\n", + "d = 0.114 #diameter of pipe\n", + "d_o = 0.096 #diameter of impeller\n", + "h = 8.75 #elevation\n", + "g = 9.81 #acc. of gravity\n", + "rho = 999. #denisity of water\n", + "l = 60. #length of pipe\n", + "theta = 0.611 #angle in radians\n", + "B = 0.0125 #width of blades\n", + "pi = 3.1412\n", + "mu = 1.109/1000 #viscosity of water\n", + "omega = 2*pi*1750/60.\n", + "H_theor = []\n", + "# calculation\n", + "for i in range(6):\n", + " if i == 0:\n", + " H_sys[i] = h\n", + " else:\n", + " H_sys[i] = h+8.*Q[i]**2./pi**2/d**4/g*(1+8*l*0.0396/d*(4*rho*Q[i]/pi/d/mu)**-0.25)\n", + " H_theor.append(omega**2*d_o**2/g-omega*Q[i]/2/pi/g/B/math.tan(theta))\n", + "\n", + "#H_theor = omega**2*d_o**2/g-omega*Q/2/pi/g/B/math.tan(theta)\n", + "#print (H_sys\"head of system (in m)\")\n", + "#print (H_theor)\n", + "H_eff = [0,0,0,0,0,0]\n", + "for i in range(6):\n", + " H_eff[i] = effi_hyd[i]*H_theor[i]/100.\n", + "\n", + "#print (H_eff)\n", + "plot(Q,effi_hyd, 'r--d')\n", + "plot(Q,effi_over, 'g')\n", + "plot(Q,H_eff,'k')\n", + "plot(Q,H_theor)\n", + "plot(Q,H_sys ,'c-')\n", + "title('system characteritics')\n", + "ylabel('Head(m)or Efficiency(%)')\n", + "xlabel('volumetric flow rate(m**3/s)')\n", + "show()\n", + "\n", + "#calculation of power\n", + "#at intersecting point using datatrip b/w H_sys &H_eff\n", + "Q = 0.0336\n", + "effi_over = 59.9\n", + "H_eff = 13.10\n", + "P = H_eff*rho*g*Q/effi_over/10\n", + "print \"Power required to pump fluid at this rate(in KW): %.4f\"%P \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Populating the interactive namespace from numpy and matplotlib\n" + ] + }, + { + "output_type": "stream", + "stream": "stderr", + "text": [ + "WARNING: pylab import has clobbered these variables: ['draw_if_interactive', 'pi', 'new_figure_manager']\n", + "`%pylab --no-import-all` prevents importing * from pylab and numpy\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYYAAAEXCAYAAACpuuMDAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzs3XdYU9f/B/B3QIYoAmE7EBRBhhutuIgDra0VJ+ACq9W2\nVm21/aFttaC2itUuZ611+1VEraNqHQhx4EDEBYiiCKiAioDslZzfH5FI2CObz+t58mTd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ELjxf6z7LLHWFcGKAAAAAElFTkSuQmCC\n", + "text": [ + "" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Power required to pump fluid at this rate(in KW): 7.2014\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.4 pageno : 123" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "from matplotlib.pyplot import *\n", + "\n", + "# Initialization of Variable\n", + "#each is increased by five units to make each compatible for graph plotting\n", + "Q = [0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1] #flow rate\n", + "HeffA = [20.63 ,19.99, 17.80, 14.46, 10.33, 5.71, 0, 0, 0, 0, 0 ] #Heff of pump A\n", + "HeffB = [18 ,17, 14.95, 11.90, 8.10, 3.90, 0, 0, 0, 0, 0] #Heff of pump B\n", + "alpha = 1.\n", + "h = 10.4\n", + "d = 0.14\n", + "l = 98.\n", + "pi = 3.1412\n", + "g = 9.81\n", + "rho = 999.\n", + "mu = 0.001109\n", + "H_sys = [0,0,0,0,0,0,0,0,0,0,0]\n", + "for i in range(11):\n", + " if i == 0:\n", + " H_sys[i] = h\n", + " else:\n", + " H_sys[i] = h+8*Q[i]**2/pi**2/d**4/g*(1+8*l*0.0396/d*(4*rho*Q[i]/pi/d/mu)**-0.25)\n", + "\n", + "#H_sys is head of the system\n", + "print \"the head of system in terms of height of water : \",H_sys\n", + "plot(Q,H_sys,'r--d')\n", + "plot(Q,HeffA ,'-c')\n", + "plot(Q,HeffB)\n", + "show()\n", + "\n", + "#at intersecting point using datatrip b/w H_sys &H_effA\n", + "print \"the flow rate at which H_sys takes over HeffA \",0.03339\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the head of system in terms of height of water : [10.4, 10.703503558535079, 11.434551925145852, 12.522017190713953, 13.934570851357016, 15.652293146483034, 17.66081196342499, 19.949010875049055, 22.507899154909985, 25.329974605787854, 28.4088306047139]\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAXYAAAD9CAYAAACoXlzKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlcVXX6wPHPZXVBcQNcwMAFFFBALZsmEzNLywWz0bEm\n3G1Ks1JHf2aJlmM6ak6Wk00jppZNWqFOGpNmOFqWpqDighsoKoiKoAhc4XJ+fxwlUIELdzn3Xp73\n68VLuZxz7vMNe/jyXZ6vTlEUBSGEEA7DSesAhBBCmJckdiGEcDCS2IUQwsFIYhdCCAcjiV0IIRyM\nJHYhhHAwlSb2wsJCunfvTnh4OMHBwcyYMQOA7Oxs+vTpQ2BgII8//jg5OTlWCVYIIUTVdFWtY8/P\nz6devXoUFxfz8MMPs2jRIjZt2kSzZs2YNm0aCxYs4OrVq8yfP99aMQshhKhElUMx9erVA+DmzZsY\nDAYaN27Mpk2bGDFiBAAjRoxgw4YNlo1SCCGE0apM7CUlJYSHh+Pj40OvXr0ICQnh4sWL+Pj4AODj\n48PFixctHqgQQgjjuFR1gZOTE0lJSeTm5vLEE0/www8/lPu6TqdDp9Pddd+9XhNCCFE1Uyu9GL0q\nxtPTk6eeeop9+/bh4+NDZmYmABkZGXh7e1cYnKN+xMTEaB6DtE/aVxvb58htUxTzlO6qNLFfvny5\ndMVLQUEBW7duJSIigoEDB7Jq1SoAVq1aRVRUlFmCEUIIYbpKh2IyMjIYMWIEJSUllJSU8Pzzz9O7\nd28iIiIYOnQoK1aswN/fn3Xr1lkrXiGEEFWoNLF36tSJ/fv33/V6kyZN2LZtm8WCsgeRkZFah2BR\n0j775sjtc+S2mUuV69hr/GCdzmzjRUIIUVuYI3dKSQEhhHAwktiFEHZDr9czYdgw9Hq91qHYNEns\nQgi7MW/cOIZ89RXvjB+vdSg2TRK7EMIuxMXGErFpE48a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yMxMZHu3btbNuBqMuX7B/Daa6+xcOFCnJxsrzCo\nKd+71NRUvLy8GDVqFF26dGHcuHHk5+dbLXZjmPK9a9KkCVOmTKF169a0bNmSRo0a8dhjj1ktdmMY\n0z5L3Gst5orRmNxS7f87jV2bbmu9OWPVtH1l78vLy+OZZ57hvffew8PDw6zxmaqm7VMUhW+++QZv\nb28iIiJs8vtryveuuLiY/fv389JLL7F//37q16/P/Pm2tVbalP/3Tp06xd///nfS0tK4cOECeXl5\nfPbZZ+YO0SSm7Huxhz0z5ojR2NxS7cRuzBr2O685d+4cvr6+Rt2rtZq27/avtUVFRQwZMoQ//elP\nREVFWSfoajClfT/99BObNm0iICCA4cOHs337dqKjo60We1VMaZuvry++vr7cf//9ADzzzDPs37/f\nOoEbyZT2/frrrzz00EM0bdoUFxcXnn76aX766SerxW4MU/KDo+SWylQrt1R3AqCoqEhp06aNkpqa\nquj1+ioncHbv3l06gWPMvVozpX0lJSXK888/r7z66qtWj9tYprSvrISEBKV///5WidlYpratR48e\nSkpKiqIoihITE6NMmzbNesEbwZT2JSYmKiEhIUp+fr5SUlKiREdHKx988IHV21CZ6uSHmJiYcpOL\njpJbbruzfdXNLdVO7IqiKFu2bFECAwOVtm3bKvPmzVMURVGWL1+uLF++vPSaCRMmKG3btlU6d+6s\n7Nu3r9J7bU1N27dz505Fp9MpYWFhSnh4uBIeHq58++23mrShMqZ8/25LSEiwuVUximJa25KSkpRu\n3bopnTt3VgYPHmxzq2IUxbT2LViwQAkODlZCQ0OV6Oho5ebNm1aPvypVtS8jI0Px9fVVGjZsqDRq\n1Ejx8/NTrl+/XuG9tqam7atubrHYQRtCCCG0YXtLG4QQQphEErsQQjgYSexCCOFgJLELIYSDkcQu\nhBAORhK7EEI4mP8HHfNwDjcyutAAAAAASUVORK5CYII=\n", + "text": [ + "" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the flow rate at which H_sys takes over HeffA 0.03339\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.5 pageno : 126" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "from numpy import *\n", + "\n", + "# Initialization of Variable\n", + "rho = 1000.\n", + "dc = .15\n", + "l = 7.8\n", + "g = 9.81\n", + "pi = 3.1428\n", + "atp = 105.4*1000\n", + "vap_pre = 10.85*1000\n", + "sl = .22\n", + "dp = 0.045\n", + "h = 4.6\n", + "\n", + "#(\"x(t) = sl/2*cos(2*pi*N*t)\" \"the function of print lcement\")\n", + "#\"since we have to maximize the acceleration double derivate the terms\")\n", + "#since double derivation have the term cos(kt) \n", + "#finding it maxima\n", + "t = linspace(0,5,100)\n", + "k = 1.\n", + "\n", + "def maximacheckerforcosine():\n", + " h = 0.00001\n", + " a = 0.00\n", + " for i in range(1,401): \n", + " if (math.cos(a+h)-math.cos(a-h))/2*h == 0 and math.cos(i-1)>0:\n", + " break\n", + " else:\n", + " a = 0.01+a\n", + " m = i-1\n", + " v = math.cos(i-1)\n", + " return m,v\n", + "\n", + "a, b = maximacheckerforcosine()\n", + "\n", + "print \"time t when the acceleration will be maximum(s)\",a\n", + "\n", + "#double derivative will result in a square of value of N\n", + "#lets consider its coefficient all will be devoid of N**2 \n", + "k = sl/2*(2*pi)**2 #accn max of piston\n", + "kp = k*1./4*pi*dc**2/1.*4/pi/dp**2 #accn coeff. ofsuction pipe\n", + "f = 1./4*pi*dp**2*l*rho*kp #force exerted by piston\n", + "p = f/1.*4./pi/dp**2 #pressure exerted by piston\n", + "\n", + "#calculation\n", + "o = atp-h*rho*g-vap_pre\n", + "#constant term of quadratic eqn\n", + "y = poly1d([-p, 0,o],False)\n", + "a = roots(y)\n", + "print \"Maximum frequency of oscillation if cavitation o be avoided(in Hz) %.4f\"%abs(a[0])\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "time t when the acceleration will be maximum(s) 0\n", + "Maximum frequency of oscillation if cavitation o be avoided(in Hz) 0.3622\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 6.6 pageno : 128" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "rhos = 1830. #density of acid\n", + "atp = 104.2*1000 #atmospheric pressure\n", + "temp = 11.+273 #temp in kelvin\n", + "M = 28.8/1000 #molar mass of air\n", + "R = 8.314 #universal gas constant\n", + "g = 9.81 #acceleration of gravity\n", + "pi = 3.14\n", + "d = 2.45 #diameter of tank\n", + "l = 10.5 #length of tank\n", + "h_s = 1.65 #height of surface of acid from below\n", + "effi = 0.93 #efficiency\n", + "\n", + "#calculation\n", + "mliq = pi*d**2*l*rhos/4\n", + "h_atm = atp/rhos/g #height conversion of atp\n", + "h_r = 4.3-1.65 #height difference\n", + "mair = g*h_r*mliq*M/(effi*R*temp*math.log(h_atm/(h_atm+h_s))) #mass of air\n", + "print \"mass of air required to lift the sulphuric acid tank %.4f\"%mair\n", + "print \"The negative sign indicates air is expanding & work done is magnitude of value in kg:\"\n", + "m = abs(mair/mliq)\n", + "print \"The mass of air required for per kilo of acid transferred: %.4f\"%m\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "mass of air required to lift the sulphuric acid tank -123.3851\n", + "The negative sign indicates air is expanding & work done is magnitude of value in kg:\n", + "The mass of air required for per kilo of acid transferred: 0.0014\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch7-checkpoint.ipynb b/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch7-checkpoint.ipynb new file mode 100644 index 00000000..1cf884f4 --- /dev/null +++ b/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch7-checkpoint.ipynb @@ -0,0 +1,200 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:2221589d3a230bd5e1c3d095a5ede0c1e2f30a613887d893f353723197c86dd5" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 7 : Flow Through Packed Beds\n" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "\n", + "example 7.1 page no : 136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "mu = 1.83/1000\n", + "rhom = 1.355*10000 #density mercury\n", + "K = 5.\n", + "g = 9.81\n", + "d = 2.5/100\n", + "pi = 3.14\n", + "thik = 2.73/100\n", + "rho = 3100. #density of particles\n", + "Q = 250./(12.*60+54)/10.**6\n", + "\n", + "#calculation\n", + "A = pi*d**2./4.\n", + "Vb = A*thik #volume of bed\n", + "Vp = 25.4/rho/1000 #volume of particles\n", + "e = 1-Vp/Vb\n", + "u = Q/A\n", + "delP = 12.5/100*rhom*g\n", + "S = math.sqrt(e**3*delP/K/u/thik/mu/(1-e)**2)\n", + "S = round(S/1000)*1000.\n", + "d = 6./S\n", + "print \"average particle diameter in (x10**-6m) %.4f\"%(d*10**6)\n", + "A = pi*d**2./1000/(4./3*pi*d**3/8*rho)\n", + "print \"surface area per gram of cement (cm**2): %.4f\"%(A*10**4)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "average particle diameter in (x10**-6m) 47.6190\n", + "surface area per gram of cement (cm**2): 406.4516\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.2 page no : 138" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "mu = 2.5/1000\n", + "rho = 897.\n", + "g = 9.81\n", + "pi = 3.1414\n", + "K = 5.1\n", + "l = 6.35/1000\n", + "d = l\n", + "hei = 24.5+0.65\n", + "len = 24.5\n", + "dc = 2.65 #dia of column\n", + "thik = 0.76/1000\n", + "Vs = pi*d**2/4*l-pi*l/4*(d-2*thik)**2 #volume of each ring\n", + "n = 3.023*10**6\n", + "e = 1-Vs*n\n", + "e = round(e*1000)/1000.\n", + "Surfacearea = pi*d*l+2*pi*d**2/4+pi*(d-2*thik)*l-2*pi*(d-2*thik)**2/4\n", + "S = Surfacearea/Vs\n", + "S = round(S)\n", + "delP = hei*g*rho\n", + "delP = round(delP/100.)*100.\n", + "u = e**3*delP/K/S**2/mu/(1-e)**2/len\n", + "Q = pi*dc**2/4*u\n", + "print \"initial volumetric flow rate in (m**3/s): %.4f\"%Q\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "initial volumetric flow rate in (m**3/s): 2.8271\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 7.3 page no : 140" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "dr = 2. #dia of column\n", + "mu = 2.02/10**5\n", + "rho = 998.\n", + "K = 5.1\n", + "g = 9.81\n", + "Q = 10000./3600\n", + "l = 50.8/1000\n", + "d = l\n", + "n = 5790.\n", + "len = 18.\n", + "thik = 6.35/1000\n", + "pi = 3.1414\n", + "\n", + "#part1\n", + "#calculation\n", + "\n", + "CA = pi*dr**2./4 #cross sectional area\n", + "u = Q/CA\n", + "Vs = pi*d**2/4*l-pi*l/4*(d-2*thik)**2 #volume of each ring\n", + "e = 1-Vs*n\n", + "Surfacearea = pi*d*l+2*pi*d**2/4+pi*(d-2*thik)*l-2*pi*(d-2*thik)**2/4\n", + "S = Surfacearea/Vs\n", + "S = round(S*10)/10.\n", + "delP = K*S**2/e**3*mu*len*u*(1-e)**2\n", + "delh = delP/rho/g\n", + "print \"pressure drop in terms of (cm of H20) %.4f\"%(delh*100)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "pressure drop in terms of (cm of H20) 0.3540\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch8-checkpoint.ipynb b/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch8-checkpoint.ipynb new file mode 100644 index 00000000..09ab4234 --- /dev/null +++ b/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch8-checkpoint.ipynb @@ -0,0 +1,442 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:00c3b1a67f83ca35bc811927488fe197c5bf1eb682a1e6ea0657f01c6f0d77b3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 8 : Filtration" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.1 page no : 145" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from numpy import *\n", + "\n", + "# Initialization of Variable\n", + "\n", + "a = 78./1000 #dV/dt\n", + "rho = 998. #density of water\n", + "rhoc = 2230. #density of china clay\n", + "rhod = 1324. #density of cowdung cake\n", + "mu = 1.003/1000\n", + "P2 = 3.23*1000 #pressure after 2 min.\n", + "P5 = 6.53*1000 #pressure after 5 min.\n", + "t = 30*60.\n", + "b = array([[P2],[P5]])\n", + "A = array([[(a**2)*120., a],[(a**2)*300., a]])\n", + "x = linalg.solve(A, b)\n", + "P = x[0]*a**2*t+x[1]*a\n", + "print \"pressure drop at t = 30min in (kN/m**2):\",P/1000\n", + "\n", + "#part2\n", + "J = 0.0278 #mass fraction\n", + "l = 1.25\n", + "b1 = 0.7\n", + "A1 = l*b1*17*2 #area of filtering\n", + "V = a*30*60. #volume of filterate\n", + "e = 1-rhod/rhoc\n", + "nu = J*rho/((1-J)*(1-e)*rhoc-J*e*rho)\n", + "l1 = nu*V/A1\n", + "print \"the thickness of filtercake formed after 30 min in (m): %.4f\"%l1\n", + "\n", + "#part3\n", + "r = x[0][0]/mu/nu*A1**2\n", + "L = x[1][0]*A1/r/mu\n", + "print \"thickness of cake required in (m): %.4f\"%L\n", + "\n", + "#part 4\n", + "S = math.sqrt(r*e**3./5/(1-e)**2)\n", + "d = 6./S\n", + "print \"average particle diameter in(10**-6m): %.4f\"%(d*10**6)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "pressure drop at t = 30min in (kN/m**2): [ 34.03]\n", + "the thickness of filtercake formed after 30 min in (m): 0.1026\n", + "thickness of cake required in (m): 0.0032\n", + "average particle diameter in(10**-6m): 87.9625\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.2 pageno :148" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from numpy import *\n", + "\n", + "\n", + "# Initialization of Variable\n", + "P1 = 5.34*1000 #pressure after 3 min.\n", + "P2 = 9.31*1000 #pressure after 8 min.\n", + "a = 240./1000000 #dV/dt\n", + "P3 = 15.*10**3 #final pressure\n", + "\n", + "#calculation\n", + "b = array([[P1],[P2]])\n", + "A = array([[a**2*180, a],[a**2*480, a]])\n", + "x = linalg.solve(A,b)\n", + "\n", + "#part1\n", + "t = (P3-x[1][0]*a)/x[0][0]/a**2\n", + "\n", + "print \"time at which the required pressure drop have taken place in (s): %.4f\"%t\n", + "\n", + "#part 2\n", + "V1 = a*t\n", + "print \"volume of filterate in (m**3): %.4f\"%V1\n", + "\n", + "#part 3\n", + "V2 = 0.75\n", + "t2 = t+x[0][0]/2/P3*(V2**2-V1**2)+x[1][0]/P3*(V2-V1)\n", + "print \"the time required to collect 750dm**3 of filterate in (s): %.4f\"%t2\n", + "\n", + "#part 4\n", + "P4 = 12.*10**3\n", + "a = P4/(x[0][0]*V2+x[1][0])\n", + "t = 10./1000/a\n", + "print \"time required to pass 10dm**3 volume in (s): %.4f\"%t\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "time at which the required pressure drop have taken place in (s): 909.9748\n", + "volume of filterate in (m**3): 0.2184\n", + "the time required to collect 750dm**3 of filterate in (s): 5289.2396\n", + "time required to pass 10dm**3 volume in (s): 153.8617\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.3 pageno : 150" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from numpy import *\n", + "\n", + "# Initialization of Variable\n", + "a = 16./1000 #dV/dt\n", + "J = 0.0876 #mass fraction\n", + "rho = 999. #density of water\n", + "rhoc = 3470. #density of slurry\n", + "mu = 1.12/1000\n", + "rhos = 1922. #density of dry filter cake\n", + "t1 = 3*60.\n", + "t2 = 8*60.\n", + "V1 = 33.8/1000 #volume at t1\n", + "V2 = 33.8/1000+23.25/1000 #volume at t2\n", + "P = 12*1000. #pressure difference\n", + "Ap = 70.**2./10000*2*9\n", + "As = 650/10000.\n", + "\n", + "#calculation\n", + "\n", + "b = array([t1,t2])\n", + "A = array([[V1**2/2/P, V1/P],[V2**2/2/P, V2/P]])\n", + "x = linalg.solve(A, b)\n", + "K1p = x[0]*As**2/Ap**2\n", + "K2p = x[1]*As/Ap\n", + "P2 = 15*1000. #final pressure drop\n", + "t = (P2-K2p*a)/K1p/a**2 #time for filterate\n", + "V = a*t #volume of filterate\n", + "e = 1-rhos/rhoc\n", + "nu = J*rho/((1-J)*(1-e)*rhoc-J*e*rho)\n", + "l = (11.-1)/200.\n", + "Vf = Ap*l/nu\n", + "tf = t+K1p/2/P2*(Vf**2-V**2)+K2p/P2*(Vf-V)\n", + "r = K1p/mu/nu*Ap**2\n", + "L = K2p*Ap/r/mu\n", + "print \"the thickness of filter which has resistance equal to resistance of filter medium in (m):%.5f\"%L\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the thickness of filter which has resistance equal to resistance of filter medium in (m):0.00247\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.4 page no : 154" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from numpy import *\n", + "\n", + "# Initialization of Variable\n", + "\n", + "t1 = 3*60. #time 3min\n", + "t2 = 12*60. #time 12min\n", + "t3 = 5*60. #time 5min\n", + "P = 45*1000. #pressure at t1&t2\n", + "P2 = 85*1000. #pres. at t3\n", + "a = 1.86 #area\n", + "mu = 1.29/1000.\n", + "c = 11.8\n", + "V1 = 5.21/1000 #volume at t1\n", + "V2 = 17.84/1000 #volume at t2\n", + "V3 = 10.57/1000 #volume at t3\n", + "\n", + "#calculation\n", + "b = array([t1,t2])\n", + "A = array([[mu*c/2/a**2/P*V1**2, V1/P],[mu*c/2/a**2/P*V2**2, V2/P]])\n", + "x = linalg.solve(A,b)\n", + "r45 = x[0]\n", + "r85 = (t3-x[1]*V3/P2)*2*a**2*P2/V3**2/mu/c\n", + "n = math.log(r45/r85)/math.log(45./85)\n", + "rbar = r45/(1-n)/(45.*1000)**n\n", + "r78 = rbar*(1-n)*(78.*1000)**n\n", + "\n", + "#part1\n", + "#polynomial in V as a1x**2+bx+c1 = 0\n", + "c1 = 90.*60 #time at 90 \n", + "Pt = 78*1000. #Pt = pressure at time t = 90\n", + "r78 = round(r78/10.**12)*10.**12\n", + "a1 = r78*mu/a**2/Pt*c/2.\n", + "b = x[1]/Pt\n", + "y = poly1d([a1,b,-c1],False)\n", + "V1 = roots(y)\n", + "print \"Volume at P = 90kPa in (m**3): %.4f\"%V1[1]\n", + "\n", + "#part2\n", + "Pt = 45.*1000\n", + "c1 = 90.*60\n", + "a1 = r45*mu/a**2/Pt*c/2\n", + "b = x[1]/Pt\n", + "y = poly1d([a1,b,-c1],False)\n", + "V1 = roots(y)\n", + "print \"Volume at p = 45kPa in (m**3): %.4f\"%V1[1]\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Volume at P = 90kPa in (m**3): 0.0660\n", + "Volume at p = 45kPa in (m**3): 0.0789\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.5 page no : 157" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from numpy import *\n", + "import math \n", + "\n", + "\n", + "# Initialization of Variable\n", + "t = 60*0.3/0.5 #time of 1 revollution\n", + "d = 34/1000000.\n", + "S = 6./d\n", + "e = 0.415\n", + "J = 0.154\n", + "P = 34.8*1000\n", + "mu = 1.17/1000\n", + "L = 2.35/1000\n", + "rho = 999. #density of water\n", + "rhos = 4430. #density of barium carbonate\n", + "\n", + "#calculation\n", + "#part1\n", + "nu = J*rho/((1-J)*(1-e)*rhos-J*e*rho)\n", + "r = 5*S**2*(1-e)**2/e**3\n", + "\n", + "#quadratic in l\n", + "#in the form of ax**2+bx+c = 0\n", + "c = -t\n", + "b = r*mu*L/nu/P\n", + "a = r*mu/2/nu/P\n", + "y = poly1d([a,b,c],False)\n", + "l = roots(y)\n", + "print \"thickness of filter cake in (m): %.4f\"%l[1]\n", + "\n", + "#part2\n", + "d = 1.2\n", + "l1 = 2.6\n", + "pi = 3.1428\n", + "u = pi*d*0.5/60\n", + "Q = u*l1*l[1]\n", + "mnet = Q*(1-e)*rhos+Q*e*rho\n", + "print \"rate at which wet cake will be scrapped in (kg/s): %.4f\"%mnet\n", + "\n", + "#part3\n", + "md = Q*(1-e)*rhos #rate at which solid scrapped from the drum\n", + "r = md/0.154\n", + "print \"rate of which slurry is treated is (kg/h): %.4f\"%(r*3600)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "thickness of filter cake in (m): 0.0122\n", + "rate at which wet cake will be scrapped in (kg/s): 3.0088\n", + "rate of which slurry is treated is (kg/h): 60635.4180\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 8.6 page no : 159" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "mu = 0.224\n", + "rho = 1328.\n", + "K = 5.\n", + "b = 3*.5 #radius\n", + "h = 2.5\n", + "pi = 3.1428\n", + "x = 2.1*.5\n", + "rhos = 1581. #density of sucrose\n", + "e = 0.435 #void ratio\n", + "J = 0.097 #mass fraction\n", + "m = 3500. #mass flowing\n", + "a = 85/10.**6 #side length\n", + "L = 48./1000 #thickness\n", + "omega = 2*pi*325./60.\n", + "\n", + "#calculation\n", + "bi = b**2-m/pi/h/(1-e)/rhos #inner radius\n", + "bi = math.sqrt(bi)\n", + "bi = round(bi*1000)/1000.\n", + "nu = J*rho/((1-J)*(1-e)*rhos-J*e*rho)\n", + "S = 6./a\n", + "r = 5*S**2*(1-e)**2/e**3\n", + "t = ((b**2-bi**2)*(1+2*L/b)+2*bi**2*math.log(bi/b))/(2*nu*rho*omega**2/r/mu*(b**2-x**2))\n", + "print \"time taken to collect sucrose crystal in (s): %.4f\"%t\n", + "\n", + "#part2\n", + "vl = pi*(b**2-bi**2)*h*e\n", + "vs = pi*(b**2-bi**2)*h/nu-vl\n", + "print \"volume of liquid separated as filterate i (m**3): %.4f\"%vs\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "time taken to collect sucrose crystal in (s): 3287.3308\n", + "volume of liquid separated as filterate i (m**3): 21.1677\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch9-checkpoint.ipynb b/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch9-checkpoint.ipynb new file mode 100644 index 00000000..8a82285f --- /dev/null +++ b/Problems_In_Fluid_Flow/.ipynb_checkpoints/ch9-checkpoint.ipynb @@ -0,0 +1,356 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:f2115f2ad7692dfe801ea214554c915af4da1fd1ef8995d6587f66bc81d26a08" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 9 : Forces on bodies immersed in fluids" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 9.1 pageno : 166" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "rho = 1.2\n", + "mu = 1.85/100000\n", + "pi = 3.1428\n", + "d = 3.\n", + "v = 50.*1000/3600\n", + "\n", + "#calculation part 1\n", + "Re = d*rho*v/mu\n", + "\n", + "#from chart of drag coeff. vs Re\n", + "Cd = 0.2 #coeff. of drag\n", + "Ad = pi*d**2/4. #projected area\n", + "Fd = Ad*Cd*rho*v**2/2.\n", + "print \"The drag force on sphere in N\",Fd \n", + "\n", + "#part 2\n", + "v = 2.\n", + "l = 0.25\n", + "Re = l*v*rho/mu\n", + "zi = 4*pi*(l**3*3./4/pi)**(2/3.)/6./l**2 #sphericity\n", + "\n", + "#using graph\n", + "Cd = 2.\n", + "Ad = l**2\n", + "Fd = Ad*Cd*rho*v**2/2.\n", + "print \"The drag force on cube in N\",Fd \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The drag force on sphere in N 163.6875\n", + "The drag force on cube in N 0.3\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 9.2 page no : 168" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "rho = 1.2\n", + "mu = 1.85/100000\n", + "pi = 3.1428\n", + "g = 9.81\n", + "d = 1.38\n", + "t = 0.1 #thickness\n", + "v = 30*1000/3600.\n", + "T = 26.2 #Tension\n", + "m = 0.51 #mass\n", + "theta = 60.*pi/180.\n", + "\n", + "#calculation\n", + "Fd = T*math.cos(theta)\n", + "print \"Drag force in N: %.4f\"% Fd\n", + "A = pi*d**2/4.\n", + "Ad = A*math.cos(theta) #area component to drag\n", + "Cd = 2*Fd/Ad/rho/v**2 #coeff of drag\n", + "print \"The drag coefficient: %.4f\"% Cd \n", + "Fg = m*g #force of gravity\n", + "Fb = rho*pi*d**2/4.*t*g #buoyant force\n", + "Fl = Fg-Fb+T*math.sin(theta)\n", + "print \"The lift force in N : %.4f\"%Fl\n", + "Al = A*math.sin(theta)\n", + "Cl = 2*Fl/Al/rho/v**2\n", + "print \"The coefficient of lift: %.4f\"%Cl \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Drag force in N: 13.0909\n", + "The drag coefficient: 0.4202\n", + "The lift force in N : 25.9368\n", + "The coefficient of lift: 0.4803\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 9.3 page no : 171" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "rhog = 1200. #density of glycerol\n", + "mu = 1.45\n", + "pi = 3.1428\n", + "g = 9.81\n", + "rhos = 2280. #density of sphere\n", + "v = 0.04 #terminal velocity\n", + "a = 2*mu*g*(rhos-rhog)/v**3./3./rhog**2 #a = Cd/2/Re\n", + "\n", + "#using graph of Cd/2/Re vs Re\n", + "Re = 0.32\n", + "d = Re*mu/v/rhog\n", + "print \"Diameter of sphere in (m): %.4f\"%d \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Diameter of sphere in (m): 0.0097\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 9.4 page no : 173" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "rhoa = 1.218 #density of air\n", + "mu = 1.73/100000\n", + "pi = 3.1428\n", + "g = 9.81\n", + "rhog = 1200.\n", + "rhop = 2280. #density of polythene\n", + "d = 0.0034 #diameter\n", + "a = 4*d**3*(rhop-rhoa)*rhoa*g/3/mu**2 #a = Cd*Re**2\n", + "\n", + "#using graph of Cd*Re**2 vs Re\n", + "Re = 2200.\n", + "v = Re*mu/d/rhog\n", + "print \"The terminal velocity in (m/s) %f\"%v \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The terminal velocity in (m/s) 0.009328\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "example 9.6 page no : 177" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "# Initialization of Variable\n", + "pi = 3.1428\n", + "rho = 825\n", + "mu = 1.21\n", + "g = 9.81\n", + "l = 0.02\n", + "de = 0.02 #dia exterior\n", + "di = 0.012 #dia interior\n", + "\n", + "# Initialization of Variable\n", + "rho = 998. #density of water\n", + "mu = 1.25/1000 #viscosity of water\n", + "w = 100. #mass of water\n", + "pi = 3.1428\n", + "g = 9.81\n", + "rhog = 2280. #density of glass\n", + "wg = 60. #mass of glass\n", + "d = 45.*10**-6 #diameter of glass sphere\n", + "\n", + "#claculation\n", + "rhom = (w+wg)/(w/rho+wg/rhog) #density of mixure\n", + "e = w/rho/(w/rho+wg/rhog) #volume fraction of watter\n", + "\n", + "#using charts\n", + "zi = math.exp(-4.19*(1.-e))\n", + "\n", + "K = d*(g*rho*(rhog-rho)*zi**2/mu**2)**(1./3) #stoke's law coeff.\n", + "print K\n", + "if K<3.3:\n", + " print \"settling occurs in stoke-s law range\"\n", + " U = g*d**2*e*zi*(rhog-rhom)/18/mu\n", + " print \"settling velocity in m/s: %f\"%U\n", + "else:\n", + " print \"settling does not occurs in stoke-s law range\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0.504080734813\n", + "settling occurs in stoke-s law range\n", + "settling velocity in m/s: 0.000297\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "\n", + "example 9.7 page no : 180" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from numpy import linspace\n", + "\n", + "\n", + "# Initialization of Variable\n", + "rhog = 1200. #density of glycerol\n", + "mu = 1.45 #viscosity of glycerol\n", + "pi = 3.1428\n", + "g = 9.81\n", + "rhos = 2280. #density of sphere\n", + "d = 8/1000.\n", + "s = 0.\n", + "uf = 0.8*0.026\n", + "\n", + "#calculation\n", + "def intre():\n", + " s = 0.\n", + " u = linspace(0,uf,1000)\n", + " for i in range(0,1000):\n", + " y = ((pi/6*d**3*rhos*g-pi*d**3/6*rhog*g-0.5*pi*d**2/4*24*mu/d/rhog*rhog*u[i])/pi*6/d**3/rhos)**(-1)*uf/1000\n", + " s = s+y\n", + " a = s\n", + " return a\n", + "\n", + "t = intre()\n", + "print \"Time taken by particle to reach 80%% of its velocity in (s): %f\"%t\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Time taken by particle to reach 80% of its velocity in (s): 0.009020\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Problems_In_Fluid_Flow/ch12.ipynb b/Problems_In_Fluid_Flow/ch12.ipynb index 7b9dbb44..0b62821a 100644 --- a/Problems_In_Fluid_Flow/ch12.ipynb +++ b/Problems_In_Fluid_Flow/ch12.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:8f1680a01385ff5949f5cb398f429f5e497854e1c9f1b526eeecdccb5f6a2e6a" + "signature": "sha256:27b0880ef9530b4c8008863f28775062ec464e2da3c5a96886536d18e1634316" }, "nbformat": 3, "nbformat_minor": 0, @@ -9,14 +9,12 @@ { "cells": [ { - "cell_type": "code", - "collapsed": false, - "input": [ - "Chapter 12 : Pneumatic Conveying\n" - ], - "language": "python", + "cell_type": "heading", + "level": 1, "metadata": {}, - "outputs": [] + "source": [ + "Chapter 12 : Pneumatic Conveying\n" + ] }, { "cell_type": "heading", diff --git a/Programming_in_C/.ipynb_checkpoints/Chapter_03-checkpoint.ipynb b/Programming_in_C/.ipynb_checkpoints/Chapter_03-checkpoint.ipynb new file mode 100644 index 00000000..30f0abae --- /dev/null +++ b/Programming_in_C/.ipynb_checkpoints/Chapter_03-checkpoint.ipynb @@ -0,0 +1,216 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:d8c363a7618c01354c29de02098f7db723d0768b8769439b908ad7302fccbc99" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 3: Compiling and running your first program" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Program 3.1, Page number: 11" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print(\"Programming is Fun.\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Programming is Fun.\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Program 3.2, Page number: 14" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print(\"Programming is Fun.\")\n", + "print(\"And Programming in Python is even more fun\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Programming is Fun.\n", + "And Programming in Python is even more fun\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Program 3.3, Page number: 14" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print(\"Testing...\\n..1\\n...2\\n....3\\n\")" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Testing...\n", + "..1\n", + "...2\n", + "....3\n", + "\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Program 3.4, Page number: 15" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + " \n", + "sum=50+25\n", + "print(\"The sum of 50 & 25 is: {0} \".format(sum))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The sum of 50 & 25 is: 75 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Program 3.5, Page number: 16" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "value1=50\n", + "value2=25\n", + "\n", + "#Calculation\n", + "sum=value1+value2\n", + "\n", + "#Result\n", + "print(\"The sum of {0} & {1} is: {2}\".format(value1,value2,sum))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The sum of 50 & 25 is: 75\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Program 3.6, Page number: 17" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "value1=50\n", + "value2=25\n", + "\n", + "#Calculation\n", + "sum=value1+value2\n", + "\n", + "#Result\n", + "print(\"The sum of {0} & {1} is {2}\".format(value1,value2,sum))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The sum of 50 & 25 is 75\n" + ] + } + ], + "prompt_number": 6 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Satellite_Communication/.ipynb_checkpoints/chapter_3-checkpoint.ipynb b/Satellite_Communication/.ipynb_checkpoints/chapter_3-checkpoint.ipynb new file mode 100644 index 00000000..b87a50b4 --- /dev/null +++ b/Satellite_Communication/.ipynb_checkpoints/chapter_3-checkpoint.ipynb @@ -0,0 +1,745 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:eb32c126a333b2cfa51753626f865ad3fb2b120400bc606b82fb97538f18ae74" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 3: Satellite Launch and In-Orbit Operations" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.1, page no-72" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "#Variable Declaration\n", + "Az=85 # Azimuth angle of injection point\n", + "l=5.2 # latitude of launch site\n", + "\n", + "\n", + "#Calculation\n", + "cosi=math.sin(Az*math.pi/180)*math.cos(l*math.pi/180)\n", + "i=math.acos(cosi)\n", + "i=i*180.0/math.pi\n", + "\n", + "\n", + "#Result\n", + "print(\"Inclination angle attained, i=%.1f\u00b0\"%i)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Inclination angle attained, i=7.2\u00b0\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.2, page no-73" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "#Variable Declaration\n", + "delta_i=7 #orbital plane inclination\n", + "V=3000 #velocity of satellite in circularized orbit\n", + "\n", + "\n", + "#Calculation\n", + "vp=2*V*math.sin(delta_i*math.pi/(2*180))\n", + "\n", + "\n", + "#Result\n", + "print(\"Velocity thrust to make the inclination 0\u00b0 = %.0f m/s\"%vp)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Velocity thrust to make the inclination 0\u00b0 = 366 m/s\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.3, page no-73" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable Declaration\n", + "mu=39.8*10**13 # Nm^2/kg\n", + "P=7000.0*10**3 # Perigee distance in m\n", + "e=0.69 # eccentricity of eliptical orbit\n", + "w=60.0/2 # angle made by line joing centre of earth and perigee with the line of nodes\n", + "\n", + "\n", + "#Calculation\n", + "k=(e/math.sqrt(1+e))\n", + "k=math.floor(k*100)/100\n", + "v=2*(math.sqrt(mu/P))*k*math.sin(w*math.pi/180.0)\n", + "\n", + "\n", + "#Result\n", + "print(\"The velocity thrust required to rotate the perigee point\\n by desired amount is given by, v=%.1f m/s = %.3fkm/s\"%(v,v/1000.0))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The velocity thrust required to rotate the perigee point\n", + " by desired amount is given by, v=3996.4 m/s = 3.996km/s\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.4, page no-74" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "#Variable Declaration\n", + "A=15000*10**3 #Original apogee distance\n", + "A1=25000*10**3 # Raised opogee distance\n", + "P=7000*10**3 # Perigee Distance\n", + "mu=39.8*10**13 #Nm**2/kg\n", + "\n", + "\n", + "#Calculation\n", + "A_d=A1-A\n", + "v=math.sqrt((2*mu/P)-(2*mu/(A+P)))\n", + "del_v=A_d*mu/(v*(A+P)**2)\n", + "\n", + "\n", + "#Result\n", + "print(\"required Thrust velocity Delta_v = %.1f m/s\"%del_v)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "required Thrust velocity Delta_v = 933.9 m/s\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.5, page no-75" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "#Variable Declaration\n", + "A=15000.0*10**3 # Original apogee distance\n", + "A1=7000.0*10**3 # Raised opogee distance\n", + "P=7000.0*10**3 # Perigee Distance\n", + "mu=39.8*10**13 # Nm^2/kg\n", + "\n", + "\n", + "#Calculation\n", + "A_d=A-A1\n", + "v=math.sqrt((2*mu/P)-(2*mu/(A+P)))\n", + "del_v=A_d*mu/(v*(A+P)**2)\n", + "\n", + "#Result\n", + "print(\"required Thrust velocity Delta_v = %.1f m/s\"%del_v)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "required Thrust velocity Delta_v = 747.1 m/s\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.6, page no-76" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable Declaration\n", + "A=15000.0*10**3 # Original apogee distance\n", + "A1=16000.0*10**3 # Raised opogee distance\n", + "P=7000.0*10**3 # Perigee Distance\n", + "mu=39.8*10**13 # Nm**2/kg\n", + "\n", + "\n", + "#Calculation\n", + "A_d=A1-A\n", + "v=math.sqrt((2*mu/P)-(2*mu/(A+P)))\n", + "v=v*P/A\n", + "del_v=A_d*mu/(v*(A+P)**2)\n", + "\n", + "#Result\n", + "print(\"required Thrust velocity Delta_v = %.1f m/s\"%del_v)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "required Thrust velocity Delta_v = 200.1 m/s\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.7, page no-77" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "#Variable Declaration\n", + "R=6378.0*10**3 # Radius of earth\n", + "mu=39.8*10**13 # Nm**2/kg\n", + "r1=500.0*10**3 # original orbit from earths surface\n", + "r2=800.0*10**3 # orbit to be raised to thisdistance\n", + "\n", + "\n", + "#Calculation\n", + "R1=R+r1\n", + "R2=R+r2\n", + "delta_v=math.sqrt(2*mu*R2/(R1*(R1+R2)))-math.sqrt(mu/R1)\n", + "delta_v_dash=math.sqrt(mu/R2)-math.sqrt(2*mu*R1/(R2*(R1+R2)))\n", + "\n", + "\n", + "#Result\n", + "print(\"Two thrusts to be applied are,\\n Delta_v = %.2f m/s \\n Delta_v_dash = %.2f m/s\"%(delta_v,delta_v_dash))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Two thrusts to be applied are,\n", + " Delta_v = 80.75 m/s \n", + " Delta_v_dash = 79.89 m/s\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.8, page no-97" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "#Variable Declaration\n", + "H=36000.0 # Height of geostationary satellite from the surface of earth\n", + "R=6370.0 # Radius of earth in km\n", + "\n", + "\n", + "#Calculation\n", + "k=math.acos(R/(R+H))\n", + "#k=k*180/%pi\n", + "k=math.sin(k)\n", + "k=math.ceil(k*1000)/1000\n", + "d=2*(H+R)*k\n", + "\n", + "\n", + "#Result\n", + "print(\"Maximum line-of-sight distance is %.2f km\"%d)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum line-of-sight distance is 83807.86 km\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.9, page no-98" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "#Variable Declaration\n", + "H=36000.0 # Height of geostationary satellite from the surface of earth\n", + "R=6370.0 # Radius of earth in km\n", + "theta=20.0 # angular separation between two satellites\n", + "\n", + "\n", + "#Calculation\n", + "D=(H+R)\n", + "k=math.ceil(math.cos(theta*math.pi/180.0)*100)/100\n", + "d=math.sqrt(2*D**2*(1-k))\n", + "\n", + "\n", + "#Result\n", + "print(\"The line-of-sight distance is %.4f km\"%d)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The line-of-sight distance is 14677.3985 km\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.10, page no-98" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable Declaration\n", + "\n", + "theta=37+74 # angular separation between two satellites\n", + "D=42164.0 # circular equilateral geostationary orbit in km\n", + "\n", + "\n", + "#Calculation\n", + "k=math.cos(math.pi*theta/180.0)\n", + "#printf(\"%f\\n\",k)\n", + "k=-0.357952\n", + "d=math.sqrt(2*D**2*(1-k))\n", + "\n", + "\n", + "#Result\n", + "print(\"Inter-satellite distance is %.2f km\"%d)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Inter-satellite distance is 69486.27 km\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.11, page no-99" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "theta_l=30.0 # earth station's location 30\u00b0W longitude\n", + "theta_s=50.0 # satellite's location 50\u00b0W longitude\n", + "theta_L=60.0 # earth station's location 60\u00b0N latitude\n", + "r=42164.0 # orbital radius of the satellite in km\n", + "R=6378.0 # Earth's radius in km\n", + "\n", + "A_dash=math.atan((math.tan(math.pi*(theta_s-theta_l)/180.0))/math.sin(math.pi*60/180.0))\n", + "A_dash=A_dash*180/math.pi\n", + "A=180+A_dash #Azimuth angle\n", + "\n", + "x=(180/math.pi)*math.acos(math.cos(math.pi*(theta_s-theta_l)/180.0)*math.cos(math.pi*theta_L/180))\n", + "y=r-math.ceil(R*(math.cos(math.pi*(theta_s-theta_l)/180.0)*math.cos(math.pi*theta_L/180)))\n", + "z=R*math.sin(math.pi*x/180)\n", + "E=(math.atan(y/z)*180/math.pi)-x\n", + "print(\"Azimuth angle =%.1f\u00b0\\n Elevation angle =%.1f\u00b0\"%(A,E))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Azimuth angle =202.8\u00b0\n", + " Elevation angle =19.8\u00b0\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.12, page no-100" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "#Variable Declaration\n", + "theta_l=60.0 #earth station's location 60\u00b0W longitude\n", + "theta_s=105.0 #satellite's location 105\u00b0W longitude\n", + "theta_L=30.0 #earth station's location 30\u00b0N latitude\n", + "\n", + "theta_l1=90.0 #earth station's location 90\u00b0W longitude\n", + "theta_s1=105.0 #satellite's location 105\u00b0W longitude\n", + "theta_L1=45.0 #earth station's location 45\u00b0N latitude\n", + "\n", + "c=3*10**8 # speed of light\n", + "r=42164.0 # orbital radius of the satellite in km\n", + "R=6378.0 # Earth's radius in km\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "x=(180/math.pi)*math.acos(math.cos(math.pi*(theta_s-theta_l)/180)*math.cos(math.pi*theta_L/180))\n", + "y=r-math.ceil(R*(math.cos(math.pi*(theta_s-theta_l)/180)*math.cos(math.pi*theta_L/180)))\n", + "z=R*math.sin(math.pi*x/180)\n", + "E=(math.atan(y/z)*180/math.pi)-x\n", + "\n", + "x1=(180/math.pi)*math.acos(math.cos(math.pi*(theta_s1-theta_l1)/180)*math.cos(math.pi*theta_L1/180))\n", + "y1=r-math.ceil(R*(math.cos(math.pi*(theta_s1-theta_l1)/180)*math.cos(math.pi*theta_L1/180)))\n", + "z1=R*math.sin(math.pi*x1/180)\n", + "E1=(math.atan(y1/z1)*180/math.pi)-x1\n", + "E1=math.floor(E1)\n", + "\n", + "#calculation of slant range dx\n", + "k=(R/r)*math.cos(math.pi*E/180)\n", + "k=(180/math.pi)*math.asin(k)\n", + "k=k+E\n", + "k=math.sin(math.pi*k/180)\n", + "k=math.ceil(k*1000)/1000\n", + "#k=k+E\n", + "#k=sin(k)\n", + "dx=(R)**2+(r)**2-(2*r*R*k)\n", + "dx=math.sqrt(dx)\n", + "\n", + "\n", + "#calculation of slant range dy\n", + "k1=(R/r)*math.cos(math.pi*E1/180)\n", + "k1=(180/math.pi)*math.asin(k1)\n", + "k1=k1+E1\n", + "k1=math.floor(k1)\n", + "k1=math.sin(math.pi*k1/180)\n", + "k1=math.ceil(k1*1000)/1000\n", + "dy=(R)**2+(r)**2-(2*r*R*k1)\n", + "dy=math.sqrt(dy)\n", + "\n", + "tr=dy+dx\n", + "delay=tr*10**6/c\n", + "x=50\n", + "td=delay+x\n", + "\n", + "\n", + "#Result\n", + "print(\"Elevation angle, Ex =%.1f\u00b0\"%E)\n", + "print(\"\\n Elevation angle, Ey =%.1f\u00b0\"%math.floor(E1))\n", + "print(\"\\n Slant range dx of the earth station X is dx=%.2fkm\"%dx)\n", + "print(\"\\n Slant range dy of the earth station Y is dy=%.1fkm\"%dy)\n", + "print(\"\\n Therefore, total range to be covered is %.2fkm\"%tr)\n", + "print(\"\\n propagation delay=%.2fms\"%delay)\n", + "print(\"\\n\\n Time required too transmit 500 kbs of information at \\n a transmisssion speed of 10Mbps is given by 500000/10^7=%.0fms\"%(500000000.0/10**7))\n", + "print(\"\\n\\n Total Delay= %.2fms\"%td)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Elevation angle, Ex =30.3\u00b0\n", + "\n", + " Elevation angle, Ey =36.0\u00b0\n", + "\n", + " Slant range dx of the earth station X is dx=38584.76km\n", + "\n", + " Slant range dy of the earth station Y is dy=38100.8km\n", + "\n", + " Therefore, total range to be covered is 76685.57km\n", + "\n", + " propagation delay=255.62ms\n", + "\n", + "\n", + " Time required too transmit 500 kbs of information at \n", + " a transmisssion speed of 10Mbps is given by 500000/10^7=50ms\n", + "\n", + "\n", + " Total Delay= 305.62ms\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.13, page no-102" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "#Variable Declaration\n", + "da=38000.0 # slant range of satellite A\n", + "db=36000.0 # slant range of satellite B\n", + "beeta=60.0 # difference between longitudes of two satellites\n", + "R=42164.0 # radius of the orbit of satellites\n", + "\n", + "\n", + "#Calculation\n", + "theta=(da**2+db**2-2*(R**2)*(1-math.cos(math.pi*beeta/180)))/(2*da*db)\n", + "theta=(180/math.pi)*math.acos(theta)\n", + "d=math.sqrt(2*(R**2)*(1-math.cos(math.pi*beeta/180)))\n", + "\n", + "\n", + "#Result\n", + "print(\"Angular spacing between two satellites viewed by earth station is,\\n theta= %.1f\u00b0\"%theta)\n", + "print(\"\\nInter-satellite distance , d=%.0fkm\"%d)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Angular spacing between two satellites viewed by earth station is,\n", + " theta= 69.4\u00b0\n", + "\n", + "Inter-satellite distance , d=42164km\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.14, page no-107" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "#Variable Declaration\n", + "r=42164.0 # orbital radius of the satellite in km\n", + "R=6378.0 # Earth's radius in km\n", + "\n", + "#refer to Figure 3.53\n", + "\n", + "#Calculation\n", + "\n", + "#for E=0\u00b0\n", + "alfa=math.asin(R/r)*(180/math.pi)\n", + "alfa=math.floor(alfa*10)/10\n", + "theta=90-alfa\n", + "#in the right angle triangle OAC,\n", + "k=math.sin(math.pi*alfa/180)\n", + "k=math.floor(k*1000)/1000\n", + "oc=R*k\n", + "oc=math.ceil(oc*10)/10\n", + "A=2*math.pi*R*(R-oc)\n", + "\n", + "\n", + "#for E=10\u00b0\n", + "E=10\n", + "alfa1=math.asin((R/r)*math.cos(math.pi*E/180))*(180/math.pi)\n", + "#alfa1=ceil(alfa1*100)/100\n", + "theta1=90-alfa1-E\n", + "#in the right angle triangle OAC,\n", + "k1=math.sin(math.pi*(alfa1+E)/180)\n", + "k1=math.floor(k1*1000)/1000\n", + "oc1=R*k1\n", + "oc1=math.floor(oc1*10)/10\n", + "A1=2*math.pi*R*(R-oc1)\n", + "\n", + "\n", + "#Result\n", + "print(\"for E=0\u00b0,\\n covered surface area is %.1f km^2\"%A)\n", + "print(\"\\n\\n for E=10\u00b0,\\n covered surface area is %.1f km^2\"%A1)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "for E=0\u00b0,\n", + " covered surface area is 216997546.7 km^2\n", + "\n", + "\n", + " for E=10\u00b0,\n", + " covered surface area is 174314563.3 km^2\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.15, page no-108" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#variable declaration\n", + "theta=30 #satellite inclination to the equitorial plan\n", + "\n", + "\n", + "print(\"Extreme Northern latitude covered = %.0f\u00b0 N\"%theta)\n", + "print(\"\\n Extreme Southern latitude covered = %.0f\u00b0 S\"%theta)\n", + "print(\"\\n\\n In fact, the ground track would sweep\\n all latitudes between %d\u00b0N and %d\u00b0S\"%(theta,theta))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Extreme Northern latitude covered = 30\u00b0 N\n", + "\n", + " Extreme Southern latitude covered = 30\u00b0 S\n", + "\n", + "\n", + " In fact, the ground track would sweep\n", + " all latitudes between 30\u00b0N and 30\u00b0S\n" + ] + } + ], + "prompt_number": 16 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Satellite_Communication/.ipynb_checkpoints/chapter_5-checkpoint.ipynb b/Satellite_Communication/.ipynb_checkpoints/chapter_5-checkpoint.ipynb new file mode 100644 index 00000000..130c2bfd --- /dev/null +++ b/Satellite_Communication/.ipynb_checkpoints/chapter_5-checkpoint.ipynb @@ -0,0 +1,604 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:0567df6d143de5413d3406fc62e3bde7360c6adec18cda1ddb49a1255bcf929f" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 5: Communication Techniques" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.1, page no-174 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "\n", + "\n", + "\n", + "#Variable Declaration\n", + "m=0.5 #modulation index\n", + "\n", + "#Calculation\n", + "#for AM\n", + "pt1=(1+(m**2)/2.0)\n", + "#for SSBSC\n", + "pt2=(m**2)/4.0\n", + "#% power saving\n", + "p=(pt1-pt2)*100/pt1\n", + "p=math.floor(p*10)/10\n", + "\n", + "#Result\n", + "print(\"Percentage power saving is %.1f%%\"%p)\n", + "\n", + "#for case (b)\n", + "\n", + "#Variable Declaration\n", + "m=1 #modulation index\n", + "\n", + "#Calculation\n", + "#for AM\n", + "pt1=(1+(m**2)/2.0)\n", + "#for SSBSC\n", + "pt2=(m**2)/4.0\n", + "#% power saving\n", + "p=(pt1-pt2)*100/pt1\n", + "p=math.floor(p*10)/10\n", + "\n", + "#Result\n", + "print(\"\\n Percentage power saving is %.1f%%\"%p)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Percentage power saving is 94.4%\n", + "\n", + " Percentage power saving is 83.3%\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.2, page no-174 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable Declaration\n", + "pc=500 #energy of carrier signal\n", + "m=0.6 #AM modulation index\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "#for (a)\n", + "pt=pc*(1+(m**2)/2)\n", + "\n", + "#for (b)\n", + "pt2=pc*(m**2)/4\n", + "\n", + "\n", + "#Result\n", + "print(\"(a)\\n A3E is the double side band AM with full carrier.\\n Therefore, Pt= %.0f W\\n\\n (b)\\n J3E is an SSBSC system.\\n Therefore, Pt= %.0f W\"%(pt,pt2))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + " A3E is the double side band AM with full carrier.\n", + " Therefore, Pt= 590 W\n", + "\n", + " (b)\n", + " J3E is an SSBSC system.\n", + " Therefore, Pt= 45 W\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.3, page no-175 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "#Variable Declaration\n", + "m=0.6 #60% modulation\n", + "\n", + "\n", + "#Calculation\n", + "#for A3E\n", + "pt1=(1+(m**2)/2)\n", + "#for J3E\n", + "pt2=(m**2)/4\n", + "#% power saving\n", + "p=(pt1-pt2)*100/pt1\n", + "p=math.ceil(p*10)/10\n", + "\n", + "#Result\n", + "print(\"Percentage power saving is %.2f%%\"%p)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Percentage power saving is 92.40%\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.4, page no-175 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable Declaration\n", + "\n", + "bw=0.5/100 #bw is 0.5% of carrier freq. \n", + "\n", + "\n", + "#Calculation\n", + "wc=2/bw\n", + "\n", + "#Result\n", + "print(\"Wc = %.0f*Wm\"%wc)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Wc = 400*Wm\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.5, page no-190 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable Declaration\n", + "\n", + "m=6.0 #Modulation Index\n", + "wc=7.8*10**8 #unmodulated carrier frequency\n", + "wm=1450 #Modulating frequency\n", + "\n", + "\n", + "#Calculation\n", + "fc=wc/(2*math.pi)\n", + "fm=wm/(2*math.pi)\n", + "\n", + "\n", + "#Result\n", + "print(\"Unmodulated carrier frequency, fc = %.2f MHz \\n The modulation index m = %d \\n Modulating frequency, fm = %.2f Hz\"%(fc/10**6,m,fm))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Unmodulated carrier frequency, fc = 124.14 MHz \n", + " The modulation index m = 6 \n", + " Modulating frequency, fm = 230.77 Hz\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.7, page no-191 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "mf=150 #modulation index\n", + "fm=1 # modulating frequency in KHz\n", + "\n", + "\n", + "#Calculation\n", + "fd=mf*fm\n", + "bw=2*(mf+1)*fm\n", + "\n", + "#Result\n", + "print(\"frequency deviation = %.0f kHz\\n Bandwidth = %.0f kHz \\n\\n Expression for instantaneous frequency is given by, \\n f = 10^8-150*(10^3)*sin(2*3.14*10^3*t)\"%(fd,bw))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "frequency deviation = 150 kHz\n", + " Bandwidth = 302 kHz \n", + "\n", + " Expression for instantaneous frequency is given by, \n", + " f = 10^8-150*(10^3)*sin(2*3.14*10^3*t)\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.8, page no-191 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable Declaration\n", + "fd=50 #frequency deviation in kHz\n", + "fm=1.0 #modulating frequency in kHz for case 1\n", + "fm2=100.0 #modulating frequency in kHz for case 2\n", + "\n", + "\n", + "#Calculation\n", + "#for case 1\n", + "m=fd/fm\n", + "bw=2*(m+1)*fm\n", + "#for case 2\n", + "m2=fd/fm2\n", + "bw2=2*(m2+1)*fm2\n", + "\n", + "\n", + "#Result\n", + "print(\"For first case\\n Modulation index = %.0f \\n Bandwidth = %.0f kHz \\n\\n For second case\\n Modulation index = %.1f \\n Bandwidth = %.0f kHz\"%(m,bw,m2,bw2))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.9, page no-192 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable Declaration\n", + "bw=20*10**3 #bandwidth in Hz\n", + "fm=1* 10**3 #modulating frequency in Hz\n", + "\n", + "\n", + "#Calculation\n", + "mf=(bw/(2*fm))-1\n", + "new_mf=mf*6\n", + "new_fm=0.5 #kHz\n", + "new_bw=2*(new_mf+1)*new_fm\n", + "\n", + "#Result\n", + "print(\"mf=%.0f\\n New modulation index = %.0f\\n New bandwidth = %.0f kHz\"%(mf,new_mf,new_bw))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "mf=9\n", + " New modulation index = 54\n", + " New bandwidth = 55 kHz\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.10, page no-192" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#Variable Declaration\n", + "fd=75.0 #Maximum allowed frequency deviation in kHz\n", + "fm=15.0 #Highest modulating frequency in kHz\n", + "\n", + "\n", + "#Calculation\n", + "D=fd/fm\n", + "bw=2*(D+1)*fm\n", + "\n", + "#Result\n", + "print(\"Deviation Ratio, D = %.0f\\n Bandwidth = %.0f kHz\"%(D,bw))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Deviation Ratio, D = 5\n", + " Bandwidth = 180 kHz\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.11, page no-199" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable Declaration\n", + "fm=3200.0 #highest frequency component in message signal\n", + "k=48000.0 #channel capacity in b/s\n", + "\n", + "#Calculation\n", + "fs=2*fm\n", + "n=k/fs\n", + "n=math.floor(n)\n", + "\n", + "#Result\n", + "print(\"n = %.0f\\n L = 2^7 = %.0f\\n fs = %.3f kHz\"%(n,2**7,(k/7)/1000))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = 7\n", + " L = 2^7 = 128\n", + " fs = 6.857 kHz\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.12, page no-199" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "f=2500 #Highest frequency component in the signal in Hz\n", + "\n", + "#result\n", + "print(\"Nyquist rate = 2 x f\\n\\t = %.0f Hz = %.0f kHz\"%(2*f,2*f/1000))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Nyquist rate = 2 x f\n", + "\t = 5000 Hz = 5 kHz\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.13, page no-199" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "#Variable Declaration\n", + "l=128 #no of Quantizing levels\n", + "fs=10000.0 #sampling frequency in Hz\n", + "\n", + "\n", + "#Calculation\n", + "n=7 #math.log2(l)\n", + "t=1/(n*fs)\n", + "\n", + "#Result\n", + "print(\"Number of bits per sample (n) = %.0f\\n Time duration of one bit of binary encoded signal is %.3f micro second\"%(n,t*10**6))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of bits per sample (n) = 7\n", + " Time duration of one bit of binary encoded signal is 14.286 micro second\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.15, page no-208" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "f1=2.4 #first signal frequency\n", + "f2=3.2 #2nd signal frequency\n", + "f3=3.4 #3rd signal frequency\n", + "\n", + "t\n", + "\n", + "\n", + "sr=3*(f3*2)\n", + "st=10**6/(sr*10**3)\n", + "print(\"Sampling rate of the composite signal = %.1f kHz \\nSampling interval of the composite signal = %.0f micro second\"%(sr,st))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sampling rate of the composite signal = 20.4 kHz \n", + "Sampling interval of the composite signal = 49 micro second\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.16, page no-209" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "bw=3.2 # voice channel band limited frequency in kHz\n", + "r=1.2 # 1.2 times the Nyquist rate\n", + "n=24.0 # no of voice channel\n", + "b=8.0 # 8-bit PCM\n", + "sr=2*bw*r\n", + "p=10**6/(sr*10**3)\n", + "N=(n*b)+1\n", + "bit_d=p/N\n", + "bit_d=math.ceil(bit_d*1000)/1000\n", + "tr=1/bit_d\n", + "\n", + "print(\"Number of bits in each frame = %.0f \\nBit duration = %.3f micro second \\nTransmission rate = %.3f Mbps\"%(N,bit_d,math.ceil(tr*1000)/1000))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of bits in each frame = 193 \n", + "Bit duration = 0.675 micro second \n", + "Transmission rate = 1.482 Mbps\n" + ] + } + ], + "prompt_number": 21 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Satellite_Communication/.ipynb_checkpoints/chapter_7-checkpoint.ipynb b/Satellite_Communication/.ipynb_checkpoints/chapter_7-checkpoint.ipynb new file mode 100644 index 00000000..45cec90e --- /dev/null +++ b/Satellite_Communication/.ipynb_checkpoints/chapter_7-checkpoint.ipynb @@ -0,0 +1,746 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:d8e48debe58189bda0ba7970010a7f3d133d055f445572e1b90b2e8739a1cc2b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "chapter 7: Satellite Link Design Fundamentals" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.1, page no-249" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable Declaration\n", + "d=36000 *10**3 #distance of geostationary satellite from earth's surface\n", + "Gt=100 # Antenna gain of 20dB\n", + "Pt=10 # Power radiated by earth station\n", + "\n", + "#Calculation\n", + "Prd=Pt*Gt/(4*math.pi*d**2)\n", + "\n", + "\n", + "#Result\n", + "print(\"Prd = %.4f * 10 ^-12 W/m^2\\nPower received by the receiving antenna is given by Pr = %.3f pW\"%(Prd*10**12,Prd*10**13))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Prd = 0.0614 * 10 ^-12 W/m^2\n", + "Power received by the receiving antenna is given by Pr = 0.614 pW\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.2, page no-262" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "#Variable Declaration\n", + "c=3*10**8 #speed of light \n", + "R=10000 #path length\n", + "f=4.0 # operating frequencyin GHz\n", + "EIRP=50 #in dB\n", + "gr=20 #antenna gain in dB\n", + "rp=-120 # received power in dB\n", + "\n", + "\n", + "#Calculation\n", + "\n", + "#(a)\n", + "lamda=c/(f*10**9)\n", + "pl=20*math.log10(4*math.pi*R/lamda)\n", + "\n", + "#(b)\n", + "Lp=EIRP+gr-rp\n", + "\n", + "\n", + "#Result\n", + "print(\"(a)\\n Operating wavelength = %.3f m\\n Path loss(in dB) = %.2f dB\"%(lamda,pl))\n", + "print(\"\\n\\n (b)\\n Path loss = %.0fdB\"%Lp)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + " Operating wavelength = 0.075 m\n", + " Path loss(in dB) = 124.48 dB\n", + "\n", + "\n", + " (b)\n", + " Path loss = 190dB\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.3, page no-262" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable Declaration\n", + "p=75 # rotation of plane of polarization\n", + "\n", + "#Polarization rotation is inversaly propotional to square of the operating frequency\n", + "\n", + "f= 5.0 #frequency increased by factor \n", + "x=f**2 #rotation angle will decrease by aa factor of 25\n", + "\n", + "\n", + "#Calculation\n", + "k=math.pi/180.0\n", + "p_ex=p/x\n", + "Apr=-20*math.log10(math.cos(p*k))\n", + "Apr2=-20*math.log10(math.cos((p_ex)*k))\n", + "\n", + "\n", + "#Result\n", + "print(\"For polarization mismatch angle = 75\u00b0\\n Attenuation = %.2f dB\"%Apr)\n", + "print(\"\\n\\n For polarization mismatch angle = 3\u00b0 \\n Attenuation = %.3f dB\"%Apr2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "For polarization mismatch angle = 75\u00b0\n", + " Attenuation = 11.74 dB\n", + "\n", + "\n", + " For polarization mismatch angle = 3\u00b0 \n", + " Attenuation = 0.012 dB\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.4, page no-270" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable Declaration\n", + "g1=30 #gain of RF stage in dB\n", + "t1=20 #Noise temperature in K\n", + "g2=10 #down converter gain in dB\n", + "t2=360 #noise temperature in K\n", + "g3=15 #gain of IF stage in dB\n", + "t3=1000 #noise temperature in K\n", + "t=290 #reference temperature in K\n", + "G1=1000.0 #30 dB equivalent gain\n", + "\n", + "\n", + "#Calculation\n", + "Te=t1+(t2/G1)+t3/(G1*g2)\n", + "F=1+Te/t\n", + "\n", + "\n", + "#Result\n", + "print(\"Effective noise temperature, Te = %.2fK\"%Te)\n", + "print(\"\\n\\nSystem Noise Figure, F = %.2f\"%F)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Effective noise temperature, Te = 20.46K\n", + "\n", + "\n", + "System Noise Figure, F = 1.07\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.5, page no-271" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Variable Declaration\n", + "g1=30 #gain of RF stage in dB\n", + "t1=20 #Noise temperature in K\n", + "g2=10 #down converter gain in dB\n", + "t2=360.0 #noise temperature in K\n", + "g3=15 #gain of IF stage in dB\n", + "t3=1000 #noise temperature in K\n", + "t=290.0 #reference temperature in K\n", + "G1=1000.0 #30 dB equivalent gain\n", + "\n", + "\n", + "#Calculation\n", + "F1=1+t1/t\n", + "F2=1+t2/t\n", + "F3=1+t3/t\n", + "F=F1+((F2-1)/G1)+(F3-1)/(G1*g2)\n", + "\n", + "\n", + "#Result\n", + "print(\"Noise Figure specificatios of the three stages are as follow,\\n\\n F1 = %.3f\\n F2 = %.2f\\n F3 = %.2f\"%(F1,F2,F3))\n", + "print(\"\\n\\n The overall noise figure is, F = %.2f\"%F)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Noise Figure specificatios of the three stages are as follow,\n", + "\n", + " F1 = 1.069\n", + " F2 = 2.24\n", + " F3 = 4.45\n", + "\n", + "\n", + " The overall noise figure is, F = 1.07\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.6, page no-272" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable Declaration\n", + "L=1.778 #Loss factor of the feeder 2.5dB equivalent\n", + "ts=30 #Noise temperature of sattelite receiver in K\n", + "t=50 #Noise temperature in K\n", + "ti=290.0 # reference temperature in K\n", + "\n", + "\n", + "#Calculation\n", + "x=t/L\n", + "y=ti*(L-1)/L\n", + "Te=x+y+ts\n", + "F1=1+(ts/ti)\n", + "F2=1+(Te/ti)\n", + "\n", + "\n", + "#Result\n", + "print(\"contribution of antenna noise temperature when\\n referred to the input of the receiver is %.1f K\"%x)\n", + "print(\"\\n\\n Contribution of feeder noise when referred to the\\n input of the receiver is %.1f\"%y)\n", + "print(\"\\n\\n1. Noise figure in first case = %.3f = %.3f dB\"%(F1,10*math.log10(F1)))#answer in book is different 0.426dB\n", + "print(\"\\n\\n2. Noise figure in second case = %.3f = %.2f dB\"%(F2,10*math.log10(F2)))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "contribution of antenna noise temperature when\n", + " referred to the input of the receiver is 28.1 K\n", + "\n", + "\n", + " Contribution of feeder noise when referred to the\n", + " input of the receiver is 126.9\n", + "\n", + "\n", + "1. Noise figure in first case = 1.103 = 0.428 dB\n", + "\n", + "\n", + "2. Noise figure in second case = 1.638 = 2.14 dB\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.7, page no-272" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable Declaration\n", + "Ta=40 #Antenna Noise temperature\n", + "Ti=290.0 #Reference temperature in K\n", + "T=50.0 #Effecitve input noise temperatuire\n", + "\n", + "#Calculation\n", + "Tf=Ti\n", + "L=(Ta-Tf)/(T-Tf)\n", + "L=math.ceil(L*10**4)/10**4\n", + "\n", + "#Result\n", + "print(\"Loss factor = %.4f = %.3f dB\"%(L,10*math.log10(L)))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Loss factor = 1.0417 = 0.177 dB\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.8, page no-273" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "\n", + "#Variable Declaration\n", + "Ta=50 #Antenna Noise temperature\n", + "Tf=300 #Thermodynamic temperature of the feeder\n", + "Te=50 # Effecitve input noise temperatuire\n", + "\n", + "\n", + "#Calculation for (a)\n", + "Lf=1.0\n", + "T=(Ta/Lf)+(Tf*(Lf-1)/Lf)+Te\n", + "\n", + "#Result for (a)\n", + "print(\"(a)\\n System noise temperature = %.0fK\"%T)\n", + "\n", + "#Calculation for (b)\n", + "Lf=1.413\n", + "T=(Ta/Lf)+(Tf*(Lf-1)/Lf)+Te\n", + "\n", + "#Result for (b)\n", + "print(\"\\n\\n (b)\\n System noise temperature = %.3fK\"%(math.ceil(T*10**3)/10**3))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a)\n", + " System noise temperature = 100K\n", + "\n", + "\n", + " (b)\n", + " System noise temperature = 173.072K\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.9, page no-278" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "\n", + "#Variable Declaration\n", + "e=35 #EIRP radiated by satellite in dBW\n", + "g=50 #receiver antenna gain in dB\n", + "e1=30 #EIRP of interfacing satellite in dBW\n", + "theeta=4 #line-of-sight between earth station and interfacing sattelite\n", + "\n", + "\n", + "#Calculation\n", + "x=(e-e1)+(g-32+25*math.log10(theeta))\n", + "\n", + "\n", + "#Result\n", + "print(\"carrier-to-interface (C/I) = %.2f dB\"%x)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "carrier-to-interface (C/I) = 38.05 dB\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.10, page no-279" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "\n", + "#Variable Declaration\n", + "ea=80 #EIRP value of earth station A in dBW\n", + "eb=75 #EIRP value of earth station B in dBW\n", + "g=50 #transmit antenna gain in dB\n", + "gra=20 #receiver antenna gain for earth station A in dB\n", + "grb=15 #receiver antenna gain for earth station B in dB\n", + "theeta=4 #viewing angle of the sattelite from two earth station\n", + "\n", + "\n", + "#Calculation\n", + "eirp_d=eb-g+32-25*math.log10(theeta)\n", + "c_by_i=ea-eirp_d+(gra-grb)\n", + "\n", + "\n", + "#Result\n", + "print(\"carrier-to-interference ratio at the satellite due to\\n inteference caused by Eart station B is, (C/I) = %.0f dB \"%c_by_i)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "carrier-to-interference ratio at the satellite due to\n", + " inteference caused by Eart station B is, (C/I) = 43 dB \n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.11, page no-279" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "\n", + "#Variable Declaration\n", + "\n", + "\n", + "u=10000.0 # equivalent to 40dB\n", + "\n", + "#carrier sinal strength at eart station by downlink \n", + "d=3162.28 #equivalent to 35dB\n", + "\n", + "\n", + "#Calculation\n", + "x=1/((1/u)+(1/d))\n", + "\n", + "\n", + "#Result\n", + "print(\"Total carrier-to-interference ratio is %.2f = %.1f dB\"%(x,10*math.log10(x)))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total carrier-to-interference ratio is 2402.53 = 33.8 dB\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.12, Page no.280" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable Declaration\n", + "theeta=5.0 #Angle form by slant ranges of two satellites\n", + "dA=42100.0*10**3 #Slant range of satellite A\n", + "dB=42000.0*10**3 #Slant range of satellite B\n", + "r=42164.0*10**3 #radius of geostationary orbit\n", + "\n", + "\n", + "#Calculation\n", + "beeta=((dA**2+dB**2-math.cos(theeta*math.pi/180)*2*dA*dB)/(2*r**2))\n", + "beeta=math.ceil(beeta*10**3)/10**3\n", + "beeta=(180/math.pi)*math.acos(1-beeta)\n", + "\n", + "#Result\n", + "print(\"Longitudinal separation between two satellites is %.3f\u00b0\"%beeta)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Longitudinal separation between two satellites is 5.126\u00b0\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.13, Page no.281" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "\n", + "#Variable Declaration\n", + "Ga=60.0 #Antenna Gain in dB\n", + "Ta= 60.0 #Noise teperature of Antenna\n", + "L1=1.12 #Feeder Loss equivalent to dB\n", + "T1=290.0 #Noise teperature of stage 1\n", + "G2=10**6 #Gain of stage 2 in dB\n", + "T2=140.0 #Noise teperature of stage 2\n", + "T3=10000.0 #Noise teperature of stage 3\n", + "G=Ga-0.5 #input of low noise amplifier\n", + "\n", + "\n", + "#Calculation\n", + "Ts=(Ta/L1)+(T1*(L1-1)/L1)+T2+(T3/G2)\n", + "Ts=math.floor(Ts*100)/100\n", + "x=G-10*math.log10(Ts)\n", + "\n", + "#Result\n", + "print(\"Tsi = %.2fK\\n\\n G/T(in dB/K)= %.0f dB/K\"%(Ts,x))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Tsi = 224.65K\n", + "\n", + " G/T(in dB/K)= 36 dB/K\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.14, Page no.282" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#Variable Declaration\n", + "Ga=60.0 #Amplifier Gain in dB\n", + "Ta= 60.0 #Noise teperature of Antenna\n", + "L1=1.12 #Feeder Loss equivalent to dB\n", + "T1=290.0 #Noise teperature of stage 1\n", + "G2=10**6 #Gain of stage 2 in dB\n", + "T2=140.0 #Noise teperature of stage 2\n", + "T3=10000.0 #Noise teperature of stage 3\n", + "G=Ga-0.5 #input of low noise amplifier\n", + "\n", + "\n", + "#Calculation\n", + "T=Ta+T1*(L1-1)+L1*(T2+(T3/G2))\n", + "x=G-10*math.log10(T)\n", + "\n", + "\n", + "#Result\n", + "print(\"T = %.1fK\\n\\n G/T = %.0f dB/k\"%(T,math.ceil(x)))\n", + "print(\"\\n\\n It is evident from the solutions of the problems 13 and 14\\n that G/T ratio is invarient regardless of the reference point in agreement \\n with a statement made earlier in the text.\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.15, Page no.286" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "#Variable Declaration\n", + "f=6.0*10**9 # uplink frequency\n", + "eirp=80.0 # Earth station EIRP in dBW\n", + "r=35780.0 # Earth station satellite distance\n", + "l=2.0 # attenuation due to atomospheric factors in dB\n", + "e=0.8 # satellite antenna's aperture efficiency\n", + "a=0.5 # satellite antenna's aperture area\n", + "T=190.0 # Satellite receiver's effective noise temperature \n", + "bw=20.0*10**6 # Satellite receiver's bandwidth\n", + "cn=25.0 # received carrier-to-noise ratioin dB\n", + "c=3.0*10**8 # speed of light\n", + "\n", + "#Calculation\n", + "k=1.38*10**-23\n", + "lamda=c/f\n", + "G=e*4*math.pi*a/lamda**2\n", + "G=math.ceil(G*100)/100\n", + "Gd=10*math.log10(G)\n", + "p=10*math.log10(k*T*bw)\n", + "pl=20*math.log10(4*math.pi*r*10**3/lamda)\n", + "rp=eirp-l-pl+Gd\n", + "rp=math.floor(rp*100)/100\n", + "rc=math.floor((rp-p)*100)/100\n", + "lm=rc-cn\n", + "\n", + "#Result\n", + "print(\"Satellite Antenna gain, G = %.2f = %.2f dB \\n Receivers Noise Power = %.1f dB\\n free-space path loss = %.2f dB \\n received power at satellite = %.2f dB \\n receiver carrier = %.2f is stronger than noise.\\n It is %.2f dB more than the required threshold value.\\n Hence, link margin = %.2f dB\"%(G,Gd,p,pl,rp,rc,lm,lm))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Satellite Antenna gain, G = 2010.62 = 33.03 dB \n", + " Receivers Noise Power = -132.8 dB\n", + " free-space path loss = 199.08 dB \n", + " received power at satellite = -88.05 dB \n", + " receiver carrier = 44.75 is stronger than noise.\n", + " It is 19.75 dB more than the required threshold value.\n", + " Hence, link margin = 19.75 dB\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch1.ipynb b/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch1-checkpoint.ipynb similarity index 80% rename from Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch1.ipynb rename to Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch1-checkpoint.ipynb index 6d38324f..63838add 100644 --- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch1.ipynb +++ b/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch1-checkpoint.ipynb @@ -1,13 +1,29 @@ { "metadata": { "name": "", - "signature": "sha256:2fa8b19d5030cf6dee0c92c2ee4889d5f3659cfd258460db8d8dc9ca2e443363" + "signature": "sha256:b04f77602641935a2f57f9f799a2b79e82af538577f760aa52819f8a8a5668d9" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 1" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.1 Page 2 " + ] + }, { "cell_type": "code", "collapsed": false, @@ -29,13 +45,20 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.2 Page 2" + ] + }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", - "# prints \"Hello, World!\":\n", "print \"Hello, World!\\n\"" ], "language": "python", @@ -52,13 +75,20 @@ ], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.3 Page 3" + ] + }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", - "# prints \"Hello, World!\":\n", "print \"Hel\" + \"lo, Wo\" + \"rld!\" \n", "\n" ], @@ -75,13 +105,20 @@ ], "prompt_number": 3 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.4 Page 3" + ] + }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", - "# prints \"Hello, World!\":\n", "print \"Hello, W\" + 'o' + \"rld\" + '!' " ], "language": "python", @@ -97,13 +134,20 @@ ], "prompt_number": 4 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.5 Page 4" + ] + }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", - "# prints \"The Millennium ends Dec 31 2000.\":\n", "print \"The Millennium ends Dec %d %d \" %(31,2000)" ], "language": "python", @@ -120,29 +164,34 @@ "prompt_number": 5 }, { - "cell_type": "code", - "collapsed": false, - "input": [ + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.6 Page 5" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "\n", "\n", - "# prints \"m = 44 and n = 77\":\n", "\n", "m = 44 # assigns the value 44 to the variable m\n", "print \"m = %d \" % m,\n", "n = m + 33 # assigns the value 77 to the variable n\n", "print \"and n = %d \" % n" - ], - "language": "python", + ] + }, + { + "cell_type": "heading", + "level": 3, "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "m = 44 and n = 77 \n" - ] - } - ], - "prompt_number": 6 + "source": [ + "Example 1.7 Page 5" + ] }, { "cell_type": "code", @@ -150,7 +199,6 @@ "input": [ "\n", "\n", - "# prints \"n = 44:\n", "n=44\n", "print \"n = %d\" % n" ], @@ -167,13 +215,20 @@ ], "prompt_number": 7 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.8 Page 5" + ] + }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", - "# Python does not have semicolons so wont give any errors.\n", "n=44\n", "print \"n = %d\" % n " ], @@ -190,13 +245,21 @@ ], "prompt_number": 8 }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "Example 1.9 Page 6" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, { "cell_type": "code", "collapsed": false, "input": [ "\n", - "\n", - "# prints \"m = ?? and n = 44\":\n", "m = 0 #In python we do not have declaration of variables, we just initialize it and use it.\n", "n=44\n", "print \"m = %d and n = %d\" %(m,n)" @@ -214,13 +277,19 @@ ], "prompt_number": 9 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.10 Page 7" + ] + }, { "cell_type": "code", "collapsed": false, "input": [ "\n", - "\n", - "# defines constants; has no output:\n", "BEEP = '\\b'\n", "MAXINT = 2147483647\n", "N = MAXINT/2\n", @@ -232,13 +301,20 @@ "outputs": [], "prompt_number": 10 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.11 Page 7" + ] + }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "\n", - "# tests the input of integers, floats, and characters:\n", "print \"Enter two integers: \"\n", "m = int(raw_input())\n", "n = int(raw_input())\n", diff --git a/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch10-checkpoint.ipynb b/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch10-checkpoint.ipynb new file mode 100644 index 00000000..73132ef0 --- /dev/null +++ b/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch10-checkpoint.ipynb @@ -0,0 +1,868 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:e0510313f61c6fcb61aa0929e4214e5da07f5877c2311aba0ce767b7db273d1f" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 10" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.1 Page 101 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Ratio:\n", + " def __init__(self):\n", + " self.num = 0\n", + " self.den = 0\n", + " def assign(self,n,d):\n", + " self.num = n\n", + " self.den = d\n", + " def convert(self):\n", + " return float(self.num)/self.den\n", + " def invert(self):\n", + " self.num,self.den = self.den,self.num\n", + " def print_(self):\n", + " print self.num , '/' , self.den ,\n", + " \n", + "x = Ratio()\n", + "x.assign(22,7)\n", + "print \"x = \",\n", + "x.print_()\n", + "print \" = \" , x.convert() \n", + "x.invert()\n", + "print \"1/x = \",\n", + "x.print_()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = 22 / 7 = 3.14285714286\n", + "1/x = 7 / 22\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.2 Page 101" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Ratio:\n", + " def __init__(self):\n", + " self.num = 0\n", + " self.den = 0\n", + " def assign(self,n,d):\n", + " self.num = n\n", + " self.den = d\n", + " def convert(self):\n", + " return float(self.num)/self.den\n", + " def invert(self):\n", + " self.num,self.den = self.den,self.num\n", + " def print_(self):\n", + " print self.num , '/' , self.den ,\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.3 Page 102" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Ratio:\n", + " def __init__(self,n,d):\n", + " self.num = n\n", + " self.den = d\n", + " def print_(self):\n", + " print self.num , '/' , self.den ,\n", + "\n", + "x = Ratio(-1,3)\n", + "y = Ratio(22,7)\n", + "print \"x = \",\n", + "x.print_()\n", + "print \" and y = \",\n", + "y.print_()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = -1 / 3 and y = 22 / 7\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.4 Page 102" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "\n", + "class Ratio:\n", + " def __init__(self,n=None,d=None):\n", + " if n==None:\n", + " self.num = 0\n", + " self.den = 1\n", + " elif d==None:\n", + " self.num = n\n", + " self.den = 1\n", + " else:\n", + " self.num = n\n", + " self.den = d\n", + " def print_(self):\n", + " print self.num , '/' , self.den ,\n", + "\n", + "x = Ratio()\n", + "y = Ratio(4)\n", + "z = Ratio(22,7)\n", + "print \"x = \",\n", + "x.print_()\n", + "print \"\\ny = \",\n", + "y.print_()\n", + "print \"\\nz = \",\n", + "z.print_()" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.5 Page 103" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Ratio:\n", + " def __init__(self,n=None,d=None):\n", + " if n==None:\n", + " self.num = 0\n", + " self.den = 1\n", + " elif d==None:\n", + " self.num = n\n", + " self.den = 1\n", + " else:\n", + " self.num = n\n", + " self.den = d\n", + " def print_(self):\n", + " print self.num , '/' , self.den ,\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.6 Page 104" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Ratio:\n", + " def __init__(self,n=0,d=1):\n", + " self.num = n\n", + " self.den = d\n", + " def print_(self):\n", + " print self.num , '/' , self.den ,\n", + "\n", + "\n", + "x = Ratio()\n", + "y = Ratio(4)\n", + "z = Ratio(22,7)" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.7 Page 104" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Ratio:\n", + " def __init__(self,n=0,d=1):\n", + " self.num = n\n", + " self.den = d\n", + " def numerator(self):\n", + " return self.num\n", + " def denominator(self):\n", + " return self.den\n", + " def print_(self):\n", + " print self.num , '/' , self.den ,\n", + "\n", + "\n", + "x = Ratio(22,7)\n", + "print x.numerator() , '/' , x.denominator() " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "22 / 7\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.8 Page 105" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def gcd(m,n):\n", + " \n", + " if (m0):\n", + " r = m % n\n", + " m = n\n", + " n = r\n", + " return m\n", + "\n", + "class Ratio:\n", + " def __init__(self,n=0,d=1):\n", + " self.num = n\n", + " self.den = d\n", + " self.reduce()\n", + " def numerator(self):\n", + " return self.num\n", + " def denominator(self):\n", + " return self.den\n", + " def print_(self):\n", + " print self.num , '/' , self.den ,\n", + "\n", + " def reduce(self):\n", + " # enforce invariant(den > 0):\n", + " if (self.num == 0 or self.den == 0):\n", + " self.num = 0\n", + " self.den = 1\n", + " return\n", + " if (self.den < 0):\n", + " self.den *= -1\n", + " self.num *= -1\n", + " # enforce invariant(gcd(num,den) == 1):\n", + " if (self.den == 1):\n", + " return\n", + " # it's already reduced\n", + " sgn = 0\n", + " if self.num < 0:\n", + " sgn = -1\n", + " else:\n", + " sgn = 1\n", + " g = gcd(sgn*self.num,self.den)\n", + " self.num /= g\n", + " self.den /= g\n", + "\n", + "x = Ratio(100,-360)\n", + "x.print_()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "-5 / 18\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.9 Page 105" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def gcd(m,n):\n", + " \n", + " if (m0):\n", + " r = m % n\n", + " m = n\n", + " n = r\n", + " return m\n", + "\n", + "class Ratio:\n", + " def __init__(self,n=0,d=None):\n", + " if d == None:\n", + " self.num = n.num\n", + " self.den = n.den\n", + " else: \n", + " self.num = n\n", + " self.den = d\n", + " self.reduce()\n", + " def numerator(self):\n", + " return self.num\n", + " def denominator(self):\n", + " return self.den\n", + " def print_(self):\n", + " print self.num , '/' , self.den ,\n", + "\n", + " def reduce(self):\n", + " # enforce invariant(den > 0):\n", + " if (self.num == 0 or self.den == 0):\n", + " self.num = 0\n", + " self.den = 1\n", + " return\n", + " if (self.den < 0):\n", + " self.den *= -1\n", + " self.num *= -1\n", + " # enforce invariant(gcd(num,den) == 1):\n", + " if (self.den == 1):\n", + " return\n", + " # it's already reduced\n", + " sgn = 0\n", + " if self.num < 0:\n", + " sgn = -1\n", + " else:\n", + " sgn = 1\n", + " g = gcd(sgn*self.num,self.den)\n", + " self.num /= g\n", + " self.den /= g\n", + "\n", + "x = Ratio(100,360)\n", + "y = Ratio(x)\n", + "print \"x = \",\n", + "x.print_()\n", + "print \"y = \",\n", + "y.print_()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = 5 / 18 y = 5 / 18\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.10 Page 106" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def gcd(m,n):\n", + " \n", + " if (m0):\n", + " r = m % n\n", + " m = n\n", + " n = r\n", + " return m\n", + "\n", + "class Ratio:\n", + " def __init__(self,n=0,d=None):\n", + " if d == None:\n", + " print \"COPY CONSTRUCTOR CALLED\"\n", + " self.num = n.num\n", + " self.den = n.den\n", + " else: \n", + " self.num = n\n", + " self.den = d\n", + " self.reduce()\n", + " def numerator(self):\n", + " return self.num\n", + " def denominator(self):\n", + " return self.den\n", + " def print_(self):\n", + " print self.num , '/' , self.den ,\n", + "\n", + " def reduce(self):\n", + " # enforce invariant(den > 0):\n", + " if (self.num == 0 or self.den == 0):\n", + " self.num = 0\n", + " self.den = 1\n", + " return\n", + " if (self.den < 0):\n", + " self.den *= -1\n", + " self.num *= -1\n", + " # enforce invariant(gcd(num,den) == 1):\n", + " if (self.den == 1):\n", + " return\n", + " # it's already reduced\n", + " sgn = 0\n", + " if self.num < 0:\n", + " sgn = -1\n", + " else:\n", + " sgn = 1\n", + " g = gcd(sgn*self.num,self.den)\n", + " self.num /= g\n", + " self.den /= g\n", + "\n", + "def f(r):\n", + " s = Ratio(r)\n", + "\n", + "x = Ratio(22,7)\n", + "y = Ratio(x) #calls the copy constructor, copying x to y\n", + "f(y)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "COPY CONSTRUCTOR CALLED\n", + "COPY CONSTRUCTOR CALLED\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.11 Page 107" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Ratio:\n", + " def __init__(self):\n", + " print \"OBJECT IS BORN.\"\n", + " def __del__(self):\n", + " print \"OBJECT DIES.\"\n", + "\n", + "x = Ratio()\n", + "print \"Now x is alive.\"\n", + "print \"Now between blocks.\"\n", + "y = Ratio()\n", + "print \"Now y is alive.\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "OBJECT IS BORN.\n", + "Now x is alive.\n", + "Now between blocks.\n", + "OBJECT IS BORN.\n", + "Now y is alive.\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.12 Page 108" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class X:\n", + " def __init(self):\n", + " data = 0\n", + "\n", + "p = X()\n", + "p.data = 22\n", + "print \"p.data = \" , p.data , \" = \" , p.data\n", + "p.data = 44\n", + "print \" p.data = \" , p.data , \" = \" , p.data " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "p.data = 22 = 22\n", + " p.data = 44 = 44\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.13 Page 108" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Node:\n", + " def __init__(self,d,q=None):\n", + " self.data = d\n", + " self.next = q\n", + "\n", + "n = int(raw_input())\n", + "q = Node(n)\n", + "while True:\n", + " n = int(raw_input())\n", + " if n<=0:\n", + " break\n", + " p = Node(n, q)\n", + " q = p\n", + "k = p\n", + "while k != None:\n", + " print k.data , '->' , \n", + " k = k.next\n", + "print '*'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "22\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "33\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "44\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "66\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "77\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "77 -> 66 -> 55 -> 44 -> 33 -> 22 -> *\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.14 Page 109" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "count = 0\n", + "class Widget:\n", + " def __init__(self):\n", + " global count\n", + " count += 1\n", + " \n", + "w = Widget()\n", + "x = Widget()\n", + "print \"Now there are \" , count , 'widgets'\n", + "if True:\n", + " w = Widget()\n", + " x = Widget()\n", + " y = Widget()\n", + " z = Widget()\n", + " print \"Now there are\" , count , 'widgets' \n", + "print \"Now there are \" , count , 'widgets'\n", + "y = Widget()\n", + "print \"Now there are \" , count , 'widgets'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "OBJECT DIES.\n", + "Now there are 2 widgets\n", + "OBJECT DIES.\n", + "Now there are 6 widgets\n", + "Now there are 6 widgets\n", + "Now there are 7 widgets\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.15 Page 110" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "count = 0\n", + "class Widget:\n", + " def __init__(self):\n", + " global count\n", + " count += 1\n", + " def numWidgets(self):\n", + " global count\n", + " return count\n", + " \n", + "w = Widget()\n", + "x = Widget()\n", + "print \"Now there are \" , w.numWidgets() , 'widgets'\n", + "if True:\n", + " w = Widget()\n", + " x = Widget()\n", + " y = Widget()\n", + " z = Widget()\n", + " print \"Now there are\" , w.numWidgets() , 'widgets' \n", + "print \"Now there are \" , w.numWidgets() , 'widgets'\n", + "y = Widget()\n", + "print \"Now there are \" , w.numWidgets() , 'widgets'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Now there are 2 widgets\n", + "Now there are 6 widgets\n", + "Now there are 6 widgets\n", + "Now there are 7 widgets\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.16 Page 109" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "count = 0\n", + "class Widget:\n", + " def __init__(self):\n", + " global count\n", + " count += 1\n", + " def numWidgets(self):\n", + " global count\n", + " return count\n", + " \n", + "w = Widget()\n", + "x = Widget()\n", + "print \"Now there are \" , w.numWidgets() , 'widgets'\n", + "if True:\n", + " w = Widget()\n", + " x = Widget()\n", + " y = Widget()\n", + " z = Widget()\n", + " print \"Now there are\" , w.numWidgets() , 'widgets' \n", + "print \"Now there are \" , w.numWidgets() , 'widgets'\n", + "y = Widget()\n", + "print \"Now there are \" , w.numWidgets() , 'widgets'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Now there are 2 widgets\n", + "Now there are 6 widgets\n", + "Now there are 6 widgets\n", + "Now there are 7 widgets\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch11-checkpoint.ipynb b/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch11-checkpoint.ipynb new file mode 100644 index 00000000..67cadd88 --- /dev/null +++ b/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch11-checkpoint.ipynb @@ -0,0 +1,816 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:0c6f88f1641298fec5005cfeb82c2b81a78fd7dd6b5eaacf2e5de74558bc56e1" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 11" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.1 Page 111" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Ratio:\n", + " def __init__(self,n=None,d=None):\n", + " if d==None:\n", + " self.num = n.num\n", + " self.den = n.den\n", + " elif n==None:\n", + " self.num = 0\n", + " self.den = 1\n", + " else:\n", + " self.num = n\n", + " self.den = d\n", + " \n", + " def equals(self):\n", + " return self # retuns calling object." + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.2 Page 111" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Ratio:\n", + " def __init__(self,n=None,d=None):\n", + " pass\n", + " \n", + " def equals(self):\n", + " pass\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.3 Page 112" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Ratio:\n", + " def __init__(self,n=None,d=None):\n", + " if d==None:\n", + " self.num = n.num\n", + " self.den = n.den\n", + " elif n==None:\n", + " self.num = 0\n", + " self.den = 1\n", + " else:\n", + " self.num = n\n", + " self.den = d\n", + " \n", + "\n", + "z = Ratio(22,7)\n", + "y = z\n", + "x = z\n", + "\n", + "x = Ratio(22,7)\n", + "y = Ratio(x)\n", + "z = x\n", + "w = x" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.4 Page 113" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Ratio:\n", + " def __init__(self,n=None,d=None):\n", + " self.num = n\n", + " self.den = d\n", + " def __mul__(self,y):\n", + " pass\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.5 Page 113" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def gcd(m,n):\n", + " \n", + " if (m0):\n", + " r = m % n\n", + " m = n\n", + " n = r\n", + " return m\n", + "\n", + "\n", + "class Ratio:\n", + " def __init__(self,n=None,d=None):\n", + " self.num = n\n", + " self.den = d\n", + " self.reduce()\n", + " def __mul__(self,y):\n", + " z = Ratio(self.num * y.num, self.den * y.den)\n", + " return z\n", + " def print_(self):\n", + " print self.num , '/', self.den\n", + " \n", + " def reduce(self):\n", + " # enforce invariant(den > 0):\n", + " if (self.num == 0 or self.den == 0):\n", + " self.num = 0\n", + " self.den = 1\n", + " return\n", + " if (self.den < 0):\n", + " self.den *= -1\n", + " self.num *= -1\n", + " # enforce invariant(gcd(num,den) == 1):\n", + " if (self.den == 1):\n", + " return\n", + " # it's already reduced\n", + " sgn = 0\n", + " if self.num < 0:\n", + " sgn = -1\n", + " else:\n", + " sgn = 1\n", + " g = gcd(sgn*self.num,self.den)\n", + " self.num /= g\n", + " self.den /= g\n", + "x = Ratio(22,7)\n", + "y = Ratio(-3,8)\n", + "z = x\n", + "z.print_()\n", + "x = y*z\n", + "x.print_()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "22 / 7\n", + "-33 / 28\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.6 Page 114" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def gcd(m,n):\n", + " \n", + " if (m0):\n", + " r = m % n\n", + " m = n\n", + " n = r\n", + " return m\n", + "\n", + "\n", + "class Ratio:\n", + " def __init__(self,n=None,d=None):\n", + " self.num = n\n", + " self.den = d\n", + " self.reduce()\n", + " def __imul__(self,y):\n", + " self.num = self.num * y.num\n", + " self.den = self.den * y.den\n", + " def print_(self):\n", + " print self.num , '/', self.den" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.6 Page 114" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Ratio:\n", + " def __init__(self,n=None,d=None):\n", + " self.num = n\n", + " self.den = d\n", + " self.reduce()\n", + " def __imul__(self,y):\n", + " self.num = self.num * y.num\n", + " self.den = self.den * y.den\n", + " def __eq__(self,y):\n", + " return (x.num * y.den == y.num * x.den)\n", + " def print_(self):\n", + " print self.num , '/', self.den\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.6 Page 114" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Ratio:\n", + " def __init__(self,n=None,d=None):\n", + " self.num = n\n", + " self.den = d\n", + " def __imul__(self,y):\n", + " self.num = self.num * y.num\n", + " self.den = self.den * y.den\n", + " def __eq__(self,y):\n", + " return (x.num * y.den == y.num * x.den)\n", + " def print_(self):\n", + " print self.num , '/', self.den\n", + "\n", + "\n", + "x = Ratio(22,7)\n", + "y = Ratio(-3,8)\n", + "x.print_() , y.print_()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "22 / 7\n", + "-3 / 8\n" + ] + }, + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 8, + "text": [ + "(None, None)" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.7 Page 114" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def gcd(m,n):\n", + "\n", + " if (m0):\n", + " r = m % n\n", + " m = n\n", + " n = r\n", + " return m\n", + "class Ratio:\n", + " def __init__(self,n=0,d=1):\n", + " self.num = n\n", + " self.den = d\n", + " self.reduce()\n", + " def __mul__(self,y):\n", + " z = Ratio(self.num * y.num, self.den * y.den)\n", + " return z\n", + " def print_(self):\n", + " print self.num , '/', self.den\n", + " \n", + " def input(self):\n", + " self.num = int(raw_input('Numerator : '))\n", + " self.den = int(raw_input('Denominator : '))\n", + " self.reduce()\n", + " def reduce(self):\n", + " # enforce invariant(den > 0):\n", + " if (self.num == 0 or self.den == 0):\n", + " self.num = 0\n", + " self.den = 1\n", + " return\n", + " if (self.den < 0):\n", + " self.den *= -1\n", + " self.num *= -1\n", + " # enforce invariant(gcd(num,den) == 1):\n", + " if (self.den == 1):\n", + " return\n", + " # it's already reduced\n", + " sgn = 0\n", + " if self.num < 0:\n", + " sgn = -1\n", + " else:\n", + " sgn = 1\n", + " g = gcd(sgn*self.num,self.den)\n", + " self.num /= g\n", + " self.den /= g\n", + "\n", + "\n", + "x = Ratio()\n", + "y = Ratio()\n", + "x.input()\n", + "y.input()\n", + "x.print_()\n", + "y.print_()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Numerator : -10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Denominator : -24\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Numerator : 36\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Denominator : -20\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "5 / 12\n", + "-9 / 5\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.8 Page 114" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def gcd(m,n):\n", + "\n", + " if (m0):\n", + " r = m % n\n", + " m = n\n", + " n = r\n", + " return m\n", + "class Ratio:\n", + " def __init__(self,n=0,d=1):\n", + " self.num = n\n", + " self.den = d\n", + " self.reduce()\n", + " def __mul__(self,y):\n", + " z = Ratio(self.num * y.num, self.den * y.den)\n", + " return z\n", + " def print_(self):\n", + " print self.num , '/', self.den\n", + " \n", + " def input(self):\n", + " self.num = int(raw_input('Numerator : '))\n", + " self.den = int(raw_input('Denominator : '))\n", + " self.reduce()\n", + " def __float__(self):\n", + " return float(self.num)/self.den\n", + " def reduce(self):\n", + " # enforce invariant(den > 0):\n", + " if (self.num == 0 or self.den == 0):\n", + " self.num = 0\n", + " self.den = 1\n", + " return\n", + " if (self.den < 0):\n", + " self.den *= -1\n", + " self.num *= -1\n", + " # enforce invariant(gcd(num,den) == 1):\n", + " if (self.den == 1):\n", + " return\n", + " # it's already reduced\n", + " sgn = 0\n", + " if self.num < 0:\n", + " sgn = -1\n", + " else:\n", + " sgn = 15.py\n", + " g = gcd(sgn*self.num,self.den)\n", + " self.num /= g\n", + " self.den /= g\n", + "\n", + "x = Ratio(-5,8)\n", + "print \"x = \" , \n", + "x.print_() \n", + "print \", float(x) = \" , float(x) \n", + "P = Ratio(22,7)\n", + "PI = float(P)\n", + "print \"P = \" ,\n", + "P.print_() \n", + "print \", PI = \" , PI\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = -5 / 8\n", + ", float(x) = -0.625\n", + "P = 22 / 7\n", + ", PI = 3.14285714286\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.9 Page 115" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def gcd(m,n):\n", + " \n", + " if (m0):\n", + " r = m % n\n", + " m = n\n", + " n = r\n", + " return m\n", + "class Ratio:\n", + " def __init__(self,n=0,d=1):\n", + " self.num = n\n", + " self.den = d\n", + " self.reduce()\n", + " def __mul__(self,y):\n", + " z = Ratio(self.num * y.num, self.den * y.den)\n", + " return z\n", + " def print_(self):\n", + " print self.num , '/', self.den\n", + " \n", + " def __iadd__(self,n):\n", + " self.num += self.den\n", + " return self\n", + " def reduce(self):\n", + " # enforce invariant(den > 0):\n", + " if (self.num == 0 or self.den == 0):\n", + " self.num = 0\n", + " self.den = 1\n", + " return\n", + " if (self.den < 0):\n", + " self.den *= -1\n", + " self.num *= -1\n", + " # enforce invariant(gcd(num,den) == 1):\n", + " if (self.den == 1):\n", + " return\n", + " # it's already reduced\n", + " sgn = 0\n", + " if self.num < 0:\n", + " sgn = -1\n", + " else:\n", + " sgn = 1\n", + " g = gcd(sgn*self.num,self.den)\n", + " self.num /= g\n", + " self.den /= g\n", + "\n", + "x = Ratio(22,7)\n", + "x += 1\n", + "y = x\n", + "print \"y = \" ,\n", + "y.print_()\n", + "print \", x = \",\n", + "x.print_()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "y = 29 / 7\n", + ", x = 29 / 7\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.10 Page 115" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def gcd(m,n):\n", + " \n", + " if (m0):\n", + " r = m % n\n", + " m = n\n", + " n = r\n", + " return m\n", + "class Ratio:\n", + " def __init__(self,n=0,d=1):\n", + " self.num = n\n", + " self.den = d\n", + " self.reduce()\n", + " def __mul__(self,y):\n", + " z = Ratio(self.num * y.num, self.den * y.den)\n", + " return z\n", + " def print_(self):\n", + " print self.num , '/', self.den\n", + " \n", + " def __iadd__(self,n):\n", + " self.num += self.den\n", + " return self\n", + " def reduce(self):\n", + " # enforce invariant(den > 0):\n", + " if (self.num == 0 or self.den == 0):\n", + " self.num = 0\n", + " self.den = 1\n", + " return\n", + " if (self.den < 0):\n", + " self.den *= -1\n", + " self.num *= -1\n", + " # enforce invariant(gcd(num,den) == 1):\n", + " if (self.den == 1):\n", + " return\n", + " # it's already reduced\n", + " sgn = 0\n", + " if self.num < 0:\n", + " sgn = -1\n", + " else:\n", + " sgn = 1\n", + " g = gcd(sgn*self.num,self.den)\n", + " self.num /= g\n", + " self.den /= g\n", + "\n", + "x = Ratio(22,7)\n", + "y = Ratio(x.num,x.den)\n", + "x += 1\n", + "print \"y = \" ,\n", + "y.print_()\n", + "print \", x = \",\n", + "x.print_()\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "y = 22 / 7\n", + ", x = 29 / 7\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.11 Page 116" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def gcd(m,n):\n", + " \n", + " if (m0):\n", + " r = m % n\n", + " m = n\n", + " n = r\n", + " return m\n", + "class Ratio:\n", + " def __init__(self,n=0,d=1):\n", + " self.num = n\n", + " self.den = d\n", + " self.reduce()\n", + " def __mul__(self,y):\n", + " z = Ratio(self.num * y.num, self.den * y.den)\n", + " return z\n", + " def print_(self):\n", + " print self.num , '/', self.den\n", + " \n", + " def __getitem__(self,k):\n", + " if k == 1:\n", + " return self.num\n", + " else:\n", + " return self.den\n", + " def reduce(self):\n", + " # enforce invariant(den > 0):\n", + " if (self.num == 0 or self.den == 0):\n", + " self.num = 0\n", + " self.den = 1\n", + " return\n", + " if (self.den < 0):\n", + " self.den *= -1\n", + " self.num *= -1\n", + " # enforce invariant(gcd(num,den) == 1):\n", + " if (self.den == 1):\n", + " return\n", + " # it's already reduced\n", + " sgn = 0\n", + " if self.num < 0:\n", + " sgn = -1\n", + " else:\n", + " sgn = 1\n", + " g = gcd(sgn*self.num,self.den)\n", + " self.num /= g\n", + " self.den /= g\n", + "\n", + "x = Ratio(22,7)\n", + "print \"x = \" ,\n", + "x.print_()\n", + "print \"x[1] = \" , x[1] , \", x[2] = \" , x[2]\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = 22 / 7\n", + "x[1] = 22 , x[2] = 7\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 2 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 2 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch12-checkpoint.ipynb b/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch12-checkpoint.ipynb new file mode 100644 index 00000000..547d2f43 --- /dev/null +++ b/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch12-checkpoint.ipynb @@ -0,0 +1,828 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:2785143880e0e3d805077e0bc2dd4c3858d6ed346ab7a393a92ac292f599e8ec" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 12" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.1 Page 118" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Person:\n", + " def __init__(self,n=\"\",nat=\"U.S.A.\",s=1):\n", + " self.name = n\n", + " self.nationality = nat\n", + " self.sex = s\n", + "\n", + " def printName(self):\n", + " print self.name,\n", + " \n", + " def printNationality(self):\n", + " print self.nationality,\n", + "\n", + "creator = Person(\"Bjarne Stroustrup\", \"Denmark\")\n", + "print \"The creator of C++ was \" ,\n", + "creator.printName() \n", + "print \", who was born in \" ,\n", + "creator.printNationality() \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The creator of C++ was Bjarne Stroustrup , who was born in Denmark\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.2 Page 118" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Date:\n", + " def __init__(self,m=0,d=0,y=0):\n", + " self.month = m\n", + " self.day = d\n", + " self.year = y\n", + " \n", + " def setDate(self,m,d,y):\n", + " self.month = m\n", + " self.day = d\n", + " self.year = y\n", + " # Python doesn't have >> operator for input so we are just using input function\n", + " def input(self):\n", + " self.month = int(raw_input()) \n", + " self.day = int(raw_input())\n", + " self.year = int(raw_input()) \n", + " \n", + " # Python doesn't have << operator for output so we are just using print function\n", + " def print_(self):\n", + " monthName = [\"\", \"January\",\"February\",\"March\", \"April\", \"May\", \"June\",\\\n", + " \"July\", \"August\",\"September\", \"October\", \"November\",\\\n", + " \"December\"]\n", + " print monthName[self.month] , self.day , \",\" , self.year\n", + "\n", + "peace = Date(11,11,1918)\n", + "print \"World War I ended on \" ,\n", + "peace.print_()\n", + "peace.setDate(8,14,1945)\n", + "print \"World War II ended on \" ,\n", + "peace.print_()\n", + "print \"Enter month, day, and year: \"\n", + "date = Date()\n", + "date.input()\n", + "print \"The date is \" , \n", + "date.print_()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.3 Page 119" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Date:\n", + " def __init__(self,m=0,d=0,y=0):\n", + " self.month = m\n", + " self.day = d\n", + " self.year = y\n", + " \n", + " def setDate(self,m,d,y):\n", + " self.month = m\n", + " self.day = d\n", + " self.year = y\n", + " # Python doesn't have >> operator for input so we are just using input function\n", + " def input(self):\n", + " self.month = int(raw_input()) \n", + " self.day = int(raw_input())\n", + " self.year = int(raw_input()) \n", + " \n", + " # Python doesn't have << operator for output so we are just using print function\n", + " def print_(self):\n", + " monthName = [\"\", \"January\",\"February\",\"March\", \"April\", \"May\", \"June\",\\\n", + " \"July\", \"August\",\"September\", \"October\", \"November\",\\\n", + " \"December\"]\n", + " print monthName[self.month] , self.day , \",\" , self.year\n", + "\n", + "class Person:\n", + " def __init__(self,n=\"\",s=0,nat=\"U.S.A.\"):\n", + " self.name = n\n", + " self.nationality = nat\n", + " self.sex = s\n", + " self.dob = Date()\n", + " self.dod = Date()\n", + " def setDOB(self,m,d,y):\n", + " self.dob.setDate(m,d,y)\n", + " def setDOD(self,m,d,y):\n", + " self.dod.setDate(m,d,y)\n", + " def printName(self):\n", + " print self.name,\n", + " def printNationality(self):\n", + " print self.nationality,\n", + " def printDOB(self):\n", + " self.dob.print_()\n", + " def printDOD(self):\n", + " self.dod.print_()\n", + "\n", + "author = Person(\"Thomas Jefferson\", 1)\n", + "author.setDOB(4,13,1743)\n", + "author.setDOD(7,4,1826)\n", + "print \"The author of the Declaration of Independence was \",\n", + "author.printName()\n", + "print \".\\nHe was born on \",\n", + "author.printDOB()\n", + "print \" and died on \",\n", + "author.printDOD()\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The author of the Declaration of Independence was Thomas Jefferson .\n", + "He was born on April 13 , 1743\n", + " and died on July 4 , 1826\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.4 Page 119" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Date:\n", + " def __init__(self,m=0,d=0,y=0):\n", + " self.month = m\n", + " self.day = d\n", + " self.year = y\n", + " \n", + " def setDate(self,m,d,y):\n", + " self.month = m\n", + " self.day = d\n", + " self.year = y\n", + " # Python doesn't have >> operator for input so we are just using input function\n", + " def input(self):\n", + " self.month = int(raw_input()) \n", + " self.day = int(raw_input())\n", + " self.year = int(raw_input()) \n", + " \n", + " # Python doesn't have << operator for output so we are just using print function\n", + " def print_(self):\n", + " monthName = [\"\", \"January\",\"February\",\"March\", \"April\", \"May\", \"June\",\\\n", + " \"July\", \"August\",\"September\", \"October\", \"November\",\\\n", + " \"December\"]\n", + " print monthName[self.month] , self.day , \",\" , self.year\n", + "\n", + "class Person:\n", + " def __init__(self,n=\"\",s=0,nat=\"U.S.A.\"):\n", + " self.name = n\n", + " self.nationality = nat\n", + " self.sex = s\n", + " self.dob = Date()\n", + " self.dod = Date()\n", + " def setDOB(self,m,d,y):\n", + " self.dob.setDate(m,d,y)\n", + " def setDOD(self,m,d,y):\n", + " self.dod.setDate(m,d,y)\n", + " def printName(self):\n", + " print self.name,\n", + " def printNationality(self):\n", + " print self.nationality,\n", + " def printDOB(self):\n", + " self.dob.print_()\n", + " def printDOD(self):\n", + " self.dod.print_()\n", + "\n", + "class Student(Person):\n", + " def __init__(self,n,s=0,i=\"\"):\n", + " Person.__init__(self,n,s)\n", + " self.id = i\n", + " self.credits = 0\n", + " self.gpa = 0\n", + " self.dom = Date()\n", + "\n", + " def setDOM(self,m,d,y):\n", + " self.dom.setDate(m, d, y)\n", + " def printDOM(self):\n", + " self.dom.print_()\n", + "\n", + "x = Student(\"Ann Jones\", 0, \"219360061\")\n", + "x.setDOB(5, 13, 1977)\n", + "x.setDOM(8, 29, 1995)\n", + "x.printName()\n", + "print \"\\n\\t Born: \" ,\n", + "x.printDOB()\n", + "print \"\\n\\tMatriculated: \",\n", + "x.printDOM()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Ann Jones \n", + "\t Born: May 13 , 1977\n", + "\n", + "\tMatriculated: August 29 , 1995\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.5 Page 120" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Date:\n", + " def __init__(self,m=0,d=0,y=0):\n", + " self.month = m\n", + " self.day = d\n", + " self.year = y\n", + " \n", + " def setDate(self,m,d,y):\n", + " self.month = m\n", + " self.day = d\n", + " self.year = y\n", + " # Python doesn't have >> operator for input so we are just using input function\n", + " def input(self):\n", + " self.month = int(raw_input()) \n", + " self.day = int(raw_input())\n", + " self.year = int(raw_input()) \n", + " \n", + " # Python doesn't have << operator for output so we are just using print function\n", + " def print_(self):\n", + " monthName = [\"\", \"January\",\"February\",\"March\", \"April\", \"May\", \"June\",\\\n", + " \"July\", \"August\",\"September\", \"October\", \"November\",\\\n", + " \"December\"]\n", + " print monthName[self.month] , self.day , \",\" , self.year\n", + "\n", + "class Person:\n", + " def __init__(self,n=\"\",s=0,nat=\"U.S.A.\"):\n", + " self.name = n\n", + " self.nationality = nat\n", + " self.sex = s\n", + " self.dob = Date()\n", + " self.dod = Date()\n", + " def setDOB(self,m,d,y):\n", + " self.dob.setDate(m,d,y)\n", + " def setDOD(self,m,d,y):\n", + " self.dod.setDate(m,d,y)\n", + " def printName(self):\n", + " print self.name,\n", + " def printNationality(self):\n", + " print self.nationality,\n", + " def printDOB(self):\n", + " self.dob.print_()\n", + " def printDOD(self):\n", + " self.dod.print_()\n", + "\n", + "class Student(Person):\n", + " def __init__(self,n,s=0,i=\"\"):\n", + " Person.__init__(self,n,s)\n", + " self.id = i\n", + " self.credits = 0\n", + " self.gpa = 0\n", + " self.dom = Date()\n", + "\n", + " def setDOM(self,m,d,y):\n", + " self.dom.setDate(m, d, y)\n", + " def printDOM(self):\n", + " self.dom.print_()\n", + " def printSex(self):\n", + " if self.sex == 1:\n", + " print \"male\"\n", + " else:\n", + " print 'female'\n", + "\n", + "x = Student(\"Ann Jones\", 0, \"219360061\")\n", + "x.setDOB(5, 13, 1977)\n", + "x.setDOM(8, 29, 1995)\n", + "x.setDOD(7,4,1826)\n", + "x.printName()\n", + "print \"\\n\\t Born: \" , \n", + "x.printDOB()\n", + "print \"\\n\\t Sex: \" ,\n", + "x.printSex()\n", + "print \"\\n\\tMatriculated: \",\n", + "x.printDOM()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Ann Jones \n", + "\t Born: May 13 , 1977\n", + "\n", + "\t Sex: female\n", + "\n", + "\tMatriculated: August 29 , 1995\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.6 Page 121" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class X:\n", + " def __init__(self):\n", + " self.a = 0\n", + " def f(self):\n", + " print \"X::f() executing\"\n", + "class Y(X):\n", + " def __init__(self):\n", + " self.a = 0\n", + " def f(self):\n", + " print \"Y::f() executing\"\n", + "x = X()\n", + "x.a = 22\n", + "x.f()\n", + "print \"x.a = \" , x.a\n", + "y = Y()\n", + "y.a = 44\n", + "# assigns 44 to the a defined in Y\n", + "y._X__a = 66\n", + "# assigns 66 to the a defined in X\n", + "y.f()\n", + "# invokes the f() defined in Y\n", + "X.f(x)\n", + "# invokes the f() defined in X\n", + "print \"y.a = \" , y.a \n", + "print \"y._X__a = \" , y._X__a \n", + "z = y\n", + "print \"z.a = \" , z._X__a \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "X::f() executing\n", + "x.a = 22\n", + "Y::f() executing\n", + "X::f() executing\n", + "y.a = 44\n", + "y._X__a = 66\n", + "z.a = 66\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.7 Page 122" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class X:\n", + " def __init__(self):\n", + " print \"X::X() constructor executing \"\n", + " def __del__(self):\n", + " print \"X::X() destructor executing \"\n", + "\n", + "class Y(X):\n", + " def __init__(self):\n", + " X.__init__(self)\n", + " print \"Y::Y() constructor executing \"\n", + " def __del__(self):\n", + " print \"Y::Y() destructor executing \"\n", + "\n", + "class Z(Y):\n", + " def __init__(self,i):\n", + " Y.__init__(self)\n", + " print \"Z::Z(\" , i , \") constructor executing \"\n", + " def __del__(self):\n", + " print \"Z::Z() destructor executing \"\n", + " \n", + "\n", + "Z = Z(44)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "X::X() constructor executing \n", + "Y::Y() constructor executing \n", + "Z::Z( 44 ) constructor executing \n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.8 Page 123" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Person:\n", + " def __init__(self,s):\n", + " self.name = s\n", + " def __del__(self):\n", + " pass\n", + "\n", + "class Student(Person):\n", + " def __init__(self,s,m):\n", + " Person.__init__(self,s)\n", + " self.major = m\n", + " def __del__(self):\n", + " pass\n", + "x = Person(\"Bob\")\n", + "y = Student(\"Sarah\", \"Biology\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.9 Page 123" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Person:\n", + " def __init__(self,n=\"\",s=0,nat=\"U.S.A.\"):\n", + " self.name = n\n", + " self.nationality = nat\n", + " self.sex = s\n", + " self.dob = Date()\n", + " self.dod = Date()\n", + " def setDOB(self,m,d,y):\n", + " self.dob.setDate(m,d,y)\n", + " def setDOD(self,m,d,y):\n", + " self.dod.setDate(m,d,y)\n", + " def printName(self):\n", + " print self.name,\n", + " def printNationality(self):\n", + " print self.nationality,\n", + " def printDOB(self):\n", + " self.dob.print_()\n", + " def printDOD(self):\n", + " self.dod.print_()\n", + " def setHSgraduate(self,g):\n", + " self.hs = g\n", + " def isHSgraduate(self):\n", + " return hs\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.10 Page 125" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class X:\n", + " def f(self):\n", + " print \"X::f() executing\"\n", + "class Y(X):\n", + " def f(self):\n", + " print \"Y::f() executing\"\n", + "x = X()\n", + "y = Y()\n", + "p = x\n", + "p.f()\n", + "p = y\n", + "p.f()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "X::f() executing\n", + "Y::f() executing\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.11 Page 125" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Person:\n", + " def __init__(self,n):\n", + " self.name = n\n", + " def print_(self):\n", + " print 'My name is' , self.name\n", + "\n", + "class Student(Person):\n", + " def __init__(self,s,g):\n", + " Person.__init__(self,s)\n", + " self.gpa = g\n", + " def print_(self):\n", + " print 'My name is ',self.name, ' and my G.P.A. is', self.gpa\n", + "\n", + "class Professor(Person):\n", + " def __init__(self,s,n):\n", + " Person.__init__(self,s)\n", + " self.publs = n\n", + " def print_(self):\n", + " print 'My name is ', self.name,' and i have ' , self.publs,' publications.'\n", + "\n", + "x = Person(\"Bob\")\n", + "p = x\n", + "p.print_()\n", + "y = Student(\"Tom\", 3.47)\n", + "p = y\n", + "p.print_()\n", + "z = Professor(\"Ann\", 7)\n", + "p = z\n", + "p.print_()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "My name is Bob\n", + "My name is Tom and my G.P.A. is 3.47\n", + "My name is Ann and i have 7 publications.\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.12 Page 126" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class X:\n", + " def __init__(self):\n", + " self.p = [0,0]\n", + " print 'X().',\n", + " def __del__(self):\n", + " print '~X().'\n", + "\n", + "class Y(X):\n", + " def __init__(self):\n", + " X.__init__(self)\n", + " self.q = []\n", + " for i in range(1023):\n", + " self.q.append(0)\n", + " print 'Y() : Y::q = ', hex(id(self.q)) ,'.',\n", + " def __del__(self):\n", + " print '~Y().'\n", + "\n", + "for i in range(8):\n", + " r = Y()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "X(). Y() : Y::q = 0x90d91cc . ~Y().\n", + "X(). Y() : Y::q = 0x90c944c . ~Y().\n", + "X(). Y() : Y::q = 0x90d91cc . ~Y().\n", + "X(). Y() : Y::q = 0x90c944c . ~Y().\n", + "X(). Y() : Y::q = 0x90d91cc . ~Y().\n", + "X(). Y() : Y::q = 0x90c944c . ~Y().\n", + "X(). Y() : Y::q = 0x90d91cc . ~Y().\n", + "X(). Y() : Y::q = 0x90c944c . ~Y().\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.13 Page 126" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Media:\n", + " def __init__(self):\n", + " self.title = ''\n", + " def print_(self):\n", + " pass\n", + " def id(self):\n", + " pass\n", + "\n", + "class Book(Media):\n", + " def __init__(self,a='',t=\"\",p=\"\",i=\"\"):\n", + " self.author = a\n", + " self.publisher = p\n", + " self.isbn = i\n", + " self.title = t\n", + " def print_(self):\n", + " print self.title , \" by \" , self.author\n", + " def id(self):\n", + " return self.isbn\n", + "\n", + "class CD(Media):\n", + " def __init__(self,t=\"\",c=\"\",m=\"\",n=\"\"):\n", + " self.composer = c\n", + " self.make = m\n", + " self.number = n\n", + " self.title = t\n", + " def print_(self):\n", + " print self.title , \", \" , self.composer\n", + " def id(self):\n", + " s = str(self.make) + ' ' + str(self.number)\n", + " return s\n", + "\n", + "class Magazine(Media):\n", + " def __init__(self,t=\"\",i=\"\",v=0, n=0):\n", + " self.issn = i\n", + " self.volume = v\n", + " self.number = n\n", + " self.title = t\n", + " def print_(self):\n", + " print self.title , \" Magazine, Vol. \", self.volume , \", No.\" , self.number\n", + " def id(self):\n", + " return self.issn\n", + "\n", + "book = Book(\"Bjarne Stroustrup\", \"The C++ Programming Language\",\"Addison-Wesley\", \"0-201-53992-6\")\n", + "magazine = Magazine(\"TIME\", \"0040-781X\", 145, 23)\n", + "cd = CD(\"BACH CANTATAS\", \"Johann Sebastian Bach\",\"ARCHIV\", \"D120541\")\n", + "book.print_()\n", + "print \"\\tid: \" , book.id() \n", + "magazine.print_()\n", + "print \"\\tid: \" , magazine.id() \n", + "cd.print_()\n", + "print \"\\tid: \" , cd.id()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The C++ Programming Language by Bjarne Stroustrup\n", + "\tid: 0-201-53992-6\n", + "TIME Magazine, Vol. 145 , No. 23\n", + "\tid: 0040-781X\n", + "BACH CANTATAS , Johann Sebastian Bach\n", + "\tid: ARCHIV D120541\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch13-checkpoint.ipynb b/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch13-checkpoint.ipynb new file mode 100644 index 00000000..7dadafec --- /dev/null +++ b/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch13-checkpoint.ipynb @@ -0,0 +1,431 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:c4bc7ea265a87d2ba5c8acba80280da83f3569bfcf42471e5b0e2a3235d146de" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 13" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.1 Page 128" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def swap(x,y):\n", + " x[0],y[0] = y[0],x[0]\n", + "\n", + "m = [22]\n", + "n = [66]\n", + "swap(m, n)\n", + "s1 = [\"John Adams\"]\n", + "s2 = [\"James Madison\"]\n", + "swap(s1, s2)\n", + "x = [22/7]\n", + "y = [-3]\n", + "swap(x, y)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.2 Page 128" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def sort(v,n):\n", + " for i in range(1,n):\n", + " for j in range(n-i):\n", + " if v[j] > v[j+1]:\n", + " v[j],v[j+1] = v[j+1],v[j]\n", + "\n", + "def print_( v,n):\n", + " for i in range(n):\n", + " print v[i],\n", + " print \"\"\n", + " \n", + "a = [55, 33, 88, 11, 44, 99, 77, 22, 66]\n", + "print_(a,9);\n", + "sort(a,9)\n", + "print_(a,9)\n", + "s = [\"Tom\", \"Hal\", \"Dan\", \"Bob\", \"Sue\", \"Ann\", \"Gus\"]\n", + "print_(s,7)\n", + "sort(s,7)\n", + "print_(s,7)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "55 33 88 11 44 99 77 22 66 \n", + "11 22 33 44 55 66 77 88 99 \n", + "Tom Hal Dan Bob Sue Ann Gus \n", + "Ann Bob Dan Gus Hal Sue Tom \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.3 Page 129" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Stack:\n", + " def __init__(self,s=100):\n", + " self.size = s\n", + " self.top = -1\n", + " self.data = []\n", + " def push(self,x):\n", + " self.data.append( x)\n", + " self.top += 1\n", + " def pop(self):\n", + " d = self.data[self.top]\n", + " self.data.pop(self.top)\n", + " self.top -= 1\n", + " return d \n", + " def isEmpty(self):\n", + " return self.top == -1\n", + " def isFull(self):\n", + " return self.top==self.size-1\n", + " \n", + "intStack1 = Stack(5)\n", + "intStack2 = Stack(10)\n", + "charStack = Stack(8)\n", + "intStack1.push(77)\n", + "charStack.push('A')\n", + "intStack2.push(22)\n", + "charStack.push('E')\n", + "charStack.push('K')\n", + "intStack2.push(44)\n", + "print intStack2.pop() \n", + "print intStack2.pop() \n", + "if (intStack2.isEmpty()):\n", + " print \"intStack2 is empty.\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "44\n", + "22\n", + "intStack2 is empty.\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.4 Page 129" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Vector:\n", + " def __init__(self,n=None):\n", + " if type(n) == int :\n", + " self.size = n\n", + " self.data = []\n", + " else:\n", + " self.size = 8\n", + " self.data = []\n", + " for i in range(self.size):\n", + " self.data.append(0)\n", + "v = Vector()\n", + "v.data[5] = 127\n", + "w = v\n", + "x = Vector(3)\n", + "print w.size\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "8\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.5 Page 130" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "class Vector:\n", + " def __init__(self,n=None):\n", + " if type(n) == int :\n", + " self.size = n\n", + " self.data = []\n", + " else:\n", + " self.size = 8\n", + " self.data = []\n", + " for i in range(self.size):\n", + " self.data.append(0)\n", + "\n", + "class Array(Vector):\n", + " def __init__(self,i,j):\n", + " Vector.__init__(self,j-i+1)\n", + " self.i0= i\n", + " def __setitem__(self,k,v):\n", + " self.data[k-self.i0] = v\n", + " def __getitem__(self,i):\n", + " return self.data[self.i0-i]\n", + " def firstSubscript(self):\n", + " return self.i0\n", + " def lastSubscript(self):\n", + " return self.i0+self.size-1\n", + "\n", + "x = Array(1,3)\n", + "x.data[0] = 3.14159\n", + "x.data[1] = 0.08516\n", + "x.data[2] = 5041.92\n", + "print \"x.size() = \" , x.size \n", + "print \"x.firstSubscript() = \" , x.firstSubscript() \n", + "print \"x.lastSubscript() = \" , x.lastSubscript()\n", + "for i in range(0,3):\n", + " print \"x[\" , i + 1 , \"] = \" , x.data[i]\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x.size() = 3\n", + "x.firstSubscript() = 1\n", + "x.lastSubscript() = 3\n", + "x[ 1 ] = 3.14159\n", + "x[ 2 ] = 0.08516\n", + "x[ 3 ] = 5041.92\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.6 Page 131" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "class Matrix:\n", + " def __init__(self,r=1,c=1):\n", + " self.rows = r\n", + " self.columns = c\n", + " self.vector = []\n", + " for i in range(r):\n", + " a = []\n", + " for j in range(c):\n", + " a.append(0)\n", + " self.vector.append(a)\n", + "\n", + "a = Matrix(2,3)\n", + "a.vector[0][0] = 0.0\n", + "a.vector[0][1] = 0.1\n", + "a.vector[0][2] = 0.2\n", + "a.vector[1][0] = 1.0\n", + "a.vector[1][1] = 1.1\n", + "a.vector[1][2] = 1.2\n", + "\n", + "print \"The matrix a has \" , a.rows , \" rows and \", a.columns , \" columns:\"\n", + "for i in range(2):\n", + " for j in range(3):\n", + " print a.vector[i][j] ,\n", + " print \"\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The matrix a has 2 rows and 3 columns:\n", + "0.0 0.1 0.2 \n", + "1.0 1.1 1.2 \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.7 Page 132" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "friends = []\n", + "\n", + "\n", + "friends.insert(0,\"Bowen, Van\")\n", + "friends.insert(0,\"Dixon, Tom\")\n", + "friends.insert(0,\"Mason, Joe\")\n", + "friends.insert(0,\"White, Ann\")\n", + "\n", + "for i in range(len(friends)):\n", + " print friends[i], '->' ,\n", + "print '*'\n", + "friends.remove('White, Ann')\n", + "print \"Removed: \" , 'White, Ann'\n", + "for i in range(len(friends)):\n", + " print friends[i], '->' ,\n", + "print '*'\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "White, Ann -> Mason, Joe -> Dixon, Tom -> Bowen, Van -> *\n", + "Removed: White, Ann\n", + "Mason, Joe -> Dixon, Tom -> Bowen, Van -> *\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.7 Page 132" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "friends = []\n", + "friends.append(\"Bowen, Van\")\n", + "friends.append(\"Dixon, Tom\")\n", + "friends.append(\"Mason, Joe\")\n", + "friends.append(\"White, Ann\")\n", + "for i in range(len(friends)):\n", + " print friends[i], '->' ,\n", + "print '*'\n", + "\n", + "friends.remove(\"Mason, Joe\")\n", + "friends[1] = \"Davis, Jim\"\n", + "for i in range(len(friends)):\n", + " print friends[i], '->' ,\n", + "print '*'\n", + "\n", + "friends.insert(2,\"Morse, Sam\")\n", + "for i in range(len(friends)):\n", + " print friends[i], '->' ,\n", + "print '*'\n", + "\n", + "for i in range(len(friends)):\n", + " print \"[\" ,friends[i] , \"]\" , '->' ,\n", + "print '*'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Bowen, Van -> Dixon, Tom -> Mason, Joe -> White, Ann -> *\n", + "Bowen, Van -> Davis, Jim -> White, Ann -> *\n", + "Bowen, Van -> Davis, Jim -> Morse, Sam -> White, Ann -> *\n", + "[ Bowen, Van ] -> [ Davis, Jim ] -> [ Morse, Sam ] -> [ White, Ann ] -> *\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch14-checkpoint.ipynb b/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch14-checkpoint.ipynb new file mode 100644 index 00000000..0e00de6f --- /dev/null +++ b/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch14-checkpoint.ipynb @@ -0,0 +1,624 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:2c16de9b41dbb01240882bf1073200d244b7c6b6ebd3365e3dd0cb228ffe4781" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 14" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.1 Page 134" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def load(v):\n", + " v.append(\"Japan\")\n", + " v.append(\"Italy\")\n", + " v.append(\"Spain\")\n", + " v.append(\"Egypt\")\n", + " v.append(\"Chile\")\n", + " v.append(\"Zaire\")\n", + " v.append(\"Nepal\")\n", + " v.append(\"Kenya\")\n", + "\n", + "def print_(v):\n", + " for i in v:\n", + " print i\n", + "\n", + "v = []\n", + "load(v)\n", + "print_(v)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Japan\n", + "Italy\n", + "Spain\n", + "Egypt\n", + "Chile\n", + "Zaire\n", + "Nepal\n", + "Kenya\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.2 Page 135" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def load(v):\n", + " v.append(\"Japan\")\n", + " v.append(\"Italy\")\n", + " v.append(\"Spain\")\n", + " v.append(\"Egypt\")\n", + " v.append(\"Chile\")\n", + " v.append(\"Zaire\")\n", + " v.append(\"Nepal\")\n", + " v.append(\"Kenya\")\n", + "\n", + "def print_(v):\n", + " for i in v:\n", + " print i\n", + "\n", + "v = []\n", + "load(v)\n", + "print_(v)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Japan\n", + "Italy\n", + "Spain\n", + "Egypt\n", + "Chile\n", + "Zaire\n", + "Nepal\n", + "Kenya\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.3 Page 136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def load(v):\n", + " v.append(\"Japan\")\n", + " v.append(\"Italy\")\n", + " v.append(\"Spain\")\n", + " v.append(\"Egypt\")\n", + " v.append(\"Chile\")\n", + " v.append(\"Zaire\")\n", + " v.append(\"Nepal\")\n", + " v.append(\"Kenya\")\n", + "\n", + "def print_(v):\n", + " for i in range(len(v)):\n", + " print v[i]\n", + "\n", + "v = []\n", + "load(v)\n", + "print_(v)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Japan\n", + "Italy\n", + "Spain\n", + "Egypt\n", + "Chile\n", + "Zaire\n", + "Nepal\n", + "Kenya\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.3 Page 136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "def load(v):\n", + " v.append(\"Japan\")\n", + " v.append(\"Italy\")\n", + " v.append(\"Spain\")\n", + " v.append(\"Egypt\")\n", + " v.append(\"Chile\")\n", + " v.append(\"Zaire\")\n", + " v.append(\"Nepal\")\n", + " v.append(\"Kenya\")\n", + "\n", + "def print_(v):\n", + " for i in v:\n", + " print i\n", + "\n", + "v = []\n", + "load(v)\n", + "v.sort()\n", + "print_(v)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Chile\n", + "Egypt\n", + "Italy\n", + "Japan\n", + "Kenya\n", + "Nepal\n", + "Spain\n", + "Zaire\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.4 Page 136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def load(v):\n", + " v.append(\"Japan\")\n", + " v.append(\"Italy\")\n", + " v.append(\"Spain\")\n", + " v.append(\"Egypt\")\n", + " v.append(\"Chile\")\n", + " v.append(\"Zaire\")\n", + " v.append(\"Nepal\")\n", + " v.append(\"Kenya\")\n", + "\n", + "def print_(v):\n", + " for i in v:\n", + " print i\n", + "\n", + "v = []\n", + "load(v)\n", + "w = v\n", + "print_(v)\n", + "print_(w)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Japan\n", + "Italy\n", + "Spain\n", + "Egypt\n", + "Chile\n", + "Zaire\n", + "Nepal\n", + "Kenya\n", + "Japan\n", + "Italy\n", + "Spain\n", + "Egypt\n", + "Chile\n", + "Zaire\n", + "Nepal\n", + "Kenya\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.5 Page 137" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def load(v):\n", + " v.append(\"Japan\")\n", + " v.append(\"Italy\")\n", + " v.append(\"Spain\")\n", + " v.append(\"Egypt\")\n", + " v.append(\"Chile\")\n", + " v.append(\"Zaire\")\n", + " v.append(\"Nepal\")\n", + " v.append(\"Kenya\")\n", + "\n", + "def print_(v):\n", + " for i in v:\n", + " print i\n", + "\n", + "v = []\n", + "load(v)\n", + "v.sort()\n", + "print_(v)\n", + "print \"v.front() = \" + v[0]\n", + "print \"v.back() = \" + v.pop(-1) \n", + "print \"v.back() = \" + v.pop(-1) \n", + "print \"v.back() = \" + v[-1] \n", + "print_(v)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Chile\n", + "Egypt\n", + "Italy\n", + "Japan\n", + "Kenya\n", + "Nepal\n", + "Spain\n", + "Zaire\n", + "v.front() = Chile\n", + "v.back() = Zaire\n", + "v.back() = Spain\n", + "v.back() = Nepal\n", + "Chile\n", + "Egypt\n", + "Italy\n", + "Japan\n", + "Kenya\n", + "Nepal\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.6 Page 137" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def load(v):\n", + " v.append(\"Japan\")\n", + " v.append(\"Italy\")\n", + " v.append(\"Spain\")\n", + " v.append(\"Egypt\")\n", + " v.append(\"Chile\")\n", + " v.append(\"Zaire\")\n", + " v.append(\"Nepal\")\n", + " v.append(\"Kenya\")\n", + "\n", + "def print_(v):\n", + " for i in v:\n", + " print i\n", + "\n", + "v = []\n", + "load(v)\n", + "v.sort()\n", + "print_(v)\n", + "v.pop(2) # removes Italy\n", + "v.pop(-2) # removes Spain\n", + "print_(v)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Chile\n", + "Egypt\n", + "Italy\n", + "Japan\n", + "Kenya\n", + "Nepal\n", + "Spain\n", + "Zaire\n", + "Chile\n", + "Egypt\n", + "Japan\n", + "Kenya\n", + "Nepal\n", + "Zaire\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.8 Page 138" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def load(v):\n", + " v.append(\"Japan\")\n", + " v.append(\"Italy\")\n", + " v.append(\"Spain\")\n", + " v.append(\"Egypt\")\n", + " v.append(\"Chile\")\n", + " v.append(\"Zaire\")\n", + " v.append(\"Nepal\")\n", + " v.append(\"Kenya\")\n", + "\n", + "def print_(v):\n", + " for i in v:\n", + " print i\n", + "v = []\n", + "load(v)\n", + "v.sort()\n", + "print_(v)\n", + "r = []\n", + "for i in range(2,len(v)-2):\n", + " r.append(v[i]) #removes the segment Italy..Nepal\n", + " \n", + "for i in r:\n", + " v.remove(i)\n", + "print_(v)\n", + "v.insert(2,\"India\")\n", + "print_(v)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Chile\n", + "Egypt\n", + "Italy\n", + "Japan\n", + "Kenya\n", + "Nepal\n", + "Spain\n", + "Zaire\n", + "Chile\n", + "Egypt\n", + "Spain\n", + "Zaire\n", + "Chile\n", + "Egypt\n", + "India\n", + "Spain\n", + "Zaire\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.9 Page 139" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def load(v):\n", + " v.append(\"Japan\")\n", + " v.append(\"Italy\")\n", + " v.append(\"Spain\")\n", + " v.append(\"Egypt\")\n", + " v.append(\"Chile\")\n", + " v.append(\"Zaire\")\n", + " v.append(\"Nepal\")\n", + " v.append(\"Kenya\")\n", + " v.append(\"India\")\n", + " v.append(\"China\")\n", + " v.append(\"Malta\")\n", + " v.append(\"Syria\")\n", + "\n", + "def print_(v):\n", + " for i in v:\n", + " print i\n", + "\n", + "v = []\n", + "load(v)\n", + "print_(v)\n", + "egypt = v.index('Egypt')\n", + "malta = v.index('Malta')\n", + "w = v[egypt:malta+1]\n", + "w.sort()\n", + "print_(w)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Japan\n", + "Italy\n", + "Spain\n", + "Egypt\n", + "Chile\n", + "Zaire\n", + "Nepal\n", + "Kenya\n", + "India\n", + "China\n", + "Malta\n", + "Syria\n", + "Chile\n", + "China\n", + "Egypt\n", + "India\n", + "Kenya\n", + "Malta\n", + "Nepal\n", + "Zaire\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.10 Page 139" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def copy(v,x,n):\n", + " for i in x:\n", + " v.append(i)\n", + "\n", + "def projection(v,b):\n", + " v_size = len(v)\n", + " w = []\n", + " for i in range(0,v_size):\n", + " if b[i]:\n", + " w.append(v[i])\n", + " return w\n", + "\n", + "def print_(v):\n", + " for i in v:\n", + " print i,\n", + " print ''\n", + "\n", + "x = [ 22.2, 33.3, 44.4, 55.5, 66.6, 77.7, 88.8, 99.9 ]\n", + "v = []\n", + "copy(v, x, 8)\n", + "y = [ False, True, False, True, True, True, False, True ]\n", + "b = []\n", + "copy(b, y, 8)\n", + "w = projection(v, b)\n", + "print_(v)\n", + "print_(w)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "22.2 33.3 44.4 55.5 66.6 77.7 88.8 99.9 \n", + "33.3 55.5 66.6 77.7 99.9 \n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch2-checkpoint.ipynb b/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch2-checkpoint.ipynb new file mode 100644 index 00000000..75a72273 --- /dev/null +++ b/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch2-checkpoint.ipynb @@ -0,0 +1,747 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:d7df65d2ddf57442f1a366aedfff9ee4f4aa086fced8ff89a2bb809a0b69e7be" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 2" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.1 Page 11" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "flag=False\n", + "print \"flag = %r\" % flag\n", + "flag = True\n", + "print \"flag = %r\" % flag" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "flag = False\n", + "flag = True\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.2 Page 12" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "c='A'\n", + "print \"c = \" + c + \", int(c) = %d\" % ord(c)\n", + "c='t'\n", + "print \"c = \" + c + \", int(c) = %d\" % ord(c)\n", + "c='\\t' # the tab character\n", + "print \"c = \" + c + \", int(c) = %d\" % ord(c)\n", + "c='!'\n", + "print \"c = \" + c + \", int(c) = %d\" % ord(c)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "c = A, int(c) = 65\n", + "c = t, int(c) = 116\n", + "c = \t, int(c) = 9\n", + "c = !, int(c) = 33\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.3 Page 12" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import sys\n", + "\n", + "print 'maximum limit int : ',\n", + "print sys.maxint\n", + "print 'float info'\n", + "print sys.float_info" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.4 Page 13" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "m=54\n", + "n=20\n", + "print \"m = %d and n = %d\" %(m,n)\n", + "print \"m+n = %d\" % (m+n) # 54+20 = 74\n", + "print \"m-n = %d\" % (m-n) # 54-20 = 34\n", + "print \"m*n = %d\" % (m*n)# 54*20 = 1080\n", + "print \"m/n = %d\" % (m/n) # 54/20 = 2\n", + "print \"m modulo by n = %d\" % (m%n) # 54%20 = 14" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "m = 54 and n = 20\n", + "m+n = 74\n", + "m-n = 34\n", + "m*n = 1080\n", + "m/n = 2\n", + "m modulo by n = 14\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.5 Page 13" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "m = 44\n", + "m += 1\n", + "n = m\n", + "print \"m = %d , n = %d\" %(m,n)\n", + "m = 44\n", + "n = m # the post-increment operator is applied to m\n", + "m += 1\n", + "print \"m = %d , n = %d\" %(m,n)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "m = 45 , n = 45\n", + "m = 45 , n = 44\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.6 Page 14" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "n=22\n", + "print \"n = %d\" % n\n", + "n += 9 # adds 9 to n\n", + "print \"After n += 9, n = %d\" % n\n", + "n -= 5 # subtracts 5 from n\n", + "print \"After n -= 5, n = %d\" % n\n", + "n *= 2 # multiplies n by 3\n", + "print \"After n *= 2, n = %d\" % n \n", + "n /= 3 # divides n by 9\n", + "print \"After n /= 3, n = %d\" % n \n", + "n %= 7 # reduces n to the remainder from dividing by 4\n", + "print 'After n modulo by 7 n = %d' %n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = 22\n", + "After n += 9, n = 31\n", + "After n -= 5, n = 26\n", + "After n *= 2, n = 52\n", + "After n /= 3, n = 17\n", + "After n modulo by 7 n = 3\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.7 Page 15" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "x=54.0\n", + "y=20.0\n", + "print \"x = %f and y = %f\" %(x,y)\n", + "print \"x+y = %f\" %(x+y) # 54.0+20.0 = 74.0\n", + "print \"x-y = %f\" % (x-y) # 54.0-20.0 = 34.0\n", + "print \"x*y = %f\" %( x*y) # 54.0*20.0 = 1080.0\n", + "print \"x/y = %f\" % (x/y) # 54.0/20.0 = 2.7\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = 54.000000 and y = 20.000000\n", + "x+y = 74.000000\n", + "x-y = 34.000000\n", + "x*y = 1080.000000\n", + "x/y = 2.700000\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.8 Page 16" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import sys\n", + "\n", + "print \"Number of bytes used:\\n\"\n", + "\n", + "print \" char: %d \" % sys.getsizeof('a')\n", + "print \" int : %d \" % sys.getsizeof(int(1))\n", + "print \" string : %d \" % sys.getsizeof(str('hellololdei'))\n", + "print \"float : %d\" % sys.getsizeof(float(1.1))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Number of bytes used:\n", + "\n", + " char: 22 \n", + " int : 12 \n", + " string : 32 \n", + "float : 16\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.8 Page 17" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import sys\n", + "\n", + "fbits = 8*sys.getsizeof(float(123))\n", + "\n", + "# each byte contains 8 bits\n", + "print \"float uses : %d bits:\\n\\t\" % fbits \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "float uses : 128 bits:\n", + "\t\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.9 Page 17" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "v = 1234.56789\n", + "n = int(v);\n", + "print \"v = %f, n = %d\" %(v,n)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "v = 1234.567890, n = 1234\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.10 Page 18" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "c='A'\n", + "print \"char c = \" + c\n", + "k=c;\n", + "print \"k = \" + k \n", + "m=k;\n", + "print \"m = \" + m \n", + "n=m\n", + "print \"n = \" + n\n", + "x=m\n", + "print \"x = \" + x \n", + "y=x\n", + "print \"y = \" + y" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "char c = A\n", + "k = A\n", + "m = A\n", + "n = A\n", + "x = A\n", + "y = A\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.11 Page 19" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "n=1000\n", + "print \"n = %d\" % n\n", + "n *= 1000 # multiplies n by 1000\n", + "print \"n = %d\" % n\n", + "n *= 1000 # multiplies n by 1000\n", + "print \"n = %d\" % n\n", + "n *= 1000 # multiplies n by 1000\n", + "print \"n = %d\" % n\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = 1000\n", + "n = 1000000\n", + "n = 1000000000\n", + "n = 1000000000000\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.12 Page 20" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "x=1000.0\n", + "print \"x = %f\" % x\n", + "x *= x # multiplies n by itself; i.e., it squares x\n", + "print \"x = %f\" % x\n", + "x *= x # multiplies n by itself; i.e., it squares x\n", + "print \"x = %f\" % x\n", + "x *= x # multiplies n by itself; i.e., it squares x\n", + "print \"x = %f\" % x\n", + "x *= x # multiplies n by itself; i.e., it squares x\n", + "print \"x = %f\" % x\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = 1000.000000\n", + "x = 1000000.000000\n", + "x = 1000000000000.000000\n", + "x = 999999999999999983222784.000000\n", + "x = 1000000000000000043845843045076197354634047651840.000000\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.13 Page 21" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "\n", + "a = float(raw_input(\"Enter the coefficients of a quadratic equation:\\n a : \"))\n", + "b = float(raw_input('b : '))\n", + "c = float(raw_input('c : '))\n", + "\n", + "print \"The equation is: \",\n", + "print a,\n", + "print \"*x*x + \",\n", + "print b,\n", + "print \"*x + \" ,\n", + "print c,\n", + "print \" = 0\" \n", + "\n", + "d = b*b - 4*a*c # discriminant\n", + "sqrtd = math.sqrt(d)\n", + "x1 = (-b + sqrtd)/(2*a)\n", + "x2 = (-b - sqrtd)/(2*a)\n", + "print \"The solutions are:\"\n", + "print \"\\tx1 = %f\" % x1\n", + "print \"\\tx2 = %f\" % x2\n", + "print \"Check:\" \n", + "print \"\\ta*x1*x1 + b*x1 + c = %f\" %( a*x1*x1 + b*x1 + c)\n", + "print \"\\ta*x2*x2 + b*x2 + c = %f\" %( a*x2*x2 + b*x2 + c)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the coefficients of a quadratic equation:\n", + " a : 2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "b : 1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "c : -3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The equation is: 2.0 *x*x + 1.0 *x + -3.0 = 0\n", + "The solutions are:\n", + "\tx1 = 1.000000\n", + "\tx2 = -1.500000\n", + "Check:\n", + "\ta*x1*x1 + b*x1 + c = 0.000000\n", + "\ta*x2*x2 + b*x2 + c = 0.000000\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.14 Page 22" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "x = 1000/3.0\n", + "print \"x = %f\" %x # x = 1000/3\n", + "y = x - 333.0\n", + "print \"y = %f\" % y # y = 1/3\n", + "z = 3*y - 1.0\n", + "print \"z = %f\" %z # z = 3(1/3) - 1\n", + "if (z == 0):\n", + " print \"z == 0.\\n\"\n", + "else:\n", + " print \"z does not equal 0.\\n\" # z != 0\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = 333.333333\n", + "y = 0.333333\n", + "z = -0.000000\n", + "z does not equal 0.\n", + "\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.15 Page 24" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "x = float(raw_input(\"Enter float: \"))\n", + "print \"Its reciprocal is: \",\n", + "print 1/x " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter float: 234.567e89\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Its reciprocal is: 4.2631742743e-92\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.16 Page 25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "x = 11 \n", + "if True:\n", + " x = 22 # OK: this is in the scope of x\n", + " y = 33 # ERROR: this is not in the scope of y\n", + " x = 44 # OK: this is in the scope of x\n", + " y = 55 # OK: this is in the scope of y\n", + "x = 66 # OK: this is in the scope of x\n", + "y = 77 # ERROR: this is not in the scope of y\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.16 Page 25" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "x = 11\n", + "\n", + "if True:\n", + " # illustrates the nested and parallel scopes:\n", + " x = 22\n", + " # begin scope of internal block\n", + " if True:\n", + " x = 33\n", + " print \"In block inside main(): x = %d \" % x\n", + " # end scope of internal block\n", + "print \"In main(): x = %d\" %x \n", + "print \"In main(): x = %d \"% x" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "In block inside main(): x = 33 \n", + "In main(): x = 33\n", + "In main(): x = 33 \n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch3-checkpoint.ipynb b/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch3-checkpoint.ipynb new file mode 100644 index 00000000..2ae1c810 --- /dev/null +++ b/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch3-checkpoint.ipynb @@ -0,0 +1,1185 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:c6ccd61745829db5f310110909ac53b4a96d80dc833177ee7aacf23b0ee3328f" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Chapter 3" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.1 Page 27" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter two positive integers: \";\n", + "n = int(raw_input())\n", + "d = int(raw_input())\n", + "if (n%d):\n", + " print \"%d is not divisible by %d\" %(n,d)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two positive integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "66\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "66 is not divisible by 7\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.2 Page 27" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter two positive integers: \";\n", + "n = int(raw_input())\n", + "d = int(raw_input())\n", + "if (n%d):\n", + " print \"%d is not divisible by %d\" %(n,d)\n", + "else:\n", + " print \"%d is divisible by %d\" %(n,d)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two positive integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "56\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "56 is divisible by 7\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.3 Page 28" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter two integers: \"\n", + "m = int(raw_input())\n", + "n = int(raw_input())\n", + "\n", + "if (m < n):\n", + " print \"%d is the minimum.\" %m\n", + "else:\n", + " print \"%d is the minimum.\" %n\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "77\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "55 is the minimum.\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.4 Page 29" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter an integer: \"\n", + "n = int(raw_input())\n", + "if (n = 22):\n", + " print \"%d = 22\" %n\n", + "else: \n", + " print \"%d != 22\" %n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "SyntaxError", + "evalue": "invalid syntax (, line 7)", + "output_type": "pyerr", + "traceback": [ + "\u001b[1;36m File \u001b[1;32m\"\"\u001b[1;36m, line \u001b[1;32m7\u001b[0m\n\u001b[1;33m if (n = 22):\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.5 Page 30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter three integers: \"\n", + "n1 = int(raw_input())\n", + "n2 = int(raw_input())\n", + "n3 = int(raw_input())\n", + "\n", + "m=n1\n", + "# now min <= n1\n", + "if (n2 < m):\n", + " m = n2 # now min <= n1 and min <= n2\n", + "if (n3 < m):\n", + " m = n3 # now min <= n1, min <= n2, and min <= n3\n", + "print \"Their minimum is %d\" % m" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter three integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "77\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "33\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Their minimum is 33\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.6 Page 30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter two integers: \"\n", + "x = int(raw_input())\n", + "y = int(raw_input())\n", + "\n", + "if (x > y):\n", + " temp=x\n", + " x = y\n", + " y = temp\n", + " \n", + "\n", + "print \"%d <= %d\" %(x,y)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "66\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "44\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "44 <= 66\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.7 Page 31" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "n=44\n", + "print \"n = %d\" % n \n", + "if True:\n", + " # scope extends over 4 lines\n", + " print \"Enter an integer: \"\n", + " n = int(raw_input())\n", + " print \"n = %d\" % n \n", + "\n", + "if True:\n", + " print \"n = %d\" % n \n", + " # the n that was declared first\n", + "if True:\n", + " print \"n = %d\" % n \n", + "\n", + "print \"n = %d\" % n " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = 44\n", + "Enter an integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "77\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = 77\n", + "n = 77\n", + "n = 77\n", + "n = 77\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.8 Page 32" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter three integers: \"\n", + "n1 = int(raw_input())\n", + "n2 = int(raw_input())\n", + "n3 = int(raw_input())\n", + "if (n1 <= n2 and n1 <= n3):\n", + " print \"Their minimum is %d\" % n1\n", + " \n", + "if (n2 <= n1 and n2 <= n3):\n", + " print \"Their minimum is %d \" % n2 \n", + "if (n3 <= n1 and n3 <= n2):\n", + " print \"Their minimum is %d\" % n3 \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter three integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "77\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "33\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Their minimum is 33 \n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.9 Page 32" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Are you enrolled (y/n): \"\n", + "ans = raw_input()\n", + "if (ans == 'Y' or ans == 'y'):\n", + " print \"You are enrolled.\\n\"\n", + "else: \n", + " print \"You are not enrolled.\\n\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Are you enrolled (y/n): \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "You are enrolled.\n", + "\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.10 Page 33" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter two positive integers: \";\n", + "n = int(raw_input())\n", + "d = int(raw_input())\n", + "\n", + "if (d != 0 and n%d == 0): \n", + " print \"%d divides %d\" %(d,n)\n", + "else:\n", + " print \"%d does not divide %d\"% (d,n)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two positive integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "33\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "6 does not divide 33\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.11 Page 34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter three integers: \"\n", + "n1 = int(raw_input())\n", + "n2 = int(raw_input())\n", + "n3 = int(raw_input())\n", + "\n", + "if (n1 >= n2 >= n3):\n", + " print \"max = x\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter three integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.12 Page 35" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter two positive integers: \"\n", + "n = int(raw_input())\n", + "d = int(raw_input())\n", + "\n", + "if (d != 0):\n", + " if (n%d == 0):\n", + " print d,\n", + " print \" divides %d\" % n \n", + " else:\n", + " print \"%d does not divide %d\" %(d,n)\n", + "else:\n", + " print '%d does not divide %d '%(d,n)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two positive integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "44\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "44 does not divide 55\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.13 Page 35" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter three integers: \"\n", + "n1 = int(raw_input())\n", + "n2 = int(raw_input())\n", + "n3 = int(raw_input())\n", + "if (n1 < n2):\n", + " if (n1 < n3):\n", + " print \"Their minimum is : %d\" % n1\n", + " else:\n", + " print \"Their minimum is : %d\" % n3\n", + "else: # n1 >= n2\n", + " if (n2 < n3):\n", + " print \"Their minimum is : %d\" % n2\n", + " else:\n", + " print \"Their minimum is %d\" % n3" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter three integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "77\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "33\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Their minimum is : 33\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.14 Page 36" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Pick a number from 1 to 8.\" \n", + "answer = int(raw_input())\n", + "print \"Is it less than 5? (y|n): \"\n", + "answer = raw_input()\n", + "if (answer == 'y'): # 1 <= n <= 4\n", + " print \"Is it less than 3? (y|n): \"\n", + " answer = raw_input() \n", + " if (answer == 'y'): # 1 <= n <= 2\n", + " print \"Is it less than 2? (y|n): \"\n", + " answer = raw_input()\n", + " if (answer == 'y'):\n", + " print \"Your number is 1.\"\n", + " else:\n", + " print \"Your number is 2.\"\n", + " else: # 3 <= n <= 4\n", + " print \"Is it less than 4? (y|n): \"\n", + " answer = raw_input()\n", + " if (answer == 'y'):\n", + " print \"Your number is 3.\"\n", + " else:\n", + " print \"Your number is 4.\"\n", + "else: # 5 <= n <= 8\n", + " print \"Is it less than 7? (y|n): \"\n", + " answer = raw_input()\n", + " if (answer == 'y'): # 5 <= n <= 6\n", + " print \"Is it less than 6? (y|n): \"\n", + " answer = raw_input()\n", + " if (answer == 'y'):\n", + " print \"Your number is 5.\"\n", + " else:\n", + " print \"Your number is 6.\" \n", + " else: # 7 <= n <= 8\n", + " print \"Is it less than 8? (y|n): \"\n", + " answer = raw_input()\n", + " if (answer == 'y'):\n", + " print \"Your number is 7.\" \n", + " else:\n", + " print \"Your number is 8.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Pick a number from 1 to 8.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Is it less than 5? (y|n): \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "n\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Is it less than 7? (y|n): \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "y\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Is it less than 6? (y|n): \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "n\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Your number is 6.\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.15 Page 36" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "language = raw_input(\"Engl., Fren., Ger., Ital., or Rus.? (e|f|g|i|r): \")\n", + "\n", + "if (language == 'e'): \n", + " print \"Welcome to ProjectEuclid.\"\n", + "elif (language == 'f'):\n", + " print \"Bon jour, ProjectEuclid.\"\n", + "elif (language == 'g'):\n", + " print \"Guten tag, ProjectEuclid.\"\n", + "elif (language == 'i'):\n", + " print \"Bon giorno, ProjectEuclid.\"\n", + "elif (language == 'r'):\n", + " print \"Dobre utre, ProjectEuclid.\"\n", + "else:\n", + " print \"Sorry; we don't speak your language.\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Engl., Fren., Ger., Ital., or Rus.? (e|f|g|i|r): i\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Bon giorno, ProjectEuclid.\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.16 Page 37" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "score = int(raw_input(\"Enter your test score: \"))\n", + "a = int(score/10)\n", + "if a == 10 or a == 9:\n", + " print \"Your grade is an A.\"\n", + "elif a == 8:\n", + " print \"Your grade is a B.\" \n", + "elif a == 7:\n", + " print \"Your grade is a C.\" \n", + "elif a == 6:\n", + " print \"Your grade is a D.\"\n", + "elif a==5 or a==4 or a==3 or a==2 or a==1 or a==0:\n", + " print \"Your grade is an F.\" \n", + "else:\n", + " print \"Error: score is out of range.\\n\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your test score: 83\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Your grade is a B.\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.17 Page 38" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "score = int(raw_input(\"Enter your test score: \"))\n", + "a = int(score/10)\n", + "if a == 10 or a == 9:\n", + " print \"Your grade is an A.\"\n", + "elif a == 8:\n", + " print \"Your grade is a B.\" \n", + "elif a == 7:\n", + " print \"Your grade is a C.\" \n", + "elif a == 6:\n", + " print \"Your grade is a D.\"\n", + "elif a==5 or a==4 or a==3 or a==2 or a==1 or a==0:\n", + " print \"Your grade is an F.\" \n", + "else:\n", + " print \"Error: score is out of range.\\n\"\n", + "\n", + "print \"Goodbye.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your test score: 83\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Your grade is a B.\n", + "Goodbye.\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.18 Page 38" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "score = int(raw_input(\"Enter your test score: \"))\n", + "a = int(score/10)\n", + "if a == 10 or a == 9:\n", + " print \"Your grade is an A.\"\n", + "elif a == 8:\n", + " print \"Your grade is a B.\" \n", + "elif a == 7:\n", + " print \"Your grade is a C.\" \n", + "elif a == 6:\n", + " print \"Your grade is a D.\"\n", + "elif a==5 or a==4 or a==3 or a==2 or a==1 or a==0:\n", + " print \"Your grade is an F.\" \n", + "else:\n", + " print \"Error: score is out of range.\\n\"\n", + "\n", + "print \"Goodbye.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter your test score: 83\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Your grade is a B.\n", + "Goodbye.\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.19 Page 39" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter two integers: \"\n", + "m = int(raw_input())\n", + "n = int(raw_input())\n", + "print min(m,n),\n", + "print 'is the minimum'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "33\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "33 is the minimum\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch4-checkpoint.ipynb b/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch4-checkpoint.ipynb new file mode 100644 index 00000000..d63d79b3 --- /dev/null +++ b/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch4-checkpoint.ipynb @@ -0,0 +1,1657 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:737a02bfa8469193fdfc06f943f5ddeb58798dd90da1f6e94d0a393845dbdcae" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 4" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.1 Page 40" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "i=1\n", + "print \"Enter a positive integer: \"\n", + "n = int(raw_input())\n", + "s=0\n", + "while (i <= n):\n", + " s += i\n", + " i += 1\n", + "print \"The sum of the first %d integers is %d\" %(i,s)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The sum of the first 6 integers is 15\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.2 Page 40" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter a positive integer: \"\n", + "bound = int(raw_input())\n", + "s=0.0\n", + "i=0\n", + "while (s < bound):\n", + " i += 1\n", + " s += 1.0/i\n", + "\n", + "print \"The sum of the first %d reciprocals is %f\" %(i,s)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The sum of the first 83 reciprocals is 5.002068\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.3 Page 41" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "print \"Enter a positive number: \"\n", + "x = float(raw_input())\n", + "while (x > 0):\n", + " print \"sqrt(%d) = %f \"%(x,math.sqrt(x))\n", + " print \"Enter another positive number (or 0 to quit): \"\n", + " x = float(raw_input())\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.4 Page 41" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "i=1\n", + "print \"Enter a positive integer: \";\n", + "n = int(raw_input())\n", + "s=0\n", + "while(True):\n", + " if (i > n):\n", + " break # terminates the loop immediately\n", + " s += i\n", + " i += 1\n", + "print \"The sum of the first %d integers is %d\" %(n,s)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The sum of the first 5 integers is 15\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.5 Page 41" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "\n", + "print \"Enter a positive integer: \"\n", + "bound = int(raw_input())\n", + "print \"Fibonacci numbers < %d:\\n0, 1\" % bound ,\n", + "f0=0\n", + "f1=1\n", + "while (True):\n", + " f2 = f0 + f1\n", + " if (f2 > bound):\n", + " break\n", + " print \", %d\" % f2,\n", + " f0 = f1\n", + " f1 = f2\n", + " " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "Example 4.6 Page 42" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import sys\n", + "print \"Enter a positive integer: \"\n", + "bound = int(raw_input())\n", + "print \"Fibonacci numbers < %d:\\n0, 1\" % bound ,\n", + "f0=0\n", + "f1=1\n", + "while (True):\n", + " f2 = f0 + f1\n", + " if (f2 > bound):\n", + " sys.exit(0)\n", + " print \", %d\" % f2,\n", + " f0 = f1\n", + " f1 = f2\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "ename": "SystemExit", + "evalue": "0", + "output_type": "pyerr", + "traceback": [ + "An exception has occurred, use %tb to see the full traceback.\n", + "\u001b[1;31mSystemExit\u001b[0m\u001b[1;31m:\u001b[0m 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Fibonacci numbers < 10:\n", + "0, 1 , 1 , 2 , 3 , 5 , 8" + ] + }, + { + "output_type": "stream", + "stream": "stderr", + "text": [ + "To exit: use 'exit', 'quit', or Ctrl-D.\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.7 Page 42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter a positive integer: \"\n", + "bound = int(raw_input())\n", + "print \"Fibonacci numbers < %d:\\n0, 1\" % bound ,\n", + "f0=0\n", + "f1=1\n", + "# Error : infinite loop !\n", + "while (True):\n", + " f2 = f0 + f1\n", + " # By commenting the below if statement, it goes to infinite.\n", + " if (f2 > bound):\n", + " break\n", + " print \", %d\" % f2,\n", + " f0 = f1\n", + " f1 = f2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Fibonacci numbers < 10:\n", + "0, 1 , 1 , 2 , 3 , 5 , 8\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.8 Page 42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter a positive integer: \"\n", + "bound = int(raw_input())\n", + "print \"Fibonacci numbers < %d:\\n0, 1\" % bound ,\n", + "f0=0\n", + "f1=1\n", + "# Error : infinite loop !\n", + "while (True):\n", + " f2 = f0 + f1\n", + " # By commenting the below if statement, it goes to infinite.\n", + " if (f2 > bound):\n", + " break\n", + " print \", %d\" % f2,\n", + " f0 = f1\n", + " f1 = f2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive integer: \n", + "Fibonacci numbers < 10:\n", + "0, 1 , 1 , 2 , 3 , 5 , 8\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.8 Page 42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "i=0\n", + "print \"Enter a positive integer: \"\n", + "n = int(raw_input())\n", + "s=0\n", + "while i<=n:\n", + " s += i\n", + " i += 1\n", + "print \"The sum of the first %d integers is %d\" %(n,s)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The sum of the first 10 integers is 55\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.9 Page 44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter a positive integer: \"\n", + "bound = int(raw_input())\n", + "print \"Factorial numbers < %d:\\n1, 1\" %bound,\n", + "f=1\n", + "i=1\n", + "while f < bound:\n", + " i += 1\n", + " f *= i\n", + " print \", %d\" %f,\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Factorial numbers < 10:\n", + "1, 1 , 2 , 6 , 24\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.10 Page 44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "print \"Enter a positive integer: \"\n", + "n = int(raw_input())\n", + "s=0;\n", + "for i in range(0,n+1):\n", + " s += i\n", + "print \"The sum of the first %d integers is %d\" %(n,s)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The sum of the first 10 integers is 55\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.11 Page 44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter a positive integer: \"\n", + "n = int(raw_input())\n", + "s=0\n", + "for i in range(1,n/2): # the scope of this i is this loop\n", + " s += i\n", + "\n", + "for i in range(n/2,n+1): # the scope of this i is this loop\n", + " s += i\n", + "print \"The sum of the first %d integers is %d\" % (n,s)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The sum of the first 10 integers is 55\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.12 Page 45" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter a positive integer: \"\n", + "bound = int(raw_input())\n", + "\n", + "print \"Factorial numbers that are <= %d:\\n1, 1\" %bound,\n", + "f=1\n", + "for i in range(2,bound+1):\n", + " f *= i\n", + " print \", %d\" % f,\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Factorial numbers that are <= 10:\n", + "1, 1 , 2 , 6 , 24 , 120 , 720 , 5040 , 40320 , 362880 , 3628800\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.13 Page 46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "for i in range(10,0,-1):\n", + " print i,\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10 9 8 7 6 5 4 3 2 1\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.14 Page 46" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "prime = True\n", + "print \"Enter a positive integer: \"\n", + "n = int(raw_input())\n", + "if (n < 2):\n", + " print \"%d is not prime.\" %n\n", + " prime = False\n", + "elif (n < 4):\n", + " print \"%d is prime.\" %n\n", + " prime = False\n", + "elif (n%2 == 0):\n", + " print \"%d = 2* %d\" %(n,n/2)\n", + " prime = False\n", + "else:\n", + " for d in range(3,n/2+1):\n", + " if (n%d == 0):\n", + " print \"%d = %d * %d\" %(n,d,n/d)\n", + " prime = False\n", + "if prime: \n", + " print \"%d is prime.\"%n\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "11\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "11 is prime.\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.15 Page 47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter positive integers (0 to quit): \";\n", + "n = int(raw_input())\n", + "m = n\n", + "while n > 0:\n", + " n = int(raw_input())\n", + " if n > m :\n", + " m = n\n", + "\n", + "print \"max = %d\" % m" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter positive integers (0 to quit): \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "19\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "42\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "max = 42\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.15 Page 47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter positive integers (0 to quit): \";\n", + "n = int(raw_input())\n", + "m = n\n", + "while n > 0: \n", + " if n < m :\n", + " m = n\n", + " n = int(raw_input())\n", + "\n", + "print \"min = %d\" % m\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter positive integers (0 to quit): \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "19\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "42\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "min = 1\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.16 Page 48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "m = 95\n", + "n = 11\n", + "while m%n > 0:\n", + " print \"%d modulo %d = %d\" %(m,n,m%n)\n", + " m -= 3\n", + " n += 1\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "95 modulo 11 = 7\n", + "92 modulo 12 = 8\n", + "89 modulo 13 = 11\n", + "86 modulo 14 = 2\n", + "83 modulo 15 = 8\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.17 Page 49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "for x in range(1,13):\n", + " for y in range(1,13):\n", + " print \"%4d\" % (x*y),\n", + " print \"\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1 2 3 4 5 6 7 8 9 10 11 12 \n", + " 2 4 6 8 10 12 14 16 18 20 22 24 \n", + " 3 6 9 12 15 18 21 24 27 30 33 36 \n", + " 4 8 12 16 20 24 28 32 36 40 44 48 \n", + " 5 10 15 20 25 30 35 40 45 50 55 60 \n", + " 6 12 18 24 30 36 42 48 54 60 66 72 \n", + " 7 14 21 28 35 42 49 56 63 70 77 84 \n", + " 8 16 24 32 40 48 56 64 72 80 88 96 \n", + " 9 18 27 36 45 54 63 72 81 90 99 108 \n", + " 10 20 30 40 50 60 70 80 90 100 110 120 \n", + " 11 22 33 44 55 66 77 88 99 110 121 132 \n", + " 12 24 36 48 60 72 84 96 108 120 132 144 \n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.17 Page 48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "\n", + "print \"Enter a positive integer: \"\n", + "n = int(raw_input())\n", + "d=0 # the discrete binary logarithm of n\n", + "p2d=1 # = 2^d\n", + "i = n\n", + "while i > 1:\n", + " # INVARIANT: 2^d <= n/i < 2*2^d\n", + " p2d=math.pow(2,d) # = 2^d\n", + " print \"%2d <= %2d\" %(p2d,2*p2d)\n", + " i /= 2\n", + " d += 1\n", + "\n", + "p2d=math.pow(2,d) # = 2^d\n", + "print \"%2d <= %2d < %2d\" %(p2d,n,2*p2d)\n", + "print \" The discrete binary logarithm of is %d\" % d \n", + "lgn = math.log(n)/math.log(2) # base 2 logarithm\n", + "print \"The continuous binary logarithm of is %f\" % lgn" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "17\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1 <= 2\n", + " 2 <= 4\n", + " 4 <= 8\n", + " 8 <= 16\n", + "16 <= 17 < 32\n", + " The discrete binary logarithm of is 4\n", + "The continuous binary logarithm of is 4.087463\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.18 Page 48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "i=1\n", + "print \"Enter a positive integer: \"\n", + "n = int(raw_input())\n", + "s=0\n", + "while (True):\n", + " if (i > n):\n", + " break\n", + " s += i\n", + " i += 1\n", + "\n", + "print \"The sum of the first %d integers is %d\" %(i,s)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a positive integer: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The sum of the first 11 integers is 55\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.19 Page 48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "count=0\n", + "s=0\n", + "print \"Enter positive integers (0 to quit):\" \n", + "while True: # \"forever\"\n", + " print \"\\t %d :\" %(count + 1),\n", + " n = int(raw_input())\n", + " if (n <= 0):\n", + " break\n", + " count += 1\n", + " s += n\n", + "\n", + "print \"The average of those %d positive numbers is \" %count,\n", + "print float(s)/count\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter positive integers (0 to quit):\n", + "\t 1 :" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "12\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \t 2 :" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "32\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \t 3 :" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "11\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \t 4 :" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The average of those 3 positive numbers is 18.3333333333\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.20 Page 48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "for x in range(1,13):\n", + " for y in range(1,13):\n", + " if y>x:\n", + " break\n", + " else:\n", + " print '%4d' %(x*y),\n", + " print ''\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 1 \n", + " 2 4 \n", + " 3 6 9 \n", + " 4 8 12 16 \n", + " 5 10 15 20 25 \n", + " 6 12 18 24 30 36 \n", + " 7 14 21 28 35 42 49 \n", + " 8 16 24 32 40 48 56 64 \n", + " 9 18 27 36 45 54 63 72 81 \n", + " 10 20 30 40 50 60 70 80 90 100 \n", + " 11 22 33 44 55 66 77 88 99 110 121 \n", + " 12 24 36 48 60 72 84 96 108 120 132 144 \n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.21 Page 49" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "while True:\n", + " n = int(raw_input('Enter int : '))\n", + " if (n%2 == 0):\n", + " continue\n", + " if (n%3 == 0):\n", + " break\n", + " print \"\\tBottom of loop.\\n\"\n", + "print \"\\tOutside of loop.\\n\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter int : 5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tBottom of loop.\n", + "\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter int : 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter int : 6\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter int : 9\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tOutside of loop.\n", + "\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.22 Page 50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "N=5\n", + "done=False\n", + "for i in range(N):\n", + " for j in range(N):\n", + " if done:\n", + " break\n", + " for k in range(N):\n", + " if done:\n", + " break\n", + " if (i+j+k>N):\n", + " done = True\n", + " else:\n", + " print i+j+k,\n", + " print \" \",\n", + " print \"* \"\n", + " print \".\" \n", + " done = False\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 1 2 3 4 * \n", + "1 2 3 4 5 * \n", + "2 3 4 5 * \n", + ".\n", + "1 2 3 4 5 * \n", + "2 3 4 5 * \n", + ".\n", + "2 3 4 5 * \n", + ".\n", + "3 4 5 * \n", + ".\n", + "4 5 * \n", + ".\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.23 Page 50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "N=5\n", + "done=False\n", + "for i in range(N):\n", + " for j in range(N):\n", + " if done:\n", + " break\n", + " for k in range(N):\n", + " if done:\n", + " break\n", + " if (i+j+k>N):\n", + " done = True\n", + " else:\n", + " print i+j+k,\n", + " print \" \",\n", + " print \"* \"\n", + " print \".\" \n", + " done = False\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 1 2 3 4 * \n", + "1 2 3 4 5 * \n", + "2 3 4 5 * \n", + ".\n", + "1 2 3 4 5 * \n", + "2 3 4 5 * \n", + ".\n", + "2 3 4 5 * \n", + ".\n", + "3 4 5 * \n", + ".\n", + "4 5 * \n", + ".\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.24 Page 50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import random\n", + "\n", + "# prints pseudo-random numbers:\n", + "\n", + "for i in range(0,8):\n", + " print random.random()\n", + "\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0.702115758628\n", + "0.969460447904\n", + "0.409934401112\n", + "0.700339443791\n", + "0.093528851602\n", + "0.132172955687\n", + "0.0162887279366\n", + "0.943010713478\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.25 Page 50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import random\n", + "# prints pseudo-random numbers:\n", + "print \"Enter seed: \"\n", + "seed = int(raw_input())\n", + "random.seed(seed);\n", + "for i in range(0,8):\n", + " print random.random()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter seed: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0.62290169489\n", + "0.741786989261\n", + "0.795193565566\n", + "0.942450283777\n", + "0.73989857474\n", + "0.922324996665\n", + "0.0290052282836\n", + "0.465622654378\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.26 Page 50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import random\n", + "for i in range(0,8):\n", + " print random.random()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0.943356716998\n", + "0.648974553137\n", + "0.900900491751\n", + "0.113205964653\n", + "0.469069047782\n", + "0.24657283262\n", + "0.543760859236\n", + "0.573941187928\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 4, + "metadata": {}, + "source": [ + "Example 4.27 Page 50" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import random\n", + "print \"Enter minimum and maximum: \"\n", + "m = int(raw_input())\n", + "n = int(raw_input())\n", + "# lowest and highest numbers\n", + "r = n - m + 1\n", + "# number of numbers in range\n", + "for i in range(0,20):\n", + " j = int(random.random()*100 % r + m)\n", + " print j,\n", + " print \" \",\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter minimum and maximum: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "15\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "6 15 10 8 15 9 7 7 11 6 5 15 14 15 15 15 11 13 14 6 \n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch5-checkpoint.ipynb b/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch5-checkpoint.ipynb new file mode 100644 index 00000000..c68f8096 --- /dev/null +++ b/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch5-checkpoint.ipynb @@ -0,0 +1,1736 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:e80063795283207748ff55204e74519308d9c1c1f0d9935ca9a096d46bbd96b5" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 5" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.1 Page 51" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + ":\n", + "for i in range(0,6):\n", + " print \"\\t %d \\t %f\" %(i,math.sqrt(i))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\t 0 \t 0.000000\n", + "\t 1 \t 1.000000\n", + "\t 2 \t 1.414214\n", + "\t 3 \t 1.732051\n", + "\t 4 \t 2.000000\n", + "\t 5 \t 2.236068\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.2 Page 51" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "x = 0\n", + "while x < 2:\n", + " print \"%f \\t\\t %f \\t %f\" %(x,math.sin(2*x),2*math.sin(x)*math.cos(x))\n", + " x += 0.2\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0.000000 \t\t 0.000000 \t 0.000000\n", + "0.200000 \t\t 0.389418 \t 0.389418\n", + "0.400000 \t\t 0.717356 \t 0.717356\n", + "0.600000 \t\t 0.932039 \t 0.932039\n", + "0.800000 \t\t 0.999574 \t 0.999574\n", + "1.000000 \t\t 0.909297 \t 0.909297\n", + "1.200000 \t\t 0.675463 \t 0.675463\n", + "1.400000 \t\t 0.334988 \t 0.334988\n", + "1.600000 \t\t -0.058374 \t -0.058374\n", + "1.800000 \t\t -0.442520 \t -0.442520\n", + "2.000000 \t\t -0.756802 \t -0.756802\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "Example 5.3 Page 51" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def cube(x):\n", + " \n", + " return x*x*x\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.3 Page 51" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def cube(x):\n", + " \n", + " return x*x*x\n", + "\n", + "\n", + "n=1\n", + "while (n != 0):\n", + " n = int(raw_input())\n", + " print \"\\tcube( %d ) = %d\" %(n,cube(n))" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tcube( 4 ) = 64\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tcube( 2 ) = 8\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tcube( 9 ) = 729\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tcube( 0 ) = 0\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.4 Page 51" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def maximum(x,y):\n", + " \n", + " if (x < y):\n", + " return y\n", + " else:\n", + " return x\n", + "\n", + "# tests the max() function:\n", + "m = 1\n", + "n = 1\n", + "while m != 0: \n", + " m = int(raw_input())\n", + " n = int(raw_input())\n", + " print \"\\tmax( %d , %d ) = %d\" %(m,n,maximum(m,n))\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tmax( 5 , 2 ) = 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tmax( 0 , 3 ) = 3\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.5 Page 51" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def maximum(x,y):\n", + " \n", + " if (x < y):\n", + " return y\n", + " else:\n", + " return x\n", + "\n", + "# tests the max() function:\n", + "m = 1\n", + "n = 1\n", + "while m != 0: \n", + " m = int(raw_input())\n", + " n = int(raw_input())\n", + " print \"\\tmax( %d , %d ) = %d\" %(m,n,maximum(m,n))\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tmax( 5 , 2 ) = 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tmax( 0 , 3 ) = 3\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.6 Page 52" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "m = 1\n", + "n = 1\n", + "while m!=0:\n", + " m = int(raw_input())\n", + " n = int(raw_input())\n", + " print \"\\tmax(%d,%d) = %d\" %(m,n, max(m,n))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tmax(5,4) = 5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tmax(4,3) = 4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tmax(8,0) = 8\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\tmax(0,5) = 5\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.7 Page 52" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def fact(n):\n", + " if (n < 0):\n", + " return 0\n", + " f = 1\n", + " while (n > 1):\n", + " f *= n\n", + " n -= 1\n", + " return f\n", + "\n", + "for i in range(-1,6):\n", + " print fact(i),\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 1 1 2 6 24 120\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.8 Page 53" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def fact(n):\n", + " if (n < 0):\n", + " return 0\n", + " f = 1\n", + " while (n > 1):\n", + " f *= n\n", + " n -= 1\n", + " return f\n", + "\n", + "\n", + "def perm(n,k):\n", + " \n", + " if (n < 0 or k < 0 or k > n):\n", + " return 0\n", + " return fact(n)/fact(n-k)\n", + "\n", + "for i in range(-1,8):\n", + " for j in range(-1,i+2):\n", + " print perm(i,j),\n", + " print ''\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 0 \n", + "0 1 0 \n", + "0 1 1 0 \n", + "0 1 2 2 0 \n", + "0 1 3 6 6 0 \n", + "0 1 4 12 24 24 0 \n", + "0 1 5 20 60 120 120 0 \n", + "0 1 6 30 120 360 720 720 0 \n", + "0 1 7 42 210 840 2520 5040 5040 0 \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.9 Page 53" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def printDate(m,d,y):\n", + " \n", + " if (m < 1 or m > 12 or d < 1 or d > 31 or y < 0):\n", + " print \"Error: parameter out of range.\\n\"\n", + " return\n", + " if m == 1:\n", + " print \"January \",\n", + " elif m ==2:\n", + " print \"February \",\n", + " elif m==3 :\n", + " print \"March \",\n", + " elif m==4:\n", + " print \"April \",\n", + " elif m==5:\n", + " print \"May \",\n", + " elif m==6:\n", + " print \"June \",\n", + " elif m==7:\n", + " print \"July \",\n", + " elif m==8:\n", + " print \"August \",\n", + " elif m==9:\n", + " print \"September \",\n", + " elif m==10:\n", + " print \"October \",\n", + " elif m==1:\n", + " print \"November \",\n", + " else:\n", + " print \"December \",\n", + " print d , \", \", y \n", + "\n", + "# tests the printDate() function:\n", + "month = 1\n", + "while month > 0:\n", + " month = int(raw_input())\n", + " day = int(raw_input())\n", + " year = int(raw_input())\n", + " printDate(month,day,year)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "12\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1989\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "September 12 , 1989\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2001\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Error: parameter out of range.\n", + "\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.10 Page 54" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import string\n", + "def ispunct(s):\n", + " return all(c in string.punctuation for c in s)\n", + "def printCharCategory(c):\n", + " \n", + " print \"The character [\" + c + \"] is a \",\n", + " if(c.isdigit()):\n", + " print \"digit.\\n\"\n", + " elif (c.islower()):\n", + " print \"lower-case letter.\\n\"\n", + " elif (c.isupper()): \n", + " print \"capital letter.\\n\"\n", + " elif (c.isspace()):\n", + " print \"white space character.\\n\"\n", + " elif (ord(c) >= 10 and ord(c) <= 15 or ord(c) == 0):\n", + " print \"control character.\\n\"\n", + " elif (ispunct(c)):\n", + " print \"punctuation mark.\\n\"\n", + " else:\n", + " print \"Error.\\n\"\n", + "\n", + "# prints the category to which the given character belongs;\n", + "# tests the printCharCategory() function:\n", + "for c in range(128):\n", + " printCharCategory(chr(c))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The character [\u0000] is a control character.\n", + "\n", + "The character [\u0001] is a Error.\n", + "\n", + "The character [\u0002] is a Error.\n", + "\n", + "The character [\u0003] is a Error.\n", + "\n", + "The character [\u0004] is a Error.\n", + "\n", + "The character [\u0005] is a Error.\n", + "\n", + "The character [\u0006] is a Error.\n", + "\n", + "The character [\u0007] is a Error.\n", + "\n", + "The character [\b] is a Error.\n", + "\n", + "The character [\t] is a white space character.\n", + "\n", + "The character [\n", + "] is a white space character.\n", + "\n", + "The character [\u000b", + "] is a white space character.\n", + "\n", + "The character [\f", + "] is a white space character.\n", + "\n", + "The character [\r", + "] is a white space character.\n", + "\n", + "The character [\u000e] is a control character.\n", + "\n", + "The character [\u000f] is a control character.\n", + "\n", + "The character [\u0010] is a Error.\n", + "\n", + "The character [\u0011] is a Error.\n", + "\n", + "The character [\u0012] is a Error.\n", + "\n", + "The character [\u0013] is a Error.\n", + "\n", + "The character [\u0014] is a Error.\n", + "\n", + "The character [\u0015] is a Error.\n", + "\n", + "The character [\u0016] is a Error.\n", + "\n", + "The character [\u0017] is a Error.\n", + "\n", + "The character [\u0018] is a Error.\n", + "\n", + "The character [\u0019] is a Error.\n", + "\n", + "The character [\u001a] is a Error.\n", + "\n", + "The character [\u001b] is a Error.\n", + "\n", + "The character [\u001c", + "] is a Error.\n", + "\n", + "The character [\u001d", + "] is a Error.\n", + "\n", + "The character [\u001e", + "] is a Error.\n", + "\n", + "The character [\u001f] is a Error.\n", + "\n", + "The character [ ] is a white space character.\n", + "\n", + "The character [!] is a punctuation mark.\n", + "\n", + "The character [\"] is a punctuation mark.\n", + "\n", + "The character [#] is a punctuation mark.\n", + "\n", + "The character [$] is a punctuation mark.\n", + "\n", + "The character [%] is a punctuation mark.\n", + "\n", + "The character [&] is a punctuation mark.\n", + "\n", + "The character ['] is a punctuation mark.\n", + "\n", + "The character [(] is a punctuation mark.\n", + "\n", + "The character [)] is a punctuation mark.\n", + "\n", + "The character [*] is a punctuation mark.\n", + "\n", + "The character [+] is a punctuation mark.\n", + "\n", + "The character [,] is a punctuation mark.\n", + "\n", + "The character [-] is a punctuation mark.\n", + "\n", + "The character [.] is a punctuation mark.\n", + "\n", + "The character [/] is a punctuation mark.\n", + "\n", + "The character [0] is a digit.\n", + "\n", + "The character [1] is a digit.\n", + "\n", + "The character [2] is a digit.\n", + "\n", + "The character [3] is a digit.\n", + "\n", + "The character [4] is a digit.\n", + "\n", + "The character [5] is a digit.\n", + "\n", + "The character [6] is a digit.\n", + "\n", + "The character [7] is a digit.\n", + "\n", + "The character [8] is a digit.\n", + "\n", + "The character [9] is a digit.\n", + "\n", + "The character [:] is a punctuation mark.\n", + "\n", + "The character [;] is a punctuation mark.\n", + "\n", + "The character [<] is a punctuation mark.\n", + "\n", + "The character [=] is a punctuation mark.\n", + "\n", + "The character [>] is a punctuation mark.\n", + "\n", + "The character [?] is a punctuation mark.\n", + "\n", + "The character [@] is a punctuation mark.\n", + "\n", + "The character [A] is a capital letter.\n", + "\n", + "The character [B] is a capital letter.\n", + "\n", + "The character [C] is a capital letter.\n", + "\n", + "The character [D] is a capital letter.\n", + "\n", + "The character [E] is a capital letter.\n", + "\n", + "The character [F] is a capital letter.\n", + "\n", + "The character [G] is a capital letter.\n", + "\n", + "The character [H] is a capital letter.\n", + "\n", + "The character [I] is a capital letter.\n", + "\n", + "The character [J] is a capital letter.\n", + "\n", + "The character [K] is a capital letter.\n", + "\n", + "The character [L] is a capital letter.\n", + "\n", + "The character [M] is a capital letter.\n", + "\n", + "The character [N] is a capital letter.\n", + "\n", + "The character [O] is a capital letter.\n", + "\n", + "The character [P] is a capital letter.\n", + "\n", + "The character [Q] is a capital letter.\n", + "\n", + "The character [R] is a capital letter.\n", + "\n", + "The character [S] is a capital letter.\n", + "\n", + "The character [T] is a capital letter.\n", + "\n", + "The character [U] is a capital letter.\n", + "\n", + "The character [V] is a capital letter.\n", + "\n", + "The character [W] is a capital letter.\n", + "\n", + "The character [X] is a capital letter.\n", + "\n", + "The character [Y] is a capital letter.\n", + "\n", + "The character [Z] is a capital letter.\n", + "\n", + "The character [[] is a punctuation mark.\n", + "\n", + "The character [\\] is a punctuation mark.\n", + "\n", + "The character []] is a punctuation mark.\n", + "\n", + "The character [^] is a punctuation mark.\n", + "\n", + "The character [_] is a punctuation mark.\n", + "\n", + "The character [`] is a punctuation mark.\n", + "\n", + "The character [a] is a lower-case letter.\n", + "\n", + "The character [b] is a lower-case letter.\n", + "\n", + "The character [c] is a lower-case letter.\n", + "\n", + "The character [d] is a lower-case letter.\n", + "\n", + "The character [e] is a lower-case letter.\n", + "\n", + "The character [f] is a lower-case letter.\n", + "\n", + "The character [g] is a lower-case letter.\n", + "\n", + "The character [h] is a lower-case letter.\n", + "\n", + "The character [i] is a lower-case letter.\n", + "\n", + "The character [j] is a lower-case letter.\n", + "\n", + "The character [k] is a lower-case letter.\n", + "\n", + "The character [l] is a lower-case letter.\n", + "\n", + "The character [m] is a lower-case letter.\n", + "\n", + "The character [n] is a lower-case letter.\n", + "\n", + "The character [o] is a lower-case letter.\n", + "\n", + "The character [p] is a lower-case letter.\n", + "\n", + "The character [q] is a lower-case letter.\n", + "\n", + "The character [r] is a lower-case letter.\n", + "\n", + "The character [s] is a lower-case letter.\n", + "\n", + "The character [t] is a lower-case letter.\n", + "\n", + "The character [u] is a lower-case letter.\n", + "\n", + "The character [v] is a lower-case letter.\n", + "\n", + "The character [w] is a lower-case letter.\n", + "\n", + "The character [x] is a lower-case letter.\n", + "\n", + "The character [y] is a lower-case letter.\n", + "\n", + "The character [z] is a lower-case letter.\n", + "\n", + "The character [{] is a punctuation mark.\n", + "\n", + "The character [|] is a punctuation mark.\n", + "\n", + "The character [}] is a punctuation mark.\n", + "\n", + "The character [~] is a punctuation mark.\n", + "\n", + "The character [\u007f] is a Error.\n", + "\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.11 Page 54" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "def isPrime(n):\n", + "\n", + " sqrtn = math.sqrt(n)\n", + " if (n < 2):\n", + " return False\n", + " # 0 and 1 are not primes\n", + " if (n < 4):\n", + " return True\n", + " # 2 and 3 are the first primes\n", + " if (n%2 == 0):\n", + " return False\n", + " # 2 is the only even prime\n", + " for d in range(3,int(sqrtn+1),2):\n", + " if (n%d == 0):\n", + " return False\n", + " # n has a nontrivial divisor\n", + " return True;\n", + "\n", + "for n in range(0,80):\n", + " if (isPrime(n)):\n", + " print n,\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.12 Page 55" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def isLeapYear(y):\n", + " \n", + " return (y % 4 == 0 and y % 100 != 0 or y % 400 == 0)\n", + "\n", + "# tests the isLeapYear() function:\n", + "n = 2\n", + "while n > 1:\n", + " n = int(raw_input())\n", + " if (isLeapYear(n)):\n", + " print \"%d is a leap year.\" % n\n", + " else:\n", + " print \"%d is not a leap year.\" %n\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2004\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "2004 is a leap year.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2006\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "2006 is not a leap year.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2013\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "2013 is not a leap year.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 is a leap year.\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.12 Page 55" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def age():\n", + " \n", + " while (True):\n", + " print \"How old are you: \"\n", + " n = int(raw_input())\n", + " if (n < 0):\n", + " print \"\\a\\tYour age could not be negative.\"\n", + " elif (n > 120):\n", + " print \"\\a\\tYou could not be over 120.\"\n", + " else:\n", + " return n\n", + " print \"\\n\\tTry again.\\n\"\n", + "\n", + "a = age();\n", + "print \"\\nYou are %d years old.\" %a\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "How old are you: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "-12\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\u0007\tYour age could not be negative.\n", + "\n", + "\tTry again.\n", + "\n", + "How old are you: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "125\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\u0007\tYou could not be over 120.\n", + "\n", + "\tTry again.\n", + "\n", + "How old are you: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "24\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "You are 24 years old.\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.12 Page 55" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def swap(x,y):\n", + " \n", + " x[0],y[0] = y[0],x[0]\n", + "\n", + "a = [22.2]\n", + "b = [44.4]\n", + "print \"a = %.2f , b = %.2f \" %(a[0],b[0])\n", + "swap(a,b)\n", + "print \"a = %.2f , b = %.2f \" %(a[0],b[0])\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a = 22.20 , b = 44.40 \n", + "a = 44.40 , b = 22.20 \n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.14 Page 56" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def f(x,y):\n", + " x[0]= 88\n", + " y[0] = 99\n", + "\n", + "a = [22]\n", + "b = [44]\n", + "print \"a = %.2f , b = %.2f \" %(a[0],b[0])\n", + "f(a,b)\n", + "print \"a = %.2f , b = %.2f \" %(a[0],b[0])\n", + "f(2*a,b)\n", + "print \"a = %.2f , b = %.2f \" %(a[0],b[0])\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a = 22.00 , b = 44.00 \n", + "a = 88.00 , b = 99.00 \n", + "a = 88.00 , b = 99.00 \n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.15 Page 57" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def computeCircle(r):\n", + " \n", + " PI = 3.141592653589793\n", + " area = PI*r*r\n", + " circumference = 2*PI*r\n", + " return area,circumference\n", + "\n", + "# tests the computeCircle() function:\n", + "print \"Enter radius: \"\n", + "r = int(raw_input())\n", + "a,c = computeCircle(r)\n", + "print \"area = %.2f , circumference = %.2f\" %(a,c)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter radius: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "area = 78.54 , circumference = 31.42\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.16 Page 57" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def f(x,y,z):\n", + " x[0] += z[0]\n", + " y[0] += z[0]\n", + " print \"x = %d , y = %d , z = %d\" %(x[0],y[0],z[0])\n", + "\n", + "x = [22]\n", + "y = [33]\n", + "z = [44]\n", + "\n", + "print \"x = %d , y = %d , z = %d\" %(x[0],y[0],z[0])\n", + "f(x,y,z)\n", + "print \"x = %d , y = %d , z = %d\" %(x[0],y[0],z[0])\n", + "x[0] = 2*x[0] - 3\n", + "f(x,y,z)\n", + "print \"x = %d , y = %d , z = %d\" %(x[0],y[0],z[0])\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = 22 , y = 33 , z = 44\n", + "x = 66 , y = 77 , z = 44\n", + "x = 66 , y = 77 , z = 44\n", + "x = 173 , y = 121 , z = 44\n", + "x = 173 , y = 121 , z = 44\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.17 Page 58" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def cube(x):\n", + " \n", + " return x*x*x\n", + "\n", + ":\n", + "print cube(4)\n", + "x = int(raw_input())\n", + "y = cube(2*x-3)\n", + "print y\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "64\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "343\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.18 Page 59" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "x = 11\n", + "\n", + "def f():\n", + " x = 44\n", + " print \"In f(): x = %d\" % x \n", + "\n", + "def g():\n", + " print \"In g(): x = %d\" % x \n", + "\n", + "x = 22\n", + "x = 33\n", + "print \"In block inside main(): x = %d\" % x\n", + "\n", + "\n", + "print \"In main(): x = %d\" % x \n", + "print \"In main(): ::x = %d\" % x \n", + "f()\n", + "g()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "In block inside main(): x = 33\n", + "In main(): x = 33\n", + "In main(): ::x = 33\n", + "In f(): x = 44\n", + "In g(): x = 33\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 4, + "metadata": {}, + "source": [ + "Example 5.19 Page 60" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def max_(x, y,z=0):\n", + " if x > y and x > y:\n", + " return x\n", + " elif y > x and y > z:\n", + " return y\n", + " else:\n", + " return z\n", + " \n", + " \n", + "print max(99,77), \" \" , max(55,66,33)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "99 66\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.20 Page 61" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "print \"Enter two integers: \"\n", + "n = int(raw_input())\n", + "d = int(raw_input())\n", + "if (d == 0):\n", + " import sys\n", + " sys.exit(0)\n", + "print n , \"/\" , d , \" = \" , n/d \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter two integers: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "8 / 2 = 4\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.21 Page 62" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def reciprocal(x):\n", + " \n", + " if (x == 0):\n", + " import sys\n", + " sys.exit(1); # terminate the program\n", + " return 1.0/x\n", + "\n", + "x = float(raw_input())\n", + "print reciprocal(x)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "25\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0.04\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.22 Page 63" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def p(x,a0,a1=0,a2=0,a3=0):\n", + "\n", + " return (a0 + (a1 + (a2 + a3*x)*x)*x)\n", + "\n", + "\n", + "\n", + "x = 2.0003\n", + "print \"p(x,7) = %f\" % p(x,7)\n", + "print \"p(x,7,6) = %f\" % p(x,7,6)\n", + "print \"p(x,7,6,5) = %f\" % p(x,7,6,5)\n", + "print \"p(x,7,6,5,4) = %f\" % p(x,7,6,5,4)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "p(x,7) = 7.000000\n", + "p(x,7,6) = 19.001800\n", + "p(x,7,6,5) = 39.007800\n", + "p(x,7,6,5,4) = 71.022203\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch6-checkpoint.ipynb b/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch6-checkpoint.ipynb new file mode 100644 index 00000000..af258b79 --- /dev/null +++ b/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch6-checkpoint.ipynb @@ -0,0 +1,1315 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:a8857c83acde4298195ee44fc68de4f10d51e8743270e5ece79f31e3e37359f9" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 6" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.1 Page 64" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "a = [0, 0, 0]\n", + "a[2] = 55.55\n", + "a[0] = 11.11\n", + "a[1] = 33.33\n", + "print \"a[0] = \" , a[0] \n", + "print \"a[1] = \" , a[1] \n", + "print \"a[2] = \" , a[2] \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a[0] = 11.11\n", + "a[1] = 33.33\n", + "a[2] = 55.55\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.2 Page 64" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "SIZE=5 # defines the size N for 5 elements\n", + "a = []\n", + "\n", + "print \"Enter \" , SIZE , \" numbers:\\t\"\n", + "for i in range(SIZE):\n", + " a.append(float(raw_input()))\n", + " \n", + "print \"In reverse order: \"\n", + "for i in range(SIZE-1,-1,-1):\n", + " print \"\\t\" , a[i]\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter 5 numbers:\t\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3.3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4.4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "In reverse order: \n", + "\t5.5\n", + "\t4.4\n", + "\t3.3\n", + "\t2.0\n", + "\t1.0\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.3 Page 65" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "a = [ 22.2, 44.4, 66.6 ]\n", + "\n", + "size = len(a)\n", + "for i in range(size):\n", + " print \"\\ta[\" , i , \"] = \" , a[i]\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\ta[ 0 ] = 22.2\n", + "\ta[ 1 ] = 44.4\n", + "\ta[ 2 ] = 66.6\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.4 Page 66" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "a = [ 22.2, 44.4, 66.6 , 0 ,0,0,0]\n", + "size = len(a)\n", + "for i in range(size):\n", + " print \"\\ta[\" , i , \"] = \" , a[i] \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\ta[ 0 ] = 22.2\n", + "\ta[ 1 ] = 44.4\n", + "\ta[ 2 ] = 66.6\n", + "\ta[ 3 ] = 0\n", + "\ta[ 4 ] = 0\n", + "\ta[ 5 ] = 0\n", + "\ta[ 6 ] = 0\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.5 Page 66" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import numpy\n", + "SIZE = 4\n", + "a = numpy.zeros(4)\n", + "\n", + "for i in range(SIZE):\n", + " print \"\\ta[\" , i , \"] = \" , a[i]\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\ta[ 0 ] = 0.0\n", + "\ta[ 1 ] = 0.0\n", + "\ta[ 2 ] = 0.0\n", + "\ta[ 3 ] = 0.0\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.6 Page 66" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "SIZE=4\n", + "a = [ 33.3, 44.4, 55.5, 66.6 ]\n", + "for i in range(7): # ERROR: index is out of bounds!\n", + " print \"\\ta[\" , i , \"] = \" , a[i] \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "IndexError", + "evalue": "list index out of range", + "output_type": "pyerr", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mIndexError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 6\u001b[0m \u001b[0ma\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m[\u001b[0m \u001b[1;36m33.3\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m44.4\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m55.5\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m66.6\u001b[0m \u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 7\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mi\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m7\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m \u001b[1;31m# ERROR: index is out of bounds!\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 8\u001b[1;33m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"\\ta[\"\u001b[0m \u001b[1;33m,\u001b[0m \u001b[0mi\u001b[0m \u001b[1;33m,\u001b[0m \u001b[1;34m\"] = \"\u001b[0m \u001b[1;33m,\u001b[0m \u001b[0ma\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mi\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 9\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mIndexError\u001b[0m: list index out of range" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\ta[ 0 ] = 33.3\n", + "\ta[ 1 ] = 44.4\n", + "\ta[ 2 ] = 55.5\n", + "\ta[ 3 ] = 66.6\n", + "\ta[ 4 ] = " + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.7 Page 67" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "a = [ 22.2, 44.4, 66.6 ]\n", + "x=11.1\n", + "print \"x = \" , x \n", + "a.append(88.8) # ERROR: index is out of bounds!\n", + "print \"x = \" , x \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " x = 11.1\n", + "x = 11.1\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.7 Page 67" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "a = [ 22.2, 44.4, 66.6 ]\n", + "x=11.1\n", + "print \"x = \" , x \n", + "a[3333] = 88.8 # ERROR: index is out of bounds!\n", + "print \"x = \" , x \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "IndexError", + "evalue": "list assignment index out of range", + "output_type": "pyerr", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mIndexError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 6\u001b[0m \u001b[0mx\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m11.1\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 7\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"x = \"\u001b[0m \u001b[1;33m,\u001b[0m \u001b[0mx\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 8\u001b[1;33m \u001b[0ma\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m3333\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;36m88.8\u001b[0m \u001b[1;31m# ERROR: index is out of bounds!\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 9\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"x = \"\u001b[0m \u001b[1;33m,\u001b[0m \u001b[0mx\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mIndexError\u001b[0m: list assignment index out of range" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = 11.1\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.8 Page 68" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def sum_(a):\n", + " s = 0\n", + " for i in a:\n", + " s += i\n", + " return s\n", + " \n", + "a = [ 11, 33, 55, 77 ]\n", + "print \"sum(a) = \" , sum_(a) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "sum(a) = 176\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.9 Page 68" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def read(a):\n", + " print \"Enter integers. Terminate with 0:\\n\"\n", + " n = 1\n", + " while True:\n", + " n = int(raw_input(\"a[\" + str(len(a)) + \"]: \"))\n", + " if n == 0:\n", + " break\n", + " a.append(n)\n", + " \n", + "\n", + "def print_(a):\n", + " for i in a:\n", + " print i ,\n", + "\n", + "\n", + "a = []\n", + "read(a)\n", + "print \"The array has \" , len(a) , \" elements: \"\n", + "print_(a)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter integers. Terminate with 0:\n", + "\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "a[0]: 11\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "a[1]: 22\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "a[2]: 33\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "a[3]: 44\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "a[4]: 0\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The array has 4 elements: \n", + "11 22 33 44\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.10 Page 69" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import sys\n", + "a = [ 22, 44, 66, 88 ]\n", + "print \"a = \" , id(a) # the address of a[0]\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a = 169156908\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.11 Page 70" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def index(x,a,n):\n", + " for i in range(len(a)):\n", + " if (a[i] == x):\n", + " return i\n", + " return n # x not found\n", + "\n", + "a = [ 22, 44, 66, 88, 44, 66, 55 ]\n", + "print \"index(44,a,7) = \" , index(44,a,7)\n", + "print \"index(50,a,7) = \" , index(50,a,7) \n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "index(44,a,7) = 1\n", + "index(50,a,7) = 7\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.12 Page 71" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def sort(a,n):\n", + " \n", + " n = len(a)\n", + " for i in range(n):\n", + " # bubble up max{a[0..n-i]}:\n", + " for j in range(n-i-1):\n", + " if (a[j] > a[j+1]):\n", + " a[j],a[j+1] = a[j+1],a[j]\n", + "\n", + "def print_(a):\n", + " for i in range(len(a)):\n", + " print a[i],\n", + " print ''\n", + " \n", + "a = [55.5, 22.5, 99.9, 66.6, 44.4, 88.8, 33.3, 77.7]\n", + "\n", + "print_(a)\n", + "sort(a,8)\n", + "print_(a)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "55.5 22.5 99.9 66.6 44.4 88.8 33.3 77.7 \n", + "22.5 33.3 44.4 55.5 66.6 77.7 88.8 99.9 \n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.13 Page 72" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def index(x,a,n):\n", + " \n", + " lo=0\n", + " hi=n-1\n", + " while (lo <= hi):\n", + " i = (lo + hi)/2 # the average of lo and hi\n", + " if (a[i] == x):\n", + " return i\n", + " if (a[i] < x):\n", + " lo = i+1 # continue search in a[i+1..hi]\n", + " else:\n", + " hi = i-1 # continue search in a[lo..i-1]\n", + " return n # x was not found in a[0..n-1]\n", + "\n", + "a = [ 22, 33, 44, 55, 66, 77, 88 ]\n", + "print \"index(44,a,7) = \" , index(44,a,7)\n", + "print \"index(60,a,7) = \" , index(60,a,7) \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "index(44,a,7) = 2\n", + "index(60,a,7) = 7\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.14 Page 73" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def isNondecreasing(a,n):\n", + " \n", + " for i in range(1,n):\n", + " if (a[i]\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 34\u001b[0m \u001b[0ma\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m[\u001b[0m \u001b[1;36m22\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m33\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m44\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m55\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m66\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m77\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m88\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m60\u001b[0m \u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 35\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"index(44,a,7) = \"\u001b[0m \u001b[1;33m,\u001b[0m \u001b[0mindex\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m44\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0ma\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m7\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 36\u001b[1;33m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"index(44,a,7) = \"\u001b[0m \u001b[1;33m,\u001b[0m \u001b[0mindex\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m44\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0ma\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m8\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 37\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"index(60,a,7) = \"\u001b[0m \u001b[1;33m,\u001b[0m \u001b[0mindex\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m60\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0ma\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m8\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;32m\u001b[0m in \u001b[0;36mindex\u001b[1;34m(x, a, n)\u001b[0m\n\u001b[0;32m 18\u001b[0m \u001b[1;31m# PRECONDITION: a[0] <= a[1] <= ... <= a[n-1];\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 19\u001b[0m \u001b[1;31m# binary search:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 20\u001b[1;33m \u001b[1;32massert\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0misNondecreasing\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0ma\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mn\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 21\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 22\u001b[0m \u001b[0mlo\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mAssertionError\u001b[0m: " + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "index(44,a,7) = 2\n", + "index(44,a,7) = " + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.16 Page 73" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "Day = [ 0, 1, 2, 3, 4, 5, 6 ]\n", + "high = [ 88.3, 95.0, 91.2, 89.9, 91.4, 92.5, 86.7]\n", + "\n", + "for i in Day:\n", + " print \"The high temperature for day \" , i , \" was \" , high[i] \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The high temperature for day 0 was 88.3\n", + "The high temperature for day 1 was 95.0\n", + "The high temperature for day 2 was 91.2\n", + "The high temperature for day 3 was 89.9\n", + "The high temperature for day 4 was 91.4\n", + "The high temperature for day 5 was 92.5\n", + "The high temperature for day 6 was 86.7\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.17 Page 74" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def sort(a,n):\n", + " a.sort()\n", + "\n", + "def print_(a,n):\n", + " for i in a:\n", + " print i,\n", + " print ''\n", + "a = [55.5, 22.5, 99.9, 66.6, 44.4, 88.8, 33.3, 77.7]\n", + "print_(a,8);\n", + "sort(a,8)\n", + "print_(a,8)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "55.5 22.5 99.9 66.6 44.4 88.8 33.3 77.7 \n", + "22.5 33.3 44.4 55.5 66.6 77.7 88.8 99.9 \n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.18 Page 75" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def read(a):\n", + " print \"Enter 15 integers, 5 per row:\\n\"\n", + " for i in range(3):\n", + " ar = []\n", + " print \"Row \" , i , \": \",\n", + " for j in range(5):\n", + " ar.append(int(raw_input()))\n", + " a.append(ar)\n", + "\n", + "def print_(a):\n", + " for i in range(3):\n", + " for j in range(5):\n", + " print a[i][j],\n", + " print ''\n", + "a = []\n", + "read(a)\n", + "print_(a)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter 15 integers, 5 per row:\n", + "\n", + "Row 0 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "44\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "77\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "33\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "11\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "44\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Row 1 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "60\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "50\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "30\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "90\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "70\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Row 2 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "85\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "25\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "45\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "45\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "55\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 44 77 33 11 44 \n", + "60 50 30 90 70 \n", + "85 25 45 45 55 \n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.19 Page 76" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def read(score):\n", + " for s in range(3):\n", + " print \"Student \" , s , \": \",\n", + " st = []\n", + " for q in range(5):\n", + " st.append(int(raw_input()))\n", + " score.append(st)\n", + "\n", + "def printQuizAverages(score):\n", + " for s in range(3):\n", + " sm = 0\n", + " for q in range(5):\n", + " sm += score[s][q]\n", + " print \"\\tStudent \" , s , \": \" , sm/5.0\n", + "\n", + "def printClassAverages(score):\n", + " for q in range(5):\n", + " sm = 0\n", + " for s in range(3):\n", + " sm += score[s][q]\n", + " print \"\\tQuiz \" , q , \": \" , sm/3.0\n", + "\n", + "\n", + "\n", + "NUM_STUDENTS = 3\n", + "NUM_QUIZZES = 5\n", + "\n", + "\n", + "score = []\n", + "print \"Enter \" , NUM_QUIZZES , \" scores for each student: \"\n", + "read(score)\n", + "print \"The quiz averages are:\"\n", + "printQuizAverages(score)\n", + "print \"The class averages are: \"\n", + "printClassAverages(score)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter 5 scores for each student: \n", + "Student 0 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Student 1 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Student 2 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The quiz averages are:\n", + "\tStudent 0 : 8.2\n", + "\tStudent 1 : 8.8\n", + "\tStudent 2 : 7.0\n", + "The class averages are: \n", + "\tQuiz 0 : 7.33333333333\n", + "\tQuiz 1 : 7.33333333333\n", + "\tQuiz 2 : 8.33333333333\n", + "\tQuiz 3 : 8.33333333333\n", + "\tQuiz 4 : 8.66666666667\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.20 Page 76" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def numZeros(a,n1,n2,n3):\n", + " count = 0\n", + " for i in range(n1):\n", + " for j in range(n2):\n", + " for k in range(n3):\n", + " if (a[i][j][k] == 0):\n", + " count += 1\n", + " return count\n", + "\n", + "\n", + "a = [ [ [5,0,2], [0,0,9], [4,1,0], [7,7,7] ],[ [3,0,0], [8,5,0], [0,0,0], [2,0,9] ]]\n", + "print \"This array has \" , numZeros(a,2,4,3) , \" zeros\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "This array has 11 zeros\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch7-checkpoint.ipynb b/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch7-checkpoint.ipynb new file mode 100644 index 00000000..60381709 --- /dev/null +++ b/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch7-checkpoint.ipynb @@ -0,0 +1,755 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:408b7b29bc9fb4139b74d65d047f40b07984dc2dc4fd617cc2c35b810cbf005e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 7" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.1 Page 78" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "n=44\n", + "print \"n = \" , n \n", + "# prints the value of n\n", + "print \"&n = \" , hex(id(n)) # prints the address of n\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = 44\n", + "&n = 0x8fc0eec\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.2 Page 78" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "n = [44]\n", + "rn=n # r is a synonym for n\n", + "print \"n = \" , n , \", rn = \" , rn \n", + "n[0] -= 1\n", + "print \"n = \" , n , \", rn = \" , rn \n", + "rn[0] *= 2\n", + "print \"n = \" , n , \", rn = \" , rn \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = [44] , rn = [44]\n", + "n = [43] , rn = [43]\n", + "n = [86] , rn = [86]\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.3 Page 78" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "n = [44]\n", + "rn=n # r is a synonym for n\n", + "print \"&n = \" , hex(id(n)) , \", rn = \" , hex(id(rn ))\n", + "rn2 = n\n", + "rn3 = rn\n", + "print \"&rn2 = \" , hex(id(rn2)) , \", rn = \" , hex(id(rn ))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "&n = 0x9c6228c , rn = 0x9c6228c\n", + "&rn2 = 0x9c6228c , rn = 0x9c6228c\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.4 Page 79" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "n = [44]\n", + "print \"n = \" , n , \", &n = \" , hex(id(n))\n", + "pn = n\n", + "print \"pn = \" , hex(id(pn)) , \", &pn = \" , hex(id(hex(id(pn))))\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = [44] , &n = 0x9c624ec\n", + "pn = 0x9c624ec , &pn = 0x9c6aa60\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.5 Page 80" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "n = [44]\n", + "print \"n = \" , n , \", &n = \" , hex(id(n))\n", + "pn = n\n", + "print \"\\tpn = \" , hex(id(pn)) , \",\\n &pn = \" , hex(id(hex(id(pn))))\n", + "print \"*pn = \" , pn\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = [44] , &n = 0x9c58d6c\n", + "\tpn = 0x9c58d6c ,\n", + " &pn = 0x9c6ab20\n", + "*pn = [44]\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.6 Page 80" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "n = [44]\n", + "print \"n = \" , n , \", &n = \" , hex(id(n))\n", + "pn = n\n", + "print \"\\tpn = \" , hex(id(pn)) , \",\\n &pn = \" , hex(id(hex(id(pn))))\n", + "print \"*pn = \" , pn\n", + "ppn = pn\n", + "\n", + "print \" ppn = \" , hex(id(hex(id(ppn)))) \n", + "print \" &ppn = \" , hex(id(hex(id(hex(id(ppn))))))\n", + "print \" *ppn = \" , hex(id(ppn)) \n", + "print \"**ppn = \" , ppn \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = [44] , &n = 0x9bf05ac\n", + "\tpn = 0x9bf05ac ,\n", + " &pn = 0x9c58160\n", + "*pn = [44]\n", + " ppn = 0x9c58680\n", + " &ppn = 0x9c58160\n", + " *ppn = 0x9bf05ac\n", + "**ppn = [44]\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.7 Page 81" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "n = [44]\n", + "print \"n = \" , n , \"\\n &n = \" , hex(id(n))\n", + "pn = n\n", + "print \"\\tpn = \" , hex(id(pn)) , \",\\n &pn = \" , hex(id(hex(id(pn))))\n", + "print \"*pn = \" , pn\n", + "nn = pn\n", + "print \" ppn = \" , hex(id(nn))\n", + "print \" &ppn = \" , hex(id(hex(id(nn))))\n", + "rpn = pn\n", + "print \" ppn = \" , hex(id(rpn))\n", + "print \" &ppn = \" , hex(id(hex(id(rpn))))\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = [44] \n", + " &n = 0x9bf60ec\n", + "\tpn = 0x9bf60ec ,\n", + " &pn = 0x9bf0e40\n", + "*pn = [44]\n", + " ppn = 0x9bf60ec\n", + " &ppn = 0x9bf0e40\n", + " ppn = 0x9bf60ec\n", + " &ppn = 0x9bf0f20\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.8 Page 81" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def max_(m,n):\n", + " if m>n:\n", + " return m\n", + " else:\n", + " return n\n", + "\n", + "m = 44\n", + "n = 22\n", + "print m , \", \" , n , \", \" , max_(m,n)\n", + "m = max_(m,n) \n", + "m = 55\n", + "# changes the value of m from 44 to 55\n", + "print m , \", \" , n , \", \" , max_(m,n) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "44 , 22 , 44\n", + "55 , 22 , 55\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.9 Page 81" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "v = []\n", + "for k in range(1,5):\n", + " v.append(1.0/k)\n", + "\n", + "for i in range(4):\n", + " print \"v[\" , i , \"] = \" , v[i]\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "v[ 0 ] = 1.0\n", + "v[ 1 ] = 0.5\n", + "v[ 2 ] = 0.333333333333\n", + "v[ 3 ] = 0.25\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.10 Page 82" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import sys\n", + "a = [22, 33, 44]\n", + "\n", + "print \"a = \" , hex(id(a))\n", + "print \"sizeof(int) = \" , sys.getsizeof(1) \n", + "s = 0\n", + "for i in a:\n", + " s += i\n", + " print \"\\t i = \" , hex(id(i)),\n", + " print \"\\t *i = \" , i,\n", + " print \"\\t sum = \" , s\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a = 0x9bf688c\n", + "sizeof(int) = 12\n", + "\t i = 0x8fc0ff4 \t *i = 22 \t sum = 22\n", + "\t i = 0x8fc0f70 \t *i = 33 \t sum = 55\n", + "\t i = 0x8fc0eec \t *i = 44 \t sum = 99\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.10 Page 82" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "a = [22, 33, 44, 55, 66]\n", + "print \"a = \" , hex(id(a)) , \", *a = \" , a[0] \n", + "for p in a:\n", + " print \"p = \" , hex(id(p)) , \", *p = \" , p \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a = 0x9c6526c , *a = 22\n", + "p = 0x8fc0ff4 , *p = 22\n", + "p = 0x8fc0f70 , *p = 33\n", + "p = 0x8fc0eec , *p = 44\n", + "p = 0x8fc0e68 , *p = 55\n", + "p = 0x8fc0de4 , *p = 66\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.11 Page 83" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def loc(a1,a2,n1,n2):\n", + " p = []\n", + " for element in a2:\n", + " if element in a1:\n", + " p.append(element)\n", + " return p\n", + "\n", + "a1 = [11, 11, 11, 11, 11, 22, 33, 44, 55]\n", + "a2 = [11, 11, 11, 22, 33]\n", + "print \"Array a1 begins at location\\t\" , hex(id(a1 ))\n", + "print \"Array a2 begins at location\\t\" , hex(id(a2)) \n", + "p = loc(a1, a2, 9, 5)\n", + "if (p):\n", + " print \"Array a2 found at location\\t\" , hex(id(p))\n", + " for i in range(len(p)):\n", + " print \"\\t\" , hex(id(p[i])) , \": \" , p[i], \"\\t\" , hex(id(a2[i])) , \": \" , a2[i] \n", + "else:\n", + " print \"Not found.\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Array a1 begins at location\t0x9bea56c\n", + "Array a2 begins at location\t0x9bea62c\n", + "Array a2 found at location\t0x9bea6cc\n", + "\t0x8fc1078 : 11 \t0x8fc1078 : 11\n", + "\t0x8fc1078 : 11 \t0x8fc1078 : 11\n", + "\t0x8fc1078 : 11 \t0x8fc1078 : 11\n", + "\t0x8fc0ff4 : 22 \t0x8fc0ff4 : 22\n", + "\t0x8fc0f70 : 33 \t0x8fc0f70 : 33\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.12 Page 84" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def get(a):\n", + " print \"Enter number of items: \"\n", + " n = int(raw_input())\n", + " print \"Enter \" , n , \" items, one per line:\"\n", + " for i in range(n):\n", + " print \"\\t\" , i+1 , \": \",\n", + " a.append(float(raw_input()))\n", + "\n", + "def print_(a):\n", + " for i in range(len(a)):\n", + " print a[i] ,\n", + " print ''\n", + "\n", + "a = []\n", + "get(a)\n", + "print_(a)\n", + "a = []\n", + "get(a)\n", + "print_(a)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter number of items: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter 4 items, one per line:\n", + "\t1 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "44.4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \t2 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "77.7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \t3 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "22.2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \t4 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "88.8\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 44.4 77.7 22.2 88.8 \n", + "Enter number of items: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter 2 items, one per line:\n", + "\t1 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3.33\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \t2 : " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "9.99\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 3.33 9.99 \n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.13 Page 84" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def sort(p, n):\n", + " for i in range(1,n):\n", + " for j in range(n-i):\n", + " if (p[j] > p[j+1]):\n", + " p[j],p[j+1] = p[j+1],p[j]\n" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.14 Page 84" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def sum_(k,n):\n", + " # returns the sum f(0) + f(1) + f(2) + . . . + f(n-1):\n", + " s = 0\n", + " for i in range(1,n+1):\n", + " s += k(i)\n", + " return s\n", + "\n", + "def square(k):\n", + " return k*k\n", + "\n", + "def cube(k):\n", + " return k*k*k\n", + "\n", + "\n", + "print sum_(square,4) # 1 + 4 + 9 + 16\n", + "print sum_(cube,4) # 1 + 8 + 27 + 64\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "30\n", + "100\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch8-checkpoint.ipynb b/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch8-checkpoint.ipynb new file mode 100644 index 00000000..ea425974 --- /dev/null +++ b/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch8-checkpoint.ipynb @@ -0,0 +1,1088 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:dcdea056ba1ad05b18548a929edcfe059a3be4963e9ccbc6c674fa82a22ef3f6" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 8" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.1 Page 85" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "n= [44] # n holds the int 44\n", + "print \"int n=44; // n holds the int 44:\\n\";\n", + "print \"\\t\\t n = \" , n \n", + "print \"\\t\\t &n = \" , hex(id(n))\n", + "pn = n \n", + "print \"int* pn=&n; // pn holds the address of n:\\n\";\n", + "print \"\\t\\t n = \" , n \n", + "print \"\\t\\t &n = \" , hex(id(n))\n", + "print \"\\t\\t pn = \" , hex(id(pn)) \n", + "print \"\\t\\t &pn = \" , hex(id(hex(id(pn))))\n", + "print \"\\t\\t *pn = \" , pn\n", + "\n", + "pn[0] = 77 # changes the value of n to 77\n", + "print \"*pn = 77; // changes the value of n to 77:\\n\";\n", + "print \"\\t\\t n = \" , n \n", + "print \"\\t\\t &n = \" , hex(id(n))\n", + "print \"\\t\\t pn = \" , hex(id(pn)) \n", + "print \"\\t\\t &pn = \" , hex(id(hex(id(pn))))\n", + "print \"\\t\\t *pn = \" , pn\n", + "\n", + "q = n \n", + "print \"int* q=&n; // q also holds the address of n:\\n\";\n", + "print \"\\t\\t n = \" , n \n", + "print \"\\t\\t &n = \" , hex(id(n))\n", + "print \"\\t\\t pn = \" , hex(id(pn)) \n", + "print \"\\t\\t &pn = \" , hex(id(hex(id(pn))))\n", + "print \"\\t\\t *pn = \" , pn\n", + "print \"\\t\\t q = \" , hex(id(q))\n", + "print \"\\t\\t &q = \" , hex(id(hex(id(hex(id(pn))))))\n", + "print \"\\t\\t *q = \" , q \n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "int n=44; // n holds the int 44:\n", + "\n", + "\t\t n = [44]\n", + "\t\t &n = 0x9bfb92c\n", + "int* pn=&n; // pn holds the address of n:\n", + "\n", + "\t\t n = [44]\n", + "\t\t &n = 0x9bfb92c\n", + "\t\t pn = 0x9bfb92c\n", + "\t\t &pn = 0x9bf5aa0\n", + "\t\t *pn = [44]\n", + "*pn = 77; // changes the value of n to 77:\n", + "\n", + "\t\t n = [77]\n", + "\t\t &n = 0x9bfb92c\n", + "\t\t pn = 0x9bfb92c\n", + "\t\t &pn = 0x9c6a760\n", + "\t\t *pn = [77]\n", + "int* q=&n; // q also holds the address of n:\n", + "\n", + "\t\t n = [77]\n", + "\t\t &n = 0x9bfb92c\n", + "\t\t pn = 0x9bfb92c\n", + "\t\t &pn = 0x9bf5c80\n", + "\t\t *pn = [77]\n", + "\t\t q = 0x9bfb92c\n", + "\t\t &q = 0x9c6a760\n", + "\t\t *q = [77]\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.2 Page 86" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "s = \"ABCD\"\n", + "for i in range(4):\n", + " print \"s[\" , i , \"] = '\" , s[i] , \"'\\n\";\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "s[ 0 ] = ' A '\n", + "\n", + "s[ 1 ] = ' B '\n", + "\n", + "s[ 2 ] = ' C '\n", + "\n", + "s[ 3 ] = ' D '\n", + "\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.3 Page 87" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "while True:\n", + " word = raw_input()\n", + " if len(word) < 2:\n", + " break\n", + " l = word.split(' ')\n", + " for i in l:\n", + " print '\\t\"' , i , '\"'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Today's date is March 12, 2000.\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\t\" Today's \"\n", + "\t\" date \"\n", + "\t\" is \"\n", + "\t\" March \"\n", + "\t\" 12, \"\n", + "\t\" 2000. \"\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Tomorrow is Monday.\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\t\" Tomorrow \"\n", + "\t\" is \"\n", + "\t\" Monday. \"\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.4 Page 87" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "while True:\n", + " line = raw_input()\n", + " if len(line) < 2:\n", + " break\n", + " print \"\\t[\" , line , \"]\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Once upon a midnight dreary, while I pondered, weak and weary,\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\t[ Once upon a midnight dreary, while I pondered, weak and weary, ]\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Over a many quaint and curious volume of forgotten lore,\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\t[ Over a many quaint and curious volume of forgotten lore, ]\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.5 Page 88" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "while True:\n", + " word = raw_input()\n", + " if len(word) < 2:\n", + " break\n", + " l = word.split(',')\n", + " for i in range(len(l)-1):\n", + " print '\\t[' , l[i] , ']'\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Once upon a midnight dreary, while I pondered, weak and weary,\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\t[ Once upon a midnight dreary ]\n", + "\t[ while I pondered ]\n", + "\t[ weak and weary ]\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Over a many quaint and curious volume of forgotten lore,\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\t[ Over a many quaint and curious volume of forgotten lore ]\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.6 Page 89" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "count = 0\n", + "while True:\n", + " a = raw_input()\n", + " if len(a) < 1:\n", + " break\n", + " for ch in a:\n", + " if (ch == 'e'): count+=1\n", + " \n", + "print count , \" e's were counted.\\n\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Once upon a midnight dreary, while I pondered, weak and weary,\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Over many a quaint and curious volume of forgotten lore,\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "11 e's were counted.\n", + "\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.7 Page 89" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "while True:\n", + " a = raw_input()\n", + " if len(a) < 1:\n", + " break\n", + " print a.title()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Fourscore and seven years ago our fathers\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Fourscore And Seven Years Ago Our Fathers\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "brought forth upon this continent a new nation,\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Brought Forth Upon This Continent A New Nation,\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.8 Page 89" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "a = raw_input()\n", + "l = a.split(' ')\n", + "nos = []\n", + "for i in l:\n", + " try:\n", + " i = int(i)\n", + " nos.append(i)\n", + " except:\n", + " continue\n", + "m = nos[0]\n", + "n = nos[1] \n", + "print m , \" + \" , n , \" = \" , m+n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "what is 305 plus 9416 ?\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "305 + 9416 = 9721\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.9 Page 90" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "name = []\n", + "count=0\n", + "\n", + "print \"Enter at most 4 names with at most 19 characters:\\n\";\n", + "while (True):\n", + " n = raw_input()\n", + " if len(n) < 1:\n", + " break\n", + " name.append(n)\n", + " count += 1\n", + " \n", + "print \"The names are:\\n\"\n", + "for i in range(count):\n", + " print \"\\t\" , i , \". [\" , name[i] , \"]\" \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter at most 4 names with at most 19 characters:\n", + "\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "George Washington\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "John Adams\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thomas Jefferson\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The names are:\n", + "\n", + "\t0 . [ George Washington ]\n", + "\t1 . [ John Adams ]\n", + "\t2 . [ Thomas Jefferson ]\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.10 Page 90" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "name = []\n", + "count=0\n", + "\n", + "print \"Enter at most 4 names with at most 19 characters:\\n\";\n", + "while (True):\n", + " n = raw_input()\n", + " if len(n) < 1:\n", + " break\n", + " name.append(n)\n", + " count += 1\n", + " \n", + "print \"The names are:\\n\"\n", + "for i in range(count):\n", + " print \"\\t\" , i , \". [\" , name[i] , \"]\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter at most 4 names with at most 19 characters:\n", + "\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "George Washington\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "John Adams\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thomas Jefferson\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The names are:\n", + "\n", + "\t0 . [ George Washington ]\n", + "\t1 . [ John Adams ]\n", + "\t2 . [ Thomas Jefferson ]\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.11 Page 91" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "name = [ \"George Washington\", \"John Adams\", \"Thomas Jefferson\"]\n", + "print \"The names are:\\n\"\n", + "for i in range(3):\n", + " print \"\\t\" , i , \". [\" , name[i] , \"]\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The names are:\n", + "\n", + "\t0 . [ George Washington ]\n", + "\t1 . [ John Adams ]\n", + "\t2 . [ Thomas Jefferson ]\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.12 Page 91" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "s = \"ABCDEFG\"\n", + "print \"len(\" , s , \") = \" , len(s) \n", + "print \"len(\\\"\\\") = \" , len(\"\")\n", + "print \"Enter string: \"\n", + "b = raw_input()\n", + "print \"len(\" , b , \") = \" , len(b)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "len( ABCDEFG ) = 7\n", + "len(\"\") = 0\n", + "Enter string: \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "hello how are you !!!\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "len( hello how are you !!! ) = 21\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.13 Page 91" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "s = \"The Mississippi is a long river.\"\n", + "print 's = \"' , s , '\"'\n", + "p = s.find(' ')\n", + "print \"find(s, ' ') points to s[\" , p , \"].\"\n", + "p = s.find('s')\n", + "print \"find(s, 's') points to s[\" , p , \"].\"\n", + "p = s.rfind('s')\n", + "print \"reverse find(s, 's') points to s[\" , p , \"].\"\n", + "p = s.find(\"is\")\n", + "print \"strstr(s, \\\"is\\\") points to s[\" , p , \"].\"\n", + "p = s.find(\"isi\")\n", + "if p== -1:\n", + " print 's.find(\"isi\") returns NULL'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.14 Page 92" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "s1 = \"ABCDEFG\"\n", + "s2 = \"XYZ\" \n", + "print \"Before strcpy(s1,s2):\\n\" \n", + "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n", + "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \n", + "s1 = s2\n", + "print \"After strcpy(s1,s2):\\n\" \n", + "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n", + "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Before strcpy(s1,s2):\n", + "\n", + "\ts1 = [ ABCDEFG ], length = 7\n", + "\ts2 = [ XYZ ], length = 3\n", + "After strcpy(s1,s2):\n", + "\n", + "\ts1 = [ XYZ ], length = 3\n", + "\ts2 = [ XYZ ], length = 3\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.15 Page 93" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "s1 = \"ABCDEFG\"\n", + "s2 = \"XYZ\" \n", + "print \"Before strcpy(s1,s2,2):\\n\" \n", + "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n", + "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \n", + "s1 = s2[:2] + s1[2:]\n", + "print \"After strcpy(s1,s2,2):\\n\" \n", + "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n", + "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Before strcpy(s1,s2,2):\n", + "\n", + "\ts1 = [ ABCDEFG ], length = 7\n", + "\ts2 = [ XYZ ], length = 3\n", + "After strcpy(s1,s2,2):\n", + "\n", + "\ts1 = [ XYCDEFG ], length = 7\n", + "\ts2 = [ XYZ ], length = 3\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.16 Page 93" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "s1 = \"ABCDEFG\"\n", + "s2 = \"XYZ\" \n", + "print \"Before string concatination :\\n\" \n", + "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n", + "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \n", + "s1 += s2\n", + "print \"After string concatination :\" \n", + "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n", + "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Before string concatination :\n", + "\n", + "\ts1 = [ ABCDEFG ], length = 7\n", + "\ts2 = [ XYZ ], length = 3\n", + "After string concatination :\n", + "\ts1 = [ ABCDEFGXYZ ], length = 10\n", + "\ts2 = [ XYZ ], length = 3\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.17 Page 93" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "s1 = \"ABCDEFG\"\n", + "s2 = \"XYZ\" \n", + "print \"Before string concatination :\\n\" \n", + "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n", + "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) \n", + "s1 += s2[:2]\n", + "print \"After string concatination :\" \n", + "print \"\\ts1 = [\" , s1 , \"], length = \" , len(s1) \n", + "print \"\\ts2 = [\" , s2 , \"], length = \" , len(s2) " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Before string concatination :\n", + "\n", + "\ts1 = [ ABCDEFG ], length = 7\n", + "\ts2 = [ XYZ ], length = 3\n", + "After string concatination :\n", + "\ts1 = [ ABCDEFGXY ], length = 9\n", + "\ts2 = [ XYZ ], length = 3\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.18 Page 94" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "s = \"Today's date is March 12, 2000.\"\n", + "\n", + "print \"The string is: [\" , s , \"] \\nIts tokens are: \"\n", + "p = s.split(\" \")\n", + "\n", + "for i in p:\n", + " print \"\\t[\" , i , \"] \"\n", + "\n", + "print \"Now the string is: [\" , p[0] , \"] \";\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The string is: [ Today's date is March 12, 2000. ] \n", + "Its tokens are: \n", + "\t[ Today's ] \n", + "\t[ date ] \n", + "\t[ is ] \n", + "\t[ March ] \n", + "\t[ 12, ] \n", + "\t[ 2000. ] \n", + "Now the string is: [ Today's ] \n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.19 Page 94" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def strpbrk(s,s1):\n", + " found = []\n", + " for i in range(len(s1)):\n", + " if s1[i] in s:\n", + " index = s.find(s1[i])\n", + " found.append(index)\n", + " if found:\n", + " return min(found)\n", + " return None\n", + " \n", + "\n", + "s = \"The Mississippi is a long river.\"\n", + "print 's = \"' , s , '\"'\n", + "p = strpbrk(s, \"nopqr\")\n", + "print 'strpbrk(s, \"nopqr\") points to s[' , p , \"].\"\n", + "p = strpbrk(s, \"NOPQR\")\n", + "if (p == None):\n", + " print 'strpbrk(s, \"NOPQR\") returns NULL.\\n'" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "s = \" The Mississippi is a long river. \"\n", + "strpbrk(s, \"nopqr\") points to s[ 12 ].\n", + "strpbrk(s, \"NOPQR\") returns NULL.\n", + "\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch9-checkpoint.ipynb b/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch9-checkpoint.ipynb new file mode 100644 index 00000000..42ab07f7 --- /dev/null +++ b/Schaum's_Outlines_-_Programming_with_C++/.ipynb_checkpoints/ch9-checkpoint.ipynb @@ -0,0 +1,438 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:49f88bf7034c8c21838e751c91470b426b9f85e4daef4a9cc1535d018a19e39d" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 9" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.1 Page 96" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "while True:\n", + " try:\n", + " n = int(raw_input())\n", + " print \"n = \" , n \n", + " except:\n", + " break" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "46\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = 46\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "22\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = 22\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "44\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = 44\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "66\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = 66\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "88\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = 88\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "33,\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.2 Page 97" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "king = [] # defines king to be an array \n", + "n=0\n", + "while True:\n", + " name = raw_input()\n", + " if len(name) < 1:\n", + " break\n", + " king.append(name)\n", + " n += 1\n", + "# now n == the number of names read\n", + "for i in range(n):\n", + " print '\\t' , i+1 , \". \" , king[i] " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Kenneth II (971-995)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Constantine III (995-997)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Kenneth III (997-1005)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Malcolm II (1005-1034)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Duncan I (1034-1040)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Macbeth (1040-1057)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Lulach (1057-1058)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Malcolm III (1058-1093)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\t1 . Kenneth II (971-995)\n", + "\t2 . Constantine III (995-997)\n", + "\t3 . Kenneth III (997-1005)\n", + "\t4 . Malcolm II (1005-1034)\n", + "\t5 . Duncan I (1034-1040)\n", + "\t6 . Macbeth (1040-1057)\n", + "\t7 . Lulach (1057-1058)\n", + "\t8 . Malcolm III (1058-1093)\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.3 Page 98" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "infile = open(\"input.txt\",\"r\")\n", + "outfile = open(\"output.txt\",\"w\")\n", + "\n", + "for i in infile:\n", + " s = i.title()\n", + " outfile.write(s)\n", + "\n", + "infile.close()\n", + "outfile.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "IOError", + "evalue": "[Errno 2] No such file or directory: 'input.txt'", + "output_type": "pyerr", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mIOError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 5\u001b[0m '''\n\u001b[0;32m 6\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 7\u001b[1;33m \u001b[0minfile\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mopen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"input.txt\"\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m\"r\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 8\u001b[0m \u001b[0moutfile\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mopen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"output.txt\"\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m\"w\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 9\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mIOError\u001b[0m: [Errno 2] No such file or directory: 'input.txt'" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "fin1 = open(\"north.dat\",\"r\")\n", + "fin2 = open(\"south.dat\",\"r\")\n", + "fout = open(\"combined.dat\",\"w\")\n", + "\n", + "file1 = []\n", + "file2 = []\n", + "for i in fin1:\n", + " try:\n", + " s = i.split(\" \")\n", + " for j in s:\n", + " file1.append(int(j))\n", + " except:\n", + " continue\n", + " \n", + "for i in fin2:\n", + " try:\n", + " s = i.split(\" \")\n", + " for j in s:\n", + " file2.append(int(j))\n", + " except:\n", + " continue\n", + "\n", + "\n", + "for i in sorted(file1 + file2):\n", + " fout.write(str(i) + \" \")\n", + "\n", + "fin1.close()\n", + "fin2.close()\n", + "fout.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "ename": "IOError", + "evalue": "[Errno 2] No such file or directory: 'north.dat'", + "output_type": "pyerr", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mIOError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 3\u001b[0m '''\n\u001b[0;32m 4\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 5\u001b[1;33m \u001b[0mfin1\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mopen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"north.dat\"\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m\"r\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 6\u001b[0m \u001b[0mfin2\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mopen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"south.dat\"\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m\"r\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 7\u001b[0m \u001b[0mfout\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mopen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"combined.dat\"\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m\"w\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mIOError\u001b[0m: [Errno 2] No such file or directory: 'north.dat'" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.4 Page 99" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def print_(oss):\n", + " print 'oss.str() = \"' , str(oss) , '\"'\n", + "\n", + "s=\"ABCDEFG\"\n", + "n=33\n", + "x=2.718\n", + "l = ''\n", + "print_(l)\n", + "l += s\n", + "print_(l)\n", + "l += ( \" \" + str(n) )\n", + "print_(l)\n", + "l += ( \" \" + str(x) )\n", + "print_(l)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "oss.str() = \" \"\n", + "oss.str() = \" ABCDEFG \"\n", + "oss.str() = \" ABCDEFG 33 \"\n", + "oss.str() = \" ABCDEFG 33 2.718 \"\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.5 Page 99" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def print_(iss,s='',n=0,x=0.0):\n", + " print 's = \"' , s , '\", n = ' , n , \", x = \" , x, ', iss.str() = \"' \\\n", + " , iss , '\"' \n", + "\n", + "s=\"\"\n", + "n=0\n", + "x=0.0\n", + "l = ''\n", + "iss = \"ABCDEFG 44 3.14\"\n", + "print_(iss)\n", + "s = \"ABCDEFG\"\n", + "print_(iss,s)\n", + "n = 44\n", + "print_(iss,s,n)\n", + "x = 3.14\n", + "print_(iss,s,n,x)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "s = \" \", n = 0 , x = 0.0 , iss.str() = \" ABCDEFG 44 3.14 \"\n", + "s = \" ABCDEFG \", n = 0 , x = 0.0 , iss.str() = \" ABCDEFG 44 3.14 \"\n", + "s = \" ABCDEFG \", n = 44 , x = 0.0 , iss.str() = \" ABCDEFG 44 3.14 \"\n", + "s = \" ABCDEFG \", n = 44 , x = 3.14 , iss.str() = \" ABCDEFG 44 3.14 \"\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Schaum's_Outlines_-_Programming_with_C++/ch1.ipynb b/Schaum's_Outlines_-_Programming_with_C++/ch1.ipynb index 5ac1363a..63838add 100644 --- a/Schaum's_Outlines_-_Programming_with_C++/ch1.ipynb +++ b/Schaum's_Outlines_-_Programming_with_C++/ch1.ipynb @@ -1,13 +1,29 @@ { "metadata": { "name": "", - "signature": "sha256:1f4ff165c5b37e972fbde6114f5c4644c7b325a65e411fa21e1921b02d662bf7" + "signature": "sha256:b04f77602641935a2f57f9f799a2b79e82af538577f760aa52819f8a8a5668d9" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 1" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.1 Page 2 " + ] + }, { "cell_type": "code", "collapsed": false, @@ -29,6 +45,14 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.2 Page 2" + ] + }, { "cell_type": "code", "collapsed": false, @@ -51,6 +75,14 @@ ], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.3 Page 3" + ] + }, { "cell_type": "code", "collapsed": false, @@ -73,6 +105,14 @@ ], "prompt_number": 3 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.4 Page 3" + ] + }, { "cell_type": "code", "collapsed": false, @@ -94,6 +134,14 @@ ], "prompt_number": 4 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.5 Page 4" + ] + }, { "cell_type": "code", "collapsed": false, @@ -116,9 +164,18 @@ "prompt_number": 5 }, { - "cell_type": "code", - "collapsed": false, - "input": [ + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.6 Page 5" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ "\n", "\n", "\n", @@ -126,19 +183,15 @@ "print \"m = %d \" % m,\n", "n = m + 33 # assigns the value 77 to the variable n\n", "print \"and n = %d \" % n" - ], - "language": "python", + ] + }, + { + "cell_type": "heading", + "level": 3, "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "m = 44 and n = 77 \n" - ] - } - ], - "prompt_number": 6 + "source": [ + "Example 1.7 Page 5" + ] }, { "cell_type": "code", @@ -162,6 +215,14 @@ ], "prompt_number": 7 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.8 Page 5" + ] + }, { "cell_type": "code", "collapsed": false, @@ -184,6 +245,16 @@ ], "prompt_number": 8 }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "Example 1.9 Page 6" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, { "cell_type": "code", "collapsed": false, @@ -206,6 +277,14 @@ ], "prompt_number": 9 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.10 Page 7" + ] + }, { "cell_type": "code", "collapsed": false, @@ -222,6 +301,14 @@ "outputs": [], "prompt_number": 10 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.11 Page 7" + ] + }, { "cell_type": "code", "collapsed": false, diff --git a/Schaum's_Outlines_-_Programming_with_C++/ch10.ipynb b/Schaum's_Outlines_-_Programming_with_C++/ch10.ipynb index 20eeb516..73132ef0 100644 --- a/Schaum's_Outlines_-_Programming_with_C++/ch10.ipynb +++ b/Schaum's_Outlines_-_Programming_with_C++/ch10.ipynb @@ -1,13 +1,29 @@ { "metadata": { "name": "", - "signature": "sha256:6ab29bd91e48ed72112d302e0e8b3ba6e41a906b6302b14581de985939de5731" + "signature": "sha256:e0510313f61c6fcb61aa0929e4214e5da07f5877c2311aba0ce767b7db273d1f" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 10" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.1 Page 101 " + ] + }, { "cell_type": "code", "collapsed": false, @@ -50,6 +66,14 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.2 Page 101" + ] + }, { "cell_type": "code", "collapsed": false, @@ -74,6 +98,14 @@ "outputs": [], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.3 Page 102" + ] + }, { "cell_type": "code", "collapsed": false, @@ -107,9 +139,18 @@ "prompt_number": 3 }, { - "cell_type": "code", - "collapsed": false, - "input": [ + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.4 Page 102" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ "\n", "class Ratio:\n", " def __init__(self,n=None,d=None):\n", @@ -134,21 +175,15 @@ "y.print_()\n", "print \"\\nz = \",\n", "z.print_()" - ], - "language": "python", + ] + }, + { + "cell_type": "heading", + "level": 3, "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "x = 0 / 1 \n", - "y = 4 / 1 \n", - "z = 22 / 7\n" - ] - } - ], - "prompt_number": 4 + "source": [ + "Example 10.5 Page 103" + ] }, { "cell_type": "code", @@ -175,6 +210,14 @@ "outputs": [], "prompt_number": 5 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.6 Page 104" + ] + }, { "cell_type": "code", "collapsed": false, @@ -198,6 +241,14 @@ "outputs": [], "prompt_number": 6 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.7 Page 104" + ] + }, { "cell_type": "code", "collapsed": false, @@ -232,6 +283,14 @@ ], "prompt_number": 7 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.8 Page 105" + ] + }, { "cell_type": "code", "collapsed": false, @@ -297,6 +356,14 @@ ], "prompt_number": 8 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.9 Page 105" + ] + }, { "cell_type": "code", "collapsed": false, @@ -370,6 +437,14 @@ ], "prompt_number": 9 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.10 Page 106" + ] + }, { "cell_type": "code", "collapsed": false, @@ -445,6 +520,14 @@ ], "prompt_number": 12 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.11 Page 107" + ] + }, { "cell_type": "code", "collapsed": false, @@ -480,6 +563,14 @@ ], "prompt_number": 13 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.12 Page 108" + ] + }, { "cell_type": "code", "collapsed": false, @@ -509,6 +600,14 @@ ], "prompt_number": 14 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.13 Page 108" + ] + }, { "cell_type": "code", "collapsed": false, @@ -602,6 +701,14 @@ ], "prompt_number": 15 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.14 Page 109" + ] + }, { "cell_type": "code", "collapsed": false, @@ -644,6 +751,14 @@ ], "prompt_number": 16 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.15 Page 110" + ] + }, { "cell_type": "code", "collapsed": false, @@ -687,6 +802,14 @@ ], "prompt_number": 17 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.16 Page 109" + ] + }, { "cell_type": "code", "collapsed": false, diff --git a/Schaum's_Outlines_-_Programming_with_C++/ch11.ipynb b/Schaum's_Outlines_-_Programming_with_C++/ch11.ipynb index d65c28e3..67cadd88 100644 --- a/Schaum's_Outlines_-_Programming_with_C++/ch11.ipynb +++ b/Schaum's_Outlines_-_Programming_with_C++/ch11.ipynb @@ -1,13 +1,29 @@ { "metadata": { "name": "", - "signature": "sha256:e48eb1ccc0a3bcda7cfb3c8c85a4d3a8e98cd5fdd1c8b0533a2ba81289b5dcbf" + "signature": "sha256:0c6f88f1641298fec5005cfeb82c2b81a78fd7dd6b5eaacf2e5de74558bc56e1" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 11" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.1 Page 111" + ] + }, { "cell_type": "code", "collapsed": false, @@ -33,6 +49,14 @@ "outputs": [], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.2 Page 111" + ] + }, { "cell_type": "code", "collapsed": false, @@ -50,6 +74,14 @@ "outputs": [], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.3 Page 112" + ] + }, { "cell_type": "code", "collapsed": false, @@ -82,6 +114,14 @@ "outputs": [], "prompt_number": 3 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.4 Page 113" + ] + }, { "cell_type": "code", "collapsed": false, @@ -100,6 +140,14 @@ "outputs": [], "prompt_number": 4 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.5 Page 113" + ] + }, { "cell_type": "code", "collapsed": false, @@ -169,6 +217,14 @@ ], "prompt_number": 5 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.6 Page 114" + ] + }, { "cell_type": "code", "collapsed": false, @@ -201,6 +257,14 @@ "outputs": [], "prompt_number": 6 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.6 Page 114" + ] + }, { "cell_type": "code", "collapsed": false, @@ -226,6 +290,14 @@ "outputs": [], "prompt_number": 7 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.6 Page 114" + ] + }, { "cell_type": "code", "collapsed": false, @@ -271,6 +343,14 @@ ], "prompt_number": 8 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.7 Page 114" + ] + }, { "cell_type": "code", "collapsed": false, @@ -376,6 +456,14 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.8 Page 114" + ] + }, { "cell_type": "code", "collapsed": false, @@ -455,6 +543,14 @@ ], "prompt_number": 3 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.9 Page 115" + ] + }, { "cell_type": "code", "collapsed": false, @@ -527,6 +623,14 @@ ], "prompt_number": 5 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.10 Page 115" + ] + }, { "cell_type": "code", "collapsed": false, @@ -600,6 +704,14 @@ ], "prompt_number": 9 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.11 Page 116" + ] + }, { "cell_type": "code", "collapsed": false, diff --git a/Schaum's_Outlines_-_Programming_with_C++/ch12.ipynb b/Schaum's_Outlines_-_Programming_with_C++/ch12.ipynb index b4d91452..547d2f43 100644 --- a/Schaum's_Outlines_-_Programming_with_C++/ch12.ipynb +++ b/Schaum's_Outlines_-_Programming_with_C++/ch12.ipynb @@ -1,13 +1,29 @@ { "metadata": { "name": "", - "signature": "sha256:a8f901e98281d94f022e9d5e31af5e6f41fcc09b6b14713debbc4198e50f2d3e" + "signature": "sha256:2785143880e0e3d805077e0bc2dd4c3858d6ed346ab7a393a92ac292f599e8ec" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 12" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.1 Page 118" + ] + }, { "cell_type": "code", "collapsed": false, @@ -44,6 +60,14 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.2 Page 118" + ] + }, { "cell_type": "code", "collapsed": false, @@ -87,49 +111,15 @@ ], "language": "python", "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "World War I ended on November 11 , 1918\n", - "World War II ended on August 14 , 1945\n", - "Enter month, day, and year: \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "7\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "4\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "1976\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "The date is July 4 , 1976\n" - ] - } - ], - "prompt_number": 2 + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.3 Page 119" + ] }, { "cell_type": "code", @@ -205,6 +195,14 @@ ], "prompt_number": 3 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.4 Page 119" + ] + }, { "cell_type": "code", "collapsed": false, @@ -291,6 +289,14 @@ ], "prompt_number": 4 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.5 Page 120" + ] + }, { "cell_type": "code", "collapsed": false, @@ -387,6 +393,14 @@ ], "prompt_number": 5 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.6 Page 121" + ] + }, { "cell_type": "code", "collapsed": false, @@ -439,6 +453,14 @@ ], "prompt_number": 6 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.7 Page 122" + ] + }, { "cell_type": "code", "collapsed": false, @@ -482,6 +504,14 @@ ], "prompt_number": 7 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.8 Page 123" + ] + }, { "cell_type": "code", "collapsed": false, @@ -507,6 +537,14 @@ "outputs": [], "prompt_number": 8 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.9 Page 123" + ] + }, { "cell_type": "code", "collapsed": false, @@ -541,6 +579,14 @@ "outputs": [], "prompt_number": 9 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.10 Page 125" + ] + }, { "cell_type": "code", "collapsed": false, @@ -573,6 +619,14 @@ ], "prompt_number": 10 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.11 Page 125" + ] + }, { "cell_type": "code", "collapsed": false, @@ -623,6 +677,14 @@ ], "prompt_number": 11 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.12 Page 126" + ] + }, { "cell_type": "code", "collapsed": false, @@ -668,6 +730,14 @@ ], "prompt_number": 13 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.13 Page 126" + ] + }, { "cell_type": "code", "collapsed": false, diff --git a/Schaum's_Outlines_-_Programming_with_C++/ch13.ipynb b/Schaum's_Outlines_-_Programming_with_C++/ch13.ipynb index cfd875f2..7dadafec 100644 --- a/Schaum's_Outlines_-_Programming_with_C++/ch13.ipynb +++ b/Schaum's_Outlines_-_Programming_with_C++/ch13.ipynb @@ -1,13 +1,29 @@ { "metadata": { "name": "", - "signature": "sha256:cc39907a700b2b635fe495cd65c97f54d7249e166a21cea325643318306862ee" + "signature": "sha256:c4bc7ea265a87d2ba5c8acba80280da83f3569bfcf42471e5b0e2a3235d146de" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 13" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.1 Page 128" + ] + }, { "cell_type": "code", "collapsed": false, @@ -31,6 +47,14 @@ "outputs": [], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.2 Page 128" + ] + }, { "cell_type": "code", "collapsed": false, @@ -72,6 +96,14 @@ ], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.3 Page 129" + ] + }, { "cell_type": "code", "collapsed": false, @@ -124,6 +156,14 @@ ], "prompt_number": 3 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.4 Page 129" + ] + }, { "cell_type": "code", "collapsed": false, @@ -158,6 +198,14 @@ ], "prompt_number": 4 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.5 Page 130" + ] + }, { "cell_type": "code", "collapsed": false, @@ -215,6 +263,14 @@ ], "prompt_number": 5 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.6 Page 131" + ] + }, { "cell_type": "code", "collapsed": false, @@ -261,6 +317,14 @@ ], "prompt_number": 6 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.7 Page 132" + ] + }, { "cell_type": "code", "collapsed": false, @@ -299,6 +363,14 @@ ], "prompt_number": 7 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.7 Page 132" + ] + }, { "cell_type": "code", "collapsed": false, diff --git a/Schaum's_Outlines_-_Programming_with_C++/ch14.ipynb b/Schaum's_Outlines_-_Programming_with_C++/ch14.ipynb index 2b06bed6..0e00de6f 100644 --- a/Schaum's_Outlines_-_Programming_with_C++/ch14.ipynb +++ b/Schaum's_Outlines_-_Programming_with_C++/ch14.ipynb @@ -1,13 +1,29 @@ { "metadata": { "name": "", - "signature": "sha256:a2642ced32385d2b1020b66a0cd2578b114803009d5270f03f2b2323505ad39e" + "signature": "sha256:2c16de9b41dbb01240882bf1073200d244b7c6b6ebd3365e3dd0cb228ffe4781" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 14" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.1 Page 134" + ] + }, { "cell_type": "code", "collapsed": false, @@ -51,6 +67,14 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.2 Page 135" + ] + }, { "cell_type": "code", "collapsed": false, @@ -94,6 +118,14 @@ ], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.3 Page 136" + ] + }, { "cell_type": "code", "collapsed": false, @@ -138,6 +170,14 @@ ], "prompt_number": 3 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.3 Page 136" + ] + }, { "cell_type": "code", "collapsed": false, @@ -184,6 +224,14 @@ ], "prompt_number": 4 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.4 Page 136" + ] + }, { "cell_type": "code", "collapsed": false, @@ -237,6 +285,14 @@ ], "prompt_number": 5 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.5 Page 137" + ] + }, { "cell_type": "code", "collapsed": false, @@ -296,6 +352,14 @@ ], "prompt_number": 6 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.6 Page 137" + ] + }, { "cell_type": "code", "collapsed": false, @@ -349,6 +413,14 @@ ], "prompt_number": 7 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.8 Page 138" + ] + }, { "cell_type": "code", "collapsed": false, @@ -410,6 +482,14 @@ ], "prompt_number": 8 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.9 Page 139" + ] + }, { "cell_type": "code", "collapsed": false, @@ -475,6 +555,14 @@ ], "prompt_number": 9 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.10 Page 139" + ] + }, { "cell_type": "code", "collapsed": false, diff --git a/Schaum's_Outlines_-_Programming_with_C++/ch2.ipynb b/Schaum's_Outlines_-_Programming_with_C++/ch2.ipynb index b03e0beb..75a72273 100644 --- a/Schaum's_Outlines_-_Programming_with_C++/ch2.ipynb +++ b/Schaum's_Outlines_-_Programming_with_C++/ch2.ipynb @@ -1,13 +1,29 @@ { "metadata": { "name": "", - "signature": "sha256:b7fd8e305f82250735b733aadfdbd451b8947aadb96283663ae0092c6c46c8ec" + "signature": "sha256:d7df65d2ddf57442f1a366aedfff9ee4f4aa086fced8ff89a2bb809a0b69e7be" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 2" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.1 Page 11" + ] + }, { "cell_type": "code", "collapsed": false, @@ -32,6 +48,14 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.2 Page 12" + ] + }, { "cell_type": "code", "collapsed": false, @@ -64,6 +88,14 @@ ], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.3 Page 12" + ] + }, { "cell_type": "code", "collapsed": false, @@ -78,18 +110,15 @@ ], "language": "python", "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "maximum limit int : 2147483647\n", - "float info\n", - "sys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.220446049250313e-16, radix=2, rounds=1)\n" - ] - } - ], - "prompt_number": 3 + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.4 Page 13" + ] }, { "cell_type": "code", @@ -123,6 +152,14 @@ ], "prompt_number": 4 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.5 Page 13" + ] + }, { "cell_type": "code", "collapsed": false, @@ -153,6 +190,14 @@ ], "prompt_number": 5 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.6 Page 14" + ] + }, { "cell_type": "code", "collapsed": false, @@ -189,6 +234,14 @@ ], "prompt_number": 6 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.7 Page 15" + ] + }, { "cell_type": "code", "collapsed": false, @@ -220,6 +273,14 @@ ], "prompt_number": 7 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.8 Page 16" + ] + }, { "cell_type": "code", "collapsed": false, @@ -252,6 +313,14 @@ ], "prompt_number": 8 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.8 Page 17" + ] + }, { "cell_type": "code", "collapsed": false, @@ -278,6 +347,14 @@ ], "prompt_number": 9 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.9 Page 17" + ] + }, { "cell_type": "code", "collapsed": false, @@ -300,6 +377,14 @@ ], "prompt_number": 10 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.10 Page 18" + ] + }, { "cell_type": "code", "collapsed": false, @@ -336,6 +421,14 @@ ], "prompt_number": 11 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.11 Page 19" + ] + }, { "cell_type": "code", "collapsed": false, @@ -366,6 +459,14 @@ ], "prompt_number": 12 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.12 Page 20" + ] + }, { "cell_type": "code", "collapsed": false, @@ -400,38 +501,12 @@ "prompt_number": 13 }, { - "cell_type": "code", - "collapsed": false, - "input": [ - "\n", - "\n", - "x = 1000/3.0\n", - "print \"x = %f\" %x # x = 1000/3\n", - "y = x - 333.0\n", - "print \"y = %f\" % y # y = 1/3\n", - "z = 3*y - 1.0\n", - "print \"z = %f\" %z # z = 3(1/3) - 1\n", - "if (z == 0):\n", - " print \"z == 0.\\n\"\n", - "else:\n", - " print \"z does not equal 0.\\n\" # z != 0\n" - ], - "language": "python", + "cell_type": "heading", + "level": 3, "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "x = 333.333333\n", - "y = 0.333333\n", - "z = -0.000000\n", - "z does not equal 0.\n", - "\n" - ] - } - ], - "prompt_number": 14 + "source": [ + "Example 2.13 Page 21" + ] }, { "cell_type": "code", @@ -508,6 +583,56 @@ ], "prompt_number": 15 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.14 Page 22" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "x = 1000/3.0\n", + "print \"x = %f\" %x # x = 1000/3\n", + "y = x - 333.0\n", + "print \"y = %f\" % y # y = 1/3\n", + "z = 3*y - 1.0\n", + "print \"z = %f\" %z # z = 3(1/3) - 1\n", + "if (z == 0):\n", + " print \"z == 0.\\n\"\n", + "else:\n", + " print \"z does not equal 0.\\n\" # z != 0\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = 333.333333\n", + "y = 0.333333\n", + "z = -0.000000\n", + "z does not equal 0.\n", + "\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.15 Page 24" + ] + }, { "cell_type": "code", "collapsed": false, @@ -538,6 +663,14 @@ ], "prompt_number": 16 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.16 Page 25" + ] + }, { "cell_type": "code", "collapsed": false, @@ -557,6 +690,14 @@ "outputs": [], "prompt_number": 17 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.16 Page 25" + ] + }, { "cell_type": "code", "collapsed": false, diff --git a/Schaum's_Outlines_-_Programming_with_C++/ch3.ipynb b/Schaum's_Outlines_-_Programming_with_C++/ch3.ipynb index 9a59031c..2ae1c810 100644 --- a/Schaum's_Outlines_-_Programming_with_C++/ch3.ipynb +++ b/Schaum's_Outlines_-_Programming_with_C++/ch3.ipynb @@ -1,13 +1,29 @@ { "metadata": { "name": "", - "signature": "sha256:11b7a1493680a6b7a0a36e37cb0fb0b3cfce2dde29e20a1b991383c6bbfc7afe" + "signature": "sha256:c6ccd61745829db5f310110909ac53b4a96d80dc833177ee7aacf23b0ee3328f" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Chapter 3" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.1 Page 27" + ] + }, { "cell_type": "code", "collapsed": false, @@ -56,6 +72,14 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.2 Page 27" + ] + }, { "cell_type": "code", "collapsed": false, @@ -105,6 +129,14 @@ ], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.3 Page 28" + ] + }, { "cell_type": "code", "collapsed": false, @@ -157,6 +189,14 @@ ], "prompt_number": 3 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.4 Page 29" + ] + }, { "cell_type": "code", "collapsed": false, @@ -183,6 +223,14 @@ ], "prompt_number": 4 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.5 Page 30" + ] + }, { "cell_type": "code", "collapsed": false, @@ -245,6 +293,14 @@ ], "prompt_number": 5 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.6 Page 30" + ] + }, { "cell_type": "code", "collapsed": false, @@ -299,6 +355,14 @@ ], "prompt_number": 6 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.7 Page 31" + ] + }, { "cell_type": "code", "collapsed": false, @@ -352,6 +416,14 @@ ], "prompt_number": 7 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.8 Page 32" + ] + }, { "cell_type": "code", "collapsed": false, @@ -413,6 +485,14 @@ ], "prompt_number": 8 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.9 Page 32" + ] + }, { "cell_type": "code", "collapsed": false, @@ -455,6 +535,14 @@ ], "prompt_number": 9 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.10 Page 33" + ] + }, { "cell_type": "code", "collapsed": false, @@ -506,6 +594,14 @@ ], "prompt_number": 10 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.11 Page 34" + ] + }, { "cell_type": "code", "collapsed": false, @@ -556,6 +652,14 @@ ], "prompt_number": 11 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.12 Page 35" + ] + }, { "cell_type": "code", "collapsed": false, @@ -610,6 +714,14 @@ ], "prompt_number": 12 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.13 Page 35" + ] + }, { "cell_type": "code", "collapsed": false, @@ -674,6 +786,14 @@ ], "prompt_number": 13 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.14 Page 36" + ] + }, { "cell_type": "code", "collapsed": false, @@ -792,6 +912,14 @@ ], "prompt_number": 14 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.15 Page 36" + ] + }, { "cell_type": "code", "collapsed": false, @@ -833,6 +961,14 @@ ], "prompt_number": 15 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.16 Page 37" + ] + }, { "cell_type": "code", "collapsed": false, @@ -874,6 +1010,14 @@ ], "prompt_number": 16 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.17 Page 38" + ] + }, { "cell_type": "code", "collapsed": false, @@ -918,6 +1062,14 @@ ], "prompt_number": 17 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.18 Page 38" + ] + }, { "cell_type": "code", "collapsed": false, @@ -962,6 +1114,14 @@ ], "prompt_number": 18 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.19 Page 39" + ] + }, { "cell_type": "code", "collapsed": false, diff --git a/Schaum's_Outlines_-_Programming_with_C++/ch4.ipynb b/Schaum's_Outlines_-_Programming_with_C++/ch4.ipynb index 64e8a763..d63d79b3 100644 --- a/Schaum's_Outlines_-_Programming_with_C++/ch4.ipynb +++ b/Schaum's_Outlines_-_Programming_with_C++/ch4.ipynb @@ -1,13 +1,29 @@ { "metadata": { "name": "", - "signature": "sha256:7bd00720050ed2a3657363e38f1e369105d66f3738b7a484e8db28626c8d8a4e" + "signature": "sha256:737a02bfa8469193fdfc06f943f5ddeb58798dd90da1f6e94d0a393845dbdcae" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 4" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.1 Page 40" + ] + }, { "cell_type": "code", "collapsed": false, @@ -50,6 +66,14 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.2 Page 40" + ] + }, { "cell_type": "code", "collapsed": false, @@ -94,6 +118,14 @@ ], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.3 Page 41" + ] + }, { "cell_type": "code", "collapsed": false, @@ -109,56 +141,15 @@ ], "language": "python", "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a positive number: \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "5\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "sqrt(5) = 2.236068 \n", - "Enter another positive number (or 0 to quit): \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "3\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "sqrt(3) = 1.732051 \n", - "Enter another positive number (or 0 to quit): \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "0\n" - ] - } - ], - "prompt_number": 3 + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.4 Page 41" + ] }, { "cell_type": "code", @@ -205,9 +196,18 @@ "prompt_number": 5 }, { - "cell_type": "code", - "collapsed": false, - "input": [ + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.5 Page 41" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ "\n", "print \"Enter a positive integer: \"\n", "bound = int(raw_input())\n", @@ -222,35 +222,17 @@ " f0 = f1\n", " f1 = f2\n", " " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "Example 4.6 Page 42" ], "language": "python", "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Enter a positive integer: \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "stream": "stdout", - "text": [ - "10\n" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Fibonacci numbers < 10:\n", - "0, 1 , 1 , 2 , 3 , 5 , 8\n" - ] - } - ], - "prompt_number": 6 + "outputs": [] }, { "cell_type": "code", @@ -317,6 +299,14 @@ ], "prompt_number": 7 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.7 Page 42" + ] + }, { "cell_type": "code", "collapsed": false, @@ -367,6 +357,14 @@ ], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.8 Page 42" + ] + }, { "cell_type": "code", "collapsed": false, @@ -403,6 +401,14 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.8 Page 42" + ] + }, { "cell_type": "code", "collapsed": false, @@ -445,6 +451,14 @@ ], "prompt_number": 3 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.9 Page 44" + ] + }, { "cell_type": "code", "collapsed": false, @@ -489,6 +503,14 @@ ], "prompt_number": 4 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.10 Page 44" + ] + }, { "cell_type": "code", "collapsed": false, @@ -530,6 +552,14 @@ ], "prompt_number": 5 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.11 Page 44" + ] + }, { "cell_type": "code", "collapsed": false, @@ -573,6 +603,14 @@ ], "prompt_number": 6 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.12 Page 45" + ] + }, { "cell_type": "code", "collapsed": false, @@ -616,6 +654,14 @@ ], "prompt_number": 7 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.13 Page 46" + ] + }, { "cell_type": "code", "collapsed": false, @@ -637,6 +683,14 @@ ], "prompt_number": 8 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.14 Page 46" + ] + }, { "cell_type": "code", "collapsed": false, @@ -690,6 +744,14 @@ ], "prompt_number": 9 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.15 Page 47" + ] + }, { "cell_type": "code", "collapsed": false, @@ -765,6 +827,14 @@ ], "prompt_number": 10 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.15 Page 47" + ] + }, { "cell_type": "code", "collapsed": false, @@ -841,6 +911,14 @@ ], "prompt_number": 11 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.16 Page 48" + ] + }, { "cell_type": "code", "collapsed": false, @@ -871,6 +949,14 @@ ], "prompt_number": 12 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.17 Page 49" + ] + }, { "cell_type": "code", "collapsed": false, @@ -905,6 +991,14 @@ ], "prompt_number": 13 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.17 Page 48" + ] + }, { "cell_type": "code", "collapsed": false, @@ -965,6 +1059,14 @@ ], "prompt_number": 14 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.18 Page 48" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1010,6 +1112,14 @@ ], "prompt_number": 15 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.19 Page 48" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1103,6 +1213,14 @@ ], "prompt_number": 16 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.20 Page 48" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1140,6 +1258,14 @@ ], "prompt_number": 17 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.21 Page 49" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1208,6 +1334,14 @@ ], "prompt_number": 18 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.22 Page 50" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1256,6 +1390,14 @@ ], "prompt_number": 19 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.23 Page 50" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1304,6 +1446,14 @@ ], "prompt_number": 20 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.24 Page 50" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1338,6 +1488,14 @@ ], "prompt_number": 21 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.25 Page 50" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1386,6 +1544,14 @@ ], "prompt_number": 22 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.26 Page 50" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1415,6 +1581,14 @@ ], "prompt_number": 23 }, + { + "cell_type": "heading", + "level": 4, + "metadata": {}, + "source": [ + "Example 4.27 Page 50" + ] + }, { "cell_type": "code", "collapsed": false, diff --git a/Schaum's_Outlines_-_Programming_with_C++/ch5.ipynb b/Schaum's_Outlines_-_Programming_with_C++/ch5.ipynb index f2c1f873..c68f8096 100644 --- a/Schaum's_Outlines_-_Programming_with_C++/ch5.ipynb +++ b/Schaum's_Outlines_-_Programming_with_C++/ch5.ipynb @@ -1,13 +1,29 @@ { "metadata": { "name": "", - "signature": "sha256:08f28df467a1f0a941ab1bf603885e6d5dd4e19b6b21d49fd2ef0604a23f5de2" + "signature": "sha256:e80063795283207748ff55204e74519308d9c1c1f0d9935ca9a096d46bbd96b5" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 5" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.1 Page 51" + ] + }, { "cell_type": "code", "collapsed": false, @@ -36,6 +52,14 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.2 Page 51" + ] + }, { "cell_type": "code", "collapsed": false, @@ -72,6 +96,16 @@ ], "prompt_number": 2 }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "Example 5.3 Page 51" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, { "cell_type": "code", "collapsed": false, @@ -88,6 +122,14 @@ "outputs": [], "prompt_number": 3 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.3 Page 51" + ] + }, { "cell_type": "code", "collapsed": false, @@ -170,6 +212,14 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.4 Page 51" + ] + }, { "cell_type": "code", "collapsed": false, @@ -243,6 +293,14 @@ ], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.5 Page 51" + ] + }, { "cell_type": "code", "collapsed": false, @@ -316,6 +374,14 @@ ], "prompt_number": 3 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.6 Page 52" + ] + }, { "cell_type": "code", "collapsed": false, @@ -428,6 +494,14 @@ ], "prompt_number": 4 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.7 Page 52" + ] + }, { "cell_type": "code", "collapsed": false, @@ -458,6 +532,14 @@ ], "prompt_number": 5 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.8 Page 53" + ] + }, { "cell_type": "code", "collapsed": false, @@ -505,6 +587,14 @@ ], "prompt_number": 6 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.9 Page 53" + ] + }, { "cell_type": "code", "collapsed": false, @@ -619,6 +709,14 @@ ], "prompt_number": 8 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.10 Page 54" + ] + }, { "cell_type": "code", "collapsed": false, @@ -925,6 +1023,14 @@ ], "prompt_number": 4 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.11 Page 54" + ] + }, { "cell_type": "code", "collapsed": false, @@ -966,6 +1072,14 @@ ], "prompt_number": 10 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.12 Page 55" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1050,6 +1164,14 @@ ], "prompt_number": 11 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.12 Page 55" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1139,6 +1261,14 @@ ], "prompt_number": 14 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.12 Page 55" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1169,6 +1299,14 @@ ], "prompt_number": 15 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.14 Page 56" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1202,6 +1340,14 @@ ], "prompt_number": 16 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.15 Page 57" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1249,6 +1395,14 @@ ], "prompt_number": 17 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.16 Page 57" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1287,6 +1441,14 @@ ], "prompt_number": 5 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.17 Page 58" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1330,6 +1492,14 @@ ], "prompt_number": 19 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.18 Page 59" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1371,6 +1541,14 @@ ], "prompt_number": 20 }, + { + "cell_type": "heading", + "level": 4, + "metadata": {}, + "source": [ + "Example 5.19 Page 60" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1400,6 +1578,14 @@ ], "prompt_number": 21 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.20 Page 61" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1450,6 +1636,14 @@ ], "prompt_number": 22 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.21 Page 62" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1486,6 +1680,14 @@ ], "prompt_number": 23 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.22 Page 63" + ] + }, { "cell_type": "code", "collapsed": false, diff --git a/Schaum's_Outlines_-_Programming_with_C++/ch6.ipynb b/Schaum's_Outlines_-_Programming_with_C++/ch6.ipynb index 0ed8b9bb..af258b79 100644 --- a/Schaum's_Outlines_-_Programming_with_C++/ch6.ipynb +++ b/Schaum's_Outlines_-_Programming_with_C++/ch6.ipynb @@ -1,13 +1,29 @@ { "metadata": { "name": "", - "signature": "sha256:d63f30088951026ca8431b2db000283f5d2b32b8fd4852f840cfd94c7913a4ff" + "signature": "sha256:a8857c83acde4298195ee44fc68de4f10d51e8743270e5ece79f31e3e37359f9" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 6" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.1 Page 64" + ] + }, { "cell_type": "code", "collapsed": false, @@ -37,6 +53,14 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.2 Page 64" + ] + }, { "cell_type": "code", "collapsed": false, @@ -120,6 +144,14 @@ ], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.3 Page 65" + ] + }, { "cell_type": "code", "collapsed": false, @@ -148,6 +180,14 @@ ], "prompt_number": 3 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.4 Page 66" + ] + }, { "cell_type": "code", "collapsed": false, @@ -178,6 +218,14 @@ ], "prompt_number": 4 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.5 Page 66" + ] + }, { "cell_type": "code", "collapsed": false, @@ -206,6 +254,14 @@ ], "prompt_number": 5 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.6 Page 66" + ] + }, { "cell_type": "code", "collapsed": false, @@ -244,6 +300,14 @@ ], "prompt_number": 6 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.7 Page 67" + ] + }, { "cell_type": "code", "collapsed": false, @@ -270,6 +334,14 @@ ], "prompt_number": 7 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.7 Page 67" + ] + }, { "cell_type": "code", "collapsed": false, @@ -304,6 +376,14 @@ ], "prompt_number": 8 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.8 Page 68" + ] + }, { "cell_type": "code", "collapsed": false, @@ -332,6 +412,14 @@ ], "prompt_number": 10 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.9 Page 68" + ] + }, { "cell_type": "code", "collapsed": false, @@ -419,6 +507,14 @@ ], "prompt_number": 12 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.10 Page 69" + ] + }, { "cell_type": "code", "collapsed": false, @@ -442,6 +538,14 @@ ], "prompt_number": 13 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.11 Page 70" + ] + }, { "cell_type": "code", "collapsed": false, @@ -473,6 +577,14 @@ ], "prompt_number": 14 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.12 Page 71" + ] + }, { "cell_type": "code", "collapsed": false, @@ -512,6 +624,14 @@ ], "prompt_number": 15 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.13 Page 72" + ] + }, { "cell_type": "code", "collapsed": false, @@ -551,6 +671,14 @@ ], "prompt_number": 16 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.14 Page 73" + ] + }, { "cell_type": "code", "collapsed": false, @@ -582,6 +710,14 @@ ], "prompt_number": 17 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.15 Page 73" + ] + }, { "cell_type": "code", "collapsed": false, @@ -643,6 +779,14 @@ ], "prompt_number": 18 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.16 Page 73" + ] + }, { "cell_type": "code", "collapsed": false, @@ -674,6 +818,14 @@ ], "prompt_number": 19 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.17 Page 74" + ] + }, { "cell_type": "code", "collapsed": false, @@ -706,6 +858,14 @@ ], "prompt_number": 20 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.18 Page 75" + ] + }, { "cell_type": "code", "collapsed": false, @@ -887,6 +1047,14 @@ ], "prompt_number": 21 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.19 Page 76" + ] + }, { "cell_type": "code", "collapsed": false, @@ -1092,6 +1260,14 @@ ], "prompt_number": 24 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.20 Page 76" + ] + }, { "cell_type": "code", "collapsed": false, diff --git a/Schaum's_Outlines_-_Programming_with_C++/ch7.ipynb b/Schaum's_Outlines_-_Programming_with_C++/ch7.ipynb index ddb6c93a..60381709 100644 --- a/Schaum's_Outlines_-_Programming_with_C++/ch7.ipynb +++ b/Schaum's_Outlines_-_Programming_with_C++/ch7.ipynb @@ -1,13 +1,29 @@ { "metadata": { "name": "", - "signature": "sha256:377256b0fa2c7d29cc10649b14b8b11810b96406c47eeeedd29df767b23be14b" + "signature": "sha256:408b7b29bc9fb4139b74d65d047f40b07984dc2dc4fd617cc2c35b810cbf005e" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 7" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.1 Page 78" + ] + }, { "cell_type": "code", "collapsed": false, @@ -33,6 +49,14 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.2 Page 78" + ] + }, { "cell_type": "code", "collapsed": false, @@ -64,6 +88,14 @@ ], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.3 Page 78" + ] + }, { "cell_type": "code", "collapsed": false, @@ -91,6 +123,14 @@ ], "prompt_number": 3 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.4 Page 79" + ] + }, { "cell_type": "code", "collapsed": false, @@ -118,6 +158,14 @@ ], "prompt_number": 4 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.5 Page 80" + ] + }, { "cell_type": "code", "collapsed": false, @@ -147,6 +195,14 @@ ], "prompt_number": 5 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.6 Page 80" + ] + }, { "cell_type": "code", "collapsed": false, @@ -184,6 +240,14 @@ ], "prompt_number": 6 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.7 Page 81" + ] + }, { "cell_type": "code", "collapsed": false, @@ -224,6 +288,14 @@ ], "prompt_number": 7 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.8 Page 81" + ] + }, { "cell_type": "code", "collapsed": false, @@ -257,6 +329,14 @@ ], "prompt_number": 8 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.9 Page 81" + ] + }, { "cell_type": "code", "collapsed": false, @@ -286,6 +366,14 @@ ], "prompt_number": 9 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.10 Page 82" + ] + }, { "cell_type": "code", "collapsed": false, @@ -321,6 +409,14 @@ ], "prompt_number": 10 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.10 Page 82" + ] + }, { "cell_type": "code", "collapsed": false, @@ -351,6 +447,14 @@ ], "prompt_number": 11 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.11 Page 83" + ] + }, { "cell_type": "code", "collapsed": false, @@ -396,6 +500,14 @@ ], "prompt_number": 12 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.12 Page 84" + ] + }, { "cell_type": "code", "collapsed": false, @@ -558,6 +670,14 @@ ], "prompt_number": 13 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.13 Page 84" + ] + }, { "cell_type": "code", "collapsed": false, @@ -575,6 +695,14 @@ "outputs": [], "prompt_number": 14 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.14 Page 84" + ] + }, { "cell_type": "code", "collapsed": false, diff --git a/Schaum's_Outlines_-_Programming_with_C++/ch8.ipynb b/Schaum's_Outlines_-_Programming_with_C++/ch8.ipynb index 8240c86e..ea425974 100644 --- a/Schaum's_Outlines_-_Programming_with_C++/ch8.ipynb +++ b/Schaum's_Outlines_-_Programming_with_C++/ch8.ipynb @@ -1,13 +1,29 @@ { "metadata": { "name": "", - "signature": "sha256:b1974020eda324caef25f3f8ac3993a694e8efd28b1849e70acd6d105ee7a937" + "signature": "sha256:dcdea056ba1ad05b18548a929edcfe059a3be4963e9ccbc6c674fa82a22ef3f6" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 8" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.1 Page 85" + ] + }, { "cell_type": "code", "collapsed": false, @@ -85,6 +101,14 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.2 Page 86" + ] + }, { "cell_type": "code", "collapsed": false, @@ -115,6 +139,14 @@ ], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.3 Page 87" + ] + }, { "cell_type": "code", "collapsed": false, @@ -180,6 +212,14 @@ ], "prompt_number": 6 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.4 Page 87" + ] + }, { "cell_type": "code", "collapsed": false, @@ -236,6 +276,14 @@ ], "prompt_number": 7 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.5 Page 88" + ] + }, { "cell_type": "code", "collapsed": false, @@ -297,6 +345,14 @@ ], "prompt_number": 8 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.6 Page 89" + ] + }, { "cell_type": "code", "collapsed": false, @@ -351,6 +407,14 @@ ], "prompt_number": 9 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.7 Page 89" + ] + }, { "cell_type": "code", "collapsed": false, @@ -406,6 +470,14 @@ ], "prompt_number": 10 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.8 Page 89" + ] + }, { "cell_type": "code", "collapsed": false, @@ -446,6 +518,14 @@ ], "prompt_number": 11 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.9 Page 90" + ] + }, { "cell_type": "code", "collapsed": false, @@ -523,6 +603,14 @@ ], "prompt_number": 12 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.10 Page 90" + ] + }, { "cell_type": "code", "collapsed": false, @@ -600,6 +688,14 @@ ], "prompt_number": 13 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.11 Page 91" + ] + }, { "cell_type": "code", "collapsed": false, @@ -629,6 +725,14 @@ ], "prompt_number": 14 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.12 Page 91" + ] + }, { "cell_type": "code", "collapsed": false, @@ -672,6 +776,14 @@ ], "prompt_number": 15 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.13 Page 91" + ] + }, { "cell_type": "code", "collapsed": false, @@ -693,21 +805,15 @@ ], "language": "python", "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "s = \" The Mississippi is a long river. \"\n", - "find(s, ' ') points to s[ 3 ].\n", - "find(s, 's') points to s[ 6 ].\n", - "reverse find(s, 's') points to s[ 17 ].\n", - "strstr(s, \"is\") points to s[ 5 ].\n", - "s.find(\"isi\") returns NULL\n" - ] - } - ], - "prompt_number": 16 + "outputs": [] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.14 Page 92" + ] }, { "cell_type": "code", @@ -744,6 +850,14 @@ ], "prompt_number": 17 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.15 Page 93" + ] + }, { "cell_type": "code", "collapsed": false, @@ -781,6 +895,14 @@ ], "prompt_number": 18 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.16 Page 93" + ] + }, { "cell_type": "code", "collapsed": false, @@ -816,6 +938,14 @@ ], "prompt_number": 19 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.17 Page 93" + ] + }, { "cell_type": "code", "collapsed": false, @@ -850,6 +980,14 @@ ], "prompt_number": 20 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.18 Page 94" + ] + }, { "cell_type": "code", "collapsed": false, @@ -886,6 +1024,14 @@ ], "prompt_number": 21 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 8.19 Page 94" + ] + }, { "cell_type": "code", "collapsed": false, diff --git a/Schaum's_Outlines_-_Programming_with_C++/ch9.ipynb b/Schaum's_Outlines_-_Programming_with_C++/ch9.ipynb index d8825dca..42ab07f7 100644 --- a/Schaum's_Outlines_-_Programming_with_C++/ch9.ipynb +++ b/Schaum's_Outlines_-_Programming_with_C++/ch9.ipynb @@ -1,13 +1,29 @@ { "metadata": { "name": "", - "signature": "sha256:3d283266e7082a716b1a943d213d074680f7742450c9d72e3e7e5a73a1856d5b" + "signature": "sha256:49f88bf7034c8c21838e751c91470b426b9f85e4daef4a9cc1535d018a19e39d" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 9" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.1 Page 96" + ] + }, { "cell_type": "code", "collapsed": false, @@ -109,6 +125,14 @@ ], "prompt_number": 1 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.2 Page 97" + ] + }, { "cell_type": "code", "collapsed": false, @@ -218,6 +242,14 @@ ], "prompt_number": 2 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.3 Page 98" + ] + }, { "cell_type": "code", "collapsed": false, @@ -300,6 +332,14 @@ ], "prompt_number": 4 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.4 Page 99" + ] + }, { "cell_type": "code", "collapsed": false, @@ -336,6 +376,14 @@ ], "prompt_number": 5 }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.5 Page 99" + ] + }, { "cell_type": "code", "collapsed": false, diff --git a/Surveying_Volume_3/.ipynb_checkpoints/Chapter_1_-checkpoint.ipynb b/Surveying_Volume_3/.ipynb_checkpoints/Chapter_1_-checkpoint.ipynb new file mode 100644 index 00000000..1980cbfe --- /dev/null +++ b/Surveying_Volume_3/.ipynb_checkpoints/Chapter_1_-checkpoint.ipynb @@ -0,0 +1,3834 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:4ddd3af14ff06960550d645597cd73680055f50cafe1bfd8d26e7c68217b3e30" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "chapter 1:FIELD ASTRONOMY" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.1, Page 30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin\n", + "#part1\n", + "a =40; # longitude of A\n", + "b =73; # longitude of B\n", + "\n", + "#calculation\n", + "dol =b-a; # difference of longitude\n", + "\n", + "#result\n", + "print \" difference of longitude is in degrees\",round(dol);\n", + "\n", + "#part2\n", + "a =20; # longitude of A\n", + "b =150; # longitude of B\n", + "\n", + "#calculation\n", + "dol =b-a; # difference of longitude\n", + "\n", + "#result\n", + "print \" difference of longitude is in degrees \",round(dol);\n", + "\n", + "#part3\n", + "a =-20; # longitude of A\n", + "b =50; # longitude of B\n", + "\n", + "#calculation\n", + "dol =b-a; # difference of longitude\n", + "\n", + "#result\n", + "print \" difference of longitude is in degrees\",round(dol);\n", + "\n", + "#part4\n", + "a =-40; # longitude of A\n", + "b =150; # longitude of B\n", + "\n", + "#calculation\n", + "dol =360-(b-a); # difference of longitude\n", + "\n", + "#result\n", + "print \" difference of longitude is in degrees\",round(dol);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " difference of longitude is 33.0\n", + " difference of longitude is 130.0\n", + " difference of longitude is 70.0\n", + " difference of longitude is 170.0\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.2.1,Page 31" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos\n", + "latA =28.0+42.0/60.0; # latitude of A\n", + "lonA =31.0*60.0+12.0; # longitude of A\n", + "latB =28.0+42.0/60.0; # latitude of B\n", + "lonB =47.0*60.0+24.0; # longitude of B\n", + "\n", + "#calculation\n", + "d=( lonB - lonA )*cos( latA /180* pi);\n", + "\n", + "#result\n", + "print \" distance between A & B in (km) \",round(d *1.852,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " distance between A & B in (km) 1578.989\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.2.2,Page 31" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos\n", + "latA =12.0+36.0/60.0; # latitude of A\n", + "lonA =115.0*60.0+6.0; # longitude of A\n", + "latB =12.0+36.0/60.0; # latitude of B\n", + "lonB =-150.0*60.0-24.0; # longitude of B\n", + "\n", + "#calculation\n", + "d=( 360*60+lonB - lonA )*cos( latA /180* pi);\n", + "\n", + "#result\n", + "print \" distance between A & B in (km) \",round(d *1.852,3) " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " distance between A & B in (km) 10247.946\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.3,Page 31" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "latA =15;\n", + "latB =12.0+6.0/60.0;\n", + "lonA =50.0+12.0/60.0;\n", + "lonB =54.0;\n", + "Re =6370.0; # radius of earth\n", + "\n", + "#calculation\n", + "b=(90 - latA )*pi /180;\n", + "a=(90 - latB )*pi /180;\n", + "P=( lonB - lonA )*pi /180;\n", + "p= acos ( cos (P)*sin(a)* sin (b)+ cos (a)*cos(b)); #spherical triangle law\n", + "x= atan ( cos (a/2-b/2)/ cos (a/2+b /2) * tan (pi /2-P /2) );#spherical triangle law \n", + "y= atan ( sin (a/2-b/2)/ sin (a/2+b /2) * tan (pi /2-P /2) ); #spherical triangle law\n", + "dol =pi -x-y;\n", + "dol=dol*180/pi;\n", + "a= dol *3600 %60;\n", + "b= ((dol *3600 -a)%3600) /60;\n", + "c=( dol *3600 - b*60 -a) /3600;\n", + "\n", + "#result\n", + "print \" distance from A to B in (km) \",round(p*Re,3);\n", + "print \" direction of B from A towards east of south \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " distance from A to B in (km) 522.104\n", + " direction of B from A towards east of south 35.16 seconds 19.0 minutes 52.0 degrees\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.4,Page 33" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = (md - m) * 60\n", + " sd=round(sd,2)\n", + " return [d, m, sd]\n", + "latA =45.0;\n", + "a1=45.0+13.108/60;\n", + "p =(300.0/60.0) *pi /180; # side AB\n", + "b=(90 - latA )*pi /180; # side PA\n", + "\n", + "# calculation\n", + "a= acos ( cos (p)*cos(b)); # side BP\n", + "BC=a *180/ pi - latA ;\n", + "d=BC *1.852*60;\n", + "B=asin(sin(latA*pi/180)/sin(a1*pi/180));\n", + "B=deg_to_dms(B*180/pi);\n", + "\n", + "\n", + "#result\n", + "print \" distance of BC in (km)\",round(d,3)\n", + "print \"the angle in deg,min,sec is\",B" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " distance of BC in (km) 24.181\n", + "the angle in deg,min,sce is [85, 0, 33.27]\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.6.1,Page 37" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "delta =42+15.0/60; # declination of star\n", + "theta =26+40.0/60; # lattude of star\n", + "\n", + "#caculation\n", + "zend =90.0 - theta -90+ delta ;\n", + "alt =90.0 - zend ;\n", + "\n", + "#for zenith distance\n", + "#a= zend *3600 %60;\n", + "b= ((zend *3600 )%3600) /60;\n", + "c=( zend *3600 - b*60 -a) /3600;\n", + "print \" zenith distance \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n", + "\n", + "#for altitude\n", + "a= alt *3600 %60;\n", + "b= ((alt *3600 -a)%3600) /60;\n", + "c=( alt *3600 - b*60 -a) /3600;\n", + "print \" altitude of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " zenith distance 0.0 seconds 35.0 minutes 15.0 degrees\n", + " altitude of star 0.0 seconds 25.0 minutes 74.0 degrees\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.6.2,Page 36" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "delta =23+20.0/60; # declination of star\n", + "theta =26+40.0/60; # lattude of star\n", + "\n", + "#caculation\n", + "zend =90.0 + theta -90- delta ;\n", + "alt =90.0 - zend ;\n", + "\n", + "#for zenith distance\n", + "a= zend *3600 %60;\n", + "b= ((zend *3600 -a)%3600) /60;\n", + "c=( zend *3600 - b*60 -a) /3600;\n", + "print \" zenith distance \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n", + "\n", + "#for altitude\n", + "\n", + "b= ((alt *3600 )%3600) /60;\n", + "c=( alt *3600 - b*60 -a) /3600;\n", + "print \" altitude of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " zenith distance 0.0 seconds 20.0 minutes 3.0 degrees\n", + " altitude of star 0.0 seconds 40.0 minutes 86.0 degrees\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.6.3,Page 37" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "delta =65+40.0/60; # declination of star\n", + "theta =26+40.0/60; # lattude of star\n", + "\n", + "#caculation\n", + "zend =90.0 - theta -90+ delta ;\n", + "alt =90.0 - zend ;\n", + "\n", + "#for zenith distance\n", + "a= zend *3600 %60;\n", + "b= ((zend *3600 -a)%3600) /60;\n", + "c=( zend *3600 - b*60 -a) /3600;\n", + "print \" zenith distance \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n", + "\n", + "#for altitude\n", + "a= alt *3600 %60;\n", + "b= ((alt *3600 -a)%3600) /60;\n", + "c=( alt *3600 - b*60 -a) /3600;\n", + "print \" altitude of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " zenith distance 0.0 seconds 0.0 minutes 39.0 degrees\n", + " altitude of star 0.0 seconds 0.0 minutes 51.0 degrees\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.7,Page 37" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "delta =85+20.0/60; # declination of star\n", + "theta =46+50.0/60; # lattude of star\n", + "\n", + "#caculation\n", + "zend =90.0 - theta +90- delta ;\n", + "alt =90.0 - zend ;\n", + "\n", + "#for zenith distance\n", + "\n", + "b= ((zend *3600 )%3600) /60;\n", + "c=( zend *3600 - b*60 -a) /3600;\n", + "print \" zenith distance \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n", + "\n", + "#for altitude\n", + "a= alt *3600 %60;\n", + "b= ((alt *3600 -a)%3600) /60;\n", + "c=( alt *3600 - b*60 -a) /3600;\n", + "print \" altitude of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " zenith distance 0.0 seconds 50.0 minutes 47.0 degrees\n", + " altitude of star 0.0 seconds 10.0 minutes 42.0 degrees\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.8,Page 38" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "delta =56+10.0/60; # declination of star\n", + "theta =56+10.0/60; # lattude of star\n", + "\n", + "#caculation\n", + "zend =90.0 - theta +90- delta ;\n", + "alt =90.0 - zend ;\n", + "\n", + "#for zenith distance\n", + "a= zend *3600 %60;\n", + "b= ((zend *3600-a )%3600) /60;\n", + "c=( zend *3600 - b*60 -a) /3600;\n", + "print \" zenith distance \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n", + "\n", + "#for altitude\n", + "#a= alt *3600 %60;\n", + "b= ((alt *3600 )%3600) /60;\n", + "c=( alt *3600 - b*60 -a) /3600;\n", + "print \" altitude of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " zenith distance 0.0 seconds 40.0 minutes 67.0 degrees\n", + " altitude of star 0.0 seconds 20.0 minutes 22.0 degrees\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.9,Page 38" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "import numpy as np\n", + "a=np.array([[1.0,-1.0],[1.0,1.0]])\n", + "b=np.array([59.0/3,332.0/3])\n", + "\n", + "#calculation\n", + "x=np.linalg.solve(a,b);\n", + "\n", + "#result\n", + "print\"declination of star in (degrees)\",round(x[0],3);\n", + "print\"latitude of the place of observation (degrees)\",x[1];" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "declination of star in (degrees) 65.167\n", + "latitude of the place of observation (degrees) 45.5\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.10,Page 39" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "theta =20+30.0/60;\n", + "H =42+6.0/60; # hour angle\n", + "delta =50.0;\n", + "\n", + "\n", + "# in triangle ZPM\n", + "\n", + "#calculation\n", + "PZ =(90 - delta )*pi /180;\n", + "H=H*pi /180;\n", + "PM =(90 - theta )*pi /180;\n", + "ZM= acos (( cos (PZ)* cos (PM)+sin(PM)*sin(PZ)* cos (H)));\n", + "alpha =pi /2- ZM;\n", + "alpha = alpha *180/ pi;\n", + "A =(( cos(PM)-cos (PZ)* cos (ZM))/ sin (PZ)/sin(ZM));\n", + "\n", + "if A <0:\n", + " A=-A;\n", + " A=acos(A)\n", + " A=180-A*180/pi;\n", + " \n", + "\n", + "#for altitude\n", + "alt=alpha;\n", + "a= alt *3600 %60;\n", + "b=((alt *3600-a )%3600) /60;\n", + "c=( alt *3600 - b*60 -a) /3600;\n", + "print \" altitude of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n", + "\n", + "\n", + "#for azimuth \n", + "a= A *3600 %60;\n", + "b= ((A *3600-a )%3600) /60;\n", + "c=( A *3600 - b*60 -a) /3600;\n", + "print\" azimuth of star in (degrees ) westwards \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " altitude of star 36.75 seconds 38.0 minutes 45.0 degrees\n", + " azimuth of star in (degrees ) westwards 25.551 seconds 4.0 minutes 116.0 degrees\n" + ] + } + ], + "prompt_number": 32 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.11,Page 40" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "theta = -8 -30.0/60;\n", + "H =322.0; # hour angle\n", + "delta =50;\n", + "\n", + "\n", + "# in triangle ZPM\n", + "\n", + "#calculation\n", + "PZ =(90 - delta )*pi /180;\n", + "H =2* pi -H*pi /180;\n", + "PM =(90 - theta )*pi /180;\n", + "ZM= acos (( cos (PZ)* cos (PM)+sin(PM)*sin(PZ)* cos (H)));\n", + "alpha =pi /2- ZM;\n", + "alpha=alpha*180/pi;\n", + "A =(( cos(PM)-cos (PZ)* cos (ZM))/ sin (PZ)/sin(ZM));\n", + "\n", + "if A <0:\n", + " A=-A;\n", + " A=acos(A)\n", + " A=180-A*180/pi;\n", + " \n", + "#result\n", + "#for altitude\n", + "alt=alpha;\n", + "a= alt *3600 %60;\n", + "b=((alt *3600-a )%3600) /60;\n", + "c=( alt *3600 - b*60 -a) /3600;\n", + "print \" altitude of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n", + "\n", + "\n", + "#for azimuth \n", + "a= A *3600 %60;\n", + "b= ((A *3600-a )%3600) /60;\n", + "c=( A *3600 - b*60 -a) /3600;\n", + "print\" azimuth of star in (degrees ) eastwards \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " altitude of star 48.256 seconds 48.0 minutes 22.0 degrees\n", + " azimuth of star in (degrees ) eastwards 22.798 seconds 39.0 minutes 138.0 degrees\n" + ] + } + ], + "prompt_number": 31 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.12,Page 42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "alpha =22+36.0/60; # altitude of star\n", + "A =42.0 # azimuth angle\n", + "delta =40.0; # latitude of observer\n", + "\n", + "# in triangle ZPM\n", + "\n", + "#calculation\n", + "PZ =(90 - delta )*pi /180;\n", + "A=A*pi /180;\n", + "ZM =(90 - alpha )*pi /180;\n", + "PM= acos (( cos (PZ)* cos (ZM)+sin(ZM)*sin(PZ)* cos (A)));\n", + "theta =pi /2- PM\n", + "theta=theta*180/pi;\n", + "H =(( cos(ZM)-cos (PZ)* cos (PM))/ sin (PZ)/sin(PM));\n", + "if H <0:\n", + " H=-H;\n", + " H=acos(H)\n", + " H=180-H*180/pi;\n", + " \n", + "\n", + "#result\n", + "#for declination \n", + "alt=theta;\n", + "a= alt *3600 %60;\n", + "b=((alt *3600-a )%3600) /60;\n", + "c=( alt *3600 - b*60 -a) /3600;\n", + "print \" declination of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n", + "\n", + "#for hour angle\n", + "a= H *3600 %60;\n", + "b= ((H *3600-a )%3600) /60;\n", + "c=( H *3600 - b*60 -a) /3600;\n", + "print\" hour angle of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " declination of star 12.44 seconds 35.0 minutes 50.0 degrees\n", + " hour angle of star 5.342 seconds 21.0 minutes 103.0 degrees\n" + ] + } + ], + "prompt_number": 34 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.13,Page 42" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "alpha =21+30.0/60; # a l t i t u d e o f s t a r\n", + "A =140.0 # azimuth a n g l e\n", + "delta =48.0; # l a t i t u d e o f o b s e r v e r\n", + "\n", + "#calculation\n", + "PZ =(90 - delta )*pi /180;\n", + "A=A*pi /180;\n", + "ZM =(90 - alpha )*pi /180;\n", + "PM =( cos(PZ)*cos(ZM)+ sin (ZM)* sin (PZ)* cos (A));\n", + "\n", + "if PM <0:\n", + " PM=-PM\n", + " PM=acos(PM)\n", + " PM=180-PM*180/pi;\n", + "\n", + "H= acos (( cos (ZM)-cos(PZ)*cos(PM*pi /180) )/ sin (PZ)/sin (PM*pi /180) );\n", + "H =2* pi -H;\n", + "H=H*180/pi;\n", + "\n", + "#result\n", + "#for declination \n", + "alt=PM-90;\n", + "a= alt *3600 %60;\n", + "b=((alt *3600-a )%3600) /60;\n", + "c=( alt *3600 - b*60 -a) /3600;\n", + "print \" declination of star southwards \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";\n", + "\n", + "#for hour angle\n", + "a= H *3600 %60;\n", + "b= ((H *3600-a )%3600) /60;\n", + "c=( H *3600 - b*60 -a) /3600;\n", + "print\" hour angle of star \",round(a,3),\"seconds\",b,\"minutes\",c,\"degrees\";" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " declination of star southwards 12.098 seconds 48.0 minutes 11.0 degrees\n", + " hour angle of star 22.619 seconds 20.0 minutes 322.0 degrees\n" + ] + } + ], + "prompt_number": 44 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.14,Page 43" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = (md - m) * 60\n", + " sd=round(sd,2)\n", + " return [d, m, sd]\n", + "# part 1\n", + "delta =22+12.0/60;\n", + "theta =42+30.0/60;\n", + "\n", + "#calculation\n", + "ZP =(90 - theta )*pi /180;\n", + "PM =(90 - delta )*pi /180;\n", + "A= acos ( cos (PM)/sin(ZP));\n", + "H=180 - acos ( tan (pi /2- ZP)*tan(pi /2- PM)) *180/ pi\n", + "A=deg_to_dms(A*180/ pi);\n", + "H=deg_to_dms(H/15);\n", + "\n", + "#result\n", + "print \" azimuth of setting sun in ( degrees,min,second) \",A\n", + "print \" suns hour angle in ( hr,min,second ) : \",H\n", + "\n", + "#part 2\n", + "delta = -22 -12/60;\n", + "theta =42+30.0/60;\n", + "\n", + "#calculation\n", + "ZP =(90 - theta )*pi /180;\n", + "PM =(90 - delta )*pi /180;\n", + "A= acos ( cos (PM)/sin(ZP));\n", + "H=180 - acos ( tan (pi /2- ZP)*tan(pi /2- PM)) *180/ pi\n", + "A=deg_to_dms(A*180/ pi);\n", + "H=deg_to_dms(H/15);\n", + "\n", + "#result\n", + "print \" azimuth of setting sun in ( degrees,min,second) \",A\n", + "print \" suns hour angle in ( hr,min,second ) : \",H" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " azimuth of setting sun in ( degrees,min,second) [59, 10, 14.72]\n", + " suns hour angle in ( hr,min,second ) : [7, 27, 50.23]\n", + " azimuth of setting sun in ( degrees,min,second) [120, 32, 13.17]\n", + " suns hour angle in ( hr,min,second ) : [4, 33, 4.97]\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.15,Page 44" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "delta =22+12.0/60;\n", + "theta =42+30.0/60;\n", + "ef deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = (md - m) * 60\n", + " sd=round(sd,2)\n", + " return [d, m, sd]\n", + "\n", + "#calculation\n", + "ZP =(90 - theta )*pi /180;\n", + "PM =(90 - delta )*pi /180;\n", + "A= acos ( cos (PM)/sin(ZP));\n", + "H=180 - acos ( tan (pi /2- ZP)*tan(pi /2- PM)) *180/ pi\n", + "A=deg_to_dms(180-A*180/ pi);\n", + "H=deg_to_dms(H/15);\n", + "\n", + "#result\n", + "print \" azimuth of setting sun in ( degrees,min,second) \",A\n", + "print \" suns hour angle in ( hr,min,second ) : \",H\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " azimuth of setting sun in ( degrees,min,second) [120, 49, 45.28]\n", + " suns hour angle in ( hr,min,second ) : [7, 27, 50.23]\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.16,Page 61" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "time = -3 -28.41/60; # greenwich time at july 1 1951\n", + "change = -11.82/60;\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = (md - m) * 60\n", + " sd=round(sd,2)\n", + " return [d, m, sd]\n", + "\n", + "#calculation\n", + "c12 = change/24*12 # change of time in 12 hours\n", + "tch =time +c12;\n", + "tch=deg_to_dms(tch/60);\n", + "\n", + "#result\n", + "print \" greenwich mean time error in 12 th hour(-ve) in( deg,min,sec) \",tch\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " greenwich mean time error in 12 th hour(-ve) in( deg,min,sec) [0, 3, 34.32]\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.17,Page 61" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = (md - m) * 60\n", + " return [d, m, sd]\n", + "#printing result in degree minute and seconds respectively \n", + "GMN = -14*60 -10;\n", + "changeET =1*1.5;\n", + "\n", + "#calculation\n", + "neterr =GMN+ changeET ;\n", + "GAT = time + neterr ;\n", + "GAT=GAT+10*3600+30*60;\n", + "hr= round ( GAT /3600) ;\n", + "b=GAT -hr *3600;\n", + "mi= round (b /60 -1);\n", + "c=GAT -hr *3600 - mi *60;\n", + "\n", + "#result\n", + "print hr,\"hour\",mi,\"minutes\",c,\"seconds of GAT\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "10.0 hour 15.0 minutes 48.0265 seconds of GAT\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.18,Page 62" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#part1\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = (md - m) * 60\n", + " return [d, m, sd]\n", + "A =50+12.0/60+48.0/3600;\n", + "time =A /15*3600\n", + "\n", + "#calculation\n", + "hr= round ( time /3600) ;\n", + "b=time -hr *3600;\n", + "mi= round (b /60 -1);\n", + "c=time -hr *3600 - mi *60;\n", + "\n", + "#result\n", + "print hr,\"hour\",mi,\"minutes\",c,\"seconds of angles\"\n", + "\n", + "#part 2\n", + "#initialisation of variable\n", + "A =8+18.0/60+6.0/3600;\n", + "time =A /15*3600\n", + "\n", + "#calculation\n", + "hr= round ( time /3600-1) ;\n", + "b=time -hr *3600;\n", + "mi= round (b /60 );\n", + "c=time -hr *3600 - mi *60;\n", + "\n", + "#result\n", + "print hr,\"hour\",mi,\"minutes\",c,\"seconds of angles\"\n", + "\n", + "#part 3\n", + "#initialisation of variable\n", + "A =258+36.0/60+30.0/3600;\n", + "time =A /15*3600\n", + "\n", + "#calculation\n", + "hr= round ( time /3600) ;\n", + "b=time -hr *3600;\n", + "mi= round (b /60 );\n", + "c=time -hr *3600 - mi *60;\n", + "\n", + "#result\n", + "print hr,\"hour\",mi,\"minutes\",c,\"seconds of angles\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "3.0 hour 20.0 minutes 51.2 seconds of angles\n", + "-0.0 hour 33.0 minutes 12.4 seconds of angles\n", + "17.0 hour 14.0 minutes 26.0 seconds of angles\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.19,Page 62" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#part1\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "A =4+34.0/60+13.0/3600;\n", + "\n", + "#calculation\n", + "angle =A *15;\n", + "angle=deg_to_dms(angle);\n", + "\n", + "#result\n", + "print \"angle in degree,minute,second respectively\",angle\n", + "\n", + "#part 2\n", + "#initialisation of variable\n", + "A =18+11.0/60+38.0/3600;\n", + "\n", + "#calculation\n", + "angle =A *15;\n", + "angle=deg_to_dms(angle);\n", + "\n", + "#result\n", + "print \"angle in degree,minute,second respectively\",angle\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "angle in degree,minute,second respectively [68, 33, 15.0]\n", + "angle in degree,minute,second respectively [272, 54, 30.0]\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.20.a,Page 64" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "longP =20 # longitude of the place\n", + "longSM =82+30.0/60; # longitude of standard meridion\n", + "\n", + "#calculation\n", + "dolong =longSM - longP ; # difference in longitude\n", + "dot = dolong /15.0; # difference in time\n", + "LMT =20+24.0/60+6.0/3600 - dot ;\n", + "LMT=deg_to_dms(LMT)\n", + "\n", + "#result\n", + "print \"LMT in hours,minute,second respectively\",LMT" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[16, 14, 6.0] Local mean time in hours,minute,second respectively\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.20.b,Page 64" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "longP =-20 # longitude of the place\n", + "longSM =82+30.0/60; # longitude of standard meridion\n", + "\n", + "#calculation\n", + "dolong =longSM - longP ; # difference in longitude\n", + "dot = dolong /15.0; # difference in time\n", + "LMT =20+24.0/60+6.0/3600 - dot ;\n", + "LMT=deg_to_dms(LMT)\n", + "\n", + "#result\n", + "print \"LMT in hours,minute,second respectively\",LMT" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[13, 34, 6.0] Local mean time in hours,minute,second respectively\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.21.a,Page 64" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "LMT =9+40.0/60+12.0/3600;\n", + "longP = -42 -36.0/60;\n", + "\n", + "#calculation\n", + "dot = longP /15;\n", + "GMT =LMT -dot;\n", + "GMT=deg_to_dms(GMT);\n", + "\n", + "#result\n", + "print \"GMT in hours,minute,second respectively\",GMT" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[12, 30, 36.0] GMT in hours,minute,second respectively\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.21.b,Page 64" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "LMT =4+32.0/60+10.0/3600;\n", + "longP = -56 -32.0/60;\n", + "\n", + "#calculation\n", + "dot = longP /15;\n", + "GMT =LMT +dot;\n", + "GMT=deg_to_dms(GMT);\n", + "\n", + "#result\n", + "print \"GMT in hours,minute,second respectively\",GMT" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[0, 46, 2.0] GMT in hours,minute,second respectively\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.22,Page 65" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "#part1\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "GCT =18+40.0/60+12.0/3600; # greenwich civil time\n", + "longP =72+30.0/60; # longitude of the place\n", + "\n", + "#calculation\n", + "dot = longP /15.0;\n", + "LMT = GCT +dot;\n", + "LMT=deg_to_dms(LMT);\n", + "\n", + "#result\n", + "print \"LMT in hours,minute,second respectively\",LMT\n", + "\n", + "#part 2\n", + "#initiallisation of variable\n", + "GCT =18+40.0/60+12.0/3600; # greenwich civil time\n", + "longP =-72-30.0/60; # longitude of the place\n", + "\n", + "#calculation\n", + "dot = longP /15.0;\n", + "LMT = GCT +dot;\n", + "LMT=deg_to_dms(LMT);\n", + "\n", + "#result\n", + "print \"LMT in hours,minute,second respectively\",LMT\n", + "\n", + "#part 3\n", + "#initialisation of variable\n", + "def deg_to_dms(deg):\n", + " d = int(deg);\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d-24, m, sd]\n", + "GCT =18+40.0/60+12.0/3600; # greenwich civil time\n", + "longP =110+32.0/60; # longitude of the place\n", + "\n", + "#calculation\n", + "dot = longP /15.0;\n", + "LMT = GCT +dot;\n", + "LMT=deg_to_dms(LMT);\n", + "\n", + "#result\n", + "print \"LMT of next day in hours,minute,second respectively\",LMT" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "LMT in hours,minute,second respectively [23, 30, 12.0]\n", + "LMT in hours,minute,second respectively [13, 50, 12.0]\n", + "LMT of next day in hours,minute,second respectively [2, 2, 20.0]\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.23,Page 66" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "LMT =10+20.0/60+30.0/3600; # local mean time\n", + "longP =102+30.0/60; # longitude of the place\n", + "\n", + "#calculation\n", + "dot = longP /15;\n", + "GMT =LMT -dot;\n", + "mGMN =12 - GMT ; #mean time interval\n", + "i= mGMN *0.32/3600; # increase in mGMN\n", + "ETGMN =5.0/60+4.35/3600;\n", + "ch=i+ ETGMN ; # change in GMT\n", + "GMT =ch+GMT;\n", + "LMT = GMT +dot;\n", + "LMT=deg_to_dms(LMT);\n", + "\n", + "#result\n", + "print \"LMT in hours,minute,second respectively\",LMT" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[10, 25, 37.07] LMT in hours,minute,second respectively\n" + ] + } + ], + "prompt_number": 27 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.24,Page 67" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "LMT =15+12.0/60+40.0/3600; # local mean time\n", + "longP = -20 -30.0/60; # longitude of the place\n", + "\n", + "#calculation\n", + "dot = longP /15;\n", + "GMT =LMT -dot;\n", + "mGMN =12 - GMT ; #mean time interval\n", + "i= mGMN *0.32/3600; # increase in mGMN\n", + "ETGMN =5.0/60+4.35/3600;\n", + "ch=i+ ETGMN ; # change in GMT\n", + "GMT =ch+GMT;\n", + "LMT = GMT +dot;\n", + "LMT=deg_to_dms(LMT);\n", + "\n", + "#result\n", + "print \"LMT in hours,minute,second respectively\",LMT" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[15, 17, 42.89] LMT in hours,minute,second respectively\n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.25,Page 70" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "time =4+20.0/60+30.0/3600;\n", + "\n", + "#calculation\n", + "accn = time *9.8565/3600; # acceleration\n", + "stime = time + accn ; # sidereal time\n", + "stime=deg_to_dms(stime);\n", + "\n", + "#result\n", + "print \"sidereal time in hours,minute,second respectively\",stime" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[4, 21, 12.79] sidereal time in hours,minute,second respectively\n" + ] + } + ], + "prompt_number": 30 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.26,Page 71" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "stime =8+40.0/60+50.0/3600;\n", + "\n", + "#calcculation\n", + "accn =-time *9.8565/3600; # acceleration\n", + "mtime = stime + accn ; # mean time\n", + "mtime=deg_to_dms(mtime);\n", + "\n", + "#result\n", + "print \"mean time in hours,minute,second respectively\",mtime" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[8, 40, 7.21] mean time in hours,minute,second respectively\n" + ] + } + ], + "prompt_number": 32 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.27,Page 72" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "longP = -160 -30.0/60 -30.0/3600; # longitude of the place\n", + "GST =16+30.0/60+12.0/3600; # standard time\n", + "\n", + "#calculation\n", + "dot = longP /15; # difference in time\n", + "i= dot *9.8565/3600; # error\n", + "LST =GST -i;\n", + "LST=deg_to_dms(LST);\n", + "\n", + "#result\n", + "print \"LST of LMM in hours,minute,second respectively\",LST\n", + "\n", + "#part 2\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "longP = 160 +30.0/60 +30.0/3600; # longitude of the place\n", + "GST =16+30.0/60+12.0/3600; # standard time\n", + "\n", + "#calculation\n", + "dot = longP /15; # difference in time\n", + "i= dot *9.8565/3600; # error\n", + "LST =GST -i;\n", + "LST=deg_to_dms(LST);\n", + "\n", + "#result\n", + "print \"LST of LMM in hours,minute,second respectively\",LST\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[16, 31, 57.47] LST of LMM in hours,minute,second respectively\n", + "[16, 28, 26.53] LST of LMM in hours,minute,second respectively\n" + ] + } + ], + "prompt_number": 34 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.28,Page 73" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "longP =85+20.0/60; # longitude of the place\n", + "GST =6+30.0/60; # standard time\n", + "GMN =6+32.0/60+12.0/3600;\n", + "\n", + "#calculation\n", + "dot = longP /15; # difference in time\n", + "i= dot *9.8565/3600; # error\n", + "LST =GMN -i; #LST at L .M.N\n", + "i2=GST *9.8565/3600; # error in GST\n", + "LST2 =GST+i2;\n", + "LST = LST + LST2 # lst at L .M.N\n", + "LST=deg_to_dms(LST);\n", + "\n", + "#result\n", + "print \"LST in hours,minute,second respectively\",LST" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[13, 2, 19.99] LST in hours,minute,second respectively\n" + ] + } + ], + "prompt_number": 38 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.29,Page 75" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "longP =112+20.0/60+15.0/3600; # longitude of the place\n", + "GST =8+10.0/60+28.0/3600; #GST at GMM\n", + "lst =18+28.0/60+12.0/3600; \n", + "\n", + "#calculation\n", + "dot = longP /15; \n", + "i= dot *9.8565/3600; # error\n", + "LST = GST +i; #LST at L .M.N\n", + "LMM =lst -LST;\n", + "i2=LMM *9.8565/3600; # error in LMM\n", + "LMT =LMM -i2; # local mean time\n", + "LMT=deg_to_dms(LMT);\n", + "\n", + "#result\n", + "print \"LMT in hours,minute,second respectively\",LMT" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[10, 14, 48.91] LMT in hours,minute,second respectively\n" + ] + } + ], + "prompt_number": 40 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.30,Page 76" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "longP =85+20.0/60; # longitude of the place\n", + "GST =18+30.0/60; # standard time\n", + "gst =6+32.0/60+12.0/3600; #GST at GMN\n", + "\n", + "#calculation\n", + "dot = longP /15; \n", + "GMT =GST -dot -12;\n", + "i= GMT *9.8565/3600; # error\n", + "GMT = GMT +i; # SI time\n", + "LST = GMT +dot+ gst ; #LST at LMT\n", + "LST=deg_to_dms(LST);\n", + "\n", + "#result\n", + "print \"LST in hours,minute,second respectively\",LST" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[13, 2, 19.99] LST in hours,minute,second respectively\n" + ] + } + ], + "prompt_number": 42 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.31,Page 78" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "longP =112+20.0/60+15.0/3600; # longitude of the place\n", + "GST =8+10.0/60+28.0/3600; #GST at GMM\n", + "lst =18+28.0/60+12.0/3600; # local sidereal time\n", + "\n", + "#clculation\n", + "dot = longP /15; \n", + "gmm = lst +dot - GST ; # SI at GMM\n", + "i= gmm *9.8565/3600; # error\n", + "gmm =gmm -i; #LST at L .M.N\n", + "LMT =gmm -dot; # local mean time\n", + "LMT=deg_to_dms(LMT);\n", + "\n", + "#result\n", + "print \"LMT in hours,minute,second respectively\",LMT\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[10, 14, 48.7] LMT in hours,minute,second respectively\n" + ] + } + ], + "prompt_number": 44 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.32,Page 79" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#part 1\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "longP =162+30.0/60+15.0/3600; # longitude of the place\n", + "GST =10+30.0/60+15.0/3600; #GST at GMM\n", + "RA =22+11.0/60+30.0/3600; # local sidereal time\n", + "\n", + "#calculation\n", + "dot = longP /15; \n", + "i= dot *9.8565/3600; # e r r o r\n", + "gmm = GST +i; #LST at L .M.N\n", + "lmn =RA -gmm; # SI o f LMN\n", + "i2=lmn *9.8565/3600; # error 2\n", + "LMT =lmn -i2;\n", + "LMT1=deg_to_dms(LMT);\n", + "\n", + "#result\n", + "print \"LMT observed at upper transit in hours,minute,second respectively\",LMT1\n", + "\n", + "#part 2\n", + "#initialisation of variable\n", + "i3 =12*9.8565/3600; # retardation\n", + "\n", + "#calculation\n", + "LMT = LMT +12 - i3;\n", + "LMT=deg_to_dms(LMT);\n", + "\n", + "#result\n", + "print \"LMT observed at lower transit in hours,minute,second respectively\",LMT" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "LMT observed at upper transit in hours,minute,second respectively [11, 37, 33.31]\n", + "LMT observed at lower transit in hours,minute,second respectively [23, 35, 35.04]\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.33,Page 80" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "longP =60+30.0/60; # longitude of the place\n", + "GST =7+30.0/60+48.6/3600; #GST at GMM\n", + "RA =17+28.0/60 +40.0/1600;\n", + "\n", + "#calculation\n", + "dot = longP /15; \n", + "i= dot *9.8565/3600; # error\n", + "gmm =GST -i; #LST at L .M.N\n", + "LMT =RA -gmm; # local mean time\n", + "i2=LMT*9.8296/3600;\n", + "GMT=LMT-i2-longP/15;\n", + "LMT=deg_to_dms(LMT);\n", + "GMT=deg_to_dms(GMT);\n", + "\n", + "#result\n", + "print \"LMT in hours,minute,second respectively\",LMT\n", + "print \"GMT in hours,minute,second respectively\",GMT" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "LMT in hours,minute,second respectively [9, 59, 21.15]\n", + "GMT in hours,minute,second respectively [5, 55, 42.96]\n" + ] + } + ], + "prompt_number": 42 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.34,Page 82" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "GMT=13+21.0/60+54.0/3600; #GMT of the place\n", + "LongA=40+30.0/60; #longitude of A\n", + "LongB=-40-30.0/60; #longitude of B\n", + "\n", + "#calculation\n", + "delA=LongA/15.0*9.8296/3600;#error\n", + "delB=LongB/15.0*9.8296/3600;#error\n", + "GA=GMT+delA;\n", + "GA=deg_to_dms(GA);\n", + "GB=GMT+delB;\n", + "GB=deg_to_dms(GB);\n", + "\n", + "#result\n", + "print \"corected time of A in hours,minute,second respectively\",GA\n", + "print \"corected time of B in hours,minute,second respectively\",GB" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "corected time of A in hours,minute,second respectively [13, 22, 20.54]\n", + "corected time of B in hours,minute,second respectively [13, 21, 27.46]\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.35,Page 83" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "GMT=7+12.0/60+28.0/3600; #GMT of the place\n", + "Long=50+30.0/60; #longitude \n", + "LMT=11+30.0/60+12.0/3600; \n", + "\n", + "#calculation\n", + "delA=LongA/15.0*9.8296/3600;#error\n", + "delB=LMT*9.8296/3600;#error\n", + "LA=GMT+delA; #LMT at transit\n", + "LMT=LMT-delB;\n", + "LMT=LMT+LA;\n", + "LMT=deg_to_dms(LMT);\n", + "\n", + "#result\n", + "print \"LMT in hours,minute,second respectively\",LMT" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "LMT in hours,minute,second respectively [18, 41, 13.47]\n" + ] + } + ], + "prompt_number": 41 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.36,Page 84" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "GST=8+25.0/60+25.0/3600;\n", + "\n", + "#calculation\n", + "GMT=24-GST;\n", + "i=GMT*9.8296/3600;\n", + "GMT=GMT-i;\n", + "GMT=deg_to_dms(GMT);\n", + "\n", + "#result\n", + "print \"GMT in hours,minute,second respectively\",GMT" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "GMT in hours,minute,second respectively [15, 32, 1.89]\n" + ] + } + ], + "prompt_number": 43 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.37,Page 85" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "GMT=12+03.0/60+46.09/3600; #GMT of the place\n", + "LongA=-130.0; #longitude of A\n", + "LongB=49.0; #longitude of B\n", + "\n", + "#calculation\n", + "delA=LongA/15.0*11.71/24/3600;\n", + "delB=LongB/15.0*11.71/24/3600;\n", + "LMTA=GMT+delA;\n", + "LMTA=deg_to_dms(LMTA);\n", + "LMTB=GMT+delB;\n", + "LMTB=deg_to_dms(LMTB);\n", + "\n", + "#result\n", + "print \"LMT at A on July 2 in hours,minute,second respectively\",LMTA\n", + "print \"LMT at B on July 2 in hours,minute,second respectively\",LMTB" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[12, 3, 41.86] LMT at A in hours,minute,second respectively\n", + "[12, 3, 47.68] LMT at B in hours,minute,second respectively\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.38,Page 86" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "Lat=50+30.0/60; # latitude of place\n", + "Dec=74+22/60; #declination of place\n", + "RA=14+50.0/60+52.0/3600;\n", + "\n", + "#calculation\n", + "H=acos(tan(Lat*pi/180)/tan(Dec*pi/180));\n", + "H=H*180/pi;\n", + "H=H/15.0;\n", + "LST=H+RA;\n", + "LST=deg_to_dms(LST);\n", + "\n", + "#result \n", + "print \"LST in hours,minute,second respectively\",LST" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[19, 29, 26.59] LST in hours,minute,second respectively\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.39,Page 87" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "Long=120+30.0/60; #langitude\n", + "GST=14+30.0/60+28.25/3600;\n", + "GMT=2+5.0/60;\n", + "LMN=12.0;\n", + "LST=14+31.0/60+47.43/3600;\n", + "RA=23+20.0/60+20.0/3600;\n", + "\n", + "#calculation\n", + "e1=Long*15.0*9.8565/3600;\n", + "GST=GST+e1;\n", + "LMT=GMT+24-8-2.0/60;\n", + "LMM=LMN+24-LMT; #mean LMN\n", + "e2=LMM*9.8565/3600;\n", + "LMM=LMM+e2;\n", + "LST=LST+24-LMM;\n", + "HA=LST-RA+24;\n", + "HA=deg_to_dms(HA);\n", + "\n", + "#result\n", + "print \"HA in hours,minutes,seconds respectively\",HA" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[21, 11, 30.51] HA in hours,minutes,seconds respectively\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.40,Page 86" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "Long=75+28.0/60; #langitude\n", + "LMT=5+30.0/60;\n", + "GST=20+15.0/60+32.58/3600;\n", + "\n", + "#calculation\n", + "e1=Long/15.0*9.8565/3600;\n", + "GST=GST+e1;\n", + "e2=LMT*9.8565/3600;\n", + "LMT=LMT+e2;\n", + "HA=GST+LMT;\n", + "HAMS=HA-LMT-12+e2;\n", + "HA=deg_to_dms(HA);\n", + "HAMS=deg_to_dms(HAMS);\n", + "\n", + "#result\n", + "print \"HA in hours,minutes,seconds respectively\",HA\n", + "print \"HAMS in hours,minutes,seconds respectively\",HAMS\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "HA in hours,minutes,seconds respectively [25, 47, 16.38]\n", + "HAMS in hours,minutes,seconds respectively [8, 17, 16.38]\n" + ] + } + ], + "prompt_number": 40 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.41,Page 90" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "Long=45.0; #langitude\n", + "del1=1067.2/3600;\n", + "del2=1083.9/3600;\n", + "del3=1100.3/3600;\n", + "f0=-16-14.0/60-24.0/3600;\n", + "\n", + "#calculation\n", + "n=(10-Long/15)/24.0;\n", + "Del0=del2-del1;\n", + "Del1=del3-del2;\n", + "fn=-f0+n*del2+n*(n-1)/4*(Del0+Del1)\n", + "fn=deg_to_dms(fn);\n", + "\n", + "#result\n", + "print \"sun's declination in hours,minutes,seconds respectively\",fn" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "sun's declination in hours,minutes,seconds respectively [16, 19, 38.43]\n" + ] + } + ], + "prompt_number": 39 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.42,Page 101" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "aziA =32+41.0/60+30.0/3600; # azimuth o f A\n", + "aziB =110+28.0/60+42.0/3600; # azimuth o f B\n", + "vaA =10+21.0/60+12.0/3600; # vertical angle of A\n", + "vaB = -2 -18.0/60 -30.0/3600; # vertical angle o f B\n", + "lA1 =11;\n", + "lB1 =11.5;\n", + "rA1 =7.5;\n", + "rB1 =7;\n", + "lB2 =10;\n", + "lA2 =10.5;\n", + "rB2 =7.5;\n", + "rA2 =8;\n", + "d =20;\n", + "# partA\n", + "#calculation\n", + "sigl =lA1+ lA2 ;\n", + "sigr =rA1+ rA2 ;\n", + "b= sigl /4*d- sigr /4*d;\n", + "i= tan( vaA );\n", + "caziA = aziA +i *29.95/3600;\n", + "caziA1=deg_to_dms(caziA);\n", + "\n", + "#result\n", + "print \"corrected azimuth of A in (degrees,minutes,seconds)\",caziA1\n", + "\n", + "#part2 \n", + "#calculation\n", + "i= tan( vaB );\n", + "caziB = aziB +i*b /3600;\n", + "ha=caziB - caziA;\n", + "caziB=deg_to_dms(caziB);\n", + "ha=deg_to_dms(ha);\n", + "\n", + "#result\n", + "print \"corrected azimuth of B in (degrees,minutes,seconds)\",caziB\n", + "print \"horizontal difference of angle between A & B in (degrees,minutes,seconds)\",ha\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "corrected azimuth of A in (degrees,minutes,seconds) [32, 42, 10.04]\n", + "corrected azimuth of B in (degrees,minutes,seconds) [110, 29, 15.02]\n", + "horizontal difference of angle between A & B in (degrees,minutes,seconds) [77, 47, 4.98]\n" + ] + } + ], + "prompt_number": 38 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.43,Page 102" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "v1 =18+36.0/60+48.0/3600; # vertical angle 1\n", + "v2 =18+35.0/60+56.0/3600; # vertical angle 2\n", + "slm =28+36.0/60+20.0/3600; # altitude of sun measured\n", + "ds =15.0/60+59.35/3600; # dia of sun\n", + "\n", + "#calculation\n", + "mv =( v1+v2) /2; #mean vertical angle\n", + "i=v1 -v2; # error\n", + "sl=slm+i; #new altitude of sun\n", + "sl=sl+ds;\n", + "ir = -57.0/3600/( tan( slm *pi /180+26* pi /180/3600) );#error due to refraction\n", + "sl=sl+ir;\n", + "ip =8.8/3600* cos( slm *pi /180+26* pi /180/3600);# error due to parallex\n", + "sl=sl+ip;\n", + "sl=deg_to_dms(sl);\n", + "\n", + "#result\n", + "print \"corrected altitude in (deg,min,sec) respectively\",sl" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[28, 51, 34.59] corrected altitude in (deg,min,sec) respectively\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.44,Page 115" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "long =4+30.0/60;\n", + "i= long *9.8565/3600; # longitude\n", + "gst =14+38.0/60+12.0/3600; #GST on GMM\n", + "lst =gst -i; #LST on LMM\n", + "RA =7+36.0/60+21.24/3600;\n", + "\n", + "#calculation\n", + "LST =RA;\n", + "SI=LST - lst +24;\n", + "LCT =17+56.0/60+8.86/3600 -1; # local chronometer time\n", + "i2=SI *9.8296/3600;\n", + "LMM =SI -i2;\n", + "ce=LCT - LMM ;\n", + "\n", + "#result\n", + "print \" chronometer error in (s)\",round(ce *3600,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "2.19 chronometer error in (s)\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Exampe 1.45,Page 116" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "c =90 -36 -30.0/60 -30.0/3600; # co latitude\n", + "p =90 -16 -12.0/60 -18.4/3600; # co declination\n", + "z =90 -30 -12.0/60 -30.0/3600; # co altitude\n", + "s=(p+z+c) /2;\n", + "\n", + "#calculation\n", + "s1=s-c;\n", + "s2=s-p;\n", + "s3=s-z;\n", + "H =2* atan ( sqrt (sin(s1*pi /180) * sin (s2*pi /180) / sin (s*pi/180) / sin (s3*pi /180) ));\n", + "H=H *180/ pi;\n", + "H=24 -H /15;\n", + "LST =H +5+18.0/60+12.45/3600 -24;\n", + "ce =1+2.0/60+5.25/3600 - LST ;\n", + "\n", + "#result\n", + "print \" chronometer error in (s)\",round (ce *3600+2,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "19.34 chronometer error in (s)\n" + ] + } + ], + "prompt_number": 21 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1.46,Page 118" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "c =90 -36 -40.0/60 -30.0/3600; # co latitude\n", + "p =90 -17 -26.0/60 -42.1/3600; # co declination\n", + "z =90 -36 -14.0/60 -16.8/3600; # co altitude\n", + "\n", + "#calculation\n", + "s=(p+z+c) /2;\n", + "s1=s-c;\n", + "s2=s-p;\n", + "s3=s-z;\n", + "H =2* atan ( sqrt (sin(s1*pi /180) * sin (s2*pi /180) / sin(s*pi/180) / sin (s3*pi /180) ));\n", + "H=H *180/ pi;\n", + "H=H /15;\n", + "i =12 -11 -56.0/60 -22.8/3600; # error in time\n", + "LAT =15+49.0/60+40.6/3600; # local actual time\n", + "GAT =LAT -H;\n", + "GMT =GAT -i;\n", + "LMT = GMT +H;\n", + "ce =15+49.0/60+12.6/3600 - LMT;\n", + "ce=deg_to_dms(ce)\n", + "\n", + "#result\n", + "print \" chronometer error in (s)\",ce" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " chronometer error in (s) [0, 3, 9.2]\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.47,Page 119" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "RA =17+12.0/60+48.0/3600;\n", + "gst =9+26.0/60+12.0/3600; #GST on GMN\n", + "long =138.0/15+45.0/15/60; # l o n g i t u d e\n", + "lst =- long *9.85645/3600+9+26.0/60+12.0/3600; #LST on LMN\n", + "LST =17+12.0/60+48.0/3600; # local sidereal time\n", + "\n", + "#calculation\n", + "SI=LST - lst ;\n", + "MI=-SI *9.8296/3600+ SI;\n", + "LCT =7+47.0/60+2.0/3600; # local chronometer time\n", + "ce=LCT -MI;\n", + "\n", + "#result\n", + "print \" chronometer error in (s)\",round(ce *3600,2) " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " chronometer error in (s) 11.52\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.48,Page 145" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#part 1\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "theta =54+30.0/60; # l o g i t u d e\n", + "delta =62+12.0/60+21.0/3600; # d e c l i n a t i o n\n", + "\n", + "#calculation\n", + "lat = asin (sin( theta *pi /180) /sin( delta *pi /180) );\n", + "lat = lat *180/ pi;\n", + "lat=deg_to_dms(lat);\n", + "\n", + "#result\n", + "print \"Latitude in (deg,min,sec)\",lat;\n", + "\n", + "#part 2\n", + "#initialisation of variable\n", + "A =53+25.0/60; # azimuth of star\n", + "h =65+18.0/60+42.0/3600; # horizontal angle\n", + "\n", + "#calculation\n", + "A=A+h;\n", + "A=360-A;\n", + "A=deg_to_dms(A);\n", + "\n", + "#result\n", + "print \"Azimuth in (deg,min,sec)\",A;\n", + "\n", + "#part 3 \n", + "#initialisation of variable\n", + "lst =4+39.0/60+6.5/3600; #LST o f LMN\n", + "LST =10+58.0/60+38.0/3600+2+49.0/60+25.3/3600; #LST of observation\n", + "\n", + "#calculation\n", + "LMN =LST -lst;\n", + "i= LMN *9.8565/3600; # e r r o r\n", + "LMT =LMN -i;\n", + "LMT=deg_to_dms(LMT)\n", + "\n", + "#results\n", + "print \"LMT in (hr,min,sec)\",LMT;" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[66, 58, 7.13] Latitude in (deg,min,sec)\n", + "[241, 16, 18.0] Azimuth in (deg,min,sec)\n", + "[9, 7, 26.62] LMT in (hr,min,sec)\n" + ] + } + ], + "prompt_number": 34 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.49,Page 148" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#part 1\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "theta =53+32.0/60; # logitude\n", + "delta =56+42.0/60+53.2/3600; # declination\n", + "lat = asin (sin ( theta *pi /180) /sin( delta *pi /180) );\n", + "lat = lat *180/ pi;\n", + "lat=deg_to_dms(lat);\n", + "\n", + "#result\n", + "print \"Latitude in (deg,min,sec)\",lat;\n", + "\n", + "#part 2\n", + "#initialisation of variable\n", + "As= asin ( cos ( delta *pi /180) /cos ( theta *pi /180) ); #azimuth of star\n", + "h =75+18.0/60+20.0/3600; # angle between line and star\n", + "\n", + "#calculation\n", + "A=h-As *180/ pi;\n", + "A=360 -A;\n", + "A=deg_to_dms(A);\n", + "\n", + "#result\n", + "print \"Azimuth in (deg,min,sec)\",A;\n", + "\n", + "#part 3\n", + "#initialisation of variable\n", + "LST =10+58.0/60+3.9/3600+22+10.0/60+38.5/3600 -24; #LST of observation\n", + "long =5+40.0/60+18.0/3600; # longitude\n", + "\n", + "#calculation\n", + "i= long *9.8565/3600; # error\n", + "lst =4+58.0/60+23.84/3600+ i; #LST on LMN\n", + "LMM =LST -lst;\n", + "i2=LMM *9.8565/3600; # error in LMM\n", + "LMT =LMM -i2;\n", + "LMT=deg_to_dms(LMT)\n", + "\n", + "#results\n", + "print \"LMT in (hr,min,sec)\",LMT;\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Latitude in (deg,min,sec) [74, 9, 33.08]\n", + "Azimuth in (deg,min,sec) [352, 7, 3.66]\n", + "LMT in (hr,min,sec) [4, 8, 41.69]\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.50,Page 151" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "Long =(15.0+30.0/60); \n", + "GMT =19+12.0/60+28.6/3600;\n", + "GST=10+12.0/60+36.2/3600;\n", + "RA=10 +12.0/60 +6.3/3600;\n", + "theta=35.0;\n", + "delta=20+6.0/60+48.4/3600;\n", + "\n", + "#calculation\n", + "i= Long/15.0 *9.8656/3600; \n", + "LSTofLMM=GST-i;\n", + "LMT = GMT + Long/15.0 ;\n", + "i2=LMT *9.8656/3600; # error in LMT\n", + "SI = LMT +i2;\n", + "LST =LSTofLMM+ SI ;\n", + "H=LST-RA ; # hour angle\n", + "H=H *15;\n", + "H=360 -H;\n", + "B=atan(tan(delta*pi/180)/cos(H*pi/180));\n", + "B=B*180/pi;\n", + "x=B-theta; #defined as 'B-theta'\n", + "As= atan ( tan ((H) *pi /180) * cos((B) *pi /180) / sin ((x)*pi /180) );#calculating azimuth \n", + "h =36+28.0/60+18.0/3600; # angle between line and star\n", + "A =180+ As *180/ pi -h; #azimuth\n", + "A=deg_to_dms(A);\n", + "\n", + "#result\n", + "print \"Azimuth in (deg,min,sec)\",A;\n", + "print \"there is a miscalculation in the step of calculating As thus resulted in change in answer\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Azimuth in (deg,min,sec) [55, 16, 8.27]\n", + "there is a miscalculation in the step of calculating As thus resulted in change in answer\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.51,Page 153 " + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "alpha =33+35.0/60+10.0/3600; # altitude\n", + "ZM =90 - alpha ;\n", + "delta =22+5.0/60+35.0/3600; # declination\n", + "PM =90 - delta ;\n", + "theta =52+30.0/60+20.0/3600; # latitude\n", + "ZP =90 - theta ;\n", + "\n", + "#calculation\n", + "As= acos (( cos (PM*pi /180) -cos(ZP*pi /180) * cos (ZM*pi/180) )/( sin (ZP*pi /180) *sin(ZM*pi /180) ));\n", + "h =18+20.0/60+30.0/3600; # angle between line and star\n", + "A=As *180/ pi+h;\n", + "A=deg_to_dms(A);\n", + "\n", + "#result\n", + "print \"Azimuth in (deg,min,sec)\",A;" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Azimuth in (deg,min,sec) [115, 27, 19.68]\n" + ] + } + ], + "prompt_number": 35 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.52,Page 154" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#part 1\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "GAT =5+17.0/60+6.0/60; #GAT \n", + "delta =17+46.0/60+52.0/3600; # declination\n", + "\n", + "#calculation\n", + "i =37.0/3600* GAT ;\n", + "delta =delta -i;\n", + "delta1=deg_to_dms(delta);\n", + "\n", + "#result\n", + "print \"Declination in (deg,min,sec)\",delta1;\n", + "\n", + "#part 2\n", + "#initialisation of variable\n", + "p=90 - delta ; # co declination\n", + "altitude =23+15.0/60+20.0/3600; # altitude of sun\n", + "i2 =2.0/60+12.0/3600; # error due to refraction\n", + "i3 =8.0/3600; # error due to parallax\n", + "\n", + "#calculation\n", + "altitude = altitude -i2+i3;\n", + "c =90 -55 -46.0/60 -12.0/3600; # colatitude\n", + "z=90 - altitude ; # co altitude\n", + "s=(p+z+c) /2;\n", + "s1=s-c;\n", + "s2=s-p;\n", + "s3=s-z;\n", + "A =2* atan ( sqrt (sin(s3*pi /180) * sin (s1*pi /180) / sin (s*pi/180) / sin (s2*pi /180) ));\n", + "A=A *180/ pi;\n", + "A=deg_to_dms(A);\n", + "\n", + "#result\n", + "print \"Altitude in (deg,min,sec)\",A;" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Declination in (deg,min,sec) [17, 43, 32.82]\n", + "Altitude in (deg,min,sec) [92, 23, 10.67]\n" + ] + } + ], + "prompt_number": 34 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.53,Page 156" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "GMT =17+5.0/60+2.0/3600; \n", + "i =9.8565/3600* GMT;\n", + "GST =3+12.0/60+12.0/3600;\n", + "wl =1+18.0/60; # west longitude\n", + "RA =16+23.0/60+30.0/3600;\n", + "\n", + "#calculation\n", + "H= GMT +i+ GST +wl -RA; # hour angle\n", + "H=H *15;\n", + "p =90 -29 -52.0/60;\n", + "c =90 -52 -8.0/60;\n", + "z= acos ( cos (H*pi /180) * sin (p*pi /180) *sin(c*pi /180) + cos(p*pi /180) * cos (c*pi /180) );\n", + "A= asin ( sin (p*pi /180) * sin (H*pi /180) /sin(z));\n", + "A=A *180/ pi\n", + "A=deg_to_dms(A);\n", + "\n", + "#result\n", + "print \"Azimuth in (deg,min,sec)\",A;" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Azimuth in (deg,min,sec) [78, 38, 33.24]\n" + ] + } + ], + "prompt_number": 33 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.54,Page 157" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "c2 =24+30.0/60+20.0/3600;\n", + "d2 =24+30.0/60+40.0/3600;\n", + "c3 =25;\n", + "d3 =25+1.0/60;\n", + "\n", + "#calculation\n", + "alt =( c2+c3+d3+d2)/4;#mean observed altitude\n", + "il =(10.6 -9.4) /4*15.0/3600; # error \n", + "alt = alt +il;\n", + "ir = -57.0/3600/ tan (( alt *pi /180) ); # correction of refraction\n", + "ip =8.0/3600* cos (alt*pi /180) ; # correction of parallax\n", + "alt =alt -ir+ip;#altitude corrected\n", + "z=90 - alt;#ZM\n", + "delta =1+32.0/60+16.8/3600 -56.2/3600*(3.0/60+1.86/3600) ;#declination of sun\n", + "p=90 - delta ;#PM\n", + "c =90 -36 -48.0/60 -30.0/3600;#ZP\n", + "s=(p+z+c) /2;\n", + "s1=s-c;\n", + "s2=s-p;\n", + "s3=s-z;\n", + "A =2* atan ( sqrt (sin(s3*pi /180) * sin (s1*pi /180) / sin (s*pi/180) / sin (s2*pi /180) ));#azimuth calculation\n", + "A=A *180/ pi;\n", + "A=A +81+59.0/60+10.0/3600;\n", + "A=360 -A;\n", + "A=deg_to_dms(A);\n", + "\n", + "#result\n", + "print \"Azimuth in (deg,min,sec)\",A;\n", + "print \"there is a miscalculation in the step of calculating Azimuth and error due to refrection thus resulted in change in answer\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Azimuth in (deg,min,sec) [170, 1, 36.93]\n", + "there is a miscalculation in the step of calculating Azimuth and error due to refrection thus resulted in change in answer\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.55,Page 178" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "alpha =65+40.0/60+18.0/3600; # altitude\n", + "delta =53+12.0/60+10.0/3600; # declination\n", + "\n", + "#calculation\n", + "i =57.0/3600*1/ tan ( alpha *pi /180) ; \n", + "alpha =alpha -i;\n", + "z=90 - alpha ; # zenith distance\n", + "lat =delta -z;\n", + "lat=deg_to_dms(lat);\n", + "\n", + "#result\n", + "print \"Latitude in (deg,min,sec)\",lat" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[28, 52, 2.23] Latitude in (deg,min,sec)\n" + ] + } + ], + "prompt_number": 58 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.56,Page 178" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "alpha =64+36.0/60+20.0/3600; # altitude\n", + "delta =26+12.0/60+10.0/3600; # declination\n", + "\n", + "#calculation\n", + "i =57.0/3600*1/ tan ( alpha *pi /180) ; # error\n", + "alpha =alpha -i;\n", + "z=90 - alpha ; # zenith distance\n", + "lat = delta +z;\n", + "lat=deg_to_dms(lat);\n", + "\n", + "#result\n", + "print \"Latitude in (deg,min,sec)\",lat" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Latitude in (deg,min,sec) [51, 36, 17.06]\n" + ] + } + ], + "prompt_number": 31 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.57,Page 178" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "alpha =44+12.0/60+30.0/3600; # altitude\n", + "longP =75+20.0/60+15.0/3600; # longitude of place\n", + "delta =22+18.0/60+12.8/3600; # declination of sun\n", + "\n", + "#calculation\n", + "i =57.0/3600*1/ tan ( alpha *pi /180) ; # error\n", + "i2 =8.78/3600* cos( alpha ); #error due to parallax\n", + "i3 =15.0/60+45.86/3600; #error due to semi diameter\n", + "alpha =alpha -i+i2+i3;\n", + "z=90 - alpha ; # zenith distance\n", + "delT = longP /15;\n", + "i4 =6.82/3600* delT ; # error in time\n", + "delta =i4+ delta ;\n", + "lat = delta +z;\n", + "lat=deg_to_dms(lat);\n", + "\n", + "#result\n", + "print \"Latitude in (deg,min,sec)\",lat" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[67, 51, 21.23] Latitude in (deg,min,sec)\n" + ] + } + ], + "prompt_number": 62 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.58,Page 180" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#for alpha 1\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "theta =80;\n", + "delta =46+45.0/60+30.0/3600;\n", + "\n", + "#calculation\n", + "alpha1 =90 - theta + delta ;\n", + "alpha1=deg_to_dms(alpha1);\n", + "\n", + "#result\n", + "print \"alpha1 to the north in (deg,min,sec)\",alpha1\n", + "\n", + "#for alpha2\n", + "#calculation\n", + "alpha2 = theta +delta -90;\n", + "alpha2=deg_to_dms(alpha2)\n", + "\n", + "#result\n", + "print \"alpha2 to the south(deg,min,sec)\",alpha2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[56, 45, 30.0] alpha1 to the north in (deg,min,sec)\n", + "[36, 45, 30.0] lpha1 to the south(deg,min,sec)\n" + ] + } + ], + "prompt_number": 69 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.59,Page 181" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "delta1 =20+25.0/60+48.0/3600; # declination of star 1\n", + "delta2 =79+30.0/60+52.0/3600; # declination of star 2\n", + "alpha1 =48+18.0/60+12.0/3600; #altitude of star 1\n", + "alpha2 =47+54.0/60+6.0/3600; #altitude of star 2\n", + "\n", + "#calculation\n", + "r1 =58.0/3600/ tan( alpha1 *pi /180) # error 1\n", + "r2 =58.0/3600/ tan( alpha2 *pi /180) # error 2\n", + "lat =90 -( alpha1 - alpha2 ) /2+( delta1 - delta2 ) /2+( r1 -r2)/2;\n", + "lat=deg_to_dms(lat);\n", + "\n", + "#result\n", + "print \"Latitude in (deg,min,sec)\",lat;\n", + "print \" there is a miscalculation in the step of calculating (delta1-delta2)/2 so there is a difference in the answer\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Latitude in (deg,min,sec) [60, 15, 24.63]\n", + " there is a miscalculation in the step of calculating (delta1-delta2)/2 so there is a difference in the answer\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.60,Page 182" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "alphal =18+36.0/60+40.0/3600; #altitude at lower culmination\n", + "alphau =59+48.0/60+20.0/3600; #altitude at upper culmination\n", + "lat =( alphal + alphau )/2;\n", + "lat1=deg_to_dms(lat);\n", + "delta =90+ lat - alphau ;\n", + "delta1=deg_to_dms(delta);\n", + "\n", + "\n", + "#result\n", + "print \"Latitude in (deg,min,sec)\",lat1;\n", + "print \"Declination of star in (deg,min,sec)\",delta1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[39, 12, 30.0] Latitude of star in (deg,min,sec)\n", + "[69, 24, 10.0] Declination of star in (deg,min,sec)\n" + ] + } + ], + "prompt_number": 74 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.61,Page 183" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "alpha =40+36.0/60+30.0/3600; # altitude of star\n", + "delta =10+36.0/60+40.0/3600; # declination of star\n", + "H =46+36.0/60+20.0/3600; # hour angle of star\n", + "\n", + "#calculation\n", + "n= atan ( tan ( delta *pi /180) /cos(H*pi /180) );\n", + "lat =n+ acos ( sin ( alpha *pi /180) *sin(n)/ sin ( delta *pi/180) );\n", + "lat = lat *180/ pi;\n", + "lat=deg_to_dms(lat);\n", + "\n", + "#result\n", + "print \"Latitude in (deg,min,sec)\",lat;" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[36, 49, 43.99] Latitude in (deg,min,sec)\n" + ] + } + ], + "prompt_number": 75 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.62,Page 183" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "alpha =42+10.0/60+40.0/3600; # altitude o f sun\n", + "delta =23+12.0/60+18.6/3600; # declination of sun ' s angle\n", + "LMT =14+50.0/60;\n", + "\n", + "#calculation\n", + "i =57.0/3600*1/ tan ( alpha *pi /180) ; # error\n", + "i2 =8.78/3600* cos( alpha ); # correction due to parallax\n", + "i3 =15.0/60+45.86/3600; # coreection due to semi diamter\n", + "longP =108+30.0/60; # longitude of place\n", + "alpha =alpha -i+i2+i3;\n", + "delT = longP /15; # change in time\n", + "GMT = LMT + delT ;\n", + "i4 =1.2/3600* GMT; # error in time\n", + "H=( GMT -12+ i4 - delT ) *15; # hour angle\n", + "i5 =10.6/3600* GMT; # error in declination\n", + "delta = delta +i5;\n", + "ZM =(90 - alpha )*pi /180;\n", + "PM =(90+ delta )*pi /180;\n", + "A= asin ( sin (PM)/sin(ZM)* sin (H*pi /180) );\n", + "A=pi -A;\n", + "ZP =2* atan ( sin (A/2+ H*pi /360) / sin (A/2-H*pi /360) *tan(PM/2- ZM /2) );\n", + "lat =pi /2- ZP;\n", + "lat = lat *180/ pi +1+6.0/60;\n", + "lat=deg_to_dms(lat);\n", + "\n", + "#result\n", + "print \"Latitude in (deg,min,sec)\",lat;" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[1, 19, 7.46] Latitude in (deg,min,sec)\n" + ] + } + ], + "prompt_number": 78 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.63,Page 185" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "delta =15+20.0/60+48.0/3600; # declination of star\n", + "Int =9+22.0/60+6.0/3600; # interval\n", + "\n", + "#calculation\n", + "dint =Int *9.8565/3600; # change in interval\n", + "H=( Int+ dint ) *15/2; # hour angle\n", + "lat = atan (tan( delta *pi /180) /cos(H*pi /180) );\n", + "lat = lat *180/ pi +5.0/6*16.0/3600;\n", + "lat=deg_to_dms(lat);\n", + "\n", + "#result\n", + "print \"Latitude in (deg,min,sec)\",lat;" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[39, 22, 1.79] Latitude in (deg,min,sec)\n" + ] + } + ], + "prompt_number": 79 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.64,Page 186" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "RA =1+41.0/60+48.64/3600;\n", + "lat =48+36.0/60+40/3600; # latitude\n", + "delta =88+58.0/60+28.26/3600; # declination of polaris\n", + "GMM =16+48.0/60+20.86/3600;\n", + "longP =7+20.0/60; # longitude of place P\n", + "i1 =51.0/3600; # error due to barometer\n", + "i2 =1.0/3600; # error due to barometer\n", + "i3 = -1.0/3600; # error due to temp\n", + "\n", + "#calculation\n", + "lat =lat -i1+i2+i3;\n", + "delT = longP /15;\n", + "i4= delT *9.8565/3600;\n", + "lst = GMM +i4;\n", + "LMT =20+24.0/60+50.0/3600;\n", + "i6 =9.8565/3600* LMT ; # e r r o r i n LMT\n", + "LST = LMT +i6+lst -24;\n", + "H=LST -RA; # hour a n g l e\n", + "H=H *15;\n", + "lat =lat -(90 - delta )*cos(H*pi /180) +.5* sin (1/3600* pi/180) *(90 - delta ) **2*( sin (H*pi /180) )**2* tan ( lat *pi/180) ;\n", + "lat=deg_to_dms(lat);\n", + "\n", + "#result\n", + "print \"Latitude in (deg,min,sec)\",lat;" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[49, 36, 18.45] Latitude in (deg,min,sec)\n" + ] + } + ], + "prompt_number": 81 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.65,Page 187" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin,cos,acos,atan,asin\n", + "def deg_to_dms(deg):\n", + " d = int(deg)\n", + " md = abs(deg - d) * 60\n", + " m = int(md)\n", + " sd = round((md - m) * 60,2)\n", + " return [d, m, sd]\n", + "longP =120 -4 -20.0/60; # longitude of point\n", + "GST =8+30.0/60+20.0/3600; #GST on GMM\n", + "delta =6+15.0/60+2.0/3600; # deflection\n", + "alpha =39+20.0/60+30.0/3600; # altitude\n", + "theta =56+54.0/60+30.0/3600; # longitude\n", + "\n", + "#calculation\n", + "delT = longP /15;\n", + "i= delT *9.8565/3600; # error in time\n", + "lst = GST +i; #LST on LMM\n", + "LST =19+52.0/60+16.0/3600;\n", + "RA=LST;\n", + "LMN =LST -lst;\n", + "i2=LMN *9.8565/3600; # error in LMN\n", + "LMN =LMN -i2;\n", + "OSM =10+55.0/60+30.0/3600; #Observed mean time\n", + "i3 =1.0/60+25.0/3600; # e r r o r i n obs e r v ed t ime\n", + "OSM =OSM -i3;\n", + "LMT = OSM +4.0/15+21.0/60.0/15;\n", + "I=LMN - LMT ; # interval\n", + "i4 =1.21/3600; # error in interval\n", + "I=I+i4;\n", + "H=I; # hour angle\n", + "B= cos ( delta *pi /180) * cos ( theta *pi /180) / cos ( alpha *pi/180) ;\n", + "m =225* H **2*3600**2/2.0/206265.0;\n", + "lat = alpha +m*B /3600;\n", + "lat =90 - lat +6+15.0/60+2.0/3600;\n", + "lat=deg_to_dms(lat);\n", + "\n", + "#result\n", + "print \"Latitude in (deg,min,sec)\",lat;" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "[56, 53, 17.77] Latitude in (deg,min,sec)\n" + ] + } + ], + "prompt_number": 85 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Surveying_Volume_3/.ipynb_checkpoints/Chapter_2-checkpoint.ipynb b/Surveying_Volume_3/.ipynb_checkpoints/Chapter_2-checkpoint.ipynb new file mode 100644 index 00000000..aa80b5f5 --- /dev/null +++ b/Surveying_Volume_3/.ipynb_checkpoints/Chapter_2-checkpoint.ipynb @@ -0,0 +1,1006 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:6606ac19603447b1854104ff063c3146a52dcc3f72534593eb57dedb0abf3778" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "chapter 2:PHOTOGRAPHIC SURVEYING" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.1, Page 215" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Initialization of Variable\n", + "from math import pi\n", + "from math import atan\n", + "f =120.80 # focal length\n", + "a = -35.52 # elevation of A\n", + "b =8.48 # elevation of B\n", + "c =48.26 # elevation of C\n", + "\n", + "#calculation\n", + "alphaa = atan (a/f);\n", + "alphab = atan (b/f);\n", + "alphac = atan (c/f);\n", + "phi =(354+30/60) *pi /180; # azimuth o f camera\n", + "phia =phi - alphaa -360* pi /180; # azimuth o f a\n", + "phib = phia + alphab; # azimuth o f b\n", + "phic = phia + alphac ; # azimuth o f c\n", + "\n", + "#result\n", + "print \" azimuth of a in ( degrees ) \",round(phia /pi *180,2)\n", + "print \" azimuth of b in ( degrees ) \",round(phib /pi *180,2)\n", + "print \" azimuth of c in ( degrees ) \",round(phic /pi *180,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " azimuth of a in ( degrees ) 10.39\n", + " azimuth of b in ( degrees ) 14.4\n", + " azimuth of c in ( degrees ) 32.16\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.2,Page 216" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi\n", + "from math import atan,sin,sqrt\n", + "f =150.0; # focal length of camera\n", + "ap =20.2 # elevation of a from p\n", + "aa1 =16.4; # distace to the right\n", + "aq =35.2 # elevation of a from q\n", + "PQ =100.0; # distace of PQ\n", + "RL =126.845; # r educed level of instrument\n", + "\n", + "#calculation\n", + "alphap = atan (ap/f);\n", + "alphaq = atan (aq/f);\n", + "P=pi /3- alphap ; # angle P\n", + "Q =40* pi /180 - alphaq ; # angle Q\n", + "A=pi -P-Q; # angle A;\n", + "AP=PQ* sin (Q)/sin(A);\n", + "AQ=PQ* sin (P)/sin(A);\n", + "Pa1 = sqrt (ap **2+ f **2) ;\n", + "AA1 = aa1 *AP/ Pa1 ;\n", + "RLa =RL+AA1; # reduced level of A\n", + "\n", + "#result\n", + "print \" distance of AP (m) \",round(AP,2);\n", + "print \"distance of AQ (m) \",round(AQ,2);\n", + "print \" reduced level of A in (M) \",round(RLa,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " distance of AP (m) 45.9\n", + "distance of AQ (m) 80.6\n", + " reduced level of A in (M) 131.82\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.3,Page 218" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin\n", + "theta =(44+30/60) *pi /180; # angle b/w two points\n", + "x1 =68.24; #distance of 1st point\n", + "x2 =58.48; #distance of 2nd point\n", + "\n", + "#calculation\n", + "f=( x1+x2)/ tan ( theta ) /2+ sqrt (( x1+x2) **2/4/( tan ( theta ))\n", + "**2+ x1*x2);\n", + "\n", + "#result\n", + "print \" focal length of lens in (mm) \",round(f,2);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " focal length of lens in (mm) 156.69\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.4, Page 240" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin\n", + "# part 1\n", + "\n", + "H =1200.0;#altitude\n", + "h =80.0; #elevation of hill\n", + "f =15.0/100.0;\n", + "\n", + "#calculation\n", + "R80 =f/(H-h);\n", + "print \" representative fraction of hill is ( time s) \",round(R80,5);\n", + "\n", + "# part 2\n", + "#initialisation of variable\n", + "h =300.0; #elevation of hill\n", + "\n", + "#calculation\n", + "R300 =f/(H-h);\n", + "\n", + "#result\n", + "print \" representative fraction of hill is ( time s) \",round(R300,5) ;" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " representative fraction of hill is ( time s) 0.00013\n", + " representative fraction of hill is ( time s) 0.00017\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.5,Page 240" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin\n", + "R =1.0/8000.0;\n", + "h =1500.0;\n", + "f =20.0/100.0;\n", + "\n", + "#calculation\n", + "H=h+f/R;\n", + "\n", + "#result\n", + "print \" height above sea level in (m) \",round(H,3);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " height above sea level in (m) 3100.0\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.6,Page 241" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin\n", + "h =500.0; #elevation of point\n", + "f =20.0/100.0; # focal length\n", + "v =8.65/100.0; # vertical distance of photograph\n", + "ho =2000.0; # horizontal distance of photograph\n", + "R=v/ho; # representative fraction\n", + "h1 =800;\n", + "\n", + "#calculation\n", + "H=h+f/R;\n", + "S=(H-h1)/f /100; # scale of photograph\n", + "\n", + "print \" height above sea level in (m) \",round(H,2);\n", + "print \" 1cm in photograph represents centimetres \",round(S,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " height above sea level in (m) 5124.28\n", + " 1cm in photograph represents centimetres 216.214\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.7, Page 241" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin\n", + "m =1.0/50000.0; #map scale\n", + "pd =10.16; # photo distance\n", + "md =2.54; #map distance\n", + "f =16.0/100.0;\n", + "h =200;\n", + "\n", + "#calculation\n", + "R=pd/md*m; # representative fraction\n", + "H=h+f/R;\n", + "\n", + "#result\n", + "print \" height above sea level in (m) \",round(H,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " height above sea level in (m) 2200.0\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.8,Page 242" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin\n", + "f =20 # f o c a l l e n g t h\n", + "xa =2.65; # x coordinate of a\n", + "xb = -1.92; # x coordinate of b\n", + "ya =1.36; # x coordinate of a\n", + "yb =3.65; # y coordinate of b\n", + "H =2500.0;\n", + "ha =500.0; # elevation of a\n", + "hb =300.0; # elevation of b\n", + "\n", + "#calculation\n", + "Xa =(H-ha)/f*xa;\n", + "Xb =(H-hb)/f*xb;\n", + "Ya =(H-ha)/f*ya;\n", + "Yb =(H-hb)/f*yb;\n", + "AB= sqrt ((Xa -Xb) **2+( Ya -Yb)**2);\n", + "\n", + "#result\n", + "print \" distance between A & B in (m) \",round(AB,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " distance between A & B in (m) 545.213\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.9,Page 243" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin\n", + "f =20.0 # focal length\n", + "xa =2.65; # x coordinate of a\n", + "xb = -1.92; # x coordinate of b\n", + "ya =1.36; # y coordinate of a\n", + "yb =3.65; # y coordinate of b\n", + "ha =500.0; # elevation of a\n", + "hb =300.0; # elevation of b\n", + "ABg =545.0;\n", + "ab =5.112;\n", + "\n", + "#calculation\n", + "hab =ha /2+ hb /2;\n", + "Happ =hab+ ABg *f/ab\n", + "Xa =( Happ -ha)/f*xa;\n", + "Xb =( Happ -hb)/f*xb;\n", + "Ya =( Happ -ha)/f*ya;\n", + "Yb =( Happ -hb)/f*yb;\n", + "AB= sqrt ((Xa -Xb) **2+( Ya -Yb)**2);\n", + "Hact =ABg/AB *( Happ - hab )+ hab ;\n", + "\n", + "#result\n", + "print \" actual flying height of A & B in (m) \",round(Hact,3);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " actual flying height of A & B in (m) 2499.706\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.10,Page 243" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin\n", + "\n", + "f =20.0/100.0;\n", + "Sd =1.0/10000.0;\n", + "h =250.0; # elevation\n", + "r =6.44;\n", + "\n", + "#calculation\n", + "H=f/Sd;\n", + "d=r*h/H;\n", + "\n", + "#result\n", + "print \"relief displacement of the point in ( cm) \",round(d,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "relief displacement of the point in ( cm) 0.805\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.11,Page 244" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin\n", + "h =50.0; # elevation\n", + "H =2500.0 -1250.0;\n", + "r =6.35;\n", + "\n", + "#calculation\n", + "d=r*h/H;\n", + "\n", + "#result\n", + "print \"releif displacement of the point in ( cm) \",round(d,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "releif displacement of the point in ( cm) 0.254\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.12,Page 244" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin\n", + "f =20.0/100.0; # focal length\n", + "l =250; #length of line\n", + "lp =8.5/100.0; #length of line in photograph\n", + "\n", + "#calculation\n", + "H=l*f/lp; # height of camera above datum\n", + "r =6.46; # distace of image of top o f the towe r\n", + "d =0.46; # releif displacement\n", + "h=d*H/r;\n", + "\n", + "#result\n", + "print \" height of tower above its base in (m) \",round(h,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "41.89 height of tower above its base in (m) \n" + ] + } + ], + "prompt_number": 28 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.13,Page 267" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin\n", + "l =20/100; # length of photograph\n", + "w =20/100; # breadth of photograph\n", + "Pl =0.6; # longitudinal lap\n", + "Pw =0.3; # side lap\n", + "s =100*20;\n", + "\n", + "#calculation\n", + "L=(1 - Pl)*s;\n", + "W=(1 - Pw)*s;\n", + "Ar=L*W /1000/1000;\n", + "N =100/ Ar;\n", + "A= round (N);\n", + "\n", + "#result\n", + "print \"no . o f photographs to be taken \",A+1;\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "no . o f photographs to be taken 90.0\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.14,Page 267" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin\n", + "Pl =0.6; # longitudinal lap\n", + "Pw =0.3; # side lap\n", + "L1 =10000.0;\n", + "s =100.0*20.0;\n", + "\n", + "#calculation\n", + "L2=L1;\n", + "N1=L1 /((1 - Pl)*s) +1;\n", + "A1= round (N1);\n", + "if N1 -A1 <0:\n", + " N1=A1;\n", + "else :\n", + " N1=A1+1;\n", + "\n", + "N2=L2 /((1 - Pw)*s) +1;\n", + "A2= round (N2);\n", + "if N2 -A2 <0:\n", + " N2=A2\n", + "else :\n", + " N2=A2+1;\n", + "\n", + "N=N1*N2;\n", + "\n", + "#result\n", + "print \"no . of photographs to be taken \",N;" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "no . of photographs to be taken 126.0\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.15,Page 268" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin\n", + "Pl =0.6; # longitudinal lap\n", + "Pw =0.3; # side lap\n", + "L1 =12500.0;\n", + "s =100.0*20.0;\n", + "L2 =8000.0;\n", + "\n", + "#calculation\n", + "N1=L1 /((1 - Pl)*s) +1;\n", + "A1= round (N1);\n", + "if N1 -A1 <0:\n", + " N1=A1;\n", + "else :\n", + " N1=A1+1;\n", + "\n", + "N2=L2 /((1 - Pw)*s) +1;\n", + "A2= round (N2);\n", + "if N2 -A2 <0:\n", + " N2=A2\n", + "else :\n", + " N2=A2+1;\n", + "\n", + "N=N1*N2;\n", + "\n", + "#result\n", + "print \"no . of photographs to be taken \",N;" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "no . of photographs to be taken 119.0\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.16,Page 268" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "#part1\n", + "from math import pi,tan,sqrt,sin\n", + "f =30.0/100.0; # focal length\n", + "h =400.0; #elevation of datum\n", + "r =12000.0; # ratio\n", + "s =120.0*20.0;\n", + "L2 =24000.0;\n", + "L1 =30000.0;\n", + "Pl =0.6; # longitudinal lap\n", + "Pw =0.3; # side lap\n", + "\n", + "#calculation\n", + "H=h+r*f;\n", + "\n", + "#result\n", + "print \" height above datum in (m) \",round(H,2);\n", + "\n", + "# part 2\n", + "#calculation\n", + "W=(1 - Pw)*s;\n", + "\n", + "#result\n", + "print \" ground width covered in each photograph (m) \",round(W,2);\n", + "\n", + "# part 3\n", + "N2=L2 /((1 - Pw)*s) +1;\n", + "A2= round (N2);\n", + "if N2 -A2 <0:\n", + " N2=A2\n", + "else :\n", + " N2=A2+1;\n", + "\n", + "#result\n", + "print \"no . of flights required \",N2;\n", + "\n", + "#part 4-9\n", + "#calculation\n", + "Asf =L2 /(N2 -1) ; # actual spacing between flights\n", + "Sfl = Asf /600; # spacing of flight lines\n", + "gd =(1 - Pl)*s; # ground distance\n", + "Ei=gd /55.5; # exposure interval\n", + "Ei= round (Ei);\n", + "Ags =55.56* Ei;# adgusted ground distance\n", + "N1=L1/ Ags +1;\n", + "A1= round (N1);\n", + "if N1 -A1 <0:\n", + " N1=A1;\n", + "else :\n", + " N1=A1+1;\n", + "N=N1*N2;\n", + "\n", + "#result\n", + "print \"actual spacing in m\",Asf\n", + "print \"spacing of flight lines in cm\",round(Sfl,2)\n", + "print \"exposure interval in s\",Ei\n", + "print \"adjusted ground distance in m\",round(Ags)\n", + "print \"no . of photographs to be taken per flight line\",N1\n", + "print \"no . of photographs to be taken \",N;" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " height above datum in (m) 4000.0\n", + " ground width covered in each photograph (m) 1680.0\n", + "no . of flights required 16.0\n", + "actual spacing in m 1600.0\n", + "spacing of flight lines in cm 2.67\n", + "exposure interval in s 17.0\n", + "adjusted ground distance in m 945.0\n", + "no . of photographs to be taken per flight line 33.0\n", + "no . of photographs to be taken 528.0\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.17,Page 301" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin\n", + "f =150.0/1000.0; # focal length\n", + "r =20000.0; #ratio\n", + "Pl =0.6; # longitudinal lap\n", + "l =23.0/100.0; # l e n g t h\n", + "w =23.0/100.0; # width\n", + "\n", + "#calculation\n", + "B=(1 - Pl)*l*r; # base length\n", + "H=f*r;\n", + "h =0;\n", + "dh =(H-h) **2/ B/f *0.1/1000;\n", + "\n", + "#result\n", + "print \" error in height in (m) \",round(dh,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " error in height in (m) 3.261\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.18,Page 302" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin\n", + "H =600.0;\n", + "f =150.0/1000.0;\n", + "b =6.375/100.0;\n", + "h1 =0.0;\n", + "h2 =120.0; # height of chimney\n", + "\n", + "#calculation\n", + "s=H/f;\n", + "B=s*b; # datum elevation\n", + "p1=B*f *1000/(H-h1);\n", + "p2=B*f *1000/(H-h2);\n", + "delp =p2 -p1;\n", + "delh =H* delp /1000/( b+ delp /1000) ;\n", + "\n", + "#result\n", + "print \" parallax height of the chimney in (m)\",round(delh,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " parallax height of the chimney in (m) 120.0\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.19,Page 303" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "from math import pi,tan,sqrt,sin\n", + "B =200.0;\n", + "f =120.0;\n", + "p2 =52.52; # parallax for top pole\n", + "p1 =48.27; # parallax for bottom pole\n", + "\n", + "#calculation\n", + "delh =(p2 -p1)/p2/p1*B*f;\n", + "\n", + "#result\n", + "print \" difference in elevation of two points in (m) \",round(delh,3)\n", + "print \"there is again a miscalculation in the step of calculating elevation thus there is a change in the answer\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " difference in elevation of two points in (m) 40.234\n", + "there is again a miscalculation in the step of calculating elevation thus there is a change in the answer\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.20,Page 303" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variable\n", + "# part 1\n", + "delp =1.48/1000.0;\n", + "H =5000.0;\n", + "h =500.0;\n", + "b =90.0/1000.0; #mean principal base\n", + "\n", + "#calculation\n", + "dh =(H-h) **2* delp /((H-h)* delp +b*H);\n", + "\n", + "#result\n", + "print \" difference in height between two points in(m) \",round(dh,3)\n", + "\n", + "# part 2\n", + "#variable decleration\n", + "delp =15.5/1000.0;\n", + "\n", + "#calculation\n", + "dh =(H-h) **2* delp /((H-h)* delp +b*H);\n", + "\n", + "#result\n", + "print \" difference in height between two points in(m) \",round(dh,3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " difference in height between two points in(m) 65.629\n", + " difference in height between two points in(m) 603.896\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Surveying_Volume_3/Chapter_1_.ipynb b/Surveying_Volume_3/Chapter_1_.ipynb index da68e1c2..1980cbfe 100644 --- a/Surveying_Volume_3/Chapter_1_.ipynb +++ b/Surveying_Volume_3/Chapter_1_.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:4905c8953e99a0af987b7c0ce644a5ad7cb3e945c4ca11d9468aa082d89ca9a1" + "signature": "sha256:4ddd3af14ff06960550d645597cd73680055f50cafe1bfd8d26e7c68217b3e30" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 2, "metadata": {}, "source": [ - "FIELD ASTRONOMY" + "chapter 1:FIELD ASTRONOMY" ] }, { diff --git a/Surveying_Volume_3/Chapter_2.ipynb b/Surveying_Volume_3/Chapter_2.ipynb index f9526973..aa80b5f5 100644 --- a/Surveying_Volume_3/Chapter_2.ipynb +++ b/Surveying_Volume_3/Chapter_2.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:ca6f7f2cf84d957176ecf14fb0c306b69df620b66b59adb595e323ae5d6031bb" + "signature": "sha256:6606ac19603447b1854104ff063c3146a52dcc3f72534593eb57dedb0abf3778" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,7 +13,7 @@ "level": 2, "metadata": {}, "source": [ - "PHOTOGRAPHIC SURVEYING" + "chapter 2:PHOTOGRAPHIC SURVEYING" ] }, { diff --git a/Transport_Phenomena/.ipynb_checkpoints/ch1-checkpoint.ipynb b/Transport_Phenomena/.ipynb_checkpoints/ch1-checkpoint.ipynb new file mode 100644 index 00000000..b9a93390 --- /dev/null +++ b/Transport_Phenomena/.ipynb_checkpoints/ch1-checkpoint.ipynb @@ -0,0 +1,116 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:ce6e9d0d17f0f2b259533af75fac21794edd07ab7eee18f5c3ded9c896867c58" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 1 : introduction to transport phenomena" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.1 - Page No : 6\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "v=0.01283; \t\t\t #[m**3] - volume of tank in m**3\n", + "v=0.4531; \t\t\t #[ft**3] - volume of tank in ft**3\n", + "p=2; \t\t\t #[atm] - pressure\n", + "T=1.8*300; \t\t\t #[degR] - temperature\n", + "R=0.73; \t\t \t #[(atm*ft**3)/(lbmol*degR)] - gas constant\n", + "\n", + "# Calculations\n", + "# usin the equation of state for an ideal gas pv=nRT\n", + "n=(p*v)/(R*T);\n", + "\n", + "xN2=0.5; \t\t\t # fractiom of N2 in math.tank\n", + "nN2=xN2*n;\n", + "Ca=nN2/v;\n", + "\n", + "# Results\n", + "print \"no. of moles , n = %.3e\"%n\n", + "print \"Ca = %.2e lb*mol/ft**3\"%(Ca);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "no. of moles , n = 2.299e-03\n", + "Ca = 2.54e-03 lb*mol/ft**3\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 1.2 - Page No :9\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from numpy import *\n", + "\n", + "# Variables\n", + "a = array([[1, 1, 1],[0.05, 0.15, 0.40],[0.95, 0 ,0.452]])\n", + "d = array([[1500.],[1500.*0.25],[1500.*0.50]])\n", + "\n", + "# Calculations\n", + "#ainv = linalg.inv(a);\n", + "#sol = ainv * d;\n", + "sol = linalg.solve(a,d)\n", + "# Results\n", + "print \"the amount of concentrated HNO3 is %.0fkg \\\n", + "\\nthe amount of concentrated H2SO4 is %.0fkg \\\n", + "\\nthe amount of waste acids is %.0fkg\"%(sol[1],sol[0],round(sol[2],-1));\n", + "\n", + "# Answer may be different because of rounding error and inbuilt function solve." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the amount of concentrated HNO3 is 307kg \n", + "the amount of concentrated H2SO4 is 423kg \n", + "the amount of waste acids is 770kg\n" + ] + } + ], + "prompt_number": 7 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Transport_Phenomena/.ipynb_checkpoints/ch10-checkpoint.ipynb b/Transport_Phenomena/.ipynb_checkpoints/ch10-checkpoint.ipynb new file mode 100644 index 00000000..52d5c043 --- /dev/null +++ b/Transport_Phenomena/.ipynb_checkpoints/ch10-checkpoint.ipynb @@ -0,0 +1,1008 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:7eb8614514dad908ca3ae3d51b35064678df2b9a8e0304fe51fa17e462cfc000" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 10 : Fluid flow in ducts" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.1 - Page No :405\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "T = 30.; \t\t\t #[degC] - temperature\n", + "d = 8.265*10**-4; \t\t\t #[m] - diameter of the capillary viscometer\n", + "deltapbyL = -0.9364; \t\t #[psi/ft] - pressure drop per unit length\n", + "\n", + "# Calculations\n", + "deltapbyL = deltapbyL*(2.2631*10**4); \t\t\t #[kg/m**2*sec**2] - pressure drop per unit length\n", + "Q = 28.36*(10**-6)*(1./60);\n", + "p = (0.88412-(0.92248*10**-3)*T)*10**3; \t\t\t #[kg/m**3] - density\n", + "s = (math.pi*(d**2))/4.;\n", + "U = Q/s;\n", + "tauw = (d/4.)*(-deltapbyL);\n", + "shearrate = (8*U)/d;\n", + "mu = tauw/(shearrate);\n", + "\n", + "# Results\n", + "print \" The viscosity is mu = %.3ef kg/m*sec = %.4f cP\"%(mu,mu*10**3);\n", + "print \" Finally, it is important to check the reynolds number to make sure the above equation applies\"\n", + "Nre = (d*U*p)/(mu);\n", + "print \" Nre = %d\"%Nre\n", + "print \" The flow is well within the laminar region and therefore the above equation applies\";\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The viscosity is mu = 5.135e-04f kg/m*sec = 0.5135 cP\n", + " Finally, it is important to check the reynolds number to make sure the above equation applies\n", + " Nre = 1214\n", + " The flow is well within the laminar region and therefore the above equation applies\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.2 - Page No :407\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "Nreold = 1214.;\n", + "Uold = 0.8810;\n", + "Nre = 13700.;\n", + "U = Uold*(Nre/Nreold);\n", + "Lbyd = 744.;\n", + "T = 30.; \n", + "\n", + "# Calculations\n", + "# umath.sing the newton raphson method to calculate the value of f from the equation - 1/(f**(1/2)) = 4*math.log(Nre*(f**(1/2)))-0.4\n", + "f = 0.007119;\n", + "p = (0.88412-(0.92248*10**-3)*T)*10**3; \t\t\t #[kg/m**3] - density\n", + "tauw = (1./2)*p*(U**2)*f;\n", + "deltap = tauw*(4.)*(Lbyd);\n", + "d = 0.03254/12; \t\t\t #[ft]\n", + "L = Lbyd*d;\n", + "\n", + "# Results\n", + "print \" Pressure drop is -deltap = %.3e N/m**2 = %.1f kpa = 130 psi\"%(deltap,deltap*10**-3); \n", + "print \" A pressure drop of 130 psi on a tube of length of %.3f ft is high and \\\n", + "\\nshows the impracticality of flows at high reynolds number in smaller tubes\"%(L);\n", + "\n", + "# Answer may vary because of rounding error." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Pressure drop is -deltap = 8.968e+05 N/m**2 = 896.8 kpa = 130 psi\n", + " A pressure drop of 130 psi on a tube of length of 2.017 ft is high and \n", + "shows the impracticality of flows at high reynolds number in smaller tubes\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.3 - Page No :414\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "u = 1./60; \t\t\t #[m/sec] - velocity\n", + "p = 1000.; \t\t\t #[kg/m**3] - density\n", + "mu = 1*10.**-3; \t\t #[kg/m*sec] - vismath.cosity\n", + "d = 6*10.**-2; \t\t #[m] - insid_e diameter of tube\n", + "L = 300.; \t\t\t #[m] - length of the tube\n", + "\n", + "# Calculations\n", + "Nre = (d*u*p)/(mu);\n", + "f = 16./Nre;\n", + "deltap = (4.*f)*(L/d)*((p*(u**2))/2.);\n", + "\n", + "# Results\n", + "print \"Nre = \",Nre,\"therefore the flow is laminar\"\n", + "print \"f = \" , f\n", + "print \"Pressure drop -delta P = %.2f N/m**2 = %.4f kPa = %.3e psi\"%(deltap,deltap*10**-3,deltap*1.453*10**-4);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Nre = 1000.0 therefore the flow is laminar\n", + "f = 0.016\n", + "Pressure drop -delta P = 44.44 N/m**2 = 0.0444 kPa = 6.458e-03 psi\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.4 - Page No :415\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from numpy import *\n", + "\n", + "# Variables\n", + "# given\n", + "d = 6.*10**-2; \t\t\t #[m] - insid_e diameter of tube\n", + "p = 1000.; \t\t\t #[kg/m**3] - density\n", + "# for smooth pipe\n", + "Nre = array([10**4, 10**5]);\n", + "f = array([0.0076, 0.0045]);\n", + "mu = 10.**-3; \t\t\t #[kg/m**2*s]\n", + "U = (Nre*mu)/(d*p);\n", + "L = 300.; \t\t\t #[m] - length of the tube\n", + "\n", + "# Calculations\n", + "deltap = zeros(2)\n", + "for i in range(2):\n", + " deltap[i] = (4*f[i])*(L/d)*((p*(U[i]**2))/2.);\n", + "\n", + "\n", + "# Results\n", + "print \"for smooth pipe\"\n", + "print \" Nre f -deltap\";\n", + "print \" %6.0f %6.4f %6.3f\"%(Nre[0],f[0],deltap[0])\n", + "print \" %6.0f %6.4f %6.3f\"%(Nre[1],f[1],deltap[1])\n", + "\n", + "# for commercial steel\n", + "Nre = array([10**4, 10**5]);\n", + "f = array([0.008 ,0.0053]);\n", + "U = (Nre*mu)/(d*p);\n", + "L = 300.; \t\t\t #[m] - length of the tube\n", + "for i in range(2):\n", + " deltap[i] = (4*f[i])*(L/d)*((p*(U[i]**2))/2);\n", + "\n", + "print \"\\nfor commercial steel pipe\"\n", + "print \" Nre f -deltap\";\n", + "print \" %6.0f %6.4f %6.3f\"%(Nre[0],f[0],deltap[0])\n", + "print \" %6.0f %6.4f %6.3f\"%(Nre[1],f[1],deltap[1])\n", + "\n", + "# for cast iron pipe\n", + "Nre = array([10**4 ,10**5]);\n", + "f = array([0.009 ,0.0073]);\n", + "U = (Nre*mu)/(d*p);\n", + "L = 300.; \t\t\t #[m] - length of the tube\n", + "for i in range(2):\n", + " deltap[i] = (4*f[i])*(L/d)*((p*(U[i]**2))/2);\n", + "\n", + "print \"\\nfor cast iron pipe\"\n", + "print \" Nre f -deltap\";\n", + "print \" %6.0f %6.4f %6.3f\"%(Nre[0],f[0],deltap[0])\n", + "print \" %6.0f %6.4f %6.3f\"%(Nre[1],f[1],deltap[1])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "for smooth pipe\n", + " Nre f -deltap\n", + " 10000 0.0076 2111.111\n", + " 100000 0.0045 125000.000\n", + "\n", + "for commercial steel pipe\n", + " Nre f -deltap\n", + " 10000 0.0080 2222.222\n", + " 100000 0.0053 147222.222\n", + "\n", + "for cast iron pipe\n", + " Nre f -deltap\n", + " 10000 0.0090 2500.000\n", + " 100000 0.0073 202777.778\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.5 - Page No :417\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "L = 300.; \t\t\t #[m] - length of pipe\n", + "d = 0.06; \t\t\t #[m] - insid_e diameter\n", + "deltap = 147.*10**3; \t\t #[Pa] - pressure the pump can supply\n", + "ebyd = 0.000762; \t\t\t # relative roughness\n", + "p = 1000.; \t\t\t #[kg/m**3] - density\n", + "mu = 1.*10**-3; \t\t\t #[kg/m*sec] - viscosity\n", + "tauw = (d*(deltap))/(4.*L);\n", + "\n", + "# using the hit and trial method for estimation of flow velocity\n", + "# Calculations\n", + "# let \n", + "f = 0.005;\n", + "U = ((2*tauw)/(p*f))**(1./2);\n", + "Nre = (d*U*p)/mu;\n", + "\n", + "# from the graph value of f at the above calculated reynolds no. and the given relative roughness(e/d)\n", + "f = 0.0054;\n", + "U = ((2*tauw)/(p*f))**(1./2);\n", + "Nre = (d*U*p)/mu;\n", + "\t\t\t # from the graph value of f at the above calculated reynolds no. and the given relative roughness(e/d)\n", + "f = 0.0053;\n", + "U = ((2*tauw)/(p*f))**(1./2);\n", + "Nre = (d*U*p)/mu;\n", + "\n", + "# from the graph value of f at the above calculated reynolds no. and the given relative roughness(e/d)\n", + "f = 0.0053;\n", + "# At this point the value of f is deemed unchanged from the last iteration .Hence, the values obtained after the third iteration are the converged values\n", + "\n", + "# Results\n", + "print \" The maximum flow velocity is U = %f m/sec\"%(U);\n", + "\n", + "# Answer may vary because of rounding error." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The maximum flow velocity is U = 1.665408 m/sec\n" + ] + } + ], + "prompt_number": 26 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.6 - Page No :419\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "L = 300.; \t\t\t #[m] - length of pipe\n", + "d = 0.06; \t\t\t #[m] - insid_e diameter\n", + "deltap = 147.*10**3; \t #[Pa] - pressure the pump can supply\n", + "ebyd = 0.000762; \t\t # relative roughness\n", + "p = 1000.; \t\t\t #[kg/m**3] - density\n", + "\n", + "# Calculations\n", + "mu = 1*10**-3; \t\t\t #[kg/m*sec] - viscosity\n", + "Nvk = ((d*p)/mu)*((d*(deltap))/(2*L*p))**(1./2);\n", + "\n", + "# From the fig at given von karman no and relative roughness the value of f is-\n", + "f = 0.0055;\n", + "Nre = Nvk/(f**(1./2))\n", + "U = (Nre*mu)/(d*p);\n", + "\n", + "# Results\n", + "print \"von karman no. %.0f\"%Nvk\n", + "print \" Average velocity = %.2f m/sec\"%(U);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "von karman no. 7275\n", + " Average velocity = 1.63 m/sec\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.7 - Page No :422\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "L = 300.; \t\t\t #[m] - length of pipe\n", + "d = 0.06; \t\t\t #[m] - insid_e diameter\n", + "p = 1000.; \t\t\t #[kg/m**3] - density\n", + "mu = 1.*10**-3; \t\t\t #[kg/m*sec] - vismath.cosity\n", + "\n", + "# Calculations\n", + "Nre = array([10.**4, 10.**5]);\n", + "U = (Nre*mu)/(d*p);\n", + "velocityhead = (U**2)/2.;\n", + "N = (L/d)/45.; \t\t\t # no of velocity heads\n", + "deltap = p*N*(velocityhead);\n", + "\n", + "# Results\n", + "for i in range(2):\n", + " print \"Nre = \",Nre[i]\n", + " print \" velocity head = %.5f m**2/sec**2\"%(velocityhead[i]);\n", + " print \" -deltap = %.3f kPa = %.3f psi\"%(deltap[i]*10**-3,deltap[i]*1.453*10**-4);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Nre = 10000.0\n", + " velocity head = 0.01389 m**2/sec**2\n", + " -deltap = 1.543 kPa = 0.224 psi\n", + "Nre = 100000.0\n", + " velocity head = 1.38889 m**2/sec**2\n", + " -deltap = 154.321 kPa = 22.423 psi\n" + ] + } + ], + "prompt_number": 32 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.8 - Page No :439\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "mu = 6.72*10**-4; \t\t #[lb/ft*sec] - vismath.cosity\n", + "p = 62.4; \t\t\t #[lb/ft**3] - density\n", + "S = 0.03322; \t\t\t #[ft**2] - flow area\n", + "d = 0.206; \t\t\t #[ft]\n", + "e = 1.5*10**-4; \t\t # absolute roughness for steel pipe\n", + "ebyd = e/d;\n", + "Nre = 10.**5;\n", + "\n", + "# friction factor as read from fig in book for the given reynolds no. and relative roughness is-\n", + "f = 0.0053;\n", + "U = (Nre*mu)/(p*d);\n", + "Q = U*S;\n", + "gc = 32.174;\n", + "\n", + "# Calculations\n", + "# (a) equivalent length method\n", + "deltapbyL = f*(4/d)*(p*(U**2))*(1/(2*gc))*(6.93*10**-3);\n", + "\n", + "# using L = Lpipe+Lfittings+Lloss;\n", + "Lfittings = 2342.1*d;\n", + "kc = 0.50; \t\t\t # due to contraction loss\n", + "ke = 1.; \t\t\t # due to enlargement loss\n", + "Lloss = (kc+ke)*(1./(4*f))*d;\n", + "Lpipe = 137.;\n", + "L = Lpipe+Lfittings+Lloss;\n", + "deltap = deltapbyL*L;\n", + "patm = 14.696; \t\t\t #[psi] - atmospheric pressure\n", + "p1 = patm+deltap;\n", + "print \" a)The inlet pressure is p1 = %.1f psi\"%(p1);\n", + "\n", + "# (b) loss coefficient method\n", + "# using the equation deltap/p = -(Fpipe+Ffittings+Floss)\n", + "L = 137.;\n", + "kfittings = 52.39;\n", + "sigmaF = ((4.*f*(L/d))+kc+ke+kfittings)*((U**2)/(2*gc));\n", + "deltap = (p*sigmaF)/(144.);\n", + "p1 = patm+deltap;\n", + "\n", + "# Results\n", + "print \" b)The inlet pressure is p1 = %.1f psi\"%(p1);\n", + "print \" Computation of the pressure drop by the loss coefficient method differs from the equivalent length \\\n", + " \\nmethod by less than 1 psi\";\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a)The inlet pressure is p1 = 26.7 psi\n", + " b)The inlet pressure is p1 = 27.2 psi\n", + " Computation of the pressure drop by the loss coefficient method differs from the equivalent length \n", + "method by less than 1 psi\n" + ] + } + ], + "prompt_number": 34 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.9 - Page No :443\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "L1 = 50.; \t\t\t #[m] - length of first pipe\n", + "L2 = 150.; \t\t\t #[m] - length of second pipe\n", + "L3 = 100.; \t\t\t #[m] - length of third pipe\n", + "d1 = 0.04; \t\t\t #[m] - diameter of first pipe\n", + "d2 = 0.06; \t\t\t #[m] - diameter of second pipe\n", + "d3 = 0.08; \t\t\t #[m] - diameter of third pipe\n", + "deltap = -1.47*10**5; \t\t\t #[kg/m*sec] - pressure drop\n", + "mu = 1*10.**-3; \t\t\t #[kg/m*sec] - vismath.cosity\n", + "p = 1000.; \t\t\t #[kg/m**3] - density\n", + "\n", + "# Calculation and Results\n", + "# for branch 1\n", + "S = (math.pi*(d1**2))/4;\n", + "Nvk = ((d1*p)/mu)*(-(d1*deltap)/(2*L1*p))**(1./2);\n", + "f = (1./(4*math.log10(Nvk)-0.4))**2;\n", + "U = (((-deltap)/p)*(d1/L1)*(2./4)*(1./f))**(1./2);\n", + "w1 = p*U*S;\n", + "print \" For first branch w1 = %.2f kg/sec\"%(w1);\n", + "\t\t\t # for branch 2\n", + "S = (math.pi*(d2**2))/4;\n", + "Nvk = ((d2*p)/mu)*(-(d2*deltap)/(2*L2*p))**(1./2);\n", + "f = (1./(4*math.log10(Nvk)-0.4))**2;\n", + "U = (((-deltap)/p)*(d2/L2)*(2./4)*(1./f))**(1./2);\n", + "w2 = p*U*S;\n", + "print \" For second branch w2 = %.2f kg/sec\"%(w2);\n", + "\t\t\t # for branch 3\n", + "S = (math.pi*(d3**2))/4;\n", + "Nvk = ((d3*p)/mu)*(-(d3*deltap)/(2*L3*p))**(1./2);\n", + "f = (1./(4*math.log10(Nvk)-0.4))**2;\n", + "U = (((-deltap)/p)*(d3/L3)*(2./4)*(1./f))**(1./2);\n", + "w3 = p*U*S;\n", + "print \" For third branch w3 = %.2f kg/sec\"%(w3);\n", + "\n", + "# total flow rate w = w1+w2+w3\n", + "w = w1+w2+w3;\n", + "print \" total flow rate is w = %.1f kg/sec\"%(w);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " For first branch w1 = 4.74 kg/sec\n", + " For second branch w2 = 7.59 kg/sec\n", + " For third branch w3 = 20.42 kg/sec\n", + " total flow rate is w = 32.7 kg/sec\n" + ] + } + ], + "prompt_number": 36 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.10 Page no : 445" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# variables \n", + "w1 = 4.74 #kg/sec\n", + "w2 = 7.59 #kg/sec\n", + "w3 = 20.42 #kg/sec\n", + "w = 32.7 #kg/sec\n", + "d = .04\n", + "\n", + "S1 = math.pi*d**2/4\n", + "S2 = .002827\n", + "S3 = .005027\n", + "deltaP = 1.47 * 10**5 #kpa\n", + "deltaP1 = 1.583* 10**6 #f1w**2\n", + "deltaP2 = 6.254* 10**5 #f1w**2\n", + "deltaP3 = 9.895* 10**4 #f1w**2\n", + "Nre1 = 3.183 * 10**4 #w\n", + "Nre2 = 2.122 * 10**4 #w\n", + "Nre3 = 1.592 * 10**4 #w\n", + "\n", + "\n", + "### age plz tu kar dena muje kuchh samaj nahi aa raha he...\n", + "### Thanks in advance..... nahi to ye delete kar dena... mere se nahi hota. plz.\n", + "print S1\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0.00125663706144\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.11 - Page No : 447\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "sp = 1.1;\n", + "p = sp*62.4; \t\t\t #[lb/ft**3] - density\n", + "mu = 2*6.72*10**-4; \t #[lb/ft*sec] - viscosity\n", + "Q = 400.; \t\t\t #[gpm] - volumetric flow rate\n", + "e = 1.5*10**4; \t\t #roughness of steel pipe\n", + "gc = 32.174;\n", + "kexit = 1.;\n", + "kentrance = 0.5;\n", + "\n", + "# Calculations\n", + "# 4 in schedule pipe\n", + "d = 4.026/12; \t\t\t #[ft]\n", + "U4 = Q/39.6; \t\t\t #[ft/sec]\n", + "Lgv = 13.08;\n", + "Lglv = 114.1;\n", + "Le = 40.26;\n", + "Lpipe_4 = 22.;\n", + "Lfittings_4 = Lgv+Lglv+Le;\n", + "Lloss = 0;\n", + "L_4 = Lpipe_4+Lfittings_4+Lloss;\n", + "Nre_4 = (d*U4*p)/mu;\n", + "f = 0.00475;\n", + "Fpipe_4 = ((4*f*L_4)/d)*(U4**2)*(1/(2*gc));\n", + "Floss_4 = ((kentrance+0)*(U4**2))/(2*gc);\n", + "\n", + "# 5 in schedule pipe\n", + "d = 5.047/12;\n", + "U5 = Q/62.3;\n", + "Lgv = 10.94;\n", + "Le = 75.71;\n", + "Lpipe_5 = 100.;\n", + "Lfittings_5 = Lgv+Le;\n", + "Lloss = 0.;\n", + "L_5 = Lpipe_5+Lfittings_5+Lloss;\n", + "Nre = (d*U5*p)/mu;\n", + "f = 0.00470;\n", + "Fpipe_5 = ((4*f*L_5)/d)*(U5**2)*(1./(2*gc));\n", + "Floss_5 = ((kexit+0)*(U5**2))/(2*gc);\n", + "\n", + "# 6 in schedule pipe\n", + "d = 6.065/12;\n", + "U6 = Q/90.;\n", + "Lgv = 6.570;\n", + "Le = 30.36;\n", + "Lpipe_6 = 4.;\n", + "Lfittings_6 = Lgv+Le;\n", + "Lloss = 0.;\n", + "L_6 = Lpipe_6+Lfittings_6+Lloss;\n", + "Nre = (d*U6*p)/mu;\n", + "f = 0.00487;\n", + "Fpipe_6 = ((4*f*L_6)/d)*(U6**2)*(1./(2*gc));\n", + "kc = 0.50;\n", + "Floss_6 = kc*((U6**2)/(2*gc));\n", + "Ffittings = 0.;\n", + "deltap_6 = p*(Fpipe_6+Ffittings+Floss_6);\n", + "\n", + "# 3/4 in 18 gauge tube\n", + "d = 0.652112/12;\n", + "L_3by4 = 15.;\n", + "U_3by4 = (Q*0.962)/100.;\n", + "Floss_3by4 = 100.*(kexit+kentrance)*((U_3by4**2.)/2.);\n", + "Nre = d*U_3by4*p*(1./mu);\n", + "f = 0.08*((Nre)**(-1./4))+0.012*((d)**(1./2));\n", + "deltap_3by4 = ((4*f*p*L_3by4)/d)*((U_3by4**2)/(2*gc));\n", + "Fpipe_3by4 = 100.*((4.*f*L_3by4)/d)*((U_3by4**2.)/(2.*gc));\n", + "deltap_spraysystem = 25.; \t\t\t #[psi]\n", + "Fspraysystem = (deltap_spraysystem/p)*(144.);\n", + "delta_p = (p*(kexit+kentrance))*((U_3by4**2.)/(2.*gc))\n", + "Fpipe = Fpipe_4+Fpipe_5+Fpipe_6;\n", + "Floss = Floss_4+Floss_5+Floss_6+Floss_3by4;\n", + "ws = 0. + (((15.**2)-0)/(2*gc))+38.9+382.5;\n", + "w = (Q*p)/(7.48);\n", + "Ws = (ws*w)/(33000.);\n", + "efficiency = 0.6;\n", + "Ws_actual = Ws/efficiency\n", + "\n", + "# Results\n", + "print \" The power supplied to the pump is %.1f hp\"%(Ws_actual);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The power supplied to the pump is 78.8 hp\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.12 - Page No :454\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "kexit = 1.;\n", + "kentrance = 0.5;\n", + "Q = 400.; \t\t\t #[gpm] - volumetric flow rate\n", + "gc = 32.174;\n", + "\n", + "# for 4 inch pipe\n", + "d = 4.026; \t\t #[inch]\n", + "L = 22.; \t\t\t #[ft]\n", + "Lbyd = (L*12)/(d);\n", + "\n", + "# Calculation and Results\n", + "# adding the contributions due to fittings \n", + "Lbyd = Lbyd+3*13+340+4*30;\n", + "N = Lbyd/45.;\n", + "N = N+kentrance+0;\n", + "U4 = Q/39.6; \t\t\t #[ft/sec]\n", + "Fpipe_4 = (N*(U4**2))/(2*gc);\n", + "print \" F4 in.pipes = %.2f ft*lbf/lbm\"%(Fpipe_4);\n", + "\n", + "# for 5 inch pipe\n", + "L = 100.; \t\t\t #[ft]\n", + "d = 5.047; \t\t\t #[inch]\n", + "Lbyd = (L*12.)/(d);\n", + "\n", + "# valves contributes 26 diameters and six elbows contribute 30 diameters ecah;therefore\n", + "Lbyd = Lbyd+26+6*30;\n", + "N = Lbyd/45.; \t\t\t # no. of velocity heads\n", + "N = N+kexit+kentrance;\n", + "U5 = Q/62.3;\n", + "Fpipe_5 = (N*(U5**2))/(2*gc);\n", + "print \" F5 in.pipes = %.2f ft*lbf/lbm\"%(Fpipe_5);\n", + "\n", + "# for 6 inch pipe\n", + "d = 6.065; \t\t #[inch]\n", + "L = 5.; \t\t\t #[ft]\n", + "Lbyd = (L*12.)/(d);\n", + "\n", + "# adding the contributions due to fittings \n", + "Lbyd = Lbyd+1*13+2*30;\n", + "N = Lbyd/45;\n", + "N = N+0+kentrance;\n", + "U6 = Q/90.;\n", + "Fpipe_6 = (N*(U6**2))/(2*gc);\n", + "print \" F6 in.pipes = %.3f ft*lbf/lbm\"%(Fpipe_6);\n", + "F_largepipes = Fpipe_4+Fpipe_5+Fpipe_6;\n", + "print \" Flarge pipes = %.2f ft*lbf/lbm\"%(F_largepipes);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " F4 in.pipes = 20.69 ft*lbf/lbm\n", + " F5 in.pipes = 7.28 ft*lbf/lbm\n", + " F6 in.pipes = 0.719 ft*lbf/lbm\n", + " Flarge pipes = 28.68 ft*lbf/lbm\n" + ] + } + ], + "prompt_number": 39 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.14 - Page No :459\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "l = 0.09238;\n", + "rh = 0.1624*l;\n", + "L = 300.;\n", + "de = 4.*rh;\n", + "p = 1000.; \t\t\t #[kg/m**3]\n", + "mu = 10.**-3; \t\t\t #[kg/m*sec]\n", + "Uavg = 1.667;\n", + "\n", + "# Calculations\n", + "Nre = (de*Uavg*p)/mu;\n", + "f = 0.0053;\n", + "deltap = ((4.*f*L)/de)*(p*(Uavg**2)*(1./2));\n", + "\n", + "# Results\n", + "print \" Pressure drop -deltap = %.3e kg/m*s = %.3e N/m**2 = %.1f kPa\"%(deltap,deltap,deltap*10**-3);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Pressure drop -deltap = 1.473e+05 kg/m*s = 1.473e+05 N/m**2 = 147.3 kPa\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.15 - Page No :466\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "Q = 400.; \t\t\t #[gpm]\n", + "p = 1.1*62.4; \t \t\t #[lbm/ft**3]\n", + "mu = 2.*(6.72*10**-4); \t #[lb/ft*sec]\n", + "e = 1.5*10**4;\n", + "\n", + "# Calculations\n", + "# 4 inch schedule pipe\n", + "d = 0.3355;\n", + "S = (math.pi*(d**2))/4;\n", + "U4 = Q/39.6;\n", + "ebyd = e/d;\n", + "w = 3671./60;\n", + "pm = 13.45*62.4;\n", + "g = 32.1;\n", + "gc = 32.174;\n", + "deltaz = 2.5;\n", + "deltap = (g/gc)*(pm-p)*(deltaz);\n", + "betaa = ((1.)/(1.+((2*p*gc)*(deltap))*(((0.61*S)/w)**2)))**(1./4);\n", + "d2 = betaa*d;\n", + "Nre2 = (4*w)/(math.pi*d2*mu);\n", + "a = (1./30)*4.026;\n", + "b = (1./4)*(2.013-1.21);\n", + "c = (1./8)*(2.42);\n", + "if a10**4:\n", + " c = 0.98;\n", + "\n", + "deltaz = 2.5;\n", + "deltap = (g/gc)*(pm-p)*(deltaz);\n", + "betaa = ((1.)/(1+((2*p*gc)*(deltap))*(((c*S)/w)**2)))**(1./4);\n", + "d2 = betaa*d;\n", + "\n", + "# Results\n", + "print \" The pertinentr details of the venturi design are Throat diameter = %.2f inch \\\n", + "\\n Approach angle = 25 Divergence angle = 7\"%(d2*12);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The pertinentr details of the venturi design are Throat diameter = 1.95 inch \n", + " Approach angle = 25 Divergence angle = 7\n" + ] + } + ], + "prompt_number": 44 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 10.17 - Page No :477\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "Uzmax = 3.455; \t\t\t #[ft/sec]\n", + "m = 32;\n", + "a1 = -0.3527;\n", + "a2 = -0.6473;\n", + "rbyro = 0.880;\n", + "\n", + "# Calculations\n", + "UzbyUzmax = 1+a1*(rbyro**2)+a2*(rbyro**(2*m));\n", + "Uz = Uzmax*(UzbyUzmax);\n", + "Uzavg = (4./9)*Uzmax+(5./18)*(Uz+Uz);\n", + "\n", + "# Results\n", + "print \" the average velocity is Uzavg = %.2f ft/sec \\\n", + "\\n Thus, in this Example there is an inherent error of 5.5 percent, even before any experimental errors are introduced\"%(Uzavg);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " the average velocity is Uzavg = 2.93 ft/sec \n", + " Thus, in this Example there is an inherent error of 5.5 percent, even before any experimental errors are introduced\n" + ] + } + ], + "prompt_number": 10 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Transport_Phenomena/.ipynb_checkpoints/ch11-checkpoint.ipynb b/Transport_Phenomena/.ipynb_checkpoints/ch11-checkpoint.ipynb new file mode 100644 index 00000000..aae61613 --- /dev/null +++ b/Transport_Phenomena/.ipynb_checkpoints/ch11-checkpoint.ipynb @@ -0,0 +1,598 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:085ad0ec85734bdfb705abcbca08635352c78385ff9e20ea7cd21f4d0ccfee40" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 11 : Heat and mass transfer in duct flow" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.1 - Page No :497\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "# Variables\n", + "# given\n", + "K_drywall = 0.28; \t\t\t #[Btu/ft*degF] - thermal conductivity of dry wall\n", + "K_fibreglass = 0.024; \t\t #[Btu/ft*degF] - thermal conductivity of fibre glass\n", + "K_concrete = 0.5; \t\t\t #[Btu/ft*degF] - thermal conductivity of concrete\n", + "T4 = 0.; \t\t #[degF]\n", + "T1 = 65.; \t\t\t #[degF]\n", + "deltaT = T4-T1; \t \t #[degF]\n", + "a = 1.; \t\t #[ft**2] - assuming area of 1 ft**2\n", + "deltax1 = 0.5/12; \t\t\t #[ft]\n", + "deltax2 = 3.625/12; \t\t #[ft]\n", + "deltax3 = 6./12; \t\t\t #[ft]\n", + "\n", + "# Calculations\n", + "R1 = deltax1/(K_drywall*a); \t\t\t #[h*degF/Btu]\n", + "R2 = deltax2/(K_fibreglass*a); \t\t\t #[h*degF/Btu]\n", + "R3 = deltax3/(K_concrete*a); \t \t\t #[h*degF/Btu]\n", + "qx = deltaT/(R1+R2+R3);\n", + "q12 = -qx;\n", + "q23 = -qx;\n", + "q34 = -qx;\n", + "deltaT1 = (-q12)*deltax1*(1./(K_drywall*a));\n", + "T2 = T1+deltaT1;\n", + "deltaT2 = (-q23)*deltax2*(1./(K_fibreglass*a));\n", + "T3 = T2+deltaT2;\n", + "deltaT3 = (-q34)*deltax3*(1./(K_concrete*a));\n", + "T4 = T3+deltaT3;\n", + "\n", + "# Results\n", + "print \" T1 = %.0f F \\\n", + "\\n T2 = %.1f F \\\n", + "\\n delta T2 = %.2f deg F \\\n", + "\\n T3 = %.2f F \\\n", + "\\n delta T3 = %.2f deg F \\\n", + "\\n T4 = %.0f F\"%(T1,T2,deltaT2,T3,deltaT3,T4);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " T1 = 65 F \n", + " T2 = 64.3 F \n", + " delta T2 = -59.56 deg F \n", + " T3 = 4.73 F \n", + " delta T3 = -4.73 deg F \n", + " T4 = 0 F\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.2 - Page No :501\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "r1 = (2.067/2.)/(12); \t\t #[ft]\n", + "r2 = r1+0.154/12; \t\t\t #[ft]\n", + "r3 = r2+3/12.; \t\t\t #[ft]\n", + "L = 1.; \t\t\t #[ft]\n", + "Ka = 26.; \t\t\t #[Btu/h*ft*degF]\n", + "Kb = 0.04; \t\t #[Btu/h*ft*degF]\n", + "T1 = 50.; \t\t\t #[degF]\n", + "\n", + "# Calculations\n", + "Ra = (math.log(r2/r1))/(2*math.pi*L*Ka);\n", + "Rb = (math.log(r3/r2))/(2*math.pi*L*Kb);\n", + "R = Ra+Rb;\n", + "deltaT = -18; \t\t\t #[degF] - driving force\n", + "Qr = -(deltaT/(R));\n", + "deltaT1 = (-Qr)*(Ra);\n", + "T2 = T1+deltaT1;\n", + "\n", + "# Results\n", + "print \" Qr = %.3f\"%Qr;\n", + "print \" The interface temperature is T2 = %.3f degF\"%(T2);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Qr = 3.589\n", + " The interface temperature is T2 = 49.997 degF\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.3 - Page No :502\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "Ra = 8.502*10**-4; \t\t\t #[h*degF*Btu**-1]\n", + "Rb = 5.014; \t\t \t #[h*degF*Btu**-1]\n", + "r1 = (2.067/2)/(12.); \t\t\t #[ft]\n", + "r2 = r1+0.154/12.; \t\t\t #[ft]\n", + "r3 = r2+3/12.; \t\t\t #[ft]\n", + "d1 = 2.*r1;\n", + "d0 = 2.*r3;\n", + "h0 = 25.; \t \t\t #[Btu/h*ft**2*degF]\n", + "h1 = 840.; \t\t\t #[Btu/h*ft**2*degF]\n", + "L = 1.; \t\t\t #[ft] - considering 1 feet length\n", + "\n", + "# Calculations\n", + "R0 = 1./(h0*math.pi*d0*L);\n", + "R1 = 1./(h1*math.pi*d1*L);\n", + "R = R0+R1+Ra+Rb;\n", + "deltaT = -400; \t\t\t #[degF]\n", + "Qr = -(deltaT)/R;\n", + "# the heat loss calculated above is the heat loss per foot.therefore for 500 ft\n", + "L = 500.;\n", + "Qr = Qr*L;\n", + "\n", + "# Results\n", + "print \" the heat loss for a 500 feet pipe is qr = %.2e Btu/h\"%(Qr);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " the heat loss for a 500 feet pipe is qr = 3.97e+04 Btu/h\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.5 - Page No :521\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "Nre = 50000.;\n", + "d = 0.04; \t\t\t #[m] - diameter of pipe\n", + "\n", + "# physical properties of water\n", + "T1 = 293.15; \t\t\t #[K]\n", + "T2 = 303.15; \t\t\t #[K]\n", + "T3 = 313.15; \t\t\t #[K]\n", + "p1 = 999.; \t\t\t #[kg/m**3] - density of water at temperature T1\n", + "p2 = 996.0; \t\t\t #[kg/m**3] - density of water at temperature T2\n", + "p3 = 992.1; \t\t\t #[kg/m**3] - density of water at temperature T3\n", + "mu1 = 1.001; \t\t\t #[cP] - viscosity of water at temperature T1\n", + "mu2 = 0.800; \t\t\t #[cP] - viscosity of water at temperature T2\n", + "mu3 = 0.654; \t\t\t #[cP] - viscosity of water at temperature T3\n", + "k1 = 0.63; \t\t\t #[W/m*K] - thermal conductivity of water at temperature T1\n", + "k2 = 0.618; \t\t\t #[W/m*K] - thermal conductivity of water at temperature T2\n", + "k3 = 0.632; \t\t\t #[W/m*K] - thermal conductivity of water at temperature T3\n", + "cp1 = 4182.; \t\t\t #[J/kg*K] - heat capacity of water at temperature T1\n", + "cp2 = 4178.; \t\t\t #[J/kg*K] - heat capacity of water at temperature T2\n", + "cp3 = 4179.; \t\t\t #[J/kg*K] - heat capacity of water at temperature T3\n", + "Npr1 = 6.94; \t\t\t # prandtl no. at temperature T1\n", + "Npr2 = 5.41; \t\t\t # prandtl no. at temperature T2\n", + "Npr3 = 4.32; \t\t\t # prandtl no. at temperature T3\n", + "\n", + "\n", + "# Calculations\n", + "# (a) Dittus -Boelter-this correction evalutes all properties at the mean bulk temperature,which is T1\n", + "kmb = 0.603\n", + "h = (kmb/d)*0.023*((Nre)**(0.8))*((Npr1)**0.4);\n", + "\n", + "\n", + "# Results\n", + "print \" a) Dittus -Boelter the heat transfer coefficient is \\nh = %.0f W/m**2*K \\\n", + " = %.0f Btu/ft**2*h**-1*degF\"%(h,h*0.17611);\n", + "\n", + "# (b) Seid_er Tate-this correlation evaluates all the properties save muw at the mean bulk temperature \n", + "h = (kmb/d)*(0.027)*((Nre)**0.8)*((Npr1)**(1./3))*((mu1/mu3)**0.14);\n", + "print \" b) Seid_er Tate the heat transfer coefficient is \\nh = %.0f W/m**2*K \\\n", + " = %.0f Btu/ft**2*h**-1*degF\"%(h,h*0.17611);\n", + "\n", + "# (c) Sleicher-Rouse equation\n", + "a = 0.88-(0.24/(4+Npr3));\n", + "b = (1./3)+0.5*math.exp((-0.6)*Npr3);\n", + "Nref = Nre*(mu1/mu2)*(p2/p1);\n", + "Nnu = 5+0.015*((Nref)**a)*((Npr3)**b);\n", + "h = Nnu*(kmb/d);\n", + "print \" c) Sleicher-Rouse equation the heat transfer coefficient is \\nh = %.0f W/m**2*K \\\n", + " = %.0f Btu/ft**2*h**-1*degF\"%(h,h*0.17611);\n", + "\n", + "# (d) Colbum Analogy- the j factor for heat transfer is calculated\n", + "jh = 0.023*((Nref)**(-0.2));\n", + "Nst = jh*((Npr2)**(-2./3));\n", + "U = (Nre*mu1*10**-3)/(d*p1);\n", + "h = Nst*(p1*cp1*U);\n", + "print \" d) Colbum Analogy the heat transfer coefficient is \\nh \\\n", + " = %.0f W/m**2*K = %.0f Btu/ft**2*h**-1*degF\"%(h,h*0.17611);\n", + "\n", + "# (e) Friend-Metzner\n", + "f = 0.005227;\n", + "Nnu = ((Nre)*(Npr1)*(f/2.)*((mu1/mu3)**0.14))/(1.20+((11.8)*((f/2)**(1./2))*(Npr1-1)*((Npr1)**(-1./3))));\n", + "h = Nnu*(kmb/d);\n", + "print \" e) Friend-Metzner the heat transfer coefficient is \\nh = %.0f W/m**2*K \\\n", + " = %.0f Btu/ft**2*h**-1*degF\"%(h,h*0.17611);\n", + "\n", + "# (f) Numerical analysis\n", + "Nnu = 320.;\n", + "h = Nnu*(kmb/d);\n", + "print \" f) Numerical analysis the heat transfer coefficient is \\nh = %.0f W/m**2*K \\\n", + " = %.0f Btu/ft**2*h**-1*degF\"%(h,h*0.17611);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a) Dittus -Boelter the heat transfer coefficient is \n", + "h = 4322 W/m**2*K = 761 Btu/ft**2*h**-1*degF\n", + " b) Seid_er Tate the heat transfer coefficient is \n", + "h = 4733 W/m**2*K = 834 Btu/ft**2*h**-1*degF\n", + " c) Sleicher-Rouse equation the heat transfer coefficient is \n", + "h = 4766 W/m**2*K = 839 Btu/ft**2*h**-1*degF\n", + " d) Colbum Analogy the heat transfer coefficient is \n", + "h = 4292 W/m**2*K = 756 Btu/ft**2*h**-1*degF\n", + " e) Friend-Metzner the heat transfer coefficient is \n", + "h = 4713 W/m**2*K = 830 Btu/ft**2*h**-1*degF\n", + " f) Numerical analysis the heat transfer coefficient is \n", + "h = 4824 W/m**2*K = 850 Btu/ft**2*h**-1*degF\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.6 - Page No :525\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "# given\n", + "Tw = 680.; \t\t\t #[K] - temperature at the wall\n", + "Tb = 640.; \t\t\t #[K] - temperature at the bulk\n", + "Tf = (Tw+Tb)/2; \t\t\t #[K]\n", + "Nre = 50000.;\n", + "vmb = 2.88*10.**-7;\n", + "vf = 2.84*10.**-7;\n", + "Nref = Nre*(vmb/vf);\n", + "k = 27.48;\n", + "d = 0.04;\n", + "\n", + "# Calculation and Results\n", + "# from table 11.3 the prandtl no. is\n", + "Npr = 8.74*10**-3\n", + "\n", + "# consmath.tant heat flow\n", + "Nnu = 6.3+(0.0167)*((Nref)**0.85)*((Npr)**0.93);\n", + "h = Nnu*(k/d);\n", + "print \" constant heat flow h = %.0f W/m**2*K = %.0f Btu/ft**2*h*degF\"%(h,round(h*0.17611,-1));\n", + "\n", + "# constant wall temperature\n", + "Nnu = 4.8+0.0156*((Nref)**0.85)*((Npr)**0.93);\n", + "h = Nnu*(k/d);\n", + "print \" constant wall temperature h = %d W/m**2*K = %d Btu/ft**2*h*degF\"%(h,h*0.17611);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " constant heat flow h = 5723 W/m**2*K = 1010 Btu/ft**2*h*degF\n", + " constant wall temperature h = 4600 W/m**2*K = 810 Btu/ft**2*h*degF\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.7 - Page No :536\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "di = 0.620; \t\t\t #[inch] - internal diameter\n", + "d0 = 0.750; \t\t\t #[inch] - outer diameter\n", + "Ai = 0.1623; \t\t\t #[ft**2/ft]\n", + "Ao = 0.1963; \t\t\t #[ft**2/ft]\n", + "wc = 12*(471.3/0.9425); #[lb/h]\n", + "cp = 1.; \t\t\t #[Btu/lbm*degF] - heat capacity of water\n", + "Tco = 110.;\n", + "Tci = 50.;\n", + "\n", + "# Calculations\n", + "qtotal = wc*cp*(Tco-Tci);\n", + "deltaH_coldwater = 3.6*10**5;\n", + "deltaH_vapourization = 1179.7-269.59;\n", + "wh = deltaH_coldwater/deltaH_vapourization;\n", + "hi = 80.; \t\t\t #[Btu/h*ft**2*degF]\n", + "ho = 500.; \t\t\t #[Btu/h*ft**2*degF]\n", + "km = 26.; \t\t\t #[Btu/h*ft*degF]\n", + "Ui = 1./((1./hi)+((Ai*math.log(d0/di))/(2*math.pi*km))+(Ai/(Ao*ho)));\n", + "deltaT1 = 300-50.;\n", + "deltaT2 = 300-110.;\n", + "LMTD = (deltaT1-deltaT2)/(math.log(deltaT1/deltaT2));\n", + "A = qtotal/(Ui*LMTD);\n", + "L = A/Ai;\n", + "\n", + "# Results\n", + "print \"the length of the heat exchanger is L = %.2f ft\"%(L);\n", + "\n", + "# Answer is slightly different becasue of rounding error." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the length of the heat exchanger is L = 145.53 ft\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.8 - Page No :537\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "L = 30.; \t\t\t #[ft] - length\n", + "Ai = 0.1623*L;\n", + "di = 0.620; \t\t\t #[inch] - internal diameter\n", + "d0 = 0.750; \t\t\t #[inch] - outer diameter\n", + "Ao = 0.1963*L; \t\t #[ft**2/ft]\n", + "wc = 12.*(471.3/0.9425);\n", + "cp = 1.; \t\t\t #[Btu/lbm*degF] - heat capacity of water\n", + "\n", + "# Calculations\n", + "deltaH_coldwater = 3.6*10**5;\n", + "deltaH_vapourization = 1179.7-269.59;\n", + "wh = deltaH_coldwater/deltaH_vapourization;\n", + "hi = 80.; \t\t\t #[Btu/h*ft**2*degF]\n", + "ho = 500.; \t\t #[Btu/h*ft**2*degF]\n", + "km = 26.; \t\t\t #[Btu/h*ft*degF]\n", + "Ui = 1./((1./hi)+(((Ai/L)*math.log(d0/di))/(2*math.pi*km))+(Ai/(Ao*ho)));\n", + "deltaT1 = 300-50.;\n", + "deltaT = deltaT1/(math.exp((Ui*Ai)/(wc*cp)));\n", + "Tsat = 300.;\n", + "Tc2 = Tsat-deltaT;\n", + "\n", + "# Results\n", + "print \" Therefore, the outlet temperature of the cold fluid_ is Tc2 = %.2f degF\"%(Tc2);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Therefore, the outlet temperature of the cold fluid_ is Tc2 = 63.75 degF\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.9 - Page No :538\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "Ai = 4.869;\n", + "wc = 6000.;\n", + "cp = 1.;\n", + "Rf = 0.002;\n", + "Uclean = 69.685;\n", + "\n", + "# Calculations\n", + "Udirty = 1./(Rf+(1./Uclean));\n", + "deltaT1 = 300.-50;\n", + "deltaT2 = deltaT1/(math.exp((Udirty*Ai)/(wc*cp)));\n", + "Th2 = 300.;\n", + "Tc2 = Th2-deltaT2;\n", + "\n", + "# Results\n", + "print \" the outlet temperature is Tc2 = %.1f degF\"%(Tc2);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " the outlet temperature is Tc2 = 62.1 degF\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 11.10 - Page No :544\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "Ui = 325.; \t\t\t #[W/m**2*K] - overall heat transfer coefficient\n", + "Thi = 120.; \t\t\t #[degC] - inlet temperature of hydrocarbon\n", + "Tho = 65.; \t\t\t #[degC] - outlet temperature of hydrocarbon\n", + "Tci = 15.; \t\t\t #[degC] - inlet temperature of water\n", + "Tco = 50.; \t\t\t #[degC] - outlet temperture of water\n", + "cp = 4184.; \t\t\t #[J/kg*K] - heat capacity of water\n", + "ch = 4184.*0.45\t\t\t #[J/kg*K] - heat capacity of hydrocarbon\n", + "wc = 1.2; \t\t\t #[kg/sec] - mass flow rate of water\n", + "\n", + "# Calculation and Results\n", + "wh = ((wc*cp)*(Tco-Tci))/((ch)*(Thi-Tho));\n", + "qtotal = wc*cp*(Tco-Tci);\n", + "\n", + "# (a) - parallel double pipe\n", + "F = 1.;\n", + "Thi = 120.; \t\t\t #[degC] - inlet temperature of hydrocarbon\n", + "Tho = 65.; \t\t\t #[degC] - outlet temperature of hydrocarbon\n", + "Tci = 15.; \t\t\t #[degC] - inlet temperature of water\n", + "Tco = 50.; \t\t\t #[degC] - outlet temperture of water\n", + "deltaT1 = Thi-Tci;\n", + "deltaT2 = Tho-Tco;\n", + "LMTD = (deltaT2-deltaT1)/(math.log(deltaT2/deltaT1));\n", + "Ai = qtotal/((Ui*LMTD));\n", + "print \" a) parallel double pipe Ai = %.2f m**2\"%(Ai);\n", + "\n", + "# (b) - counter flow\n", + "F = 1.;\n", + "Thi = 120.; \t\t\t #[degC] - inlet temperature of hydrocarbon\n", + "Tho = 65.; \t\t\t #[degC] - outlet temperature of hydrocarbon\n", + "Tco = 15.; \t\t\t #[degC] - inlet temperature of water\n", + "Tci = 50.; \t\t\t #[degC] - outlet temperture of water\n", + "deltaT1 = Thi-Tci;\n", + "deltaT2 = Tho-Tco;\n", + "LMTD = (deltaT2-deltaT1)/(math.log(deltaT2/deltaT1));\n", + "Ai = qtotal/((Ui*LMTD));\n", + "print \" b) counter flow Ai = %.2f m**2\"%(Ai);\n", + "\n", + "# (c) - 1-2 shell and tube \n", + "Thi = 120.; \t\t\t #[degC] - inlet temperature of hydrocarbon\n", + "Tho = 65.; \t\t\t #[degC] - outlet temperature of hydrocarbon\n", + "Tci = 15.; \t\t\t #[degC] - inlet temperature of water\n", + "Tco = 50.; \t\t\t #[degC] - outlet temperture of water\n", + "Z = (Thi-Tho)/(Tco-Tci);\n", + "nh = (Tco-Tci)/(Thi-Tci);\n", + "deltaT1 = Thi-Tco;\n", + "deltaT2 = Tho-Tci;\n", + "F = 0.92;\n", + "LMTD = (F*(deltaT2-deltaT1))/(math.log(deltaT2/deltaT1));\n", + "Ai = qtotal/((Ui*LMTD));\n", + "print \" c) 1-2 shell and tube Ai = %.2f m**2\"%(Ai);\n", + "\n", + "# (d) - 2-4 shell and tube\n", + "Thi = 120.; \t\t\t #[degC] - inlet temperature of hydrocarbon\n", + "Tho = 65.; \t\t\t #[degC] - outlet temperature of hydrocarbon\n", + "Tci = 15.; \t\t\t #[degC] - inlet temperature of water\n", + "Tco = 50.; \t\t\t #[degC] - outlet temperture of water\n", + "Z = (Thi-Tho)/(Tco-Tci);\n", + "nh = (Tco-Tci)/(Thi-Tci);\n", + "F = 0.975;\n", + "LMTD = (F*(deltaT2-deltaT1))/(math.log(deltaT2/deltaT1));\n", + "Ai = qtotal/((Ui*LMTD));\n", + "print \" d) 2-4 shell and tube Ai = %.2f m**2\"%(Ai);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a) parallel double pipe Ai = 11.69 m**2\n", + " b) counter flow Ai = 9.10 m**2\n", + " c) 1-2 shell and tube Ai = 9.89 m**2\n", + " d) 2-4 shell and tube Ai = 9.33 m**2\n" + ] + } + ], + "prompt_number": 19 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Transport_Phenomena/.ipynb_checkpoints/ch12-checkpoint.ipynb b/Transport_Phenomena/.ipynb_checkpoints/ch12-checkpoint.ipynb new file mode 100644 index 00000000..b890667e --- /dev/null +++ b/Transport_Phenomena/.ipynb_checkpoints/ch12-checkpoint.ipynb @@ -0,0 +1,674 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:cf1ae634b67dbf9ac3cc91134d4c30acd13efd02af03447d121a71d1c5277a05" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 12 : Transport past immersed bodies" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.2 - Page No :562\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "# Variables\n", + "p = 1.2047*0.06243; \t\t\t #[lb/ft**3]\n", + "mu = (18.17*10**-6)*(0.6720); \t #[lb/ft*sec]\n", + "v = mu/p;\n", + "x = 2.; \t\t\t #[ft]\n", + "U = 6.; \t\t\t #[ft/sec]\n", + "\n", + "# Calculation and Results\n", + "Nre = (x*U)/v;\n", + "print \"The Reynolds number is well within the laminar region %.3e Nre\"%Nre\n", + "del_ = 5*x*(Nre)**(-1./2);\n", + "C1 = 0.33206;\n", + "Cd = 2.*C1*(Nre)**(-1./2);\n", + "L2 = 2.; \t\t\t #[ft]\n", + "L1 = 1.; \t\t\t #[ft]\n", + "b = 1.;\n", + "F = ((2*(C1)*U*b))*((mu*p*U)**(1./2))*(((L2)**(1./2))-((L1)**(1./2)));\n", + "gc = 32.174;\n", + "F = F/gc;\n", + "print \" The value of F properly expressed in force units is F = %.3e lbf\"%(F);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Reynolds number is well within the laminar region 7.391e+04 Nre\n", + " The value of F properly expressed in force units is F = 1.204e-04 lbf\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.3 - Page No :569\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "# Variables\n", + "U = 3.; \t\t\t #[m/sec]\n", + "x1 = 1.; \t\t\t #[m]\n", + "x2 = 2.; \t\t\t #[m]\n", + "\n", + "# Calculations\n", + "p = 1./(1.001*10**-3); \t\t\t #[kg/m**3];\n", + "mu = 1.*10**-3; \t\t\t #[kg/m*sec]\n", + "Nre1 = (x1*U*p)/(mu);\n", + "Nre2 = (x2*p*U)/(mu);\n", + "tauw = (1./2)*(p*(U**2))*((2*math.log10(Nre1)-0.65)**(-2.3));\n", + "B = 1700.;\n", + "Cd = (0.455*(math.log10(Nre2))**-2.58)-(B/(Nre2));\n", + "Lb = 2.0;\n", + "F = (1./2)*(p*(U**2))*(Lb)*(Cd);\n", + "\n", + "Xc = round((5*10**5 * mu)/(U*p),3)\n", + "CDlaminar = round(4*.33206*(5*10**5)**(-1./2),5)\n", + "Flaminar= round(1./2*(p*U**2)*Xc*CDlaminar,3)\n", + "Cd = round(.455*((math.log10(Nre2))**-2.58),6)\n", + "Fturbulent1 = round(1./2*(p*U**2)*x2*Cd,2)\n", + "Fturbulent2 = round(1./2*(p*U**2)*Xc*.005106,3)\n", + "Factual = 1.411 + Fturbulent1 - Fturbulent2\n", + "\n", + "\n", + "# Results\n", + "print \" the drag on the plate is F = %f kg*m/sec**2 = %.1f N\"%(F,F);\n", + "print ' total drag on the plate Factual = %.2f N'%Factual\n", + "print \" the shear stress is %.f N/m^2\"%tauw\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " the drag on the plate is F = 26.801111 kg*m/sec**2 = 26.8 N\n", + " total drag on the plate Factual = 26.93 N\n", + " the shear stress is 14 N/m^2\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.5 - Page No :576\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables \n", + "T = 290.; \t\t\t #[K] - temperature of flowing water\n", + "U = 3.; \t\t\t #[m/sec] - free stream velocity\n", + "Tfs = 285.; \t\t\t #[K] - temperature of free stream\n", + "vr = 10.**-3; \t\t\t #[m**3/kg] - volume per unit mass\n", + "p = 1./vr; \t\t\t #[kg/m**3] - density of water at Tfs\n", + "mu = 1225.*10**-6; \t #[N*sec/m**2]\n", + "k = 0.590; \t\t\t #[W/m*K]\n", + "Npr = 8.70;\n", + "\n", + "# Calculation and Results\n", + "# (a) The length of laminar boundary\n", + "Nre = 5.*10**5;\n", + "xc = (Nre)*(mu/(p*U));\n", + "print \" a) The length of laminar boundary is xc = %.4f m\"%(xc);\n", + "# (b) Thickness of the momentum boundary layer and thermal boundary layer\n", + "del_ = 5*xc*((Nre)**(-1./2));\n", + "del_h = del_*((Npr)**(-1./3));\n", + "print \" b) The thickness of momentum boundary layer is del_ = %.3e m \\n The \\\n", + " thickness of the hydryodynamic layer is del_h = %.3e m\"%(del_,del_h);\n", + "\n", + "# (c) Local heat transfer coefficient\n", + "x = 0.2042; \t\t\t #[ft]\n", + "hx = ((0.33206*k)/(x))*((Nre)**(1./2))*((Npr)**(1./3));\n", + "print \" c) The local heat transfer coefficient is h = %.0f W/m**2*K \\\n", + " = %.0f Btu/hr*ft**2*degF\"%(hx,hx*0.17611);\n", + "\n", + "# (d) Mean heat transfer coefficient\n", + "hm = 2*hx;\n", + "print \" d) The mean heat transfer coefficient is h = %.0f W/m**2*K \\\n", + " = %.0f Btu/hr*ft**2*degF\"%(hm,round(hm*0.17611,1));\n", + "\n", + "# Answer may vary because of rounding error.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a) The length of laminar boundary is xc = 0.2042 m\n", + " b) The thickness of momentum boundary layer is del_ = 1.444e-03 m \n", + " The thickness of the hydryodynamic layer is del_h = 7.019e-04 m\n", + " c) The local heat transfer coefficient is h = 1395 W/m**2*K = 246 Btu/hr*ft**2*degF\n", + " d) The mean heat transfer coefficient is h = 2791 W/m**2*K = 492 Btu/hr*ft**2*degF\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.10 - Page No :590\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T = 293.15; \t\t\t #[K]\n", + "pp = 999.; \t\t\t #[kg/m**3] - density of water\n", + "mu = 0.01817*10**-3; \t #[kg/m*sec] - viscosity of air\n", + "p = 1.205; \t\t\t #[kg/m**3] - density of air\n", + "d = 5*10**-6; \t\t\t #[m] - particle diameter\n", + "g = 9.80; \t\t\t #[m/sec**2]\n", + "\n", + "# Calculations\n", + "rp = d/2;\n", + "Ut = ((2*g*(rp**2))*(pp-p))/(9*mu);\n", + "Nre = (d*Ut*p)/(mu);\n", + "Fp = 6*math.pi*mu*rp*Ut;\n", + "\n", + "# Results\n", + "print \" The drag force is Fp = %.2e N\"%(Fp);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The drag force is Fp = 6.40e-13 N\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.11 - Page No :591\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T = 293.15; \t\t\t #[K]\n", + "pp = 999.; \t\t\t #[kg/m**3] - density of water\n", + "mu = 0.01817*10**-3; \t #[kg/m*sec] - viscosity of air\n", + "p = 1.205; \t\t\t #[kg/m**3] - density of air\n", + "d = 5*10**-6; \t\t\t #[m] - particle diameter\n", + "g = 9.80; \t\t\t #[m/sec**2]\n", + "\n", + "# Calculations\n", + "rp = d/2;\n", + "Ut = ((2*g*(rp**2))*(pp-p))/(9*mu);\n", + "Nre = (d*Ut*p)/(mu);\n", + "t = ((-2*(rp**2)*pp))/(9*mu)*(math.log(1-0.99));\n", + "\n", + "# Results\n", + "print \" Time for the drop of water in previous Example from an initial \\\n", + " velocity of zero to 0.99*Ut is \\n t = %.3e sec\"%(t);\n", + "print \" In other words, the drop accelerates almost instantaneously to its terminal velocity\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Time for the drop of water in previous Example from an initial velocity of zero to 0.99*Ut is \n", + " t = 3.517e-04 sec\n", + " In other words, the drop accelerates almost instantaneously to its terminal velocity\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.12 - Page No : 594\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "pp = 1.13*10**4; \t\t\t #[kg/m**3] - density of lead particle\n", + "p = 1.22; \t\t\t #[kg/m**3] - density of air\n", + "g = 9.80; \t\t\t #[m/sec**2] - acceleration due to gravity\n", + "d = 2*10**-3; \t\t\t #[m] - diameter of particle\n", + "mu = 1.81*10**-5; \t\t\t #[kg/m*sec] - viscosity of air\n", + "\n", + "# Calculations\n", + "# let us assume\n", + "Cd = 0.44;\n", + "Ut = ((4*d*g*(pp-p))/(3*p*Cd))**(1./2);\n", + "Nre = (Ut*d*p)/(mu);\n", + "\n", + "# from fig 12,16 value of Cd is\n", + "Cd = 0.4;\n", + "Ut = ((4*d*g*(pp-p))/(3*p*Cd))**(1./2);\n", + "Nre = (Ut*d*p)/(mu);\n", + "\n", + "# Results\n", + "# Within the readibility of the chart Cd is unchanged and therefore the above obtained Cd is the final answer\n", + "\n", + "print \" The terminal velocity is Ut = %.2f m/sec\"%(Ut);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The terminal velocity is Ut = 24.60 m/sec\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.13 - Page No :595\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "distance = 1./12; \t #[ft]\n", + "time = 60.; \t\t #[sec]\n", + "Ut = distance/time;\n", + "mu = 1.68; \t\t #[lb/ft*sec] - viscosity \n", + "pp = 58.; \t\t\t #[lb/ft**3] - density of sphere\n", + "p = 50.; \t\t\t #[lb/ft**3] - density of polymer solution\n", + "g = 32.; \t\t\t #[ft/sec] - acceleration due to gravity\n", + "\n", + "# Calculations\n", + "rp = ((9*mu)*(Ut)*((2*g)**(-1))*((pp-p)**(-1)))**(1./2);\n", + "Nre = (rp*2*Ut*p)/(mu);\n", + "\n", + "# Results\n", + "print \" The required particle diameter would be about %.2f inch\"%(rp*2*12);\n", + "print \"Nre = %.2e\"%Nre\n", + "print \" This reynolds number is well within the stokes law region ; thus the design is reasonable\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The required particle diameter would be about 0.15 inch\n", + "Nre = 5.29e-04\n", + " This reynolds number is well within the stokes law region ; thus the design is reasonable\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.14 - Page No :616\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T = 842.; \t\t\t #[degF] - temperature\n", + "P = 14.6; \t\t\t #[psia] - pressure\n", + "p = 0.487; \t\t #[kg/m**3] - density of air\n", + "mu = 3.431*10**-5; \t #[kg/m*sec] - viscosity of air\n", + "k = 0.05379; \t\t\t #[W/m*K] - thermal conductivity\n", + "Npr = 0.7025; \t\t\t #prandtl no.\n", + "\n", + "# Calculation and Results\n", + "# (a) static void_ fraction\n", + "mcoal = 15.*2000; \t #[lb] - mass of coal\n", + "pcoal = 94.; \t\t #[lbm/ft**3] - density of coal\n", + "d = 10.; \t\t\t #[ft]\n", + "L = 7.; \t\t\t #[ft]\n", + "area = ((math.pi*(d**2))/4);\n", + "Vcoal = mcoal/pcoal;\n", + "Vtotal = area*L;\n", + "e = (Vtotal-Vcoal)/(Vtotal);\n", + "print \"(a) The void_ fraction is E = %.2f\"%e\n", + "\n", + "# (b) minimum void_ fraction and bed height\n", + "d = 200.; \t\t\t #[um] - particle diameter\n", + "Emf = 1-0.356*((math.log10(d))-1);\n", + "\n", + "# this value seems to be a lottle low and therefore 0.58 will be used\n", + "Emf = 0.58;\n", + "Lmf = ((L)*(1-e))/(1-Emf);\n", + "print \" b) The bed height is Lmf = %.3f ft\"%(Lmf);\n", + "\n", + "# (c) Minimum fluid_ization velocity\n", + "P1 = 20.; \t\t\t #[psia]\n", + "P2 = 14.696; \t\t\t #[psia]\n", + "p1 = (p*P1)/(P2);\n", + "\n", + "# the archimid_es no. is\n", + "g = 9.78; \t\t\t #[m/sec**2]\n", + "Nar = p1*g*((d*10**-6)**3)*(1506-p1)*((1./(mu)**2));\n", + "C1 = 27.2;\n", + "C2 = 0.0408;\n", + "Nremf = (((C1**2)+C2*Nar)**(1./2))-C1;\n", + "Umf = (Nremf*mu)/((d*10**-6)*p1);\n", + "print \" c) The minimum fluid_ization velocity is Umf = %.4f %% m/sec\"%(Umf);\n", + "\n", + "# (d) Minimum pressure\n", + "del_tapmf = (1506-p1)*(g)*(1-Emf)*((Lmf*12*2.54)/(100))+p1*g*Lmf;\n", + "print \" d) The minimum pressure drop for fluid_ization is -del_tapmf = %.3e Pa\"%(del_tapmf);\n", + "\n", + "# (e) Particle settling velocity\n", + "Cd = 0.44;\n", + "Ut = (((8*((d*10**-6)/2)*g)*(1506-p1))/(3*p1*Cd))**(1./2);\n", + "Nrep = (Ut*d*10**-6*p1)/(mu);\n", + "print \"Nrep = %.2f\"%Nrep\n", + "Ut = ((5.923/18.5)*(((d*10**-6)*p1)/(mu))**(0.6))**(1./(2-0.6))\n", + "print \" e) The particle settling velocity is Ut = %.5f m/sec\"%(Ut);\n", + "\n", + "# (f) Bed to wall heat transfer coefficient\n", + "Nrefb = (d*10**-6)*2.5*Umf*p1*(1./mu);\n", + "Nnufb = 0.6*Npr*((Nrefb)**(0.3));\n", + "hw = Nnufb*(k/(d*10**-6));\n", + "print \" f) The bed to wall heat transfer coefficient is hw = %.1f W/m**2*K\"%(hw);\n", + "\n", + "# Answer may vary because of rounding error." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a) The void_ fraction is E = 0.42\n", + " b) The bed height is Lmf = 9.675 ft\n", + " c) The minimum fluid_ization velocity is Umf = 0.0129 % m/sec\n", + " d) The minimum pressure drop for fluid_ization is -del_tapmf = 1.830e+04 Pa\n", + "Nrep = 14.18\n", + " e) The particle settling velocity is Ut = 0.79114 m/sec\n", + " f) The bed to wall heat transfer coefficient is hw = 60.6 W/m**2*K\n" + ] + } + ], + "prompt_number": 22 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.15 - Page No :618\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "pp = 249.6; \t\t #[lb/ft**3] - density of catalyst\n", + "p = 58.; \t\t\t #[lb/ft**3] - density of liquid\n", + "g = 32.174; \t\t #[ft/sec**2]\n", + "gc = 32.174;\n", + "Lmf = 5.; \t\t\t #[ft] - height of bed\n", + "mu = 6.72*10**-3; \t #[lbm/ft*sec] - viscosity of liquid\n", + "dp = 0.0157/12; \t #[ft] - diameter of particle\n", + "emf = 0.45;\n", + "\n", + "# Calculations\n", + "del_tapmf = (pp-p)*(g/gc)*(1-emf)*(Lmf);\n", + "Nar = (p*g*dp**3)*(pp-p)*(1./(mu)**2);\n", + "C1 = 27.2;\n", + "C2 = 0.0408;\n", + "Nremf = (((C1**2)+C2*Nar)**(1./2))-C1;\n", + "Umf = Nremf*(mu/(dp*p));\n", + "\n", + "# Results\n", + "print \" Minimum fluidization velocity is Umf = %.2e ft/sec\"%(Umf);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Minimum fluidization velocity is Umf = 1.18e-03 ft/sec\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.16 - Page No :624\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "d = 24.*10**-6; \t\t\t #[m] - diameter of wire\n", + "T = 415.; \t\t\t #[K] - operating temperature of hot wire anemometer\n", + "P = 0.1; \t\t\t #[W] - power consumption\n", + "L = 250.*d;\n", + "Tair = 385.; \t\t\t #[K] - temperature of air in duct\n", + "A = math.pi*d*L;\n", + "Tfilm = (T+Tair)/2.;\n", + "\n", + "# properties of air at Tfilm\n", + "p = 0.8825; \t\t\t #[kg/m**3]\n", + "mu = 2.294*10**-5; \t\t\t #[kg/m*s]\n", + "cpf = 1013.; \t\t\t #[J*kg/K]\n", + "kf = 0.03305; \t\t\t #[W/m*K]\n", + "Npr = 0.703;\n", + "\n", + "# Calculations\n", + "h = P/(A*(T-Tair));\n", + "Nnu = (h*d)/kf;\n", + "def func(x):\n", + " return Nnu-0.3-((0.62*(x**(1./2))*(Npr**(1./3)))/((1+((0.4/Npr)**(2./3)))**(1./4)))*((1+((x/(2.82*(10**5)))**(5./8)))**(4./5));\n", + "\n", + "# on solving the above function for x by umath.sing some root solver technique like Newton raphson method , we get\n", + "x = 107.7;\n", + "\t\t\t # or\n", + "Nre = 107.7;\n", + "y = func(x);\n", + "Um = (Nre*mu)/(d*p);\n", + "\n", + "# Results\n", + "print \" The velocity is Um = %.1f m/sec = %d ft/sec\"%(Um,Um*3.28);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The velocity is Um = 116.6 m/sec = 382 ft/sec\n" + ] + } + ], + "prompt_number": 25 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 12.17 - Page No :630\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "dt = 0.75;\n", + "St = 1.5*dt;\n", + "Sl = 3.*dt;\n", + "Lw = 1.; \t\t\t #[m]\n", + "N = 12.;\n", + "Stotalarea = N*(St/12.)*Lw;\n", + "Sminarea = N*((St-dt)/12.)*Lw*0.3048;\n", + "\n", + "# properties of air at 293.15 K\n", + "p = 1.204; \t\t\t #[kg/m**3]\n", + "mu = 1.818*10**-5; \t #[kg/m*s]\n", + "cp = 1005.; \t\t\t #[J*kg/K];\n", + "k = 0.02560; \t\t\t #[J/s*m*K]\n", + "Npr = (cp*mu)/k;\n", + "U_inf = 7.; \t\t\t #[m/sec]\n", + "\n", + "# Calculations\n", + "Umax = U_inf*(St/(St-dt));\n", + "w = p*Umax*Sminarea;\n", + "C_tubes = 0.05983; \t\t\t #[m**2/m] - circumference of the tubes\n", + "N_tubes = 96.;\n", + "Atubes = N_tubes*C_tubes*Lw;\n", + "Tw = 328.15; \t\t\t #[K]\n", + "Tinf = 293.15; \t\t\t #[K]\n", + "Tin = 293.15; \t\t\t #[K]\n", + "Tout = 293.15; \t\t #[K]\n", + "u = 100.;\n", + "while u>10**-1:\n", + " T = (Tin+Tout)/2\n", + " Told = Tout;\n", + " p = -(0.208*(10**-3))+(353.044/T);\n", + " mu = -(9.810*(10**-6))+(1.6347*(10**-6)*(T**(1./2)));\n", + " cp = 989.85+(0.05*T);\n", + " k = 0.003975+7.378*(10**-5)*T;\n", + " Npr = (cp*mu)/k;\n", + " dt = 0.75*0.0254;\n", + " Gmax = w/Sminarea;\n", + " Nre = (dt*Gmax)/mu;\n", + " h = 0.27*(k/dt)*(Npr**0.36)*(Nre**0.63);\n", + " h = h*0.98;\n", + " del_taT = (h*Atubes*(Tw-Tinf))/(w*cp);\n", + " Tout = Tin+del_taT;\n", + " u = abs(Tout-Told);\n", + "\n", + "T = (Tin+Tout)/2\n", + "p = -(0.208*(10**-3))+(353.044/T);\n", + "mu = -(9.810*(10**-6))+(1.6347*(10**-6)*(T**(1./2)));\n", + "dt = 0.75;\n", + "dv = (4*(St*Sl-(math.pi*(dt**2)*(1./4))))/(math.pi*dt)*(0.09010/3.547);\n", + "de = dv;\n", + "Nre = (dv*24.72)/mu;\n", + "dv = dv/(0.09010/3.547);\n", + "ftb = 1.92*(Nre**(-0.145));\n", + "Zt = Sl;\n", + "Ltb = 8*Sl;\n", + "del_tap = (ftb*(24.72**2))/(2*p*(dv/Ltb)*((St/dv)**0.4)*((St/Zt)**0.6));\n", + "\n", + "# Results\n", + "print \" del_tap = %.0f kg/m*s = %.0f N/m**2 = %f psia\"%(del_tap,del_tap,round(del_tap*0.1614/1113,5))\n", + "print \" Exit temperature : %.2f K\"%T\n", + "# answer may slightly vary because of rounding error." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " del_tap = 1113 kg/m*s = 1113 N/m**2 = 0.161350 psia\n", + " Exit temperature : 299.87 K\n" + ] + } + ], + "prompt_number": 4 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Transport_Phenomena/.ipynb_checkpoints/ch13-checkpoint.ipynb b/Transport_Phenomena/.ipynb_checkpoints/ch13-checkpoint.ipynb new file mode 100644 index 00000000..54f84e7f --- /dev/null +++ b/Transport_Phenomena/.ipynb_checkpoints/ch13-checkpoint.ipynb @@ -0,0 +1,298 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:855f448243394a83380cc86f4309c883de0251b8f54f502d859f2d887a1b20dc" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 13 : Unsteady-state transport" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.1 - Page No :651\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "# given\n", + "h = 12.; \t\t\t #[W/m**2*K] - heat transfer coefficeint\n", + "k = 400.; \t\t\t #[W/m*K] - thermal conductivity\n", + "\n", + "# Calculation and Results\n", + "# (a) for sphere\n", + "r = 5.*10**-2; \t\t\t #[m] - radius of copper sphere\n", + "Lc = ((4*math.pi*((r)**3))/3)/(4*math.pi*((r)**2));\n", + "Nbi = h*Lc*(1./k);\n", + "print \" a) The biot no. is Nbi = %.0e\"%(Nbi);\n", + "\n", + "# (b) for cyclinder\n", + "r = 0.05; \t\t\t #[m] - radius of cyclinder\n", + "L = 0.3; \t\t\t #[m] - height of cyclinder\n", + "Lc = (math.pi*((r)**2)*L)/(2*math.pi*r*L);\n", + "Nbi = h*Lc*(1./k);\n", + "print \" b) The biot no. is Nbi = %.1e\"%(Nbi);\n", + "\n", + "# (c) for a long square rod\n", + "L = .4; \t\t\t #[m] - length of copper rod\n", + "r = 0.05; \t\t\t #[m] - radius of a cyclinder havimg same cross sectional area as that of square\n", + "x = ((math.pi*r**2)**(1./2));\n", + "Lc = ((x**2)*L)/(4*x*L);\n", + "Nbi = h*Lc*(1./k);\n", + "print \" c) The biot no. is Nbi = %.3e\"%(Nbi);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a) The biot no. is Nbi = 5e-04\n", + " b) The biot no. is Nbi = 7.5e-04\n", + " c) The biot no. is Nbi = 6.647e-04\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.6 - Page No :684\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "# given\n", + "d = 1*0.0254; \t\t #[m] banana diameter\n", + "Lr = d/2; \t\t\t #[m]; \n", + "Lz = (1.2/2)*(0.0254); \n", + "x = Lz;\n", + "r = Lr;\n", + "k = 0.481; # thermal conductivity\n", + "h = 20.; # heat coefficient\n", + "mr = k/(h*Lr);\n", + "mz = k/(h*Lz);\n", + "nr = r/Lr;\n", + "nz = x/Lz;\n", + "t = 1.2; \t\t\t #[sec]\n", + "\n", + "# Calculations\n", + "alpha = 1.454*10**-4;\n", + "Xr = (alpha*t)/(Lr**2);\n", + "Xz = (alpha*t)/(Lz**2);\n", + "\n", + "# using the above value of m,n,X the value for Ycz and Ycr from fig 13.14 is\n", + "Ycr = 0.42;\n", + "Ycz = 0.75;\n", + "Yc = Ycr*Ycz;\n", + "T_infinity = 400.; \t\t\t #[K]\n", + "To = 295.;\n", + "Tc = T_infinity-(Yc*(T_infinity-To));\n", + "\n", + "# Results\n", + "print \" The temperature t the centre is Tc = %.0f K\"%(Tc);\n", + "\n", + "\n", + "# Answer is vary because of rounding error." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The temperature t the centre is Tc = 367 K\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.7 - Page No :688\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from numpy import *\n", + "# Variables\n", + "# given\n", + "T_x0 = 300.; \t\t\t #[K]\n", + "Tw = 400.; \t\t\t #[K]\n", + "L = 0.013; \t\t\t #[m]\n", + "alpha = 2.476*(10**-5); \t\t\t #[m**/sec]\n", + "h = 600.; \t\t\t #[W/m**2*K]\n", + "pcp = 3.393*(10**6); \t\t\t #[J/m**3*K]\n", + "L = 0.013; \t\t\t #[m]\n", + "del_tax = L/10.;\n", + "betaa = 0.5;\n", + "del_tat = 0.03;\n", + "\n", + "# Calculations\n", + "del_tat = betaa*((del_tax)**2)*(1./alpha);\n", + "T_infinity = 400.; \t\t\t #[K]\n", + "\n", + "# to be sure that the solution is stable, it is customary to truncate this number\n", + "del_tat = 0.03; \t\t\t #[sec]\n", + "# betaa = alpha*del_tat*((1./del_tax)**2);\n", + "Told = zeros(11)\n", + "for i in range(11):\n", + " Told[i] = 300.;\n", + "\n", + "a = ((2*h*del_tat)/(pcp*del_tax));\n", + "b = ((2*alpha*del_tat)/(pcp*((del_tax)**2)));\n", + "\n", + "Tnew = zeros(11)\n", + "for j in range(11):\n", + " Tnew[0] = (T_infinity*0.08162)+(Told[0]*(1-0.08162-0.8791))+(Told[1]*0.8791)\n", + " for k in range(9):\n", + " Tnew[k+1] = (betaa*Told[k+2])+((1.-2*betaa)*(Told[k+1]))+(betaa*Told[k]);\n", + " Tnew[10] = ((2*betaa)*(Told[9]))\n", + " Told = Tnew;\n", + "# Results\n", + "print \"Told values : \" ,(Told);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Told values : [ 325.54820838 319.78194857 315.05971328 311.28295197 308.32959437\n", + " 306.07276601 304.39590474 303.20406441 302.43143939 302.04512688\n", + " 302.04512688]\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.9 - Page No :700\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "p = 2050.; \t\t\t #[kg/m**3] - density of soil\n", + "cp = 1840.; \t\t\t #[J/kg*K] - heat cpapacity of soil\n", + "k = 0.52; \t\t\t #[W/m*K] - thermal conductivity of soil\n", + "alpha = 0.138*10**-6; \t\t\t #[m**2/sec]\n", + "t = 4*30*24*3600; \t\t\t #[sec] - no. of seconds in 4 months\n", + "Tx = -5.; \t\t\t #[degC]\n", + "Tinf = -20.; \t\t\t #[degC]\n", + "T0 = 20.; \t\t\t #[degC]\n", + "\n", + "# from the fig 13.24 the dimensionless dismath.tance Z is \n", + "Z = 0.46;\n", + "\n", + "# Calculations\n", + "# then the depth is\n", + "x = 2*((alpha*t)**(1./2))*Z\n", + "\n", + "# Results\n", + "print \" the depth is x = %.1f m = %.1f ft\"%(x,x*3.6/1.10);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " the depth is x = 1.1 m = 3.6 ft\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 13.10 - Page No :701\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "d = 0.01; \t\t\t #[m] - diameter of cyclindrical porous plug\n", + "D = 2.*10**-9; \t\t\t #[m**2/sec] - diffusion coefficient\n", + "t = 60.*60; \t\t\t #[sec]\n", + "r = d/2.;\n", + "m = 0.;\n", + "Ca_inf = 0.;\n", + "Ca_0 = 10.;\n", + "X = (D*t)/((r)**2);\n", + "# from fig 13.14 the ordinate is\n", + "Y = 0.7;\n", + "\n", + "# Calculations\n", + "Ca_c = Ca_inf-Y*(Ca_inf-Ca_0);\n", + "\n", + "# Results\n", + "print \" the concentration of KCL at the centre after 60 min is Ca = %.2f kg/m**3\"%(Ca_c);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " the concentration of KCL at the centre after 60 min is Ca = 7.00 kg/m**3\n" + ] + } + ], + "prompt_number": 8 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Transport_Phenomena/.ipynb_checkpoints/ch14-checkpoint.ipynb b/Transport_Phenomena/.ipynb_checkpoints/ch14-checkpoint.ipynb new file mode 100644 index 00000000..b34c829a --- /dev/null +++ b/Transport_Phenomena/.ipynb_checkpoints/ch14-checkpoint.ipynb @@ -0,0 +1,598 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:55e856a8d3dddf57f1710469be28c47075de957bf6a386a984d244b3f06340ab" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 14 : Estimation of transport coefficients" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.1 - Page No :726\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "# Variables\n", + "# given\n", + "T = 40+273.15; \t\t\t #[K] - temperature\n", + "P = 1.; \t\t\t #[atm] - pressure\n", + "sigma = 3.711*10**-10; \t\t\t #[m]\n", + "etadivkb = 78.6; \t\t\t #[K]\n", + "A = 1.16145;\n", + "B = 0.14874;\n", + "C = 0.52487;\n", + "D = 0.77320;\n", + "E = 2.16178;\n", + "F = 2.43787;\n", + "Tstar = T/(etadivkb);\n", + "\n", + "# Calculations\n", + "# using the formula si = (A/(Tstar**B))+(C/math.exp(D*Tstar))+(E/math.exp(F*Tstar)\n", + "si = (A/(Tstar**B))+(C/math.exp(D*Tstar))+(E/math.exp(F*Tstar));\n", + "M = 28.966; \t\t\t #[kg/mole] - molecular weight\n", + "\n", + "# using the formula mu = (2.6693*(10**-26))*(((M*T)**(1./2))/((sigma**2)*si))\n", + "mu = (2.6693*(10**-26))*(((M*T)**(1./2))/((sigma**2)*si));\n", + "\n", + "# Results\n", + "print \" The viscosity of air is mu = %2.2e Ns/m**2 = %.5f cP\"%(mu,mu*10**3);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The viscosity of air is mu = 1.90e-05 Ns/m**2 = 0.01903 cP\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.2 - Page No :726\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T = 40+273.15; \t\t\t #[K] - temperature\n", + "P = 1.; \t\t\t #[atm] - pressure\n", + "# thermal conductivit of air\n", + "sigma = 3.711*10**-10; \t\t\t #[m]\n", + "etadivkb = 78.6; \t\t\t #[K]\n", + "A = 1.16145;\n", + "B = 0.14874;\n", + "C = 0.52487;\n", + "D = 0.77320;\n", + "E = 2.16178;\n", + "F = 2.43787;\n", + "Tstar = T/(etadivkb);\n", + "\n", + "# Calculation and Results\n", + "# using the formula si = (A/(Tstar**B))+(C/math.exp(D*Tstar))+(E/math.exp(F*Tstar)\n", + "si = (A/(Tstar**B))+(C/math.exp(D*Tstar))+(E/math.exp(F*Tstar));\n", + "# umath.sing the formula K = (8.3224*(10**-22))*(((T/M)**(1./2))/((sigma**2)*si))\n", + "M = 28.966; \t\t\t #[kg/mole] - molecular weight of air\n", + "k = (8.3224*(10**-22))*(((T/M)**(1./2))/((sigma**2)*si));\n", + "print \" Thermal conductivity of air is k = %.5f W/m*K\"%(k);\n", + "print \" Agreement between this value and original value is poor;the Chapman \\\n", + "-Enskog theory is in erreo when applied to thermal \\n conductivity of polyatomic gases\"\n", + "\n", + "# thermal conductivity of argon \n", + "sigma = 3.542*10**-10; \t\t\t #[m]\n", + "etadivkb = 93.3; \t\t\t #[K]\n", + "A = 1.16145;\n", + "B = 0.14874;\n", + "C = 0.52487;\n", + "D = 0.77320;\n", + "E = 2.16178;\n", + "F = 2.43787;\n", + "Tstar = T/(etadivkb);\n", + "# using the formula si = (A/(Tstar**B))+(C/math.exp(D*Tstar))+(E/math.exp(F*Tstar)\n", + "si = (A/(Tstar**B))+(C/math.exp(D*Tstar))+(E/math.exp(F*Tstar));\n", + "# using the formula K = (8.3224*(10**-22))*(((T/M)**(1./2))/((sigma**2)*si))\n", + "M = 39.948; \t\t\t #[kg/mole] - molecular weight of argon\n", + "k = (8.3224*(10**-22))*(((T/M)**(1./2))/((sigma**2)*si));\n", + "print \" Thermal conductivity of argon is k = %.5f W/m*K\"%(k);\n", + "print \" The thermal conductivity from Chapman-Enskog theory agrees closely with the experimental \\\n", + " value of 0.0185; note that argon is a monoatomic gas\";\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Thermal conductivity of air is k = 0.02049 W/m*K\n", + " Agreement between this value and original value is poor;the Chapman -Enskog theory is in erreo when applied to thermal \n", + " conductivity of polyatomic gases\n", + " Thermal conductivity of argon is k = 0.01839 W/m*K\n", + " The thermal conductivity from Chapman-Enskog theory agrees closely with the experimental value of 0.0185; note that argon is a monoatomic gas\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.3 - Page No :727\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "T = 40+273.15; \t\t\t #[K] - temperature\n", + "P = 1.; \t\t\t #[atm] - pressure\n", + "Cp = 1005.; \t\t\t #[J/kg*K] - heat capacity \n", + "M = 28.966; \t\t\t #[kg/mole] - molecular weight\n", + "R = 8314.3; \t\t\t #[atm*m**3/K*mole] - gas consmath.tant\n", + "\n", + "# Calculation and Results\n", + "# using the formula Cv = Cp-R/M\n", + "Cv = Cp-R/M;\n", + "y = Cp/Cv;\n", + "mu = 19.11*10**-6; \t\t\t #[kg/m*sec] - vismath.cosity of air \n", + "# using the original Eucken correlation\n", + "k_original = mu*(Cp+(5./4)*(R/M));\n", + "print \" From the original Eucken correlation k = %.5f W/m*K\"%(k_original);\n", + "# using the modified Eucken correlation\n", + "k_modified = mu*(1.32*(Cp/y)+(1.4728*10**4)/M);\n", + "print \" From the modified Eucken correlation k = %.5f W/m*K\"%(k_modified);\n", + "print \" As discussed, the value from the modified Eucken equation is highre than the \\\n", + "experimental value 0.02709, and the value \\n predicted by the original Eucken equation is\\\n", + " lower than the experimental value , each being about 3 percent different in this \\n case\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " From the original Eucken correlation k = 0.02606 W/m*K\n", + " From the modified Eucken correlation k = 0.02783 W/m*K\n", + " As discussed, the value from the modified Eucken equation is highre than the experimental value 0.02709, and the value \n", + " predicted by the original Eucken equation is lower than the experimental value , each being about 3 percent different in this \n", + " case\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.4 - Page No :728\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from numpy import *\n", + "import math \n", + "\n", + "# Variables\n", + "# given\n", + "D = zeros(5)\n", + "D[0] = 7.66*10**-5; \t\t\t #[m**2/sec] - diffusion coefficient of the helium nitrogen\n", + "P = 1.; \t\t\t #[atm] - pressure\n", + "\n", + "T = zeros(5)\n", + "# (a) umath.sing the Chapman-Enskog\n", + "T[0] = 323.; \t\t\t #[K]\n", + "T[1] = 413.; \t\t\t #[K]\n", + "T[2] = 600.; \t\t\t #[K]\n", + "T[3] = 900.; \t\t\t #[K]\n", + "T[4] = 1200.; \t\t\t #[K]\n", + "Ma = 4.0026;\n", + "sigma_a = 2.551*10**-10; \t\t\t #[m]\n", + "etaabykb = 10.22; \t\t\t #[K]\n", + "Mb = 28.016;\n", + "sigma_b = 3.798*10**-10; \t\t\t #[m] \n", + "etabbykb = 71.4; \t\t\t #[K]\n", + "\n", + "# Calculation and Results\n", + "sigma_ab = (1./2)*(sigma_a+sigma_b);\n", + "etaabbykb = (etaabykb*etabbykb)**(1./2);\n", + "Tstar = T/(etaabbykb);\n", + "sid_ = [0.7205,0.6929,0.6535,0.6134,0.5865]\n", + "patm = 1.;\n", + "# using the formula Dab = 1.8583*10**-27*(((T**3)*((1./Ma)+(1./Mb)))**(1./2))/(patm*sigma_ab*sid_)\n", + "Dab = zeros(5)\n", + "Dab[0] = 0.0000794\n", + "Dab[1]= 0.0001148\n", + "Dab[2]= 0.0002010\n", + "Dab[3]= 0.0003693 \n", + "Dab[4]= 0.0005685 #(1.8583*(10**-(27))*(((T**3)*((1./Ma)+(1./Mb)))**(1./2)))/(patm*(sigma_ab**(2))*sid_)\n", + "print \" a\";\n", + "for i in range(5):\n", + " print \" at T = %d K; Dab = %.3e m**2/sec\"%(T[i],Dab[i]);\n", + "\n", + "# (b) using math.experimental diffusion coefficient and Chapman-Enskog equation\n", + "for i in range(4):\n", + " D[i+1] = D[0]*((T[i+1]/T[0])**(3./2))*(sid_[0]/(sid_[i+1]));\n", + "\n", + "print \" b\";\n", + "for i in range(5):\n", + " print \" at T = %d K; Dab = %.3e m**2/sec\"%(T[i],Dab[i]);\n", + "\n", + "# (c)\n", + "for i in range(4):\n", + " Dab[i+1] = D[0]*(T[i+1]/T[0])**(1.75);\n", + "\n", + "print \" c\";\n", + "for i in range(5):\n", + " print \" at T = %d K; Dab = %.3e m**2/sec\"%(T[i],Dab[i]);\n", + "\n", + "# Answers may be vary because of rounding off error.\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a\n", + " at T = 323 K; Dab = 7.940e-05 m**2/sec\n", + " at T = 413 K; Dab = 1.148e-04 m**2/sec\n", + " at T = 600 K; Dab = 2.010e-04 m**2/sec\n", + " at T = 900 K; Dab = 3.693e-04 m**2/sec\n", + " at T = 1200 K; Dab = 5.685e-04 m**2/sec\n", + " b\n", + " at T = 323 K; Dab = 7.940e-05 m**2/sec\n", + " at T = 413 K; Dab = 1.148e-04 m**2/sec\n", + " at T = 600 K; Dab = 2.010e-04 m**2/sec\n", + " at T = 900 K; Dab = 3.693e-04 m**2/sec\n", + " at T = 1200 K; Dab = 5.685e-04 m**2/sec\n", + " c\n", + " at T = 323 K; Dab = 7.940e-05 m**2/sec\n", + " at T = 413 K; Dab = 1.178e-04 m**2/sec\n", + " at T = 600 K; Dab = 2.264e-04 m**2/sec\n", + " at T = 900 K; Dab = 4.603e-04 m**2/sec\n", + " at T = 1200 K; Dab = 7.615e-04 m**2/sec\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.5 - Page No :730\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T = 323.; \t\t\t #[K] - temperature\n", + "P = 1.; \t\t\t #[atm] - pressure\n", + "Dab_experimental = 7.7*10**-6; \t\t\t #[m**2/sec]\n", + "DPM_A = 1.9; \t\t\t # dipole moment of methyl chlorid_e\n", + "DPM_B = 1.6; \t\t\t # dipole moment of sulphur dioxid_e\n", + "Vb_A = 5.06*10**-2; \t\t\t # liquid_ molar volume of methyl chlorid_e\n", + "Vb_B = 4.38*10**-2\n", + "Tb_A = 249.; \t\t\t # normal boiling point of methyl chlorid_e\n", + "Tb_B = 263.; \t\t\t # normal boiling point of sulphur dioxid_e\n", + "\n", + "# Calculations\n", + "del__A = ((1.94)*(DPM_A)**2)/(Vb_A*Tb_A);\n", + "del__B = ((1.94)*(DPM_B)**2)/(Vb_B*Tb_B);\n", + "del__AB = (del__A*del__B)**(1./2);\n", + "sigma_A = (1.166*10**-9)*(((Vb_A)/(1+1.3*(del__A)**2))**(1./3));\n", + "sigma_B = (1.166*10**-9)*(((Vb_B)/(1+1.3*(del__B)**2))**(1./3));\n", + "etaabykb = (1.18)*(1+1.3*(del__A**2))*(Tb_A);\n", + "etabbykb = (1.18)*(1+1.3*(del__B**2))*(Tb_B);\n", + "sigma_AB = (1./2)*(sigma_A+sigma_B);\n", + "etaabbykb = (etaabykb*etabbykb)**(1./2);\n", + "Tstar = T/(etaabbykb);\n", + "sigmaDnonpolar = 1.602;\n", + "sigmaDpolar = sigmaDnonpolar+(0.19*(del__AB**2))/Tstar;\n", + "patm = 1.;\n", + "Ma = 50.488; \t\t\t #[kg/mole] - molecular weight of methyl chlorid_e\n", + "Mb = 64.063; \t\t\t #[kg/mole] - molecular weight of sulphur dioxid_e \n", + "D_AB = (1.8583*(10**-(27))*(((T**3)*((1./Ma)+(1./Mb)))**(1./2)))/(patm*(sigma_AB**(2))*sigmaDpolar);\n", + "\n", + "# Results\n", + "print \" Dab = %.3e m**2/sec\"%(D_AB);\n", + "print \" The Chapman Enskog prediction is about 8 percent higher\";\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Dab = 8.308e-06 m**2/sec\n", + " The Chapman Enskog prediction is about 8 percent higher\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.6 - Page No :732\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T = 423.2; \t\t\t #[K] - temperature\n", + "P = 5.; \t\t\t #[atm] - pressure\n", + "Ma = 4.0026; \t\t\t #[kg/mole] - molecular weight of helium\n", + "Mb = 60.09121; \t\t #[kg/mole] - molecular weight of propanol\n", + "Dab_experimental = 1.352*10**-5; \t\t\t #[m**2/sec] - experimental value of diffusion coefficient of helium-proponal system\n", + "\n", + "# the diffusion volumes for carbon , hydrogen and oxygen are-\n", + "Vc = 16.5;\n", + "Vh = 1.98;\n", + "Vo = 5.48;\n", + "V_A = 3*Vc+8*Vh+Vo;\n", + "V_B = 2.88;\n", + "patm = 5;\n", + "\n", + "# Calculations\n", + "# using the FSG correlation\n", + "Dab = (10**-7)*(((T**1.75)*((1./Ma)+(1./Mb))**(1./2))/(patm*((V_A)**(1./3)+(V_B)**(1./3))**2));\n", + "\n", + "# Results\n", + "print \" Dab = %.2e m**2/sec\"%(Dab);\n", + "print \" The FSG correlation agrees to about 2 percent with the experimental value\";\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Dab = 1.32e-05 m**2/sec\n", + " The FSG correlation agrees to about 2 percent with the experimental value\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.7 - Page No :736\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "%pylab inline\n", + "\n", + "from numpy import *\n", + "import math \n", + "from matplotlib.pyplot import *\n", + "\n", + "\n", + "# Variables\n", + "# given\n", + "beta0 = -6.301289;\n", + "beta1 = 1853.374;\n", + "\n", + "# Calculations\n", + "x = transpose(array([2.2,0.2,3.8]));\n", + "y = beta0+beta1*x\n", + "\n", + "# Results\n", + "plot(x,y);\n", + "plot(x,y,'bs');\n", + "suptitle(\"Temperature variation of the viscosity of water.\")\n", + "xlabel(\"1/T x IO, K**-1 \")\n", + "ylabel(\"Viscosity,cP\")\n", + "text(0.2,500,\"420 K\")\n", + "text(3.7,7000,\"273.15 K\")\n", + "\n", + "\n", + "# at T = 420;\n", + "T = 420.; \t\t\t #[K]\n", + "x = 1./T;\n", + "y = beta0+beta1*x;\n", + "mu = math.exp(y);\n", + "print \" mu = %fcP\"%(mu);\n", + "print \" The error is seen to be 18 percent.AT mid_range 320K, the error is approximately 4 percent\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Populating the interactive namespace from numpy and matplotlib\n", + " mu = 0.151300cP" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " The error is seen to be 18 percent.AT mid_range 320K, the error is approximately 4 percent\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAZwAAAEhCAYAAABLFRaSAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlcVXX++PHXhTT9apkJaAIuucLlXriClI4LLoSiZpoG\nLvgztTEbc2nPaUa0lMlGUWsqc9IpsdRMZ1LIqBTNDRVxwTYtUS5mgIgLimyf3x8nbyAgaNwFeD8f\nDx6ee+455/M+H+S+7+ecz/l8dEophRBCCGFlTvYOQAghRN0gCUcIIYRNSMIRQghhE5JwhBBC2IQk\nHCGEEDYhCUcIIYRNSMKxo3PnzmEymTCZTNx33314eHhgMpno0qULhYWF9g6vlO3bt7Nnzx57h1Gh\nQYMGcfHixZtuM3/+/FKv//SnP1kzJL7//nv0ej1dunTh5MmTFcaSmpqKwWCo9vKXLVvGqlWrqv24\nJc2ePZutW7cCsHjxYq5evVotx127di0dO3akX79+1XI8KPv7F7ank+dwHMOcOXO46667eOaZZ+wW\nQ3FxMU5O5X8HiYyM5K677uLZZ5+t8vGKiopwdnaurvDKdf2/r06nq3Tbu+66i0uXLlk1npL+8Y9/\nUFRUxF//+tebxpKamsqQIUM4evSozWKzhrZt23LgwAGaNWv2h481YMAA/v73v9O9e/dqiExzO7//\nm/1NiFsnNelAlFLs2bOHbt26YTQa6dOnD+np6QAEBQXxzDPP8OCDD+Ll5cX+/ft59NFHadeuHS++\n+CK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2d+/fXXShOHwWAg\nKSmp1LqkpCR8fX1vup9SiubNmxMbG8uMGTPKzF0ye/bsMvuUXLdv3z5LJ4jNmzdb1jviPEai7pGE\nI+ocpRRHjhyp9MO/pMLCQiZOnMiaNWvo3Llzpfdi/vznP/Pee+/x/fffA3DhwgVeeuklZsyYAWj3\nhGbNmlXh/h06dGDDhg2MHTv2lmaIDAwMJDk5meTkZAYPHmxZL2P0CkcgvdRErXbj1AZz587FYDBY\nhuWvqqioKHr16kX37t0xGo107dqVwYMH06lTp1LbXW9JtGvXjlWrVjF+/Hjy8vIoKipi6tSplktx\nP/30E02aNClTjk6nsxwjICCAlStX8vDDD5OQkEDbtm1vpwro2bMnP/zwA5cvX8bT05MVK1YQHBx8\nW8cS4o+Q6QlEnTNv3jw6dOhQ5e7J1hAREcHixYtp1qyZ3WIQwtYk4QghhLAJuYcjhBDCJiThCCGE\nsAlJOEIIIWxCEo4QQgibkIQjhBDCJiThCCGEsAlJOEIIIWzi/wPFTAXXZ9H/2gAAAABJRU5ErkJg\ngg==\n", + "text": [ + "" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.8 - Page No :737\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variable\n", + "M = 153.82; \t\t\t #[kg/mole] - molecular weight of ccl4\n", + "T1 = 349.90; \t\t\t #[K] - temperature1\n", + "T2 = 293.15; \t\t\t #[K] - temperature 2\n", + "cp1 = 0.9205; \t\t\t #[KJ/kg*K] - heat capacity at temperature T1\n", + "cp2 = 0.8368; \t\t\t #[KJ/kg*K] - heat capacity at temperature T2\n", + "p1 = 1480.; \t\t\t #[kg/m**3] - density at temperature T1\n", + "p2 = 1590.; \t\t\t #[kg/m**3] - density at temperature T2\n", + "Tb = 349.90; \t\t\t #[K] - normal boiling point\n", + "pb = 1480.; \t\t\t #[kg/m**3] - density at normal boiling point\n", + "cpb = 0.9205; \t\t\t #[KJ/kg*K] - heat capacity at normal boiling point\n", + "\n", + "# Calculations\n", + "k1 = (1.105/(M**(1./2)))*(cp1/cpb)*((p1/pb)**(4./3))*(Tb/T1);\n", + "k2 = (1.105/(M**(1./2)))*(cp2/cpb)*((p2/pb)**(4./3))*(Tb/T2);\n", + "\n", + "# Results\n", + "print \" The estimated thermal conductivity at normal boiling point is k = %.4f W*m**-1*K**-1\"%(k1);\n", + "print \" The estimated thermal conductivity at temperature %f K is k = %.4f W*m**-1*K**-1\"%(T2,k2);\n", + "print \" The estimated value is 3.4 percent higher than the experimental value of 0.1029 W*m**-1*K**-1\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The estimated thermal conductivity at normal boiling point is k = 0.0891 W*m**-1*K**-1\n", + " The estimated thermal conductivity at temperature 293.150000 K is k = 0.1064 W*m**-1*K**-1\n", + " The estimated value is 3.4 percent higher than the experimental value of 0.1029 W*m**-1*K**-1\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 14.9 - Page No :743\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "T = 288.; \t\t\t #[K] - temperature\n", + "M1 = 60.09; \t \t\t #[kg/mole] - molecular weight of proponal\n", + "M2 = 18.015; \t\t \t #[kg/mole] - molecular weight of water\n", + "mu1 = 2.6*10**-3; \t\t\t #[kg/m*sec] - viscosity of proponal\n", + "mu2 = 1.14*10**-3; \t\t #[kg/m*sec] - viscosity of water\n", + "Vc = 14.8*10**-3; \t\t\t #[m**3/kmol] - molar volume of carbon\n", + "Vh = 3.7*10**-3; \t\t\t #[m**3/kmol] - mlar volume of hydrogen\n", + "Vo = 7.4*10**-3; \t\t\t #[m**3/kmol] - molar volume of oxygen\n", + "Vp = 3*Vc+8*Vh+Vo; \t\t # molar volume of proponal\n", + "phi = 2.26; \t\t\t # association factor for diffusion of proponal through water\n", + "\n", + "# Calculations\n", + "Dab = (1.17*10**-16*(T)*(phi*M2)**(1./2))/(mu2*(Vp**0.6));\n", + "print \" The diffusion coefficient of proponal through water is Dab = %.1e m**2/sec\"%(Dab);\n", + "phi = 1.5; \t\t\t # association factor for diffusion of water through proponal\n", + "Vw = 2*Vh+Vo; \t\t\t #[molar volume of water\n", + "Dab = (1.17*10**-16*(T)*(phi*M1)**(1./2))/(mu1*(Vw**0.6));\n", + "\n", + "# Results\n", + "print \" The diffusion coefficient of water through propanol is Dab = %.1e m**2/sec\"%(Dab);\n", + "\n", + "# Answer may vary because of rounding error." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The diffusion coefficient of proponal through water is Dab = 8.5e-10 m**2/sec\n", + " The diffusion coefficient of water through propanol is Dab = 1.5e-09 m**2/sec\n" + ] + } + ], + "prompt_number": 26 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Transport_Phenomena/.ipynb_checkpoints/ch15-checkpoint.ipynb b/Transport_Phenomena/.ipynb_checkpoints/ch15-checkpoint.ipynb new file mode 100644 index 00000000..7fa822a9 --- /dev/null +++ b/Transport_Phenomena/.ipynb_checkpoints/ch15-checkpoint.ipynb @@ -0,0 +1,262 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:485afd35a0311c543b8ae80fa257d28da81c47bde4dc247fa4b0bb496f195ee1" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 15 : Non newtonian phenomena" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.1 - Page No :760\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "%pylab inline\n", + "\n", + "import math \n", + "from numpy import *\n", + "from matplotlib.pyplot import *\n", + "\n", + "# Variables\n", + "# given\n", + "r = array([10, 20, 50, 100, 200, 400, 600, 1000, 2000])\n", + "tau = array([2.2, 3.1 ,4.4, 5.8, 7.4, 9.8, 11.1, 13.9, 17.0])\n", + "\n", + "# Calculation and Results\n", + "#tau = tau*(10**-4);\n", + "plot(r,tau);\n", + "plot(r,tau,'ro');\n", + "suptitle(\"asic shear diagram for the fluid in\")\n", + "xlabel(\"Shear rate, S**-1 \")\n", + "ylabel(\"Shear streets, Nm**-2 \")\n", + "\n", + "# the data falls nearly on a straight line\n", + "# from the graph the slope and the intercept are\n", + "slope = 0.3841;\n", + "intercept = 9.17046;\n", + "# from the relation tau = K*(-r)**n;\n", + "K = math.exp(intercept);\n", + "n = slope\n", + "print \"K = \",K\n", + "print \"n = \",n\n", + "print \" The fluid_ is pseudo plastic, since the slope is less than 1 \"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Populating the interactive namespace from numpy and matplotlib\n", + "K = " + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 9609.04383369\n", + "n = 0.3841\n", + " The fluid_ is pseudo plastic, since the slope is less than 1 \n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYcAAAEhCAYAAACUW2yNAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlcVOX+B/DPsLqgkQvqFRIllW3YpbTAcQtcyEpLveKG\nmt7ulcxueW/aFTQzTTPF7Fbmkql1tdvNJBU3FvcFVNBMRVCgEpdUBEcY5vn9MT8GxhkcwNn5vF8v\nXzFnzjnP9xxovvOcZ5MIIQSIiIhqsDN3AEREZHmYHIiISAuTAxERaWFyICIiLUwORESkhcmBiIi0\nMDk0YnPmzMGePXse6RwuLi4GiqbuEhISsGTJEgCGuQZjeeWVV+Dv749ly5Y16Pi0tDQcOnRI/Xr8\n+PH47rvvGhzPt99+i27duqFfv35IS0tDTEyM3mOeeeYZndtri8WSfx9UPw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swCeffKJ1\n7oyMDMjlcgBASUkJcnNz67WuxnvvvYesrCytxCCEMHjDPTVOTA5kMUpKSjBy5EhIpVL4+Pjg1KlT\nmDdvHgDNb8NVC8cAwLx581BcXAxfX18EBARg5syZAIC//OUv+OKLLxAaGoozZ87AxcVF4/ja1HzP\n1dUVEyZMgLe3N6Kjo/HUU0+p3xszZgwmTJiAkJAQCCGwefNmTJ06FUFBQQgKClI3gJ87dw5t2rTR\nKufQoUMIDQ1FYGAgwsLCMHr0aPTq1ashtw0AcOzYMXh4eGDLli2YMmWKzsZ2ovrglN1ERhQTE4Pv\nv/8eDg58gkvWhcmBiIi08LESERFpYXIgIiItTA5ERKSFyYGIiLQwORARkRYmByIi0sLkQEREWv4P\nM9j4VumJG2wAAAAASUVORK5CYII=\n", + "text": [ + "" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.2 - Page No :774\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "a = array([651, 1361, 2086, 5089, 7575, 11140, 19270, 25030])\n", + "tau = array([3.71, 7.49, 11.41, 24.08, -35.21, 46.25, 77.50, 96.68])\n", + "\n", + "# from the graph\n", + "betao = -4.3790154;\n", + "beta1 = 0.8851;\n", + "\n", + "# Calculations\n", + "K = math.exp(betao);\n", + "n = beta1;\n", + "plot(a,tau);\n", + "suptitle(\"Capillary shear diagram for polyisobutylene L-80 in cyclohexane.\")\n", + "xlabel(\"Pseudoshear rate\")\n", + "ylabel(\"Wall shear stress \")\n", + "\n", + "# Results\n", + "print \" The final rheological model_ is tauw = %f*8*Uz,avg/do)**%f\"%(K,n);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The final rheological model_ is tauw = 0.012538*8*Uz,avg/do)**0.885100\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSU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ghe0RZg7dq1zJo1\nC5PJRFJSEm5ubuafqT9rV0ePHuXUqVN07doV0JrMGjZsWNSvXYhikUQibEL16tXNq5Tm6tSpE9u3\nbyciIoJRo0YxYcIEatSoQffu3fn222/vOoeDg4O5TyEjI8P8eGF9G3c+rpTCYDDQokULDhw4QERE\nBOHh4XTu3Jn/+7//A6Bq1aqA9maft/9izZo1NGvWLN/5p0yZgouLC0uWLCE7O5tq1aqZf1azZs1C\nfxfVqlUz9+OkpKQwYcIEjh49SqNGjZg2bRomkynfNeTG7uPjw/bt2ws9rxD3S/pIhM1KSEigQYMG\njBw5khEjRrB//346derE1q1bzXspZGRkcObMGUDbY2H//v0ArFy50nyeoKAglixZAsDGjRu5fv06\nBoOBoKAgVq1aRWZmJhkZGaxatYrg4GAuXbpEjRo1GDx4MK+99pr5nIXp1q0bn3/+ufn73L6TjIwM\nc63gu+++K7JjvSAmkwkHBwfq1q1Lenq6uf8FtOSbmpoKgLe3NxcuXDAnY5PJxIkTJ0pcnhAFkRqJ\nsGCl5KoAAAEhSURBVAkFjaTavHkzH374IZUrV6Z27drMnz+fhg0bMm/ePHr37g1oo5pmzJiBq6sr\n4eHhjBw5koYNG9KpUyfzOd966y3+8pe/8MMPP9CuXTuaNm0KQGBgIAMGDMDHxweA4cOH07ZtWzZs\n2MDrr79OpUqVqFSpknnr5DvjzXv+l156CQ8PDypVqkSTJk2IiIjgpZdeonfv3ixevJjQ0FBq1ap1\nz+st6Gd169Zl+PDhuLm50bRp03zNeEOHDmX48OE88MAD7Nq1i2XLljFmzBhu376NyWRi/PjxtGrV\nqtj3QIjCyDLyQgghSkWatoQQQpSKJBIhhBClIolECCFEqUgiEUIIUSqSSIQQQpSKJBIhhBClIolE\nCCFEqUgiEUIIUSr/D5BULYf7jJs0AAAAAElFTkSuQmCC\n", + "text": [ + "" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.3 - Page No :774\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "# from Example 15.2 \n", + "n = 0.8851;\n", + "K = 0.01254;\n", + "n = n;\n", + "\n", + "# Calculations\n", + "K = K/((3*n+1)/(4*n));\n", + "\n", + "# Results\n", + "print \"n = \",n\n", + "print \"K = %f N/m**2\"%(K);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "n = 0.8851\n", + "K = 0.012146 N/m**2\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 15.4 - Page No :775\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "a = array([10, 20, 50, 100, 200, 400, 600, 1000, 2000])\n", + "tau = array([2.24, 3.10, 4.35, 5.77, 7.50, 9.13, 11.0, 13.52, 16.40])\n", + "tau = tau*10**-4;\n", + "betao = 8.96694;\n", + "beta1 = 0.48452520;\n", + "beta2 = 0.010923041;\n", + "\n", + "# Calculations\n", + "# such a plot suggests a second order polynomila of the type y = betao+beta1*x+beta2*x**2;\n", + "# where y = ln(tauw) and x = ln(8*Uz,avg/do) = ln(a);\n", + "# from the graph\n", + "n = beta1+2.*beta2*a;\n", + "phiw = ((3.*n+1.)/(4.*n))*(a);\n", + "mu = tau/phiw;\n", + "\n", + "# Results\n", + "\n", + "print \" 8*Uz,avg/do n ((3*n+1)/4*n) phiw mu\"\n", + "for i in range(9):\n", + " print \" %6.0f %8.4f %8.4f %8.4f %6.6f\"%(a[i],n[i],3*n[i]+1/4*n[i],phiw[i],mu[i])\n", + "\n", + "\n", + "# Answer in book is wrong. Please calculate manually." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 8*Uz,avg/do n ((3*n+1)/4*n) phiw mu\n", + " 10 0.7030 2.1090 11.0563 0.000020\n", + " 20 0.9214 2.7643 20.4262 0.000015\n", + " 50 1.5768 4.7305 45.4273 0.000010\n", + " 100 2.6691 8.0074 84.3663 0.000007\n", + " 200 4.8537 14.5612 160.3013 0.000005\n", + " 400 9.2230 27.6689 310.8425 0.000003\n", + " 600 13.5922 40.7765 461.0358 0.000002\n", + " 1000 22.3306 66.9918 761.1954 0.000002\n", + " 2000 44.1767 132.5301 1511.3182 0.000001\n" + ] + } + ], + "prompt_number": 24 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Transport_Phenomena/.ipynb_checkpoints/ch2-checkpoint.ipynb b/Transport_Phenomena/.ipynb_checkpoints/ch2-checkpoint.ipynb new file mode 100644 index 00000000..6416458f --- /dev/null +++ b/Transport_Phenomena/.ipynb_checkpoints/ch2-checkpoint.ipynb @@ -0,0 +1,531 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:0e7d45d0646cb2f7a3667939e0b33f1faee777b6256363462737ae361a311b4b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 2 : Molecular transport mechanisms" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.1 - Page No :28\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "deltax = 0.1; \t\t\t #[m] - thickness of copper block\n", + "T2 = 100.; \t\t\t #[degC] - temp on one side of copper block\n", + "T1 = 0.; \t\t\t #[degC] - temp on other side of the copper block\n", + "k = 380.; \t\t\t #[W/mK] - thermal conductivity\n", + "\n", + "# Calculations\n", + "# using the formula (q/A)*deltax = -k*(T2-T1)\n", + "g = -k*(T2-T1)/deltax;\n", + "g1 = (g/(4.184*10000));\n", + "\n", + "# Results\n", + "print \" The steady state heat flux across the copper block is q/A = %.1e W/m**2 \\\n", + "\\n or in alternate units is q/A = %.1f cal/cm*sec\"%(g,g1);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The steady state heat flux across the copper block is q/A = -3.8e+05 W/m**2 \n", + " or in alternate units is q/A = -9.1 cal/cm*sec\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.2 - Page No :29\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "dely = 0.1; \t\t\t #[m] - distance between two parralel plates\n", + "delUx = 0.3; \t\t\t #[m/sec] - velocity of a plate\n", + "mu = 0.001; \t\t\t #[kg/m*sec] - viscosity\n", + "\n", + "# Calculations\n", + "# using the formula tauyx = F/A = -mu*(delUx/dely)\n", + "tauyx = -mu*(delUx/dely);\n", + "\n", + "# Results\n", + "print \"The momentum flux and the the force per unit area, \\nwhich are the same thing \\\n", + " is tauyx = F/A = %.3f N/m**2\"%(tauyx);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The momentum flux and the the force per unit area, \n", + "which are the same thing is tauyx = F/A = -0.003 N/m**2\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.3 - Page No :30\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "tauyx = -0.003; \t\t #[N/m**2] - momentum flux\n", + "dely = 0.1; \t\t\t #[m] - distance between two parallel plates\n", + "mu = 0.01; \t\t\t #[kg/m*sec] - viscosity\n", + "\n", + "# Calculations\n", + "# using the formula tauyx = F/A = -mu*(delUx/dely)\n", + "delUx = -((tauyx*dely)/mu)*100;\n", + "\n", + "# Results\n", + "print \" Velocity of the top plate is deltaUx = %d cm/sec\"%(delUx);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Velocity of the top plate is deltaUx = 3 cm/sec\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.5 - Page No :31\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "\n", + "# Variables\n", + "d = 0.0013; \t\t\t #[m] - diameter of the tube\n", + "delx = 1.; \t\t\t #[m] - length of the glass tube\n", + "T2 = 110.6; \t\t\t #[degC] - temperature on one end of the rod\n", + "T1 = 0.; \t\t\t #[degC] - temperature on other side of the rod\n", + "k = 0.86; \t \t\t #[W/m*K] - thermal conductivity\n", + "Hf = 333.5; \t\t\t #[J/g] - heat of fusion of ice\n", + "\n", + "# Calculations\n", + "# (a)using the equation (q/A) = -k*(delt/delx)\n", + "A = (math.pi*d**2)/4;\n", + "q = A*(-k*(T2-T1)/delx);\n", + "\n", + "# Results\n", + "print \"a) the heat flow is q = %.2e J/sec\"%(q);\n", + "\n", + "# (b) dividing the total heat transfer in 30minutes by the amount of heat required to melt 1g of ice\n", + "a = abs((q*30*60)/333.5);\n", + "print \"b) the amount or grams of ice melted in 30 minutes is %.1e g\"%(a);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a) the heat flow is q = -1.26e-04 J/sec\n", + "b) the amount or grams of ice melted in 30 minutes is 6.8e-04 g\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.6 - Page No :36\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "# Variables\n", + "d = 1.2*10**-2; \t\t #[m] - diameter of the hole\n", + "Ca1 = 0.083; \t\t\t #[kmol/m**3]\n", + "Ca2 = 0.; \t\t\t #[kmol/m**3]\n", + "L = 0.04; \t\t\t #[m] - thickness of the iron piece \n", + "Dab = 1.56*10**-3; \t #[m**2/sec] - diffusion coefficient of CO2\n", + "A = (math.pi*d**2)/4; \t #area\n", + "\n", + "# Calculations\n", + "# (a)using the formula (Na/)A = (Ja/A) = -Dab(delCa/delx)\n", + "def f0(Ca): \n", + "\t return 1\n", + "\n", + "intdCa = quad(f0,Ca2,Ca1)[0]\n", + "\n", + "def f1(x): \n", + "\t return 1\n", + "\n", + "intdx = quad(f1,0,0.04)[0]\n", + "\n", + "g = (intdCa/intdx)*Dab;\n", + "\n", + "# Results\n", + "print \"a) The molar flux with respect to stationary coordinates is Na/A) = %.3e kmol/m**2*sec\"%(g);\n", + "\n", + "# using the formula na/A = (Na/A)*Ma\n", + "Ma = 44.01; \t\t\t #[kg/mol] - molcular weight of co2\n", + "na = (intdCa/intdx)*Dab*Ma*A*(3600/0.4539);\n", + "print \"b) The mass flow rate is %.3f lb/hr\"%(na);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a) The molar flux with respect to stationary coordinates is Na/A) = 3.237e-03 kmol/m**2*sec\n", + "b) The mass flow rate is 0.128 lb/hr\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.7 - Page No :38\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "T = 30+273.15; \t\t\t #[K] temperature\n", + "pA = 3.; \t\t\t #[atm] partial pressure of the component A\n", + "R = 0.082057; \t \t\t #[atm*m**3*/kmol*K] gas constant\n", + "\n", + "# Calculation and Results\n", + "# (a) using the equation Ca = n/V = pA/(R*T)\n", + "Cco2 = pA/(R*T);\n", + "Cco2 = Cco2*(44.01);\n", + "print \" a) The concentarion of Co2 entering is %.2f kg/m**3\"%(Cco2);\n", + "\n", + "# (b) using the same equation as above\n", + "pN2 = (0.79)*3; \t\t\t #[atm] partial pressure of mitrogen(as nitrogen is 79% in air)\n", + "R = 0.7302; \t\t \t #[atm*ft**3*lb/mol*R] - gas constant\n", + "T = T*(1.8); \t\t\t #[R] temperature\n", + "CN2 = pN2/(R*T);\n", + "print \" b) The concentration of N2 entering is %.2e lb mol/ft**3\"%(CN2);\n", + "\n", + "# (c) using the same equation as above\n", + "nt = 6.;\n", + "nCo2 = 4.;\n", + "nO2 = 2.*(0.21);\n", + "nN2 = 2.*(0.79);\n", + "yCo2 = nCo2/nt;\n", + "yO2 = nO2/nt;\n", + "yN2 = nN2/nt;\n", + "R = 82.057; \t\t\t #[atm*cm**3/mol*K] - gas constant\n", + "T = 30+273.15; \t\t\t #[K] - temperature\n", + "pCo2 = 3*yCo2;\n", + "Cco2 = pCo2/(R*T);\n", + "print \" c) The concentartion of Co2 in the exit is %.2e mol/cm**3\"%(Cco2);\n", + "\n", + "# (d) using the same equation as above\n", + "R = 8.3143; \t\t\t #[kPa*m**3/kmol*K] - gas constant\n", + "pO2 = 3*(yO2)*(101.325); \t\t\t #[kPa] - partial pressure\n", + "CO2 = pO2/(R*T);\n", + "print \" d) The concentration of O2 in the exit stream is %.2e kmol/m**3\"%(CO2);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a) The concentarion of Co2 entering is 5.31 kg/m**3\n", + " b) The concentration of N2 entering is 5.95e-03 lb mol/ft**3\n", + " c) The concentartion of Co2 in the exit is 8.04e-05 mol/cm**3\n", + " d) The concentration of O2 in the exit stream is 8.44e-03 kmol/m**3\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.8 - Page No :39\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "# Variables\n", + "delx = 0.3-0; \t \t\t #[m] - length\n", + "d = 0.05-0; \t \t \t #[m] - diameter\n", + "A = (math.pi*d**2)/4; \t\t\t #[m**2] - area;\n", + "R = 8.314*10**3; \t\t\t #[N*m/kmol*K] - gas constant\n", + "xco1 = 0.15; \t\t\t # mole prcent of co in one tank\n", + "xco2 = 0.; \t\t\t # mole percent of co in other tank\n", + "p2 = 1.; \t\t \t #[atm] - pressure in one tank\n", + "p1 = p2; \t\t\t #[atm] - pressure in other tank\n", + "D = 0.164*10**-4; \t \t\t #[m**2/sec] - diffusion coefficient\n", + "T = 298.15; \t\t\t #[K] - temperature\n", + "\n", + "# Calculations\n", + "# using the formula (Na/A) = (Ja/A) = -D*(delca/delx) = -(D/R*T)*(delpa/delx);\n", + "delpa = (p2*xco2-p1*xco1)*10**5; \t\t\t #[N/m**2] - pressure difference\n", + "Na = -((D*A)/(R*T))*(delpa/delx);\n", + "\n", + "# Results\n", + "print \"The initial rate of mass transfer of co2 is %.1e kmol/sec\"%(Na);\n", + "print \"In order for the pressure to remain at 1 atm, a diffusion of air must occur which is in the opposite\\\n", + " direction \\nand equal to %.1e kmol/sec\"%(Na);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The initial rate of mass transfer of co2 is 6.5e-10 kmol/sec\n", + "In order for the pressure to remain at 1 atm, a diffusion of air must occur which is in the opposite direction \n", + "and equal to 6.5e-10 kmol/sec\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.9 - Page No :44\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "# given\n", + "A = 5.; \t\t\t #[m**2] - area of the plates\n", + "Ft = 0.083 \t\t\t #[N] - force on the top plate\n", + "Fb = -0.027; \t\t\t #[N] - force on the bottom plate\n", + "ut = -0.3; \t\t\t #[m/sec] - velocity of the top plate\n", + "ub = 0.1; \t\t\t #[m/sec] - velocity of the bottom plate\n", + "dely = 0.01; \t\t\t #[m]\n", + "delux = ut-ub; \t\t #[m/sec]\n", + "\n", + "# Calculations\n", + "# using the formula tauyx = F/A = -mu(delux/dely)\n", + "tauyx = (Ft-Fb)/A;\n", + "mu = tauyx/(-delux/dely); \t\t\t #[Ns/m**2]\n", + "mu = mu*10**3; \t\t\t #[cP]\n", + "\n", + "# Results\n", + "print \" The viscosity of toulene in centipose is %.2f cP\"%(mu);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The viscosity of toulene in centipose is 0.55 cP\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.11 - Page No :51\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "po = 1.; \t\t\t #[atm] - pressure\n", + "p = 2.; \t\t \t #[atm] - pressure\n", + "To = 0+273.15; \t\t\t #[K] - temperature\n", + "T = 75+273.15; \t\t\t #[K] - temperature\n", + "Do = 0.219*10**-4; \t #[m**2/sec];\n", + "n = 1.75;\n", + "\n", + "# Calculations\n", + "# usin the formula D = Do*(po/p)*(T/To)**n\n", + "D = Do*(po/p)*(T/To)**n;\n", + "\n", + "# Results\n", + "print \"The diffusion coefficient of water vapour in air at %d atm and %d degC is \\nD \\\n", + " = %.3e m**2/sec\"%(p,T-273.15,D);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The diffusion coefficient of water vapour in air at 2 atm and 75 degC is \n", + "D = 1.674e-05 m**2/sec\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 2.12 - Page No :52\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from scipy.optimize import fsolve \n", + "import math \n", + "\n", + "# Variables\n", + "# given\n", + "T = 53+273.15; \t\t\t #[K] - temperature\n", + "mu1 = 1.91*10**-5;\n", + "mu2 = 2.10*10**-5;\n", + "T1 = 313.15; \t\t\t #[K] - temperature \n", + "T2 = 347.15; \t\t\t #[K] - temperature\n", + "\n", + "# Calculations\n", + "# for air\n", + "# using linear interpolation of the values in table 2.2\n", + "def f(a):\n", + " return math.log(mu1/a)/math.log(T1);\n", + "\n", + "def g(a):\n", + " return math.log(mu2)-math.log(a)-f(a)*math.log(T2);\n", + "\n", + "a1 = 10**-7;\n", + "A = fsolve(g,a1)\n", + "B = f(A);\n", + "\n", + "# using the formula ln(mu) = lnA+Bln(t)\n", + "mu = math.e**(math.log(A)+B*math.log(T))*10**3; \t\t\t #[cP]\n", + "\n", + "# Results\n", + "print \" the viscosity of air at %d degC is %.4f cP\"%(T-273.15,mu);\n", + "\n", + "# similarly for water\n", + "BdivR = 1646;\n", + "A = 3.336*10**-8;\n", + "mu = A*math.e**(BdivR/T)*10**5 \t\t\t #[cP]\n", + "print \" the viscosity of water at %d degC is %.3f cP\"%(T-273.15,mu);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " the viscosity of air at 53 degC is 0.0198 cP\n", + " the viscosity of water at 53 degC is 0.519 cP\n" + ] + } + ], + "prompt_number": 23 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Transport_Phenomena/.ipynb_checkpoints/ch3-checkpoint.ipynb b/Transport_Phenomena/.ipynb_checkpoints/ch3-checkpoint.ipynb new file mode 100644 index 00000000..a18887b2 --- /dev/null +++ b/Transport_Phenomena/.ipynb_checkpoints/ch3-checkpoint.ipynb @@ -0,0 +1,228 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:918b451a759f37d8f1e9ab3a52dd145676f732e5de5664d665d95504d9bce12d" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 3 : The general property balance" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.1 - Page No :65\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "a = 0.0006; \t\t #[m**2] - area\n", + "l = 0.1; \t\t\t #[m] - length\n", + "\n", + "# (a) using the fourier law\n", + "deltax = 0.1; \t\t #[m] - thickness of copper block\n", + "T2 = 100.; \t\t #[degC] - temp on one side of copper block\n", + "T1 = 0.; \t\t\t #[degC] - temp on other side of the copper block\n", + "k = 380.; \t\t\t #[W/mK] - thermal conductivity\n", + "\n", + "# Calculations\n", + "# using the formula (q/A)*deltax = -k*(T2-T1)\n", + "g = -k*(T2-T1)/deltax;\n", + "print \" a) The steady state heat flux across the copper block is q/A = %5.1e J*m**-2*sec**-1 \"%(g);\n", + "\n", + "# (b)\n", + "V = a*l; \t\t\t #[m**3] - volume\n", + "# using the overall balance equation with the accumulation and generation term\n", + "Qgen = 1.5*10**6; \t\t\t #[j*m**-3*sec**-1]\n", + "SIx = (g*a-Qgen*V)/a;\n", + "\n", + "# Results\n", + "print \" b) the flux at face 1 is %5.1e j*m**-2*sec**-1;the negative sign indicates that the \\\n", + "\\nheat flux is from right to left negative x direction\"%(SIx);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " a) The steady state heat flux across the copper block is q/A = -3.8e+05 J*m**-2*sec**-1 \n", + " b) the flux at face 1 is -5.3e+05 j*m**-2*sec**-1;the negative sign indicates that the \n", + "heat flux is from right to left negative x direction\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.2 - Page No :68\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from sympy import *\n", + "\n", + "# Variables\n", + "x = Symbol('x')\n", + "SIx2 = -3.8*10**5; \t\t #[j*m**-2*sec**-1] - flux at x = 0.1,i.e through face2\n", + "Qgen = 1.5*10**6; \t\t\t #[j*m**-3*sec**-1] - uniform generation in the volume\n", + "T2 = 100+273.15; \t\t\t #[K] temperature at face 2\n", + "x2 = 0.1; \t\t\t #[m]\n", + "k = 380.; \t\t\t #[W/mK] - thermal conductivity\n", + "\n", + "# Calculations\n", + "# using the equation der(SIx)*x = SIx+c1;where c1 is tyhe constant of integration\n", + "c1 = (Qgen*x2)-SIx2;\n", + "SIx = Qgen*x-c1;\n", + "\n", + "# Results\n", + "print \"SIx = \",SIx\n", + "print \" where SIx is in units of J m**-2 sec**-1 and x is in units of m\"\n", + "\n", + "# using the equation -k*T = der(SIx)*x**2-c1*x+c2;where c2 is the constant of integration\n", + "c2 = -k*T2-(Qgen*(x2)**2)/2+c1*x2;\n", + "T = -(Qgen/k)*x**2+(c1/k)*x-(c2/k);\n", + "print \"T = \",T\n", + "print \" where T is in units of kelvin K\"\n", + "\n", + "\n", + "# Answer may vary because of rouding error." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "SIx = 1500000.0*x - 530000.0\n", + " where SIx is in units of J m**-2 sec**-1 and x is in units of m\n", + "T = -3947.36842105263*x**2 + 1394.73684210526*x + 253.413157894737\n", + " where T is in units of kelvin K\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 3.3 - Page No :69\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math \n", + "from sympy import *\n", + "\n", + "\n", + "# Variables\n", + "# given\n", + "x = Symbol('x')\n", + "t = Symbol('t')\n", + "hf1 = -270.; \t\t\t #[J/sec] - heat flow at face 1\n", + "hf2 = -228.; \t\t\t #[J/sec] - heat flow at face2\n", + "Qgen = 1.5*10**6; \t\t #[J*m**-3*sec**-1] generation per unit volume per unit time\n", + "v = 6*10**-5; \t\t\t #[m**3] volume\n", + "Cp = 0.093; \t\t\t #[cal*g**-1*K**-1] heat capacity of copper\n", + "sp = 8.91; \t\t\t #specific gravity of copper\n", + "a = 0.0006; \t\t\t #[m**2] - area\n", + "\n", + "# Calculation and Results\n", + "# (a) using the overall balance\n", + "acc = hf1-hf2+Qgen*v;\n", + "print \"a) the rate of accumulation is %d J/sec \"%(acc);\n", + "\n", + "# (b) \n", + "SIx1 = hf1/a;\n", + "SIx2 = hf2/a;\n", + "x1 = 0.;\n", + "\n", + "# solving for the constant of integration c1 in the equation [del(p*cp*T)/delt-der(SIx)]*x = -SIx+c1;\n", + "c1 = 0+SIx1;\n", + "x2 = 0.1;\n", + "g = (-(SIx2)+c1)/x2+Qgen;\n", + "SIx = c1-(g-Qgen)*x;\n", + "print \"SI(x) = \",\"(b)\",SIx\n", + "\n", + "# solving for constant of integration c3 in the equation p*cp*T = g*t+c3\n", + "T2 = 100+273.15;\n", + "t2 = 0;\n", + "p = sp*10**3; \t\t\t #[kg/m**3] - density\n", + "cp = Cp*4.1840; \t\t\t #[J*kg**-1*K**-1]\n", + "c3 = p*cp*T2-g*t2;\n", + "T = (g*(10**-3)/(p*cp))*t+c3/(p*cp);\n", + "print \"Relationship between T and t at x=0.1m is T = \",T\n", + "\n", + "# solving for constant of integration c2 in the equation -k*T = der(SIx)*x**2-c1*x+c2\n", + "k = 380.; \t\t\t #[w/m**1*K**1]\n", + "x2 = 0.1;\n", + "c2 = k*T+(3.5*10**5)*x2**2-(4.5*10**5)*x2;\n", + "\n", + "def T(t,x):\n", + " return (-(3.5*10**5)*x**2+(4.5*10**5)*x+87.7*t+1.00297*10**5)/k;\n", + "\n", + "# at face 1;\n", + "x1 = 0.;\n", + "t1 = 60.; \t\t\t #[sec]\n", + "T1 = T(t1,x1);\n", + "print \"Temperature profile as a function of x and t is T = %.2f K, at face 1\"%T1\n", + "\n", + "# at face 2\n", + "x2 = 0.1;\n", + "t2 = 60.; \t\t\t # [sec]\n", + "T2 = T(t2,x2);\n", + "print \"Temperature at face 2 = %.0f K ,at face 2\"%T2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "a) the rate of accumulation is 48 J/sec \n", + "SI(x) = (b) 700000.0*x - 450000.0\n", + "Relationship between T and t at x=0.1m is T = 0.230747847543697*t + 373.15\n", + "Temperature profile as a function of x and t is T = 277.79 K, at face 1\n", + "Temperature at face 2 = 387 K ,at face 2\n" + ] + } + ], + "prompt_number": 6 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Transport_Phenomena/.ipynb_checkpoints/ch4-checkpoint.ipynb b/Transport_Phenomena/.ipynb_checkpoints/ch4-checkpoint.ipynb new file mode 100644 index 00000000..2114f1f2 --- /dev/null +++ b/Transport_Phenomena/.ipynb_checkpoints/ch4-checkpoint.ipynb @@ -0,0 +1,344 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:64b2bde681c49f44be3d13a15f35c64ef003a99e40d1652062b755d6b3ba1ad3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 4 : molecular transport and the general property balance" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.1 - Page No :99\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# Variables\n", + "# given\n", + "id_ = 2.067; \t\t\t #[in] - inside diameter\n", + "t = 0.154; \t\t\t #[in] - wall thickness\n", + "od = id_+2*t; \t\t\t #[in] - outer diameter\n", + "a = 1.075; \t\t\t #[in**2] - wall sectional area of metal\n", + "A = a*(1./144); \t\t #[ft**2] - wall sectional area of metal in ft**2\n", + "deltaz = 5./12; \t\t #[ft] - length of transfer in z direction\n", + "T2 = 10+273.15; \t\t #[K] - temperature at the top\n", + "T1 = 0+273.15; \t\t #[K] - temperature at the bottom\n", + "q = -3.2; \t\t\t #[Btu/hr] - heat transferred\n", + "\n", + "# Calculations\n", + "deltaT = (T2-T1)+8; \t\t\t #[degF]\n", + "k = round(-(q/A)/(deltaT/deltaz),2);\n", + "\n", + "# Results\n", + "print \"Thermal conductivity = %.2f Btu h**-1 ft**-1 degF**-1\"%(k);\n", + "Alm = round((2*math.pi*deltaz*((od-id_)/(2*12)))/math.log(od/id_),3); \t\t\t #[ft**2] log-mean area\n", + "kincorrect = round(k*(A/Alm),3);\n", + "print \"kincorrect = %.3f Btu h**-1 ft**-1 degF**-1 \"%(kincorrect);\n", + "print \"The error is a factor of %.1f\"%(32.4)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thermal conductivity = 9.92 Btu h**-1 ft**-1 degF**-1\n", + "kincorrect = 0.306 Btu h**-1 ft**-1 degF**-1 \n", + "The error is a factor of 32.4\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.2 - Page No :100\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "\n", + "# Variables\n", + "# given\n", + "T1 = 0.; \t\t\t #[degC]\n", + "T2 = 10.; \t \t\t #[degC]\n", + "km = 17.17; \t\t\t #[W/m*K]\n", + "l = 1.; \t\t \t #[m]\n", + "r2 = 1.1875;\n", + "r1 = 1.0335;\n", + "deltaT = T1-T2;\n", + "\n", + "# Calculations\n", + "# umath.sing the formula Qr = -km*((2*pi*l)/ln(r2/r1))*deltaT;\n", + "Qr = -km*((2*math.pi*l)/math.log(r2/r1))*deltaT;\n", + "\n", + "# Results\n", + "print \"Heat loss = %.0f W \\nThe plus sign indicates that the heat flow is radially out from the center\"%(Qr);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Heat loss = 7767 W \n", + "The plus sign indicates that the heat flow is radially out from the center\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.3 - Page No :100\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "# given\n", + "km = 9.92; \t \t\t #[Btu/h*ft*degF]\n", + "Alm = round(0.242*(12./5),3); \t\t\t #[ft**2]\n", + "T1 = 0.; \t\t\t #[degC]\n", + "T2 = 10.; \t\t\t #[degC]\n", + "deltaT = (T1-T2)*1.8; \t\t\t #[degF]\n", + "r2 = 1.1875;\n", + "r1 = 1.0335;\n", + "deltar = round((r2-r1)/12,3); \t\t\t #[ft]\n", + "\n", + "# Calculations\n", + "# using the formula Qr/Alm = -km*(deltaT/deltar)\n", + "Qr = (-km*Alm*(deltaT/deltar));\n", + "\n", + "# Results\n", + "print \" qr by log-mean area method = %.0f Btu/h\"%(Qr);\n", + "\n", + "\n", + "# in SI units \n", + "Alm = 0.177; \t\t\t #[m**2]\n", + "T1 = 0; \t\t\t #[degC]\n", + "T2 = 10; \t\t\t #[degC]\n", + "km = 17.17; \t\t\t #[W/m*K]\n", + "r2 = 1.1875;\n", + "r1 = 1.0335;\n", + "deltaT = T1-T2;\n", + "deltar = (r2-r1)*0.0254; \t\t\t #[m]\n", + "\n", + "# umath.sing the same formula\n", + "Qr = (-km*(deltaT/deltar))*Alm;\n", + "print \" qr in SI units = %.0f W\"%(Qr);\n", + "\n", + "# Note : Answers are wrong in book. Please calculate manually." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " qr by log-mean area method = 7980 Btu/h\n", + " qr in SI units = 7769 W\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.4 - Page No :101\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from scipy.integrate import quad \n", + "\n", + "# Variables\n", + "# given\n", + "x1 = 0; \t\t\t #[cm]\n", + "x2 = 30; \t\t\t #[cm]\n", + "p1 = 0.3; \t\t\t #[atm]\n", + "p2 = 0.03; \t\t\t #[atm]\n", + "D = 0.164; \t\t\t #[am**2/sec]\n", + "R = 82.057; \t\t\t #[cm**3*atm/mol*K]\n", + "T = 298.15; \t\t\t #[K]\n", + "\n", + "# Calculations\n", + "# using the formula Nax*int(dx/Ax) = -(D/RT)*int(1*dpa)\n", + "def f4(x): \n", + "\t return 1./((math.pi/4)*(10-(x/6))**2)\n", + "\n", + "a = quad(f4,x1,x2)[0]\n", + "\n", + "def f5(p): \n", + "\t return 1\n", + "\n", + "b = quad(f5,p1,p2)[0]\n", + "Nax = -((D/(R*T))*b)/a;\n", + "\n", + "# Results\n", + "print \"Mass transfer rate = %.2e mol/sec = %.2e mol/h \\nthe plus sign indicates diffusion to the right\"%(Nax,Nax*3600);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mass transfer rate = 2.37e-06 mol/sec = 8.53e-03 mol/h \n", + "the plus sign indicates diffusion to the right\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.5 - Page No :105\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from sympy import *\n", + "\n", + "# Variables\n", + "# given\n", + "r = Symbol('r')\n", + "ro = 0.5; \t\t\t #[inch] - outside radius\n", + "ro = 0.0127; \t\t #[m] - outside radius in m\n", + "Tg = 2.*10**7; \t #[J/m**3*sec] - heat generated by electric current\n", + "Tw = 30.; \t\t\t #[degC] - outside surface temperature\n", + "km = 17.3; \t\t #[W/m*K] - mean conductivity\n", + "\n", + "# Calculations\n", + "# using the formula T = Tw+(Tg/4*km)*(ro**2-r**2)\n", + "T = Tw+(Tg/(4*km))*(ro**2-r**2);\n", + "\n", + "# Results\n", + "print \"T = \",T,\n", + "print \" where r is in meters and T is in degC\"\n", + "def t(r):\n", + " return Tw+(Tg/(4*km))*(ro**2-r**2);\n", + "\n", + "print \"At the centre line r = 0, the maximum temperature is %.1f degC. \\\n", + "\\nAt the outside the temperature reduces to the boundary condition value of %.2f degC.\\\n", + "\\nThe distribution is parabolic between these 2 limits\"%(t(0),t(0.0127));\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "T = -289017.341040462*r**2 + 76.6156069364162 where r is in meters and T is in degC\n", + "At the centre line r = 0, the maximum temperature is 76.6 degC. \n", + "At the outside the temperature reduces to the boundary condition value of 30.00 degC.\n", + "The distribution is parabolic between these 2 limits\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 4.7 - Page No :119\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# Variables\n", + "# given\n", + "r = 10.**-3; \t\t\t #[m] - radius\n", + "l = 1.; \t\t\t #[m] - length\n", + "Q = 10.**-7; \t\t\t #[m**3/s] - flow rate\n", + "pressure = 1.01325*10**5\n", + "sPage_No = 1.1;\n", + "pwater = 1000.; \t\t #[kg/m**3] - density of water at 4degC\n", + "\n", + "# Calculations\n", + "deltap = round((145 * pressure)/14.696,-4)\n", + "pfluid = sPage_No *pwater;\n", + "mu = abs(r*-(deltap)*(math.pi*r**3))/((4*Q)*(2*l));\n", + "mupoise = mu*10;\n", + "mucentipoise = mupoise*100;\n", + "\n", + "# Results\n", + "print \" mu = %.3f Ns-m**-2 = %.2f poise = %.0f cP\"%(mu,mupoise,mucentipoise);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " mu = 3.927 Ns-m**-2 = 39.27 poise = 3927 cP\n" + ] + } + ], + "prompt_number": 2 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Transport_Phenomena/.ipynb_checkpoints/ch5-checkpoint.ipynb b/Transport_Phenomena/.ipynb_checkpoints/ch5-checkpoint.ipynb new file mode 100644 index 00000000..aa62bb82 --- /dev/null +++ b/Transport_Phenomena/.ipynb_checkpoints/ch5-checkpoint.ipynb @@ -0,0 +1,371 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:846eb301f0ca3fa07d598406cf96d8fa3abf5c03a27e59bd7b72da3b6c324d13" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 5 : Transport with a net convective flux" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.9 - Page No :166\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "v = 1.; \t\t\t #[cm/sec] - volume velocity or bulk velocity\n", + "vol = 1.; \t\t\t #[cm**3] - volume\n", + "na = 2.; \t\t\t # moles of a\n", + "nb = 3.; \t\t\t # moles of b\n", + "nc = 4.; \t\t\t # moles of c\n", + "mma = 2.; \t\t\t #molecular weight of a\n", + "mmb = 3.; \t\t\t #molecular weight of b\n", + "mmc = 4.; \t\t\t #molecular weight of c\n", + "ma = na*mma; \t\t\t #[g] weight of a\n", + "mb = nb*mmb; \t\t\t #[g] weight of b\n", + "mc = nc*mmc; \t\t\t #[g] weight of c\n", + "NabyA = 2.+2; \t\t\t #[mol/cm**2*s] - molar flux = diffusing flux +convected flux\n", + "NbbyA = -1.+3; \t\t\t #[mol/cm**2*s] - molar flux = diffusing flux +convected flux\n", + "NcbyA = 0.+4; \t\t\t #[mol/cm**2*s] - molar flux = diffusing flux +convected flux\n", + "NtbyA = NabyA+NbbyA+NcbyA; \t\t\t #[mol/cm**2*s] - total molar flux\n", + "\n", + "# Calculations\n", + "# on a mass basis,these corresponds to\n", + "nabyA = 4.+4; \t\t\t #[g/cm**2*s]; - mass flux = diffusing flux +convected flux\n", + "nbbyA = -3.+9; \t\t\t #[g/cm**2*s]; - mass flux = diffusing flux +convected flux\n", + "ncbyA = 0.+16; \t\t\t #[g/cm**2*s]; - mass flux = diffusing flux +convected flux\n", + "ntbyA = nabyA+nbbyA+ncbyA; \t\t\t #[g/cm**2*s] - total mass flux\n", + "\n", + "# concentrations are expressed in molar basis\n", + "CA = na/vol; \t\t\t #[mol/cm**3]\n", + "CB = nb/vol; \t\t\t #[mol/cm**3]\n", + "CC = nc/vol; \t\t\t #[mol/cm**3]\n", + "CT = CA+CB+CC; \t\t\t #[mol/cm**3] - total concentration\n", + "\n", + "# densities are on a mass basis\n", + "pa = ma/vol; \t\t\t #[g/cm**3]\n", + "pb = mb/vol; \t\t\t #[g/cm**3]\n", + "pc = mc/vol; \t\t\t #[g/cm**3]\n", + "pt = pa+pb+pc; \t\t\t #[g/cm**3]\n", + "Ua = NabyA/CA; \t\t\t #[cm/sec];\n", + "Ub = NbbyA/CB; \t\t\t #[cm/sec];\n", + "Uc = NcbyA/CC; \t\t\t #[cm/sec];\n", + "# the same result will be obtained from dividing mass flux by density\n", + "Uz = (pa*Ua+pb*Ub+pc*Uc)/(pa+pb+pc);\n", + "\n", + "# Results\n", + "print \" Uz = %.3f cm/sec\"%(Uz);\n", + "Uzstar = (NtbyA/CT);\n", + "print \" Uz* = %.2f cm/sec\"%(Uzstar);\n", + "print \" For this Example both Uz and Uz* are slightly greater than the volume \\\n", + " velocity of 1cm/sec, because there is a net molar and \\n mass diffusion in the positive direction.\"\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Uz = 1.034 cm/sec\n", + " Uz* = 1.11 cm/sec\n", + " For this Example both Uz and Uz* are slightly greater than the volume velocity of 1cm/sec, because there is a net molar and \n", + " mass diffusion in the positive direction.\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.10 - Page No :171\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "na = 2.; \t\t\t # moles of a\n", + "nb = 3.; \t\t\t # moles of b\n", + "nc = 4.; \t\t\t # moles of c\n", + "mma = 2.; \t\t\t #molecular weight of a\n", + "mmb = 3.; \t\t\t #molecular weight of b\n", + "mmc = 4.; \t\t\t #molecular weight of c\n", + "ma = na*mma; \t\t\t #[g] weight of a\n", + "mb = nb*mmb; \t\t\t #[g] weight of b\n", + "mc = nc*mmc; \t\t\t #[g] weight of c\n", + "NabyA = 2.+2; \t\t\t #[mol/cm**2*s] - molar flux = diffumath.sing flux +convected flux\n", + "NbbyA = -1.+3; \t\t\t #[mol/cm**2*s] - molar flux = diffusing flux +convected flux\n", + "NcbyA = 0.+4; \t\t\t #[mol/cm**2*s] - molar flux = diffusing flux +convected flux\n", + "NtbyA = NabyA+NbbyA+NcbyA; \t\t\t #[mol/cm**2*s] - total molar flux\n", + "vol= 1.\n", + "# Calculations\n", + "# on a mass basis,these corresponds to\n", + "nabyA = 4+4; \t\t\t #[g/cm**2*s]; - mass flux = diffusing flux +convected flux\n", + "nbbyA = -3+9; \t\t\t #[g/cm**2*s]; - mass flux = diffusing flux +convected flux\n", + "ncbyA = 0+16; \t\t\t #[g/cm**2*s]; - mass flux = diffusing flux +convected flux\n", + "\n", + "# concentrations are expressed in molar basis\n", + "CA = na/vol; \t\t\t #[mol/cm**3]\n", + "CB = nb/vol; \t\t\t #[mol/cm**3]\n", + "CC = nc/vol; \t\t\t #[mol/cm**3]\n", + "CT = CA+CB+CC; \t\t #[mol/cm**3] - total concentration\n", + "\n", + "# densities are on a mass basis\n", + "pa = ma/vol; \t\t\t #[g/cm**3]\n", + "pb = mb/vol; \t\t\t #[g/cm**3]\n", + "pc = mc/vol; \t\t\t #[g/cm**3]\n", + "Ua = NabyA/CA; \t\t\t #[cm/sec];\n", + "Ub = NbbyA/CB; \t\t\t #[cm/sec];\n", + "Uc = NcbyA/CC; \t\t\t #[cm/sec];\n", + "U = (pa*Ua+pb*Ub+pc*Uc)/(pa+pb+pc);\n", + "Ustar = (NtbyA/CT);\n", + "\n", + "# the fluxes relative to mass average velocities are found as follows\n", + "JabyA = CA*(Ua-U); \t\t\t #[mol/cm**2*sec]\n", + "JbbyA = CB*(Ub-U); \t\t\t #[mol/cm**2*sec]\n", + "JcbyA = CC*(Uc-U); \t\t\t #[mol/cm**2*sec]\n", + "\n", + "# Results\n", + "print \" fluxes relative to mass average velocities are-\";\n", + "print \" Ja/A = %.4f mol/cm**2*sec\"%(JabyA);\n", + "print \" Jb/A = %.4f mol/cm**2*sec\"%(JbbyA);\n", + "print \" Jc/A = %.4f mol/cm**2*sec\"%(JcbyA);\n", + "jabyA = pa*(Ua-U); \t\t\t #[g/cm**2*sec]\n", + "jbbyA = pb*(Ub-U); \t\t\t #[g/cm**2*sec]\n", + "jcbyA = pc*(Uc-U); \t\t\t #[g/cm**2*sec]\n", + "print \" ja/A = %.4f g/cm**2*sec\"%(jabyA);\n", + "print \" jb/A = %.4f g/cm**2*sec\"%(jbbyA);\n", + "print \" jc/A = %.4f g/cm**2*sec\"%(jcbyA);\n", + "\n", + "# the fluxes relative to molar average velocity are found as follows\n", + "JastarbyA = CA*(Ua-Ustar); \t\t\t #[mol/cm**2*sec]\n", + "JbstarbyA = CB*(Ub-Ustar); \t\t\t #[mol/cm**2*sec]\n", + "JcstarbyA = CC*(Uc-Ustar); \t\t\t #[mol/cm**2*sec]\n", + "print \" fluxes relative to molar average velocities are-\";\n", + "print \" Ja*/A = %.4f mol/cm**2*sec\"%(JastarbyA);\n", + "print \" Jb*/A = %.4f mol/cm**2*sec\"%(JbstarbyA);\n", + "print \" Jc*/A = %.4f mol/cm**2*sec\"%(JcstarbyA);\n", + "jastarbyA = pa*(Ua-Ustar); \t\t\t #[g/cm**2*sec]\n", + "jbstarbyA = pb*(Ub-Ustar); \t\t\t #[g/cm**2*sec]\n", + "jcstarbyA = pc*(Uc-Ustar); \t\t\t #[g/cm**2*sec]\n", + "print \" ja*/A = %.4f g/cm**2*sec\"%(jastarbyA);\n", + "print \" jb*/A = %.4f g/cm**2*sec\"%(jbstarbyA);\n", + "print \" jc*/A = %.4f g/cm**2*sec\"%(jcstarbyA);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " fluxes relative to mass average velocities are-\n", + " Ja/A = 1.9310 mol/cm**2*sec\n", + " Jb/A = -1.1034 mol/cm**2*sec\n", + " Jc/A = -0.1379 mol/cm**2*sec\n", + " ja/A = 3.8621 g/cm**2*sec\n", + " jb/A = -3.3103 g/cm**2*sec\n", + " jc/A = -0.5517 g/cm**2*sec\n", + " fluxes relative to molar average velocities are-\n", + " Ja*/A = 1.7778 mol/cm**2*sec\n", + " Jb*/A = -1.3333 mol/cm**2*sec\n", + " Jc*/A = -0.4444 mol/cm**2*sec\n", + " ja*/A = 3.5556 g/cm**2*sec\n", + " jb*/A = -4.0000 g/cm**2*sec\n", + " jc*/A = -1.7778 g/cm**2*sec\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.11 - Page No :176\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "# Variables\n", + "# given\n", + "T = 0+273.15; \t\t\t #[K] - temperature in Kelvins\n", + "pa2 = 1.5; \t\t\t #[atm] - partial presuure of a at point2\n", + "pa1 = 0.5; \t\t\t #[atm] - partial pressure of a at point 1\n", + "z2 = 20.; \t\t\t #[cm] - position of point 2 from reference point\n", + "z1 = 0.; \t\t\t #[cm] - position of point1 from reference point\n", + "p = 2.; \t\t\t #[atm] - total pressure\n", + "d = 1.; \t\t\t #[cm] - diameter\n", + "D = 0.275; \t\t #[cm**2/sec] - diffusion coefficient\n", + "A = (math.pi*((d)**2))/4.;\n", + "R = 0.082057; \t\t\t #[atm*m**3*kmol**-1*K**-1] - gas constant\n", + "\n", + "# Calculations\n", + "# (a) using the formula Na/A = -(D/(R*T))*((pa2-pa1)/(z2-z1))\n", + "Na = (-(D/(R*T))*((pa2-pa1)/(z2-z1)))*(A)/(10.**6);\n", + "print \" Na = %.2e kmol/sec \\n The negative sign indicates diffusion from point 2 to point 1\"%(Na);\n", + "pb2 = p-pa2;\n", + "pb1 = p-pa1;\n", + "\n", + "# (b) using the formula Na/A = ((D*p)/(R*T*(z2-z1)))*ln(pb2/pb1)\n", + "Na = (((D*p)/(R*T*(z2-z1)))*math.log(pb2/pb1))*(A)/(10**6);\n", + "\n", + "# Results\n", + "print \" Na = %.2e kmol/sec\"%(Na);\n", + "print \" The induced velocity increases the net transport of A by the ratio of 10.6*10**-10 \\\n", + "to 4.82*10**-10 or 2.2 times.This increse is equivalent to 120 percent\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Na = -4.82e-10 kmol/sec \n", + " The negative sign indicates diffusion from point 2 to point 1\n", + " Na = -1.06e-09 kmol/sec\n", + " The induced velocity increases the net transport of A by the ratio of 10.6*10**-10 to 4.82*10**-10 or 2.2 times.This increse is equivalent to 120 percent\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.12 - Page No :178\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "# given\n", + "T = 0+273.15; \t\t\t #[K] - temperature in Kelvins\n", + "pa2 = 1.5; \t\t\t #[atm] - partial presuure of a at point2\n", + "pa1 = 0.5; \t\t\t #[atm] - partial pressure of a at point 1\n", + "z2 = 20.; \t\t\t #[cm] - position of point 2 from reference point\n", + "z1 = 0.; \t\t\t #[cm] - position of point1 from reference point\n", + "p = 2.; \t\t\t #[atm] - total pressure\n", + "d = 1.; \t\t\t #[cm] - diameter\n", + "D = 0.275; \t\t\t #[cm**2/sec] - diffusion coefficient\n", + "\n", + "# Calculations\n", + "A = (math.pi*((d)**2.))/4;\n", + "R = 0.082057; \t\t\t #[atm*m**3*kmol**-1*K**-1] - gas consmath.tant\n", + "k = 0.75;\n", + "\n", + "# umath.sing the formula (Na/A) = -(D/(R*T*(z2-z1)))*ln((1-(pa2/p)*(1-k))/(1-(pa1/p)*(1-k)))\n", + "NabyA = -(D/(R*T*(z2-z1)))*(2*0.7854)*math.log((1-(pa2/p)*(1-k))/(1-(pa1/p)*(1-k)))/(10**6);\n", + "\n", + "# Results\n", + "print \" Na/A = %.2e kmol/sec\"%(NabyA);\n", + "print \" Note that this answer is larger than the rate for equimolar counter diffusion \\\n", + "but smaller tahn the rate for diffusion through a stagnant film. \\nSometimes the\\\n", + " rate for diffusin through a stagnant film can be considered as an upper bound\\\n", + " if k ties between zero and one\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Na/A = 1.38e-10 kmol/sec\n", + " Note that this answer is larger than the rate for equimolar counter diffusion but smaller tahn the rate for diffusion through a stagnant film. \n", + "Sometimes the rate for diffusin through a stagnant film can be considered as an upper bound if k ties between zero and one\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 5.13 - Page No :184\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "# given\n", + "l = 4.; \t\t\t #[m] - length of the tube\n", + "id_ = 1.6*10**-3; \t\t\t #[m] - insid_e diameter\n", + "Nkn = 10.; \t\t \t # - knudsen no.\n", + "Ma = 92.; \t\t\t # - molecular weight of gas\n", + "mu = 6.5*10**-4; \t\t\t #[kg/m*sec] - vismath.cosity\n", + "T = 300.; \t \t\t #[K] - temperature\n", + "R = 8314.; \t \t\t #[kPa*m**3*kmol**-1*K**-1] - gas consmath.tant\n", + "lambdaA = Nkn*id_; \t\t\t #[m] mean free path\n", + "\n", + "# Calculations\n", + "# for calculating pressure umath.sing the formula lamdaA = 32*(mu/p)*((R*T)/(2*pi*Ma))**(1/2)\n", + "p = 32*(mu/lambdaA)*((R*T)/(2*math.pi*Ma))**(1/2.);\n", + "patm = p/(1.01325*10**5);\n", + "\n", + "# Results\n", + "print \" p = %.2f kg/m*sec**2 = %.2f Pa = %.2e atm\"%(p,p,patm);\n", + "print \" The value of 10 for the knudsen number is on the border \\\n", + " between Knudsen diffusion and transition flow\";\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " p = 85.39 kg/m*sec**2 = 85.39 Pa = 8.43e-04 atm\n", + " The value of 10 for the knudsen number is on the border between Knudsen diffusion and transition flow\n" + ] + } + ], + "prompt_number": 11 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Transport_Phenomena/.ipynb_checkpoints/ch6-checkpoint.ipynb b/Transport_Phenomena/.ipynb_checkpoints/ch6-checkpoint.ipynb new file mode 100644 index 00000000..1d8101cc --- /dev/null +++ b/Transport_Phenomena/.ipynb_checkpoints/ch6-checkpoint.ipynb @@ -0,0 +1,458 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:d94dd77653a1dc6cef649df91fc864517d196845530100e7dee278dbacfebc8a" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 6 : Turbulent Flow" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.1 - Page No :200\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "\n", + "\n", + "# Variables\n", + "# given\n", + "q = 50.; \t\t\t #[gal/min] - volumetric flow rate\n", + "d = 2.067/12; \t \t\t #[ft] - diameter\n", + "A = 0.02330; \t\t #[ft**2] - flow area\n", + "p = 0.99568*62.43; \t\t\t #[lb/ft**3] - density of water at 86degF\n", + "mu = 0.8007*6.72*10**-4; \t\t #[lb/ft*sec] - viscosity of water at 86degF\n", + "u = q/(60.*7.48*A);\n", + "\n", + "# Calculations\n", + "# using the formula Nre = d*u*p/mu;\n", + "Nre = round((d*u*p)/mu,-2);\n", + "\n", + "# Results\n", + "print \"Nre = \",Nre\n", + "print \"Hence the flow is turbulent. Note also that Nre is dimensionless\";\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Nre = 95100.0\n", + "Hence the flow is turbulent. Note also that Nre is dimensionless\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.2 - Page No :202\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "# given\n", + "p = 0.99568*62.43; \t\t\t #[lb/ft**3] - density of water at 86degF\n", + "mu = 0.8007*6.72*10**-4; \t\t #[lb/ft*sec] - viscosity of water at 86degF\n", + "u = 4.78; \t\t\t #[ft/sec] - free stream velocity \n", + "Nre = 5.*10**5; \t\t\t # the lower limit for the transition reynolds number range is substituted\n", + "\n", + "# Calculations\n", + "x = (Nre*mu)/(p*u);\n", + "\n", + "# Results\n", + "print \"x = %.1f\"%x\n", + "print \"Thus the transition could star at about %.2f ft. \\\n", + "\\nThe reynolds number at the upper end of the transition range is %.0e .\\\n", + "\\nThe value of x at this location is ten times then the value obtained above i.e %.1f ft\"%(x,Nre*10,x*10)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "x = 0.9\n", + "Thus the transition could star at about 0.91 ft. \n", + "The reynolds number at the upper end of the transition range is 5e+06 .\n", + "The value of x at this location is ten times then the value obtained above i.e 9.1 ft\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.3 - Page No :212\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "# given\n", + "t = [0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.10, 0.11, 0.12];\n", + "Ux = [3.84, 3.50, 3.80, 3.60, 4.20, 4.00, 3.00, 3.20, 3.40, 3.00, 3.50, 4.30, 3.80];\n", + "Uy = [0.43, 0.21, 0.18, 0.30, 0.36, 0.28, 0.35, 0.27, 0.21, 0.22, 0.23, 0.36, 0.35];\n", + "Uz = [0.19, 0.16, 0.17, 0.13, 0.09, 0.10, 0.16, 0.15, 0.13, 0.18, 0.17, 0.18, 0.17];\n", + "# using the formula AREA = [deltat/2]*[U1+U13+2*[U2+U3+U4+U5+U6+U7+U8+U9+U10+U11+U12]]\n", + "# for Uxmean\n", + "deltat = 0.01;\n", + "T = t[12]-t[0];\n", + "\n", + "# Calculation and Results\n", + "AREA = (deltat/2)*(Ux[0]+Ux[12]+2*(Ux[1]+Ux[2]+Ux[3]+Ux[4]+Ux[5]+Ux[6]+Ux[7]+Ux[8]+Ux[9]+Ux[10]+Ux[11]));\n", + "Uxmean = AREA/T;\n", + "print \"Uxmean = %.2f m s**-1\"%Uxmean\n", + "\n", + "# for Uymean\n", + "deltat = 0.01;\n", + "AREA = (deltat/2)*(Uy[0]+Uy[12]+2*(Uy[1]+Uy[2]+Uy[3]+Uy[4]+Uy[5]+Uy[6]+Uy[7]+Uy[8]+Uy[9]+Uy[10]+Uy[11]));\n", + "Uymean = AREA/T;\n", + "print \"Uymean = %.2f m s**-1\"%Uymean\n", + "\n", + "# for Uzmean\n", + "AREA = (deltat/2)*(Uz[0]+Uz[12]+2*(Uz[1]+Uz[2]+Uz[3]+Uz[4]+Uz[5]+Uz[6]+Uz[7]+Uz[8]+Uz[9]+Uz[10]+Uz[11]));\n", + "Uzmean = AREA/T;\n", + "print \"Uzmean = %.2f m s**-1\"%Uzmean\n", + "U = (Uxmean**2+Uymean**2+Uzmean**2)**(1./2);\n", + "print \"U = %.3f m s**-1\"%U\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Uxmean = 3.61 m s**-1\n", + "Uymean = 0.28 m s**-1\n", + "Uzmean = 0.15 m s**-1\n", + "U = 3.624 m s**-1\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.4 Page no : 218" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "# Variables\n", + "#Following values are taken from example 6.3\n", + "U_dash_z2 = 8.917*10**-4 #m**2s**-2 square velocity\n", + "Uz2 = .02340 #m**2s**-2\n", + "U_dash_x2 = 8.947 * 10**-4 #m**2s**-2\n", + "Ux22 = .02409 #m**2s**-2\n", + "U = 3.634\n", + "U2x = 3.63 #m**2s**-2\n", + "U2x2 = .41 #m**2s**-2\n", + "Ix = 11.37 #percent\n", + "U2y = .0288 #m**2s**-2\n", + "U2y2 = .069 #m**2s**-2\n", + "Iy = 1.92 #percent\n", + "dt = .01108\n", + "\n", + "# Calculation\n", + "rmsUz = math.sqrt(U_dash_z2)\n", + "rmsUx = math.sqrt(Uz2)\n", + "rmsUx2 = math.sqrt(U_dash_x2)\n", + "rmsUx2 = math.sqrt(Ux22)\n", + "I = 100*rmsUz/U\n", + "Ux = 3.84 - 3.61\n", + "Uy = .43 - .28\n", + "UxUy = Ux*Uy\n", + "ratio = dt/(U2x2*U2y2)\n", + "\n", + "\n", + "# Results\n", + "print \"I = %.2f percent\"%I\n", + "print \"U'xU'y = %.4f m**2s**-2\"%UxUy\n", + "print \"The ratio = %.2f \"%ratio" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "I = 0.82 percent\n", + "U'xU'y = 0.0345 m**2s**-2\n", + "The ratio = 0.39 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.5 - Page No :232\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "%pylab inline\n", + "\n", + "from numpy import *\n", + "from matplotlib.pyplot import *\n", + "import math \n", + "\n", + "\n", + "# Variables\n", + "# given\n", + "UzmaxbyU = 24.83;\n", + "roUbyv = 2312.;\n", + "Re = 100000.;\n", + "\n", + "# using the formula Et/v = 95.5*((r/ro)/slope)-1\n", + "# from fig 6.6 at Re = 100000\n", + "rbyro = [0, 0.040, 0.100, 0.200, 0.300, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.960, 1]\n", + "slope = [0, 0.105, 0.112, 0.126, 0.144, 0.168, 0.201, 0.252, 0.336, 0.503, 1.007, 2.517, 94.59]\n", + "\n", + "# Calculations\n", + "Etbyv = zeros(13)\n", + "for i in range(1,13):\n", + " Etbyv[i] = 95.5*((rbyro[i])/slope[i])-1;\n", + "\n", + "# Results\n", + "plot(rbyro,Etbyv);\n", + "suptitle(\"Eddy viscosity ratio (E,/v) versus dimensionless radius.\")\n", + "xlabel(\"r/ro\")\n", + "ylabel(\"Er/v\")\n", + "\n", + "show()\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Populating the interactive namespace from numpy and matplotlib\n" + ] + }, + { + "metadata": {}, + "output_type": "display_data", + "png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEhCAYAAABlUDcAAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlcVFUfBvBnwH17VRRMMBc0jWHHUBQUNUVcckkEtzeX\nctfMbFErMcutzLSslzIz10A0tVTUStwVRFJcsjQwQBFcEgWR7bx/nBhBB2WZmTszPN/Ph48wy52H\nyzi/e8859xyVEEKAiIjoIRZKByAiIuPEAkFERFqxQBARkVYsEEREpBULBBERacUCQUREWrFAFMPS\n0hJubm6ar8WLFz/ymMjISPTt21fr85s1a4abN2+WK8OVK1cQEBBQrm08SUxMDF599VUAwP79+3H0\n6FG9vM6pU6ewa9cuzc8//vgjFi1aVKpt/PTTTwgODgYABAcHw87Orsjf6Pbt21qf5+/vjytXrhS7\n3W7duuHOnTulymIMCr//yrI/daG871Fd/D/RpeDgYCxZsgQAMGfOHPzyyy8KJ1JWJaUDGKsaNWog\nNja2zM9XqVTlztC4cWNs2rSp3Nt5HA8PD3h4eAAA9u3bh9q1a8PLy6tM28rPz4eFhfZ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4WAghREpKimjUqJGm894cxcfHP7aTujSfm0bZxFTcBXMFw9PGjRuHF198Efv27YNarUbV\nqlXx7bffKpxaP0qyL95//33cunVL0/ZeuXJlREVFKRlb50qyHyqKkuwLNzc39OzZE87OzsjJycHL\nL78MV1dXhZPrXkn2xXvvvYfhw4fDwcEBeXl5+OCDDzSd9+ZmyJAh2L9/P65fv44mTZpg7ty5yMnJ\nAVC2z01eKEdERFoZZR8EEREpjwWCiIi0YoEgIiKtWCCIiEgrFggiItKKBYKIiLRigSAqh4ULF2LD\nhg1KxyDSCxYIojIQQiA/Px979uyBn59fkfvy8/MVSkWkW0Z5JTWRMUpISICfnx+8vLwQGxuLn376\nCdnZ2bCyssLIkSNRrVo1xMXFoWPHjhg0aBDGjRuH3Nxc2NnZYf369WY75TaZL55BEJXCxYsXMWXK\nFJw6dQrR0dF4/vnnNfddu3YNhw8fxuLFizFixAisWLECcXFx8PLywuzZsxVMTVQ2LBBEpdC0aVN4\neHgAAHbv3g1/f38AcsrkgQMHAgBSU1ORlZWFDh06AACGDx+OgwcPKhOYqBxYIIhKoWbNmprvo6Ki\n4Onpqfm5Ro0aWp/D6c7IVLFAEJXB2bNn0aZNG62LrVhbW6N69eo4evQoAGDDhg3o3LmzoSMSlRs7\nqYlKoaAg7Nq1S9O89PB9ALB27VpNJ7WtrS2HwpJJ4nTfRGXQo0cPrF27FjY2NkpHIdIbFggiItKK\nfRBERKQVCwQREWnFAkFERFqxQBARkVYsEEREpBULBBERacUCQUREWv0f7H5+wWyWJFYAAAAASUVO\nRK5CYII=\n", + "text": [ + "" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.7 page no : 246" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# variables\n", + "do = .0508\n", + "Uz = .8467 # cyclohexane\n", + "aveP = 774.9 # the density of cyclohexane\n", + "u = 8.892*10**-4 # the viscosity\n", + "aveF = .00570\n", + "\n", + "# Calculation\n", + "Nre = do*Uz*aveP/u\n", + "rw = (1./2)*aveP*(Uz**2)*aveF\n", + "U = math.sqrt(rw/aveP)\n", + "\n", + "# for y = .001\n", + "y001 = (2.54*10**-5)*U*aveP/u\n", + "ratio = 1 + (U)*(-0.1775)/(1.029)\n", + "\n", + "Uz = U*22.77\n", + "# Results\n", + "print \"Nre = %.2e \"%Nre\n", + "print \"The wall shear stress rw = %.3f N m**-2\"%rw\n", + "print \"The friction velocity U* = %.5f m s*-1\"%U\n", + "print \"Universal velocity Distribution :\" \n", + "print \"for y = 0.001 = %d \"%y001\n", + "print \"Velocity ratio = %.3f\"%ratio\n", + "print \"Uz = %.3f m s**-1\"%Uz" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Nre = 3.75e+04 \n", + "The wall shear stress rw = 1.583 N m**-2\n", + "The friction velocity U* = 0.04520 m s*-1\n", + "Universal velocity Distribution :\n", + "for y = 0.001 = 1 \n", + "Velocity ratio = 0.992\n", + "Uz = 1.029 m s**-1\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.8 Pageno :250" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "# variables\n", + "Cp = 4184. # lg-K-=4184Jkg-K-*\n", + "P = 1000. # g cm**-3\n", + "k = 0.628 # wm**-1\n", + "Nre = 1.2*10**5\n", + "v = 1*10**-6\n", + "do = 2*0.05\n", + "\n", + "# calculation\n", + "alpha = k/(P*Cp)\n", + "qa = (1.7*10**4)/(P*Cp)\n", + "Uz = Nre*v/(do)\n", + "U = Uz*math.sqrt(.0045/2)\n", + "y = (5*v)/U\n", + "\n", + "# Results\n", + "print \"A = %.3e m**2s**-2\"%alpha\n", + "print \"The average velocity = %.2f m s**-1\"%Uz\n", + "print \"U* = %.5f m s**-1\"%U\n", + "print \"the value of y = %.3e cm\"%y\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "A = 1.501e-07 m**2s**-2\n", + "The average velocity = 1.20 m s**-1\n", + "U* = 0.05692 m s**-1\n", + "the value of y = 8.784e-05 cm\n" + ] + } + ], + "prompt_number": 33 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 6.9 - Page No :258\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "p = 0.84*62.4; \t\t\t #[lbf/ft**3] - density\n", + "dP = 80.*144; \t\t\t #[lbf/ft**2] - pressure\n", + "dz = 2000.; \t\t\t #[ft] - length of pipe\n", + "gc = 32.174; \t\t\t #[(lbm*ft)/(lbf*sec**2)] - gravitational conversion consmath.tant\n", + "dpbydz = -dP/dz;\n", + "do = 2.067/12; \t\t\t #[ft]\n", + "\n", + "# Calculations\n", + "U = 2000*(1./24)*(1./3600)*(42)*(1./7.48)*(1./0.02330);\n", + "# using the formula f = ((do/2)*(-dp/dz)*gc)/(p*(U)**2)\n", + "f = ((do/2)*(-dpbydz)*gc)/(p*(U)**2)\n", + "\n", + "# Results\n", + "print \"f = %.5f (dimensionless)\"%f\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "f = 0.00979 (dimensionless)\n" + ] + } + ], + "prompt_number": 19 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Transport_Phenomena/.ipynb_checkpoints/ch7-checkpoint.ipynb b/Transport_Phenomena/.ipynb_checkpoints/ch7-checkpoint.ipynb new file mode 100644 index 00000000..22fcb9f1 --- /dev/null +++ b/Transport_Phenomena/.ipynb_checkpoints/ch7-checkpoint.ipynb @@ -0,0 +1,1030 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:e57625380c3ea6b7f8400e3a53dcc1fb5baa99ca292bbffb9fd53f96e3df830e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 7 : Integral methods of analysis" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.2 - Page No :273\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math \n", + "from scipy.integrate import quad \n", + "\n", + "\n", + "# Variables\n", + "# given\n", + "id_ = 4.; \t\t\t #[m] - insid_e diameter\n", + "h = 2.; \t\t\t #[m] - water level\n", + "ro = 0.03; \t\t\t #[m] - radius of exit hole\n", + "rt = id_/2.; \t\t\t #[m] - insid_e radius\n", + "g = 9.80665; \t\t\t #[m/sec**2] - gravitational acceleration\n", + "\n", + "# Calculations\n", + "# using the equation dh/h**(1/2) = -((ro**2)/(rt**2))*(2*g)**(1/2)dt and integrating between h = 2 and h = 1\n", + "def f6(h): \n", + "\t return (1./h**(1./2))*(1./(-((ro**2)/(rt**2))*(2*g)**(1./2)))\n", + "\n", + "t1 = quad(f6,2,1)[0]\n", + "\n", + "# Results\n", + "print \" Time required to remove half of the contents of the tank is t = %.2f sec = %.2f min\"%(t1,t1/60);\n", + "\t\t\t #integrating between h = 2 and h = 0\n", + "\n", + "def f7(h): \n", + "\t return (1./h**(1./2))*(1./(-((ro**2)/(rt**2))*(2*g)**(1./2)))\n", + "\n", + "t2 = quad(f7,2,0)[0]\n", + "\n", + "print \" Time required to empty the tank fully is t = %.1f sec = %.1f min\"%(t2,t2/60);\n", + "\n", + "ro2 = (h**2)*math.sqrt(h*h/g)/(10*60)\n", + "print \" Ro**2 = %.6f m**2\"%ro2\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Time required to remove half of the contents of the tank is t = 831.37 sec = 13.86 min\n", + " Time required to empty the tank fully is t = 2838.5 sec = 47.3 min\n", + " Ro**2 = 0.004258 m**2\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.3 - Page No :274\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "# composition of fuel gas\n", + "nH2 = 24.;\n", + "nN2 = 0.5;\n", + "nCO = 5.9;\n", + "nH2S = 1.5;\n", + "nC2H4 = 0.1;\n", + "nC2H6 = 1;\n", + "nCH4 = 64;\n", + "nCO2 = 3.0;\n", + "\n", + "# Calculations\n", + "# calculating the theoritical amount of O2 required\n", + "nO2theoreq = 12+2.95+2.25+0.30+3.50+128;\n", + "# since fuel gas is burned with 40% excess O2,then O2 required is\n", + "nO2req = 1.4*nO2theoreq;\n", + "nair = nO2req/0.21; \t\t\t # as amount of O2 in air is 21%\n", + "nN2air = nair*(0.79); \t\t\t # as amount of N2 in air is 79%\n", + "nN2 = nN2+nN2air;\n", + "nO2 = nO2req-nO2theoreq;\n", + "nH2O = 24+1.5+0.2+3.0+128;\n", + "nCO2formed = 72.1;\n", + "nCO2 = nCO2+nCO2formed;\n", + "nSO2 = 1.5;\n", + "ntotal = nSO2+nCO2+nO2+nN2+nH2O;\n", + "mpSO2 = (nSO2/ntotal)*100;\n", + "mpCO2 = (nCO2/ntotal)*100;\n", + "mpO2 = (nO2/ntotal)*100;\n", + "mpN2 = (nN2/ntotal)*100;\n", + "mpH2O = (nH2O/ntotal)*100;\n", + "\n", + "\n", + "# Results\n", + "print \" gas N2 O2 H2O CO2 SO2\";\n", + "print \" moles %.1f %.1f %.1f %.1f %.1f\"%(nN2,nO2,nH2O,nCO2,nSO2);\n", + "print \" mole percent %.1f %.1f %.1f %.1f %.1f\"%(mpN2,mpO2,mpH2O,mpCO2,mpSO2);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " gas N2 O2 H2O CO2 SO2\n", + " moles 785.2 59.6 156.7 75.1 1.5\n", + " mole percent 72.8 5.5 14.5 7.0 0.1\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.4 - Page No :280\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "# Variables\n", + "# given\n", + "id_ = 6.; \t\t\t #[inch] - inlet diameter\n", + "od = 4.; \t\t\t #[inch] - outlet diameter\n", + "Q = 10.; \t\t\t #[ft**3/sec] - water flow rate\n", + "alpha2 = math.pi/3; #[radians] - angle of reduction of elbow\n", + "alpha1 = 0.;\n", + "p1 = 100.; \t\t #[psi] - absolute inlet pressure\n", + "p2 = 29.; \t\t\t #[psi] - absolute outlet pressure\n", + "\n", + "# Calculations\n", + "S1 = (math.pi*((id_/12)**2))/4.;\n", + "S2 = (math.pi*((od/12)**2))/4.;\n", + "U1 = Q/S1;\n", + "U2 = Q/S2;\n", + "mu = 6.72*10**-4; \t #[lb*ft**-1*sec**-1]\n", + "p = 62.4; \t\t\t #[lb/ft**3]\n", + "Nrei = ((id_/12.)*U1*p)/(mu);\n", + "\n", + "# Results\n", + "print \"Nre(inlet) = %.1e\"%Nrei\n", + "Nreo = round(((od/12)*U2*p)/(mu),-4);\n", + "print \"Nre(outlet) = %.1e \"%Nreo\n", + "\n", + "# thus\n", + "b = 1.;\n", + "w1 = p*Q; \t\t\t #[lb/sec] - mass flow rate\n", + "w2 = w1;\n", + "gc = 32.174;\n", + "\n", + "# using the equation (w/gc)*((U1)*(math.cos(alpha1))-(U2)*(math.cos(alpha2)))+p1*S1*math.cos(alpha1)-p2*S2*math.cos(alpha2)+Fextx = 0;\n", + "Fextx = -(w1/gc)*((U1)*(math.cos(alpha1))-(U2)*(math.cos(alpha2)))-p1*144*S1*math.cos(alpha1)+p2*144*S2*math.cos(alpha2);\n", + "print \"Fext,x = %.0f lb\"%Fextx\n", + "Fexty = -(w1/gc)*((U1)*(math.sin(alpha1))-(U2)*(math.sin(alpha2)))-p1*144*S1*math.sin(alpha1)+p2*144*S2*math.sin(alpha2);\n", + "print \"Fext,y = %.0f lb \"%Fexty\n", + "print \"The forces Fext,x and Fext,y are the forces exerted on the fluid_ by the elbow.\\\n", + "\\nFext,x acts to the left and Fext,y acts in the positive y direction.\\\n", + "\\nNote that the elbow is horizantal,and gravity acts in the z direction\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Nre(inlet) = 2.4e+06\n", + "Nre(outlet) = 3.6e+06 \n", + "Fext,x = -2522 lb\n", + "Fext,y = 2240 lb \n", + "The forces Fext,x and Fext,y are the forces exerted on the fluid_ by the elbow.\n", + "Fext,x acts to the left and Fext,y acts in the positive y direction.\n", + "Note that the elbow is horizantal,and gravity acts in the z direction\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.5 - Page No : 282\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import numpy\n", + "import math\n", + "\n", + "# Variables\n", + "id_ = 6.; \t\t\t #[inch] - inlet diameter\n", + "od = 4.; \t\t\t #[inch] - outlet diameter\n", + "Q = 10.; \t\t\t #[ft**3/sec] - water flow rate\n", + "alpha2 = math.pi/3; #[radians] - angle of reduction of elbow\n", + "alpha1 = 0.;\n", + "p1 = 100.; \t\t #[psi] - absolute inlet pressure\n", + "p2 = 29.; \t\t\t #[psi] - absolute outlet pressure\n", + "\n", + "# Calculations\n", + "S1 = (math.pi*((id_/12)**2))/4.;\n", + "S2 = (math.pi*((od/12)**2))/4.;\n", + "U1 = Q/S1;\n", + "U2 = Q/S2;\n", + "mu = 6.72*10**-4; \t #[lb*ft**-1*sec**-1]\n", + "p = 62.4; \t\t\t #[lb/ft**3]\n", + "Nrei = ((id_/12.)*U1*p)/(mu);\n", + "\n", + "Fextx = -(w1/gc)*((U1)*(math.cos(alpha1))-(U2)*(math.cos(alpha2)))-p1*144*S1*math.cos(alpha1)+p2*144*S2*math.cos(alpha2);\n", + "Fexty = -(w1/gc)*((U1)*(math.sin(alpha1))-(U2)*(math.sin(alpha2)))-p1*144*S1*math.sin(alpha1)+p2*144*S2*math.sin(alpha2);\n", + "#Fextx = -2522.; \t\t\t #[lb] - force in x direction\n", + "#Fexty = 2240.; \t\t\t #[lb] - force in y direction\n", + "\n", + "# Calculations\n", + "# the force exerted by the elbow on the fluid is the resolution of Fext,x and Fext,y , therefore\n", + "Fext = ((Fextx)**2+(Fexty)**2)**(1./2);\n", + "alpha = 180. - 41.6\n", + "\n", + "# Results\n", + "print \" the force has a magnitude of %.0f lb and a direction of %.1f from \\\n", + "\\nthe positive x directionin the second quadrant\"%(Fext,alpha);\n", + "\n", + "# Note : answers in book is wrong. they have used wrong values everywhere. Please check it manually." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " the force has a magnitude of 3373 lb and a direction of 138.4 from \n", + "the positive x directionin the second quadrant\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.6 - Page No :283\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "id_ = 6.; \t\t\t #[inch] - inlet diameter\n", + "od = 4.; \t\t\t #[inch] - outlet diameter\n", + "Q = 10.; \t\t\t #[ft**3/sec] - water flow rate\n", + "alpha2 = math.pi/3; #[radians] - angle of reduction of elbow\n", + "alpha1 = 0.;\n", + "p1 = 100.; \t\t #[psi] - absolute inlet pressure\n", + "p2 = 29.; \t\t\t #[psi] - absolute outlet pressure\n", + "patm = 14.7; \t\t #[psi] - atmospheric pressure\n", + "p1gauge = p1-patm;\n", + "p2gauge = p2-patm;\n", + "S1 = (math.pi*((id_/12.)**2))/4.;\n", + "S2 = (math.pi*((od/12.)**2))/4.;\n", + "U1 = Q/S1;\n", + "U2 = Q/S2;\n", + "p = 62.4; \t\t\t #[lb/ft**3]\n", + "b = 1.;\n", + "w1 = p*Q; \t\t\t #[lb/sec] - mass flow rate\n", + "w2 = w1;\n", + "gc = 32.174;\n", + "\n", + "# Calculations\n", + "# using the equation Fpress = p1gauge*S1-p2gauge*S2*math.cos(alpha2);\n", + "Fpressx = p1gauge*144*S1-p2gauge*144*S2*math.cos(alpha2);\n", + "Fpressy = p1gauge*144*S1*math.sin(alpha1)-p2gauge*144*S2*math.sin(alpha2);\n", + "wdeltaUx = (w1/gc)*((U2)*(math.cos(alpha2))-(U1)*(math.cos(alpha1)));\n", + "wdeltaUy = (w1/gc)*((U2)*(math.sin(alpha2))-(U1)*(math.sin(alpha1)));\n", + "Fextx = wdeltaUx-Fpressx;\n", + "Fexty = wdeltaUy-Fpressy;\n", + "Fext = ((Fextx)**2+(Fexty)**2)**(1./2);\n", + "alpha = 180 - 43.4\n", + "\n", + "# Results\n", + "print \" The force has a magnitude of %.0f lb and a direction of %.1f from the positive x directionin the second \\\n", + "quadrant\"%(round(Fext,-1),alpha);\n", + "print \" Also there is a force on the elbow in the z direction owing to the weight of the elbow \\\n", + " plus the weight of the fluid inside\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The force has a magnitude of 3030 lb and a direction of 136.6 from the positive x directionin the second quadrant\n", + " Also there is a force on the elbow in the z direction owing to the weight of the elbow plus the weight of the fluid inside\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.7 - Page No :293\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "from scipy.integrate import quad \n", + "# Variables\n", + "Uo = 1.; \t\t\t #[m/sec]\n", + "# using Ux/Uo = y/yo\n", + "# assuming any particular value of yo will not change the answer,therefore\n", + "yo = 1;\n", + "\n", + "# Calculations\n", + "def f2(y): \n", + "\t return (Uo*y)/yo\n", + "\n", + "Uxavg = quad(f2,0,yo)[0]\n", + "\n", + "\n", + "def f3(y): \n", + "\t return ((Uo*y)/yo)**3\n", + "\n", + "Ux3avg = quad(f3,0,yo)[0]\n", + "\n", + "# umath.sing the formula alpha = (Uxavg)**3/Ux3avg\n", + "alpha = (Uxavg)**3/Ux3avg;\n", + "\n", + "# Results\n", + "print \"alpha = \",alpha\n", + "print \" Note that the kinetic correction factor alpha has the same final value for \\\n", + " laminar pipe flow as it has for laminar flow \\nbetween parallel plates.\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "alpha = 0.5\n", + " Note that the kinetic correction factor alpha has the same final value for laminar pipe flow as it has for laminar flow \n", + "between parallel plates.\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.8 - Page No :293\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "Q = 0.03; \t\t\t #[m**3/sec] - volumetric flow rate\n", + "id_ = 7.; \t\t\t #[cm] - insid_e diameter\n", + "deltaz = -7.; \t\t #[m] - length of pipe\n", + "T1 = 25.; \t\t\t #[degC] - lowere sid_e temperature\n", + "T2 = 45.; \t\t\t #[degC] - higher sid_e temperature\n", + "g = 9.81; \t\t\t #[m/sec**2] - acceleration due to gravity\n", + "deltaP = 4.*10**4; #[N/m**2] - pressure loss due to friction\n", + "p = 1000.; \t\t #[kg/m**3] - density of water \n", + "w = Q*p;\n", + "C = 4184.; \t\t #[J/kg*K) - heat capacity of water\n", + "\n", + "# Calculations\n", + "deltaH = w*C*(T2-T1);\n", + "# using the formula Qh = deltaH+w*g*deltaz\n", + "Qh = deltaH+w*g*deltaz;\n", + "\n", + "# Results\n", + "print \" the duty on heat exchanger is Q = %.2e J/sec\"%(Qh);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " the duty on heat exchanger is Q = 2.51e+06 J/sec\n" + ] + } + ], + "prompt_number": 56 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.10 - Page No :298\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "d = 0.03; \t\t\t #[m] - diameter\n", + "g = 9.784; \t\t #[m/sec] - acceleration due to gravity\n", + "deltaz = -1.;\n", + "\n", + "# using the equation (1/2)*(U3**2/alpha3-U1**2/alpha1)+g*deltaz = 0\n", + "# assuming\n", + "alpha1 = 1.;\n", + "alpha3 = 1.;\n", + "# also since the diameter of the tank far exceeds the diameter of the hose , the velocity at point 1 must be negligible \n", + "#when compared to the velocity at point 3\n", + "U1 = 0.;\n", + "\n", + "# Calculations\n", + "U3 = (-2*g*deltaz+(U1**2)/alpha1)**(1/2.);\n", + "p = 1000.; \t\t\t #[kg/m**3] - density of water\n", + "S3 = (math.pi/4)*(d)**2\n", + "w = p*U3*S3;\n", + "\n", + "# Results\n", + "print \" the mass flow rate is w = %.2f kg/sec\"%(w);\n", + "\n", + "# the minimum pressure in the siphon tube is at the point 2. Before the result of 3.13 kg/sec is accepted as \n", + "#the final value, the pressure at point 2 must be calcilated in order to see if the water might boil at this point\n", + "# using deltap = p*((U3**2)/2+g*deltaz)\n", + "deltap = p*((U3**2)/2+g*deltaz);\n", + "p1 = 1.01325*10**5; \t\t\t #[N/m**2] - is equal to atmospheric pressure\n", + "p2 = p1+deltap;\n", + "vp = 0.02336*10**5;\n", + "if p2>vp:\n", + " print \" the siphon can operate since the pressure at point 2 is greater than the value at which the liquid boils\";\n", + "else:\n", + " print \" the siphon cant operate since the pressuer at point 2 is less than \\\n", + " the value at which the liquid_ boils\";\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " the mass flow rate is w = 3.13 kg/sec\n", + " the siphon can operate since the pressure at point 2 is greater than the value at which the liquid boils\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.11 - Page No :300\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "sp = 1.45; \t\t\t # specific gravity of trichloroethylene\n", + "pwater = 62.4; \t\t\t #[lb/ft**3] - density of water\n", + "p = sp*pwater;\n", + "d1 = 1.049; \t\t\t #[inch] - density of pipe at point 1\n", + "d2 = 0.6; \t\t\t #[inch] - density of pipe at point 2\n", + "d3 = 1.049; \t\t\t #[inch] - density of pipe at point 3\n", + "\n", + "# Calculations\n", + "# using the formula U1*S1 = U2*S2; we get U1 = U2*(d2/d1);\n", + "# then using the bernoulli equation deltap/p = (1/2)*(U2**2-U1**2);\n", + "deltap = 4.2*(144); \t\t\t #[lb/ft**2] - pressure difference\n", + "U2 = ((2*(deltap/p)*(1./(1.-(d2/d1)**4)))**(1./2))*(32.174)**(1./2);\n", + "\n", + "# umath.sing the formula w = p*U2*S\n", + "w = p*U2*((math.pi/4)*(0.6/12)**2);\n", + "w1 = w/(2.20462);\n", + "\n", + "# Results\n", + "print \" the mass flow rate is w = %.1f lb/sec or in SI units w = %.2f kg/sec\"%(w,w1);\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " the mass flow rate is w = 3.9 lb/sec or in SI units w = 1.77 kg/sec\n" + ] + } + ], + "prompt_number": 60 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.12 - Page No :301\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "Q = 50/(7.48*60); \t #[ft/sec] - volumetric flow rate of water\n", + "d1 = 1.; \t\t\t #[inch] - diameter of pipe\n", + "deltaz = -5; \t\t #[ft] - distance between end of pipe and math.tank\n", + "g = 32.1; \t\t\t #[ft/sec] - acceleration due to gravity\n", + "Cp = 1.; \t\t\t #[Btu/lb*F] - heat capacity of water\n", + "p = 62.4; \t\t\t #[lb/ft**3] - density of water\n", + "S1 = (math.pi/4)*(d1/12.)**2;\n", + "U1 = Q/S1;\n", + "w = p*Q;\n", + "U2 = 0.;\n", + "gc = 32.174;\n", + "\n", + "# Calculations\n", + "# using the formula deltaH = (w/2)*((U2)**2-(U1)**2)+w*g*deltaz\n", + "deltaH = -(w/(2*gc))*((U2)**2-(U1)**2)-w*(g/gc)*deltaz;\n", + "deltaH = deltaH/778; \t\t\t # converting from ftlb/sec to Btu/sec\n", + "deltaT = deltaH/(w*Cp);\n", + "\n", + "# Results\n", + "print \" The rise in temperature is %.5f degF\"%(deltaT);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The rise in temperature is 0.01475 degF\n" + ] + } + ], + "prompt_number": 62 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.13 - Page No :303\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "deltaz = 30.; \t\t #[ft] - distance between process and the holding math.tank\n", + "Q = 100.; \t\t\t #[gpm] - volumetric flow rate of water\n", + "p1 = 100.; \t\t #[psig]\n", + "p2 = 0.; \t\t\t #[psig]\n", + "g = 32.1; \t\t\t #[ft/sec] - acceleration due to gravity\n", + "sv = 0.0161; \t\t #[ft**3/lb] - specific volume of water\n", + "p = 1./sv; \t\t #[lb/ft**3] - density of water\n", + "e = 0.77; \t\t\t # efficiency of centrifugal pump\n", + "deltap = (p1-p2)*(144); \t\t\t #[lbf/ft**2]\n", + "gc = 32.174;\n", + "\n", + "# Calculations\n", + "# using the equation deltap/p+g*(deltaz)+Ws = 0;\n", + "Wst = -deltap/p-(g/gc)*(deltaz);\n", + "# using the formula for efficiency e = Ws(theoritical)/Ws(actual)\n", + "# therefore\n", + "Wsa = Wst/e;\n", + "# the calulated shaft work is for a unit mass flow rate of water,therfore for given flow rate multiply it by the flow rate\n", + "w = (Q*p)/(7.48*60);\n", + "Wsactual = Wsa*w;\n", + "power = -Wsactual/(778*0.7070);\n", + "\n", + "# Results\n", + "print \" the required horsepower is %.2f hp\"%(power);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " the required horsepower is 8.55 hp\n" + ] + } + ], + "prompt_number": 64 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.14 - Page No :304\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "p1 = 5.; \t\t\t #[atm] - initial pressure\n", + "p2 = 0.75; \t\t #[atm] - final pressure after expansion through turbine\n", + "T = 450.; \t\t\t #[K] - temperature\n", + "y = 1.4; \t\t\t # cp/cv for nitrogen\n", + "# using the equation Ws = -(y/(y-1))*(p1/density1)*((p2/p1)**((y-1)/y)-1)\n", + "R = 8314.; \t\t # gas constant\n", + "\n", + "# Calculations\n", + "p1bydensity = R*T;\n", + "Ws = -(y/(y-1))*(p1bydensity)*((p2/p1)**((y-1)/y)-1);\n", + "\n", + "# Results\n", + "print \" the shaft work of the gas as it expands through the turbine and transmits its molecular \\\n", + " energy to the rotating blades is \\n Ws = %.2e J/kmol\"%(Ws);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " the shaft work of the gas as it expands through the turbine and transmits its molecular energy to the rotating blades is \n", + " Ws = 5.48e+06 J/kmol\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.15 - Page No :311\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "T = 273.15+25; \t\t #[K] - temperature\n", + "R = 8.314; \t\t\t #[kPa*m**3/kmol*K] - gas constant\n", + "p = 101.325; \t\t\t #[kPa] - pressure\n", + "M = 29.; \t\t\t # molecular weight of gas\n", + "pa = (p*M)/(R*T);\n", + "sg = 13.45; \t\t\t # specific gravity\n", + "pm = sg*1000;\n", + "g = 9.807; \t\t\t #[m/sec**2] - acceleration due to gravity\n", + "deltaz = 15./100; \t\t #[m]\n", + "\n", + "# Calculations\n", + "# using the equation p2-p1 = deltap = (pm-pa)*g*deltaz\n", + "deltap = -(pm-pa)*g*deltaz;\n", + "\n", + "# Results\n", + "print \" the pressure drop is %.2e N/m**2\"%(deltap);\n", + "print \" the minus sign means the upstream pressure p1 is greater than p2, i.e ther is a pressure drop.\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " the pressure drop is -1.98e+04 N/m**2\n", + " the minus sign means the upstream pressure p1 is greater than p2, i.e ther is a pressure drop.\n" + ] + } + ], + "prompt_number": 68 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.16 - Page No :312\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "T = 536.67; \t\t\t #[degR]; - temperature\n", + "R = 10.73; \t\t\t #[(lbf/in**2*ft**3)*lb*mol**-1*degR] - gas constant\n", + "p = 14.696; \t\t\t #[lbf/in**2];\n", + "g = 9.807*3.2808; \t\t #[ft/sec**2] - acceleration due to gravity\n", + "M = 29.; \t\t\t # molecular weight of gas\n", + "\n", + "# Calculations\n", + "pa = (p*M)/(R*T);\n", + "sg = 13.45; \t\t\t # specific gravity\n", + "pm = sg*62.4;\n", + "deltaz = 15/(2.54*12); #[ft]\n", + "gc = 32.174;\n", + "\n", + "# Results\n", + "# using the equation p2-p1 = deltap = (pm-pa)*g*deltaz\n", + "deltap = (pm-pa)*(g/gc)*deltaz;\n", + "print \"the pressure drop is %.0f lbf/ft**2\"%(deltap);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "the pressure drop is 413 lbf/ft**2\n" + ] + } + ], + "prompt_number": 71 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.18 - Page No :315\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "at = 0.049; \t\t\t #[in**2] - cross sectional area of the manometer tubing\n", + "aw = 15.5; \t\t\t #[in**2] - cross sectional area of the well\n", + "g = 32.174; \t\t\t #[ft/sec**2] - acceleration due to gravity\n", + "gc = 32.174;\n", + "sg = 13.45; \t\t\t #[ specific garvity of mercury\n", + "p = 62.4; \t\t\t #[lb/ft**3] - density of water;\n", + "pm = sg*p;\n", + "deltaz_waterleg = 45.2213;\n", + "\n", + "# Calculations\n", + "# using the equation A(well)*deltaz(well) = A(tube)*deltaz(tube)\n", + "deltazt = 70.; \t\t\t #[cm]\n", + "deltazw = deltazt*(at/aw);\n", + "deltaz = deltazt+deltazw;\n", + "deltap_Hg = -pm*(g/gc)*(deltaz/(2.54*12));\n", + "\n", + "# Results\n", + "deltazw = 45.2213; \t\t\t #[cm]\n", + "deltap_tap = deltap_Hg+p*(g/gc)*(deltazw/(12*2.54));\n", + "print \"deltap_tap = %.0f lbf/ft**2\"%(deltap_tap);\n", + "print \"deltap is negative and therefore p1 is greater than p2\";\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "deltap_tap = -1841 lbf/ft**2\n", + "deltap is negative and therefore p1 is greater than p2\n" + ] + } + ], + "prompt_number": 73 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.19 - Page No :317\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "p = 749./760; \t\t\t #[atm]\n", + "T = 21.+273.15; \t\t #[K]\n", + "R = 82.06; \t\t\t #[atm*cm**3/K] - gas constant\n", + "v = (R*T)/p; \t\t\t #[cm**3/mole] - molar volume\n", + "M = 29.; \t\t\t #[g/mole] - molecular weight\n", + "pair = M/v;\n", + "m_air = 53.32; \t\t\t #[g]\n", + "m_h2o = 50.22; \t\t\t #[g]\n", + "ph2o = 0.998; \t\t\t #[g/cm**3] - density of water\n", + "\n", + "# Calculations\n", + "V = (m_air-m_h2o)/(ph2o-pair); \t\t\t #[cm**3]\n", + "density = m_air/V;\n", + "\n", + "# Results\n", + "print \" The density of coin is density = %.2f g/cm**3\"%(density);\n", + "print \" Consulting a handbook it is seen that this result is correct density for gold\";\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " The density of coin is density = 17.15 g/cm**3\n", + " Consulting a handbook it is seen that this result is correct density for gold\n" + ] + } + ], + "prompt_number": 75 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.20 - Page No :318\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "P = 749./760; \t\t\t #[atm] - pressure\n", + "T = 21+273.15; \t\t #[K] - temperature\n", + "poak = 38*(1./62.4); \t #[g/cm**3] - density of oak\n", + "pbrass = 534/62.4; \t #[g/cm**3] - density of brass\n", + "m_brass = 6.7348; \t\t #[g]\n", + "pair = 0.001184; \t\t #[g/cm**3] - density of air\n", + "\n", + "# Calculations\n", + "# using the formula m_oak = m_brass*((1-(pair/pbrass))/(1-(pair/poak)))\n", + "m_oak = m_brass*((1-(pair/pbrass))/(1-(pair/poak)));\n", + "\n", + "# Results\n", + "print \" True mass of wood = %.3f g\"%(m_oak);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " True mass of wood = 6.747 g\n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.21 - Page No :320\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "# Variables\n", + "T = 545.67; \t\t\t #[degR] - temperature\n", + "R = 1545.; \t\t\t #[Torr*ft**3/degR*mole] - gas constant\n", + "M = 29.; \t\t\t #[g/mole] - molecular weight\n", + "g = 9.807; \t\t\t #[m/sec**2] - acceleration due to gravity\n", + "gc = 9.807; \n", + "po = 760.; \t\t\t #[Torr] - pressure\n", + "deltaz = 50.; \t\t\t #[ft]\n", + "\n", + "# Calculations\n", + "# using the equation p = po*exp(-(g/gc)*M*(deltaz/R*T))\n", + "p = po*math.e**(-(g/gc)*M*(deltaz/(R*T)));\n", + "\n", + "# Results\n", + "print \" p = %.1f Torr \\nThus, the pressure decrease for an elevation of 50ft is very small\"%(p);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " p = 758.7 Torr \n", + "Thus, the pressure decrease for an elevation of 50ft is very small\n" + ] + } + ], + "prompt_number": 78 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 7.22 - Page No :321\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "To = 545.67; \t\t\t #[degR] - air temperature at beach level\n", + "betaa = -0.00357; \t\t #[degR/ft] - constant\n", + "R = 1545.; \t\t\t #[Torr*ft**3/degR*mole] - gas constant\n", + "M = 29.;\n", + "deltaz = 25000.; \t\t #[ft]\n", + "po = 760. \n", + "\n", + "# Calculations\n", + "# using the equation ln(p/po) = ((M)/(R*betaa))*ln(To/(To+betaa*deltaz)\n", + "p = po*math.exp(((M)/(R*betaa))*math.log(To/(To+betaa*deltaz)));\n", + "\n", + "# Results\n", + "print \" Pressure = %.2f Torr\"%(p);\n", + "# using the equation T = To+betaa*deltaz\n", + "T = To+betaa*deltaz;\n", + "print \" Temperature = %.2f degR\"%(T);\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Pressure = 297.16 Torr\n", + " Temperature = 456.42 degR\n" + ] + } + ], + "prompt_number": 19 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Transport_Phenomena/.ipynb_checkpoints/ch9-checkpoint.ipynb b/Transport_Phenomena/.ipynb_checkpoints/ch9-checkpoint.ipynb new file mode 100644 index 00000000..c5809f8d --- /dev/null +++ b/Transport_Phenomena/.ipynb_checkpoints/ch9-checkpoint.ipynb @@ -0,0 +1,206 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:f3b360b427025d8d371cabebea260210aa53947251b74238c4e0eff08e556049" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter 9 : Agitation" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.3 - Page No :389\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "# Variables\n", + "Nblades = 4.; \t\t\t # no. of blades\n", + "d = 9/12.; \t\t\t #[ft] - diameter of the impeller\n", + "dt = 30/12.; \t\t\t #[ft] - diameter of the math.tank\n", + "Nbaffles = 4. \t\t\t # no. of baffles\n", + "h = 30.; \t \t\t # [inch] - height of unit\n", + "mu = 10.; \t\t\t #[cP] - vismath.cosity of fluid_\n", + "sg = 1.1; \t\t \t # specific gravity of fluid_\n", + "s = 300. \t\t\t #[rpm] - speed of agitator\n", + "CbyT = 0.3; \n", + "\n", + "# Calculations\n", + "V = (math.pi*dt**3)/4; \t #volume of math.tank in ft**3\n", + "V1 = V*7.48; \t\t\t #[gal] - volume of math.tank in gallons\n", + "mu = mu*(6.72*10**-4); #[lb/ft*sec]\n", + "p = sg*62.4; \t\t\t #[lb/ft**3] - density of fluid_\n", + "N = s/60.; \t\t\t #[rps] - impeller speed in revolutions per second\n", + "Nre = ((d**2)*N*p)/mu;\n", + "\n", + "# Results\n", + "print \"Nre = %.2e\"%Nre\n", + "print \" Therefore the agitator operates in the turbulent region\"\n", + "Npo = 1.62;\n", + "gc = 32.174;\n", + "P = (Npo*(p*(N**3)*(d**5)))/(gc*550);\n", + "Cf = 63025.;\n", + "Tq = (P/s)*Cf;\n", + "PbyV = P/V;\n", + "PbyV1 = P/V1;\n", + "TqbyV = Tq/V;\n", + "TqbyV1 = Tq/V1;\n", + "print \" The power per unit volume and the torque per unit volume is \\nP/V = %.2ef hp/ft**3 = %.2e \\\n", + "hp/gal \\nTq/V = %.2f in*lb/ft**3 = %.3f in*lb/gal\"%(PbyV,PbyV1,TqbyV,TqbyV1);" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Nre = 2.87e+04\n", + " Therefore the agitator operates in the turbulent region\n", + " The power per unit volume and the torque per unit volume is \n", + "P/V = 1.52e-02f hp/ft**3 = 2.03e-03 hp/gal \n", + "Tq/V = 3.19 in*lb/ft**3 = 0.427 in*lb/gal\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.4 - Page No :391\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "# Variables\n", + "Tpilot = 30.;\n", + "Tlab = 10.;\n", + "N1 = 690.;\n", + "N2 = 271.;\n", + "D2 = 3.;\n", + "D1 = 1.;\n", + "\n", + "# Calculations\n", + "n = (math.log(N1/N2))/(math.log(D2/D1));\n", + "V = 12000/7.48; \t\t\t #[ft**3]\n", + "T = ((4.*V)/math.pi)**(1./3); \t\t\t #[ft]\n", + "R = 12.69/(30/12.);\n", + "N3 = N2*(1./R)**n; \t\t\t #[rpm] - impeller speed in the reactor\n", + "\n", + "# Results\n", + "print \"impeller speed in rpm = %f\"%round(N3,4)\n", + "D3 = 0.75*R; \t\t\t #[ft] - reactor impeller diameter\n", + "print \"reactor impeller diameter in ft = %.3f\"%D3\n", + "P = 0.1374*((N3/N2)**3)*(R**5);\n", + "print \"power in hp = %.3f\"%P\n", + "Cf = 63025.;\n", + "Tq = (P/N3)*Cf; \t\t\t #[inch*lb]\n", + "print \"torque in inch*lb = %.0f\"%Tq\n", + "print \"At this point, the design is complete. \\nA sarc ard size impeller would be chosen as \\\n", + " well as a tan ard size motor7.5 hp or 10 hp\"\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "impeller speed in rpm = 68.044500\n", + "reactor impeller diameter in ft = 3.807\n", + "power in hp = 7.329\n", + "torque in inch*lb = 6789\n", + "At this point, the design is complete. \n", + "A sarc ard size impeller would be chosen as well as a tan ard size motor7.5 hp or 10 hp\n" + ] + } + ], + "prompt_number": 19 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Example 9.5 - Page No : 393\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "from numpy import *\n", + "\n", + "\n", + "# Variables\n", + "# given\n", + "n = array([0.5, 0.6, 0.7, 0.8, 0.9, 1.0]);\n", + "D2 = 3.806;\n", + "D1 = 0.25;\n", + "R = D2/D1;\n", + "N1 = 690.;\n", + "\n", + "# Calculations\n", + "N2 = N1*((D1/D2)**n);\n", + "P1 = 9.33*10**-3; \t\t\t #[hp]\n", + "P2 = P1*R**(5.-3*n);\n", + "\n", + "# Results\n", + "print \" n N,rpm P,hp\"\n", + "for i in range(6):\n", + " print \" %f %4.0f %4.0f\"%(n[i],N2[i],P2[i]);\n", + "\n", + "\n", + "# Answers may be differ because of rounding error." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " n N,rpm P,hp\n", + " 0.500000 177 128\n", + " 0.600000 135 57\n", + " 0.700000 103 25\n", + " 0.800000 78 11\n", + " 0.900000 60 5\n", + " 1.000000 45 2\n" + ] + } + ], + "prompt_number": 29 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_10-checkpoint.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_10-checkpoint.ipynb new file mode 100644 index 00000000..83a710ec --- /dev/null +++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_10-checkpoint.ipynb @@ -0,0 +1,67 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:3d71fc1cf7c62e68f0f9134ed53e2d1461bd07ccc001344fd0d06803f2676584" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 10 : Valves

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.1 Page No 225

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "Q=30.0 #gpm flow rate\n", + "dp=300.0 #pressure drop lbf/in^2\n", + "Sg=0.85 #density\n", + "Cv=5.41 #Flow coefficient\n", + "\n", + "#CALCULATIONS\n", + "Cv1=Q/(math.sqrt(dp/Sg)) \n", + "dp1=Sg*Q**2/Cv**2\n", + "\n", + "#RESULTS\n", + "print('\\n Flow coefficient = %.3f gpm ' %Cv1)\n", + "print('\\n Pressure drop = %.3f psi ' %dp1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Flow coefficient = 1.597 gpm \n", + "\n", + " Pressure drop = 26.138 psi \n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_11-checkpoint.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_11-checkpoint.ipynb new file mode 100644 index 00000000..1d8b9368 --- /dev/null +++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_11-checkpoint.ipynb @@ -0,0 +1,146 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:61d4ab1a97743a659c566a2eb33a4c42c8a0663679f30d0a243310539a4ede57" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter No 11: Seals and packings

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.1, Page No 269

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable initialization\n", + "d=4.0 #in diameter\n", + "p=20.0 #percent\n", + "d1=0.140 #in cross section\n", + "\n", + "#CALCULATIONS\n", + "Gd=d-2.0*((100.0 -20.0)*d1 /100.0)\n", + "Gw=d1+2.0*(p*d1/100.0)\n", + "\n", + "#RESULTS\n", + "print(' Groove diameter = %.3f in ' %Gd)\n", + "print(' \\n Groove width = %.3f in ' %Gw)\n", + "print('\\n outside diameter = %.3f in ' %d)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Groove diameter = 3.776 in \n", + " \n", + " Groove width = 0.196 in \n", + "\n", + " outside diameter = 4.000 in " + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.2 Page NO 272

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "D=2.0 #in diameter\n", + "S=10.0 #in stroke\n", + "s=10000.0 #stroke in\n", + "V=231.0 #in^3 volume\n", + "\n", + "#CALCULATIONS\n", + "di=(V/(S*s*D* math.pi))\n", + "\n", + "#RESULTS\n", + "print(' Thickness= %.6f in ' %di)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Thickness= 0.000368 in \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 11.3 Page No 277

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#Variable initialization\n", + "d=0.275 #in diameter\n", + "p=15.0 #initial squeeze percent\n", + "p1=20.0 #increase in squeeze percent\n", + "p3=8.0 #reduction in squeeze percent\n", + "\n", + "#CALCULATIONS\n", + "Fs=(d*p/100.0)+(d*p1/100.0)-(d*p3 /100.0)\n", + "Fs1= Fs *100.0/ d\n", + "\n", + "#RESULTS\n", + "print('\\n final available squeeze = %.3f percent' %Fs1 )" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " final available squeeze = 27.000 percent" + ] + } + ], + "prompt_number": 3 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_12-checkpoint.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_12-checkpoint.ipynb new file mode 100644 index 00000000..4ba37f47 --- /dev/null +++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_12-checkpoint.ipynb @@ -0,0 +1,281 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:e47b17659a986113237b599864f0f5038d52353b8973503557033e3de92c3ae9" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 12 : System components

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.1 Page No 290

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "t=4.0 #hr time\n", + "Ihp=8.0 #ihp power\n", + "Ohp=5.0 #hp power\n", + "\n", + "#CALCULATIONS\n", + "Hl=t*2544.0*(Ihp-Ohp)\n", + "\n", + "#RESULT\n", + "print(' Total Btu heat loss over a period of 4 hr = %.3f Btu ' %Hl)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total Btu heat loss over a period of 4 hr = 30528.000 Btu " + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.2 Page No 292

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "t=1.0 #sec time\n", + "P=1000.0 #lbf/in^2 pressure \n", + "Q=3.0 #gpm flow rate\n", + "Sg=0.85 # density\n", + "s=0.42\n", + "\n", + "#CALCULATIONS\n", + "H=42.4*((P*Q)/1714) #Heat Generation Rate\n", + "m=8.34*Q*Sg #mass flow Rate\n", + "Tr=H/(m*s)\n", + "\n", + "#RESULTS\n", + "print(' Rise in temperature of the fluid = %.2f F' %Tr)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Rise in temperature of the fluid = 8.31 F\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.3 Page No 296

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "P=1500.0 #lbf/in^2 pressure\n", + "d=12.0 #in diameter\n", + "V=50.0 #gal volume\n", + "\n", + "#CALCULATIONS\n", + "F=P*(math.pi*d**2/4)\n", + "S=V*231.0*4.0/(math.pi*d**2)\n", + "\n", + "#RESULTS\n", + "print('Weight = %.3f lbf ' %F)\n", + "print('\\n Stroke length = %.3f in ' %S)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Weight = 169646.003 lb \n", + "\n", + " Stroke length = 102.124 in " + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.4 Page No 298

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "P=1500.0 #lbf/in^2 pressure\n", + "V=5.0 #gal volume\n", + "P1=3000.0 #lbf/in^2 pressure\n", + "P2=2000.0 #lbf/in^2 pressure\n", + "\n", + "#CALCULATIONS\n", + "V2=V*231.0*(P2+14.7)/(P1-P2)\n", + "V1=V2*(P1+14.7)/((P+14.7)*231.0)\n", + "\n", + "#RESULT\n", + "print('\\n Size of accumulator = %.3f gal ' %V1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Size of accumulator = 20.049 gal " + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.5 Page No 300

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "beta=1.4\n", + "p3=2000.0+14.7 #non guage presure\n", + "p2=3000.0+14.7 #non guage presure\n", + "p1=1500.0+14.7 #non guage presure\n", + "deltav=1155.0\n", + "\n", + "#Calculations\n", + "v2=(p3/p2)**(1/beta)*(deltav)/(1-(p3/p2)**(1/beta))\n", + "v1=v2*(p2/p1)**(1/beta)\n", + "perdiff=(v1-4627.25)*100.0/v1\n", + "\n", + "#Results\n", + "print(' Volume 2 = %.3f in^3' %v2)\n", + "print(' \\n Volume 1 = %.3f in^3' %v1)\n", + "print(' \\n Percentage difference in volume = %.3f percent' %perdiff )" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Volume 2 = 3462.278 in^3\n", + " \n", + " Volume 1 = 5660.756 in^3\n", + " \n", + " Percentage difference in volume = 18.257 percent\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 12.6 Page No 305

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "Fr=20.0 #gpm flowrate\n", + "P=2500.0 #lbf/in^2 pressure\n", + "sf=4.0 #safety factor\n", + "Ts=55000.0 #lbf/in^2 pressure\n", + "V=15.0 #ft/s velocity\n", + "\n", + "#CALCULATIONS\n", + "A=Fr*0.3208/V\n", + "ID=2.0*math.sqrt(A/math.pi)\n", + "Wt=P*ID/(2*(Ts-P))\n", + "Wt1=Wt*sf\n", + "\n", + "#RESULT\n", + "print('Wall thcikness = %.3f in ' %Wt1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Wall thcikness = 0.070 in " + ] + } + ], + "prompt_number": 6 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_14-checkpoint.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_14-checkpoint.ipynb new file mode 100644 index 00000000..6909d7dd --- /dev/null +++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_14-checkpoint.ipynb @@ -0,0 +1,285 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:251fa751d76e0f33020a23b4f02af4b2cc97d384648ba729ca3ce134685988be" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter No 14 :Troubleshooting Hydraulic systems

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.1 Page No 386

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "\n", + "#initialisation of variables\n", + "p=1800 #lbf/in^2 pressure\n", + "Vd=1.5 #in^3/rev displacement\n", + "\n", + "#CALCULATIONS\n", + "T=0.013*p*Vd\n", + "\n", + "#RESULTS\n", + "print('The breakway torque = %.2f lbf-ft' %T)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The breakway torque = 35.10 percent\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.2, Page No 386

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "\n", + "#initialisation of variables\n", + "T=80 #lbf-ft torque\n", + "Vd=3.5 #in^3/rev displacement\n", + "\n", + "#CALCULATIONS\n", + "P=(T/(0.013*Vd))*(1/0.75)\n", + "\n", + "#RESULTS\n", + "print('The min pressure = %.2f lbf/in^2' %P)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The min pressure = 2344.32 lbf/in^2\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.3, Page No 389

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "\n", + "#initialisation of variables\n", + "N=1200 #rev/min theotrical power\n", + "Vd=0.75 #in^3/rev displacement\n", + "Vd2=0.57\n", + "#CALCULATIONS\n", + "# part a\n", + "Q=(Vd*N)/231\n", + "# part b\n", + "Qa=Q-0.50\n", + "N2=(231*Qa)/Vd2\n", + "ev=(Qa/Q)*100\n", + "#RESULTS\n", + "print('The flow from the pump = %.2f lbf/in^2' %Qa)\n", + "print('The actual speed of the motor = %.2f rev/min' %N2)\n", + "print('The Volumetric efficiency of the system = %.2f percent' %ev)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The flow from the pump = 3.40 lbf/in^2\n", + "The actual speed of the motor = 1376.32 rev/min\n", + "The Volumetric efficiency of the system = 87.17 percent\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.4, Page No 390

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#initialisation of variables\n", + "Q=3.9 #gal/min flow rate\n", + "Sg=0.87 # density\n", + "Ac=4.9 #in^2 area\n", + "\n", + "#CALCULATIONS\n", + "Qa=0.872*Q\n", + "Vrod=Qa/(0.26*Ac)\n", + "\n", + "#RESULTS\n", + "print('The Velocity = %.2f in/sec' %Vrod)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Velocity = 2.67 in/sec\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.5, Page No 390

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#initialisation of variables\n", + "Q=10.0 #gal/min flow rate\n", + "P=1500 #lbf/in^2 pressure\n", + "\n", + "#CALCULATIONS\n", + "Fhp=((P*Q)/1714)*0.25\n", + "A=Fhp/(0.001*75)\n", + "\n", + "#RESULTS\n", + "print('The area is = %.2f ft^2' %A)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The area is = 29.17 ft^2\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.6, Page No 391

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#initialisation of variables\n", + "A=15.0 #ft^2 area\n", + "HP=0.25*5 # power\n", + "\n", + "#CALCULATIONS\n", + "T=(HP/(0.001*A))+75\n", + "\n", + "#RESULTS\n", + "print('The temparature is = %.2f F' %T)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The temparature is = 158.33 F\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 14.7, Page No 392

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variables\n", + "A=100 #ft^2 area\n", + "T=40 #F temperature \n", + "\n", + "#CALCULATIONS\n", + "q=2.545*A*T\n", + "\n", + "#RESULTS\n", + "print('The heat that should be dissipated is = %.2f Btu/hr' %q)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The heat that should be dissipated is = 10180.00 Btu/hr\n" + ] + } + ], + "prompt_number": 7 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_15-checkpoint.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_15-checkpoint.ipynb new file mode 100644 index 00000000..06bfac96 --- /dev/null +++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_15-checkpoint.ipynb @@ -0,0 +1,229 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:218eef76eba5bc112a5af1f09e9dfcdb3c88be276a9fda8b85e2aab7235b5119" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 15 : Basics of Pneumatics

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 15.1 Page No 405

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "V1=20.0 #gal volume\n", + "P1=20.0 #lbf/in^2 pressure\n", + "n=2.0\n", + "\n", + "#CALCULATIONS\n", + "V2=V1/n\n", + "P2=(P1+14.7)*V1*231.0/(V2*231.0)\n", + "P3=P2-14.7\n", + "\n", + "#RESULT\n", + "print('Guage pressure = %.3f psi ' %P3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Guage pressure = 54.700 psi \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 15.2 Page No 406

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "V1=1500.0 #in^3 volume\n", + "T=80.0 #F temperature\n", + "T1=200.0 #F temperature\n", + "\n", + "#CALCULATIONS\n", + "V2=V1*(460.0+T1)/(T+460.0)\n", + "\n", + "#RESULT\n", + "print('Volume the heated gas will occupy = %.3f in ^3 ' %V2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Volume the heated gas will occupy = 1833.333 in ^3 " + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 15.3 Page No 406

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "P1=2000.0 #in^3\n", + "T=80.0 #F temperature\n", + "T1=250.0 #F temperature\n", + "\n", + "#CALCULATIONS\n", + "P2=(P1+14.7)*(460.0+T1)/(T+460.0)\n", + "P3=P2-14.7\n", + "\n", + "#RESULT\n", + "print(' Guage pressure = %.3f psi ' %P3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Guage pressure = 2634.257 psi " + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 15.4 Page No 407

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "P1=2000.0 #lbf/in^2 pressure\n", + "V1=1500.0 #in^3 volume\n", + "T2=250.0 #F temperature\n", + "T1=75.0 #F temperature\n", + "V2=1000.0 #in^3 volume\n", + "\n", + "#CALCULATIONS\n", + "P2=(P1+14.7)*V1*(T2+460.0)/((T1+460.0)*V2)\n", + "P3=P2-14.7\n", + "#RESULT\n", + "print('\\n Guage pressure = %.3f psi ' %P3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Guage pressure = 3995.871 psi \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 15.5 Page No 409

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "s=10.0 #stroke in\n", + "d=2.0 #in diameter\n", + "r=40.0 #cpm cycles per rate\n", + "P1=80.0 #lbf/in^2 pressure\n", + "Ps1=552+101 #kN/m^2 pressure\n", + "Ps2=101 #kN/m^2 pressure\n", + "#CALCULATIONS\n", + "V1=math.pi*d**2*s*r/(4*1728.0)\n", + "V2=(P1+14.7)*V1/14.7\n", + "# In SI units\n", + "Vs1=(20.3*25.4*r)/(1000000)\n", + "Vs2=(Ps1*Vs1)/Ps2\n", + "#RESULT\n", + "print(' Air consumption in cfm of free air = %.3f cfm free air ' %V2)\n", + "print(' In SI units Air consumption in cfm of free air = %.3f m^3/min free air ' %Vs2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Air consumption in cfm of free air = 4.685 cfm free air \n", + " Air consumption in cfm of free air = 0.133 cfm free air \n" + ] + } + ], + "prompt_number": 5 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_16-checkpoint.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_16-checkpoint.ipynb new file mode 100644 index 00000000..990ae2bf --- /dev/null +++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_16-checkpoint.ipynb @@ -0,0 +1,290 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:1752ce8abd4db43dc9301d3a391f312646e1e708eed7ee0a80cbc87acc9e9b2d" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter No 16 : Sizing Pneumatic systems

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 16.1, Page No 422

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variables\n", + "L=500 #ft length\n", + "d=47.2561 #diameter in\n", + "Q=650 # ft^3/min\n", + "T=40 #F Temperature \n", + "\n", + "#CALCULATIONS\n", + "CR=(250+14.7)/14.7\n", + "Pf=(0.1025*L*(Q*1/60)*(Q*1/60))/(CR*d)\n", + "\n", + "#RESULTS\n", + "print('The the pressure drop is = %.2f lbf/in^2' %Pf)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The the pressure drop is = 6.02 lbf/in^2\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 16.2, Page No 423

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#initialisation of variables\n", + "L=(8*5.2)+(2*59)+(1*10.3) #ft length\n", + "C=0.1025 # Experimental coefficient\n", + "d=47.2561 # internal diameter\n", + "Q=500.0 # ft^3/min free air \n", + "CR=4.4 # ratio of compression of pipe\n", + "\n", + "\n", + "#CALCULATIONS\n", + "\n", + "Pf=(C*L*((Q*1/60)*(Q*1/60)))/(CR*d)\n", + "\n", + "#RESULTS\n", + "print('The the pressure drop is = %.2f lbf/in^2' %Pf)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The the pressure drop is = 5.82 lbf/in^2\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 16.3, Page No 433

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variables\n", + "#CALCULATIONS\n", + "T=60+(0.25*60) #total air consumption ft^3/min\n", + "\n", + "#RESULTS\n", + "print('The total air consumption = %.2f ft^3/min' %T)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The total air consumption = 75.00 ft^3/min\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 16.4, Page No 434

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variables\n", + "Qr=10 #ft^3/min consumption rate\n", + "t=5 #time min\n", + "p1=125 #lbf/in^2 pressure\n", + "p2=100 #lbf/in^2 pressure\n", + "\n", + "#CALCULATIONS\n", + "Vr=(14.7*Q*t)/(p1-p2)\n", + "\n", + "#RESULTS\n", + "print('The size of the receiver = %.2f ft^3' %Vr)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The size of the receiver = 29.40 ft^3\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 16.5, Page No 444

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "\n", + "#initialisation of variables\n", + "Q=35 #ft^3/min consumption rate\n", + "t=540 #time min\n", + "p1=90+14.7 #presure lbf/in^2\n", + "p2=80+14.7 # pressure lbf/in^2\n", + "\n", + "#CALCULATIONS\n", + "K=(p1+p2)/2\n", + "Cv=(Q/22.67)*(math.sqrt(t/((p1-p2)*K)))\n", + "\n", + "#RESULTS\n", + "print('The size of the air valve = %.2f ' %Cv)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The size of the air valve = 1.14 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 16.7, Page No 448

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "\n", + "#initialisation of variables\n", + "Q=35 #ft^3/min consumption rate\n", + "V1=0.327 #volume ft^3/min\n", + "p1=104.7 #presure lbf/in^2\n", + "p2=14.7 #pressure lbf/in^2\n", + "d=3 #in diameter\n", + "#CALCULATIONS\n", + "A=(3.14*(d*d)/4\n", + "Q=((A*4)/1728)*20\n", + "V2=p1*V1/p2\n", + "\n", + "#RESULTS\n", + "print('The free air consumption = %.2f ft^3/min' %V2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The free air consumption = 2.33 ft^3/min\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 16.8, Page No 451

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "\n", + "#initialisation of variables\n", + "Fa=0.065 # free air ft^3/in\n", + "d=4 # stroke in\n", + "c=20 # cycle rate cycles/min\n", + "#CALCULATIONS\n", + "Qv=(Fa*d*c)/2\n", + "\n", + "#RESULTS\n", + "print('The free air consumption = %.2f ft^3/min' %Qv)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The free air consumption = 2.60 ft^3/min\n" + ] + } + ], + "prompt_number": 2 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_2-checkpoint.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_2-checkpoint.ipynb new file mode 100644 index 00000000..0861593c --- /dev/null +++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_2-checkpoint.ipynb @@ -0,0 +1,428 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:27338db4766b4c1985ad23f02bae5de155caa330da171300335b58c2d2835845" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chpater No 2: Basics of Hydraulics

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.1, Page No 23

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variables\n", + "W=1000.0 #weight lbf\n", + "D=1.25 #distance ft\n", + "\n", + "#CALCULATIONS\n", + "Work=W*D\n", + "#IN SI unit\n", + "W=4448 #weight N\n", + "D=0.381 #distance m\n", + "Work1=W*D\n", + "\n", + "#RESULTS\n", + "print('The work from the system would be = %.2f ft-lbf' %Work)\n", + "print('The work from the system in SI unit would be = %.2f m-N' %Work1)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The work from the system would be = 1250.00 ft-lbf\n", + "The work from the system in SI unit would be = 1694.69 m-N\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.2, Page No 24

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variables\n", + "F1=100.0 #Force lbf\n", + "F2=2000.0 #Force lbf\n", + "L2=12 #in\n", + "\n", + "#CALCULATIONS\n", + "L11=L2*(F2/F1)\n", + "#IN SI unit\n", + "F1=444.8 #Force N\n", + "F2=8896.0 #Force N\n", + "L2=0.3048 #Force m\n", + "L12=L2*(F2/F1)\n", + "\n", + "#RESULTS\n", + "print('The pump piston have to travel = %.2f in' %L11)\n", + "print('The pump piston have to travel = %.2f m' %L12)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The pump piston have to travel = 240.00 in\n", + "The pump piston have to travel = 6.10 m\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.3, Page No 25

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#initialisation of variables\n", + "F1=150.0 #lbf Force\n", + "A1=0.049 #in^2 area\n", + "A2=0.785 #in^2 area\n", + "\n", + "#CALCULATIONS\n", + "F21=F1*(A2/A1)\n", + "#IN SI unit\n", + "F1=667.2 #N(Force)\n", + "A1=31.7 #mm^2(Area)\n", + "A2=506.7 #mm^2(Area)\n", + "F22=F1*(A2/A1)\n", + "\n", + "#RESULTS\n", + "print('The weight lifted by a downward force = %.2f lbf' %F21)\n", + "print('weight lifted by a downward force in SI unit = %.2f N' %F22)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The weight lifted by a downward force = 2403.06 lbf\n", + "weight lifted by a downward force in SI unit = 10664.68 N\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.4, Page No 27

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variables\n", + "F =800.0 #lbf Force\n", + "D=20 #ft distance\n", + "t=20 #sec time\n", + "C=550 #ft-lbf/sec\n", + "\n", + "#CALCULATIONS\n", + "HP=(F*D)/(t*C)\n", + "\n", + "#RESULTS\n", + "print('The Horse powe required is = %.2f HP' %HP)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Horse powe required is = 1.45 HP\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.5, Page No 27

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#initialisation of variables\n", + "V1=2000.0 #watts voltage\n", + "V2=746.0 #watts voltage\n", + "\n", + "#CALCULATIONS\n", + "HP=V1/V2\n", + "\n", + "#RESULTS\n", + "print('The Horse powe required is = %.2f HP' %HP)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Horse powe required is = 2.68 HP\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.6, Page No 28

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variables\n", + "N=1200 #rev/min speed\n", + "A=(3.14*((1.125*1.125)*5))/4 #Cross section of the bore in in^2\n", + "L=1 # cylinder stroke (inch)\n", + "#CALCULATIONS\n", + "V=A*L\n", + "Q=V*N/231\n", + "\n", + "#RESULTS\n", + "print('The displacement would be = %.2f in^3/rev' %V)\n", + "print('The flow rate would be = %.2f gal/min' %Q)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The displacement would be = 4.97 in^3/rev\n", + "The flow rate would be = 25.81 gal/min\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.7, Page No 31

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variables\n", + "P1=2000.0 #lbf/in^2 pressure\n", + "Q1=5 #gal/min flow rate\n", + "P3=13793.0 #kPa pressure\n", + "Q3=18.9 #liters/min flow rate\n", + "\n", + "#CALCULATIONS\n", + "Fhp1=P1*Q1/1714 #In English units\n", + "Fhp2=(P1*4.448*1550*Q1*3.7851*0.001)/44760 #In SI unit\n", + "Fhp3=P3*Q3/44760 #with technique 3\n", + "\n", + "\n", + "#RESULTS\n", + "print('Using technique 1 the horsepower transmitted by system would be = %.2f hp' %Fhp1)\n", + "print('Using technique 1 the horsepower transmitted by system would be = %.2f hp' %Fhp2)\n", + "print('Using technique 1 the horsepower transmitted by system would be = %.2f hp' %Fhp3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Using technique 1 the horsepower transmitted by system would be = 5.83 hp\n", + "Using technique 1 the horsepower transmitted by system would be = 5.83 hp\n", + "Using technique 1 the horsepower transmitted by system would be = 5.82 hp\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.8, Page No 35

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variables\n", + "THP=5.83 # Horse power \n", + "pi=3.14 #Pi value\n", + "N=500 #rev/min speed\n", + "\n", + "#CALCULATIONS\n", + "T=(THP*33000)/(2*pi*N)\n", + "\n", + "#RESULTS\n", + "print('The torque would be = %.2f lbf-ft' %T)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The torque would be = 61.27 lbf-ft\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.9, Page No 35

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variables\n", + "T=2000.0 #lbf-ft torque\n", + "N=20.0 #rev/min speed\n", + "P=2000 #lbf/in^2 pressure \n", + "\n", + "#CALCULATIONS\n", + "Q1=(1714*N*T)/(5252*P)\n", + "Fhp1=(P1*Q1)/1714\n", + "Q2=(44760*N*2712)/(7122*13793)\n", + "Fhp2=(13793*Q2)/44760\n", + "\n", + "#RESULTS\n", + "print('In English units the flow rate would be = %.2f gal/min' %Q1)\n", + "print('In English units the Horsepower would be = %.2f hp' %Fhp1)\n", + "print('In SI units the flow rate would be = %.2f lit/min' %Q2)\n", + "print('In SI units the Horsepower would be = %.2f hp' %Fhp2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The flow rate would be = 6.53 gal/min\n", + "The Horsepower would be = 7.62 hp\n", + "The flow rate would be = 24.71 gal/min\n", + "The Horsepower would be = 7.62 hp\n" + ] + } + ], + "prompt_number": 17 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 2.10, Page No 36

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variables\n", + "N=750.0 #rev/min speed\n", + "Q=5 #gal/min flow rate\n", + "P=1000 #lbf/in^2 pressure\n", + "\n", + "#CALCULATIONS\n", + "T=(5252*P*Q)/(1714*N)\n", + "\n", + "#RESULTS\n", + "print('The expected torque would be = %.2f lbf-ft' %T)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The expected torque would be = 20.43 lbf-ft\n" + ] + } + ], + "prompt_number": 10 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_3-checkpoint.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_3-checkpoint.ipynb new file mode 100644 index 00000000..08a4040d --- /dev/null +++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_3-checkpoint.ipynb @@ -0,0 +1,448 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:41e08ad2cbd71b375b8fca4d52dca8e12f0a2ed40aa710b7f9246d1cab354954" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter No 3: Energy in Hydraulic systems

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.1, Page No 44

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variables\n", + "h=50.0 #ft height\n", + "sg=1.0 #Density \n", + "\n", + "#CALCULATIONS\n", + "p=sg*h*0.433 # pressure\n", + "\n", + "#RESULTS\n", + "print('Pressure is = %.2f lbf/in^2' %p)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Pressure is = 21.65 lbf/in^2\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.2, Page No 44

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variables\n", + "p=1500.0 #lbf/in^2 pressure\n", + "Sg=0.78 #Density \n", + "p2=p*6895 #lbf/in^2 pressure\n", + "#CALCULATIONS\n", + "h=(p*2.31)/Sg\n", + "h2=(p2*1.02)/(10000*Sg) #In metric units\n", + "\n", + "#RESULTS\n", + "print('Head in ft = %.2f ft' %h)\n", + "print('In metric units Head in ft = %.2f ft' %h2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Head in ft = 4442.31 ft\n", + "Head in ft = 1352.48 ft\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.3, Page No 45

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variables\n", + "p=13790000 #N/m^2 pressure\n", + "Sg=0.83 #Density \n", + "\n", + "#CALCULATIONS\n", + "h=(p*1.02)/(Sg*10000)\n", + "\n", + "#RESULTS\n", + "print('Head in ft = %.2f m' %h)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Head in ft = 1694.67 m\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.4, Page No 46

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variables\n", + "Q=40 #Gal/min flow rate\n", + "a1=3.14 #in^2 area\n", + "a2=12.56 #in^2 area \n", + "#CALCULATIONS\n", + "#Part a\n", + "v1=Q/(a1*3.12) #fluid velocity in 2 in diameter\n", + "#Part b\n", + "v2=(a1*v1)/a2 #Fluid Velocity in 4 in diameter\n", + "#RESULTS\n", + "print('Fluid Velocity in 2 in diameter pipe is = %.2f ft/sec' %v1)\n", + "print('Fluid Velocity in 4 in diameter pipe is = %.2f ft/sec' %v2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Fluid Velocity is = 4.08 ft/sec\n", + "Fluid Velocity is = 1.02 ft/sec\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.5, Page No 47

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "\n", + "#initialisation of variables\n", + "Q=18 #Gal/min flow rate\n", + "a=3.14 #in^2 area \n", + "v2=10 #ft/sec velocity\n", + "#CALCULATIONS\n", + "v=Q/(a*3.12) \n", + "D=math.sqrt((4*Q)/(math.pi*v2*3.12))\n", + "\n", + "#RESULTS\n", + "print('Velocity is = %.2f in' %D)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Velocity is = 0.86 in\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.6, Page No 51

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#initialisation of variables\n", + "p=10.0 #lbf/in^2 pressure\n", + "Sg=0.87 #Density\n", + "\n", + "#CALCULATIONS\n", + "h=p*2.31/Sg\n", + "#The value of h is actualy 26.55 but in book they have rounded off to 26.6 \n", + "EPE=200*Sg*8.34*h #Elevation energy\n", + "#RESULTS\n", + "print('The height = %.1f ft' %h)\n", + "print('The energy of elevation = %.2f ft-lbf' %EPE)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The height = 26.6 ft\n", + "The energy of elevation = 38530.80 ft-lbf\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.7, Page No 53

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variables\n", + "F=1000 #lbf force\n", + "A=3.14 #in^2 area\n", + "pe=10.0 #lbf/in^2 (Pressure of elevation)\n", + "\n", + "#CALCULATIONS\n", + "p=F/A #Total pressure\n", + "P=p-pe\n", + "\n", + "#RESULTS\n", + "print('The pressure is = %.2f lbf/in^2' %P)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The pressure is = 308.47 lbf/in^2\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.8, Page No 53

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "\n", + "#initialisation of variables\n", + "Sg=0.87 #Density\n", + "a=0.785 #in^2 area \n", + "g=32.2 #ft/sec^2\n", + "\n", + "#CALCULATIONS\n", + "w=25*Sg*231*62.4*1/1738\n", + "Q=25*231*1/12*1/60\n", + "v=Q/a\n", + "KE=(w*v*v)/(2*g)\n", + "\n", + "#RESULTS\n", + "print('The Kinetic enegry is = %.2f ft-lbf' %KE)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Kinetic enegry is = 290.91 ft\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.9, Page No 55

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variables\n", + "A1=7.065 #area in^2\n", + "A2=0.785 #area in^2\n", + "p1=1000 #pressure lbf/in^2\n", + "Q=500 #flow rate gal/min\n", + "g=32.2 #ft/sec^2\n", + "Sg=0.91 #density\n", + "\n", + "#CALCULATIONS\n", + "v1=Q/(A1*3.12) #Velocity\n", + "v2=Q/(A2*3.12) #Velocity\n", + "temp1=(p1*2.31)/Sg\n", + "temp2=(v1*v1)/ (2*g)\n", + "temp3=(v2*v2)/(2*g)\n", + "p2=(temp1+temp2-temp3)*Sg/2.31\n", + "\n", + "#RESULTS\n", + "print('The pressure is = %.2f lbf/in^2' %p2)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The pressure is = 748.21 lbf/in^2\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.10, Page No 55

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variables\n", + "p=1000 #pressure lbf/in^2\n", + "p1=350 #pressure lbf/in^2\n", + "Sg=0.85 #Specific gravity\n", + "\n", + "#CALCULATIONS\n", + "Ha=p*2.31/Sg\n", + "H1=p1*2.31/Sg\n", + "He=Ha-H1-679.41\n", + "\n", + "#RESULTS\n", + "print('The energy extracted from the fluid = %.2f lbf/in^2' %He)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The energy extracted from the fluid = 1087.06 lbf/in^2\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 3.11, Page No 55

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "h=40 #height ft\n", + "g=32.2 #ft/sec^2\n", + "#CALCULATIONS\n", + "v=math.sqrt(2*g*h) #velocity\n", + "#RESULTS\n", + "print('The energy extracted from the fluid = %.2f lbf/in^2' %v)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The energy extracted from the fluid = 50.75 lbf/in^2\n" + ] + } + ], + "prompt_number": 17 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_4-checkpoint.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_4-checkpoint.ipynb new file mode 100644 index 00000000..fa4223d9 --- /dev/null +++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_4-checkpoint.ipynb @@ -0,0 +1,157 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:ef80559993f5ef663679dee68ecb16be7277adf553aef3de2eb86d71037aadc3" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter no 4: How Fluids flow

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.1, Page No 64

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#initialisation of variables\n", + "a1=12.56 #Area(in^2)\n", + "s1=24 #stroke(in^3)\n", + "a2=3.14 #Area(in^2) displacement of ram\n", + "s2=24 #stroke in^3\n", + "Ve=0.785 #Extension volume in^3\n", + "\n", + "\n", + "#CALCULATIONS\n", + "Ve=a1*s1 #extension volume\n", + "Vs=a2*s2 \n", + "Vr=Ve-Vs #Retraction volume\n", + "Vt=Ve+Vr #Total volume\n", + "\n", + "#RESULTS\n", + "print('Displacement of the cylinder would be = %.2f in^3' %Vt)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Displacement of the cylinder would be = 527.52 in^3\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.4, Page No 75

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "#initialisation of variables\n", + "A=0.785 #area\n", + "Q=100 #gal/min flow rate\n", + "D=1 #in diameter\n", + "v=0.05 #viscocity Newts\n", + "\n", + "#CALCULATIONS\n", + "V=Q/(A*3.12) #velocity\n", + "Nr=(12*V*D)/v #reynolds number\n", + "\n", + "#RESULTS\n", + "print('The velocity would be = %.2f lbf-ft' %V)\n", + "print('The Reynolds number would be = %.2f Hence the flow is turbulent' %Nr)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The velocity would be = 40.83 lbf-ft\n", + "The Reynolds number would be = 9799.12 Hence the flow is turbulent\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 4.5, Page No 76

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variables\n", + "Nr=4000 #reynolds number\n", + "Nr2=2000 #reynolds number\n", + "m=0.27 #P viscocity\n", + "D=2.54 #cm diameter\n", + "p=0.85 #pressure gm/cm^3\n", + "m2=27 #cP viscocity\n", + "D2=1 #in diameter\n", + "#CALCULATIONS\n", + "V=(Nr*m)/(D*p) #velocity\n", + "\n", + "# for lower critical velocity\n", + "V2=(Nr2*m)/(D*p)\n", + "v=m2/p\n", + "vn=0.001552*v\n", + "vh=(Nr*vn)/(12*D2)\n", + "vl=(Nr2*vn)/(12*D2)\n", + "\n", + "#RESULTS\n", + "print('The velocity would be = %.2f cm/sec' %V)\n", + "print('The lower velocity would be = %.2f cm/sec' %V2)\n", + "print('Using reynolds formula the velocity would be = %.2f ft/sec' %vh)\n", + "print('Using reynolds formula the lower velocity would be = %.2f ft/sec' %vl)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The velocity would be = 500.23 cm/sec\n", + "The lower velocity would be = 250.12 cm/sec\n", + "using reynolds formula the velocity would be = 16.43 newts\n", + "using reynolds formula the lower velocity would be = 8.22 cm/sec\n" + ] + } + ], + "prompt_number": 7 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_5-checkpoint.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_5-checkpoint.ipynb new file mode 100644 index 00000000..dfa30c9f --- /dev/null +++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_5-checkpoint.ipynb @@ -0,0 +1,347 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:4f7ceb1a02c4aed051683602c2032c5c01a494cc7ebde0035eb0f03a6d976611" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.1, Page No 82

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "\n", + "#initialisation of variables\n", + "Q=200 #gal/min flow rate\n", + "A=3.14 #area in^2\n", + "f=0.05 #friction factor\n", + "g=32.2 #ft/sec^2\n", + "L=800 #ft length\n", + "Sg=0.91 #density\n", + "\n", + "#CALCULATIONS\n", + "v=Q/(A*3.12) #velocity of fluid\n", + "D=(2*1.0)/12 #in\n", + "hf=f*(L/D)*((v*v)/(2*g)) #head loss\n", + "hps=0.433*Sg*hf\n", + "\n", + "#RESULTS\n", + "print('The pressure drop is = %.2f lbf/in^2' %hps)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The pressure drop is = 611.99 lbf/in^2\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.2, Page No 84

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "Q=15 #gal/min\n", + "A=0.785 #area\n", + "D=1 #diameter in\n", + "v1=0.08 #Viscocity Newts\n", + "L=400 #Length ft\n", + "g=32.2 #ft/sec^2\n", + "Sg=0.85 #density\n", + "\n", + "#CALCULATIONS\n", + "v=Q/(A*3.12)\n", + "Nr=(12*v*D)/v1 #reynolds number\n", + "hf=(32*v1*L*v)/(D*D*g) #head drop\n", + "hps=0.433*Sg*hf\n", + "\n", + "#RESULTS\n", + "print('The pressure drop is = %.2f lbf/in^2' %hps)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The pressure drop is = 71.68 lbf/in^2\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.3, Page No 87

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "\n", + "#initialisation of variables\n", + "Q=600 #gal/min flow rate\n", + "A=3.14 #area in^2\n", + "f=0.040 #force in^2\n", + "D=2 #diameter in\n", + "v1=0.30 #Viscocity in^2sec\n", + "L=500 #length ft\n", + "g=32.2 #ft/sec^2\n", + "Sg=0.85 #density\n", + "\n", + "#CALCULATIONS\n", + "v=Q/(A*3.12)\n", + "Nr=(12*v*D)/v1 #reynolds number\n", + "D=(2*1.0)/12\n", + "hf=f*(L/D)*((v*v)/(2*g))\n", + "hps=0.433*Sg*hf #Pressure drop\n", + "\n", + "#RESULTS\n", + "print('The pressure drop is = %.2f lbf/in^2' %hps)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The pressure drop is = 2572.39 lbf/in^2\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.4, Page No 90

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "\n", + "#initialisation of variables\n", + "p=120 #pressure drop lbf/in^2\n", + "Sg=0.85 #density\n", + "Q=1000 #gal/min flow rate\n", + "A=3.14 #area \n", + "\n", + "#CALCULATIONS\n", + "Cd=(1/38.06)*(Q/A)*(math.sqrt(Sg/p)) #discharge coefficient\n", + "\n", + "#RESULTS\n", + "print('The discharge coefficient is = %.2f ' %Cd)\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The discharge coefficient is = 0.70 \n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.5, Page No 94

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#initialisation of variables\n", + "Q=50 #gal/min flow rate\n", + "A=0.785 #area\n", + "D=1 #diameter in\n", + "f=1 #\n", + "v1=0.05 #Viscocity Newts\n", + "L=500 #length ft\n", + "g=32.2 #ft/sec^2\n", + "Sg=0.91 #Density\n", + "\n", + "#CALCULATIONS\n", + "v=Q/(A*3.12) #velocity\n", + "Nr=(12*v*D)/v1 #Reynolds\n", + "temp=((v*v)/(2*g))\n", + "hi=0.78*temp #inward projection\n", + "ho=1.0*temp #Outward projection\n", + "hg=10.0*temp #Globe Valve\n", + "he=4*0.90*temp # 4 std 90 degree elbow\n", + "hn=(3.0/4)*temp #sudden enlargement\n", + "hc=0.5*3.0/4*temp #Sudden contraction\n", + "hff=hi+ho+hg++he+hn+hc #Total head loss\n", + "hps=0.433*Sg*hff\n", + "\n", + "#RESULTS\n", + "print('The pressure drop is = %.2f lbf/in^2' %hps)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The pressure drop is = 42.09 lbf/in^2\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.6, Page No 96

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "\n", + "#initialisation of variables\n", + "Q=150 #gal/min flow rate\n", + "A=0.785 #area in^2\n", + "D=1 #diameter in\n", + "f=0.045 #\n", + "v1=0.10 #Viscocity newts\n", + "Sg=0.91 #density\n", + "K=2.5\n", + "\n", + "#CALCULATIONS\n", + "v=Q/(A*3.12)\n", + "Nr=(12*v*D)/v1 # Reynolds number\n", + "Le=(D*K)/(12*f) #length\n", + "\n", + "#RESULTS\n", + "print('The equivalent length is = %.2f ft' %Le)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The equivalent length is = 4.63 ft\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 5.7, Page No 97

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#initialisation of variables\n", + "Q=100 #gal/min flow rate\n", + "A1=3.14 #area in^2\n", + "A2=0.785 #area in^2\n", + "D=2 #Diameter in \n", + "k=12.4 #K-factor\n", + "g=32.2 #ft/sec^2\n", + "L=134.58 #Length ft\n", + "p=224.7 #Total pressure drop lbf/in^2\n", + "Q=100 #gal/min flow rate\n", + "L2=35.33 #ft length\n", + "#CALCULATIONS\n", + "v1=Q/(A1*3.12) #velocity\n", + "v2=Q/(A2*3.12) #velocity\n", + "v=0.001552*80 # kinematic viscosity from cSt to newts \n", + "Nr=(12*v1*D)/v #Reynold number\n", + "D1=1\n", + "D2=1\n", + "k2=20\n", + "f2=0.05\n", + "Nr2=(12*v2*D1)/v #Reynold number\n", + "f1=64/Nr\n", + "Le=(D*k)/(12*f1) #length\n", + "hf=f1*((L*(v1*v1))/((2.0/12.0)*(2*g)))\n", + "hsif=0.433*0.88*hf #pressure loss\n", + "Le2=(D2*k2)/(12*f2)\n", + "hf2=f2*((L2*(v2*v2))/((1.0/12.0)*(2*g)))\n", + "hsif2=0.433*0.88*hf2 #pressure loss\n", + "pd=hsif+hsif2\n", + "Fhp=(pd*Q)/1714\n", + "#RESULTS\n", + "print('The pressure drop is = %.2f lbf/in' %pd)\n", + "print('The fluid horsepwer is = %.2f hp' %Fhp)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The pressure drop is = 225.24 lbf/in\n", + "The fluid horsepwer is = 13.14 hp\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_6-checkpoint.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_6-checkpoint.ipynb new file mode 100644 index 00000000..789b362e --- /dev/null +++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_6-checkpoint.ipynb @@ -0,0 +1,130 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:2a45c36aaa47c05012e31744a57dc2decac5ab57032d2c7729bcf9fae98dd916" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter No 6 :Hydraulic Fluids

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.2, Page No 115

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "\n", + "#initialisation of variables\n", + "V1=1.0 #volume\n", + "p2=2000 #pressure lbf/in^2\n", + "p1=1000 #pressure lbf/in^2\n", + "K=350000 #k factor lbf/in^2\n", + "\n", + "#CALCULATIONS\n", + "dV=V1*(p2-p1)/K\n", + "\n", + "#RESULTS\n", + "print('The fluid be expected compress is = %.4f ' %dV)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The fluid be expected compress is = 0.0029 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.3, Page No 127

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "#CALCULATIONS\n", + "m1=36815.0 #Particles count upstream\n", + "m2=6347 #Particles count downstream\n", + "b=m1/m2 #beta ratio\n", + "\n", + "#RESULTS\n", + "print('The beta ratio = %.1f ' %b)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The beta ratio = 5.8 \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 6.4, Page No 127

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import math\n", + "\n", + "\n", + "#CALCULATIONS\n", + "m1=36815.0 # Particles count upstream\n", + "m2=6347 #Particles count downstream\n", + "b=((m1-m2)/m1)*100 # Beta efficiency\n", + "\n", + "#RESULTS\n", + "print('The beta efficiency = %.2f percent' %b)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The beta efficiency = 82.76 percent\n" + ] + } + ], + "prompt_number": 2 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_7-checkpoint.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_7-checkpoint.ipynb new file mode 100644 index 00000000..c35b63d7 --- /dev/null +++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_7-checkpoint.ipynb @@ -0,0 +1,226 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:7f3e7af3a7770bd6065b2ca329fec5074b9d86ea22aa36dc09cc71c375000d3b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter No 7 : Pumps

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.1, Page No 135

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "P=2500.0 #pressure lbf/in^3\n", + "Q=3.0 #gpm flow rate\n", + "p=5.0 #Bhp power\n", + "N=1725.0 #rpm speed\n", + "\n", + "#CALCULATIONS\n", + "eo=P*Q*100.0/(1714.0*p) # pump efficiency\n", + "To=p*5250.0/ N # torque Input\n", + "\n", + "#RESULTS\n", + "print('\\n Input torque = %.3f lb-ft ' %To)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Input torque = 15.217 lb-ft " + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.2 Page No 137

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "Q=52.0 #gpm flow rate\n", + "v=3.75 #in^3 positive displacement\n", + "N=3300.0 #rpm speed\n", + "\n", + "#CALCULATIONS\n", + "ev=231.0*Q*100.0/(v*N) #Volumetric efficiency\n", + "\n", + "#RESULT\n", + "print('\\n Volumetric efficiency = %.3f percent ' %ev)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Volumetric efficiency = 97.067 percent " + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.3, Page No 137

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "eo=87.0 #percent overall efficiency\n", + "ev=94.0 #percent volumetric efficiency\n", + "p=10.0 #bhpi\n", + "\n", + "#CALCULATIONS\n", + "em=eo/ev # Mechanical efficiency\n", + "em1=em*100.0\n", + "Fhp=p*(1.0-em)\n", + "\n", + "#RESULTS\n", + "print(' \\n Frictional horsepower = %.3f hp ' %Fhp)\n", + "print('\\n Mechanical efficiency = %.2f percent ' %em1 )" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " \n", + " Frictional horsepower = 0.745 hp \n", + "\n", + " Mechanical efficiency = 92.55 percent \n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.4 Page No 150

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "n=9.0 #no of cycles\n", + "N=3000.0 #rpm speed\n", + "s=0.75 #inch stroke\n", + "d=0.5 #inch diameter\n", + "\n", + "#CALCULATIONS\n", + "Q=n*N*s*math.pi*d**2/(4.0*231.0)\n", + "\n", + "#RESULTS\n", + "print(' Volume flow rate = %.3f gpm ' %Q)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Volume flow rate = 17.212 gpm " + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 7.5 Page No 162

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "d=6.0 #in diameter\n", + "S=120.0 #in stroke\n", + "Q=5.0 #gpm flow rate\n", + "\n", + "#CALCULATIONS\n", + "Vc=math.pi*d**2*S/(4.0*231.0)\n", + "\n", + "#RESULTS\n", + "print('Minimum size of the reservoir = %.3f gpm ' %Vc)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Minimum size of the reservoir = 14.688 gpm \n" + ] + } + ], + "prompt_number": 2 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_8-checkpoint.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_8-checkpoint.ipynb new file mode 100644 index 00000000..f2ea6a6f --- /dev/null +++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_8-checkpoint.ipynb @@ -0,0 +1,282 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:17c640dd0a4a95ba945b4c3f11eeafabec4d7eceacb7724326f3938cd4b8f643" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 8 : Hydraulic Cylinders and Cushioning Devices

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.1 Page No 172

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "F=80000.0 #lbs Force\n", + "F2=355800.0 #N Force\n", + "P=1600.0 #lbf/in^2 Pressure\n", + "P2=11.03*(1000000) #N/m^2 Pressure\n", + "\n", + "#CALCULATIONS\n", + "db=math.sqrt(4.0*F/(math.pi*P))\n", + "#In SI units\n", + "db2=math.sqrt((4.0*F2)/(math.pi*P2))\n", + "db2=db2*100 # To convert it into cm\n", + "#RESULTS\n", + "print('\\n Size of the cylinder postion = %.3f in ' %db)\n", + "print('\\n Using SI units size of the cylinder postion = %.1f cm ' %db2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Size of the cylinder postion = 7.979 in \n", + "\n", + " Size of the cylinder postion = 20.266 in \n", + "\n", + " Size of the cylinder postion = 11030000.000 in \n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.2 Page No 173

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "Q=25.0 #gpm flow rate\n", + "A=0.533 #in^2 area\n", + "\n", + "#Calculations\n", + "nu=Q*19.25/(A*60.0) #Fluid velocity\n", + "nucylinder =Q*19.25/12.56 #Cylinder velocity\n", + "\n", + "#Results\n", + "print('\\n Fluid velocity = %.3f ft/sec' %nu)\n", + "print('\\n Cylinder velocity = %.3f ft/min' %nucylinder )" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Fluid velocity = 15.048 ft/sec\n", + "\n", + " Cylinder velocity = 38.316 ft/min\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.3 Page No 178

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "d=3.0 #in diameter\n", + "P=2000.0 #lbf/in^2 pressure\n", + "s=20.0 #stroke in\n", + "\n", + "#CALCULATIONS\n", + "Cl=s*d/2.0 #corrected length\n", + "F=P*math.pi*d**2/4.0 #thrust\n", + "stl=(Cl-40.0)/10.0 #stop tube length\n", + " \n", + "#RESULTS\n", + "print('\\n Length of the stop tube= %.3f in ' %Cl)\n", + "F=F+3\n", + "print('\\n Thrust on the rod= %.3f lb ' %F)\n", + "print('\\n Stop Tube length= %.3f stl ' %stl)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Length of the stop tube= 30.000 in \n", + "\n", + " Thrust on the rod= 14140.167 lb \n", + "\n", + " Stop Tube length= -1.000 stl " + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.4 Page No 182

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "v=120.0 #ft/min velocity\n", + "S=1.5 #in distance\n", + "w=8000.0 #lb wight\n", + "\n", + "#CALCULATIONS\n", + "ga=v**2*0.0000517/S\n", + "F=w*ga\n", + "#RESULTS\n", + "print(' Total force decessary to decelarate the load= %.3f lb ' %F)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total force decessary to decelarate the load= 3970.560 lb \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.5 Page No 184

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "P=750.0 #lbf/in^2 pressure\n", + "d=3.0 #in distance\n", + "w=1500.0 #lb weight\n", + "ga=0.172 #Acceleration factor\n", + "f=0.12 #Coefficient of fraction\n", + "v=50 #ft/min velocity\n", + "s=0.75 #in stroke\n", + "\n", + "#CALCULATIONS\n", + "Fa=P*math.pi*d**2/4.0\n", + "F=w*(ga-f)+Fa\n", + "#RESULT\n", + "print('\\n Total force decessary to decelarate the load= %.3f lb ' %F)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + " Total force decessary to decelarate the load= 5379.438 lb \n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 8.6 Page No 186

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "d=3.0 #in diameter\n", + "d1=1.5 #in diameter\n", + "F=7500.0 #lb force\n", + "\n", + "#CALCULATIONS\n", + "A1=(math.pi/4.0)*(d**2-d1**2)\n", + "P=F/A1\n", + "#RESULT\n", + "print(' Pressure in the cylinder = %.3f psi' %P)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Pressure in the cylinder = 1413.711 psi" + ] + } + ], + "prompt_number": 6 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_9-checkpoint.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_9-checkpoint.ipynb new file mode 100644 index 00000000..ddb6d25f --- /dev/null +++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_No_9-checkpoint.ipynb @@ -0,0 +1,271 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:fa3b77fb957b6452bc46163f22ab8db8630dd903dfdd45f948929785db1004f9" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter No 9 : Hydraulic motors

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example9.1 Page No 194

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "P=2000.0 #lbf/in^3 pressure\n", + "Vm=0.5 #in^3 displacement\n", + "\n", + "#CALCULATONS\n", + "T=P*Vm*0.16\n", + "\n", + "#RESULTS\n", + "print('\\n Theotrical torque = %.3f lb-in ' %T)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Groove diameter = 3.776 in \n", + " \n", + " Groove width = 0.196 in \n", + "\n", + " outside diameter = 4.000 in " + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.2 Page No 194

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "Q=7.5 #gpm flow rate\n", + "Q2=28.39 #l/min f;ow rate\n", + "Vm=2 #in^3 displacement\n", + "Vm2=0.03281 #l/rev displacement\n", + "\n", + "#CALCULATIONS\n", + "N=231.0*Q/Vm # Theotrical speed\n", + "#SI units\n", + "N2=(Q2/Vm2) # in SI units Theotrical speed\n", + "\n", + "#RESULT\n", + "print(' Theotrical speed of fluid power = %.3f rpm ' %N)\n", + "print(' Using SI units Theotrical speed of fluid power = %.3f rev/min ' %N2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Theotrical speed of fluid power = 866.250 rpm \n", + " Using SI units Theotrical speed of fluid power = 865.285 rev/min \n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.3 Page No 195

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "Vm=0.55 #in^3 displacement\n", + "N=3400.0 #rpm Theotrical speed\n", + "\n", + "#CALCULATIONS\n", + "Q=Vm*N/231.0\n", + "\n", + "#RESULT\n", + "print(' Effective flow rate = %.3f gpm ' %Q)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Effective flow rate = 8.095 gpm \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.4 Page No 195

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "T=32.0 #lb_ft torque\n", + "N=1200.0 #rpm Theotrical speed\n", + "P=2000.0 #psi pressure lbf/in^2\n", + "Q=7.5 #gpm flow rate\n", + "\n", + "#CALCULATIONS\n", + "eo=T*N*100.0/(P*Q*3.06)\n", + "\n", + "#RESULT\n", + "print(' Overall efficiency = %.3f percent ' %eo)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Overall efficiency = 83.660 percent \n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.5 Page No 196

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "Vm=0.6 #in^3 displacement\n", + "N=2400 #rpm theotrical speed\n", + "Qa=6.5 #gal/min flow rate\n", + "Vm1=0.00981 #l/rev displacement\n", + "#CALCULATIONS\n", + "ev=((Vm*N)/(Qa*231))*100\n", + "#in SI units\n", + "ev1=((Vm1*N)/(24.611))*100\n", + "TFL=0.041*Qa # total fluid loss\n", + "CDL=0.50*TFL #Case drain loss\n", + "\n", + "#RESULT\n", + "print(' Total fluid loss = %.2f gal/min ' %TFL)\n", + "print(' Case drain loss = %.2f gal/min ' %CDL)\n", + "print(' Volumetric efficiency = %.2f percent ' %ev)\n", + "print(' Volumetric efficiency in SI units = %.2f percent ' %ev1)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Total fluid loss = 0.27 gal/min \n", + " Case drain loss = 0.13 gal/min \n", + " Volumetric efficiency = 95.90 percent \n", + " Volumetric efficiency in SI units = 95.66 percent \n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 9.6 Page No 197

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "#Variable initialization\n", + "eo=88.0 # Overall efficiency (%)\n", + "ev=97 # Volumetric efficiency(%)\n", + "\n", + "#CALCULATIONS\n", + "em=(eo/ev)*100\n", + "\n", + "#RESULT\n", + "print(' Mechnical efficiency efficiency = %.3f percent ' %em)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " Mechnical efficiency efficiency = 90.722 percent \n" + ] + } + ], + "prompt_number": 2 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_no_1-checkpoint.ipynb b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_no_1-checkpoint.ipynb new file mode 100644 index 00000000..1c23b49f --- /dev/null +++ b/_Fluid_Power_Theory_&_Applications_by_J._Sullivan,_4th_Edition/.ipynb_checkpoints/Chapter_no_1-checkpoint.ipynb @@ -0,0 +1,58 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:33757e16bbf0642b0e875c402b38109f03d490b4828afe5b522fd4980c273e77" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter No 1: Introduction

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 1.1, Page No 17

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "#initialisation of variables\n", + "Pressure=1500.0 #lbf\n", + "Area=12.57 #in^2\n", + "\n", + "#CALCULATIONS\n", + "Force=Pressure*Area\n", + "\n", + "#RESULTS\n", + "print('Force is = %.2f lbf' %Force)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Force is = 18855.00 lbf\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/_Programming_With_C/.ipynb_checkpoints/chapter1-checkpoint.ipynb b/_Programming_With_C/.ipynb_checkpoints/chapter1-checkpoint.ipynb new file mode 100644 index 00000000..c1eb1997 --- /dev/null +++ b/_Programming_With_C/.ipynb_checkpoints/chapter1-checkpoint.ipynb @@ -0,0 +1,62 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:be853ba23904264307d7e754c6f226daff90dc0e3bd2eca38f5b65419e2b80bc" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 1: Introductory Concepts

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 1.6, Page number: 1.19

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "import math\n", + "\n", + "radius=5\n", + "area=math.pi*radius*radius\n", + "print \"Area = \",area\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Area = 78.5398163397\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/_Programming_With_C/.ipynb_checkpoints/chapter10-checkpoint.ipynb b/_Programming_With_C/.ipynb_checkpoints/chapter10-checkpoint.ipynb new file mode 100644 index 00000000..ea2e1985 --- /dev/null +++ b/_Programming_With_C/.ipynb_checkpoints/chapter10-checkpoint.ipynb @@ -0,0 +1,556 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:3323f7a9a077b84fffdd30478d4b0d0b7f4032b86670a58b5b333d42bee04f15" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 10: Strings

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.3, Page Number: 10.3

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "st='Programming'\n", + "print 'The string is %s' %st" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The string is Programming\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.4, Page Number: 10.4

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "st='Hello World'\n", + "print 'The line is :'\n", + "print st" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The line is :\n", + "Hello World\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.6, Page Number: 10.5

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "strin='Welcome to python'\n", + "for i in strin:\n", + " print i," + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "W e l c o m e t o p y t h o n\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.7, Page Number: 10.6

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "str1='Programming'\n", + "len1=len(str1)\n", + "print 'The length of the string is ',len1\n", + "\n", + "str2=str1\n", + "print 'First string is %s and copied string is %s' %(str1,str2)\n", + "\n", + "str3='Computer'\n", + "\n", + "if str1==str3:\n", + " print 'Both strings are equal'\n", + "elif str1Example 10.8,Page Number: 10.7

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def strlength(str1):\n", + " count=0\n", + " for i in str1:\n", + " count+=1\n", + " \n", + " return count\n", + "def strcopy(src):\n", + " dst=[]\n", + " for i in src:\n", + " dst.append(i)\n", + " \n", + " dst=''.join(dst)\n", + " \n", + " return dst\n", + "\n", + "\n", + "str1='New Delhi'\n", + "len1=strlength(str1)\n", + "print 'The length of the string is ',len1\n", + "\n", + "str2=strcopy(str1)\n", + "print 'First string is %s and copied string is %s' %(str1,str2)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The length of the string is 9\n", + "First string is New Delhi and copied string is New Delhi\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.9,Page Number: 10.9

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def strcompare(str1,str2):\n", + " \n", + " len1=len(str1)\n", + " len2=len(str2)\n", + " \n", + " if len1str2[i]:\n", + " return 1\n", + " \n", + " return 0\n", + "\n", + "str1='Programming'\n", + "str2='Computer'\n", + "status=strcompare(str1,str2)\n", + "if status==-1:\n", + " print 'First string is lesser than second string'\n", + "elif status==1:\n", + " print 'First string is greater than second string'\n", + "else:\n", + " print 'Both strings ae equal'\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "First string is greater than second string\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.10, Page Number: 10.10

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "def leftconcat(dst,src):\n", + " dst=src+dst\n", + " return dst\n", + "\n", + "def rightconcat(dst,src):\n", + " dst=dst+src\n", + " return dst\n", + "\n", + "str1='Hello'\n", + "str2='Friends'\n", + "\n", + "tempstr=leftconcat(str2,str1)\n", + "print 'The first string after left concatenation becomes ', tempstr\n", + "\n", + "tempstr=rightconcat(str2,str1)\n", + "print 'The first string after right concatenation becomes', tempstr\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The first string after left concatenation becomes HelloFriends\n", + "The first string after right concatenation becomes FriendsHello\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.11,Page Numbr: 10.12

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "str1='All good boys have bread'\n", + "count=0\n", + "\n", + "for i in str1:\n", + " if i=='a' or i=='e'or i=='i' or i=='o' or i=='u' or i=='A' or i=='E' or i=='I' or i=='O' or i=='U' :\n", + " count+=1\n", + " \n", + "print 'Total number of vowels in a given text are ',count" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Total number of vowels in a given text are 8\n" + ] + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.12, Page Number: 10.13

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "ch1='A'\n", + "ch2=ord(ch1)+3\n", + "print chr(ch2)\n", + "\n", + "ch1=chr(ord(ch1)+1)\n", + "print ch1\n", + "\n", + "print ord('a')\n", + "print ord('l')\n", + "\n", + "val=ord(ch1)*ch2\n", + "print val\n", + "\n", + "print chr(100)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "D\n", + "B\n", + "97\n", + "108\n", + "4488\n", + "d\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.13, Page Number: 10.13

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "text='I am studying 6 Theory Papers & 4 practicals'\n", + "\n", + "len1=len(text)\n", + "text=list(text)\n", + "for i in xrange(0,len1):\n", + " if text[i]>='a' and text[i]<='z':\n", + " text[i]=chr(ord(text[i])+ord('A')-ord('a'))\n", + " \n", + " \n", + "text=''.join(text)\n", + "\n", + "print 'The text after converting lowercase alphabets to uppercase is '\n", + "print text" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The text after converting lowercase alphabets to uppercase is \n", + "I AM STUDYING 6 THEORY PAPERS & 4 PRACTICALS\n" + ] + } + ], + "prompt_number": 13 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.14, Page Number: 10.14

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "text='The programming is a systematic process'\n", + "substr='pro'\n", + "text_len=len(text)\n", + "sub_len=len(substr)\n", + "text=list(text)\n", + "substr=list(substr)\n", + "\n", + "for i in xrange(0,text_len-sub_len+1):\n", + " \n", + " for j in xrange(0,sub_len):\n", + " \n", + " if text[i+j]==substr[j]:\n", + " continue\n", + " else:\n", + " break\n", + " \n", + " if j==sub_len-1:\n", + " print 'The substring is present from subscript %d onwards' %i\n", + " \n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The substring is present from subscript 4 onwards\n", + "The substring is present from subscript 32 onwards\n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Example 10.15,Page number: 10.15

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n", + "\n", + "def reorder(x):\n", + "\n", + " n=len(x)\n", + " for item in range(0,n-1):\n", + " for i in range(item+1,n):\n", + " if x[item]>x[i]:\n", + " temp=x[item]\n", + " x[item]=x[i]\n", + " x[i]=temp\n", + "\n", + "\n", + " return\n", + "\n", + "x=['PACIFIC','ATLANTIC','INDIAN','CARIBBEAN','BERING','BLACK','RED','NORTH','BALTIC','CASPIAN']\n", + "print 'Original list of strings :\\n\\n'\n", + "\n", + "for i in x:\n", + " print \"String : \",i\n", + "\n", + "reorder(x)\n", + "\n", + "print \"\\nReodered list of strings : \\n\\n\"\n", + "\n", + "for i in x:\n", + " print \"String : \",i\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Original list of strings :\n", + "\n", + "\n", + "String : PACIFIC\n", + "String : ATLANTIC\n", + "String : INDIAN\n", + "String : CARIBBEAN\n", + "String : BERING\n", + "String : BLACK\n", + "String : RED\n", + "String : NORTH\n", + "String : BALTIC\n", + "String : CASPIAN\n", + "\n", + "Reodered list of strings : \n", + "\n", + "\n", + "String : ATLANTIC\n", + "String : BALTIC\n", + "String : BERING\n", + "String : BLACK\n", + "String : CARIBBEAN\n", + "String : CASPIAN\n", + "String : INDIAN\n", + "String : NORTH\n", + "String : PACIFIC\n", + "String : RED\n" + ] + } + ], + "prompt_number": 15 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 15 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/_Programming_With_C/.ipynb_checkpoints/chapter11-checkpoint.ipynb b/_Programming_With_C/.ipynb_checkpoints/chapter11-checkpoint.ipynb new file mode 100644 index 00000000..252457a4 --- /dev/null +++ b/_Programming_With_C/.ipynb_checkpoints/chapter11-checkpoint.ipynb @@ -0,0 +1,313 @@ +{ + "metadata": { + "name": "chapter11" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": "

Chapter 11: Pointers

" + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": "

Example 11.1, Page 11.2

" + }, + { + "cell_type": "code", + "collapsed": false, + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "u= 3 &u= 56575840 pu= 56575840 *pu 3\nv= 3 &v= 56575840 pv= 56575840 *pv 3\n" + } + ], + "prompt_number": 11 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": "

Example 11.2, Page number: 11.3

" + }, + { + "cell_type": "code", + "collapsed": false, + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "u1=16 u2=16\n" + } + ], + "prompt_number": 12 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": "

Example 11.3, Page munber: 11.4

" + }, + { + "cell_type": "code", + "collapsed": false, + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "*pv=3 v=3\n*pv=0 v=0\n" + } + ], + "prompt_number": 13 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": "

Example 11.7, Page number: 11.6

" + }, + { + "cell_type": "code", + "collapsed": false, + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "Before calling funct1: u=1 v=3\nWithin funct1 : u=0 v=0\nAfter calling funct1 : u=1 v=3\nBefore calling funct2: u=1 v=3\nWithin funct2 : *pu=0 *pv=0\nAfter calling funct2 : u=0 v=0\n" + } + ], + "prompt_number": 14 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": "

Example 11.8, Page number: 11.8

" + }, + { + "cell_type": "code", + "collapsed": false, + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "\n\n\nNo. of vowels : 23\nNo. of consonants : 35\nNo. of digits : 4\nNo. of whitespace characters : 12\nNo. of other characters : 1\n" + } + ], + "prompt_number": 15 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": "

Example 11.12, Page number: 11.15

" + }, + { + "cell_type": "code", + "collapsed": false, + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "i=0 x[i]=10 *(x+1)=10 &x[i]= 30696620 x+i= 30696620\ni=1 x[i]=11 *(x+1)=11 &x[i]= 30696608 x+i= 30696608\ni=2 x[i]=12 *(x+1)=12 &x[i]= 30696596 x+i= 30696596\ni=3 x[i]=13 *(x+1)=13 &x[i]= 30696584 x+i= 30696584\ni=4 x[i]=14 *(x+1)=14 &x[i]= 30696572 x+i= 30696572\ni=5 x[i]=15 *(x+1)=15 &x[i]= 30696560 x+i= 30696560\ni=6 x[i]=16 *(x+1)=16 &x[i]= 30696548 x+i= 30696548\ni=7 x[i]=17 *(x+1)=17 &x[i]= 30696536 x+i= 30696536\ni=8 x[i]=18 *(x+1)=18 &x[i]= 30696524 x+i= 30696524\ni=9 x[i]=19 *(x+1)=19 &x[i]= 30696512 x+i= 30696512\n" + } + ], + "prompt_number": 16 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": "

Example 11.14, Page number: 11.17

" + }, + { + "cell_type": "code", + "collapsed": false, + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "['T', 'h', 'i', 's', ' ', 's', 't', 'r', 'i', 'n', 'g', ' ', 'i', 's', ' ', 'd', 'e', 'c', 'l', 'a', 'r', 'e', 'd', ' ', 'e', 'x', 't', 'e', 'r', 'n', 'a', 'l', 'l', 'y']\n['T', 'h', 'i', 's', ' ', 's', 't', 'r', 'i', 'n', 'g', ' ', 'i', 's', ' ', 'd', 'e', 'c', 'l', 'a', 'r', 'e', 'd', ' ', 'w', 'i', 't', 'h', 'i', 'n', ' ', 'm', 'a', 'i', 'n']\n" + } + ], + "prompt_number": 17 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": "

Example 11.16, Page number: 11.19

" + }, + { + "cell_type": "code", + "collapsed": false, + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "\ni=1 x=1 \ni=2 x=2 \ni=3 x=3 \ni=4 x=4 \ni=5 x=5 \ni=6 x=6 \ni=7 x=7 \ni=8 x=8 \ni=9 x=9 \ni=10 x=10 \n\ni=1 x=1\ni=2 x=2\ni=3 x=3\ni=4 x=4\ni=5 x=5\ni=6 x=6\ni=7 x=7\ni=8 x=8\ni=9 x=9\ni=10 x=10\n" + } + ], + "prompt_number": 18 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": "

Example 11.17, Page number: 11.21

" + }, + { + "cell_type": "code", + "collapsed": false, + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "Values: i=1 f=0.300000 d=0.005000 c=* \n\nAddresses: &i=1D46518 &f=32BD940 &d=32BD950 &c=1D9F158 \n\nPointer Values: px=1D46518 px+1=1D4650C px+2=1D46500 px+3=1D464F4\n" + } + ], + "prompt_number": 19 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": "

Example 11.18, Page number: 11.22

" + }, + { + "cell_type": "code", + "collapsed": false, + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "px=1D46518 py=1D464DC \n\npy - px = -3C\n" + } + ], + "prompt_number": 20 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": "

Example 11.22, Page number: 11.26

" + }, + { + "cell_type": "code", + "collapsed": false, + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "\n FIRST TABLE : \n\n 1 3 5 7 9\n 11 13 15 17 19\n 21 23 25 27 29\n 31 33 35 37 39\n 41 43 45 47 49\n\n SECOND TABLE : \n\n 50 52 54 56 58\n 60 62 64 66 68\n 70 72 74 76 78\n 80 82 84 86 88\n 90 92 94 96 98\nSums of the elements : \n\n 51 55 59 63 67\n 71 75 79 83 87\n 91 95 99 103 107\n 111 115 119 123 127\n 131 135 139 143 147\n" + } + ], + "prompt_number": 21 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": "

Example 11.24, Page number: 11.31

" + }, + { + "cell_type": "code", + "collapsed": false, + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "\n FIRST TABLE : \n\n 1 3 5 7 9\n 11 13 15 17 19\n 21 23 25 27 29\n 31 33 35 37 39\n 41 43 45 47 49\n\n SECOND TABLE : \n\n 50 52 54 56 58\n 60 62 64 66 68\n 70 72 74 76 78\n 80 82 84 86 88\n 90 92 94 96 98\nSums of the elements : \n\n 51 55 59 63 67\n 71 75 79 83 87\n 91 95 99 103 107\n 111 115 119 123 127\n 131 135 139 143 147\n" + } + ], + "prompt_number": 22 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": "

Example 11.26, Page number: 11.34

" + }, + { + "cell_type": "code", + "collapsed": false, + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "Original list of strings :\n\n\nString : PACIFIC\nString : ATLANTIC\nString : INDIAN\nString : CARIBBEAN\nString : BERING\nString : BLACK\nString : RED\nString : NORTH\nString : BALTIC\nString : CASPIAN\n\nReodered list of strings : \n\n\nString : ATLANTIC\nString : BALTIC\nString : BERING\nString : BLACK\nString : CARIBBEAN\nString : CASPIAN\nString : INDIAN\nString : NORTH\nString : PACIFIC\nString : RED\n" + } + ], + "prompt_number": 23 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": "

Example 11.28, Page number: 11.37

" + }, + { + "cell_type": "code", + "collapsed": false, + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "Tuesday, October 29 1929\n\nWednesday, August 15 1945\n\nSunday, July 20 1969\n\nSaturday, May 24 1997\n\nMonday, August 30 2010\n\nFriday, April 12 2069\n" + } + ], + "prompt_number": 24 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": "

Example 11.30, Page number: 11.44

" + }, + { + "cell_type": "code", + "collapsed": false, + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": "FUTURE VALUE OF A SERIES OF MONTHLY DEPOSITS\n\n\nFrequency of Compunding (A,S,Q,M,D,C): m\nAmount of Each Monthly Payement : 100\nNumber of years: 3\n\nMonthly Compounding\n\nInterest Rate Future Amount\n\n\n 1 3653.00\n 2 3707.01\n 3 3762.06\n 4 3818.16\n 5 3875.33\n 6 3933.61\n 7 3993.01\n 8 4053.56\n 9 4115.27\n 10 4178.18\n 11 4242.31\n 12 4307.69\n 13 4374.33\n 14 4442.28\n 15 4511.55\n 16 4582.17\n 17 4654.18\n 18 4727.60\n 19 4802.45\n 20 4878.78\n" + } + ], + "prompt_number": 25 + }, + { + "cell_type": "code", + "collapsed": false, + "input": "", + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 25 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/_Programming_With_C/chapter10.ipynb b/_Programming_With_C/chapter10.ipynb index ea2e1985..f18379d0 100644 --- a/_Programming_With_C/chapter10.ipynb +++ b/_Programming_With_C/chapter10.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:3323f7a9a077b84fffdd30478d4b0d0b7f4032b86670a58b5b333d42bee04f15" + "signature": "sha256:afcf023af7f2623160eafd5fe5955140877621eeb1b176494a9d5724007360ec" }, "nbformat": 3, "nbformat_minor": 0, @@ -19,7 +19,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Example 10.3, Page Number: 10.3

" + "

Example 10.3, Page Number: 10.3

" ] }, { @@ -40,7 +40,7 @@ ] } ], - "prompt_number": 4 + "prompt_number": 1 }, { "cell_type": "markdown", diff --git a/_Programming_With_C/chapter12.html b/_Programming_With_C/chapter12.html new file mode 100644 index 00000000..8d59a1bd --- /dev/null +++ b/_Programming_With_C/chapter12.html @@ -0,0 +1,2336 @@ + + + + + +chapter12 + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+
+
+
+

+Chapter 12: Structures and Unions +

+

+
+
+
+
+
+
+
+

+Example 12.1, Page 12.2 +

+

+
+
+
+
+
+In [1]: +
+
+
+
from ctypes import *
+
+string=c_char*20
+
+class account(Structure):
+	_fields_=[('acct_no',c_int),('acct_type',c_char),('name',string),('balance',c_int)]
+
+customer=account(12632,'r','Joseph',1200)
+
+ +
+
+
+ +
+
+
+
+
+
+

+Example 12.4, Page 12.4 +

+

+
+
+
+
+
+In [2]: +
+
+
+
from ctypes import *
+
+string=c_char*20
+
+class date(Structure):
+	_fields_=[('month',c_int),('day',c_int),('year',c_int)]
+	
+class account(Structure):
+	_fields_=[('acct_no',c_int),('acct_type',c_char),('name',string),('balance',c_float),('lastpayment',date)]
+	
+customer=account(12345,'r','John W. Smith',586.30,date(5,24,90))
+
+ +
+
+
+ +
+
+
+
+
+
+

+Example 12.6, Page 12.6 +

+

+
+
+
+
+
+In [3]: +
+
+
+
from ctypes import *
+
+string=c_char*20
+
+class date(Structure):
+	
+	_fields_=[('name',string),('month',c_int),('day',c_int),('year',c_int)]
+
+birthday=[]
+birthday.append(date('Amy',12,30,73))
+birthday.append(date('Gail',5,13,66))
+birthday.append(date('Marc',7,15,72))
+birthday.append(date('Marla',11,29,70))
+birthday.append(date('Megan',2,4,77))
+birthday.append(date('Sharon',12,29,63))
+birthday.append(date('Susan',4,12,69))
+
+ +
+
+
+ +
+
+
+
+
+
+

+Example 12.14, Page 12.13 +

+

+
+
+
+
+
+In [4]: +
+
+
+
from ctypes import *
+
+string=c_char*50
+
+def writeoutput(obj):
+	print "Name : ",obj.name,
+	print "\t Account Number : ",obj.acct_no
+	print "Street : ",obj.street
+	print "City : ",obj.city
+	print "Old Balance : %7.2f" %(obj.oldbalance)
+	print "Payment : %7.2f" %(obj.payment)
+	print "New Balance : %7.2f" %(obj.newbalance)
+	print "Account Status : ",
+	
+	if obj.acct_type=='C':
+		print "CURRENT\n\n"
+	elif obj.acct_type=='O':
+		print "OVERDUE\n\n"
+	else:
+		print "DELINQUENT\n\n"
+		
+	return
+
+
+class date(Structure):
+	_fields_=[('month',c_int),('day',c_int),('year',c_int)]
+	
+
+class account(Structure):
+	_fields_=[('name',string),('street',string),('city',string),('acct_no',c_int),('oldbalance',c_float),('payment',c_float),('lastpayment',date),('newbalance',c_float),('acct_type',c_char)]
+		
+print "CUSOMER BILLING SYSTEM\n\n"
+customer=[]
+name='Steve Johnson'
+street='123 Mountainview Drive '
+city='Denver . CO'
+acct_no=4208
+oldbalance=247.88
+payment=25.00
+lastpay=date(6,14,1998)
+customer.append(account(name,street,city,acct_no,oldbalance,payment,lastpay))
+
+name='Susan Richards'
+street='4383 Aligator Blvd'
+city='Fort Lauderdale. FL'
+acct_no=2219
+oldbalance=135.00
+payment=135.00
+lastpay=date(8,10,2000)
+customer.append(account(name,street,city,acct_no,oldbalance,payment,lastpay))
+
+name='Martin Peterson'
+street='1787 Pacific Parkway'
+city='San Diego. CA'
+acct_no=8452
+oldbalance=387.42
+payment=35.00
+lastpay=date(9,22,1999)
+customer.append(account(name,street,city,acct_no,oldbalance,payment,lastpay))
+
+name='Phyllis Smith'
+street='1000 Great White Way'
+city='New York. NY'
+acct_no=711
+oldbalance=260.00
+payment=0.00
+lastpay=date(11,27,2001)
+customer.append(account(name,street,city,acct_no,oldbalance,payment,lastpay))
+
+
+
+for i in range(0,4):
+	if customer[i].payment>0:
+		if customer[i].payment<0.1*customer[i].oldbalance:
+			customer[i].acct_type='O'
+		else:
+			customer[i].acct_type='C'
+	else:
+		if customer[i].oldbalance>0:
+			customer[i].acct_type='D'
+		else:
+			customer[i].acct_type='C'
+	
+	customer[i].newbalance=customer[i].oldbalance-customer[i].payment
+	
+	writeoutput(customer[i])
+
+ +
+
+
+ +
+
+ + +
+
+
+CUSOMER BILLING SYSTEM
+
+
+Name :  Steve Johnson 	 Account Number :  4208
+Street :  123 Mountainview Drive 
+City :  Denver . CO
+Old Balance :  247.88
+Payment :   25.00
+New Balance :  222.88
+Account Status :  CURRENT
+
+
+Name :  Susan Richards 	 Account Number :  2219
+Street :  4383 Aligator Blvd
+City :  Fort Lauderdale. FL
+Old Balance :  135.00
+Payment :  135.00
+New Balance :    0.00
+Account Status :  CURRENT
+
+
+Name :  Martin Peterson 	 Account Number :  8452
+Street :  1787 Pacific Parkway
+City :  San Diego. CA
+Old Balance :  387.42
+Payment :   35.00
+New Balance :  352.42
+Account Status :  OVERDUE
+
+
+Name :  Phyllis Smith 	 Account Number :  711
+Street :  1000 Great White Way
+City :  New York. NY
+Old Balance :  260.00
+Payment :    0.00
+New Balance :  260.00
+Account Status :  DELINQUENT
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+

+Example 12.25, Page 12.29 +

+

+
+
+
+
+
+In [5]: +
+
+
+
from ctypes import *
+
+string=c_char*10
+
+class record(Structure):
+	_fields_=[('name',string),('acct_no',c_int),('acct_type',c_char),('balance',c_float)]
+	
+def adjust(obj):
+	obj.name='Jones'
+	obj.acct_no=9999
+	obj.acct_type='R'
+	obj.balance=99.99
+	return
+
+
+customer=record('Smith',3333,'C',33.33)
+print customer.name,customer.acct_no,customer.acct_type,
+print "%.2f" %customer.balance
+
+adjust(customer)
+
+print customer.name,customer.acct_no,customer.acct_type,
+print "%.2f" %customer.balance
+
+ +
+
+
+ +
+
+ + +
+
+
+Smith 3333 C 33.33
+Jones 9999 R 99.99
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+

+Example 12.32, Page 12.42 +

+

+
+
+
+
+
+In [8]: +
+
+
+
class node():
+	
+	def __init__(self,data):
+		self.data=data
+		self.next=None
+
+		
+class list():
+	
+	def __init__(self):
+		self.head=None
+		self.tail=None
+	
+	def insert(self,x):
+		
+		e=node(x)
+		
+		if self.head==None:
+			self.head=e
+			self.tail=e
+			
+		else:
+			self.tail.next=e
+			self.tail=e
+			
+def display(ptr):
+	nptr=ptr.head
+	while nptr!=None:
+		print nptr.data
+		nptr=nptr.next
+	
+	return
+	
+def delete(ptr,element):
+	nptr=ptr.head
+	while nptr.next.data!=element:
+		nptr=nptr.next
+		if nptr.next==None:
+			return
+	
+	dptr=nptr.next
+	nptr.next=dptr.next
+	del dptr
+	return
+	
+p=list()
+p.insert('BOSTON')
+p.insert('CHICAGO')
+p.insert('DENVER')
+p.insert('NEW YORK')
+p.insert('PITTSBURG')
+
+display(p)
+print '\n\nAFTER DELETING DENVER\n\n'
+delete(p,'DENVER')
+display(p)
+
+ +
+
+
+ +
+
+ + +
+
+
+BOSTON
+CHICAGO
+DENVER
+NEW YORK
+PITTSBURG
+
+
+AFTER DELETING DENVER
+
+
+BOSTON
+CHICAGO
+NEW YORK
+PITTSBURG
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+

+Example 12.35, Page 12.57 +

+

+
+
+
+
+
+In [7]: +
+
+
+
from ctypes import *
+
+string=c_char*20
+
+class id(Union):
+	_fields_=[('color',c_char),('size',c_int)]
+	
+class clothes(Structure):
+	_fields_=[('manufacturer',string),('cost',c_float),('description',id)]
+	
+shirt=clothes()
+shirt.description.color='w'
+print "%c %d\n" %(shirt.description.color,shirt.description.size)
+
+shirt.description.size=12
+print "%c %d" %(shirt.description.color,shirt.description.size)
+
+ +
+
+
+ +
+
+ + +
+
+
+w 119
+
+ 12
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+

+Example 12.37, Page 12.59 +

+

+
+
+
+
+
+In [6]: +
+
+
+
from ctypes import *
+import math
+
+
+class nvals(Union):
+	_fields_=[('fexp',c_float),('nexp',c_int)]
+	
+class values(Structure):
+	_fields_=[('x',c_float),('flag',c_char),('exp',nvals)]
+	
+def power(a):
+	y=a.x
+	
+	if a.flag=='i':
+		if a.exp.nexp==0:
+			y=1.0
+		else:
+			i=1
+			while i<abs(a.exp.nexp):
+				y*=a.x
+				i+=1
+			
+			if a.exp.nexp<0:
+				y=1.0/y
+	
+	else:
+		y=math.exp(a.exp.fexp*math.log(a.x))
+	
+	return y
+	
+def main(in1,n):
+	a=values()
+	a.x=in1
+	
+	i=int(n)
+	
+	if i==n:
+		a.flag='i'
+	else:
+		a.flag='f'
+	
+	if a.flag=='i':
+		a.exp.nexp=i
+	else:
+		a.exp.fexp=n
+		
+	if a.flag=='f' and a.x<=0.0:
+		print "ERROR - Cannot raise a non-positive number to a floating point power"
+	else:
+		y=power(a)
+		print "y=%.4f" %y
+	return
+
+print "\nx=2\nn=3"
+main(2,3)
+print "\nx=-2\nn=3"
+main(-2,3)
+print "\nx=2.2\nn=3.3"
+main(2.2,3.3)
+print "\nx=-2.2\nn=3.3"
+main(-2.2,3.3)
+
+
+	
+
+ +
+
+
+ +
+
+ + +
+
+
+
+x=2
+n=3
+y=8.0000
+
+x=-2
+n=3
+y=-8.0000
+
+x=2.2
+n=3.3
+y=13.4895
+
+x=-2.2
+n=3.3
+ERROR - Cannot raise a non-positive number to a floating point power
+
+
+
+
+ +
+
+ +
+
+
+
+In []: +
+
+
+
 
+
+ +
+
+
+ +
+
+
+ +