1. mrmath mathematische-funktionen¶
Mathematische funktionen.
Module author: Michael Rippstein <info@anatas.ch>
1.1. Konstanten¶
Die Konstanten werden von dem Modul mrmath bereitgestellt.
- RAD: float = 0.017453292519943295¶
Konstante zum umrechnen von Grad ins Bogenmass.
\(\text{RAD} = \frac{\pi}{180}\)
1.2. Hyperbelfunktionen¶
- coth(x)[source]¶
Kotangens hyperbolicus.
- Parameters
x (float) – eingabe ist \(x = -\infty \dots + \infty \qquad x \neq 0\)
- Returns
\(coth(x)\)
- Return type
- Raises
ArithmeticError – wird ausgelöst wenn \(x = 0\)
Examples
>>> coth(0) Traceback (most recent call last): ... ArithmeticError >>> print( round( coth(1), 5 ) ) 1.31304
1.3. Zahlenteoretische und “darstellende” Funktionen¶
- frac(x)[source]¶
Liefert den Nachkommateil einer Zahl.
- Return type
Nachkommanteil
- Parameters
x (float) –
Notes
Der Nachkommanteil ist immer positive.
Examples
>>> frac(1.123) 0.123 >>> frac(-1.123) 0.123 >>> frac(0.123) 0.123 >>> frac(-0.123) 0.123 >>> round(frac(7654321.123456789),9) 0.123456789
- modulo(x, y)[source]¶
Berechnet x mod y.
Examples
>>> round(modulo(370, 360), 1) 10.0 >>> round(modulo(-370, 360), 1) 350.0 >>> round(modulo(-30, 360), 1) 330.0 >>> round(modulo(-0, 360), 1) 0.0 >>> round(modulo(360, 360), 1) 0.0 >>> round(modulo(370, -360), 1) -10.0 >>> round(modulo(-370, -360), 1) -350.0 >>> round(modulo(-30, -360), 1) -330.0 >>> round(modulo(-0, -360), 1) 0.0 >>> round(modulo(360, -360), 1) 0.0
1.4. Winkelumrechnungen¶
- ddd(deg, min_, sec)[source]¶
Umrechnung eines in Grad, bogenminuten und bogensekunden gegebenen winkels in dezimale darstellung.
- Parameters
- Returns
winkel in dezimaler darstellung
- Return type
Examples
>>> round(ddd(15, 30, 0.0), 1) 15.5 >>> round(ddd(-8, 9, 10.0), 5) -8.15278 >>> round(ddd(0, 1, 0.0), 5) 0.01667 >>> round(ddd(0, -5, 0.0), 5) -0.08333
- dms(angle)[source]¶
Ermittelt Grad, Bogenminuten und Bogensekunden zu gegebenem Winkel.
- Parameters
dd – Winkel in Grad in dezimaler Darstellung
angle (float) –
- Returns
D (int) – Winkelgrade
M (int) – Bogenminuten
S (float) – Bogensekunden
- Return type
Examples
>>> dms(0.5) (0, 30, 0.0) >>> dms(-0.5) (0, -30, 0.0)