NumPy学习笔记 (4)

NumPy 数学函数

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. This is the same function as rad2deg but the latter is preferred because of the more descriptive name.
radians (x[, out])Convert angles from degrees to radians. This function is the same as deg2rad, which is more descriptive..
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.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值