What is the indefinite sum of tan(x)? What is the indefinite sum of the tangent function, that is, the function $T$ for which 
$\Delta_x T = T(x + 1) - T(x) = \tan(x)$
Of course, there are infinitely many answers, who all differ by a function of period 1. Ideally, I would like the solution to be of the form
$T(x) = $ nice_function$(x)$ + possibly_ugly_periodic_function$(x)$,
where nice is at least piece-wise continuous.
If any of the following sums can be found, the sum of tan can also be found:


*

*$\sum \sec x$

*$\sum \csc x$

*$\sum \cot x$

*$\sum \frac{1}{e^{ix} + 1}$
I have tried several methods without success, including using a newton series (which does not converge for non-integer $x$), and trying to guess possible functions. 
I would also appreciate lines of attack if a solution is not known.
 A: There is no reason to think there is any simple expression for solution $T$ of
$$T(x + 1) - T(x) = \tan(x)$$ 
What we CAN find a simple solution to is this:
$$T(x + \pi) - T(x) = \tan(x)$$
A: There are no "nice" functions with such properties. Every solution is discontinuous at a dense subset of $\mathbb{R}$. Just look on poles of $\tan x$. Let $x=\pi/2+\pi m$, $m\in\mathbb{Z}$. Clearly either $T$ is discontinuous at $x$ or at $x+1$. In the latter case it is also discontinuous at $x+k$ for every positive integer $k$. In the former case, $T$ is discontinuous at $x+k$ for every non-positive integer $k$.
A: Well I found the answer to your question, it is
$$\sum_x \tan(x)=ix-\psi _{e^{2 i}}^{(0)}\left(x+\frac{\pi }{2}\right)+C$$
I have verified it with difference operator and it gives tan(x). The function involved is the q-digamma function http://mathworld.wolfram.com/q-PolygammaFunction.html .
You can verify the result yourself.
A: I add more details for the solution in the distinguished answer due to Anixx.  First, we need the digamma function
http://en.wikipedia.org/wiki/Digamma_function
which we will call $\Psi(x)$.  Important properties (from that web page) are: $\Psi(x)$ is analytic in the complex plane except at the nonpositive integers where it has simple poles.  $\Psi(x+1)-\Psi(x) = 1/x$.  $\Psi(x) > 0$ for $x>2$.  Asymptotics:
$$
  \Psi(x) = \log x - \frac{1}{2x} - \frac{1}{12x^2} + \frac{1}{120x^4} + O(x^{-6})
\qquad\text{as } x \to \infty .
$$
So, define $T(z) ={}$
$$
  -\sum_{k = 1}^{\infty} \Biggl[\Psi \Biggl(\pi \biggl(k - \frac{1}{2}\biggr) - z + 1\Biggr) + \Psi \Biggl(\pi \biggl(k - \frac{1}{2}\biggr) + z\Biggr) - \Psi \Biggl(\pi \biggl(k - \frac{1}{2}\biggr) + 1\Biggr) - 
\Psi \Biggl(\pi \biggl(k - \frac{1}{2}\biggr)\Biggr)\Biggr]
$$
For any fixed $z$, only finitely many preliminary terms involve $\Psi$ evaluated at a nonpositive argument, and the asymptotics of the remaining terms are computed (from the asymptotics given above) as
$$
\Psi \Biggl(\pi \biggl(k - \frac{1}{2}\biggr) - z + 1\Biggr) + \Psi \Biggl(\pi \biggl(k - \frac{1}{2}\biggr) + z\Biggr) - \Psi \Biggl(\pi \biggl(k - \frac{1}{2}\biggr) + 1\Biggr) - 
\Psi \Biggl(\pi \biggl(k - \frac{1}{2}\biggr)\Biggr)
$$
$=z(1-z)/(k^2\pi^2) + o(k^{-2})$ as $k \to \infty$.  So the series converges absolutely except when we are at a pole of one of the preliminary terms.  Now, because of absolute convergence, we may subtract term-by-term and simplify to get
$$
T(z+1)-T(z) = \sum_{k=1}^\infty\Biggl[\frac{8z}{(-\pi+2\pi k-2z)(-\pi+2\pi k+2z)}\Biggr] = \tan z .
$$
A: The indefinite integral of tan(x) is -ln |cos(x)|, so find out how that expression was arrived at and see if this can be adpated to the discrete case. 
http://en.wikipedia.org/wiki/Indefinite_sum
http://en.wikipedia.org/wiki/Table_of_integrals#Trigonometric_functions
Or go for an approximate answer: truncate the taylor series and find the indefinite sum of that polynomial. From http://en.wikipedia.org/wiki/Taylor_series
tan(x) = x+x^3/3+...  and sum(x+x^3/3,x) = (7/12)x^2-(1/2)x+(1/12)x^4-(1/6)x^3
The problem with this is tan(x) is periodically discontinuous and the taylor series is only valid for one period.
A: It's not in Jolley's Summation Of Series, which is pretty close to saying it doesn't exist. Have you tried Euler-Maclaurin summation to get an asymptotic series? 
A: Consider T(x) in T(x+1)-T(x)=tan(x) to be defined only on the integers>=0 and write it as the recurrence relation :
T(n+1)-T(n)=tan(n) 
and set the initial value at T(0)=0, 
and then without needing a closed form expression for T(n) in terms of n, 
but just plotting the values of T(n+1)=T(n)+tan(n) 
we can see what the function looks like when restricted to the integers:

The top-left image shows the function plotted from n=..750
The left column of images is the plot, the middle images join the dots to get a look at the shape, and the right column shows were the image is zoomed to get the images on the next row.
The function T(n) appears to be almost periodic with period about 355.5
T(n) maximum is about 3.5, T min is about -425.
A: And here is the plot of indefinite sum of tan(x):

Here you can see tan(x) in red and its indefinite sum is in blue.
As you can see, the indefinite sum is fairly continuous. Oleg Eroshkin's conclusion that this function should be discontinuous everywhere apparently came from a false assumption that indefinite sum of a periodic function should also be periodic.
Though it is true that as $|x|$ grows the density of the poles grows, showing the same behavior as in function $f(x)=\tan(x^2)$
The function shown on this plot is 
$$T(z)=-\sum _{k=1}^{\infty } \left(\psi \left(k \pi -\frac{\pi }{2}+1-z\right)+\psi \left(k \pi -\frac{\pi }{2}+z\right)-\psi \left(k \pi -\frac{\pi }{2}+1\right)-\psi \left(k \pi -\frac{\pi }{2}\right)\right)+C$$
It can be derived from the first formula on this page:
$$\tan(x)=8x \sum_{k=1}^{\infty} \frac1{(2k-1)^2\pi^2-4x^2}$$
We notice that there is a difference of squares in the denominator and separate the terms so to obtain
$$\tan(x)=-\sum_{k=1}^{\infty}\left(\frac1{x-\pi k+\frac{\pi}2}+\frac1{x+\pi k-\frac{\pi}2}\right)$$
Now we take indefinite sum by each term to obtain the expression for T(x). All simple.
A: The Maple command for indefinite sums (as described on the page http://www.maplesoft.com/support/help/Maple/view.aspx?path=sum/details, found via Google by typing "indefinite sum" maple) is given by
sum(f,x);
I tried this, but my version of Maple doesn't know the answer when f=tan(x).
For sin(x) it gives sum(sin(x),x);= -(1/2)sin(x)+(1/2)*sin(1)cos(x)/(cos(1)-1)
