npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

math-ezy

v1.0.2

Published

An npm package to mathematical computations

Downloads

8

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-ezy

Documentation

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: 120

Functions

isPrime(num)

isPrime(7)  // output : true

factorial(num)

factorial(5)  // output : 120

gcd(num1, num2)

gcd(12, 15)  // output : 3

fibonacci(n) Returns the nth fibonacci number

fibonacci(5)  // output : 5

geometricSeriesSum(a, r, n)

geometricSeriesSum(1, 2, 5)  // output : 31

arithmeticSeriesSum(a, d, n)

arithmeticSeriesSum(1, 2, 5)  // output : 25

distance([x1, y1], [x2, y2])

distance([0, 0], [3, 4]); // 5

combinations(n, r)

combinations(5, 3); // 10

permutations(n, r)

permutations(5, 3); // 60

log(base, value)

log(2, 8); // 3

solveQuadratic(a, b, c)

solveQuadratic(1, -3, 2); // [2, 1]

solveLinear(a, b)

solveLinear(4, -16); // 4

sin(degrees)

sin(30); // 0.5

cos(degrees)

cos(60); // 0.5

tan(degrees)

tan(45); // 1

add(...numbers)

add(1, 2, 3, 4); // 10

subtract(...numbers)

subtract(10, 2, 1); // 7

multiply(...numbers)

multiply(2, 3, 4); // 24

divide(a, b)

divide(10, 2); // 5

Contributing

Please feel free to contribute on this package to make it the best.

Licence

Licensed under the ISC license.