Wolfram mathematica 如何使Mathematica简化平方根表达式

Wolfram mathematica 如何使Mathematica简化平方根表达式,wolfram-mathematica,simplify,Wolfram Mathematica,Simplify,我想让Mathematica计算平方变量的平方根。相反,它只是返回平方根下的平方变量。我编写了一个简单的代码作为示例: x = y^2 z = FullSimplify[Sqrt[x]] 但它返回的是平方根符号下的y^2 此行为记录在Sqrt参考页上: Sqrt[z^2]不会自动转换为z。 [……] 这些转换可以使用PowerExpand完成,但通常仅对正实数参数是正确的。 因此: 您还可以通过提供各种假设来简化: In[10]:= Simplify[Sqrt[x], Assumptions

我想让Mathematica计算平方变量的平方根。相反,它只是返回平方根下的平方变量。我编写了一个简单的代码作为示例:

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

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

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

Sqrt[z^2]不会自动转换为z。 [……]

这些转换可以使用PowerExpand完成,但通常仅对正实数参数是正确的。 因此:

您还可以通过提供各种假设来简化:

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
如果你需要更多的帮助,我建议你继续问下去

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