s = numpy.getfromtxt('the_s_file.txt')
delta = numpy.getfromtxt('the_delta_file.txt')

def V(r, phi, lam):
    ret = 0
for n in range(2, 361):
    for m in range(0, n + 1):
        inner = c[n, m] * math.cos(m * lam) + s[n, m] * math.sin(m * lam)
inner *= math.sqrt(math.factorial(n - m) / math.factorial(n + m) * (2 * n +
    1) * (2 - delta[m, 0]))
inner *= P(n, m, math.sin(lam))
ret += math.pow(a / r, n) * inner
return ret
Writing a double sum in Python