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
20 changes: 19 additions & 1 deletion BREAKING-CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ the right shape, written out or once its operations are carried out, throws `Inv
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`, `fallingfactorial`, `factorialpower`,
`risingfactorial`, `forwarddifference`, `laplacian`, `jacobian` and `hessian`. Names that will not be functions,
`risingfactorial` 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`.
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 @@ -481,6 +481,24 @@ elsewhere. `primepi(x)` counts the primes at most the real number `x`
| `"primeomega(12)".ToEntity().Simplify()` | `12 * primeomega` | `3` |
| `"primepi(10)".ToEntity().Evaled` | `primepi * 10` | `4` |
| `"mobius(0)".ToEntity().Simplify()` | `0` | `NaN` |

### The Laplacian, the Jacobian and the Hessian

**Not silent: `laplacian(f, x)`, `jacobian(F, x)` and `hessian(f, x)` are now computed into derivatives, where they were
read as products or, with two arguments, were a parse error.** They are taken in the variables listed as a vector,
`[x, y, z]`, or in one variable. `laplacian` is the sum of the second derivatives of a scalar function. `jacobian` is the
matrix with a row for each component of `F` and a column for each variable. `hessian` is the matrix of the second
derivatives, the entry in row `i` and column `j` being the derivative in `x_i` of the derivative in `x_j`. Like `det`
they are computed when parsed and have no node: the result is made of `derivative` nodes, evaluated as any derivative
is ([#2182](https://github.com/asc-community/AngouriMath/issues/2182)).

| Input | Was (2.6.0) | Now |
|---|---|---|
| `"laplacian(x^2 y + y^3, [x, y])".ToEntity().Simplify()` | throws `UnhandledParseException` | `8 * y` |
| `"jacobian([x y, x + y], [x, y])".ToEntity().Simplify()` | throws `UnhandledParseException` | `[[y, x], [1, 1]]` |
| `"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 |

### 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 @@ -808,3 +808,6 @@ file_header_template=\nCopyright (c) 2019-2026 Angouri.\nAngouriMath is licensed

[Tests/UnitTests/Convenience/NumberTheoryFunctionsTest.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/VectorCalculusTest.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
6 changes: 3 additions & 3 deletions Sources/AngouriMath/Core/Antlr/AngouriMath.g
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,9 @@ atom returns[Entity value]
| 'transpose(' args = function_arguments ')' { Assert("transpose", 1, $args.list.Count); $value = ParsingHelpers.Transposed($args.list[0]); }
| 'dot(' args = function_arguments ')' { Assert("dot", 2, $args.list.Count); $value = ParsingHelpers.Dot($args.list[0], $args.list[1]); }
| 'cross(' args = function_arguments ')' { Assert("cross", (1, 2), $args.list.Count); $value = ParsingHelpers.Cross($args.list); }
| 'laplacian(' args = function_arguments ')' { Assert("laplacian", 2, $args.list.Count); $value = ParsingHelpers.Laplacian($args.list[0], $args.list[1]); }
| 'jacobian(' args = function_arguments ')' { Assert("jacobian", 2, $args.list.Count); $value = ParsingHelpers.Jacobian($args.list[0], $args.list[1]); }
| 'hessian(' args = function_arguments ')' { Assert("hessian", 2, $args.list.Count); $value = ParsingHelpers.Hessian($args.list[0], $args.list[1]); }
| 'resultant(' args = function_arguments ')' { Assert("resultant", 3, $args.list.Count); $value = ParsingHelpers.Resultant($args.list[0], $args.list[1], $args.list[2]); }
/* The complex conjugate, by its name and by the shorter one other systems use.
https://github.com/asc-community/AngouriMath/issues/2145 */
Expand Down Expand Up @@ -694,9 +697,6 @@ atom returns[Entity value]
| 'factorialpower(' args = function_arguments ')' { $value = NotImplementedFunction("factorialpower", "falling factorial yet"); }
| 'risingfactorial(' args = function_arguments ')' { $value = NotImplementedFunction("risingfactorial", "rising factorial yet"); }
| 'forwarddifference(' args = function_arguments ')' { $value = NotImplementedFunction("forwarddifference", "forward difference yet"); }
| 'laplacian(' args = function_arguments ')' { $value = NotImplementedFunction("laplacian", "Laplacian yet"); }
| 'jacobian(' args = function_arguments ')' { $value = NotImplementedFunction("jacobian", "Jacobian yet"); }
| 'hessian(' args = function_arguments ')' { $value = NotImplementedFunction("hessian", "Hessian 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
6 changes: 3 additions & 3 deletions Sources/AngouriMath/Core/Antlr/AngouriMath.interp
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ null
'transpose('
'dot('
'cross('
'laplacian('
'jacobian('
'hessian('
'resultant('
'conjugate('
'conj('
Expand All @@ -214,9 +217,6 @@ null
'factorialpower('
'risingfactorial('
'forwarddifference('
'laplacian('
'jacobian('
'hessian('
'heaviside('
'unitstep('
'isprime('
Expand Down
52 changes: 26 additions & 26 deletions Sources/AngouriMath/Core/Antlr/AngouriMath.tokens
Original file line number Diff line number Diff line change
Expand Up @@ -426,32 +426,32 @@ WS=237
'transpose('=189
'dot('=190
'cross('=191
'resultant('=192
'conjugate('=193
'conj('=194
'arg('=195
'Re('=196
'Im('=197
're('=198
'real('=199
'im('=200
'imag('=201
'trunc('=202
'zeta('=203
'riemannzeta('=204
'hurwitzzeta('=205
'lambertw('=206
'productlog('=207
'harmonicnumber('=208
'catalannumber('=209
'multinomial('=210
'fallingfactorial('=211
'factorialpower('=212
'risingfactorial('=213
'forwarddifference('=214
'laplacian('=215
'jacobian('=216
'hessian('=217
'laplacian('=192
'jacobian('=193
'hessian('=194
'resultant('=195
'conjugate('=196
'conj('=197
'arg('=198
'Re('=199
'Im('=200
're('=201
'real('=202
'im('=203
'imag('=204
'trunc('=205
'zeta('=206
'riemannzeta('=207
'hurwitzzeta('=208
'lambertw('=209
'productlog('=210
'harmonicnumber('=211
'catalannumber('=212
'multinomial('=213
'fallingfactorial('=214
'factorialpower('=215
'risingfactorial('=216
'forwarddifference('=217
'heaviside('=218
'unitstep('=219
'isprime('=220
Expand Down
Loading
Loading