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

mathema

v1.0.9

Published

Make Math Merry

Downloads

12

Readme

Installation

Install Package

npm i mathema

Usage

Import

import  *  as  mathema  from  'mathema';

prefix useage

append mathema. in front of all functions if you are directly importing * as mathema. Else for example, using algebra. only, import like so:

import { algebra } from 'mathema';

Usage Example

Mathema Example Angular Project

Functions

| Function | Params | Description | | ------------------------ | ------------------------ | ------------------------------------------------------------------------------------------------------------- | |Algebra (Arithmetic): LCM| | algebra.arithmetic.lcm.arr() | arr: any[] | Take in an array of numbers and find the least common multiple | | algebra.arithmetic.lcm.pair() | x: number, y: number | Take in an set of 2 numbers, x and y, and find the least common multiple |
GCD| | algebra.arithmetic.gcd.arr() | x: number, y: number | Take in an array of numbers and find the greatest common divisor | | algebra.arithmetic.gcd.pair() | arr: any[] | Take in an set of 2 numbers, x and y, and find the greatest common divisor
|Basics:| | |Add| | basics.add.simple() | x: number, y: number | add two values, x + y
| basics.add.twoArrays() | arr1: any[], arr2: any[] | add two array value pairs together, arr1 index value + arr2 index value
| basics.add.MultiD() | arr: any[] | loop 1d, 2d or multiD array and add all values together | |Basics: | Subtract| | basics.subtract.simple() | x: number, y: number | subtract two values, x - y
| basics.subtract.twoArrays() | arr1: any[], arr2: any[] | subtract two array value pairs together, arr1 index value - arr2 index value
| basics.subtract.multiD() | arr: any[] | loop 1d, 2d or multiD array and subtract all values together Multiply| | basics.subtract.simple() | x: number, y: number | subtract two values, x - y
| basics.subtract.twoArrays() | arr1: any[], arr2: any[] | subtract two array value pairs together, arr1 index value - arr2 index value
| basics.subtract.multiD() | arr: any[] | loop 1d, 2d or multiD array and subtract all values together Divide| | basics.divide.simple() | x: number, y: number | divide two values, x / y.
| basics.divide.twoArrays() | arr1: any[], arr2: any[] | divide two array value pairs together, arr1 index value / arr2 index value.
| basics.divide.multiD() | arr: any[] | loop 1d, 2d or multiD array and dividing all values together| |Conversion:| | Area (long hand conversion)| | conversion.convert() | from: string sq inch ,to: string sq centimeter , quantity: number | from — take in a from what converion type, to — take in a to what conversion type, quantity take in a value to represent the from amount Length (short hand conversion)| | conversion.convert() | from: string in ,to: string cm , quantity: number | from — take in a from what converion type, to — take in a to what conversion type, quantity take in a value to represent the from amount Mass| | conversion.convert() | from: string, to: string, quantity: number | from — take in a from what converion type, to — take in a to what conversion type, quantity take in a value to represent the from amount Temp| | conversion.convert() | from: string, to: string, quantity: number | from — take in a from what converion type, to — take in a to what conversion type, quantity take in a value to represent the from amount Volume| | conversion.convert() | from: string, to: string, quantity: number | from — take in a from what converion type, to — take in a to what conversion type, quantity take in a value to represent the from amount| |Discrete:| | GCD (Euclidean Algorithm)| | discrete.gcd.arr() | array: any[] | Take in an array of numbers and find the greatest common divisor via Euclidean Algorithm (invokes parallel (fork-join pattern) as needed) | discrete.gcd.pair() | x: number, y: number | Take in an set of 2 numbers, x and y, and find the greatest common divisor via Euclidean Algorithm| | Sets (Intersections, Unions)| | discrete.sets.intersection() | a: any[], b: any[] | Take in an sets of 2 arrays, a and b, where two sets are those elements that belong to both sets, intersection | discrete.sets.union() | a: any[], b: any[] | Take in an sets of 2 arrays, a and b, where two sets are all the same elements from both sets, an union| | Combinations & Permutations| | discrete.combination.ncr() | n: number, r: number | Take in an set of 2 numbers, n and r, where n is the number of total items and r is the number of picked items | discrete.sets.union() | n: number, r: number, o?: boolean | undefined | Take in an set of 2 numbers, n and r and boolean order o, where n is the number of total items and r is the number of picked items. Do verify if order matters or not. Default if left blank is true| |Geometry:| | Circle| | geometry.circle.area() | r: number | take in 1 radius value to get final area | geometry.circle.circumference() | r: number | take in 1 radius value to get final circumference| | Cylinder| | geometry.cylinder.diameter() | h: number, v: number | take in 2 values, height and volume to get final diameter | geometry.cylinder.surfaceArea() | r: number, h: number | take in 2 values, radius and height to get final surface area| | | geometry.cylinder.volume() | r: number, h: number | take in 2 values, radius and height to get final volume| | Rectangle| | geometry.rectangle.area() | x: number, y: number | take in 2 values of length and width to multiply by each other to get a area | geometry.rectangle.perimeter() | x: number, y: number | take in 2 values of length and width to multiply by 2 each and then add together to get final perimeter| | Sphere| | geometry.sphere.surfaceArea() | r: number | take in 1 value, radius to get final surface area | geometry.sphere.volume() | r: number | take in 1 value, radius to get final volume| | Square| | geometry.square.area() | x: number | take in 1 value and square it to get final area | geometry.square.perimeter() | x: number | take in 1 value and multiply all sides to get final perimeter| | Triangle| | geometry.triangle.area.asa() | a: number, b: number, y: number | strictly for triangle type of ASA, also known as Angle-Side-Angle Postulate -> take in 3 values, side a, angle b and angle y | geometry.triangle.area.height() | b: number, h: number | strictly for triangle with a height property only, does work for right angles strictly as well -> take in 2 vlaues, b for base and h for height to get final area| | | geometry.triangle.area.perimeter() | a: number, b: number, c: number | take in 3 values, side a, b and c to get final surface area| | | geometry.triangle.area.sas() | a: number, y: number, b: number | strictly for triangle type of SAS, also known as Side-Angle-Side Postulate -> take in 3 values, side a, side b, and angle y| | | geometry.triangle.area.sss() | a: number, b: number, c: number | strictly for triangle type of SSS, also known as Side-Angle-Side Postulate (Heron's formula) -> take in 3 values, side a, b and c|
|Helpers: | Factorialize| | helpers.factorialize() | num: any | taken in a number num that gives back the factorial| Flatten| | helpers.flatten() | arr: any[] | Take in an array to flatten| Round| | helpers.flatten() | num: number, decimals: number | Take in a number num to round to the nearest dictated max number decimals (0-15 decimals only permitted)| Slice Builder| | helpers.sliceBuilder() | str: string, splitAt: number, inject: string | number | Take in a string and inject a string or number into a specific position| Square Root| | helpers.sqrt() | num: number | Take in a number num that gives back the square root of a value