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
36 changes: 36 additions & 0 deletions BREAKING-CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,42 @@ the candidate ([#2650](https://github.com/asc-community/AngouriMath/issues/2650)
| `"(1 - i) + (1 - 2 * i) * (10^30 x) + 2 (10^30 x)^2 - 3 Im(10^30 x) = 0".Solve("x")` | the equation, unsolved | its roots, `10^-30` times those of the equation in `x` |
| `"3 + (2 + i) (10^30 x)^2 + 3 Im(10^30 x) = 0".Solve("x")` | the equation, unsolved | its roots, `10^-30` times those of the equation in `x` |

### A root is not accepted on a residual the working digits cannot tell from zero

**Silent: wrong roots are now no answer.** An equation whose coefficient nearly cancels, such as `P - Q sqrt(2)` with
`P + Q sqrt(2) = (1 + sqrt(2))^n`, was solved with that coefficient read as 0, or past the hundred working digits as
some other number, and the roots were exact numbers that are no roots. The check that puts a root back enclosed its
residual only where the equation had no decimal in it, and an integer of more digits than half the working precision is
parsed as one ([#2615](https://github.com/asc-community/AngouriMath/issues/2615)); and it enclosed to at most the
digits of the largest number once more, where a residual such as `b^2 / 4`, the part of `b^2 + 12` that was dropped,
needs about four times those. A root now leaves the equation unsolved where an interval enclosing its residual leaves
zero out: with such a written integer in it as well, and at digits doubled up to four times the orders the numbers
it is written with span. A polynomial answered with no root is left unsolved where a coefficient read as zero is shown
not to be, and a statement left unsolved keeps its own numbers where simplifying would evaluate one of them to
another ([#2448](https://github.com/asc-community/AngouriMath/issues/2448)).

`P + Q sqrt(2) = (1 + sqrt(2))^n`, `U - V sqrt(6) = (sqrt(3) - sqrt(2))^n`, `L` and `F` the Lucas and Fibonacci numbers:

| Input | Was (2.10.0) | Now |
|---|---|---|
| `x^2 + (P - Q sqrt(2)) x - 3`, `n = 160`, `SolveEquation` and `Solve` | `{ (-(P - Q sqrt(2)) - 2 sqrt(3)) / 2, (-(P - Q sqrt(2)) + 2 sqrt(3)) / 2 }`, each leaving `8.1e-124` | the equation, unsolved |
| `x^2 + (1 - sqrt(2))^160 x - 3`, both | the same roots, with `(1 - sqrt(2))^160` for `b` | unsolved |
| `x^2 + (P - Q sqrt(2)) x - 3 = 0`, `n = 270`, `Solve` | `{ x : x ^ 2 + 2499 * x - 3 = 0 }` | `{ x : x ^ 2 + (P - Q * sqrt(2)) * x - 3 = 0 }` |
| `(P - Q sqrt(2)) x - 1`, `n = 200`, both | `{ }` | unsolved |
| `(P - Q sqrt(2)) x - 1 = 0`, `n = 300`, `Solve` | `{ x : 241546412250001 * x - 1 = 0 }` | `{ x : (P - Q * sqrt(2)) * x - 1 = 0 }` |
| `x + (P - Q sqrt(2)) = 0`, `n = 200`, `Solve` | `{ x : x = 0 }` | `{ x : x + P - Q * sqrt(2) = 0 }` |
| `(1 - sqrt(2))^160 x - 1`, both | `{ 17543233911800695450907164956888413406276808032081050028214274 }` | unsolved |
| `x^3 + (P - Q sqrt(2)) x - 1`, `n = 60`, both | `{ }` | unsolved |
| `x^3 + ((L - F sqrt(5)) / 2) x - 1`, `n = 100`, both | `{ }` | unsolved |
| `x^2 + (P - Q sqrt(2)) x - 3`, `n` = 20 to 60, and 220 to 240 through `SolveEquation`; `P + Q sqrt(2)` to 120 | its roots | unchanged |

Measured against mpmath at 1600 digits for `x^2 + (P -+ Q sqrt(2)) x - 3` at `n` = 20 to 300 by tens, and for
`P - Q sqrt(2)`, `(1 - sqrt(2))^n`, `U - V sqrt(6)` and `(L - F sqrt(5)) / 2` at nine `n` from 20 to 300 in `c x - 1`,
`x + c`, `x^2 + c x - 3`, `x^2 - c`, `c x^2 + x - 1`, `x^3 + c x - 1`, `x^3 - c` and `x^3 + c x^2 - 2 x - 1`, through
`SolveEquation` and `Solve`, a decline counting as one only where its statement is the equation: 674 answers, of which
2.10.0 got 117 wrong and none now; every answer 2.10.0 got right is unchanged. The declines come of downcasting,
which v3 removes.

### A root of a modulus piece that is not read as a real declines, rather than being left out

**Silent: `{ }` becomes the roots.** Over the reals, an equation in moduli of polynomials is solved piece by piece
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,12 @@ static bool BackSubstitute(
if (univariate is null)
return budget.Allow(false, "no univariate equation");

if (univariate.SolveEquation(variable).InnerSimplified is not Set.FiniteSet roots)
Entity solved;
// Each root is put back into the system below, so it is not enclosed to more digits here as well.
// https://github.com/asc-community/AngouriMath/issues/2448
using (AnalyticalSolving.StatementSolver.WithoutRisingDigits())
solved = univariate.SolveEquation(variable).InnerSimplified;
if (solved is not Set.FiniteSet roots)
return budget.Allow(false, "unenumerable roots");

var remaining = new Dictionary<Variable, int>(at);
Expand Down
Loading
Loading