HOME

TheInfoList



OR:

In
mathematics Mathematics is a field of study that discovers and organizes methods, Mathematical theory, theories and theorems that are developed and Mathematical proof, proved for the needs of empirical sciences and mathematics itself. There are many ar ...
, a ternary operation is an ''n''-
ary ARY may stand for: * Abdul Razzak Yaqoob, a Pakistani expatriate businessman * Andre Romelle Young, real name of Dr. Dre * Ary and the Secret of Seasons, an action adventure video game * ARY Digital, a Pakistani television network * ARY Digital Net ...
operation Operation or Operations may refer to: Arts, entertainment and media * ''Operation'' (game), a battery-operated board game that challenges dexterity * Operation (music), a term used in musical set theory * ''Operations'' (magazine), Multi-Man ...
with ''n'' = 3. A ternary operation on a
set Set, The Set, SET or SETS may refer to: Science, technology, and mathematics Mathematics *Set (mathematics), a collection of elements *Category of sets, the category whose objects and morphisms are sets and total functions, respectively Electro ...
''A'' takes any given three elements of ''A'' and combines them to form a single element of ''A''. In
computer science Computer science is the study of computation, information, and automation. Computer science spans Theoretical computer science, theoretical disciplines (such as algorithms, theory of computation, and information theory) to Applied science, ...
, a ternary operator is an
operator Operator may refer to: Mathematics * A symbol indicating a mathematical operation * Logical operator or logical connective in mathematical logic * Operator (mathematics), mapping that acts on elements of a space to produce elements of another sp ...
that takes three
arguments An argument is a series of sentences, statements, or propositions some of which are called premises and one is the conclusion. The purpose of an argument is to give reasons for one's conclusion via justification, explanation, and/or persua ...
as input and returns one output.


Examples

The
function Function or functionality may refer to: Computing * Function key, a type of key on computer keyboards * Function model, a structured representation of processes in a system * Function object or functor or functionoid, a concept of object-orie ...
T(a, b, c) = ab + c is an example of a ternary operation on the
integer An integer is the number zero (0), a positive natural number (1, 2, 3, ...), or the negation of a positive natural number (−1, −2, −3, ...). The negations or additive inverses of the positive natural numbers are referred to as negative in ...
s (or on any structure where + and \times are both defined). Properties of this ternary operation have been used to define
planar ternary ring In mathematics, an algebraic structure (R,T) consisting of a non-empty set R and a ternary mapping T \colon R^3 \to R \, may be called a ternary system. A planar ternary ring (PTR) or ternary field is special type of ternary system used by Marsha ...
s in the foundations of
projective geometry In mathematics, projective geometry is the study of geometric properties that are invariant with respect to projective transformations. This means that, compared to elementary Euclidean geometry, projective geometry has a different setting (''p ...
. In the
Euclidean plane In mathematics, a Euclidean plane is a Euclidean space of Two-dimensional space, dimension two, denoted \textbf^2 or \mathbb^2. It is a geometric space in which two real numbers are required to determine the position (geometry), position of eac ...
with points ''a'', ''b'', ''c'' referred to an origin, the ternary operation , b, c= a - b + c has been used to define free vectors. Since (''abc'') = ''d'' implies ''b'' – ''a'' = ''c'' – ''d'', the
directed line segment In geometry, a line segment is a part of a straight line that is bounded by two distinct endpoints (its extreme points), and contains every point on the line that is between its endpoints. It is a special case of an '' arc'', with zero curvatu ...
s ''b'' – ''a'' and ''c'' – ''d'' are equipollent and are associated with the same free vector. Any three points in the plane ''a, b, c'' thus determine a
parallelogram In Euclidean geometry, a parallelogram is a simple polygon, simple (non-list of self-intersecting polygons, self-intersecting) quadrilateral with two pairs of Parallel (geometry), parallel sides. The opposite or facing sides of a parallelogram a ...
with ''d'' at the fourth vertex. In
projective geometry In mathematics, projective geometry is the study of geometric properties that are invariant with respect to projective transformations. This means that, compared to elementary Euclidean geometry, projective geometry has a different setting (''p ...
, the process of finding a
projective harmonic conjugate In projective geometry, the harmonic conjugate point of a point on the real projective line with respect to two other points is defined by the following construction: :Given three collinear points , let be a point not lying on their join and le ...
is a ternary operation on three points. In the diagram, points ''A'', ''B'' and ''P'' determine point ''V'', the harmonic conjugate of ''P'' with respect to ''A'' and ''B''. Point ''R'' and the line through ''P'' can be selected arbitrarily, determining ''C'' and ''D''. Drawing ''AC'' and ''BD'' produces the intersection ''Q'', and ''RQ'' then yields ''V''. Suppose ''A'' and ''B'' are given sets and \mathcal(A, B) is the collection of
binary relation In mathematics, a binary relation associates some elements of one Set (mathematics), set called the ''domain'' with some elements of another set called the ''codomain''. Precisely, a binary relation over sets X and Y is a set of ordered pairs ...
s between ''A'' and ''B''.
Composition of relations In the mathematics of binary relations, the composition of relations is the forming of a new binary relation from two given binary relations ''R'' and ''S''. In the calculus of relations, the composition of relations is called relative multiplica ...
is always defined when ''A'' = ''B'', but otherwise a ternary composition can be defined by , q, r= p q^T r where q^T is the
converse relation In mathematics, the converse of a binary relation is the relation that occurs when the order of the elements is switched in the relation. For example, the converse of the relation 'child of' is the relation 'parent of'. In formal terms ...
of ''q''. Properties of this ternary relation have been used to set the axioms for a heap. In
Boolean algebra In mathematics and mathematical logic, Boolean algebra is a branch of algebra. It differs from elementary algebra in two ways. First, the values of the variable (mathematics), variables are the truth values ''true'' and ''false'', usually denot ...
, T(A,B,C) = AC+(1-A)B defines the formula (A \lor B) \land (\lnot A \lor C).


Computer science

In computer science, a ternary operator is an
operator Operator may refer to: Mathematics * A symbol indicating a mathematical operation * Logical operator or logical connective in mathematical logic * Operator (mathematics), mapping that acts on elements of a space to produce elements of another sp ...
that takes three arguments (or operands). The arguments and result can be of different types. Many
programming language A programming language is a system of notation for writing computer programs. Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
s that use C-like syntax feature a ternary operator, ?:, which defines a
conditional expression In computer science, conditionals (that is, conditional statements, conditional expressions and conditional constructs) are programming language constructs that perform different computations or actions or return different values depending on t ...
. In some languages, this operator is referred to as the ''conditional operator''. In
Python Python may refer to: Snakes * Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia ** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia * Python (mythology), a mythical serpent Computing * Python (prog ...
, the ternary conditional operator reads x if C else y. Python also supports ternary operations called
array slicing In computer programming, array slicing is an operation that extracts a subset of elements from an array and packages them as another array, possibly in a different dimension from the original. Common examples of array slicing are extracting a ...
, e.g. a :c/code> return an array where the first element is a /code> and last element is a -1/code>.
OCaml OCaml ( , formerly Objective Caml) is a General-purpose programming language, general-purpose, High-level programming language, high-level, Comparison of multi-paradigm programming languages, multi-paradigm programming language which extends the ...
expressions provide ternary operations against records, arrays, and strings: a. -c would mean the string a where index b has value c. The multiply–accumulate operation is another ternary operator. Another example of a ternary operator is ''between'', as used in
SQL Structured Query Language (SQL) (pronounced ''S-Q-L''; or alternatively as "sequel") is a domain-specific language used to manage data, especially in a relational database management system (RDBMS). It is particularly useful in handling s ...
. The
Icon programming language Icon is a very high-level programming language based on the concept of "goal-directed execution" in which an expression in code returns "success" along with a result, or a "failure", indicating that there is no valid result. The success and fail ...
has a "to-by" ternary operator: the expression 1 to 10 by 2 generates the odd integers from 1 through 9. In Excel formulae, the form is =if(C, x, y).


See also

*
Unary operation In mathematics, a unary operation is an operation with only one operand, i.e. a single input. This is in contrast to ''binary operations'', which use two operands. An example is any function , where is a set; the function is a unary operation ...
*
Unary function In mathematics, a unary function is a function that takes one argument. A unary operator belongs to a subset of unary functions, in that its codomain coincides with its domain. In contrast, a unary function's domain need not coincide with its r ...
*
Binary operation In mathematics, a binary operation or dyadic operation is a rule for combining two elements (called operands) to produce another element. More formally, a binary operation is an operation of arity two. More specifically, a binary operation ...
*
Iterated binary operation In mathematics, an iterated binary operation is an extension of a binary operation on a set ''S'' to a function on finite sequences of elements of ''S'' through repeated application. Common examples include the extension of the addition operation ...
*
Binary function In mathematics, a binary function (also called bivariate function, or function of two variables) is a function that takes two inputs. Precisely stated, a function f is binary if there exists sets X, Y, Z such that :\,f \colon X \times Y \right ...
* Median algebra or
Majority function In Boolean logic, the majority function (also called the median operator) is the Boolean function that evaluates to false when half or more arguments are false and true otherwise, i.e. the value of the function equals the value of the majority of t ...
*
Ternary conditional operator In computer programming, the ternary conditional operator is a ternary operator that is part of the syntax for basic conditional expressions in several programming languages. It is commonly referred to as the conditional operator, conditional ...
for a list of ternary operators in computer programming languages * Ternary
Exclusive or Exclusive or, exclusive disjunction, exclusive alternation, logical non-equivalence, or logical inequality is a logical operator whose negation is the logical biconditional. With two inputs, XOR is true if and only if the inputs differ (on ...
* Ternary equivalence relation


References


External links

*{{Commons category-inline, Ternary operations