[英]Is there a way to substitute recursively and automatically in sympy?
I am coming from Mathematica, where you can do the following to fully substitute:我来自 Mathematica,您可以在其中执行以下操作以完全替代:
In[1]:=
x=y
y=z
Simplify[x]
Out[1]=
z
Is there a way of doing this automatically in SymPy?有没有办法在 SymPy 中自动执行此操作? I am aware that I can manually substitute the variables 1 by 1 using subs
or solve
, or by doing something janky like this:我知道我可以使用subs
或solve
手动将变量 1 替换为 1 ,或者通过执行以下操作:
In[1]:
y=z
x=y
x
Out[1]:
z
but is there a way of making it automatically get the most expanded and substituted expression solving for 1 variable?但是有没有办法让它自动获得解 1 个变量的最大扩展和替换表达式?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.