For some sums, NSum gives me the result nicely for some number of terms, but if I add one more term, it suddenly becomes much slower. I haven't found the minimum example for which this can be reproduced, but here is a problem I was just trying to compute:
NSum[Sin[x0*n*Pi]*Sin[d*n*Pi/2]*Exp[(n*Pi)^2 *t]*(2 - Cos[n*Pi] -
2*BesselJ[1, n*Pi/2]*Sin[n*Pi/2]), {n, 1, 24}]
Here t=-0.3, d=0.1 and x0=0.5. For 24 terms, this evaluates just fine (and gives me 0.015118), but for 25 terms, the calculation takes much longer. It seems to me that adding just one more term to the sum should not take much longer than the original calculation. What is going on here? I'm using Mathematica version 9.0.1.0.
NSumTerms
within ten of desired term number. $\endgroup$ – ciao Jun 11 '14 at 9:53