Expressions
Building, reading from math, inspecting, substituting into, simplifying and evaluating expressions and equations.
| Operation | Kind | Bindings | Summary |
|---|---|---|---|
contains | function | TypeScript, Python, Rust, Go | Check if an expression contains a specific variable |
evaluate | function | Python, Rust, Go | Evaluate a scalar AST expression against a dict of float variable bindings. |
expand | function | Python, Go | Public alias for expand_document using the spec’s spelling (esm-spec §9.6.4 rule 2). |
free_variables | function | Julia, TypeScript, Python, Rust, Go | Extract all free (unbound) variable names from an expression. |
parse_math | function | Julia, TypeScript, Python, Rust, Go | Read one expression, or one equation, written as math under a set of declared names: LaTeX for :markdown (Lean Math.parseLatex), Typst math for :typst (Math.parseTypst). |
simplify | function | Julia, TypeScript, Python, Rust, Go | Perform constant folding and algebraic simplification on an expression. |
substitute | function | Julia, TypeScript, Python, Rust, Go | Replace every variable named in bindings with its replacement expression, throughout expr (including faq bodies, filter predicates, integral bounds and every other… |
substitute_in_equations | function | Julia, TypeScript, Go | Apply substitutions across all equations in a model. |
substitute_in_model | function | TypeScript, Python, Rust, Go | Apply substitution across an ENTIRE model, not just its equations. |
substitute_in_model_with_context | function | Rust, Go | substitute_in_model with scoped reference resolution. |
substitute_in_reaction_system | function | TypeScript, Python, Rust, Go | Apply substitution across all rate expressions in a reaction system. |
substitute_in_reaction_system_with_context | function | Rust, Go | substitute_in_reaction_system with scoped reference resolution. |
substitute_with_context | function | Rust, Go | Substitute variables in an expression with scoped reference resolution (esm-spec §2.3.3). |
expr | type | Python, Rust | An expression (esm-spec §4): a numeric literal (int or float), a variable or parameter reference (str), or an operator node (ExprNode) whose args are themselves… |
expr_node | type | Python, Go | A node in an expression tree. |