from math import cos, sin
import mpmath as mp
mp.plot([sin, cos], [0, 3]) # this is fine
l = [sin, cos]
mp.plot([lambda x: f(2*x) for f in l], [0, 3])
# this only plots sin(2x)!
我在这里缺少什么,或者是plot
在此处查看相关的
文献。这是一个快速的修复程序,可以完成您想要的工作。
from math import cos, sin
import mpmath as mp
mp.plot([sin, cos], [0, 3]) # this is fine
l = [sin, cos]
mp.plot([lambda x, f=f: f(2*x) for f in l], [0, 3])