While checking SymPy wiki's tutorial about pattern
matching<http://wiki.sympy.org/wiki/Tutorial#Pattern_matching>,
I ended up with the following:

>>> from sympy import *
>>> x = Symbol('x')
>>> p = Wild('p')
>>> q = Wild('q')
>>> (5*x**2 + 3*x).match(p*x**2 + q*x)

I got the following result,
{q_: 5*x, p_: 3/x}

while result presented in wiki is
{p_: 5, q_: 3}

I can get the second result by defining

>>> p = Wild('p', exclude='x')
>>> q = Wild('q', exclude='x')

but shouldn't SymPy return that "natural" result by default? (Nevertheless,
I don't know how to define which answer would be the "natural" one in a
general case.)


Roberto.

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

Reply via email to