mirror of
https://gitlab.rlp.net/pgp/pgp1-python-einfuehrung
synced 2024-11-16 13:48:11 +00:00
Finalized solutions for the different tasks.
This commit is contained in:
parent
655d60a1c6
commit
f992d287f9
3 changed files with 2363 additions and 37 deletions
221
Aufgaben_zur_Vorbereitung_von_Kapitel_1.ipynb
Normal file → Executable file
221
Aufgaben_zur_Vorbereitung_von_Kapitel_1.ipynb
Normal file → Executable file
|
@ -476,6 +476,60 @@
|
|||
"```"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Lösung:\n",
|
||||
"\n",
|
||||
"Hier noch ein kleiner Kommentar zum auflösen der Formel. Wir wollen den Zeitpunkt t1 wissen an dem das Objekt auf dem Boden aufkommt (s(t1) = 0). Sprich wir müssen die obige Formel wie folgt umstellen:\n",
|
||||
"\n",
|
||||
"$$ s(t_1) = 1/2 \\cdot g \\cdot t_1^2 + s_0 $$\n",
|
||||
"\n",
|
||||
"auflösen nach t:\n",
|
||||
"\n",
|
||||
"$$ \\sqrt{2 \\cdot (s - s_0)/g} = t_1 $$\n",
|
||||
"\n",
|
||||
"wobei hier s(t1)=0 und s0 = 1.2 m ist. Solltet ihr einfach 1.2 m durch eine der Beschleunigungen Teilen bekommt ihr durch die Wurzel eine komplexe Zahl."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2020-08-25T09:07:53.967603Z",
|
||||
"start_time": "2020-08-25T09:07:53.954643Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"1.2171612389003692 0.4946193668294979 0.09359019226174953\n",
|
||||
"-92.31736564698974\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"s0 = -1.2 # m\n",
|
||||
"aSun = -274 # m/s**2\n",
|
||||
"aEarth = -9.81 # m/s**2\n",
|
||||
"aMoon = -1.62 #m/s**2\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"tSun = (2 * s0/aSun)**(1/2) # s\n",
|
||||
"tEarth = (2 * s0/aEarth)**(1/2) # s\n",
|
||||
"tMoon = (2 * s0/aMoon)**(1/2) # s\n",
|
||||
"\n",
|
||||
"# Times:\n",
|
||||
"print(tMoon, tEarth, tSun)\n",
|
||||
"\n",
|
||||
"# Velocity:\n",
|
||||
"print(aSun * tSun * 3.6) # km/h"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
|
@ -633,6 +687,42 @@
|
|||
"* Das Runden der berechneten Werte der Anzahl an signifikanten Stellen entsprechend. "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2020-08-25T09:08:13.614302Z",
|
||||
"start_time": "2020-08-25T09:08:13.607319Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\n",
|
||||
"Fie Fallzeit beträgt auf...\n",
|
||||
"... dem Mond: 1.217 s \n",
|
||||
"... der Erde: 0.495 s\n",
|
||||
"... der Sonne: 0.094 s\n",
|
||||
"\n",
|
||||
"Der Stift schlägt auf der Sonnenoberfläche\n",
|
||||
"mit einer Geschwindikeit von -92.317 km/h auf.\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"print(f'''\n",
|
||||
"Fie Fallzeit beträgt auf...\n",
|
||||
"... dem Mond: {tMoon:.3f} s \n",
|
||||
"... der Erde: {tEarth:.3f} s\n",
|
||||
"... der Sonne: {tSun:.3f} s\n",
|
||||
"''')\n",
|
||||
"\n",
|
||||
"print(f'Der Stift schlägt auf der Sonnenoberfläche\\nmit einer Geschwindikeit von {(aSun * tSun * 3.6):.3f} km/h auf.')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
|
@ -817,6 +907,60 @@
|
|||
"<div>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Lösung:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2020-08-25T09:09:05.968956Z",
|
||||
"start_time": "2020-08-25T09:09:05.958982Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\n",
|
||||
"Spannung | Strom | Leistung:\n",
|
||||
"5 V: 10 mA; 50 mW\n",
|
||||
"10 V: 20 mA; 200 mW\n",
|
||||
"20 V: 40 mA; 800 mW\n",
|
||||
"50 V: 100 mA; 5000 mW\n",
|
||||
"\n",
|
||||
"Der Fehler des Stroms für die 50 V Messung beträgt: 11 Ohm\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"def strom(spannung, widerstand):\n",
|
||||
" return spannung/(widerstand/1000)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def leistung(spannung, widerstand=500):\n",
|
||||
" return spannung**2/(widerstand/1000)\n",
|
||||
"\n",
|
||||
"print(f'''\n",
|
||||
"Spannung | Strom | Leistung:\n",
|
||||
"5 V: {strom(5, 500):2.0f} mA; {leistung(5):2.0f} mW\n",
|
||||
"10 V: {strom(10, 500):2.0f} mA; {leistung(10):2.0f} mW\n",
|
||||
"20 V: {strom(20, 500):2.0f} mA; {leistung(20):2.0f} mW\n",
|
||||
"50 V: {strom(50, 500):2.0f} mA; {leistung(50):2.0f} mW\n",
|
||||
"''' )\n",
|
||||
"\n",
|
||||
"def delta_strom(spannung, dspannung, widerstand=500, dwiderstand=20):\n",
|
||||
" return strom(spannung, widerstand) * ((dspannung/spannung)**2 + (dwiderstand/widerstand)**2)**(1/2)\n",
|
||||
"\n",
|
||||
"print(f'Der Fehler des Stroms für die 50 V Messung beträgt: {delta_strom(50, 50/10):2.0f} Ohm')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
|
@ -1248,11 +1392,54 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
"source": [
|
||||
"### Lösung:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2020-08-25T09:09:57.232469Z",
|
||||
"start_time": "2020-08-25T09:09:57.215516Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"1373.715238095238"
|
||||
]
|
||||
},
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"messwert_nummer = list(range(1,7,1))\n",
|
||||
"spannungs_wert = [12., 11.78, 12.56, 12.34, 12.01, 11.94]\n",
|
||||
"strom_werte = [110, 98, 102, 124, 105, 95]\n",
|
||||
"dspannung_wetre = [0.32, 0.15, 0.63, 0.12, 0.20, 0.17]\n",
|
||||
"dstrom_werte = [10]*len(messwert_nummer)\n",
|
||||
"\n",
|
||||
"daten = [messwert_nummer, spannungs_wert, strom_werte, dspannung_wetre, dstrom_werte]\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"u5 = daten[1][4]\n",
|
||||
"i5 = daten[2][4]\n",
|
||||
"leistung(u5, i5)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Die Messwertnummer ist in der obigen Tabelle um eins im Vergleich zum Listenindex verschoben."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
|
@ -1277,12 +1464,34 @@
|
|||
"<div>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Lösungen:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
"source": [
|
||||
"height = [1, 1.2 , 1.4, 1.6, 1.8, 2, 2.2, 2.4, 2.6, 2.8] # m\n",
|
||||
"dheight = [0.1] * len(height) # m\n",
|
||||
"t = [0.74, 0.8, 0.87, 0.94, 0.99, 1.03, 1.10, 1.15, 1.17, 1.24] # s\n",
|
||||
"dt = [0.012, 0.011, 0.009, 0.008, 0.010, 0.011, 0.012, 0.013, 0.080, 0.010] # s\n",
|
||||
"\n",
|
||||
"def free_fall(t, a):\n",
|
||||
" '''\n",
|
||||
" Zurückgelegte Strecke bei einer gleichbeschleunigten Bewegung.\n",
|
||||
" \n",
|
||||
" Args:\n",
|
||||
" t (float): Vergangene Zeit in Sekunden.\n",
|
||||
" a (float): Beschleunigung der Bewegung in m/s**2\n",
|
||||
" '''\n",
|
||||
" return 0.5 * a * t**2 "
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
@ -1301,7 +1510,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.7.6"
|
||||
"version": "3.7.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
|
2020
Erweiterete_Musterloesung_Fitten_mit_der_Schiefenebene.ipynb
Executable file
2020
Erweiterete_Musterloesung_Fitten_mit_der_Schiefenebene.ipynb
Executable file
File diff suppressed because one or more lines are too long
159
Kapitel_1._Einstieg_in_die_Welt_von_Python.ipynb
Normal file → Executable file
159
Kapitel_1._Einstieg_in_die_Welt_von_Python.ipynb
Normal file → Executable file
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue