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

This question already has an answer here:

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.

## marked as duplicate by Michael E2 plotting StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Jan 3 '17 at 1:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

• – Michael E2 Jan 2 '17 at 19:38

## 1 Answer

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]]


reference: sci.math.symbolic

• Really nice answer. I learned a lot from your help. Thanks. – David Jan 2 '17 at 23:45