On Saturday, 11 June 2022 at 11:09:45 UTC-7 erent...@gmail.com wrote: > sage -c "vector([1,2,3])^2" returns with a NotImplementedError, when in > other mathematics software, the same expression will operate element-wise. > > python: > >>> import numpy; numpy.array([1,2,3])**2 > array([1, 4, 9]) > > This perhaps illustrates it best: numpy.matrix([1,2,3])**2 doesn't work either. A sage "vector" is a lot more like a 1-dimensional matrix, where multiplication is reserved for ... matrix multiplication! Since exponentiation is strongly tied to iterated multiplication, you end up only being able to take a power of a square matrix.
If you want array semantics, use arrays (there multiplication is element-wise, so element-wise exponentiation makes sense as well). -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/452f71e2-c58a-401c-9021-a2852ecc91d5n%40googlegroups.com.