Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: How to force Mathematica to treat a number as positive and real?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg51881] Re: [mg51831] How to force Mathematica to treat a number as positive and real?
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Thu, 4 Nov 2004 01:49:41 -0500 (EST)
  • References: <200411030624.BAA08310@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On 3 Nov 2004, at 15:24, Rainer wrote:

> I'd like to do some symbolic computation with parameters. These
> parameters (named, e.g. "a") are always *real-valued* and positive. I
> managed to tell Mathematica that a is a real number by using:
>
>   a/:Im[a]=0;
>
> This works since the response to "Re[a]" is now "a" (and not "Re[a]"
> which is the general result when one does not use the above definition
> of a).
>
> Now, I would like to do a similar thing, forcing Mathematica to assume
> that a is a positive number. I want that the result of Abs[a] is equal
> to a. I tried:
>
>   a/:Positive[a]=True;
>
> but it does not work. Does anybody know how I can do this?
> Thanks
> Rainer
>
>
Assuming you have Mathematica 5.0 you should use Refine and the 
Assumptions mechanism. You can even do it in a "global" way, as folows:

This tells Mathematica to Refine every statement using the current 
assumptions:

$Pre = Refine[#] &;

Next, define the assumptions:

$Assumptions = {a ³ 0};

Now


Abs[a]

a


Andrzej Kozlowski
Chiba, Japan
http://www.akikoz.net/~andrzej/
http://www.mimuw.edu.pl/~akoz/


  • Prev by Date: Re: Re: Null entry in a Graphics list?
  • Next by Date: Re: How to force Mathematica to treat a number as positive and real?
  • Previous by thread: How to force Mathematica to treat a number as positive and real?
  • Next by thread: Re: How to force Mathematica to treat a number as positive and real?