Mathematica 4.0 and SPSS 6.14 installed on HKUSUA

We are pleased to announce that Mathematica 4.0 and SPSS 6.14 for Unix have recently been installed on the HKUSUA system. The use of these two software packages are discussed in the following:

Mathematica 4.0

Mathematica is a software which lets you perform highly complex numerical, symbolic and algebraic computations easily and displays the results with sophisticated graphical plots to output devices and files.

1. Functions and features

Mathematica has over 843 built-in functions for numerical and symbolic calculations, processing and plotting of  2D and 3D graphics, as well as for users to create their own libraries for the specific needs. Mathematica also provides interfaces for linking external software e.g. TEX or user programs written in C or Fortran. Thus, within a processing session using Mathematica, you can pass information to or receive information from other applications and programs.

Note: Mathematica is made of two parts: a kernel and a front end. The kernel is the part which does calculations while the front end is the part which handles Mathematica notebook files and interacts with the user.

2. Starting and Quitting a Mathematica session

A. Setting Mathematica kernel for graphical display

If you wish to display graphical plots using Mathematica kernel , set up your terminal as follows:

B. Starting and quitting Mathematica Kernel C. Starting and quitting Mathematica Front End

3. Using Mathematica

You can enter Mathematica commands or data according to its syntax as highlighted below:

A. You have to enter Mathematica function names in their exact form (mindful of the upper and lower cases):

For instance, you must enter "Show" instead of show or SHOW

B. Use correct Metacharacters to separate your symbols and perform special functions

        N [Log[4 Pi]]   as      log(4pi)
        N [Pi,7]        as      pi to 7 significant digits
        %, %%, ...      as      last result, second last result...
        >> filename             write expressions to filename
        >>> filename            append to filename
        << filename             receive from/load filename

        ?Show                   on-line help on the Show function
        ??Show                  more information
        ?Sh*                    list of functions beginning with Sh
        ?$*                     list all global variables

        !! filename             display content of filename
        !                       spawn a new shell

        (* ... *)       as      comment

        x^y             as       x to the power y
        -x              as      minus x
        x/y             as      x divided by y
        x+y             as      x plus y
        x y  or  x*y    as      x times y

        f[x]            as      f(x)
        f[[x]]          as      Part(f,x) - indexing
        {a,b,...}               as      list of values
        (term)          as      for grouping

        ;                       command separator which prohibit input

        x=value                 assign value to variable x
        x=.                     clear value of x
        x=y=value               value get assigned to both x and y

        y:=f[x]                 deferred assignment (Definition)

C. Input/Output

4. Dealing with graphics output

There are a number of macro files (packages) provided to deal with different output devices/formats:

FileGraphics.m - direct Graphics output (Postscript commands) to the file pstmp
PSDirect.m      -       direct Graphics output to stdout
VT340.m         -       Graphics output for VT340 terminal
Tek.m           -       Graphics output for Tektronic 4014 series terminals
Motif.m         -       Graphics output to X-Window

You can load any one of them in a Mathematica session using the << operator.

psfix is a utility program which can convert the default Mathematica PostScript output file to Encapsulated Post Script file

5. Examples

The following shows how Mathematica is invoked from a session with the HKUSUA system, and the sequence of commands for numerical/symbolic calculations and simple plottings.

A. Numerical/Symbolic calculations

hkusua% math
Mathematica 4.0 for Solaris
Copyright 1988-1999 Wolfram Research, Inc.
 -- Terminal graphics initialized --

In[1]:= Expand[(1+x)^2]

Out[1]= 1+ 2 x + x

In[2]:= Factor[%]

Out[2]= (1 + x)

In[3]:= x = 2

Out[3]= 2

In[4]:= Evaluate[%%]

Out[4]= 9

ln[5]:= Simplify[%1]

Out[5]= 9

In[6]:= x =.

In[7]:= Simplify[%1]

Out[7]= (1 + x)

In[8]:= D[%,x]

Out[8]= 2 (1 + x)

In[9]:= Integrate[%,x]

Out[9]= 2 (x + --)

In[10]:= h = (1+x)^2 ==0

Out[10]= (1 + X) == 0

In[11]:= Solve[%10,x]

Out[11]= {{x -> -1}, {x -> -1}}

In[12]:= Solve[x^2+x+1==0,x]

                     1/3             2/3
Out[12]= {{x -> -(-1)   }, {x -> (-1)   }}

In[13]:= NSolve[x^2+x+1==0,x]

Out[13]= {{x -> -0.5 - 0.866025  I}, {x -> -0.5 + 0.866025 I}}

In[14]:= Quit


B. Simple Plots

hkusua% math
Mathematica 4.0 for Solaris
Copyright 1988-1999 Wolfram Research, Inc.
 -- Terminal graphics initialized --


SPSS Release 6.14 for Unix

SPSS is an integrated and comprehensive system for statistical data analysis.  Due to the phasing out of the HKURSC system on which the SPSS package was previously installed, SPSS for Unix (Release 6.13) has been installed on HKUSUA since October,  2000.  The SPSS modules available on HKUSUA include:
SPSS Base provides you with the basic functions of data access, data preparation, analytical reporting and predictive modeling so that you can analyse the data you have got for making better decisions.
SPSS Tables provides you with the functon to generate reports in tables format from results of analyses which could be very complicated. The tablulated results would enable you to communicate your  results with others effectively.
SPSS Categories can be used to predict categorical outcome when you understand how items are grouped with perceptual maps.
To invoke SPSS on HKUSUA, go through the following steps (as in the previous HKURSC system):
  1. Start the Excursion program on your PC or type &ldquo;xhost +&rdquo; on your workstation.
  1. Login to and type the command
&lsquo;setenv DISPLAY your_ip_address:0.0&rsquo;
to setyour display environment to your PC or workstation.
  1. Type &lsquo;spss&rsquo; to invoke the SPSS package.
  2. To run SPSS in batch mode (No Graphical User Interface), please use the following command
                                   spss -m <  input_fileanme > output_filename
If you encounter any problems in using SPSS, please report them by email to or

Should you have any enquiries related to the the procedure in using the SPSS software, please contact the undersigned.


Frankie Cheung
Tel: 2859 2489


and Kenneth Yip
Tel: 2859 7973

[Contents] [Next] [Previous]