There are probably little ways around these things, but nothing clean without dispatching in the core.
Aaron Meurer On Wed, Apr 9, 2014 at 2:20 AM, F. B. <[email protected]> wrote: > > > On Wednesday, April 9, 2014 1:36:56 AM UTC+2, Aaron Meurer wrote: >> >> Yes, exactly. In Python, __eq__ really means equality, and things like >> sets and lists will assume objects that return True with __eq__ can be >> interchanged with one another. SymPy follows this convention. If a == b, >> any SymPy algorithm might interchange a with b and consider it to be valid. >> >> Also take a read of https://github.com/sympy/sympy/wiki/Automatic- >> Simplification<https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fsympy%2Fsympy%2Fwiki%2FAutomatic-Simplification&sa=D&sntz=1&usg=AFQjCNE4HCl0rm_Ftr8RuRsznedmiHC99w>. >> It's best to allow different things ways of writing mathematically the same >> thing to be written down differently, and deal with them being >> mathematically equal in algorithms. >> >> > I also share the feeling that canonicalization upon construction is wrong, > especially as it is computationally expensive for tensors. TensAdd is > currently canonicalizing everything. > > I tried to make TensMul and TensAdd inherit Mul and Add, it looks great to > use all polynomial manipulation stuff with tensors, except that methods > inherited by Mul and Add completely ignore indices (this is bad). For > example, if TensMul inherits Mul, it is possible to use > tens_mul_instance.expand(), unfortunately the resulting expression is not a > TensAdd, it's an Add object. Is there any way to overcome this issue? > Tensor expressions should really be handled to some degree as polynomials. > > -- > 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/e9a07348-9bb1-48af-a93c-7e458bb5f0f2%40googlegroups.com<https://groups.google.com/d/msgid/sympy/e9a07348-9bb1-48af-a93c-7e458bb5f0f2%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- 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/CAKgW%3D6LAuK_8Ad0tQ9yOb%2BH017AKkh7BJ%2BdAfP9sS-D-u5XKyg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
