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:

enter image description here

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:

enter image description here

Which is similar to the hand-calculated solution

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

found by students in Calculus II.


1 Answer 1


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"}, 
    PlotLabel -> TraditionalForm[expr]]

Mathematica graphics

reference: sci.math.symbolic

  • $\begingroup$ Really nice answer. I learned a lot from your help. Thanks. $\endgroup$
    – David
    Commented Jan 2, 2017 at 23:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.