MathGroup Archive 1997

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

Search the Archive

Re: Question on Positive[x]=True


In article <5qci9o$ejn$3 at dragonfly.wolfram.com>, seanross at worldnet.att.net
wrote:

> Raya Firsov-Khanin 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
> 
> Protected is an attribute which must be removed before modifying.
> 
> Try 
> 
> Unprotect[Positive];
> Positive[x]=True;
> Protect[Positive];

An alternative is to use an upvalue for x as in,

Positive[x] ^= True

-- 
David Reiss
dreissNOSPAM at nospam.earthlink.net
http://www.batnet.com/dreiss
To send personal email, remove the words 
"nospam" and "NOSPAM" from the email address


  • Prev by Date: Re: problem of notebook in 16bit X server
  • Next by Date: Petri net and Mathematica?
  • Previous by thread: Re: Question on Positive[x]=True
  • Next by thread: Re: Question on Positive[x]=True