An Interview with Stephen Wolfram
Hal Varian, Mathematica in Education and Research 5 (Summer 1996) 7–9. Associate Editor Hal Varian talks with the creator of Mathematica about Version 3.0.
HV: You've talked about using precedents in Mathematica design. Which precedents were really important to maintain in moving from Version 2 to Version 3?
SW: Well, the first thing to say is that we've worked hard to maintain compatibility, so that any program written with an earlier version of Mathematica can run without change in 3.0, and any notebook can be converted. I guess the good news is that we didn't make any big mistakes in the design of earlier versions of Mathematica that we'd have to go back on now. There are a few very small incompatible changes—I really doubt most people will ever run into them—that are listed at the very back of my book (and in the online help).
As far as new functionality is concerned, yes, I tried hard to follow design precedents that were already set up in Mathematica, because that way people have to learn the smallest number of new concepts in order to use the new functionality. The most important precedents deal with the whole idea of symbolic programming—the notion of setting up symbolic expressions that can represent anything one wants, and then having functions that operate on both their structure and content.
One of the things I think is interesting about Version 3 is the extent to which it validates the generality of symbolic programming. There are certainly some new programming constructs in Version 3, but the fundamental ideas of symbolic programming in Mathematica already existed even in Version 1. There, though, they were mostly used for setting up mathematical kinds of things, together with graphics and so on. But now, in Version 3, they're used for a lot more things, like setting up notebook documents and user interface elements. The fact that the same symbolic programming primitives work for those as work for math kinds of things, I think, really validates the idea of symbolic programming being something pretty general.
HV: What were the components of Mathematica that were changed the most? Integrate? Solve?
SW: We worked on Version 3 for about five years, and a huge amount of new stuff is in it. Actually, I think the source code for Mathematica more than doubled in size from Version 2 to Version 3. I guess in general the idea in Version 3 was both to deepen and broaden the capabilities of Mathematica. Deepen in the sense of taking functions like Integrate whose basic description was already set, and making them cover more cases, work more efficiently, and so on. Broader in the sense of adding completely new functions that make Mathematica able to do a wider range of things.
HV: I understand that Compile now handles vectors and matrices. What kinds of performance increases are you seeing?
SW: Yes, we've extended Compile quite a bit. It can now handle lots of array operations, list manipulation, functional programming, and so on. Pretty much any operation where the structure of the output can be predicted just by looking at the structure of the input. (It can't handle functions like Cases where the form of the output depends not only on the structure, but also on the data, in the input.)
The speed increases one sees depend on a lot of details, but they're quite often factors of twenty or more. In fact, compiled Mathematica code now often seems to be faster than at least the most straightforward custom implementations in C. At least, that's what I've found for some of my cellular automaton programs. And actually, we've discovered some pretty interesting general things from studying the behavior of Compile, that I think we'll be able to use to do some rather spectacular things for the speed of numerical operations on larger data sets in Mathematica in general. But that's for the next version...
HV: How has the Graphics system changed?
SW: The main changes have to do with integrating different kinds of elements into Mathematica graphics, and being able to import and export graphics easily. There are a few new basic options and things, mostly to help people produce top-quality publication graphics. An example is Offset, which lets one place objects in graphics with a certain absolute offset from a particular point. Other examples have to do with fonts, which can now be controlled in much more detail.
As you know, one of the big things in Mathematica 3.0 is the typesetting system, and an important feature of graphics in 3.0 is that you can now put fully formatted expressions, with whatever special characters, styling, etc. you want right into graphics.
Another thing in graphics in Mathematica 3.0 is that you can use the Display[ ] function to tell Mathematica to output your graphics in a whole collection of formats—EPS, TIFF, GIF, etc. You can also tell Mathematica an absolute size that you want a graphic to show up in a notebook, or an absolute resolution.
The new programmable notebook system in Mathematica gives some more capabilities as well; for example, you can generate a collection of graphics, then immediately send a command to the front end to have Mathematica start an animation of these graphics.
HV: How about upward compatibility?
SW: As I already said, programs should be essentially 100% compatible; notebooks should be 100% convertible. One thing that's happened in Mathematica 3.0 is that we've been able to get rid of platform-dependent .mb cache files. Now all notebooks are in .nb files, and the .nb files are identical from one platform to another. When you try to open a .ma file, Mathematica will let you convert it to a .nb file that will then work on any platform. By the way, the Notebook Conversion dialog also has an option for letting you convert all the notebooks in a particular directory. The option is just a check box, and it's rather easy to miss. But I've found it very useful.
HV: Can you tell us a bit about the typesetting capabilities?
SW: What we wanted to do was create a "no compromises" typesetting system that would make things look great on screen and on paper, and allow everything to be edited and interacted with very easily. We wanted the system to work with math, with tables, with text, and so on.
I think it all worked out extremely well. It's easy to enter things. And you can evaluate what you've entered. And then you can edit or reuse any part of your results.
Being able to do what we did with typesetting isn't easy, and in fact it wouldn't have been possible if it wasn't for the symbolic programming language that we already have inside Mathematica. In fact, even doing something as seemingly straightforward as breaking a mathematical expression across lines requires a kind of understanding of the structure and meaning of the expression that makes use of a lot of symbolic programming ideas.
HV: What about the World Wide Web capabilities?
SW: You can use HTMLSave[ ] or Save As HTML to save a Mathematica notebook as an HTML document. Of course, when the notebook is converted to HTML, it's not nearly as good as when it's a live notebook. The formulas have to get turned into bitmaps, for example, because there's no way to represent math in HTML. And of course you can't evaluate a piece of HTML.
I find that the best way to interact with Mathematica on the web is to store everything as a notebook, and then to set my browser so that Mathematica or MathReader is a helper app that is used to open anything with a .nb file extension. This works well. And actually Mathematica notebooks can have hyperlinks that go to http addresses, so you can get back into your web browser even once you've gone off into the notebook.
In addition to Mathematica documents, it's also possible to interact with Mathematica computations on the web. We've got an example of that at //www.integrals.com. It's a site where people type in integrals, and Mathematica does the integrals, and displays the result. The site works by connecting the web server via MathLink to the Mathematica kernel.
It turns out that the Mathematica language is actually a very good way to
specify not only the form but also the function of a web site, and we've
been working for some time on a major new technology called ActiveSites
that takes advantage of that. But that's for another interview.
Editor's Note: See the column by Matthew Thomas, this issue.
HV: How easy is it to convert an archive of papers in TEX to Mathematica 3.0?
SW: It depends. We do have quite a bit of technology for converting from TEX to Mathematica, that we'll be making available sometime early next year, and on many kinds of TEX documents it works very well. In fact, we used it to convert my whole Mathematica book—which was originally in TEX—into Mathematica notebooks. But we can only be sure that our convertor will work if the TEX you use is fairly stylized. It's the same issue as when you submit a paper in TEX to most journals—they don't want you to have your own macros and so on, because they want to be able to treat TEX like a markup language, where you indicate a section head by \section, not by a bold, larger, font change.
So, the basic answer to your question is: If your TEX is well stylized enough, our automated convertor should work well. And in fact, it'll have ways that you can extend it for your own documents, etc. as well.
HV: How do you see these new capabilities affecting technical communications?
SW: Gosh. Well, the biggest thing is that I'm hoping we'll see more and more interactive papers being produced: papers where you can not only read about something, but also do something—right there in the notebook. I think that a lot of things that we've done with Mathematica and with Mathematica notebooks have blurred the boundaries between documents and programs. And that's going to mean that it's increasingly realistic for people to publish programs as well as descriptions of things. What I'm hoping is that in the future papers will routinely include not only words and pictures, but also data, programs, user interface elements, and so on. So if I want to do something with the contents of a paper—say run my own model on the data it describes, or use its program on my data—I can immediately and seamlessly do that. And the availability of Mathematica as a kind of universal language is critical to making that possible.
HV: How has the Help system been improved?
SW: One thing is that we've now got my complete Mathematica book, as well as the complete Guide to Packages, and all the other standard Mathematica documentation, online, as Mathematica notebooks. So you can read them on the screen, evaluate or copy examples from them, print them, and so on. You can also search them, directly or by using a master index. There's really a lot in the Help system now. One thing I encourage you to look at are the demos. They are kind of buried under Getting Started/Demos. But I think people will find them pretty interesting—both as examples of what Mathematica can do, and for actual material they discuss.
HV: Can you give us some examples of unusual notebook designs using the new palettes and hyperlink examples?
SW: The best place to look for these is in the demo area I just mentioned. One thing to look at is the Polyhedron Explorer. It's a palette-based notebook that lets people explore operations on polyhedra. It's fun and educational, and it's also a good example of how one can build a custom user interface in Mathematica 3.0. I might also mention that the About Box for Mathematica 3.0 is just another notebook. But like many of the demo notebooks, it doesn't look or act much like a traditional notebook.
HV: What role do you see palettes playing in mathematical education?
SW: One of the big things about palettes is that they let one use Mathematica just by pushing buttons. So that means that it's easy to set up lots of operations, and have students try them out just by pushing buttons, without ever having to figure out how to type anything. I'm sure we'll see some really neat things done with palettes over the course of this year. I know that quite a few of the courses that are based on Mathematica are planning to do revisions using palettes, and I think it'll be exciting to see what gets done.
HV: Are there brand new capabilities that didn't exist in previous versions?
SW: Lots and lots! We've worked hard on Mathematica 3.0 for five years, and actually we've more or less doubled the size of the internal code for the system in that period of time. So there'd better be a lot of new things! A good way to find out what's new is to look at my Mathematica book. In the Reference Guide, every new function—and there are hundreds of them—is indicated by a +. There's also a summary of what's new in the front of my book, and at the back of the First Look booklet that's excerpted from my book.
HV: What demands does Mathematica place on the platform? I understand that you have some clever ways to deal with disk space issues.
SW: The amazing thing is that even though Mathematica 3.0 does much, much more than Mathematica 2.2, it ends up not needing a bigger computer. The reason is some clever software engineering tricks that we invented to save memory. And what I think we can say on all platforms is, that if you can run the current version of your operating system, you'll also be able to run Mathematica.
As far as disk space is concerned, Mathematica 3.0 does need quite a bit more of that than Mathematica 2.2 did. To store the whole on-line Mathematica book and everything typically takes 100 megabytes or so. To store only programs takes much less—perhaps 20 megabytes. But one neat thing we've done is to set everything up so that if you want to, you can run with zero megabytes of hard disk space—you execute Mathematica directly off a CD-ROM. Once it's started up, this actually works quite well, and I myself have used this capability quite a few times.