Skip to content

Wrong calculation of convergence to state if distance to state is exactly 0.0 #67

@MarvynBornemann

Description

@MarvynBornemann

In Observables.jl the function

function get_convergence_to_state(sol::AbstractODESolution, state, distance; tail_frac=0.8)
    L = length(sol.t)
    idx = max(1, round(Int, tail_frac*L)):L
    x = sol.t[idx]
    y = [distance(state, p) for p in sol.u[idx]]
    X = zeros(length(x),2)
    X[:,1] = x
    X[:,2] .= 1.0
    slope, intercept = X \ log.(y)
    return slope
end

returns slope = NaN if the distance(state, p) = 0.0 and therefore y is 0.0 somewhere.

Might be resolved by just calculating slope = x \ log.(y). Then the slope = -inf if the distance y is 0.0 somewhere.

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