# How does the series $\sum_{n=1}^\infty \frac{(-1)^n \cos(n^2 x)}{n}$ behave?

The title is the question: I'm trying to understand the behavior of the series

$$\star \qquad \sum_{n=1}^\infty \frac{(-1)^n \cos(n^2 x)}{n},\qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad\qquad \qquad$$

where $0\leq x \leq 1$. All I know for sure about it is that it converges conditionally at $x=0$ to a known value (I think it's $-\ln 2$). I don't even know how to check its convergence for other values of $x$ (it may be possible to compute it for certain rational multiples of $\pi$). I plotted the partial sum going up to $n=1000$ using Maple and the partial sum only goes from about $-2.8$ to $0.4$. It also looks continuous but very jagged. This suggests that the series may converge at least pointwise to a continuous, nowhere-differntiable function. The maximum value of the absolute value of the derivative of the 1000th partial sum is about $21249$, according to Maple17's Mamimize command, but I am suspicious because Maple says the maximum occurs at $x=0.2000002655$, suspiciously close to $0.2$. But if the derivative of the 1000th partial sum really is that big, it suggests that if the series converges to a function, that function might be nowhere-continuous.

I did some Googling, looking for information on continuous, nowhere-differentiable functions, hoping to find my series. There seem to be a huge number of them that are well-known. The best-known such functions seem to be "Weierstrass functions", but for such functions the denominator is something like $2^n$, which grows much faster than $n$. At http://epubl.luth.se/1402-1617/2003/320/LTU-EX-03320-SE.pdf , there is posted a thesis about continuous, nowhere-differentiable functions. On p. 23 of the .pdf (not the author's page number, but the page number of the .pdf document), the author discusses "Riemann's function", defined by $\sum_{k=1}^\infty \frac{1}{k^2}\sin(k^2 x)$. This is very similar to my series, but again the denominator decays more rapidly than the one I'm considering.

So, to make a long story short, this is what I'd like to know:

For what values of $x$ does $\star$ converge?

For what values of $x$ does $\star$ converge absolutely?

If $\star$ converges for all $x$ (EDIT: NO: see accepted answer) , does it converge merely pointwise or uniformly? (see answer)

If $\star$ converges at least pointwise (EDIT: NO: see accepted answer), where is the resulting function differentiable?

EDIT: I accepted an excellent answer that answers most of my questions, and I will not unaccept it. However, I am still a little curious about the complete answers to my first and second questions above. I will upvote informative, original comments and answers.

-
$$(-1)^n\cos (n^2x)=cos(n^2x-n\pi)$$ – Suraj M S Nov 24 '13 at 4:01
Oh, and the convergence at $x=0$ is not absolute, since the absolute value of the terms is just the harmonic series. – Henning Makholm Nov 24 '13 at 4:15
Why are you saying the series converges absolutely for $x=0$? It converges conditionally. – Mhenni Benghorbal Nov 24 '13 at 5:09
@SurajM.S : Your observation is useful if one wants to repeat Henning's argument for other rational multiples of $\pi$. – Stefan Smith Nov 29 '13 at 0:43

The series diverges for $x=\frac{2\pi}8\approx 0.78$. Since the squares modulo 8 are 0,1,4,1,0,1,4,1, the series for this $x$ becomes $$- \frac{\sqrt{1/2}}{1} - \frac1{2} - \frac{\sqrt{1/2}}{3} + \frac1{4} - \frac{\sqrt{1/2}}{5} - \frac1{6} - \frac{\sqrt{1/2}}{7} + \cdots$$
The terms with even denominator form an alternating series -- their $(-1)^n$ factor is always $1$ but the cosine alternates between $-1$ and $1$. So their sum converges. However, the terms with odd denominator all have the same sign because the $(-1)^n$ factor is always $-1$ and the cosine is always $\cos\frac{\pi}{4} = \sqrt{1/2}$. So they diverge logarithmically towards $-\infty$.
I would expect (without having checked) that a similar divergence will happen at many other rational multiples of $\pi$, such that your series diverges for a dense set of $x$s.
Note that logarithmic divergence is slow. Even for $1000$ terms, you shouldn't expect it to have reached more than $\log 1000\approx 7$ times the first term, so the $2.8$ maximum you've found numerically does not really point towards convergence (note that in the above case only half of the terms participate in the divergence).
Again, that is excellent, and it shows that computers can't replace analysis. I am also quite sure that the series will diverge for a set of rational multiples of $\pi$ that is dense in $[0,1]$. – Stefan Smith Nov 24 '13 at 4:09