First page Back Continue Last page Overview Image

Mathematische Funktionen

NumPy bietet auch eine Vielzahl von mathematischen Funktionen, die auch elementweise auf Arrays angewendet werden können:

>>> x = np.array([2,4,9], float)

>>> np.sqrt(x)

array([ 1.41421356, 2. , 3. ])

>>>

Weitere Funktionen:

abs, sign, sqrt, log, log10, exp, sin, cos, tan, arcsin, arccos,arctan, sinh, cosh, tanh, arcsinh, arccosh, and arctanh.

Auch die Konstanten π und e sind in NumPy vorhanden:

>>> np.pi

3.1415926535897931

>>> np.e

2.7182818284590451