Repository navigation
Integrate numerically by Gauss-Legendre, and give the digits it knows - #2063
Merged
Merged
Conversation
DefiniteIntegral was the mean of steps + 1 equally weighted samples, its bounds among them: a first-order rule, off in the third digit on x^2 over [0, 1] at the default 100 steps and printed to a hundred digits, and NaN for a convergent integral with a singular bound, sin(x)/x and ln(x) over [0, 1] among them. It is now the five-point Gauss-Legendre rule on steps panels, which never evaluates a bound and is exact on each panel for degree nine, run on the panels, twice as many and four times as many. Never evaluating a bound, the rule gives a divergent integral a finite value -- 1/x over [0, 1] came to about 10 -- so where the differences between the three do not shrink above the rounding, the integral is NaN. Where they shrink, the rest of their geometric series is added and is the error: for x^-0.9 the last difference is a fourteenth of it, and the value without it was 7 where it is 10. The rounding is measured against the integral of the modulus, so x^3 over [-1, 1] is 0 and not NaN. The value is rounded to the place of the error, at most fifteen digits, with the downcasting off so that -0.9999 does not print as -9999/10000. A singularity inside the segment is not seen, and the docs say so. The MCP server ran the old rule at 2000 and 4000 steps and reported the digits the two agreed on, and its self-test documented the first-order rule, which no longer reproduces. It now asks once and reports the digits of the value it gets, with half a unit in the last place for the error; its caveat says what the rule does at a bound, and its README lists the workarounds that remain. Fixes #1675. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
…ly-by-gauss-legendre # Conflicts: # BREAKING-CHANGES.md # Sources/MCP/AngouriMath.Mcp/SelfTest.cs # Sources/MCP/README.md
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.
Fixes #1675.
DefiniteIntegraltook the mean ofsteps + 1equally weighted samples, the two bounds among them. That is a first-order rule. At the default 100 steps,x^2over[0, 1]was off in the third digit, and the value printed to a hundred digits. A convergent integral with a singular bound came out NaN,sin(x)/xandln(x)over[0, 1]among them.stepspanels, which is exact on each panel up to degree nine and never evaluates a bound. It runs onstepspanels, then twice as many, then four times as many.1/xover[0, 1]came to about 10. So when the differences between the three runs do not shrink faster than the rounding, the integral is NaN.x^-0.9over[0, 1], the value without that tail was 7, where the integral is 10.x^3over[-1, 1]is 0 and not NaN.-0.9999does not print as-9999/10000.DefiniteIntegralByGaussLegendreTest: 7 of its 11 cases fail on master. Those arex^2,sin(x)/x,ln(x),1/sqrt(x),e^xandsin(x)to their tolerances, plus the digit count. The full unit suite passes (16,714), and so do the MCP tests (325). The library builds for netstandard2.0. The BREAKING-CHANGES entry lists the changed values:x^2was0.33499…and is0.333333333333333;sin(x)/xwas NaN and is0.946083070367182;ln(x)was NaN and is-1.00000;1/xis still NaN. #2061 and #2062 open the same section, so whichever of the three merges later has one heading to resolve.🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura