{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Ideal Gas Calculation\n", "\n", "\n", "The following cell will do an ideal gas calculation.\n", "\n", "$$ P = \\frac{n R T}{V} $$" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Collecting pint\n", " Downloading Pint-0.7.2.tar.gz (149kB)\n", "\u001b[K 100% |████████████████████████████████| 153kB 154kB/s \n", "\u001b[?25hBuilding wheels for collected packages: pint\n", " Running setup.py bdist_wheel for pint ... \u001b[?25ldone\n", "\u001b[?25h Stored in directory: /Users/jeff/Library/Caches/pip/wheels/c4/51/5e/1645f2de6cd09ff62e27db29123a4a81add45347b355e19ded\n", "Successfully built pint\n", "Installing collected packages: pint\n", "Successfully installed pint-0.7.2\n" ] } ], "source": [ "!pip install pint" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from pint import UnitRegistry\n", "ur = UnitRegistry()" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "30.5767522699 pound_force_per_square_inch\n" ] } ], "source": [ "Rgas = 8.314 * ur.joule/ur.kelvin/ur.mole\n", "T = 284 * ur.kelvin\n", "n = 2 * ur.mole\n", "V = 22.4 * ur.liter\n", "\n", "P = n*Rgas*T/V\n", "print P.to(ur.psi)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.5" } }, "nbformat": 4, "nbformat_minor": 2 }