{ "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": [ "
Software | Version |
---|---|
Python | 3.7.7 64bit [GCC 7.3.0] |
IPython | 7.16.1 |
OS | Linux 3.10.0 1062.9.1.el7.x86_64 x86_64 with centos 7.7.1908 Core |
numpy | 1.18.5 |
Fri Aug 07 11:02:07 2020 EDT |