In my opinion it's not very mathematical. If we implement powers for vectors like this (and products, too, as some of these other packages do), then for consistency, perhaps products and powers of matrices should behave the same way? Ordinary matrix multiplication is much more common in mathematics than element-wise multiplication, and I think it would be awkward to have a separate operation for ordinary matrix multiplication. Anyway, it is easy to accomplish the same task:
sage: v = vector([1,2,3]) sage: vector([a**2 for a in v]) (1, 4, 9) or sage: v.apply_map(lambda x: x^2) (1, 4, 9) On Saturday, June 11, 2022 at 11:09:45 AM 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]) > > octave: > octave:1> [1,2,3].^2 > ans = 1 4 9 > > mathematica: > In[1]:= {1,2,3}^2 > Out[1]= {1, 4, 9} > > Is there a reason this is not the way sage also implements it? > > -- 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/57da3365-efad-43e0-a054-396e811e50cen%40googlegroups.com.