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
15 changes: 15 additions & 0 deletions BREAKING-CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,21 @@ is `null`. A row with symbols in it is tried at one value of them, and where it
| `MathS.Equations("ln(x) + ln(y)", "x - y").Solve("x", "y")` | `[[-1, -1], [1, 1]]` | `[[1, 1]]`: `ln(-1) + ln(-1)` is `2 pi i` |
| `MathS.Equations("sqrt(y) - x", "y - a").Solve("x", "y")` | `[[sqrt(a), (sqrt(a)) ^ 2], [-sqrt(a), (-sqrt(a)) ^ 2]]` | `null`: the second row is a solution only at `a = 0` |

### `conj`, `arg` and `det` are refused by name

**Not silent: these now throw `UnrecognizedFunctionParseException` where they parsed.** A name the parser does not
know, followed by a bracket, is read as a product, so `arg(z)` was the variable `arg` times `z`, and `arg(z) = 1`
solved to `{ 1 / arg }`. `conjugate` was already refused by name; `conj` and `arg` are the conjugate and the argument
as other systems spell them, and `det` is the determinant, which a `Matrix` has as the property `Determinant` but an
expression cannot call. `re` and `im` are still read as products, as before: two letters is short enough to be a
variable's name ([#2136](https://github.com/asc-community/AngouriMath/issues/2136)).

| Input | Was (2.6.0) | Now |
|---|---|---|
| `"arg(z)".ToEntity()` | `arg * z` | throws `UnrecognizedFunctionParseException` |
| `"conj(z)".ToEntity()` | `conj * z` | throws `UnrecognizedFunctionParseException` |
| `"det([[1, 2], [3, 4]])".ToEntity()` | `det * [[1, 2], [3, 4]]` | throws `UnrecognizedFunctionParseException` |

### A system with more or fewer equations than unknowns is solved or declined

**Not silent: what was an exception is an answer or `null`.** `EquationSystem.Solve` threw
Expand Down
7 changes: 7 additions & 0 deletions Sources/AngouriMath/Core/Antlr/AngouriMath.g
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,13 @@ atom returns[Entity value]

| 'trunc(' args = function_arguments ')' { $value = NotImplementedFunction("trunc", "rounding functions"); }
| 'conjugate(' args = function_arguments ')' { $value = NotImplementedFunction("conjugate", "complex conjugate as a symbolic function"); }
/* conj and arg are the conjugate and the argument as other systems spell them, and det the
determinant, which exists on a matrix but not in an expression. Each was read as a product:
arg(z) was arg * z. re and im are left as products, as MissingFunctionNamesRefusedTest
records. https://github.com/asc-community/AngouriMath/issues/2136 */
| 'conj(' args = function_arguments ')' { $value = NotImplementedFunction("conj", "complex conjugate as a symbolic function"); }
| 'arg(' args = function_arguments ')' { $value = NotImplementedFunction("arg", "complex argument as a symbolic function"); }
| 'det(' args = function_arguments ')' { $value = NotImplementedFunction("det", "determinant in an expression; a Matrix has the property Determinant"); }
| 'domain(' args = function_arguments ')'
{
Assert("domain", 2, $args.list.Count);
Expand Down
8 changes: 7 additions & 1 deletion Sources/AngouriMath/Core/Antlr/AngouriMath.interp

Large diffs are not rendered by default.

32 changes: 19 additions & 13 deletions Sources/AngouriMath/Core/Antlr/AngouriMath.tokens
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,17 @@ T__181=182
T__182=183
T__183=184
T__184=185
NEWLINE=186
NUMBER=187
SPECIALSET=188
BOOLEAN=189
NAN=190
VARIABLE=191
COMMENT=192
WS=193
T__185=186
T__186=187
T__187=188
NEWLINE=189
NUMBER=190
SPECIALSET=191
BOOLEAN=192
NAN=193
VARIABLE=194
COMMENT=195
WS=196
'!'=1
'^'=2
'-'=3
Expand Down Expand Up @@ -372,8 +375,11 @@ WS=193
'Chi('=179
'trunc('=180
'conjugate('=181
'domain('=182
'piecewise('=183
'apply('=184
'lambda('=185
'NaN'=190
'conj('=182
'arg('=183
'det('=184
'domain('=185
'piecewise('=186
'apply('=187
'lambda('=188
'NaN'=193
1,113 changes: 561 additions & 552 deletions Sources/AngouriMath/Core/Antlr/AngouriMathLexer.cs

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion Sources/AngouriMath/Core/Antlr/AngouriMathLexer.interp

Large diffs are not rendered by default.

32 changes: 19 additions & 13 deletions Sources/AngouriMath/Core/Antlr/AngouriMathLexer.tokens
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,17 @@ T__181=182
T__182=183
T__183=184
T__184=185
NEWLINE=186
NUMBER=187
SPECIALSET=188
BOOLEAN=189
NAN=190
VARIABLE=191
COMMENT=192
WS=193
T__185=186
T__186=187
T__187=188
NEWLINE=189
NUMBER=190
SPECIALSET=191
BOOLEAN=192
NAN=193
VARIABLE=194
COMMENT=195
WS=196
'!'=1
'^'=2
'-'=3
Expand Down Expand Up @@ -372,8 +375,11 @@ WS=193
'Chi('=179
'trunc('=180
'conjugate('=181
'domain('=182
'piecewise('=183
'apply('=184
'lambda('=185
'NaN'=190
'conj('=182
'arg('=183
'det('=184
'domain('=185
'piecewise('=186
'apply('=187
'lambda('=188
'NaN'=193
Loading
Loading