It depends if you want op(u) to also be usable in expressions. If you
do, the simplest way is to make op be a Function, and define __call__
on it so that it returns an object representing op(u)(x).
Defining that other object is the tricky part. I think something like
class AppliedOp(Expr):
def __new__(cls, op, x):
obj = Expr.__new__(cls, op, x)
return obj
@property
def func(self):
return self._args[0]
@property
def args(self):
return self._args[1:]
and op is
class op(Function):
def __call__(self, x):
return AppliedOp(self, x)
You'll also want to define some printing methods on AppliedOp so that
it prints as op(u)(x).
Aaron Meurer
> --
> 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+un...@googlegroups.com.
> To post to this group, send email to
sy...@googlegroups.com.
> Visit this group at
https://groups.google.com/group/sympy.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/sympy/aed8dedf-9b6c-468e-838a-ad56a659ddfe%40googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.