The best way to implement a function on an iterable is to use the map function.
Since map is written in C and is highly optimized, its internal implied loop can be more efficient than a regular Python for loop.
I am solving a stochastic differential equation and I have a function that contains an algorithm to solve it. So I have to call that function at each time step (it is similar to Runge Kutta's method but with a random variable), then I have to solve the equation many times (since the solution is random) to be able to make averages with all the solutions . That is why I want to know how to call this function in each iteration in the most efficient way possible.
How can I efficiently call a function in a loop with python?