Repository navigation
Commit 7ea4508
Give a one-sided limit the fallback the other paths have
A one-sided limit had nothing behind it. Where a two-sided or an infinite
destination falls through to l'Hopital's rule and the rest, this path
returned whatever the descent produced and stopped:
if (side is ApproachFrom.Left or ApproachFrom.Right)
return expr.ComputeLimitDivideEtImpera(x, dest, side);
The descent can make an indeterminate form definite on the way down, by
putting a part's own limit in place of the part. x * ln(x) at 0+ becomes
0 * ln(x), so 0 * -oo, so NaN -- and NaN is the claim that the limit does
not exist, not that it was not found. sin(x) / x approached from either
side came back the same way: the library said the most familiar limit in
the subject did not exist.
Where nothing above answered, this now moves x out to infinity and asks
there. That is what ComputeLimitImpl does for a finite destination in any
case, so it is the same question, put where l'Hopital's rule and the rest
of the machinery for infinity live. Whatever the descent found is kept if
this finds nothing better, so the change can only add answers.
The substituted expression is simplified before being asked about, and not
for tidiness: the destination is left behind as a term, and it is exactly
that leftover which produces the NaN. (0 + 1/x) * ln(0 + 1/x) at infinity
is NaN where (1/x) * ln(1/x) is 0.
Measured over 26 one-sided limits worked out by hand: 13 correct before,
18 after; 12 wrong before, 7 after. Nothing that was right became wrong.
Suite unchanged at 3m09s against 3m05s.
Seven are still wrong, and this does not claim them: x^2 * ln(x),
sqrt(x) * ln(x), x^x, (1 + x)^(1/x), (1 - cos(x)) / x^2, 1/x - 1/sin(x)
and 1/ln(x) - 1/(x-1) from the right. Each needs the machinery at infinity
to be stronger than it is, not a different bridge to it -- three of them
answer already once the differences-at-infinity and Gruntz branches are in.
(1 + x)^(1/x) at 0+ gives 1 rather than e both before and after, which is
a separate defect on the two-sided-versus-one-sided path.
Part of #209.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 7f1b4f2 commit 7ea4508
2 files changed
Lines changed: 108 additions & 1 deletion
File tree
- Sources
- AngouriMath/Functions/Continuous/Limits/Solvers
- Tests/UnitTests/Calculus
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
55 | 81 | | |
56 | 82 | | |
57 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
0 commit comments