Specialized canonical forms
These transformations have a fixed normal-form contract: each one produces a
determined shape and never runs the heuristic search used by
simplify. Use them when the output
shape matters more than minimal size.
Related rewrites are on algebraic transforms and trigonometric and complex rewrites.
Canonical presentation passes#
piecewise_fold#
api::solving::Session method
pub fn piecewise_fold(
&self,
input_expression: &Expression,
) -> Result<Expression, ApiError>Calling forms
api::expression_operations::Expression method: api::expression_operations::Expression::piecewise_fold
pub fn piecewise_fold(&self) -> Result<Expression, ApiError>Expand abs, signum, and heaviside_step definitions recursively and fold
piecewise operands of sums, products, powers, factorials, and ordinary function
calls into one top-level piecewise expression. For example, x*abs(x - 1)
becomes the exact two-branch definition with values x*(x - 1) and
-x*(x - 1). Branch combinations retain first-match order and conditions are
conjoined exactly.
Each structural fold is limited to 16 branches and 128 stored nodes, with a per-input growth limit of eight times the source node count. A node that would exceed a limit remains unfolded; the operation still returns an exact, equality-preserving expression and may therefore return the input unchanged.
rewrite_special_functions#
api::Session method
pub fn rewrite_special_functions(
&self,
target: &Expression,
basis: SpecialFunctionBasis,
) -> Result<Expression, ApiError>Calling forms
api::Expression method: api::Expression::rewrite_special_functions
pub fn rewrite_special_functions(
&self,
basis: SpecialFunctionBasis,
) -> Result<Expression, ApiError>Rewrite beta, gamma, binomial, factorial, and rising-factorial representations
into the requested "gamma", "factorial", "binomial", or
"rising_factorial" basis. The exact identities are applied only when their
domain gates are proven: factorial and binomial conversions require the
relevant non-negative integers, rising-factorial conversions additionally
require a positive base, and beta-to-gamma requires two positive arguments.
For example, with n declared a positive integer, n! may be rewritten into
the gamma basis and gamma(n) into the factorial basis. A site with
unconstrained arguments is returned unchanged. Gamma ratios with a literal
non-negative argument offset are minimized to their exact shifted product.
The context method, expression convenience method, and module function have the same behavior. An unknown basis name raises an explicit error; there is no force mode.
presentation_normal_form#
api::algebra::Session method
pub fn presentation_normal_form(
&self,
input_expression: &Expression,
) -> Result<Expression, ApiError>Calling forms
api::expression_operations::Expression method: api::expression_operations::Expression::presentation_normal_form
pub fn presentation_normal_form(&self) -> Result<Expression, ApiError>The cheap, bounded display-oriented pass run at solver output seams: rational
normal form only, kept only when the weighted complexity does not grow.
Unlike simplify it never runs the full heuristic ladder, so it is fast and
deterministic in shape.
Example#
This family is not part of the recommended symi::api facade in this release. Call it through the native modules in the native Rust API reference.
Additional API#
SpecialFunctionBasis#
api re_export
pub use options::SpecialFunctionBasis;A canonical target basis for special-function rewrites.
SpecialFunctionBasis.Binomial#
api::options::SpecialFunctionBasis variant
Binomial,Rewrite toward binomial coefficients.
SpecialFunctionBasis.Factorial#
api::options::SpecialFunctionBasis variant
Factorial,Rewrite toward factorials.
SpecialFunctionBasis.Gamma#
api::options::SpecialFunctionBasis variant
Gamma,Rewrite toward gamma functions.
SpecialFunctionBasis.RisingFactorial#
api::options::SpecialFunctionBasis variant
RisingFactorial,Rewrite toward rising factorials.
SpecialFunctionBasis.from_name#
api::options::SpecialFunctionBasis method
pub fn from_name(name: &str) -> Result<Self, ApiError>Resolves the stable binding spelling of a special-function basis.
SpecialFunctionBasis.into_core#
api::options::SpecialFunctionBasis method
pub fn into_core(
self,
) -> crate::special_function_basis::SpecialFunctionBasisConverts this binding-neutral value to the engine representation.
SpecialFunctionBasis.name#
api::options::SpecialFunctionBasis method
pub fn name(self) -> &'static strReturns the stable binding spelling of this special-function basis.