1 | initial version |
I'm pretty sure your function attains its maximum at x=0, where each of the terms will have its maximal (positive) value 1. I assume your series arises as a truncation of an infinite series? It doesn't look like this series will be pointwise convergent, so I'm not so sure that the extremal values of the truncated series will tell you something useful.
In general, I'd expect the algorithms in scipy for optimizing functions to be pretty good. Use for instance:
sage: import scipy.optimize as opt sage: f=fast_callable(sum( cos(a*x) for a in sequence),vars=(x,),domain=RDF) sage: opt.minimize_scalar(f)
although you might want to double check if the numerics are trustworthy. Your expression has an awful lot of terms, so there's plenty of room for precision loss.