【发布时间】:2017-05-30 13:38:47
【问题描述】:
我正在尝试学习 python 中符号操作的来龙去脉(我是初学者)。
我有以下基本代码,输出给我一个错误,告诉我它“无法将表达式转换为浮点数”。
这段代码有什么问题:
from sympy import *
from math import *
def h(x):
return log(0.75392 * x)
x = symbols('x')
hprime = h(x).diff(x)
print(hprime)
【问题讨论】:
-
删除
from math import * -
@user46944 我相信问题是因为
math被包含在sympy之后。只需交换前两行就可以了。阅读this 了解更多信息。
标签: python sympy symbolic-math derivative