MathGroup Archive 2000

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

Search the Archive

Re: Bugs in Abs and Sign !?


Hi,

Abs[x^2] is simplifyed first to Abs[x]^2 and *than* your rule
Abs[u_]:> fnt[u] is applied. The thame thing happens with
Sign[x^2] that is transformed to Sign[x]^2.

To prevent this simplifications you need Hold[] and 

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

works as expected.

Gruss
  Jens

Jack Goldberg wrote:
> 
> Hi group.
> 
> 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 led
> 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 have
> found in just 2 weeks.  Please tell me I'm wrong.
> 
> Thanks guys.
> 
> Jack


  • Prev by Date: Re: Select Output of FindMinimum
  • Next by Date: Re: Select Output of FindMinimum
  • Previous by thread: Re: Bugs in Abs and Sign !?
  • Next by thread: RE: Bugs in Abs and Sign !?