extra-math 1.3.14 โ 1.3.17
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 +32 -8
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,11 +1,34 @@
|
|
|
1
|
-
|
|
1
|
+
A collection of common mathematical functions.<br>
|
|
2
2
|
๐ฆ [Node.js](https://www.npmjs.com/package/extra-math),
|
|
3
3
|
๐ [Web](https://www.npmjs.com/package/extra-math.web),
|
|
4
4
|
๐ [Files](https://unpkg.com/extra-math/),
|
|
5
5
|
๐ฐ [JSDoc](https://nodef.github.io/extra-math/),
|
|
6
6
|
๐ [Wiki](https://github.com/nodef/extra-math/wiki/).
|
|
7
7
|
|
|
8
|
-
Mathematics is the classification and study of all possible patterns. [(1)]
|
|
8
|
+
Mathematics is the classification and study of all possible patterns. [(1)] This
|
|
9
|
+
package includes common mathematical functions related to *natural numbers*, *real*
|
|
10
|
+
*numbers*, *geometry*, and *statistics*.
|
|
11
|
+
|
|
12
|
+
**Natural numbers**: There are 3 different ways of performing the *modulo*
|
|
13
|
+
operation: [rem], [mod], and [modp]. [gcd]/`HCF` and [lcm] of a list of numbers
|
|
14
|
+
can be obtained. To calculate the number of ways of *ordering items*, use
|
|
15
|
+
[factorial]/`P(n, k)`, [binomial]/`C(n, k)`, or [multinomial]/`n!/kโ!kโ!...`.
|
|
16
|
+
|
|
17
|
+
**Real numbers**: *Range* of a number can be controlled with [constrain],
|
|
18
|
+
[norm], or [map]. Use [lerp] for *linear interpolation* (or extrapolation);
|
|
19
|
+
[root] for calculating the *n-th root* of a number; and [log] to find the
|
|
20
|
+
*logarithm* of a number with a given base. Results of *special mathematical
|
|
21
|
+
functions* (approximations) for a given number can be obtained with [gamma],
|
|
22
|
+
[lgamma], [erf], and [erfc].
|
|
23
|
+
|
|
24
|
+
**Geometry**: Perform conversion from [degrees] to [radians] and vice versa.
|
|
25
|
+
Find the [magnitude] of a vector or [distance] between two points.
|
|
26
|
+
|
|
27
|
+
**Statistics**: For a list of numbers, we can calculate the [sum], [product],
|
|
28
|
+
[mean]. [median] gives the value lying in the middle when the numbers are
|
|
29
|
+
sorted, and [modes] gives the values which are repeated most often. The
|
|
30
|
+
difference between the largest and the smallest values is the [range].
|
|
31
|
+
[variance] is a measure of variability of numbers.
|
|
9
32
|
|
|
10
33
|
This package is available in both *Node.js* and *Web* formats. The web format is
|
|
11
34
|
exposed as `extra_math` standalone variable and can be loaded from [jsDelivr CDN].
|
|
@@ -54,11 +77,11 @@ math.lcm(2, 3, 4);
|
|
|
54
77
|
| [multinomial] | Find the number of ways to put n objects in m bins (n=sum(kแตข)). |
|
|
55
78
|
| | |
|
|
56
79
|
| [constrain] | Constrain a number within a minimum and a maximum value. |
|
|
57
|
-
| [root] | Find the nth root of a number (โฟโ). |
|
|
58
|
-
| [log] | Find the logarithm of a number with a given base. |
|
|
59
80
|
| [norm] | Normalize a number from its current range into a value between 0 and 1. |
|
|
60
81
|
| [map] | Re-map a number from one range to another. |
|
|
61
82
|
| [lerp] | Linearly interpolate a number between two numbers. |
|
|
83
|
+
| [root] | Find the nth root of a number (โฟโ). |
|
|
84
|
+
| [log] | Find the logarithm of a number with a given base. |
|
|
62
85
|
| [gamma] | Compute the gamma function of a number (ฮ). |
|
|
63
86
|
| [lgamma] | Compute the natural logarithm of the absolute value of the gamma function of a number (log-ฮ). |
|
|
64
87
|
| [erf] | Find error function value of number (approximation). |
|
|
@@ -66,8 +89,8 @@ math.lcm(2, 3, 4);
|
|
|
66
89
|
| | |
|
|
67
90
|
| [degrees] | Convert radians to degrees. |
|
|
68
91
|
| [radians] | Convert degrees to radians. |
|
|
69
|
-
| [
|
|
70
|
-
| [
|
|
92
|
+
| [magnitude] | Calculate the magnitude (length) of a vector. |
|
|
93
|
+
| [distance] | Calculate the distance between two points. |
|
|
71
94
|
| | |
|
|
72
95
|
| [sum] | Find the sum of numbers (ฮฃ). |
|
|
73
96
|
| [product] | Find the product of numbers (โ). |
|
|
@@ -93,6 +116,7 @@ math.lcm(2, 3, 4);
|
|
|
93
116
|
- [Permutation](https://en.wikipedia.org/wiki/Permutation)
|
|
94
117
|
- [Binomial coefficient](https://en.wikipedia.org/wiki/Binomial_coefficient)
|
|
95
118
|
- [Multinomial distribution](https://en.wikipedia.org/wiki/Multinomial_distribution)
|
|
119
|
+
- [Conventional commits](https://www.conventionalcommits.org/en/v1.0.0-beta.2/)
|
|
96
120
|
|
|
97
121
|
<br>
|
|
98
122
|
<br>
|
|
@@ -121,8 +145,8 @@ math.lcm(2, 3, 4);
|
|
|
121
145
|
[erfc]: https://nodef.github.io/extra-math/modules.html#erfc
|
|
122
146
|
[degrees]: https://nodef.github.io/extra-math/modules.html#degrees
|
|
123
147
|
[radians]: https://nodef.github.io/extra-math/modules.html#radians
|
|
124
|
-
[
|
|
125
|
-
[
|
|
148
|
+
[magnitude]: https://nodef.github.io/extra-math/modules.html#magnitude
|
|
149
|
+
[distance]: https://nodef.github.io/extra-math/modules.html#distance
|
|
126
150
|
[sum]: https://nodef.github.io/extra-math/modules.html#sum
|
|
127
151
|
[product]: https://nodef.github.io/extra-math/modules.html#product
|
|
128
152
|
[mean]: https://nodef.github.io/extra-math/modules.html#mean
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "extra-math",
|
|
3
|
-
"version": "1.3.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.3.17",
|
|
4
|
+
"description": "A collection of common mathematical functions.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
7
7
|
"sideEffects": false,
|