Kleiner Python-Rechner, der die Normalverteilung (Gauß-Glockenkurve) in einer Dimension über ein Intervall berechnet und die Wertepaare in data.dat schreibt, passend zum Plotten mit Gnuplot.
- Fragt Intervall (Start-/Endwert), Erwartungswert μ, Varianz σ und Schrittweite ab.
- Rechnet für jeden Schritt den Funktionswert
f(x)und schreibtx f(x)nachdata.dat.
python3 Normalverteilung.py # Werte eingeben
# data.dat danach z. B. mit Gnuplot plotten: plot 'data.dat'Dichtefunktion: f(x) = 1/(σ·√(2π)) · e^(−(x−μ)²/(2σ²))
Mehr dazu: Wikipedia · Normalverteilung
Python 3 · Gnuplot
🇬🇧 English
A tiny Python calculator for the 1-D normal (Gaussian) distribution over an interval. It asks for the range, mean μ, variance σ and step size, then writes x f(x) pairs to data.dat for plotting with Gnuplot.
Eines meiner allerersten Python-Programme (2021). Die Konstanten sind hier noch grob von Hand gesetzt (π ≈ 3.41), also eher Lernstand als Lehrbuch. Bewusst so gelassen, als Zeitstempel.