waranomath
v1.0.1
Published
this module can help you to solve an equation or an system
Downloads
5
Maintainers
Readme
Quadratic and System Solver
A simple JavaScript module to solve quadratic equations and systems of two unknowns. This module provides an easy-to-use interface for finding the roots of second-degree equations and solving linear equations with two variables.
Table of Contents
Installation
To install the module, run:
npm install waranomath
Usage
Solving Quadratic Equations
To solve a quadratic equation of the form ax^2 + bx + c = 0, you can use the 'Warano.eq2(a, b, c)' function. It returns the roots of the equation.
const Warano = require("waranomath");
const root = Warano.eq2(2, -3, 2);
console.log(roots); // Outputs: [2, 1] (roots of the equation x^2 - 3x + 2 = 0)
Solving Systems of Two Unknowns
To solve a system of linear equation of the form :
a1 * x + b1 * y = c1
a2 * x + b2 * y = c2
You can use the s2s(a1, b1, c1, a2, b2, c2) function. It returns the values of x and y.
const solver=require("waranomath")
const solution = solver.s2s(2, 3, 5, 1, -1, 1);
console.log(solution); // Outputs: { x: 2, y: 1 }