- Introduction
- UNIX - The absolute least you need to know
- Using the Math Software
- Using graphics over the network
- Using batch processing
- Further Reading
Using Graphics Over the Network
Advice on graphics
The goal of this section is to help you use the graphics features of the math packages. There is no perfect way of doing this. Before you attempt any method other than typewriter graphics, you should ask yourself if you really need graphics output from your UNIX session. UNIX machines are designed to crunch a lot of numbers quickly, but they are not designed to draw pretty pictures. Desktop versions of the math software are designed to draw pretty pictures.One good way out of this is to use the UNIX machine to do all the hard work, save the results in a file, transfer the file to your desktop machine, and then use your desktop package to visualize and interpret the results.
This area of this document is still changing as we perfect the methods. If you have any problems, suggestions, etc. with the techniques used here, please post to iu.statmath, or email statmath@indiana.edu.
Typewriter Graphics
Typewriter graphics is the default behavior for all three packages (but if you are running an X-server and you have set the DISPLAY variable, all three default to X graphical output.). Typewriter graphics simply means that the program will try to draw a picture using ASCII characters. While not pretty (or accurate, for that matter), typewriter graphics are good for drawing formulae with a bit more clarity than straight text.Postscript, VRML, and GIF Output
All three major math packages offer graphics output to other file formats. This may be your best graphics option if you plan to publish your results on the web, use graphics in other applications (such as word processors), or if you are doing batch processing. All three packages will place output files in the current directory if a full path is not given, so make sure that you have write permission on the current directory. After you are done, you will need to retrieve your files using FTP.Maple
Maple provides good export capability. See?plottools,vrml - export 2d or 3d graphics to vrml
?plot,device - export to gif, jpeg, Postscript, and other formats.
?plot,device,ps - options for Postscript output.
?plotsetup - output options - especially see section on plotoutput variable.
Matlab
Matlab provides extensive export capability. Type the following in Matlab for more information:help vrml -export a graphics object to VRML 2.0
help imwrite -write out a graphics object to a wide variety of formats
help saveas -save a graphics object to Postscript
help print -save a graphics object to Postscript
Mathematica
Graphics output requires the use of a front-end. Since the only front-end availible for UNIX is the X-windows client, this method is less useful (since you would already have graphics capability directly from within Mathematica). However, you can still redirect output to other file formats. You can use the following command to redirect plot output to a GIF file.Plot3d[[Sin[x y],{x,0,4},{y,0,4}, DisplayFunction-> Function[Display["foo.gif",#,"GIF"]]
You use this option with all plot, play, and show commands. Be sure that your current working directory is something reasonable, since that is where the file will end up. You may also use a full path for the filename. Read about other file formats by using the Mathematica help browser, under "Built-in Functions": Graphics and Sound -> Graphics Exporting -> Display.
X Windows
X Windows is a distributed Graphical User Interface (GUI) environment. In other words, you can run a program on a UNIX machine, but have the window appear on your local machine. This gives you the full functionality of using the graphical interface, while still having the power of a large UNIX computer. The program you are running is called an X-windows client. You local machine must be able to interpret and display the windowing commands that your client sends - in other words, your local machine must act as an X-windows server. Most Solaris, Linux, and IRIX (SGI) workstations are capable of acting in this manner directly. For Mac and Windows users, you must run a seperate program that will provide this capability. Please note that using X-windows requires a fast network connection, so using this option over a dial-up line is not recommended.- For Mac users, you will have to install a third-party X-windows server (this is different from the Mac OS X Unix Server). UITS does not support or endorse the use of these programs in the public clusters (STCs). However, you may purchase, install, and use these programs on your own Mac. MI/X is a free X-server for the Mac. UITS provides this link as a service to customers and in no way endorses or supports this product.
- For Windows (3.x, 9x, and NT) users, you will have to install a third party X-windows server. UITS does not support or endorse the use of these programs in the public clusters (STCs). However, you may purchase, install, and use these programs on your own PC. Popular X-windows servers include X-WinPro , Exceed, and MI/X (free). UITS provides these links as a service to customers and in no way endorses or supports these products.
- For UNIX workstation users, the Ships and DaVinci machines have X already installed.
- Setup the X-windows server on your local machine.
- If you are using a UNIX local machine, you will have to give the client machine permission to connect to your X-server. Do this by issuing the command xhost +steel.ucs.indiana.edu
- PC and Mac users should start their X-server software. Refer to the documentation of the software.
- Connect to the remote machine using telnet.
- You need to tell the remote machine where you are. To do this, you must set the DISPLAY environment variable to your local hostname.
- Find out what shell you use by typing echo $SHELL
- If you use csh, type setenv DISPLAY hostname:0
- If you use bash, type DISPLAY=hostname:0;export DISPLAY
- Start the X-client version of the math software from your telnet session.
- Maple - issue the command xmaple &
- Matlab - issue the command matlab. If your X-server is setup properly, you should be able to enter matlab commands in the telnet window, but have graphics displayed in a "pretty" new window. Type demo to try this out.
- Mathematica - issue the command mathematica &. You may see errors about fonts. If so, follow these instructions.
- Do your work, and exit from the math software.
- Un-setup your X-server
- For UNIX machines, make sure you issue the command xhost -steel.ucs.indiana.edu after you are done.
- For PC and Mac users, consult your X-server's documentation.
More information on the X-windows system may be found at www.x11.org.
Mathlink
Note: This information applies to the Mac edition of Mathematica 4.0.Mathlink is a feature of Mathematica. Users familiar with Mathematica will recall that it is made up of two parts:
- The Kernel - does all processing, manages variables, and loads packages
- The Front-end - does all graphics work, input, and output.
- Go to the Kernel menu and select Kernel Configuration Options,
- Select Kernels and Tasks,
- Click the Add button to add a new kernel
- Assign the new kernel a name. For example, if using Mathematica on DaVinci, you may want to use DaVinci as the name of the new kernel.
- Under Basic Options, click on Remote Machine.
- Click the Connections button and under Connection Settings Method, select VersaTerm Telnet Tool.
- In the Host TCP/IP Address box, type in either the hostname or IP address of the remote host and click OK.
- If connecting to a Unix system, click on the Terminal button and select VT102 under Terminal Settings Emulation. You may also customize your keyboard mapping here.
- Note, by default Mathematica looks for the > symbol before launching the program on a remote system. If the default prompt on the remote system is not >, then you must either change the default prompt or the start up option in the new kernel settings. To change the prompt locally, click on Advance Options and in the Communications Toolbox Login box, change the > to whatever the last character in your login prompt is. For example, if you were accessing Mathematica on a Unix system with the default prompt for Korn shell, you would change > to $.
- Once all the settings are correct, click OK twice.
- In the Kernel menu, choose Notebooks Kernel and select the Connection from the list of available kernels.
- Again from the Kernel menu, choose Start Kernel and select the Connection from the list of available kernels.
You will then be asked to supply a username and password for the remote system.
Next: Using Batch Processing



