Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Expression (mathematics)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Symbolic description of a mathematical object}} {{other uses| Expression (disambiguation)}} {{use dmy dates|date=July 2020|cs1-dates=y}} [[File:Equation_vs_Expression.png|thumb|239x239px|In the [[equation]] 7x − 5 = 2, the [[Sides of an equation|sides of the equation]] are expressions.]] In [[mathematics]], an '''expression''' is a written arrangement of [[symbol (mathematics)|symbol]]s following the context-dependent, [[syntax (logic)|syntactic]] conventions of [[mathematical notation]]. Symbols can denote [[numbers]], [[variable (mathematics)|variable]]s, [[operation (mathematics)|operation]]s, and [[function (mathematics)|function]]s.<ref>[[Oxford English Dictionary]], s.v. “[[doi:10.1093/OED/4555505636|Expression (n.), sense II.7]],” "''A group of symbols which together represent a numeric, algebraic, or other mathematical quantity or function.''"</ref> Other symbols include [[punctuation]] marks and [[bracket (mathematics)|bracket]]s, used for [[Symbols of grouping|grouping]] where there is not a well-defined [[order of operations]]. Expressions are commonly distinguished from ''[[mathematical formula|formulas]]'': expressions are a kind of [[mathematical object]], whereas formulas are statements ''about'' mathematical objects.<ref>{{cite book|first=Robert R.|last=Stoll|year=1963|title=Set Theory and Logic|publisher=Dover Publications|location=San Francisco, CA|isbn=978-0-486-63829-4}}</ref> This is analogous to [[natural language]], where a [[noun phrase]] refers to an object, and a whole [[Sentence (linguistics)|sentence]] refers to a [[fact]]. For example, <math>8x-5</math> is an expression, while the [[Inequality (mathematics)|inequality]] <math>8x-5 \geq 3 </math> is a formula. To ''evaluate'' an expression means to find a numerical [[Value (mathematics)|value]] equivalent to the expression.<ref>[[Oxford English Dictionary]], s.v. "[[doi:10.1093/OED/3423541985|Evaluate (v.), sense a]]", "''Mathematics. To work out the ‘value’ of (a quantitative expression); to find a numerical expression for (any quantitative fact or relation).''"</ref><ref>[[Oxford English Dictionary]], s.v. “[[doi:10.1093/OED/1018661347|Simplify (v.), sense 4.a]]”, "''To express (an equation or other mathematical expression) in a form that is easier to understand, analyse, or work with, e.g. by collecting like terms or substituting variables.''"</ref> Expressions can be ''evaluated'' or ''simplified'' by replacing [[Operation (mathematics)|operations]] that appear in them with their result. For example, the expression <math>8\times 2-5</math> simplifies to <math>16-5</math>, and evaluates to <math>11.</math> An expression is often used to define a [[Function (mathematics)|function]], by taking the variables to be [[Argument of a function|arguments]], or inputs, of the function, and assigning the output to be the evaluation of the resulting expression.<ref name="Codd1970">{{cite journal |last1=Codd |first1=Edgar Frank |authorlink=Edgar F. Codd|date=June 1970 |title=A Relational Model of Data for Large Shared Data Banks |url=https://www.seas.upenn.edu/~zives/03f/cis550/codd.pdf |archive-url=https://web.archive.org/web/20040908011134/http://www.seas.upenn.edu/~zives/03f/cis550/codd.pdf |archive-date=2004-09-08 |url-status=live |journal=Communications of the ACM |volume=13 |issue=6 |pages=377–387 |doi=10.1145/362384.362685 |s2cid=207549016 |access-date=2020-04-29}}</ref> For example, <math>x\mapsto x^2+1</math> and <math>f(x) = x^2 + 1</math> define the function that associates to each number its [[square function|square]] plus one. An expression with no variables would define a [[constant function]]. Usually, two expressions are considered [[Equality (mathematics)|equal]] or ''equivalent'' if they define the same function. Such an equality is called a "[[Formal semantics (natural language)|semantic]] equality", that is, both expressions "mean the same thing." == History == {{Broader|History of mathematics|History of mathematical notation}} {{See also|History of the function concept}} === Early written mathematics === {{Multiple image | direction = horizontal | image1 = Ishango bone (cropped).jpg | image2 = Ybc7289-bw.jpg | image3 = Moskou-papyrus.jpg | total_width = 230 | perrow = 2 | footer = The [[Ishango bone]] at the [[Royal Belgian Institute of Natural Sciences|RBINS]]. A [[Babylonian tablet]] approximating the [[square root of 2]]. Problem 14 from the [[Moscow Mathematical Papyrus]]. }} The earliest written mathematics likely began with [[tally marks]], where each mark represented one unit, carved into wood or stone. An example of early [[counting]] is the [[Ishango bone]], found near the [[Nile]] and dating back over [[Upper Paleolithic|20,000 years ago]], which is thought to show a six-month [[lunar calendar]].<ref name="Marshack2">Marshack, Alexander (1991). ''The Roots of Civilization'', Colonial Hill, Mount Kisco, NY.</ref> [[Ancient Egyptian mathematics|Ancient Egypt]] developed a symbolic system using [[hieroglyphics]], assigning symbols for powers of ten and using addition and subtraction symbols resembling legs in motion.<ref>Encyclopædia Americana. By Thomas Gamaliel Bradford. Pg [https://books.google.com/books?id=hrRPAAAAMAAJ&pg=PA314 314]</ref><ref>Mathematical Excursion, Enhanced Edition: Enhanced Webassign Edition By Richard N. Aufmann, Joanne Lockwood, Richard D. Nation, Daniel K. Cleg. Pg [https://books.google.com/books?id=GTgTnSGMukgC&pg=PA186 186]</ref> This system, recorded in texts like the [[Rhind Mathematical Papyrus]] (c. 2000–1800 BC), influenced other [[History of the Mediterranean region|Mediterranean cultures]]. In [[Mesopotamia]], a similar system evolved, with numbers written in a base-60 ([[sexagesimal]]) format on [[clay tablets]] written in [[Cuneiform]], a technique originating with the [[Sumerians]] around 3000 BC. This base-60 system persists today in measuring time and [[angle]]s. === Syncopated stage === The "syncopated" stage of mathematics introduced symbolic abbreviations for commonly used operations and quantities, marking a shift from purely [[Geometry|geometric]] reasoning. [[Ancient Greek mathematics]], largely geometric in nature, drew on [[Egyptian numerals|Egyptian numerical systems]] (especially [[Attic numerals]]),<ref>Mathematics and Measurement By Oswald Ashton Wentworth Dilk. Pg [https://books.google.com/books?id=AKJZvXOS7n4C&pg=PA14 14]</ref> with little interest in algebraic symbols, until the arrival of [[Diophantus]] of [[History of Alexandria|Alexandria]],<ref>[http://www.ms.uky.edu/~carl/ma330/projects/diophanfin1.html Diophantine Equations]. Submitted by: Aaron Zerhusen, Chris Rakes, & Shasta Meece. MA 330-002. Dr. Carl Eberhart. 16 February 1999.</ref> who pioneered a form of [[syncopated algebra]] in his ''[[Arithmetica]],'' which introduced symbolic manipulation of expressions.<ref>Boyer (1991). "Revival and Decline of Greek Mathematics". pp. 180-182. "In this respect it can be compared with the great classics of the earlier Alexandrian Age; yet it has practically nothing in common with these or, in fact, with any traditional Greek mathematics. It represents essentially a new branch and makes use of a different approach. Being divorced from geometric methods, it resembles Babylonian algebra to a large extent. But whereas Babylonian mathematicians had been concerned primarily with approximate solutions of determinate equations as far as the third degree, the Arithmetica of Diophantus (such as we have it) is almost entirely devoted to the exact solution of equations, both determinate and indeterminate. [...] Throughout the six surviving books of Arithmetica there is a systematic use of abbreviations for powers of numbers and for relationships and operations. An unknown number is represented by a symbol resembling the Greek letter ζ {\displaystyle \zeta } (perhaps for the last letter of arithmos). [...] It is instead a collection of some 150 problems, all worked out in terms of specific numerical examples, although perhaps generality of method was intended. There is no postulation development, nor is an effort made to find all possible solutions. In the case of quadratic equations with two positive roots, only the larger is give, and negative roots are not recognized. No clear-cut distinction is made between determinate and indeterminate problems, and even for the latter for which the number of solutions generally is unlimited, only a single answer is given. Diophantus solved problems involving several unknown numbers by skillfully expressing all unknown quantities, where possible, in terms of only one of them."</ref> His notation represented unknowns and powers symbolically, but without modern symbols for [[Relation (mathematics)|relations]] (such as [[Equality (mathematics)|equality]] or [[Inequality (mathematics)|inequality]]) or [[Exponentiation|exponents]].<ref name="Boyer">Boyer (1991). "Revival and Decline of Greek Mathematics". p. 178. "The chief difference between Diophantine syncopation and the modern algebraic notation is the lack of special symbols for operations and relations, as well as of the exponential notation."</ref> An unknown number was called <math>\zeta</math>.<ref>A History of Greek Mathematics: From Aristarchus to Diophantus. By Sir Thomas Little Heath. Pg [[iarchive:bub gb 7DDQAAAAMAAJ/page/n472|456]]</ref> The square of <math>\zeta</math> was <math>\Delta^v</math>; the cube was <math>K^v</math>; the fourth power was <math>\Delta^v\Delta</math>; the fifth power was <math>\Delta K^v</math>; and <math>\pitchfork</math> meant to subtract everything on the right from the left.<ref>A History of Greek Mathematics: From Aristarchus to Diophantus. By Sir Thomas Little Heath. Pg [[iarchive:bub gb 7DDQAAAAMAAJ/page/n474|458]]</ref> So for example, what would be written in modern notation as: <math display="block">x^3 - 2x^2 + 10x -1,</math> Would be written in Diophantus's syncopated notation as: : <math>\Kappa^{\upsilon} \overline{\alpha} \; \zeta \overline{\iota} \;\, \pitchfork \;\, \Delta^{\upsilon} \overline{\beta} \; \Mu \overline{\alpha} \,\;</math> In the 7th century, [[Brahmagupta]] used different colours to represent the unknowns in algebraic equations in the ''[[Brāhmasphuṭasiddhānta]]''. Greek and other ancient mathematical advances, were often trapped in cycles of bursts of creativity, followed by long periods of stagnation, but this began to change as knowledge spread in the [[early modern period]]. === Symbolic stage and early arithmetic === [[File:Johannes_Widmann-Mercantile_Arithmetic_1489.jpg|thumb|275x275px|The 1489 use of the [[plus and minus signs]] in print.]] The transition to fully symbolic algebra began with [[Ibn al-Banna' al-Marrakushi]] (1256–1321) and [[Abū al-Ḥasan ibn ʿAlī al-Qalaṣādī]], (1412–1482) who introduced symbols for operations using [[Arabic script|Arabic characters]].<ref>{{MacTutor|id=Al-Banna|title=al-Marrakushi ibn Al-Banna}}</ref><ref name="Gullberg2">{{cite book |last1=Gullberg |first1=Jan |author-link=Jan Gullberg |url=https://archive.org/details/mathematicsfromb1997gull |title=Mathematics: From the Birth of Numbers |date=1997 |publisher=W. W. Norton |isbn=0-393-04002-X |page=[https://archive.org/details/mathematicsfromb1997gull/page/298 298] |url-access=registration}}</ref><ref name="Qalasadi2">{{MacTutor Biography|id=Al-Qalasadi|title=Abu'l Hasan ibn Ali al Qalasadi}}</ref> The [[plus sign]] (+) appeared around 1351 with [[Nicole Oresme]],<ref>[https://books.google.com/books?id=k0U1AQAAMAAJ Der Algorismus proportionum des Nicolaus Oresme]: Zum ersten Male nach der Lesart der Handschrift R.40.2. der Königlichen Gymnasial-bibliothek zu Thorn. [[Nicole Oresme]]. S. Calvary & Company, 1868.</ref> likely derived from the Latin ''et'' (meaning "and"), while the minus sign (−) was first used in 1489 by [[Johannes Widmann]].<ref>''Later [[early modern]] version'': [[iarchive:anewsystemmerca04walsgoog|A New System of Mercantile Arithmetic]]: Adapted to the Commerce of the United States, in Its Domestic and Foreign Relations with Forms of Accounts and Other Writings Usually Occurring in Trade. By [[Michael Walsh (1801)|Michael Walsh]]. [[Edmund M. Blunt]] (proprietor.), 1801.</ref> [[Luca Pacioli]] included these symbols in his works, though much was based on earlier contributions by [[Piero della Francesca]]. The [[radical symbol]] (√) for [[square root]] was introduced by [[Christoph Rudolff]] in the 1500s, and [[parentheses]] for [[Precedence (mathematics)|precedence]] by [[Niccolò Tartaglia]] in 1556. [[François Viète]]’s ''New Algebra'' (1591) formalized modern symbolic manipulation. The [[multiplication sign]] (×) was first used by [[William Oughtred]] and the [[division sign]] (÷) by [[Johann Rahn]]. [[René Descartes]] further advanced algebraic symbolism in ''[[La Géométrie]]'' (1637), where he introduced the use of letters at the end of the alphabet (x, y, z) for [[Variable (mathematics)|variables]], along with the [[Cartesian coordinate system]], which bridged algebra and geometry.<ref>{{harvnb|Descartes|2006|loc=p.1xiii}} "This short work marks the moment at which algebra and geometry ceased being separate."</ref> [[Isaac Newton]] and [[Gottfried Wilhelm Leibniz]] independently developed [[Calculus of variations|calculus]] in the late 17th century, with [[Leibniz's notation]] becoming the standard. ==Variables and evaluation== {{anchor|evaluation}} In [[elementary algebra]], a [[Variable (mathematics)|''variable'']] in an expression is a [[Letter (alphabet)|letter]] that represents a number whose value may change. To ''evaluate an expression'' with a variable means to find the value of the expression when the variable is [[Assignment (computer science)|assigned]] a given number. Expressions can be ''evaluated'' or ''simplified'' by replacing [[Operation (mathematics)|operations]] that appear in them with their result, or by combining [[Like terms|like-terms]].<ref>{{Cite web |last1=Marecek |first1=Lynn |last2=Mathis |first2=Andrea Honeycutt |date=2020-05-06 |title=1.1 Use the Language of Algebra - Intermediate Algebra 2e {{!}} OpenStax |url=https://openstax.org/books/intermediate-algebra-2e/pages/1-1-use-the-language-of-algebra#term-00018 |access-date=2024-10-14 |website=openstax.org |language=English}}</ref> For example, take the expression <math>4 x^2 + 8</math>; it can be evaluated at {{Math|1=''x'' = 3}} in the following steps: <math display="inline">4(3)^2 + 8</math>, (replace x with 3) <math>4 \cdot (3 \cdot 3 ) + 8</math> (use definition of [[Exponentiation|exponent]]) <math>4 \cdot 9 + 8</math> (evaluate inner multiplication) <math>36 + 8</math> (evaluate remaining multiplication) <math>44</math> (evaluate addition) A ''term'' is a constant or the [[Product (mathematics)|product]] of a constant and one or more variables. Some examples include <math>7, \; 5x, \; 13x^2y, \; 4b </math> The constant of the product is called the [[coefficient]]. Terms that are either constants or have the same variables raised to the same powers are called ''[[like terms]]''. If there are like terms in an expression, one can simplify the expression by combining the like terms. One adds the coefficients and keeps the same variable. <math>4x + 7x +2x = 13x</math> Any variable can be classified as being either a [[free variable]] or a [[bound variable]]. For a given combination of values for the free variables, an expression may be evaluated, although for some combinations of values of the free variables, the value of the expression may be [[Undefined (mathematics)|undefined]]. Thus an expression represents an [[Operation (mathematics)|operation]] over constants and free variables and whose output is the resulting value of the expression.<ref name="Model Theory">{{cite book |author1=C.C. Chang |author1-link=Chen Chung Chang |title=Model Theory |author2=H. Jerome Keisler |author2-link=H. Jerome Keisler |publisher=North Holland |year=1977 |series=Studies in Logic and the Foundation of Mathematics |volume=73}}; here: Sect.1.3</ref> For a non-formalized language, that is, in most mathematical texts outside of [[mathematical logic]], for an individual expression it is not always possible to identify which variables are free and bound. For example, in <math display="inline">\sum_{i < k} a_{ik}</math>, depending on the context, the variable <math display="inline">i</math> can be free and <math display="inline">k</math> bound, or vice-versa, but they cannot both be free. Determining which value is assumed to be free depends on context and [[Semantics of logic|semantics]].<ref>Sobolev, S.K. (originator). [http://encyclopediaofmath.org/index.php?title=Free_variable&oldid=46988 ''Free variable'']. ''[[Encyclopedia of Mathematics]]''. [[Springer Publishing|Springer]]. {{ISBN|1402006098}}.</ref> === Equivalence === {{Main|Identity (mathematics)}} An expression is often used to define a [[Function (mathematics)|function]], or denote [[Function composition|compositions]] of functions, by taking the variables to be [[Argument of a function|arguments]], or inputs, of the function, and assigning the output to be the evaluation of the resulting expression.<ref name="Codd19702">{{cite journal |last1=Codd |first1=Edgar Frank |date=June 1970 |title=A Relational Model of Data for Large Shared Data Banks |url=https://www.seas.upenn.edu/~zives/03f/cis550/codd.pdf |url-status=live |journal=Communications of the ACM |volume=13 |issue=6 |pages=377–387 |doi=10.1145/362384.362685 |s2cid=207549016 |archive-url=https://web.archive.org/web/20040908011134/http://www.seas.upenn.edu/~zives/03f/cis550/codd.pdf |archive-date=2004-09-08 |access-date=2020-04-29 |authorlink=Edgar F. Codd}}</ref> For example, <math>x\mapsto x^2+1</math> and <math>f(x) = x^2 + 1</math> define the function that associates to each number its [[Square function|square]] plus one. An expression with no variables would define a [[constant function]]. In this way, two expressions are said to be equivalent if, for each combination of values for the free variables, they have the same output, i.e., they represent the same function.<ref>Equation. Encyclopedia of Mathematics. URL: http://encyclopediaofmath.org/index.php?title=Equation&oldid=32613</ref><ref>Pratt, Vaughan, "Algebra", The Stanford Encyclopedia of Philosophy (Winter 2022 Edition), Edward N. Zalta & Uri Nodelman (eds.), URL: https://plato.stanford.edu/entries/algebra/#Laws</ref> The equivalence between two expressions is called an [[Identity (mathematics)|identity]] and is sometimes denoted with <math>\equiv.</math> For example, in the expression <math display="inline">\sum_{n=1}^{3} (2nx),</math> the variable {{math|''n''}} is bound, and the variable {{math|''x''}} is free. This expression is equivalent to the simpler expression {{math|12 ''x''}}; that is <math display="block">\sum_{n=1}^{3} (2nx)\equiv 12x.</math> The value for {{math|1=''x'' = 3}} is 36, which can be denoted <math display="block">\sum_{n=1}^{3} (2nx)\Big|_{x=3}= 36.</math> === Polynomial evaluation === {{Main|Polynomial evaluation}} A polynomial consists of variables and [[coefficient]]s, that involve only the operations of [[addition]], [[subtraction]], [[multiplication]] and [[exponentiation]] to [[nonnegative integer]] powers, and has a finite number of terms. The problem of [[polynomial evaluation]] arises frequently in practice. In [[computational geometry]], polynomials are used to compute function approximations using [[Taylor polynomials]]. In [[cryptography]] and [[hash table]]s, polynomials are used to compute [[K-independent hashing|''k''-independent hashing]]. In the former case, polynomials are evaluated using [[floating-point arithmetic]], which is not exact. Thus different schemes for the evaluation will, in general, give slightly different answers. In the latter case, the polynomials are usually evaluated in a [[finite field]], in which case the answers are always exact. For evaluating the [[univariate polynomial]] <math display="inline">a_nx^n+a_{n-1}x^{n-1}+\cdots +a_0,</math> the most naive method would use <math>n</math> multiplications to compute <math>a_nx^n</math>, use <math display="inline">n-1</math> multiplications to compute <math>a_{n-1} x^{n-1}</math> and so on for a total of <math display="inline">\frac{n(n+1)}{2}</math> multiplications and <math>n</math> additions. Using better methods, such as [[Horner's rule]], this can be reduced to <math>n</math> multiplications and <math>n</math> additions. If some preprocessing is allowed, even more savings are possible. === Computation === {{Main|Computation}} A [[computation]] is any type of [[arithmetic]] or non-arithmetic [[calculation]] that is "well-defined".<ref>{{Cite web |date=2024-10-11 |title=Definition of COMPUTATION |url=https://www.merriam-webster.com/dictionary/computation |access-date=2024-10-12 |website=www.merriam-webster.com |language=en}}</ref> The notion that mathematical statements should be 'well-defined' had been argued by mathematicians since at least the [[1600s (decade)|1600s]],<ref>{{cite book |last=Couturat |first=Louis |title=la Logique de Leibniz a'Après des Documents Inédits |date=1901 |publisher=Paris |isbn=978-0343895099}}</ref> but agreement on a suitable definition proved elusive.<ref name="Davis Davis 2000">{{cite book |last1=Davis |first1=Martin |title=The Universal Computer |last2=Davis |first2=Martin D. |date=2000 |publisher=W. W. Norton & Company |isbn=978-0-393-04785-1}}</ref> A candidate definition was proposed independently by several mathematicians in the 1930s.<ref name="Davis">{{cite book |last=Davis |first=Martin |title=Computability & Unsolvability |date=1982-01-01 |publisher=Courier Corporation |isbn=978-0-486-61471-7}}</ref> The best-known variant was formalised by the mathematician [[Alan Turing]], who defined a well-defined statement or calculation as any statement that could be expressed in terms of the initialisation parameters of a [[Turing machine]].<ref>{{Cite news |last=Turing |first=A.M. |year=1937 |title=On Computable Numbers, with an Application to the Entscheidungsproblem |url=http://www.comlab.ox.ac.uk/activities/ieg/e-library/sources/tp2-ie.pdf |periodical=Proceedings of the London Mathematical Society |pages=230–65 |volume=42 |doi=10.1112/plms/s2-42.1.230 |orig-year=Delivered to the Society November 1936 |series=2}}</ref>{{page needed|reason=Couldn't find string "well-defined" in the paper.|date=October 2024}} Turing's definition apportioned "well-definedness" to a very large class of mathematical statements, including all well-formed [[Equations|algebraic statements]], and all statements written in modern computer programming languages.<ref name="Davis Davis 2000 p.">{{cite book |last1=Davis |first1=Martin |title=The Universal Computer |last2=Davis |first2=Martin D. |date=2000 |publisher=W. W. Norton & Company |isbn=978-0-393-04785-1 |page=}}</ref> Despite the widespread uptake of this definition, there are some mathematical concepts that have no well-defined characterisation under this definition. This includes [[the halting problem]] and [[Busy beaver|the busy beaver game]]. It remains an open question as to whether there exists a more powerful definition of 'well-defined' that is able to capture both computable and 'non-computable' statements.{{efn|The study of non-computable statements is the field of [[hypercomputation]].}}<ref>{{cite journal |author=Davis, Martin |year=2006 |title=Why there is no such discipline as hypercomputation |journal=Applied Mathematics and Computation |volume=178 |issue=1 <!-- Special Issue on Hypercomputation --> |pages=4–7 |doi=10.1016/j.amc.2005.09.066}}</ref> All statements characterised in modern programming languages are well-defined, including [[C++]], [[Python (programming language)|Python]], and [[Java (programming language)|Java]].<ref name="Davis Davis 2000 p." /> Common examples of computation are basic [[arithmetic]] and the [[Execution (computing)|execution]] of computer [[algorithms]]. A [[calculation]] is a deliberate mathematical process that transforms one or more inputs into one or more outputs or ''results''. For example, [[multiplying]] 7 by 6 is a simple algorithmic calculation. Extracting the [[square root]] or the [[cube root]] of a number using mathematical models is a more complex algorithmic calculation. ==== Rewriting ==== Expressions can be computed by means of an ''[[evaluation strategy]].''<ref>{{cite book |last1=Araki |first1=Shota |url=https://books.google.com/books?id=MFMCCwAAQBAJ&pg=PA1 |title=Theory and Practice of Computation |last2=Nishizaki |first2=Shin-ya |date=November 2014 |isbn=978-981-4612-87-6 |page=1 |chapter=Call-by-name evaluation of RPC and RMI calculi |doi=10.1142/9789814612883_0001 |access-date=21 August 2021}}</ref> To illustrate, executing a function call <code>f(a,b)</code> may first evaluate the arguments <code>a</code> and <code>b</code>, store the results in [[Reference (computer science)|references]] or memory locations <code>ref_a</code> and <code>ref_b</code>, then evaluate the function's body with those references passed in. This gives the function the ability to look up the original argument values passed in through dereferencing the parameters (some languages use specific operators to perform this), to modify them via [[Assignment (computer science)|assignment]] as if they were local variables, and to return values via the references. This is the call-by-reference evaluation strategy.<ref>{{cite book |author1=Daniel P. Friedman |title=Essentials of Programming Languages |author2=Mitchell Wand |date=2008 |publisher=[[MIT Press|The MIT Press]] |isbn=978-0262062794 |edition=third |location=Cambridge, MA}}</ref> Evaluation strategy is part of the semantics of the programming language definition. Some languages, such as [[PureScript]], have variants with different evaluation strategies. Some [[declarative language]]s, such as [[Datalog]], support multiple evaluation strategies. Some languages define a [[calling convention]]. In [[rewriting]], a [[reduction strategy]] or rewriting strategy is a relation specifying a rewrite for each object or term, compatible with a given reduction relation. A rewriting strategy specifies, out of all the reducible subterms ([[redex]]es), which one should be reduced (''contracted'') within a term. One of the most common systems involves [[lambda calculus]]. ==Well-defined expressions== {{Main|Well-defined expression}} The [[language of mathematics]] exhibits a kind of [[grammar]] (called [[formal grammar]]) about how expressions may be written. There are two considerations for well-definedness of mathematical expressions, [[Syntax (logic)|syntax]] and [[Formal semantics (natural language)|semantics]]. Syntax is concerned with the rules used for constructing, or transforming the symbols of an expression without regard to any [[Interpretation (logic)|interpretation]] or [[Meaning (linguistics)|meaning]] given to them. Expressions that are syntactically correct are called [[Well-formedness|well-formed]]. Semantics is concerned with the meaning of these well-formed expressions. Expressions that are semantically correct are called [[Well-defined expression|well-defined]]. === Well-formed === The syntax of mathematical expressions can be described somewhat informally as follows: the allowed [[operator (mathematics)|operator]]s must have the correct number of inputs in the correct places (usually written with [[infix notation]]), the sub-expressions that make up these inputs must be well-formed themselves, have a clear [[order of operations]], etc. Strings of symbols that conform to the rules of syntax are called [[Well-formedness|''well-formed'']], and those that are not well-formed are called, ''ill-formed'', and do not constitute mathematical expressions.<ref>{{cite book |last=Stoll |first=Robert R. |title=Set Theory and Logic |publisher=Dover Publications |isbn=978-0-486-63829-4 |location=San Francisco, CA |year=1963}}</ref> For example, in [[arithmetic]], the expression ''1 + 2 × 3'' is well-formed, but :<math>\times4)x+,/y</math>. is not. However, being well-formed is not enough to be considered well-defined. For example in arithmetic, the expression <math display="inline">\frac{1}{0}</math> is well-formed, but it is not well-defined. (See [[Division by zero]]). Such expressions are called [[Undefined (mathematics)|undefined]]. ===Well-defined=== [[Semantics]] is the study of meaning. [[Formal semantics (natural language)|Formal semantics]] is about attaching meaning to expressions. An expression that defines a unique [[Value (mathematics)|value]] or meaning is said to be [[Well-defined expression|well-defined]]. Otherwise, the expression is said to be ill defined or ambiguous.'''<ref name="MathWorld2">{{cite web |last=Weisstein |first=Eric W. |title=Well-Defined |url=http://mathworld.wolfram.com/Well-Defined.html |access-date=2 January 2013 |publisher=From MathWorld – A Wolfram Web Resource}}</ref>''' In general the meaning of expressions is not limited to designating values; for instance, an expression might designate a condition, or an [[equation]] that is to be solved, or it can be viewed as an object in its own right that can be manipulated according to certain rules. Certain expressions that designate a value simultaneously express a condition that is assumed to hold, for instance those involving the operator <math>\oplus</math> to designate an internal [[direct sum]]. In [[algebra]], an expression may be used to designate a value, which might depend on values assigned to [[variable (mathematics)|variable]]s occurring in the expression. The determination of this value depends on the [[semantics]] attached to the symbols of the expression. The choice of semantics depends on the context of the expression. The same syntactic expression ''1 + 2 × 3'' can have different values (mathematically 7, but also 9), depending on the [[order of operations]] implied by the context (See also [[Order of operations#Calculators|Operations § Calculators]]). For [[real number]]s, the product <math>a \times b \times c</math> is unambiguous because <math>(a \times b)\times c = a \times (b \times c)</math>; hence the notation is said to be ''well defined''.<ref name="MathWorld2"/> This property, also known as [[associativity]] of multiplication, guarantees the result does not depend on the sequence of multiplications; therefore, a specification of the sequence can be omitted. The [[subtraction]] operation is non-associative; despite that, there is a convention that <math>a-b-c</math> is shorthand for <math>(a-b)-c</math>, thus it is considered "well-defined". On the other hand, [[Division (mathematics)|Division]] is non-associative, and in the case of <math>a/b/c</math>, parenthesization conventions are not well established; therefore, this expression is often considered ill-defined. Unlike with functions, notational ambiguities can be overcome by means of additional definitions (e.g., rules of [[Operator precedence|precedence]], associativity of the operator). For example, in the programming language [[C (programming language)|C]], the operator <code>-</code> for subtraction is ''left-to-right-associative'', which means that <code>a-b-c</code> is defined as <code>(a-b)-c</code>, and the operator <code>=</code> for assignment is ''right-to-left-associative'', which means that <code>a=b=c</code> is defined as <code>a=(b=c)</code>.<ref>{{Cite web |date=2014-02-07 |title=Operator Precedence and Associativity in C |url=https://www.geeksforgeeks.org/operator-precedence-and-associativity-in-c/ |access-date=2019-10-18 |website=GeeksforGeeks |language=en-US}}</ref> In the programming language [[APL (programming language)|APL]] there is only one rule: from [[APL (programming language)#Design|right to left]] – but parentheses first. == Formal definition == The term 'expression' is part of the [[language of mathematics]], that is to say, it is not defined ''within'' mathematics, but taken as a [[Primitive notion|primitive]] part of the language. To attempt to define the term would not be doing mathematics, but rather, one would be engaging in a kind of [[metamathematics]] (the [[metalanguage]] of mathematics), usually [[mathematical logic]]. Within mathematical logic, mathematics is usually described as a kind of [[formal language]], and a well-formed expression can be [[Recursive definition|defined recursively]] as follows:<ref name="Model Theory"/> The [[Alphabet (formal languages)|alphabet]] consists of: * A set of individual [[Constant (mathematics)|constants]]: Symbols representing fixed [[Mathematical object|objects]] in the [[domain of discourse]], such as [[Numeral system|numerals]] (1, 2.5, 1/7, ...), [[Set (mathematics)|sets]] (<math>\varnothing, \{1,2,3\}</math>, ...), [[truth values]] (T or F), etc. * A set of individual variables: A [[Countable set|countably infinite]] amount of symbols representing [[Variable (mathematics)|variables]] used for representing an unspecified object in the domain. (Usually letters like {{mvar|x}}, or {{mvar|y}}) * A set of operations: [[Function symbols]] representing [[Operation (mathematics)|operations]] that can be performed on elements over the domain, like addition (+), multiplication (×), or set operations like union (∪), or intersection (∩). (Functions can be understood as [[unary operations]]) * Brackets ( ) With this alphabet, the recursive rules for forming a well-formed expression (WFE) are as follows: * Any constant or variable as defined are the [[atomic formula|atomic expressions]], the simplest well-formed expressions (WFE's). For instance, the constant <math>2</math> or the variable <math>x</math> are syntactically correct expressions. * Let <math>F</math> be a [[metavariable]] for any [[n-ary operation]] over the domain, and let <math>\phi_1, \phi_2, ... \phi_n</math> be metavariables for any WFE's. :Then <math>F(\phi_1, \phi_2, ... \phi_n)</math> is also well-formed. For the most often used operations, more convenient notations (like [[infix notation]]) have been developed over the centuries. :For instance, if the domain of discourse is the [[real number]]s, <math>F</math> can denote the [[binary operation]] +, then <math>\phi_1 + \phi_2</math> is well-formed. Or <math>F</math> can be the unary operation <math>\surd</math> so <math>\sqrt{\phi_1}</math> is well-formed. :Brackets are initially around each non-atomic expression, but they can be deleted in cases where there is a defined [[order of operations]], or where order doesn't matter (i.e. where operations are [[Associative property|associative]]). A well-formed expression can be thought as a [[Abstract syntax tree|syntax tree]].<ref>{{cite book |last1=Hermes |first1=Hans |author-link=Hans Hermes |title=Introduction to Mathematical Logic |publisher=Springer London |year=1973 |isbn=3540058192 |issn=1431-4657}}; here: Sect.II.1.3</ref> The [[Node (computer science)|leaf nodes]] are always atomic expressions. Operations <math> + </math> and <math> \cup </math> have exactly two child nodes, while operations <math display="inline">\sqrt{x} </math>, <math display="inline">\text{ln}(x)</math> and <math display="inline"> \frac{d}{dx} </math> have exactly one. There are countably infinitely many WFE's, however, each WFE has a finite number of nodes. ===Lambda calculus=== {{Main|Lambda calculus}} Formal languages allow [[Formal system|formalizing]] the concept of well-formed expressions. In the 1930s, a new type of expression, the [[Lambda calculus#Definition|lambda expression]], was introduced by [[Alonzo Church]] and [[Stephen Kleene]] for formalizing [[function (mathematics)|function]]s and their evaluation.<ref>{{cite journal|first=Alonzo|last=Church|author-link=Alonzo Church|title=A set of postulates for the foundation of logic|journal=Annals of Mathematics|series=Series 2|volume=33|issue=2|pages=346–366|year=1932|doi=10.2307/1968337|jstor=1968337}}</ref>{{efn|For a full history, see Cardone and Hindley's "History of Lambda-calculus and Combinatory Logic" (2006).}} The lambda operators (lambda abstraction and function application) form the basis for lambda calculus, a formal system used in [[mathematical logic]] and [[programming language theory]]. The equivalence of two lambda expressions is [[decision problem|undecidable]] (but see [[unification (computer science)]]). This is also the case for the expressions representing real numbers, which are built from the integers by using the arithmetical operations, the logarithm and the exponential ([[Richardson's theorem]]). ==Types of expressions== ===Algebraic expression=== An ''[[algebraic expression]]'' is an expression built up from [[Algebraic number|algebraic constants]], [[Variable (mathematics)|variables]], and the [[algebraic operation]]s ([[addition]], [[subtraction]], [[multiplication]], [[Division (mathematics)|division]] and [[exponentiation]] by a [[rational number]]).<ref>{{cite book |last1=Morris |first1=Christopher G. |title=Academic Press dictionary of science and technology |publisher=Gulf Professional Publishing |page=[https://archive.org/details/academicpressdic00morr/page/74 74] |year=1992 |url=https://archive.org/details/academicpressdic00morr|url-access=registration |quote=algebraic expression over a field. }}</ref> For example, {{math|1=3''x''<sup>2</sup> − 2''xy'' + ''c''}} is an algebraic expression. Since taking the [[square root]] is the same as raising to the power {{sfrac|1|2}}, the following is also an algebraic expression: :<math>\sqrt{\frac{1-x^2}{1+x^2}}</math> See also: [[Algebraic equation]] and [[Algebraic closure]] ===Polynomial expression=== A [[polynomial expression]] is an expression built with [[scalar (mathematics)|scalar]]s (numbers of elements of some field), [[indeterminate (variable)|indeterminate]]s, and the operators of addition, multiplication, and exponentiation to nonnegative integer powers; for example <math>3(x+1)^2 - xy.</math> Using [[associativity]], [[commutativity]] and [[distributivity]], every polynomial expression is equivalent to a [[polynomial]], that is an expression that is a [[linear combination]] of products of integer powers of the indeterminates. For example the above polynomial expression is equivalent (denote the same polynomial as <math>3x^2-xy+6x+3.</math> Many author do not distinguish polynomials and polynomial expressions. In this case the expression of a polynomial expression as a linear combination is called the ''canonical form'', ''normal form'', or ''expanded form'' of the polynomial. ===Computational expression=== {{Main|Expression (computer science)}} In [[computer science]], an ''expression'' is a [[Syntax (programming languages)|syntactic]] entity in a [[programming language]] that may be evaluated to determine its [[value (computer science)|value]]<ref>[[John C. Mitchell|Mitchell, J.]] (2002). Concepts in Programming Languages. Cambridge: Cambridge University Press, ''3.4.1 Statements and Expressions'', p. 26</ref> or fail to terminate, in which case the expression is undefined.<ref>Maurizio Gabbrielli, Simone Martini (2010). Programming Languages - Principles and Paradigms. Springer London, ''6.1 Expressions'', p. 120</ref> It is a combination of one or more [[Constant (programming)|constants]], [[variable (programming)|variable]]s, [[function (programming)|function]]s, and [[operator (programming)|operator]]s that the programming language interprets (according to its particular [[Order of operations|rules of precedence]] and of [[Associative property|association]]) and computes to produce ("to return", in a [[state (computer science)|stateful]] environment) another value. This process, for mathematical expressions, is called ''evaluation''. In simple settings, the [[return type|resulting value]] is usually one of various [[primitive data type|primitive types]], such as [[string (computer science)|string]], [[Boolean expression|Boolean]], or numerical (such as [[integer (computer science)|integer]], [[floating-point number|floating-point]], or [[complex data type|complex]]). In [[computer algebra]], formulas are viewed as expressions that can be evaluated as a Boolean, depending on the values that are given to the variables occurring in the expressions. For example <math>8x-5 \geq 3</math> takes the value ''false'' if {{mvar|x}} is given a value less than 1, and the value ''true'' otherwise. Expressions are often contrasted with [[Statement (computer science)|statements]]—syntactic entities that have no value (an instruction). [[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 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 (mathematics)|matrix]] may be represented as an expression with "matrix" as an operator and its rows as operands. See: [[Computer algebra#Expressions|Computer algebra expression]] ===Logical expression=== In [[mathematical logic]], a ''"logical expression"'' can refer to either [[Term (logic)|terms]] or [[Well-formed formula#Predicate logic|formulas]]. A term denotes a mathematical object while a formula denotes a mathematical fact. In particular, terms appear as components of a formula. A [[first-order logic|first-order]] term is [[recursive definition|recursively constructed]] from constant symbols, variables, and [[function symbol (logic)|function symbols]]. An expression formed by applying a [[predicate (logic)|predicate symbol]] to an appropriate number of terms is called an [[atomic formula]], which evaluates to [[Truth#Truth in mathematics|true]] or [[False (logic)|false]] in [[Principle of bivalence|bivalent logics]], given an [[interpretation (logic)|interpretation]]. For example, {{tmath|(x+1)*(x+1)}} is a term built from the constant 1, the variable {{mvar|x}}, and the binary function symbols {{tmath|+}} and {{tmath|*}}; it is part of the atomic formula {{tmath|(x+1)*(x+1) \ge 0}} which evaluates to true for each [[real number|real-numbered]] value of {{mvar|x}}. ===Formal expression=== {{See also|Regular expression}} A '''formal expression''' is a kind of [[String (computer science)|string]] of [[Symbol (formal)|symbols]], created by the same [[Expression (mathematics)#Formal definition|production rules]] as standard expressions, however, they are used without regard to the meaning of the expression. In this way, two ''formal expressions'' are considered equal only if they are [[Syntax (logic)|syntactically]] equal, that is, if they are the exact same expression.<ref>{{Cite book |last=McCoy |first=Neal H. |url=https://archive.org/details/introductiontomo00mcco/page/126/mode/2up?q=%22purely+formal+expression%22 |title=Introduction To Modern Algebra |publisher=[[Allyn & Bacon]] |year=1960 |location=Boston |pages=127 |lccn=68015225}}</ref><ref>{{Cite book |last=Fraleigh |first=John B. |url=https://archive.org/details/firstcourseinabs07edfral/page/198/mode/2up?q=%22formal+sum%22 |title=A first course in abstract algebra |date=2003 |publisher=Boston : Addison-Wesley |isbn=978-0-201-76390-4}}</ref> For instance, the formal expressions "2" and "1+1" are not equal. ==See also== {{div col|colwidth=22em}} * [[Analytic expression]] * [[Closed-form expression]] * [[Formal calculation]] * [[Functional programming]] * [[Infinite expression]] * [[Number sentence]] * [[Rewriting]] * [[Signature (logic)]] {{div col end}} ==Notes== {{notelist}} ==References== {{reflist}} == Works Cited == {{cite book |last=Descartes |first=René |url=https://books.google.com/books?id=9FOC5F6nVaAC&pg=PR60 |title=A discourse on the method of correctly conducting one's reason and seeking truth in the sciences |publisher=Oxford University Press |year=2006 |isbn=0-19-282514-3 |translator=Ian Maclean |orig-year=1637}}{{Mathematical logic}} [[Category:Abstract algebra]] [[Category:Logical expressions]] [[Category:Elementary algebra]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Anchor
(
edit
)
Template:Broader
(
edit
)
Template:Cite book
(
edit
)
Template:Cite journal
(
edit
)
Template:Cite news
(
edit
)
Template:Cite thesis
(
edit
)
Template:Cite web
(
edit
)
Template:Div col
(
edit
)
Template:Div col end
(
edit
)
Template:Efn
(
edit
)
Template:Harvnb
(
edit
)
Template:ISBN
(
edit
)
Template:MacTutor
(
edit
)
Template:MacTutor Biography
(
edit
)
Template:Main
(
edit
)
Template:Math
(
edit
)
Template:Mathematical logic
(
edit
)
Template:Multiple image
(
edit
)
Template:Mvar
(
edit
)
Template:Notelist
(
edit
)
Template:Other uses
(
edit
)
Template:Page needed
(
edit
)
Template:Reflist
(
edit
)
Template:See also
(
edit
)
Template:Sfrac
(
edit
)
Template:Short description
(
edit
)
Template:Tmath
(
edit
)
Template:Use dmy dates
(
edit
)