Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anaskhan96/newtonmath
Rust wrapper for Newton API
https://github.com/anaskhan96/newtonmath
api api-client newton rust rust-lang rust-library
Last synced: 2 days ago
JSON representation
Rust wrapper for Newton API
- Host: GitHub
- URL: https://github.com/anaskhan96/newtonmath
- Owner: anaskhan96
- License: mit
- Created: 2017-12-29T08:23:04.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-31T05:26:23.000Z (almost 7 years ago)
- Last Synced: 2024-10-14T12:20:15.329Z (24 days ago)
- Topics: api, api-client, newton, rust, rust-lang, rust-library
- Language: Rust
- Size: 10.7 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: license
Awesome Lists containing this project
README
# newtonmath
[![Build Status](https://travis-ci.org/anaskhan96/newtonmath.svg?branch=master)](https://travis-ci.org/anaskhan96/newtonmath)
[![](http://meritbadge.herokuapp.com/newtonmath)](https://crates.io/crates/newtonmath)`newtonmath` is a Rust wrapper for the [Newton API](https://github.com/aunyks/newton-api), *a really micro micro-service for advanced math*.
Functions implemented:
```rust
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` whereas the `VectorResult` returned is of type `Result, failure::Error>`.### Setup
* Add `newtonmath` as a dependency in your `Cargo.toml`
```toml
[dependencies]
newtonmath = "0.3.0"
```* Include it in your code
```rust
extern crate newtonmath as newton;
```### Usage
```rust
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
};
}
```