Raspberry Pi Mathematica Notebook and CDF test

I wondered if the five CDFs and their associated notebooks posted to date on this blog would run unmodified on Mathematica running on the Raspberry Pi. The answer is mostly yes. All but one ran. The Yahoo! Financial Code Generator CDF ran but the notebook did not. This notebook crashed Mathematica on the Raspberry Pi. To be fair, however, the Yahoo! Financial Code Generator needs some work. It runs continuously and should only update once a code button is selected. All version were very slow as well. This means that careful and efficient code is require for responsive operation on the Raspberry Pi.

Fermi Distribution Notebook

Lorentz Equation Notebook

Lorentz Equation CDF

Solar System Animation Notebook

Solar System Animation CDF

Solar Radiance CDF

Solar Radiance Notebook

Yahoo! FInance CDF

The Raspberry Pi boots

The Raspberry Pi NOOBS completed its installation and booted into Rasbpian Linux.

Raspberry PI now operational

Raspberry PI now operational

The photo below shows it running in GUI mode and a Mathematica plot of Sin[x].

Raspberry Pi booted and running in GUI mode showing a Mathematica plot of Sin[x]

Raspberry Pi booted and running in GUI mode showing a Mathematica plot of Sin[x]

Now, it’s time to figure out if all the hardware drivers are present.

 

 

NOOBS v1.3.4 we have a problem

The NOOBS SC Card contained v1.3.0 so I decided to upgrade to v1.3.4 before booting my Raspberry Pi. I downloaded NOOBS_v1_3_4.zip from the Raspberrypi.org website. I also downloaded the recommended SD Card FAT formating tool as well. The NOOBS_v1_3_4.zip file was unzipped and copied onto the 8 GB SD Card after to older version was saved. The copy failed with the following error: file copy error the “parameter is incorrect”. The os\RaspBMC\root.tar.xz seems to be the problem file.

The SC card was reformatted using the full and the quick options but this did not solve the problem. Several site recommended testing the memory using H2testw 1.4. The test took about 40 minutes to write the card and verify it but no errors were found.

H2testw SD Card memory test results

H2testw SD Card memory test results

I wrote the following Mathematica code to check the download and file but nothing jumps out as a problem.

I’ll run the Raspbian and probably the Adafruit version of the wheezy build so hopefully this will not be an issue going further.

Update:

After all this testing and checking, all the files copied over without an error. I still don’t understand what the problem was.

Raspberry Pi Kit arrives

Once I learned that Mathematica and the Wolfram Language are supported on the Raspberry Pi , I could not resist getting it. I started looking at Raspberry Pi at the MarkShed, could not resist the 2.8 touch screen at Adafruit. The photographs below show the components I selected. This is like my fourth order with Adafruit (Arduino kits) and I’ve been impressed with the quality of the components supplied.

I’m interested in using Mathematica as a way to create, display, control, and interact with hardware. Some of the projects that I’m thinking about include:

  • Clock radio modification to add Internet music streaming
  • Audio function generator
  • Impedance analyzer using the AD5933 Impedance Converter Network Analyzer eval board
  • Interface with DSP eval boards for signal processing applications
  • Interface with a Smartfusion SoC eval board to explore FPGA and analog sampling applications
  • USB development board for sensor applications

My custom selected Raspberry Pi kit as received

Raspberry PI Model B Top view

Raspberry PI Model B bottom view with NOOBS 1.3 SD Card installed

Adafruit Raspberry Pi case top and bottom part top view

Adafruit Raspberry Pi case top and bottom part bottom view

Adafruit Raspberry Pi case showing analog video port openings

Adafruit Raspberry Pi case showing power and SD Cart openings

Adafruit Raspberry Pi case showing HDMI opening

Adafruit PiTFT mini kit 320x240 2.8" TFT Touch screen for the Raspberry Pi with headers front side view

Adafruit PiTFT mini kit 320x240 2.8" TFT Touch screen for the Raspberry Pi with headers front side view of the board and back side view of the TFT screen

Adafruit PiTFT mini kit 320x240 2.8" TFT Touch screen for the Raspberry Pi with headers back side view of the board

Adafruit PiTFT mini kit 320x240 2.8" TFT Touch screen for the Raspberry Pi with installed headers top view of the board

Adafruit PiTFT mini kit 320x240 2.8" TFT Touch screen for the Raspberry Pi with installed headers top view of the board

Raspberry Pi in the Adafruit case with USP keyboard cable, USB Wi-FI module (not in view), HDMI cable, power cable, SD Card, and cobbler breakout cable all plugged in for fit check

Rasberry Pi in Adafriut case with cables

Miniature Wi-FI 802.11 a/g/n Module kit for the Raspberry Pi to view

Miniature Wi-FI 802.11 a/g/n Module kit for the Raspberry Pi bottom view

Adafruit Assembled Pi Cobbler Breakout Cable for the Raspberry Pi cable view.

Adafruit Assembled Pi Cobbler Breakout Cable for the Raspberry Pi Breakout board top view

Mathematica text books

I useĀ  the two textbooks on Mathematica shown below regularly.

Mathematica Cookbook has a lot of good programming examples in science, engineering, finance, and music. It’s for someone knowledgeable about programming and the subject matter and should be considered more of a reference manual.

Mathematica Navigator is more like a Mathematica manual but has a lot of examples. The paperback version was written for Mathematica 6 but the book contains a CD-ROM that has a version of the book for Mathematica 6 and 7. These math books can be linked into the documentation center for quick and easy reference. My complaint is that the version 7 of the book only contains what’s new with version 7. You must search both versions to get all the examples on a search topic.

All CDFs should use SaveDefinitions->True

Getting CDFs to work when embedded in my blog was giving me fits. I would get to the point where the my modelĀ  would work fine in a Mathematica mathbook, in a CDF preview, in the web-ready CDF run locally , but not when uploaded to my blog. Wolfram support advises that the option SaveDefinitions->True should be used in every CDF you create. SaveDefinitions->True preserves the internal state of all the variables for a CDF. I’ve used this now in CDF using Manipulate and DynamicModule and it definitely works.