Re: Mathematica Programmer vs. Programming in Mathematica

*To*: mathgroup at smc.vnet.net*Subject*: [mg63129] Re: Mathematica Programmer vs. Programming in Mathematica*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>*Date*: Thu, 15 Dec 2005 03:06:37 -0500 (EST)*References*: <200512130841.DAA08238@smc.vnet.net> <dnopbs$2g9$1@smc.vnet.net> <200512142222.jBEMMaKZ009591@ljosalfr.globalsymmetry.com>*Sender*: owner-wri-mathgroup at wolfram.com

On 15 Dec 2005, at 07:22, Steven T. Hatton wrote: > > He also says: " It is to be hoped that there will soon be a > hard-wired version in the underlying Mathematica C code." It seems prety obvious now it is not going to happen. I for one do not regret it. > > >> Both volumes of "The Mathematica Programmer" are very different from >> "Programing in Mathematica". The latter book is actually devoted >> entirely to writing Mathematica packages and isn't a particularly >> good guide to other aspects of Mathematica programming (it was the >> first book on Mathematica programming I ever read and I don't think I >> learnt very much from it). > > I have read from several different books on Mathematica over the > years. > None of them provide a very good introduction. I believe part of the > problem is that the authors tend to avoid explaining what makes > Mathematica > "functions" different from functions in languages such as C. > Instead, they > seem to focus on the similarities. A few diagrams such as are > found in > _Interpretation of Computer Programs_ by Abelson and Sussman, and an > accompanying general description of the process of evaluation would > have > been of great value to me. I wonder what value there would be in trying to explain what makes Mathematica "functions" different from functions in languages such as C in a book addressed to readers most of whom have no knowledge of C and are not particualry interested in getting it? The "Structure and INterpretation of Computer Programs" is a good book; I actaully learnt a lot about Mathematica form it ;-) One good thing about it is that it leaves all mention of C to the fotnotes and the exercies (see in particualrl page 610) for those who are interested only. > > I have gained a lot from _Programming in Mathematica_. I don't > agree that > it is devoted entirely to writing Mathematica Packages. To me that is > similar to saying something like '_The C++ Programming Language, > Special > Edition_" is entirely about creating namespaces'. Packages are > merely a > (good) means of organizing code in Mathematica. Most of what Maeder > presents could easily be done in the Global` context. O.K., I guess I exaggerated somewhat. In fact Programming in Mathematica is a very elegantly written book that gives a good idea of the possibilities of Mathematica programming. Since I have bought three editions of it (for Mathematica versions 1, 2 and 4) obviously I must have found something of value in it. Nevertheless I still do not think this is a good book to start learning Mathematica programming form. On the other after I read Wagner's book I could easily read Programming in Mathematica and other Mathematica books and although I found useful things in them I don't think I ever discovered any more fundamental principles I that were somehow missed by Wagner. > > [...] >> The >> explanation is pretty compressed: less than one page long. > > I'm hoping there is sufficient development in the preceding > chapters to > explain his implementation. I have a used copy on order. As I and others have already explained: each chapter is on a totally different topic. They are unrelated and and do not naturally lead from one to another. > >> The package is used again in Maeder's book "Computer Science with >> Mathematica" in the chapter on object oriented programming but again >> Maeder writes that the exact way how is works is irrelevant and >> refers the interested reader to the Mathematica Programmer. > > He actually says it is "unimportant for our applications of object > oriented > programming." _Computer Science with Mathematica_ was one of the > books I > read without much depth of understanding due to my lack of a solid > grasp of > how Mathematica works differently from traditional procedural and > functional languages. > I don't understand you here, though I suspect that is because our background and interests are quite different. I have never had much interest in "how Mathematica works differently from traditional procedural and functional languages" and honestly do not have much now either. I don't think not knowing that was ever any obstacle to my understanding of Mathematica. I knew a bit of Lisp at the time when I started learning Mathematica (and that was entirely due to reading Chaitin's "algorithmic Information Theory" , which of course does not give you any knowledge of "practical" Lisp) and as a result I made the mistake of trying to program in too Lisp like style, before I realised how dreadfully inefficient such programs are in Mathematica (due to the sort of things mentioned by Jon Harrop). I guess if I had known even less Lisp my progress would have been faster ;-) In fact my approach was entirely different from yours. I had been using Mathematica for a number of years without any programming but then I got an idea about a specific project I wanted to implement for the classes I was teaching. I found that I had to learn to program to do that. I could not find any information that I needed in the Mathematica book (it was of course all there, but the problem was I did not know how to look for it). After reading "Programming in Mathematica" I was not much closer. But after I read David Wagner's book it became almost trivial to implement my project; the whole program turned out to be less than a page long. Since then I have read or at least looked at lots of Mathematica books and I learnt many interesting tricks (although not as many as I learnt from the MathGroup, particularly from Allan Hayes, Carl Woll and Hartmut Wolf not to mention WRI employees). I also read "The Structure and Interpretation of Computer Programs" following a suggestion by Richard Fateman (I am grateful for that ;-)). That was, I think, the only books on programing other than Mathematica programing that I have fully read or want to read (I am not counting books on algorithmic algebra, like Mishra, Akritas, etc, which I consider part of mathematics , or general books on algorithms like those by Knuth, Sedgewick, etc). I enjoyed it and it gave me some insight but that is enough. I think I know now as much about this subject as I need or want to know. It's a bit like with research in mathematics: there is a point at which you have to stop enlarging your "general knowledge",most of which you won't be able to use and which is always affected by the "The more I study the more I know. The more I know the more I forget. The more I forget the less I know. " syndrome, and start working on your own specific problems. Andrzej Kozlowski

**References**:**Mathematica Programmer vs. Programming in Mathematica***From:*"Steven T. Hatton" <hattons@globalsymmetry.com>