# Real and Imaginary plots of the answer to $\int \sec x\, dx$ [duplicate]

I used free-from input to do this:

= integrate sec x with respect to x

I got a huge amount of information, but I'd like to focus on this plot that was given:

Can my colleagues show how to do this plot?

It's also interesting that Mathematica gives this answer:

In[91]:= Integrate[Sec[x], x]

Out[91]= -Log[Cos[x/2] - Sin[x/2]] + Log[Cos[x/2] + Sin[x/2]]

But if we click on Step-by-step-solutions, Wolfram Alpha gives this answer:

Which is similar to the hand-calculated solution

$$\ln|\sec x+\tan x|+C$$

found by students in Calculus II.

• Commented Jan 2, 2017 at 19:38

It depends on the CAS system. $\int \sec(t) \, dt$ gives

Mathematica:     ln(cos(t/2)+sin(t/2))-ln(cos(t/2)-sin(t/2))
Wolfram/ALpha:   ln(tan(t)+sec(t))+ constant
Rubi:            arctanh(sin(t))
Fricas:          1/2 ( ln(1+sin(t)) - ln(1-sin(t)) )
Maple            ln(sec(t)+tan(t))
Derive 6.10      LN(TAN((2*t + pi)/4))
Maxima           log((1+sin(x))/cos(x))


As for your plot, you can do

expr = Log[Sec[x] + Tan[x]];
Plot[{Re@expr, Im@expr}, {x, -2 Pi, 2 Pi}, PlotStyle -> {Blue, Red},
PlotLegends -> {"real part", "imaginary part"},