|
[Date Index]
[Thread Index]
[Author Index]
Re: Bugs in Abs and Sign !?
- To: mathgroup at smc.vnet.net
- Subject: [mg25752] Re: Bugs in Abs and Sign !?
- From: Brian Higgins <bghiggins at ucdavis.edu>
- Date: Sat, 21 Oct 2000 14:43:00 -0400 (EDT)
- References: <8sjkr7$g3p@smc.vnet.net> <8smdh4$lcb@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Bill Bertrum kindly pointed out to me that the replacement rule I
suggested in my previous post does not work:I
Abs[x^2] /. Abs -> fnt
He is correct. The following rule does the trick
In[18]:=Abs[x^2] /. Power[Abs[x_], y_] -> fnt[Power[x, y]]
Out[18]=fnt[x^2]
Brian
n article <8smdh4$lcb at smc.vnet.net>,
Brian Higgins <bghiggins at ucdavis.edu> wrote:
> 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.
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
Prev by Date:
RE: Contexts and Naming of Things
Next by Date:
Text in graphics
Previous by thread:
Re: Bugs in Abs and Sign !?
Next by thread:
Mathematica -> "AI"
|