我对Python非常陌生,仍然在学习matplotlib的基础知识。我理解如何“正常地”绘制一些东西,但是对于一个任务,我需要绘制一个复杂的函数,并且能够通过变量控制进入该函数的变量
例如:如果我有变量a、b和c
我想画一个复杂的函数:f(xj)=(a)(b)(xj)^c其中j=sqrt(-1)
(或者任何你想要的功能,真的,我只是从头顶上编造出来的)
目标是将它们绘制为单独的线(即,实部为一条线,虚部为另一条线),但能够通过滑块控制a、b和c。我该怎么做?变量的范围可以是任何东西,因为这只是一个一般的操作问题
我知道.real和.imag命令,但我不知道如何对在滑块上控制变量的函数执行这些命令
非常感谢您的帮助,谢谢
如果我们使用了你给出的
f(xj) = (a)(b)(xj)^c; j = sqrt(-1)
示例,并假设x轴将是域值(xj)
,那么可以使用此代码绘制实数值和复数值然后,对于滑块,我们可以从matplotlib.widget添加滑块小部件(在documentation中找到关于它的更多信息),因此我们可以使用此代码
但是,使用其他图形更有效,例如以
xj
为域的3D图形,以y轴和z轴上的实数和虚数为范围的复数复值函数通常也将复数作为参数,例如,函数
由于这是将二维实体映射到二维实体,因此视觉表示将不是普通的“图形”。表示复函数的两种方法是布置复平面,到处计算函数值和
我的Python包cplot包括这两个方面。例如,这将绘制正弦函数:
相关问题 更多 >
编程相关推荐