MathGroup Archive 1992

[Date Index] [Thread Index] [Author Index]

Search the Archive

simplification of Sqrt function in some cases

Hi Mathgroup,

I was trying to have Sqrt, the square root function simplify Sqrt[x^2] to x. 
With the standard definition, the expression is returned unchanged. I 
redifined Sqrt[x^y] to be x^(y/2) when y is an even integer. However, I find 
that Mathematica does not use this definition all the time. In fact, when the 
output from Mathematica is given as input(Out[7],In[8] in the session), the 
expression is further simplified.

The following lines from 
an interactive session should clarify my point. The first input lines are only 
to show the functioning of the standard Sqrt function. 

In[1]:= Sqrt[x^4]

Out[1]= Sqrt[x ]

In[2]:= Sqrt[4 x^4]

Out[2]= 2 Sqrt[x ]

In[3]:= Unprotect[Sqrt]

Out[3]= {Sqrt}

In[4]:= Sqrt[x_^y_] := x^(y/2)/;EvenQ[y]

In[5]:= Protect[Sqrt]

Out[5]= {Sqrt}

In[6]:= Sqrt[x^4]

Out[6]= x

In[7]:= Sqrt[4 x^4]

Out[7]= 2 Sqrt[x ]

In[8]:= 2 Sqrt[x^4]

Out[8]= 2 x

I would very much appreciate if some one could point out what I am missing,
else if there is any other way of resolving this.

Thanks in advance,

Praveen Paripati
praveen at

  • Prev by Date: Adding a conditional definition to Sqrt.
  • Next by Date: XYpic for arrows in TeX
  • Previous by thread: Adding a conditional definition to Sqrt.
  • Next by thread: XYpic for arrows in TeX