[Date Index] [Thread Index] [Author Index]
RE: Positive[a] = True ???
This doesn't work because you're trying to attach the rule to the symbol Plus, which is protected by default. The best way to do this is to attach the value to a as an UpValue. Do: Positive[a]^=True This is documented on pages 260-3 of the Mathematica book. ---------- >From: Marius[SMTP:domokos at chaph.usc.edu] >To: mathgroup at smc.vnet.net >Subject: [mg2518] Positive[a] = True ??? I assume that this topic has been addressed already, and I think I actually remember reading something about it before. However, I have not been able to find anything in the archive. Anyway, here is my problem: The book says that it is possible to declare a variable as beeing positive without assigning any numerical value to it. However, when I try it in version 2.2.2 on a PowerMac, Mathematica rejects the assignment with a message regarding the tag protection. For example: IN>> Positive[a] = True; OUT>> Set::write: Tag Positive in Positive[a] is Protected. What is the problem? Thank you. Frank Domokos