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: 16 additions & 1 deletion BREAKING-CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,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` and `productlog`. Names that will not be functions,
is: `zeta`, `riemannzeta` and `hurwitzzeta`. 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`.
Each name without a bracket is still a variable, and short names such as `beta` and `norm` are still read as products
Expand Down Expand Up @@ -555,6 +555,21 @@ through `digamma` and `polygamma` for a whole `m >= 1`. A negative integer `n` h
| `"harmonicnumber(4)".ToEntity().Simplify()` | `4 * harmonicnumber` | `25/12` |
| `"harmonicnumber(n, 2)".ToEntity()` | throws `UnhandledParseException` | `harmonicnumber(n, 2)` |

### The Lambert W function

**Not silent: `lambertw(z)` and `lambertw(k, z)`, also `productlog`, are the Lambert W function, the solution `w` of
`w e^w = z` on the branch `k`, where they were a product and a parse error.** The branches are those of Corless et
al. (1996), as Mathematica's `ProductLog` and mpmath's `lambertw` have them: `W_0` is real on `[-1/e, +oo)` and `W_(-1)`
on `[-1/e, 0)`. It is exact at `0` and where `z` is `c e^c` for a real `c` the branch takes, so `lambertw(e)` is `1`
and `lambertw(-1/e)` is `-1`, and it is evaluated numerically elsewhere. Its derivative is `e^(-W(z))/(1 + W(z))`
([#2182](https://github.com/asc-community/AngouriMath/issues/2182)).

| Input | Was (2.6.0) | Now |
|---|---|---|
| `"lambertw(e)".ToEntity().Simplify()` | `e * lambertw` | `1` |
| `"productlog(e)".ToEntity().Simplify()` | `e * productlog` | `1` |
| `"lambertw(-1, x)".ToEntity()` | throws `UnhandledParseException` | `lambertw(-1, x)` |

### The Catalan numbers

**Not silent: `catalannumber(n)` is the Catalan number, where it was a product.** It is `binomial(2n, n) / (n + 1)` for
Expand Down
9 changes: 9 additions & 0 deletions Sources/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -835,3 +835,12 @@ file_header_template=\nCopyright (c) 2019-2026 Angouri.\nAngouriMath is licensed

[Tests/UnitTests/Convenience/ForwardDifferenceTest.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

[AngouriMath/Core/Entity/Continuous/Number/LambertW.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

[AngouriMath/Core/Entity/Continuous/Entity.Continuous.LambertW.Classes.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/LambertWTest.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
8 changes: 8 additions & 0 deletions Sources/AngouriMath/Convenience/MathS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1631,6 +1631,14 @@ public static Entity VectorLength(Matrix v)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Entity Digamma(Entity argument) => new Polygammaf(Integer.Zero, argument);

/// <summary>The principal branch of the Lambert W function, the solution <c>w</c> of <c>w e^w = z</c></summary>
/// <remarks>https://github.com/asc-community/AngouriMath/issues/2182</remarks>
public static Entity LambertW(Entity z) => new LambertWf(Integer.Zero, z);

/// <summary>The branch <paramref name="k"/> of the Lambert W function</summary>
/// <remarks>https://github.com/asc-community/AngouriMath/issues/2182</remarks>
public static Entity LambertW(Entity k, Entity z) => new LambertWf(k, z);

/// <summary>The upper incomplete gamma function, <c>Gamma(a, z) = int_z^oo t^(a - 1) e^(-t) dt</c></summary>
/// <param name="parameter">The parameter <c>a</c>, any complex number</param>
/// <param name="lowerLimit">The lower limit <c>z</c>, any complex number; <c>0</c> only where <c>Re a > 0</c></param>
Expand Down
4 changes: 2 additions & 2 deletions Sources/AngouriMath/Core/Antlr/AngouriMath.g
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,8 @@ atom returns[Entity value]
| 'Ei(' args = function_arguments ')' { Assert("Ei", 1, $args.list.Count); $value = MathS.Ei($args.list[0]); }
| 'li(' args = function_arguments ')' { Assert("li", 1, $args.list.Count); $value = MathS.Li($args.list[0]); }
/* The polygamma functions, and the digamma function, which is the one of order 0. https://github.com/asc-community/AngouriMath/issues/171 */
| 'lambertw(' args = function_arguments ')' { if (Assert("lambertw", (2, 1), $args.list.Count)) $value = MathS.LambertW($args.list[0], $args.list[1]); else $value = MathS.LambertW($args.list[0]); }
| 'productlog(' args = function_arguments ')' { if (Assert("productlog", (2, 1), $args.list.Count)) $value = MathS.LambertW($args.list[0], $args.list[1]); else $value = MathS.LambertW($args.list[0]); }
| 'polygamma(' args = function_arguments ')' { Assert("polygamma", 2, $args.list.Count); $value = MathS.Polygamma($args.list[0], $args.list[1]); }
| 'digamma(' args = function_arguments ')' { Assert("digamma", 1, $args.list.Count); $value = MathS.Digamma($args.list[0]); }
/* The trigonometric and hyperbolic integrals. https://github.com/asc-community/AngouriMath/issues/1501 */
Expand Down Expand Up @@ -695,8 +697,6 @@ atom returns[Entity value]
| 'zeta(' args = function_arguments ')' { $value = NotImplementedFunction("zeta", "Riemann or Hurwitz zeta function yet"); }
| 'riemannzeta(' args = function_arguments ')' { $value = NotImplementedFunction("riemannzeta", "Riemann zeta function yet"); }
| 'hurwitzzeta(' args = function_arguments ')' { $value = NotImplementedFunction("hurwitzzeta", "Hurwitz zeta function yet"); }
| 'lambertw(' args = function_arguments ')' { $value = NotImplementedFunction("lambertw", "Lambert W function yet"); }
| 'productlog(' args = function_arguments ')' { $value = NotImplementedFunction("productlog", "Lambert W function 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. */
| 'heaviside(' args = function_arguments ')' { $value = NotAFunctionHere("heaviside", "its value at 0 is 0, 1/2 or 1 by source; write iverson(x > 0), iverson(x >= 0) or (1 + sgn(x))/2"); }
Expand Down
4 changes: 2 additions & 2 deletions Sources/AngouriMath/Core/Antlr/AngouriMath.interp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ null
'erfi('
'Ei('
'li('
'lambertw('
'productlog('
'polygamma('
'digamma('
'Si('
Expand Down Expand Up @@ -215,8 +217,6 @@ null
'zeta('
'riemannzeta('
'hurwitzzeta('
'lambertw('
'productlog('
'heaviside('
'unitstep('
'isprime('
Expand Down
60 changes: 30 additions & 30 deletions Sources/AngouriMath/Core/Antlr/AngouriMath.tokens
Original file line number Diff line number Diff line change
Expand Up @@ -422,36 +422,36 @@ WS=237
'erfi('=185
'Ei('=186
'li('=187
'polygamma('=188
'digamma('=189
'Si('=190
'Ci('=191
'Shi('=192
'Chi('=193
'det('=194
'transpose('=195
'dot('=196
'cross('=197
'laplacian('=198
'forwarddifference('=199
'jacobian('=200
'hessian('=201
'resultant('=202
'conjugate('=203
'conj('=204
'arg('=205
'Re('=206
'Im('=207
're('=208
'real('=209
'im('=210
'imag('=211
'trunc('=212
'zeta('=213
'riemannzeta('=214
'hurwitzzeta('=215
'lambertw('=216
'productlog('=217
'lambertw('=188
'productlog('=189
'polygamma('=190
'digamma('=191
'Si('=192
'Ci('=193
'Shi('=194
'Chi('=195
'det('=196
'transpose('=197
'dot('=198
'cross('=199
'laplacian('=200
'forwarddifference('=201
'jacobian('=202
'hessian('=203
'resultant('=204
'conjugate('=205
'conj('=206
'arg('=207
'Re('=208
'Im('=209
're('=210
'real('=211
'im('=212
'imag('=213
'trunc('=214
'zeta('=215
'riemannzeta('=216
'hurwitzzeta('=217
'heaviside('=218
'unitstep('=219
'isprime('=220
Expand Down
Loading
Loading