On Thursday, April 3, 2014 5:04:36 PM UTC+2, Aaron Meurer wrote:
>
> Some people on this list might be interested in this
> https://github.com/ContinuumIO/pyalge.
>
Indeed, that can be very powerful to symbolic math.
I don't really like their style of putting the string of the expression
inside the dispatching decorator, but otherwise you can't easily freeze
expressions to an unevaluated state in Python. That's a point in favor of
Julia.
In any case, in SymPy there are wildcards types, so a possible solution:
x = symbols('x')
w = Wild('w')
@patterndispatch(sin(w*x), assumptions=Q.positive(w))
def foo(a):
a**2
@patterndispatch(sin(w*x))
def foo(a):
a**3
# there should be a mechanism that understands which one is more specific.
foo(sin(3*x)) # ==> sin(3*x)**2
foo(sin(-2*x)) # ==> sin(3*x)**3
What do you think about this approach?
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/76c5493f-d6c4-49d6-b3c1-063b16245816%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.