Skip to content
Open
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
72 changes: 72 additions & 0 deletions BREAKING-CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,39 @@ integer. Exact large integers are unchanged
| `"integral(exp(x), x, 0, 300)".Simplify()` | `1942426395…4199999…9` | `e ^ 300 - 1` |
| `"2^340 * sqrt(2)".Evaled` | an `Integer` | `3.167477390…E+102`, a `Real` |

### A constant near a rational is not taken for it

**Silent: wrong answers become right ones, or stay written.** Evaluation rounds a value within `1e-50` of a small
rational onto it, at the default hundred digits, so that a cancellation such as `cosh(1)^2 - sinh(1)^2` comes out as
the integer it is. `Simplify` took that rational as the exact value of any constant that is only near one, and the
trigonometric tables read an angle that near a table angle as it. Such a value is now held to an interval
enclosure in twice the working digits, and more where the parts are large or small. It is taken only where the
enclosure holds it; where the enclosure excludes it the constant stays written. An equality or an order of such a
side is decided by the enclosures. A tangent, cotangent, secant or cosecant of an argument whose period the working
digits cannot place is left written instead of `NaN`. A floor, a ceiling, a rounding or a remainder whose argument is
within that distance of where its answer changes is read from the enclosure, or left written
([#2775](https://github.com/asc-community/AngouriMath/issues/2775)).

| `.Simplify()` | Was (`a3f3b9ed1`) | Now |
|---|---|---|
| `1 - e^(-200)` | `1` | `1 - 1 / e ^ 200` |
| `sinh(60)/cosh(60)` | `1` | `(e ^ 60 + (-1) / e ^ 60) / (e ^ 60 + 1 / e ^ 60)` |
| `sqrt(10^120 + 1) / 10^60` | `1` | `sqrt(10…01) / 10…0` |
| `1/3 + e^(-200)` | `1/3` | `1/3 + 1 / e ^ 200` |
| `cos(1/10^60)` | `1` | `cos(1/10…0)` |
| `sin(1/10^99)` | `0` | `sin(1/10…0)` |
| `arctan(1/10^150)` | `0` | `arctan(1/10…0)` |
| `sin(pi + 1/10^150)` | `0` | `sin(1/10…0 + pi)` |
| `tan(e^1000)` | `NaN` | `tan(e ^ 1000)` |
| `csc(e^1000)^2 - cot(e^1000)^2` | `NaN` | `1` |
| `1 - e^(-200) = 1` | `True` | `False` |
| `cos(1/10^30) < 1` | `False` | `True` |
| `floor(1 - e^(-200))` | `1` | `0` |
| `ceil(1 + e^(-200))` | `1` | `2` |
| `round(1/2 + e^(-200))` | `0` | `1` |
| `(-e^(-1000)) mod 1` | `1` | `1 + (-1) / e ^ 1000` |
| `(7/2 - e^(-200)) mod 1` | `1/2` | `1/2 + (-1) / e ^ 200` |

### A complex number with exact parts keeps them exact

**Silent: wrong numbers become right ones.** A sum, difference, product or quotient of two complex numbers, and so a
Expand Down Expand Up @@ -503,6 +536,45 @@ before v3, which decides exact comparisons exactly (#1019 §10). Two decimals th
| `sqrt(5)^1000 = 5^500` | `False` | stays written |
| `sqrt(2) < sqrt(2) + 10^(-150)` | `False` | stays written |

### A value past the exponent range is not taken for 0, an infinity or NaN

**Silent: wrong answers become right ones, or stay written.** A constant expression whose value is past the decimals'
exponent range evaluates to `+oo`, or flushes to `0`. `Simplify` took those values as exact whenever a function, a
quotient or a comparison held such a part: `e^400000 / e^399999` evaluated as `+oo / +oo` and became `NaN`, and
`1 / e^400000` and `sin(e^(-400000))` became `0`. A part counts as finite when it is written with exact numbers and
constants using sums, products, quotients by parts that cannot be 0, powers, the factorial off its poles, sine,
cosine and erf. A value that rests on such a part is no longer taken from the decimals, and the rest of `Simplify`
decides it or leaves it written. An equality with such a side is not decided by the decimals either.
`(n - 1/2)!` is written out as a rational times `sqrt(pi)` only up to `2 n = 50000`. Past that it stays a factorial,
since it used to take a second or more to write out. A quotient of two factorials of rationals a whole number below
20 apart is the product of the terms that do not cancel
([#2753](https://github.com/asc-community/AngouriMath/issues/2753)).

| | Was (2.10.0) | Now |
|---|---|---|
| `"exp(400000) * exp(-399999)".Simplify()` | `NaN` | `e` |
| `"e^400000 / e^399999".Simplify()` | `NaN` | `e` |
| `"gamma(300000.5) / gamma(299999.5)".Simplify()` | `NaN` | `599999/2` |
| `"exp(-400000)".Simplify()` | `0` | `1 / e ^ 400000` |
| `"1 / (e^400000 + 1)".Simplify()` | `0` | `1 / (1 + e ^ 400000)` |
| `"exp(-250000) * 10^100000".Simplify()` | `0` | `1000…000 / e ^ 250000` |
| `"abs(e^(-400000))".Simplify()` | `0` | `1 / e ^ 400000` |
| `"sin(e^(-400000))".Simplify()` | `0` | `sin(1 / e ^ 400000)` |
| `"arcsin(e^(-400000))".Simplify()` | `0` | `arccsc(e ^ 400000)` |
| `"sin(e^400000)".Simplify()` | `NaN` | `sin(e ^ 400000)` |
| `"e^(-400000) = 0".Simplify()` | `True` | `False` |
| `"e^400000 = e^400001".Simplify()` | `True` | `e ^ 400000 = e ^ 400001` |
| `"gamma(100001/2)".Simplify()` | `+oo` | `(99999/2)!` |
| `"cos(e^(-400000))".Simplify()` | `1`, which is not its value | `cos(1 / e ^ 400000)` |
| `"floor(-e^(-400000))".Simplify()` | `0` | `-1` |
| `"ceil(e^(-400000))".Simplify()` | `0` | `1` |
| `"(-e^(-400000)) mod 1".Simplify()` | `0` | `1 - 1 / e ^ 400000` |

`floor`, `ceil`, `round` and `mod 1` of such a value are read from its sign and a bound its parts prove: a power of a
base above 1 to a negative exponent, or a bounded constant over such a power, lies strictly between -1 and 1. So
`floor(e^(-400000))` is `0` as before, but no longer because the value flushed to 0. The
sign of such a value is decided by its parts too, so `sgn(e^400000)` is `1` as before.

### A square system is answered exactly whichever order its equations are in

**Not silent: a decimal answer is now exact, and a refused system has an answer.** The eliminator took the last
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//
//
// Copyright (c) 2019-2026 Angouri.
// AngouriMath is licensed under MIT.
// Details: https://github.com/asc-community/AngouriMath/blob/master/LICENSE.md.
Expand Down Expand Up @@ -142,6 +142,7 @@ private static bool RealWhereverItIs(Entity expr, Variable x)
// The pieces between neighbouring kinks, closed where they end at one, and on each the
// sign every modulus takes, read at a point inside it.
Set answer = Set.Empty;
var taken = new List<Point>();
for (var i = 0; i <= ends.Count; i++)
{
Point? left = i == 0 ? null : ends[i - 1];
Expand Down Expand Up @@ -204,6 +205,14 @@ private static bool RealWhereverItIs(Entity expr, Variable x)
case null:
return null;
case true:
// A finite set keys its members by their evaluations, and two roots a cancellation leaves
// within the rounding of each other evaluate alike: the roots near 10^-71 and -10^-71 of
// x^4 - 10 x^2 - |x| + 10^-70 were one member, and the answer lacked a root. Two such roots
// not shown to be one number decline. https://github.com/asc-community/AngouriMath/issues/2775
foreach (var other in taken)
if (other.Exact.Evaled == root.Exact.Evaled && Compare(other, root) != 0)
return null;
taken.Add(root);
answer = answer.Unite(new FiniteSet(root.Exact));
break;
}
Expand Down
Loading