numpy[3]

这篇博客详细介绍了NumPy中的数组运算,包括基本运算、三角函数、舍入、总和、乘积和差异。强调了逻辑运算的正确用法,推荐使用按位运算符而非Python的and和or关键字。还提到了Python内置函数如`max()`在数组运算中的性能问题,并对比了`maximum(a, b)`与`max(a, b)`的区别。此外,博客涵盖了掩码数组的使用和数组的读写操作,如`numpy.save`和`numpy.load`。" 109607001,9144357,jQuery 动画详解,"['jQuery', '前端开发', '动画效果', 'DOM操作']
摘要由CSDN通过智能技术生成

數組的運算

  • 基本運算
運算 對應函數
y = x1 + x2 add(x1, x2 [, y])
y = x1 - x2 subtract(x1, x2 [, y])
y = x1 * x2 multiply (x1, x2 [, y])
y = x1 / x2 divide (x1, x2 [, y]), 如果兩個陣列的元素為整數,那麼用整數除法
y = x1 / x2 true_divide(x1, x2 [, y]), 總是返回精確的商
y = x1 // x2 floor_divide (x1, x2 [, y]), 總是返回商值取整
y = -x negative(x [,y])
y = x1**x2 power(x1, x2 [, y])
y = x1 % x2 remainder(x1, x2 [, y]), mod(x1, x2, [, y])
數學運算
add(x1, x2, /[, out, where, casting, order, …]) 按元素添加參數。
subtract(x1, x2, /[, out, where, casting, …]) 從元素方面減去參數。
multiply(x1, x2, /[, out, where, casting, …]) 元素相乘的論證。
divide(x1, x2, /[, out, where, casting, …]) 以元素方式返回輸入的真正除法。
logaddexp(x1, x2, /[, out, where, casting, …]) 輸入的取冪之和的對數。
logaddexp2(x1, x2, /[, out, where, casting, …]) base-2中輸入的取冪之和的對數。
true_divide(x1, x2, /[, out, where, …]) 以元素方式返回輸入的真正除法。
floor_divide(x1, x2, /[, out, where, …]) 返回小於或等於輸入除法的最大整數。
negative(x, /[, out, where, casting, order, …]) 數字否定,元素方面。
positive(x, /[, out, where, casting, order, …]) 數字正面,元素方面。
power(x1, x2, /[, out, where, casting, …]) 第一個數組元素從第二個數組提升到冪,逐個元素。
remainder(x1, x2, /[, out, where, casting, …]) 返回除法元素的餘數。
mod(x1, x2, /[, out, where, casting, order, …]) 返回除法元素的餘數。
fmod(x1, x2, /[, out, where, casting, …]) 返回除法的元素餘數。
divmod(x1, x2[, out1, out2], / [, out, …]) 同時返回逐元素的商和余數。
absolute(x, /[, out, where, casting, order, …]) 逐個元素地計算絕對值。
fabs(x, /[, out, where, casting, order, …]) 以元素方式計算絕對值。
rint(x, /[, out, where, casting, order, …]) 將數組的元素舍入為最接近的整數。
sign(x, /[, out, where, casting, order, …]) 返回數字符號的元素指示。
heaviside(x1, x2, /[, out, where, casting, …]) 計算Heaviside階躍函數。
conj(x, /[, out, where, casting, order, …]) 以元素方式返回复共軛。
exp(x, /[, out, where, casting, order, …]) 計算輸入數組中所有元素的指數。
exp2(x, /[, out, where, casting, order, …]) 計算輸入數組中所有p的2 ** p。
log(x, /[, out, where, casting, order, …]) 自然對數,元素方面。
log2(x, /[, out, where, casting, order, …]) x的基數為2的對數。
log10(x, /[, out, where, casting, order, …]) 以元素方式返回輸入數組的基數10對數。
expm1(x, /[, out, where, casting, order, …]) 計算數組中的所有元素。exp(x) - 1
log1p(x, /[, out, where, casting, order, …]) 返回一個加上輸入數組的自然對數,逐個元素。
sqrt(x, /[, out, where, casting, order, …]) 以元素方式返回數組的非負平方根。
square(x, /[, out, where, casting, order, …]) 返回輸入的元素方塊。
cbrt(x, /[, out, where, casting, order, …]) 以元素方式返回數組的立方根。
reciprocal(x, /[, out, where, casting, …]) 以元素為單位返回參數的倒數。
gcd(x1, x2, /[, out, where, casting, order, …]) 返回|x1|和的最大公約數|x2|
lcm(x1, x2, /[, out, where, casting, order, …]) 返回|x1|和的最小公倍數|x2|
  • 三角函數
sin(x, /[, out, where, casting, order, …]) 三角正弦,元素。
cos(x, /[, out, where, casting, order, …]) 餘弦元素。
tan(x, /[, out, where, casting, order, …]) 計算切線元素。
arcsin(x, /[, out, where, casting, order, …]) 反正弦,元素。
arccos(x, /[, out, where, casting, order, …]) 三角反餘弦,元素方式。
arctan(x, /[, out, where, casting, order, …]) 三角反正切,逐元素。
arctan2(x1, x2, /[, out, where, casting, …]) x1/x2正確選擇象限的逐元素反正切。
hypot(x1, x2, /[, out, where, casting, …]) 給定直角三角形的“腿”,返回其斜邊。
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值