Evaluation and constants
Symi distinguishes construction, symbolic execution, direct eager evaluation, and host-language truth queries.
| Operation | Result |
|---|---|
| comparison or Boolean constructor | symbolic relation or formula |
evaluate_truth(predicate) |
exact three-valued host result |
predicate.execute() |
symbolic logical_true, logical_false, or an unevaluated expression |
simplify_logical(predicate) |
logical form simplification, not a host Boolean conversion |
limit(...) |
deferred limit expression |
evaluate_limit(...) |
explicitly eager limit computation |
derivative(...) |
deferred derivative expression |
differentiate(...) |
eager differentiation |
integral(...) |
deferred integral expression |
integrate(...) |
eager integration |
Three-valued results are True, False, or None in Python;
true, false, or null in the JavaScript facade; and TruthValue in the
Rust facade. Unknown means the proposition was not proved or disproved. It is
not false and does not indicate invalid input.
execute recursively evaluates executable symbolic forms. It is the uniform
way to evaluate a deferred derivative, integral, limit, sum, product, or
decidable predicate while retaining a symbolic result when exact
evaluation declines.
Constants#
| Constant | Python | JavaScript facade | Rust facade |
|---|---|---|---|
| pi | symi.pi / context.pi |
symi.pi / context.pi |
session.pi() |
| Euler's number | symi.e / context.e |
symi.e / context.e |
session.e() |
| Euler–Mascheroni | symi.euler_gamma |
symi.euler_gamma |
session.euler_gamma() |
| imaginary unit | symi.imaginary_unit |
symi.imaginary_unit |
session.imaginary_unit() |
| infinities and common sets | module/context properties | facade/context properties | session methods |
Python and JavaScript constants are immutable properties, not zero-argument
functions. Each access returns a handle in the owning default or explicit
context, so normal provenance rules still apply. Code using pi(), e(), or
other former module calls must remove the parentheses.
pi#
Raw WebAssembly: Default context
pi(): ExpressionCalling forms
Explicit context: Context.pi
readonly pi: ExpressionRaw WebAssembly: Explicit context: Context.pi
readonly pi: ExpressionSymiFacade property: SymiFacade.pi
readonly pi: ExpressionThe circle constant . Exact in every arithmetic operation; use
evaluate_numeric for a decimal value to any number of
significant digits.
e#
Raw WebAssembly: Default context
e(): ExpressionCalling forms
Explicit context: Context.e
readonly e: ExpressionRaw WebAssembly: Explicit context: Context.e
readonly e: ExpressionSymiFacade property: SymiFacade.e
readonly e: ExpressionEuler's number , the base of the natural logarithm. exp(1) and this
constant are the same expression.
euler_gamma#
Not exposed by the WASM / JavaScript bindings. Available as Context.euler_gamma in Python, UniffiSession.eulerGamma in Kotlin, UniffiSession.eulerGamma in Swift, api::Session::euler_gamma in Rust.
The Euler–Mascheroni constant . It appears in closed forms produced by
digamma and related special functions.
imaginary_unit#
Not exposed by the WASM / JavaScript bindings. Available as Context.imaginary_unit in Python, UniffiSession.imaginaryUnit in Kotlin, UniffiSession.imaginaryUnit in Swift, api::Session::imaginary_unit in Rust.
The imaginary unit with . Use
real_part and
imaginary_part to
decompose a complex expression.
infinity#
Raw WebAssembly: Default context
infinity(): ExpressionCalling forms
Explicit context: Context.infinity
readonly infinity: ExpressionRaw WebAssembly: Explicit context: Context.infinity
readonly infinity: ExpressionSymiFacade property: SymiFacade.infinity
readonly infinity: ExpressionUnsigned positive infinity . Negate it for . Both are accepted
as bounds by integrate_definite and as
approach points by limit.
The remaining constants are documented with the structures that use them:
logical_true and
logical_false with Boolean algebra, and
empty_set, real_line,
complex_plane, and
integer_set with sets.
Exact structural decomposition uses numerator_denominator, numerator, and
denominator. Complex decomposition uses the existing complete names
real_part and imaginary_part; no re or im aliases are provided.
Numeric evaluation#
Decimal approximations are produced only on explicit request, by the
operations described in Numeric evaluation:
evaluate_numeric for the value of a
closed expression to any number of significant digits, and the numerical
integration, summation, and root-finding operations beside it.
Example#
Construction, symbolic execution, and the exact host query are three separate steps.
const relation = symi.lessThan(symi.rational(1n, 3n), 1);
console.log(relation.toString());
console.log(relation.execute().toString());
console.log(symi.evaluateTruth(relation));
console.log(symi.pi.multiply(2).toString());Additional API#
eulerGamma#
Raw WebAssembly: Default context
eulerGamma(): ExpressionThe Euler–Mascheroni constant .
Calling forms
Explicit context: Context.eulerGamma
readonly eulerGamma: ExpressionRaw WebAssembly: Explicit context: Context.eulerGamma
eulerGamma(): ExpressionSymiFacade property: SymiFacade.eulerGamma
readonly eulerGamma: ExpressionimaginaryUnit#
Raw WebAssembly: Default context
imaginaryUnit(): ExpressionThe imaginary unit with .