Message Boards Message Boards

Mathematica as the media for thinking about the unthinkable

Dear community members, after watching this video by Bret Victor, I'm wondering if Mathematica could become the media for thinking about the unthinkable. What are your thoughts? How easy would be to replicate and extend the examples shown in the video using Wolfram Language?

Bret Victor - Media for Thinking the Unthinkable

enter image description here

15 Replies
Posted 8 years ago

The title should have been Yet Another Graphics Program. I don't see any encouragement to think, quite the opposite in his caution to "forget the details, just trust me". The graphics are tuned and colorful but what's novel? Even GeoGebra has sliders. Show me a demonstration that produces an Aha! moment, a QED moment. The demonstration is more like the trend to tune a model to produce a predetermined output and claim to have done "science".

POSTED BY: Douglas Kubler

I looked at this video and several others by Bret Victor. The examples he gives are interesting, but I don't think that they scale.

I think that the most important thing is interactivity, whether one is manipulating graphics or writing code snippets. Fro the most part, I think it would be faster to build up a graphic or an analysis by building up Wolfram Language code than to do all the (similar in principle) steps needed to make a graph directly.

More could be done in Wolfram Language, of course. The suggestions bar could be made more robust, and the function to roll up all the changes made with the suggestions bar could be made more robust. It should be possible to have a command like "Turn this into a function" or even "make these functions into a package". The idea is to make things as transparent as possible. There are some actions in WL that tend to break this transparency.

I used to write music. I started with this at a time when you had to use pen and paper. I welcomed even the most primitive software. However, none of it is transparent. Right now, with software like Finale, you can play on a keyboard (or use a microphone for a flute or Violin) to enter music. It is certainly more transparent than using the computer keyboard to enter one note at a time, but there are drawbacks. First, you need to be really competent in the instrument to make it work. Second, there is still an awful lot of work to clean up even the best transcriptions. Third, it works best for things like simple music or choral music. For complicated stuff, a composer still needs to have the fine control that only manipulating single symbols provides.

In a similar way, direct graphic manipulation to make code may be useful for a lot of simple cases, but there comes a point where only code will do well. For some things, such as 3-D plots or large data sets, direct manipulation would be much harder than code. What Wolfram Language provides is a faster, more intuitive (in the right hands) way to get things done with code.

Having said that, it would be nice to have more widgets for directly manipulating graphics in Wolfram Language.

Free standing Mathematica DynamicModules or Java applets are very nice and have their place. It would be nice if a DynamicModule could be converted to a Java applet within Mathematica and then put on a web page.

Nevertheless, we must recognize that these objects are rather small boxes. For example, Bret Victor's applet that Nasser points to has just a single 2D Slider as a control. (There are two examples but they are basically the same.) So this is indeed a small and restricted box! But a very nice display - Bret does have style.

If you want to do mathematics, science, engineering, physics or economics there is a much larger box you can work in - by many orders of magnitude. It's called a Mathematica notebook. Even better are notebooks backed by applications. DynamicModules can play (a modest) role in notebooks. The entire notebook, Mathematica and supporting applications will breath a more vibrant life into them.

There is too much effort in trying to provide "Mathematica without Mathematica". I don't think these efforts are really that successful as a means of communication. They don't really serve the scientific community. I'll believe the scientific community is being served when I see Mathematica notebooks on http://arxiv.org/. If students go to university they have to pay tuition, and buy textbooks. If people want computers and internet service they have to pay for it. If you want to fly to a scientific conference you have to pay air fare. If you publish a journal paper someone has to pay page charges. (But not for posting Mathematica applications and notebooks!) So why don't people just buy Mathematica and facilitate their work and communication? Be free to play in the big box.

There is new pricing for Premier service plus for the home edition, which should lower the cost of ownership for many people to a very reasonable level. I have been paying for a commercial license (Premier Service) for many years, and will continue to do so because of other perks. However, the cost is trivial compared to what I can do using Wolfram Language on the desktop with all the bells and whistles.

The student versions are dirt cheap when compared to books, graphing calculators, etc.

There is also the Raspberry Pi, which is really cheap but which requires a bit of tech savvy.

None of the alternatives (CDF, etc.) in my opinion come close to providing the functionality of the full Mathematica.

Please no Java applets! Java is dying, chrome is already blocking them, most mobile phones and tablets can't/don't run them. Definitely not good to invest in Java. It will die soon, like flash did. Javascript is much better choice nowadays, it is very 'hot', and most browser do a lot of tricks to run it incredibly fast!

POSTED BY: Sander Huisman

Bret Victor frequency response of the filter example shown in the video (at 18:10 time), he has on his different web site, that one can interact with directly also. (bottom of the the page).

Of course, one can do this example and much more using Manipulate and Dynamics. Many examples at Demonstration site. But the nice thing about this example, is that it runs directly inside web page, and runs smoothly, with no additional installation of anything by the user.

If there is a way to compile Manipulate to Javascript (and any kernel code needed of course) and somehow be able to run Manipulate inside web page without any plugin, this will go a long way to make Manipulate more popular.

POSTED BY: Nasser M. Abbasi
Posted 8 years ago

Ruben,

You ask

How easy would be to replicate and extend the examples shown in the video using Wolfram Language?

An my view is

I will not be easy at all, except if you try small toys like those in the Mathematica Help system.

Although one can elaborate tiny examples (small toys) mimicking some aspects of the Bret Victor’s presentation, I think that, as per today, the Wolfram Language cannot be considered as «the media for thinking about the unthinkable» in the Bret Victor’s sense.

Could it be the day after tomorrow? Perhaps it could, but not as it is now.

In general, the dynamic architecture of the Wolfram Language collapses (freezes) as soon as you attempt something complex beyond a well curtailed essay for marketing or classroom purposes, or for making a piece of software for the Demonstration project. (By the way, I guess that it could have been the same with the Bret VictorÂ’s video show: namely, the content could have been carefully chosen to fit his idea in the presentation, I would like to see a a Bret Victor like real life solution).

The unquestionable fact that WRI does not fix many bugs or bad functions that clearly affect the smoothness and functionality of Dynamic and correlated, among others, is in my opinion, a corroboration of it, (see my posts on inefficiencies of Locators in MathGroup for a reference, whose solution, as far as I know, has not been tackled at all). Remember that locators are a key tool in the VictorÂ’s show, however used in a very very simple way.

You asked and I share my humble opinion. It is my personal experience after 8 years of working with Mathematica on very similar subjects in different fields, in a very similar way to the one presented by Bret. Working on dynamic pieces of software since the appearance of Mathematica version 6 which was released in May 1, 2007.

What if working with a gigantic supercomputer? Could it change partially the story?... Maybe. But only in the realm of crunching number capacity and not in the adequateness of the algorithms themselves. And it is algorithms which matters: first sofware then hardware.

Anyway, I would appreciate an example of a large enough working system deployed in an industrial environment, or equivalent, as a refutation of my view.

Martin.

POSTED BY: E Martin

I agree with you that it is not easy at all. However, the thing Bret made is probably even so not that easy! I can't imagine another programming language where you can 'whip out' these kinds of programs, he shows some nice visualisation and 'manipulation software' (for lack of better words) but the code behind it is definitely not easy.

POSTED BY: Sander Huisman

I liked Bret Victor's first example best because he turned a static paper into a dynamic paper with far more explanation of the topic and at least one illustration had a slider. The circuit example was more a design tool. In practice it would have to have much more support and documentation. The Jerome Bruner idea of Interactive-Visual-Symbolic (or numerical), that is combining them, is a very good principle of dynamic presentations. The introduction of the Playfair plot on trade balances should remind us that types of presentations that we now take for granted had to be invented. Mathematica gives us a fantastic new palette of tools to convey information. Nevertheless, these are relatively new and it's going to take a lot of experimentation and practice to learn how to best use them. For example, just having a lot of things that move around can end up being quite confusing. Bret's difference equation is again a design tool. It seems to put the user in a restricted box. The polygon example was difficult for me to follow because he was trying to explain too many things in too short a time.

Another thing I liked a lot about Bret's presentation is that a number of the examples had a very nice free form and quite appropriate composition. He mixed graphics, dynamics, text and code just as if he was writing on a sheet of paper. I wish Mathematica had more of a paradigm for this. Mathematica's composition is rather chunky and clunky.

Another feature that Bret Victor had was the invisible slider to vary a displayed number. Does anyone know how to do this in Mathematica?

If you look up Bret Victor on YouTube, there are quite a few of his videos. Another one that I liked, which was a larger picture, was "The Human Representation of Thought".

There is, by the way, a rich history of innovators concerned with human-machine interaction who have brought us to where we are. Much of it is chronicled in Walter Isaacson's The Inovators. But, alas, the index doesn't even mention Mathematica, Wolfram, Adobe, LaTex or Knuth. Technical publication doesn't make the cut.

What I care about here is the Wolfram Language, Mathematica and applications as a publication medium. Almost everything is there. There is only one problem. As a medium for communicating information, it and others such as Bret Victor have competition. That competition is the millennia old, static written paper with textual discussion, equations and diagrams, and its offshoot, the nearly static PDF document. Static documents are winning hands down. Why? Maybe because it seems too difficult and maybe because most users don't see examples. Few are done. The nearest thing is the Demonstration project, which are good practice and exploration of dynamic techniques. But they don't raise to the level of extended publications.

So, as an example, I thought I would post snapshots of a notebook that might raise to the level of a publication and using the active and dynamic features of the Wolfram Language. The notebook concerns the fact that orbits in the Schwarzschild geometry in general relative can be calculated exactly using the Weierstrass Elliptic function. This seemed to have been only realized in this century and I only found out about it from Ron Burns, a retired physicist who was using some of my packages, and who sent me a short notebook on it, doing the calculation for Mercury and a pulsar. I found it so interesting that I decided to turn it into a longer tutorial and learn some of the features of elliptic functions, of which I had little knowledge. It also serves as a good example of why a Wolfram Language publication supported by applications is far superior to static printed publications.

Here is a screen shot of the beginning of the notebook. The first thing to notice is that it's supported by two applications: a UnitsHelper application that was used to introduce reduced geometric units, and the Presentations application that helped me custom design dynamic displays. The more usual case might be that the author might have his own application supporting the general subject matter and it might be used for a number of papers.

enter image description here

The reader, having Mathematica, can of course do the calculations in the notebook and can also try his own calculations. So there is a small paste palette for the most common symbols in the theory. There are also palettes that go with the supporting applications and the notebook uses a Stylesheet from one of them. The ability to actively calculate can eliminate many errors and typos that plague static printed papers. It's still possible to make errors but the overall integrity of a notebook is much higher than a static paper. In this notebook there are inline references using openers that give the details and links to web documents when they exist.

In the Introduction to the Weierstrass function there is a Crib Sheet that gives the main definitions and identities of the function.

enter image description here

The Crib Sheet is launched as a side window. The various formulas can be pasted into a notebook. At the bottom of the Crib Sheet there are template paste buttons for the relevant Weierstrass functions and links to their help pages.

One feature I often use in notebooks is to write a specification for a graphic or dynamic display just where it is used in a notebook but then (semi) permanently close the cell. To notify the reader that the cell has to be evaluated I place an Eval button in the text cell preceding the display cell. The Eval button has a tooltip telling its purpose and also how the closed cell could be opened. And it's easier to click the Eval button than to fish for the closed cell bracket.

I also sometimes use cell buttons that give the user the choice of generating a predefined display in the notebook or as a side window. The advantage of side windows is that if there is extensive discussion in the notebook then the display won't scroll out of view.

There is a fair amount of calculation in the notebook demonstrating the properties of the WeierstrassP function and its physical application, which I'm not showing here. Rather I'm showing the features a notebook has over a static publication. The following dynamic display shows how the WeierstrassP Function tiles the complex plane. The function is defined by two parameters, g2 and g3. The graphic on the left shows the domain that gives real turning point values (e1, e2, e3), that correspond to real trajectories. The red points show the poles of the function. The green points show the turning points in one cell. The top of the tile plot is graduated in terms of 2 Pi and you can see that the real part of the elliptic period is different.

enter image description here

The display also illustrates the technique of combining dynamic graphics with numerical or symbolic data. Here we can print the data into a notebook as an Association. Associations are a very nice feature of Mathematica because, among other things, they provide context for the numbers.

<|"g2" -> 0.0469463, "g3" -> 0.000755332, "\[Omega]1" -> 3.81324, 
 "\[Omega]2" -> 0. + 4.2424 I, "\[ScriptCapitalE]" -> 1.04526, 
 "\[ScriptCapitalL]" -> 5.24236, "e1" -> -0.0991574, "e2" -> -0.01647,
  "e3" -> 0.115627, "\[Rho]1" -> -31.5974, "\[Rho]2" -> 7.47793, 
 "\[Rho]3" -> 2.51306|>

Another view of the WeierstrassP function is given by showing a surface plot of the real value along with a matching contour plot and scans through the horizontal and vertical turning points. The surface plot is rotatable and the contour plot is well annotated with tooltips. This also reminds us that Mathematica notebooks can freely use color, which is rare and expensive in printed papers. Also printed articles usually have page charges whereas notebooks can be longer without extra monetary expense. You are freer to explain in more detail when you think it is useful.

enter image description here

Getting to the physics, the supporting UnitsHelper application allows us to use geometric units where the gravitational constant and speed of light are taken as equal to 1.

SetupReducedUnits[{Quantity[1, "SpeedOfLight"], 
  Quantity[1, "GravitationalConstant"]}, {Quantity["Meters"], 
  Quantity["Amperes"], Quantity["Kelvin"]}]
{"Kilograms" -> 7.43*10^-28 "Meters", "Seconds" -> 299792458 "Meters"}

A key part of the tutorial is the transformation of the geodesic equation in the Schwarzschild metric (taken from a text) to the differential equation that defines the WeierstrassP function.

enter image description here

In that derivation there are tooltips on each expression showing the Wolfram Language expression that produced it. We can finally get to calculating and plotting some orbits.

enter image description here

The green section of the g2-g3 domain is the region that gives bound orbits.The upper edge gives circular orbits and the lower edge gives highly elliptical orbits, so elliptical that they look like a ticking hand of a clock. All the perihelion advancement is near the center. A red locator can be moved to select a domain point but there is a problem because the green region becomes a narrow slice at the upper right and that's where many interesting physical cases occur. However, extra precision is used in the dynamic and the g3 slider automatically puts the locator within the thin slice. This is a case where the dynamic presentation must be adapted to the particular conditions of the case. I usually use a DynamicModule for these displays because they give me greater ability to control the composition of the display.

There is also a similar domain-orbit dynamic using the radial turning points of an orbit. The green locator can be used to pick the radial parameters, or they can be entered in the InputFields. Here a highly elliptical orbit is shown.

enter image description here

The orbits are determined by two parameters but there are choices of which two parameters are used. The user is provided by a routine that allows any pair of parameters and returns all parameters as an Association

step1 = AllOrbitParameters[\[Omega]1\[Omega]2][4.7, 5.5 I]
Inactivate[
 AllOrbitParameters[\[ScriptCapitalE]\[ScriptCapitalL]] @@ ({"\
\[ScriptCapitalE]", "\[ScriptCapitalL]"} /. step1), AllOrbitParameters]
Activate[%]

giving

<|"g2" -> 0.0192086, "g3" -> 0.000276706, "\[Omega]1" -> 4.7, 
 "\[Omega]2" -> 0. + 5.5 I, "\[ScriptCapitalE]" -> 0.968605, 
 "\[ScriptCapitalL]" -> 3.949, "e1" -> -0.0604853, "e2" -> -0.0151259,
  "e3" -> 0.0756112, "\[Rho]1" -> 21.8837, "\[Rho]2" -> 7.33058, 
 "\[Rho]3" -> 3.14575|>
 AllOrbitParameters][\[ScriptCapitalE]\[ScriptCapitalL][0.968605, 3.949]
<|"g2" -> 0.0192086, "g3" -> 0.000276706, "\[Omega]1" -> 4.7, 
 "\[Omega]2" -> 0. + 5.5 I, "\[ScriptCapitalE]" -> 0.968605, 
 "\[ScriptCapitalL]" -> 3.949, "e1" -> -0.0604853, "e2" -> -0.0151259,
  "e3" -> 0.0756112, "\[Rho]1" -> 21.8837, "\[Rho]2" -> 7.33058, 
 "\[Rho]3" -> 3.14575|>

Extracting the data for the planet Mercury from NASA or Wikipedia, which the inline references link to, and skipping some of the notebook calculations we finally calculate the difference between the WeierstrassP real half period and a regular orbit half period to get the perihelion advance per orbit. Multiplying by the number of orbits in a century we obtain the result that gave Einstein heart palpitations.

2 (\[Omega]1Mercury - \[Pi]) Quantity[1, "Radians"]/orbit;
% 415 orbit // ToUnit[Quantity[1, "ArcSeconds"]];
NumberForm[%, {5, 3}]

giving

42.958"

And, using high precision, plot the radial function around the century mark.

enter image description here

Let's look at the advantages.

1) You are handing the reader a document with supporting routines that allow him to quickly perform the calculations himself and extend or modify them.

2) You can provide the reader with multiple forms of presentation including graphics, dynamic presentations or step by step derivations and proofs. In other words, something like a classic paper but with active and dynamic features added.

3) Since calculations and dynamics must work, this produces a higher integrity document. It doesn't eliminate all possibility of error but certainly reduces the probability. Often an error first becomes manifest in a graphic or dynamic display. Edward Tufte writes (in Visual Explanations) "Those who discover an explanation are often those who construct its representation." Publishing with notebooks will encourage a variety of presentations and the attendant exploration and discoveries.

4) Readers can more easily respond with additions, suggestions or criticisms using the tools you've handed them.

5) If the paper is within an application the reader could even add his own package and maybe share routines and results with you.

6) You can use color and longer documents freely.

Wolfram could do many things to improve and smooth their product for this usage. But basically the technology is here. Why aren't you using it?

The examples he shows are very impressive, but also very very specialised! There is always a balance between those I think. Mathematica is less specialized but can certainly do the tasks he showed, but it will take some time to program them. But I'd bet it also took him quite some time!

POSTED BY: Sander Huisman

I completely agree that Mathematica could probably do amazing things. IMHO, the problem is that there's not so much clear information about how to create dynamic interactive interfaces and the existing documentation is spread all over the place. Until existing and potential users have access to that, people will still underestimate or be unaware of the power of the Wolfram Language. I hope Wolfram Media can publish some titles in the near future about the topic. It would really help to make Mathematica and the Wolfram Language go mainstream!

I think quite the contrary, this is one of the best areas covered. The doc's page on Manipulate links to 5 very extensive tutorials. Plus Manipulate and Dynamic pages have numerous examples. And more than 10,000 examples on Demonstrations.

enter image description here

POSTED BY: Sam Carrettie

Bjorn Tipling, the author of the post If programming languages were weapons, would possibly answer "yes", as he sees Mathematica as "a low earth orbit projectile cannon, it could probably do amazing things" ;-)

enter image description here

POSTED BY: Sam Carrettie

An interesting question. IMHO Mathematica is definitely the top interactive programing environment. I think you have to also consider Wolfram SystemModeler as it also represents visual interactive approach to programming. A related post: Climate change and programming?

POSTED BY: Vitaliy Kaurov
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract