Skip to content

anaskhan96/newtonmath

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

newtonmath

Build Status

newtonmath is a Rust wrapper for the Newton API, a really micro micro-service for advanced math.

Functions implemented:

fn simplify(exp: &str) -> StringResult // /simplify endpoint
fn factor(exp: &str) -> StringResult // /factor endpoint
fn derive(exp: &str) -> StringResult // /derive endpoint
fn integrate(exp: &str) -> StringResult // /integrate endpoint
fn find_zeroes(exp: &str) -> VectorResult // /zeroes endpoint
fn find_tangent(exp: &str) -> StringResult // /tangent endpoint
fn area_under_curve(exp: &str) -> StringResult // /area endpoint
fn cosine(exp: &str) -> StringResult // /cos endpoint
fn sine(exp: &str) -> StringResult // /sin endpoint
fn tangent(exp: &str) -> StringResult // /tan endpoint
fn inverse_cosine(exp: &str) -> StringResult // /arccos endpoint
fn inverse_sine(exp: &str) -> StringResult // /arcsin endpoint
fn inverse_tangent(exp: &str) -> StringResult // /arctan endpoint
fn absolute_value(exp: &str) -> StringResult // /abs endpoint
fn logarithm(exp: &str) -> StringResult // /log endpoint

The StringResult returned is of type Result<String, failure::Error> whereas the VectorResult returned is of type Result<Vec<i64>, failure::Error>.

Setup

  • Add newtonmath as a dependency in your Cargo.toml
[dependencies]
newtonmath = "0.3.0"
  • Include it in your code
extern crate newtonmath as newton;

Usage

fn main(){
    let res = newton::derive("x^2-1");
    match res {
        Ok(data) => println!("{}", data), // "2 x"
        Err(err) => println!("{:?}",err) // If an error is returned
    };
}

Releases

No releases published

Packages

No packages published

Languages