{ "metadata": { "name": "", "signature": "sha256:e52ffa5d23d3ddfa48a481e2732abf0ed79242403a53e7634d8954f9e01773b0" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 3 - First law of Thermodynamics" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 1 - pg 129" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate the increase in energy\n", "#initialisation of variables\n", "P= 0.0060 #atm\n", "M=18. #gm\n", "L=80 #cal/gm\n", "H=596.1 #cal/gm\n", "#calculations\n", "Hs=M*L+M*H\n", "#results\n", "print '%s %d %s' %('Net increase in energy = ',Hs,'cal')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Net increase in energy = 12169 cal\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2 - pg 130" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate the increase in energy\n", "#initialisation of variables\n", "P= 0.0060 #atm\n", "V1= 0.0181 #l\n", "H= -10730 #cal\n", "V2= 22.4 #l\n", "#CALCULATIONS\n", "W= (V2-P*V1)*(1.987/.08205)\n", "E= H+W\n", "#RESULTS\n", "print '%s %d %s' % (' increase in energy=',E,' cal ')\n", "print 'The answer differs a bit from the textbook due to rounding off error'" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " increase in energy= -10187 cal \n", "The answer differs a bit from the textbook due to rounding off error\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 3 - pg 132" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate the increase in energy\n", "#initialisation of variables\n", "T1= 70 #C\n", "T2= 10 #C\n", "Cp= 18 #cal mole^-1 deg^-1\n", "P= 1 #atm\n", "m= 18. #g\n", "d= 0.9778 #g/ml\n", "d1= 0.9997 #g/ml\n", "e= 1.987 #cal\n", "x= 82.05 #ml atm\n", "#CALCULATIONS\n", "H= Cp*(T1-T2)\n", "E= H-(e/x)*P*((m/d)-(m/d1))\n", "#RESULTS\n", "print '%s %.1f %s' % (' increase in energy=',E,'cal ')\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " increase in energy= 1080.0 cal \n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 4 - pg 132" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate the conversion factor\n", "#initialisation of variables\n", "i= 1 #amp\n", "r= 2 #ohms\n", "t= 10 #min\n", "dT= 2.73 #C\n", "x= 0.1 #cal/deg\n", "x1= 100 #cal/deg\n", "x2= 5 #cal/deg\n", "#CALCULATIONS\n", "w= i**2*r*t*60\n", "H= (x+x1+x2)*dT\n", "E= w/H\n", "#RESULTS\n", "print '%s %.2f %s' % ('conversion factor =',E,'cal ')\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "conversion factor = 4.18 cal \n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 6 - pg 137" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate the heat at constant pressure and volume\n", "#initialisation of variables\n", "Cp= 6.0954 #cal /mol deg\n", "Cp1= 3.2533*10**-3 #cal /mol deg\n", "Cp2= 1.071*10**-6 #cal /mol deg\n", "T= 100 #C\n", "T1= 0 #C\n", "R= 1.987 #atml/cal K\n", "#CALULATIONS\n", "H= Cp*(T-T1)+(Cp1/2)*((T+273.2)**2-(T1+273.2)**2)-(Cp2/3)*((T+273.2)**3-(T1+273.2)**3)\n", "q= H-R*(T-T1)\n", "#RESULTS\n", "print '%s %.1f %s' % (' Heat at constant pressure=',H,'cal ')\n", "print '%s %.1f %s' % (' \\n Heat at constant volume=',q,'cal ')\n", "print 'The answer differs a bit from the textbook due to rounding off error'" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " Heat at constant pressure= 703.4 cal \n", " \n", " Heat at constant volume= 504.7 cal \n", "The answer differs a bit from the textbook due to rounding off error\n" ] } ], "prompt_number": 5 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7 - pg 140" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate the work done in the process\n", "#initialisation of variables\n", "vl= 0.019 #l\n", "vg= 16.07 #l\n", "h= 1489. #mm of Hg\n", "#CALCULATIONS\n", "w= -(h/760)*(vl-vg)*(1.987/0.08206)\n", "#RESULTS\n", "print '%s %d %s' % (' Work done=',w,'cal ')\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " Work done= 761 cal \n" ] } ], "prompt_number": 6 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 8 - pg 141" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate the minimum work in both cases\n", "#initialisation of variables\n", "import math\n", "n= 2 #moles\n", "R= 0.08206 #J/mol K\n", "T= 25 #C\n", "b= 0.0428 #lmole^-1\n", "a= 3.61 #atm l^2 mole^-1\n", "V1= 20. #l\n", "V2= 1. #l\n", "#CALCULATIONS\n", "w1= n*1.987*(273.2+T)*math.log10(V1/V2) *2.303\n", "w= (n*R*(273.2+T)*2.303*math.log10((V1-n*b)/(V2-n*b))-a*n**2*((1/V2)-(1/V1)))*(1.987/0.08206)\n", "#RESULTS\n", "print '%s %.1f %s' % (' minimum work=',w1,'cal ')\n", "print '%s %.1f %s' % (' \\n minimum work=',w,'cal ')\n", "print 'The answer differs a bit from the textbook due to rounding off error'" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " minimum work= 3550.7 cal \n", " \n", " minimum work= 3319.5 cal \n", "The answer differs a bit from the textbook due to rounding off error\n" ] } ], "prompt_number": 7 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 9 - pg 144" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate the final volume and temperature of the gas. Also calculate the work done in the process\n", "#initialisation of variables\n", "cv = 5.00 #cal mole^-1 deg^-1\n", "R= 1.99 #cal mole^-1 deg^-1\n", "p= 1 #atm\n", "p1= 100. #atm\n", "V= 75. #l\n", "n= 3. #moles\n", "R1= 0.08206 #cal/mol K\n", "#CALCULATIONS\n", "cp= cv+R\n", "r= cp/cv\n", "V1= V/(p1/p)**(1/r)\n", "T2= p1*V1/(n*R1)\n", "w= (p1*V1-p*V)*R/((r-1)*R1)\n", "#RESULTS\n", "print '%s %.2f %s' % (' final volume of gas =',V1,'l ')\n", "print '%s %d %s' % (' \\n final temperature of gas =',T2,'K ')\n", "print '%s %d %s' % (' \\n Work done =',w,'cal ')\n", "print 'The answer differs a bit from the textbook due to rounding off error'" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " final volume of gas = 2.78 l \n", " \n", " final temperature of gas = 1130 K \n", " \n", " Work done = 12384 cal \n", "The answer differs a bit from the textbook due to rounding off error\n" ] } ], "prompt_number": 8 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 10 - pg 144" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate the change in energy and enthalpy\n", "#initialisation of variables\n", "cv= 5 #cal mole^-1\n", "P= 100 #atm\n", "T= 1130 #K\n", "T1= 812 #K\n", "n= 3 #moles\n", "R= 1.99 #cal/mole K\n", "#CALCULTIONS\n", "E= n*cv*(T1-T)\n", "H= E+n*R*(T1-T)\n", "#RESULTS\n", "print '%s %.1f %s' % (' change in energy =',E,'cal ')\n", "print '%s %.1f %s' % (' \\n change in enthalpy=',H,' cal ')\n", "print 'The answer differs a bit from the textbook due to rounding off error'" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " change in energy = -4770.0 cal \n", " \n", " change in enthalpy= -6668.5 cal \n", "The answer differs a bit from the textbook due to rounding off error\n" ] } ], "prompt_number": 9 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 11 - pg 145" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate the work done and final pressure\n", "#initialisation of variables\n", "import math\n", "k= 1.435 \n", "k1= 17.845*10**-3 #K**-1\n", "k2= -4.165*10**-6 #K**-2\n", "T= 200. #C\n", "T1= 0. #C\n", "P= 10. #atm\n", "R= 1.987 #cal/mol K\n", "k3= 3.422\n", "#CALCULATIONS\n", "W= k*(T-T1)+(k1/2)*((273+T)**2-(273+T1)**2)+(k2/3)*((273+T)**3-(273+T1)**3)\n", "P2= (P/math.e**((k*math.log((273+T1)/(273+T))+k1*(T1-T)+(k2/2)*((273+T1)**2-(273+T)**2))/R))/100.\n", "#RESULTS\n", "print '%s %d %s' % (' work done by methane =',W,'cal ')\n", "print '%s %.2f %s' % (' \\n final pressure=',P2,'atm ')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " work done by methane = 1499 cal \n", " \n", " final pressure= 0.77 atm \n" ] } ], "prompt_number": 10 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 12 - pg 150" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate the fraction of liquid\n", "#initialisation of variables\n", "P= 100 #atm\n", "P1= 1 #atm\n", "R= 1.99 #cal/mol**-1 K**-1\n", "k= 0.3 #atm**-1\n", "E= 1600 #cal\n", "T= -183 #C\n", "T1= 0 #C\n", "#CALCULATIONS\n", "X= (k*3.5*R*(P-P1))/(3.5*R*(T1-T)+E)\n", "#RESULTS\n", "print '%s %.3f' % (' fraction of liquid = ',X)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " fraction of liquid = 0.072\n" ] } ], "prompt_number": 11 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 13 - pg 152" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate the enthalpy change of the reaction\n", "#initialisation of variables\n", "H= -21.8 #kcal\n", "H1= 3.3 #kcal\n", "#CALCULATIONS\n", "H2= H-H1\n", "#RESULTS\n", "print '%s %.1f %s' % (' Enthalpy =',H2,'kcal ')\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " Enthalpy = -25.1 kcal \n" ] } ], "prompt_number": 12 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 14 - pg 153" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate the heat of hydrogenation\n", "#initialisation of variables\n", "H= -68.317 #kcal\n", "H1= -310.615 #kcal\n", "H2= -337.234 #kcal\n", "R= 1.987 #cal/mol^-1 K^-1\n", "T= 298.2 #K\n", "n= 1 #mole\n", "n1= 1 #mole\n", "n2= 1 #mole\n", "#CALCULATIONS\n", "E= H+H1-H2-(n-n1-n2)*R*T*10**-3\n", "#RESULTS\n", "print '%s %.3f %s' % (' Heat of hydrogenation =',E,'kcal ')\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " Heat of hydrogenation = -41.105 kcal \n" ] } ], "prompt_number": 13 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 15 - pg 155" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate the enthalpy of the process\n", "#initialisation of variables\n", "Hf= -196.5 #kcal\n", "H= -399.14 #kcal\n", "#CALCULATIONS\n", "H1= (H-Hf)*1000\n", "#RESULTS\n", "print '%s %d %s' % (' Enthalpy =',H1,' kcal ')\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " Enthalpy = -202640 kcal \n" ] } ], "prompt_number": 14 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 16 - pg 157" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate the Enthalpy change\n", "#initialisation of variables\n", "H= -350.2 #kcal\n", "H1= -128.67 #kcal\n", "H2= -216.90 #kcal\n", "#CALCULATIONS\n", "H3= H-(H1+H2)\n", "#RESULTS\n", "print '%s %.1f %s' % (' Enthalpy =',H3,'kcal ')\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " Enthalpy = -4.6 kcal \n" ] } ], "prompt_number": 15 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 17 - pg 158" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate the enthalpy of the process\n", "#initialisation of variables\n", "H= -40.023 #kcal\n", "H1= -22.063 #kcal\n", "#CALCULATIONS\n", "H2= H-H1\n", "#RESULTS\n", "print '%s %.3f %s' % (' Enthalpy =',H2,' kcal ')\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " Enthalpy = -17.960 kcal \n" ] } ], "prompt_number": 16 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 18 - pg 162" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate the enthalpy change in the process\n", "#initialisation of variables\n", "H= -112.148 #k cal\n", "H1= 101.99 #k cal\n", "Hx=-112.148 #kcal\n", "Hy=-111.015 #kcal\n", "Hz=-.64\n", "Hsol=-9.02\n", "#CALCULATIONS\n", "H2= H+H1\n", "H3=2*Hx-2*Hy\n", "H4=-10*Hz\n", "H5=Hsol-5*Hz\n", "#RESULTS\n", "print '%s %.2f %s' % (' Enthalpy in case 1=',H2,'k cal ')\n", "print '%s %.3f %s' % (' Enthalpy in case 2=',H3,'k cal ')\n", "print '%s %.1f %s' % (' Enthalpy in case 3=',H4,'k cal ')\n", "print '%s %.2f %s' % (' Enthalpy in case 4=',H5,'k cal ')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " Enthalpy in case 1= -10.16 k cal \n", " Enthalpy in case 2= -2.266 k cal \n", " Enthalpy in case 3= 6.4 k cal \n", " Enthalpy in case 4= -5.82 k cal \n" ] } ], "prompt_number": 34 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 19 - pg 167" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate the dE and dH in the process\n", "#initialisation of variables\n", "cp=18.\n", "T2=373 #K\n", "T1=298 #K\n", "T3=403.2 #K\n", "hvap=9713 #cal\n", "H4= 0 #cal\n", "E4= 0 #cal\n", "a=7.1873\n", "b=2.3733e-3\n", "c=.2084e-6\n", "R=1.987\n", "#RESULTS\n", "H1=cp*(T2-T1)\n", "H2=hvap\n", "H3=a*(T3-T2) + b/2 *(T3**2-T2**2) + c/3 *(T3**3-T2**3)\n", "E1=H1\n", "E2=H2-R*T2\n", "E3=H3-R*(T3-T2)\n", "H= H1+H2+H3+H4\n", "E= E1+E2+E3+E4\n", "#RESULTS\n", "print '%s %d %s' % (' Enthalpy=',H,'cal ')\n", "print '%s %d %s' % (' \\n Energy=',E,' cal ')\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " Enthalpy= 11308 cal \n", " \n", " Energy= 10507 cal \n" ] } ], "prompt_number": 18 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 20 - pg 171" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate the enthalpy change \n", "#initialisation of variables\n", "H= -114009.8 #cal\n", "x= -5.6146 #K**-1\n", "y= 0.9466*10**-3 #K**-2\n", "z= 0.1578*10**-6 #K**-3\n", "T= 1000\n", "#CALCULATIONS\n", "H1= H+x*T+y*T**2+z*T**3\n", "#RESULTS\n", "print '%s %.1f %s' %(' Enthalpy =',H1,'cal ')\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " Enthalpy = -118520.0 cal \n" ] } ], "prompt_number": 19 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 21 - pg 173" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#caculate the temperature achieved\n", "#Initialization of variables\n", "import numpy\n", "a=72.3639\n", "b=36.2399e-3\n", "c=3.7621e-6\n", "H=214920\n", "#calculations\n", "vec=([-c/3,b/2,a,-H])\n", "vec2=numpy.roots(vec)\n", "vec22=(vec2[2])\n", "#results\n", "print '%s %.1f %s' %('The required temperature observed is', vec22,'K')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The required temperature observed is 2059.4 K\n" ] } ], "prompt_number": 24 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 22 - pg 175" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate the change in enthalpy\n", "#initialisation of variables\n", "T= 298 #K\n", "R= 1.987 #atmcc/mol K\n", "x= 128.16\n", "y= 0.9241\n", "H= -8739 #cal\n", "H1=-771.1 #cal\n", "H22=-196.5 #cal\n", "H33=-30.4 #cal\n", "n1= 10 #mol\n", "n2= 12 #mol\n", "M1=122.12\n", "M11=128.16\n", "M2=55.85\n", "dT=2.51\n", "x1=.8\n", "H2=1947.4\n", "x2=1.\n", "H3=1944.2\n", "dT2=3.62\n", "#CALCULATIONS\n", "E1=H1+1.5*R*T/1000.\n", "E2=H22+1.5*R*T/1000.\n", "E3=(H33+3.5*R*T/1000.)/2.\n", "C=(-E1*.9619/M1-E2/2/M2*.0002 -.47/1000. *E3)*1000/dT - x1-H2\n", "E11=(-E2/2/M2*.0002-.76/1000. *E3 - (x2+H3+C)*dT2)*M11/.9241\n", "H= (E11+R*T*(n1-n2))/1000\n", "#RESULTS\n", "print '%s %.1f %s' %(' Enthalpy =',H,'kcal mole^-1 ')\n", "print 'The answer is a bit different from textbook due to rounding off error'" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ " Enthalpy = -1214.5 kcal mole^-1 \n", "The answer is a bit different from textbook due to rounding off error\n" ] } ], "prompt_number": 14 } ], "metadata": {} } ] }