Function math_utils_lib::quick_eval
source · pub fn quick_eval(
expr: String,
vars: Vec<Variable>
) -> Result<Value, QuickEvalError>Expand description
evaluates a given expression using the given variables (e and pi are provided by the function). If you just want the Binary Tree, have a look at parse().
§Examples
let res = quick_eval("3*3".to_string(), vec![])?;
assert_eq!(res, Value::Scalar(9.));let x = Variable {
name: "x".to_string(),
value: Value::Scalar(3.)
};
let res = quick_eval("3x".to_string(), vec![x])?;
assert_eq!(res, Value::Scalar(9.));