def backflow(a,r,rho,x): number_of_particles = x.shape[0] return \ pysum( a*(x[i,0]*x[j,1]-x[i,1]*x[j,0])/rho(i)**2/r(i,j)**3/(1-a/r(i,j)) for i in xrange(number_of_particles) for j in xrange(number_of_particles) if i != j )
def rho(i): return sqrt(pysum(x[i,0:2]**2))
def diff_log_trial(i,k): return pysum(a*(x[i,k]-x[j,k])/(r(i,j)**3 * (1-a/r(i,j))) for j in xrange(x.shape[0]) if j != i)
def r(i,j): return sqrt(pysum((x[i,:]-x[j,:])**2))