QuantEcon / QuantEcon/QuantEcon.py

ENH: Migrate IVP off the legacy scipy.integrate.ode API

Open
#878 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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):

  1. Map current methods — solvesolve_ivp with dense_output=True; interpolate → the returned OdeSolution, replacing manual B-spline plumbing; keep compute_residual on top.
  2. Preserve the constructor signature IVP(f, jac=None); translate old integrator names ('dopri5''RK45', 'lsoda''LSODA', …) with a deprecation shim for one release if set_integrator is kept at all.
  3. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.