Status: Valid
Owner: ----
Labels: Type-Defect Priority-Medium Solvers NeedsReview
New issue 3375 by asmeu...@gmail.com: rsolve fails on empty conditions
http://code.google.com/p/sympy/issues/detail?id=3375
This was originally https://github.com/sympy/sympy/issues/1511.
The rsolve routine returns an error when passed an empty dictionary or list
for the initial conditions. For Example:
In [1]: from sympy import Function, rsolve
In [2]: from sympy.abc import n
In [3]: y = Function('y')
In [4]: f = (n-1)*y(n+2) - (n**2+3*n-2)*y(n+1) + 2*n*(n+1)*y(n)
In [5]: rsolve(f, y(n))
Out[5]: 2**n*C1 + C0*n!
In [6]: rsolve(f, y(n), {})
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-6-0c2500fb118d> in <module>()
----> 1 rsolve(f, y(n), {})
/usr/lib/python2.7/site-packages/sympy/solvers/recurr.pyc in rsolve(f, y,
init)
756 return None
757 else:
--> 758 for k, v in result.iteritems():
759 solution = solution.subs(k, v)
760
AttributeError: 'list' object has no attribute 'iteritems'
In [7]: rsolve(f, y(n), [])
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-7-3eed95bd2d17> in <module>()
----> 1 rsolve(f, y(n), [])
/usr/lib/python2.7/site-packages/sympy/solvers/recurr.pyc in rsolve(f, y,
init)
756 return None
757 else:
--> 758 for k, v in result.iteritems():
759 solution = solution.subs(k, v)
760
AttributeError: 'list' object has no attribute 'iteritems'
A fix is at https://github.com/sympy/sympy/pull/1512.
--
You received this message because you are subscribed to the Google Groups
"sympy-patches" group.
To post to this group, send email to sympy-patches@googlegroups.com.
To unsubscribe from this group, send email to
sympy-patches+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.