newtonmath
newtonmath
is a Rust wrapper for the Newton API, a really micro micro-service for advanced math.
Functions implemented:
fn simplify(exp: &str) -> StringResult fn factor(exp: &str) -> StringResult fn derive(exp: &str) -> StringResult fn integrate(exp: &str) -> StringResult fn find_zeroes(exp: &str) -> VectorResult fn find_tangent(exp: &str) -> StringResult fn area_under_curve(exp: &str) -> StringResult fn cosine(exp: &str) -> StringResult fn sine(exp: &str) -> StringResult fn tangent(exp: &str) -> StringResult fn inverse_cosine(exp: &str) -> StringResult fn inverse_sine(exp: &str) -> StringResult fn inverse_tangent(exp: &str) -> StringResult fn absolute_value(exp: &str) -> StringResult fn logarithm(exp: &str) -> StringResult
The StringResult
returned is of type Result<String, reqwest::Error>
whereas the VectorResult
returned is of type Result<Vec<i64>, reqwest::Error>
.
Setup
- Add
newtonmath
as a dependency in your Cargo.toml
[dependencies]
newtonmath = "0.3.0"
extern crate newtonmath as newton;
Usage
fn main(){
let res = newton::derive("x^2-1");
match res {
Ok(data) => println!("{}", data), Err(err) => println!("{:?}",err) };
}