一、数学运算
函数名 | description | 说明 |
---|---|---|
add(x1, x2, [, out, where, casting, order, …]) | Add arguments element-wise. | 按元素添加参数。 |
subtract(x1, x2, [, out, where, casting, …]) | Subtract arguments, element-wise. | 从元素角度减去参数。 |
multiply(x1, x2, [, out, where, casting, …]) | Multiply arguments element-wise. | 将参数逐元素相乘。 |
matmul(x1, x2, [, out, casting, order, …]) | Matrix product of two arrays. | 两个数组的矩阵乘积。 |
divide(x1, x2, [, out, where, casting, …]) | Returns a true division of the inputs, element-wise. | 以元素为单位返回输入的真实除法。 |
logaddexp(x1, x2, [, out, where, casting, …]) | Logarithm of the sum of exponentiations of the inputs. | 输入取幂之和的对数。 |
logaddexp2(x1, x2, [, out, where, casting, …]) | Logarithm of the sum of exponentiations of the inputs in base-2. | 以2为底的输入的幂和的对数。 |
true_divide(x1, x2, [, out, where, …]) | Returns a true division of the inputs, element-wise. | 以元素为单位返回输入的真实除法。 |
floor_divide(x1, x2, [, out, where, …]) | Return the largest integer smaller or equal to the division of the inputs. | 返回小于或等于输入除法的最大整数。 |
negative(x, [, out, where, casting, order, …]) | Numerical negative, element-wise. | 数值为负数,逐元素。 |
positive(x, [, out, where, casting, order, …]) | Numerical positive, element-wise. | 数值正数,逐元素。 |
power(x1, x2, [, out, where, casting, …]) | First array elements raised to powers from second array, element-wise. | 第一个数组元素在元素方面从第二个数组提升为幂。 |
float_power(x1, x2, [, out, where, …]) | First array elements raised to powers from second array, element-wise. | 第一个数组元素在元素方面从第二个数组提升为幂。 |
remainder(x1, x2, [, out, where, casting, …]) | Return element-wise remainder of division. | 返回元素的除法余数。 |
mod(x1, x2, [, out, where, casting, order, …]) | Return element-wise remainder of division. | 返回元素的除法余数。 |
fmod(x1, x2, [, out, where, casting, …]) | Return the element-wise remainder of division. | 返回元素的除法余数。 |
divmod(x1, x2[, out1, out2], [, out, …]) | Return element-wise quotient and remainder simultaneously. | 同时返回元素商和余数。 |
absolute(x, [, out, where, casting, order, …]) | Calculate the absolute value element-wise. | 按元素计算绝对值。 |
fabs(x, [, out, where, casting, order, …]) | Compute the absolute values element-wise. | 按元素计算绝对值。 |
rint(x, [, out, where, casting, order, …]) | Round elements of the array to the nearest integer. | 将数组的元素四舍五入到最接近的整数。 |
sign(x, [, out, where, casting, order, …]) | Returns an element-wise indication of the sign of a number. | 返回数字符号的逐元素指示。 |
heaviside(x1, x2, [, out, where, casting, …]) | Compute the Heaviside step function. | 计算Heaviside阶跃函数。 |
conj(x, [, out, where, casting, order, …]) | Return the complex conjugate, element-wise. | 逐元素返回复共轭。 |
conjugate(x, [, out, where, casting, …]) | Return the complex conjugate, element-wise. | 逐元素返回复共轭。 |
exp(x, [, out, where, casting, order, …]) | Calculate the exponential of all elements in the input array. | 计算输入数组中所有元素的指数。 |
exp2(x, [, out, where, casting, order, …]) | Calculate 2**p for all p in the input array. | 为输入数组中的所有p计算2 ** p。 |
log(x, [, out, where, casting, order, …]) | Natural logarithm, element-wise. | 自然对数,逐元素。 |
log2(x, [, out, where, casting, order, …]) | Base-2 logarithm of x. | x的以2为底的对数。 |
log10(x, [, out, where, casting, order, …]) | Return the base 10 logarithm of the input array, element-wise. | 以元素为单位返回输入数组的以10为底的对数。 |
expm1(x, [, out, where, casting, order, …]) | Calculate exp(x) - 1 for all elements in the array. | 为数组中的所有元素计算exp(x)-1。 |
log1p(x, [, out, where, casting, order, …]) | Return the natural logarithm of one plus the input array, element-wise. | 返回元素加一个输入数组的自然对数。 |
sqrt(x, [, out, where, casting, order, …]) | Return the non-negative square-root of an array, element-wise. | 以元素为单位返回数组的非负平方根。 |
square(x, [, out, where, casting, order, …]) | Return the element-wise square of the input. | 返回输入的元素方平方。 |
cbrt(x, [, out, where, casting, order, …]) | Return the cube-root of an array, element-wise. | 返回元素的数组的立方根。 |
reciprocal(x, [, out, where, casting, …]) | Return the reciprocal of the argument, element-wise. | 以元素为单位返回参数的倒数。 |
gcd(x1, x2, [, out, where, casting, order, …]) | Returns the greatest common divisor of |x1| and |x2| | 返回| x1 |的最大公约数。和| x2 | |
lcm(x1, x2, [, out, where, casting, order, …]) | Returns the lowest common multiple of |x1| and |x2| | 返回| x1 |的最小公倍数和| x2 | |
二、三角函数
函数名 | description | 说明 |
---|---|---|
sin(x, [, out, where, casting, order, …]) | Trigonometric sine, element-wise. | 三角正弦,元素方式。 |
cos(x, [, out, where, casting, order, …]) | Cosine element-wise. | 余弦元素。 |
tan(x, [, out, where, casting, order, …]) | Compute tangent element-wise. | 按元素计算切线。 |
arcsin(x, [, out, where, casting, order, …]) | Inverse sine, element-wise. | 按元素反正弦。 |
arccos(x, [, out, where, casting, order, …]) | Trigonometric inverse cosine, element-wise. | 三角反余弦,元素方式。 |
arctan(x, [, out, where, casting, order, …]) | Trigonometric inverse tangent, element-wise. | 三角逆切线,元素方向。 |
arctan2(x1, x2, [, out, where, casting, …]) | Element-wise arc tangent of x1/x2 choosing the quadrant correctly. | 正确选择象限的x1 / x2的逐元素反正切。 |
hypot(x1, x2, [, out, where, casting, …]) | Given the “legs” of a right triangle, return its hypotenuse. | 给定直角三角形的“腿”,返回其斜边。 |
sinh(x, [, out, where, casting, order, …]) | Hyperbolic sine, element-wise. | 双曲正弦,逐元素。 |
cosh(x, [, out, where, casting, order, …]) | Hyperbolic cosine, element-wise. | 双曲余弦,元素方式。 |
tanh(x, [, out, where, casting, order, …]) | Compute hyperbolic tangent element-wise. | 计算双曲正切元素。 |
arcsinh(x, [, out, where, casting, order, …]) | Inverse hyperbolic sine element-wise. | 反双曲正弦元素。 |
arccosh(x, [, out, where, casting, order, …]) | Inverse hyperbolic cosine, element-wise. | 反双曲余弦,逐元素。 |
arctanh(x, [, out, where, casting, order, …]) | Inverse hyperbolic tangent element-wise. | 反双曲正切元素明智。 |
degrees(x, [, out, where, casting, order, …]) | Convert angles from radians to degrees. | 将角度从弧度转换为度。 |
radians(x, [, out, where, casting, order, …]) | Convert angles from degrees to radians. | 将角度从度转换为弧度。 |
deg2rad(x, [, out, where, casting, order, …]) | Convert angles from degrees to radians. | 将角度从度转换为弧度。 |
rad2deg(x, [, out, where, casting, order, …]) | Convert angles from radians to degrees. | 将角度从弧度转换为度。 |
三、位操作
函数名 | description | 说明 |
---|---|---|
bitwise_and(x1, x2, [, out, where, …]) | Compute the bit-wise AND of two arrays element-wise. | 按元素计算两个数组的按位与。 |
bitwise_or(x1, x2, [, out, where, casting, …]) | Compute the bit-wise OR of two arrays element-wise. | 按元素计算两个数组的按位或。 |
bitwise_xor(x1, x2, [, out, where, …]) | Compute the bit-wise XOR of two arrays element-wise. | 按元素计算两个数组的按位XOR。 |
invert(x, [, out, where, casting, order, …]) | Compute bit-wise inversion, or bit-wise NOT, element-wise. | 按元素计算按位求反,或按位求非。 |
left_shift(x1, x2, [, out, where, casting, …]) | Shift the bits of an integer to the left. | 向左移动整数的位。 |
right_shift(x1, x2, [, out, where, …]) | Shift the bits of an integer to the right. | 向右移整数的位。 |
四、比较函数
函数名 | description | 说明 |
---|---|---|
greater(x1, x2, [, out, where, casting, …]) | Return the truth value of (x1 > x2) element-wise. | 按元素返回(x1> x2)的真值。 |
greater_equal(x1, x2, [, out, where, …]) | Return the truth value of (x1 >= x2) element-wise. | 逐元素返回(x1> = x2)的真值。 |
less(x1, x2, [, out, where, casting, …]) | Return the truth value of (x1 < x2) element-wise. | 按元素返回(x1 <x2)的真值。 |
less_equal(x1, x2, [, out, where, casting, …]) | Return the truth value of (x1 =< x2) element-wise. | 逐元素返回(x1 = <x2)的真值。 |
not_equal(x1, x2, [, out, where, casting, …]) | Return (x1 != x2) element-wise. | 按元素返回(x1!= x2)。 |
equal(x1, x2, [, out, where, casting, …]) | Return (x1 == x2) element-wise. | 按元素返回(x1 == x2)。 |
logical_and(x1, x2, [, out, where, …]) | Compute the truth value of x1 AND x2 element-wise. | 按元素计算x1和x2的真值。 |
logical_or(x1, x2, [, out, where, casting, …]) | Compute the truth value of x1 OR x2 element-wise. | 按元素计算x1或x2的真值。 |
logical_xor(x1, x2, [, out, where, …]) | Compute the truth value of x1 XOR x2, element-wise. | 按元素计算x1 XOR x2的真值。 |
logical_not(x, [, out, where, casting, …]) | Compute the truth value of NOT x element-wise. | 按元素计算NOT x的真值。 |
maximum(x1, x2, [, out, where, casting, …]) | Element-wise maximum of array elements. | 数组元素的逐元素最大值。 |
minimum(x1, x2, [, out, where, casting, …]) | Element-wise minimum of array elements. | 数组元素的按元素最小值。 |
fmax(x1, x2, [, out, where, casting, …]) | Element-wise maximum of array elements. | 数组元素的逐元素最大值。 |
fmin(x1, x2, [, out, where, casting, …]) | Element-wise minimum of array elements. | 数组元素的按元素最小值。 |
五、其它函数
函数名 | description | 说明 |
---|---|---|
isfinite(x, [, out, where, casting, order, …]) | Test element-wise for finiteness (not infinity or not Not a Number). | 逐一测试有限性(不是无穷大还是不是数字)。 |
isinf(x, [, out, where, casting, order, …]) | Test element-wise for positive or negative infinity. | 逐元素测试正无穷大或负无穷大。 |
isnan(x, [, out, where, casting, order, …]) | Test element-wise for NaN and return result as a boolean array. | 对NaN逐个元素进行测试,并以布尔数组返回结果。 |
isnat(x, [, out, where, casting, order, …]) | Test element-wise for NaT (not a time) and return result as a boolean array. | 对NaT(不是时间)逐个元素进行测试,并将结果作为布尔数组返回。 |
fabs(x, [, out, where, casting, order, …]) | Compute the absolute values element-wise. | 按元素计算绝对值。 |
signbit(x, [, out, where, casting, order, …]) | Returns element-wise True where signbit is set (less than zero). | 返回设置有符号位(小于零)的元素级True。 |
copysign(x1, x2, [, out, where, casting, …]) | Change the sign of x1 to that of x2, element-wise. | 逐元素地将x1的符号更改为x2的符号。 |
nextafter(x1, x2, [, out, where, casting, …]) | Return the next floating-point value after x1 towards x2, element-wise. | 将x1之后的下一个浮点值向x2逐元素返回。 |
spacing(x, [, out, where, casting, order, …]) | Return the distance between x and the nearest adjacent number. | 返回x与最接近的相邻数字之间的距离。 |
modf(x[, out1, out2], [, out, where, …]) | Return the fractional and integral parts of an array, element-wise. | 以元素为单位返回数组的小数和整数部分。 |
ldexp(x1, x2, [, out, where, casting, …]) | Returns x1 * 2**x2, element-wise. | 按元素返回x1 * 2 ** x2。 |
frexp(x[, out1, out2], [, out, where, …]) | Decompose the elements of x into mantissa and twos exponent. | 将x的元素分解为尾数和二进制指数。 |
fmod(x1, x2, [, out, where, casting, …]) | Return the element-wise remainder of division. | 返回元素的除法余数。 |
floor(x, [, out, where, casting, order, …]) | Return the floor of the input, element-wise. | 以元素为单位返回输入的底限。 |
ceil(x, [, out, where, casting, order, …]) | Return the ceiling of the input, element-wise. | 以元素为单位返回输入的上限。 |
trunc(x, [, out, where, casting, order, …]) | Return the truncated value of the input, element-wise. | 以元素为单位返回输入的截断值。 |