algebric
v1.0.9
Published
A package for advanced mathematical operations. To install, run: npm install -g algebric
Downloads
31
Readme
Installation
To install Algebric globally, run:
npm install -g algebric
CLI instructions (example usage)
algebric add 1 1
algebric add 3 2 5 7 10
algebric subtract 5 3
algebric subtract 20 5 3
algebric multiply 3 4
algebric multiply 2 3 4
algebric divide 10 2
algebric divide 100 5 2
algebric evaluate "2 * (3 + 5)"
algebric evaluate "sin(30 deg)"
algebric evaluate "log(1000, 10)"
algebric simplify "x^2 + 2*x + 1"
algebric expand "(x + 1)^2"
algebric factor "x^2 + 2*x + 1"
algebric solve "x^2 - 1"
algebric solve "x^2 + x - 6"
algebric solve "3*x^2 + 2*x - 8"
Programming Support (example usage)
const algebric = require('algebric');
// Add numbers
const sum = algebric.add(1, 2, 3);
console.log(sum); // Output: 6
// Subtract numbers
const difference = algebric.subtract(10, 4, 2);
console.log(difference); // Output: 4
// Multiply numbers
const product = algebric.multiply(2, 3, 4);
console.log(product); // Output: 24
// Divide numbers
const quotient = algebric.divide(100, 5, 2);
console.log(quotient); // Output: 10
// Simplify an algebraic expression
const simplified = algebric.simplify("x^2 + 2*x + 1");
console.log(simplified); // Output: (x + 1)^2
// Expand an algebraic expression
const expanded = algebric.expand("(x + 1)^2");
console.log(expanded); // Output: x^2 + 2*x + 1
// Factor an algebraic expression
const factored = algebric.factor("x^2 + 2*x + 1");
console.log(factored); // Output: (x + 1)^2
// Solve an algebraic equation
const solutions = algebric.solve("x^2 - 1");
console.log(solutions); // Output: [1, -1]
// Evaluate an expression
const result = algebric.evaluate("2 * (3 + 5)");
console.log(result); // Output: 16
const sinResult = algebric.evaluate("sin(30 deg)");
console.log(sinResult); // Output: 0.5 (approximately)
const logResult = algebric.evaluate("log(1000, 10)");
console.log(logResult); // Output: 3
This project is licensed under the MIT License. See the LICENSE.txt file for details.