MathGroup Archive 1999

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

Search the Archive

Re: assumption, supposition?

  • To: mathgroup at
  • Subject: [mg15351] Re: assumption, supposition?
  • From: "Allan Hayes" <hay at>
  • Date: Sat, 9 Jan 1999 23:58:15 -0500
  • References: <774kr1$>
  • Sender: owner-wri-mathgroup at

Erk Jensen wrote in message <774kr1$46h at>...
>Probably I'm looking up the wrong keyword in Mathematica help, but I
>can't find what I'm looking for. Maybe that's because I've learned
>those expressions in german...
>My problem:
>I want Mathematica to assume that a certain condition is satisfied for
>the following algebraic transformations. More specifically: Let rho
>describe a radius coordinate. I know it is not negative real. So, for
>transformations of expressions containing rho, e.g.  Sqrt[rho^2], I
>want assure Mathematica that 0 <= rho is in fact satisfied, and that it
>is consequently allowed to replace Sqrt[rho^2] by rho. How do I do
>My solution was
>Unprotect[Sqrt]; Sqrt[rho_^2] := rho/; 0 <= rho; Protect[Sqrt];
>rho /: 0 <= rho = True;
>and this seems to work, but I wonder whether this is really the proper
>way. Since the TagSet I'm using here assigns the whole statement to
>rho, and ?rho results in
>rho /: 0 <= rho = True
>so I still have my doubts ...
>Can some of you experts enlighten me?
>Thanks in advance
>               -erk-


This looks OK:

The definition

Sqrt[(rho_)^2] := rho /; 0 <= rho;

is not restricted to rho (which here is a dummy variable). We can use

c/: c<=0 = True;

and get



Unfortunately Mathematica does not do any deduction:

d/: (d>=0)=True;



But we can allow for this by

Sqrt[(rho_)^2] := rho /; 0 <= rho


Allan Hayes
Mathematica Training and Consulting
hay at
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

  • Prev by Date: Re: setting X and Y range in 2D plots
  • Next by Date: Re: setting X and Y range in 2D plots
  • Previous by thread: Re: assumption, supposition?
  • Next by thread: Re: assumption, supposition?