鱼C论坛

 找回密码
 立即注册
查看: 2697|回复: 1

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

[复制链接]
发表于 2022-4-21 08:14:18 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
  1. from numpy import *
  2. from sympy import *
  3. from matplotlib import pyplot as pl
  4. x,y = symbols('x y')
  5. x = arange(-1,1,0.01)
  6. y = log(x + 1,exp(x))
  7. pl.plot(x,diff(y,x))
  8. pl.plot(x,y)
  9. 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))
有大佬邦邦吗
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2022-4-21 09:41:35 | 显示全部楼层
解决了,两个库函数不能通用,经初始化的x自变量不能带入到numpy库中的log()函数中,但怎么输出求完导后的函数图像啊,只能先算一遍导数然后重新输入代码吗?
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-4-29 04:27

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表