Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

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

Search the Archive

Re: Bugs in Abs and Sign !?

  • To: mathgroup at
  • Subject: [mg25705] Re: [mg25674] Bugs in Abs and Sign !?
  • From: Tomas Garza <tgarza01 at>
  • Date: Thu, 19 Oct 2000 04:35:30 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

I guess it's just a matter of how Abs[] works. Take

Abs[x^2] // FullForm
Power[Abs[x], 2]

This says that the calculation of Abs[x^2] proceeds by taking first the 
absolute value of x, and then squaring it. This procedure gives the 
right result. However, for an arbitrary function g,

g[x^2] // FullForm
g[Power[x, 2]]

i.e., first square the argument and then apply g, which is what one 
might expect. Why does Abs[] goes in a different way? That is why one 

Abs[x^2] /. Abs[u_] -> fnt[u]

instead of fnt[x^2]. But I wouldn't call it a bug - it's just the way 
Abs[] calculates, and it gives the right result.

Tomas Garza
Mexico City

Jack Goldberg  <jackgold at> wrote:

> Try,
> Abs[x^2] /. Abs[u_] -> fnt[u]
> and
> Sign[x^2] /. Sign[u_] -> fnt[u]
> In each case I get  fnt[x]^2.  Shouldn't I get  fnt[x^2]? After all,
> g[x^2] /. g[u_] -> fnt[u]  returns fnt[x^2] which is what I have been 
> to expect from Mathematica.  I am using ver 4.01 on a PowerMac.
> These peculiarities are driving me crazy.  This is the fourth "bug" I 
> found in just 2 weeks.  Please tell me I'm wrong.

  • Prev by Date: Re: Mathematica -> "AI"
  • Next by Date: Re: Associated Legendre Definition
  • Previous by thread: Re: Bugs in Abs and Sign !?
  • Next by thread: Re: Bugs in Abs and Sign !?