Files
Lab1/molla/compatibilita/comp1.ipynb

194 lines
3.9 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"id": "ba4e56bc",
"metadata": {},
"source": [
"## Valori statici (calibro)\n",
"N = 10\n",
"\n",
"A = 23.98765 ± 0.18498"
]
},
{
"cell_type": "markdown",
"id": "aaf30c1f",
"metadata": {},
"source": [
"## Valori statici (sonar)\n",
"N = 6\n",
"\n",
"A = 23.41058 ± 0.22237"
]
},
{
"cell_type": "markdown",
"id": "7a851edb",
"metadata": {},
"source": [
"## Valori dinamici (sonar)\n",
"N = 4\n",
"\n",
"KC= 24.3546921 ± 0.03539\n"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "b349ba73",
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"from scipy.stats import t as student_t"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "a68eb302",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"t = 1.951\n",
"p-value (two-tailed) = 7.1395 %\n"
]
}
],
"source": [
"# Valori statici (calibro)\n",
"Nd = 10\n",
"Ad = 24.00\n",
"uAd = 0.18 * 3\n",
"\n",
"\n",
"#Valori statici (sonar)\n",
"Ns = 6\n",
"As = 23.41\n",
"uAs = 0.22 * 3\n",
"\n",
"#Nomi coerenti con Cannelli\n",
"GdL = Nd + Ns - 2\n",
"\n",
"s2 = ( (Nd - 1) * uAd**2 + (Ns - 1) * uAs**2 ) / GdL\n",
"\n",
"sigma2 = ( s2 / Nd ) + ( s2 / Ns )\n",
"\n",
"t = ( Ad - As ) / np.sqrt( sigma2 )\n",
"\n",
"\n",
"p_value = 2 * (1 - student_t.cdf(abs(t), df=GdL))\n",
"print(f\"t = {t:.3f}\")\n",
"print(f\"p-value (two-tailed) = {p_value * 100:.4f} %\")\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "2746d086",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"t = -0.972\n",
"p-value (two-tailed) = 35.0452 %\n"
]
}
],
"source": [
"# Valori statici (calibro)\n",
"Nd = 10\n",
"Ad = 24.00\n",
"uAd = 0.18 *3\n",
"\n",
"#Valori dinamici (sonar)\n",
"Ns = 4\n",
"As = 24.35\n",
"uAs = 0.26 *3\n",
"\n",
"#Nomi coerenti con Cannelli\n",
"GdL = Nd + Ns - 2\n",
"\n",
"s2 = ( (Nd - 1) * uAd**2 + (Ns - 1) * uAs**2 ) / GdL\n",
"\n",
"sigma2 = ( s2 / Nd ) + ( s2 / Ns )\n",
"\n",
"t = ( Ad - As ) / np.sqrt( sigma2 )\n",
"\n",
"\n",
"p_value = 2 * (1 - student_t.cdf(abs(t), df=GdL))\n",
"print(f\"t = {t:.3f}\")\n",
"print(f\"p-value (two-tailed) = {p_value * 100:.4f} %\")\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "be0c6cc6",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"t = -2.775\n",
"p-value (two-tailed) = 2.4092 %\n"
]
}
],
"source": [
"# Valori statici (sonar)\n",
"Nd = 6\n",
"Ad = 23.41\n",
"uAd = 0.22 * 3\n",
"\n",
"#Valori dinamici (sonar)\n",
"Ns = 4\n",
"As = 24.35\n",
"uAs = 0.03 * 3\n",
"\n",
"#Nomi coerenti con Cannelli\n",
"GdL = Nd + Ns - 2\n",
"\n",
"s2 = ( (Nd - 1) * uAd**2 + (Ns - 1) * uAs**2 ) / GdL\n",
"\n",
"sigma2 = ( s2 / Nd ) + ( s2 / Ns )\n",
"\n",
"t = ( Ad - As ) / np.sqrt( sigma2 )\n",
"\n",
"\n",
"p_value = 2 * (1 - student_t.cdf(abs(t), df=GdL))\n",
"print(f\"t = {t:.3f}\")\n",
"print(f\"p-value (two-tailed) = {p_value * 100:.4f} %\")\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"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.13.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}