Skip to content

Conversation

ryandeeley
Copy link
Collaborator

We wish to create the initial functions useful for analysing rate-dependent dynamical systems that will go into the JOSS paper, in particular the critical_rate and moving_sinks functions.

@reykboerner
Copy link
Collaborator

Hey @ryandeeley, I added a file for each function in src. Also, don't mind the format-check failing, this can easily be fixed later.

@ryandeeley
Copy link
Collaborator Author

Hey @ryandeeley, I added a file for each function in src. Also, don't mind the format-check failing, this can easily be fixed later.

cool, thanks!

## Non-autonomous case

Now, we want to explore a non-autonomous version of the system.
We consider a setting where in the past and in the future the system is autnonomous and in between there is a non-autonomous period ``[t_start, t_end]`` with a time-dependent parameter ramping given by the function ``\lambda(rt)``. Choosing different values of the parameter ``r`` allows us to vary the speed of the parameter ramping.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

autnonomous -> autonomous

r::Float64
t_start::Float64
t_end::Float64
end
Copy link
Member

@oameye oameye Aug 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This struct should be made concrete. Both p_lambda and λ are non concrete types instead one should use Parametric types. Also, RateProtocol should probably not be mutable as this would lead to bad performance. Instead I propose

struct RateProtocol{F, T}
    forcing_function::F
    p_lambda::Vector{T}
    rate::T
    time_interval::Tuple{T,T}
end

Comment on lines +47 to +69
u,
p,
t,
ds::ContinuousTimeDynamicalSystem,
λ::Function,
t_start::Float64,
t_end::Float64,
r::Float64;
kwargs...,
)
if t_start > t_end
error("Please ensure that t_start ≤ t_end.")
end

= if r*t t_start
λ(p, t_start; kwargs...)
elseif t_start < r*t < t_end
λ(p, r*t; kwargs...) # the value(s) of λ(rt)
else
λ(p, t_end; kwargs...) # the value(s) of λ(rt)
end; # the value(s) of λ(rt)
return ds.integ.f(u, p̃, t)
end;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better for performance to do this with a callback?

Time-dependent forcing protocol specified by the following fields:
- `λ::Function`: forcing function of the form `λ(p, t_start; kwargs...)``
- `p_lambda::Vector`: parameters of forcing function
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p_lambda::Vector`: parameters of the forcing function

fp, eig, stab = [], [], []
for t in times
rate_sys = apply_ramping(ds, rp, t)
_fp, _eig, _stab = fixedpoints(rate_sys, box)
Copy link
Collaborator Author

@ryandeeley ryandeeley Aug 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first this threw me because it looks like you're trying to compute the fixed points of a nonautonomous system, rather than those of the associated frozen-in autonomous system. However, I'm guessing fixed_points is clever and extracts the frozen-in dynamic_rule corresponding to the initial time t passed here.

The term "moving sinks" refers to Wieczorek et al. (2023).
"""
function moving_sinks(ds::ContinuousTimeDynamicalSystem, rp::RateProtocol, box;
times=0:0.1:1)
Copy link
Collaborator Author

@ryandeeley ryandeeley Aug 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would propose changing the value of the keyword argument times to rp.t_start/rp.r : (rp.t_end/rp.r - rp.t_start/rp.r)/10 : rp.t_end/rp.r, because then when "sweeping through" times you are going to automatically cover all possible parameter values attained with the rate protocol rp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants