Ask Your Question

Revision history [back]

You can use the apply_map method :

sage: v.apply_map(sign)
(1, 0, -1)

sage: m.apply_map(lambda x : x^2)
[ 1  4]
[ 9 16]