Basic http://www.openmath.org/OpenMath/CDs/Basic 31/Dec/1997 official The basic semantic dictionary that every OM compliant implementation should accept. Pi The mathematical constant Pi, approximately 3.14159 Constant () -> Intersection( real, Non(rational), Non(algebraic) ) Pi = 3.1415926535897932385, "20-digit approximation" Pi = 4*arctan(1) Pi = 16*arctan(1/5)-4*arctan(1/239), "Machin's formula" \pi = 16 \arctan(1/5) - 4 \arctan (1/239) Pi 16 1 5 4 1 239 true The boolean value true Constant false The boolean value false Constant infinity A value greater than any computable value. Infinity characterizes the positive real infinity. Negative infinity is represented as -infinity. Constant a < infinity, "for any a which is not infinity itself" a <= infinity, "for any a which is not infinity itself" NaN The result of an ill-posed floating computation. OpenMath borrows the definition of NaN from the IEEE standard for floating point representations. Constant 0/0 = NaN NaN+a = NaN, "for any a which is not infinity" NaN*a = NaN, "for any a which is not infinity or 0" NaN-a = NaN, "for any a which is not infinity" NaN/a = NaN, "for any a which is not 0" ImagUnit The imaginary unit, the square root of -1. The number (0,1) in the pair-representation of complex numbers. The name "i" has been avoided, as it causes too many clashes with the variable "i" and thus renaming would be often required. Constant (-1)^(1/2) = ImagUnit ImagUnit^2+1=0 exp(ImagUnit*Pi)+1=0 i = \sqrt{-1} ImagUnit -1 1 2 i^2+1 = 0 ImagUnit 2 1 0 e^{i\pi}+1 = 0 ImagUnit Pi 1 0 e The base of the natural logarithms. Also called Euler's constant. Also called the base of the Napierian logarithms. Although e^x = exp(x), for mathematical purposes the functional form is preferred, while for displaying purposes, the exponential form is preferred. Constant e=exp(1) e^x = exp(x) e = limit( (1+1/n)^n, n, infinity ) e = 2.71828182845904523536028747135, "30-digit approximation" e^x = \lim_{n \rightarrow \infty} (1+x/n)^n x 1 1 n n n infinity + plus The addition operator of any group Binary, Operator Associative, Commutative, Error( "invalid cancellation of infinity" ) (complex complex) -> complex (real real) -> real (rational rational) -> rational (integer integer) -> integer (symbolic symbolic) -> symbolic a+b=b+a, commutativity a+(b+c)=(a+b)+c, associativity a+0=a, identity 0+a=a, identity a+(b+c)=(a+b)+c a b c a b c + plus The unary addition operator. It behaves like the identity operator. Unary, Operator complex -> complex real -> real rational -> rational integer -> integer symbolic -> symbolic +a=a * times The multiplication operator of any commutative ring Binary, Operator Associative, Commutative (complex complex) -> complex (real real) -> real (rational rational) -> rational (integer integer) -> integer (symbolic symbolic) -> symbolic a*b=b*a, commutativity a*(b*c)=(a*b)*c, associativity a*1=a, identity 1*a=a, identity a*0=0 0*a=0 - minus The subtraction operator of any group, defined as a-b = a + inverse(b) Binary, Operator Error( "invalid cancellation of infinity" ) (complex complex) -> complex (real real) -> real (rational rational) -> rational (integer integer) -> integer (symbolic symbolic) -> symbolic a-(b+c)=a-b-c - minus The unary minus operator. The inverse operator of a group. Unary, Operator complex -> complex real -> real rational -> rational integer -> integer symbolic -> symbolic a+(-a)=0 / over The division operator of any commutative field, defined as the multiplication by the multiplicative inverse of the second argument. Binary, Operator Error( "division by zero" ), Error( "invalid cancellation of infinity" ) (complex complex) -> complex (real real) -> real (rational rational) -> rational (integer integer) -> rational (symbolic symbolic) -> symbolic ^ power The powering operator Binary, Operator Error( "division by zero" ), Error( "0^0 is undefined" ) (complex complex) -> complex (real real) -> complex (rational rational) -> complex (rational integer) -> rational (integer integer) -> rational (symbolic symbolic) -> symbolic a^0=1 a^1=a 1^a=1 apply Explicit use of function application. Apply a function to a sequence of (0 or more) arguments. The first argument of apply is taken as a function, and this function is applied over the second, third, etc. arguments of apply. Symbolically: apply( f, a, b, c, .... ) == f( a, b, c, ... ) Function application is provided by the encoding, so in general it is not necessary to use apply. For example, sin(x) is encoded as in SGML and as (sin x) in the lisp-like functional encoding. Apply is needed in two special cases: When the name of the function clashes with some name used by the encoding or by OpenMath, or when the function to be applied is not a symbol, and hence the SGML encoding will not be able to produce valid tags. Nary apply( f ) = f( ) apply( f, a ) = f( a ) apply( f, a, b ) = f( a, b ) apply( f, a, b, c ) = f( a, b, c ) * NC A B lambda The operation of lambda calculus that makes a function from an expression and a variable. The definition at this level uses only one variable. Lambda is a binary function, where the first argument is the variable and the second argument is a the expression. Lambda( x, F ) is written as \lambda x [F] in the lambda calculus literature. The lambda function can be viewed as the inverse of function application. Although the expression F may contain x, the lambda expression is interpreted to be free of x. That is, the x variable is a variable local to the environment of the definition of the function or operator. Formally, lambda(x,F) is free of x, and any substitutions, evaluations or tests for x in lambda(x,F) should not happen. A lambda expression on an arbitrary function applied to a simple argument is equivalent to the arbitrary function. E.g. lambda(x, f(x)) == f. This is a common shortcut. Binary apply( lambda(x, F), x ) = F, "for any expression F and symbol x" lambda(x, f(x)) = f x x from Interpretation of a name (typically a function, constant or operator name) from a specific CD. This is necessary only in special circumstances, when a name is defined in more than one CD. When a name is used in an OpenMath expression, the usage is associated with a hierarchy of CD definitions. The interpretation of an unqualified name is that of the first CD in which appears. For example, suppose that the multiplication operator is used. Assume that we are using the "Basic" CD and on top of this, the "NC" (non-commutative) CD. Both define the operator "*". An unqualified reference to "*" will refer to the definition of "Basic". To refer to the NC "*" the form: from("*",Basic) should be used. Binary, Function (symbol symbol) -> constructor and The boolean conjunction Binary, Function (boolean boolean) -> boolean (symbolic symbolic) -> symbolic and(true, true) = true and(true, false) = false and(false, true) = false and(false, false) = false or The boolean disjunction Binary, Function (boolean boolean) -> boolean (symbolic symbolic) -> symbolic or(true, true) = true or(true, false) = true or(false, true) = true or(false, false) = false xor The boolean exclusive disjunction Binary, Function (boolean boolean) -> boolean (symbolic symbolic) -> symbolic xor(true, true) = false xor(true, false) = true xor(false, true) = true xor(false, false) = false not The boolean negation Unary, Function (boolean) -> integer (symbolic) -> symbolic not(true) = false not(false) = false union The union of two sets Binary, Function (set set) -> set intersection The intersection of two sets Binary, Function (set set) -> set setdiff The difference of two sets i.e. the set of the members of the first that are not members of the second. Binary, Function (set set) -> set member The membership testing operation (also commonly called "in" or "including"). Returns true if the first argument is part of the second argument. The second argument must be a set. Binary, Function (symbolic set) -> boolean IntegerQuotient Integer quotient, the result of integer division. For arguments a and b, it returns q, where a = b*q+r, |r| < |b| and a*r ≥ 0 (or the sign of r is the same as the sign of a). Binary, Function Error( "division by zero" ) (integer integer) -> integer (symbolic symbolic) -> symbolic a = b*IntegerQuotient(a,b) + IntegerRemainder(a,b) IntegerRemainder Integer remainder, the result of integer division. For arguments a and b, it returns r, where a = b*q+r, |r| < |b| and a*r ≥ 0 (the sign of r is the same as the sign of a when both are non-zero). Binary, Function Error( "division by zero" ) (integer integer) -> integer (symbolic symbolic) -> symbolic a = b*IntegerQuotient(a,b) + IntegerRemainder(a,b) IntegerGcd The integer greatest common divisor of all its arguments. The function is extended to work with 0 arguments (returns 0) and with one argument (returns the argument). Nary, Function Associative, Commutative Sequence(integer) -> integer Sequence(symbolic) -> symbolic IntegerGcd() = 0 IntegerGcd(a) = a IntegerGcd(a,b) = IntegerGcd(b,a) IntegerGcd(a,b,c) = IntegerGcd(a,IntegerGcd(b,c)) exp The exponential function M. Abramowitz and I. Stegun, Handbook of Mathematical Functions, [4.2] Unary, Function real -> real symbolic -> symbolic exp(0) = 1 exp(x) = e^x exp(x) = limit( (1+x/n)^n, n, infinity ) ln The logarithmic function. Also called the natural logarithm. The inverse of the exponential function. M. Abramowitz and I. Stegun, Handbook of Mathematical Functions, [4.1] Unary, Function Error( "logarithm has a singularity at 0" ) Intersect(real,positive) -> real symbolic -> symbolic ln(1) = 0 ln(exp(x)) = x, "for real x" exp(ln(x)) = x, always sin The circular trigonometric function sine M. Abramowitz and I. Stegun, Handbook of Mathematical Functions, [4.3] Unary, Function real -> real symbolic -> symbolic sin(0) = 0 sin(integer*Pi) = 0 sin((Z+1/2)*Pi) = (-1)^Z, "for integer Z" -1 <= sin(real) sin(real) <= 1 sin(3*x)=-4*sin(x)^3+3*sin(x), "triple angle formula" ditto, [4.3.27] cos The cosine function. M. Abramowitz and I. Stegun, Handbook of Mathematical Functions, [4.3] Unary, Function real -> real symbolic -> symbolic cos(0) = 1 cos(integer*Pi+Pi/2) = 0 cos(Z*Pi) = (-1)^Z, "for integer Z" -1 <= cos(real) cos(real) <= 1 tan The tangent function. M. Abramowitz and I. Stegun, Handbook of Mathematical Functions, [4.3] Unary, Function real -> real symbolic -> symbolic tan(integer*Pi) = 0 tan(x) = sin(x)/cos(x) cot The cotangent function. M. Abramowitz and I. Stegun, Handbook of Mathematical Functions, [4.3] Unary, Function real -> real symbolic -> symbolic cot(integer*Pi+Pi/2) = 0 cot(x) = cos(x)/sin(x) sec The secant function. M. Abramowitz and I. Stegun, Handbook of Mathematical Functions, [4.3] Unary, Function real -> real symbolic -> symbolic sec(x) = 1/cos(x) csc The cosecant function. M. Abramowitz and I. Stegun, Handbook of Mathematical Functions, [4.3] Unary, Function real -> real symbolic -> symbolic csc(x) = 1/sin(x) arcsin The inverse of the sine function. M. Abramowitz and I. Stegun, Handbook of Mathematical Functions, [4.4] Unary, Function real -> real symbolic -> symbolic sin(arcsin(x)) = x arcsin(sin(x)) = x, "for x between -Pi/2 and Pi/2" arccos The inverse of the cosine function. M. Abramowitz and I. Stegun, Handbook of Mathematical Functions, [4.4] Unary, Function real -> real symbolic -> symbolic cos(arccos(x)) = x arccos(cos(x)) = x, "for x between 0 and Pi" arctan The inverse of the tangent function. M. Abramowitz and I. Stegun, Handbook of Mathematical Functions, [4.4] Unary, Function real -> real symbolic -> symbolic tan(arctan(x)) = x arctan(tan(x)) = x, "for x between -Pi/2 and Pi/2" arccot The inverse of the cotangent function. M. Abramowitz and I. Stegun, Handbook of Mathematical Functions, [4.4] Unary, Function real -> real symbolic -> symbolic cot(arccot(x)) = x arcsec The inverse of the secant function. M. Abramowitz and I. Stegun, Handbook of Mathematical Functions, [4.4] Unary, Function real -> real symbolic -> symbolic sec(arcsec(x)) = x arccsc The inverse of the cosecant function. M. Abramowitz and I. Stegun, Handbook of Mathematical Functions, [4.4] Unary, Function real -> real symbolic -> symbolic csc(arccsc(x)) = x ExpandedForm The expanded form of a mathematical object. The formal definition of an expanded form is that every occurrence of a*(b+c) is replaced by a*b+a*c. This is expansion with respect to arithmetic operators (including integer powers). ExpandedForm defines a mathematical object with certain properties, it does not necessarily imply performing an operation over its argument. Unary, Function symbolic -> symbolic ExpandedForm( a*(b+c) ) = a*b+a*c ExpandedForm( (x+y)^2 ) = x^2 + 2*x*y + y^2 diff The derivative of its first argument evaluated at the second argument. The first argument is a unary function or a unary operator. A lambda expression is naturally a valid first argument. The result of the differentiation is an operator, which is then immediately applied to the second argument. This is necessary to be able to express concepts like, for example, the derivative of an unknown function at 0. diff( sin, x ) = cos(x) diff( lambda(x, sin(x)), x ) = cos(x) diff( lambda(x, x^2+3), x ) = 2*x diff( lambda(x, x^2+3), a ) = 2*a diff( lambda(x, x^2+3), 1 ) = 2 The following common expressions in the math literature are encoded as follows (using a latex notation for mathematics) \frac{\partial f}{\partial x} == diff( f, x ) f^{\prime}(x) == diff( f, x ) f^{\prime}(0) == diff( f, 0 ) f^{\prime} == lambda( x, diff(f,x) ) Binary, Function (symbolic symbol) -> symbolic diff The unary differentiation function. This is identical to the diff function with two arguments, except that it does not evaluate the resulting expression at the point, it returns the operator. It is ideally used for repeated differentiation or when we are interested in the differentiated operator. The following relation defines the unary diff formally: diff( f ) == lambda( x, diff(f,x) ) Examples: diff( sin ) = cos diff( lambda(x, sin(x)) ) = cos diff( lambda(x, x^2+3) ) = lambda(x, 2*x) The following common expressions in the math literature are encoded as follows (using a latex notation for mathematics) f^{\prime} == diff(f) f^{\prime \prime} == diff(diff(f)) f^{\prime \prime}x == diff(diff(f),x) f^{\prime \prime \prime} == diff(diff(diff(f))) Unary, Function symbolic -> symbolic integral The indefinite integral of a unary operator or function (first argument) evaluated at the second argument. integral( cos, x ) = sin(x) integral( lambda(x, cos(x)), x ) = sin(x) integral( lambda(x, 2*x^2+3), x ) = x^3+3*x integral( lambda(x, 2*x^2+3), y ) = y^3+3*y integral( lambda(x, 2*x^2+3), a+b ) = (a+b)^3+3*(a+b) The following common expressions in the math literature are encoded as follows (using a latex notation for mathematics) \int x dx == integral(lambda(x,x),x) Binary , Function (symbolic symbol) -> symbolic integral The unary integration function. This is identical to the integral function with two arguments, except that it does not evaluate the resulting expression at the point, it returns the operator. It is ideally used for repeated integration or when we are interested in the integrated operator. The following relation defines the unary integral formally: integral( f ) == lambda( x, integral(f,x) ) integral( cos ) = sin integral( lambda(x, cos(x)) ) = sin integral( lambda(x, 2*x^2+3) ) = lambda(x, x^3+3*x) The following common expressions in the math literature are encoded as follows (using a latex notation for mathematics) \int f == integral(f) \int \int f == integral(integral(f)) Unary , Function symbolic -> symbolic defint The definite integral of a unary operator or function (first argument) evaluated between the second and third argument. integral( cos, 0, Pi ) = sin(Pi)-sin(0) = 0 integral( lambda(x, cos(x)), 0, x ) = sin(x) integral( lambda(x, 2*x^2+3), 0, x ) = x^3+3*x integral( lambda(x, 2*x^2+3), 0, 1 ) = 4 The following common expressions in the math literature are encoded as follows (using a latex notation for mathematics) \int_0^a x^2 dx == defint( lambda(x, x^2), 0, a ) \int_0^x x^2 dx == defint( lambda(x, x^2), 0, x ) \int_0^x t^2 dt == defint( lambda(t, t^2), 0, x ) \int_0^x \sin == defint( sin, 0, x ) Binary , Function = equal The equality operator. Binary, Operator Commutative (symbolic symbolic) -> boolean <> unequal The in-equality operator. Binary, Operator Commutative (symbolic symbolic) -> boolean < less The less-than operator Binary, Operator (symbolic symbolic) -> boolean <= lessequal The less-or-equal operator Binary, Operator (symbolic symbolic) -> boolean > greater The greater-than operator Binary, Operator (symbolic symbolic) -> boolean >= greaterequal The greater-or-equal operator Binary, Operator (symbolic symbolic) -> boolean list An ordered list of elements. The list structure does not impose any restriction on the number or type of the elements. Just the ordering and number of elements is preserved. Many systems will use alternative notations to denote lists, for example [a,b,c...], or (a,b,c,...) or {a,b,c,....}. Nicklaus Wirth, Algorithms + Data Structures = Programs, Prentice-Hall, [4.3] The list may be homogeneous (all elements of the same type) or inhomogeneous (elements can be of different types). Nary, Constructor 2 3 5 7 11 13 17 19 23 29 set An unordered list of elements. The set structure does not impose any restriction on the number or type of the elements. Repeated elements are discarded from a set. Many systems will use alternative notations to denote sets, for example {a,b,c,....}. The set may be homogeneous (all elements of the same type) or inhomogeneous (elements can be of different types). Nary, Constructor 1 2 3 3 3 2 1 2 3 array The computer science notion of an array, that is a data structure with n dimensions, each dimension with its own range of valid values where elements can be stored and retrieved. Intuitively, a one dimensional array, e.g. array( segment(1,n), [....] ) is equivalent to a vector. A two-dimensional array, e.g. array( segment(1,m), segment(1,n), [ [...], [....], ...] ) is equivalent to a matrix. An n-dimensional array has n+1 arguments. The first n arguments are integer segments or ranges which define the lower and upper bound of each dimension. The last argument is a list or a list of list or an n-iterated list of lists containing the values stored in the array. if the last argument is missing, it is assumed that the array entries are undefined. Nary, Constructor 1 10 2 3 5 7 11 13 17 19 23 29 1 100 1 100 segment A segment (or range or interval) of values, defined by two limiting values, the lowest and the highest. A segment is typically used in the definition of arrays, definite integration and summation, and every time that a range of values needs to be defined. Some programming languages use the notation a .. b for segments. Segments are closed, i.e. the end points are included in the segment. Binary, Constructor select The selection operation of an array, list, set or any other non-primitive object. Select has at least two arguments, the first argument is the object to be selected from, and the rest are the integer selectors. Select with n arguments (n>2) can only be applied to arrays with n-1 dimensions. The normal representation of select is not in the form of a function, but as a subscript (e.g. a_i in latex) or in the form of an index (a[i] in many programming languages). E.g. select(a,i,j,...) == a[i,j,...] The second, third, etc arguments of select are called the selectors. When the selector is a negative integer, it is interpreted as its complement counted from the left to the right. Hence if a is a list, a[-1] is the last element of a. a[-3] is the third element from left to right. In general, a[-k] == a[ length(a)+1-k ]. For the binary case, when the selector is 0, select has the value of the function or operator at the top of the expression tree. Nary (anything integer) -> anything (array integer integer) -> anything (array integer integer integer) -> anything select(a,k) = a[k] select(a,i,j) = a[i,j] select(a+b,1) = a length The length of a structure, typically a list set or array. Every OpenMath object has a length, and in general, the length is the arity of the function/ operator at the top of the expression tree. The length of symbols and strings is the number of characters in their encoding. The length of integers and floating point numbers is not defined here. Unary symbolic -> integer structure -> integer length(list(1,2,3)) = 3 length(list()) = 0 length(a+b) = 2 length("abc") = 3 sin(x)^2+cos(x)^2-1=0, "Invariant relation followed by sin and cos" M. Abramowitz and I. Stegun, Handbook of Mathematical Functions [4.3.10] sin(Z*Pi)=0, "for any integer Z" exp(ImagUnit*Pi) + 1 = 0, "Identity linking ImagUnit, Pi, 0 and 1" ditto, [4.2.26] sin(2*x) = 2*sin(x)*cos(x), "sine duplicating formula" csc(x) = 1/sin(x) sec(x) = 1/cos(x) tan(x) = sin(x)/cos(x) cot(x) = 1/tan(x)