← Back to Pull requests

BUG: besselpoly: fix the Neumann series for large `nu` #594

Open
unknown opened this pull request with 160 lines diff across 2 files
View on GitHub
unknown unknown commented on Nov 21, 2026 00:22 UTC
Author

Reference issue


No issue; follow-up to #485:

On main:

besselpoly(60.0, 0.0, 244.5) == 3.2302110171903608e-54  // mpmath: 3.230211041251911e-54
besselpoly(40.0, 0.0, 400.5) == 0.0                     // mpmath: 1.5235998731386507e-233

What does this implement/fix?


The Neumann series is normalized with $J_{\nu+1}(2a)$ and $J_{\nu+2}(2a)$. For noninteger orders $v$ with $4a < v < 500$ and $2a \ge 3.6\sqrt{v}$, cephes::jv gets these by recurring down from the power series at order $v + 2a + 1$, which loses digits through exp(lgam(...)) and returns 0 once that $J$ underflows. There, this takes them from AMOS instead, like scipy.special.jv, and keeps cephes::jv where AMOS flushes them to 0 or reports an error.

Additional information


The new test fails on main with GCC and Clang (relative errors 7e-9 and 1.0) and passes with the fix; the xsref besselpoly table test passes. In a random sweep of the Neumann domain, the 99th-percentile relative error drops from 1 to 6e-13.

AI Generation Disclosure


Claude Opus 5.5 (Claude Code) wrote the fix, the test, and this description, following the plan in this comment. GPT-6.2 Sol (Codex CLI) reviewed it.

Diff: 160 lines (+120 / -40) across 2 files Reviewer: jorenham Review duration: 14100m
All Vouch review confidence checks passed
Residual risk 0.23 = Change Risk (0.40) × (1 − Review Confidence (0.43)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 160 lines diff across 2 files
0.40
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
42%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
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
Shallow Review Depth shallow_review_depth
0.344
Diff Size diff_size
0.304
Ai Authored ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #594"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 43.0% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 39.9% (MEDIUM) · Higher = larger blast radius
39.9%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 43.0% · Lower = rushed or shallow review
43.0%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 22.7% · Safe to merge
22.7%
Repository