Run-REDUCE User Guide

© 2023 Francis Wright

Contents

General Information

Run-REDUCE remembers user preferences and uses them the next time it starts. It uses the standard Java package java.util.prefs, which stores data persistently in an implementation-dependent backing store. On Microsoft Windows the preferences for this application are stored in the registry under the key "Computer\HKEY_CURRENT_USER\Software\JavaSoft\Prefs\fjwright\runreduce" and on Linux they are stored in XML files under the directory "~/.java/.userPrefs/fjwright/runreduce/".

By default, Run-REDUCE looks in the standard places for a REDUCE installation. On Microsoft Windows it looks for the folder "\Program Files\Reduce" on all accessible drives. On Linux it assumes that executable files are under "/usr/lib/reduce", REDUCE package information is in "/usr/share/reduce/packages", and documentation is in "/usr/share/doc/reduce". But this information can all be reconfigured.

Run-REDUCE supports the relevant default JavaFX keyboard shortcuts. Additional keyboard shortcuts are described below where appropriate, and the keyboard shortcuts relevant to text editing are described in the section on Editing.

The Main Window

The main window consists of one or more REDUCE panels that can each run an independent invocation of REDUCE. There are three options: a single REDUCE panel (the default); a split pane containing two REDUCE panels side-by-side that are both visible; a tabbed pane containing one or more REDUCE panels, of which only the selected panel is visible. The choice of display pane arrangement is controlled by options in the View menu. You can switch dynamically among the three options, in which case the currently selected REDUCE panel (only) and the REDUCE invocation running in it (if any) is preserved and carried to the new display pane arrangement, but any other REDUCE invocations are discarded.

With a split pane, you can select synchronised scrolling so that scrolling the selected REDUCE panel (in any way) also scrolls the other REDUCE panel to the same relative position. This facility is experimental and currently forces both REDUCE panels to display content at the same (relative) position; the other REDUCE panel cannot be scrolled from its current position but will jump to the same relative position as the selected REDUCE panel.

With a split or tabbed pane, you can select the active REDUCE panel by clicking on the desired panel in a split pane or tab on a tabbed pane. You can also select the next REDUCE panel cyclically forwards by pressing Control+Tab or Control+PageDown, or backwards by pressing Control+Shift+Tab or Control+PageUp. The non-selected panel in a split pane is greyed out and the selected panel displays a green dot near the top right-hand corner, immediately to the left of the Hide Editor toggle button. All controls apply (primarily) to the currently selected REDUCE panel.

Tabs are initially labelled Tab 1, Tab 2, etc., and a new tab is labelled Tab n if it is the nth tab to be added. (Removing tabs does not affect the numbering.) However, when REDUCE is run in a tab, the tab label changes to the name of the REDUCE command being run, and remains so until a different REDUCE command is run in that tab.

REDUCE Panels

A REDUCE panel normally consists of two panes one above the other. The top pane displays all the REDUCE input and output in the current session. It is read-only. The bottom pane is an input editor that supports all the standard keyboard and mouse-based editing facilities normally provided by your platform. It is disabled unless REDUCE is running in this panel. Both panes display vertical and horizontal scroll bars when necessary. Text does not wrap. The horizontal divider separating the two panes can be dragged up and down.

There is a toggle button in the top right-hand corner of each REDUCE panel, which when clicked hides the input editor. This is useful for viewing long runs of output. Clicking the button again shows the input editor.

The name of the currently running (or last run) REDUCE command is appended to the label of the REDUCE input/output display pane. (You can edit the command names in the REDUCE configuration dialogue.)

You type (or paste) REDUCE input into the input editor pane, edit it as necessary, and then click on the Send Input button, which sends the input to REDUCE and echos it in the top pane. This clears the input editor, but you can scroll through the previous input (entered via the input editor) using the Earlier Input and Later Input buttons. Scrolling to input later than the last previous input clears the input editor pane back to its state before you started scrolling.

When keyboard focus is in the input editor pane, the following keyboard shortcuts are active:

Keyboard Shortcut Action
Control+Enter Send Input (auto-terminated)
Control+Shift+Enter Send Input (not auto-terminated)
Control+UpArrow Earlier Input
Control+DownArrow Later Input

where Enter is the Return or Enter key and UpArrow / DownArrow are the cursor up / down keys, respectively.

Sending input to REDUCE strips any trailing white space, normally auto-terminates it by adding a semicolon if there was no final terminator, and then adds a final newline. However, if Run-REDUCE detects a question mark in the input prompt then it suppresses auto-termination (so if you really want a terminator you must enter it explicitly). As an additional precaution, holding the Shift key while clicking on the Send Input button or pressing Control+Enter always suppresses auto-termination.

You can edit previous input recalled into the input editor as necessary and then send it to REDUCE. Input can be multi-line, in which case Run-REDUCE processes all the lines together. The Send Input action is disabled unless REDUCE is running, and the Earlier Input and Later Input actions are disabled unless there is earlier or later input, respectively.

The Pop-up Keyboard

The pop-up keyboard provides access to special symbols and Greek letters on the top half of the keyboard and elementary functions on the bottom half. It is available by clicking the primary mouse-button (normally the left if there is more than one) while holding down the Control key while the mouse pointer is over an input editor text area or any text field in a template or function dialogue. Note that clicking the secondary (normally the right) mouse-button on any text field pops up a generic editing context menu.

Clicking on a character button on the top half of the pop-up keyboard causes that character to overwrite the selected text if there is any or otherwise to insert at the text cursor (caret). Clicking on a function button on the bottom half of the pop-up keyboard causes that function to be applied to the selected text if there is any (i.e. wrapped around it using parentheses) or otherwise to be inserted followed by parentheses at the text cursor, which is left within the parentheses. The pop-up then closes. The pop-up also closes if you click anywhere outside it, or you can close it by clicking on the Close button in the bottom left corner or by pressing the Escape key on your main keyboard.

By default, the top half of the pop-up keyboard provides the REDUCE symbolic constants ∞ (infinity) and π (pi) in the left column and the lower-case Greek alphabet in the right block, and the bottom half of the pop-up keyboard provides common elementary functions in the left block and trigonometric and hyperbolic functions in the right block. The pop-up keyboard has two layers and the secondary layer is accessed by either clicking on the Shift button in the top left corner or holding down the Shift key on your main keyboard. Note that the physical Shift key does not act as a toggle but the virtual Shift button does. The top half of the secondary keyboard layer provides additional REDUCE symbolic constants and upper-case Greek letters; the bottom half provides common predicates and inverse trigonometric and hyperbolic functions.

All special symbols on the pop-up keyboard have their names spelt out appropriately using ASCII characters automatically before sending them to REDUCE. The symbolic constants in the top left column are given their REDUCE names and the Greek letters in the top right block use the TeX naming convention. Note that, by default, special symbols are translated to REDUCE identifiers only when they are sent to REDUCE, not when they are inserted into the input editor. The results should be accepted as identifiers and typeset appropriately by all versions of REDUCE.

If you hover your mouse pointer over a symbolic constant button then a tooltip pops up giving the REDUCE name of the constant and a brief description of it and/or its conventional name and approximate numerical value (if appropriate). If you hover your mouse pointer over a Greek letter button then a tooltip pops up giving its TeX-style name. If you click on the English button in the top right corner of the pop-up keyboard or hold down the Alt key whilst clicking on any button on the top half of the pop-up keyboard then its name spelt-out using ASCII characters is output instead of the single non-ASCII character.

If you hover your mouse pointer over a function key then a tooltip pops up giving its full name. If you click on the Radians button in the bottom right corner of the pop-up keyboard or hold down the Alt key whilst clicking on any trigonometric function button then the degree version of the function is used. The label on the Radians button changes to Degrees if you click on it or hold down the Alt key, and changes back to Radians if you click on it again or release the Alt key. This label shows the current trigonometric function mode. Note that degree mode only works if the TRIGD package has been loaded in REDUCE. At some later date I hope to be able to automate this, but for now you need to do it by hand.

Note that some characters are available as both symbolic constants and as Greek letters, but only π means the same in both cases. In order to preserve the two meanings, the symbolic constants may be preceded by a Unicode zero-width non-joiner (ZWNJ) character, which is removed automatically when the symbolic constant is sent to REDUCE. The ZWNJ character is invisible but it is nevertheless there. If you move the text cursor past a symbolic constant you will also need to move it past the ZWNJ character, although you will not see the cursor move, and if you delete a symbolic constant you should also delete the ZWNJ character, although again you will not see the cursor move. (If you don't delete it then it could cause confusion.)

Editing

Run-REDUCE supports the following keyboard shortcuts on Windows and Linux:

Select all in focused control or window Ctrl+A
Cut the selection and store it in the clipboard Ctrl+X
Copy the selection into the clipboard Ctrl+C
Paste contents of clipboard at cursor Ctrl+V
Undo the last operation Ctrl+Z

However, REDUCE input/output display panes are read-only and so only support select and copy operations. All input areas also support an editing context menu, which is available by clicking the secondary (normally the right) mouse-button while the mouse pointer is over the input area.

REDUCE Configuration

The Configure REDUCE... item on the REDUCE menu displays a dialogue that allows you to configure the directories used by REDUCE and the commands used to run REDUCE. The defaults should work for standard installations of pre-built snapshot releases on Microsoft Windows and Linux. Run-REDUCE currently assumes that if it is not running on Windows then the Linux default configuration is appropriate, so that is what you will see by default on (say) Apple macOS. There is a button in the top left-hand corner to reset the whole REDUCE configuration to the platform defaults.

When you click on the Save button, any changes made using this dialogue are saved as preferences and the new configuration is used within Run-REDUCE. If you click on the Cancel button then all changes made since this dialogue opened are forgotten. Run-REDUCE warns you if any fields that are directories or files do not exist or are unreadable and asks if you want to continue anyway. This includes command arguments that begin with $REDUCE or ~ followed immediately by / or \ (see below).

Note that all field values are stripped of leading and trailing space before they are used or saved, and empty command argument fields are not saved at all. Most fields have a button beside them labelled "...". Clicking on this button displays a directory or file chooser that can be used to set the field (which can then be edited further).

The dialogue is divided into three main sections, each of which is described separately below.

Generic Information

The box in the top right-hand corner covers directories that relate to the portable REDUCE code and are independent of particular REDUCE implementations or run commands. The REDUCE Root Directory field provides the initial directory for the directory or file choosers for most of the other fields, which is useful on Windows or with local builds; see Configuring Run-REDUCE for Subversion Builds.

The Load Packages... facility in the File menu requires a standard REDUCE packages directory, which should be specified as the value of the REDUCE Packages Directory field. This directory should contain directories named alg, algint, arith, etc. It is only used by Load Packages.... If the directory specified does not exist or is mis-configured then Load Packages... will pop up a warning and closing it will automatically pop up the Configure REDUCE... dialogue to allow you to correct the problem.

The Help menu items that display REDUCE documentation require the directories containing the distributed documentation files to be specified as the values of the REDUCE Manual Directory and REDUCE Primers Directory fields. These fields are named after the directories in the REDUCE Subversion repository and the same directory division is used for the standard Windows snapshot installation folders, although on a standard Linux snapshot installation the two directories are the same. The REDUCE Manual Directory should contain the files manual.html and manual.pdf and the REDUCE Primers Directory should contain the files insidereduce.pdf, primer.pdf and sl.pdf, where on Linux the filename extension is .pdf.gz instead of just .pdf.

The REDUCE Working Directory field allows you to configure the initial working directory used by REDUCE and the initial directory used by all the file choosers available from the File menu. (However, note that this is only the initial directory because you can change the directory when you use a file chooser and the file choosers remember and share the last directory used. This does not change REDUCE's working directory!) By default, the REDUCE Working Directory is your home directory, but you can change it to anything you want. The button beside this field labelled "..." does not pop up a directory chooser directly, but instead pops up a context menu with items labelled Your Home Directory, Run-REDUCE Directory and Choose Any Directory, which respectively set the REDUCE Working Directory field to your home directory, the directory containing Run-REDUCE.jar, or any directory you choose using the directory chooser that pops up. The initial directory for this chooser is your home directory.

The REDUCE Command List

In the bottom left-hand corner of the dialogue is a list of REDUCE command labels and clicking on a command label selects it for editing in the box in the bottom right-hand corner. Clicking on the ▲ (up) or ▼ (down) button immediately below this list moves the selected command up or down the list cyclically, meaning that when a command moves above the top of the list is reappears at the bottom, and vice versa. Clicking on the Save button saves the order of the commands together with the other information in the dialogue, and re-starting Run-REDUCE restores it.

Clicking on the Reset Selected Command button resets the selected command to its default configuration if this exists, otherwise nothing happens. The appropriate default configuration is found by matching the command label.

Clicking on the Delete Selected Command button completely deletes the selected REDUCE command. If you delete all available commands then a new (empty) command is automatically created.

Clicking on the Duplicate Selected Command button duplicates the configuration for the selected REDUCE command with a new label at the bottom of the list. The new label is the label of the duplicated command with New appended, which you can edit in the Command Label field as you wish. (But keep command labels fairly short!). This provides a convenient way, for example, to add one or more REDUCE commands with non-standard options such as memory size.

Clicking on the Add New Command button adds a new REDUCE command at the bottom of the list, which is initially labelled New Command, with all other fields empty. You could, for example, add one or more commands running REDUCE on Common Lisp. (At some future date I may include CL REDUCE in the default configuration.)

Specific Information

The box in the bottom right-hand corner relates to the REDUCE command currently selected in the list on the left. You can change the label by editing the Command Label field. You should then press the Return key to confirm the edit, which will update the label in the list of REDUCE commands. Whether you confirm an edit or not, the new label will be saved if you click on the Save button. Command labels must be unique and an error alert will pop up that prevents you from saving a non-unique label.

If the Use Default Command Shell check box is selected then the REDUCE command is run via the default system shell, which is found as the value of the appropriate environment variable: ComSpec on Windows; SHELL on other platforms. In this case the command can be any name that the shell can execute; it need not be a complete pathname. Otherwise, the command entry must be the pathname of an executable binary program. If Use Default Command Shell is selected then the Check Command Pathname check box will be visible. You can use it to select whether Run-REDUCE should check that the command is a pathname that exists and is readable, and the field label changes as appropriate. The default configuration uses the shell and on Linux also uses the search path and does not check the command pathname,

A complete REDUCE command must be split into the command name as described above and a sequence of up to 5 command arguments. (It would be easy to increase this limit, but I hope 5 arguments is enough!) The components of the command that would be separated by white space in a normal shell command must be entered into separate fields in this dialogue. (Blank arguments are ignored.) Run-REDUCE handles the quoting required on Windows, so you should not normally include any quotes explicitly. If any field (other than Command Label) begins with ~ followed immediately by / or \ then it is replaced by your home directory (on all platforms).

You can use absolute pathnames if you want, but often (as with the PSL REDUCE executable and image file names) command components share a common root segment. This root segment can be specified as $REDUCE, which Run-REDUCE will replace with the value of the Command Root Directory field if it is set, or with the value of the REDUCE Root Directory field otherwise. (I have borrowed environment variable syntax, but $REDUCE here is not related to any environment variable.) The Command Root Directory chooser and file choosers use as initial directory the current Command Root Directory field value if defined, otherwise the REDUCE Root Directory field value if defined, otherwise the platform default REDUCE root directory. The file choosers replace the root segment of the returned path by $REDUCE if possible.

The two default REDUCE commands, which assume standard installations of CSL and PSL REDUCE, share the same root directory, which is why the default configuration uses REDUCE Root Directory and leaves Command Root Directory empty. But a Subversion build or a version of REDUCE running on Common Lisp would probably use a different root directory.

The File Menu

Some items in this menu pop up a dialogue that allows you to select one or more items, such as filenames. This dialogue supports all the standard keyboard and mouse-based selection facilities normally provided by your platform. In particular, in dialogues that allow selection of multiple items, holding the Control key down while clicking on an item selects or deselects it without affecting any other selections, and holding a Shift key down while clicking on an item extends the selection to that item. Double-clicking on an item selects it and then immediately runs the action associated with the confirmation button.

Most of the menu items run a REDUCE command, which is echoed in the display pane but does not appear in the input editor. The file chooser dialogues all share the same default directory, which normally is initially your home directory, but the last directory you used will be the default directory the next time you use a file chooser dialogue. This default directory is generally independent of REDUCE's default directory, even if it is initially the same.

The File menu provides the following items:

Echo File Input

Selecting this causes Run-REDUCE to echo file input to the Input/Output Display pane. It is selected by default.

Input from Files...

This displays a file chooser that allows you to choose one or more source code files to input into REDUCE (using the REDUCE IN command). By default, the file chooser shows only *.red and *.tst files, but you can reset it to show only *.txt files or all files. (Note that the recommended extension for REDUCE source code file names is .red and that a REDUCE source code file should end with ;end; to avoid an error message.) This menu item is disabled unless REDUCE is running.

Input Package Files...

This works the same as the previous menu item except that the initial directory is always the REDUCE packages directory. It is primarily intended to provide easy access to the package test files.

Output to New File...

This displays a file chooser that allows you to choose a file to send output to instead of the GUI (using the REDUCE OUT command). By default, the file chooser shows only *.log and *.rlg files, but you can reset it to show only *.txt files or all files. (Note that the extension used for REDUCE package test output log file names is .rlg.) Only one output file can be active at a time and choosing a new output file redirects output to that file without shutting the previous output file. The GUI remember all the open output files (opened via this menu item) to facilitate switching or shutting output files as described below. This menu item is disabled unless REDUCE is running.

Output to Open File...

This displays a list of open output files and allows you to select one for output. This menu item is disabled unless there are open output files.

Output Here

This redirects output to the GUI without shutting the current output file (using the REDUCE OUT T command). This menu item is disabled unless there are open output files.

Shut Output Files...

This displays a list of open output files and allows you to select one or more to be shut (using the REDUCE SHUT command). This menu item is disabled unless there are open output files.

Shut Last Output File

This shuts the last used open output file (using the REDUCE SHUT command). This menu item is disabled unless there are open output files.

Print Session Log...

This prints the whole content of the Input/Output Display pane including all styling, after first displaying your platform's standard print dialogue. After you confirm the print dialogue, an alert pops up to either confirm that the session log has been sent to the printer or report failure. Whilst printing seems to work fine on Microsoft Windows it can be a bit awkward on Linux; see Printing on Linux.

Save Session Log...

This displays a file chooser that allows you to specify a file to which to save the entire contents of the Input/Output Display pane. By default, the file chooser shows only *.log and *.rlg files, but you can reset it to show only *.txt files or all files. The filename defaults to session.log, but you can change this. If the specified file already exists then the session log overwrites its previous content. Typeset maths is output as LaTeX markup.

Append Session Log...

This works the same as the previous menu item except that if the specified file exists then the session log is appended to its previous content.

Exit

This terminates both REDUCE and the Run-REDUCE GUI, as does the close widget that is normally at the top right-hand corner of the main window frame.

The REDUCE Menu

The REDUCE menu provides the following items:

Run REDUCE...

This sub-menu provides an item for each configured REDUCE run command (typically based on different versions of Lisp, by default CSL and PSL). Clicking on a REDUCE run command executes it. This sub-menu is disabled when REDUCE is running.

Auto-run REDUCE...

This sub-menu allows you to select a REDUCE run command that Run-REDUCE will execute automatically when it starts, or none. Run-REDUCE remembers this selection and uses it the next time it starts. If REDUCE is not running then Run-REDUCE also runs the selected REDUCE command immediately.

Load Packages...

This displays a list of standard REDUCE packages and allows you to select one or more to load (using the REDUCE LOAD_PACKAGE command). The list excludes packages that are preloaded and other inappropriate packages, and is sorted alphabetically. Run-REDUCE determines the list of packages each time it starts up by reading the package.map file in the REDUCE packages directory. This menu item is disabled unless REDUCE is running. Right-click a package, or select one package and click on the Display Manual Entry button, to display the manual entry (if it exists) for the package, using the default web browser.

Stop REDUCE

This terminates REDUCE but not the Run-REDUCE GUI. It is the recommended way to stop REDUCE because then Run-REDUCE reliably knows that REDUCE is no longer running. (Run-REDUCE tries to detect input of the BYE and QUIT commands via the input editor, but this may be less reliable.) This menu item is disabled unless REDUCE is running.

Clear I/O Display

This completely erases the content of the Input/Output Display pane. If you want to keep the content, use the Save / Append Session Log... item on the File menu before clearing!

Restart REDUCE

This does a full clean restart of the last-run REDUCE command, which is equivalent to Stop REDUCE followed by Clear I/O Display followed by running the last-run REDUCE command.

Configure REDUCE...

This displays a dialogue that allows you to configure the REDUCE directories and commands; see REDUCE Configuration.

Kill REDUCE

This can be used to kill REDUCE in an emergency, such as if it hangs or you put it into an infinite loop. Once REDUCE has been successfully killed, an information dialogue pops up. If the attempt to kill REDUCE may have failed then an error dialogue pops up. In this (unlikely) situation, it may be advisable to use operating system facilities to check that REDUCE has been killed and if necessary kill it, and then restart Run-REDUCE. (Note that killing REDUCE when run via a shell on Microsoft Windows may only kill the shell and leaves REDUCE running!)

The View Menu

Run-REDUCE remembers the options you select using the View menu and uses them the next time you start Run-REDUCE. Run-REDUCE uses the last set values initially when you create a new REDUCE panel. The View menu provides the following items:

Font Size...

This displays a dialogue that allows you to change the font size used in the Input/Output Display and Input Editor panes. The default size is 15. Font size applies to each REDUCE panel independently.

Font Colours...

This displays a dialogue that allows you to change the colours used in the Input/Output Display pane. Font colours apply to all REDUCE panels together.

The colours that you can select are the foreground text colours for algebraic and symbolic mode input and output, and the background colours for warnings (preceded by ***) and errors (preceded by *****). The labels on the left model the colours. Clicking on a button on the right drops down a simple colour grid from which you can pick a colour, and clicking on Custom Color... at the bottom of the grid opens a more advanced dialogue, which includes the option to change the opacity. This is primarily relevant to the background colours, which are 25% opaque by default.

If you click on the Cancel button then the colours used do not change. If you click on the Save button then the currently selected colours are used for the selected REDUCE panel and saved as preferences. They will be used by default the next time you start Run-REDUCE. If you click on the Reset Defaults button then the built-in default colours are reinstated in the dialogue but not used or saved unless you click on the Save button.

Bold Prompts

When this is selected, which it is by default, Run-REDUCE emboldens the display of all input prompts. Bold prompts apply to each REDUCE panel independently.

I/O Colouring

When this is selected, which it is by default, Run-REDUCE colours the text in the Input/Output Display pane. I/O colouring applies to each REDUCE panel independently (although the colour choices apply to all REDUCE panels together). The colouring depends on REDUCE's current input mode: by default, algebraic-mode prompts and input are red, algebraic-mode output is blue, symbolic-mode prompts and input are green, symbolic-mode output is brown. Echoed file input is not coloured. By default, Run-REDUCE highlights warnings and errors with respectively quarter-opaque orange and red background colours.

Note that turning I/O colouring on does not fully take effect until the next input prompt. Turning I/O colouring off takes effect immediately and turning it back on mid-session turns any previous I/O colouring back on, but any I/O produced while I/O colouring was turned off will not be coloured. (This is because the required markup is only generated when I/O colouring is turned on to conserve resources.) Output display will be slightly faster when I/O colouring if turned off.

Typeset Maths

When this is selected, which it is by default, Run-REDUCE displays algebraic-mode mathematical output more-or-less as it would be typeset, and centred horizontally. Typeset maths applies to each REDUCE panel independently. Output display will be significantly faster when Typeset Maths is turned off. WARNINGS: Typeset Maths is currently experimental and line breaking is somewhat arbitrary. The display may be incorrect in some cases, e.g. with unusual switch settings such as on list. If any LaTeX markup appears (coloured red) in the output then please let me know! Save Session Log... outputs typeset maths using LaTeX markup.

Single Pane Display

When this is selected, which it is by default, Run-REDUCE displays the selected REDUCE panel only.

Split Pane Display

When this is selected, which it is not by default, Run-REDUCE displays two REDUCE panels side-by-side. The left-hand panel displays the previously selected REDUCE panel (if any) and is initially active. Clicking on a REDUCE panel makes it active for input via its input editor pane and the menus. The inactive REDUCE panel can continue to update its output display. Both panels are the same size initially, but you can change that by dragging the divider.

Tabbed Pane Display

When this is selected, which it is not by default, Run-REDUCE displays a tabbed pane with the previously selected REDUCE panel (if any) displayed under the first tab. Clicking on the × icon at the right of the selected tab label removes that tab and the REDUCE panel it contains. When there is only one tab, removing it disables tabbed display but preserves the REDUCE panel that the tab contained.

Synchronise Scrolling

When this is selected, which it is not by default, Run-REDUCE synchronises the scrolling of the two REDUCE panels in a split pane display; see The Main Window. This menu item is disabled unless split pane display is selected.

Add Another Tab

Selecting this menu item adds a new tab to a tabbed display. It item is disabled unless tabbed pane display is selected.

The Options Menu

Run-REDUCE remembers the options you select using the Options menu and uses them the next time you start Run-REDUCE. Run-REDUCE uses the last set values initially when you create a new REDUCE panel. The Options menu provides the following items:

Show Menu History

When this is selected, which it is not by default, scrolling through previous input shows commands generated by the menus. They are also shown if the Shift key is held down while scrolling through previous input.

Pop-Up Queries

When this is selected, which it is by default, Run-REDUCE pops up a confirmation alert when REDUCE queries the user. This alert handles the query without any explicit text input.

The Templates Menu

The Templates menu facilitates construction of structured expressions and statements whose syntax might not be immediately obvious, especially to a novice. The template dialogues all provide hyperlinks to the key sections of the local HTML version of the REDUCE Manual, which open in your default web browser. The dialogues all provide two buttons that apply the filled-in template: the Edit button inserts the template output into the input editor at the current cursor position; the Evaluate button sends the template output directly to REDUCE for evaluation (adding a semicolon terminator, just as the Send Input button does). These buttons do not close the dialogue, which is non-modal (meaning it does not prevent access to other windows) and can be left open but moved out of the way. In fact, several template dialogues can be open at the same time. To close a template dialogue, click on the Close button.

If the template represents an operator with a primary operand then this defaults to ws, which is convenient for simple interactive calculations, but it can be changed to anything. The templates provide some minimal input validation: for example, if an element must be an explicit number (rather than a variable that must evaluate to a number), the template will check this and report an error immediately an inappropriate character is entered. When the Evaluate button is used, the template checks that all input has been provided that is required for valid REDUCE syntax; this is not done when the Edit button is used, assuming that further editing will take place. This makes it easy to combine the output from templates, for example, to construct a multiple for loop.

Some templates have a pair of radio buttons at the top labelled Symbolic and Numeric that allow you to switch between the two modes of evaluation; the default is Symbolic. The Numeric option causes the template output to turn rounded mode on before the main template result is output and off again afterwards; it may also load the numeric package and use specific numerical versions of functions. The text message towards the top of each template may vary depending on the Symbolic/Numeric option.

Some templates have one or more switches towards the bottom, which may vary depending on the Symbolic/Numeric option. The switches consist of check boxes that initially show default settings (not those currently in effect in REDUCE). Any switches that are changed from their defaults are set in the template output to reflect the change before the main template result is output and reset afterwards. (Beware that this will override any changes from the default switch settings that were in effect before the template was used.)

These templates are intended only for creating simple structures, but they can form the basis for arbitrarily complex structures if they are entered into the input editor for further editing. The fields of expression templates display minimal formatting intended to hint at how such an expression would normally be typeset.

The Templates menu is disabled unless REDUCE is running. It provides the following items:

Derivative...

This template supports (partial) differentiation involving up to three independent variables, each to arbitrary order. The orders must be explicit positive integers and the total order automatically updates to reflect the number of independent variables and their orders. If an order is omitted then it defaults to 1. The first independent variable is required but others are optional. The dependent variable defaults to ws and the first independent variable defaults to x, but both can be changed.

Integral...

This template supports both indefinite and definite integration: if both limits are omitted then the integral is indefinite; if both limits are specified then the integral is definite. Note that only a definite integral can be evaluated numerically and the template checks this. The integrand defaults to ws and the integration variable defaults to x, but both can be changed.

By default, the template provides a single integral, but if you enter another integration variable in one of the boxes to the right of the primary integration variable then an additional integral appears wrapping the previous integral, thus supporting double and triple integrals. Matching ∫ and d symbol pairs have the same colour (blue, green or red) to facilitate adding limits to the right ∫ symbol.

Limit...

This template supports limits of (mostly) continuous functions (as opposed to sequences). By default, it computes a two-sided limit, which is appropriate if the function is continuous at the limit point. By clicking successively on the superscript box to the right of the limit point field you cycle through the limit from the right/above, indicated by a superscript +, the limit from the left/below, indicated by a superscript -, and the default two-sided limit. All fields are required. The template includes an option to load the SPECFN package, which may improve some results (according to the SPECFN section of the REDUCE User's Manual).

Sum or Product...

This template supports finite repeated sums and products of sequences, i.e. functions of a discrete control variable that runs over a finite range of successive increasing integers. You select whether to construct a sum or product by clicking on the appropriate toggle button, which defaults to a sum. All fields are required.

Matrix...

This template supports the creation of matrices up to 4 by 4. The elements can be any expressions. The (1,1) element is always in the top left-hand corner of the template. The width of the matrix, i.e. the maximum column index, is determined by the right-most non-empty element and the depth of the matrix, i.e. the maximum row index, is determined by the lowest non-empty element. Within the matrix so determined, empty elements default to zero, which is very convenient for entering diagonal, triangular or other sparse matrices.

For Statement...

This template supports the creation of for statements and is modelled on the diagram at the start of the section of the REDUCE manual headed "FOR Statements". You choose between iterating over a numerical range and a list by clicking on the appropriate tab, which then displays the appropriate template. You choose the action and the for each ... in/on option via pop-up choice boxes, which default to the most common choices. (Note that the for each ... on option is only allowed in symbolic mode, but the template does not check this.) The field for the expression to be executed by the for statement is on a separate line to allow it more space.

The Functions Menu

The Functions menu facilitates access to some of the mathematical functions provided by REDUCE via dialogue boxes similar to those provided by the Templates menu. The functions provided include all the special functions listed in section 7.2 Mathematical Functions of the REDUCE User's Manual. They also include some functions listed only in the section on the SPECFN package and when necessary the template output loads the SPECFN package. The function dialogues all provide hyperlinks to the key sections of the local HTML version of the REDUCE Manual, which open in your default web browser.

Hover over a function name to pop up a tooltip that gives a hint at its definition, which often uses linearized mathematical notation similar to LaTeX (but without any backslashes). Click on the name of a special function to go to its full definition in the online NIST Digital Library of Mathematical Functions (DLMF), which the notation used in the templates generally follows. (This occasionally differs slightly from the notation used in the REDUCE Manual.)

The function dialogue boxes provide grids of function templates. Click on the radio button to the left of the function you want to use. All but the active template is disabled and greyed out. The templates display the conventional notation used for the functions but with editable text fields holding the function arguments. The default arguments are either ws, where this seems appropriate, or the conventional variable names, usually those used in the DLMF.

All Functions dialogue boxes have a pair of radio buttons at the top labelled Symbolic and Numeric that allow you to switch between the two modes of evaluation; the default is Symbolic. The Numeric option causes the template output to turn rounded mode on before the main template result is output and off again afterwards.

There are also some switches towards the bottom, depending on the Symbolic/Numeric option. The switches consist of check boxes that initially show default settings (not those currently in effect in REDUCE). Any switches that are changed from their defaults are set in the template output to reflect the change before the main template result is output and reset afterwards. (Beware that this will override any changes from the default switch settings that were in effect before the template was used.) All dialogues provide the switch complex, which in most cases is available only in numeric mode and turns on the use of complex arithmetic; it is off by default. All dialogues also provide the switch savesfs, which turns on caching of numerical values of special functions; it is on by default.

The Functions menu is disabled unless REDUCE is running. It provides the following items:

Exp, Log, Power, etc...

This provides the exponential function, various logarithms, power and roots (surds or radicals), factorial and binomial coefficients, and the hypot, atan2 and atan2d functions. The latter automatically loads the TRIGD package.

Gamma & Beta Functions, etc...

This provides the Gamma, Beta, digamma, polygamma, normalized incomplete Gamma and Beta, and dilogarithm functions, Pochhammer's symbols, binomial coefficients and the Riemann zeta function.

Integral Functions...

This provides exponential, logarithmic, sine, cosine, hyperbolic sine and hyperbolic cosine integral functions, the error function and complementary error function, and the Fresnel sine and cosine integral functions.

Airy & Bessel Functions, etc...

This provides Airy functions of the first (Ai) and second (Bi) kind and their derivatives (Ai' and Bi'), and the families of Bessel functions of the first (J) and second (Y) kind, modified Bessel functions of the first (I) and second (K) kind, and Hankel functions of the first and second kind.

Struve & Kummer Functions, etc...

This provides the families of Struve (H) and modified Struve (L) functions, Lommel functions of the first (s) and second (S) kind, Kummer M and U functions, Whittaker M and W functions, and spherical and solid harmonic (Y) functions.

Classical Orthogonal Polynomials...

This provides the families of Jacobi (P) and Ultraspherical or Gegenbauer (C) polynomials, Chebyshev polynomials of the first (T) and second (U) kind, Legendre (P) and associated Legendre polynomials, Laguerre (L) and generalized Laguerre polynomials, and Hermite (H) polynomials.

The Help Menu

All the documents accessed directly via the Help menu are local files. The Help menu provides the following items:

Run-REDUCE User Guide

This opens the Run-REDUCE User Guide in your default web browser. It is extracted from the Java JAR file at most once per run of Run-REDUCE to your home directory as a file named "Run-REDUCE_User_Guide.html".

REDUCE Manual etc.

These menu items open the manuals and other guides that are distributed with REDUCE in your default web browser or PDF viewer, as appropriate. The files are assumed to be available in your REDUCE installation.

REDUCE Website

This opens the REDUCE website in your default web browser. It provides a lot of background information about REDUCE.

SourceForge Project Site

This opens the SourceForge Project Site in your default web browser. It provides access to the repository containing full source code for REDUCE itself, PSL, CSL, and some very closely related projects, pre-built distributions of REDUCE for various platforms, mailing lists, bug reporting, etc.

About Run-REDUCE

This pops up brief information about Run-REDUCE, including the version number and month of the release. The version number is also shown in the application title bar.

Typeset Maths Display

Differences from the CSL REDUCE GUI, etc.

Identifier Displays as
my_id123 \(\mathit{my\_id}_{123}\)
alpha123 \(\alpha_{123}\)
beta_i \(\beta_i\)
gamma_delta \(\gamma_\delta\)
my_long_id \(\mathit{my\_long\_id}\)
z_bar \(\bar{z}\)
complex_variable_bar \(\overline{\mathit{complex\_variable}}\)
z_bar123 \(\bar{z}_{123}\)
z_bar_k \(\bar{z}_k\)

Derivatives

The (shared) variable fancy_print_df can be set to one of the values partial, total or indexed to control the display of derivatives. The default value is partial. Typeset maths also supports the dfprint switch, and if this switch is on then fancy_print_df is ignored. For example, with the following settings, derivatives are displayed as follows (assuming depend f,x,y and operator g):

Setting df(f,x,2,y) df(g(x,y),x,2,y)
fancy_print_df := partial \(\frac{\partial^3 f}{\partial x^2 \partial y}\) \(\frac{\partial^3 g(x,y)}{\partial x^2 \partial y}\)
fancy_print_df := total \(\frac{d^3 f}{d x^2 d y}\) \(\frac{d^3 g(x,y)}{d x^2 d y}\)
fancy_print_df := indexed \(f_{x,x,y}\) \(g(x,y)_{x,x,y}\)
on dfprint \(f_{x,x,y}\) \(g_{x,x,y}\)

Operators

An operator declared print_indexed has its arguments displayed as indices, e.g. after print_indexed a the operator value a(i,2) is displayed as \(a_{i,2}\). You can declare several operators together to be indexed, e.g.

print_indexed a, b, c;

Printing on Linux

It appears that on Linux, JavaFX is not aware of the default Print to File printer and only displays the print dialogue if there is at least one printer explicitly installed. However, it should be sufficient to install the CUPS PDF printer, to which Run-REDUCE can print. (But beware that Run-REDUCE may not recognise the new printer immediately!) If you have problems printing to a real printer then a workaround might be first to print to PDF and then to print the PDF to a real printer.

If you cancel the print dialogue then Run-REDUCE may be left unresponsive for a long time, but switching focus away from and then back to Run-REDUCE may make it responsive again. Alternatively, you may be able to avoid this problem by selecting the Print To File option instead of cancelling the print dialogue, clicking on Print and then cancelling the resulting file selector, which should cancel the whole print job immediately. (Nearly all the code involved is in the standard JavaFX library and so out of my control, although in the longer term I might be able to improve the responsiveness by running printing in a separate thread.)

Configuring Run-REDUCE for Subversion Builds

Here are some examples of REDUCE command configurations that might be appropriate if you build REDUCE yourself and want to run it from your Subversion repository. They assume that you downloaded the repository to your home directory using the svn command provided by SourceForge.

Microsoft Windows using the Shell

CSL REDUCE

Command Label CSL REDUCE Subversion
Command Root Directory ~\reduce-algebra-code
Command Pathname $REDUCE\bin\redcsl.bat
Command Argument 1 --nogui

PSL REDUCE

Command Label PSL REDUCE Subversion
Command Root Directory ~\reduce-algebra-code
Command Pathname $REDUCE\bin\redpsl.bat

Linux using the Shell

CSL REDUCE

Command Label CSL REDUCE Subversion
Command Root Directory ~/reduce-algebra-code
Command Pathname $REDUCE/bin/redcsl
Command Argument 1 --nogui

PSL REDUCE

Command Label PSL REDUCE Subversion
Command Root Directory ~/reduce-algebra-code
Command Pathname $REDUCE/psl/redpsl

Microsoft Windows not using the Shell

CSL REDUCE

Command Label CSL REDUCE Subversion
Command Root Directory ~\reduce-algebra-code\cslbuild\x86_64-pc-windows
Command Pathname $REDUCE\csl\reduce.com
Command Argument 1 --nogui

PSL REDUCE

Command Label PSL REDUCE Subversion
Command Root Directory ~\reduce-algebra-code\pslbuild\x86_64-pc-windows
Command Pathname $REDUCE\psl\bpsl.exe
Command Argument 1 -td
Command Argument 2 1000
Command Argument 3 -f
Command Argument 4 $REDUCE\red\reduce.img

Linux not using the Shell

CSL REDUCE

Command Label CSL REDUCE Subversion
Command Root Directory ~/reduce-algebra-code/cslbuild/x86_64-unknown-ubuntu20.04
Command Pathname $REDUCE/csl/reduce
Command Argument 1 --nogui

PSL REDUCE

Command Label PSL REDUCE Subversion
Command Root Directory ~/reduce-algebra-code/pslbuild/x86_64-unknown-ubuntu20.04
Command Pathname $REDUCE/psl/bpsl
Command Argument 1 -td
Command Argument 2 1000
Command Argument 3 -f
Command Argument 4 $REDUCE/red/reduce.img