2016-09-16 22 views
-2
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 
+1

請格式化你的代碼與代碼塊 – RPGillespie

+3

有什麼問題? – jadsq

回答

相關問題