I am trying to solve the dynamics of a network composed of N=400 neurons.
That means I have 400 coupled equations that obey the following rules:
i = 0,1,2...399
J(i,j) = some function of i and j (where j is a dummy variable)
I(i) = some function of i
dr(i,t)/dt = -r(i,t) + sum over j from 0 to 399[J(i,j)*r(j)] + I(i)
How do I solve?
I know that for a system of 3 odes. I defined the 3 odes and the initial conditions and then apply odeint. Is there a better way to perform in this case?
So far I tried the following code (it isn't good since it enters an infinite loop):
N=400 t=np.linspace(0,20,1000) J0=0.5 J1=2.5 I0=0.5 I1=0.001 i=np.arange(0,400,1) theta=(2*np.pi)*i/N I=I0+I1*cos(theta) r=np.zeros(400) x0 = [np.random.rand() for ii in i] def threshold(y): if y>0: return y else: return 0 def vectors(x,t): for ii in i: r[ii]=x[ii] for ii in i: drdt[ii] = -r[ii] + threshold(I[ii]+sum(r[iii]*(J0+J1*cos(theta[ii]-theta[iii]))/N for iii in i)) return drdt x=odeint(vectors,x0,t) 