simplification of Sqrt function in some cases
- To: mathgroup at yoda.physics.unc.edu
- Subject: simplification of Sqrt function in some cases
- From: PRAVEEN at vtcs1.cs.vt.edu
- Date: Thu, 10 Sep 1992 8:03:46 -0400 (EDT)
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]
4
Out[1]= Sqrt[x ]
In[2]:= Sqrt[4 x^4]
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]
2
Out[6]= x
In[7]:= Sqrt[4 x^4]
4
Out[7]= 2 Sqrt[x ]
In[8]:= 2 Sqrt[x^4]
2
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 vtcs1.cs.vt.edu