小编nat*_*son的帖子

SymPy无法解决Matlab可以解决的等式

我有一个与轨道力学中的太阳同步共振条件有关的方程.我目前正在学习Python,所以我尝试使用以下代码在SymPy中解决它:

from sympy import symbols,solve

[n_,Re_,p_,i_,J2_,Pe_] = symbols(['n_','Re_','p_','i_','J2_','Pe_'])

del_ss = -((3*n_*(Re_**2)*J2_/(4*(p_**2)))*(4-5*(sin(i_)**2)))-((3*n_*(Re_**2)*J2_/(2*(p_**2)))*cos(i_))-((2*pi)/Pe_)

pprint(solve(del_ss,i_))
Run Code Online (Sandbox Code Playgroud)

可以为五个变量成功重新排列表达式,但是当i_solve命令中使用变量时(如上所述),会产生错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 479, in runfile
    execfile(filename, namespace)
  File "C:\Users\Nathan\Python\sympy_test_1.py", line 22, in <module>
    pprint(solve(del_ss,i_))
  File "C:\Python27\lib\site-packages\sympy\solvers\solvers.py", line 484, in solve
    solution = _solve(f, *symbols, **flags)
  File "C:\Python27\lib\site-packages\sympy\solvers\solvers.py", line 700, in _solve
    soln = tsolve(f_num, symbol)
  File "C:\Python27\lib\site-packages\sympy\solvers\solvers.py", line 1143, in tsolve
    "(tsolve: at least one Function expected at this point")
NotImplementedError: …
Run Code Online (Sandbox Code Playgroud)

python sympy

9
推荐指数
1
解决办法
1638
查看次数

mlabwrap设置查询

我碰巧偶然发现了用户brentlance发布的关于Matlab与Python链接的答案,并且想知道我是否可以向社群询问有关mlabwrap模块初始设置的一些建议.

我使用的是Windows 7 32位,使用Matlab R2012a和Python 2.7(来自Python(x,y)科学计算软件包).当我尝试运行时:

python setup.py install
Run Code Online (Sandbox Code Playgroud)

在malbwrap目录中,控制台返回一个非常大的错误,如下所示:

WINDOWS SPECIFIC ISSUE? Unable to remove c:\users\nathan\appdata\local\temp\tmpv
tzipc; please delete it manually
[Error 32] The process cannot access the file because it is being used by anothe
r process: 'c:\\users\\nathan\\appdata\\local\\temp\\tmpvtzipc'

running install
running build
running build_py
running build_ext
building 'mlabraw' extension
Traceback (most recent call last):
  File "setup.py", line 189, in <module>
    extra_compile_args=EXTRA_COMPILE_ARGS,
  File "C:\Python27\lib\distutils\core.py", line 152, in setup
    dist.run_commands()
  File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands …
Run Code Online (Sandbox Code Playgroud)

python matlab mlabwrap

9
推荐指数
0
解决办法
765
查看次数

标签 统计

python ×2

matlab ×1

mlabwrap ×1

sympy ×1