Repository navigation
A Taylor expansion simplifies each derivative before taking the next - #2302
Merged
Rafael-SOWNet merged 1 commit intoOct 31, 2026
Merged
Conversation
SingleTaylorExpansionTerms took each derivative from the one before it as it stood, and only the term built from it was simplified. A quotient's derivatives grew about eightfold a step: the ninth of sin(x) / x had 7,797,110 nodes, and 87 simplified, so 7 terms around 1 printed in 36,421 characters and 11 ran out of memory. Each derivative is now simplified before the next is taken, and each coefficient once it is evaluated at the point, so 11 terms are 529 characters in 0.9 s. The partial derivatives of the multivariable expansion are simplified the same way. The sum stops asking for terms once it has them, where it took one derivative more and dropped it. No terms are 0, where the empty sum threw AngouriBugException. A function with no value at the point has no derivatives there either, so its expansion is NaN once, where it was a NaN for each term after as many derivatives. The documented examples of Maclaurin, Taylor and TaylorTerms print the simplified coefficients, cos(1) * (-1) is -cos(1), so they now say what they print and leave DocumentationExamplesRunTest's failing list. The cotan(1 - t) pins in SeriesTest take the simplified coefficients, csc(1)^2 and 2 cot(1) csc(1)^2. e^x / (1 + x^2) still grows about threefold a step: the quotient rule squares the denominator and Simplify does not cancel the factor the numerator's terms share with it. That is Simplify's, #2301. Seven of the new and changed tests fail on master. The suite, the trio, F#, AOT and the eight harnesses pass. Fixes #2291. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2302 +/- ##
==========================================
+ Coverage 86.74% 86.77% +0.03%
==========================================
Files 310 310
Lines 67973 67974 +1
Branches 19744 19736 -8
==========================================
+ Hits 58961 58984 +23
+ Misses 4880 4869 -11
+ Partials 4132 4121 -11
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Rafael-SOWNet
deleted the
a-taylor-expansion-simplifies-each-derivative
branch
October 31, 2026 19:47
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.
Each derivative is simplified before the next is taken, and each coefficient once it is evaluated at the point.
Taylor("sin(x) / x", 11, ("x", 1))OutOfMemoryException(32 s at a 2 GB heap)Taylor("sin(x) / x", 7, ("x", 1))Taylor("sin(x) / x", 4, ("x", 0))NaN + NaN + NaN / 2! + NaN / 3!NaNTaylor("sin(x)", 0, ("x", 1))AngouriBugException0Taylor("sin(x) + cos(y)", 6, ("x", 1)), third termcos(1) * (-1) * (x - 1) ^ 3 / 3!-cos(1) * (x - 1) ^ 3 / 3!sin(x) / xhas 7,797,110 nodes as differentiated and 87 simplified.NaNonce.MathSnow print what they say, so they come offDocumentationExamplesRunTest's failing list.e^x / (1 + x^2)still grows about threefold a step, throughSimplifynot cancelling a shared factor. That's Simplify does not cancel a factor when a numerator's term holds a power of it #2301.Fixes #2291.
🤖 Generated with Claude Code