# integral of 1/x, tan x

why integral ($ $$1/x$, $x$) returns $log(x)$? Shouldn't it return $log(|x|)$. Similarly, integral$(tan(x),x)$ returns $log(sec(x))$ shouldn't it return $log(|sec(x)|)$. Can anyone explain?

After previous post, I dig a little bit and find:

```
sage: equation=integral(1/x+x,x).real()
sage: equation
1/2*real_part(x)^2 - 1/2*imag_part(x)^2 + log(abs(x))
sage:
```

Now, anyway to set real_part(x)=x and imag_part(x)=0 in "eq" and get the resultant "eq"?

More>>

```
sage: integral(1/(x^3-1),x).real()
-1/3*sqrt(3)*real_part(arctan(1/3*(2*x + 1)*sqrt(3))) + 1/3*log(abs(x - 1)) - 1/6*log(abs(x^2 + x + 1))
```

Everything is fine in the above computation except the word "real_part". Anyway to get rid of that?