math-ezy
v1.0.2
Published
An npm package to mathematical computations
Maintainers
Readme
math-ezy
A lightweight and efficient math utilities package providing a collection of essential math functions such as prime checks, factorials, trigonometric calculations, and more.
Installation
You can install this package using npm:
npm install math-ezyDocumentation
Once installed, you can import the functions you need
import { add, subtract, factorial, isPrime, fibonacci } from 'math-ezy';
// Example usage
console.log(add(1, 2, 3)); // Output: 6
console.log(factorial(5)); // Output: 120Functions
isPrime(num)
isPrime(7) // output : truefactorial(num)
factorial(5) // output : 120gcd(num1, num2)
gcd(12, 15) // output : 3fibonacci(n) Returns the nth fibonacci number
fibonacci(5) // output : 5geometricSeriesSum(a, r, n)
geometricSeriesSum(1, 2, 5) // output : 31arithmeticSeriesSum(a, d, n)
arithmeticSeriesSum(1, 2, 5) // output : 25distance([x1, y1], [x2, y2])
distance([0, 0], [3, 4]); // 5combinations(n, r)
combinations(5, 3); // 10permutations(n, r)
permutations(5, 3); // 60log(base, value)
log(2, 8); // 3solveQuadratic(a, b, c)
solveQuadratic(1, -3, 2); // [2, 1]solveLinear(a, b)
solveLinear(4, -16); // 4sin(degrees)
sin(30); // 0.5cos(degrees)
cos(60); // 0.5tan(degrees)
tan(45); // 1add(...numbers)
add(1, 2, 3, 4); // 10subtract(...numbers)
subtract(10, 2, 1); // 7multiply(...numbers)
multiply(2, 3, 4); // 24divide(a, b)
divide(10, 2); // 5Contributing
Please feel free to contribute on this package to make it the best.
Licence
Licensed under the ISC license.
