QuantEcon / QuantEcon/QuantEcon.py
ENH: Migrate IVP off the legacy scipy.integrate.ode API
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.4k
- Forks
- 2.3k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 3
Description
Problem
quantecon/_ivp.py defines class IVP(integrate.ode) — inheriting SciPy's old-generation integrator. scipy.integrate.ode has been the "old API" since solve_ivp arrived (SciPy 1.0, 2017): frozen feature-wise, documented as legacy, and a standing candidate for eventual deprecation. Because IVP is-a ode, our public surface (set_integrator('dopri5'), set_initial_value, …) is SciPy's, so upstream changes land directly on users. It is also the reason _ivp.py still carries the repo's last Py2-style super(IVP, self).__init__ call.
Proposed change
Rebuild IVP on scipy.integrate.solve_ivp (composition, not inheritance):
- Map current methods —
solve→solve_ivpwithdense_output=True;interpolate→ the returnedOdeSolution, replacing manual B-spline plumbing; keepcompute_residualon top. - Preserve the constructor signature
IVP(f, jac=None); translate old integrator names ('dopri5'→'RK45','lsoda'→'LSODA', …) with a deprecation shim for one release ifset_integratoris kept at all. - Numerical parity tests against current outputs on the doc examples (tolerance-level, not bitwise — steppers differ).
Coordinate with #111 (refactor of IVP's simulation methods) — same file, natural sequencing: this issue modernizes the foundation, #111 the surface.
Acceptance criteria
- No inheritance from
scipy.integrate.ode; suite and docs examples pass - Documented old-option → new-option mapping in the changelog
From the July 2026 technical-debt audit (AI-assisted; claims verified against 28d4b3b on 2026-07-25).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with quantecon/_ivp.py and the existing IVP usage in the documentation examples. Review the current methods and coordinate sequencing with #111 before comparing solve and interpolation behavior against the proposed solve_ivp approach. Done means the suite and documentation examples pass, inheritance from scipy.integrate.ode is gone, and the old-option to new-option mapping is documented in the changelog.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100