2017-06-03 32 views
0

我希望Mathematica评估平方变量的平方根。相反,它只是返回平方根下的平方变量。我写了一个简单的代码作为例子:如何使Mathematica简化平方根表达式

x = y^2 
z = FullSimplify[Sqrt[x]] 

但它是返回y^2在平方根符号下!

回答

1

此行为是记录在Sqrt参考页上:

  • Sqrt[z^2]没有自动转换为ž

[...]

  • 这些转换可以使用PowerExpand来完成,但通常只为正实的论点是正确的。

这样:

In[1]:= x = y^2 

Out[1]= y^2 

In[15]:= PowerExpand[Sqrt[x]] 

Out[15]= y 

您也可以通过提供各种假设得到简化:

In[10]:= Simplify[Sqrt[x], Assumptions -> Element[y, Reals]] 

Out[10]= Abs[y] 

In[13]:= Simplify[Sqrt[x], Assumptions -> y > 0] 

Out[13]= y 

In[14]:= Simplify[Sqrt[x], Assumptions -> y < 0] 

Out[14]= -y 

如果你想要更多的帮助,我建议您请上the Mathematica Stack Exchange

+0

完美的伎俩! – PatStarks