Mathematical functions#
The reference documentation is generated from numpy files, see also API reference on Numpy
Trigonometric functions#
All trigonometric functions use radians when an angle is called for.
The ratio of degrees to radians is 
sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
|
cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
|
tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
|
arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
|
arccos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
|
arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
|
degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
|
radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
|
deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
|
rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
Hyperbolic functions#
sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
|
cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
|
tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
|
arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
|
arccosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
|
arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
Rounding#
rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
|
floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
|
ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
|
trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
Sums, products, differences#
|
Sum of array elements over a given axis. |
|
Return the cumulative product of elements along a given axis. |
|
Return the cumulative sum of the elements along a given axis. |
|
Calculate the n-th discrete difference along the given axis. |
|
Return the cross product of two (arrays of) vectors. |
Exponents and logarithms#
exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
|
expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
|
exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
|
log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
|
log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
Arithmetic operations#
Miscellaneous#
|
Returns the discrete, linear convolution of two one-dimensional sequences. |
|
Clip (limit) the values in an array. |
sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
|
square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
|
absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
|
fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
|
sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
|
maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
|
minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) |
|
|
Create a data type object. |
The element size of this data-type object. |
Tip
The Python function max() will find the maximum over a one-dimensional
array, but it will do so using a slower sequence interface. The reduce
method of the maximum ufunc is much faster. Also, the max() method
will not give answers you might expect for arrays with greater than
one dimension. The reduce method of minimum also allows you to compute
a total minimum over an array.
Warning
the behavior of maximum(a, b) is different than that of max(a, b).
As a ufunc, maximum(a, b) performs an element-by-element comparison
of a and b and chooses each element of the result according to which
element in the two arrays is larger. In contrast, max(a, b) treats
the objects a and b as a whole, looks at the (total) truth value of
a > b and uses it to return either a or b (as a whole). A similar
difference exists between minimum(a, b) and min(a, b).
Array operations#
|
Compute the inverse of a matrix. |
|
Compute the standard deviation along the specified axis. |
|
Dot product of two arrays. |
|
Compute the outer product of two vectors. |
|
Compute the arithmetic mean along the specified axis. |
|
Changes elements of an array based on conditional and input values. |
|
Return the shape of an array. |
|
Return the number of dimensions of an array. |
|
Return the number of elements along a given axis. |
Random functions#
|
Random values in a given shape. |
|
Return a sample (or samples) from the "standard normal" distribution. |
|
Return random floats in the half-open interval [0.0, 1.0). |
|
Draw samples from a standard Normal distribution (mean=0, stdev=1). |
|
Draw samples from a uniform distribution. |
Sorting, searching#
|
Find indices where elements should be inserted to maintain order. |
|
Return elements chosen from x or y depending on condition. |