Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Background

I've coded in C/Scheme for 10 years. I have a BS CS.

I've recently become very interested in pattern-matching (lisp's match macro), and term rewriting systems, which brought me to Mathematica.

I would like to read a book on Mathematica that will show me lots of cool term-rewriting as a programming style techniques.

Question:

What should I read?

share|improve this question
1  
Gray's "Mastering Mathematica" has a nice chapter on rule-based programming followed by a discussion of substitution and Lambda calculus, so you may want to check that out. –  Michael Wijaya Jun 28 '12 at 20:04
6  
To the closers: please think before you cast the close votes. This question is IMO well formulated, rather narrowly focused, and constructive. Please save us all the reopening effort. –  Leonid Shifrin Jun 28 '12 at 20:49
3  
I agree with @Leonid. I would not vote to close this and will vote to reopen if closed. –  rm -rf Jun 28 '12 at 21:01
1  
@Leonid I do not see the point of having huge resource lists if we are going to have also questions on parts of them. I don't think this should be closed (rather, I think the other question and answers are impossible to use, but that's another matter) –  acl Jun 28 '12 at 21:54
2  
@Leonid I should add here that I do appreciate the effort gone into compiling the other, long answer. I just wish it could be somehow made more usable (of course if parts of it resided in answers to other questions Faysal would have a hard time maintaining and adding it). I am not sure what the best solution is. I'll stop because, as is well-known, This Is Not A Discussion Forum :) –  acl Jun 28 '12 at 22:10
show 5 more comments

2 Answers 2

up vote 21 down vote accepted

OK, I will start with a few suggestions. I think, that what you really need is to understand Mathematica evaluator. Once you get this understanding, programming in Mathematica will become vastly easier for you, and you will be ready for the advanced examples showing the power of rules. So, here are the steps I'd take:

  • Read the book of David Wagner, "Power programming with Mathematica, the kernel" (1996, Computing McGraw-Hill). This is the best book I know to explain the essence of Mathematica evaluation process, and it is full of nice examples. Although it is currently out of print, you can get a free, licensed PDF copy of the book here.

  • While Wagner explains many things about evaluation process, some more details can be found in the WRI Technical Report by David Withoff titled "Mathematica internals" (thanks @Faysal for reminding me about it). It is a short and very interesting read, and even though it was published in 1992, it is mostly accurate to these days (which speaks well of Mathematica design consistency).

  • Get and read as many books by Roman Maeder as you can :-). There are four I know of, and I would read them in this order:

    If you thoroughly read these, you will get more than enough background. They are not an easy read, but easily the best and most elegant exposition of Mathematica from the rule-based perspective, with plenty of non-trivial examples. I think his books are still unmatched, even though published way back. You should have no problems reading them after Wagner's book.

  • After that, you can hunt for rule-based code in many places. There are many nice examples in the books of Michael Trott, and also "Mastering Mathematica" by John Gray, as was mentioned in comments. There are also lots of good and non-trivial rule-based code in the past MathGroup posts, StackOverflow discussions ([mathematica] tag) and here on Mathematica SE. I will try to collect links to some which I find representative and post them here in this answer.

But, to summarize: first, understand the evaluation sequence and evaluation control (Wagner's book is IMO the best source for that, and I will add some links to evaluation-related SO and SE threads here soon). After that, the rest will follow. With your Scheme background, it will be much easier, since the recursive part of Mathematica evaluator is similar to what you know from Lisp / Scheme, so you will have to only grok the rule-based part (which is very substantial, and makes Mathematica evaluator really different).

share|improve this answer
1  
Have you forgotten your own book? mathprogramming-intro.org It's a gem and you know it :-) –  ndroock1 Jun 28 '12 at 21:21
    
@ndroock1 Thanks :). I did not focus on rule-based part, in fact I under-represented it. Neither did I focus on or explain the evaluation process. Both are covered in the new one I am working on, but who knows when it is ready (particularly with the current level of activity here which keeps me busy). Since the question was not about a collection of books on Mathematica programming, I did not include it then. –  Leonid Shifrin Jun 28 '12 at 21:28
    
Thanks, this is very useful. –  user1602 Jun 29 '12 at 0:26
2  
Ask your university or city library. –  ndroock1 Jun 29 '12 at 7:00
2  
About the evaluation process a brief description is given here library.wolfram.com/infocenter/Demos/4683 –  Faysal Aberkane Jun 30 '12 at 21:26
show 3 more comments

If you are relatively new to Mathematica, I would definitely pick up a copy of "Programming with Mathematica: An Introduction" by Paul Wellin. This will give you an excellent starting point and solid foundation before you progress to more advanced material. I am still working my way through Paul's book, but it has been well worth it and has really opened my eyes to the power of Mathematica.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.