num_ode_rk4_adaptive ignores h_min when h_min is at least the integration span, taking steps 400x below it while h_min just under the span errors
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 62/100
Research direction
Start by locating num_ode_rk4_adaptive and reading its step selection and minimum step rejection paths. Reproduce the reported case with h_min equal to the integration span, then compare it with h_min just below the span. Done means the solver enforces the documented minimum step and reports an error when the tolerance requires smaller steps; run the relevant Rust tests.
Written by the indexing model from the issue text.
Description
When h_min is at least the integration span, num_ode_rk4_adaptive silently ignores it and returns hundreds of steps that are all far below h_min, while the same call with h_min just under the span correctly raises the documented step-limit error — so raising h_min turns an error into a success that violates the bound.
suppressWarnings(suppressMessages(library(rssn)))
s <- rssn_session()
rhs <- rssn_callback(function(t, y) -y, s, op = "num_ode_rk4_adaptive", index = 11)
run <- function(hmin, t1) {
r <- tryCatch(call_value("num_ode_rk4_adaptive", 0, t1, list(1), 1e-12, 1e-12,
0.1, hmin, 10, 1e6, 1e6, rhs, session = s),
error = function(e) "ERROR")
if (identical(r, "ERROR")) return(sprintf("t1=%-4g h_min=%-5g ERROR", t1, hmin))
tt <- sapply(value_json(r)$record$fields[[1]][[2]]$tensor$data, function(z) z$float)
sprintf("t1=%-4g h_min=%-5g ok nsteps=%d min_h=%.4g steps_below_h_min=%d",
t1, hmin, length(tt) - 1, min(diff(tt)), sum(diff(tt) < hmin))
}
for (a in list(c(0.9, 1), c(1, 1), c(1.9, 2), c(2, 2), c(2, 0.5))) cat(run(a[1], a[2]), "\n")
t1=1 h_min=0.9 ERROR
t1=1 h_min=1 ok nsteps=394 min_h=0.001589 steps_below_h_min=394
t1=2 h_min=1.9 ERROR
t1=2 h_min=2 ok nsteps=722 min_h=0.00237 steps_below_h_min=722
t1=0.5 h_min=2 ok nsteps=206 min_h=7.5e-05 steps_below_h_min=206
y' = -y on [0, 1] at atol = rtol = 1e-12 needs steps of about 0.002, so a minimum step of 1 is unsatisfiable and the docstring says exactly what should happen: "an error for ... a tolerance requiring a smaller step than h_min". With h_min = 0.9 that error is raised; with h_min = 1 — equal to the span — every one of the 394 accepted steps is below h_min by a factor of 400 and no error is reported. The answer is still numerically right (y(1) = 0.367879441171), so the defect is that h_min stops being enforced rather than that the solution is wrong; a caller who uses h_min to bound the work per interval, or to detect an unsatisfiable tolerance, is given a green light instead.
The trigger is h_min >= t1 - t0 (confirmed at spans 0.5, 1 and 2, and independent of h_max, which was 10 here and 1/2/4 in a second run): that case appears to take a "finish the interval in one step" path which skips the min-step rejection, but the solver then subdivides normally instead of taking the single step.
rssn 0.3.0, R 4.6.2 binding, Windows x86_64.
- Dominant language
- Rust
- Stars
- 36
- Forks
- 3
- Avg merge
- 14h 51m
- Merged PRs (30d)
- 29
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing 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.
More from Apich-Organization/rssn
-
num_ode_rk4_adaptive rejects atol = 0 while accepting rtol = 0 and while num_ode_dopri5 accepts bothOpenarea/ode-pde good first issue help wanted kind/contract severity/4-minor
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Apich-Organization/rssn#383 ·
Maintainers usually reply within 1 day
-
area/numerical good first issue help wanted kind/doc-mismatch severity/5-trivial
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Apich-Organization/rssn#373 ·
Maintainers usually reply within 1 day
-
area/numerical good first issue help wanted kind/doc-mismatch severity/4-minor
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Apich-Organization/rssn#371 ·
Maintainers usually reply within 1 day
-
json_encode() re-emits a decoded empty JSON object as [], so {} and {"":1} are not round-trip stableOpenarea/api-bindings good first issue help wanted kind/contract severity/4-minor
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Apich-Organization/rssn#361 ·
Maintainers usually reply within 1 day
-
area/statistics good first issue help wanted kind/wrong-result severity/4-minor
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Apich-Organization/rssn#362 ·
Maintainers usually reply within 1 day
All issues in Apich-Organization/rssn
Similar issues
-
Update Wasmtime to 48.0.11 for RUSTSEC-2026-0648Possibly taken @flyingrobots claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
flyingrobots/edict#457 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
-
O-windows relnotes relnotes-needs-review relnotes-tracking-issue T-libs
Difficulty 1/5 Under an hour Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
approved
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
fritzprix/libr-agent#3266 ·
Maintainers usually reply within 1 day
-
Frame::second_to_frame truncates f32 product, causing periodic off-by-one framesPossibly taken @ShamanicArts claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
dmtrKovalenko/fframes#296 ·
Maintainers usually reply within 1 day