Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect results with TMJets for initial condition containing an equilibrium point #588

Open
schillic opened this issue Nov 26, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@schillic
Copy link
Member

(copied here from another discussion)

using ReachabilityAnalysis, DifferentialEquations, Plots

@taylorize function f!(dy, y, p, t)
    dy[1] = y[1] * cos(y[1])
end

prob = @ivp(y' = f!(y), y(0)  0 .. 2, dim=1)

alg = TMJets21b(orderT=10, orderQ=2, abstol=1e-15)

sol = solve(prob, tspan=(0.0, 5.0), alg=alg,
            ensemble=true, trajectories=200, adaptive=true, dt=0.001,
            trajectories_alg=Rodas5())

# plot flowpipe and the ensemble solution
plot(sol, vars=(0, 1), linewidth=0.2, xlab="t", ylab="y(t)")
plot!(ensemble(sol), vars=(0, 1), linealpha=1.0)

Screenshot from 2021-09-24 14-33-02

Something odd happens near 0. Mincing the initial interval gives answers that look better

prob = @ivp(y' = f!(y), y(0)  split(Interval(0, 2), 50), dim=1)
alg = TMJets21b(orderT=10, orderQ=2, abstol=1e-15)
solm = solve(prob, tspan=(0.0, 5.0), alg=alg)

# plot flowpipe and the ensemble solution
plot(solm, vars=(0, 1), linewidth=0.2, xlab="t", ylab="y(t)")
plot!(ensemble(sol), vars=(0, 1), linealpha=1.0)

Screenshot from 2021-09-24 14-37-39

If the interval of interest is 1 .. 2, or any other not containing 0, the integrator behaves properly.

prob = @ivp(y' = f!(y), y(0)  Interval(1, 2), dim=1)
alg = TMJets21b(orderT=10, orderQ=2, abstol=1e-15)
solm = solve(prob, tspan=(0.0, 5.0), alg=alg)

# plot flowpipe and the ensemble solution
plot(solm, vars=(0, 1), linewidth=0.2, xlab="t", ylab="y(t)")
plot!(ensemble(sol), vars=(0, 1), linealpha=1.0)

Screen Shot 2021-10-01 at 6 47 57 PM

There is something about the initial interval having an (unstable) equilibrium point inside. If we include 0 in the initial interval, at some point things go wrong. If 0..0 is the initial point for the expansion, so the initial interval is symmetric around zero, then we get an error: "Minimum tolerance reached" before finishing the integration. If the interval is asymmetric, the integration may finish but the flowpipe obtained is wrong, or simply the error bounds of the Taylor expansion become useless (-Inf .. Inf).

@schillic schillic added the bug Something isn't working label Nov 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant