16.Numpy之函数运算

#NumPy之 函数运算
import numpy as np

#math calculations

print('math calculations for array:')
a=np.array([0,1,2,3])
b=np.array([2,-1,2,3])
print(np.exp(a))
print(np.sqrt(a))
print(np.add(a,b))
# output:
# [  1.           2.71828183   7.3890561   20.08553692]
# [ 0.          1.          1.41421356  1.73205081]
# [2 0 4 6]
c=np.linspace(0,8,20)
print('c:')
print(c)
# c:
# [ 0.          0.42105263  0.84210526  1.26315789  1.68421053  2.10526316
#   2.52631579  2.94736842  3.36842105  3.78947368  4.21052632  4.63157895
#   5.05263158  5.47368421  5.89473684  6.31578947  6.73684211  7.15789474
#   7.57894737  8.        ]
print('sin(c):')
print(np.sin(c))
# sin(c):
# [ 0.          0.40872137  0.74604665  0.95305133  0.9935755   0.86054034
#   0.57718464  0.19300541 -0.2248883  -0.60349817 -0.87668803 -0.99673665
#  -0.94267373 -0.72394309 -0.37875293  0.03259839  0.43825537  0.76735722
#   0.96241589  0.98935825]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值