Mathematica and matlab

From ImageWiki

Revision as of 13:39, 26 March 2007 by Sporring (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Thanks to Rune C.Kildetoft Andresen for telling us how to do this.

Running Mathematica or Matlab on a Linux Box via X11 forwarding

First one need to setup a ssh connection to DIKU allowing X11 forwarding, this is done by writting

ssh -C -Y

One should replace the username, spiderman, with ones own username on the DIKU system. Next one should log on to one of the kand machines at DIKU.

besthost kand xterm

If X11 forwarding works a xterm should now popup on ones desktop. At the prompt of the xterm one should now write

mathematica &

Or if one wants to run matlab simply type

matlab &

That is pretty much it.

Fixing Mathematica Fonts

One may see the following error messages when opening Mathematica

spiderman@kand-2> xset:  bad font path element (#307), possible causes are:
      Directory does not exist or has wrong permissions
      Directory missing fonts.dir
      Incorrect font server address or syntax

This is a known problem. The reason for the problem is that Mathematica is looking for the Fonts on the local machine. The solution is to install the Mathematica Fonts locally.

The Fonts is located at DIKUs system in the folder


First one should copy the contents of this folder onto the local machine, this is done easily by writting something like

su -
cd /opt/
mkdir mathfonts
scp -R /opt/mathfonts

Next one should go to the home folder and locate the shell script file (.bashrc),

emacs .bashrc &

and add the lines

xset fp+ /opt/mathfonts/Type1
xset fp+ /opt/mathfonts/BDF
xset fp rehash

to the shell script file. Finally log out and on again. That's it!

Installing Matlab Locally with SSH-Tunnel to License Server

The following worked for me with version 7.3. Remember to change version number in the text below, when Matlab is upgraded. In theory it should not be necessary to install the license.dat file, but there seems to be a conflict with the ebuild, so I continue to install it manually.

(login as anonymous/<my email>)
cd distfiles-DIKU
# get matlab-7.3.tar.gz
ssh kand-1 # some machine where matlab is installed
cp /usr/local/portage/sci-mathematics/matlab/matlab-7.3.ebuild .
cp /opt/matlab/etc/license.dat .
exit # from kand-1
exit # from tyr
su - # login as root on the local machine
scp sporring@tyr:matlab-7.3.tar.gz /usr/portage/packages/All/
scp sporring@tyr:matlab-7.3.ebuild /usr/local/portage/sci-mathematics/matlab/
ln -s /usr/portage/packages/All/matlab-7.3.tar.gz /usr/portage/distfiles/
cd /usr/local/portage/sci-mathematics/matlab/

I did not have an installation in the system, otherwise and unmerge is needed:

emerge --unmerge sci-mathematics/matlab

Still I did have old ebuilds from old matlab version, which caused problems, so I removed everything. Then I edited matlab-7.3.ebuild by commenting 4 lines for local DIKU patches, and then I wrote,

ebuild matlab-7.3.ebuild digest
scp sporring@tyr:license.dat files/matlab-7.3-license.dat
emerge -ka sci-mathematics/matlab
ln -s /opt/matlab/bin/matlab /usr/local/bin/
ln -s /opt/matlab/bin/mbuild /usr/local/bin/
ln -s /opt/matlab/bin/mex /usr/local/bin/
exit # as root

As normal user I now setup tunnels and started Matlab:

ssh -f -L -L sleep 7d
matlab -c 27000@localhost

and that started me a Matlab java thingy.

Personal tools