# -*- coding: utf8 -*-
from __future__ import division
#Example: 16.2
'''Determine the value of G0 for the reaction 2H2O 2H2 + O2 at 25◦C and at 2000 K,
with the water in the gaseous phase.'''
#Keys:
#1-H2
#2-O2
#3-H2O
#Variable Declaration:
def dG(T1,Hf1,Hf2,Hf3,Sf1,Sf2,sf3):
dH = 2*Hf1+Hf2-2*Hf3 #Change in enthalpy in kJ
dS = 2*Sf1+Sf2-2*sf3 #Change in entropy in J/K
dG = dH-T1*dS/1000 #change n gibbs free energy in kJ
return dG
#Results:
print 'Change in gibbs free energy at 298K :',round(dG(298,0, 0, -241.826, 130.678,205.148,188.834),3),"KJ"
print 'Change in gibbs free energy at 298K :',round(dG(2000,52.942, 59.176, -241.826+72.788,188.419,268.748,264.769),3),"KJ"