from math import sin, cos, pi
import numpy as np
N=10
a=np.random.randint(0, 360+1, N)
print (a)
theta=a*pi/180
print(theta)
x=[cos(theta)]
print(x)
y=[sin(theta)]
print(y)
TypeError Traceback (most recent call last)
<ipython-input-47-632b45c2aba1> in <module>()
9 theta=a*pi/180
10 print(theta)
---> 11 x=[cos(theta)]
12 print(x)
13 y=[sin(theta)]
TypeError: only length-1 arrays can be converted to Python scalars
Aucun commentaire:
Enregistrer un commentaire