Running Mathematica scripts directly from the Unix shell

1) Select cells with pretty expressions within the Mathematica Notebook and click Cell > Convert to > InputForm

2) Cut and paste the resulting inputform code into a textfile, e.g. script.m.

3) Repeat 1)-2) as needed.

4) Terminate textfile with:  Exit[]

5) Execute script from the command line prompt with:
~$ MathKernel -noprompt -run “<<script.m”

Ubuntu 9.10, Matlab, Mathematica

To install those software packages it is necessary to install first the library ‘libstdc++5’ manually. Since it is not available from Synaptic it is necessary to download it manually.

Additionally, for Matlab, after installing it we have to do

root# cd /usr/loocal/matlab

root# ./install_matlab -glnx

 

and say yes to all the questions. Then, do (still in /usr/loocal/matlab ):

root# cd bin

root# gedit matlab

 

and add the following line AFTER the FIRST ONE (#!/bin/sh):

export AWT_TOOLKIT=3DMToolkit

and save the file and exit. Now, you should be able to load Matlab without problems and from anywhere.

 

 

 

 

 

 

Loading FITS files in Mathematica

Here is the basic source code for loading a FITS file in Mathematica


Import[ "/home/rau/Desktop/FIELD1.fits", "Elements"]
d = First@Import[ "/home/rau/Desktop/FIELD1.fits", "RawData"];
ArrayPlot[Log[N[d]], ColorFunction -> ColorData["BlackBodySpectrum"]]