2 个版本
0.1.1 | 2023年9月26日 |
---|---|
0.1.0 | 2023年9月21日 |
1078 in 数学
24KB
639 行
Moo-Math
_(_)_
'-e e-'
(o_o)
What does the cow sound like?
It's moo~ moo moo
一个无需依赖的数学解释器实用工具,能够
- 解析常规数学方程
- 使用Runge-Kutta方法解析一阶微分方程
- 可以添加自定义数学函数
示例
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));
}