Author, Publisher, Developer, Stitchcoder

Blog

A New Slant in Mathematica

This item was originally posted on the Wolfram Research blog at http://blog.wolfram.com/2009/09/03/a-new-slant-in-mathematica/

Diagonal error message sent in by Flip Phillps—click to enlarge

Longtime Mathematica user Flip Phillips recently sent us this tremendously amusing error message generated by Mathematica. Much as you might think when stumbling upon a pickup truck hanging from a tree, your first reaction is probably, "How does something like that even happen??"

The answer is powerful, integrated design. An error message like this is possible only in a system that deeply integrates graphical and symbolic environments, and goes to great lengths to ensure that everything that ought to work, does work.

Flip, unfortunately, did not save anything but a screen shot of the error, so we may never know the exact details of what happened, but it's not hard to figure out that a Rotate function was involved.

Rotate is a wrapper that makes a lot of sense in the context of graphics. For example, you can rotate a rectangle:

Graphics[Rotate[Rectangle[{0, 0}, {1, 1}], π/6]]
Rotated rectangle

You can even make a little slider interface to rotate it by different amounts:

Manipulate[Graphics[Rotate[Rectangle[{0, 0}, {1, 1}], Θ]], {Θ, 0, 2 π}]

[SWF]http://blog.wolfram.com/data/uploads/2009/09/manipulate1.swf, 410, 450, hl=en&fs=1[/SWF]

But there's no fundamental reason why Rotate shouldn't work on everything, including text and mathematical expressions completely outside the context of graphics. And in Mathematica, we try to ensure that if something should work, it does work, because you just never know when it might come in handy.

So for example you can rotate the result of an integration:

Rotate[Integrate[1/(1 - x^3), x], π/4]
Rotated integration results

The implementation of Rotate, and similar formatting constructs, is deep and complete. Rotated objects, for example, are perfectly acceptable as variable names:

Apart[1/(1 - Rotate[bob, 3 Pi/4]^9)]
Output with rotated variable names

Yes of course you can make an interactive version of that too:

Manipulate[Apart[1/(1 - Rotate[bob, Θ]^9)], {Θ, 0, 2 π}]

[SWF]http://blog.wolfram.com/data/uploads/2009/09/manipulate2.swf, 400, 144, hl=en&fs=1[/SWF]

Clearly what happened in the case of this error message is something along these lines:

Rotate[RandomReal[100, {15, 15}], 3 Pi/4]
Rotated block of RandomReal results

Seen in this context, there's really no mystery: this is simply an error message generated in the course of working with rotated objects, perhaps a raster image meant to go inside a graphics object (which would explain the 2D array of numbers).

What the pickup truck is doing in the tree you will have to figure out on your own.