pub struct MathExpr<'a, T: Float> { /* private fields */ }Implementations§
Source§impl<'a, T: Float + Debug> MathExpr<'a, T>
impl<'a, T: Float + Debug> MathExpr<'a, T>
Sourcepub fn variables(&self) -> HashSet<&'a str>
pub fn variables(&self) -> HashSet<&'a str>
Returns all variable names, including those in conditional branches.
Sourcepub fn substitute(&self, name: &str, replacement: &Self) -> Self
pub fn substitute(&self, name: &str, replacement: &Self) -> Self
Substitutes a variable structurally, without rewriting expression text.
pub fn new_var(name: &'a str) -> Self
pub fn new_const(value: T) -> Self
pub fn new_add(left: Self, right: Self) -> Self
pub fn new_subtract(left: Self, right: Self) -> Self
pub fn new_multiply(left: Self, right: Self) -> Self
pub fn new_divide(numerator: Self, denominator: Self) -> Self
pub fn new_power(base: Self, exponent: Self) -> Self
pub fn new_negate(operand: Self) -> Self
pub fn new_sin(operand: Self) -> Self
pub fn new_cos(operand: Self) -> Self
pub fn new_tan(operand: Self) -> Self
pub fn new_asin(operand: Self) -> Self
pub fn new_acos(operand: Self) -> Self
pub fn new_atan(operand: Self) -> Self
pub fn new_sinh(operand: Self) -> Self
pub fn new_cosh(operand: Self) -> Self
pub fn new_tanh(operand: Self) -> Self
pub fn new_sign(operand: Self) -> Self
pub fn new_abs(operand: Self) -> Self
pub fn new_exp(operand: Self) -> Self
pub fn new_sqrt(operand: Self) -> Self
pub fn new_log(operand: Self) -> Self
pub fn new_log10(operand: Self) -> Self
pub fn new_iif(check: Self, if_less_than_zero: Self, otherwise: Self) -> Self
pub fn derive(&self, by_var: &str) -> Self
Sourcepub fn simplify(&self) -> Self
pub fn simplify(&self) -> Self
Applies real-algebra identities, not strict IEEE-754 equivalences. Reassociation may change rounding, overflow, or signed zero; eliminating expressions (including redundant iif checks) may remove evaluation errors.
pub fn evaluate( &self, args: &HashMap<&str, T>, ) -> Result<T, EvaluationError<'a, T>>
Trait Implementations§
impl<'a, T: PartialEq + Float> StructuralPartialEq for MathExpr<'a, T>
Auto Trait Implementations§
impl<'a, T> Forget for MathExpr<'a, T>
impl<'a, T> Freeze for MathExpr<'a, T>
impl<'a, T> RefUnwindSafe for MathExpr<'a, T>
impl<'a, T> Send for MathExpr<'a, T>
impl<'a, T> Sync for MathExpr<'a, T>
impl<'a, T> Unpin for MathExpr<'a, T>
impl<'a, T> UnsafeUnpin for MathExpr<'a, T>
impl<'a, T> UnwindSafe for MathExpr<'a, T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more