我正在尝试使用dsolve sympy函数解决一个非常简单的ODE:
from sympy import*
init_printing()
t = symbols('t', real = True)
A = symbols('A', complex = True)
f = Function('rho')(t)
dsolve(Derivative(f, t)+A*f, f)
但是,我得到了:
Traceback (most recent call last):
File "<ipython-input-9-3d1f21a5ef22>", line 1, in <module>
dsolve(Derivative(f, t)+A*f, f)
File "/home/ted/anaconda3/lib/python3.6/site-packages/sympy/solvers/ode.py", line 566, in dsolve
hints = _desolve(eq, func=func, hint=hint, simplify=True, xi=xi, eta=eta, type='ode', ics=ics, x0=x0, n=n, **kwargs)
File "/home/ted/anaconda3/lib/python3.6/site-packages/sympy/solvers/deutils.py", line 205, in _desolve
n=terms, x0=x0, prep=prep)
File "/home/ted/anaconda3/lib/python3.6/site-packages/sympy/solvers/ode.py", line 1251, in classify_ode
r = _nth_linear_match(reduced_eq, func, order)
File "/home/ted/anaconda3/lib/python3.6/site-packages/sympy/solvers/ode.py", line 3723, in _nth_linear_match
terms[f.derivative_count] += c
AttributeError: 'Derivative' object has no attribute 'derivative_count'
sympy版本为1.1.1,python版本为3.6.4,ipython版本为6.2.1。
答案 0 :(得分:1)
我的坏!我尝试使用当前开发版本中的一个文件(ode.py)而不更新其余文件。现在我有了它的工作。谢谢!