Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions BREAKING-CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ the right shape, written out or once its operations are carried out, throws `Inv
**Not silent: these names followed by a bracket now throw `UnrecognizedFunctionParseException` where they were read as
products.** An unknown name followed by a bracket is a product, so `zeta(2)` was `zeta * 2` and simplified to
`2 * zeta`. The long names of the functions the library is to have are refused until each is implemented, as `trunc`
is: `zeta`, `riemannzeta`, `hurwitzzeta`, `lambertw`, `productlog`, `harmonicnumber`, `catalannumber`, `multinomial` and
is: `zeta`, `riemannzeta`, `hurwitzzeta`, `lambertw`, `productlog`, `harmonicnumber`, `catalannumber` and
`forwarddifference`. Names that will not be functions,
because what they mean differs between sources or is already written exactly, are refused with the spelling to use:
`heaviside`, `unitstep`, `isprime`, `pochhammer`, `doublefactorial`, `factorial2`, `fractionalpart` and `quotient`.
Expand All @@ -480,7 +480,7 @@ Each name without a bracket is still a variable, and short names such as `beta`
| `"zeta(2)".ToEntity().Simplify()` | `2 * zeta` | throws `UnrecognizedFunctionParseException` |
| `"isprime(7)".ToEntity()` | `isprime * 7` | throws `UnrecognizedFunctionParseException`: write `n in PP` |
| `"heaviside(x)".ToEntity()` | `heaviside * x` | throws `UnrecognizedFunctionParseException`: write `iverson(x > 0)`, `iverson(x >= 0)` or `(1 + sgn(x))/2` |
| `"multinomial(a, b, c)".ToEntity()` | throws `UnhandledParseException` | throws `UnrecognizedFunctionParseException` |
| `"harmonicnumber(n, m)".ToEntity()` | throws `UnhandledParseException` | throws `UnrecognizedFunctionParseException` |

### The Möbius, divisor and prime-counting functions

Expand Down Expand Up @@ -530,6 +530,19 @@ and `Γ(x + n)/Γ(x)`. LaTeX draws them with Knuth's bars, `x^{\underline{n}}` a
| `"risingfactorial(3, 2)".ToEntity().Simplify()` | throws `UnhandledParseException` | `12` |
| `"fallingfactorial(5, 1/2)".ToEntity().EvalNumerical()` | throws `UnhandledParseException` | `2.29257989505120015013822761269...` |

### The multinomial coefficient

**Not silent: `multinomial(k_1, ..., k_m)` is `(k_1 + ... + k_m)! / (k_1! ... k_m!)`, where with two or more arguments it
was a parse error and with one it was a product.** It is written in the factorial, which is the gamma function off the
whole numbers, so it is symmetric in its arguments and has no value where an argument or their sum is a negative
integer ([#2182](https://github.com/asc-community/AngouriMath/issues/2182)).

| Input | Was (2.6.0) | Now |
|---|---|---|
| `"multinomial(2, 3, 4)".ToEntity().Simplify()` | throws `UnhandledParseException` | `1260` |
| `"multinomial(1/2, 1/2)".ToEntity().Simplify()` | throws `UnhandledParseException` | `4 / pi` |
| `"multinomial(n)".ToEntity()` | `multinomial * n` | `n! / n!` |

### A subscript may have a subscript

**Not silent: what was a parse error is a name.** A name took at most one `_`, so `x_1_2` and `X_a_beta` were lexer
Expand Down
3 changes: 3 additions & 0 deletions Sources/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -820,3 +820,6 @@ file_header_template=\nCopyright (c) 2019-2026 Angouri.\nAngouriMath is licensed

[Tests/UnitTests/Convenience/ComplexPartsCompilationTest.cs]
file_header_template=\nCopyright (c) 2019-2026 Angouri.\nAngouriMath is licensed under MIT.\nDetails: https://github.com/asc-community/AngouriMath/blob/master/LICENSE.md.\nWebsite: https://am.angouri.org.\n

[Tests/UnitTests/Convenience/MultinomialTest.cs]
file_header_template=\nCopyright (c) 2019-2026 Angouri.\nAngouriMath is licensed under MIT.\nDetails: https://github.com/asc-community/AngouriMath/blob/master/LICENSE.md.\nWebsite: https://am.angouri.org.\n
2 changes: 1 addition & 1 deletion Sources/AngouriMath/Core/Antlr/AngouriMath.g
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,7 @@ atom returns[Entity value]
| 'gcd(' args = function_arguments ')' { AssertAtLeast("gcd", 1, $args.list.Count); $value = $args.list.Aggregate((a, b) => MathS.Gcd(a, b)); }
| 'lcm(' args = function_arguments ')' { AssertAtLeast("lcm", 1, $args.list.Count); $value = $args.list.Aggregate((a, b) => MathS.Lcm(a, b)); }
| 'binomial(' args = function_arguments ')' { Assert("binomial", 2, $args.list.Count); $value = MathS.Binomial($args.list[0], $args.list[1]); }
| 'multinomial(' args = function_arguments ')' { $value = ParsingHelpers.Multinomial($args.list); }
| 'fallingfactorial(' args = function_arguments ')' { Assert("fallingfactorial", 2, $args.list.Count); $value = MathS.FallingFactorial($args.list[0], $args.list[1]); }
| 'factorialpower(' args = function_arguments ')' { Assert("factorialpower", 2, $args.list.Count); $value = MathS.FallingFactorial($args.list[0], $args.list[1]); }
| 'risingfactorial(' args = function_arguments ')' { Assert("risingfactorial", 2, $args.list.Count); $value = MathS.RisingFactorial($args.list[0], $args.list[1]); }
Expand Down Expand Up @@ -695,7 +696,6 @@ atom returns[Entity value]
| 'productlog(' args = function_arguments ')' { $value = NotImplementedFunction("productlog", "Lambert W function yet"); }
| 'harmonicnumber(' args = function_arguments ')' { $value = NotImplementedFunction("harmonicnumber", "harmonic numbers yet"); }
| 'catalannumber(' args = function_arguments ')' { $value = NotImplementedFunction("catalannumber", "Catalan numbers yet"); }
| 'multinomial(' args = function_arguments ')' { $value = NotImplementedFunction("multinomial", "multinomial coefficients yet"); }
| 'forwarddifference(' args = function_arguments ')' { $value = NotImplementedFunction("forwarddifference", "forward difference yet"); }
/* Names that will not be functions, refused with the spelling to use: what they mean is
ambiguous between sources, or is already written exactly another way. */
Expand Down
2 changes: 1 addition & 1 deletion Sources/AngouriMath/Core/Antlr/AngouriMath.interp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ null
'gcd('
'lcm('
'binomial('
'multinomial('
'fallingfactorial('
'factorialpower('
'risingfactorial('
Expand Down Expand Up @@ -215,7 +216,6 @@ null
'productlog('
'harmonicnumber('
'catalannumber('
'multinomial('
'forwarddifference('
'heaviside('
'unitstep('
Expand Down
84 changes: 42 additions & 42 deletions Sources/AngouriMath/Core/Antlr/AngouriMath.tokens
Original file line number Diff line number Diff line change
Expand Up @@ -409,48 +409,48 @@ WS=237
'gcd('=172
'lcm('=173
'binomial('=174
'fallingfactorial('=175
'factorialpower('=176
'risingfactorial('=177
'iverson('=178
'aleph('=179
'erf('=180
'erfc('=181
'erfi('=182
'Ei('=183
'li('=184
'polygamma('=185
'digamma('=186
'Si('=187
'Ci('=188
'Shi('=189
'Chi('=190
'det('=191
'transpose('=192
'dot('=193
'cross('=194
'laplacian('=195
'jacobian('=196
'hessian('=197
'resultant('=198
'conjugate('=199
'conj('=200
'arg('=201
'Re('=202
'Im('=203
're('=204
'real('=205
'im('=206
'imag('=207
'trunc('=208
'zeta('=209
'riemannzeta('=210
'hurwitzzeta('=211
'lambertw('=212
'productlog('=213
'harmonicnumber('=214
'catalannumber('=215
'multinomial('=216
'multinomial('=175
'fallingfactorial('=176
'factorialpower('=177
'risingfactorial('=178
'iverson('=179
'aleph('=180
'erf('=181
'erfc('=182
'erfi('=183
'Ei('=184
'li('=185
'polygamma('=186
'digamma('=187
'Si('=188
'Ci('=189
'Shi('=190
'Chi('=191
'det('=192
'transpose('=193
'dot('=194
'cross('=195
'laplacian('=196
'jacobian('=197
'hessian('=198
'resultant('=199
'conjugate('=200
'conj('=201
'arg('=202
'Re('=203
'Im('=204
're('=205
'real('=206
'im('=207
'imag('=208
'trunc('=209
'zeta('=210
'riemannzeta('=211
'hurwitzzeta('=212
'lambertw('=213
'productlog('=214
'harmonicnumber('=215
'catalannumber('=216
'forwarddifference('=217
'heaviside('=218
'unitstep('=219
Expand Down
Loading
Loading