Hilbert transform of x (or a sawtooth) This has a simple curiosity value, but I was converting the czt() (chirp z-transform) function from Octave into (wx)Maxima and, while testing it, I used a simple ramp, or $x$. The appearance of the transform is that of an "U". So I was wondering if there is a closed form formula for the response. If I use:
$$\dfrac{1}{\pi}\int{\dfrac{x}{t-x}\mathrm{d}x}=-\dfrac{t\log(x-t)+x}{\pi}$$
which is a logarithm on a slope; at best, it's only half the curve. There are other integral forms, I tried the difference version but that gives something very similar to the above. Then I realized that applying the FFT means the infinity $x$ becomes a modulo operation, or a sawtooth, and it's more fitting for a cosine sum: $\sum\frac{\cos{kx}}{k}$. I modified the formula above (and used a bit of hammer time) and got:
$$n\cdot\dfrac{\log(k+1)+\log(n-k+2)-7.33}{2.5},\quad k=1,2,...,n$$
which seems to come close to the actual curve (blue is the result of the Hilbert transform, green is the cosine sum, and red is the logarithm above):

$x$ is a discrete valued sequence of $n=100$ terms: $k+1,\;k=0,1,...,n-1$. OTOH, the cosine sum implies a $\sum{\frac{1}{x}}$ result, but that doesn't go negative by itself. Intuitively, I imagine this sum of cosines to be evaluated as a limit of $\sum{\frac{\cos{pk}}{k}}$ at each point $p$, and that would be the answer, but that seems like a brute-force approach, and I'm not even sure if it's the right way.
I am, most probably, overthinking it, or even diverging from the actual response (if there is one), so my question is: is there a continuous function that describes the Hilbert transform of (a periodic) $x$?

I've been fiddling with this. It looked as if the sum of cosines would converge to zero, since the cosine takes values between -1 and 1, while k goes to infinity, but I've been trying to evaluate the sum numerically with an imposed n and the results clearly converge towards a certain value. Here is the sum evaluated for x=0.9 and n=10000
:
The value at the end is 0.139365607458084, while the average of all the points is 0.139405249374687. This made me look at it from a different perspective: it's a sum of $\frac{\cos{kx}}{k}$, so it's a discrete evaluation of the integral of it, but results in $\frac{\sin{kx}}{k^2}$, which is nowhere near the result.
It looks like the only way to do it is to evaluate the limit of the sum of cosines at each point of the underlying DFT, which might avoid the spectral leakage, but it certainly won't give any continuous function. I hope the question doesn't reduce to "is this possible":.
 A: I found something, because the math seems to go the right way, but I can't quite match the responses (which most probably means it's wrong, but it's the only thing I've got so far).
Continuing from the sum of cosines, in the OP the integral used $x$ as the variable, but that is the value for the discrete point, and so $k$ should be used, instead, which leads to the cosine integral. Since the modulo transforms $x$ into a periodic function, and since the Hilbert transform is done using a Fourier transform, that implies sampling and, even if the formula I'm looking for is continuous, there is a spectrum folding, which is why there is a sum of logarithms in the OP with $x$ and $-x$. The same applies here:
$$\sum_{k=1}^N{\dfrac{\cos{kx}}{k}}=\int{\dfrac{\cos{kx}}{k}\mathrm{d}k}=-\dfrac{i\Gamma(0,-ikx)+i\Gamma(0,ikx)}{2}=\mathrm{Ci}(kx)\tag{1}$$
Maxima shows it as the incomplete $\Gamma$ function. Applying the spectrum mirroring is done relative to the length of the sequence, defined through $n$. With scaling it becomes:
$$-\dfrac{n}{\pi}\Biggl(\mathrm{Ci}\Bigl(\dfrac{x}{n}\Bigr)+\mathrm{Ci}\Bigl(\dfrac{n-x}{n}\Bigr)+1\Biggr)\tag{2}$$
Testing this seems to be a close match to the continuous sum of cosines ($n=10,100,1000$, skips $x[0]$ because of the $\mathrm{Ci}(0)$):

but there are apparent differences. If I grab the ol' trusty hammer, I end up with a correction value of $1.5$ for the argument of the function and $0.39$ as offset (differences between the traces):

But the offset is not the problem, the curve does not seem to fit exactly, and I don't know whether it's because I am using a finite amount of cosines for the sum, or if the formula is just plain wrong. Here are the differences for traces that are sampled at $\frac1n$, as opposed to $\frac{0.1}{n}$ until now:

It doesn't seem to be a sampling effect, since the curve for $n=100$ is quite similar for $n=1000$ (i.e. there are not more oscillations).
So I tried from a different angle. If the Hilbert transform is a sum of cosines and, thus, a cosine integral, then the original (modulo) $x$ signal should be a similarly made sine integral:
$$\begin{align}
\sum_{k=1}^N{\dfrac{\sin{kx}}{k}}&=\int{\dfrac{\sin{kx}}{x}\mathrm{d}k}=\dfrac{i\Gamma(0,-ikx)-i\Gamma(0,ikx)}{2}=\mathrm{Si}(kx)\tag{3} \\
&\Rightarrow -\dfrac{n}{2}\Biggl(\mathrm{Si}\Bigl(\dfrac{x}{n}\Bigr)-\mathrm{Si}\Bigl(\dfrac{n-x}{n}\Bigr)+1\Biggr)\tag{4}
\end{align}$$
where I had to use $\frac{n}{2}$ as the normalization, but it still doesn't match well the input, and I suppose it's to be expected that a continuously differentiable function should not be able to recreate a ramp. Here in blue is $x$, left - difference (same shape for $n=10$ as for $n=10000$):

So then, is this the way to go? Because the results are not very encouraging.
