{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "### Calculus approach to data of H&H section 4.2.2" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import numpy as np" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Repeat the calculation of the uncertainty $\\alpha_P$ in problem 3 using the \"calculus approximation\" of the uncertainties." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$$\n", "P(V_m,T) = \\frac{RT}{V_m-b} - \\frac{a}{V_m^2}\n", "$$\n", "\n", "$$\n", "\\alpha_P = \\sqrt{\\left(\\alpha_P^T\\right)^2+\\left(\\alpha_P^V\\right)^2}\n", "$$\n", "\n", "$$\n", "\\alpha_P^T = \\left(\\frac{\\partial P}{\\partial T}\\right)\\alpha_T = \\frac{R}{V_m-b}\\alpha_T\n", "$$\n", "\n", "$$\n", "\\alpha_P^V = \\left(\\frac{\\partial P}{\\partial V}\\right)\\alpha_V \n", "= \\left[RT\\left(\\frac{-1}{(V_m-b)^2}\\right) - \\frac{a(-2)}{V_m^3}\\right]\\alpha_V \n", "= \\left[\\frac{-RT}{(V_m-b)^2} + \\frac{2a}{V_m^3}\\right]\\alpha_V\n", "$$" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "R = 8.3145\n", "Tbest = 298.0\n", "alpha_T = 0.2\n", "Vmbest = 2.000e-4\n", "alpha_V = 0.003e-4\n", "a = 1.408e-1\n", "b = 3.913e-5" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(10336.918008329707, -18162.58562642741)" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "alpha_PT = (R/(Vmbest-b))*alpha_T\n", "alpha_PV = ((-1*R*Tbest/(Vmbest-b)**2)+2*a/Vmbest**3)*alpha_V\n", "alpha_PT, alpha_PV" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'2.089812e+04'" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "alpha_P = np.sqrt(alpha_PV**2 + alpha_PT**2)\n", "format(alpha_P,'e')" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.020898119306488768" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# And divide by 10^6\n", "alpha_P/1e6" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "So, the uncertainty in the pressue is 0.02 MPa. Basically the same thing that we got with the other approaches to Section 4.2.2. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Version information\n", "`version_information` is from J.R. Johansson (jrjohansson at gmail.com); see Introduction to scientific computing with Python for more information and instructions for package installation.\n", "\n", "`version_information` is installed on the linux network at Bucknell" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "%load_ext version_information" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "application/json": { "Software versions": [ { "module": "Python", "version": "3.7.7 64bit [GCC 7.3.0]" }, { "module": "IPython", "version": "7.16.1" }, { "module": "OS", "version": "Linux 3.10.0 1062.9.1.el7.x86_64 x86_64 with centos 7.7.1908 Core" }, { "module": "numpy", "version": "1.18.5" } ] }, "text/html": [ "
SoftwareVersion
Python3.7.7 64bit [GCC 7.3.0]
IPython7.16.1
OSLinux 3.10.0 1062.9.1.el7.x86_64 x86_64 with centos 7.7.1908 Core
numpy1.18.5
Fri Aug 07 11:02:07 2020 EDT
" ], "text/latex": [ "\\begin{tabular}{|l|l|}\\hline\n", "{\\bf Software} & {\\bf Version} \\\\ \\hline\\hline\n", "Python & 3.7.7 64bit [GCC 7.3.0] \\\\ \\hline\n", "IPython & 7.16.1 \\\\ \\hline\n", "OS & Linux 3.10.0 1062.9.1.el7.x86\\_64 x86\\_64 with centos 7.7.1908 Core \\\\ \\hline\n", "numpy & 1.18.5 \\\\ \\hline\n", "\\hline \\multicolumn{2}{|l|}{Fri Aug 07 11:02:07 2020 EDT} \\\\ \\hline\n", "\\end{tabular}\n" ], "text/plain": [ "Software versions\n", "Python 3.7.7 64bit [GCC 7.3.0]\n", "IPython 7.16.1\n", "OS Linux 3.10.0 1062.9.1.el7.x86_64 x86_64 with centos 7.7.1908 Core\n", "numpy 1.18.5\n", "Fri Aug 07 11:02:07 2020 EDT" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%version_information numpy" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "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.7.7" } }, "nbformat": 4, "nbformat_minor": 1 }