       Re: Re: How do I eliminate premultipliers of "1." ?

• To: mathgroup at smc.vnet.net
• Subject: [mg31184] Re: [mg31162] Re: How do I eliminate premultipliers of "1." ?
• From: Daniel Lichtblau <danl at wolfram.com>
• Date: Tue, 16 Oct 2001 01:19:07 -0400 (EDT)
• References: <9q8oeb\$co\$1@smc.vnet.net> <200110140811.EAA02418@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Alan Mason wrote:
>
> Hello Brett.
> You can get rid of them by applying a rule.
>
> In:=
> expr = 1.0 a
>
> Out=
> 1. a
>
> In:=
> expr2 = expr /. 1.0 u_:> u
>
> Out=
> a
>
> ..  I agree with you, though.  Mathematica 4.1 even claims that 1.0 == 1 is
> True.
> In:=
> 1.0 \[Equal] 1
>
> Out=
> True
>
> I consider this an outright error. 1.0 means a floating-point approximation
> to 1, whereas 1 is exactly 1
>
> The correct way to treat 1.0/1.0 is somewhat ambiguous.  Does 1.0 stand for
> the same approximation at each appearance?  If so, the ratio should be 1;
> otherwise, it should be 1.0.
>
> Alan
>
> "Brett Patterson" <bap at roe.ac.uk> wrote in message
> news:9q8oeb\$co\$1 at smc.vnet.net...
> > Consider the following:
> >
> > In := 1 a / 1
> > Out := a
> >
> > In := 1.0 a / 1.0
> > Out := 1. a
> >
> > Now consider these identities:
> >
> > In := (1 / 1) == 1
> > Out := True
> >
> > In := (1.0 / 1.0) == 1.0
> > Out := True
> >
> > In := (1 / 1) == 1.0
> > Out := True
> >
> > In := (1.0 / 1.0) == 1
> > Out := True
> >
> > Given that it is clear mathematically that I want the
> > answer to In to evaluate to just "a", and given that
> > Mathematica is clearly recognizing that 1.0 / 1.0 is the
> > same as 1 / 1, can someone please tell me why Out contains
> > the premultiplier "1." and how to eliminate it in expressions
> > that might contain this superfluous unit multiplier in various places.
> >
> > Thanks!
> >
> > Brett Patterson
> >
> > UK Astronomy Technology Centre
> > The Royal Observatory
> > Blackford Hill
> > Edinburgh EH9 3HJ
> > Scotland
> >

(1) 1.*a is given as a result in Out because the expression 1.*a/1.0
in In is inexact and so an exact result is not justifiable.

(2) The fact that 1.0==1 returns True is intentional and not a bug.
Numeric equality testing coerces to lowest precision of input (where
machine precision is to be regarded as "lower" than any bignum
precision). For distinguishing by mathematical semantics exact vs.
inexact numbers one may use SameQ (===).

Daniel Lichtblau
Wolfram Research

```

• Prev by Date: Formula for sum of integrals of polynomials
• Next by Date: Re: How do I eliminate premultipliers of "1." ?
• Previous by thread: Re: How do I eliminate premultipliers of "1." ?
• Next by thread: Re: How do I eliminate premultipliers of "1." ?