手机
当前位置:查字典教程网 >脚本专栏 >python >Python计算三维矢量幅度的方法
Python计算三维矢量幅度的方法
摘要:本文实例讲述了Python计算三维矢量幅度的方法。分享给大家供大家参考。具体如下:fromnumpyimport*frommathimpor...

本文实例讲述了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程序设计有所帮助。

【Python计算三维矢量幅度的方法】相关文章:

python每次处理固定个数的字符的方法总结

python逐行读取文件内容的三种方法

python实现问号表达式(?)的方法

Python中字典(dict)和列表(list)的排序方法实例

python 测试实现方法

python中精确输出JSON浮点数的方法

python中的sort方法使用详解

python 动态获取当前运行的类名和函数名的方法

python字典多条件排序方法实例

Python实现扫描指定目录下的子目录及文件的方法

精品推荐
分类导航