Flip the odd-degree endpoint second derivative at z=-1 #285
All Vouch review confidence checks passed
Residual risk 0.04 = Change Risk (0.14) × (1 − Review Confidence (0.68)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.14 · 5 lines diff across 1 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.35 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.107
Real PR Conversation Timeline
2 items
Changes Requested
thanks. can you add a regression test? there are some conflicts as well.
fbourgey
shaneraphel
Summary
assoc_legendre_pwithdiff_n=2returns the wrong sign atz=-1for odd degree. The second-derivative closed forms form = 0, 2, 4are thez=+1values. Atz=-1those values pick up(-1)^n.For
n=3, m=0,P_3''(x) = 15x, so the endpoint is-15. The header returned+15. The same sign error shows up form=2(P_3^2second derivative90atx=-1, header returned-90). Even degrees already match and are left alone. Them=-2closed form does not matchlpmvforn>2at either endpoint, so this change does not touch it.This is the routine behind SciPy
special.assoc_legendre_pin scipy/scipy#26229.Test plan
scipy.special.lpmvnear both endpoints forn=2..7andm in {0, 2, 4}. Atn=3, m=0the old form is+15and the finite-difference value is-15. Multiplying by(-1)^nwhenz<0andnis odd matches that sign. Atz=+1the form already matches (+15).