Add TaylorHomotopyContinuationJL: Taylor polynomialization + homotopy continuation + Newton polish for non-polynomial systems - #1094
Merged
ChrisRackauckas merged 1 commit intoJul 20, 2026
Conversation
…-polynomial systems Taylor-expands a general nonlinear system around the initial guess into a polynomial surrogate (via TaylorSeries.jl jet transport), finds all roots of the surrogate with HomotopyContinuation.jl, and polishes every (near-)real path endpoint with a Newton iteration on the original system. If the system is polynomial of total degree <= `degree` the surrogate is exact and all roots are recovered. Implementation notes: - `compile = false` for HC solves: each call builds a system with fresh numeric coefficients, so compiled straight-line programs never get cache hits and would cost seconds of codegen per solve. - All finite path endpoints are harvested (not just `HC.solutions`), since multiplicity-k roots are classified as "excess" endpoints and dropped by the default accessors; the Newton polish filters junk endpoints. - Newton polish success is judged by achieved residual, not step convergence, so singular roots (where Newton is only linear) still count. - Total-degree start systems are preferred for small path counts: dense Taylor truncations have mixed volume equal to the Bezout number, making polyhedral mixed-cell computation pure overhead. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AYuTWSRDz6kE8Bn8vAKh57
Member
Author
|
CI analysis after first full run: Everything exercising this PR's change is green — The two failing jobs are pre-existing master failures, unrelated to this diff:
Both master failures are being investigated separately (bisect + fix PRs to follow). 🤖 Generated with Claude Code |
Member
Author
|
Follow-up on the two pre-existing master CI failures noted above — both are now root-caused with fixes up:
🤖 Generated with Claude Code |
ChrisRackauckas
marked this pull request as ready for review
July 20, 2026 15:01
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.
Note
This PR should be ignored until reviewed by @ChrisRackauckas.
Summary
Adds
TaylorHomotopyContinuationJL{AllRoots}to NonlinearSolveHomotopyContinuation: a solver for general (non-polynomial) nonlinear systems thatdegree(default 3), via TaylorSeries.jl jet transport — works on any generic Julia function, same operator-overloading requirement as ForwardDiff duals;If the system is polynomial of total degree ≤
degree, the surrogate is exact and all roots are found.AllRoots = truereturns anEnsembleSolutionof every root (mirroringHomotopyContinuationJL{true}); the default single-root form returns the converged root closest to the initial guess. Supports oop/iip/scalar problems, explicit jacobians, andHomotopyNonlinearFunctiontransformations.This complements the existing algorithm:
HomotopyContinuationJL{true}requires a genuinely polynomial (HC-traceable) system; this works on transcendental ones at the cost of approximation, with the Newton polish recovering exactness of the reported roots.Motivation / prototype results
Prototyped and benchmarked before this PR (details: https://github.com/ChrisRackauckas/InternalJunk/pull/69). On an 8-problem hard suite × 20 random starts (success = ‖f‖∞ < 1e-8): 100% success on every problem, including Freudenstein–Roth where TrustRegion stalls at the classic local-min of ‖f‖ (8/20), exp–sin where plain Newton scores 11/20, Bratu n=6 (returns both solution branches; Newton 17/20), Powell singular (multiplicity-4 root), and Kearfott's badly-scaled problem. Median solve times after tuning: 3–50 ms for n ≤ 5, ~0.4 s for n = 6 with 729 paths. The
degree^npath count limits the method to roughly n ≤ 12 at degree 2, n ≤ 8 at degree 3 (documented in the docstring).Implementation notes (perf/correctness findings baked in)
compile = falsefor the HC solve — every call builds aSystemwith fresh numeric coefficients, so HC's compiled straight-line programs never get cache hits; without this each solve costs ~3.5 s of codegen (700× slowdown at these sizes).HC.solutions()— multiplicity-k roots (e.g. Powell singular) are classified as "excess" endpoints and dropped by the default accessors under every flag combination. As Newton guesses every finite endpoint is fair game; the polish filters junk.(numvars, order)behind a lock (variables!rebuilds multiplication tables on every call).Tests
New
test/taylor_polynomialize.jlwired into the Core group: scalar transcendental (all 3 roots of u = 2sin(u) + closest-root variant), exact recovery of all 9 Himmelblau critical points, transcendental oop (exp–sin) and iip (Bratu, both branches), explicit-jacobian path, no-real-roots retcodes, multiplicity-4 singular root, andHomotopyNonlinearFunctionpolynomialize/unpolynomialize round-trip.Ran locally with
Pkg.test()on Julia 1.11:Runic has been run on all changed files. Version bumped 0.1.10 → 0.1.11; TaylorSeries (0.22.4+) added as a dependency; docstring added to the docs API page in the same PR.
🤖 Generated with Claude Code
https://claude.ai/code/session_01AYuTWSRDz6kE8Bn8vAKh57