Updates:
        Cc: asmeurer Vinzent.Steinberg
        Labels: NeedsReview

Comment #12 on issue 666 by smichr: sorting of expressions makes subs_dict() fail
http://code.google.com/p/sympy/issues/detail?id=666

branch ops at github/smichr proposes a fix for the dilemma of comment 7 which ensures that longer patterns will always be found before shorter patterns. An upgrade to allow static substitutions was also added, but otherwise as little as possible was done to the current structure of subs.

(x**y)({x:y, y:x}, static=1) # no longer either x**x nor y**y
y**x

The example from comment 7 now gives:
ff = exp(x) + exp(-x+x*y)
a=exp(x)
b=exp(-x+x*y)
A,B=symbols('AB')
ff.subs([(a,A), (b,B)])
A + exp(x*y)/A
ff.subs([(b,B), (a,A)])
A + B
ff.subs(dict([(b,B), (a,A)])) # properly sorted now
A + B

There is one puzzling test in tsolve that is failing. If someone could take a look that would be helpful. I don't see why the answer is not seen in the list.

--
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.

Reply via email to