The standard library defines the vocabulary used by a MathJSON expression. This dictionary is independent of the syntax used to parse/serialize from another language but it defines the meaning of the symbols used in a MathJSON expression.
A library contains definitions for symbols and functions, for example:
Piis a transcendental number whose value is approximately 3.14159265…”
Addfunction is associative, commutative, pure, idempotent and can be applied to arbitrary number of Real or Complex numbers”.
A domain is similar to a type in a traditional programming language.
The domain of a symbol provides some contextual information about this symbol, for example: “x is a positive integer”.
The codomain of a function indicates the set of values that a function maps to, or the domain of the “result” of the function.
Each entry in the symbol dictionary indicate the domain of the symbol, and for functions its codomain.
A MathJSON function such as
Equal can be used for a variety of
purposes. It can be helpful to classify them in some broad categories:
|The result of evaluating an inert function is the function and its arguments. This is more useful than it sounds: it can be used to ‘tag’ an input an indicate how it should be interpreted. Examples:
|A function that takes a variety of inputs and return a new kind of object. Examples:
|A function whose arguments and return value are all numeric. Examples:
|A predicate function returns a boolean. It can evaluate if a proposition is true or false. Examples:
|A predicate whose arguments are also booleans. Examples:
To define a custom syntax, provide custom syntax and custom symbol
dictionaries when creating a
If no custom dictionaries are provided, the default ones are used. They are organized by topic as follow: