New answers tagged

4

By a very wide margin, the slowest part of your code is this loop: for k in range(nangles): pi_nm2 = 0 pi_nm1 = 1 for n in range(1, nstop): tau_nm1 = n * mu[k] * pi_nm1 - (n + 1) * pi_nm2 S1[k] += (2 * n + 1) * (pi_nm1 * a[n - 1] + tau_nm1 * b[n - 1]) / (n + 1) / n S2[k] += (2 * n + 1) * (...


Top 50 recent answers are included