Molla statica fatta benegit status
This commit is contained in:
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
# L'inzio di questo file è specifico per ogniuno di noi
|
||||
Funzioni\ matlab.txt
|
||||
prova*
|
||||
test*
|
||||
@@ -15,12 +15,12 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"pip install matplotlib numpy pandas scipy"
|
||||
"# pip install matplotlib numpy pandas scipy"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": 2,
|
||||
"id": "e31f5b72",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -79,10 +79,21 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 3,
|
||||
"id": "3d561eb0",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[1.5 3. ]\n",
|
||||
"a 0.50000\n",
|
||||
"b 0.57735\n",
|
||||
"dtype: float64\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"def media(x, dim = 0):\n",
|
||||
" uA = np.nanstd(x, axis=dim, ddof=1)\n",
|
||||
@@ -250,18 +261,19 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": 1,
|
||||
"id": "78c30380",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"A = 1.9900 +- 0.0892\n",
|
||||
"B = 0.0500 +- 0.2959\n",
|
||||
"cov_AB = -0.023880\n",
|
||||
"p-value chi² = 0.7187\n"
|
||||
"ename": "NameError",
|
||||
"evalue": "name 'pd' is not defined",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[31m---------------------------------------------------------------------------\u001b[39m",
|
||||
"\u001b[31mNameError\u001b[39m Traceback (most recent call last)",
|
||||
"\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[1]\u001b[39m\u001b[32m, line 49\u001b[39m\n\u001b[32m 45\u001b[39m chi = sc.stats.chi2.cdf(x2, dof) \u001b[38;5;66;03m# P(X² > x2)\u001b[39;00m\n\u001b[32m 47\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m A, B, sigma_A, sigma_B, cov_AB, chi\n\u001b[32m---> \u001b[39m\u001b[32m49\u001b[39m df = \u001b[43mpd\u001b[49m.DataFrame({\n\u001b[32m 50\u001b[39m \u001b[33m\"\u001b[39m\u001b[33mx\u001b[39m\u001b[33m\"\u001b[39m:[\u001b[32m1.0\u001b[39m, \u001b[32m2.0\u001b[39m, \u001b[32m3.0\u001b[39m, \u001b[32m4.0\u001b[39m, \u001b[32m5.0\u001b[39m],\n\u001b[32m 51\u001b[39m \u001b[33m\"\u001b[39m\u001b[33my\u001b[39m\u001b[33m\"\u001b[39m:[\u001b[32m2.1\u001b[39m, \u001b[32m3.9\u001b[39m, \u001b[32m6.2\u001b[39m, \u001b[32m7.8\u001b[39m, \u001b[32m10.1\u001b[39m],\n\u001b[32m 52\u001b[39m \u001b[33m\"\u001b[39m\u001b[33mux\u001b[39m\u001b[33m\"\u001b[39m:[\u001b[32m0.1\u001b[39m, \u001b[32m0.1\u001b[39m, \u001b[32m0.1\u001b[39m, \u001b[32m0.1\u001b[39m, \u001b[32m0.1\u001b[39m],\n\u001b[32m 53\u001b[39m \u001b[33m\"\u001b[39m\u001b[33muy\u001b[39m\u001b[33m\"\u001b[39m:[\u001b[32m0.2\u001b[39m, \u001b[32m0.2\u001b[39m, \u001b[32m0.2\u001b[39m, \u001b[32m0.2\u001b[39m, \u001b[32m0.2\u001b[39m]\n\u001b[32m 54\u001b[39m })\n\u001b[32m 56\u001b[39m A, B, sA, sB, covAB, chi = reg_lin(df[\u001b[33m\"\u001b[39m\u001b[33mx\u001b[39m\u001b[33m\"\u001b[39m], df[\u001b[33m\"\u001b[39m\u001b[33my\u001b[39m\u001b[33m\"\u001b[39m], df[\u001b[33m\"\u001b[39m\u001b[33mux\u001b[39m\u001b[33m\"\u001b[39m], df[\u001b[33m\"\u001b[39m\u001b[33muy\u001b[39m\u001b[33m\"\u001b[39m])\n\u001b[32m 57\u001b[39m \u001b[38;5;28mprint\u001b[39m(\u001b[33m\"\u001b[39m\u001b[33mAx + B : \u001b[39m\u001b[33m\"\u001b[39m)\n",
|
||||
"\u001b[31mNameError\u001b[39m: name 'pd' is not defined"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -310,7 +322,7 @@
|
||||
" # Chi quadro\n",
|
||||
" x2 = np.sum((y - A * x - B)**2 / sigma_y_eq**2)\n",
|
||||
" dof = len(x) - 2\n",
|
||||
" chi = sc.stats.chi2.sf(x2, dof) # P(X² > x2)\n",
|
||||
" chi = sc.stats.chi2.cdf(x2, dof) # P(X² > x2)\n",
|
||||
"\n",
|
||||
" return A, B, sigma_A, sigma_B, cov_AB, chi\n",
|
||||
"\n",
|
||||
@@ -322,6 +334,7 @@
|
||||
" })\n",
|
||||
"\n",
|
||||
"A, B, sA, sB, covAB, chi = reg_lin(df[\"x\"], df[\"y\"], df[\"ux\"], df[\"uy\"])\n",
|
||||
"print(\"Ax + B : \")\n",
|
||||
"print(f\"A = {A:.4f} +- {sA:.4f}\")\n",
|
||||
"print(f\"B = {B:.4f} +- {sB:.4f}\")\n",
|
||||
"print(f\"cov_AB = {covAB:.6f}\")\n",
|
||||
|
||||
835
molla/mollaStatica.ipynb
Normal file
835
molla/mollaStatica.ipynb
Normal file
File diff suppressed because one or more lines are too long
931
molla/mollaStatica1.ipynb
Normal file
931
molla/mollaStatica1.ipynb
Normal file
File diff suppressed because one or more lines are too long
884
molla/mollaStatica2.ipynb
Normal file
884
molla/mollaStatica2.ipynb
Normal file
File diff suppressed because one or more lines are too long
6
molla/statica1.csv
Normal file
6
molla/statica1.csv
Normal file
@@ -0,0 +1,6 @@
|
||||
m1,Dx1,Dx2,Dx3,Dx4,Dx5,Dx6
|
||||
88.970,77.26,77.28,77.26,77.28,77.24,77.42
|
||||
108.61,68.92,68.94,69.00,68.98,68.90,69.02
|
||||
128.64,60.88,61.00,60.82,60.94,61.08,60.94
|
||||
148.38,52.96,52.96,52.78,52.88,52.88,53.00
|
||||
168.53,44.42,44.68,44.48,44.80,44.92,44.52
|
||||
|
5
molla/statica2.csv
Normal file
5
molla/statica2.csv
Normal file
@@ -0,0 +1,5 @@
|
||||
m1,Dx1,Dx2,Dx3,Dx4,Dx5,Dx6
|
||||
49.2466666666667,212.10,211.64,212.00,212.18,212.52,212.04
|
||||
69.2766666666667,150.92,150.26,150.02,150.16,150.40,150.18
|
||||
88.9666666666667,90.34,90.34,90.38,90.52,90.26,90.28
|
||||
108.61,29.82,30.18,30.10,30.20,30.10,30.40
|
||||
|
Reference in New Issue
Block a user