70
$\begingroup$

I have used Mathematica for several years but at a pretty low level - piecing together built-in function inefficiently and fearing the sight of # and &'s when I see others use them (I never do). I would like to improve my skills.

Which book would be best to read for someone familiar with Mathematica basics but would like to learn more sophisticated uses of Mathematica?

$\endgroup$
0

8 Answers 8

73
$\begingroup$

After having used Mathematica for a couple of years, more or less only to abuse it as a neat plotting and integral solving engine, Leonid Shifrin's Mathematica Programming was my first book that brought me closer to actually understanding how Mathematica works. I soon lost my fear of # & @ @@ @@@ /@ //@.

(Plus the book is free, and if you still need help: Leonid is a regular on this site.)

$\endgroup$
8
  • 1
    $\begingroup$ +1 GREAT! I've always wanted to understand the # & @ @@ @@@ /@ but they always said me to read Mathematica's documentation, but I never understood from there. $\endgroup$
    – Red Banana
    Jun 18, 2012 at 3:16
  • $\begingroup$ Hi Leonid! Are you preparing a next version of your book ? I think it would be worthwhile to publish a traditional styled book on paper. $\endgroup$
    – tchronis
    Oct 18, 2013 at 10:46
  • $\begingroup$ plus that Leonid's book contains a list of the other must-reads $\endgroup$
    – eldo
    May 26, 2014 at 7:43
  • 4
    $\begingroup$ @H.R. Thanks! This is great to know. Yes, I did write it in .nb. At some point soon, I will publish the nb version. $\endgroup$ Jan 27, 2016 at 11:23
  • 1
    $\begingroup$ @geom For example, from here $\endgroup$ Jun 7, 2023 at 22:45
36
$\begingroup$

Easily one of the best books ever written on Mathematica is David Wagner's Power Programming with Mathematica: The Kernel.

It was written more than ten years ago at a time when version 3 of Mathematica was current but is every bit as much relevant today as it was then since the foundation on which Mathematica is built has not changed that much over the intervening years.

Unfortunately the book is out of print and it may be difficult to locate a used copy ... a university library however should be able to obtain a copy easily through inter-library loan. This beautifully written book is well worth the trouble of tracking it down.

As an aside question: does anyone know where David Wagner is today?

EDIT

In the interest of completeness, Wellin's An Introduction to Programming in Mathematica is also worth mentioning here (nice section on front-end programming and provides example of a complete DSL implementation in Mma) in addition to Maeder's Computer Science with Mathematica (especially helpful for those trying to use Mma in a OOP style), Mangano's Mathematica Cookbook (full of in-depth recipes for a multitude of concrete problems), Wagon's Mathematica in Action (focused on solving mathematical problems in Mma many of a recreational nature) and Trott's four-volume Guidebooks on Numerics, Programming, Symbolics, and Graphics (which includes thousands of pages of examples of Mathematica being used to solve a wide range of different problems with in-depth discussion and demonstration of Mma programming language features).

There are of course many more Mma books out there. These are just some of the titles that I've found most useful over the last decade or two using Mathematica.

$\endgroup$
7
  • 5
    $\begingroup$ This book was my primary source of mma knowledge, although I already knew a few things before getting it. I keep recommending it on SO and here. As to David Wagner himself, I tried to get some traces of him, but wasn't successful. He somehow disappeared around 1996 or so, and did not finished his second volume, which was supposed to cover MathLink. I hope he is alive. It might be that he quit from any Mathematica - related activities completely, and is doing something different now. $\endgroup$ May 2, 2012 at 8:50
  • $\begingroup$ Unfortunately there is a dearth of publicly available information on the deep inner-workings of the Mathematica kernel and the front-end. An authoritative reference from Wolfram would obviously be welcomed by much of their target audience (as forums like this one easily prove) and I hope Wolfram will consider publishing one in the near future after finding a way to protect their intellectual property in the process. Until then, we can refer to our photocopies of Wagner (for kernel-related matters at least). $\endgroup$ May 2, 2012 at 20:28
  • 3
    $\begingroup$ I proudly own the original book (not the photocopy) :). I bought it from Amazon for $40 in 2004, now it is usually much more expensive there (when available). And I had no idea what I was buying, at the time - had no access to it prior to that. $\endgroup$ May 2, 2012 at 20:30
  • 1
    $\begingroup$ Thanks! I am at work on another book with much more material and different organization, but with the current volume of work it's hard to put any time frame on that. The book you refer to is more aimed at a beginner or somewhat intermediate level. I wrote it 4 years ago, and didn't do much with it or the web site since about 3 years ago (which is a shame). $\endgroup$ May 4, 2012 at 7:39
  • 1
    $\begingroup$ @Peltio No, highly unlikely. The author of the book was already a professor in 1996 and this chap is looking for a postdoc position in 2024, so he mush be much much younger. I also could not find any trace of David Wagner who wrote that most excellent book on Mathematica kernel programming. Btw, the book is now officially available for free in electronic form. $\endgroup$ Jan 21 at 14:26
14
$\begingroup$

Mathematica core programming has not changed much during the years. So, if someone has an interest in learning how to effectively program in Mathematica, older books - even those dating back to version 2.2! - can be of use.

Personally, I believe one of the best books in this sense is

Thomas B. Bahder
Mathematica Programming for Scientists and Engineers
Addison Wesley, 1995

It is a 1995 book, aimed at version 2.2 (version 3 was still in the works). Nonetheless this is one of the best references for mathematica core programming that I have read. Ever. The only parts of the book that did not age well, obviously are those relating to graphics and import but that should not be a reason to shun this book. The following chapters

Ch1 The Building blocks
Ch2 Working with Lists
Ch4 Scoping Constructs
Ch5 Functions

Could make their own book with the title: "Pure Mathematica in a nutshell". The other chapters on Symbolic and Numerical computations (including those on matrices, ODEs and PDEs) exemplify the application of the basic core notion to actual computing. The part I like the most is the way Bahder uses pattern matching to shape function calls in order to make them very general. This book really show the giant leap between procedural programming and functional/rule-based programming.

I am not sure this book is still in print; after having read it many (too many :-) ) years ago, I recently acquired a used copy from the Am[censored] marketplace for 15 bucks. It would be nice if this book could be made available as "Power Programming in MMA" was, because it deserves greater visibility.

$\endgroup$
2
  • 4
    $\begingroup$ +1. It's funny that you mention this book as I'm actually reading it right now and saw your post. Completely agree that this is one of the good old books on Mathematica and has never been mentioned on this site. One aspect you didn't mention is how useful this book is for those that constantly need to transfer data from files to be analyzed in Mathematica. He covers a great deal in Chapter 11: Input and Output. I ordered mine a few months ago for just 6 dollars and is probably the best 6 bucks I've ever spent. $\endgroup$
    – RunnyKine
    Oct 6, 2013 at 12:49
  • $\begingroup$ Great book! Lacks a chapter on performance tuning/profiling as well as a chapter on debugging. +1 for Chapter 11: Input and Output. The rest of the book is must read for scientists/engineers which can't be said for Wagner's and many other books mentioned in this thread. $\endgroup$ Dec 22, 2022 at 3:34
13
$\begingroup$

I really don't like to read old books, but these days, following @Leonid advice, I start to read Stephen Wolfram's The Mathematica Book (version 5.2). It can be downloaded for free here. I strong recommend it for everybody that wants to have a deeper understand of Mathematica. Even though the program is currently in version 9, the core operations are almost the same.

enter image description here

$\endgroup$
8
$\begingroup$

I would recommend -

  • The Student's Introduction to MATHEMATICA :A Handbook for Precalculus, Calculus, and Linear Algebra
  • Programming with Mathematica by Paul Wellin.
  • Leonid Shifrin's Mathematica Programming

Also don't forget the documentation available online, particularly the pdf on the core language.

In response to comments below. I only started learning Mathematica and in particular how to program mathematica in the last few months but i have a background in C/C++/Java. The first book listed above i found to be an excellent general introduction to mathematica that covers a lot of the basics and gets you going in how to use it to solve problems in calculus, linear algebra etc, the final chapter is also a very good introduction to programming mathematica. I found Paul Wellins book to be a very good follow on from this, its goes into much more detail on the programming side and if you work thru the problems at the end of each chapter/section you really learn a lot. IF you work your way thru Paul Wellins book you will be well on your way to learning how to program mathematica and you will also get much greater insight into just how powerful mathematica is a tool.

Regards David.

$\endgroup$
2
  • 1
    $\begingroup$ 2 of the three you listed were already mentioned in other answers. Please make sure that suggestions are not being duplicated. As for the remaining one, please explain why you recommend it, as that is what will help future visitors make an informed decision. $\endgroup$
    – rm -rf
    Feb 16, 2013 at 1:03
  • 1
    $\begingroup$ @rm-rf This QandA is evolving strangely. Some answers are heading towards being one person's recommendations of a few books, rather than a single book. But then should answerers add their opinions about a book to the other post - could get messy if individual paragraphs of an answer are different people's opinions. $\endgroup$
    – cormullion
    Feb 16, 2013 at 8:17
7
$\begingroup$

A few years ago, I started getting deeper into Mathematica while doing mathematical physics. I stumbled upon this question on StackExchange. I found the answers very useful. I feel that after all these years I can add something to the existing responses based on my personal perspective and reflection. IMHO, at least one great was book mentioned only in passing: Roman E. Maeder's Computer Science with MATHEMATICA. If you are one of those people who fly on planes who don't want to know anything about the Navier-Stokes equation, please stop reading the rest of my post before you get the urge to downvote my answer.

The first milestone in understanding how MMA works under the hood for me was understanding John McCarthy's paper Recursive Functions of Symbolic Expressions and Their Computation by Machine, Part I. I found familiarity with Structure and Interpretation of Computer Programs by Harold Abelson, Gerald Jay Sussman, and Julie Sussman very useful. My next step was not a book but rather a series of three video lectures on Wolfram Programming Language Fundamentals by Professor Richard Gaylord.

  1. https://www.youtube.com/watch?v=H-rnezxOCA8
  2. https://www.youtube.com/watch?v=H-rnezxOCA8
  3. https://www.youtube.com/watch?v=u1Oijydu4qI

They are accompanied by a transcript. The indispensable parts of the transcript are pages 29-35 (Exercise). I can't recommend them enough.

If one is to read a single book on MAA internals, then the aforementioned David Wagner's Power Programming with Mathematica: The Kernel is perhaps "the best". However, even Dr. Wagner, in arguably capstone chapter 7 (Expression Evaluation) refers multiple times to chapter 10 (Rules-Based programming) of Roman E. Maeder's Computer Science with MATHEMATICA. Chapter 11 (Functions) and Chapter 12 (Theory of Computations) of Maeder's book take us back to John McCarthy's paper and theoretical research preceded it.

Dr. Maeder was doing a three-year post-doc in the department of computer science at the University of Illionis Urbana Champain when he became employee number two or three (depending if you count Dr. Wolfram as an employee or just the owner) of Wolfram Research. Dr. Maeder wrote a few other highly acclaimed books on Mathematica. Dr. Wagner was running his own consulting business at the time of writing the Power Programming book after resigning his associated professorship in theoretical computer science at the University of Colorado Boulder. Dr. Maeder is one of the principal architects of Mathematica. Dr. Wagner is John Lions of Mathematica (pun intended). Both of them had a primary interest in theoretical computer science and programming for the sake of programming rather than in doing scientific work (math-physics in my case) with Mathematica.

One of the earlier responses mentioned chapters 1,2,4, and 5 of Mathematica for Scientists and Engineers by Thomas B. Bahder. I have a copy on my desk. It most definitely those four chapters contains sufficient amount of MMA core programming for 99% of users with scientific/engineering background. However, it also contains still very readable chapters on Symbolic Calculations (Chapter 6), Numerical Calculations(Chapter 7), Vectors, Matrices, and Tensors (Chapter 8), ODEs (Chapter 9), BVP (Chapter 10) and my favourite Input/Output (Chapter 11). What it completely lacks is a chapter on Profiling (Performance Tuning) and a chapter on Debugging. That is were Wagner's book Power Programming really shines.

Finally, the Mathematica Journal is full of little gems like this: Demystifying Rules by Dr. Nancy Blachman.

My final words of wisdom is that Wolfram Language should not be one of your first computer programming languages but most definitely the last programming language you will ever need to learn. In case you care I grew up learning Basic, Pascal, Fortran 77, and C in that order before adding AWK, KSH93 and no less than half-dozen of other langauges. I tried and failed miserably to raise my kids around Forth and Scheme. Not counting TeX/LaTeX, I use only two langauges (Julia, MMA) close to 3 hours a week which is a bare minimum for maintaining languge competency.

Disclaimer: It appears that Mathematica was heavily influenced by Kenneth E. Iverson's APL beside LISP. Even though APL's central datatype, the multidimensional array, is very important in mathematics and science, I have never personally seen a single line of code written in APL or its sucessor programming language J. I could blame Fortran, MATLAB, or my birthday for it but that is the reality. While in chapter 10 (Rules-Based programming) of Computer Science with MATHEMATICA Roman E. Maeder points straight to Prolog, now forgoten logical programming language, neither Maeder nor Wagner mention APL even in passing which is astonishing considering semantic similarities with MMA. This similarity is not only superficial. When working with list data type in MAA one should be all too aware that unlike Lisp which implements list data type via linked lists, Mathematica uses arrays to implement list data type.

$\endgroup$
2
  • 1
    $\begingroup$ (+1) Especially for the APL connection. A cross-ref to Todd Allen's post on (legally!) getting David Wagner's book $\endgroup$
    – user1066
    Dec 25, 2022 at 10:00
  • $\begingroup$ Nancy Blachman's article is not directly accessible through Wolfram website, but I found an Internet Archive version here. $\endgroup$
    – B215826
    Dec 17, 2023 at 13:52
5
+50
$\begingroup$

For mathematical practice I consider the best

Mathematica®: A Problem-Centered Approach - Robert A. Hazrat,

or a bit older

Mathematica® in Action - Stan Wagon

For invent procedures or solutions

Programming with Mathematica: An Introduction - Paul Wellin

and for for practical applications such as working with - for example - biological data

Mathematica Beyond Mathematics: José Guillermo Sánchez León

Unfortunately, I still lack any practical textbook, which works with news from version 10 up (e.q. Dataset, some news plots & graphics, Machine learning, 3D geometry, cloud(!)...)

$\endgroup$
1
  • $\begingroup$ Thanks for the answer. You even have a new book, even if it doesn't cover all of the new stuff. $\endgroup$
    – Michael E2
    Dec 3, 2017 at 19:48
4
$\begingroup$

I found that Schaum's Outline of Mathematica (2nd Edition) to be a great value starter book for just getting your feet wet with working with Mathematica. It's the only book I have actually bought so far and it starts without getting into too much technical detail until later. It covers all the basic parts of the language with lots of practice problems and answers which will get you more comfortable with the Mathematica functional programming syntax.

But it defers the more advance topics of Pure Functions, Patterns, Contexts and Modules to the Appendix which you will probably need to learn from another book or from reading tutorials on websites such as this one or from the help documentation included with the software.

A few of my aha moments with this book has been the generality of working with lists in Mathematica and later combining data lists with pure function and mapthread (&/@ has become my favorite command) to really speed up coding and plot generation.

$\endgroup$
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.