Using Phython's GEKKO library and following the example to solve the Wave Equation from their original paper, one needs to create a whole lot of equations.
m.Equations([u[i].dt() == v[i]for i in range(npx)])
m.Equations([v[i].dt() == c**2*(u[mod(i+1,npx)]-2.0*u[mod(i,npx)]+u[mod(i-1,npx)])/dx**2 for i in arange(0,npx,1)])
(I already reduced it to two lines via mod , incorporating the boundary conditions and let i run from 0 to 99, but it's basically still the same as in the example.)
It is still using a for-loop, i.e. v[i]for i in range(npx)]. Can one avoid this and thus make the code more readable or the simulation faster by paralellising / vectorising it like one can do with numpy arrays?
Of course for this problem the computation only takes <18s on my laptop, but bigger problems might be very slow.
There is something about arrays in the documentation, but I don't understand it and I don't know if this is even what I am looking for.
I attached a MWE, using the above code here.