【Python问题】contains an element of the set of generators.

问题描述

求积分时如下

print(float(integrate(sympy.log(x, math.e), (x, a, b))))

报错:
contains an element of the set of generators.'

解决办法

在函数表达式前添加nsimplify,如下

print(float(integrate(nsimplify(sympy.log(x, math.e)), (x, a, b))))

参考:github上的解答

你可能感兴趣的:(各路问题汇总,python)