NumPy 数学函数

来源:互联网 发布:表白二维码生成器软件 编辑:程序博客网 时间:2024/06/05 02:11

三角函数(Trigonometric)

Function Describe sin(x[, out]) 正弦值 cos(x[, out]) 余弦值 tan(x[, out]) 正切值 arcsin(x[, out]) 反正弦 arccos(x[, out]) 反余弦 arctan(x[, out]) 反正切 hypot(x1, x2[, out]) 求直角三角形斜边 arctan2(x1, x2[, out]) Element-wise arc tangent of x1/x2 choosing the quadrant correctly. degrees(x[, out]) 弧度求角度 radians(x[, out]) 角度求弧度 unwrap(p[, discont, axis]) Unwrap by changing deltas between values to 2*pi complement. deg2rad(x[, out]) 角度求弧度 rad2deg(x[, out]) 弧度求角度

双曲线函数(Hyperbolic)

Function Describe sinh(x[, out]) 双曲线正弦 cosh(x[, out]) 双曲线余弦 tanh(x[, out]) 双曲线正切 arcsinh(x[, out]) 反双曲线正弦 arccosh(x[, out]) 反双曲线余弦 arctanh(x[, out]) 反双曲线正切

四舍五入(Rounding)

Function Describe around(a[, decimals, out]) 以给定的小数位进行四舍五入 round_(a[, decimals, out]) 以给定的小数位进行四舍五入,等同于around rint(x[, out]) 四舍五入到整数 fix(x[, y]) 向0取整,正数向下取整,负数向上取整 floor(x[, out]) 向下取整 ceil(x[, out]) 向上取整 trunc(x[, out]) 取整数部分

和、积、差异(Sums、Products、Differences)

Function Describe prod(a[, axis, dtype, out, keepdims]) 求积 sum(a[, axis, dtype, out, keepdims]) 求和 nanprod(a[, axis, dtype, out, keepdims]) 求积,缺省值为1 nansum(a[, axis, dtype, out, keepdims]) 求和,缺省值为0 cumprod(a[, axis, dtype, out]) 累积 cumsum(a[, axis, dtype, out]) 累和 nancumprod(a[, axis, dtype, out]) 累积,缺省为1 nancumsum(a[, axis, dtype, out]) 累和,缺省为0 diff(a[, n, axis]) out[n] = a[n+1] - a[n] ediff1d(ary[, to_end, to_begin]) The differences between consecutive elements of an array. gradient(f, *varargs, **kwargs) Return the gradient of an N-dimensional array. cross(a, b[, axisa, axisb, axisc, axis]) 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&Logarithm)

Function Describe exp(x[, out]) 指数 expm1(x[, out]) exp(x) - 1 exp2(x[, out]) 2**x log(x[, out]) 对数 log10(x[, out]) 以10为底对数 log2(x[, out]) 以2为底对数. log1p(x[, out]) exp(x) - 1 logaddexp(x1, x2[, out]) Logarithm of the sum of exponentiations of the inputs. logaddexp2(x1, x2[, out]) Logarithm of the sum of exponentiations of the inputs in base-2.

算术运算

Function Describe add(x1, x2[, out]) 加法 reciprocal(x[, out]) 倒数 negative(x[, out]) 负数 multiply(x1, x2[, out]) 乘法 divide(x1, x2[, out]) 除法 power(x1, x2[, out]) 幂运算 subtract(x1, x2[, out]) 减法 true_divide(x1, x2[, out]) 真除法 / floor_divide(x1, x2[, out]) 向下取整除法 // fmod(x1, x2[, out]) 求余 mod(x1, x2[, out]) 求余,余数为正 modf(x[, out1, out2]) 分别返回整数和余数 remainder(x1, x2[, out]) 和mod相同

其他(Miscellaneous)

Function Describe convolve(a, v[, mode]) Returns the discrete, linear convolution of two one-dimensional sequences. clip(a, a_min, a_max[, out]) 求某一范围的值 sqrt(x[, out]) 开平方 cbrt(x[, out]) 开立方 square(x[, out]) 求平方 absolute(x[, out]) 绝对值 fabs(x[, out]) 绝对值 sign(x[, out]) 标记数字的正负零 maximum(x1, x2[, out]) 求最大值 minimum(x1, x2[, out]) 求最小值 fmax(x1, x2[, out]) 求最大值 fmin(x1, x2[, out]) 求最小值 nan_to_num(x) 替换空值 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, period]) One-dimensional linear interpolation.

Other special functions

Floating point routines

Handling complex numbers

0 0