Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Arrays (Python)TypeError:只有整数标量数组才能转换为标量索引_Arrays_Python 3.x_List_Physics - Fatal编程技术网

Arrays (Python)TypeError:只有整数标量数组才能转换为标量索引

Arrays (Python)TypeError:只有整数标量数组才能转换为标量索引,arrays,python-3.x,list,physics,Arrays,Python 3.x,List,Physics,当我编译以下程序时,Python抛出一个TypeError:只有整数标量数组可以转换为标量索引 这似乎是一个相对简单的程序执行,但我似乎无法解决它 频率 设M==质量M_j的j==1到n之和。我希望程序简单地显示一个周期图,其中周期n由sqrtg*m_j/l_j*m的1到n之和定义。使用列表理解将周期函数应用于x数组中的每个条目,如下所示- y = np.array([period(i) for i in x]) 此外,还需要初始化dem和g- y = np.array([period(i)

当我编译以下程序时,Python抛出一个TypeError:只有整数标量数组可以转换为标量索引

这似乎是一个相对简单的程序执行,但我似乎无法解决它

频率


设M==质量M_j的j==1到n之和。我希望程序简单地显示一个周期图,其中周期n由sqrtg*m_j/l_j*m的1到n之和定义。使用列表理解将周期函数应用于x数组中的每个条目,如下所示-

y = np.array([period(i) for i in x])
此外,还需要初始化dem和g-

y = np.array([period(i) for i in x])
dem = 0.0
g = 9.8