file cover in directory macro

     cover       # draw the cover

file default in directory macro

     batch       ## run the history buffer, but don't delete from history list
     bell        ## ring terminal bell
     calc        ## evaluate an expression
     cd          ## change directories
     compatible  ## define macros to be compatible with Mongo
     declare     ## declare a vector $1: declare name size
     del         ## delete last command from history list
     del1        ## don't put command on history list
     echo        ## write to terminal
     ed          ## edit a macro, or the previous one if no argument
     edit_all    ## edit history buffer
     emacs_all   ## edit the history list using an external editor.
     emacs_hist  ## edit the history list using an external editor.
     error_handler ## Handle C interrupts
     execute     # read and execute an SM file of commands (1 per line)
     extend_history # Extend history buffer to be of size $1
     for         ## Repeat a macro while a condition is true, like C's for(;;). See also while
     gripe       ## complain to Robert (Unix only)
     h           ## get help
     head        ## print the top of the current data (or other) file
     hm          ## help with the last macro edited
     hv          ## help with variable
     insert      ## insert text after line $1
     load        ## load macros in default directory
     load2       ## load macros in (second) default directory
     ls          ## list macros
     lsm         ## list macros in a file in default macro directory
     lsv         ## list variables
     q           ## check, then quit
     re          ## macro read
     reset_ctype # Reset the default ctypes (except "default")
     sav         ## save to a file $1, don't save from files `$mfiles'
     show        ## show current values of various things
     startup     ## macro invoked upon startup
     undef       ## undefine a variable
     undo        ## undo [macro] : undo (i.e. erase lines drawn by) macro $1
     unload      ## forget macros from a file
     unset       # delete a vector
     v           ## set verbosity
     wr          ## macro write

file demos in directory macro

     square      # sum the Fourier series for a square wave, using $1 terms
     colours     # draw a circle in a number of colours until ^C stops it
     crings      # draw a set of coloured circles
     crings2     # draw a set of coloured circles using 256 shades of yellow
     gauss_convolve # convolve 2 Gaussians with sigmas $1 and $2
     grey_sincos # draw a grey scale image of a sin(x)cos(y) surface
     scribble    # use cursor to draw a line, and then shade the interior
     shading     # draw an ammonite
     sundial     # draw a sundial, allowing for the analemma

file fonts in directory macro

     fonts       # draw the font table
     TeX_defs    # draw the ``TeX'' definitions
     make_char   # help create a new character

file fourier in directory macro

     #
     # Macros to make dealing with complex numbers for FFT's easier
     # Assumes that complex vector `name' is represented by two vectors
     # called name_r and name_i
     #
     fft         # Direct FFT: fft name name
     ifft        # Inverse FFT: ifft name name
     cadd        # Add complex numbers: $1 = $2 + $3
     cdiv        # Divide complex numbers: $1 = $2/$3
     cmod        # Modulus: $1 = |$2|
     cmult       # Multiply complex numbers: $1 = $2*$3
     csub        # Subtract complex numbers: $1 = $2 - $3
     imag        # Imaginary part: $1 = Im($2)
     real        # Real part: $1 = Re($2)
     vcentre     # shift a vector so that its 0th element appears in the middle
     vcenter     # an alias for vcentre

file images in directory macro

     entropy # Find entropy of an image
     hist_equalise # Histogram equalise an image
     gamma       # Gamma correct an image

file irregular in directory macro
These macros were written by Gabor Toth, to whom many thanks. They enable you to define an SM IMAGE from 3 vectors, (x,y) and the value z

     irregular_image # Set IMAGE from 3 vectors (x,y) and z
     trigrid     # Interpolate to the regular grid
     trigridtry  # Demonstrate the use of trigrid

file math in directory macro

     #
     # Written by Daniel Pfenniger (PFENNIGER@obs.unige.ch)
     # `A&S' is Abramowitz & Stegun
     #
     J0          # Bessel func. J0(|x|), A&S, 9.4.1,.3
     Y0          # Bessel func. Y0(|x|), |x|>0, A&S, 9.4.2-3
     J1          # Bessel func. J1(|x|), A&S, 9.4.4,.6
     Y1          # Bessel func. Y1(|x|), |x|>0, A&S, 9.4.5-6
     I0          # Modified Bessel func. I0(|x|), A&S, 9.8.1-2
     I1          # Modified Bessel func. I1(|x|), A&S, 9.8.3-4
     K0          # Modified Bessel func. K0(|x|), |x|>0, A&S, 9.8.5-6
     K1          # Modified Bessel func. K1(|x|), |x|>0, A&S, 9.8.7-8
     K           # Complete elliptic integral K(m), 0<=m<1, A&S 17.3.34
     E           # Complete elliptic integral E(m), 0<=m<=1, A&S 17.3.36
     fresnel     # Calculate the Fresnel integrals C, S, and F

file matrix in directory macro

     matrix       # Introduction to matrix utilities
     mdeclare     # declare $1 to be a $2x$2 square matrix
     mdimen       # print matrix $1's dimension
     mprint       # print the matrix $1  (given as $1_0 $1_1 etc -- see minv)
     madd         # set matrix $1 equal to $2+$3
     minv         # Quick matrix inversion, done in place.
     mset         # set matrix $1 equal to $2
     mmult        # set matrix $1 equal to $2*$3
     mmult_c      # set matrix $1 equal to $2*$3 where $3 is a scalar
     mmult_v      # set vector $1 equal to $2*$3 where $3 is a vector
     mmult_vT     # set vector $1 equal to $2^T*$3 where $2 is a vector
     mtrans         # set matrix $1 equal to $2^T
     mprint       # print the vector $1

file mongo in directory macro
(omitting those that are simply abbreviations, like ang)

     da          ## set data file
     dev         ## set device
     dra         ## draw, accepting expressions
     ecolumn     ## define vector error_col as error vector
     end         ## quit, not on history
     era         ## erase screen, not on history
     lis         ## list history, not on history
     hard        ## make a hardcopy of what you type (or get by history)
     hardcopy    ## close the old device and set dev type to 0
     hcopy       ## hcopy [printer] [l1] [l2]: Make hardcopy of playback buffer
     hmacro      ## hmacro [macro] [printer]: make hardcopy of `macro' on `printer'
     identification ## write an id to the top right hand corner of screen
     input       ## execute an Mongo file
     mongo       # make SM resemble Mongo as closely as possible
     pcolumn     ## set point column (Mongo)
     playback    ## define "all" from buffer, and run it
     read_all    ## read a macro file, putting `all' onto the history buffer
     read_hist   ## read history from a file
     read_old    ## read an Mongo file onto the history buffer
     rel         ## relocate, accepting expressions
     save_all    ## write the playback list to a file (use sav instead)
     terminal    ## device
     toplabel    ## put label at top of plot
     xcolumn     ## read a column into vector x (Mongo)
     xlogarithm  ## take log of vector x (Mongo)
     ycolumn     ## read a column into y
     ylogarithm  ## take log of y

file project in directory macro
Miscellaneous projections (e.g. equal area). Contributed by Michael Strauss.

     aitoff          #convert l and b to x y in Aitoff coordinates
     aitoff1         # Convert l and b to x y in reverse Aitoff coordinates
     aitoffdec       # Draw a line of constant declination in an Aitoff plot
     aitoffdec1      # Draw a line of constant declination in a reverse Aitoff plot
     aitoffgrid      # Put up equal area grid in Aitoff
     aitoffgrid1     # Puts up equal area grid in Aitoff. Reverse sense
     calc_lb         # Calculates r, l and b given x, y, and z
     circle_exclude  # After circleplot, draws regions excluded in latitude
     circlelabel     # Draw axes for a redshift circleplot
     circleplot      # Plot redshift points; requires circlelabel
     eqgal           # Usage: ra dec l b; Convert (ra, dec) to (l,b).
     galeq           # Usage: galeq l b ra dec. Convert (l,b) to (ra, dec)
     galgrid         # Puts up equal area grid
     galplot         # Usage: galplot ra dec l b
     galpoints       # Plot points on an equal area grid; galpoints l b
     gstrans         # Convert supergalactic to galactic coordinates
     hemiconvert     # Convert from l b to x y for hemisphere plotting
     hemidec         # Draw a line of constant declination on a pair of
     hemiplot        # Sky plot in two hemispheres, equal area
     invaitoff       # Convert x y in Aitoff coordinates to l, b
     pielabel        # Draw axes for a redshift pieplot
     pieplot         # Plot redshift points; requires pielabel
     radtick         # Put tick marks on a radial axis
     sgtrans         # Convert galactic to supergalactic coordinates

file stats in directory macro

     cgauss      # evaluate a cumulated Gaussian distribution : N($mean,$sig)
     cuniform    # evaluate a cumulated uniform distribution, $mean,$sig
     chisq       # Return chi^2 distribution of vector $1 with $2 dof
     draw_KS     # Draw a cumulated curve, for looking at KS statistics
     erfc        # calculate complementary error function erfc($1)
     factorial   # Use Stirling's formula to calculate a factorial ($1)!
     gauss       # evaluate a Gaussian : N($mean,$sig)
     gaussdev    # return a N(0,1) random vector
     linfit      # linear least squares fit for any number of parameters
     log_fac     # Use Stirling's formula to calculate a log factorial.
     lsq         # do a least squares fit to a set of vectors
     lsq2        # do a least squares fit to a set of vectors, errors in x and y
     prob_chisq  # probability of getting a given value of chi^2
     prob_KS     # probability of getting a given value of the K-S statistic
     prob_wilc   # return probability in $$2 that x exceeds $1 from Wilcoxon
     rxy         # find Pearson Correlation Coefficient for two vectors
     smirnov1    # calculate 1 sided Kolmogorov-Smirnov statistic for vector
     smirnov2    # calculate 2 sided Kolmogorov-Smirnov statistic for vectors
     spear       # calculate Spearman rank correlation coefficient for 2 vectors
     stats       # stats vector mean sigma kurtosis : calculate $mean $sigma etc
     stats2      # stats vector weights mean sigma kurtosis
     stats_med   # stats_med vector median SIQR : calc $median $SIQR from vector
     wilcoxon    # calculate Wilcoxon statistic for 2 vectors
     wlsq        # do a weighted least squares fit to a set of vectors

file trigd in directory macro
Equivalents for all SM trig functions, taking degree arguments. Names add an extra `d' (e.g. sind)

file utils in directory macro

     alpha_poi   # alpha_poi x y z. Like poi x y, but use z as labels for points
     arc         # the arclength along the curve ($1,$2), e.g. set v=arc(x,y)
     arrow       # use the cursor to define an arrow.
     barhist     # draw a bar histogram
     boxit       # use the cursor to define a box, and draw it
     circle      # draw a circle, centre ($1,$2) radius $3
     cumulate    # find the cumulative distribution of $1 in $2
     draw_arrow  # draw an arrow from ($1,$2) to ($3,$4)
     draw_box    # draw a box, defined by two corners
     error_x     # draw x-error bars: error x y size
     error_y     # draw y-error bars: error x y size
     get_hist    # get_hist input output-x output-y base top width
     gauss       # evaluate a Gaussian : N($mean,$sig)
     get         # syntax: get i j.  Read a column from a file
     glevels     # Set grey levels. Usage: glevels expr
     greyscale   # Draw a grey-scale image.
                 #                    Usage: greyscale [npx npy maxweight dmargin]
     info        # Get help about a command from SM's info files
     interp      # Linearily interpolate $3 into ($1,$2), giving $4
     interp2     # Linearily interpolate $3 into ($1,$2), giving $4
     is_file     # Return true if file $1 exists
     is_macro    # Return true if $1 is a macro
     is_set      # define variable $$1 if the $3'rd bit is set in $2
     is_vector   # Return true if $1 is a vector
     logerr      # syntax: logerr x y error, where y is logged, and error isn't
     mconcat     # Concatenate 2 macros, optionally renaming result
     number      # convert a string vector to an arithmetic one
     pairs       # pairs x1 y1 x2 y2. connect (x1,y1) to (x2,y2)
     polar       # draw a circle as an `axis' for polar coordinates
     pmatrix     # print the matrix $1
     puts	    # Draw a line of text, then move to the start of the next line
     qminv       # Quick matrix inversion, done in place
     repeated    # Return an array that is true for repeated elements in $1
     reverse     # reverse the order of a vector
     save_vec    # put the definition of a vector onto the history list
     set_window  # cycle through all available windows
     shade_box   # shade a box, spacing $1, defined by two corners
     shed        # shade region between x y and x2 y2 with n lines
     simp        # Simpson's rule integration: simp answer x y
     smooth      # boxcar smooth a vector
     smooth2     # smooth a vector with a given filter
     smooth3     # smooth a vector with a given filter omitting points
     2dhistogram # convert the current image to a 2-d histogram
     thin        # create a "thinned" version of a vector for plotting points
     thin2       # "thin" the end of a vector
     thin3       # "thin" the central portion of a vector
     uniq        # Remove duplicate elements of $1, e.g. u = uniq(x)
     upper       # define a variable giving an `upper limit' symbol
     vecminmax   # find the minimum and maximum of a vector
     vfield      # plot a vector field: vfield x y len angle
     vfield2      # plot a vector field, vfield x y len angle (len in x-axis units)
     vfield3      # plot a vector field: vfield x y len angle (len in y-axis units)
     vfield4      # Vector field at points x, y; components vx vy
     vfield5      # Vector field at points x, y; components vx vy scaled by f