Status: Accepted
Owner: asmeurer
Labels: Type-Defect Priority-Medium Solvers
New issue 2074 by asmeurer: dsolve(diff(D(t), t) - k1*(B + C2*exp(-k*t) -
D(t)), D(t), 'nth_linear_constant_coeff_variation_of_parameters') gives
AttributeError: 'tuple' object has no attribute 'match'
http://code.google.com/p/sympy/issues/detail?id=2074
In [36]: var('t C2 k k1 B')
Out[36]: (t, C₂, k, k₁, B)
In [37]: D, R = map(Function, 'DR')
In [38]: dsolve(diff(D(t), t) - k1*(B + C2*exp(-k*t) - D(t)),
D(t), 'nth_linear_constant_coeff_variation_of_parameters')
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (327, 0))
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/Users/aaronmeurer/Documents/Python/sympy/sympy/<ipython console> in
<module>()
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/solvers/ode.pyc in
dsolve(eq, func, hint, simplify, **kwargs)
455 if simplify:
456 return odesimp(solvefunc(eq, func, order=hints['order'],
--> 457 match=hints[hint]), func, hints['order'], hint)
458 else:
459 # We still want to integrate (you can disable it separately
with the hint)
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/multidimensional.pyc
in
wrapper(*args, **kwargs)
133 result = apply_on_element(wrapper, args,
kwargs, n)
134 return result
--> 135 return f(*args, **kwargs)
136 wrapper.__doc__ = f.__doc__
137 wrapper.__name__ = f.__name__
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/solvers/ode.pyc in
odesimp(eq, func, order, hint)
894 # a simpler expression, but the solved expression could have
introduced
895 # things like -C1, so rerun constantsimp() one last time before
returning.
--> 896 eq = constant_renumber(constantsimp(eq, x, 2*order), 'C', 1,
2*order)
897
898 return eq
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/multidimensional.pyc
in
wrapper(*args, **kwargs)
133 result = apply_on_element(wrapper, args,
kwargs, n)
134 return result
--> 135 return f(*args, **kwargs)
136 wrapper.__doc__ = f.__doc__
137 wrapper.__name__ = f.__name__
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/solvers/ode.pyc in
constant_renumber(expr, symbolname, startnumber, endnumber)
1416
1417
-> 1418 return _constant_renumber(expr, symbolname, startnumber,
endnumber)
1419
1420
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/solvers/ode.pyc in
_constant_renumber(expr, symbolname, startnumber, endnumber)
1393 if isinstance(expr, Equality):
1394 return Eq(_constant_renumber(expr.lhs, symbolname,
startnumber, endnumber),
-> 1395 _constant_renumber(expr.rhs, symbolname, startnumber,
endnumber))
1396
1397 if type(expr) not in (Mul, Add, Pow) and not
expr.is_Function and\
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/solvers/ode.pyc in
_constant_renumber(expr, symbolname, startnumber, endnumber)
1413 sortedargs.sort(Basic._compare_pretty)
1414 return expr.new(*[_constant_renumber(x, symbolname,
startnumber,
-> 1415 endnumber) for x in sortedargs])
1416
1417
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/solvers/ode.pyc in
_constant_renumber(expr, symbolname, startnumber, endnumber)
1413 sortedargs.sort(Basic._compare_pretty)
1414 return expr.new(*[_constant_renumber(x, symbolname,
startnumber,
-> 1415 endnumber) for x in sortedargs])
1416
1417
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/solvers/ode.pyc in
_constant_renumber(expr, symbolname, startnumber, endnumber)
1413 sortedargs.sort(Basic._compare_pretty)
1414 return expr.new(*[_constant_renumber(x, symbolname,
startnumber,
-> 1415 endnumber) for x in sortedargs])
1416
1417
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/solvers/ode.pyc in
_constant_renumber(expr, symbolname, startnumber, endnumber)
1413 sortedargs.sort(Basic._compare_pretty)
1414 return expr.new(*[_constant_renumber(x, symbolname,
startnumber,
-> 1415 endnumber) for x in sortedargs])
1416
1417
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/solvers/ode.pyc in
_constant_renumber(expr, symbolname, startnumber, endnumber)
1413 sortedargs.sort(Basic._compare_pretty)
1414 return expr.new(*[_constant_renumber(x, symbolname,
startnumber,
-> 1415 endnumber) for x in sortedargs])
1416
1417
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/solvers/ode.pyc in
_constant_renumber(expr, symbolname, startnumber, endnumber)
1411 else:
1412 sortedargs = list(expr.args)
-> 1413 sortedargs.sort(Basic._compare_pretty)
1414 return expr.new(*[_constant_renumber(x, symbolname,
startnumber,
1415 endnumber) for x in sortedargs])
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/basic.pyc in
_compare_pretty(a, b)
273 from sympy.core.symbol import Wild
274 p1, p2, p3 = Wild("p1"), Wild("p2"), Wild("p3")
--> 275 r_a = a.match(p1 * p2**p3)
276 r_b = b.match(p1 * p2**p3)
277 if r_a is not None and r_b is not None:
AttributeError: 'tuple' object has no attribute 'match'
The error also occurs if you use the
nth_linear_constant_coeff_variation_of_parameters_Integral hint. This is
probably related to issue 2070.
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.