Expand description
Low-level numerical evaluation trait system
This module implements the two-level evaluation architecture following SymPy’s proven design:
- Low-level
EvalNumerictrait: Type-specific numerical evaluation without substitution - High-level
evaluate()method: User-facing API with substitution, simplification, and control
§Architecture
The two-level design separates concerns:
EvalNumeric::eval_numeric(): Internal trait for numerical conversion (like SymPy’s_eval_evalf())Expression::evaluate_with_context(): Public API with substitution and context control (like SymPy’sevalf())
This separation enables:
- Clear semantics for each expression type
- Explicit control over evaluation behavior
- Extensibility for custom types
§Mathematical Background
Numerical evaluation converts symbolic expressions to numerical form while preserving mathematical correctness. For example:
sin(π/2)→1.0(exact symbolic evaluation)sqrt(2)→1.4142135623730951(numerical approximation with precision control)x^2(with x=3) →9(after substitution and evaluation)
Structs§
- Eval
Context - Evaluation context