2 releases

0.1.1 Sep 26, 2023
0.1.0 Sep 21, 2023

#1216 in Math

MIT/Apache

24KB
639 lines

Moo-Math

 _(_)_
'-e e-'
 (o_o)

What does the cow sound like?
It's moo~ moo moo

Mathematics interpreter utility, written without dependencies, capable of

  • Interpreting normal mathematics equation
  • Interpreting first order differential equation with Runge-Kutta method
  • Can add custom math function

Example

fn main(){
    let mut moo = Moo::new(|functions| {
        // add custom function
        functions.insert("relu", |v| {
            f64::max(0.0, v)
        });
    });
    let program = moo.parse("x + 10 + relu(-6)").ok().unwrap().unwrap();
    // run(x) output: 10
    println!("{}", program.run(0.0));
}

No runtime deps