Computer algebra: Difference between revisions

Content deleted Content added
OAbot (talk | contribs)
m Open access bot: doi updated in citation with #oabot.
OAbot (talk | contribs)
m Open access bot: url-access updated in citation with #oabot.
 
(15 intermediate revisions by 14 users not shown)
Line 5:
In [[mathematics]] and [[computer science]],<ref>{{Cite web |title=ACM Association in computer algebra |url=https://www.sigsam.org/cca/}}</ref> '''computer algebra''', also called '''symbolic computation''' or '''algebraic computation''', is a scientific area that refers to the study and development of [[algorithm]]s and [[software]] for manipulating [[expression (mathematics)|mathematical expressions]] and other [[mathematical object]]s. Although computer algebra could be considered a subfield of [[scientific computing]], they are generally considered as distinct fields because scientific computing is usually based on [[numerical computation]] with approximate [[floating point number]]s, while symbolic computation emphasizes ''exact'' computation with expressions containing [[variable (mathematics)|variable]]s that have no given value and are manipulated as symbols.
 
[[Software]] applications that perform symbolic calculations are called ''[[computer algebra system]]s'', with the term ''system'' alluding to the complexity of the main applications that include, at least, a method to represent mathematical data in a computer, a user [[programming language]] (usually different from the language used for the implementation), a dedicated memory manager, a [[user interface]] for the input/output of mathematical expressions, and a large set of [[function (computer science)|routines]] to perform usual operations, like simplification of expressions, [[differentiation (mathematics)|differentiation]] using the [[chain rule]], [[polynomial factorization]], [[indefinite integration]], etc.
 
Computer algebra is widely used to experiment in mathematics and to design the formulas that are used in numerical programs. It is also used for complete scientific computations, when purely numerical methods fail, as in [[public key cryptography]], or for some [[non-linear]] problems.
Line 11:
== Terminology ==
 
Some authors distinguish ''computer algebra'' from ''symbolic computation'', using the latter name to refer to kinds of symbolic computation other than the computation with mathematical [[formula]]s. Some authors use ''symbolic computation'' for the computer -science aspect of the subject and "''computer algebra"'' for the mathematical aspect.<ref>{{cite conference | first = Stephen M. | last = Watt | date = 2006 | url = http://www.csd.uwo.ca/~watt/pub/reprints/2006-tc-sympoly.pdf | title = Making Computer Algebra More Symbolic (Invited) | conference = Transgressive Computing 2006: A conference in honor of Jean Della Dora, (TC 2006) | pages = 43–49 |isbn=9788468983813 |oclc=496720771}}</ref> In some languages, the name of the field is not a direct translation of its English name. Typically, it is called ''calcul formel'' in French, which means "formal computation". This name reflects the ties this field has with [[formal methods]].
 
Symbolic computation has also been referred to, in the past, as ''symbolic manipulation'', ''algebraic manipulation'', ''symbolic processing'', ''symbolic mathematics'', or ''symbolic algebra'', but these terms, which also refer to non-computational manipulation, are no longer used in reference to computer algebra.
 
== Scientific community ==
There is no [[learned society]] that is specific to computer algebra, but this function is assumed by the [[special interest group]] of the [[Association for Computing Machinery]] named [[SIGSAM]] (Special Interest Group on Symbolic and Algebraic Manipulation).<ref>[http://www.sigsam.org SIGSAM official site]</ref>
on Symbolic and Algebraic Manipulation).<ref>[http://www.sigsam.org SIGSAM official site]</ref>
 
There are several annual conferences on computer algebra, the premier being [[ISSAC]] (International Symposium on Symbolic and Algebraic Computation), which is regularly sponsored by SIGSAM.<ref>{{Cite web |url=http://www.sigsam.org/conferences/index.phtml |title=SIGSAM list of conferences |access-date=2012-11-15 |archive-url=https://web.archive.org/web/20130808052201/http://www.sigsam.org/conferences/index.phtml |archive-date=2013-08-08 |url-status=dead }}</ref>
 
There are several journals specializing in computer algebra, the top one being ''[[Journal of Symbolic Computation]]'' founded in 1985 by [[Bruno Buchberger]].<ref>{{cite book |title=Computer Algebra and Symbolic Computation: Mathematical Methods |url=https://archive.org/details/computeralgebras00cohe_792 |url-access=limited |last=Cohen |first=Joel S. | date = 2003 |publisher=AK Peters |isbn=978-1-56881-159-8 |page=[https://archive.org/details/computeralgebras00cohe_792/page/n33 14] }}</ref> There are also several other journals that regularly publish articles in computer algebra.<ref>[http://www.sigsam.org/journals.phtml SIGSAM list of journals]</ref>
 
== Computer science aspects ==
{{Unreferenced section|date=November 2012}}
 
=== Data representation ===
 
As [[numerical software]] is highly efficient for approximate [[numerical computation]], it is common, in computer algebra, to emphasize ''exact'' computation with exactly represented data. Such an exact representation implies that, even when the size of the output is small, the intermediate data generated during a computation may grow in an unpredictable way. This behavior is called ''expression swell''.<ref>{{Cite web |title=Lecture 12: Rational Functions and Conversions — Introduction to Symbolic Computation 1.7.6 documentation |url=https://homepages.math.uic.edu/~jan/mcs320/mcs320notes/lec12.html |access-date=2024-03-31 |website=homepages.math.uic.edu}}</ref> To obviatealleviate this problem, various methods are used in the representation of the data, as well as in the algorithms that manipulate them.<ref>{{Cite journal |last1=Neut |first1=Sylvain |last2=Petitot |first2=Michel |last3=Dridi |first3=Raouf |date=2009-03-01 |title=Élie Cartan's geometrical vision or how to avoid expression swell |url=https://www.sciencedirect.com/science/article/pii/S0747717108001132 |journal=Journal of Symbolic Computation |series=Polynomial System Solving in honor of Daniel Lazard |volume=44 |issue=3 |pages=261–270 |doi=10.1016/j.jsc.2007.04.006 |issn=0747-7171|url-access=subscription }}</ref>
 
==== Numbers ====
The usual numbersnumber systems used in [[numerical computation]] are [[floating point]] numbers and [[integers]] of a fixed, bounded size. NoneNeither of these is convenient for computer algebra, due to expression swell.<ref>Richard Liska [http://kfe.fjfi.cvut.cz/~liska/ca/node53.html#:~:text=is%20a%20common%20phenomenon%20of,dramatically%20as%20the%20calculation%20progresses. Expression swell], from "Peculiarities of programming in computer algebra systems"</ref> Therefore, the basic numbers used in computer algebra are the integers of the mathematicians, commonly represented by an unbounded signed sequence of [[numerical digit|digits]] in some [[radix|base of numeration]], usually the largest base allowed by the [[machine word]]. These integers allow one to define the [[rational number]]s, which are [[irreducible fraction]]s of two integers.
 
Programming an efficient implementation of the arithmetic operations is a hard task. Therefore, most free [[computer algebra system]]s, and some commercial ones such as [[Mathematica]] and [[Maple (software)|Maple]],<ref>[https://library.wolfram.com/infocenter/Conferences/7518/Macalester_talk.txt "The Mathematica Kernel: Issues in the Design and Implementation"]. October 2006. Retrieved 2023-11-29.</ref><ref>[https://www.maplesoft.com/support/help/AddOns/view.aspx?path=GMP "The GNU Multiple Precision (GMP) Library"]. [[Maplesoft]]. Retrieved 2023-11-29.</ref> use the [[GNU Multiple Precision Arithmetic Library|GMP library]], which is thus a ''de facto'' standard.
Therefore, the basic numbers used in computer algebra are the integers of the mathematicians, commonly represented by an unbounded signed sequence of [[numerical digit|digits]] in some [[radix|base of numeration]], usually the largest base allowed by the [[machine word]]. These integers allow to define the [[rational number]]s, which are [[irreducible fraction]]s of two integers.
 
Programming an efficient implementation of the arithmetic operations is a hard task. Therefore, most free [[computer algebra system]]s and some commercial ones such as [[Mathematica]] and [[Maple (software)]],<ref>[https://library.wolfram.com/infocenter/Conferences/7518/Macalester_talk.txt "The Mathematica Kernel: Issues in the Design and Implementation"]. October 2006. Retrieved 2023-11-29.</ref><ref>[https://www.maplesoft.com/support/help/AddOns/view.aspx?path=GMP "The GNU Multiple Precision (GMP) Library"]. [[Maplesoft]]. Retrieved 2023-11-29.</ref> use the [[GNU Multiple Precision Arithmetic Library|GMP library]], which is thus a ''de facto'' standard.
 
==== Expressions ====
 
[[File:Cassidy.1985.015.gif|thumb|400px|Representation of the expression {{math|(8 − 6) × (3 + 1)}} as a [[Lisp (programming language)|Lisp]] tree, from a 1985 Master's Thesis.<ref>{{cite thesis | type=Master's thesis | url=https://commons.wikimedia.org/wiki/File:The_feasibility_of_automatic_storage_reclamation_with_concurrent_program_execution_in_a_LISP_environment._(IA_feasibilityofaut00cass).pdf | first=Kevin G. |last=Cassidy | title=The Feasibility of Automatic Storage Reclamation with Concurrent Program Execution in a LISP Environment | institution=Naval Postgraduate School, Monterey/CA | date=Dec 1985 |page=15 |id=ADA165184}}</ref>]]
Except for [[number]]s and [[variable (mathematics)|variables]], every [[Expression (mathematics)|mathematical expression]] may be viewed as the symbol of an operator followed by a [[sequence]] of operands. In computer -algebra software, the expressions are usually represented in this way. This representation is very flexible, and many things that seem not to be mathematical expressions at first glance, may be represented and manipulated as such. For example, an equation is an expression with "=" as an operator, and a matrix may be represented as an expression with "matrix" as an operator and its rows as operands.
 
Even programs may be considered and represented as expressions with operator "procedure" and, at least, two operands, the list of parameters and the body, which is itself an expression with "body" as an operator and a sequence of instructions as operands. Conversely, any mathematical expression may be viewed as a program. For example, the expression {{math|''a'' + ''b''}} may be viewed as a program for the addition, with {{math|''a''}} and {{math|''b''}} as parameters. Executing this program consists inof ''evaluating'' the expression for given values of {{math|''a''}} and {{math|''b''}}; if they are not given any values, then the result of the evaluation is simply its input.
 
This process of delayed evaluation is fundamental in computer algebra. For example, the operator "=" of the equations is also, in most computer algebra systems, the name of the program of the equality test: normally, the evaluation of an equation results in an equation, but, when an equality test is needed, either explicitly asked by the user through an "evaluation to a Boolean" command, or automatically started by the system in the case of a test inside a program, then the evaluation to a booleanBoolean result is executed.
 
As the size of the operands of an expression is unpredictable and may change during a working session, the sequence of the operands is usually represented as a sequence of either [[Pointer (computer programming)|pointers]] (like in [[Macsyma]])<ref>{{Cite book |url=https://people.eecs.berkeley.edu/~fateman/macsyma/docs/refman16.pdf |title=Macsyma Mathematics and System Reference Manual |publisher=[[Macsyma]] |year=1996 |pages=419}}</ref> or entries in a [[hash table]] (like in [[Maple (software)|Maple]]).
Line 50 ⟶ 46:
=== Simplification ===
 
The raw application of the basic rules of [[derivative|differentiation]] with respect to {{math|''x''}} on the expression {{Math|''a''<mathsup>a^''x''</mathsup>}} gives the result
:<math> x\cdot a^{x-1}\cdot 0 + a^x\cdot \left (1\cdot \log a + x\cdot \frac{0}{a} \right).</math>
A simpler expression than this is generally desired, and simplification is needed when working with general expressions. This simplification is normally done through [[rewriting|rewriting rules]].<ref>{{cite book |last1=Buchberger |first1=Bruno |first2=Rüdiger |last2=Loos |chapter=Algebraic simplification |chapter-url=https://www.risc.jku.at/people/buchberg/papers/1982-00-00-B.pdf | editor1-last = Buchberger | editor1-first = Bruno | editor2-last = Collins | editor2-first = George Edwin | editor3-last = Loos | editor3-first = Rüdiger | editor4-last = Albrecht| editor4-first = Rudolf |title= Computer Algebra: Symbolic and Algebraic Computation|series=Computing Supplementa |year=1983 |volume=4 |pages=11–43 |doi=10.1007/978-3-7091-7551-4_2 |isbn=978-3-211-81776-6 }}</ref> There are several classes of rewriting rules to be considered. The simplest are rules that always reduce the size of the expression, like {{math|''E'' &minus; ''E'' → 0}} or {{math|sin(0) → 0}}. They are systematically applied in computer algebra systems.
A simpler expression than this is generally desired, and simplification is needed when working with general expressions.
 
This simplification is normally done through [[rewriting|rewriting rules]].<ref>{{cite book |last1=Buchberger |first1=Bruno |first2=Rüdiger |last2=Loos |chapter=Algebraic simplification |chapter-url=https://www.risc.jku.at/people/buchberg/papers/1982-00-00-B.pdf | editor1-last = Buchberger | editor1-first = Bruno | editor2-last = Collins | editor2-first = George Edwin | editor3-last = Loos | editor3-first = Rüdiger | editor4-last = Albrecht| editor4-first = Rudolf |title= Computer Algebra: Symbolic and Algebraic Computation|series=Computing Supplementa |year=1983 |volume=4 |pages=11–43 |doi=10.1007/978-3-7091-7551-4_2 |isbn=978-3-211-81776-6 }}</ref> There are several classes of rewriting rules to be considered. The simplest are rules that always reduce the size of the expression, like {{math|''E'' &minus; ''E'' → 0}} or {{math|sin(0) → 0}}. They are systematically applied in computer algebra systems.
 
A difficulty occurs with [[associative operation]]s like addition and multiplication. The standard way to deal with associativity is to consider that addition and multiplication have an arbitrary number of operands,; that is, that {{math|''a'' + ''b'' + ''c''}} is represented as {{math|"+"(''a'', ''b'', ''c'')}}. Thus {{math|''a'' + (''b'' + ''c'')}} and {{math|(''a'' + ''b'') + ''c''}} are both simplified to {{math|"+"(''a'', ''b'', ''c'')}}, which is displayed {{math|''a'' + ''b'' + ''c''}}. In the case of expressions such as {{math|''a'' &minus; ''b'' + ''c''}}, the simplest way is to systematically rewrite {{math|&minus;''E''}}, {{math|''E'' &minus; ''F''}}, {{math|''E''/''F''}} as, respectively, {{math|(&minus;1)⋅''E''}}, {{math|''E'' + (&minus;1)⋅''F''}}, {{math|''E''⋅''F''<sup>&minus;1</sup>}}. In other words, in the internal representation of the expressions, there is no subtraction nor division nor unary minus, outside the representation of the numbers.
 
Another difficulty occurs with the [[commutativity]] of addition and multiplication. The problem is to quickly recognize the [[like terms]] in order to combine or cancel them. Testing every pair of terms is costly with very long sums and products. To address this, [[Macsyma]] sorts the operands of sums and products into an order that places like terms in consecutive places, allowing easy detection. In [[Maple (software)|Maple]], a [[hash function]] is designed for generating collisions when like terms are entered, allowing them to be combined as soon as they are introduced. This allows subexpressions that appear several times in a computation to be immediately recognized and stored only once. This saves memory and speeds up computation by avoiding repetition of the same operations on identical expressions.
 
Some rewriting rules sometimes increase and sometimes decrease the size of the expressions to which they are applied. This is the case offor the [[distributivity|distributive law]] or [[Trigonometric identity#Product-to-sum and sum-to-product identities|trigonometric identities]]. For example, the distributivitydistributive law allows rewriting <math>(x+1)^4 \rightarrow x^4+4x^3+6x^2+4x+1</math> and <math>(x-1)(x^4+x^3+x^2+x+1) \rightarrow x^5-1.</math> As there is no way to make a good general choice of applying or not such a rewriting rule, such rewriting is done only when explicitly invoked by the user. For the distributivitydistributive law, the computer function that applies this rewriting rule is typically called "expand". The reverse rewriting rule, called "factor", requires a non-trivial algorithm, which is thus a key function in computer algebra systems (see [[Polynomial factorization]]).
 
== Mathematical aspects ==
Line 66 ⟶ 60:
Some fundamental mathematical questions arise when one wants to manipulate [[expression (mathematics)|mathematical expressions]] in a computer. We consider mainly the case of the [[Multivariate polynomial|multivariate]] [[rational fraction]]s. This is not a real restriction, because, as soon as the [[irrational function]]s appearing in an expression are simplified, they are usually considered as new indeterminates. For example,
:<math>(\sin(x+y)^2+ \log(z^2-5))^3</math>
is viewed as a polynomial in <math>\sin(x+y)</math> and <math>\log(z^2-5)</math>.
 
=== Equality ===
There are two notions of equality for [[expression (mathematics)|mathematical expressions]]. '''Syntactic equality''' is the equality of their representation in a computer. This is easy to test in a program. ''Semantic equality'' is when two expressions represent the same mathematical object, as in
:<math> (x+y)^2=x^2+2xy+y^2.</math>
 
Line 78 ⟶ 72:
In computer algebra, "canonical form" and "normal form" are not synonymous.<ref>{{cite book |last1=Davenport |first1=J. H. |last2=Siret |first2=Y. |last3=Tournier |first3=É. |title=Computer Algebra: Systems and Algorithms for Algebraic Computation |publisher=Academic |date=1988 |isbn=0-12-204230-1 |oclc=802584470 }}</ref> A ''canonical form'' is such that two expressions in canonical form are semantically equal if and only if they are syntactically equal, while a ''normal form'' is such that an expression in normal form is semantically zero only if it is syntactically zero. In other words, zero has a unique representation as an expression in normal form.
 
Normal forms are usually preferred in computer algebra for several reasons. Firstly, canonical forms may be more costly to compute than normal forms. For example, to put a polynomial in canonical form, one has to expand every product through the [[distributivity|distributive law]], while it is not necessary with a normal form (see below). Secondly, it may be the case, like for expressions involving radicals, that a canonical form, if it exists, depends on some arbitrary choices and that these choices may be different for two expressions that have been computed independently. This may make impracticable the use of a canonical form impractical.
 
==History==
 
=== Human-driven computer algebra ===
Early computer algebra systems, such as the [[ENIAC]] at the [[University of Pennsylvania]], relied on [[Computer (occupation)|human computers]] or programmers to reprogram it between calculations, manipulate its many physical modules (or panels), and feed its IBM card reader.<ref>[http://www.seas.upenn.edu/about-seas/eniac/operation.php "ENIAC in Action: What it Was and How it Worked"]. ''ENIAC: Celebrating Penn Engineering History''. University of Pennsylvania. Retrieved December 3, 2023.</ref> Female mathematicians handled the majority of ENIAC programming human-guided computation: [[Jean Bartik|Jean Jennings]], [[Marlyn Meltzer|Marlyn Wescoff]], [[Ruth Teitelbaum|Ruth Lichterman]], [[Betty Holberton|Betty Snyder]], [[Frances Spence|Frances Bilas]], and [[Kathleen Antonelli|Kay McNulty]] led said efforts.<ref>{{Cite journal |last=Light |first=Jennifer S. |date=1999 |title=When Computers Were Women |url=https://muse.jhu.edu/article/33396 |journal=Technology and Culture |language=en |volume=40 |issue=3 |pages=455–483 |doi=10.1353/tech.1999.0128 |issn=1097-3729|url-access=subscription }}</ref>
 
=== Foundations and early applications ===
In 1960, [[John McCarthy (computer scientist)|John McCarthy]] explored an extension of [[Primitive recursive function|primitive recursive functions]] for computing symbolic expressions through the [[Lisp (programming language)|Lisp]] programming language while at the [[Massachusetts Institute of Technology]].<ref>{{Cite journal |last=McCarthy |first=John |date=1960-04-01 |title=Recursive functions of symbolic expressions and their computation by machine, Part I |url=https://dl.acm.org/doi/10.1145/367177.367199 |journal=Communications of the ACM |volume=3 |issue=4 |pages=184–195 |doi=10.1145/367177.367199 |issn=0001-0782|doi-access=free }}</ref> Though his series on "Recursive functions of symbolic expressions and their computation by machine" remained incomplete,<ref>{{Cite book |last=Wexelblat |first=Richard L. |title=History of programming languages |date=1981 |publisher=Academic press |others=History of programming languages conference, Association for computing machinery |isbn=978-0-12-745040-7 |series=ACM monograph series |___location=New York London Toronto}}</ref> McCarthy and his contributions to artificial intelligence programming and computer algebra via Lisp helped establish [[MIT Computer Science and Artificial Intelligence Laboratory|Project MAC]] at the Massachusetts Institute of Technology and the organization that later became the [[Stanford University centers and institutes|Stanford AI Laboratory]] (SAIL) at [[Stanford University]], whose competition facilitated significant development in computer algebra throughout the late 20th century.
 
Early efforts at symbolic computation, in the 1960s and 1970s, faced challenges surrounding the inefficiency of long-known algorithms when ported to computer algebra systems.<ref>{{Cite journal |date=1985-03-01 |title=Symbolic Computation (An Editorial) |url=https://www.sciencedirect.com/science/article/pii/S0747717185800250 |journal=Journal of Symbolic Computation |volume=1 |issue=1 |pages=1–6 |doi=10.1016/S0747-7171(85)80025-0 |issn=0747-7171|url-access=subscription }}</ref> Predecessors to Project MAC, such as [[ALTRAN]], sought to overcameovercome algorithmic limitations through advancements in hardware and interpreters, while later efforts turned towards software optimization.<ref>{{Cite journal |last=Feldman |first=Stuart I. |date=1975-11-01 |title=A brief description of Altran |url=https://dl.acm.org/doi/10.1145/1088322.1088325 |journal=ACM SIGSAM Bulletin |volume=9 |issue=4 |pages=12–20 |doi=10.1145/1088322.1088325 |issn=0163-5824}}</ref>
 
=== Historic problems ===
A large part of the work of researchers in the field consisted of revisiting classical [[algebra]] to increase its [[Computable function|effectiveness]] while developing [[Algorithmic efficiency|efficient algorithms]] for use in computer algebra. An example of this type of work is the computation of [[Polynomial greatest common divisor|polynomial greatest common divisors]], a task required to simplify fractions and an essential component of computer algebra. Classical algorithms for this computation, such as [[Euclidean algorithm|Euclid's algorithm]], providedproved inefficient over infinite fields; algorithms from [[linear algebra]] faced similar struggles.<ref>{{Citation |last=Kaltofen |first=E. |title=Factorization of Polynomials |date=1983 |url=http://link.springer.com/10.1007/978-3-7091-7551-4_8 |work=Computer Algebra |series=Computing Supplementa |volume=4 |pages=95–113 |editor-last=Buchberger |editor-first=Bruno |access-date=2023-11-29 |place=Vienna |publisher=Springer Vienna |doi=10.1007/978-3-7091-7551-4_8 |isbn=978-3-211-81776-6 |editor2-last=Collins |editor2-first=George Edwin |editor3-last=Loos |editor3-first=Rüdiger |editor4-last=Albrecht |editor4-first=Rudolf|url-access=subscription }}</ref> Thus, researchers turned to discovering methods of reducing polynomials (such as those over a [[ring of integers]] or a [[unique factorization ___domain]]) to a variant efficiently computable via a EuclidianEuclidean algorithm.
 
== Algorithms used in computer algebra ==
{{excerpt|List of algorithms|Computer algebra}}
== See also ==
* [[Automated theorem prover]]