Standard Library

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:

For example:

  • Pi is a transcendental number whose value is approximately 3.14159265…
  • The Add function 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 Add, Sin or Equal can be used for a variety of purposes. It can be helpful to classify them in some broad categories:

inert 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: Hold Evaluate Complex LatexString
constructor A function that takes a variety of inputs and return a new kind of object. Examples: Symbol String Interval Range
numeric A function whose arguments and return value are all numeric. Examples: Add Sin Exp Sqrt
predicate A predicate function returns a boolean. It can evaluate if a proposition is true or false. Examples: Equal IsPrime
logical A predicate whose arguments are also booleans. Examples: And Not Or

Custom Library

To define a custom syntax, provide custom syntax and custom symbol dictionaries when creating a ComputeEngine instance.

If no custom dictionaries are provided, the default ones are used. They are organized by topic as follow:

Dictionary Symbols/Functions
Arithmetic Add Multiply Power Exp Log ExponentialE ImaginaryUnit
Calculus Derive Integrate
Collections Sequence List Dictionary Set
Control Structures If Block Loop Sum
Core Let, Set, InverseFunction LatexTokens
Domains Anything Nothing Number Integer
Functions Function Apply Return
Logic And Or Not True False Maybe
Sets Union Intersection EmptySet
Special Functions Erf Gamma Factorial
Styling Delimiter Style
Trigonometry Pi Cos Sin Tan