Computer algebra
Computer algebra, also called symbolic computation, is the study and development of algorithms and software that work with mathematical expressions as symbols. A numerical program turns into a decimal such as 2.828... and stops there. A computer algebra program instead gives the exact form , and it can keep a letter such as as an unknown.[1]
The programs that do this work are called computer algebra systems. They can:[1]
- simplify expressions
- take derivatives
- find integrals
- solve equations
- work with matrices
Computer algebra is part of both computational mathematics and computer science. Its tools are used in physics, number theory and teaching.[2][3][4]
Symbolic and numerical computation
Symbolic computing keeps answers exact, while numerical computing gives approximate answers. Numerical programs use floating-point numbers with a fixed number of digits. Python's built-in float, for example, always uses 53 bits of precision.[5]
Symbolic computation represents mathematical objects exactly and leaves variables without values in symbolic form.[1]
| Feature | Numerical computing | Symbolic computing |
|---|---|---|
| Numbers | Fixed-size floating-point values | Exact integers, fractions and roots such as |
| Variables | Must have numeric values | Can stay as unknown symbols |
| Results | Approximate values | Exact formulas |
| Memory and time | Fixed size per number | Depend strongly on the data and can be large |
Symbolic systems need much more memory, and their running time depends strongly on the data.[2] Their advantage is accuracy: well-tested packages do not lose factors of 2 or get signs wrong.[2]
How expressions are stored
Expression trees
SymPy stores each expression as a tree, called an expression tree. Each inner node is an operation, such as addition or a power, and each leaf is a number or a symbol.[6] For example, is stored as Add(Pow(x, 2), Mul(x, y)).[6]
SymPy has no subtraction or division nodes. It stores as and as .[6]
Exact numbers
Exact work needs number types beyond fixed-size floating-point values. Libraries such as FLINT provide arithmetic on these objects:[7]
- integers and rational numbers
- algebraic numbers, which are roots of polynomials with rational coefficients
- finite fields, which are number systems with finitely many elements
- polynomials and matrices
SymPy also offers arbitrary-precision floating-point numbers. It stores each one's value together with its precision in bits.[5]
Simplification
"Simplify" has no exact mathematical definition. SymPy's general simplify command uses rules of thumb and makes no guarantees, while its narrower commands promise a certain form of output.[5][8] The narrower commands include these:[5][8]
expandmultiplies out products and powers.factorsplits a polynomial into irreducible factors, which cannot be split further. For a polynomial with rational coefficients, this is guaranteed.cancelrewrites a fraction of polynomials with common factors removed.apartsplits a fraction of polynomials into partial fractions.
Two stronger goals do have precise definitions.[2]
- A normal simplifier returns 0 for every expression that equals 0.
- A canonical form gives all equal expressions one and the same written form.
With a canonical form, testing whether two expressions are equal is easy, since you only compare their canonical forms.
Whether a rule is valid can depend on what the symbols stand for. The rule holds when but not for a general complex . So SymPy leaves unchanged unless it is told that is nonnegative.[5]
Core problems and algorithms
Polynomial greatest common divisors
Polynomials are central objects in computer algebra.
The greatest common divisor (GCD) of two polynomials is the largest polynomial that divides both. Canceling a fraction of polynomials requires it.
Computing GCDs of polynomials in several variables was a major challenge in the early 1970s.[9]
The classic method is the Euclidean algorithm, which divides repeatedly and keeps the remainders.
With integer coefficients, this produces fractions. Pseudo-division, a form of polynomial division arranged to avoid fractions, removes them. Even then the coefficients can grow fast: in one worked example their length doubles at each step.[10]
The modular methods described in a later section avoid this growth.
Factoring polynomials
Factoring writes a polynomial as a product of pieces that cannot be split further, such as . It is one of the field's great successes.[11]
In the early 1960s, programmers found the methods in classical algebra books too slow in practice.[11] The exception was Gauss's distinct-degree factorization, which splits a polynomial into pieces whose irreducible factors all have the same degree.[11][12]
For integer coefficients, a standard method today is the Berlekamp-Zassenhaus algorithm. It builds on Elwyn Berlekamp's 1967 method for factoring over finite fields and Hans Zassenhaus's 1969 work on Hensel factorization.[13]
The algorithm runs in three steps:[14]
- Factor the polynomial modulo a suitable prime , that is, working with remainders after division by . This step uses Berlekamp's method.
- Use Hensel lifting to turn this into a factorization modulo , then , then , and so on up to a large enough power .
- Test subsets of the lifted factors to find the products that are true factors with integer coefficients.
Step 3 can take time exponential in the number of factors, because there may be exponentially many subsets to check.[14]
In 1982, A. K. Lenstra, H. W. Lenstra Jr. and László Lovász showed that polynomials with rational coefficients can be factored in polynomial time, meaning a running time bounded by a fixed power of the input size. Their method uses lattice basis reduction.[11][13]
In 2000, Mark van Hoeij put lattice reduction inside the Berlekamp-Zassenhaus algorithm itself.[11] His method greatly cuts the time needed to choose the right subsets in step 3.[14]
Solving systems of polynomial equations
A Gröbner basis is a set of polynomials whose special properties make many problems about polynomial systems simple to solve by algorithm.[15]
Bruno Buchberger introduced the idea and the algorithm for computing it in his 1965 PhD thesis.[15][9] Buchberger's algorithm turns any set of polynomials into an equivalent Gröbner basis.[15]
The basis depends on a chosen monomial order, a rule for ranking terms such as and .
A lexicographic order ranks terms the way a dictionary ranks words. It compares the powers of the top-ranked variable first, say , and looks at only to break ties.
A Gröbner basis for a lexicographic order is also called a triangular system, because, as with linear equations, its solutions are easy to read off.[15]
For example, take a circle and a line:
Subtracting from the first polynomial removes :
With ranked above , the set is a Gröbner basis for this system. The last polynomial contains only , so , and then gives the two points where the line meets the circle.
Some questions about real numbers involve inequalities and the phrases "for all" and "there exists".
Quantifier elimination rewrites such a statement as an equivalent one without those phrases.
Alfred Tarski proved in the 1930s, by giving an algorithm, that this can always be done. His method was not practical except for trivial problems.[16]
George Collins found a far more efficient method in 1973 and published it in 1975.[16]
Collins's method is based on cylindrical algebraic decomposition (CAD). A CAD splits space into connected pieces, called cells, that fit the zero sets of the given polynomials, meaning the points where those polynomials equal zero.[17]
The cells are arranged in columns. Projecting a CAD of -dimensional space onto one fewer dimension gives a CAD of that lower-dimensional space.[18]
Integration and summation
Symbolic differentiation was among the first things computers did with formulas. Kahrimanian and Nolan wrote programs for it in 1953.[2]
Symbolic integration is much harder.
The integration problem asks for an algorithm that decides whether an elementary function has an elementary antiderivative, and finds the antiderivative if it does.[19]
Here "elementary" means built from rational functions using exponentials, logarithms, trigonometric and inverse trigonometric functions, and algebraic operations.[19]
Robert Risch outlined such an algorithm in papers from 1969 and 1970, now called the Risch algorithm.[9][19] Turning his outline into working software took years, and four papers at the EUROSAM '79 conference brought it much closer.[9]
Today a system can find results such as this one:[1]
Sums have a similar theory. In 1978, Bill Gosper of Xerox PARC published Gosper's algorithm for indefinite hypergeometric sums.[20] It works on terms whose ratio is a rational function of , and it looks for a function with
where is also a rational function of . The algorithm either finds such an or proves that none exists.[20]
Other problem areas
Computer algebra covers many more structures than polynomials and formulas.
- Computational group theory studies algorithms for groups. The GAP system centers on it and offers thousands of functions and large libraries of algebraic objects.[21]
- Computational algebraic geometry and commutative algebra are the focus of systems such as Singular.[22]
- Randomized algorithms are common. Factoring polynomials in many variables became an application of the DeMillo-Lipton/Schwartz-Zippel lemma, a result about evaluating polynomials at random points.[11]
- Symbolic-numeric computation handles polynomials whose coefficients are imprecise floating-point numbers instead of exact values.[11]
Why exact computation is hard
Intermediate expression swell
Expressions can grow much larger during a computation than at its end. This is called intermediate expression swell.[2]
For example, multiply two polynomials of degree 10 that have 11 terms each. If every cross-product is formed before like terms are combined, there are 121 terms. The final answer has degree 20, so it has at most 21 terms.[2]
Swell raises the amount of memory a computation needs.[2]
It also makes garbage collection important, meaning that the software reuses memory that is no longer needed.[2]
Modular methods
Modular methods avoid coefficient growth by working with small numbers. A modular algorithm solves the problem modulo several primes, where no number can exceed the prime, and then rebuilds the true answer with the Chinese remainder theorem.[10] W. S. Brown's modular GCD algorithm works this way for polynomials in several variables with integer coefficients.[10]
A modular GCD computation runs like this:[10]
- Reduce both input polynomials modulo a prime .
- Compute their GCD modulo . Brown's algorithm does this by evaluating the extra variables at chosen points, finding one-variable GCDs, and interpolating.
- Repeat with more primes, then combine the results coefficient by coefficient with the Chinese remainder theorem.
- Check whether the candidate divides both inputs. If it does, stop. If not, add another prime.
For example, if a coefficient is 2 modulo 5 and 1 modulo 7, the Chinese remainder theorem gives:[10]
If the true coefficient lies between 0 and 34, it must be 22.
Limits of simplification
Some simplification problems have no algorithm at all. Take expressions built from rational numbers, and using , , and , together with exp, log, sin and absolute value. No algorithm is guaranteed to reduce every such expression that equals 0 to 0 in finite time.[2]
This result is due to Richardson (1968) and Caviness (1970) and is known as Richardson's theorem.[2]
It makes zero-testing for these expressions an undecidable problem.
Other simplification problems may be decidable but have no known algorithm yet. One example is finding the shortest expression by sum-substitution, which means choosing where to replace a sum such as with an equivalent expression.[2]
Running time
Even when an algorithm exists, it can be slow, and measuring how slow belongs to theoretical computer science. Collins's CAD method takes time doubly exponential in the number of variables, meaning it can grow like for variables. Its time is only polynomial in the number of polynomials, their degrees and the size of their coefficients.[16]
Polynomial factoring behaves much better. If random choices are allowed, its cost grows only polynomially with the number of variables.[11]
Computer algebra systems
A computer algebra system bundles these algorithms behind a language a user can type into. Some systems are general-purpose, while others serve one branch of mathematics or science.
| System | Main focus | Notes |
|---|---|---|
| Reduce | General; first aimed at quantum electrodynamics | Written by Anthony Hearn in the programming language Lisp in the early to mid-1960s[2][23][9] |
| Macsyma and Maxima | General | Macsyma was begun at MIT around 1968. Its descendant Maxima was released under the GNU GPL in 1998.[2][24] |
| Maple | General | Begun in 1980 at the University of Waterloo[4] |
| Mathematica | General | Version 1.0 released in June 1988[25] |
| SymPy | General | Open-source library written in pure Python[5] |
| PARI/GP | Number theory | Developed at the University of Bordeaux since the early 1980s[3] |
| GAP | Discrete algebra, especially group theory | Free, with source code[21] |
| Singular | Polynomial computations, commutative algebra, algebraic geometry | Free and open source[22] |
| FORM | Very large expressions in high-energy physics | Jos Vermaseren was its main developer until he retired in 2018[26] |
Building a general-purpose system is a large job. Writing a usable one was already estimated at 50 person-years or more about three decades before 2018.[2] Macsyma, Axiom and Reduce were once commercial or restricted, but all three were later released as open source.[9]
History
First programs
The first symbolic programs did differentiation, in 1953.[2] In 1956, Boys and coworkers used the Cambridge EDSAC computer for formulas with more than 500 terms. It is sometimes cited as the first full use of computer algebra.[2]
Several systems appeared in the early 1960s.
- ALPAK, by W. Stanley Brown and colleagues at Bell Labs, handled very large rational expressions. Its successor was ALTRAN.[9]
- FORMAC, begun in 1962 and described in 1964, was based on FORTRAN.[2] Jean Sammet was its lead designer, and it has been called the first commercially successful computer algebra system.[9]
- Schoonschip, by Martinus Veltman, first ran in 1963 on an IBM 7090. It was written in assembly language.[23]
- Reduce was built in Lisp for physics.[2] Its first published use reported that six months of human work had been cut to fifteen minutes of computer time.[9]
MIT's Macsyma was begun around 1968 as part of Project MAC and became publicly available in 1971.[2][9] Macsyma, like Reduce, was built on Lisp.[2] In the early 1970s, George Collins released SAC-1, a FORTRAN system with polynomial GCD, factoring, resultants and exact real roots.[9]
Key algorithms
Several key algorithms appeared between 1965 and the early 1980s.
- 1965: Buchberger's thesis introduces Gröbner bases. They did not reach computer algebra systems until after 1976.[9]
- 1969 to 1970: Risch publishes his integration algorithm.[9][19]
- 1975: Collins publishes CAD.[16]
- 1978: Gosper publishes his summation algorithm.[20]
- 1982: Lenstra, Lenstra and Lovász publish polynomial-time factoring.[13]
Modern systems
In 1979, Stephen Wolfram began designing SMP, the predecessor of Mathematica.[27] In 1980, Gaston Gonnet, Keith Geddes, Morven Gentleman and others began Maple, aiming for an efficient interactive system that worked well on smaller computers.[4]
Wolfram Research released Mathematica 1.0 in June 1988.[25]
Applications
Computer algebra began in physics and spread to many fields.
- Particle physics: Reduce was first used for quantum electrodynamics.[2] Veltman built Schoonschip to help with his work on gauge theories, and he shared the 1999 Nobel Prize in Physics with Gerard 't Hooft for that work.[27] FORM serves the theoretical high-energy physics community, and version 5 added a built-in generator for Feynman diagrams.[26]
- Gravity research: Calculations in this field are complicated, and computer algebra has proved very useful. A 2018 review listed about 100 packages written for it.[2]
- Science and engineering: Gröbner bases have been used to analyze nonlinear cryptosystems, prove geometry theorems automatically, and solve robot inverse kinematics, the task of finding joint settings that move a robot arm to a target position.[15]
- Number theory: PARI/GP computes factorizations, elliptic curves, modular forms and L-functions.[3]
- Software: SymPy turns formulas into code in C, Fortran, Julia, JavaScript, MATLAB and other languages.[5]
- Teaching: Maple was first used for teaching at the University of Waterloo.[4]
Research community
The field has its own professional society, conference and journal. Jean Sammet founded ACM SIGSAM, the Special Interest Group on Symbolic and Algebraic Manipulation, and was its first chair. She also organized the SYMSAC '66 conference.[9]
That meeting grew into the International Symposium on Symbolic and Algebraic Computation (ISSAC). Its series began in 1966 and has met every year since 1981.[9][28] Bruno Buchberger founded the Journal of Symbolic Computation in 1985.[29]
References
- Introduction (SymPy tutorial), SymPy Development Team, 2025.
- Computer algebra in gravity research, Living Reviews in Relativity, 2018.
- PARI/GP Development Headquarters, University of Bordeaux, 2026.
- Gaston Gonnet oral history, SIAM History of Numerical Analysis and Scientific Computing, 2005.
- SymPy: symbolic computing in Python, PeerJ Computer Science, 2017.
- Advanced Expression Manipulation (SymPy tutorial), SymPy Development Team, 2025.
- FLINT: Fast Library for Number Theory, FLINT team, 2025.
- Simplification (SymPy tutorial), SymPy Development Team, 2025.
- Symbolic Mathematical Computation 1965-1975: The View from a Half-Century Perspective, arXiv, 2025.
- Sparse modular GCD algorithm for polynomials over algebraic function fields, M.Sc. thesis, Simon Fraser University, 2006.
- Polynomial Factorization: a Success Story, E. Kaltofen, ISSAC 2003 invited talk, 2003.
- Factoring Polynomials Over Finite Fields: A Survey, J. von zur Gathen and D. Panario, Journal of Symbolic Computation, 2001.
- New Sparse Multivariate Polynomial Factorization Algorithms over Integers, Proceedings of ISSAC 2023, ACM, 2023.
- Berlekamp-Zassenhaus Algorithm, Wolfram MathWorld, 2025.
- Groebner basis, Scholarpedia, 2010.
- A short history of quantifier elimination methods, C. W. Brown, United States Naval Academy, 2004.
- Cylindrical Algebraic Decomposition I: The Basic Algorithm, SIAM Journal on Computing, 1984.
- A Short Introduction to the Cylindrical Algebraic Decomposition, J. Nalbach, talk at Utrecht, 2023.
- The Solution of the Problem of Integration in Finite Terms, Bulletin of the American Mathematical Society, 1970.
- Decision procedure for indefinite hypergeometric summation, Proceedings of the National Academy of Sciences, 1978.
- GAP: Groups, Algorithms, Programming, The GAP Group, 2025.
- Singular, University of Kaiserslautern, 2025.
- Veltman Schoonschip Collection, University of Michigan, 2009.
- Maxima, a Computer Algebra System, Maxima project, 2025.
- Mathematica Quick Revision History, Wolfram Research, 2025.
- FORM Version 5.0, arXiv, 2026.
- Computer Algebra Pioneer Wins Nobel Prize, Wolfram Research, 1999.
- ISSAC 2026, ISSAC Steering Committee, 2026.
- Journal of Symbolic Computation: Aims and Scope, Elsevier, 2025.
