I have an impulse train given by
$$\frac{1}{R+1}+\frac{\sum_{k=1}^R \cos(\frac{2k \pi x}{R+1})}{R+1}$$
It seems obvious to me that, for $x=0$, the function returns $1$. This is because $\cos (0)=1$, and we therefore end up with $\frac{1}{R+1}+\frac{R}{R+1}=\frac{R+1}{R+1}=1$.
However, my math software (Mathematica) gives an indeterminate result at $x=0$. Usually this means there is a division by $0$ somewhere. But I can't see any reason for this function to produce an indeterminate result. (This is about the maths of the situation, not the way the software works.)
Can anyone explain?
I set the problem in Wolfram Development Platform and the limit is properly given.
The only thing I noticed is that the simplification of the result is not as good as it could be since, using another CAS, $$\sum_{k=1}^R \cos \left(\frac{2 k\pi x}{R+1}\right)=\frac{1}{2} \left(\sin \left(\frac{\pi (2 R+1) x}{R+1}\right) \csc \left(\frac{\pi x}{R+1}\right)-1\right)$$ making
$$\frac{1}{R+1}+\frac{\sum_{k=1}^R \cos(\frac{2k \pi x}{R+1})}{R+1}=\frac{\sin \left(\frac{\pi (2 R+1) x}{R+1}\right) \csc \left(\frac{\pi x}{R+1}\right)+1}{2 (R+1)}$$ Probably, the indetermination comes from the limit of $\csc(t)$ when $t\to 0$ while, using Taylor expansion $$\sin \left(\frac{\pi (2 R+1) x}{R+1}\right)=\frac{( \pi (2 R+1) ) }{R+1}x-\frac{( \pi (2R+1) )^3 }{6 (R+1)^3}x^3+O\left(x^5\right)$$ $$\csc \left(\frac{\pi x}{R+1}\right)=\frac{R+1}{\pi x}+\frac{\pi x}{6 (R+1)}+\frac{7 \pi ^3 x^3}{360 (R+1)^3}+O\left(x^5\right)$$ $$\sin \left(\frac{\pi (2 R+1) x}{R+1}\right)\,\csc \left(\frac{\pi x}{R+1}\right)=(2 R+1)-\frac{2 \pi ^2 R (2 R+1) }{3 (R+1)}x^2+O\left(x^4\right)$$