In mathematics, an expression is a written arrangement of symbols following the context-dependent, syntactic conventions of mathematical notation. Symbols can denote numbers (constants), variables, operations, functions. Other symbols include punctuation signs and brackets (often used for grouping, that is for considering a part of the expression as a single symbol).
Many authors distinguish an expression from a formula, the former denoting a mathematical object, and the latter denoting a statement about mathematical objects.[1] This is analogous to natural language, where a noun phrase refers to an object, and a whole sentence refers to a fact. For example,
8x-5
8x-5\geq3
Expressions can be evaluated or partially evaluated by replacing operations that appear in them with their result. For example, the expression
8 x 2-5
16-5
11.
An expression is often used to define a function, by taking the variables to be arguments, or inputs, of the function, and assigning the output to be the total evaluation of the resulting expression.[2] For example,
x\mapstox2+1
f(x)=x2+1
The use of expressions ranges from the simple:
3+8
8x-5
7{{x}2
x-1 | |
{{x |
2
to the complex:
| ||||
f(a)+\sum | ||||
k=1 |
dk | |
dtk |
\right|t=0f(u(t))
+
1 | |
\int | |
0 |
(1-t)n | |
n! |
dn+1 | |
dtn+1 |
f(u(t))dt.
Many 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 an operation over constants and free variables and whose output is the resulting value of the expression.[3]
For example, if the expression
x/y
x/y|x=10,=2.
The evaluation is undefined for y = 0Two 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. [4] [5] The equivalence between two expressions is called an identity and is often denoted with
\equiv.
See main article: Formal grammar.
See main article: Syntax (logic).
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.[6]
For example, in arithmetic, the expression 1 + 2 × 3 is well-formed, but
x 4)x+,/y
See main article: Semantics and Formal semantics (logic).
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
⊕
A well-formed expression in mathematics can be described as part of a formal language, and defined recursively as follows:[7]
The alphabet consists of:
\varnothing,\{1,2,3\}
With this alphabet, the recursive rules for forming well-formed expression (WFE) are as follows:
2
x
F
\phi1,\phi2,...\phin
Then
F(\phi1,\phi2,...\phin)
For instance, if the domain of discorse is the real numbers,
F
\phi1+\phi2
F
\surd
\sqrt{\phi1}
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)
A well-formed expression can be thought as a syntax tree.[8] The leaf nodes are always atomic expressions. Operations
+
\cup
See main article: Lambda calculus.
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. [9] 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)
An algebraic expression is an expression built up from algebraic constants, variables, and the algebraic operations (addition, subtraction, multiplication, division and exponentiation by a rational number).[10] For example, is an algebraic expression. Since taking the square root is the same as raising to the power, the following is also an algebraic expression:
\sqrt{ | 1-x2 |
1+x2 |
A polynomial expression is an expression built with scalars (numbers of elements of some field), indeterminates, and the operators of addition, multiplication, and exponentiation to nonnegative integer powers; for example
3(x+1)2-xy.
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
3x2-xy+6x+3.
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.
See main article: Expression (computer science). In computer science, an expression is a syntactic entity in a programming language that may be evaluated to determine its value[11] or fail to terminate, in which case the expression is undefined.[12] 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).
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
8x-5\geq3
Expressions are often contrasted with statements—syntactic entities that have no value (an instruction).
Except for numbers and 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 may be represented as an expression with "matrix" as an operator and its rows as operands.
See: Computer algebra expression
In mathematical logic, a "logical expression" can refer 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.
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, and the binary function symbols and ; it is part of the atomic formula which evaluates to true for each real-numbered value of .