Computer algebra: Difference between revisions

Content deleted Content added
Undid revision 1062726893 by PaleoNeonate (talk): I don't see why Lambda calculus is relevant here
m General + punct fixes
Line 40:
 
[[File:Cassidy.1985.015.gif|thumb|400px|Representation of the expression (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 | author=Kevin G. 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 }} Here: p.15</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, a matrix may be represented as an expression with “matrix”"matrix" as an operator and its rows as operands.
 
Even programs may be considered and represented as expressions with operator “procedure”"procedure" and, at least, two operands, the list of parameters and the body, which is itself an expression with “body”"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 {{mvar|''a''}} and {{mvar|''b''}} as parameters. Executing this program consists in ''evaluating'' the expression for given values of {{mvar|''a''}} and {{mvar|''b''}}; if they do not have any value—that is they are indeterminates—, 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"evaluation to a Boolean”Boolean" command, or automatically started by the system in the case of a test inside a program—then the evaluation to a boolean 0 or 1 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]]) or entries in a [[hash table]] (like in [[Maple (software)|Maple]]).