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: [mg51887] Re: How to force Mathematica to treat a number as positive and real?
  • From: David Bailey <dave at Remove_Thisdbailey.co.uk>
  • Date: Thu, 4 Nov 2004 01:50:04 -0500 (EST)
  • References: <cm9vi3$8nc$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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
> 
You can use the Assumptions option in Simplify and FullSimplify to 
specify that a number belongs to a particular field - Reals in your case 
- and also to supply additional information, e.g.


Simplify[{Abs[a], Re[a]}, Assumptions ->
    {a â?? Reals, a >= 0}]

{a,a}

You might find it convenient to define your own simplification function 
with the necessary assumptions built in:

MySimplify[x_] := Simplify[x, Assumptions -> {a â?? Reals, a â?¥ 0}]

{Abs[a], Re[a], Min[a, 0]} // MySimplify

{a, a, 0}

David Bailey


  • Prev by Date: Re: Re: Hide Mathematica kernel window
  • Next by Date: Re: Series [was Change head, with Apply?]
  • Previous by thread: Re: 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?