{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# An Engineering Calculation using the Ideal Gas Law\n", "\n", "## First Step\n", "\n", "This notebook does some calculations with the ideal gas law\n", "\n", "$$ P = \\frac{n R T}{V}$$" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "210819.285714\n" ] } ], "source": [ "n = 2.0\n", "V = 22.4\n", "T = 284.0\n", "R = 8314.0\n", "\n", "P = n*R*T/V\n", "print P" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The Pressure is: 210819.285714\n" ] } ], "source": [ "print \"The Pressure is: \", P" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Requirement already satisfied (use --upgrade to upgrade): pint in /Users/jeff/anaconda/lib/python2.7/site-packages\n", "\u001b[33mYou are using pip version 8.1.1, however version 8.1.2 is available.\n", "You should consider upgrading via the 'pip install --upgrade pip' command.\u001b[0m\n" ] } ], "source": [ "!pip install pint" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": true }, "outputs": [], "source": [ "from pint import UnitRegistry\n", "ur = UnitRegistry()" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "V = 22.4 * ur.liter\n", "T = 284.0 * ur.kelvin\n", "R = 8314.0 * ur.Pa * ur.liter/ur.mol/" ] } ], "metadata": { "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 }