Identifiers
The tables that say how each name is spelled in each language.
FUNCTIONS and CONSTANTS hold the canonical names — the ones that appear
inside the AST — and the ROOT_*, NUMEXPR_* and PYTHON_* maps give
each backend’s spelling of them. A canonical name absent from a backend’s map
is how “not supported here” is expressed: rendering it raises ValueError
rather than emitting an approximation.
The *_ALIASES maps go the other way, folding the surface spellings a parser
may see onto one canonical name, which is what makes TMath::ATan2,
atan2 and arctan2 the same function, and e_num, e_euler and
TMath::E() the same constant.
Numeric values for the physical constants come from hepunits, so they
agree with the rest of Scikit-HEP.
For the list of what is actually supported, in a form meant for reading, see Supported Expressions. The tables below are the definitions that page describes; their contents are not reproduced here, since they are long and the guide already lays them out side by side.
- formulate.identifiers.FUNCTIONS
Canonical names of every function formulate knows.
- formulate.identifiers.CONSTANTS
Canonical names of every constant formulate knows. A
Symbolwhose name is in here is a constant; every other symbol is a variable.
- formulate.identifiers.UNARY_OPERATORS
Canonical names of the operators a
UnaryOperatormay use.
- formulate.identifiers.BINARY_OPERATORS
Canonical names of the operators a
BinaryOperatormay use.
- formulate.identifiers.NAMESPACES
Namespace prefixes a function name may carry, lower-cased.
Backend spellings
One map per language, from canonical name to how that language writes it. A
canonical name missing from a map is not supported by that language, and
rendering it raises ValueError.
- formulate.identifiers.ROOT_FUNCTIONS
ROOT’s spelling of each function it supports.
- formulate.identifiers.NUMEXPR_FUNCTIONS
NumExpr’s spelling of each function it supports.
- formulate.identifiers.PYTHON_FUNCTIONS
NumPy’s name for each function it supports, without the
np.prefix, which is added when the expression is rendered.
- formulate.identifiers.ROOT_CONSTANTS
ROOT’s spelling of each constant, usually a
TMathcall.
- formulate.identifiers.NUMEXPR_CONSTANTS
The value substituted for each constant when rendering to NumExpr, which has no symbolic constants of its own.
- formulate.identifiers.PYTHON_CONSTANTS
The value substituted for each constant when rendering to Python.
- formulate.identifiers.ROOT_OPERATOR_SYMBOLS
ROOT’s spelling of each operator. There is no
xor, since ROOT reads^as exponentiation.
- formulate.identifiers.NUMEXPR_OPERATOR_SYMBOLS
NumExpr’s spelling of each operator.
- formulate.identifiers.PYTHON_OPERATOR_SYMBOLS
Python’s spelling of each operator.
invis absent on purpose; seePYTHON_UNARY_FUNCTIONS.
- formulate.identifiers.PYTHON_UNARY_FUNCTIONS
Unary operators Python writes as a function call rather than as a symbol. Takes precedence over
PYTHON_OPERATOR_SYMBOLS.
Aliases
Alternative spellings a parser may encounter, mapped onto one canonical name.
- formulate.identifiers.FUNCTION_ALIASES
Other spellings of a function, mapped onto its canonical name.
- formulate.identifiers.CONSTANTS_ALIASES
Other spellings of a constant, mapped onto its canonical name.
- formulate.identifiers.CONSTANTS_FUNCTION_ALIASES
Constants recognised only in call form, such as
c(). Kept separate so that a barecstays a variable, since short branch names are common.
- formulate.identifiers.FUNCTION_DISPLAY_NAMES
How to name a function in an error message, where its canonical name is internal.