Comment #6 on issue 1577 by smichr: match doesn't put every wild as a key
http://code.google.com/p/sympy/issues/detail?id=1577

Regarding the comment that the replacement dictionary (if present) should allow the pattern to rebuild the expression is exactly the problem with the return dictionary
given in issue 1826:

d=oo
a, b, c, p = map(Wild, 'abcp')
r=d.match(a+b*c**p)
r
{c_: nan, a_: oo, p_: 1}
(a+b*c**p).subs(r)  <<<< it doesn't rebuild the expression
nan
r={a:oo,b:0,c:1,d:1} <<< this does
(a+b*c**p).subs(r)
oo

An approach like as_independent would be useful where, if and Add is being analyzed and there is not independent term you get a 0. And a Mul generates a 1. It seems to me that if a term doesn't match in a pattern then it should get a value that will
make it disappear: if only 'a' matches in an expression below, then

for a+b*c**p,  b=0 shuts off the other term
for a+c**p, c=0, p=1 shuts it off
for a*b**p, b=1 and p=0 tell you there was no power term


--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to sympy-iss...@googlegroups.com.
To unsubscribe from this group, send email to 
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to