今天写python代码:
当用到math.log()函数值,总是出现如下错误:
TypeError: only length-1 arrays can be converted to Python scalars
原因:math.log()不能对矩阵进行直接操作。
经过测试,发现:
本文探讨了在使用Python的math.log()函数时遇到TypeError的问题,指出该函数不能直接应用于矩阵,并提供了解决方案。
今天写python代码:
当用到math.log()函数值,总是出现如下错误:
TypeError: only length-1 arrays can be converted to Python scalars
原因:math.log()不能对矩阵进行直接操作。
经过测试,发现: