Crate calculi

Source
Expand description

§Calculi

‘calculi’ is a crate used to algebraically solve equations with unknown variables for a given outcome.

It is also able to solve equations when all unknown variables are given and perform other calculus functions.

§Examples

let eq1 = calculi::Equation::new("x - 2 * a + 4 ^ b");

assert_eq!(eq1.solve_for(10.0, vec![("a", 4.5), ("b", 1.0)]).1, 15.0);


let eq2 = calculi::Equation::new("x + root(y, 3) + ln(exp(3))");

assert_eq!(eq2.solve_with(vec![("x", 2.0), ("y", 27.0)]).to_float().unwrap(), 8.0);
 
 
let eq3 = calculi::Equation::new("x ^ 3");
 
assert_eq!(eq3.derive().text, "3 * x ^ 2")

Look at Equation for all the equation functions.

Look at Component for the component functions that can be used on the component which Equation::solve_with returns.

Look at Operators for all available operators.

Structs§

Equation
The equation struct containing the equation text and the parsed component.Component.

Enums§

Component
The possible equation components
Operator
These are all the functions/operators that can be used in an equation.