# How to perform trig functions on a vector element-wise?

I'd like to get the cosine of all elements in a Vector in Blender's python. Should I just use numpy for this?

Edit: I was tired when I wrote this and kind of mis-posed the question. What I actually meant was that I have a list of all the blender Vectors containing x, y, and z, and I want to do things like calculate the cosine of each x. But this answer does a good job of addressing the question that I actually wrote and it put me on the road to solving the problem I was trying to solve so I'm accepting it.

• not quite sure of the vector class in blender. If it were a list you could use the map function Apr 12 '16 at 6:59

new_vector = Vector(map(lambda x: sin(x), list(vector_variable)))

new_vector = Vector(sin(x) for x in vector_variable)