Reduce (computer algebra system)

REDUCE

CSL REDUCE on Microsoft Windows

Developer(s)| Anthony C. Hearn et al.
Initial release| 1968; 57 years ago (1968)
Stable release|

August 2024; 5 months ago (2024-08)[1]

Repository| sourceforge.net/projects/reduce-algebra/
Written in| Standard Lisp
Operating system| Cross-platform
Type| Computer algebra system
License| Modified BSD license
Website| reduce-algebra.sourceforge.io

REDUCE is a general-purpose computer algebra system originally geared towards applications in physics.

The development of REDUCE was started in 1963 by Anthony C. Hearn. Since then, many scientists from all over the world[2] have contributed to its development. REDUCE was open-sourced in December 2008[3] and is available for free under a modified BSD license on SourceForge. Previously it had cost $695.

REDUCE is written entirely in its own Lisp dialect called Standard Lisp,[4] expressed in an ALGOL-like syntax called RLISP that is also used as the basis for REDUCE's user-level language.

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. CSL REDUCE offers a graphical user interface. REDUCE can also be built on other Lisps, such as Common Lisp. The Julia package Reduce.jl[5] uses REDUCE as a backend and implements its semantics in Julia style.

## Programming paradigms

[edit]

REDUCE's user-level language supports several programming paradigms, as illustrated in the programming examples below.

Since it is based on Lisp, which is a functional programming language, REDUCE supports functional programming and all statements have values (although they are not always useful). REDUCE also supports procedural programming by ignoring statement values. Algebraic computation usually proceeds by transforming a mathematical expression into an equivalent but different form. This is called simplification, even though the result might be much longer. (The name REDUCE is a pun on this problem of intermediate expression swell!) In REDUCE, simplification occurs automatically when an expression is entered or computed, controlled by simplification rules and switches. In this way, REDUCE supports rule-based programming, which is the classic REDUCE programming paradigm. In early versions of REDUCE, rules and switches could only be set globally, but modern REDUCE also supports local setting of rules and switches, meaning that they control the simplification of only one expression. REDUCE programs often contain a mix of programming paradigms.

## Programming examples

[edit]

The screenshot shows simple interactive use.

As a simple programming example, consider the problem of computing the  n {\displaystyle n} th Taylor polynomial of the function  f ( x ) {\displaystyle f(x)} about the point  x = a {\displaystyle x=a} , which is given by the formula  ∑ r = 0 n f ( r ) ( a ) r ! ( x − a ) r {\displaystyle \sum _{r=0}^{n}{\frac {f^{(r)}(a)}{r!}}(x-a)^{r}} . Here,  f ( r ) {\displaystyle f^{(r)}} denotes the  r {\displaystyle r} th derivative of  f {\displaystyle f} evaluated at the point  a {\displaystyle a} and  r ! {\displaystyle r!} denotes the factorial of  r {\displaystyle r} . (However, note that REDUCE includes sophisticated facilities for power-series expansion.)

As an example of functional programming in REDUCE, here is an easy way to compute the 5th Taylor polynomial of  sin ⁡ x {\displaystyle \sin x} about 0. In the following code, the control variable `r` takes values from 0 through 5 in steps of 1, `df` is the REDUCE differentiation operator and the operator `sub` performs substitution of its first argument into its second. Note that this code is very similar to the mathematical formula above (with  n = 5 {\displaystyle n=5} and  a = 0 {\displaystyle a=0} ).

for r := 0:5 sum sub(x = 0, df(sin x, x, r))*x^r/factorial r;

produces by default the output[6]

x ( x 4 − 20 x 2 + 120 ) 120 {\displaystyle {\frac {x\left(x^{4}-20x^{2}+120\right)}{120}}}

This is correct, but it doesn't look much like a Taylor series. 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:

off allfac; on revpri, div; ws;

x − 1 6 x 3 + 1 120 x 5 {\displaystyle x-{\frac {1}{6}}x^{3}+{\frac {1}{120}}x^{5}}

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  a {\displaystyle a} .

procedure my_taylor(f, x, x0, n);
% Return the nth Taylor polynomial of f
% as a function of x about x0.
begin scalar result := sub(x = x0, f), mul := 1;
for r := 1:n do <<
f := df(f, x);
mul := mul*(x - x0)/r;
result := result + sub(x = x0, f)*mul
>>;
return result
end;

The procedure is called `my_taylor` because REDUCE already includes an operator called `taylor`. All the text following a `%` sign up to the end of the line is a comment. The keyword `scalar` introduces and initializes two local variables, `result` and `mul`. The keywords `begin` and `end` delimit a block of code that may include local variables and may return a value, whereas the symbols `<<` and `>>` delimit a group of statements without introducing local variables.

The procedure may be called as follows to compute the same Taylor polynomial as above.

my_taylor(sin x, x, 0, 5);

## See also

[edit]

* Free and open-source software portal
* Mathematics portal

* List of computer algebra systems
* ALTRAN
* REDUCE Meets CAMAL \- J. P. Fitch [1]

## References

[edit]

1. ^ "Files on SourceForge".
2. ^ "REDUCE History and Contributors". REDUCE Computer Algebra System. Retrieved 2024-12-27.
3. ^ "REDUCE History and Contributors". REDUCE Computer Algebra System. Retrieved 2024-12-27.
4. ^ "The Standard Lisp Report" (PDF). REDUCE Computer Algebra System. Retrieved 2024-12-27.
5. ^ chakravala (April 9, 2019). "chakravala/Reduce.jl". GitHub. Retrieved June 16, 2019.
6. ^ The typeset REDUCE output shown assumes the use of CSL REDUCE.

## External links

[edit]

* REDUCE on SourceForge
* Anthony C. Hearn at al., REDUCE User's Manual [ HTML | PDF ].
* Anthony C. Hearn, "REDUCE: The First Forty Years". Invited paper presented at the A3L Conference in Honor of the 60th Birthday of Volker Weispfenning, April 2005.
* Andrey Grozin, "TeXmacs-Reduce interface", April 2012.

* v
* t
* e

Computer algebra systems

Open-source|

* Axiom
* Cadabra
* CoCoA
* Fermat
* FriCAS
* FORM
* GAP
* GiNaC
* Macaulay2
* Maxima
* Normaliz
* PARI/GP
* REDUCE
* SageMath
* Singular
* SymPy
* Xcas/Giac
* Yacas

Proprietary|

* ClassPad Manager
* KANT
* Magma
* Maple
* Mathcad
* Mathematica
* muPAD (MATLAB symbolic math toolbox)
* SMath Studio
* TI InterActive!
* Engineering Equation Solver

Discontinued|

* CAMAL
* Derive
* Erable
* LiveMath
* Macsyma
* Mathomatic
* muMATH
* ALTRAN

* Category
* List

Authority control databases: National |

* Germany

|

This scientific software article is a stub. You can help Wikipedia by expanding it.

|

* v
* t
* e

*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template