Closed
Description
using ModelingToolkit
using ModelingToolkit: t_nounits as t, D_nounits as D
using DifferentialEquations
using Test
for sign in [-1.0, +1.0]
@variables x(t)
sys = ODESystem(
[D(D(x)) ~ 0], t;
initialization_eqs = [D(x)^2 ~ 1, x ~ 0], guesses = [D(x) => sign], name = :sys
) |> structural_simplify
prob = ODEProblem(sys, [], (0.0, 1.0), [])
sol = solve(prob, Tsit5())
@test sol(1.0, idxs=sys.x) ≈ sign # system with D(x(0)) = ±1 should solve to x(1) = ±1
end
But it always chooses the negative branch:
Test Failed at C:\Users\herma\.julia\dev\SymBoltz\bug.jl:14
Expression: sol(1.0, idxs = sys.x) ≈ sign
Evaluated: -0.9999999999999956 ≈ 1.0
So it looks like the guess for D(x)
is not respected. Is there a missing dummy derivative substitution somewhere, similar to #3029?