I am a physics student. I must perform a simple relaxation loop over a list of data and I did it with a simple while loop that looks something like this
i = 1; While[i < Limit, data[[i]] = f[ data[[i]] , data[[i+1]], data[[i-1]] ]; i = i+2; i = 2; While[i < Limit, data[[i]] = f[ data[[i]] , data[[i+1]], data[[i-1]] ]; i = i+2;
As you can see, i perform the operation first on odd places of the list and then on even ones. The problem is, i must do this something like ten thousand times for the solution to converge and this takes too much time. So i was wondering if this could be accomplished in a faster way maybe using nest, but how can i use data[[i+1]] and data[[i-1]] in the computation?
Maybe it is a trivial question so i apologize in advance.