Periodic Chain
It's often in Physics to treat problems with periodic boundaries, a lineal chain of entities that only have relations with the nearest neighbour. So, if you have 10 elementes numbered from 1 to 10, the element 3 feels actions of element 4 and 2, what happens with element 1 and 10? there is where the periodic boundarie enters. Element 10 must be related with 9 and 1, and element one does with 2 and 10.
In writing the code, it's no hard to do this, a couple of "if's" does the work, but what about if you are trying to solve a bidimesional lattice? But first, it may be interesting try to solve the linear chain first. I solved the half of the problem doing:
Action(i)=Action(mod(i,10)) [i runs from 0 to 11]
'Action' is some kind of function, and I think in a problem with 10 elements in the real chain. You see that the neighbour at the right of 10 is indeed 1, that's ok.
But this doesn't work for element 1
.
Can anybody try to solve this?


