Repository navigation
Judge a decimal root against the terms of the equation as written (#2645) - #2649
Open
Rafael-SOWNet wants to merge 1 commit into
Open
Rafael-SOWNet wants to merge 1 commit into
Rafael-SOWNet wants to merge 1 commit into
Conversation
) tanh, sinh and cosh are written with exponentials, so 10^3 tanh(x / 10^3) = x / 2 is 10^3 (e^(2x / 10^3) - 1) / (e^(2x / 10^3) + 1) - x / 2. A root the numeric search found near 0 was judged by IsEvidenceAgainst against LargestTerm. LargestTerm reads the equation after the root is put in, where every part is a number, so it multiplied out the factor e^(2x / 10^3) - 1, which depends on x and cancels near 0, and read it as terms of size 500. Beside those, the residual 5.5e-14 at x = 1.1e-13 was nothing, so 1.1e-13 was answered beside 0. The terms of the equation are 1.1e-13 and 5.5e-14, and the residual is half the larger. Verdict now also judges a root found in decimals against the terms of the sum the equation is, each read whole, reached only through factors and divisors that do not depend on x. It drops the root where the residual is more than RelativeResidualTolerance of the largest. This only adds a reason to drop a decimal root, and only where the terms cancel. Over 99 equations K F(x/K) = K g(x/K) in nine tanh, sinh, cosh, arcsin and arctan shapes, K = 10^-30 to 10^30, the false roots go from 6 to 0 against mpmath at 120 digits, and no true root is lost. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2649 +/- ##
==========================================
- Coverage 86.71% 86.70% -0.01%
==========================================
Files 346 346
Lines 75647 75673 +26
Branches 22114 22127 +13
==========================================
+ Hits 65596 65612 +16
- Misses 5420 5426 +6
- Partials 4631 4635 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2645
tanh, sinh and cosh are written with exponentials, and near 0 the parts of
e^u - 1ore^u - e^(-u)cancel. A root the numeric search found near 0 was judged against those parts (viaLargestTerm, which multiplies out a factor that depends on x once the root is put in), and kept beside 0.A root found in decimals is now also judged against the terms of the sum the equation is, each read whole and reached only through factors and divisors that do not depend on x (
IsLargeBesideTheTermsAsWritteninSolveStatement.Verdict). It is dropped where its residual is more than 1% of the largest term. This only adds a reason to drop a decimal root..Solve("x")10^3 tanh(x / 10^3) = x / 2{ 0, 1.1013E-13 }{ 0 }10^20 tanh(x / 10^20) = x / 3{ -3.1958E-13, 0 }{ 0 }10^6 sinh(x / 10^6) = 2 x{ -4.9027E-13, 0, 4.9027E-13 }{ 0 }tanh(x) = x / 2,sinh(x) = 2 x,sin(x) = x / 2The missing roots
±1915.008…of the first row are #2643's, answered by #2644.Family check: 99 equations
K F(x/K)in nine arcsin, arctan, tanh, sinh and cosh shapes, K = 10^-30 to 10^30, each root checked against mpmath at 120 digits: answered 90 → 90, roots 196 → 190, false roots 6 → 0, no true root lost.Tests:
ARootNearZeroIsJudgedByTheTermsAsWrittenTest, 9 cases, 5 of which fail on master. Full UnitTests suite (net10.0, on dccddc5 + this): 21854 passed, 0 failed, 13 skipped. Entry inBREAKING-CHANGES.md.🤖 Generated with Claude Code