Skip to content

PALC: keep the state on the tangent line when p reaches p_min or p_max - #363

Open
ParadaCarleton wants to merge 3 commits into
bifurcationkit:masterfrom
ParadaCarleton:palc-no-p-clamp
Open

ParadaCarleton wants to merge 3 commits into
bifurcationkit:masterfrom
ParadaCarleton:palc-no-p-clamp

Conversation

@ParadaCarleton

@ParadaCarleton ParadaCarleton commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

PALC clamps the parameter at the ends of [p_min, p_max], but both clamp only p. The state x stays where the unclamped step put it, so the point the solver works with no longer lies on the tangent line. This means the correction can converge onto a different branch, or evaluate F outside its domain. The error occurs in two separate places:

1. The predictor (corrector!, Palc.jl:160-162). When the predictor (x_pred, p_pred) = (x, p) + ds·τ lands past a bound, corrector! sets p_pred to the bound and runs the Natural corrector at that parameter, starting from x_pred. But x_pred belongs to the overshot parameter, so the fixed-parameter Newton starts a full step's worth of x beyond where the curve meets the bound. If another branch is closer to that point, it converges there.

Example: F(x, λ) = (x − λ)(x − λ − 3), whose two branches are x = λ and x = λ + 3. Start at (0, 0) with ds = 4 and p_max = 1. The tangent is (1, 1)/√2, so the predictor lands at about (2.83, 2.83). p is clamped to 1, but x stays at 2.83. At λ = 1 the roots are x = 1 and x = 4, and 2.83 is closer to 4, so the continuation ends at x = 4, on the other branch.

The fix moves the predictor to where its line meets the bound, x + (bound − p)/(p_pred − p)·(x_pred − x), whenever the current point lies inside (p_min, p_max). In the example this is x = 1, the right root. The new test test/continuation/palc_bound_predictor.jl runs this problem with Secant and Bordered tangents. We first hit this on a 3-player logit equilibrium branch that folds back just past the target parameter; the clamped step landed on the folded-back segment.

2. The corrector iterates (newton_palc). Each Newton iterate sets p = clamp(p − up, p_min, p_max) and keeps x − u. An iterate that wants to leave the interval is again moved in p only, so the next residual is evaluated at a point that no Newton step produced. When F is undefined past the bound, the line search can also evaluate it there and throw a DomainError. Here the corrector stops when an iterate leaves [p_min, p_max], so PALC rejects the step and shrinks ds as for any failed corrector. The test test/continuation/palc_bounds.jl covers this case.

Both changes only affect steps that reach a bound; every step strictly inside the interval runs as before.

https://claude.ai/code/session_015sE9Latuiqsp6zSHQ1cshz

…ound

Clamping only the parameter left the state a full step out along the
tangent, so the fixed-parameter corrector could converge onto another
branch: on (x - λ)(x - λ - 3) = 0, a step of 4 from λ = 0 ended at x = 4
at p_max = 1.

Claude-Session: https://claude.ai/code/session_01BEoUbvf41HZqywHoqybG7q
@ParadaCarleton ParadaCarleton changed the title newton_palc: stop the corrector when an iterate leaves [p_min, p_max] PALC: keep the state on the tangent line when p reaches p_min or p_max Oct 26, 2026

This branch has not been deployed

No deployments
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