L1-python/source/Exercice-solution.ipynb

728 lines
58 KiB
Plaintext
Raw Normal View History

2023-03-05 14:41:53 +00:00
{
"cells": [
{
"cell_type": "markdown",
"id": "bf0cd470",
"metadata": {},
"source": [
"# Exercice"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "c0302414",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"from scipy.optimize import curve_fit"
]
},
{
"cell_type": "markdown",
"id": "908b1a9d",
"metadata": {},
"source": [
"### Data generation"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "76ccfc6f",
"metadata": {},
"outputs": [],
"source": [
"# constants\n",
"g = 10.\n",
"V0 = 1.\n",
"H = 1."
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "d58ffe3e",
"metadata": {},
"outputs": [],
"source": [
"# Model \n",
"l = V0 * np.sqrt(2.*H/g)"
]
},
{
"cell_type": "markdown",
"id": "9a03ead6",
"metadata": {},
"source": [
"### Données\n",
"pour file \"V1msHvariable.csv\""
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "dd458e01",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.40 0.80 0.01\n",
"0.42 0.90 0.01\n",
"0.45 1.00 0.01\n",
"0.47 1.10 0.01\n",
"0.49 1.20 0.01\n"
]
}
],
"source": [
"#\n",
"error = 0.01\n",
"for h in [0.8, 0.9,1,1.1,1.2]:\n",
" l = V0 * np.sqrt(2.*h/g)\n",
" print('{0:.2f} {1:0.2f} {2:.2f}'.format(l,h,error))"
]
},
{
"cell_type": "markdown",
"id": "a06afab7",
"metadata": {},
"source": [
"### Données\n",
"pour file \"H1mVvariable.csv\""
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "ca4407db",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.45 1.00 0.10\n",
"0.54 1.20 0.10\n",
"0.67 1.50 0.10\n",
"0.89 2.00 0.10\n",
"1.34 3.00 0.10\n"
]
}
],
"source": [
"error = 0.1\n",
"for v in [1, 1.2,1.5,2,3]:\n",
" l = v * np.sqrt(2.*H/g)\n",
" print('{0:.2f} {1:0.2f} {2:.2f}'.format(l,v,error))"
]
},
{
"cell_type": "markdown",
"id": "81b6f7b3",
"metadata": {},
"source": [
"## Solution"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "a748d198",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<img src=\"experience.png\" width=\"500\" height=\"500\"/>"
],
"text/plain": [
"<IPython.core.display.Image object>"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# import image module\n",
"from IPython.display import Image\n",
" \n",
"# get the image\n",
"Image(url=\"experience.png\", width=500, height=500)"
]
},
{
"cell_type": "markdown",
"id": "301b6ab8",
"metadata": {},
"source": [
" Une bille supposée ponctuelle avec une vitesse horizontale $V_0$ tombe d'une table de hauteur $H$ et rencontre le sol à une longueur $L$.\n",
"\n",
"Nous disposons de deux fichiers de mesures expérimentales (fichiers formatés csv séparés par des \";\")\n",
"- \"V1msHvariable.csv\" expérience de mesure de la longueur $L$ à vitesse $V_0=1 \\ m/s$ constante pour des différentes hauteurs $H$ avec l'erreur correspondante\n",
"- \"H1mVvariable.csv\" expérience de mesure de la longueur $L$ à hauteur $H= 1 \\ m$ constante pour des différentes vitesses $V_0$ avec l'erreur correspondante\n",
"\n",
"On propose un modèle pour la longueur $L$\n",
"\n",
"$$ L = C V_0^\\alpha H^\\beta $$\n",
"\n",
"nous allons évaluer les coefficients $\\alpha$ et $\\beta$, ainsi que la constante $C$."
]
},
{
"cell_type": "markdown",
"id": "bb58b946",
"metadata": {},
"source": [
"### Point 1.1\n",
"En utilisant la bibliothèque Pandas, lisez le fichier \"V1msHvariable.csv\" et définisez les variables $L$, $H$, \n",
"et $erreur$ (de la mesure de hauteur)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "8aa94441",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" L H error\n",
"0 0.40 0.8 0.01\n",
"1 0.42 0.9 0.01\n",
"2 0.45 1.0 0.01\n",
"3 0.47 1.1 0.01\n",
"4 0.49 1.2 0.01\n"
]
}
],
"source": [
"d = pd.read_csv(\"V1msHvariable.csv\",delimiter=\";\")\n",
"print(d)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "296b12e0",
"metadata": {},
"outputs": [],
"source": [
"d.head()\n",
"# taking values from headers\n",
"L = d[\"L\"]\n",
"H = d[\"H\"]\n",
"e = d[\"error\"]"
]
},
{
"cell_type": "markdown",
"id": "fc7a10ed",
"metadata": {},
"source": [
"### Point 1.2\n",
"Faites une figure de $L$ vs $H$ avec barres d'erreur"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "d8aab11d",
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "67ec753b",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.legend.Legend at 0x7f84498dfc70>"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAGDCAYAAAAxhIflAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAaM0lEQVR4nO3df4xd5Z3f8ffX9mSHJEPj2pMlscE/UoTxJsHgMZikRLsk2QLdggioGEiyRF0BVaFJm6TQXbWgRpEWEa2ghRYIobQKWbMKYAFySrbZ7C5VMLUnmICDnZpJHMaE4HjteEjGYcb+9o97zV6GZ8b3ztzjOx6/X9IV5zznec79zuPBHz/nnntvZCaSJI01q9MFSJKmJwNCklRkQEiSigwISVKRASFJKjIgJElFBoQkqciAkA4jIn4SER87gs+XEfGPxrTdHBFfP1I1SGBASJLGYUBIbRARv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By4PKIWD5Ov1uAJ8Ycuh34X5m5DDgNeKGqWiVJb1XlCuJMYHtmDmTm68Ba4KJCv+uBh4BXDzVExPHAR4CvAWTm65m5t8JaJUljzKnw3AuAlxr2B4GzGjtExALgYuBcYFXDoaXALuC/R8RpQD/w2cz81dgniYirgasBTjrppHbWL7XFZXc/BcCD13iVtBnO0/RR5QoiCm05Zv824IbMPDCmfQ5wBvDfMvN04FdA8TWMzLwnM/sys6+3t3eKJUuSDqlyBTEInNiwvxB4eUyfPmBtRADMBy6IiFFgAzCYmU/X+32TcQJCklSNKgNiI3ByRCwBdgJrgCsaO2TmkkPbEXE/8HhmrqvvvxQRp2T
"text/plain": [
"<Figure size 432x432 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fig = plt.figure(figsize=(6,6)) # s\n",
"ax = plt.subplot() \n",
"ax.errorbar(H,L,e, marker='.', linestyle=\"none\", label=\"data\")\n",
"ax.set_title(\"L vs H\")\n",
"ax.set_xlabel(\"H[m]\")\n",
"ax.set_ylabel(\"L[m]\")\n",
"ax.legend()"
]
},
{
"cell_type": "markdown",
"id": "a84939cd",
"metadata": {},
"source": [
"### Point 1.3\n",
"Utilisez la fonction \"curve_fit\" pour faire une regression linéaire des données exprimées en une échelle log-log\n",
"et trouve la valeur de $\\alpha$"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "4d6afbe8",
"metadata": {},
"outputs": [],
"source": [
"# fit\n",
"def func(x, a, b):\n",
" return a * x + b"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "db8be79d",
"metadata": {},
"outputs": [],
"source": [
"from scipy.optimize import curve_fit"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "b1b62edc",
"metadata": {},
"outputs": [],
"source": [
"popt= curve_fit(func, np.log(H), np.log(L))"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "10616c91",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"a = 0.512\n",
"b= -0.805\n"
]
}
],
"source": [
"popt[0]\n",
"a=popt[0][0]\n",
"b=popt[0][1]\n",
"print(\"a = %.3f\" % a)\n",
"print(\"b= %.3f\" % b)"
]
},
{
"cell_type": "markdown",
"id": "763aab30",
"metadata": {},
"source": [
"### Point 1.4\n",
"Faites un figure log-log de $L$ vs $H$ en ajoutant la regression linéaire trouvée dans le point précédent"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "5403d854",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[]"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZsAAAGHCAYAAABmjP8YAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAp1klEQVR4nO3dd3xV9f3H8dcnIRDQgAgqCMhQqiB7iRMVBAciguy9tbW1trXV1l+lddVRW7VWBbGgjIQtQxQREAcopoogoAKCBkQwBAgjkPH9/XGixZhAQu7JueP9fDzyaHLvuee+c4u8+Z7x/ZpzDhERET/FBR1ARESin8pGRER8p7IRERHfqWxERMR3KhsREfGdykZERHynshEREd+pbETKkJltNbNOZfh+zszOK/DYWDObXFYZREBlIyIiZUBlIxJmzKyCme01sybHPHaGmR02szPNrLqZLcjfZo+ZvW1m+m9Zwpr+gIqEGefcEWA20O+Yh3sDbznndgG/BdKAM4CzgD8CmndKwprKRiQ8TeXHZdM//zGAbKAmUNc5l+2ce9sdf5LD/+aPgvaa2V7gbl8SixyHykYkPC0FKprZRWZWF2gBzMl/7jFgE7DYzLaY2YnKo5Vz7rTvv4C/+RVapCjlgg4gIj/lnMszs+l4o5tvgQXOucz85zLxDqX91swuBJaZ2Wrn3JvBJRY5PpWNSNlLMLPEY37Occ7lFLLdVGAukA786fsHzawrsBHYDOwHcvO/RMKWDqO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tR2ZqEZFot3Odd6N
"text/plain": [
"<Figure size 432x432 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fig = plt.figure(figsize=(6,6)) # s\n",
"ax = plt.subplot() \n",
"ax.errorbar(H,L,e, marker='.', linestyle=\"none\", label=\"data\")\n",
"ax.plot(H,np.exp(b)*H**a,\"-\",label=\"model\")\n",
"ax.set_title(\"with error bars\")\n",
"ax.set_title(\"L vs H\")\n",
"ax.set_xlabel(\"H[m]\")\n",
"ax.set_ylabel(\"L[m]\")\n",
"ax.legend()\n",
"ax.loglog()"
]
},
{
"cell_type": "markdown",
"id": "07f7c827",
"metadata": {},
"source": [
"Estimation de la constante $C$"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "d619b153",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0 0.447214\n",
"1 0.442719\n",
"2 0.450000\n",
"3 0.448127\n",
"4 0.447307\n",
"dtype: float64\n"
]
}
],
"source": [
"C=L/H**0.5\n",
"print(C)"
]
},
{
"cell_type": "markdown",
"id": "9f02fc0f",
"metadata": {},
"source": [
"## Partie 2\n",
"Etude de la longueur $L$ à hauteur $H= 1 \\ m$ constante pour des différentes vitesses $V_0$ "
]
},
{
"cell_type": "markdown",
"id": "4692da2f",
"metadata": {},
"source": [
"### Point 2.1\n",
"En utilisant la bibliothèque Pandas, lisez le fichier \"H1mVvariable.csv\" et définisez les variables $L$, $V_0$, \n",
"et $erreur$ (de la mesure de vitesse)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "86a78bb1",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" L V error\n",
"0 0.45 1.0 0.1\n",
"1 0.54 1.2 0.1\n",
"2 0.67 1.5 0.1\n",
"3 0.89 2.0 0.1\n",
"4 1.34 3.0 0.1\n"
]
}
],
"source": [
"d = pd.read_csv(\"H1mVvariable.csv\",delimiter=\";\")\n",
"print(d)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "9d9b92cc",
"metadata": {},
"outputs": [],
"source": [
"# taking values from headers\n",
"L = d[\"L\"]\n",
"V = d[\"V\"]\n",
"e = d[\"error\"]"
]
},
{
"cell_type": "markdown",
"id": "bcc73921",
"metadata": {},
"source": [
"### Point 2.2\n",
"Faites une figure de $L$ vs $V_0$ avec barres d'erreur"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "2b001194",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.legend.Legend at 0x7f8428d243a0>"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAGICAYAAABMYefvAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAag0lEQVR4nO3df5BdZZ3n8fc3SWtAeySTxAEJJsRhCKgESANBxUEHB9ARFrE2AUoLVzc4pVNas+vKzjjKlmXtWLhV4qpLIjJoLQIzCiy4qOPuDMoOaSeJgkkIuCEQbTIsIQbSSCJp+rt/3Bu8dvrHbbrPPd153q+qLs+P5577vceH+8lzzj3nRGYiSSrXjLoLkCTVyyCQpMIZBJJUOINAkgpnEEhS4QwCSSqcQSBJhTMIVLSIeDQizunA+8yMiL0R8bph1t0UEX9TdQ3SSGbVXYBUgsx8PiIeBF4LbDqwPCJ6gD8Bjq+rNskRgTSGiLgyIr45ZNk1EfGF5vTHI+KxiOiPiIci4o9G2NQm4MQhy64GPpeZOya/cqk9jgiksd0EfDIificz90TETOBfAxdFxPHAh4HTMnNHRCwCZo6wnc1Az4GZiHgncBzwjkqrl8bgiEAaQ2ZuB34M/KvmorcCz2ZmL/A88FLgxIjoysxHM/PhETb1woigGSZ/DfxlZj7bXPaZiLgnIr4ZEYdX94mk32YQSO35BnBJc/rS5jyZu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SRNTeN6VGVEnETjENALr8vMWye5JklSB7UdBBFxPXASsBkYbC5OwCCQpGlsPCOC5Zl5YmWVSJJqMZ7rCNZGhEEgSYeY8YwIvkYjDB4Hfk3
"text/plain": [
"<Figure size 432x432 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fig = plt.figure(figsize=(6,6)) # s\n",
"ax = plt.subplot() \n",
"ax.errorbar(V,L,e, marker='.', linestyle=\"none\", label=\"data\")\n",
"ax.set_title(\"with error bars\")\n",
"ax.set_title(\"L vs $V_0$\")\n",
"ax.set_xlabel(\"$V_0$[m/s]\")\n",
"ax.set_ylabel(\"L[m]\")\n",
"ax.legend()"
]
},
{
"cell_type": "markdown",
"id": "70f7b0cd",
"metadata": {},
"source": [
"### Point 2.3\n",
"Utilisez la fonction \"curve_fit\" pour faire une regression linéaire des données exprimées en une échelle log-log\n",
"et trouve la valeur de $\\beta$"
]
},
{
"cell_type": "code",
"execution_count": 20,
"id": "21162560",
"metadata": {},
"outputs": [],
"source": [
"popt= curve_fit(func, np.log(V), np.log(L))"
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "ad96315b",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"a = 0.991\n",
"b = -0.800\n"
]
}
],
"source": [
"popt[0]\n",
"a=popt[0][0]\n",
"b=popt[0][1]\n",
"print(\"a = %.3f\" % a)\n",
"print(\"b = %.3f\" % b)"
]
},
{
"cell_type": "markdown",
"id": "8b31f498",
"metadata": {},
"source": [
"### Point 2.4\n",
"Faites un figure log-log de $L$ vs $V_0$ en ajoutant la regression linéaire trouvée dans le point précédent"
]
},
{
"cell_type": "code",
"execution_count": 22,
"id": "78a36fc1",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[]"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZ8AAAGMCAYAAAAFoK+hAA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AyfJnP++eezzz77cPTRR/PYY48BcNVVV3HooYfy5je/mZNPPpnnn3+ee++9l1tvvZWPfexjHHzwwTz++ON9rpOkMhg+dbZu4yZ+87sNLF317LD3tXTpUm688Ubuv/9+br75Zu677z4A3vOe93Dffffxs5/9jP3224+rr76at771rcyZM4cLL7yQBx54gL322qvPdZJUBsOnjpauepZHn1xH57MbOOOLS4YdQD/60Y846aST2HHHHdlpp52YM2cOAA8//DCzZs1i6tSpLFy4kEceeaTP6w90naT2VMs/lrfF8KmjJSu66K68dd6mzd0sWdE17H329ZEIH/jAB7jssst46KGHWLBgARs3buzzugNdJ6n9vPLH8vM1+WN5WwyfOpq553hGVLKiY9QIZu45flj7e/vb384tt9zChg0bWLduHbfddhsA69at441vfCObNm161SeQjhkzhnXr1r18ub91krTk0dWQ3UDU7I/lrTF86mj6xHHs+4YxTBi3Aws/OJPpE8cNa3+HHHIIp556KgcffDAnn3wys2bNAuDTn/40hx9+OO985zvZd999X15/2mmnceGFFzJt2jQef/zxftdJanOr7mXm/R9nOzYRZE3+WN4WP1KhH7X6SIUiP5ypSH6kgtQCurvhnn+B758H4yZz5qaP8YvN/41LTps25D+W/UgFSVL/1j8DC/8E7vgHOOAkmP9D1r92ErvtvMOwW5qB8JNM66zVjngktYBV98KiM+H5NfCui2H6B6CPk5nqyfCRpHZRVbPxwa/CGw8qZRTDZ5Ays8/TnduJzxNKTWj9M3DzPHj8DjjwZJh9CWw/prRxDJ9BGD16NF1dXYwfP75tAygz6erqYvTo0WWPImmgGqBmq2b4DMKECRPo7Ozk6aefLnuUUo0ePZoJEyaUPYakbWmgmq2a4TMIHR0dTJ48uewxJGnbGqxmq2b4SFKracCarZrhI0mt4uWa7XwYN6mharZqho8ktYLqmu1dF8Poncqeql+GjyQ1uyao2aoZPpLUrJqoZqtm+EhSM2qymq2a4SNJzaZONVuR70Vp+EhSs2jimq2a4SNJzWD9M3DLfFh+Oxzwnp4XjTZRzVbN8JGkRveqmu1fYPrchj+bbVsMH0lqVC1Us1UzfCSpEbVYzVbN8JGkRtOCNVs1w0eSGkUL12zVDB9JagQtXrNVM3wkqWyr7oVFZ8HzXS1bs1UzfCSpLFvUbLe3bM1WzfCRpDK0Wc1WzfCRpKK1Yc1WzfCRpKK0cc1WzfCRpCK0ec1WzfCRpHqzZtuC4SNJ9WLN1i/DR5LqwZptqwwfSaq1VYsr781mzdYfw0eSaqW7G+65GL5/HoybaM22FYaPJNWCNdugGD6SNFzWbINm+EjSUFmzDZnhI0lDYc02LIaPJA2WNduwGT6SNFDWbDVj+EjSQFiz1ZThI0nbYs1Wc4aPJPXHmq1uDB9J6os1W10ZPpJUrXfNdsI/w4wzrdlqzPCRpJdYsxXG8JEksGYrmOEjSdZshTN8JLUva7bSGD6S2tP6LrhlnjVbSQwfSe3Hmq10ho+k9rFFzfY9eOOby56qLRk+ktqDNVtDMXwktT5rtoZj+EhqXdZsDastwiciXgP8K/ACcGdmLix5JEn1Zs3W0EaUPcBQRcQ1EfFURDxctf3YiHgsIpZHxDmVze8BFmXm2cCcwoeVVKxVi+HyI+BXP+qp2f7kGoOnwTRt+ADXAcf23hARI4HPA8cB+wOnR8T+wATg15VlLxY4o6QidXfDj/4ZrjsBOkb31GyHnuXzOw2oaWu3zLwrIiZVbT4MWJ6ZKwAi4kbgRKCTngB6gOY
"text/plain": [
"<Figure size 432x432 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fig = plt.figure(figsize=(6,6)) # s\n",
"ax = plt.subplot() \n",
"ax.errorbar(V,L,e, marker='.', linestyle=\"none\", label=\"data\")\n",
"ax.plot(V,np.exp(b)*V**a,\"-\",label=\"model\")\n",
"ax.set_title(\"with error bars\")\n",
"ax.set_title(\"L vs $V_0$\")\n",
"ax.set_xlabel(\"$V_0$[m/s]\")\n",
"ax.set_ylabel(\"L[m]\")\n",
"ax.legend()\n",
"ax.loglog()"
]
},
{
"cell_type": "markdown",
"id": "b27babbe",
"metadata": {},
"source": [
"Estimation de la constante $C$"
]
},
{
"cell_type": "code",
"execution_count": 23,
"id": "6ae3c7c3",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0 0.450000\n",
"1 0.450000\n",
"2 0.446667\n",
"3 0.445000\n",
"4 0.446667\n",
"dtype: float64\n"
]
}
],
"source": [
"C1=L/V\n",
"print(C1)"
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "e34d2bdb",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.447073328032969 0.44766666666666677\n"
]
}
],
"source": [
"print(C.mean(),C1.mean())"
]
},
{
"cell_type": "markdown",
"id": "c215342d",
"metadata": {},
"source": [
"Le modèle peut s'écrire donc\n",
"$$L = C V H^{1/2}$$\n",
"avec $C=0.447$.\n",
" L'unité de $C$ est $\\sqrt{T^2/L}$\n",
"$$ L = [C] L/T L^{1/2}$$.\n",
"\n",
"Comme le moteur de la chute c'est la gravité et $[g] = L/T^2$ nous pouvons écrire\n",
"$$ C = \\sqrt{2/ g}$$ alors\n",
"$$ L = V_0 \\sqrt{ \\frac{2 H}{g}}$$."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ca1f0efd",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.9.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}