I guess that is a problem of how the systems handle complex numbers.
Let's calculate the difference between your result and Mathematica's for some points:
Table[(-Log[Cos[x]] - Sec[x]^2 + Sec[x]^4/4) - (-Log[Abs[Cos[x]]] - Tan[x]^2/2 + Tan[x]^4/4), {x, 0, 8, 0.2}]
This gives:
{-0.75, -0.75, -0.75, -0.75, -0.75, -0.75, -0.75, -0.75, -0.75 -
3.14159 I, -0.75 - 3.14159 I, -0.75 - 3.14159 I, -0.75 -
3.14159 I, -0.75 - 3.14159 I, -0.75 - 3.14159 I, -0.75 -
3.14159 I, -0.75 - 3.14159 I, -0.75 - 3.14159 I, -0.75 -
3.14159 I, -0.75 - 3.14159 I, -0.75 - 3.14159 I, -0.75 -
3.14159 I, -0.75 - 3.14159 I, -0.75 - 3.14159 I, -0.75 -
3.14159 I, -0.75, -0.75, -0.75, -0.75, -0.75, -0.75, -0.75, -0.75, \
-0.75, -0.75, -0.75, -0.75, -0.75, -0.75, -0.75, -0.75, -0.75 -
3.14159 I}
That means that the real part differs by a constant (-0.75) only, which is ok. The difference in the complex part comes from the fact that Mathematica's solution has a
$-Log[Cos[x]]$ whereas your solution has a
$-Log[|Cos[x]|]$, i.e. you have absolute values, where Mathematica has none. When
$Cos[x]$ is negative Mathematica needs the complex
$Log$.
If you actually integrate the tan, you run into trouble because the function has poles. The integral does not converge in general.
You can see that when you try to integrate
Integrate[Tan[x], {x, 0, 2 Pi}]
which does not converge. You can use the Principal Value though:
Integrate[Tan[x], {x, 0, 2 Pi}, PrincipalValue -> True]
(*0*)
Mathematica correctly interprets the integration as integration over the complex numbers and gets complex results.
For details see for example: http://www.math.odu.edu/~jhh/ch55.PDF
Cheers,
Marco