Mathematica 6

Where Documents meet Applications

Theodore Gray

Wolfram Research, Inc.

The value of interactivity for technical books

Let me start with a bold assertion.

Nearly any book that tries to describe how something works in the world could benefit from dynamic, interactive illustrations.

The value of interactivity for technical books

Why does the tangent function go to infinity?

Does this plot help explain things?

Plot[Tan[x],{x,0,2Pi}]

What about this interactive illustration?

Illustrating Tangent With The Unit Circle

The value of interactivity for technical books

Is there any suject not amenable to interactive demonstrations?

How about insurance law?

The Duty to Settle

The value of interactivity for technical books

These sorts of dynamic visualizations are the logical extension of static plots and tables, and they add hugely to the reader's experience and engagement with the material.

The problem of interactivity for technical books

Unfortunately the cost of creating interactivity has always been very high.

It may be practical for big calculus textbooks, but what about more specialized titles?

Those books rarely have any electronic supplement, and when they do, it's more like sample code than real interactive content.

It's just too expensive.

The real problem of interactivity for technical books

Actually the biggest problem with interactive supplements is not just the cost, but the fact that creating them is not something authors are typically willing or able to do themselves.

There has been a trend for decades to push more and more responsibility for manuscript preparation onto authors.

This is particularly true for technical books that involve complex math typesetting, data plots and the like: It's pretty much expected that authors supply camera ready files.

And if dynamic interactive content is to become common for these books, it's going to have to be done largely by the authors.

Authors are not and don't want to be programmers

Creating interactive applications using Java, Flash, Visual Basic, AJAX, you name it, is a programming job.

There is a guild of people, user interface programmers, who love these systems: They make sense to them, and they are very powerful.

But people who are subject matter experts in something other than programming are, with few exceptions, not going to write programs in these kinds of systems.  It's a whole different way of thinking.

A program for people who are not programmers

This is where Mathematica comes in.

The great strength of Mathematica, the thing that has driven its development for the past 20 years, is that Mathematica is a system designed from the bottom up for people who are not programmers.

But while they are not programmers, they are very smart people who need to express complex, varied, hard-to-pin-down ideas.

Systems that attempt to remove programming by removing language all fail to provide the necessary level of flexibility and power.

Mathematica uniquely solves the problem with a powerful language designed for non-programmers.

Who uses Mathematica?

Wolfram Research has a customer base of over 2 million users.  Most of them are not programmers by trade.

They are educators, scientists, engineers, financial analysis, inventors, video game designers, movie makers: A remarkable diversity of people, often at the leading edge of their field.

They are happy using Mathematica because it's a language that makes sense to them.

And they are productive people!

Over 700 books have been written about or applying Mathematica, and Mathematica has been used to create content for countless others.

Fun fact: All the math in printed US patents is typeset with Mathematica.

The central idea of Mathematica

At its heart Mathematica is a document-centric system.

This presentation, for example, is a Mathematica notebook document being displayed in Slideshow form.

Within a Mathematica document you use language to create output of many kinds.

Expressions

Plotting

3D Plotting

Diagrams

Tables

The central idea of Version 6

The big idea in Mathematica 6 is to extend Mathematica's natural ability to express ideas and create presentations of those ideas to the process of creating dynamic interactive applications.

We have designed a system that allows non-programmers to creating interactive user interfaces using a paradigm they are already familiar with, the Mathematica language.

What does this mean in practice?

To see how this works, let's start with some specific examples of Mathematica input commands.

100!

Expand[(α+β)^20]

TraditionalForm[Integrate[1/(1-α^3),α]]

Plot[Sin[x],{x,0,2Pi}]

ListLinePlot[NestList[4 #1 (1-#1)&,0.3,50],PlotRange->{0,1}]

With[{pts={{1,3},{2,1},{3,5},{4,4}}},Plot[InterpolatingPolynomial[pts,x],{x,1,5},Epilog->{PointSize[0.02],Point[pts]},Evaluated->True]]

Show[Table[Plot3D[Im[Exp[k 2 Pi I/4] Power[1-(x+I y)^2,(4)^-1]],{x,-2,2},{y,-2,2},Mesh->False,PlotRange->All],{k,4}],Axes->False,Boxed->False,BoxRatios->{1,1,1.5}]

With[{loc=RandomReal[{0,10},{10,2}]},ListDensityPlot[MapIndexed[Append[#,#2[[1]]]&,loc],PlotRange->{{0,10},{0,10}},PlotRange->{{0,10},{0,10}},InterpolationOrder->0,Epilog->{PointSize[0.02],Point[loc]}]]

Let's try those again

Let's try those same examples again, but this time made interactive.

A single new function, Manipulate, creates user interfaces automatically.

Manipulate[n!,{n,1,1000,1}]

Manipulate[Expand[(α+β)^n],{n,1,200,1}]

Manipulate[TraditionalForm[Integrate[1/(1-α^n),α]],{n,1,20,1}]

Manipulate[Plot[Sin[n x],{x,0,2Pi}],{n,1,10}]

Manipulate[ListLinePlot[NestList[λ #1 (1-#1)&,0.3,50],PlotRange->{0,1}],{λ,0,4}]

Manipulate[Plot[InterpolatingPolynomial[points,x],{x,-2,2},PlotRange->2],
{{points,RandomReal[{-2,2},{5,2}]},Locator}]

Manipulate[ListDensityPlot[MapIndexed[Append[#,#2[[1]]]&,loc],PlotRange->{{0,10},{0,10}},PlotRange->{{0,10},{0,10}},InterpolationOrder->0],{{loc,RandomReal[{0,10},{10,2}]},{0,0},{10,10},Locator,LocatorAutoCreate->{3,Infinity}}]

Manipulate[Show[Table[Plot3D[Im[Exp[k 2 Pi I/4] Power[1-(x+I y)^p,(4)^-1]],{x,-2,2},{y,-2,2},Mesh->False,PlotRange->All],{k,4}],Axes->False,Boxed->False,BoxRatios->{1,1,1.5}],{p,1,3}]

Manipulate[ListDensityPlot[MapIndexed[Append[#,#2[[1]]]&,loc],PlotRange->{{0,10},{0,10}},PlotRange->{{0,10},{0,10}},InterpolationOrder->0,ColorFunction->(ColorData[colors][#]&)],{{loc,RandomReal[{0,10},{10,2}]},{0,0},{10,10},Locator,LocatorAutoCreate->{3,Infinity}},{{colors,"BeachColors","color scheme"},ColorData["Gradients"]}]

From static to dynamic

Here's an example you might expect to find in a book.

Suppose you want to explain how the relationship  (x^2)+ a (y^3)< b  behaves for different values of a and b.

In a print-only book you might make a table of plots.

Note the compact, straight-forward command that produces this rich result: Let's not forget that Mathematica is still a great system for creating this kind of static content!

Grid[Table[RegionPlot[(x^2)+a (y^3)<b,{x,-2,2},{y,-2,2},ImageSize->100],{a,-2,2},{b,-2,2}]]

From static to dynamic

But look when we get by simply replacing the words Grid and Table with Manipulate.

As with the other examples, note that we have reused the subject matter contents of the example (the RegionPlot) command, and added interactivity with an extremely minimal amount of effort.

We did not need to switch to some other, unfamiliar GUI building environment, write event functions, handlers, or control scripts, deal with window objects, or any of the myriad of other complications required in any other system that allows anything close to this level of flexibility and power.

Manipulate[RegionPlot[(x^2)+ a (y^3)< b,{x,-2,2},{y,-2,2}],{a,-2,2},{b,-2,2}]

Demonstrations Website

Our users have really taken to the new world of interactivity in Version 6.

To give them a showcase for their work we created the demonstrations.wolfram.com website, which currently has over 2500 interactive applets.

And we created a free downloadable player application that lets anyone run these examples.

The details of how this website works will be covered in my talk this afternoon.

Series Steps on a Number Line

Radial Engine

Revolutionary Cup

The Duty to Settle

Tree Bender

Illustrating Tangent With The Unit Circle

Probabilistic Forest Fire Model

Polyhedral Koalas

Basic Statistics of Movable Points

The philosophy of Manipulate

Manipulate is an abstract, high-level description of an interactive application.

The example we just looked at asked for, in a very abstract way, a user interface to let a and b get real number values from -2 to 2.

Manipulate was free to choose any sort of interface to satisfy this request.

Right now it might choose to give us sliders above the output, but if it's running on a device with a small, very wide aspect ratio screen, it might automatically choose to place the controls on the left or right.

(Not a hypothetical question: On handheld pen-based UMPC systems it uses the handedness user preference setting to decide whether to place controls on the left or right by default.)

It's powerful precisely because the description of the interface is vague and open to flexible interpretation.

Manipulate is retargetable and future-proof

Perhaps the most powerful aspect of Manipulate is that it can be deployed using many different delivery technologies, now and in the future.

A clean, simple Manipulate command can be expected to do something sensible in virtually any conceivable future environment.

Have you got a multi-touch table surface computer with a bluetooth mind-reader?  Manipulate will work great with that, just as soon as we get one to port it to.

This is not something you can say about other user interface language: They are generally far too specific to outlast a particular technology.

Right now Mathematica interactive content runs in the free downloadable Player (analogous to the Flash player but for Mathematica content).

Use your imagination to think of other ways it could be deployed, and chances are we're working on it.

It's not just for toys

Let's move on to looking at some more full-fledged examples of what can be done with Version 6.

We've seen simple examples with inputs a few lines long, but the system scales smoothly to very large programs.

The Mathematica kernel and language is designed for serious, large-scale applications, and we have built an interface construction system that matches it in scalability.

IsotopeBrowser

Isotope Graph Navigator.

Wiggle Wab

It's not just for math

We use math and science examples all the time, but that's just a habit.

The technology works just as well for other things.

Large-scale content generation

Andre Kuzniarek is going to talk about how Mathematica can be used to create content for print publication and for export to XML and other formats.

So I'm going to show you some of the other, less well-known ways Mathematica can be used to create content.

Creating a website

One of my hobbies is collecting chemical elements.  So I used Mathematica to make a website about them.

periodictable.com

Video

You might not think of Mathematica as a system for creating videos, but there are some pretty neat things you can do with it.

Grand tour of the world

Animation produced for SigGraph by Yu-Sung Chang, based on CountryData and CityData.

Grand tour of the world

Video periodic table

Animation produced by me, based on 42,480 individual photographs.

Elements of Video

NOVA Samurai version

3D prints

So, that's why I handed out the 3D periodic table prints: They were created in Mathematica.

The 12 stereo frames were sent to the printer as unmodified files created directly by Export.

All the text was laid out in Mathematica, all the images were imported, scaled, and assembled in Mathematica.

I laid that image out once by hand in Photoshop, no way was I going to do it 12 times.

Demonstrations universe

Animation generated from about 1100 selected examples from the Demonstrations website.

Universe of Demonstrations

Chemical Heritage Foundation

It turns out even processing sound tracks is trivial, at least it was in this case.

Rising Column

I could go on

Our users have really started getting into creating interactive content.

On our Demonstrations website we have over 2500 interactive applications, with new ones being added every day.

Some are simple things created in a few minutes, others are large and sophisticated.

They are so interesting that in fact I have a whole other talk about them this afternoon.

Conclusion

Mathematica has always been a powerful tool, but with Version 6 it has reached a new level.

It is and will continue to be a powerful tool for creating content for print publications.

But we hope that more and more people will realize that they can now take that very same content and, with minimal effort, redeploy it as dynamic interactive applications, greatly enriching their works.

There are many opportunities in this for both authors and publishers.