Skip to content

Update for OrdinaryDiffEq v7 / DifferentialEquations v8 - #3

Merged
tobydriscoll merged 2 commits into
fncbook:mainfrom
ChrisRackauckas-Claude:odiffeq-v7-diffeq-v8-update
May 4, 2026
Merged

tobydriscoll merged 2 commits into
fncbook:mainfrom
ChrisRackauckas-Claude:odiffeq-v7-diffeq-v8-update

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown

Summary

Updates the package for the OrdinaryDiffEq v7 / DifferentialEquations v8 breaking release. Three small changes are sufficient — FNC only uses ODE features, so most of the v7 surface (controllers, ADTypes, ODEAliasSpecifier, ODEVerbosity, callback signatures, ensemble RNG, …) doesn't apply here.

Changes

  1. Project.toml — bumped DifferentialEquations compat from "7.15" to "7.15, 8". The umbrella package was scoped down in v8 to only re-export OrdinaryDiffEq, but every call site in this repo is ODE-only (Tsit5, ODEProblem, solve), so existing usage continues to work after the bump.

  2. src/chapter10.jl — fixed one indexing breakage in shoot. Under RecursiveArrayTools v4 (shipped with OrdinaryDiffEq v7), ODESolution now subtypes AbstractArray, so sol[end] returns the last scalar element in column-major order rather than the last timestep vector. The downstream g₂(y[end]...) then tries to splat a Float64 and errors. Switched to y.u[end]..., which is the forward-compatible form (works under both RAT v3 and v4).

    The companion y[1,:], y[2,:] lines from commit e15d935 still work unchanged: AbstractArray row-slicing on the (ncomponents, ntimesteps) column-major storage returns the same per-component trajectories as the v3 override did. I verified this empirically against OrdinaryDiffEq v7.0.0 before deciding to leave them.

  3. README.md — updated the "alternative numerical packages" table to point BVP users at BoundaryValueDiffEq directly. DifferentialEquations v8 no longer re-exports the BVP solver family from the umbrella, so the old recommendation would no longer give the user a working BVP setup.

Why this is the whole diff

I read the OrdinaryDiffEq v7 / DiffEq v8 NEWS.md end-to-end and audited the repo for every category of breaking change:

v7/v8 breaking change Affects FNC?
DiffEq v8 umbrella reduction (only re-exports OrdinaryDiffEq) No — only ODE features used
RAT v4 sol[i]sol.u[i] Yes — fixed in chapter10.jl
sol[1,:] / sol[2,:] row slicing No — semantics preserved on AbstractArray
for u in sol, length(sol), eachindex(sol) No — not used
sol.retcode == :Symbol No — retcode not inspected
sol.destatssol.stats No — not used
u_modified!derivative_discontinuity! No — no callbacks
autodiff::BoolADTypes No — implicit solvers / autodiff kwargs not used
verbose::BoolODEVerbosity No
alias::Bool / alias_u0ODEAliasSpecifier No
gamma/beta1/beta2/q* controller kwargs → controller= No
chunk_size/diff_type/standardtag/precs algorithm kwargs No
lazy::BoolVal{true/false} No
williamson_condition=true default → false No (no 2N low-storage RKs)
VectorContinuousCallback affect! signature No
CheckInit default DAE init No (no DAEs)
Tableau construct* rename No
Threading: Static.True/FalseSerial/Threaded No
Algorithm struct {CS,AD,FDT,ST,CJ} type-param removal No
Ensemble prob_func/output_func signature No
KenCarp4/Rodas4/etc. now require explicit sublib No (only Tsit5 used)

The only call site touched in src/ is the shoot function. Everything else in the repo (euler, ie2, rk4, rk23, ab4, am2 in chapter06, parabolic in chapter11) operates on user-written RHS functions or uses solve(ivp) with default-solver behavior, both of which are unchanged.

Test plan

  • Resolve and precompile FNC against DifferentialEquations v8.0.0 / OrdinaryDiffEq v7.0.0 on Julia 1.11

  • Pkg.test() — all 11 test sets pass (74 total tests):

    Chapter 1   |  1   1   0.6s
    Chapter 2   |  8   8   4.7s
    Chapter 3   |  4   4   4.2s
    Chapter 4   | 11  11   1.4s
    Chapter 5   | 12  12   4.4s
    Chapter 6   |  8   8   4.8s   <- exercises Tsit5 + euler/ie2/rk4/ab4/rk23/am2
    Chapter 8   |  7   7   1.8s
    Chapter 9   |  7   7   4.8s
    Chapter 10  |  8   8   9.5s   <- exercises shoot, bvplin, bvp, fem
    Chapter 11  |  5   5  28.8s   <- exercises parabolic (solve(ivp))
    Chapter 13  |  3   3  17.2s
         Testing FundamentalsNumericalComputation tests passed
    
  • Empirically verified RAT v4 indexing semantics (sol[1,:] and sol[2,:] return per-component trajectories; sol[end] returns a scalar; sol.u[end] returns the last timestep vector) before deciding which lines actually needed migration.

ChrisRackauckas and others added 2 commits May 4, 2026 11:45
Bumps the DifferentialEquations compat to allow v8. The umbrella
package was scoped down in v8 to only re-export OrdinaryDiffEq, but
all uses in this repo are ODE-only (Tsit5, ODEProblem, solve), so
the existing call sites continue to work after the bump.

Fixes one indexing breakage in chapter10's `shoot`: under
RecursiveArrayTools v4 (shipped with OrdinaryDiffEq v7), an
ODESolution now subtypes AbstractArray, so `sol[end]` returns the
last *scalar* element in column-major order rather than the last
timestep vector. The downstream `g₂(y[end]...)` then tries to splat
a Float64 and errors. Switching to `y.u[end]...` is the
forward-compatible form and works under both RAT v3 and v4.

The companion `y[1,:], y[2,:]` lines from commit e15d935 still work
unchanged, because AbstractArray row-slicing on the (ncomponents,
ntimesteps) column-major storage returns the same per-component
trajectories as the v3 override did.

Updates the README's "alternative packages" table to point BVP
users at BoundaryValueDiffEq directly, since DifferentialEquations
v8 no longer re-exports the BVP solver family.

All test sets pass on Julia 1.11 with DifferentialEquations v8.0.0
and OrdinaryDiffEq v7.0.0.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The DiffEq docs site (diffeq.sciml.ai) is a unified portal that
covers all topic-specific solvers including BVPs, even after the
v8 umbrella stopped re-exporting them from `using
DifferentialEquations`. Linking to the consolidated docs matches
the IVP entry's existing convention and is a more useful landing
page for a newcomer than the BoundaryValueDiffEq subpackage docs.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread Project.toml
Arpack = "0.5"
Dierckx = "0.5"
DifferentialEquations = "7.15"
DifferentialEquations = "7.15, 8"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both versions are still supported.

Comment thread README.md
| Spline | [Dierckx](https://github.com/kbarbary/Dierckx.jl) |
| [Initial-value problem](https://diffeq.sciml.ai/latest/tutorials/ode_example/#ode_example) | [DifferentialEquations](https://diffeq.sciml.ai/latest/) |
| [Boundary-value problem](https://diffeq.sciml.ai/latest/tutorials/bvp_example/#Boundary-Value-Problems) | [DifferentialEquations](https://diffeq.sciml.ai/latest/) |
| [Boundary-value problem](https://diffeq.sciml.ai/latest/tutorials/bvp_example/#Boundary-Value-Problems) | [BoundaryValueDiffEq](https://diffeq.sciml.ai/latest/) |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other BVP docs are sub-docs here, so the full thing is better. Therefore this is good.

Comment thread src/chapter10.jl
sol = solve(IVP,Tsit5(),abstol=tol/10,reltol=tol/10)
x = sol.t; y = sol;
return [g₁(s...),g₂(y[end]...)]
return [g₁(s...),g₂(y.u[end]...)]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably shouldn't splat for performance, but this at least matches before.

@ChrisRackauckas

Copy link
Copy Markdown
Contributor

This is a reasonably backwards compatible change.

@tobydriscoll
tobydriscoll merged commit 2b51a7a into fncbook:main May 4, 2026
4 of 5 checks passed
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.

3 participants