Search topics and sections

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 8\sqrt{8} into a decimal such as 2.828... and stops there. A computer algebra program instead gives the exact form 222\sqrt{2}, and it can keep a letter such as xx 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]

Numerical versus symbolic evaluation of the square root of 8Input: √8numericalsymbolic2.828427124752√2approximateexact√8 = √(4·2) = 2√2
Computing 8\sqrt{8} two ways. Numerical evaluation gives the approximate decimal 2.82842712475, while symbolic simplification gives the exact form 222\sqrt{2}, since 8=4⋅2=22\sqrt{8} = \sqrt{4 \cdot 2} = 2\sqrt{2}.
Feature Numerical computing Symbolic computing
Numbers Fixed-size floating-point values Exact integers, fractions and roots such as 2\sqrt{2}
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, x2+xyx^2 + xy is stored as Add(Pow(x, 2), Mul(x, y)).[6]

Expression tree for x squared plus x times yAddPowMulx2xyx² + x·y
SymPy stores x2+xyx^2 + xy as a tree. An Add node holds a Pow node for x2x^2 and a Mul node for x⋅yx \cdot y, and the symbols and the integer sit at the leaves.

SymPy has no subtraction or division nodes. It stores x−yx - y as x+(−1)⋅yx + (-1)\cdot y and x/yx/y as x⋅y−1x \cdot y^{-1}.[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]

  • expand multiplies out products and powers.
  • factor splits a polynomial into irreducible factors, which cannot be split further. For a polynomial with rational coefficients, this is guaranteed.
  • cancel rewrites a fraction of polynomials p/qp/q with common factors removed.
  • apart splits 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 t2=t\sqrt{t^2} = t holds when t≥0t \ge 0 but not for a general complex tt. So SymPy leaves t2\sqrt{t^2} unchanged unless it is told that tt 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 x2−1=(x−1)(x+1)x^2 - 1 = (x-1)(x+1). 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]

  1. Factor the polynomial ff modulo a suitable prime pp, that is, working with remainders after division by pp. This step uses Berlekamp's method.
  2. Use Hensel lifting to turn this into a factorization modulo p2p^2, then p4p^4, then p8p^8, and so on up to a large enough power pnp^n.
  3. Test subsets of the lifted factors to find the products that are true factors with integer coefficients.
Berlekamp-Zassenhaus factoring pipeline f with integer coefficients Factors modulo prime p Factors modulo p², p⁴, p⁸, … pⁿ True factors over integers Step 1 Berlekamp's method Step 2 Hensel lifting Step 3 Test factor subsets Can be exponential in the number of factors; lattice reduction (van Hoeij) speeds it up
The Berlekamp-Zassenhaus algorithm factors a polynomial ff with integer coefficients modulo a prime pp, lifts those factors to moduli p2,p4,p8,…,pnp^2, p^4, p^8, \ldots, p^n by Hensel lifting, and then tests subsets of the lifted factors to find the true factors over the integers. The subset test can take time exponential in the number of factors, and van Hoeij's lattice reduction method speeds it up.

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 x2yx^2y and xy3xy^3.

A lexicographic order ranks terms the way a dictionary ranks words. It compares the powers of the top-ranked variable first, say xx, and looks at yy 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:

x2+y2−1=0,x−y=0x^2 + y^2 - 1 = 0, \qquad x - y = 0

Subtracting (x+y)(x−y)(x+y)(x-y) from the first polynomial removes xx:

x2+y2−1−(x+y)(x−y)=2y2−1x^2 + y^2 - 1 - (x+y)(x-y) = 2y^2 - 1

With xx ranked above yy, the set {x−y, 2y2−1}\{x - y,\ 2y^2 - 1\} is a Gröbner basis for this system. The last polynomial contains only yy, so y=±1/2y = \pm 1/\sqrt{2}, and then x=yx = y gives the two points where the line meets the circle.

Gröbner basis of a circle and a linexy(1/√2, 1/√2)(−1/√2, −1/√2)x − y = 0x² + y² − 1 = 0Original systemx² + y² − 1, x − yGröbner basis(lex, x above y)x − y2y² − 1only y:y = ±1/√2
The unit circle x2+y2−1=0x^2 + y^2 - 1 = 0 and the line x−y=0x - y = 0 cross at (1/2,1/2)(1/\sqrt{2}, 1/\sqrt{2}) and (−1/2,−1/2)(-1/\sqrt{2}, -1/\sqrt{2}). A lexicographic Gröbner basis with x>yx > y turns the system into x−yx - y and 2y2−12y^2 - 1, and the second polynomial contains only yy, so it gives y=±1/2y = \pm 1/\sqrt{2} directly.

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 nn-dimensional space onto one fewer dimension gives a CAD of that lower-dimensional space.[18]

Cylindrical algebraic decomposition for the unit circleAboveUpper arcInsideLower arcBelow(−∞, −1)−1(−1, 1)1(1, ∞)xyx < −1x > 113 cells in total
Cylindrical algebraic decomposition of the plane for x2+y2−1x^2 + y^2 - 1. The lines x=−1x = -1 and x=1x = 1 split the xx-axis into 5 cells. The columns above them hold 1, 3, 5, 3 and 1 cells, so the plane has 13 cells in total.

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]

∫(exsin⁡x+excos⁡x)dx=exsin⁡x+C\int \left(e^x \sin x + e^x \cos x\right)dx = e^x \sin x + C

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 ana_n whose ratio an/an−1a_n/a_{n-1} is a rational function of nn, and it looks for a function S(n)S(n) with

∑n=1man=S(m)−S(0),\sum_{n=1}^{m} a_n = S(m) - S(0),

where S(n)/S(n−1)S(n)/S(n-1) is also a rational function of nn. The algorithm either finds such an SS or proves that none exists.[20]

Other problem areas

Computer algebra covers many more structures than polynomials and formulas.

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]

Intermediate expression swell in polynomial multiplication04080120Number of terms1111121≤ 21First factorSecond factorAll cross-productsbefore combiningFinal product(degree 20)100 more termsmid-calculation
Multiplying two degree-10 polynomials of 11 terms each first produces 11×11=12111 \times 11 = 121 cross-products. After like terms are combined, at most 21 terms remain, one for each power from x0x^0 to x20x^{20}.

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]

  1. Reduce both input polynomials modulo a prime pp.
  2. Compute their GCD modulo pp. Brown's algorithm does this by evaluating the extra variables at chosen points, finding one-variable GCDs, and interpolating.
  3. Repeat with more primes, then combine the results coefficient by coefficient with the Chinese remainder theorem.
  4. 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]

c≡22(mod35)c \equiv 22 \pmod{35}

If the true coefficient lies between 0 and 34, it must be 22.

Modular GCD computation Inputs f₁, f₂ with integer coefficients reduce mod 5 reduce mod 7 GCD mod 5 small numbers only GCD mod 7 small numbers only combine with Chinese remainder theorem coefficient ≡ 2 (mod 5) coefficient ≡ 1 (mod 7) coefficient ≡ 22 (mod 35) candidate divides f₁ and f₂? yes no add another prime done: GCD found
A modular GCD computation reduces the integer inputs f1,f2f_1, f_2 modulo the primes 5 and 7, computes each GCD with small numbers, and combines the results with the Chinese remainder theorem. For example, c≡2(mod5)c \equiv 2 \pmod 5 and c≡1(mod7)c \equiv 1 \pmod 7 give c≡22(mod35)c \equiv 22 \pmod{35}. If the candidate does not divide both inputs, the method adds another prime and repeats.

Limits of simplification

Some simplification problems have no algorithm at all. Take expressions built from rational numbers, xx and π\pi using ++, −-, ×\times and ÷\div, 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 A+BA + B 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 22n2^{2^n} for nn 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

Timeline of computer algebra, 1950 to 20001950196019701980199020001953 first symbolic differentiation programs1964 FORMAC described1966 SYMSAC '66 conference1969 Risch integration algorithm1975 Collins: CAD published1980 Maple begun at Waterloo1985 Journal of SymbolicComputation founded1998 Maximareleased under GPL1988 Mathematica 1.01982 LLL polynomial-time factoring1978 Gosper summation algorithm1971 Macsyma publicly available1968 Macsyma begun at MIT1965 Buchberger: Gröbner bases1963 Schoonschip first runs (IBM 7090)SystemsAlgorithms and community
Milestones in computer algebra from 1950 to 2000. Blue dots mark computer algebra systems and orange dots mark algorithms and community events.

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

  1. Introduction (SymPy tutorial), SymPy Development Team, 2025.
  2. Computer algebra in gravity research, Living Reviews in Relativity, 2018.
  3. PARI/GP Development Headquarters, University of Bordeaux, 2026.
  4. Gaston Gonnet oral history, SIAM History of Numerical Analysis and Scientific Computing, 2005.
  5. SymPy: symbolic computing in Python, PeerJ Computer Science, 2017.
  6. Advanced Expression Manipulation (SymPy tutorial), SymPy Development Team, 2025.
  7. FLINT: Fast Library for Number Theory, FLINT team, 2025.
  8. Simplification (SymPy tutorial), SymPy Development Team, 2025.
  9. Symbolic Mathematical Computation 1965-1975: The View from a Half-Century Perspective, arXiv, 2025.
  10. Sparse modular GCD algorithm for polynomials over algebraic function fields, M.Sc. thesis, Simon Fraser University, 2006.
  11. Polynomial Factorization: a Success Story, E. Kaltofen, ISSAC 2003 invited talk, 2003.
  12. Factoring Polynomials Over Finite Fields: A Survey, J. von zur Gathen and D. Panario, Journal of Symbolic Computation, 2001.
  13. New Sparse Multivariate Polynomial Factorization Algorithms over Integers, Proceedings of ISSAC 2023, ACM, 2023.
  14. Berlekamp-Zassenhaus Algorithm, Wolfram MathWorld, 2025.
  15. Groebner basis, Scholarpedia, 2010.
  16. A short history of quantifier elimination methods, C. W. Brown, United States Naval Academy, 2004.
  17. Cylindrical Algebraic Decomposition I: The Basic Algorithm, SIAM Journal on Computing, 1984.
  18. A Short Introduction to the Cylindrical Algebraic Decomposition, J. Nalbach, talk at Utrecht, 2023.
  19. The Solution of the Problem of Integration in Finite Terms, Bulletin of the American Mathematical Society, 1970.
  20. Decision procedure for indefinite hypergeometric summation, Proceedings of the National Academy of Sciences, 1978.
  21. GAP: Groups, Algorithms, Programming, The GAP Group, 2025.
  22. Singular, University of Kaiserslautern, 2025.
  23. Veltman Schoonschip Collection, University of Michigan, 2009.
  24. Maxima, a Computer Algebra System, Maxima project, 2025.
  25. Mathematica Quick Revision History, Wolfram Research, 2025.
  26. FORM Version 5.0, arXiv, 2026.
  27. Computer Algebra Pioneer Wins Nobel Prize, Wolfram Research, 1999.
  28. ISSAC 2026, ISSAC Steering Committee, 2026.
  29. Journal of Symbolic Computation: Aims and Scope, Elsevier, 2025.

Figure