Loading/Running a File

To load the program state from a file or run a scripted calculation, tap the "File..." button, choose "Load Algebra" and follow the prompts, or use the "load" command.

The "load" command has two related uses; it is used to restore "save"d files, and to run scripts of pre-written commands.

(The "verbose" Command-line option forces display of the file's source lines)

Loading a file does not REPLACE the current session; the saved commands MODIFY the current session just as if they had been entered interactively.  If the script requires a clean slate, "unlock all", "clear all" and "remove all" commands should be included early in the script.

Scripts can contain "comment"s and include interactive elements such as the "input" command.

Note:  Scripts can load other scripts, so they can access related library files of equations and variables automatically.

Restoring a Session

A workspace saved with the "save" command can be used to restore that workspace.

An important point is that "load"ing a file does not REPLACE the current session; the saved commands MODIFY the current session just as if they were being entered interactively.  If the current workspace is not cleared, the loaded file may produce unexpected results as its variable and/or equation definitions are added to the existing workspace!

If the workspace should be empty before loading the saved session, "unlock all", "clear all", and "remove all" commands should be done before the file is loaded.

For example, the following restores the previously-saved example workspace from scratch:

> unlock all

> clear all

> remove all

> load temp.eqn verbose

temp.eqn> C=25

               C = 25

       C = 25

temp.eqn> K=298

               K = 298

       K = 298

temp.eqn> F=77

               F = 77

       F = 77

temp.eqn>

temp.eqn> F=32+9(-273+K)/5

 * Warning: Equation 'F=32+9(K-273)/5' is Overdetermined, but the system is Consistent.


temp.eqn> K=273+C

 * Warning: Equation 'K=273+C' is Overdetermined, but the system is Consistent.


> list

 (Eq. 1)
9 (K - 273)
F = 32 + -----------
5

 (Eq. 2)
               K = 273 + C

       C = 25
       K = 298
       F = 77

Note:  The warning messages inform that the equations are "Overdetermined" (meaning all of their variables already had values prior to the equations' definitions), but "Consistent" (meaning the variables' values do not contradict the equations).  If there were an inconsistency, the warning would say so, and any results should be suspect until the inconsistency were resolved.

Since save files may contain only variables, or only equations, there can be good reasons for NOT clearing the workspace prior to loading a file...  Partial save files can be used to load a "library" of equations or variables into the current session.

Running a Script

"load"ing a file is nothing more than the program reading and executing a sequence of commands from a file.  In fact, a "save" file is actually a script that contains only variable, lock, and/or equation definitions!

By default, an input file's source lines are not displayed as the file is loaded.  To include that feedback, the optional keyword "verbose" can be specified from the Command line after the filename.  Showing the input lines can be useful for seeing the exact sequence of commands (not just the effects) that a script includes.

In general, a script may contain any valid program commands.  Scripts can even load other scripts to automatically import any needed libraries of equations or variables.