### Mathematica/Wolfram via LC on Raspberry Pi

Posted:

**Tue Nov 25, 2014 11:38 pm**The attached stack assumes you have, beside Fraser's LC 6.5.1/7.0.1, a copy of Mathematica (more exactly: a part of it, Wolfram, the Mathematica mathKernel) on your Raspberry Pi. With the Raspbian OS for the Raspberry Pi a free and surprisingly complete copy of Mathematica is included (download NOOBS from http://www.raspberrypi.org/downloads).

This demo stack is not here to explain Mathematica or to explain math (although one could use Ex. 1 to 3 and 6, 8, 10 for that and the examples can serve as slots for use of Mathematica for Plots or simple calculations).

The main purpose is to show, how to connect in a simple way from LC to this great (and usually rather expensive) application.

Using directly the MathematicaFrontend for our (short) examples would be at about 5 times faster. Using a different, fast CPU for the MathKernel is at about 10 to 20 times faster. For lengthy jobs, the first factor (five) will go down below two, the second factor may even increase -- we have a slow CPU and a limited amount of RAM.

For plots (Examples 1 to 5) the Export function of 'Wolfram' is used. For this to work with graphics one has to use the Mathematica frontend itself or, with the MathKernel and our "primitive frontend", use an X-forwarding of the screen. The tightvncserver does this pretty good for us, just read one of the (short) Raspi-tutorials of how to install it (essentially "sudo apt-get install tightvncserver").

Then, of course, play with the beauty of math. For example in the ParametricPlot (Ex. 4) you could start with {Cos[3*t],Sin[t]} and then change Sin[t] to Sin[2*t] and so on, and see what happens.

Mathematica is a very powerful application. One should start with it softly, on a very basic level. Just as one would learn to drive with a Porsche. After a few months speed up, just as you would drive a Porsche, although you have a speed limit, sigh.

(Oh Lord, wonâ€™t you buy me a Mercedes-Benz? My friends all drive Porsches, I must make amends...).

This demo stack is not here to explain Mathematica or to explain math (although one could use Ex. 1 to 3 and 6, 8, 10 for that and the examples can serve as slots for use of Mathematica for Plots or simple calculations).

The main purpose is to show, how to connect in a simple way from LC to this great (and usually rather expensive) application.

Using directly the MathematicaFrontend for our (short) examples would be at about 5 times faster. Using a different, fast CPU for the MathKernel is at about 10 to 20 times faster. For lengthy jobs, the first factor (five) will go down below two, the second factor may even increase -- we have a slow CPU and a limited amount of RAM.

For plots (Examples 1 to 5) the Export function of 'Wolfram' is used. For this to work with graphics one has to use the Mathematica frontend itself or, with the MathKernel and our "primitive frontend", use an X-forwarding of the screen. The tightvncserver does this pretty good for us, just read one of the (short) Raspi-tutorials of how to install it (essentially "sudo apt-get install tightvncserver").

Then, of course, play with the beauty of math. For example in the ParametricPlot (Ex. 4) you could start with {Cos[3*t],Sin[t]} and then change Sin[t] to Sin[2*t] and so on, and see what happens.

Mathematica is a very powerful application. One should start with it softly, on a very basic level. Just as one would learn to drive with a Porsche. After a few months speed up, just as you would drive a Porsche, although you have a speed limit, sigh.

(Oh Lord, wonâ€™t you buy me a Mercedes-Benz? My friends all drive Porsches, I must make amends...).

*Remark. If you own a copy of Mathematica 5 or greater, the attached stack will run (fast) on MacOS X or Windows or Linux too, you simply have to change in the script *one* line, the correct path to the MathKernel.*