moo-math

Crates.iomoo-math
lib.rsmoo-math
version0.1.1
sourcesrc
created_at2023-09-21 12:23:06.789872
updated_at2023-09-26 16:58:34.135793
descriptionA simple math interpreter
homepagehttps://www.boon4681.com
repositoryhttps://github.com/boon4681/moo-math
max_upload_size
id979397
size24,849
boon4681 (boon4681)

documentation

README

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));
}
Commit count: 11

cargo fmt