Skip to content
Symi Docs
Python
On this page

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#

Default context

pi: Expression
Calling forms

Explicit context: Context.pi

pi: Expression

The circle constant π\pi. Exact in every arithmetic operation; use evaluate_numeric for a decimal value to any number of significant digits.

e#

Default context

e: Expression
Calling forms

Explicit context: Context.e

e: Expression

Euler's number ee, the base of the natural logarithm. exp(1) and this constant are the same expression.

euler_gamma#

Default context

euler_gamma: Expression
Calling forms

Explicit context: Context.euler_gamma

euler_gamma: Expression

The Euler–Mascheroni constant γ\gamma. It appears in closed forms produced by digamma and related special functions.

imaginary_unit#

Default context

imaginary_unit: Expression
Calling forms

Explicit context: Context.imaginary_unit

imaginary_unit: Expression

The imaginary unit ii with i2=−1i^2 = -1. Use real_part and imaginary_part to decompose a complex expression.

infinity#

Default context

infinity: Expression
Calling forms

Explicit context: Context.infinity

infinity: Expression

Unsigned positive infinity ∞\infty. Negate it for −∞-\infty. 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.

Python
import symi

x = symi.symbol("x")
relation = symi.less_than(symi.rational(1, 3), 1)

print(relation)
print(relation.execute())
print(symi.evaluate_truth(relation))
print(symi.evaluate_truth(symi.less_than(x, 1)))
print(symi.pi * 2)

Symi documentation · Python