Back to functions

nerdamer


nerdamer

This is the main object used to parse expression or equations. This object gets extended when additional modules are loaded. Remember that this just another variable which can be stored to shorter variable for convenience.

Usage: nerdamer(expression, subs, option, location)


Parameters

String expression The expression being parsed.
Object subs An object of known values
String|String[] option A string or array containing additional options such as parsing directly to number or expanding the expression. Use "numer" to when wanting the expression to be evaluated. Use "expand" when wanting the expression to be expanded.
int location The index of where the expression should be stored.

Returns

Expression

EXAMPLES:
var x = nerdamer('5*x+(x^2+2*x)*x+(x+2)');
console.log(x.toString());
var x = nerdamer('(x^2+2*x)*x+1+x+cos(y)', {y: '7'}, ['expand'])
//the substitutions was called but the functions weren't called
console.log(x.toString());
var x = nerdamer('(x^2+2*x)*x+1+x+cos(y)', {y: '7'}, ['expand', 'numer']);
console.log(x.toString());
var x = nerdamer('(x^2+2*x)*x+1+x+cos(y)', {y: '7'}, ['expand', 'numer']);
console.log(x.text('decimals'));
OUTPUT:
Back to functions