MathXplorer/T Installation & Configuration

The Distribution

The MathXplorer/T distribution, once uncompressed, consists of four directories. Here are their contents:

lib two library files
doc documentation in HTML format
scripts Tcl scripts
m-files various useful MathViews scripts

Loading Packages

MathXplorer/T consists of two Tcl packages: Mxt and MxtGr. Their functionality is delivered via dynamic loading of the following library files found in the lib sub-directory:

Windows UNIX provides
Tcl Package
requires
Tcl Packages
provides
Tcl commands
mxt.dll libmxt.so Mxt Tcl minterp
mxtgr.dll libmxtgr.so MxtGr Tcl, Tk, Mxt graph

These files should be placed in the standard system locations for dynamic libraries. Alternatively, Windows users can augment their PATH environment variable to include the location of these DLL's. Similarly, UNIX users can augment their LD_LIBRARY_PATH environment variable.

To load the MathXplorer/T packages, use Tcl's load command. Specify as its argument the path of a library file containing the package. Should load complain with a file-not-found type of message, check that:

If you want the MathXplorer/T commands to be available on-demand, you have two options:

Note that package MxtGr depends on package Mxt. However, package Mxt need not be explicitly loaded before MxtGr since MxtGr implicitly loads Mxt.

m-files

As we mentioned in the introduction, the MathXplorer/T package supports user-defined script files. These files have the '.m' extension. For example, you can define a function sigmag in the file c:\m-files\sigmag.m containing the following:

function [ mag ] = sigmag( x )
mag = abs(fft(x));

MathViews maintains a character array variable _MVPATH. It interprets this character array as a separated list of directories which are to be search for files with the '.m' extension. When a MathViews interpreter is created, it initializes the value of _MVPATH with the value of the environment variable MVPATH, should it exist. At any time, you can clear an interpreter's cache of loaded functions by invoking (assuming an interpreter MV created on Windows):

% MV eval clear functions
% MV eval "_MVPATH='c:\\\\m-files;d:\\\\more-m-files\\\\foo'"
_MVPATH =
c:\m-files;d:\more-m-files\foo

(Admittedly obscene, the four back-slashes are needed under Windows to give _MVPATH the value c:\m-files;d:\more-m-files\foo. The double-quotes surrounding the argument to MV eval are needed to prevent Tcl from interpreting the Windows path-list separator, the semicolon, as a Tcl command separator. UNIX users don't have to suffer this particular complication.). It is a good idea to set the MVPATH environment variable right before loading the Mxt package, possibly in Tcl's start-up script. This will guarantee that any MathViews interpreter created subsequently will have an initialized value of its variable _MVPATH. Each MathViews interpreter can then modify its value of _MVPATH.

Test Drive

Using wish, let's give it a try:

% package names enumerate existing packages
Tcl Tk
% load mxt.dll load the Mxt package
% package names enumerate packages again
Mxt Tcl Tk minterp now available
% set env(MVPATH) c:\\my_dir set the MVPATH environment variable
% minterp create MV create an interpreter MV
MV
% MV eval x=1:5 use MV to create a vector x
x =
1 2 3 4 5
% load mxtgr.dll load the MxtGr package
% package names enumerate packages
MxtGr Mxt Tcl Tk graph now available
% graph .g -bg yellow create a widget .g
.g
% pack .g display .g

The MathWizards

Last modified: Mon Nov 30 16:49:34 PST 1998