Function xxcalc::polynomial_calculator::functions::bind [] [src]

pub fn bind(args: Vec<Polynomial>) -> Result<PolynomialEvaluationError>

Binds a polynomial with a value (requires two arguments).

This function computes value of given polynomial (first argument) when the symbol is replaced with a constant value (second argument).

Examples

assert_eq!(PolynomialCalculator.process("bind(x^2, 10)"), Ok(Polynomial::constant(100.0)));Run

Errors

It will return a wrapped PolynomialError::NonConstantError when the second argument is not a constant polynomial (a polynomial of degree zero).