vamtiger-evaluate-function
v0.0.9
Published
Evaluate a defined function.
Downloads
2
Maintainers
Readme
VAMTIGER Evaluate Function
VAMTIGER Evaluate Function can evaluate a defined function.
Installation
VAMTIGER Evaluate Function can be installed using npm or yarn:
npm i --global vamtiger-evaluate-function
or
yarn global vamtiger-evaluate-function
Usage
Import or require a referece to VAMTIGER Evaluate Function :
import evaluateFunction from 'vamtiger-evaluate-function';
or
const evaluateFunction = require('vamtiger-evaluate-function').default;
VAMTIGER Evaluate Function can evaluate a defined function
const result = evaluateFunction({
formula: '-x^2 + 6x - 11',
x: 2
})
.then(handleResult)
.catch(handleError);
If SymPy is installed, the function can also be evaluated by specifying the python option:
async someAsyncFunction function() {
const result = evaluateFunction({
formula: '-x**2 + 6*x - 11', // Python Syntax
x: 2,
python: true
})
.then(handleResult)
.catch(handleError);
}
Since VAMTIGER Evaluate Function returns a Promise, it can be more conveniently executed within an async function:
async someAsyncFunction function() {
const result = await evaluateFunction({
formula: '-x^2 + 6x - 11',
x: 2
});
}
When installed globally, the result can be logged from the commandline:
vamtiger-evaluate-function --formula "-x^2 + 6x - 11" --x "4x - 1"
or
vamtiger-evaluate-function --formula "-x**2 + 6*x - 11" --x "4*x - 1" --python