Add operation

54 views
Skip to first unread message

Henrique Miguel Cortes Soares

unread,
May 22, 2024, 12:12:20 PMMay 22
to sympy
Why does type(Add(A, B)), where A and B are MatrixSymbols, return MatAdd but type(Add(Sys.i, Sys.j)), where Sys.i, Sys.j are BaseVectors, return Add and not VectorAdd?
Doing type(Sys.i + Sys.j) also returns VectorAdd

Sangyub Lee

unread,
May 30, 2024, 8:57:37 AMMay 30
to sympy
I think that this question is quite technical, but I may take a chance to answer this

I think that you may try to fix this by adding constructor_postprocessor_mapping to corresponding vector module, as done by matrix

https://github.com/sympy/sympy/blob/8c94201570737a2fc3ef8e9cc53bed01a44e8281/sympy/matrices/expressions/matexpr.py#L525-L528

However, I'd note that constructor_postprocessor_mapping is already commented to be 'experimental' from the author,
and if the issue cannot be fixed with the simple change like this
(SymPy community have historical experiences that lots of tests can fail for making small changes, for example)
we may be better not involved in pushing this changes.
Reply all
Reply to author
Forward
0 new messages