MathGroup Archive 1997

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

Search the Archive

Re: sqrt[x^2]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg9849] Re: sqrt[x^2]
  • From: Allan Hayes <hay at haystack.demon.co.uk>
  • Date: Fri, 28 Nov 1997 05:36:05 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

ZenArcher wrote:
> 
> Well I know this is really elementary, but I just don't understand this
> result:
> sqrt[x^2]=sqrt[x^2]
> sqrt[4^2]=4
> Why doesn't Mathematica tell me that the Square Root of x^2 is x, but it
> will tell me that the square root of 4^2 is 4?

Zen:

Mathematica gives

Sqrt[x^2]

	Sqrt[x^2]

because it has no information about x to help it compute further (x is
not always the answer - thought this is so for positive real x) For
example

Sqrt[(-4)^2]  

	4

Sqrt[(-I)^2]

	I

Why is this?
Well,
		(-4)^2 = 16   and 4^2 = 16
so there is no unique square root of 16. We either give all possibilies
or make a choice. When it can calculate further Mathematica  makes a
choice, it gives the "principal square root". The definition of this is
included in the defition of z^p below.:

The principal value of z^p   (for non-zero z) is
	Exp[p Log[z]]  
where Log[z] is the "principal logarithm" of z that is   log[Abs[z]] + I
Arg[z]
where log is the ordinary log 
and Arg[z] is the "principal argument" of z that is the angle, a, in the
range  (-pi, +pi]  (not including -pi) such that 
	Exp[I a] = z/Abs[z]

Put another way, for non-zero z,
	
Log[z] the unique complex number w such that
	Exp[w] = z    and    -pi < Im[w] <= pi and z^a is  Exp[a w]

-- 
Allan Hayes
Mathematica Training and Consulting
Leicester, UK
hay at haystack.demon.co.uk
http://www.haystack.demon.co.uk
voice: +44 (0)116 271 4198
fax: +44 (0)116 271 4198


  • Prev by Date: Kronecker Delta
  • Next by Date: Re: Graphing Inequalities
  • Previous by thread: sqrt[x^2]
  • Next by thread: Re: Re: sqrt[x^2]