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
14 changes: 13 additions & 1 deletion 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` and
is: `zeta`, `riemannzeta`, `hurwitzzeta`, `lambertw`, `productlog`, `harmonicnumber` 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 Down Expand Up @@ -516,6 +516,18 @@ is ([#2182](https://github.com/asc-community/AngouriMath/issues/2182)).
| `"hessian(x^3 y^2, [x, y])".ToEntity().Simplify()` | throws `UnhandledParseException` | `[[6 * x * y ^ 2, 6 * x ^ 2 * y], [6 * x ^ 2 * y, 2 * x ^ 3]]` |
| `"jacobian(x y, {x, y})".ToEntity()` | throws `UnhandledParseException` | throws `InvalidArgumentParseException`: a set has no order for the columns |

### The Catalan numbers

**Not silent: `catalannumber(n)` is the Catalan number, where it was a product.** It is `binomial(2n, n) / (n + 1)` for
a whole `n >= 0`, and `4^n Γ(n + 1/2) / (√π Γ(n + 2))` elsewhere, as SymPy's `catalan` is: `-1/2` at `-1`, `0` at
every whole number below it, and no value at a negative half-integer
([#2182](https://github.com/asc-community/AngouriMath/issues/2182)).

| Input | Was (2.6.0) | Now |
|---|---|---|
| `"catalannumber(4)".ToEntity().Simplify()` | `4 * catalannumber` | `14` |
| `"catalannumber(-1)".ToEntity().Simplify()` | `-catalannumber` | `-1/2` |

### The falling and the rising factorial

**Not silent: `fallingfactorial(x, n)`, also `factorialpower(x, n)`, and `risingfactorial(x, n)` are functions, where
Expand Down
3 changes: 3 additions & 0 deletions Sources/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -823,3 +823,6 @@ file_header_template=\nCopyright (c) 2019-2026 Angouri.\nAngouriMath is licensed

[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

[Tests/UnitTests/Convenience/CatalanNumberTest.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
4 changes: 4 additions & 0 deletions Sources/AngouriMath/Convenience/MathS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1387,6 +1387,10 @@ public static Entity VectorLength(Matrix v)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Entity Binomial(Entity n, Entity k) => new Binomialf(n, k);

/// <summary>The Catalan number <c>C_n = binomial(2n, n) / (n + 1)</c></summary>
/// <remarks>https://github.com/asc-community/AngouriMath/issues/2182</remarks>
public static Entity CatalanNumber(Entity n) => new CatalanNumberf(n);

/// <summary>The falling factorial <c>x (x - 1) ... (x - n + 1)</c>, <c>x^{\underline{n}}</c></summary>
/// <remarks>https://github.com/asc-community/AngouriMath/issues/2182</remarks>
public static Entity FallingFactorial(Entity x, Entity n) => new FallingFactorialf(x, n);
Expand Down
2 changes: 1 addition & 1 deletion Sources/AngouriMath/Core/Antlr/AngouriMath.g
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,7 @@ atom returns[Entity value]
| '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); }
| 'catalannumber(' args = function_arguments ')' { Assert("catalannumber", 1, $args.list.Count); $value = MathS.CatalanNumber($args.list[0]); }
| '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]
| 'lambertw(' args = function_arguments ')' { $value = NotImplementedFunction("lambertw", "Lambert W function yet"); }
| '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"); }
| '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 @@ -175,6 +175,7 @@ null
'lcm('
'binomial('
'multinomial('
'catalannumber('
'fallingfactorial('
'factorialpower('
'risingfactorial('
Expand Down Expand Up @@ -215,7 +216,6 @@ null
'lambertw('
'productlog('
'harmonicnumber('
'catalannumber('
'forwarddifference('
'heaviside('
'unitstep('
Expand Down
82 changes: 41 additions & 41 deletions Sources/AngouriMath/Core/Antlr/AngouriMath.tokens
Original file line number Diff line number Diff line change
Expand Up @@ -410,47 +410,47 @@ WS=237
'lcm('=173
'binomial('=174
'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
'catalannumber('=176
'fallingfactorial('=177
'factorialpower('=178
'risingfactorial('=179
'iverson('=180
'aleph('=181
'erf('=182
'erfc('=183
'erfi('=184
'Ei('=185
'li('=186
'polygamma('=187
'digamma('=188
'Si('=189
'Ci('=190
'Shi('=191
'Chi('=192
'det('=193
'transpose('=194
'dot('=195
'cross('=196
'laplacian('=197
'jacobian('=198
'hessian('=199
'resultant('=200
'conjugate('=201
'conj('=202
'arg('=203
'Re('=204
'Im('=205
're('=206
'real('=207
'im('=208
'imag('=209
'trunc('=210
'zeta('=211
'riemannzeta('=212
'hurwitzzeta('=213
'lambertw('=214
'productlog('=215
'harmonicnumber('=216
'forwarddifference('=217
'heaviside('=218
'unitstep('=219
Expand Down
Loading
Loading