SimplificationStrategy

Trait SimplificationStrategy 

Source
pub trait SimplificationStrategy: Send + Sync {
    // Required method
    fn simplify(&self, args: &[Expression]) -> Expression;

    // Provided methods
    fn applies_to(&self, args: &[Expression]) -> bool { ... }
    fn name(&self) -> &str { ... }
}
Expand description

Simplification strategy for a specific function or function family

Implements pattern-based algebraic rewrites (e.g., log(x^n) → n*log(x)) Distinct from FunctionProperties which store declarative mathematical data.

Required Methods§

Source

fn simplify(&self, args: &[Expression]) -> Expression

Apply simplification rules to function call

§Arguments
  • args - Function arguments to simplify
§Returns

Simplified expression (may be unchanged if no rules apply)

§Examples

Common simplification patterns:

  • log(1) → 0
  • log(x^n) → n*log(x)
  • sin(0) → 0

Provided Methods§

Source

fn applies_to(&self, args: &[Expression]) -> bool

Check if simplification strategy applies to given arguments

Allows early rejection of inapplicable strategies

Source

fn name(&self) -> &str

Get strategy name for debugging

Implementors§