Take a look at how the class MatAdd is implemented. Note that is isn't a trivial problem to solve, and there are still ongoing discussions on the best way to do it (see for instance https://github.com/sympy/sympy/pull/18769).
Aaron Meurer On Fri, Apr 3, 2020 at 3:30 PM Davide Sandona' <sandona.dav...@gmail.com> wrote: > > A few days ago I opened an issue requesting information about vector > expressions [1]. Thanks to covid lock-down I had enough free-time to develop > something. In the issue it was suggested that I could open a pull-request, > but before doing that I would like to solve a problem I'm having a hard time > comprehending. This is the link to the repo I'm working on [2]. > > The problem is with the class VecAdd; ideally, I would like it to subclass > the class Add, so that it would "simplify" the arguments. However, if I do > that, the evaluation of n-derivatives would return instances of the class Add! > I checked the output of _eval_derivative_n_times which is of type VecAdd, > however it must be intercepted by some other function and finally it returns > an instance of the class Add. I absolutely need it to return an instance of > VecAdd. > > Can someone help me understand what the problem is and suggest corrective > actions? > > Thanks! > > [1] https://github.com/sympy/sympy/issues/18987 > [2] https://github.com/Davide-sd/sympy_vector_expressions > > -- > 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 view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/1ab183ad-bfc6-474c-8b53-acb44946008d%40googlegroups.com. -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6LtJPGnX3L%2BGMgfKKK%2BPSi6Qygd_2BCUxO0xZ5XZnOKng%40mail.gmail.com.