\(\int (a+b \cos (c+d x)) \sec ^2(c+d x) \, dx\) [412]

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [A] (verified)
Fricas [B] (verification not implemented)
Sympy [F]
Maxima [A] (verification not implemented)
Giac [B] (verification not implemented)
Mupad [B] (verification not implemented)
Reduce [B] (verification not implemented)

Optimal result

Integrand size = 19, antiderivative size = 24 \[ \int (a+b \cos (c+d x)) \sec ^2(c+d x) \, dx=\frac {b \text {arctanh}(\sin (c+d x))}{d}+\frac {a \tan (c+d x)}{d} \] Output:

b*arctanh(sin(d*x+c))/d+a*tan(d*x+c)/d
 

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 24, normalized size of antiderivative = 1.00 \[ \int (a+b \cos (c+d x)) \sec ^2(c+d x) \, dx=\frac {b \coth ^{-1}(\sin (c+d x))}{d}+\frac {a \tan (c+d x)}{d} \] Input:

Integrate[(a + b*Cos[c + d*x])*Sec[c + d*x]^2,x]
 

Output:

(b*ArcCoth[Sin[c + d*x]])/d + (a*Tan[c + d*x])/d
 

Rubi [A] (verified)

Time = 0.29 (sec) , antiderivative size = 24, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.316, Rules used = {3042, 3227, 3042, 4254, 24, 4257}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \sec ^2(c+d x) (a+b \cos (c+d x)) \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {a+b \sin \left (c+d x+\frac {\pi }{2}\right )}{\sin \left (c+d x+\frac {\pi }{2}\right )^2}dx\)

\(\Big \downarrow \) 3227

\(\displaystyle a \int \sec ^2(c+d x)dx+b \int \sec (c+d x)dx\)

\(\Big \downarrow \) 3042

\(\displaystyle a \int \csc \left (c+d x+\frac {\pi }{2}\right )^2dx+b \int \csc \left (c+d x+\frac {\pi }{2}\right )dx\)

\(\Big \downarrow \) 4254

\(\displaystyle b \int \csc \left (c+d x+\frac {\pi }{2}\right )dx-\frac {a \int 1d(-\tan (c+d x))}{d}\)

\(\Big \downarrow \) 24

\(\displaystyle b \int \csc \left (c+d x+\frac {\pi }{2}\right )dx+\frac {a \tan (c+d x)}{d}\)

\(\Big \downarrow \) 4257

\(\displaystyle \frac {a \tan (c+d x)}{d}+\frac {b \text {arctanh}(\sin (c+d x))}{d}\)

Input:

Int[(a + b*Cos[c + d*x])*Sec[c + d*x]^2,x]
 

Output:

(b*ArcTanh[Sin[c + d*x]])/d + (a*Tan[c + d*x])/d
 

Defintions of rubi rules used

rule 24
Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3227
Int[((b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*sin[(e_.) + (f_.)*(x 
_)]), x_Symbol] :> Simp[c   Int[(b*Sin[e + f*x])^m, x], x] + Simp[d/b   Int 
[(b*Sin[e + f*x])^(m + 1), x], x] /; FreeQ[{b, c, d, e, f, m}, x]
 

rule 4254
Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Simp[-d^(-1)   Subst[Int[Exp 
andIntegrand[(1 + x^2)^(n/2 - 1), x], x], x, Cot[c + d*x]], x] /; FreeQ[{c, 
 d}, x] && IGtQ[n/2, 0]
 

rule 4257
Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] 
 /; FreeQ[{c, d}, x]
 
Maple [A] (verified)

Time = 2.62 (sec) , antiderivative size = 30, normalized size of antiderivative = 1.25

method result size
derivativedivides \(\frac {\tan \left (d x +c \right ) a +b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}\) \(30\)
default \(\frac {\tan \left (d x +c \right ) a +b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}\) \(30\)
parts \(\frac {a \tan \left (d x +c \right )}{d}+\frac {b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}\) \(32\)
risch \(\frac {2 i a}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}+\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{d}-\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{d}\) \(59\)
parallelrisch \(\frac {\cos \left (d x +c \right ) b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-\cos \left (d x +c \right ) b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+a \sin \left (d x +c \right )}{\cos \left (d x +c \right ) d}\) \(63\)
norman \(\frac {-\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}-\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{d}}{\left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right ) \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right )}+\frac {b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}-\frac {b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}\) \(101\)

Input:

int((a+cos(d*x+c)*b)*sec(d*x+c)^2,x,method=_RETURNVERBOSE)
 

Output:

1/d*(tan(d*x+c)*a+b*ln(sec(d*x+c)+tan(d*x+c)))
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 60 vs. \(2 (24) = 48\).

Time = 0.08 (sec) , antiderivative size = 60, normalized size of antiderivative = 2.50 \[ \int (a+b \cos (c+d x)) \sec ^2(c+d x) \, dx=\frac {b \cos \left (d x + c\right ) \log \left (\sin \left (d x + c\right ) + 1\right ) - b \cos \left (d x + c\right ) \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, a \sin \left (d x + c\right )}{2 \, d \cos \left (d x + c\right )} \] Input:

integrate((a+b*cos(d*x+c))*sec(d*x+c)^2,x, algorithm="fricas")
 

Output:

1/2*(b*cos(d*x + c)*log(sin(d*x + c) + 1) - b*cos(d*x + c)*log(-sin(d*x + 
c) + 1) + 2*a*sin(d*x + c))/(d*cos(d*x + c))
 

Sympy [F]

\[ \int (a+b \cos (c+d x)) \sec ^2(c+d x) \, dx=\int \left (a + b \cos {\left (c + d x \right )}\right ) \sec ^{2}{\left (c + d x \right )}\, dx \] Input:

integrate((a+b*cos(d*x+c))*sec(d*x+c)**2,x)
 

Output:

Integral((a + b*cos(c + d*x))*sec(c + d*x)**2, x)
 

Maxima [A] (verification not implemented)

Time = 0.04 (sec) , antiderivative size = 38, normalized size of antiderivative = 1.58 \[ \int (a+b \cos (c+d x)) \sec ^2(c+d x) \, dx=\frac {b {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 2 \, a \tan \left (d x + c\right )}{2 \, d} \] Input:

integrate((a+b*cos(d*x+c))*sec(d*x+c)^2,x, algorithm="maxima")
 

Output:

1/2*(b*(log(sin(d*x + c) + 1) - log(sin(d*x + c) - 1)) + 2*a*tan(d*x + c)) 
/d
 

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 63 vs. \(2 (24) = 48\).

Time = 0.51 (sec) , antiderivative size = 63, normalized size of antiderivative = 2.62 \[ \int (a+b \cos (c+d x)) \sec ^2(c+d x) \, dx=\frac {b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - \frac {2 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1}}{d} \] Input:

integrate((a+b*cos(d*x+c))*sec(d*x+c)^2,x, algorithm="giac")
 

Output:

(b*log(abs(tan(1/2*d*x + 1/2*c) + 1)) - b*log(abs(tan(1/2*d*x + 1/2*c) - 1 
)) - 2*a*tan(1/2*d*x + 1/2*c)/(tan(1/2*d*x + 1/2*c)^2 - 1))/d
 

Mupad [B] (verification not implemented)

Time = 39.65 (sec) , antiderivative size = 47, normalized size of antiderivative = 1.96 \[ \int (a+b \cos (c+d x)) \sec ^2(c+d x) \, dx=\frac {2\,b\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d}-\frac {2\,a\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2-1\right )} \] Input:

int((a + b*cos(c + d*x))/cos(c + d*x)^2,x)
 

Output:

(2*b*atanh(tan(c/2 + (d*x)/2)))/d - (2*a*tan(c/2 + (d*x)/2))/(d*(tan(c/2 + 
 (d*x)/2)^2 - 1))
 

Reduce [B] (verification not implemented)

Time = 0.16 (sec) , antiderivative size = 62, normalized size of antiderivative = 2.58 \[ \int (a+b \cos (c+d x)) \sec ^2(c+d x) \, dx=\frac {-\cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) b +\cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) b +\sin \left (d x +c \right ) a}{\cos \left (d x +c \right ) d} \] Input:

int((a+b*cos(d*x+c))*sec(d*x+c)^2,x)
 

Output:

( - cos(c + d*x)*log(tan((c + d*x)/2) - 1)*b + cos(c + d*x)*log(tan((c + d 
*x)/2) + 1)*b + sin(c + d*x)*a)/(cos(c + d*x)*d)