• 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]
  • 相关阅读:
    :Netty中的Idle事件
    :Netty中的Idle事件
    大数据分析在石化企业的应用探讨
    全关联优化
    Java中的instanceof关键字
    Java中的instanceof关键字
    第七章 正则模式
    Rac sequence
    监控ping
    第六章 HASH
  • 原文地址:https://www.cnblogs.com/wjc920/p/9256148.html
Copyright © 2020-2023  润新知