Re: Bugs in Abs and Sign !?
- To: mathgroup at smc.vnet.net
- Subject: [mg25696] Re: Bugs in Abs and Sign !?
- From: Brian Higgins <bghiggins at ucdavis.edu>
- Date: Thu, 19 Oct 2000 04:35:23 -0400 (EDT)
- References: <8sjkr7$g3p@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Jack, There is no bug in my opinion. Mathematica is doing pricesly what you requested. When you use replacement rules it is wise to carefully examine the FullForm of your expression. Thus FullForm[Abs[x^2] ] Power[Abs[x], 2] Hence Abs[x^2] /. Abs[u_] -> fnt[u] will give Power[ fnt[x] , 2] which is fnt[x]^2 The correct replacement rule for what you want to do is Abs[x^2] /. Abs -> fnt Cheers, Brian In article <8sjkr7$g3p at smc.vnet.net>, Jack Goldberg <jackgold at umich.edu> 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 > > Sent via Deja.com http://www.deja.com/ Before you buy.