Skip to content

Improve root-finding convergence with bisection and log-scale formulation - #38

Merged
aarmey merged 1 commit into
mainfrom
improve-rootfinding
Aug 27, 2026
Merged

Improve root-finding convergence with bisection and log-scale formulation#38
aarmey merged 1 commit into
mainfrom
improve-rootfinding

Conversation

@aarmey

@aarmey aarmey commented Aug 27, 2026

Copy link
Copy Markdown
Member

Summary of Changes

  • 1D Bracketed Bisection for polyfc: Replaced unconstrained Levenberg-Marquardt with optimistix.Bisection on the bounded domain [0, Phi_max]. Because the residual function is strictly monotonic and bounded, this provides guaranteed 100% convergence with no overshooting or domain errors.
  • Log-Space Parameterization for polyc: Updated Req_polyc to solve for log(Req) using the log-ratio residual log(Req + Rbound) - log(Rtot). This prevents negative receptor concentrations during intermediate iterations and stabilizes gradients across wide dynamic ranges.
  • Analytical 1:1 Langmuir Initial Estimate for Req_solve: Initialized the solver with the 1:1 binding equilibrium estimate instead of a zero vector, starting the solver near the true root and reducing iterations.
  • New Edge Case Tests: Added regression tests in valentbind/test/test_edge_cases.py covering high-affinity/high-valency multivalent mixtures (f=12, wide affinity ranges).

All 16 unit tests, static type checks (make ty), and Ruff lint/formatting checks pass.

@aarmey
aarmey merged commit 5499c67 into main Aug 27, 2026
2 checks passed
@aarmey
aarmey deleted the improve-rootfinding branch August 27, 2026 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant