MathGroup Archive 2003

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

Search the Archive

Re: Re: New version, old bugs

  • To: mathgroup at smc.vnet.net
  • Subject: [mg44186] Re: [mg44151] Re: New version, old bugs
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Sat, 25 Oct 2003 06:26:42 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Maxim's postings stimulated me to re-think  my ideas on Mathematica and 
try to articulate the vague feelings that I have had about it for a 
long time. The result surprised me: I now feel that I have at last got 
an insight into the nature of the program that has baffled me for so 
long and in particular why some love it while others find it 
frustrating, and moreover why many experience both emotions at the same 
time. The comments below contain no specific examples and are not 
directly relevant to anything in Maxim"s postings, but I think are 
relevant to some of the general "complaints"  has voiced. The specific 
examples he provides may well be bugs but I think the general issues he 
raises are not themselves bugs but actually involve something much 
deeper.
When considering these matters the first point that I think should be 
kept in mind is that the main designer of Mathematica is not a 
mathematician or a computer scientist but a theoretical physicist. 
Moreover he is a very eloquent physicist whose views on such things as 
physics, mathematics and the relationship between them are very well 
known. Perhaps his views on the design of Mathematica are somewhat less 
clearly expressed (as far as I know) but it seems to me that they can 
be easily deduced form his views on mathematics. In many ways these 
views are quite typical of many mathematically minded physicists, 
including some of the most famous ones.
One should first be aware that a vast amount of what today is 
considered "pure mathematics" was actually created by physicists. In 
some cases, for example Archimedes, Newton or today E. Witten it is not 
even clear whether
we are talking of a physicist or of a mathematician (Witten calls 
himself a physicist but has a Fields medal in mathematics). Others, 
like Dirac, Einstein or Feynman (to mention just some who made a huge 
contribution to mathematics) were definitely physicists. One thing that 
strikingly distinguishes the mathematics created (or discovered) by 
physicists from the one that emerges form the work of pure 
mathematicians is that its  primary motivation is derived form concrete 
physical problems. In fact for a physicists there are two essential 
factors involved in this process of inventing new mathematics: the 
needs of the physical problem he is dealing with and his "intuition", 
which is something difficult to describe, but which tells him what sort 
of things are likely to work and how they ought to be applied. The 
third factor, which is hardly of any importance to most physicists but 
of much greater one to most mathematicians is the formal basis of the 
concepts and definitions being created: their internal consistency 
(what is called being "well defined"), their relation to the already 
existing body of mathematics etc. For most physicists, if a 
mathematical idea "works" and if it is "intuitively" felt to be correct 
than it is as good as correct. They rarely bother about much more. Most 
(but not all!) mathematicians view these things differently: in their 
view concepts have to be well defined, theorems have to be properly 
proved and so on before they can be considered "mathematics". Even on 
this point however, there is no agreement among even the best 
mathematicians. In the past many of the greatest (Euler being a very 
notable example) were quite prepared to rely on their intuition without 
much care about what is called "mathematical rigour". The same has been 
true of some of the greatest 20th century mathematicians, one example 
being Rene Thom who hardly ever bothered to give proofs of any of his 
many remarkable theorems. The whole issue is still hotly disputed and I 
suspect will always continue to be so. Anybody interested in this 
dispute including the contributions of some of the greatest living 
mathematicians should look at the article:

A. Jaffe and F. Quinn, Theoretical Mathematics: Toward a cultural 
synthesis
of mathematics and theoretial physics, Bull. Amer. Math. Soc. 29 (1993),
1-13.
and the responses in the subsequent volume.

Now when interesting mathematics is created in this way by physicists, 
many mathematicians feel that it should be given rigorous mathematical 
foundations and indeed this is often accomplished. Moreover, when it is 
done successfully I think most people would agree that our 
understanding is enhanced. Perhaps the most familiar example of this 
kind is Dirac's invention of the Delta function (DiracDelta in 
Mathematica), which was extremely useful and physically very intuitive 
from the start but was only given rigorous mathematical basic by 
Laurent Schwartz in his theory of distributions. But there is actually 
no guarantee that even intuitive ideas that seem to work well can 
actually be given rigorous mathematical foundations. For example, as 
far as I know, this has still not been done for the general case of the 
so called Feynman path integral and it may be that we will have to 
settle for some sort of "ad hoc' justification (basically a set of 
rules that are justified by the fact that they give the "right answer").
What has it all to do with Mathematica? Well, it seems to me that by 
creating Mathematica Steven Wolfram brought all these issues to the 
area of programming and software design. For Mathematica's programming 
language seems in this light like a perfect example of a "mathematical 
theory" created by a physicist, in other words
1. It is extremely intuitive
2. It is exceptionally useful
3. It is not necessarily fully self-consistent nor does it have a 
clearly defined "syntax" which specifies in advance what is "legal" and 
what is not. Like in  "physicist's  mathematics", this sort of thing is 
actually being "discovered" through the process of trying various 
things that "intuitively" seem natural and ought to work. Most of the 
time they do but sometimes they do not. When they don't it is not quite 
clear that one could actually make them work without breaking some 
other desirable property. It is neither clear that a process of 
establishing a "rigorous syntax' for Mathematica is worth the effort 
nor that such a process could be guaranteed to be successful.

I think nothing illustrates this point better than the Mathematica's 
"Flat" attribute. The idea is extremely intuitive and very powerful.  
Yet when you try to think carefully about it you notice that not only 
its implementation is, in some sense "incomplete' (more precisely, it 
does not do everything one expects it to do) but that it probably could 
never be made "complete" simply because in designing computer software 
one has to be concerned with "usability" just as much or perhaps more 
than with rigour and "mathematical correctness".

In spite of this I think Mathematica possesses the best and the most 
powerful mathematical programming language there is. However, if what I 
wrote above is correct than it suggests that not everyone will be happy 
with it and clearly not everyone is. If you are not comfortable with 
the fact that often you won't be able to tell in advance if a piece of 
code will work, and that you will sometimes need to experiment and made 
adjustments, then Mathematica is not for you. But that may well be the 
price that must be paid or its "intuitiveness" and for me this is a 
price worth paying.


Andrzej Kozlowski
Yokohama, Japan
http://www.mimuw.edu.pl/~akoz/





On Friday, October 24, 2003, at 05:24 PM, Maxim wrote:

> A few more glitches of Mathematica's pattern matcher:
>
> In[1]:=
> Module[{f},
>   f[a] /. f[x_] /; True /; False :> 0
> ]
>
> Module[{f},
>   Attributes[f] = Flat;
>   f[a] /. f[x_] /; True /; False :> 0
> ]
>
> Out[1]=
> f$37[a]
>
> Out[2]=
> 0
>
> It looks like there's still a long way to go to acquaint Flat with 
> other
> language constructs.
>
> In[1]:=
> Module[{f},
>   Attributes[f] = {Flat, OneIdentity};
>   f[x] /. f[x_, y_:1] -> {x}
> ]
>
> Out[1]=
> {f$37[x]}
>
> I'm not sure about this one, should the result here be {x}?
>
> Another example:
>
> In[1]:=
> Module[{a},
>   {x^2, x^3} /. x^(p_) :>
>     (a = p; a*x)
> ]
>
> Module[{a},
>   {x^2, x^3} /. x^(p_) :>
>     (a = p; a*x /; True)
> ]
>
> Out[1]=
> {2*x, 3*x}
>
> Out[2]=
> {3*x, 3*x}
>
> To understand how the last one works we need to know the evaluation
> sequence; the number in parentheses shows whether rhs is evaluated for 
> x^2
> (1) or x^3 (2):
>
> a=2  (1)
> True (1)
> a=3  (2)
> True (2)
> 3*x  (1)
> 3*x  (2)
>
> So the description of ReplaceAll in the Reference (saying that it tries
> parts in the sequential order) is incomplete (or even not strictly 
> true),
> because it switches between parts in this weird manner. Just as in the
> situation with
>
> In[1]:=
> Hold[x] /. x :> Module[{}, Random[]]
> Hold[x] /. x :> Module[{}, Random[] /; True]
> Hold[x] /. x :> Block[{}, Random[] /; True]
>
> Out[1]=
> Hold[Module[{}, Random[]]]
>
> Out[2]=
> Hold[Random[]]
>
> Out[3]=
> Hold[0.011784819818934053]
>
> giving three different results, I cannot say that the expressions are
> semantically equivalent because no one knows what the semantics should 
> be in
> the first place, but it is very confusing when adding True condition
> suddenly changes the result.
>
> Maxim Rytin
> m.r at prontomail.com
>
>
>
>


  • Prev by Date: Re: Baffling Failure when plotting multiple curves.
  • Next by Date: RE: Re: errors while picking random numbers - use of % and %%
  • Previous by thread: Re: New version, old bugs
  • Next by thread: Re: New version, old bugs