Skip to content

Commit 46a2e03

Browse files
A quotient is zero where its numerator is and its denominator is not (#2320)
The solver had a case for a product, which is zero where a factor is, and none for a quotient, which came to the spellings. One of those took a substitution t = x^2 into the powers t^(3/2) and t^(5/2) and gave it to Newton's method, so (18x^2 - 3x^3 - 4x^4 + x^5)/(9x^2 - 6x^4 + x^6) = 0 was answered with three near-copies of 3 beside it and without -2 (2.6.0 answered { 3 }). A non-strict inequality takes the roots of its equation, and the one with it for its = 0 part lost -2 as well, 2.6.0 having had -3, where the quotient is negative, in its place. N/D = 0 is now N = 0, less the roots at which D is zero, where 0/0 has no value: (x^2 - 1)/(x - 1) = 0 is { -1 }. Only where N's roots are finitely many numbers, each put into D; a family of roots, as sin(x)/x = 0 has, is left to the routes after, which answer it as before. Found by a cross-check of rational inequalities against their exact values at rational points. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent a290f93 commit 46a2e03

4 files changed

Lines changed: 73 additions & 0 deletions

File tree

‎BREAKING-CHANGES.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,17 @@ real radical form still takes it ([#2143](https://github.com/asc-community/Angou
429429
| `"sin(pi/18)".ToEntity().Simplify()` | `sqrt((1 - 1/4 * ((4 + 4 * sqrt(-3)) ^ (1/3) + (4 - 4 * sqrt(-3)) ^ (1/3))) / 2)` | `sin(pi / 18)` |
430430
| `"sin(pi/5)".ToEntity().Simplify()` | `1/4 * sqrt(10 - 2 * sqrt(5))` | `1/4 * sqrt(10 - 2 * sqrt(5))` |
431431

432+
### A quotient is zero where its numerator is and its denominator is not
433+
434+
**Silent: `N/D = 0` is solved as `N = 0` less the zeros of `D`, where it was left to the spellings.** One of those took
435+
`t = x^2` into half-integer powers of `t` and handed it to Newton's method, which answered near-copies of a root and left
436+
out others. A non-strict inequality takes the roots of its equation, so its answer was wrong with it.
437+
438+
| Input | Was (2.6.0) | Now |
439+
|---|---|---|
440+
| `"(18x^2 - 3x^3 - 4x^4 + x^5)/(9x^2 - 6x^4 + x^6) = 0".ToEntity().Solve("x")` | `{ 3 }` | `{ -2, 3 }` |
441+
| `"(108x^2 - 18x^3 - 24x^4 + 6x^5)/(27x^2 - 18x^4 + 3x^6) >= 0".ToEntity().Solve("x")` | `{ -sqrt(9.000000…), …, -3, … } \/ (-2; -sqrt(3)) \/ …`, with `-3`, where the quotient is negative, and without `-2` | `[-2; -sqrt(3)) \/ (-sqrt(3); 0) \/ (0; sqrt(3)) \/ (sqrt(3); +oo)` |
442+
432443
### A step function at a jump takes the side its argument arrives from
433444

434445
**Silent: a limit of `floor`, `ceil` or `sgn` whose argument arrives on a jump is answered, where it was left

‎Sources/.editorconfig‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ file_header_template=\nCopyright (c) 2019-2026 Angouri.\nAngouriMath is licensed
6363
[Tests/UnitTests/Convenience/RoundIsExactTest.cs]
6464
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
6565

66+
[Tests/UnitTests/Algebra/SolveTest/AQuotientIsZeroWhereItsNumeratorIsTest.cs]
67+
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
68+
6669
[Tests/UnitTests/Core/FactorialCacheIsThreadSafeTest.cs]
6770
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
6871

‎Sources/AngouriMath/Functions/Continuous/Solvers/EquationSolver/AnalyticalEquationSolver.cs‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,19 @@ when @base.ContainsNode(x) && !power.ContainsNode(x)
224224
return TreeAnalyzer.Assuming(predicate, () => Solve(expression, x, compensateSolving)).Filter(predicate, x);
225225
case Piecewise p:
226226
return EquationSolver.SolvePiecewise(p, x, (e, x) => Solve(e, x, compensateSolving));
227+
// A quotient is zero exactly where its numerator is and its denominator is not
228+
// zero: (x^2 - x)/(x^2 + x) = 0 is x = 1, x = 0 being a zero of both. Left to the
229+
// spellings below, (18x^2 - 3x^3 - 4x^4 + x^5)/(9x^2 - 6x^4 + x^6) = 0 was taken
230+
// by a substitution t = x^2 into powers t^(3/2) and t^(5/2) and given to Newton's
231+
// method, which answered three near-copies of 3 beside it and left out -2. Only
232+
// where the numerator's roots are finitely many numbers, each of which can be put
233+
// into the denominator; anything else is left to the routes below.
234+
case Divf(var numerator, var denominator)
235+
when numerator.ContainsNode(x) && denominator.ContainsNode(x)
236+
&& Solve(numerator, x, compensateSolving) is FiniteSet zeros
237+
&& zeros.All(root => !root.Vars.Any()):
238+
return zeros.Where(root => denominator.Substitute(x, root).Evaled is not Complex value
239+
|| value.IsFinite && !(value is Rational rational ? rational.IsZero : IsZero(value))).ToSet();
227240
// A product is zero exactly where one of its factors is. Without this the
228241
// factors are expanded back into a polynomial and the equation is answered
229242
// by the general formula for whatever degree that turns out to be, so
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
//
2+
// Copyright (c) 2019-2026 Angouri.
3+
// AngouriMath is licensed under MIT.
4+
// Details: https://github.com/asc-community/AngouriMath/blob/master/LICENSE.md.
5+
// Website: https://am.angouri.org.
6+
//
7+
8+
using AngouriMath.Extensions;
9+
using Xunit;
10+
using static AngouriMath.Entity;
11+
using static AngouriMath.Entity.Set;
12+
13+
namespace AngouriMath.Tests.Algebra
14+
{
15+
/// <summary>
16+
/// A quotient is zero exactly where its numerator is and its denominator is not. Left to the
17+
/// spellings, <c>(18x^2 - 3x^3 - 4x^4 + x^5)/(9x^2 - 6x^4 + x^6) = 0</c> was taken by a
18+
/// substitution <c>t = x^2</c> into half-integer powers of <c>t</c> and given to Newton's method,
19+
/// which answered three near-copies of 3 beside it and left out -2; and the inequality with it
20+
/// for its <c>= 0</c> part lost -2 as well. Found by a cross-check of rational inequalities
21+
/// against their exact values; no issue was filed.
22+
/// </summary>
23+
[Trait("Area", "Algebra")]
24+
public sealed class AQuotientIsZeroWhereItsNumeratorIsTest
25+
{
26+
[Theory]
27+
[InlineData("(18x^2 - 3x^3 - 4x^4 + x^5)/(9x^2 - 6x^4 + x^6) = 0", "{ -2, 3 }")]
28+
[InlineData("(108x^2 - 18x^3 - 24x^4 + 6x^5)/(27x^2 - 18x^4 + 3x^6) = 0", "{ -2, 3 }")]
29+
// Zeros of the numerator that the denominator shares are not roots: 0/0 has no value.
30+
[InlineData("(x^2 - 1)/(x - 1) = 0", "{ -1 }")]
31+
[InlineData("(x^4 - 9x^2)/(x^6 - 3x^4) = 0", "{ 3, -3 }")]
32+
public void TheRootsAreTheNumeratorsTheDenominatorDoesNotShare(string equation, string expected)
33+
=> Assert.Equal(expected.ToEntity(), equation.ToEntity().Solve("x"));
34+
35+
[Fact]
36+
public void TheNonStrictInequalityKeepsTheRootsOfItsEquation()
37+
{
38+
var answer = (Set)"(108x^2 - 18x^3 - 24x^4 + 6x^5)/(27x^2 - 18x^4 + 3x^6) >= 0".ToEntity().Solve("x");
39+
foreach (var (at, inside) in new[] { ("-2", true), ("3", true), ("1", true), ("-3", false), ("0", false), ("sqrt(3)", false) })
40+
{
41+
Assert.True(answer.TryContains(at.ToEntity(), out var contains), $"{at} undecided in {answer}");
42+
Assert.Equal(inside, contains);
43+
}
44+
}
45+
}
46+
}

0 commit comments

Comments
 (0)