{ "cells": [ { "cell_type": "markdown", "id": "64fca81f", "metadata": {}, "source": [ "# Viscosity" ] }, { "cell_type": "code", "execution_count": 47, "id": "6275e63f", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "from scipy.stats import linregress\n", "from scipy import constants as const" ] }, { "cell_type": "code", "execution_count": 53, "id": "6f06c2a4", "metadata": {}, "outputs": [], "source": [ "def cleanDataFrame(df: pd.DataFrame) -> pd.DataFrame:\n", " for col in df.columns:\n", " if col[0] != 'd':\n", " df[f\"{col} ± d{col}\"] = df[col].astype(str) + \" ± \" + df[f\"d{col}\"].astype(str)\n", " df = df.drop(columns=[col, f\"d{col}\"])\n", " return df" ] }, { "cell_type": "markdown", "id": "015fa3b7", "metadata": {}, "source": [ "## Hagen Poiseuille Law" ] }, { "cell_type": "code", "execution_count": 54, "id": "dc5eac39", "metadata": {}, "outputs": [], "source": [ "rho: float = 1.23\n", "drho: float = 0.01\n", "\n", "T: float = 21.5\n", "dT: float = 0.1\n", "\n", "eta: float = lambda rho, h, l, R, t, DeltaM: ((np.pi * const.g * 1e2 * rho**2) / 8) * (h / l) * (R**4) * (t / DeltaM)\n", "deta: float = lambda rho, drho, h, dh, l, dl, R, dR, t, dt, DeltaM, dDeltaM: np.sqrt(\n", " ( ( (np.pi * const.g * 1e2 * 2 * rho) / 8) * (h / l) * (R**4) * (t / DeltaM) * drho )**2 +\n", " ( ( (np.pi * const.g * 1e2 * rho**2) / 8) * (1 / l) * (R**4) * (t / DeltaM) * dh )**2 +\n", " ( ( (np.pi * const.g * 1e2 * rho**2) / 8) * (-h / l**2) * (R**4) * (t / DeltaM) * dl )**2 +\n", " ( ( (np.pi * const.g * 1e2 * rho**2) / 8) * (h / l) * (4 * R**3) * (t / DeltaM) * dR )**2 +\n", " ( ( (np.pi * const.g * 1e2 * rho**2) / 8) * (h / l) * (R**4) * (1 / DeltaM) * dt )**2 +\n", " ( ( (np.pi * const.g * 1e2 * rho**2) / 8) * (h / l) * (R**4) * (-t / DeltaM**2) * dDeltaM )**2\n", ")\n" ] }, { "cell_type": "code", "execution_count": 55, "id": "a4612687", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Viscosity η = 1.336028e+00 ± 1.609758e-01 Pa·s (Poise)\n" ] }, { "data": { "application/vnd.microsoft.datawrangler.viewer.v0+json": { "columns": [ { "name": "index", "rawType": "int64", "type": "integer" }, { "name": "R ± dR", "rawType": "object", "type": "string" }, { "name": "l ± dl", "rawType": "object", "type": "string" }, { "name": "$M_{before}$ ± d$M_{before}$", "rawType": "object", "type": "string" }, { "name": "$M_{after}$ ± d$M_{after}$", "rawType": "object", "type": "string" }, { "name": "$\\Delta M$ ± d$\\Delta M$", "rawType": "object", "type": "string" }, { "name": "t ± dt", "rawType": "object", "type": "string" }, { "name": "$h_{1}$ ± d$h_{1}$", "rawType": "object", "type": "string" }, { "name": "$h_{2}$ ± d$h_{2}$", "rawType": "object", "type": "string" }, { "name": "$h$ ± d$h$", "rawType": "object", "type": "string" }, { "name": "$\\eta$ ± d$\\eta$", "rawType": "object", "type": "string" } ], "ref": "3b834b4e-9aa1-4eed-bebf-ba986271fe17", "rows": [ [ "0", "0.15 ± 0.005", "43.5 ± 0.1", "433.26 ± 0.01", "766.35 ± 0.01", "333.09000000000003 ± 0.01414213562373095", "1811 ± 1", "52.7 ± 0.1", "48.5 ± 0.1", "50.6 ± 0.07071067811865477", "1.8654084342380144 ± 0.2506161821585334" ], [ "1", "0.08 ± 0.005", "43.0 ± 0.1", "436.31 ± 0.01", "500.93 ± 0.01", "64.62 ± 0.01414213562373095", "1801 ± 1", "52.5 ± 0.1", "51.8 ± 0.1", "52.15 ± 0.07071067811865477", "0.8066466758632603 ± 0.2021000017651807" ] ], "shape": { "columns": 10, "rows": 2 } }, "text/html": [ "
| \n", " | R ± dR | \n", "l ± dl | \n", "$M_{before}$ ± d$M_{before}$ | \n", "$M_{after}$ ± d$M_{after}$ | \n", "$\\Delta M$ ± d$\\Delta M$ | \n", "t ± dt | \n", "$h_{1}$ ± d$h_{1}$ | \n", "$h_{2}$ ± d$h_{2}$ | \n", "$h$ ± d$h$ | \n", "$\\eta$ ± d$\\eta$ | \n", "
|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "0.15 ± 0.005 | \n", "43.5 ± 0.1 | \n", "433.26 ± 0.01 | \n", "766.35 ± 0.01 | \n", "333.09000000000003 ± 0.01414213562373095 | \n", "1811 ± 1 | \n", "52.7 ± 0.1 | \n", "48.5 ± 0.1 | \n", "50.6 ± 0.07071067811865477 | \n", "1.8654084342380144 ± 0.2506161821585334 | \n", "
| 1 | \n", "0.08 ± 0.005 | \n", "43.0 ± 0.1 | \n", "436.31 ± 0.01 | \n", "500.93 ± 0.01 | \n", "64.62 ± 0.01414213562373095 | \n", "1801 ± 1 | \n", "52.5 ± 0.1 | \n", "51.8 ± 0.1 | \n", "52.15 ± 0.07071067811865477 | \n", "0.8066466758632603 ± 0.2021000017651807 | \n", "