2020-05-14 18:57:35 -04:00
|
|
|
"""Element-by-element functions
|
|
|
|
|
|
|
|
These functions can operate on numbers, 1-D arrays, or 2-D arrays by
|
|
|
|
applying the function to every element in the array. This is typically
|
|
|
|
much more efficient than expressing the same operation as a Python loop."""
|
|
|
|
|
|
|
|
def acos():
|
2020-06-01 09:56:15 -04:00
|
|
|
"""Computes the inverse cosine function"""
|
|
|
|
...
|
2020-05-14 18:57:35 -04:00
|
|
|
|
|
|
|
def acosh():
|
2020-06-01 09:56:15 -04:00
|
|
|
"""Computes the inverse hyperbolic cosine function"""
|
|
|
|
...
|
2020-05-14 18:57:35 -04:00
|
|
|
|
|
|
|
def asin():
|
2020-06-01 09:56:15 -04:00
|
|
|
"""Computes the inverse sine function"""
|
|
|
|
...
|
2020-05-14 18:57:35 -04:00
|
|
|
|
|
|
|
def asinh():
|
2020-06-01 09:56:15 -04:00
|
|
|
"""Computes the inverse hyperbolic sine function"""
|
|
|
|
...
|
2020-05-14 18:57:35 -04:00
|
|
|
|
|
|
|
def around(a, *, decimals):
|
2020-06-01 09:56:15 -04:00
|
|
|
"""Returns a new float array in which each element is rounded to
|
|
|
|
``decimals`` places."""
|
|
|
|
...
|
2020-05-14 18:57:35 -04:00
|
|
|
|
|
|
|
def atan():
|
2020-06-01 09:56:15 -04:00
|
|
|
"""Computes the inverse tangent function; the return values are in the
|
|
|
|
range [-pi/2,pi/2]."""
|
|
|
|
...
|
2020-05-14 18:57:35 -04:00
|
|
|
|
|
|
|
def atan2(y,x):
|
2020-06-01 09:56:15 -04:00
|
|
|
"""Computes the inverse tangent function of y/x; the return values are in
|
|
|
|
the range [-pi, pi]."""
|
|
|
|
...
|
2020-05-14 18:57:35 -04:00
|
|
|
|
|
|
|
def atanh():
|
2020-06-01 09:56:15 -04:00
|
|
|
"""Computes the inverse hyperbolic tangent function"""
|
|
|
|
...
|
2020-05-14 18:57:35 -04:00
|
|
|
|
|
|
|
def ceil():
|
2020-06-01 09:56:15 -04:00
|
|
|
"""Rounds numbers up to the next whole number"""
|
|
|
|
...
|
2020-05-14 18:57:35 -04:00
|
|
|
|
|
|
|
def cos():
|
2020-06-01 09:56:15 -04:00
|
|
|
"""Computes the cosine function"""
|
|
|
|
...
|
2020-05-14 18:57:35 -04:00
|
|
|
|
|
|
|
def erf():
|
2020-06-01 09:56:15 -04:00
|
|
|
"""Computes the error function, which has applications in statistics"""
|
|
|
|
...
|
2020-05-14 18:57:35 -04:00
|
|
|
|
|
|
|
def erfc():
|
2020-06-01 09:56:15 -04:00
|
|
|
"""Computes the complementary error function, which has applications in statistics"""
|
|
|
|
...
|
2020-05-14 18:57:35 -04:00
|
|
|
|
|
|
|
def exp():
|
2020-06-01 09:56:15 -04:00
|
|
|
"""Computes the exponent function."""
|
|
|
|
...
|
2020-05-14 18:57:35 -04:00
|
|
|
|
|
|
|
def expm1():
|
2020-06-01 09:56:15 -04:00
|
|
|
"""Computes $e^x-1$. In certain applications, using this function preserves numeric accuracy better than the `exp` function."""
|
|
|
|
...
|
2020-05-14 18:57:35 -04:00
|
|
|
|
|
|
|
def floor():
|
2020-06-01 09:56:15 -04:00
|
|
|
"""Rounds numbers up to the next whole number"""
|
|
|
|
...
|
2020-05-14 18:57:35 -04:00
|
|
|
|
|
|
|
def gamma():
|
2020-06-01 09:56:15 -04:00
|
|
|
"""Computes the gamma function"""
|
|
|
|
...
|
2020-05-14 18:57:35 -04:00
|
|
|
|
|
|
|
def lgamma():
|
2020-06-01 09:56:15 -04:00
|
|
|
"""Computes the natural log of the gamma function"""
|
|
|
|
...
|
2020-05-14 18:57:35 -04:00
|
|
|
|
|
|
|
def log():
|
2020-06-01 09:56:15 -04:00
|
|
|
"""Computes the natural log"""
|
|
|
|
...
|
2020-05-14 18:57:35 -04:00
|
|
|
|
|
|
|
def log10():
|
2020-06-01 09:56:15 -04:00
|
|
|
"""Computes the log base 10"""
|
|
|
|
...
|
2020-05-14 18:57:35 -04:00
|
|
|
|
|
|
|
def log2():
|
2020-06-01 09:56:15 -04:00
|
|
|
"""Computes the log base 2"""
|
|
|
|
...
|
2020-05-14 18:57:35 -04:00
|
|
|
|
|
|
|
def sin():
|
2020-06-01 09:56:15 -04:00
|
|
|
"""Computes the sine"""
|
|
|
|
...
|
2020-05-14 18:57:35 -04:00
|
|
|
|
|
|
|
def sinh():
|
2020-06-01 09:56:15 -04:00
|
|
|
"""Computes the hyperbolic sine"""
|
|
|
|
...
|
2020-05-14 18:57:35 -04:00
|
|
|
|
|
|
|
def sqrt():
|
2020-06-01 09:56:15 -04:00
|
|
|
"""Computes the square root"""
|
|
|
|
...
|
2020-05-14 18:57:35 -04:00
|
|
|
|
|
|
|
def tan():
|
2020-06-01 09:56:15 -04:00
|
|
|
"""Computes the tangent"""
|
|
|
|
...
|
2020-05-14 18:57:35 -04:00
|
|
|
|
|
|
|
def tanh():
|
2020-06-01 09:56:15 -04:00
|
|
|
"""Computes the hyperbolic tangent"""
|
|
|
|
...
|
|
|
|
|
|
|
|
def vectorise(f, *, otypes=None):
|
|
|
|
"""
|
|
|
|
:param callable f: The function to wrap
|
|
|
|
:param otypes: List of array types that may be returned by the function. None is intepreted to mean the return value is float.
|
|
|
|
|
|
|
|
Wrap a Python function `f` so that it can be applied to arrays.
|
|
|
|
|
|
|
|
The callable must return only values of the types specified by otypes, or the result is undefined."""
|
|
|
|
...
|