Einführung¶
Beispiel zur Kondition¶
Mit der Kondition wird das Verhältnis von Eingabe- zu Ausgabefehler eines Prozesses bezeichnet. Der Prozess wie etwas gerechnet wird, ist sehr entscheidend. Das Beispiel Integralberechnung über Rekursion veranschaulicht dies sehr schön.
Jupyter-Notebook Download: Beispiel zur Kondition
Zahlendarstellung¶
Mit dem folgenden Python Skript kann die Zahlendarstellung auf einem Rechner visualisiert werden (vgl. Kapitel 1.3.2 im Skript).
import bitstring
# If not installed, install with "pip install bitstring"
# Documentation: https://pypi.org/project/bitstring/
def bin2float(b):
return bitstring.BitArray(bin=b).float
def float2bin(f,length=64):
return bitstring.BitArray(float=f, length=length).bin
if __name__ == "__main__":
print(float2bin(123.75))
print(bin2float('0100000001011110111100000000000000000000000000000000000000000000'))
Download: floatMemoryRepresentation.py
Für die Zahl \(123.75\) folgt mit Basis \(b=2\)
\[\begin{split}123.75 & = 1\cdot 2^6 + 1\cdot 2^5 + 1\cdot 2^4 + 1\cdot 2^3 + 0\cdot 2^2 + 1\cdot 2^1 + 1\cdot 2^0 + 1\cdot 2^{-1} + 1\cdot 2^{-2}\\
& = +(1\cdot 2^{-1} + 1\cdot 2^{-2} + 1\cdot 2^{-3} + 1\cdot 2^{-4} + 0\cdot 2^{-5} + 1\cdot 2^{-6} + 1\cdot 2^{-7}\\
& \quad\quad + 1\cdot 2^{-8} + 1\cdot 2^{-9})\cdot 2^7\end{split}\]