On Jan 27, 2013, at 6:34 AM, "Alexey U. Gudchenko" <[email protected]> wrote:
> > Additionally to Stefan's answer about sympy core , I introduce the > example how it may be implemented concretely. > > There is the tested code in the atachment of it. > (I can create PR, but I don't know where will it be better to put in the > sympy modules) > > And there is the '__call__' magic-method used instead of the implicit > multiplication as aplly-like method. > >>>> Dx = DiffOperator(x) >>>> myD = (a*Dx + Dx**3) # construct diff operator >>>> myD(x**4) # apply this operator. > 4*a*x**3 + 24*x > > > For matrices it is some more complicated > >>>> I = Matrix([[0, -1], [1, 0]]) >>>> myD = I*Dx # construct diff >>>> myD(x**2) # apply > > Derivative([x**2, 0] > [ 0, x**2], x) > > > Here I don't know how Derivative can be automatically applied for the > Matrix expression. Well just as application of Dx isn't really multiplication, neither is application of the matrix operator. So a subclass of Matrix will be needed here. Aaron Meurer > > > -- > Alexey Gudchenko > > On 26.01.2013 02:49, ruoyu zhang wrote: >>>>> p = DifferentialOperator(t) >>>>> a * p * f(t) >> Derivative(f(t), t)*a >> >> p is a DifferentialOperator, when it multiply with some expression at >> right side, it calculates the derivative of the expression. >> > > -- > 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?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > <diff_operator.py> -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
