Re: positive square root

• To: mathgroup at smc.vnet.net
• Subject: [mg58698] Re: [mg58684] positive square root
• From: "Jose Luis Gomez" <jose.luis.gomez at itesm.mx>
• Date: Fri, 15 Jul 2005 03:02:13 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```Hi Paul

>> (2) My current solution is to use, e.g., Abs[Sqrt[z]]. But when
>> Mathematica echoes this, it puts the Abs function *under* the radical,
>> so it looks like Sqrt[Abs[z]]. Is this a bug in the display?

This is NOT a bug in the display, it is an evaluation. If you write 2+2,
Mathematica will evaluate that to 4, in the same way, if you write
Abs[Sqrt[z]], Mathematica will evaluate it to Sqrt[Abs[z]] (they are in fact
the same for complex numbers). Mathematica evaluates your input, and
sometimes those "evaluations" are, well, somehow silly for a human. For
example, if you write b+a, Mathematica will evaluate that to a+b (just
writing the a before the b).

>> (1) Is there a way to tell Mathematica that I'm only interested in
>> positive square roots?

Actually, Mathematica assumes in some of the commands that you only want the
positive root, for example, if you Plot[Sqrt[x],{x,0,4}] Mathematica plots
only the positive root. So, in which command do you have the problem? Please
be more specific

Finally there is a library that must be used very very very carefully. That
library is RealOnly (you can check it in the AddOns part of the help)
Needs["Miscellaneous`RealOnly`"]
That library could be interesting for you, but it can create problems with
the internal work of other commands that seem not related, like plots or
integrals.

Bye!

Jose Luis
http://homepage.cem.itesm.mx/lgomez/

-----Mensaje original-----
De: paulvonhippel at yahoo [mailto:paulvonhippel at yahoo.com]
Enviado el: Jueves, 14 de Julio de 2005 01:49 a.m.
Para: mathgroup at smc.vnet.net
Asunto: [mg58684] positive square root

I work in a world where the square root is always a positive number.
But Mathematica allows for the possibility of negative square roots.
Two questions arise:

(1) Is there a way to tell Mathematica that I'm only interested in
positive square roots?

(2) My current solution is to use, e.g., Abs[Sqrt[z]]. But when
Mathematica echoes this, it puts the Abs function *under* the radical,
so it looks like Sqrt[Abs[z]]. Is this a bug in the display?

```

• Prev by Date: Comparison of Mathematica on Various Computers
• Next by Date: Re: Light and surface colors
• Previous by thread: Re: positive square root
• Next by thread: D[...] change in 5.1