MathGroup Archive 2009

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

Search the Archive

Re: Re: Replace and ReplaceAll -- simple application

  • To: mathgroup at smc.vnet.net
  • Subject: [mg106003] Re: [mg105968] Re: Replace and ReplaceAll -- simple application
  • From: danl at wolfram.com
  • Date: Wed, 30 Dec 2009 04:12:45 -0500 (EST)
  • References: <200912270006.TAA12080@smc.vnet.net> <hh72dp$kud$1@smc.vnet.net>

> Scot T. Martin wrote:
>> The problem is that "-1." is not "1".
>
> And furthermore, this bug has been declared a feature. And defended,
> repeatedly.   Just as I does not occur in -I.
> It can be fixed, should be fixed, and has been fixed in other CAS.

Deja vu all over again. Why it was only three weeks ago I was seeing
various assertions of bughood mentioned in the Usenet sci.math.symbolic
thread at URL below (insert usual caveats about email line breaking of
URLs).

http://groups.google.com/group/sci.math.symbolic/browse_thread/thread/0256579cfacee298#

One response, from Jon McLoone of Wolfram Research, was quite on target.
I'll try to give a different one.

The first rule of syntactic replacement is that it must obey syntax.
Whether Mathematica's InputForm and related formatting is in some way
misleading in that -1.0 "looks like" it contains 1, or 3-4*I "looks like"
it contains I, is of secondary importance (or maybe tertiary). Far more
important are the following.

(1) InputForm must be readily interpreted (by Mathematica) in an
unambiguous manner. Where possible, e.g numeric notation, it should also
not be overly burdened with prefix notation (that is to say, it is also
nice to have something that is human-readable). Example: Use some familiar
notation, say 3-4*I, to denote what in Mathematica FullForm is
Complex[3,-4].

(2) Numbers must be entities that contain no arithmetic operators e.g.
minus or times. Example: There is no Minus or Times in Complex[3,-4], even
though it "looks" like 3-4*I in Mathematica InputForm. This is important
for efficient arithmetic, and I think also for general evaluation of input
(Example: one wants 3*x/4 and (3/4)*x to evaluate to the same internal
representation, using Times[Rational[3,4],x]).

(3) As noted earlier, syntactic replacement should not arbitrarily and
capriciously depart from following syntax (Examples: Do not consider
Complex[3,4] as "containing" Complex[0,1], even though their respective
InputForm notations are 3+4*I and I, Do not consider Times[3,Power[x,-2]]
as containing x^2, even though InputForm shows it as 3/x^2).

Clearly there are design decisions behind all this. Anyone is free to
state dislike of those decisions. That does not make them bugs. It does
not even necessarily make them bad decisions. Me, I think the ones
itemized above are just fine, which is why I took the trouble to mention
them explicitly.

Daniel Lichtblau
Wolfram Research




  • Prev by Date: Abs''[1]
  • Next by Date: Re: algebraic numbers
  • Previous by thread: Re: Replace and ReplaceAll -- simple application
  • Next by thread: Re: Re: Replace and ReplaceAll -- simple application