Mathematical functions#

Trigonometric functions#

sin

cos

tan

arcsin

asin

arccos

acos

arctan

atan

hypot

arctan2

atan2

degrees

radians

unwrap(p[, discont, axis, period])

Unwrap by taking the complement of large deltas with respect to the period.

deg2rad

rad2deg

Hyperbolic functions#

sinh

cosh

tanh

arcsinh

asinh

arccosh

acosh

arctanh

atanh

Rounding#

round(a[, decimals, out])

Evenly round to the given number of decimals.

around(a[, decimals, out])

Round an array to the given number of decimals.

rint

fix(x[, out])

Round to nearest integer towards zero.

floor

ceil

trunc

Sums, products, differences#

prod(a[, axis, dtype, out, keepdims, ...])

Return the product of array elements over a given axis.

sum(a[, axis, dtype, out, keepdims, ...])

Sum of array elements over a given axis.

nanprod(a[, axis, dtype, out, keepdims, ...])

Return the product of array elements over a given axis treating Not a Numbers (NaNs) as ones.

nansum(a[, axis, dtype, out, keepdims, ...])

Return the sum of array elements over a given axis treating Not a Numbers (NaNs) as zero.

cumulative_sum(x, /, *[, axis, dtype, out, ...])

Return the cumulative sum of the elements along a given axis.

cumulative_prod(x, /, *[, axis, dtype, out, ...])

Return the cumulative product of elements along a given axis.

cumprod(a[, axis, dtype, out])

Return the cumulative product of elements along a given axis.

cumsum(a[, axis, dtype, out])

Return the cumulative sum of the elements along a given axis.

nancumprod(a[, axis, dtype, out])

Return the cumulative product of array elements over a given axis treating Not a Numbers (NaNs) as one.

nancumsum(a[, axis, dtype, out])

Return the cumulative sum of array elements over a given axis treating Not a Numbers (NaNs) as zero.

diff(a[, n, axis, prepend, append])

Calculate the n-th discrete difference along the given axis.

ediff1d(ary[, to_end, to_begin])

The differences between consecutive elements of an array.

gradient(f, *varargs[, axis, edge_order])

Return the gradient of an N-dimensional array.

cross(a, b[, axisa, axisb, axisc, axis])

Return the cross product of two (arrays of) vectors.

trapezoid(y[, x, dx, axis])

Integrate along the given axis using the composite trapezoidal rule.

Exponents and logarithms#

exp

expm1

exp2

log

log10

log2

log1p

logaddexp

logaddexp2

Other special functions#

i0(x)

Modified Bessel function of the first kind, order 0.

sinc(x)

Return the normalized sinc function.

Floating point routines#

signbit

copysign

frexp

ldexp

nextafter

spacing

Rational routines#

lcm

gcd

Arithmetic operations#

add

reciprocal

positive

negative

multiply

divide

power

pow

subtract

true_divide

floor_divide

float_power

fmod

mod

modf

remainder

divmod

Handling complex numbers#

angle(z[, deg])

Return the angle of the complex argument.

real(val)

Return the real part of the complex argument.

imag(val)

Return the imaginary part of the complex argument.

conj

conjugate

Extrema finding#

maximum

max(a[, axis, out, keepdims, initial, where])

Return the maximum of an array or maximum along an axis.

amax(a[, axis, out, keepdims, initial, where])

Return the maximum of an array or maximum along an axis.

fmax

nanmax(a[, axis, out, keepdims, initial, where])

Return the maximum of an array or maximum along an axis, ignoring any NaNs.

minimum

min(a[, axis, out, keepdims, initial, where])

Return the minimum of an array or minimum along an axis.

amin(a[, axis, out, keepdims, initial, where])

Return the minimum of an array or minimum along an axis.

fmin

nanmin(a[, axis, out, keepdims, initial, where])

Return minimum of an array or minimum along an axis, ignoring any NaNs.

Miscellaneous#

convolve(a, v[, mode])

Returns the discrete, linear convolution of two one-dimensional sequences.

clip(a[, a_min, a_max, out, min, max])

Clip (limit) the values in an array.

sqrt

cbrt

square

absolute

fabs

sign

heaviside

nan_to_num(x[, copy, nan, posinf, neginf])

Replace NaN with zero and infinity with large finite numbers (default behaviour) or with the numbers defined by the user using the nan, posinf and/or neginf keywords.

real_if_close(a[, tol])

If input is complex with all imaginary parts close to zero, return real parts.

interp(x, xp, fp[, left, right, period])

One-dimensional linear interpolation for monotonically increasing sample points.