You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$x\prime\prime(t) = 0$ with $x(0) = 0$ and ${x\prime(0)}^2 = 1$ should initialize with $x\prime(0) = \pm 1$ chosen by an initial guess, and solve to $x(t) = \pm t$:
using ModelingToolkit
using ModelingToolkit: t_nounits as t, D_nounits as D
using DifferentialEquations
using Test
for sign in [-1.0, +1.0]
@variablesx(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())
@testsol(1.0, idxs=sys.x) ≈ sign # system with D(x(0)) = ±1 should solve to x(1) = ±1end
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?
The text was updated successfully, but these errors were encountered:
Yes, this looks like a substitution miss. We probably need to do a pass over the keys like in that issue you linked, where we pass over it to get the new guesses array before putting that with the NonlinearSystem
But it always chooses the negative branch:
So it looks like the guess for
D(x)
is not respected. Is there a missing dummy derivative substitution somewhere, similar to #3029?The text was updated successfully, but these errors were encountered: