mathjs 10.4.2 → 10.4.3
Sign up to get free protection for your applications and to get access to all the features.
- package/HISTORY.md +9 -0
- package/docs/expressions/syntax.md +7 -3
- package/docs/reference/functions/stirlingS2.md +5 -1
- package/lib/browser/math.js +3 -3
- package/lib/browser/math.js.map +1 -1
- package/lib/cjs/entry/dependenciesAny/dependenciesStirlingS2.generated.js +6 -0
- package/lib/cjs/entry/dependenciesNumber/dependenciesStirlingS2.generated.js +3 -0
- package/lib/cjs/entry/pureFunctionsAny.generated.js +2 -0
- package/lib/cjs/entry/pureFunctionsNumber.generated.js +1 -0
- package/lib/cjs/factoriesNumber.js +12 -2
- package/lib/cjs/function/combinatorics/stirlingS2.js +42 -12
- package/lib/cjs/header.js +2 -2
- package/lib/cjs/plain/number/arithmetic.js +8 -4
- package/lib/cjs/version.js +1 -1
- package/lib/esm/entry/dependenciesAny/dependenciesStirlingS2.generated.js +4 -0
- package/lib/esm/entry/dependenciesNumber/dependenciesStirlingS2.generated.js +2 -0
- package/lib/esm/entry/pureFunctionsAny.generated.js +2 -0
- package/lib/esm/entry/pureFunctionsNumber.generated.js +1 -0
- package/lib/esm/factoriesNumber.js +14 -2
- package/lib/esm/function/combinatorics/stirlingS2.js +41 -12
- package/lib/esm/plain/number/arithmetic.js +7 -3
- package/lib/esm/version.js +1 -1
- package/package.json +1 -1
package/HISTORY.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# History
|
2
2
|
|
3
|
+
|
4
|
+
# 2022-04-08, version 10.4.3
|
5
|
+
|
6
|
+
- Fix #2508: improve the precision of stirlingS2 (#2509). Thanks @gwhitney.
|
7
|
+
- Fix #2514: implement optional argument `base` in the number implementation
|
8
|
+
of function `log` (#2515). Thanks @gwhitney.
|
9
|
+
- Improve the documentation on operator `;` (#2512). Thanks @gwhitney.
|
10
|
+
|
11
|
+
|
3
12
|
# 2022-03-29, version 10.4.2
|
4
13
|
|
5
14
|
- Fix #2499: different behavior for unit conversion "degC" and "K" (#2501).
|
@@ -24,7 +24,11 @@ the lower level syntax of math.js. Differences are:
|
|
24
24
|
not bitwise xor.
|
25
25
|
- Implicit multiplication, like `2 pi`, is supported and has special rules.
|
26
26
|
- Relational operators (`<`, `>`, `<=`, `>=`, `==`, and `!=`) are chained, so the expression `5 < x < 10` is equivalent to `5 < x and x < 10`.
|
27
|
-
|
27
|
+
- Multi-expression constructs like `a = 1; b = 2; a + b` or
|
28
|
+
`"a = 1;\n cos(a)\n sin(a)"` (where `\n` denotes newline)
|
29
|
+
produce a collection ("ResultSet") of values. Those expressions
|
30
|
+
terminated by `;` are evaluated for side effect only and their values
|
31
|
+
are suppressed from the result.
|
28
32
|
|
29
33
|
## Operators
|
30
34
|
|
@@ -651,7 +655,7 @@ Parentheses are parsed as a function call when there is a symbol or accessor on
|
|
651
655
|
the left hand side, like `sqrt(4)` or `obj.method(4)`. In other cases the
|
652
656
|
parentheses are interpreted as an implicit multiplication.
|
653
657
|
|
654
|
-
Math.js will always evaluate implicit multiplication before explicit multiplication `*`, so that the expression `x * y z` is parsed as `x * (y * z)`. Math.js also gives implicit multiplication higher precedence than division, *except* when the division matches the pattern `[number] / [number] [symbol]` or `[number] / [number] [left paren]`. In that special case, the division is evaluated first:
|
658
|
+
Math.js will always evaluate implicit multiplication before explicit multiplication `*`, so that the expression `x * y z` is parsed as `x * (y * z)`. Math.js also gives implicit multiplication higher precedence than division, *except* when the division matches the pattern `[unaryPrefixOp]?[number] / [number] [symbol]` or `[unaryPrefixOp]?[number] / [number] [left paren]`. In that special case, the division is evaluated first:
|
655
659
|
|
656
660
|
```js
|
657
661
|
math.evaluate('20 kg / 4 kg') // 5 Evaluated as (20 kg) / (4 kg)
|
@@ -661,7 +665,7 @@ math.evaluate('20 / 4 kg') // 5 kg Evaluated as (20 / 4) kg
|
|
661
665
|
The behavior of implicit multiplication can be summarized by these operator precedence rules, listed from highest to lowest precedence:
|
662
666
|
|
663
667
|
- Function calls: `[symbol] [left paren]`
|
664
|
-
- Explicit division `/` when the division matches this pattern: `[number] / [number] [symbol]` or `[number] / [number] [left paren]`
|
668
|
+
- Explicit division `/` when the division matches this pattern: `[+-~]?[number] / [+-~]?[number] [symbol]` or `[number] / [number] [left paren]`
|
665
669
|
- Implicit multiplication
|
666
670
|
- All other division `/` and multiplication `*`
|
667
671
|
|
@@ -7,7 +7,11 @@ a set of n labelled objects into k nonempty unlabelled subsets.
|
|
7
7
|
stirlingS2 only takes integer arguments.
|
8
8
|
The following condition must be enforced: k <= n.
|
9
9
|
|
10
|
-
If n = k or k = 1, then s(n,k) = 1
|
10
|
+
If n = k or k = 1 <= n, then s(n,k) = 1
|
11
|
+
If k = 0 < n, then s(n,k) = 0
|
12
|
+
|
13
|
+
Note that if either n or k is supplied as a BigNumber, the result will be
|
14
|
+
as well.
|
11
15
|
|
12
16
|
|
13
17
|
## Syntax
|