2024-06-30 16:19:48 发布
网友
我想知道是否有可能设置一个数学领域。功能。例如,当我定义以下表达式时
>>> import sympy as syp >>> x = syp.Symbol('x') >>> miles_to_km = x * 1.609344 >>> miles_to_km.evalf() 1.609344*x
是否可以限制域,使x在[0,inf]范围内?所以目标是我可以使用sympy.plot函数来生成一个从0开始的图,并且只包含正的x值,而不是
sympy.plot
如果我们通过以下方式检查手册:
help(syp.plot)
您将获得:
...expr : Expression representing the function of single variablerange: (x, 0, 5), A 3-tuple denoting the range of the free variable....
...
expr : Expression representing the function of single variable
expr
range: (x, 0, 5), A 3-tuple denoting the range of the free variable.
range
所以,你可以:
将得到以下输出:
如果我们通过以下方式检查手册:
您将获得:
所以,你可以:
^{pr2}$将得到以下输出:
相关问题 更多 >
编程相关推荐