On Fri, Apr 10, 2020 at 12:39 PM jlh <
j...@gmx.ch> wrote:
>
> On Friday, April 10, 2020 at 6:55:32 PM UTC+2, Aaron Meurer wrote:
>>
>> IMO A**1 does make sense, so I don't see any reason to disallow it. I
>> agree the others are just an oversight.
>
>
> Technically even A ** 0 makes sense, which would just return Identity(A.rows) (and funnily return a matrix of a different shape than the power's base).
Why rows and not columns though? I think A**0 should give an error.
>
> My reasoning for removing were:
> - It's not consistent: A ** 1 vs MatPow(A, 1)
> - Probably nobody relies on that behavior
> - Makes the code more complex for hardly any gain
Well I wouldn't be surprised if it breaks something somewhere if A**1
stops working, since something might assume that A**1 is always the
same as A. I guess you can try removing it and seeing what tests fail.
But to me, mathematically, A**1 does make sense, even if none of the
other powers do.
Aaron Meurer
>
> I can keep that behavior in if desired of course, but then it should at least be made consistent, which means it should work for A ** 1 as well as for Matrix([[1, 2]]) ** 1. And A ** 0 should work too.
>
>> That sounds good, but be aware that the design of things in the matrix
>> module is a bit different, in particular, the matrix expressions
>> remain completely unevaluated by default and only evaluate on doit().
>> Your redesign might not be affected by that, but it's worth noting
>> that just because something happens some way in the core, it shouldn't
>> necessarily happen the same way in the matrix expressions.
>
>
> Yeah I've seen they don't evaluate when constructed. They evaluate when calling doit(), which also happens when operators are used with those objects.
>
> --
> 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+un...@googlegroups.com.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/c697efff-ded3-4412-b727-a0fc69150e3b%40googlegroups.com.