I'm simulating the time-delayed Kuramoto model using JiTCDDE and I am having some issues using get_state()
to extract the derivatives through the time evolution.
I'm modelling the time-delayed Kumamoto model on a digraph encoded by an adjacency matrix A
:
def kuramotos():
sols = np.zeros(n)
for i in range(n):
yield omegas[i] + k * sum(
sin(y(j, t - τ) - y(i))
for j in range(n) if A[j,i])
I'm using JiTCDDE to simulate the time evolution according to:
I = jitcdde(kuramotos, n=n)
I.set_integration_parameters(rtol=0, atol=1e-5)
I.constant_past(random.uniform(0, pi, n), time=0)
I.integrate_blindly(max(τ), 0.001)
ts = np.linspace(0,100,1001)
p = [] #phases
dp = [] #phase velocities
for time in I.t+np.arange(0,100.1,0.1):
p.append(list(I.integrate(time) % (2 * pi)))
state = I.get_state() # returns time, phases, frequency
dpi = [s[2] for s in state]
dp.append(dpi)
From what I gather, [s[2] for s in state]
should be returning the values of the derivatives at each time. So I would expect to have a set of n phase velocities at each time step. In reality, what I'm getting is arrays of varying shapes at each time. For example, for n = 50, I would ideally be expecting a simple list of 50 values for the derivative at each timestep, but what I get is:
for i in range(0,10):
print(np.shape(np.array(dp[i])))
Output:
(21, 50)
(7, 50)
(5, 50)
(4, 50)
(3, 50)
(3, 50)
(3, 50)
(3, 50)
(3, 50)
(3, 50)
I'm curious why the shapes of the arrays are like this, and why it seems to settle towards (3,50)? Ideally I would like to simply be getting a list of 50 values for the derivative at each step in time.