next up previous contents index
Next: THE PACKAGE SYStems - Up: Commands for Producing HTML Previous: HTML   Contents   Index


Using an input file

Because Mathematica is interpretive, it is tempting to perform computations by starting Mathematica and start typing. Often, however, we have found that it is often the case that it is helpful to construct an auxilary file and then to load that file. This has the benefit of allowing the user to modify the computation slightly and rerun it, as well as the additional benefit of recording the computation.

A common input file may have the form

First version of the file

Get["NCGB.m"];
start = {x**x-a,
         Inv[y]**y-1,y**Inv[y]-1,
         (1-x)**Inv[1-x]-1,
         Inv[1-x]**(1-x)-1
};
start = NCExpand[start];  (* NCExpand, alias NCE is explained in the NCAlgebra document. *)
Print["start:",start];

After the file is run, one can see whether or not the file executed correctly. It does not -- we forgot the SetNonCommutative command. The new file would look like:

Second version of the file

Get["NCGB.m"]; 
SetNonCommutative[a,x,y,Inv[x],Inv[1-y]];
start = {x**x-a, 
         Inv[y]**y-1,y**Inv[y]-1,
         (1-x)**Inv[1-x]-1,
         Inv[1-x]**Inv[1-x]-1
};
start = NCExpand[start]; 
Print["start:",start];

After restarting Mathematica and running this command, we find that $ start$ is what we expect it to be. We can then remove the Print statement and add more code.


next up previous contents index
Next: THE PACKAGE SYStems - Up: Commands for Producing HTML Previous: HTML   Contents   Index
NCAlgebra Project 2002-09-09