Mathematica/Wolfram via LC on Raspberry Pi

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Post Reply
[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1764
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Mathematica/Wolfram via LC on Raspberry Pi

Post by [-hh] » 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...).

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.
Attachments
maths2.livecode.zip
Updated Oct 24, 2015
(5.08 KiB) Downloaded 151 times
plot2.png
plot2.png (7.34 KiB) Viewed 1641 times
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1764
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Mathematica/Wolfram via LC on Raspberry Pi

Post by [-hh] » Sat Oct 24, 2015 7:12 pm

Removed a single typo that prevented a value table export to CSV on LC 8 (sorry).
See the updated stack below.

Runs now with LC 6-8 on Mac/Win/Linux/RaspberryPi.
You need a licensed version of Mathematica (I tested and had success using several version from 5.0-10.0).
RaspbianOS on RaspberryPi includes a free version of Mathematica.
shiftLock happens

Post Reply

Return to “Raspberry Pi”