Functions as infinite series - graphing

Any one know how to graph a function defined as an infinite series? I need to graph the function $$f(x)=\sum_{n=1}^{\infty}\bigg(n^{2}\tan^{-1}(x- n^{2}) +n^{2}\tan^{-1}(x+ n^{2}) \bigg)$$ $x\in \mathbb R$.

EDIT: So, as Peter suggested, we can simplify the function using $\tan^{-1} a + \tan^{-1} b = \tan^{-1}((a + b) / (1 - ab))$ to be $$f(x)=\sum_{n=1}^{\infty} n^{2} \tan^{-1}\bigg(\frac{2x}{ 1-(x^{2}-n^{4})}\bigg)$$

-
What's with the $\pm$? –  Pedro Tamaroff Dec 8 '12 at 14:11
OK, I fixed that. Thanks! –  Matt Dec 8 '12 at 14:16
Oh, OK. You might want to use some arctangent difference and sum formulas that should help. –  Pedro Tamaroff Dec 8 '12 at 14:17
You mean something like $\tan^{-1} a + \tan^{-1} b = \tan^{-1}((a + b) / (1 - ab))$. –  Matt Dec 8 '12 at 14:20
Indeed. ${}{}{}{}{}{}$ –  Pedro Tamaroff Dec 8 '12 at 14:20

Here you can see a plot for $n=6,10,20$. It seems that when we sum up to $n$, we obtain a set of $2n$ vertical sigmoids bounded by the lines $y= \pi/2\cdot x$ and $y=-\pi/2\cdot x$. You can open the image to see it larger.

$\hspace{0.5 cm}$

-

If you are able to find an explicit formula for the sum of the series, you use that formula to plot the graph of the sum. If not, you choose $N$ large and plot the sum of the first $N$ terms of the series.

In your example I doubt that there is a simpler expression for the sum. $f$ is odd, so that it is enough to consider $x\ge0$. Since $|\tan^{-1}x|\le\max(|x|,\pi/2)$, we see that the series is uniformly convergent. The sum is discontinuous at the points $x=\pm\sqrt{1+n^4}$, $n\in\mathbb{N}$. Below are the graphs of $8$, $16$ and $32$ terms of the sum, drawn with Mathematica 9.

-

Here is a graph of the series by maple 12. To see that there are jumps at some point (look where the vertical segments are), just notice that, the value of the series at $x=4.12$ is positive $9.2885852$ and at the point $x=4.13$ is negative $-3.2263024$.

This is the plot of $f'(x)$

-
So it looks that the function is not differentiable at $x=\pm 4, \pm 9, \dots$! I'm not sure if that is a sharp corner or a vertical asymptot! Could you plot the derivative of that function, I don't have maple 12? The function should be differentiable! The derivative is $$f'(x)=\sum_{n=1}^{\infty}n^{2}\bigg(\frac{1}{(x-n^{2})+1}+\frac{1}{(x+n^{2})+1‌​}\bigg)$$ –  Matt Dec 8 '12 at 14:41
You mean $$f'(x) = \sum\limits_{n = 1}^\infty {{n^2}} \left\{ {{1 \over {1 + {{\left( {x - {n^2}} \right)}^2}}} + {1 \over {1 + {{\left( {x + {n^2}} \right)}^2}}}} \right\}$$ Note that this is not always valid. –  Pedro Tamaroff Dec 8 '12 at 14:52
yes, thanks!... –  Matt Dec 8 '12 at 14:53
You have discontinuities at certain points. –  Mhenni Benghorbal Dec 8 '12 at 15:18
OK, maybe it is my fault: starting with $f'(x)$ as above, what would be the graph of $f'$ and $f$? You already graphed $f$, but as I know the function $f'$ is continuous, but the $f$ is not differentiable! where is my mistake!! –  Matt Dec 8 '12 at 16:04