<?xml version="1.0" encoding="utf-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Forum Bauen und Umwelt - Simulation anziehender und abstoßender Felder in Python 3</title>
<link>https://bauforum.wirklichewelt.de/</link>
<description>Das Bauforum</description>
<language>de</language>
<item>
<title>Simulation anziehender und abstoßender Felder in Python 3</title>
<content:encoded><![CDATA[<p>Eine Simulation ohne allzu konkreten physikalischen Bezug zeigt die Wirkung zweier entgegengesetzt wirkender Felder auf eine Anzahl Partikel. Ähnlich der Gravitation werden die Partikel mit einer Kraft angezogen, die sich umgekehrt quadratisch zum Abstand der einzelnen Teilchen verhält. Gleichzeitig werden sie von einer Kraft mit stärkerer Wirkung aber geringerer effektiver Reichweite abgestoßen. Ganz entfernt erinnert das Verhalten an die Wechselwirkung der Elementarkräfte im Atomkern.</p>
<p>Sinn der Übung ist weniger die Darstellung eines realen physikalischen Vorgangs (insofern muss ich alle enttäuschen, die das als Last-Minute-Idee für die aktuelle Programmieraufgabe aufgreifen wollen) als vielmehr, ein Programmierbeispiel für den Einfluss eines Reglerpaneels auf eine laufende Simulation zu sein. Diese wird zu Beginn des Programms einmal angestoßen und läuft dann kontinuierlich weiter, während alle möglichen Parameter bis hin zur Partikelanzahl lustig geändert werden können. Gelegentlich läuft die Simulation total aus dem Ruder, was sich in der Regel durch entschlossenes Hochziehen des Dämpfungsreglers schnell beheben lässt.</p>
<p>Wer kann mir das kuriose Verhalten der Partikel erklären, wenn man den Regler für die Abstoßung ganz oder fast ganz auf null herunterzieht?</p>
<p><img src="https://bauforum.wirklichewelt.de/images/uploaded/Bild_Y6C5SN0O1.png" alt="[image]"  loading="lazy" /><br />
<img src="https://bauforum.wirklichewelt.de/images/uploaded/Bild_VY17CL9B1.png" alt="[image]"  loading="lazy" /></p>
<p>Download: <a href="images/uploaded/ZIP-Archiv_2ABK27ET1.zip" target="_blank" rel=\"noopener\"><img src="img/zip.png" alt="[image]"  loading="lazy" />ZIP-Archiv_2ABK27ET1.zip</a></p>
<pre class="python" style="font-family:monospace;"><ol><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;">#!/usr/bin/python3</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Ein Haufen Partikel, der sich auf große Entfernung anzieht</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># und auf geringe Entfernung abstößt</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;">#</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Version vom 1. Januar 2017</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Autor: Martin Vogel, martinvogel.de</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Lizenz: cc-by-3.0 https://creativecommons.org/licenses/by/3.0/de/</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;">#</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">from</span> tkinter <span style="color: #ff7700;">import</span> *</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">from</span> <span style="color: #dc143c;">random</span> <span style="color: #ff7700;">import</span> randint<span style="color: #000;">,</span> choice<span style="color: #000;">,</span> <span style="color: #dc143c;">random</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">from</span> <span style="color: #dc143c;">time</span> <span style="color: #ff7700;">import</span> perf_counter</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">from</span> <span style="color: #dc143c;">math</span> <span style="color: #ff7700;">import</span> hypot</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">class</span> Einstellungen:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #080;">&quot;&quot;&quot;Einige programmweit gültige Einstellungen, die meisten sind über</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">    # Schieberegler beeinflussbar.&quot;&quot;&quot;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: black;">&#41;</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Die Anfangsgröße der Canvas</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">H</span>öhe <span style="color: #000;">=</span> <span style="color: #008;">600</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">Breite</span> <span style="color: #000;">=</span> <span style="color: #008;">800</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Die Anfangszahl der Partikel</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">Anzahl</span> <span style="color: #000;">=</span> <span style="color: #008;">200</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Die Elastizität der Wand:</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># 1: Impuls wird voll zurückgegeben, 0: Partikel &quot;klebt&quot; an der Wand.</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">Wandelastizit</span>ät <span style="color: #000;">=</span> <span style="color: #008;">0.5</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Anteil, um den die Geschwindigkeit pro Rechenschritt vermindert wird.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">D</span>ämpfung <span style="color: #000;">=</span> <span style="color: #008;">0.01</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Anmerkung: da die Zahl der Rechenschritte pro Sekunde von der Anzahl</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># der Partikel abhängt (der Rechenaufwand wächst quadratisch), wirkt</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># sich die Dämpfung bei geringer Partikelzahl viel stärker aus als bei</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># großer Partikelzahl. Wer mag, kann das gerne mal verbessern.</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Die Stärke von Anziehung und Abstoßung.</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">Anziehungsfaktor</span> <span style="color: #000;">=</span> <span style="color: #008;">9</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">Absto</span>ßungsfaktor <span style="color: #000;">=</span> <span style="color: #008;">18</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Bezugswert für Zeitmessungen:</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">Zeit</span> <span style="color: #000;">=</span> perf_counter<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">def</span> setze_dämpfung<span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: #000;">,</span> event<span style="color: black;">&#41;</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Lies den Schieberwert!</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">D</span>ämpfung <span style="color: #000;">=</span> SD.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">def</span> setze_anzahl<span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: #000;">,</span> event<span style="color: #000;">=</span><span style="color: #808;">None</span><span style="color: black;">&#41;</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Wo steht der Schieber?</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">Anzahl</span> <span style="color: #000;">=</span> SA.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff7700;">while</span> <span style="color: #808;">len</span><span style="color: black;">&#40;</span>Partikel<span style="color: black;">&#41;</span> <span style="color: #000;">&lt;</span> <span style="color: #808;">self</span>.<span style="color: black;">Anzahl</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Brauchen wir noch Partikel? Neuen erzeugen!</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            C_Partikel<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff7700;">while</span> <span style="color: #808;">len</span><span style="color: black;">&#40;</span>Partikel<span style="color: black;">&#41;</span> <span style="color: #000;">&gt;</span> <span style="color: #808;">self</span>.<span style="color: black;">Anzahl</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Haben wir zu viele Partikel? Irgendeins löschen!</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            choice<span style="color: black;">&#40;</span>Partikel<span style="color: black;">&#41;</span>.<span style="color: black;">l</span>ösche<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">def</span> setze_anziehungsfaktor<span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: #000;">,</span> event<span style="color: black;">&#41;</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Hole den Schieberwert!</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">Anziehungsfaktor</span> <span style="color: #000;">=</span> SAn.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Die Grafik im Kontrollpaneel aktualisieren</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        C.<span style="color: black;">after_idle</span><span style="color: black;">&#40;</span>ZeigeVerlauf<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">def</span> setze_abstoßungsfaktor<span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: #000;">,</span> event<span style="color: black;">&#41;</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Welcher Schieberwert wurde eingestellt?</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">Absto</span>ßungsfaktor <span style="color: #000;">=</span> SAb.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Die Grafik im Kontrollpaneel aktualisieren</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        C.<span style="color: black;">after_idle</span><span style="color: black;">&#40;</span>ZeigeVerlauf<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">def</span> setze_wandelastizität<span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: #000;">,</span> event<span style="color: black;">&#41;</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Lies den Schieber, setze das Attribut:</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">Wandelastizit</span>ät <span style="color: #000;">=</span> SW.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">def</span> setze_canvasgröße<span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: #000;">,</span> event<span style="color: black;">&#41;</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Falls die Größe der Canvas verändert wird, neue Abmessungen auslesen</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># und merken:</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">Breite</span> <span style="color: #000;">=</span> C.<span style="color: black;">winfo_width</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">H</span>öhe <span style="color: #000;">=</span> C.<span style="color: black;">winfo_height</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Die einzige Instanz dieser Klasse:</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">E <span style="color: #000;">=</span> Einstellungen<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Alle Partikel werden in dieser Liste verwaltet.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Partikel <span style="color: #000;">=</span> <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">def</span> zufallsfarben<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #080;">&quot;Erzeugt einen nicht zu dunklen RGB-Farbwert und eine dunklere Variante&quot;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Ein Farbpaar für die Partikel: Heller Kern, dunkler Rand</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    r<span style="color: #000;">,</span> g<span style="color: #000;">,</span> b <span style="color: #000;">=</span> randint<span style="color: black;">&#40;</span><span style="color: #008;">64</span><span style="color: #000;">,</span> <span style="color: #008;">255</span><span style="color: black;">&#41;</span><span style="color: #000;">,</span> randint<span style="color: black;">&#40;</span><span style="color: #008;">64</span><span style="color: #000;">,</span> <span style="color: #008;">255</span><span style="color: black;">&#41;</span><span style="color: #000;">,</span> randint<span style="color: black;">&#40;</span><span style="color: #008;">64</span><span style="color: #000;">,</span> <span style="color: #008;">255</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">return</span> <span style="color: #080;">&quot;#%02x%02x%02x&quot;</span> % <span style="color: black;">&#40;</span>r<span style="color: #000;">,</span> g<span style="color: #000;">,</span> b<span style="color: black;">&#41;</span><span style="color: #000;">,</span> <span style="color: #080;">&quot;#%02x%02x%02x&quot;</span> % <span style="color: black;">&#40;</span>r//<span style="color: #008;">2</span><span style="color: #000;">,</span> g//<span style="color: #008;">2</span><span style="color: #000;">,</span> b//<span style="color: #008;">2</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">class</span> C_Partikel:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #080;">&quot;Massepunkt mit Ort und Geschwindigkeit.&quot;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: #000;">,</span> x<span style="color: #000;">=</span><span style="color: #808;">None</span><span style="color: #000;">,</span> y<span style="color: #000;">=</span><span style="color: #808;">None</span><span style="color: black;">&#41;</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Ort</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff7700;">if</span> x <span style="color: #ff7700;">is</span> <span style="color: #808;">None</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            x <span style="color: #000;">=</span> randint<span style="color: black;">&#40;</span><span style="color: #008;">0</span><span style="color: #000;">,</span> E.<span style="color: black;">Breite</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff7700;">if</span> y <span style="color: #ff7700;">is</span> <span style="color: #808;">None</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            y <span style="color: #000;">=</span> randint<span style="color: black;">&#40;</span><span style="color: #008;">0</span><span style="color: #000;">,</span> E.<span style="color: black;">H</span>öhe<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">x</span> <span style="color: #000;">=</span> x</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">y</span> <span style="color: #000;">=</span> y</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Geschwindigkeit</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">vx</span> <span style="color: #000;">=</span> <span style="color: #008;">0</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">vy</span> <span style="color: #000;">=</span> <span style="color: #008;">0</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Farbe</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        hell<span style="color: #000;">,</span> dunkel <span style="color: #000;">=</span> zufallsfarben<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Canvasobjekt</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">ID</span> <span style="color: #000;">=</span> C.<span style="color: black;">create_oval</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">x</span>-<span style="color: #008;">3</span><span style="color: #000;">,</span> <span style="color: #808;">self</span>.<span style="color: black;">y</span>-<span style="color: #008;">3</span><span style="color: #000;">,</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                                <span style="color: #808;">self</span>.<span style="color: black;">x</span>+<span style="color: #008;">3</span><span style="color: #000;">,</span> <span style="color: #808;">self</span>.<span style="color: black;">y</span>+<span style="color: #008;">3</span><span style="color: #000;">,</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                                fill<span style="color: #000;">=</span>hell<span style="color: #000;">,</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                                outline<span style="color: #000;">=</span>dunkel<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Eintragen in die Liste aller Partikel</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        Partikel.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Der Punkt kann mit der Maus verschoben werden.</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        C.<span style="color: black;">tag_bind</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">ID</span><span style="color: #000;">,</span> <span style="color: #080;">&quot;&lt;B1-Motion&gt;&quot;</span><span style="color: #000;">,</span> <span style="color: #808;">self</span>.<span style="color: black;">bewegezu</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">def</span> lösche<span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: black;">&#41;</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #080;">&quot;Punkt wird entfernt&quot;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Lösche Punkt aus der Partikelliste</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        Partikel.<span style="color: black;">remove</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Lösche Canvas-Objekt</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        C.<span style="color: black;">delete</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">ID</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">def</span> bewegezu<span style="color: black;">&#40;</span><span style="color: #808;">self</span><span style="color: #000;">,</span> event<span style="color: black;">&#41;</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #080;">&quot;Punkt wird verschoben&quot;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        C.<span style="color: black;">move</span><span style="color: black;">&#40;</span><span style="color: #808;">self</span>.<span style="color: black;">ID</span><span style="color: #000;">,</span> event.<span style="color: black;">x</span>-<span style="color: #808;">self</span>.<span style="color: black;">x</span><span style="color: #000;">,</span> event.<span style="color: black;">y</span>-<span style="color: #808;">self</span>.<span style="color: black;">y</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #808;">self</span>.<span style="color: black;">x</span><span style="color: #000;">,</span> <span style="color: #808;">self</span>.<span style="color: black;">y</span> <span style="color: #000;">=</span> event.<span style="color: black;">x</span><span style="color: #000;">,</span> event.<span style="color: black;">y</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">def</span> Animationsschleife<span style="color: black;">&#40;</span>event<span style="color: #000;">=</span><span style="color: #808;">None</span><span style="color: black;">&#41;</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #080;">&quot;&quot;&quot;Einsammeln aller Kräfte, die auf jedes Partikel wirken und anschließende</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">    Berechnung der Kraftwirkung&quot;&quot;&quot;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Berechnung der seit dem letzten Aufruf verstrichenen Zeit delta_t</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    jetzt <span style="color: #000;">=</span> perf_counter<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    delta_t <span style="color: #000;">=</span> jetzt-E.<span style="color: black;">Zeit</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    E.<span style="color: black;">Zeit</span> <span style="color: #000;">=</span> jetzt</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Anz<span style="color: #000;">,</span> Abs <span style="color: #000;">=</span> E.<span style="color: black;">Anziehungsfaktor</span><span style="color: #000;">,</span> E.<span style="color: black;">Absto</span>ßungsfaktor</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Dmp <span style="color: #000;">=</span> E.<span style="color: black;">D</span>ämpfung</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Wez <span style="color: #000;">=</span> E.<span style="color: black;">Wandelastizit</span>ät</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Kopie der Partikelliste erzeugen, damit es keine Verfälschungen durch</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Neuberechnungen gibt.</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    P <span style="color: #000;">=</span> Partikel<span style="color: black;">&#91;</span>:<span style="color: black;">&#93;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Für alle Partikel:</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">for</span> i<span style="color: #000;">,</span> Pi <span style="color: #ff7700;">in</span> <span style="color: #808;">enumerate</span><span style="color: black;">&#40;</span>P<span style="color: black;">&#41;</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Aktuelle Koordinaten</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        x<span style="color: #000;">,</span> y <span style="color: #000;">=</span> Pi.<span style="color: black;">x</span><span style="color: #000;">,</span> Pi.<span style="color: black;">y</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Beschleunigungssumme in x- und y-Richtung</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        ax <span style="color: #000;">=</span> ay <span style="color: #000;">=</span> <span style="color: #008;">0</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Einwirkungen aller anderen Partikel einsammeln:</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff7700;">for</span> Pj <span style="color: #ff7700;">in</span> P:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Abstände in x- und y-Richung</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            dx <span style="color: #000;">=</span> Pj.<span style="color: black;">x</span>-Pi.<span style="color: black;">x</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            dy <span style="color: #000;">=</span> Pj.<span style="color: black;">y</span>-Pi.<span style="color: black;">y</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Abstand diagonal</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            d <span style="color: #000;">=</span> hypot<span style="color: black;">&#40;</span>dx<span style="color: #000;">,</span> dy<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #ff7700;">if</span> d:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                <span style="color: #800; font-style: italic;"># Falls Pj nicht dasselbe Partikel wie Pi ist:</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                <span style="color: #800; font-style: italic;"># Die Beschleunigungsgleichung:</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                <span style="color: #800; font-style: italic;"># Die Anziehung lässt mit dem Quadrat der Entfernung nach</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                <span style="color: #800; font-style: italic;"># (ähnlich der Gravitation).</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                <span style="color: #800; font-style: italic;"># Die Abstoßung soll hier mit der dritten Potenz der</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                <span style="color: #800; font-style: italic;"># Entfernung schwächer werden (ohne physikalische Grundlage).</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                a <span style="color: #000;">=</span> <span style="color: black;">&#40;</span>Anz/d<span style="color: black;">&#41;</span>**<span style="color: #008;">2</span> - <span style="color: black;">&#40;</span>Abs/d<span style="color: black;">&#41;</span>**<span style="color: #008;">3</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                <span style="color: #800; font-style: italic;"># Beschleunigungskomponenten aufaddieren</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                ax +<span style="color: #000;">=</span> dx*a</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                ay +<span style="color: #000;">=</span> dy*a</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Nachdem die resultierende Beschleunigung aufaddiert wurde, kann</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># die Geschwindigkeitsänderung berechnet werden:</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        Partikel<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>.<span style="color: black;">vx</span> <span style="color: #000;">=</span> <span style="color: black;">&#40;</span>ax*delta_t+Pi.<span style="color: black;">vx</span><span style="color: black;">&#41;</span>*<span style="color: black;">&#40;</span><span style="color: #008;">1</span>-Dmp<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        Partikel<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>.<span style="color: black;">vy</span> <span style="color: #000;">=</span> <span style="color: black;">&#40;</span>ay*delta_t+Pi.<span style="color: black;">vy</span><span style="color: black;">&#41;</span>*<span style="color: black;">&#40;</span><span style="color: #008;">1</span>-Dmp<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Daraus ergibt sich der neue Ort des Partikels.</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        x +<span style="color: #000;">=</span> Partikel<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>.<span style="color: black;">vx</span>*delta_t</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        y +<span style="color: #000;">=</span> Partikel<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>.<span style="color: black;">vy</span>*delta_t</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Bei den folgenden Kollisionen wird das Partikel um eine zufällige</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Entfernung von der Wand abgesetzt, um kuriose Effekte zu vermeiden,</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># die entstehen, wenn ein Haufen benachbarter Partikel dieselben</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># x- oder y- Werte aufweisen.</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff7700;">if</span> x <span style="color: #000;">&lt;</span> <span style="color: #008;">0</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Kollision mit linker Wand?</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            x <span style="color: #000;">=</span> <span style="color: #dc143c;">random</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>/<span style="color: #008;">10</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            Partikel<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>.<span style="color: black;">vx</span> *<span style="color: #000;">=</span> -Wez</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            Partikel<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>.<span style="color: black;">vy</span> *<span style="color: #000;">=</span> Wez</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff7700;">elif</span> x <span style="color: #000;">&gt;</span> E.<span style="color: black;">Breite</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Kollision mit rechter Wand?</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            x <span style="color: #000;">=</span> E.<span style="color: black;">Breite</span>-<span style="color: #dc143c;">random</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>/<span style="color: #008;">10</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            Partikel<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>.<span style="color: black;">vx</span> *<span style="color: #000;">=</span> -Wez</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            Partikel<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>.<span style="color: black;">vy</span> *<span style="color: #000;">=</span> Wez</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff7700;">if</span> y <span style="color: #000;">&lt;</span> <span style="color: #008;">0</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Kollision mit oberer Wand?</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            y <span style="color: #000;">=</span> <span style="color: #dc143c;">random</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>/<span style="color: #008;">10</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            Partikel<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>.<span style="color: black;">vx</span> *<span style="color: #000;">=</span> Wez</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            Partikel<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>.<span style="color: black;">vy</span> *<span style="color: #000;">=</span> -Wez</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff7700;">elif</span> y <span style="color: #000;">&gt;</span> E.<span style="color: black;">H</span>öhe:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #800; font-style: italic;"># Kollision mit unterer Wand?</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            y <span style="color: #000;">=</span> E.<span style="color: black;">H</span>öhe-<span style="color: #dc143c;">random</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>/<span style="color: #008;">10</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            Partikel<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>.<span style="color: black;">vx</span> *<span style="color: #000;">=</span> Wez</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            Partikel<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>.<span style="color: black;">vy</span> *<span style="color: #000;">=</span> -Wez</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #800; font-style: italic;"># Canvasobjekt des Partikels auf neue Koordinaten setzen</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        C.<span style="color: black;">move</span><span style="color: black;">&#40;</span>Partikel<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>.<span style="color: black;">ID</span><span style="color: #000;">,</span> x-Partikel<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>.<span style="color: black;">x</span><span style="color: #000;">,</span> y-Partikel<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>.<span style="color: black;">y</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        Partikel<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>.<span style="color: black;">x</span><span style="color: #000;">,</span> Partikel<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>.<span style="color: black;">y</span> <span style="color: #000;">=</span> x<span style="color: #000;">,</span> y</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Sobald die CPU wieder Luft geholt hat, geht’s von vorne los.</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    C.<span style="color: black;">after_idle</span><span style="color: black;">&#40;</span>Animationsschleife<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Das Hauptfenster mit der Canvas</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">T <span style="color: #000;">=</span> Tk<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">T.<span style="color: black;">title</span><span style="color: black;">&#40;</span><span style="color: #080;">&quot;Wechselwirkung nah und fern&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Die Zeichenfläche. Sie passt sich Größenänderungen des Fensters an.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">C <span style="color: #000;">=</span> Canvas<span style="color: black;">&#40;</span>width<span style="color: #000;">=</span>E.<span style="color: black;">Breite</span><span style="color: #000;">,</span> height<span style="color: #000;">=</span>E.<span style="color: black;">H</span>öhe<span style="color: #000;">,</span> bg<span style="color: #000;">=</span><span style="color: #080;">&quot;black&quot;</span><span style="color: #000;">,</span> highlightthickness<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">C.<span style="color: black;">pack</span><span style="color: black;">&#40;</span>expand<span style="color: #000;">=</span><span style="color: #808;">True</span><span style="color: #000;">,</span> fill<span style="color: #000;">=</span><span style="color: #080;">&quot;both&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">C.<span style="color: black;">bind</span><span style="color: black;">&#40;</span><span style="color: #080;">&quot;&lt;Configure&gt;&quot;</span><span style="color: #000;">,</span> E.<span style="color: black;">setze_canvasgr</span>öße<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Das Kontrollfenster</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">KF <span style="color: #000;">=</span> Toplevel<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">KF.<span style="color: black;">title</span><span style="color: black;">&#40;</span><span style="color: #080;">&quot;Reglerpult&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Das Reglerpult</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SLF <span style="color: #000;">=</span> LabelFrame<span style="color: black;">&#40;</span>KF<span style="color: #000;">,</span> text<span style="color: #000;">=</span><span style="color: #080;">&quot;Parameter&quot;</span><span style="color: #000;">,</span> padx<span style="color: #000;">=</span><span style="color: #008;">5</span><span style="color: #000;">,</span> pady<span style="color: #000;">=</span><span style="color: #008;">5</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SLF.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span> column<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span> columnspan<span style="color: #000;">=</span><span style="color: #008;">2</span><span style="color: #000;">,</span> sticky<span style="color: #000;">=</span><span style="color: #080;">&quot;wens&quot;</span><span style="color: #000;">,</span> padx<span style="color: #000;">=</span><span style="color: #008;">5</span><span style="color: #000;">,</span> pady<span style="color: #000;">=</span><span style="color: #008;">5</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Zeile 1 im Labelframe (die Regler) soll dessen Größenanpassung übernehmen,</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># außerdem soll sie mindestens 200 Pixel hoch sein, damit die</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Skalenzahlen gut zu erkennen sind.</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">KF.<span style="color: black;">rowconfigure</span><span style="color: black;">&#40;</span><span style="color: #008;">0</span><span style="color: #000;">,</span> weight<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SLF.<span style="color: black;">rowconfigure</span><span style="color: black;">&#40;</span><span style="color: #008;">1</span><span style="color: #000;">,</span> weight<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: #000;">,</span> minsize<span style="color: #000;">=</span><span style="color: #008;">200</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Die 5 Spalten sollen sich gleichmäßig verteilen können.</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SLF.<span style="color: black;">columnconfigure</span><span style="color: black;">&#40;</span><span style="color: #008;">0</span><span style="color: #000;">,</span> weight<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SLF.<span style="color: black;">columnconfigure</span><span style="color: black;">&#40;</span><span style="color: #008;">1</span><span style="color: #000;">,</span> weight<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SLF.<span style="color: black;">columnconfigure</span><span style="color: black;">&#40;</span><span style="color: #008;">2</span><span style="color: #000;">,</span> weight<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SLF.<span style="color: black;">columnconfigure</span><span style="color: black;">&#40;</span><span style="color: #008;">3</span><span style="color: #000;">,</span> weight<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SLF.<span style="color: black;">columnconfigure</span><span style="color: black;">&#40;</span><span style="color: #008;">4</span><span style="color: #000;">,</span> weight<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Schieberegler für die Anzahl der Partikel</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Label<span style="color: black;">&#40;</span>SLF<span style="color: #000;">,</span> text<span style="color: #000;">=</span><span style="color: #080;">&quot;Anzahl&quot;</span><span style="color: black;">&#41;</span>.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span> column<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SA <span style="color: #000;">=</span> Scale<span style="color: black;">&#40;</span>SLF<span style="color: #000;">,</span> from_<span style="color: #000;">=</span><span style="color: #008;">500</span><span style="color: #000;">,</span> to<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span> width<span style="color: #000;">=</span><span style="color: #008;">20</span><span style="color: #000;">,</span> orient<span style="color: #000;">=</span><span style="color: #080;">&quot;vertical&quot;</span><span style="color: #000;">,</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">           tickinterval<span style="color: #000;">=</span><span style="color: #008;">100</span><span style="color: #000;">,</span> resolution<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: #000;">,</span> command<span style="color: #000;">=</span>E.<span style="color: black;">setze_anzahl</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SA.<span style="color: #808;">set</span><span style="color: black;">&#40;</span>E.<span style="color: black;">Anzahl</span><span style="color: black;">&#41;</span>  <span style="color: #800; font-style: italic;"># Anfangswert des Reglers</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SA.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: #000;">,</span> column<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span> sticky<span style="color: #000;">=</span><span style="color: #080;">&quot;nsew&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Schieberegler für den Anziehungsfaktor</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Label<span style="color: black;">&#40;</span>SLF<span style="color: #000;">,</span> text<span style="color: #000;">=</span><span style="color: #080;">&quot;Anziehung&quot;</span><span style="color: black;">&#41;</span>.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span> column<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SAn <span style="color: #000;">=</span> Scale<span style="color: black;">&#40;</span>SLF<span style="color: #000;">,</span> from_<span style="color: #000;">=</span><span style="color: #008;">50</span><span style="color: #000;">,</span> to<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span> width<span style="color: #000;">=</span><span style="color: #008;">20</span><span style="color: #000;">,</span> orient<span style="color: #000;">=</span><span style="color: #080;">&quot;vertical&quot;</span><span style="color: #000;">,</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            tickinterval<span style="color: #000;">=</span><span style="color: #008;">10</span><span style="color: #000;">,</span> resolution<span style="color: #000;">=</span><span style="color: #008;">0.1</span><span style="color: #000;">,</span> command<span style="color: #000;">=</span>E.<span style="color: black;">setze_anziehungsfaktor</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SAn.<span style="color: #808;">set</span><span style="color: black;">&#40;</span>E.<span style="color: black;">Anziehungsfaktor</span><span style="color: black;">&#41;</span>  <span style="color: #800; font-style: italic;"># Anfangswert des Reglers</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SAn.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: #000;">,</span> column<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: #000;">,</span> sticky<span style="color: #000;">=</span><span style="color: #080;">&quot;nsew&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Schieberegler für den Abstoßungsfaktor</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Label<span style="color: black;">&#40;</span>SLF<span style="color: #000;">,</span> text<span style="color: #000;">=</span><span style="color: #080;">&quot;Abstoßung&quot;</span><span style="color: black;">&#41;</span>.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span> column<span style="color: #000;">=</span><span style="color: #008;">2</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SAb <span style="color: #000;">=</span> Scale<span style="color: black;">&#40;</span>SLF<span style="color: #000;">,</span> from_<span style="color: #000;">=</span><span style="color: #008;">50</span><span style="color: #000;">,</span> to<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span> width<span style="color: #000;">=</span><span style="color: #008;">20</span><span style="color: #000;">,</span> orient<span style="color: #000;">=</span><span style="color: #080;">&quot;vertical&quot;</span><span style="color: #000;">,</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            tickinterval<span style="color: #000;">=</span><span style="color: #008;">10</span><span style="color: #000;">,</span> resolution<span style="color: #000;">=</span><span style="color: #008;">0.1</span><span style="color: #000;">,</span> command<span style="color: #000;">=</span>E.<span style="color: black;">setze_absto</span>ßungsfaktor<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SAb.<span style="color: #808;">set</span><span style="color: black;">&#40;</span>E.<span style="color: black;">Absto</span>ßungsfaktor<span style="color: black;">&#41;</span>  <span style="color: #800; font-style: italic;"># Anfangswert des Reglers</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SAb.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: #000;">,</span> column<span style="color: #000;">=</span><span style="color: #008;">2</span><span style="color: #000;">,</span> sticky<span style="color: #000;">=</span><span style="color: #080;">&quot;nsew&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Schieberegler für die Wand-Elastizität</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Label<span style="color: black;">&#40;</span>SLF<span style="color: #000;">,</span> text<span style="color: #000;">=</span><span style="color: #080;">&quot;Wand-nelastizität&quot;</span><span style="color: black;">&#41;</span>.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span> column<span style="color: #000;">=</span><span style="color: #008;">3</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SW <span style="color: #000;">=</span> Scale<span style="color: black;">&#40;</span>SLF<span style="color: #000;">,</span> from_<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: #000;">,</span> to<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span> width<span style="color: #000;">=</span><span style="color: #008;">20</span><span style="color: #000;">,</span> orient<span style="color: #000;">=</span><span style="color: #080;">&quot;vertical&quot;</span><span style="color: #000;">,</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">           tickinterval<span style="color: #000;">=</span><span style="color: #008;">0.2</span><span style="color: #000;">,</span> resolution<span style="color: #000;">=</span><span style="color: #008;">0.01</span><span style="color: #000;">,</span> command<span style="color: #000;">=</span>E.<span style="color: black;">setze_wandelastizit</span>ät<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SW.<span style="color: #808;">set</span><span style="color: black;">&#40;</span>E.<span style="color: black;">Wandelastizit</span>ät<span style="color: black;">&#41;</span>  <span style="color: #800; font-style: italic;"># Anfangswert des Reglers</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SW.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: #000;">,</span> column<span style="color: #000;">=</span><span style="color: #008;">3</span><span style="color: #000;">,</span> sticky<span style="color: #000;">=</span><span style="color: #080;">&quot;nsew&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Schieberegler für die Dämpfung</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Label<span style="color: black;">&#40;</span>SLF<span style="color: #000;">,</span> text<span style="color: #000;">=</span><span style="color: #080;">&quot;Dämpfung&quot;</span><span style="color: black;">&#41;</span>.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span> column<span style="color: #000;">=</span><span style="color: #008;">4</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SD <span style="color: #000;">=</span> Scale<span style="color: black;">&#40;</span>SLF<span style="color: #000;">,</span> from_<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: #000;">,</span> to<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span> width<span style="color: #000;">=</span><span style="color: #008;">20</span><span style="color: #000;">,</span> orient<span style="color: #000;">=</span><span style="color: #080;">&quot;vertical&quot;</span><span style="color: #000;">,</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">           tickinterval<span style="color: #000;">=</span><span style="color: #008;">0.2</span><span style="color: #000;">,</span> resolution<span style="color: #000;">=</span><span style="color: #008;">0.001</span><span style="color: #000;">,</span> command<span style="color: #000;">=</span>E.<span style="color: black;">setze_d</span>ämpfung<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SD.<span style="color: #808;">set</span><span style="color: black;">&#40;</span>E.<span style="color: black;">D</span>ämpfung<span style="color: black;">&#41;</span>  <span style="color: #800; font-style: italic;"># Anfangswert des Reglers</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SD.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: #000;">,</span> column<span style="color: #000;">=</span><span style="color: #008;">4</span><span style="color: #000;">,</span> sticky<span style="color: #000;">=</span><span style="color: #080;">&quot;nsew&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">def</span> ZeigeVerlauf<span style="color: black;">&#40;</span>event<span style="color: #000;">=</span><span style="color: #808;">None</span><span style="color: black;">&#41;</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #080;">&quot;&quot;&quot;In einer Canvasgrafik unterhalb der Regler wird der Wirkungsradius</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">    und die Stärke von Anziehung und Abstoßung (innerhalb gewisser Grenzen)</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #080;">    als Diagramm angezeigt.&quot;&quot;&quot;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Einige Werte zur Darstellung ausrechnen und zwischenspeichern</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Werte <span style="color: #000;">=</span> <span style="color: black;">&#91;</span><span style="color: #008;">0</span><span style="color: black;">&#93;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">for</span> d <span style="color: #ff7700;">in</span> <span style="color: #808;">range</span><span style="color: black;">&#40;</span><span style="color: #008;">1</span><span style="color: #000;">,</span> <span style="color: #008;">600</span><span style="color: black;">&#41;</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        Anziehung <span style="color: #000;">=</span> <span style="color: black;">&#40;</span>E.<span style="color: black;">Anziehungsfaktor</span>/d<span style="color: black;">&#41;</span>**<span style="color: #008;">2</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        Abstoßung <span style="color: #000;">=</span> <span style="color: black;">&#40;</span>E.<span style="color: black;">Absto</span>ßungsfaktor/d<span style="color: black;">&#41;</span>**<span style="color: #008;">3</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        Werte.<span style="color: black;">append</span><span style="color: black;">&#40;</span>Anziehung-Abstoßung<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Extrema?</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Wmin<span style="color: #000;">,</span> Wmax <span style="color: #000;">=</span> <span style="color: #808;">min</span><span style="color: black;">&#40;</span>Werte<span style="color: black;">&#41;</span>-<span style="color: #008;">0.001</span><span style="color: #000;">,</span> <span style="color: #808;">max</span><span style="color: black;">&#40;</span>Werte<span style="color: black;">&#41;</span>+<span style="color: #008;">0.001</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Der betragsmäßig kleinere der beiden Werte bestimmt den Maßstab</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Wmin<span style="color: #000;">,</span> Wmax <span style="color: #000;">=</span> <span style="color: #808;">max</span><span style="color: black;">&#40;</span>Wmin<span style="color: #000;">,</span> -<span style="color: #008;">2</span>*Wmax<span style="color: black;">&#41;</span><span style="color: #000;">,</span> <span style="color: #808;">min</span><span style="color: black;">&#40;</span>Wmax<span style="color: #000;">,</span> -<span style="color: #008;">2</span>*Wmin<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># … noch etwas Randabstand</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Wmax +<span style="color: #000;">=</span> <span style="color: #008;">0.05</span>*<span style="color: black;">&#40;</span>Wmax-Wmin<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Wmin -<span style="color: #000;">=</span> <span style="color: #008;">0.05</span>*<span style="color: black;">&#40;</span>Wmax-Wmin<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Lage der Nulllinie in y-Richtung</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Null <span style="color: #000;">=</span> <span style="color: #008;">100</span>*<span style="color: black;">&#40;</span>Wmax<span style="color: black;">&#41;</span>/<span style="color: black;">&#40;</span>Wmax-Wmin<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Punkte des Funktionsgraphen</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    Punkte <span style="color: #000;">=</span> <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Skalierung der Werte auf den Darstellungsbereich</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">for</span> x <span style="color: #ff7700;">in</span> <span style="color: #808;">range</span><span style="color: black;">&#40;</span><span style="color: #008;">1</span><span style="color: #000;">,</span> <span style="color: #008;">600</span><span style="color: black;">&#41;</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        Punkte.<span style="color: black;">append</span><span style="color: black;">&#40;</span>x<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        y <span style="color: #000;">=</span> <span style="color: #808;">min</span><span style="color: black;">&#40;</span><span style="color: #008;">101</span><span style="color: #000;">,</span> <span style="color: #808;">max</span><span style="color: black;">&#40;</span>-<span style="color: #008;">1</span><span style="color: #000;">,</span> <span style="color: #008;">100</span>*<span style="color: black;">&#40;</span>Wmax-Werte<span style="color: black;">&#91;</span>x<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>/<span style="color: black;">&#40;</span>Wmax-Wmin<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        Punkte.<span style="color: black;">append</span><span style="color: black;">&#40;</span>y<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Radius der Grenze zwischen Anziehung und Abstoßung</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">try</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        r0 <span style="color: #000;">=</span> E.<span style="color: black;">Absto</span>ßungsfaktor**<span style="color: #008;">3</span>/E.<span style="color: black;">Anziehungsfaktor</span>**<span style="color: #008;">2</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">except</span>:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        r0 <span style="color: #000;">=</span> <span style="color: #808;">float</span><span style="color: black;">&#40;</span><span style="color: #080;">&quot;inf&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Radius wird für die Darstellung auf Anzeigebereich begrenzt</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    x0 <span style="color: #000;">=</span> <span style="color: #808;">min</span><span style="color: black;">&#40;</span><span style="color: #008;">600</span><span style="color: #000;">,</span> r0<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Grafik neu aufbauen</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    SC.<span style="color: black;">delete</span><span style="color: black;">&#40;</span><span style="color: #080;">&quot;all&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Nullinie</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    SC.<span style="color: black;">create_line</span><span style="color: black;">&#40;</span><span style="color: #008;">0</span><span style="color: #000;">,</span> Null<span style="color: #000;">,</span> <span style="color: #008;">600</span><span style="color: #000;">,</span> Null<span style="color: #000;">,</span> fill<span style="color: #000;">=</span><span style="color: #080;">&quot;#008000&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># An-Ab-Grenze</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    SC.<span style="color: black;">create_line</span><span style="color: black;">&#40;</span>x0<span style="color: #000;">,</span> <span style="color: #008;">0</span><span style="color: #000;">,</span> x0<span style="color: #000;">,</span> <span style="color: #008;">100</span><span style="color: #000;">,</span> fill<span style="color: #000;">=</span><span style="color: #080;">&quot;#008000&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># untenliegende Beschriftung</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    SC.<span style="color: black;">create_text</span><span style="color: black;">&#40;</span>x0+<span style="color: #008;">2</span><span style="color: #000;">,</span> <span style="color: #008;">2</span><span style="color: #000;">,</span> text<span style="color: #000;">=</span><span style="color: #080;">&quot;Anziehung&quot;</span><span style="color: #000;">,</span> anchor<span style="color: #000;">=</span><span style="color: #080;">&quot;nw&quot;</span><span style="color: #000;">,</span> fill<span style="color: #000;">=</span><span style="color: #080;">&quot;#40C000&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    SC.<span style="color: black;">create_text</span><span style="color: black;">&#40;</span>x0-<span style="color: #008;">2</span><span style="color: #000;">,</span> <span style="color: #008;">2</span><span style="color: #000;">,</span> text<span style="color: #000;">=</span><span style="color: #080;">&quot;Abstoßung&quot;</span><span style="color: #000;">,</span> anchor<span style="color: #000;">=</span><span style="color: #080;">&quot;ne&quot;</span><span style="color: #000;">,</span> fill<span style="color: #000;">=</span><span style="color: #080;">&quot;#40C000&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Funktionsgraph</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    SC.<span style="color: black;">create_line</span><span style="color: black;">&#40;</span>Punkte<span style="color: #000;">,</span> fill<span style="color: #000;">=</span><span style="color: #080;">&quot;#E0E000&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Beschleunigungsgleichung</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    SC.<span style="color: black;">create_text</span><span style="color: black;">&#40;</span><span style="color: #008;">598</span><span style="color: #000;">,</span> <span style="color: #008;">98</span><span style="color: #000;">,</span> text<span style="color: #000;">=</span><span style="color: #080;">&quot;a = (%.1f/x)² - (%.1f/x)³&quot;</span> % <span style="color: black;">&#40;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                   E.<span style="color: black;">Anziehungsfaktor</span><span style="color: #000;">,</span> E.<span style="color: black;">Absto</span>ßungsfaktor<span style="color: black;">&#41;</span><span style="color: #000;">,</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                   anchor<span style="color: #000;">=</span><span style="color: #080;">&quot;se&quot;</span><span style="color: #000;">,</span> fill<span style="color: #000;">=</span><span style="color: #080;">&quot;#E0E000&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #800; font-style: italic;"># Radius als gestrichelter Kreis mit symbolischem Partikel im Zentrum</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    SC.<span style="color: black;">create_oval</span><span style="color: black;">&#40;</span>-<span style="color: #008;">3</span><span style="color: #000;">,</span> Null-<span style="color: #008;">3</span><span style="color: #000;">,</span> <span style="color: #008;">3</span><span style="color: #000;">,</span> Null+<span style="color: #008;">3</span><span style="color: #000;">,</span> fill<span style="color: #000;">=</span><span style="color: #080;">&quot;red&quot;</span><span style="color: #000;">,</span> outline<span style="color: #000;">=</span><span style="color: #080;">&quot;red&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    SC.<span style="color: black;">create_oval</span><span style="color: black;">&#40;</span>-x0<span style="color: #000;">,</span> Null-x0<span style="color: #000;">,</span> x0<span style="color: #000;">,</span> Null+x0<span style="color: #000;">,</span> outline<span style="color: #000;">=</span><span style="color: #080;">&quot;red&quot;</span><span style="color: #000;">,</span> dash<span style="color: #000;">=</span><span style="color: black;">&#40;</span><span style="color: #008;">3</span><span style="color: #000;">,</span> <span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    SC.<span style="color: black;">create_text</span><span style="color: black;">&#40;</span>x0/<span style="color: #008;">2</span><span style="color: #000;">,</span> Null-<span style="color: #008;">1</span><span style="color: #000;">,</span> text<span style="color: #000;">=</span><span style="color: #080;">&quot;r0 = %.1f&quot;</span> % r0<span style="color: #000;">,</span> fill<span style="color: #000;">=</span><span style="color: #080;">&quot;red&quot;</span><span style="color: #000;">,</span> anchor<span style="color: #000;">=</span><span style="color: #080;">&quot;s&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Die Canvas im Kontrollfenster</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SC <span style="color: #000;">=</span> Canvas<span style="color: black;">&#40;</span>KF<span style="color: #000;">,</span> width<span style="color: #000;">=</span><span style="color: #008;">600</span><span style="color: #000;">,</span> height<span style="color: #000;">=</span><span style="color: #008;">100</span><span style="color: #000;">,</span> bg<span style="color: #000;">=</span><span style="color: #080;">&quot;black&quot;</span><span style="color: #000;">,</span> highlightthickness<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">SC.<span style="color: black;">grid</span><span style="color: black;">&#40;</span>row<span style="color: #000;">=</span><span style="color: #008;">1</span><span style="color: #000;">,</span> column<span style="color: #000;">=</span><span style="color: #008;">0</span><span style="color: #000;">,</span> padx<span style="color: #000;">=</span><span style="color: #008;">5</span><span style="color: #000;">,</span> pady<span style="color: #000;">=</span><span style="color: #008;">5</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Anzeige des Diagramms</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">ZeigeVerlauf<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Canvas anzeigen</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">C.<span style="color: black;">update</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Erstellung der Anfangsbestückung an Partikeln</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">E.<span style="color: black;">setze_anzahl</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Animation starten</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Animationsschleife<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Kontrollfenster in den Vordergrund holen</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">KF.<span style="color: black;">lift</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #800; font-style: italic;"># Lift off!</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">T.<span style="color: black;">mainloop</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li></ol></pre>]]></content:encoded>
<link>https://bauforum.wirklichewelt.de/index.php?id=11458</link>
<guid>https://bauforum.wirklichewelt.de/index.php?id=11458</guid>
<pubDate>Sun, 01 Jan 2017 16:54:43 +0000</pubDate>
<category>Software</category><dc:creator>Martin Vogel</dc:creator>
</item>
</channel>
</rss>
