V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
meteor2013
V2EX  ›  Python

请问 python 里面有没一个函数或者方法可以直接计算一组向量的合向量?

  •  
  •   meteor2013 · 2016-06-23 00:54:33 +08:00 · 3005 次点击
    这是一个创建于 2872 天前的主题,其中的信息可能已经有所发展或是发生改变。
    6 条回复    2016-08-01 13:13:50 +08:00
    pimin
        1
    pimin  
       2016-06-23 01:17:59 +08:00
    NumPy
    debiann
        2
    debiann  
       2016-06-23 01:21:51 +08:00 via iPhone
    Geoion
        3
    Geoion  
       2016-06-23 01:21:58 +08:00 via Android
    做数学怎么能不知道 scipy 呢?
    practicer
        4
    practicer  
       2016-06-23 08:14:05 +08:00
    import numpy as np

    >>> np.sum([[0, 1], [0, 5]])
    6
    jinxueliu
        5
    jinxueliu  
       2016-06-24 13:49:03 +08:00
    向量的计算还是用 Numpy 吧
    necomancer
        6
    necomancer  
       2016-08-01 13:13:50 +08:00
    In [1]: import numpy as np

    In [2]: a = array([[1,2,3],[2,2,3]])
    ...:

    In [3]: np.sum(a, axis = 0)
    Out[3]: array([3, 4, 6])
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2379 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 10:05 · PVG 18:05 · LAX 03:05 · JFK 06:05
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.