This is documentation for an old release of NumPy (version 1.3.). Read this page Search for this page in the documentation of the latest stable release (version > 1.17).
Mathematical functions
Trigonometric functions
sin (x[, out]) |
Trigonometric sine, element-wise. |
cos (x[, out]) |
Cosine elementwise. |
tan (x[, out]) |
Compute tangent element-wise. |
arcsin (x[, out]) |
Inverse sine elementwise. |
arccos (x[, out]) |
Trigonometric inverse cosine, element-wise. |
arctan (x[, out]) |
Trigonometric inverse tangent, element-wise. |
hypot (x1, x2[, out]) |
Given two sides of a right triangle, return its hypotenuse. |
arctan2 (x1, x2[, out]) |
Elementwise arc tangent of x1/x2 choosing the quadrant correctly. |
degrees (x[, out]) |
Convert angles from radians to degrees. |
radians (x[, out]) |
Convert angles from degrees to radians. |
unwrap (p[, discont, axis]) |
Unwrap by changing deltas between values to 2*pi complement. |
Hyperbolic functions
sinh (x[, out]) |
Hyperbolic sine, element-wise. |
cosh (x[, out]) |
Hyperbolic cosine, element-wise. |
tanh (x[, out]) |
Hyperbolic tangent element-wise. |
arcsinh (x[, out]) |
Inverse hyperbolic sine elementwise. |
arccosh (x[, out]) |
Inverse hyperbolic cosine, elementwise. |
arctanh (x[, out]) |
Inverse hyperbolic tangent elementwise. |
Rounding
around (a[, decimals, out]) |
Evenly round to the given number of decimals. |
round_ (a[, decimals, out]) |
Round an array to the given number of decimals. |
rint (x[, out]) |
Round elements of the array to the nearest integer. |
fix (x[, y]) |
Round to nearest integer towards zero. |
floor (x[, out]) |
Return the floor of the input, element-wise. |
ceil (x[, out]) |
Return the ceiling of the input, element-wise. |
Sums, products, differences
prod (a[, axis, dtype, out]) |
Return the product of array elements over a given axis. |
sum (a[, axis, dtype, out]) |
Return the sum of array elements over a given axis. |
nansum (a[, axis]) |
Return the sum of array elements over a given axis treating Not a Numbers (NaNs) as zero. |
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. |
diff (a[, n, axis]) |
Calculate the nth order discrete difference along given axis. |
ediff1d (ary[, to_end, to_begin]) |
The differences between consecutive elements of an array. |
gradient (f, *varargs) |
Return the gradient of an N-dimensional array. |
cross (a, b[, axisa, axisb, axisc, ...]) |
Return the cross product of two (arrays of) vectors. |
trapz (y[, x, dx, axis]) |
Integrate along the given axis using the composite trapezoidal rule. |
Exponents and logarithms
exp (x[, out]) |
Calculate the exponential of the elements in the input array. |
expm1 (x[, out]) |
Return the exponential of the elements in the array minus one. |
log (x[, out]) |
Natural logarithm, element-wise. |
log10 (x[, out]) |
Compute the logarithm in base 10 element-wise. |
log2 (x[, y]) |
Return the base 2 logarithm. |
log1p (x[, out]) |
log(1 + x) in base e, elementwise. |
Other special functions
i0 (x) |
Modified Bessel function of the first kind, order 0. |
sinc (x) |
Return the sinc function. |
Floating point routines
signbit (x[, out]) |
Returns element-wise True where signbit is set (less than zero). |
frexp (x[, out1, out2]) |
Split the number, x, into a normalized fraction (y1) and exponent (y2) |
ldexp (x1, x2[, out]) |
Compute y = x1 * 2**x2. |
Arithmetic operations
add (x1, x2[, out]) |
Add arguments element-wise. |
reciprocal (x[, out]) |
Return element-wise reciprocal. |
negative (x[, out]) |
Returns an array with the negative of each element of the original array. |
multiply (x1, x2[, out]) |
Multiply arguments elementwise. |
divide (x1, x2[, out]) |
Divide arguments element-wise. |
power (x1, x2[, out]) |
Returns element-wise base array raised to power from second array. |
subtract (x1, x2[, out]) |
Subtract arguments element-wise. |
true_divide (x1, x2[, out]) |
Returns an element-wise, true division of the inputs. |
floor_divide (x1, x2[, out]) |
Return the largest integer smaller or equal to the division of the inputs. |
fmod (x1, x2[, out]) |
Return the remainder of division. |
mod (x1, x2[, out]) |
Returns element-wise remainder of division. |
modf (x[, out1, out2]) |
Return the fractional and integral part of a number. |
remainder (x1, x2[, out]) |
Returns element-wise remainder of division. |
Handling complex numbers
angle (z[, deg]) |
Return the angle of the complex argument. |
real (val) |
Return the real part of the elements of the array. |
imag (val) |
Return the imaginary part of array. |
conj (x[, out]) |
Return the complex conjugate, element-wise. |
Miscellaneous
convolve (a, v[, mode]) |
Returns the discrete, linear convolution of two one-dimensional sequences. |
clip (a, a_min, a_max[, out]) |
Clip (limit) the values in an array. |
sqrt (x[, out]) |
Return the positive square-root of an array, element-wise. |
square (x[, out]) |
Return the element-wise square of the input. |
absolute (x[, out]) |
Calculate the absolute value element-wise. |
fabs (x[, out]) |
Compute the absolute values elementwise. |
sign (x[, out]) |
Returns an element-wise indication of the sign of a number. |
maximum (x1, x2[, out]) |
Element-wise maximum of array elements. |
minimum (x1, x2[, out]) |
Element-wise minimum of array elements. |
nan_to_num (x) |
Replace nan with zero and inf with large numbers. |
real_if_close (a[, tol]) |
If complex input returns a real array if complex parts are close to zero. |
interp (x, xp, fp[, left, right]) |
One-dimensional linear interpolation. |