Skip to content

SDDE: saveat causes incorrect evaluation of the history function #3254

@ChrisRackauckas-Claude

Description

@ChrisRackauckas-Claude

Moved from SciML/StochasticDelayDiffEq.jl#52.

Using saveat with SDDE problems causes the history function to return incorrect values. When solving without saveat, the history function evaluates correctly, but adding saveat changes the results.

Reproducer (adapted for new DelayDiffEq-based SDDE):

using DelayDiffEq, StochasticDiffEqLowOrder

function f(du, u, h, p, t)
    du[1] = -u[1]
    println(h(p, t - 0.001))
end

function g(du, u, h, p, t)
    du[1] = 0.1
end

tspan = (0.0, 0.1)
h(p, t) = 0.0
u0 = [0.0]
prob = SDDEProblem(f, g, u0, h, tspan, 0.0, constant_lags = [0.001])

sol = solve(prob, MethodOfSteps(EM()), dt = 0.01)           # correct
sol = solve(prob, MethodOfSteps(EM()), dt = 0.01, saveat = 0.1)  # incorrect history

The history function should return the same values regardless of saveat.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions