Core

Constants

Symbol Description
All All the possible values apply
Missing A required expression is not present
None None of the possible values apply
Nothing An optional expression is not present
Undefined The result is not defined. For example, the domain() of an unknown symbol is Undefined.
Note that for numbers, the equivalent is NaN (Not a Number) and for booleans, Maybe
Example
["Divide", 2, "Missing"] \[\frac{2}{\unicode{"2B1A}}\]
["List", 2, "Nothing", 3] \[\lbrack 2, ,3 \rbrack\]

Core Functions

FunctionOperation
About

["About", symbol]

Evaluate to a dictionary containing information about a symbol such as its domain, its attributes, its value, etc…

Domain

["Domain", expression]

Evaluate to the domain of expression

Evaluate

["Evaluate", expression]

Apply a sequence of definitions to an expression in order to reduce, simplify and calculate its value. Overrides Hold and hold attributes of a function.

Error

["Error", expression, string]inert

Tag an expression that could not be interpreted correctly. It may have a syntax error, a reference to an unknown symbol or function or some other problem.

Hold

["Hold", expression]inert

Tag an expression that should be kept in an unevaluated form

Html

["Html", expr]

Evaluate to a string which is the HTML markup corresponding to the expression. If the head of expr is LatexString, Latex or LatexTokens, renders the LaTeX to HTML markup

Identity

["Identity", expression]

Evaluate to its argument

InverseFunction

["InverseFunction", expression]

Evaluate to the inverse function of its argument for example Arcsin for Sin

Latex

["Latex", expr]

Evaluate to a LatexString which is the expression serialized to LaTeX

LatexString

["LatexString", string]inert

Tag a string as a LaTeX string

LatexTokens

["LatexTokens", …token[]]

Evaluate to a LatexString made of the concatenation of the token arguments

Parse

["Parse", expr]

If expr is a LatexString or LatexTokens, evaluate to a MathJSON expression corresponding to the LaTeX string.

String

["String", …expr[]]constructor

Evaluate to a string made from the concatenation of the arguments converted to string

Symbol

["Symbol", …expr[]]constructor

Evaluate to a new symbol made of a concatenation of the arguments.

For example `["Symbol", "x", 2] -> "x2"

Example
["InverseFunction", "Sin"] \[ \sin^{-1} \]

Styling Functions

The functions in this section represent a visual difference that is not usually material to the interpretation of an expression such as text color and size or other typographic variations.

FunctionOperation
Style

["Style", expr, css]inert

Apply CSS styles to an expression

Delimiter

["Delimiter", expr]inert

["Delimiter", expr, sep]

["Delimiter", expr, open, close]

["Delimiter", expr, open, sep, close]

Display expr wrapped in a delimiter.

Lambda

["Lambda", variables:List, expression]

Create a Lambda-function, also called anonymous function.

The first argument is a symbol or a list of symbols which are the bound variables (parameters) of the Lambda-function.

The second argument is an expression expressed as a function of the bound variables of the Lambda-function.

To apply a Lambda-function to some arguments, use:

Lambda([x], x * x)(3)
// ➔ 9

You can avoid naming the parameters by using the following shorthands:

  • _ or _1 : the first argument
  • _2 : the second argument
  • _3 : the third argument, etc…
  • __: the sequence of arguments, so Length(__) is the number of arguments
Lambda(_ * _)(4)
// ➔ 16

You can assign a Lambda expression to a symbol for later use:

cube = Lambda(_ * _ * _)
cube(5)
// ➔ 125

Parse, Latex, LatexTokens and LatexString

["Latex", expr ]

  • expr: a MathJSON expression
  • Returns a LaTeX string representing the expression.
["Latex", ["Divide", "Pi", 2]]
// ➔ "'\frac{\pi}{2}'"

["LatexTokens", token-1, token-2, …token-n]

The arguments token-n are interpreted as LaTeX tokens:

Token
<{> begin group
<}> end group
<space> blank space
<$$> display mode shift
<$> inline mode shift
#0-#9 argument
#? placeholder
string that starts with / a LaTeX command
other strings ordinary symbols
["LatexTokens", "'\\frac'", "'<{>'", "'pi'", "'<}>'", "'<{>'", 2, "'<}>'"]
// ➔ "'\frac{\pi}{2}'"

See: TeX:289

This function can be returned when the parser fails to parse a sequence of LaTeX tokens.

Piecewise

Prime

MathJSON LaTeX
["Prime", "f"] f^\prime
["Prime", "f", 2] f^\doubleprime

Superscripts and Subscripts

These functions are all inert functions, that is they evaluate to themselves.

Function Description
Subminus \[ x_- \]
Subplus \[ x_+\]
Subscript \[ x_{n} \]
Substar \[ x_*\]
Superdagger \[ x^\dagger\]
Superminus \[ x^-\]
Superplus \[ x^+\]
Superstar \[ x^*\] When the argument is a complex number, indicate the conjugate.