MathGroup Archive 1995

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

Search the Archive

RE: Positive[a] = True ???

  • To: mathgroup at smc.vnet.net
  • Subject: [mg2523] RE: [mg2518] Positive[a] = True ???
  • From: "John R. Fultz" <jfultz>
  • Date: Thu, 16 Nov 1995 01:45:14 -0500
  • Encoding: 38 TEXT

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






  • Prev by Date: Re: Q:BarChart, MultipleListPlot
  • Next by Date: Re: (fix) bizarre mathematica replacement rule error
  • Previous by thread: Re: Positive[a] = True ???
  • Next by thread: Re: Positive[a] = True ???