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?
Solved! Go to Solution.
Mike
winfrod rager has offered an extensive explanation how to make perdiodic functions, you can download his work here :http://communities.ptc.com/thread/36244
By these days I needed a code the make the indexs runs periodically on a range of integers, and I solved that by re reading winfrod's contribution. I've modified one of his examples and came out in the following
y(t)=mod((mod(t-1,2T)+2T),2T)+1 with T =5 you have y(1)=1, y(10)=10 and y(11)=1, y(12)=2 etc and, y(0)=10, y(-1)=9 and so on.
Hope this be useful for you.
joe
Action(mod(mod(i,2T)+2T,2T))
Solve the issue, take T=5
See my history in the Forum for more explanations.
Please post a worksheet.
Mike
Mike
winfrod rager has offered an extensive explanation how to make perdiodic functions, you can download his work here :http://communities.ptc.com/thread/36244
By these days I needed a code the make the indexs runs periodically on a range of integers, and I solved that by re reading winfrod's contribution. I've modified one of his examples and came out in the following
y(t)=mod((mod(t-1,2T)+2T),2T)+1 with T =5 you have y(1)=1, y(10)=10 and y(11)=1, y(12)=2 etc and, y(0)=10, y(-1)=9 and so on.
Hope this be useful for you.
joe
Cheers Joe. I wasn't looking for a solution I was nearly asking for a worksheet to be provided.
Cheers anyway.
Mike