我正在尝试运行这个python脚本,但它给了我与sympy相关的错误

时间:2017-05-31 19:32:41

标签: python python-2.7 sympy

您好我正在尝试使用python运行此代码我已经安装了所需的模块但它给了我这个输出:

    Traceback (most recent call last):
  File "sweep.py", line 62, in <module>
    Bb_all = zeros((3,0))
  File "C:\Python27\lib\site-packages\sympy\matrices\dense.py", line 1260, in ze
ros
    return cls.zeros(r, c)
  File "C:\Python27\lib\site-packages\sympy\matrices\dense.py", line 521, in zer
os
    r = as_int(r)
  File "C:\Python27\lib\site-packages\sympy\core\compatibility.py", line 406, in
 as_int
    raise ValueError('%s is not an integer' % n)
TypeError: not all arguments converted during string formatting

代码的Github:https://github.com/kai5z/Chladni-patterns

1 个答案:

答案 0 :(得分:1)

我认为你的问题出在以下几个方面:

Bb_all = zeros((3,0)) # line 62
Bs_all = zeros((2,0))

Sympy documentation说:

  

sympy.matrices.dense.zeros(r,c =无,cls =无)[来源]

     

返回一个带有r行和c列的零矩阵;如果省略c,则返回方阵。

所以删除()它应该有效(有多个实例将元组参数传递给zeros - &gt; zeros(3,0)所以请务必将其全部修复)