2017-06-03 33 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