Jump to content

Expression (mathematics)

From Wikipedia, the free encyclopedia
(Redirected from Expression (math))

In mathematics, an expression or mathematical expression is a finite combination of symbols that is well-formed according to rules that depend on the context. Mathematical symbols can designate numbers (constants), variables, operations, functions, brackets, punctuation, and grouping to help determine order of operations and other aspects of logical syntax.

Many authors distinguish an expression from a formula, the former denoting a mathematical object, and the latter denoting a statement about mathematical objects.[1] For example, is an expression, while is a formula. However, in modern mathematics, and in particular in computer algebra, formulas are viewed as expressions that can be evaluated to true or false, depending on the values that are given to the variables occurring in the expressions. For example takes the value false if x is given a value less than –1, and the value true otherwise.

Examples

[edit]

The use of expressions ranges from the simple:

  (linear polynomial)
  (quadratic polynomial)
  (rational fraction)

to the complex:

Variables and evaluation

[edit]

Many mathematical expressions include variables. 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. Thus an expression represents a function whose inputs are the values assigned to the free variables and whose output is the resulting value of the expression.

For example, if the expression is evaluated with x = 10, y = 5, it evaluates to 2; this is denoted

The evaluation is undefined for y = 0

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.

For example, in the expression the variable n is bound, and the variable x is free. This expression is equivalent to the simpler expression 12 x.

The value for x = 3 is 36, which can be denoted

Syntax versus semantics

[edit]

Syntax

[edit]

An expression is a syntactic construct. It must be well-formed. It can be described somewhat informally as follows: the allowed operators must have the correct number of inputs in the correct places, the characters that make up these inputs must be valid, have a clear order of operations, etc. Strings of symbols that violate the rules of syntax are not well-formed and are not valid mathematical expressions.

For example, in the usual notation of arithmetic, the expression 1 + 2 × 3 is well-formed, but the following expression is not:

.

Semantics

[edit]

Semantics is the study of meaning. Formal semantics is about attaching meaning to expressions.

In algebra, an expression may be used to designate a value, which might depend on values assigned to variables 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 Operations § Calculators).

The semantic rules may declare that certain expressions do not designate any value (for instance when they involve division by 0); such expressions are said to have an undefined value, but they are well-formed expressions nonetheless. 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 to designate an internal direct sum.

Formal definition

[edit]

A well-formed expression in mathematics can be described as part of a formal language, and defined recursively as follows:[2]

The alphabet consists of:

  • A set of variable names: A countably infinite amount of variables used for representing mathematical objects in the domain. (Usually letters like x, or y)
  • A set of operations: Symbols representing 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 well-formed expression (WFE) are as follows:

  • Any constant or variable as defined are the atomic expressions (the simplest WFE's). For instance, the expressions "" or "" are syntactically correct expressions.
  • Let be a metavariable for some n-ary operation over the domain, and let be metavariables for any WFE's.
Then is also a WFE.
For instance, if the domain of discorse is the real numbers, can denote the binary operation +, then is a WFE. Or can be the unary operation , then is as well.

A well-formed expression can be thought as a syntax tree.[3] The leaf nodes are always atomic expressions. Operations and have exactly two child nodes, while operations , and have exactly one. There are countably infinitely many WFE's, however, each WFE has a finite number of nodes.

Lambda calculus

[edit]

Formal languages allow formalizing the concept of well-formed expressions.

In the 1930s, a new type of expressions, called lambda expressions, were introduced by Alonzo Church and Stephen Kleene for formalizing functions and their evaluation. They form the basis for lambda calculus, a formal system used in mathematical logic and the theory of programming languages.

The equivalence of two lambda expressions is undecidable. 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

[edit]

Algebraic expression

[edit]

An algebraic expression is an expression built up from constant, algebraic numbers, variables, and the algebraic operations (addition, subtraction, multiplication, division and exponentiation by an exponent that is a rational number).[4] For example, 3x2 − 2xy + c is an algebraic expression. Since taking the square root is the same as raising to the power 1/2, the following is also an algebraic expression:

See also: Algebraic closure

Computational expression

[edit]

In computer science, an expression is a syntactic entity in a programming language that may be evaluated to determine its value[5] or fail to terminate, in which case the expression is undefined.[6] It is a combination of one or more constants, variables, functions, and operators that the programming language interprets (according to its particular rules of precedence and of association) and computes to produce ("to return", in a stateful environment) another value. This process, for mathematical expressions, is called evaluation. In simple settings, the resulting value is usually one of various primitive types, such as string, boolean, or numerical (such as integer, floating-point, or complex).

Expressions are often contrasted with statements—syntactic entities that have no value (an instruction).

Representation of the expression (8 − 6) × (3 + 1) as a Lisp tree, from a 1985 Master's Thesis[7]

Except for numbers and 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" as an operator and its rows as operands.

See: Computer algebra expression

Logical expression

[edit]

In mathematical logic, a "logical expression" can reffer to either terms or formulas. A term denotes a mathematical object while a formula denotes a mathematical fact. In particular, terms appear as components of a formula. This is analogous to natural language, where a noun phrase refers to an object and a whole sentence refers to a fact.

A first-order term is recursively constructed from constant symbols, variables and function symbols. An expression formed by applying a predicate symbol to an appropriate number of terms is called an atomic formula, which evaluates to true or false in bivalent logics, given an interpretation. For example, is a term built from the constant 1, the variable x, and the binary function symbols and ; it is part of the atomic formula which evaluates to true for each real-numbered value of x.

See also

[edit]

Notes

[edit]
  1. ^ Stoll, Robert R. Set Theory and Logic. San Francisco, CA: Dover Publications. ISBN 978-0-486-63829-4.
  2. ^ C.C. Chang; H. Jerome Keisler (1977). Model Theory. Studies in Logic and the Foundation of Mathematics. Vol. 73. North Holland.; here: Sect.1.3
  3. ^ Hermes, Hans (1973). Introduction to Mathematical Logic. Springer London. ISBN 3540058192. ISSN 1431-4657.; here: Sect.II.1.3
  4. ^ Morris, Christopher G. (1992). Academic Press dictionary of science and technology. Gulf Professional Publishing. p. 74. algebraic expression over a field.
  5. ^ Mitchell, J. (2002). Concepts in Programming Languages. Cambridge: Cambridge University Press, 3.4.1 Statements and Expressions, p. 26
  6. ^ Maurizio Gabbrielli, Simone Martini (2010). Programming Languages - Principles and Paradigms. Springer London, 6.1 Expressions, p. 120
  7. ^ Cassidy, Kevin G. (Dec 1985). The Feasibility of Automatic Storage Reclamation with Concurrent Program Execution in a LISP Environment (PDF) (Master's thesis). Naval Postgraduate School, Monterey/CA. p. 15. ADA165184.

References

[edit]