{
 "metadata": {
  "name": "",
  "signature": "sha256:c9abd3a4addb064e928970d9b53877d65c2d3bdaa244a23d35c0b5616eab425e"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 04: Thermochemistry"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example Problem 4.1, Page Number 68"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Varialble Declaration\n",
      "DH0_H2O = 241.8          #Std Enthalpy of reaxtion of Water Fomation backward rxn, kJ/mol\n",
      "DH0_2H = 2*218.0         #Std Enthalpy of formation of Hydrogen atom, kJ/mol\n",
      "DH0_O = 249.2            #Std Enthalpy of formation of Oxygen atom, kJ/mol\n",
      "R = 8.314                #Ideal gas constant, J/(mol.K)\n",
      "Dn = 2.0\n",
      "T = 298.15               #Std. Temperature, K\n",
      "#Calculation\n",
      "DH0_2HO = DH0_H2O + DH0_2H + DH0_O\n",
      "DU0 = (DH0_2HO - Dn*R*T*1e-3)/2\n",
      "\n",
      "#Results\n",
      "print 'Avergae Enthalpy change required for breaking both OH bonds %4.1f kJ/mol'%DH0_2HO\n",
      "print 'Average bond energy required for breaking both OH bonds %4.1f kJ/mol'%DU0"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Avergae Enthalpy change required for breaking both OH bonds 927.0 kJ/mol\n",
        "Average bond energy required for breaking both OH bonds 461.0 kJ/mol\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.2, Page Number 70"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import numpy as np\n",
      "from sympy import *\n",
      "\n",
      "#Variable Declaration\n",
      "a = ([29.064, 31.695, 28.165])             #Constant 'a' in Heat capacity equation, J/(mol.K)\n",
      "b = ([-0.8363e-3, 10.143e-3, 1.809e-3])    #Constant 'b' in Heat capacity equation, J/(mol.K)\n",
      "c = ([20.111e-7, -40.373e-7, 15.464e-7])   #Constant 'a' in Heat capacity equation, J/(mol.K)\n",
      "delHf0HCl = -92.3                          #Std. Heat of formation of HCl, kJ/mol\n",
      "T1, T2 = 298.15, 1450                       #Std and final temperature, K\n",
      "\n",
      "#Calculations\n",
      "T = symbols('T')\n",
      "DA = a[2]-(a[0]+a[1])/2\n",
      "DB = b[2]-(b[0]+b[1])/2\n",
      "DC = c[2]-(c[0]+c[1])/2\n",
      "\n",
      "expr = integrate( DA + DB*T + DC*T**2, (T,T1,T2))\n",
      "DHR1450= expr/1000 + delHf0HCl\n",
      "\n",
      "#Results\n",
      "print 'Heat of reaction for HCl formation is %4.1f kJ/mol'%DHR1450"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat of reaction for HCl formation is -95.1 kJ/mol\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.3, Page Number 72"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Varialble Declaration\n",
      "ms1 = 0.972          #Mass of cyclohexane, g\n",
      "DT1 = 2.98           #Change in temperature for bath, \u00b0C\n",
      "DUR1 = -3913e3       #Std Internal energy change, J/mol\n",
      "mw = 1.812e3         #Mass of water, g\n",
      "ms2 = 0.857          #Mass of benzene, g\n",
      "Ms1 = 84.16\n",
      "Ms2 = 78.12\n",
      "DT2 = 2.36           #Change in temperature for bath, \u00b0C\n",
      "Mw = 18.02\n",
      "Cpw = 75.3 \n",
      "\n",
      "#Calculation\n",
      "\n",
      "Ccal = ((-ms1/Ms1)*DUR1-(mw/Mw)*Cpw*DT1)/DT1\n",
      "DUR2 = (-Ms2/ms2)*((mw/Mw)*Cpw*DT2+Ccal*DT2)\n",
      "\n",
      "#Results\n",
      "print 'Calorimeter constant %4.2e J/\u00b0C'%Ccal\n",
      "print 'Enthalpy of rection for benzene %4.2e J/mol'%DUR2"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat capacity of calorimeter 7.59e+03 J/\u00b0C\n",
        "Enthalpy of rection for benzene -3.26e+06 J/mol\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.4, Page Number 73"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Varialble Declaration\n",
      "ms = 1.423           #Mass of Na2SO4, g\n",
      "mw = 100.34          #Mass of Na2SO4, g\n",
      "DT = 0.037           #Change in temperature for solution, K\n",
      "Mw = 18.02           #Molecular wt of Water\n",
      "Ms = 142.04          #Molecular wt of ms Na2SO4\n",
      "Ccal = 342.5         #Calorimeter constant, J/K\n",
      "#Data\n",
      "DHfNa = -240.1\n",
      "DHfSO4 = -909.3\n",
      "DHfNa2SO4 = -1387.1\n",
      "\n",
      "#Calculation\n",
      "DHs = (-Ms/ms)*((mw/Mw)*Cpw*DT+Ccal*DT)\n",
      "DHsolD = 2*DHfNa + DHfSO4 - DHfNa2SO4\n",
      "\n",
      "#Results\n",
      "print 'Enthalpy of solution for Na2SO4 %4.2e J/mol'%DHs\n",
      "print 'Enthalpy of solution for Na2SO4 from Data %4.2e J/mol'%DHsolD"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Enthalpy of solution for Na2SO4 -2.81e+03 J/mol\n",
        "Enthalpy of solution for Na2SO4 from Data -2.40e+00 J/mol\n"
       ]
      }
     ],
     "prompt_number": 33
    }
   ],
   "metadata": {}
  }
 ]
}