Skip to content Skip to main navigation Skip to footer

Python中计算三维矢量幅度的方法

Python中计算三维矢量幅度是如何来实现的呢?下面的内容将会通过具体的实例来演示Python中计算三维矢量幅度的实现方法及相关技巧:

本文实例讲述了Python计算三维矢量幅度的方法。分享给大家供大家参考。具体如下:

from numpy import *
from math import *
a=(['x','y','z'])
sum_com=0
for i in range(3):
  y=input("Enter %s component:"%a[i])
  m=y**2
  sum_com += m
magnitude=sqrt(sum_com)
print "The magnitude of vector is %s"%magnitude
 


Python中计算三维矢量幅度就是这样,欢迎大家参考。。。。

0 Comments

There are no comments yet

Leave a comment

Your email address will not be published.