Aaron, what do you think if I try to write a PR introducing a matching map?

For example, something behaving like

>>> ri = MatcherMap()
>>> x = symbols('x')
>>> a = Wild('a', exclude=[x])
>>> b = Wild('b', exclude=[y])
>>> ri[a] = lambda a, x : a * x
>>> ri[cos(a + b*x)] = lambda a, b, x : sin(a + b*x)/b
>>> ri[cos(2)]
cos(2)*x
>>> ri[cos(2+3*x)]
sin(2+x)/3

>>> def f(a, x):
...     if a != -1:
...         return x**(a+1)/(a+1)
...     else:
...         return log(x)
>>> ri[x**a] = f

Writing it the unoptimized way wouldn't be that difficult.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to