Re: Abs and variables

• To: mathgroup at smc.vnet.net
• Subject: [mg4297] Re: Abs and variables
• From: Mark Evans <evans at gte.net>
• Date: Sat, 29 Jun 1996 03:56:36 -0400
• Organization: GTE Intelligent Network Services, GTE INS
• Sender: owner-wri-mathgroup at wolfram.com

```Perrin wrote:
>
>         How can I have the Abs function treat real variables properly?
> I seem to recall a way of declaring a variable real, but I don't
> remember how.  If there is such a way, would this work with Abs; i.e.
> fix the variable a so that "Abs[a]" will give a result of "a"?
>
> Thanks.
>
> /
> :@-) Scott
> \

I have always bemoaned Mathematica's deficiency with respect to symbolic real
variables.  WRI has vaguely promised some improvements in this area.  I'm
sure they will do a better job next time around.

Mathematica is just not very good at simplifying symbolic expressions
involving symbolic reals.  The kernel always assumes that symbols could be
complex even though in many cases they cannot.

The particular simplification you cite, however, is not quite valid in any
case, because "a" can be positive or negative even if it is real.  If a < 0,
then Abs[a] != a.  In this case I would not want the simplification you cite
to take effect.

There is a package called "ReIm.m" which lets you declare symbols to be pure
straightforward simplifications that one would expect in reasonable amounts
of time.

There is also the ComplexExpand[] function.  This is the most helpful
function I have found in this regard.  Read the manual about its usage.  When
you wrap an expression with ComplexExpand[], the symbols in the expression
are assumed real unless you specifically state otherwise in the argument list
to the function.

Mark Evans
evans at gte.net

==== [MESSAGE SEPARATOR] ====

```

• Prev by Date: Re: Numerical Differentiation
• Next by Date: Re: Numerical Differentiation
• Previous by thread: Abs and variables
• Next by thread: Re: Abs and variables