{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Exercise 1. Fitting functions to data." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The change of the standard Gibbs function $\\Delta G$ of a reaction was determined by measuring equilibrium constants at various temperatures. The following values were obtained:\n", "\n", "| $T$ [K] | $\\Delta G$ [kJ $\\mathrm{mol}^{-1}$] |\n", "| :--: | :--: |\n", "|270 | 40.3 |\n", "|280 | 38.2 |\n", "|290 | 36.1 |\n", "|300 | 32.2 |\n", "|310 | 29.1 |\n", "|320 | 28.0 |\n", "|330 | 25.3 |\n", "\n", "The uncertainty in $T$ is negligible and the weight factors are equal for\n", "all cases. \n", "\n", "1. Determine the reaction entropy $S = −d \\Delta G/dT$ by fitting the values of $\\Delta G$ to a linear function of $T$. \n", "2. What is the uncertainty in $S$ to a 90% confidence? \n", "3. Extrapolate $\\Delta G$ to $T = 350 \\mathrm{K}$ and give the uncertainty at 90% confidence level. Compare with the uncertainty at 90% for $\\Delta G$ at $T = 290 \\mathrm{K}$. Discuss the differences in the uncertainties and what can you conclude?\n", "4. Import the seaborn library, use the [regplot][1] function to plot the data. Try 90% and 99% confidence intervals when plotting. Compare and conclude.\n", "\n", "[1]: https://stanford.edu/~mwaskom/software/seaborn/generated/seaborn.regplot.html \"seaborn.regplot — seaborn 0.7.0 documentation\"" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import numpy as np\n", "import matplotlib.pyplot as plt\n", "%matplotlib inline\n", "from scipy import stats\n", "import seaborn as sns\n", "\n", "\n", "T = np.array([270, 280, 290, 300, 310, 320, 330])\n", "x = T\n", "DeltaG = np.array([40.3, 38.2, 36.1, 32.2, 29.1, 28.0, 25.3])\n", "y = DeltaG\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.10" } }, "nbformat": 4, "nbformat_minor": 0 }