Yes, that sounds like a reasonable change. On Fri, 10 Apr 2020 at 14:17, jlh <j...@gmx.ch> wrote: > > Hello everyone! > > I noticed that powers of non-square matrices (with MatPow) do not raise an > error, e.g. if A = MatrixSymbol('A', 2, 3) then MatPow(A, 10) does not raise. > I would assume that this is just an oversight, but then I see explicit unit > tests for MatPow(A, 1), which make me wonder if perhaps there is a reason > this is supported. However the behavior is not consistent, since A ** 1 does > raise an error anyway. But then again ZeroMatrix(2, 3) ** 1 does not raise. > > As far as I know most textbooks do not define A ** n at all for any value of > n when A is not square. This might also be of interest: > https://math.stackexchange.com/questions/101590/what-is-zero-power-of-a-non-square-matrix > > So question: Would it be an acceptable breaking change to completely forbid > powers of non-square matrices, including the barely useful MatPow(A, 0) and > MatPow(A, 1)? It doesn't seem to break any tests (other than test_matpow.py). > > Background: I plan to do some clean-up in the MatPow code to make it follow > the same convention used in other places, e.g. move the argument validation > from MatrixExpr.__pow__() to MatPow.__new__() and move some specialized code > from MatPow.doit() to the _eval_power() methods of respective sub-classes. > > Thanks! > > -- > 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/8b817360-def8-43c9-84a0-bfd59b3c6651%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/CAHVvXxS3try%3DYC14%3DnAto1%2B3j7P4qPuvAiS4CpSC2R8%2BeqSWWg%40mail.gmail.com.