math庫的操作對象只能是標量

今天寫Python代碼: 當用到  math.exp(-x) 函數值時,出現如下錯誤: TypeError: only length-1 arrays can be converted to python scalars 用到math.log()函數值,也會出現以上錯誤。 錯誤原因:math庫的操作對象只能是標量(單個數),不能是list,array, matrix等,當對這些進行操作時都會出現錯
相關文章
相關標籤/搜索