asd734619 发表于 2022-4-21 08:14:18

matplotlib 怎么输出 lnx 对数函数图像啊

from numpy import *
from sympy import *
from matplotlib import pyplot as pl
x,y = symbols('x y')
x = arange(-1,1,0.01)
y = log(x + 1,exp(x))
pl.plot(x,diff(y,x))
pl.plot(x,y)
output()#自定义输出函数
y = log(x + 1,exp(x))发生异常: AttributeError
'ImmutableDenseNDimArray' object has no attribute 'as_coefficient'

During handling of the above exception, another exception occurred:


During handling of the above exception, another exception occurred:

File "C:\Users\86176\Desktop\python\实验.py", line 93, in <module>
    y = log(x + 1,exp(x))
有大佬邦邦吗{:10_254:}

asd734619 发表于 2022-4-21 09:41:35

解决了,两个库函数不能通用,经初始化的x自变量不能带入到numpy库中的log()函数中,但怎么输出求完导后的函数图像啊,只能先算一遍导数然后重新输入代码吗?
页: [1]
查看完整版本: matplotlib 怎么输出 lnx 对数函数图像啊