Ask Your Question

apromixately's profile - activity

2021-12-22 08:27:08 +0100 received badge  Supporter (source)
2021-12-22 08:27:02 +0100 marked best answer How do I do map/element-wise operations?

I am looking for a way to apply a function to every element of a vector or matrix.

v = vector([2, 0, -3])
print(v)
w = sign(v)
print(w) # I want (1, 0, -1)

m = matrix([[1, 2], [3, 4]])
m = m**2
print(m) # I want [1, 4] [9, 16]

How does this work?

2021-12-22 08:27:02 +0100 received badge  Scholar (source)
2021-12-18 22:32:45 +0100 received badge  Student (source)
2021-12-18 22:31:18 +0100 asked a question How do I do map/element-wise operations?

How do I do map/element-wise operations? I am looking for a way to apply a function to every element of a vector or matr