When installing the module, I get a TypeError. I am using the example from the website.
I am not sure if the error is because of this module or because of crypto-js.
Log:
io@iovoid:~/node-sandbox$ npm install algebra.js
/home/io/node-sandbox
`-- algebra.js@0.2.5
npm WARN enoent ENOENT, open '/home/io/node-sandbox/package.json'
npm WARN node-sandbox No description
npm WARN node-sandbox No repository field.
npm WARN node-sandbox No README data
npm WARN node-sandbox No license field.
io@iovoid:~/node-sandbox$ node
> var algebra = require('algebra.js');
undefined
> var Fraction = algebra.Fraction;
undefined
> var Expression = algebra.Expression;
undefined
> var Equation = algebra.Equation;
undefined
> var expr = new Expression("x");
undefined
> expr = expr.subtract(3);
TypeError: Object #<Object> has no method 'sign'
at Fraction.reduce (/home/io/node-sandbox/node_modules/algebra.js/src/fractions.js:27:14)
at Fraction.multiply (/home/io/node-sandbox/node_modules/algebra.js/src/fractions.js:117:29)
at /home/io/node-sandbox/node_modules/algebra.js/src/expressions.js:427:60
at Array.reduce (native)
at Term.coefficient (/home/io/node-sandbox/node_modules/algebra.js/src/expressions.js:427:30)
at Term.simplify (/home/io/node-sandbox/node_modules/algebra.js/src/expressions.js:432:31)
at /home/io/node-sandbox/node_modules/algebra.js/src/expressions.js:35:54
at Array.map (native)
at Expression.simplify (/home/io/node-sandbox/node_modules/algebra.js/src/expressions.js:35:29)
at Expression.multiply (/home/io/node-sandbox/node_modules/algebra.js/src/expressions.js:133:59)
> expr = expr.add("x");
TypeError: Object #<Object> has no method 'sign'
at Fraction.reduce (/home/io/node-sandbox/node_modules/algebra.js/src/fractions.js:27:14)
at Fraction.multiply (/home/io/node-sandbox/node_modules/algebra.js/src/fractions.js:117:29)
at /home/io/node-sandbox/node_modules/algebra.js/src/expressions.js:427:60
at Array.reduce (native)
at Term.coefficient (/home/io/node-sandbox/node_modules/algebra.js/src/expressions.js:427:30)
at Term.simplify (/home/io/node-sandbox/node_modules/algebra.js/src/expressions.js:432:31)
at /home/io/node-sandbox/node_modules/algebra.js/src/expressions.js:35:54
at Array.map (native)
at Expression.simplify (/home/io/node-sandbox/node_modules/algebra.js/src/expressions.js:35:29)
at Expression.add (/home/io/node-sandbox/node_modules/algebra.js/src/expressions.js:73:59)
>
undefined
> console.log(expr.toString());
x
undefined
EDIT: It was because some Node versions doesn't support Math.sign.
When installing the module, I get a TypeError. I am using the example from the website. I am not sure if the error is because of this module or because of crypto-js. Log:
EDIT: It was because some Node versions doesn't support Math.sign.