Status: Valid
Owner: ----
Labels: Type-Defect Priority-Low
New issue 3316 by [email protected]: Expr.expand: the result depends on
the order in which hints are traversed.
http://code.google.com/p/sympy/issues/detail?id=3316
Expr.expand invokes the corresponding _eval_expand_* methods
consecutively. This yields different results depending on the order in
which _eval_expand_* are invoked. For an example, consider the following
tests from test_complex.py:
exp(I*x+y).expand(complex=True) == exp(y)*cos(x)+I*sin(x)*exp(y)
expand would produce either exp(y)*(cos(x) + I*sin(x)) or
exp(y)*cos(x)+I*sin(x)*exp(y) depending on the order the hints are
traversed. Obviously, the two results are the same in sense that they
simplify to the same expression; however, they are different as expressions.
The current workaround is to sort the hints in Expr.expand, which fixes the
order in which the _eval_expand_* methods are invoked. I believe this
solution may safely live in SymPy for quite some time. However, a better
approach should eventually be adopted.
--
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.