extra-math 1.3.32 → 1.3.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,8 +6,13 @@ A collection of common mathematical functions.<br>
|
|
|
6
6
|
📘 [Wiki](https://github.com/nodef/extra-math/wiki/).
|
|
7
7
|
|
|
8
8
|
Mathematics is the classification and study of all possible patterns [(1)]. This
|
|
9
|
-
package includes common
|
|
10
|
-
*numbers
|
|
9
|
+
package includes common number functions related to querying *about* numbers,
|
|
10
|
+
*comparing* numbers, *rounding* numbers, performing *rounded division*,
|
|
11
|
+
performing *modulo* operations, *controlling range* of numbers, performing
|
|
12
|
+
*arithmetic* operations, obtaining *divisors* of a number (and related
|
|
13
|
+
operations), getting the number of possible *arrangements* of a set of objects,
|
|
14
|
+
performing *geometry*-related calculations, performing basic *statistical*
|
|
15
|
+
analysis, and finding various *statistical means*.
|
|
11
16
|
|
|
12
17
|
**Natural numbers**: There are 3 different ways of performing the *modulo*
|
|
13
18
|
operation: [rem], [mod], and [modp]. [gcd]/`HCF` and [lcm] of a list of numbers
|
|
@@ -67,23 +72,44 @@ math.lcm(2, 3, 4);
|
|
|
67
72
|
|
|
68
73
|
| Property | Description |
|
|
69
74
|
| ---- | ---- |
|
|
75
|
+
| [is] | Check if value is a number. |
|
|
76
|
+
| [significantDigits] | Count the number of significant digits in a number. |
|
|
77
|
+
| | |
|
|
78
|
+
| [compare] | Compare two numbers. |
|
|
79
|
+
| | |
|
|
80
|
+
| [floor] | Round down a number to specific precision. |
|
|
81
|
+
| [ceil] | Round up a number to specific precision. |
|
|
82
|
+
| [round] | Round a number to specific precision. |
|
|
83
|
+
| | |
|
|
84
|
+
| [floorDiv] | Perform floor-divison of two numbers. |
|
|
85
|
+
| [ceilDiv] | Perform ceiling-divison of two numbers. |
|
|
86
|
+
| [roundDiv] | Perform rounded-divison of two numbers. |
|
|
87
|
+
| | |
|
|
70
88
|
| [rem] | Find the remainder of x/y with sign of x (truncated division). |
|
|
71
89
|
| [mod] | Find the remainder of x/y with sign of y (floored division). |
|
|
72
90
|
| [modp] | Find the remainder of x/y with +ve sign (euclidean division). |
|
|
73
|
-
| [gcd] | Find the greatest common divisor of numbers. |
|
|
74
|
-
| [lcm] | Find the least common multiple of numbers. |
|
|
75
|
-
| [factorial] | Find the factorial of a number. |
|
|
76
|
-
| [binomial] | Find the number of ways to choose k elements from a set of n elements. |
|
|
77
|
-
| [multinomial] | Find the number of ways to put n objects in m bins (n=sum(kᵢ)). |
|
|
78
91
|
| | |
|
|
79
92
|
| [constrain] | Constrain a number within a minimum and a maximum value. |
|
|
80
93
|
| [normalize] | Normalize a number from its current range into a value between 0 and 1. |
|
|
81
94
|
| [remap] | Re-map a number from one range to another. |
|
|
82
95
|
| [lerp] | Linearly interpolate a number between two numbers. |
|
|
96
|
+
| | |
|
|
97
|
+
| [isPow] | Check if a number is a power-of-n. |
|
|
98
|
+
| [prevPow] | Get previous power-of-n of a number. |
|
|
99
|
+
| [nextPow] | Find next power-of-n of a number. |
|
|
100
|
+
| | |
|
|
83
101
|
| [root] | Find the nth root of a number (ⁿ√). |
|
|
84
102
|
| [log] | Find the logarithm of a number with a given base. |
|
|
85
|
-
|
|
|
86
|
-
| [
|
|
103
|
+
| | |
|
|
104
|
+
| [properDivisors] | List all divisors of a number, except itself. |
|
|
105
|
+
| [aliquotSum] | Sum all proper divisors of a number. |
|
|
106
|
+
| [isPrime] | Check if number is prime. |
|
|
107
|
+
| [gcd] | Find the greatest common divisor of numbers. |
|
|
108
|
+
| [lcm] | Find the least common multiple of numbers. |
|
|
109
|
+
| | |
|
|
110
|
+
| [factorial] | Find the factorial of a number. |
|
|
111
|
+
| [binomial] | Find the number of ways to choose k elements from a set of n elements. |
|
|
112
|
+
| [multinomial] | Find the number of ways to put n objects in m bins (n=sum(kᵢ)). |
|
|
87
113
|
| | |
|
|
88
114
|
| [degrees] | Convert radians to degrees. |
|
|
89
115
|
| [radians] | Convert degrees to radians. |
|
|
@@ -92,11 +118,16 @@ math.lcm(2, 3, 4);
|
|
|
92
118
|
| | |
|
|
93
119
|
| [sum] | Find the sum of numbers (Σ). |
|
|
94
120
|
| [product] | Find the product of numbers (∏). |
|
|
95
|
-
| [mean] | Find the average of numbers. |
|
|
96
121
|
| [median] | Find the value separating the higher and lower halves of numbers. |
|
|
97
122
|
| [modes] | Find the values that appear most often. |
|
|
98
|
-
| [range] | Find the
|
|
123
|
+
| [range] | Find the smallest and largest values. |
|
|
99
124
|
| [variance] | Find the mean of squared deviation of numbers from its mean. |
|
|
125
|
+
| | |
|
|
126
|
+
| [arithmeticMean] | Find the average of numbers. |
|
|
127
|
+
| [geometricMean] | Find the geometric mean of numbers. |
|
|
128
|
+
| [harmonicMean] | Find the harmonic mean of numbers. |
|
|
129
|
+
| [quadriaticMean] | Find the quadriatic mean of numbers. |
|
|
130
|
+
| [cubicMean] | Find the cubic mean of numbers. |
|
|
100
131
|
|
|
101
132
|
<br>
|
|
102
133
|
<br>
|
|
@@ -127,30 +158,44 @@ math.lcm(2, 3, 4);
|
|
|
127
158
|
[](https://codeclimate.com/github/nodef/extra-math/maintainability)
|
|
128
159
|
|
|
129
160
|
|
|
161
|
+
[floor]: https://nodef.github.io/extra-math/functions/floor.html
|
|
162
|
+
[ceil]: https://nodef.github.io/extra-math/functions/ceil.html
|
|
163
|
+
[round]: https://nodef.github.io/extra-math/functions/round.html
|
|
164
|
+
[floorDiv]: https://nodef.github.io/extra-math/functions/floorDiv.html
|
|
165
|
+
[ceilDiv]: https://nodef.github.io/extra-math/functions/ceilDiv.html
|
|
166
|
+
[roundDiv]: https://nodef.github.io/extra-math/functions/roundDiv.html
|
|
130
167
|
[rem]: https://nodef.github.io/extra-math/functions/rem.html
|
|
131
168
|
[mod]: https://nodef.github.io/extra-math/functions/mod.html
|
|
132
169
|
[modp]: https://nodef.github.io/extra-math/functions/modp.html
|
|
170
|
+
[constrain]: https://nodef.github.io/extra-math/functions/constrain.html
|
|
171
|
+
[normalize]: https://nodef.github.io/extra-math/functions/normalize.html
|
|
172
|
+
[remap]: https://nodef.github.io/extra-math/functions/remap.html
|
|
173
|
+
[lerp]: https://nodef.github.io/extra-math/functions/lerp.html
|
|
174
|
+
[isPow]: https://nodef.github.io/extra-math/functions/isPow.html
|
|
175
|
+
[prevPow]: https://nodef.github.io/extra-math/functions/prevPow.html
|
|
176
|
+
[nextPow]: https://nodef.github.io/extra-math/functions/nextPow.html
|
|
177
|
+
[root]: https://nodef.github.io/extra-math/functions/root.html
|
|
178
|
+
[log]: https://nodef.github.io/extra-math/functions/log.html
|
|
179
|
+
[properDivisors]: https://nodef.github.io/extra-math/functions/properDivisors.html
|
|
180
|
+
[aliquotSum]: https://nodef.github.io/extra-math/functions/aliquotSum.html
|
|
181
|
+
[isPrime]: https://nodef.github.io/extra-math/functions/isPrime.html
|
|
133
182
|
[gcd]: https://nodef.github.io/extra-math/functions/gcd.html
|
|
134
183
|
[lcm]: https://nodef.github.io/extra-math/functions/lcm.html
|
|
135
184
|
[factorial]: https://nodef.github.io/extra-math/functions/factorial.html
|
|
136
185
|
[binomial]: https://nodef.github.io/extra-math/functions/binomial.html
|
|
137
186
|
[multinomial]: https://nodef.github.io/extra-math/functions/multinomial.html
|
|
138
|
-
[constrain]: https://nodef.github.io/extra-math/functions/constrain.html
|
|
139
|
-
[root]: https://nodef.github.io/extra-math/functions/root.html
|
|
140
|
-
[log]: https://nodef.github.io/extra-math/functions/log.html
|
|
141
|
-
[normalize]: https://nodef.github.io/extra-math/functions/normalize.html
|
|
142
|
-
[remap]: https://nodef.github.io/extra-math/functions/remap.html
|
|
143
|
-
[lerp]: https://nodef.github.io/extra-math/functions/lerp.html
|
|
144
|
-
[erf]: https://nodef.github.io/extra-math/functions/erf.html
|
|
145
|
-
[erfc]: https://nodef.github.io/extra-math/functions/erfc.html
|
|
146
187
|
[degrees]: https://nodef.github.io/extra-math/functions/degrees.html
|
|
147
188
|
[radians]: https://nodef.github.io/extra-math/functions/radians.html
|
|
148
189
|
[magnitude]: https://nodef.github.io/extra-math/functions/magnitude.html
|
|
149
190
|
[distance]: https://nodef.github.io/extra-math/functions/distance.html
|
|
150
191
|
[sum]: https://nodef.github.io/extra-math/functions/sum.html
|
|
151
192
|
[product]: https://nodef.github.io/extra-math/functions/product.html
|
|
152
|
-
[mean]: https://nodef.github.io/extra-math/functions/mean.html
|
|
153
193
|
[median]: https://nodef.github.io/extra-math/functions/median.html
|
|
154
194
|
[modes]: https://nodef.github.io/extra-math/functions/modes.html
|
|
155
195
|
[range]: https://nodef.github.io/extra-math/functions/range.html
|
|
156
196
|
[variance]: https://nodef.github.io/extra-math/functions/variance.html
|
|
197
|
+
[arithmeticMean]: https://nodef.github.io/extra-math/functions/arithmeticMean.html
|
|
198
|
+
[geometricMean]: https://nodef.github.io/extra-math/functions/geometricMean.html
|
|
199
|
+
[harmonicMean]: https://nodef.github.io/extra-math/functions/harmonicMean.html
|
|
200
|
+
[quadriaticMean]: https://nodef.github.io/extra-math/functions/quadriaticMean.html
|
|
201
|
+
[cubicMean]: https://nodef.github.io/extra-math/functions/cubicMean.html
|