I have this array named a of 1242 numbers. I need to get the cosine value for all the numbers in Python.
When I use : cos_ra = math.cos(a) I get an error stating:
TypeError: only length-1 arrays can be converted to Python scalars
How can I solve this problem??
Thanks in advance
numpy.math.cos, usenumpy.cos.math.cosisn't vectorized, butnp.cosis. (Also, better for performance since only one function call overhead)