1.0.9 • Published 1 year ago

mathema v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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

FunctionParamsDescription

|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

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago