REDUCE is a general-purpose computer algebra system originally geared towards applications in physics.
[2] REDUCE was open-sourced in December 2008 and is available for free under a modified BSD license on SourceForge.
Implementations of REDUCE are available on most variants of Unix, Linux, Microsoft Windows, or Apple Macintosh systems by using an underlying Portable Standard Lisp (PSL) or Codemist Standard Lisp (CSL) implementation.
The difference is that if the input results in a useful (non-nil) value then it will be output if the separator is a semi-colon (;) but hidden if it is a dollar sign ($).
However, a REDUCE variable can have no value, in which case it is displayed as its name, in order to allow mathematical expressions involving indeterminates to be constructed and manipulated.
Programming languages use identifiers to name constructs such as variables and functions, and strings to store text.
A REDUCE identifier can also include any character anywhere if it is input preceded by an exclamation mark (!).
REDUCE source code was originally written in all upper-case letters, as were all programming languages in the 1960s.
However, modern REDUCE is case-insensitive (by default), which means that it ignores the case of letters, and it is normally written in lower-case.
The exceptions to this rule are that case is preserved within strings and when letters in identifiers are preceded by an exclamation mark (!).
program, which is slightly longer than the version above, uses an identifier as follows CSL REDUCE displays the same output as shown above.
One is the begin...end construct inherited from ALGOL 60, which is called a block or compound statement.
Algebraic computation usually proceeds by transforming a mathematical expression into an equivalent but different form.
As an example of functional programming in REDUCE, here is an easy way to compute the 5th Taylor polynomial of
That can be fixed by changing a few output-control switches and then evaluating the special variable ws, which stands for workspace and holds the last non-empty output expression: As an example of procedural programming in REDUCE, here is a procedure to compute the general Taylor polynomial, which works for functions that are well-behaved at the expansion point
REDUCE GUIs provide menu support for some or all of the file and package handling described below.
In order to develop non-trivial computations, it is convenient to store source code in a file and have REDUCE read it instead of interactive input.
It is recommended to end a REDUCE input file with the line as an end-of-file marker.
REDUCE output can be directed to a file instead of the interactive display by executing the command Output redirection can be terminated permanenty by executing the command or temporarily by executing the command There are similar mechanisms for directing a compiled version of the REDUCE input to a file and loading compiled code, which is the basis for building REDUCE and can be used to extend it.
REDUCE is composed of a number of packages; some are pre-loaded, some are auto-loaded when needed, and some must be explicitly loaded before they can be used.
The precise filenames and locations depend on the version of Lisp on which REDUCE is built, but the package names are always the same.
The simplest REDUCE data types are Standard Lisp atomic types such as identifiers, machine numbers (i.e. "small" integers and floating-point numbers supported directly by the computer hardware), and strings.
One is called prefix form, which is just the Standard Lisp code for the expression and is convenient for operations such as input and output; e.g. for
it is REDUCE converts between these two representations as necessary, but tries to retain standard quotient form as much as possible to avoid the conversion overhead.
(The reason for the name scalar is buried in the history of REDUCE, but it was probably chosen to distinguish local variables from the relativistic 4-vectors and Dirac gamma matrices defined in the high-energy physics package, which was the original core of REDUCE.
This distinction is more significant in the REDUCE implementation language, RLISP, also known as symbolic or lisp mode.
The REDUCE begin...end block described above is translated into a Standard Lisp prog form by the REDUCE parser, and all Standard Lisp variables should either be bound in prog forms, or declared global or fluid.
This distinction is normally only significant to a Lisp compiler and is used to maximize efficiency; in interpreted code these declarations can be skipped and undeclared variables are effectively fluid.
The REDUCE GNUPLOT package supports the display of curves or surfaces defined by formulas and/or data sets via the command plot(...).
In 2024, binary distributions were released for 64-bit versions of macOS, Linux (Debian and Red Hat based systems) and Microsoft Windows.