Deriving the Integral for Alternating Harmonic Series Partial Sums The partial sums of the harmonic series (the Harmonic Number, $H_n$) are given by
$$H_n=\sum_{k=1}^{n} \frac{1}{k}$$
and the well known integral representation is
$$H_n=\int_0^1 \frac{1-x^n}{1-x}\,dx$$
This can be used to calculate $H_n$ using rational values of $n$.
The partial sums of the alternating harmonic series (the Alternating Harmonic Number, $\widetilde{H_n}$) are given by
$$\widetilde{H_n}=\sum_{k=1}^{n} \frac{(-1)^{k-1}}{k}$$
Now I am happy with the equivalent integral representation for the alternating harmonic number at integer $n$:
$$\widetilde{H_n}=\int_0^1 \frac{1+(-1)^{n-1}x^n}{1+x}\,dx$$
but at rational values of $n$ this formula gives complex results which I don't believe are correct.
The correct formula I think involves the real component of (-1)^z at non-integer values of z, i.e. $\text{Real}[(-1)^z]=\cos(\pi\,z)$
$$\widetilde{H_n}=\int_0^1 \frac{1+(-\cos(\pi\,n))x^n}{1+x}\,dx=\sum_{k=1}^{\infty}(-1)^{k-1} \left(\frac{1}{k}-\frac{\cos(\pi\,n)}{k+n}\right)\tag{1}$$
from which real solutions result for example
$$\widetilde{H}_{1/2}=\log 2$$
However is this assertion of mine correct (concerning the integral at non-integer $n$) and if so, can it be easily proved (without resorting to complex analysis)?
Development of the Argument
Lets define the harmonic number in terms of partial zeta sums thus, $H_n=\zeta_n(1)$ and the alternating harmonic number in terms of partial sums of the Dirichlet eta function $\widetilde{H_n}=\eta_n(1)$
by analogy we can define the partial sums of the Dirichlet Lambda function thus, $\lambda_n(1)=\sum_{k=1}^{n} \frac{1}{2k-1}$ and of the Dirichlet Beta function thus, $\beta_n(1)=\sum_{k=1}^{n} \frac{(-1)^{k-1}}{2k-1}$
Now I have been able to find a simple relationship between $\zeta_n(1)$ (i.e. $H_n$) and $\lambda_n(1)$, that is valid for rational $n$.
$$\lambda_n(1)=\zeta_{2n}(1) -\frac{1}{2}\zeta_{n}(1)=H_{2n}-\frac{1}{2}H_n$$
I was therefore wondering whether a similar simple relationship exits between $H_n$ and $\widetilde{H_n}$ for rational $n$. Obviously that is not possible if $\widetilde{H_n}$ is typically a complex number.
For example for integer $n$ we have two formulae for $\widetilde{H_n}$ or $\eta_n(1)$:
$$\eta_{2n-1}(1)=\widetilde{H}_{2n-1}=2\lambda_n(1)-\zeta_{2n-1}(1)$$
$$\eta_{2n}(1)=\widetilde{H}_{2n}=2\lambda_n(1)-\zeta_{2n}(1)$$
and I would like to get to one formula.
Update 2: A result of playing with these ideas in Mathematica
In Mathematica functions often get simplified in terms of the Generalized Harmonic Number function $H_n^{(s)}=\zeta_n(s)=\sum_{k=1}^n \frac{1}{k^s}$
So I've been trying to represent all the trigonometric functions in terms of the Generalized Harmonic Number function.
It's easy for the functions involving $\csc x$ or $\sec x$ but much harder for the pure functions $\sin x$ and $\cos x$.
Anyway I at last managed to find a reasonably simple 4 term candidate for $\cos x$, utilizing my definition for $\eta_n(1)$ above in (1).
$$\cos(x)=1+\frac{x}{\pi}\left(\eta_{-x/\pi}(1)-\eta_{x/\pi}(1)\right)+\frac{x}{\pi}\left(\zeta_{-x/\pi}(1)-\zeta_{x/\pi}(1)\right)$$
But maybe the complex numbers cancel out using the alternative definition.
 A: Here are the formulas and evaluations relevant to the question.

(1) $\quad f(n)=\int_0^1\frac{1+(-1)^{n-1} x^n}{1+x}\,dx=\log(2)+\frac{1}{2} (-1)^n \left(H_{\frac{n-1}{2}}-H_{\frac{n}{2}}\right),\ Re(n)>-\frac{1}{2}$
(2) $\quad f\left(\frac{1}{2}\right)=\log(2)+\frac{1}{2} i \left(H_{-\frac{1}{4}}-H_{\frac{1}{4}}\right)=0.693147 - i\ 0.429204$

(3) $\quad g(n)=\int_0^1\frac{1-\cos (\pi n)\ x^n}{1+x}\,dx=\log(2)+\frac{1}{2} \cos(\pi n) \left(H_{\frac{n-1}{2}}-H_{\frac{n}{2}}\right),\ Re(n)>-\frac{1}{2}$
(4) $\quad g\left(\frac{1}{2}\right)=\log (2)=\Re\left(f\left(\frac{1}{2}\right)\right)$

The following figure illustrates the real and imaginary parts of $f(n)$ defined in formula (1) above in blue and orange respectively. The dashed-gray horizontal grid line is at $\log(2)$. Note $\Im(f(n))$ (orange) has zeros at integer values of $n$, and $Re(f(n))$ (blue) evaluates to $\log(2)$ (dashed-gray) at half-integer values of $n$. Note Figure (1) below is also consistent with $\underset{n\to\infty}{\text{lim}}f(n)=\log (2)$.


Figure (1): Illustration of $\Re(f(n))$ and $\Im(f(n))$ in blue and orange respectively
