2024-04-27 04:43:44 发布
网友
但我要用“3”来表示。怎么了?在
a, f = symbols('a f') a(3).subs(a,f)
您已经将f定义为一个函数,然后将其替换为来自symbols()的返回值。在
f
symbols()
您可以使用replace来更改函数。这里有一些例子。在
replace
import sympy as sp f = sp.Function('f') g = sp.Function('g') x,y = sp.symbols('x, y') f(x).replace(f, g)
g(x)
sin(x)
f(x,y).replace(f, lambda *args: sp.exp(-5 * args[0] + args[1] ))
exp(-5*x + y)
documentation提供了大量附加示例的列表。在
您已经将
f
定义为一个函数,然后将其替换为来自symbols()
的返回值。在您可以使用
^{pr2}$replace
来更改函数。这里有一些例子。在documentation提供了大量附加示例的列表。在
相关问题 更多 >
编程相关推荐