Re: Question on Positive[x]=True
- To: mathgroup at smc.vnet.net
- Subject: [mg7931] Re: Question on Positive[x]=True
- From: bruck at pacificnet.net (Ronald Bruck)
- Date: Wed, 23 Jul 1997 15:46:09 -0400
- Organization: University of Southern California
- Sender: owner-wri-mathgroup at wolfram.com
In article <5pv0ob$id3 at smc.vnet.net>, Raya Firsov-Khanin <raya at mech.ed.ac.uk> wrote: :Dear Steve, : :I have the following question. I want to state that a variable :x is positive. On page 1170 of the Third edition of The Mathematica book :it is said that I can do it by making a definition : : Positive[x] = True : :However, while trying to do it I get a message : : :Set::write: Tag Positive in Positive[x] is Protected : :Any suggestions on how one can make variables positive, negative etc? : :Thanks a lot. : Raya Khanin. : University of Edinburgh There seem to be a lot of lacunae in the third edition; unfortunately, this one ISN'T a lacunae, but a false statement! Use the ^= construction. But a word of warning: Mathematica is rather brain-dead in this regard; if you set Positive[x] ^= True, and ask "Positive[x]", well, you get true; excellent; but if you ask "Negative[x]", you get it back unevaluated. (Similarly, Sqrt[x^2] doesn't evaluate to x.) In another post, Tony Nicolas suggests using ==. But he's missed the point of what you're trying to do (which is to ASSUME x is positive). --Ron Bruck Now 100% ISDN from this address